OOops
[platal.git] / modules / platal.php
index 1fa6352..f57f270 100644 (file)
@@ -21,7 +21,7 @@
 
 function bugize($list)
 {
-    $list = preg_split('/,/', Env::s('libs'), -1, PREG_SPLIT_NO_EMPTY);
+    $list = preg_split('/,/', $list, -1, PREG_SPLIT_NO_EMPTY);
     $ans  = array();
 
     foreach ($list as $bug) {
@@ -43,15 +43,15 @@ class PlatalModule extends PLModule
             'changelog'         => $this->make_hook('changelog', AUTH_PUBLIC),
 
             // Preferences thingies
-            'prefs'             => $this->make_hook('prefs',     AUTH_COOKIE),
-            'prefs/rss'         => $this->make_hook('prefs_rss', AUTH_COOKIE),
-            'prefs/webredirect' => $this->make_hook('webredir',  AUTH_MDP, 'mail'),
-            'prefs/skin'        => $this->make_hook('skin',      AUTH_COOKIE),
+            'prefs'             => $this->make_hook('prefs',     AUTH_COOKIE, 'user'),
+            'prefs/rss'         => $this->make_hook('prefs_rss', AUTH_COOKIE, 'user'),
+            'prefs/webredirect' => $this->make_hook('webredir',  AUTH_MDP,    'mail'),
+            'prefs/skin'        => $this->make_hook('skin',      AUTH_COOKIE, 'user'),
 
             // password related thingies
-            'password'          => $this->make_hook('password',  AUTH_MDP),
+            'password'          => $this->make_hook('password',  AUTH_MDP,    'user'),
             'tmpPWD'            => $this->make_hook('tmpPWD',    AUTH_PUBLIC),
-            'password/smtp'     => $this->make_hook('smtppass',  AUTH_MDP, 'mail'),
+            'password/smtp'     => $this->make_hook('smtppass',  AUTH_MDP,    'mail'),
             'recovery'          => $this->make_hook('recovery',  AUTH_PUBLIC),
             'exit'              => $this->make_hook('exit',      AUTH_PUBLIC),
             'review'            => $this->make_hook('review',    AUTH_PUBLIC),
@@ -229,7 +229,7 @@ class PlatalModule extends PLModule
 
         $page->changeTpl('platal/password.tpl');
         $page->setTitle('Mon mot de passe');
-        $page->assign('do_auth', false);
+        $page->assign('do_auth', 0);
     }
 
     function handler_smtppass($page)
@@ -276,7 +276,7 @@ class PlatalModule extends PLModule
             return;
         }
 
-        if (!ereg('[0-3][0-9][0-1][0-9][1][9]([0-9]{2})', Env::v('birth'))) {
+        if (!preg_match('/^[0-3][0-9][0-1][0-9][1][9]([0-9]{2})$/', Env::v('birth'))) {
             $page->trigError('Date de naissance incorrecte ou incohérente');
             return;
         }
@@ -340,8 +340,8 @@ Si en cliquant dessus tu n'y arrives pas, copie intégralement l'adresse dans la
 Polytechnique.org
 \"Le portail des élèves & anciens élèves de l'École polytechnique\"
 
-Email envoyé à ".Env::v('login') . (Post::has('email') ? "
-Adresse de secours : " . Post::v('email') : ""));
+Email envoyé à ".Env::v('login') . (is_null($to) ? '' : '
+Adresse de secours : ' . $to));
         $mymail->send();
 
         S::logger($user->id())->log('recovery', is_null($to) ? $inactives_to . ', ' . $user->bestEmail() : $to);
@@ -396,7 +396,7 @@ Adresse de secours : " . Post::v('email') : ""));
                                        $uid);
             $page->changeTpl('platal/password.tpl');
             $page->assign('hruid', $hruid);
-            $page->assign('do_auth', true);
+            $page->assign('do_auth', 1);
         }
     }