X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=195d4bb450b9f3df211c0a37cedd0315637c67f3;hb=a0b453227e9433d2bd4dea1e07a7463800702839;hp=7d73eb286b777f7f3a8f49c3c130fa1e783dab3c;hpb=a7de4ef724d1a3b0bf978a50ce7cc9d23412c7a0;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index 7d73eb2..195d4bb 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -1,6 +1,6 @@ $this->make_hook('groups2', AUTH_PUBLIC), 'plan' => $this->make_hook('plan', AUTH_PUBLIC), 'photo' => $this->make_hook('photo', AUTH_MDP), + 'autologin' => $this->make_hook('autologin', AUTH_MDP), ); } @@ -55,7 +56,7 @@ class XnetModule extends PLModule } exit; } - + function handler_index(&$page) { $page->nomenu = true; @@ -64,14 +65,14 @@ class XnetModule extends PLModule function handler_exit(&$page) { - XnetSession::killSuid(); - XnetSession::destroy(); + Platal::session()->stopSUID(); + Platal::session()->destroy(); $page->changeTpl('xnet/deconnexion.tpl'); } function handler_admin(&$page) { - new_admin_page('xnet/admin.tpl'); + $page->changeTpl('xnet/admin.tpl'); if (Get::has('del')) { $res = XDB::query('SELECT id, nom, mail_domain @@ -80,27 +81,29 @@ class XnetModule extends PLModule list($id, $nom, $domain) = $res->fetchOneRow(); $page->assign('nom', $nom); if ($id && Post::has('del')) { + S::assert_xsrf_token(); + XDB::query('DELETE FROM groupex.membres WHERE asso_id={?}', $id); - $page->trig('membres supprimés'); + $page->trigSuccess('membres supprimés'); if ($domain) { XDB::query('DELETE FROM virtual_domains WHERE domain={?}', $domain); XDB::query('DELETE FROM virtual, virtual_redirect USING virtual INNER JOIN virtual_redirect USING (vid) WHERE alias LIKE {?}', '%@'.$domain); - $page->trig('suppression des alias mails'); + $page->trigSuccess('suppression des alias mails'); $mmlist = new MMList(S::v('uid'), S::v('password'), $domain); if ($listes = $mmlist->get_lists()) { foreach ($listes as $l) { $mmlist->delete_list($l['list'], true); } - $page->trig('mail lists surpprimées'); + $page->trigSuccess('mail lists surpprimées'); } } XDB::query('DELETE FROM groupex.asso WHERE id={?}', $id); - $page->trig("Groupe $nom supprimé"); + $page->trigSuccess("Groupe $nom supprimé"); Get::kill('del'); } if (!$id) { @@ -109,6 +112,8 @@ class XnetModule extends PLModule } if (Post::has('diminutif')) { + S::assert_xsrf_token(); + XDB::query('INSERT INTO groupex.asso (id,diminutif) VALUES(NULL,{?})', Post::v('diminutif')); pl_redirect('../'.Post::v('diminutif').'/edit'); @@ -196,6 +201,16 @@ class XnetModule extends PLModule $page->setType($cat); } + + function handler_autologin(&$page) + { + $allkeys = func_get_args(); + unset($allkeys[0]); + $url = join('/',$allkeys); + header("Content-type: text/javascript; charset=utf-8"); + echo '$.ajax({ url: "'.$url.'?forceXml=1", dataType: "xml", success: function(xml) { $("body",xml).insertBefore("body"); $("body:eq(1)").remove(); }});'; + exit; + } } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: