X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=f46ec862614aa16fc3b1053223e2422af30acbe5;hb=9b5ef111c02be6325580afe696baa4492b3934a3;hp=3eb63126960e1e9ad9de1e32b07bf76aa6190b15;hpb=1e33266a2f91e1af7a5cb3e8fbbc1c49ff9341f3;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index 3eb6312..f46ec86 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -33,9 +33,31 @@ 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);