X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations%2Fphotos.inc.php;h=60b6ae162f237870b8267cddaf975d6c90f784e3;hb=c76545c351fae4e2298624ff9ee5bf854dc5a5b6;hp=1aac21673606df9ca6bad31532761d8b63671bad;hpb=34465ab035104f739a54ec62660f04f874448627;p=platal.git diff --git a/include/validations/photos.inc.php b/include/validations/photos.inc.php index 1aac216..60b6ae1 100644 --- a/include/validations/photos.inc.php +++ b/include/validations/photos.inc.php @@ -21,7 +21,7 @@ // {{{ class PhotoReq -class PhotoReq extends Validate +class PhotoReq extends ProfileValidate { // {{{ properties @@ -43,9 +43,9 @@ class PhotoReq extends Validate // }}} // {{{ constructor - public function __construct(User &$_user, PlUpload &$upload, $_stamp=0) + public function __construct(User &$_user, Profile &$_profile, PlUpload &$upload, $_stamp = 0) { - parent::__construct($_user, true, 'photo', $_stamp); + parent::__construct($_user, $_profile, 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->trigError('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(); @@ -64,7 +64,7 @@ class PhotoReq extends Validate } // }}} - // {{{ function isValid() + // {{{ function isValid() public function isValid() { @@ -74,9 +74,9 @@ class PhotoReq extends Validate // }}} // {{{ function get_request() - static public function get_request($uid) + static public function get_request($pid) { - return parent::get_typed_request($uid, 'photo'); + return parent::get_typed_request($pid, 'photo'); } // }}} @@ -103,7 +103,7 @@ class PhotoReq extends Validate if (isset($_FILES['userfile'])) { $upload =& PlUpload::get($_FILES['userfile'], S::user()->login(), 'photo'); if (!$upload) { - $this->trigError('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); @@ -137,11 +137,10 @@ class PhotoReq extends Validate public function commit() { - //require_once 'notifs.inc.php'; XDB::execute('REPLACE INTO profile_photos (pid, attachmime, attach, x, y) VALUES ({?},{?},{?},{?},{?})', - $this->user->profile()->id(), $this->mimetype, $this->data, $this->x, $this->y); - //register_watch_op($this->user->id(), WATCH_FICHE, '', 'photo'); + $this->profile->id(), $this->mimetype, $this->data, $this->x, $this->y); + return true; }