From 23fb3e6f6b1376a432eb3142dd43f6e609980f8d Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Tue, 8 Sep 2009 10:23:01 +0200 Subject: [PATCH] Fetches Groupes X logos directly from the database and not from .net on .org. --- modules/profile.php | 23 +++++++++++++++++++++++ templates/profile/groupesx.tpl | 2 +- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/modules/profile.php b/modules/profile.php index b80d0e2..14ccc88 100644 --- a/modules/profile.php +++ b/modules/profile.php @@ -51,6 +51,7 @@ class ProfileModule extends PLModule 'referent/country' => $this->make_hook('ref_country', AUTH_COOKIE, 'user', NO_AUTH), 'groupes-x' => $this->make_hook('xnet', AUTH_COOKIE), + 'groupes-x/logo' => $this->make_hook('xnetlogo', AUTH_PUBLIC), 'vcard' => $this->make_hook('vcard', AUTH_COOKIE), 'admin/binets' => $this->make_hook('admin_binets', AUTH_MDP, 'admin'), @@ -714,6 +715,28 @@ class ProfileModule extends PLModule $page->assign('assos', $req->fetchAllAssoc()); } + function handler_xnetlogo(&$page, $id) + { + if (is_null($id)) { + return PL_NOT_FOUND; + } + + $res = XDB::query('SELECT logo, logo_mime + FROM groupex.asso + WHERE id = {?}', $id); + list($logo, $logo_mime) = $res->fetchOneRow(); + + if (!empty($logo)) { + header("Content-type: $mime"); + echo $logo; + } else { + header('Content-type: image/jpeg'); + readfile(dirname(__FILE__) . '/../htdocs/images/dflt_carre.jpg'); + } + + exit; + } + function handler_vcard(&$page, $x = null) { if (is_null($x)) { diff --git a/templates/profile/groupesx.tpl b/templates/profile/groupesx.tpl index b9c6b49..f3ea167 100644 --- a/templates/profile/groupesx.tpl +++ b/templates/profile/groupesx.tpl @@ -32,7 +32,7 @@ {$asso.nom} {if $asso.has_logo} - [ LOGO ] + [ LOGO ] {/if}