X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=include%2Fbanana%2Fhooks.inc.php;h=c08c983d48a317290e9c6e4029b979ba0841e44d;hb=00ba8a742be0cfc70eef7c6aaaccebe7134ec087;hp=149aff23dfcc85578496d1558bc92e8afc44a62a;hpb=9e1816c7666767755abbc24f6a0df290efff81b6;p=platal.git diff --git a/include/banana/hooks.inc.php b/include/banana/hooks.inc.php index 149aff2..c08c983 100644 --- a/include/banana/hooks.inc.php +++ b/include/banana/hooks.inc.php @@ -19,7 +19,8 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -require_once 'banana/banana.inc.php'; +require_once dirname(__FILE__) . '/../../banana/banana/banana.inc.php'; +require_once dirname(__FILE__) . '/../../banana/banana/message.func.inc.php'; function hook_formatDisplayHeader($_header, $_text, $in_spool = false) { @@ -76,7 +77,7 @@ function hook_platalRSS($group) } else { $group = ''; } - return '/rss/' . $group . S::v('hruid') . '/' . S::v('core_rss_hash') . '/rss.xml'; + return '/rss/' . $group . S::v('hruid') . '/' . S::user()->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 #x4dat#.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; } }