X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=812e9ed6743c3493aa804595b51cdfa84664924e;hb=8b1f8e12d444062ef63a0db3a8fa94582a9778c3;hp=f3cf0f9417ca5c4bb4ee5884b6fd672c9091757b;hpb=92169c1d1ff0356cc4fb2dd645c3a08861d36450;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index f3cf0f9..812e9ed 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -32,14 +32,29 @@ class XnetModule extends PLModule 'groups' => $this->make_hook('groups', AUTH_PUBLIC), '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_bug(&$page) + function handler_photo(&$page, $x = null) { - $this->handler_index(&$page); - $page->assign('bug', 1); + 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_index(&$page) @@ -58,6 +73,7 @@ class XnetModule extends PLModule function handler_exit(&$page) { + XnetSession::killSuid(); XnetSession::destroy(); $page->changeTpl('xnet/deconnexion.tpl'); }