- return XDB::execute(
- "INSERT INTO evenements
- SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?},
- peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide')",
- $this->uid, $this->titre, $this->texte,
- $this->peremption, $this->pmin, $this->pmax);
+ if (XDB::execute("INSERT INTO announces
+ SET uid = {?}, creation_date=NOW(), titre={?}, texte={?},
+ expiration={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')",
+ $this->user->id(), $this->titre, $this->texte,
+ $this->expiration, $this->pmin, $this->pmax)) {
+ $eid = XDB::insertId();
+ if ($this->img) {
+ XDB::execute("INSERT INTO announce_photos
+ SET eid = {?}, attachmime = {?}, x = {?}, y = {?}, attach = {?}",
+ XDB::insertId(), $this->imgtype, $this->imgx, $this->imgy, $this->img);
+ }
+ global $globals;
+ if ($globals->banana->event_forum) {
+ require_once 'banana/forum.inc.php';
+ $banana = new ForumsBanana($this->user);
+ $post = $banana->post($globals->banana->event_forum,
+ $globals->banana->event_reply,
+ $this->titre, MiniWiki::wikiToText($this->texte, false, 0, 80));
+ if ($post != -1) {
+ XDB::execute("UPDATE announces
+ SET creation_date = creation_date, post_id = {?}
+ WHERE id = {?}", $post, $eid);
+ }
+ }
+ return true;
+ }
+ return false;