From f107d806eb6cb92fb37de0f4fb4c28aa6b7f9042 Mon Sep 17 00:00:00 2001 From: x2003bruneau Date: Mon, 10 Jul 2006 10:45:11 +0000 Subject: [PATCH] Fix xfaces by using banana's makeLink hook and retab banana.inc.php git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@418 839d8a87-29fc-0310-9880-83ba4fa771e5 --- htdocs/xface.php | 6 ----- include/banana.inc.php | 67 ++++++++++++++++++++++++++------------------------ modules/banana.php | 10 ++++++++ 3 files changed, 45 insertions(+), 38 deletions(-) delete mode 100644 htdocs/xface.php diff --git a/htdocs/xface.php b/htdocs/xface.php deleted file mode 100644 index ca3d136..0000000 --- a/htdocs/xface.php +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/include/banana.inc.php b/include/banana.inc.php index 304d13b..f537fda 100644 --- a/include/banana.inc.php +++ b/include/banana.inc.php @@ -24,8 +24,8 @@ require_once('banana/banana.inc.php'); function hook_formatDisplayHeader($_header,$_text) { global $globals; if ($_header == 'x-org-id') { - return $_text . ' [fiche]'; + return $_text . ' [fiche]'; } } @@ -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(); } diff --git a/modules/banana.php b/modules/banana.php index b0819c3..87c5db2 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -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'); -- 2.1.4