forked from minimanager/minimanager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forum.php
154 lines (123 loc) · 5.54 KB
/
forum.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
// page header, and any additional required libraries
require_once 'header.php';
require_once 'config/forum.conf.php';
require_once 'libs/forum_lib.php';
require_once 'libs/bbcode_lib.php';
// minimum permission to view page
valid_login($action_permission['read']);
$sqlm = new SQL;
$sqlm->connect($mmfpm_db['addr'], $mmfpm_db['user'], $mmfpm_db['pass'], $mmfpm_db['name']);
$cid = $sqlm->query('
SELECT category, name, description, side_access, level_post_topic, level_read, level_post
FROM mm_forum_categories');
while ($category = $sqlm->fetch_assoc($cid))
{
if(!isset($category['level_read']))
$category['level_read'] = 0;
if(!isset($category['level_post']))
$category['level_post'] = 0;
if(!isset($category['level_post_topic']))
$category['level_post_topic'] = 0;
if(!isset($category['side_access']))
$category['side_access'] = 'ALL';
$fid = $sqlm->query('
SELECT forum, category, name, description, side_access, level_post_topic, level_read, level_post
FROM mm_forum_forums
WHERE category = '.$category['category'].'');
while ($forum = $sqlm->fetch_assoc($fid))
{
if(!isset($forum['level_read']))
$forum['level_read'] = 0;
if(!isset($forum['level_post']))
$forum['level_post'] = 0;
if(!isset($forum['level_post_topic']))
$forum['level_post_topic'] = 0;
if(!isset($forum['side_access']))
$forum['side_access'] = 'ALL';
}
}
// #######################################################################################################
// Forum_Index : Display the forums in categories
// #######################################################################################################
require_once './include/forum/forum_index.php';
// #######################################################################################################
// Display each forums
// #######################################################################################################
require_once './include/forum/forum_forum_view.php';
// #######################################################################################################
// Display Topic
// #######################################################################################################
require_once './include/forum/forum_topic_view.php';
// #######################################################################################################
// Add Topic AND Do Add Topic
// #######################################################################################################
require_once './include/forum/forum_topic_add.php';
// #######################################################################################################
// Edit Topic
// Close / Announce / Stick
// #######################################################################################################
require_once './include/forum/forum_topic_edit.php';
// #######################################################################################################
// Move Topic AND Do Move Topic
// #######################################################################################################
require_once './include/forum/forum_topic_move.php';
// #######################################################################################################
// Add Post
// #######################################################################################################
require_once './include/forum/forum_post_add.php';
// #######################################################################################################
// Delete Post AND Do Delete Post
// #######################################################################################################
require_once './include/forum/forum_post_del.php';
// #######################################################################################################
// Edit Post AND Do Edit Post
// #######################################################################################################
require_once './include/forum/forum_post_edit.php';
//#############################################################################
// MAIN
//#############################################################################
// load language
$forum_lang = lang_forum();
// $_GET and SECURE
$action = (isset($_GET['action'])) ? $_GET['action'] : NULL;
// define functions to be called by actions
if ('index' == $action)
forum_index($sqlr, $sqlm);
elseif ('view_forum' == $action)
forum_view_forum($sqlm);
elseif ('view_topic' == $action)
forum_view_topic($sqlr, $sqlc, $sqlm);
elseif ('add_topic' == $action)
forum_add_topic($sqlm);
elseif ('do_add_topic' == $action)
forum_do_add_topic($sqlm);
elseif ('do_edit_close' == $action)
forum_do_edit_close($sqlm);
elseif ('do_edit_announce' == $action)
forum_do_edit_announce($sqlm);
elseif ('do_edit_stick' == $action)
forum_do_edit_stick($sqlm);
elseif ('move_topic' == $action)
forum_move_topic($sqlm);
elseif ('do_move_topic' == $action)
forum_do_move_topic($sqlm);
elseif ('do_add_post' == $action)
forum_do_add_post($sqlm);
elseif ('delete_post' == $action)
forum_delete_post($sqlm);
elseif ('do_delete_post' == $action)
forum_do_delete_post($sqlm);
elseif ('edit_post' == $action)
forum_edit_post($sqlm);
elseif ('do_edit_post' == $action)
forum_do_edit_post($sqlm);
else
forum_index($sqlr, $sqlm);
// close whats not needed anymore
unset($action);
unset($action_permission);
unset($forum_lang);
// page footer
require_once 'footer.php';
?>