X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=211674463ec3a19803927af873874348c29978f3;hb=300325787a5d47336b64110034e582ae611341e0;hp=ce9ed099a63dcc7354e203f65a557001db7d26de;hpb=c0d230b0444016cbb248c81c2c50688e77c84a57;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index ce9ed09..2116744 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -33,17 +33,38 @@ class XnetModule extends PLModule 'groupes.php' => $this->make_hook('groups2', AUTH_PUBLIC), 'plan' => $this->make_hook('plan', AUTH_PUBLIC), 'send_bug' => $this->make_hook('bug', AUTH_MDP), + 'photo' => $this->make_hook('photo', AUTH_MDP), ); } + function handler_photo(&$page, $x = null) + { + if (is_null($x)) { + return PL_NOT_FOUND; + } + + $res = XDB::query("SELECT attachmime, attach + FROM aliases + INNER JOIN photo ON(id = uid) + WHERE alias = {?}", $x); + + if ((list($type, $data) = $res->fetchOneRow())) { + Header("Content-type: image/$type"); + echo $data; + } else { + Header('Content-type: image/png'); + echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png'); + } + exit; + } + function handler_bug(&$page) { $page->changeTpl('bug.tpl',SIMPLE); $page->addJsLink('close_on_esc.js'); if (Env::has('send')) { $page->assign('bug_sent',1); - require_once "diogenes/diogenes.hermes.inc.php"; - $mymail = new HermesMailer(); + $mymail = new PlMailer(); $mymail->setFrom('"'.S::v('prenom').' '.S::v('nom').'" <'.S::v('bestalias').'@polytechnique.org>'); $mymail->addTo('support+platal@polytechnique.org'); $mymail->setSubject('Plat/al '.Env::v('task_type').' : '.Env::v('item_summary')); @@ -68,8 +89,15 @@ class XnetModule extends PLModule function handler_exit(&$page) { - XnetSession::destroy(); - $page->changeTpl('xnet/deconnexion.tpl'); + if (S::has('suid')) { + $suid = S::v('suid'); + $_SESSION['perms'] = $suid['perms']; + S::kill('suid'); + } else { + XnetSession::destroy(); + $page->changeTpl('xnet/deconnexion.tpl'); + } + pl_redirect('/'); } function handler_admin(&$page)