projects
/
platal.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge commit 'origin/platal-0.10.0'
[platal.git]
/
include
/
validations
/
photos.inc.php
diff --git
a/include/validations/photos.inc.php
b/include/validations/photos.inc.php
index
9010dea
..
2a2fec7
100644
(file)
--- a/
include/validations/photos.inc.php
+++ b/
include/validations/photos.inc.php
@@
-1,6
+1,6
@@
<?php
/***************************************************************************
<?php
/***************************************************************************
- * Copyright (C) 2003-200
7
Polytechnique.org *
+ * Copyright (C) 2003-200
9
Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
@@
-43,9
+43,9
@@
class PhotoReq extends Validate
// }}}
// {{{ constructor
// }}}
// {{{ constructor
- public function __construct(
$_uid
, PlUpload &$upload, $_stamp=0)
+ public function __construct(
User &$_user
, PlUpload &$upload, $_stamp=0)
{
{
- parent::__construct($_u
id
, true, 'photo', $_stamp);
+ parent::__construct($_u
ser
, true, 'photo', $_stamp);
$this->read($upload);
}
$this->read($upload);
}
@@
-54,15
+54,15
@@
class PhotoReq extends Validate
private function read(PlUpload &$upload)
{
private function read(PlUpload &$upload)
{
- $this->valid = $upload->resizeImage(240, 300, 160, 0, SIZE_MAX);
+ $this->valid = $upload->resizeImage(240, 300, 160, 0, SIZE_MAX);
if (!$this->valid) {
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->trig
Error
('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();
$upload->rm();
}
}
$this->data = $upload->getContents();
list($this->x, $this->y, $this->mimetype) = $upload->imageInfo();
$upload->rm();
}
-
+
// }}}
// {{{ function isValid()
// }}}
// {{{ function isValid()
@@
-76,7
+76,7
@@
class PhotoReq extends Validate
static public function get_request($uid)
{
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'])) {
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) {
if (!$upload) {
- $this->trig('Une erreur est survenue lors du téléchargement du fichier');
+ $this->trig
Error
('Une erreur est survenue lors du téléchargement du fichier');
return false;
}
$this->read($upload);
return false;
}
$this->read($upload);
@@
-137,11
+137,11
@@
class PhotoReq extends Validate
public function commit()
{
public function commit()
{
+ require_once 'notifs.inc.php';
XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y)
VALUES ({?},{?},{?},{?},{?})',
XDB::execute('REPLACE INTO photo (uid, attachmime, attach, x, y)
VALUES ({?},{?},{?},{?},{?})',
- $this->uid, $this->mimetype, $this->data, $this->x, $this->y);
- require_once('notifs.inc.php');
- register_watch_op($this->uid, WATCH_FICHE);
+ $this->user->id(), $this->mimetype, $this->data, $this->x, $this->y);
+ register_watch_op($this->user->id(), WATCH_FICHE, '', 'photo');
return true;
}
return true;
}