begin to migrate the first 'asso' page to the new system, using a namespace hack...
[platal.git] / modules / banana.php
index 87c5db2..3be2ced 100644 (file)
@@ -27,7 +27,6 @@ class BananaModule extends PLModule
             'banana'              => $this->make_hook('banana', AUTH_COOKIE),
             'banana/profile'      => $this->make_hook('profile', AUTH_MDP),
             'banana/subscription' => $this->make_hook('subscription', AUTH_COOKIE),
-            'banana/updateall'    => $this->make_hook('updateall', AUTH_COOKIE),
             'banana/xface'        => $this->make_hook('xface', AUTH_COOKIE),
         );
     }
@@ -38,10 +37,16 @@ class BananaModule extends PLModule
         if (!is_null($group)) {
             $get['group'] = $group;
         }
+        if (Post::has('updateall')) {
+            $get['banana'] = 'updateall';
+        }
         if (!is_null($action)) {
             if ($action == 'new') {
                 $get['action'] = 'new';
-            } elseif (($action == 'reply' || $action == 'cancel') && !is_null($artid)) {
+            } 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)) {
@@ -90,13 +95,6 @@ class BananaModule extends PLModule
                 (Post::getBool('bananaupdate') ? 'automaj' : '')
             );
         }
-
-        return PL_OK;
-    }
-
-    function handler_updateall(&$page)
-    {
-        return BananaModule::run_banana($page, Array('banana' => 'updateall'));
     }
 
     function handler_subscription(&$page)
@@ -106,11 +104,10 @@ class BananaModule extends PLModule
 
     function handler_xface(&$page, $face = null)
     {
-        header('Content-Type: image/jpeg');
-        passthru('echo ' . escapeshellarg(base64_decode($face))
+        header('Content-Type: image/gif');
+        passthru('echo ' . escapeshellarg(base64_decode(strtr($face, '.:', '+/')))
                 . '| uncompface -X '
-                . '| convert xbm:- jpg:-');
-        return PL_OK;
+                . '| convert -transparent white xbm:- gif:-');
     }
 
     function run_banana(&$page, $params = null)
@@ -124,8 +121,6 @@ class BananaModule extends PLModule
         $res = PlatalBanana::run($params);
         $page->assign_by_ref('banana', $banana);
         $page->assign('banana_res', $res);
-
-        return PL_OK;
     }
 }