Commit | Line | Data |
---|---|---|
f585e5a4 | 1 | <?php |
2 | /*************************************************************************** | |
12262f13 | 3 | * Copyright (C) 2003-2011 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( | |
5ae3e9a9 SJ |
27 | 'banana' => $this->make_hook('banana', AUTH_COOKIE, 'forums'), |
28 | 'banana/rss' => $this->make_hook('rss', AUTH_PUBLIC, 'forums', NO_HTTPS), | |
bfe9f4c7 | 29 | 'admin/forums' => $this->make_hook('forums_bans', AUTH_PASSWD, 'admin'), |
a3a1d23b | 30 | ); |
f585e5a4 | 31 | } |
32 | ||
26ba053e | 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 | ||
26ba053e | 47 | function handler_rss($page, $group, $alias, $hash, $file = null) |
f107d806 | 48 | { |
6544d0e1 | 49 | if (is_null($file)) { |
50 | if (is_null($hash)) { | |
f3e66b56 | 51 | return PL_FORBIDDEN; |
6544d0e1 | 52 | } |
53 | $this->handler_rss($page, null, $group, $alias, $hash); | |
54 | } | |
f3e66b56 FB |
55 | $user = Platal::session()->tokenAuth($alias, $hash); |
56 | if (is_null($user)) { | |
57 | return PL_FORBIDDEN; | |
6544d0e1 | 58 | } |
6544d0e1 | 59 | |
60 | require_once 'banana/forum.inc.php'; | |
f3e66b56 | 61 | $banana = new ForumsBanana($user, array('group' => $group, 'action' => 'rss2')); |
4f355064 | 62 | $banana->run(); |
6544d0e1 | 63 | exit; |
f107d806 | 64 | } |
65 | ||
26ba053e | 66 | function handler_forums_bans($page, $action = 'list', $id = null) |
669cb0e0 | 67 | { |
46f272fe | 68 | $page->setTitle('Administration - Bannissements des forums'); |
669cb0e0 | 69 | $page->assign('title', 'Gestion des mises au ban'); |
7d15f750 | 70 | $table_editor = new PLTableEditor('admin/forums','forum_innd','id_innd'); |
48e11686 PC |
71 | $table_editor->add_sort_field('priority', true, true); |
72 | $table_editor->describe('read_perm','lecture',true); | |
73 | $table_editor->describe('write_perm','écriture',true); | |
d90cbe1a | 74 | $table_editor->describe('priority','priorité',true); |
669cb0e0 | 75 | $table_editor->describe('comment','commentaire',true); |
76 | $table_editor->apply($page, $action, $id); | |
48e11686 | 77 | $page->changeTpl('forums/admin.tpl'); |
669cb0e0 | 78 | } |
79 | ||
26ba053e | 80 | static function run_banana($page, $params = null) |
a3a1d23b | 81 | { |
3d9b1d30 | 82 | $page->changeTpl('banana/index.tpl'); |
46f272fe | 83 | $page->setTitle('Forums & PA'); |
3d9b1d30 | 84 | |
24cec3d8 | 85 | require_once 'banana/forum.inc.php'; |
4f355064 | 86 | run_banana($page, 'ForumsBanana', $params); |
a3a1d23b | 87 | } |
f585e5a4 | 88 | } |
89 | ||
a7de4ef7 | 90 | // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: |
f585e5a4 | 91 | ?> |