backport patch 441
[platal.git] / modules / banana.php
index b0819c3..87c5db2 100644 (file)
@@ -28,6 +28,7 @@ class BananaModule extends PLModule
             '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),
         );
     }
 
@@ -103,6 +104,15 @@ class BananaModule extends PLModule
         return $this->run_banana($page, Array('subscribe' => 1));
     }
 
+    function handler_xface(&$page, $face = null)
+    {
+        header('Content-Type: image/jpeg');
+        passthru('echo ' . escapeshellarg(base64_decode($face))
+                . '| uncompface -X '
+                . '| convert xbm:- jpg:-');
+        return PL_OK;
+    }
+
     function run_banana(&$page, $params = null)
     {
         $page->changeTpl('banana/index.tpl');