|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
// $Id: admin/index.php,v 1.40 2006/01/01 C. Felix AKA the Cat |
|
3
|
|
|
// ------------------------------------------------------------------------ // |
|
4
|
|
|
// XF Guestbook // |
|
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
|
|
|
// You may not change or alter any portion of this comment or credits // |
|
12
|
|
|
// of supporting developers from this source code or any supporting // |
|
13
|
|
|
// source code which is considered copyrighted (c) material of the // |
|
14
|
|
|
// original comment or credit authors. // |
|
15
|
|
|
// // |
|
16
|
|
|
// This program is distributed in the hope that it will be useful, // |
|
17
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of // |
|
18
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // |
|
19
|
|
|
// GNU General Public License for more details. // |
|
20
|
|
|
// // |
|
21
|
|
|
// You should have received a copy of the GNU General Public License // |
|
22
|
|
|
// along with this program; if not, write to the Free Software // |
|
23
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // |
|
24
|
|
|
// ------------------------------------------------------------------------ // |
|
25
|
|
|
|
|
26
|
|
|
include dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
|
27
|
|
|
include_once dirname(__DIR__) . '/include/cp_functions.php'; |
|
28
|
|
|
include_once __DIR__ . '/admin_header.php'; |
|
29
|
|
|
|
|
30
|
|
|
if (!isset($xoopsModuleConfig['flagdir'])) { |
|
31
|
|
|
redirect_header(XOOPS_URL . '/modules/system/admin.php?fct=modulesadmin&op=update&module=' . $xoopsModule->dirname(), 4, _AM_XFGB_MUST_UPDATE); |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
include_once dirname(__DIR__) . '/include/functions.php'; |
|
35
|
|
|
//include_once("../class/msg.php"); |
|
36
|
|
|
|
|
37
|
|
View Code Duplication |
if (isset($_GET['op'])) { |
|
|
|
|
|
|
38
|
|
|
$op = $_GET['op']; |
|
39
|
|
|
} elseif (isset($_POST['op'])) { |
|
40
|
|
|
$op = $_POST['op']; |
|
41
|
|
|
} else { |
|
42
|
|
|
$op = 'show'; |
|
43
|
|
|
} |
|
44
|
|
|
|
|
45
|
|
View Code Duplication |
if (isset($_GET['msg_id'])) { |
|
|
|
|
|
|
46
|
|
|
$msg_id = (int)$_GET['msg_id']; |
|
47
|
|
|
} elseif (isset($_POST['msg_id'])) { |
|
48
|
|
|
$msg_id = (int)$_POST['msg_id']; |
|
49
|
|
|
} else { |
|
50
|
|
|
$msg_id = 0; |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
$msg_handler = xoops_getModuleHandler('msg'); |
|
54
|
|
|
|
|
55
|
|
|
function delete() |
|
|
|
|
|
|
56
|
|
|
{ |
|
57
|
|
|
global $msg_handler, $xoopsModule; |
|
|
|
|
|
|
58
|
|
|
$msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0; |
|
59
|
|
|
if ($msg_count > 0) { |
|
60
|
|
|
$messagesent = _AM_XFGB_MSGDELETED; |
|
61
|
|
|
for ($i = 0; $i < $msg_count; $i++) { |
|
62
|
|
|
$msg = $msg_handler->get($_POST['msg_id'][$i]); |
|
63
|
|
|
$filename = $msg->getVar('title'); |
|
|
|
|
|
|
64
|
|
|
$filename = $msg->getVar('photo'); |
|
65
|
|
|
if (!$msg_handler->delete($msg)) { |
|
66
|
|
|
$messagesent = _AM_XFGB_ERRORDEL; |
|
67
|
|
|
} |
|
68
|
|
View Code Duplication |
if ('' !== $filename) { |
|
|
|
|
|
|
69
|
|
|
$filename = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->getVar('dirname') . '/' . $filename; |
|
70
|
|
|
unlink($filename); |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
} else { |
|
74
|
|
|
$messagesent = _AM_XFGB_NOMSG; |
|
75
|
|
|
} |
|
76
|
|
|
redirect_header($_SERVER['PHP_SELF'], 2, $messagesent); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
function approve() |
|
|
|
|
|
|
80
|
|
|
{ |
|
81
|
|
|
global $msg_handler; |
|
|
|
|
|
|
82
|
|
|
$msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0; |
|
83
|
|
|
if ($msg_count > 0) { |
|
84
|
|
|
$messagesent = _AM_XFGB_VALIDATE; |
|
85
|
|
|
for ($i = 0; $i < $msg_count; $i++) { |
|
86
|
|
|
$msg = $msg_handler->get($_POST['msg_id'][$i]); |
|
87
|
|
|
$msg->setVar('moderate', 0); |
|
88
|
|
|
if (!$msg_handler->insert($msg)) { |
|
89
|
|
|
$messagesent = _AM_XFGB_ERRORVALID; |
|
90
|
|
|
} |
|
91
|
|
|
} |
|
92
|
|
|
} else { |
|
93
|
|
|
$messagesent = _AM_XFGB_NOMSG; |
|
94
|
|
|
} |
|
95
|
|
|
redirect_header($_SERVER['PHP_SELF'], 2, $messagesent); |
|
96
|
|
|
exit(); |
|
|
|
|
|
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
function banish() |
|
|
|
|
|
|
100
|
|
|
{ |
|
101
|
|
|
global $msg_handler, $xoopsDB; |
|
|
|
|
|
|
102
|
|
|
$msg_count = (!empty($_POST['msg_id']) && is_array($_POST['msg_id'])) ? count($_POST['msg_id']) : 0; |
|
103
|
|
|
if ($msg_count > 0) { |
|
104
|
|
|
$messagesent = _AM_XFGB_BANISHED; |
|
105
|
|
|
for ($i = 0; $i < $msg_count; $i++) { |
|
106
|
|
|
$msg = $msg_handler->get($_POST['msg_id'][$i]); |
|
107
|
|
|
$ip[$i] = $msg->getVar('poster_ip'); |
|
|
|
|
|
|
108
|
|
|
$msg->setVar('moderate', 1); |
|
109
|
|
|
if (!$msg_handler->insert($msg)) { |
|
110
|
|
|
$messagesent = _AM_XFGB_ERRORBANISHED; |
|
111
|
|
|
} |
|
112
|
|
|
} |
|
113
|
|
|
$ip = array_unique($ip); |
|
|
|
|
|
|
114
|
|
|
$badips = xfgb_get_badips(); |
|
115
|
|
|
foreach ($ip as $oneip) { |
|
116
|
|
|
if (!in_array($oneip, $badips)) { |
|
117
|
|
|
$sql = 'INSERT INTO ' . $xoopsDB->prefix('xfguestbook_badips') . " (ip_value) VALUES ('$oneip')"; |
|
118
|
|
|
$result = $xoopsDB->query($sql); |
|
|
|
|
|
|
119
|
|
|
} |
|
120
|
|
|
} |
|
121
|
|
|
} else { |
|
122
|
|
|
$messagesent = _AM_XFGB_NOMSG; |
|
123
|
|
|
} |
|
124
|
|
|
|
|
125
|
|
|
redirect_header($_SERVER['PHP_SELF'], 2, $messagesent); |
|
126
|
|
|
exit(); |
|
|
|
|
|
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
function show() |
|
|
|
|
|
|
130
|
|
|
{ |
|
131
|
|
|
global $msg_handler, $xoopsModule, $pathIcon16; |
|
|
|
|
|
|
132
|
|
|
$pick = isset($_GET['pick']) ? (int)$_GET['pick'] : 0; |
|
|
|
|
|
|
133
|
|
|
$start = isset($_GET['start']) ? (int)$_GET['start'] : 0; |
|
134
|
|
|
$sel_status = isset($_GET['sel_status']) ? $_GET['sel_status'] : 0; |
|
135
|
|
|
$sel_order = isset($_GET['sel_order']) ? $_GET['sel_order'] : 0; |
|
136
|
|
|
$limit = 10; |
|
137
|
|
|
$status_option0 = ''; |
|
138
|
|
|
$status_option1 = ''; |
|
139
|
|
|
$status_option2 = ''; |
|
140
|
|
|
$order_option_asc = ''; |
|
141
|
|
|
$order_option_desc = ''; |
|
142
|
|
|
|
|
143
|
|
|
switch ($sel_status) { |
|
144
|
|
|
case 0 : |
|
|
|
|
|
|
145
|
|
|
$status_option0 = "selected='selected'"; |
|
146
|
|
|
$title = _AM_XFGB_ALLMSG; |
|
147
|
|
|
$criteria = new Criteria('msg_id', 0, '>'); |
|
148
|
|
|
$criteria->setSort('post_time'); |
|
149
|
|
|
break; |
|
150
|
|
|
|
|
151
|
|
|
case 1 : |
|
|
|
|
|
|
152
|
|
|
$status_option1 = "selected='selected'"; |
|
153
|
|
|
$title = _AM_XFGB_PUBMSG; |
|
154
|
|
|
$criteria = new Criteria('moderate', '0'); |
|
155
|
|
|
$criteria->setSort('post_time'); |
|
156
|
|
|
break; |
|
157
|
|
|
|
|
158
|
|
|
case 2 : |
|
|
|
|
|
|
159
|
|
|
$status_option2 = "selected='selected'"; |
|
160
|
|
|
$title = _AM_XFGB_WAITMSG; |
|
161
|
|
|
$criteria = new Criteria('moderate', '1'); |
|
162
|
|
|
$criteria->setSort('post_time'); |
|
163
|
|
|
break; |
|
164
|
|
|
|
|
165
|
|
|
} |
|
166
|
|
|
|
|
167
|
|
|
switch ($sel_order) { |
|
168
|
|
|
case 1: |
|
169
|
|
|
$order_option_asc = "selected='selected'"; |
|
170
|
|
|
$criteria->setOrder('ASC'); |
|
|
|
|
|
|
171
|
|
|
break; |
|
172
|
|
|
|
|
173
|
|
|
case 0: |
|
174
|
|
|
$order_option_desc = "selected='selected'"; |
|
175
|
|
|
$criteria->setOrder('DESC'); |
|
176
|
|
|
break; |
|
177
|
|
|
} |
|
178
|
|
|
|
|
179
|
|
|
$totalcount = $msg_handler->countMsg($criteria); |
|
180
|
|
|
$criteria->setOrder('DESC'); |
|
181
|
|
|
$criteria->setLimit($limit); |
|
182
|
|
|
$criteria->setStart($start); |
|
183
|
|
|
$msg =& $msg_handler->getObjects($criteria); |
|
184
|
|
|
|
|
185
|
|
|
$badips = xfgb_get_badips(); |
|
186
|
|
|
|
|
187
|
|
|
/* -- Code to show selected terms -- */ |
|
188
|
|
|
echo "<form name='pick' id='pick' action='" . $_SERVER['PHP_SELF'] . "' method='GET' style='margin: 0;'>"; |
|
189
|
|
|
|
|
190
|
|
|
echo " |
|
191
|
|
|
<table width='100%' cellspacing='1' cellpadding='2' border='0' style='border-left: 1px solid silver; border-top: 1px solid silver; border-right: 1px solid silver;'> |
|
192
|
|
|
<tr> |
|
193
|
|
|
<td><span style='font-weight: bold; font-size: 12px; font-variant: small-caps;'>" . $title . ' : ' . $totalcount . "</span></td> |
|
|
|
|
|
|
194
|
|
|
<td align='right'> |
|
195
|
|
|
" . _AM_XFGB_DISPLAY . " : |
|
196
|
|
|
<select name='sel_status' onchange='submit()'> |
|
197
|
|
|
<option value = '0' $status_option0>" . _AM_XFGB_ALLMSG . " </option> |
|
198
|
|
|
<option value = '1' $status_option1>" . _AM_XFGB_PUBMSG . " </option> |
|
199
|
|
|
<option value = '2' $status_option2>" . _AM_XFGB_WAITMSG . ' </option> |
|
200
|
|
|
</select> |
|
201
|
|
|
' . _AM_XFGB_SELECT_SORT . " |
|
202
|
|
|
<select name='sel_order' onchange='submit()'> |
|
203
|
|
|
<option value = '1' $order_option_asc>" . _AM_XFGB_SORT_ASC . "</option> |
|
204
|
|
|
<option value = '0' $order_option_desc>" . _AM_XFGB_SORT_DESC . '</option> |
|
205
|
|
|
</select> |
|
206
|
|
|
</td> |
|
207
|
|
|
</tr> |
|
208
|
|
|
</table> |
|
209
|
|
|
</form>'; |
|
210
|
|
|
/* -- end code to show selected terms -- */ |
|
211
|
|
|
|
|
212
|
|
|
echo "<table border='1' width='100%' cellpadding ='2' cellspacing='1'>"; |
|
213
|
|
|
echo "<tr class='bg3'>"; |
|
214
|
|
|
echo "<td align='center'></td>"; |
|
215
|
|
|
echo "<td align='center'><b><input type='hidden' name='op' value='delete' /></td>"; |
|
216
|
|
|
echo "<td align='center'><b>" . _AM_XFGB_NAME . '</td>'; |
|
217
|
|
|
echo "<td align='center'><b>" . _AM_XFGB_TITLE . '</td>'; |
|
218
|
|
|
echo "<td align='center'><b>" . _AM_XFGB_MESSAGE . '</td>'; |
|
219
|
|
|
echo "<td align='center'><b>" . _AM_XFGB_DATE . '</td>'; |
|
220
|
|
|
echo "<td align='center'><b>" . _AM_XFGB_ACTION . '</td>'; |
|
221
|
|
|
echo '</tr>'; |
|
222
|
|
|
|
|
223
|
|
|
if ('0' != $totalcount) { |
|
224
|
|
|
echo "<form name='msglist' id='list' action='" . $_SERVER['PHP_SELF'] . "' method='POST' style='margin: 0;'>"; |
|
225
|
|
|
|
|
226
|
|
|
foreach ($msg as $onemsg) { |
|
227
|
|
|
$all_msg = array(); |
|
228
|
|
|
$all_msg['post_time'] = formatTimestamp($onemsg->getVar('post_time')); |
|
229
|
|
|
$all_msg['msg_id'] = $onemsg->getVar('msg_id'); |
|
230
|
|
|
$all_msg['user'] = ($onemsg->getVar('user_id') > 0) ? XoopsUser::getUnameFromId($onemsg->getVar('user_id')) : $onemsg->getVar('uname'); |
|
231
|
|
|
$all_msg['action'] = "<a href='main.php?op=edit&msg_id=" . $onemsg->getVar('msg_id') . "'><img src='" . $pathIcon16 . "/edit.png'></a>"; |
|
232
|
|
|
$img_status = "<img src='" . XOOPS_URL . '/modules/' . $xoopsModule->dirname() . '/assets/images/'; |
|
233
|
|
|
if ($onemsg->getVar('moderate')) { |
|
234
|
|
|
$img_status .= "ic15_question.gif'>"; |
|
235
|
|
|
} else { |
|
236
|
|
|
$img_status .= "ic15_ok.gif'>"; |
|
237
|
|
|
} |
|
238
|
|
|
$all_msg['title'] = "<a href='../main.php?op=show_one&msg_id=" . $onemsg->getVar('msg_id') . "'>" . $onemsg->getVar('title') . '</a>'; |
|
239
|
|
|
$all_msg['message'] = $onemsg->getVar('message'); |
|
240
|
|
|
|
|
241
|
|
|
if ($onemsg->getVar('photo')) { |
|
242
|
|
|
$all_msg['message'] = |
|
243
|
|
|
"<img src=\"" . XOOPS_UPLOAD_URL . '/' . $xoopsModule->getVar('dirname') . '/' . $onemsg->getVar('photo') . "\" align = \"left\" hspace =\"10\">" . $onemsg->getVar('message'); |
|
244
|
|
|
} else { |
|
245
|
|
|
$all_msg['message'] = $onemsg->getVar('message'); |
|
246
|
|
|
} |
|
247
|
|
|
|
|
248
|
|
|
echo '<tr>'; |
|
249
|
|
|
echo "<td align='center' class='even'><input type='checkbox' name='msg_id[]' id='msg_id[]' value='" . $all_msg['msg_id'] . "'/></td>"; |
|
250
|
|
|
echo "<td align='center' class = 'head'><b>" . $img_status . '</b></td>'; |
|
251
|
|
|
echo "<td align='center' class = 'even'>" . $all_msg['user'] . '</td>'; |
|
252
|
|
|
echo "<td align='left' class = 'odd'>" . $all_msg['title'] . '</td>'; |
|
253
|
|
|
echo "<td align='left' class = 'even'>" . $all_msg['message'] . '</td>'; |
|
254
|
|
|
echo "<td class='odd'>" . $all_msg['post_time'] . '<br>'; |
|
255
|
|
|
if (in_array($onemsg->getVar('poster_ip'), $badips)) { |
|
256
|
|
|
echo "<font color=\"#FF0000\"><b>" . $onemsg->getVar('poster_ip') . '</b></font></td>'; |
|
257
|
|
|
} else { |
|
258
|
|
|
echo $onemsg->getVar('poster_ip') . '</td>'; |
|
259
|
|
|
} |
|
260
|
|
|
echo "<td align='center' class='even'>" . $all_msg['action'] . '</td>'; |
|
261
|
|
|
echo '</tr>'; |
|
262
|
|
|
unset($all_msg); |
|
263
|
|
|
} |
|
264
|
|
|
echo "<tr class='foot'><td><select name='op'>"; |
|
265
|
|
|
if (1 != $sel_status) { |
|
266
|
|
|
echo "<option value='approve'>" . _AM_XFGB_PUB . '</option>'; |
|
267
|
|
|
} |
|
268
|
|
|
echo "<option value='delete'>" . _DELETE . '</option>'; |
|
269
|
|
|
echo "<option value='banish'>" . _AM_XFGB_BAN . '</option>'; |
|
270
|
|
|
echo '</select> </td>'; |
|
271
|
|
|
echo "<td colspan='6'>" . $GLOBALS['xoopsSecurity']->getTokenHTML() . "<input type='submit' value='" . _GO . "' />"; |
|
272
|
|
|
echo '</td></tr>'; |
|
273
|
|
|
echo '</form>'; |
|
274
|
|
|
} else { |
|
275
|
|
|
echo "<tr ><td align='center' colspan ='10' class = 'head'><b>" . _AM_XFGB_NOMSG . '</b></td></tr>'; |
|
276
|
|
|
} |
|
277
|
|
|
echo '</table><br>'; |
|
278
|
|
View Code Duplication |
if ($totalcount > $limit) { |
|
|
|
|
|
|
279
|
|
|
include_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
|
280
|
|
|
$pagenav = new XoopsPageNav($totalcount, $limit, $start, 'start', 'sel_status=' . $sel_status . '&sel_order=' . $sel_order); |
|
281
|
|
|
echo "<div style='text-align: center;' class = 'head'>" . $pagenav->renderNav() . '</div><br>'; |
|
282
|
|
|
} else { |
|
283
|
|
|
echo ''; |
|
284
|
|
|
} |
|
285
|
|
|
echo '<br>'; |
|
286
|
|
|
} |
|
287
|
|
|
|
|
288
|
|
|
switch ($op) { |
|
289
|
|
|
case 'save': |
|
290
|
|
|
global $xoopsModule; |
|
|
|
|
|
|
291
|
|
|
if (!$GLOBALS['xoopsSecurity']->check()) { |
|
292
|
|
|
redirect_header('index.php', 2, implode('<br>', $GLOBALS['xoopsSecurity']->getErrors())); |
|
293
|
|
|
} |
|
294
|
|
|
$msgstop = ''; |
|
295
|
|
|
$msg = $msg_handler->get($msg_id); |
|
296
|
|
|
$del_img = isset($_POST['del_img']) ? (int)$_POST['del_img'] : 0; |
|
297
|
|
|
if ($del_img) { |
|
298
|
|
|
$filename = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->getVar('dirname') . '/' . $msg->getVar('photo'); |
|
299
|
|
|
unlink($filename); |
|
300
|
|
|
$msg->setVar('photo', ''); |
|
301
|
|
|
} elseif (!empty($_FILES['photo']['name'])) { |
|
302
|
|
|
xfgb_upload(); |
|
303
|
|
|
$photo = str_replace('tmp_', 'msg_', $preview_name); |
|
304
|
|
|
$photos_dir = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->getVar('dirname') . '/'; |
|
305
|
|
|
rename($photos_dir . $preview_name, $photos_dir . $photo); |
|
306
|
|
View Code Duplication |
if ('' !== $msg->getVar('photo')) { |
|
|
|
|
|
|
307
|
|
|
$filename = XOOPS_UPLOAD_PATH . '/' . $xoopsModule->getVar('dirname') . '/' . $msg->getVar('photo'); |
|
308
|
|
|
unlink($filename); |
|
309
|
|
|
} |
|
310
|
|
|
$msg->setVar('photo', $photo); |
|
311
|
|
|
} |
|
312
|
|
|
if (!empty($msgstop)) { |
|
313
|
|
|
redirect_header('main.php?op=edit&msg_id=' . $msg_id, 2, $msgstop); |
|
314
|
|
|
} |
|
315
|
|
|
$uname = isset($_POST['uname']) ? $_POST['uname'] : ''; |
|
316
|
|
|
$email = isset($_POST['email']) ? $_POST['email'] : ''; |
|
317
|
|
|
$url = isset($_POST['url']) ? $_POST['url'] : ''; |
|
318
|
|
|
$title = isset($_POST['title']) ? $_POST['title'] : ''; |
|
319
|
|
|
$message = isset($_POST['message']) ? $_POST['message'] : ''; |
|
320
|
|
|
$note = isset($_POST['note']) ? $_POST['note'] : ''; |
|
321
|
|
|
$gender = isset($_POST['gender']) ? $_POST['gender'] : ''; |
|
322
|
|
|
$country = isset($_POST['country']) ? $_POST['country'] : ''; |
|
323
|
|
|
$other = isset($_POST['other']) ? $_POST['other'] : ''; |
|
324
|
|
|
$moderate = isset($_POST['moderate']) ? (int)$_POST['moderate'] : 0; |
|
325
|
|
|
|
|
326
|
|
|
$msg->setVar('uname', $uname); |
|
327
|
|
|
$msg->setVar('email', $email); |
|
328
|
|
|
$msg->setVar('url', $url); |
|
329
|
|
|
$msg->setVar('title', $title); |
|
330
|
|
|
$msg->setVar('message', $message); |
|
331
|
|
|
$msg->setVar('note', $note); |
|
332
|
|
|
$msg->setVar('gender', $gender); |
|
333
|
|
|
if ('' !== $country) { |
|
334
|
|
|
$msg->setVar('country', $country); |
|
335
|
|
|
$msg->setVar('flagdir', $xoopsModuleConfig['flagdir']); |
|
336
|
|
|
} |
|
337
|
|
|
$msg->setVar('other', $other); |
|
338
|
|
|
$msg->setVar('moderate', $moderate); |
|
339
|
|
|
if ($msg_handler->insert($msg)) { |
|
340
|
|
|
redirect_header('main.php?op=show', 1, _AM_XFGB_MSGMOD); |
|
341
|
|
|
} else { |
|
342
|
|
|
redirect_header('main.php?op=show', 2, _AM_XFGB_MSGERROR); |
|
343
|
|
|
} |
|
344
|
|
|
break; |
|
345
|
|
|
|
|
346
|
|
|
case 'edit': |
|
347
|
|
|
xoops_cp_header(); |
|
348
|
|
|
$index_admin = new ModuleAdmin(); |
|
349
|
|
|
echo $index_admin->addNavigation(basename(__FILE__)); |
|
350
|
|
|
//xfguestbook_admin_menu(0); |
|
351
|
|
|
$msg = $msg_handler->get($msg_id); |
|
352
|
|
|
include_once dirname(__DIR__) . '/include/form_edit.inc.php'; |
|
353
|
|
|
$msg_form->display(); |
|
354
|
|
|
include __DIR__ . '/admin_footer.php'; |
|
355
|
|
|
//xoops_cp_footer(); |
|
356
|
|
|
break; |
|
357
|
|
|
|
|
358
|
|
|
case 'approve': |
|
359
|
|
|
approve(); |
|
360
|
|
|
break; |
|
361
|
|
|
|
|
362
|
|
|
case 'delete': |
|
363
|
|
|
delete(); |
|
364
|
|
|
break; |
|
365
|
|
|
|
|
366
|
|
|
case 'banish': |
|
367
|
|
|
banish(); |
|
368
|
|
|
break; |
|
369
|
|
|
|
|
370
|
|
|
case 'show': |
|
371
|
|
View Code Duplication |
default: |
|
|
|
|
|
|
372
|
|
|
xoops_cp_header(); |
|
373
|
|
|
$index_admin = new ModuleAdmin(); |
|
374
|
|
|
echo $index_admin->addNavigation(basename(__FILE__)); |
|
375
|
|
|
//xfguestbook_admin_menu(0); |
|
376
|
|
|
show(); |
|
377
|
|
|
include __DIR__ . '/admin_footer.php'; |
|
378
|
|
|
//xoops_cp_footer(); |
|
379
|
|
|
break; |
|
380
|
|
|
} |
|
381
|
|
|
|
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.