X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=7d73eb286b777f7f3a8f49c3c130fa1e783dab3c;hb=155819d9ece12a06d37df46e22b76e3c71f65fba;hp=ce9ed099a63dcc7354e203f65a557001db7d26de;hpb=c0d230b0444016cbb248c81c2c50688e77c84a57;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index ce9ed09..7d73eb2 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -1,6 +1,6 @@ $this->make_hook('index', AUTH_PUBLIC), - 'login' => $this->make_hook('login', AUTH_MDP), 'exit' => $this->make_hook('exit', AUTH_PUBLIC), 'admin' => $this->make_hook('admin', AUTH_MDP, 'admin'), '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) { - $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->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')); - $mymail->setTxtBody(Env::v('detailed_desc')); - $mymail->send(); + 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,16 +62,9 @@ class XnetModule extends PLModule $page->changeTpl('xnet/index.tpl'); } - function handler_login(&$page) - { - $allkeys = func_get_args(); - unset($allkeys[0]); - $url = join('/',$allkeys); - pl_redirect($url); - } - function handler_exit(&$page) { + XnetSession::killSuid(); XnetSession::destroy(); $page->changeTpl('xnet/deconnexion.tpl'); } @@ -84,7 +81,7 @@ class XnetModule extends PLModule $page->assign('nom', $nom); if ($id && Post::has('del')) { XDB::query('DELETE FROM groupex.membres WHERE asso_id={?}', $id); - $page->trig('membres supprimés'); + $page->trig('membres supprimés'); if ($domain) { XDB::query('DELETE FROM virtual_domains WHERE domain={?}', $domain); @@ -98,12 +95,12 @@ class XnetModule extends PLModule foreach ($listes as $l) { $mmlist->delete_list($l['list'], true); } - $page->trig('mail lists surpprimées'); + $page->trig('mail lists surpprimées'); } } XDB::query('DELETE FROM groupex.asso WHERE id={?}', $id); - $page->trig("Groupe $nom supprimé"); + $page->trig("Groupe $nom supprimé"); Get::kill('del'); } if (!$id) { @@ -201,4 +198,5 @@ class XnetModule extends PLModule } } +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: ?>