X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fbanana%2Fhooks.inc.php;h=c08c983d48a317290e9c6e4029b979ba0841e44d;hb=00ba8a742be0cfc70eef7c6aaaccebe7134ec087;hp=ebd913c879495e0d4be5b4e05ee8066510a4f9e4;hpb=8a43972f58f0a77015ae9e509f1c073d188874d2;p=platal.git diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index ebd913c..c08c983 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -1,6 +1,6 @@ token . '/rss.xml'; } function hook_platalMessageLink($params) @@ -177,20 +178,25 @@ function hook_hasXFace($headers) function hook_getXFace($headers) { - $login = @$headers['x-org-id']; - if (!$login) { - @list($login, ) = explode('@', $headers['x-org-mail']); + $login = null; + foreach (array('x-org-id', 'x-org-mail') as $key) { + if (isset($headers[$key])) { + $login = $headers[$key]; + break; + } } - if (!$login) { + if (is_null($login)) { + // No login, fallback to default handler return false; } if (isset($headers['x-face'])) { - $res = XDB::query("SELECT p.uid - FROM forums.profils AS p - INNER JOIN aliases AS a ON (p.uid = a.id) - WHERE FIND_IN_SET('xface', p.flags) AND a.alias = {?}", - $login); + $user = User::getSilent($login); + $res = XDB::query("SELECT pf.uid + FROM forum_profiles AS pf + WHERE pf.uid = {?} AND FIND_IN_SET('xface', pf.flags)", + $user->id()); if ($res->numRows()) { + // User wants his xface to be showed, fallback to default handler return false; } }