From 4fa7cd36a31629ea7d20d2f8b27d015538ce398d Mon Sep 17 00:00:00 2001 From: Thomas Deniau Date: Tue, 18 Mar 2008 14:50:50 +0100 Subject: [PATCH] webservice ? --- configs/platal.ini | 2 ++ modules/banana.php | 22 +++++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/configs/platal.ini b/configs/platal.ini index b1aaf00..c0222b4 100644 --- a/configs/platal.ini +++ b/configs/platal.ini @@ -22,6 +22,8 @@ mbox_helper = "/usr/bin/banana-mbox-helper" event_forum = "" event_reply = "" +bans_authorized_ips = "129.104.208.153 129.104.201.51 129.104.201.52" + [Geoloc] webservice_url = "" diff --git a/modules/banana.php b/modules/banana.php index ad09a9b..50c7121 100644 --- a/modules/banana.php +++ b/modules/banana.php @@ -28,7 +28,8 @@ class BananaModule extends PLModule // 'banana/profile' => $this->make_hook('profile', AUTH_MDP), // 'banana/subscribe' => $this->make_hook('subscription', AUTH_COOKIE), 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), - 'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP, 'admin'), + 'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP, 'admin'), + 'forums/bans/service' => $this->make_hook('forums_bans_service', AUTH_PUBLIC) ); } @@ -162,6 +163,25 @@ class BananaModule extends PLModule $table_editor->apply($page, $action, $id); } + function handler_forums_bans_service(&$page, $action = 'list', $id = null) + { + global $globals; + + $ips = array_flip(explode(' ', $globals->banana->bans_authorized_ips)); + + if ($ips && isset($ips[$_SERVER['REMOTE_ADDR']])) { + + $res = XDB::query("SELECT priority, read_perm, write_perm, comment + FROM forums.innd AS i + INNER JOIN x4dat.aliases AS a ON ( a.id = i.uid AND a.type='a_vie' ) + INNER JOIN x4dat.aliases AS b ON ( b.id = a.id AND b.type != 'homonyme' ) + WHERE b.alias = '".addslashes(Env::v('forlife'))."'"); + $ban = $res->fetchOneAssoc(); + echo "$res['priority']\n$res['read_perm']\n$res['write_perm']\n$res['comment']\n"; + } + exit(); + } + static function run_banana(&$page, $params = null) { $page->changeTpl('banana/index.tpl'); -- 2.1.4