X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fauth.php;h=70c7e00a07275cde1d8c5fca13563b08fe110920;hb=670b0ac0977d685aa05ba490bef58fd2995bcffb;hp=ea7e267e34d2eeb270a2083ca3c0390f8df87b1a;hpb=4e9a4346c00f08e155c9f6d4fd4c783d0d2385aa;p=platal.git diff --git a/modules/auth.php b/modules/auth.php index ea7e267..70c7e00 100644 --- a/modules/auth.php +++ b/modules/auth.php @@ -1,6 +1,6 @@ $this->make_hook('manageurs', AUTH_PUBLIC), 'auth-redirect.php' => $this->make_hook('redirect', AUTH_COOKIE), - 'auth-groupex.php' => $this->make_hook('groupex', AUTH_COOKIE), + 'auth-groupex.php' => $this->make_hook('groupex_old', AUTH_COOKIE), + 'auth-groupex' => $this->make_hook('groupex', AUTH_COOKIE), 'admin/auth-groupes-x' => $this->make_hook('admin_authgroupesx', AUTH_MDP, 'admin'), ); } @@ -78,7 +79,7 @@ class AuthModule extends PLModule WHERE $where ORDER BY nom"); - $res = "\n\n\n\n"; + $res = "\n\n\n\n"; while (list ($prenom1,$nom1,$email1) = $all->next()) { $res .= "\n"; @@ -90,7 +91,7 @@ class AuthModule extends PLModule $res .= "\n\n"; - header('Content-Type: text/xml; charset="ISO-8859-1"'); + header('Content-Type: text/xml; charset="UTF-8"'); echo $res; } exit; @@ -124,9 +125,15 @@ class AuthModule extends PLModule http_redirect(Env::v('dest', '/')); } - function handler_groupex(&$page) + function handler_groupex_old(&$page) + { + return $this->handler_groupex($page, 'iso-8859-1'); + } + + function handler_groupex(&$page, $charset = 'utf8') { require_once dirname(__FILE__).'/auth/auth.inc.php'; + $page->assign('referer', true); $gpex_pass = $_GET["pass"]; $gpex_url = urldecode($_GET["url"]); @@ -137,11 +144,12 @@ class AuthModule extends PLModule } /* a-t-on besoin d'ajouter le http:// ? */ - if (!preg_match("/^(http|https):\/\/.*/",$gpex_url)) + if (!preg_match("/^(http|https):\/\/.*/",$gpex_url)) { $gpex_url = "http://$gpex_url"; + } $gpex_challenge = $_GET["challenge"]; - // mise à jour de l'heure et de la machine de dernier login sauf quand on est en suid + // mise à jour de l'heure et de la machine de dernier login sauf quand on est en suid if (!isset($_SESSION['suid'])) { $logger = (isset($_SESSION['log']) && $_SESSION['log']->uid == $uid) ? $_SESSION['log'] : new CoreLogger($uid); @@ -150,27 +158,30 @@ class AuthModule extends PLModule } /* on parcourt les entrees de groupes_auth */ - $res = XDB::iterRow('select privkey,name,datafields from groupesx_auth'); + $res = XDB::iterRow('SELECT privkey, name, datafields FROM groupesx_auth'); while (list($privkey,$name,$datafields) = $res->next()) { if (md5($gpex_challenge.$privkey) == $gpex_pass) { - $returl = $gpex_url.gpex_make_params($gpex_challenge,$privkey,$datafields); + $returl = $gpex_url . gpex_make_params($gpex_challenge, $privkey, $datafields, $charset); http_redirect($returl); } } - /* si on n'a pas trouvé, on renvoit sur x.org */ + /* si on n'a pas trouvé, on renvoit sur x.org */ http_redirect('https://www.polytechnique.org/'); } - function handler_admin_authgroupesx(&$page, $action = 'list', $id = null) { + + function handler_admin_authgroupesx(&$page, $action = 'list', $id = null) + { $page->assign('xorg_title','Polytechnique.org - Administration - Auth groupes X'); - $page->assign('title', 'Gestion de l\'authentification centralisée'); + $page->assign('title', 'Gestion de l\'authentification centralisée'); $table_editor = new PLTableEditor('admin/auth-groupes-x','groupesx_auth','id'); $table_editor->describe('name','nom',true); - $table_editor->describe('privkey','clé privée',false); - $table_editor->describe('datafields','champs renvoyés',true); + $table_editor->describe('privkey','clé privée',false); + $table_editor->describe('datafields','champs renvoyés',true); $table_editor->apply($page, $action, $id); } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>