X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fvalidations.inc.php;h=d5cd9e0da778189a655c14ff316e3e264cd8334d;hb=d0edeb70f254ed642b59c7c3636b7802266bcfe4;hp=981451088ff9382ec3611b318dfb6d798b24db18;hpb=a7d35093a40837b3a17d7fbac0259995f084812c;p=platal.git diff --git a/include/validations.inc.php b/include/validations.inc.php index 9814510..d5cd9e0 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -21,7 +21,8 @@ define('SIZE_MAX', 32768); -require_once dirname(__FILE__) . '/../classes/xdb.php'; +global $globals; +require_once $globals->spoolroot . '/core/classes/xdb.php'; /** * Iterator class, that lists objects through the database @@ -116,7 +117,7 @@ abstract class Validate $this->uid, $this->type, $this, $this->stamp); global $globals; - update_NbValid(); + $globals->updateNbValid(); return true; } @@ -139,6 +140,8 @@ abstract class Validate */ public function clean() { + global $globals; + if ($this->unique) { $success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?}', $this->uid, $this->type); @@ -146,7 +149,7 @@ abstract class Validate $success = XDB::execute('DELETE FROM requests WHERE user_id={?} AND type={?} AND stamp={?}', $this->uid, $this->type, $this->stamp); } - update_NbValid(); + $globals->updateNbValid(); return $success; } @@ -210,7 +213,7 @@ abstract class Validate if ($this->commit()) { $this->sendmail(true); $this->clean(); - $this->trigSuccess('Mail de validation envoyé'); + $this->trigSuccess('Email de validation envoyé'); return true; } else { $this->trigError('Erreur lors de la validation'); @@ -222,7 +225,7 @@ abstract class Validate if (Env::v('comm')) { $this->sendmail(false); $this->clean(); - $this->trigSuccess('Mail de refus envoyé'); + $this->trigSuccess('Email de refus envoyé'); return true; } else { $this->trigError('pas de motivation pour le refus !!!'); @@ -258,20 +261,17 @@ abstract class Validate protected function trigError($msg) { - global $page; - $page->trigError($msg); + Platal::page()->trigError($msg); } protected function trigWarning($msg) { - global $page; - $page->trigWarning($msg); + Platal::page()->trigWarning($msg); } protected function trigSuccess($msg) { - global $page; - $page->trigSuccess($msg); + Platal::page()->trigSuccess($msg); } // }}}