X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fxnet.php;h=6dc536dde29a5771a0eaee43a0452a3cf78238b5;hb=12262f1306059765d8625a6752364679c8625d31;hp=00e929e4548690cd7baf76d278e822ba173ae391;hpb=fe13bc1d7ba9f72d452ec07baf8538a74b7c67b8;p=platal.git diff --git a/modules/xnet.php b/modules/xnet.php index 00e929e..6dc536d 100644 --- a/modules/xnet.php +++ b/modules/xnet.php @@ -1,6 +1,6 @@ $this->make_hook('plan', AUTH_PUBLIC), 'photo' => $this->make_hook('photo', AUTH_MDP), 'autologin' => $this->make_hook('autologin', AUTH_MDP), + + 'Xnet' => $this->make_wiki_hook(), ); } function handler_photo(&$page, $x = null) { - if (is_null($x)) { + if (!$x || !($profile = Profile::get($x))) { return PL_NOT_FOUND; } - $res = XDB::query("SELECT attachmime, attach - FROM aliases AS a - INNER JOIN photo AS p ON(a.uid = p.uid) - WHERE alias = {?}", $x); - - if ((list($type, $data) = $res->fetchOneRow())) { - pl_cached_dynamic_content_headers("image/$type"); - echo $data; - } else { - pl_cached_dynamic_content_headers("image/png"); - echo file_get_contents(dirname(__FILE__).'/../htdocs/images/none.png'); - } - exit; + // Retrieve the photo and its mime type. + $photo = $profile->getPhoto(true, true); + + // Display the photo, or a default one when not available. + $photo->send(); } function handler_index(&$page) @@ -123,7 +117,7 @@ class XnetModule extends PLModule XDB::execute('INSERT INTO groups (id, diminutif) VALUES (NULL, {?})', Post::v('diminutif')); - pl_redirect('../' . Post::v('diminutif') . '/edit'); + pl_redirect(Post::v('diminutif') . '/edit'); } else { $page->trigError('Le diminutif demandé est déjà pris.'); } @@ -193,7 +187,7 @@ class XnetModule extends PLModule $page->assign('cat', $cat); $page->assign('dom', $dom); - $res = XDB::query("SELECT id,nom + $res = XDB::query("SELECT id,nom FROM group_dom WHERE FIND_IN_SET({?}, cat) ORDER BY nom", $cat);