Commit | Line | Data |
---|---|---|
f585e5a4 | 1 | <?php |
2 | /*************************************************************************** | |
179afa7f | 3 | * Copyright (C) 2003-2008 Polytechnique.org * |
f585e5a4 | 4 | * http://opensource.polytechnique.org/ * |
5 | * * | |
6 | * This program is free software; you can redistribute it and/or modify * | |
7 | * it under the terms of the GNU General Public License as published by * | |
8 | * the Free Software Foundation; either version 2 of the License, or * | |
9 | * (at your option) any later version. * | |
10 | * * | |
11 | * This program is distributed in the hope that it will be useful, * | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of * | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | |
14 | * GNU General Public License for more details. * | |
15 | * * | |
16 | * You should have received a copy of the GNU General Public License * | |
17 | * along with this program; if not, write to the Free Software * | |
18 | * Foundation, Inc., * | |
19 | * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * | |
20 | ***************************************************************************/ | |
21 | ||
9c30fe48 | 22 | class ForumsModule extends PLModule |
f585e5a4 | 23 | { |
24 | function handlers() | |
25 | { | |
26 | return array( | |
03c0a3a7 FB |
27 | 'banana' => $this->make_hook('banana', AUTH_COOKIE), |
28 | 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'user', NO_HTTPS), | |
20f6e3ac | 29 | 'admin/forums' => $this->make_hook('forums_bans', AUTH_MDP, 'admin'), |
a3a1d23b | 30 | ); |
f585e5a4 | 31 | } |
32 | ||
3d9b1d30 | 33 | function handler_banana(&$page, $group = null, $action = null, $artid = null) |
f585e5a4 | 34 | { |
4f355064 | 35 | $page->changeTpl('banana/index.tpl'); |
46f272fe | 36 | $page->setTitle('Forums & PA'); |
4f355064 | 37 | |
a3a1d23b | 38 | $get = Array(); |
7e6495d4 | 39 | if (Post::has('updateall')) { |
85b9d118 | 40 | $get['updateall'] = Post::v('updateall'); |
7e6495d4 | 41 | } |
4f355064 | 42 | require_once 'banana/forum.inc.php'; |
43 | get_banana_params($get, $group, $action, $artid); | |
44 | run_banana($page, 'ForumsBanana', $get); | |
f585e5a4 | 45 | } |
46 | ||
6544d0e1 | 47 | function handler_rss(&$page, $group, $alias, $hash, $file = null) |
f107d806 | 48 | { |
6544d0e1 | 49 | if (is_null($file)) { |
50 | if (is_null($hash)) { | |
51 | exit; | |
52 | } | |
53 | $this->handler_rss($page, null, $group, $alias, $hash); | |
54 | } | |
55 | require_once('rss.inc.php'); | |
56 | $uid = init_rss(null, $alias, $hash); | |
57 | if (!$uid) { | |
58 | exit; | |
59 | } | |
60 | $res = XDB::query("SELECT id AS uid, alias AS forlife | |
61 | FROM aliases | |
62 | WHERE type = 'a_vie' AND id = {?}", $uid); | |
63 | $row = $res->fetchOneAssoc(); | |
64 | $_SESSION = array_merge($row, $_SESSION); | |
65 | ||
66 | require_once 'banana/forum.inc.php'; | |
e3a55098 | 67 | $banana = new ForumsBanana(S::user(), array('group' => $group, 'action' => 'rss2')); |
4f355064 | 68 | $banana->run(); |
6544d0e1 | 69 | exit; |
f107d806 | 70 | } |
71 | ||
669cb0e0 | 72 | function handler_forums_bans(&$page, $action = 'list', $id = null) |
73 | { | |
46f272fe | 74 | $page->setTitle('Administration - Bannissements des forums'); |
669cb0e0 | 75 | $page->assign('title', 'Gestion des mises au ban'); |
76 | $table_editor = new PLTableEditor('admin/forums','forums.innd','id_innd'); | |
48e11686 PC |
77 | $table_editor->add_sort_field('priority', true, true); |
78 | $table_editor->describe('read_perm','lecture',true); | |
79 | $table_editor->describe('write_perm','écriture',true); | |
d90cbe1a | 80 | $table_editor->describe('priority','priorité',true); |
669cb0e0 | 81 | $table_editor->describe('comment','commentaire',true); |
82 | $table_editor->apply($page, $action, $id); | |
48e11686 | 83 | $page->changeTpl('forums/admin.tpl'); |
e73e78b9 | 84 | $page->addJsLink('jquery.js'); |
669cb0e0 | 85 | } |
86 | ||
5f4a0314 | 87 | static function run_banana(&$page, $params = null) |
a3a1d23b | 88 | { |
3d9b1d30 | 89 | $page->changeTpl('banana/index.tpl'); |
46f272fe | 90 | $page->setTitle('Forums & PA'); |
3d9b1d30 | 91 | |
24cec3d8 | 92 | require_once 'banana/forum.inc.php'; |
4f355064 | 93 | run_banana($page, 'ForumsBanana', $params); |
a3a1d23b | 94 | } |
f585e5a4 | 95 | } |
96 | ||
a7de4ef7 | 97 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
f585e5a4 | 98 | ?> |