X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fphotos.inc.php;h=7194e04d0dcf73b7dfacec125559d5704962a0b2;hb=f2c150a0b20f222ddadabe7c0a307b60cec86a54;hp=26f45f8a6906665ac16e3cc5c8cda7ee27361ddc;hpb=dd9bac8f7903e9924525ad8db3e38650ff5ad1b6;p=platal.git diff --git a/include/validations/photos.inc.php b/include/validations/photos.inc.php index 26f45f8..7194e04 100644 --- a/include/validations/photos.inc.php +++ b/include/validations/photos.inc.php @@ -43,9 +43,9 @@ class PhotoReq extends Validate // }}} // {{{ constructor - public function __construct($_uid, PlUpload &$upload, $_stamp=0) + public function __construct(User &$_user, PlUpload &$upload, $_stamp=0) { - parent::__construct($_uid, true, 'photo', $_stamp); + parent::__construct($_user, true, 'photo', $_stamp); $this->read($upload); } @@ -56,7 +56,7 @@ class PhotoReq extends Validate { $this->valid = $upload->resizeImage(240, 300, 160, 0, SIZE_MAX); if (!$this->valid) { - $this->trig('Le fichier que tu as transmis n\'est pas une image valide, ou est trop gros pour être traité'); + $this->trigError('Le fichier que tu as transmis n\'est pas une image valide, ou est trop gros pour être traité'); } $this->data = $upload->getContents(); list($this->x, $this->y, $this->mimetype) = $upload->imageInfo(); @@ -76,7 +76,7 @@ class PhotoReq extends Validate static public function get_request($uid) { - return parent::get_typed_request($uid,'photo'); + return parent::get_typed_request($uid, 'photo'); } // }}} @@ -101,9 +101,9 @@ class PhotoReq extends Validate protected function handle_editor() { if (isset($_FILES['userfile'])) { - $upload =& PlUpload::get($_FILES['userfile'], S::v('forlife'), 'photo'); + $upload =& PlUpload::get($_FILES['userfile'], S::user()->login(), 'photo'); if (!$upload) { - $this->trig('Une erreur est survenue lors du téléchargement du fichier'); + $this->trigError('Une erreur est survenue lors du téléchargement du fichier'); return false; } $this->read($upload); @@ -140,8 +140,8 @@ class PhotoReq extends Validate require_once 'notifs.inc.php'; XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y) VALUES ({?},{?},{?},{?},{?})', - $this->uid, $this->mimetype, $this->data, $this->x, $this->y); - register_watch_op($this->uid, WATCH_FICHE, 'photo'); + $this->user->id(), $this->mimetype, $this->data, $this->x, $this->y); + register_watch_op($this->user->id(), WATCH_FICHE, '', 'photo'); return true; }