From: x2000habouzit Date: Sun, 9 Jul 2006 13:14:24 +0000 (+0000) Subject: remove acces_smtp.php => password/smtp X-Git-Tag: xorg/0.9.11~491 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=1a5da85749d16dcfb0f845362717f4763730741b;p=platal.git remove acces_smtp.php => password/smtp git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@405 839d8a87-29fc-0310-9880-83ba4fa771e5 --- diff --git a/htdocs/acces_smtp.php b/htdocs/acces_smtp.php deleted file mode 100644 index ae9812f..0000000 --- a/htdocs/acces_smtp.php +++ /dev/null @@ -1,49 +0,0 @@ -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: -?> diff --git a/modules/platal.php b/modules/platal.php index 73a05a6..930e6db 100644 --- a/modules/platal.php +++ b/modules/platal.php @@ -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; diff --git a/templates/acces_smtp.tpl b/templates/acces_smtp.tpl index 3013786..231e443 100644 --- a/templates/acces_smtp.tpl +++ b/templates/acces_smtp.tpl @@ -55,8 +55,8 @@ {/literal}

- Pourquoi et comment utiliser le serveur SMTP de Polytechnique.org.
- Pourquoi et comment utiliser le serveur NNTP de Polytechnique.org.
+ Pourquoi et comment utiliser le serveur SMTP de Polytechnique.org.
+ Pourquoi et comment utiliser le serveur NNTP de Polytechnique.org.

{if $actif} @@ -65,7 +65,7 @@ Pour activer un compte SMTP/NNTP sur ssl.polytechnique.org, tape un mot de passe ci-dessous. {/if}

-
+
diff --git a/templates/preferences.tpl b/templates/preferences.tpl index 29b6004..7b9f63a 100644 --- a/templates/preferences.tpl +++ b/templates/preferences.tpl @@ -63,7 +63,7 @@
-

Activer l'accès SMTP et NNTP

+

Activer l'accès SMTP et NNTP

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