From: Stéphane Jacob Date: Wed, 6 Aug 2008 18:03:58 +0000 (+0200) Subject: Fixes a few issues due to the use of the core. X-Git-Tag: xorg/1.0.0~332^2~546 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=ad3fee9d6daba9581f7acc061b76da8f7cf7256d;p=platal.git Fixes a few issues due to the use of the core. --- diff --git a/include/validations.inc.php b/include/validations.inc.php index 2f11046..d5cd9e0 100644 --- a/include/validations.inc.php +++ b/include/validations.inc.php @@ -140,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); diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index 64020ed..3437515 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -290,18 +290,17 @@ function start_connexion ($uid, $identified) send_warning_mail($mail_subject); $_SESSION = array(); $_SESSION['perms'] = new FlagSet(); - global $page; $newpage = false; - if (!$page) { + if (!Platal::page()) { require_once 'xorg.inc.php'; new_skinned_page('platal/index.tpl'); $newpage = true; } - $page->trigError("Une erreur est survenue lors de la procédure d'authentification. " + Platal::page()->trigError("Une erreur est survenue lors de la procédure d'authentification. " ."Merci de contacter au plus vite " ."support@polytechnique.org"); if ($newpage) { - $page->run(); + Platal::page()->run(); } return false; } diff --git a/modules/profile/general.inc.php b/modules/profile/general.inc.php index a63540e..c64f3a3 100644 --- a/modules/profile/general.inc.php +++ b/modules/profile/general.inc.php @@ -116,19 +116,18 @@ class ProfileEmailDirectory implements ProfileSetting public function value(ProfilePage &$page, $field, $value, &$success) { - $p = $page; - global $page; + $p = Platal::page(); $success = true; if (!is_null($value)) { $email_stripped = strtolower(trim($value)); - if ((!isvalid_email($email_stripped)) && ($email_stripped) && ($p->values['email_directory'] == "new@example.org")) { - $page->assign('email_error', '1'); - $page->assign('email_directory_error', $email_stripped); - $page->trigError('Adresse Email invalide'); + if ((!isvalid_email($email_stripped)) && ($email_stripped) && ($page->values['email_directory'] == "new@example.org")) { + $p->assign('email_error', '1'); + $p->assign('email_directory_error', $email_stripped); + $p->trigError('Adresse Email invalide'); $success = false; } else { - $page->assign('email_error', '0'); + $p->assign('email_error', '0'); } } return $value; diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index b380c3e..ec5e3eb 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -86,8 +86,7 @@ class ProfileNumber extends ProfileNoSave $value = trim($value); $success = empty($value) || is_numeric($value); if (!$success) { - global $page; - $page->trigError('Numéro invalide'); + Platal::page()->trigError('Numéro invalide'); } return $value; } @@ -110,8 +109,7 @@ class ProfileTel extends ProfileNoSave $value = format_display_number($value,$error); $success = !$error; if (!$success) { - global $page; - $page->trigError('Le préfixe international du numéro de téléphone est inconnu. '); + Platal::page()->trigError('Le préfixe international du numéro de téléphone est inconnu. '); } return $value; }