Fix xface with last banana and make white region transparent
[platal.git] / modules / banana.php
index 87c5db2..4e7aee9 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,6 +37,9 @@ 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';
@@ -94,11 +96,6 @@ class BananaModule extends PLModule
         return PL_OK;
     }
 
-    function handler_updateall(&$page)
-    {
-        return BananaModule::run_banana($page, Array('banana' => 'updateall'));
-    }
-
     function handler_subscription(&$page)
     {
         return $this->run_banana($page, Array('subscribe' => 1));
@@ -107,9 +104,9 @@ class BananaModule extends PLModule
     function handler_xface(&$page, $face = null)
     {
         header('Content-Type: image/jpeg');
-        passthru('echo ' . escapeshellarg(base64_decode($face))
+        passthru('echo ' . escapeshellarg(base64_decode(strtr($face, '.:', '+/')))
                 . '| uncompface -X '
-                . '| convert xbm:- jpg:-');
+                . '| convert -transparent white xbm:- gif:-');
         return PL_OK;
     }