Merge commit 'origin/fusionax' into account
[platal.git] / include / banana / hooks.inc.php
index 4c70d63..82334ea 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2008 Polytechnique.org                              *
+ *  Copyright (C) 2003-2009 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
@@ -190,9 +190,9 @@ function hook_getXFace($headers)
     }
     if (isset($headers['x-face'])) {
         $user = User::getSilent($login);
-        $res = XDB::query('SELECT  pf.uid
+        $res = XDB::query("SELECT  pf.uid
                              FROM  forum_profiles AS pf
-                            WHERE  pf.uid = {?} AND FIND_IN_SET(\'xface\', pf.flags)',
+                            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
@@ -214,7 +214,7 @@ function make_Organization()
     global $globals;
     $perms = S::v('perms');
     $group = $globals->asso('nom');
-    if (S::has_perms()) {
+    if (S::admin()) {
         return "Administrateur de Polytechnique.org";
     } else if ($group && $perms->hasFlag('groupadmin')) {
         return "Animateur de $group";
@@ -319,7 +319,9 @@ class BananaHandler
     {
     }
 
-    public function process()
+    public function success() { }
+
+    public function process(&$success)
     {
         return PlWizard::CURRENT_PAGE;
     }
@@ -327,7 +329,8 @@ class BananaHandler
 
 function run_banana(&$page, $class, array $args)
 {
-    $banana = new $class(S::user(), $args);
+    $user = S::user();
+    $banana = new $class($user, $args);
     $page->assign('banana', $banana->run());
     $page->addCssInline($banana->css());
     $page->addCssLink('banana.css');