Phone class: new class to access profile_phones.
[platal.git] / include / banana / moderate.inc.php
index b167cfd..307183e 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2007 Polytechnique.org                              *
+ *  Copyright (C) 2003-2010 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-require_once 'banana/banana.inc.php';
 require_once 'banana/hooks.inc.php';
 
 function hook_checkcancel($_headers)
 {
-    return ($_headers['x-org-id'] == S::v('forlife') or S::has_perms());
+    return ($_headers['x-org-id'] == S::v('hruid') or S::admin());
 }
 
 function hook_makeLink($params)
@@ -39,7 +38,7 @@ function hook_makeLink($params)
         if ($key == 'group') {
             continue;
         }
-        if ($key == 'action') {
+        if ($key == 'action' && $value != 'showext') {
             continue;
         }
         if (!empty($get)) {
@@ -56,25 +55,28 @@ class ModerationBanana extends Banana
     static public $domain;
     static public $client;
 
-    function __construct($params = null, &$client)
+    function __construct(User &$user, $params = null)
     {
+        ini_set('memory_limit', '128M');
+
         global $globals;
-        ModerationBanana::$client = $client;
+        ModerationBanana::$client = $params['client'];
         ModerationBanana::$listname = $params['listname'];
         ModerationBanana::$domain = isset($params['domain']) ? $params['domain'] : $globals->mail->domain;
         $params['group'] = ModerationBanana::$listname . '@' . ModerationBanana::$domain;
+        Banana::$spool_root = $globals->banana->spool_root;
         Banana::$spool_boxlist = false;
         Banana::$msgshow_withthread = false;
         Banana::$withtabs      = false;
         Banana::$msgshow_externalimages = false;
         Banana::$msgshow_mimeparts[] = 'source';
+        Banana::$feed_active = false;
+        Banana::$debug_smarty = ($globals->debug & DEBUG_SMARTY);
         array_push(Banana::$msgparse_headers, 'x-org-id', 'x-org-mail');
         parent::__construct($params, 'MLInterface', 'ModerationPage');
     }
 }
 
-require_once('banana/page.inc.php');
-
 class ModerationPage extends BananaPage
 {
     protected function prepare()
@@ -87,17 +89,11 @@ class ModerationPage extends BananaPage
 
     public function trig($msg)
     {
-        global $page;
-        if ($page) {
-            $page->trig(utf8_decode($msg));
-        }
+        Platal::page()->trigError($msg);
         return true;
     }
 }
 
-require_once('banana/protocoleinterface.inc.php');
-require_once('banana/message.inc.php');
-
 class BananaMLInterface implements BananaProtocoleInterface
 {
     private $infos; //(list, addr, host, desc, info, diff, ins, priv, sub, own, nbsub)
@@ -105,23 +101,23 @@ class BananaMLInterface implements BananaProtocoleInterface
 
     public function __construct()
     {
-        $this->infos = ModerationBanana::$client->get_members(ModerationBanana::$listname); 
+        $this->infos = ModerationBanana::$client->get_members(ModerationBanana::$listname);
         $this->infos = $this->infos[0];
-        
+
         $mods = ModerationBanana::$client->get_pending_ops(ModerationBanana::$listname);
         $this->helds = $mods[1];
     }
-    
+
     public function isValid()
     {
         return !is_null(ModerationBanana::$client);
     }
-    
+
     public function lastErrNo()
     {
         return 0;
     }
-    
+
     public function lastError()
     {
         return null;
@@ -235,7 +231,12 @@ class BananaMLInterface implements BananaProtocoleInterface
     {
         return ModerationBanana::$domain . '_' . ModerationBanana::$listname;
     }
+
+    public function backtrace()
+    {
+        return null;
+    }
 }
 
-// vim:set et sw=4 sts=4 ts=4:
+// vim:set et sw=4 sts=4 ts=4 enc=utf-8:
 ?>