X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fevts.inc.php;h=7dcbce07e98f81ba548117edc63076a5914c9cdb;hb=f9a8c549deebf96792c3ba423e01545dc7caf95b;hp=f4095304b3e9408cf6f49a69717f529808f5714e;hpb=a8b4ccb6c163277c49fb92427a7bb4ace8469660;p=platal.git diff --git a/include/validations/evts.inc.php b/include/validations/evts.inc.php index f409530..7dcbce0 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')) { @@ -122,10 +122,11 @@ class EvtReq extends Validate protected function _mail_body($isok) { + $you_have = ($this->formal ? 'vous aviez' : 'tu avais'); if ($isok) { - return " L'annonce que tu avais proposée ({$this->titre}) vient d'être validée."; + return " L'annonce que $you_have proposée ({$this->titre}) vient d'être validée."; } else { - return " L'annonce que tu avais proposée ({$this->titre}) a été refusée."; + return " L'annonce que $you_have proposée ({$this->titre}) a été refusée."; } } @@ -134,26 +135,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 'banana/forum.inc.php'; - $banana = new ForumsBanana(User::getSilent($this->uid)); + $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); }