<?php
/***************************************************************************
- * Copyright (C) 2003-2009 Polytechnique.org *
+ * Copyright (C) 2003-2010 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
// {{{ class PhotoReq
-class PhotoReq extends Validate
+class PhotoReq extends ProfileValidate
{
// {{{ properties
public $valid = false;
public $rules = "Refuser les photos copyrightées, de mineurs, ou ayant
- un caractère pornographique, violent, etc... Si une photo est mal
+ un caractère pornographique, violent… Si une photo est mal
cadrée (20% de photo et 80% de blanc par exemple), si c'est un
camarade antique, on lui arrange sinon on lui
refuse en lui expliquant gentiment le problème. Idem si les dimensions de
// }}}
// {{{ 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);
}
{
$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();
}
// }}}
- // {{{ function isValid()
+ // {{{ function isValid()
public function isValid()
{
// }}}
// {{{ 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');
}
// }}}
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);
public function commit()
{
- require_once 'notifs.inc.php';
- XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y)
+ XDB::execute('REPLACE INTO profile_photos (pid, attachmime, attach, x, y)
VALUES ({?},{?},{?},{?},{?})',
- $this->user->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;
}