Fix RSS encoding, add a disclaimer for xnet announces...
[platal.git] / modules / platal.php
index 7d72369..586b485 100644 (file)
@@ -39,7 +39,7 @@ class PlatalModule extends PLModule
     {
         return array(
             'index'       => $this->make_hook('index',     AUTH_PUBLIC),
-           'cacert.pem'  => $this->make_hook('cacert',    AUTH_PUBLIC),
+           'cacert.pem'  => $this->make_hook('cacert',    AUTH_PUBLIC),
             'changelog'   => $this->make_hook('changelog', AUTH_PUBLIC),
 
             // Preferences thingies
@@ -56,9 +56,6 @@ class PlatalModule extends PLModule
             'recovery'      => $this->make_hook('recovery',  AUTH_PUBLIC),
             'exit'          => $this->make_hook('exit', AUTH_PUBLIC),
             'deconnexion.php' => $this->make_hook('exit', AUTH_PUBLIC),
-
-            // happenings related thingies
-            'rss'         => $this->make_hook('rss',       AUTH_PUBLIC),
         );
     }
 
@@ -73,10 +70,10 @@ class PlatalModule extends PLModule
     {
         $data = file_get_contents("/etc/ssl/xorgCA/cacert.pem","r");
         header("Pragma:");
-       header("Set-Cookie:");
-       header("Cache-Control:");
-       header("Expires:");
-       header("Content-Type: application/x-x509-ca-cert");
+        header("Set-Cookie:");
+        header("Cache-Control:");
+        header("Expires:");
+        header("Content-Type: application/x-x509-ca-cert");
         header("Content-Length: ".strlen($data));
         echo $data;
         exit;
@@ -256,7 +253,7 @@ class PlatalModule extends PLModule
         $res = XDB::query(
                 "SELECT  user_id, naissance
                    FROM  auth_user_md5 AS u
-             INNER JOIN  aliases       AS a ON (u.user_id=a.id AND type!='homonyme')
+             INNER JOIN  aliases       AS a ON (u.user_id=a.id AND type != 'homonyme')
                   WHERE  a.alias={?} AND u.perms IN ('admin','user') AND u.deces=0", $mailorg);
         list($uid, $naissance) = $res->fetchOneRow();
 
@@ -268,8 +265,7 @@ class PlatalModule extends PLModule
             $res   = XDB::query('SELECT email FROM emails WHERE uid = {?} AND NOT FIND_IN_SET("filter", flags)', $uid);
             $mails = implode(', ', $res->fetchColumn());
 
-            require_once "diogenes/diogenes.hermes.inc.php";
-            $mymail = new HermesMailer();
+            $mymail = new PlMailer();
             $mymail->setFrom('"Gestion des mots de passe" <support+password@polytechnique.org>');
             $mymail->addTo($mails);
             $mymail->setSubject('Ton certificat d\'authentification');
@@ -292,7 +288,8 @@ Mail envoy
             $logger = $_SESSION['log'] = new CoreLogger($uid);
             $logger->log('recovery', $emails);
         } else {
-            $page->trig('Pas de résultat correspondant aux champs entrés dans notre base de données.');
+            $page->trig('Les informations que tu as rentrées ne permettent pas de récupérer ton mot de passe.<br />'.
+                        'Si tu as un homonyme, utilise prenom.nom.promo comme login');
         }
     }
 
@@ -347,23 +344,19 @@ Mail envoy
              LEFT JOIN auth_user_quick AS a ON s.id=a.skin
                  WHERE skin_tpl != '' AND ext != ''
               GROUP BY id ORDER BY s.date DESC";
-        $page->assign_by_ref('skins', XDB::iterator($sql));
+        $page->assign('skins', XDB::iterator($sql));
     }
 
     function handler_exit(&$page, $level = null)
     {
         if (S::has('suid')) {
-            if (S::has('suid')) {
-                $a4l  = S::v('forlife');
-                $suid = S::v('suid');
-                $log  = S::v('log');
-                $log->log("suid_stop", S::v('forlife') . " by " . $suid['forlife']);
-                $_SESSION = $suid;
-                S::kill('suid');
-                pl_redirect('admin/utilisateurs.php', 'login='.$a4l);
-            } else {
-                pl_redirect('events');
-            }
+            $a4l  = S::v('forlife');
+            $suid = S::v('suid');
+            $log  = S::v('log');
+            $log->log("suid_stop", S::v('forlife') . " by " . $suid['forlife']);
+            $_SESSION = $suid;
+            S::kill('suid');
+            pl_redirect('admin/user/' . $a4l);
         }
 
         if ($level == 'forget' || $level == 'forgetall') {
@@ -393,22 +386,6 @@ Mail envoy
             $page->changeTpl('exit.tpl');
         }
     }
-
-    function handler_rss(&$page, $user = null, $hash = null)
-    {
-        require_once 'rss.inc.php';
-
-        $uid = init_rss('rss.tpl', $user, $hash);
-
-        $rss = XDB::iterator(
-                'SELECT  e.id, e.titre, e.texte, e.creation_date
-                   FROM  auth_user_md5   AS u
-             INNER JOIN  evenements      AS e ON ( (e.promo_min = 0 || e.promo_min <= u.promo)
-                                                   AND (e.promo_max = 0 || e.promo_max >= u.promo) )
-                  WHERE  u.user_id = {?} AND FIND_IN_SET(e.flags, "valide")
-                                         AND peremption >= NOW()', $uid);
-        $page->assign('rss', $rss);
-    }
 }
 
 ?>