Fix xfaces by using banana's makeLink hook
authorx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 10 Jul 2006 10:45:11 +0000 (10:45 +0000)
committerx2003bruneau <x2003bruneau@839d8a87-29fc-0310-9880-83ba4fa771e5>
Mon, 10 Jul 2006 10:45:11 +0000 (10:45 +0000)
and retab banana.inc.php

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@418 839d8a87-29fc-0310-9880-83ba4fa771e5

htdocs/xface.php [deleted file]
include/banana.inc.php
modules/banana.php

diff --git a/htdocs/xface.php b/htdocs/xface.php
deleted file mode 100644 (file)
index ca3d136..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-header('Content-Type: image/jpeg');
-passthru('echo '.escapeshellarg(base64_decode($_REQUEST['face'])).
-         '|uncompface -X |convert xbm:- jpg:-');
-
-?>
index 304d13b..f537fda 100644 (file)
@@ -24,8 +24,8 @@ require_once('banana/banana.inc.php');
 function hook_formatDisplayHeader($_header,$_text) {
     global $globals;
     if ($_header == 'x-org-id') {
-               return $_text . ' [<a href="' . $globals->baseurl . '/fiche.php?user=' 
-                        . $_text . '" class="popup2">fiche</a>]';
+        return $_text . ' [<a href="' . $globals->baseurl . '/fiche.php?user=' 
+             . $_text . '" class="popup2">fiche</a>]';
     }
 }
 
@@ -40,35 +40,38 @@ function hook_checkcancel($_headers) {
 }
 
 function hook_makeLink($params) {
-       global $globals;
-       $base = $globals->baseurl . '/banana'; 
-       if ($params['subscribe'] == 1) {
-               return $base . '/subscription';
-       }
-
-       if (!isset($params['group'])) {
-               return $base;
-       }
-       $base .= '/' . $params['group'];
-
-       if (isset($params['first'])) {
-               return $base . '/from/' . $params['first'];
-       }
-       if (isset($params['artid'])) {
-               if ($params['action'] == 'new') {
-                       $base .= '/reply';
-               } elseif ($params['action'] == 'cancel') {
-                       $base .= '/cancel';
-               } else {
-                       $base .= '/read';
-               }
-               return $base . '/' . $params['artid'];
-       }
-       
-       if ($params['action'] == 'new') {
-               return $base . '/new';
-       }
-       return $base;
+    global $globals;
+    $base = $globals->baseurl . '/banana'; 
+    if ($params['subscribe'] == 1) {
+        return $base . '/subscription';
+    }
+    if (isset($params['xface'])) {
+        return $base . '/xface/' . $params['xface'];
+    }
+
+    if (!isset($params['group'])) {
+        return $base;
+    }
+    $base .= '/' . $params['group'];
+
+    if (isset($params['first'])) {
+        return $base . '/from/' . $params['first'];
+    }
+    if (isset($params['artid'])) {
+        if ($params['action'] == 'new') {
+            $base .= '/reply';
+        } elseif ($params['action'] == 'cancel') {
+            $base .= '/cancel';
+        } else {
+            $base .= '/read';
+        }
+        return $base . '/' . $params['artid'];
+    }
+    
+    if ($params['action'] == 'new') {
+        return $base . '/new';
+    }
+    return $base;
 }
 
 function hook_makeImg($img, $alt, $height, $width)
@@ -140,7 +143,7 @@ class PlatalBanana extends Banana
         global $banana, $globals;
 
         if (Get::get('banana') == 'updateall'
-                               || (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) {
+                || (!is_null($params) && isset($params['banana']) && $params['banana'] == 'updateall')) {
             $globals->xdb->execute('UPDATE auth_user_quick SET banana_last={?} WHERE user_id={?}', gmdate('YmdHis'), Session::getInt('uid'));
             $_SESSION['banana_last'] = time();
         }
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');