New IP watcher :
[platal.git] / modules / banana.php
index b7cbfbd..ea857c5 100644 (file)
@@ -69,25 +69,23 @@ class BananaModule extends PLModule
         if (!is_null($action)) {
             if ($action == 'new') {
                 $get['action'] = 'new';
-            } elseif ($action == 'reply' && !is_null($artid)) {
-                $get['action'] = 'new';
-                $get['artid']  = $artid;
-            } elseif ($action == 'cancel' && !is_null($artid)) {
-                $get['action'] = $action;
-                $get['artid']  = $artid;
-            } elseif ($action == 'from' && !is_null($artid)) {
-                $get['first'] = $artid;
-            } elseif ($action == 'read' && !is_null($artid)) {
-                $get['artid'] = $artid;
-                $get['part']  = @$_GET['part'];
-            } elseif ($action == 'source' && !is_null($artid)) {
-                $get['artid'] = $artid;
-                $get['part'] = 'source';
-            } elseif ($action == 'xface' && !is_null($artid)) {
-                $get['artid'] = $artid;
-                $get['part']  = 'xface';
+            } elseif (!is_null($artid)) {
+                $get['artid'] = $artid; 
+                if ($action == 'reply') {
+                    $get['action'] = 'new';
+                } elseif ($action == 'cancel') {
+                    $get['action'] = $action;
+                } elseif ($action == 'from') {
+                    $get['first'] = $artid;
+                } elseif ($action == 'read') {
+                    $get['part']  = @$_GET['part'];
+                } elseif ($action == 'source') {
+                    $get['part'] = 'source';
+                } elseif ($action == 'xface') {
+                    $get['part']  = 'xface';
+                }   
             }
-        }    
+        }   
         return BananaModule::run_banana($page, $get);
     }
 
@@ -146,15 +144,16 @@ class BananaModule extends PLModule
     static function run_banana(&$page, $params = null)
     {
         $page->changeTpl('banana/index.tpl');
-        $page->addCssLink('banana.css');
         $page->assign('xorg_title','Polytechnique.org - Forums & PA');
 
-        require_once dirname(__FILE__).'/banana/banana.inc.php';
+        require_once 'banana/forum.inc.php';
 
-        $banana = new PlatalBanana($params);
+        $banana = new ForumsBanana($params);
         $res = $banana->run();
         $page->assign_by_ref('banana', $banana);
         $page->assign('banana_res', $res);
+        $page->addCssInline($banana->css());
+        $page->addCssLink('banana.css');
     }
 }