remove acces_smtp.php => password/smtp
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 9 Jul 2006 13:14:24 +0000 (13:14 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sun, 9 Jul 2006 13:14:24 +0000 (13:14 +0000)
git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@405 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/acces_smtp.php [deleted file]
modules/platal.php
templates/acces_smtp.tpl
templates/preferences.tpl

diff --git a/htdocs/acces_smtp.php b/htdocs/acces_smtp.php
deleted file mode 100644 (file)
index ae9812f..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-new_skinned_page('acces_smtp.tpl', AUTH_MDP);
-$page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
-    
-$uid  = Session::getInt('uid');
-$pass = Env::get('smtppass1');
-$log  = Session::getMixed('log');
-
-if ( Env::get('op') == "Valider" && Env::get('smtppass1') == Env::get('smtppass2') && strlen($pass) >= 6 ) {
-
-    $globals->xdb->execute('update auth_user_md5 set smtppass = {?} where user_id = {?}', $pass, $uid);
-    $page->trig('Mot de passe enregistré');
-    $log->log("passwd_ssl");
-
-} elseif (Env::get('op') == "Supprimer") {
-
-    $globals->xdb->execute('update auth_user_md5 set smtppass = "" where user_id = {?}', $uid);
-    $page->trig('Compte SMTP et NNTP supprimé');
-    $log->log("passwd_del");
-
-}
-
-$res = $globals->xdb->query("select IF(smtppass != '', 'actif', '') from auth_user_md5 where user_id = {?}", $uid);
-$page->assign('actif', $res->fetchOneCell());
-$page->run();
-
-// vim:et:sw=4:
-?>
index 73a05a6..930e6db 100644 (file)
@@ -25,13 +25,14 @@ class PlatalModule extends PLModule
     {
         return array(
             // Preferences thingies
-            'prefs'       => $this->make_hook('prefs',     AUTH_COOKIE),
-            'prefs/rss'   => $this->make_hook('prefs_rss', AUTH_COOKIE),
-            'skin'        => $this->make_hook('skin',      AUTH_COOKIE),
+            'prefs'     => $this->make_hook('prefs',     AUTH_COOKIE),
+            'prefs/rss' => $this->make_hook('prefs_rss', AUTH_COOKIE),
+            'skin'      => $this->make_hook('skin',      AUTH_COOKIE),
 
             // password related thingies
-            'password'    => $this->make_hook('password',  AUTH_MDP),
-            'tmpPWD'      => $this->make_hook('tmpPWD',    AUTH_PUBLIC),
+            'password'      => $this->make_hook('password',  AUTH_MDP),
+            'tmpPWD'        => $this->make_hook('tmpPWD',    AUTH_PUBLIC),
+            'password/smtp' => $this->make_hook('smtppass',  AUTH_MDP),
 
             // happenings related thingies
             'rss'         => $this->make_hook('rss',       AUTH_PUBLIC),
@@ -131,6 +132,39 @@ class PlatalModule extends PLModule
         return PL_OK;
     }
 
+    function handler_smtppass(&$page)
+    {
+        global $globals;
+
+        $page->changeTpl('acces_smtp.tpl');
+        $page->assign('xorg_title','Polytechnique.org - Acces SMTP/NNTP');
+
+        $uid  = Session::getInt('uid');
+        $pass = Env::get('smtppass1');
+        $log  = Session::getMixed('log');
+
+        if (Env::get('op') == "Valider" && strlen($pass) >= 6 
+        &&  Env::get('smtppass1') == Env::get('smtppass2')) 
+        {
+            $globals->xdb->execute('UPDATE auth_user_md5 SET smtppass = {?}
+                                     WHERE user_id = {?}', $pass, $uid);
+            $page->trig('Mot de passe enregistré');
+            $log->log("passwd_ssl");
+        } elseif (Env::get('op') == "Supprimer") {
+            $globals->xdb->execute('UPDATE auth_user_md5 SET smtppass = ""
+                                     WHERE user_id = {?}', $uid);
+            $page->trig('Compte SMTP et NNTP supprimé');
+            $log->log("passwd_del");
+        }
+
+        $res = $globals->xdb->query("SELECT IF(smtppass != '', 'actif', '') 
+                                       FROM auth_user_md5
+                                      WHERE user_id = {?}", $uid);
+        $page->assign('actif', $res->fetchOneCell());
+
+        return PL_OK;
+    }
+
     function handler_tmpPWD(&$page, $certif = null)
     {
         global $globals;
index 3013786..231e443 100644 (file)
@@ -55,8 +55,8 @@
 {/literal}
 
 <p>
-  <a href="docs/doc_smtp.php">Pourquoi et comment</a> utiliser le serveur SMTP de Polytechnique.org. <br />
-  <a href="docs/doc_nntp.php">Pourquoi et comment</a> utiliser le serveur NNTP de Polytechnique.org. <br />
+  <a href="{rel}/Docs/SMTPSécurisé">Pourquoi et comment</a> utiliser le serveur SMTP de Polytechnique.org.<br />
+  <a href="{rel}/Docs/NNTPSécurisé">Pourquoi et comment</a> utiliser le serveur NNTP de Polytechnique.org.<br />
 </p>
 <p>
 {if $actif}
@@ -65,7 +65,7 @@
   Pour activer un compte SMTP/NNTP sur <strong>ssl.polytechnique.org</strong>, tape un mot de passe ci-dessous.
 {/if}
 </p>
-<form action="{$smarty.server.REQUEST_URI}" method="post" id="smtppass_form">
+<form action="{rel}/password/smtp" method="post" id="smtppass_form">
   <table class="tinybicol" cellpadding="3" summary="Définition du mot de passe">
     <tr>
       <th colspan="2">
index 29b6004..7b9f63a 100644 (file)
@@ -63,7 +63,7 @@
   </tr>
   <tr class="pair">
     <td>
-      <h3><a href="{"acces_smtp.php"|url}">Activer l'accès SMTP et NNTP</a></h3>
+      <h3><a href="{rel}/password/smtp">Activer l'accès SMTP et NNTP</a></h3>
       <div class='explication'>
         Pour activer ton compte sur le serveur SMTP et NNTP de Polytechnique.org.
         Cela te permet d'envoyer tes mails plus souplement (SMTP), et de consulter