X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=modules%2Fprofile%2Fpage.inc.php;h=3b0c9ca856f2e83a2fe816b2c57abcd02fe55b2b;hb=eb5632361d837d1d4f813d4f77e52d6702a0d523;hp=e259f1e880d9e04e878bc116ade73be3e37b4589;hpb=dd9bac8f7903e9924525ad8db3e38650ff5ad1b6;p=platal.git diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index e259f1e..3b0c9ca 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -1,6 +1,6 @@ trig('URL Incorrecte : une url doit commencer par http:// ou https:// ou ftp://' - . ' et ne pas contenir de caractères interdits'); + Platal::page()->trigError('URL Incorrecte : une url doit commencer par http:// ou https:// ou ftp://' + . ' et ne pas contenir de caractères interdits'); } return $value; } @@ -69,11 +68,9 @@ class ProfileEmail extends ProfileNoSave return isset($page->values[$field]) ? $page->values[$field] : S::v($field); } $value = trim($value); - require_once 'xorg.misc.inc.php'; $success = empty($value) || isvalid_email($value); if (!$success) { - global $page; - $page->trig('Adresse Email invalide'); + Platal::page()->trigError('Adresse Email invalide'); } return $value; } @@ -89,8 +86,7 @@ class ProfileTel extends ProfileNoSave } $success = !preg_match('/[<>{}@&#~\/:;?,!§*_`\[\]|%$^=]/', $value, $matches); if (!$success) { - global $page; - $page->trig('Le numéro de téléphone contient un caractère interdit : ' . pl_entities($matches[0][0])); + Platal::page()->trigError('Le numéro de téléphone contient un caractère interdit : ' . pl_entities($matches[0][0])); } return $value; } @@ -135,16 +131,14 @@ class ProfileDate extends ProfileNoSave } else { $success = preg_match('@(\d{2})/(\d{2})/(\d{4})@', $value, $matches); if (!$success) { - global $page; - $page->trig("Les dates doivent être au format jj/mm/aaaa"); + Platal::page()->trigError("Les dates doivent être au format jj/mm/aaaa"); } else { $day = (int)$matches[1]; $month = (int)$matches[2]; $year = (int)$matches[3]; $success = ($day > 0 && $day <= 31) && ($month > 0 && $month <= 12) && ($year > 1900 && $year <= 2020); if (!$success) { - global $page; - $page->trig("La date n'a pas une valeur valide"); + Platal::page()->trigError("La date n'a pas une valeur valide"); } } } @@ -259,8 +253,7 @@ abstract class ProfilePage implements PlWizardPage register_watch_op(S::i('uid'), WATCH_FICHE); } global $platal; - $log =& $_SESSION['log']; - $log->log('profil', $platal->pl_self(1)); + S::logger()->log('profil', $platal->pl_self(1)); } protected function checkChanges() @@ -290,11 +283,11 @@ abstract class ProfilePage implements PlWizardPage return 'profile/base.tpl'; } - protected function _prepare(PlatalPage &$page, $id) + protected function _prepare(PlPage &$page, $id) { } - public function prepare(PlatalPage &$page, $id) + public function prepare(PlPage &$page, $id) { if (count($this->values) == 0) { $this->fetchData(); @@ -307,7 +300,7 @@ abstract class ProfilePage implements PlWizardPage $page->assign('errors', $this->errors); } - public function process() + public function process(&$global_success) { $global_success = true; $this->fetchData(); @@ -329,11 +322,15 @@ abstract class ProfilePage implements PlWizardPage } return Post::has('next_page') ? PlWizard::NEXT_PAGE : PlWizard::CURRENT_PAGE; } - global $page; - $page->trig("Certains champs n'ont pas pu être validés, merci de corriger les informations " - . "de ton profil et de revalider ta demande"); + Platal::page()->trigError("Certains champs n'ont pas pu être validés, merci de corriger les informations " + . "de ton profil et de revalider ta demande."); return PlWizard::CURRENT_PAGE; } + + public function success() + { + return 'Ton profil a bien été mis à jour.'; + } } require_once dirname(__FILE__) . '/general.inc.php';