X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fevts.inc.php;h=67076a02f199c0bb3a5e0056915eabf2ec5d8581;hb=9dd0544eb8fa39338b76e30c37022a1f76ed83eb;hp=c33ce5e06309cff271f3ec62426e1db8983ec6c5;hpb=527ccdb5d9e3a120168331f4aa3070f6c574228e;p=platal.git diff --git a/include/validations/evts.inc.php b/include/validations/evts.inc.php index c33ce5e..67076a0 100644 --- a/include/validations/evts.inc.php +++ b/include/validations/evts.inc.php @@ -1,6 +1,6 @@ titre = $_titre; $this->texte = $_texte; $this->pmin = $_pmin; $this->pmax = $_pmax; - $this->peremption = $_peremption; + $this->expiration = $_expiration; $this->comment = $_comment; if ($upload) { $this->readImage($upload); @@ -58,7 +58,7 @@ class EvtReq extends Validate // }}} // {{{ function readImage() - private function readImage(PlUpload &$upload) + private function readImage(PlUpload $upload) { if ($upload->exists() && $upload->isType('image')) { list($this->imgx, $this->imgy, $this->imgtype) = $upload->imageInfo(); @@ -92,9 +92,9 @@ class EvtReq extends Validate $this->texte = Env::v('texte'); $this->pmin = Env::i('promo_min'); $this->pmax = Env::i('promo_max'); - $this->peremption = Env::v('peremption'); + $this->expiration = Env::v('expiration'); if (@$_FILES['image']['tmp_name']) { - $upload = PlUpload::get($_FILES['image'], S::v('forlife'), 'event'); + $upload = PlUpload::get($_FILES['image'], S::user()->login(), 'event'); if (!$upload) { $this->trigError("Impossible de télécharger le fichier"); } elseif (!$upload->isType('image')) { @@ -134,28 +134,27 @@ class EvtReq extends Validate public function commit() { - if (XDB::execute("INSERT INTO evenements - SET user_id = {?}, creation_date=NOW(), titre={?}, texte={?}, - peremption={?}, promo_min={?}, promo_max={?}, flags=CONCAT(flags,',valide,wiki')", - $this->uid, $this->titre, $this->texte, - $this->peremption, $this->pmin, $this->pmax)) { + /* TODO: refines this filter on promotions by using userfilter. */ + 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 evenements_photo + 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 'user.func.inc.php'; - $forlife = get_user_forlife($this->uid); require_once 'banana/forum.inc.php'; - $banana = new ForumsBanana($forlife); + $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 evenements + XDB::execute("UPDATE announces SET creation_date = creation_date, post_id = {?} WHERE id = {?}", $post, $eid); }