fixes
[platal.git] / modules / platal.php
index 737d5ee..9e2f0f2 100644 (file)
@@ -38,7 +38,8 @@ class PlatalModule extends PLModule
     function handlers()
     {
         return array(
-            'cacert.pem'  => $this->make_hook('cacert', AUTH_PUBLIC),
+            'index'       => $this->make_hook('index',     AUTH_PUBLIC),
+            'cacert.pem'  => $this->make_hook('cacert',    AUTH_PUBLIC),
             'changelog'   => $this->make_hook('changelog', AUTH_PUBLIC),
 
             // Preferences thingies
@@ -60,6 +61,13 @@ class PlatalModule extends PLModule
         );
     }
 
+    function handler_index(&$page)
+    {
+        if (logged()) {
+            redirect("events");
+        }
+    }
+
     function handler_cacert(&$page)
     {
         $data = file_get_contents('/etc/ssl/xorgCA/cacert.pem');
@@ -119,8 +127,6 @@ class PlatalModule extends PLModule
         }
 
         $page->assign('prefs', $globals->hook->prefs());
-
-        return PL_OK;
     }
 
     function handler_webredir(&$page)
@@ -155,8 +161,6 @@ class PlatalModule extends PLModule
                                       WHERE user_id = {?}',
                                     Session::getInt('uid'));
         $page->assign('carva', $res->fetchOneCell());
-
-        return PL_OK;
     }
 
     function handler_prefs_rss(&$page)
@@ -171,8 +175,6 @@ class PlatalModule extends PLModule
             $this->__set_rss_state(true);
             $page->trig("Ton Fil RSS est activé.");
         }
-
-        return PL_OK;
     }
 
     function handler_password(&$page)
@@ -203,8 +205,6 @@ class PlatalModule extends PLModule
         $page->changeTpl('motdepasse.tpl');
         $page->addJsLink('javascript/motdepasse.js');
         $page->assign('xorg_title','Polytechnique.org - Mon mot de passe');
-
-        return PL_OK;
     }
 
     function handler_smtppass(&$page)
@@ -236,8 +236,6 @@ class PlatalModule extends PLModule
                                        FROM auth_user_md5
                                       WHERE user_id = {?}", $uid);
         $page->assign('actif', $res->fetchOneCell());
-
-        return PL_OK;
     }
 
     function handler_recovery(&$page)
@@ -247,7 +245,7 @@ class PlatalModule extends PLModule
         $page->changeTpl('recovery.tpl');
 
         if (!Env::has('login') || !Env::has('birth')) {
-            return PL_OK;
+            return;
         }
 
         if (!ereg('[0-3][0-9][0-1][0-9][1][9]([0-9]{2})', Env::get('birth'))) {
@@ -301,8 +299,6 @@ Mail envoy
         } else {
             $page->trig('Pas de résultat correspondant aux champs entrés dans notre base de données.');
         }
-
-        return PL_OK;
     }
 
     function handler_tmpPWD(&$page, $certif = null)
@@ -333,8 +329,6 @@ Mail envoy
             $page->changeTpl('motdepasse.tpl');
             $page->addJsLink('javascript/motdepasse.js');
         }
-
-        return PL_OK;
     }
 
     function handler_skin(&$page)
@@ -362,7 +356,6 @@ Mail envoy
                  WHERE skin_tpl != '' AND ext != ''
               GROUP BY id ORDER BY s.date DESC";
         $page->assign_by_ref('skins', $globals->xdb->iterator($sql));
-        return PL_OK;
     }
 
     function handler_exit(&$page, $level = null)
@@ -407,7 +400,6 @@ Mail envoy
         } else {
             $page->changeTpl('exit.tpl');
         }
-        return PL_OK;
     }
 
     function handler_rss(&$page, $user = null, $hash = null)
@@ -426,8 +418,6 @@ Mail envoy
                   WHERE  u.user_id = {?} AND FIND_IN_SET(e.flags, "valide")
                                          AND peremption >= NOW()', $uid);
         $page->assign('rss', $rss);
-
-        return PL_OK;
     }
 }