@@ -51,8 +51,8 @@ |
||
51 | 51 | $myts = \MyTextSanitizer::getInstance(); |
52 | 52 | |
53 | 53 | if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof XoopsTpl)) { |
54 | - require_once $GLOBALS['xoops']->path('class/template.php'); |
|
55 | - $xoopsTpl = new \XoopsTpl(); |
|
54 | + require_once $GLOBALS['xoops']->path('class/template.php'); |
|
55 | + $xoopsTpl = new \XoopsTpl(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | $pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); |
@@ -33,15 +33,15 @@ |
||
33 | 33 | use XoopsModules\Newbb; |
34 | 34 | |
35 | 35 | //require_once $GLOBALS['xoops']->path('include/cp_header.php'); |
36 | -require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; |
|
37 | -require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/vars.php'); |
|
38 | -require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.user.php'); |
|
39 | -require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/functions.render.php'); |
|
36 | +require_once dirname(dirname(dirname(__DIR__))).'/include/cp_header.php'; |
|
37 | +require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/vars.php'); |
|
38 | +require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/functions.user.php'); |
|
39 | +require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/functions.render.php'); |
|
40 | 40 | //require_once $GLOBALS['xoops']->path('Frameworks/art/functions.php'); |
41 | 41 | //require_once $GLOBALS['xoops']->path('Frameworks/art/functions.admin.php'); |
42 | 42 | |
43 | -require_once dirname(__DIR__) . '/include/config.php'; |
|
44 | -require_once dirname(__DIR__) . '/include/common.php'; |
|
43 | +require_once dirname(__DIR__).'/include/config.php'; |
|
44 | +require_once dirname(__DIR__).'/include/common.php'; |
|
45 | 45 | |
46 | 46 | /** @var Newbb\Helper $helper */ |
47 | 47 | $helper = Newbb\Helper::getInstance(); |
@@ -48,269 +48,269 @@ |
||
48 | 48 | ///** @var Newbb\ForumHandler $forumHandler */ |
49 | 49 | //$forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
50 | 50 | switch ($op) { |
51 | - case 'moveforum': |
|
52 | - //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); |
|
51 | + case 'moveforum': |
|
52 | + //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); |
|
53 | 53 | |
54 | - if (Request::getInt('dest_forum', 0, 'POST')) { |
|
55 | - $dest = Request::getInt('dest_forum', 0, 'POST'); |
|
56 | - if ($dest > 0) { |
|
57 | - $pid = $dest; |
|
58 | - $forum_dest = $forumHandler->get($pid); |
|
59 | - $cid = $forum_dest->getVar('cat_id'); |
|
60 | - unset($forum_dest); |
|
61 | - } else { |
|
62 | - $cid = abs($dest); |
|
63 | - $pid = 0; |
|
64 | - } |
|
65 | - $forumObject = $forumHandler->get($forum_id); |
|
66 | - $forumObject->setVar('cat_id', $cid); |
|
67 | - $forumObject->setVar('parent_forum', $pid); |
|
68 | - $forumHandler->insert($forumObject); |
|
69 | - if ($forumHandler->insert($forumObject)) { |
|
70 | - if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
|
71 | - $forums = array_map('intval', array_values($subforums)); |
|
72 | - $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
73 | - } |
|
54 | + if (Request::getInt('dest_forum', 0, 'POST')) { |
|
55 | + $dest = Request::getInt('dest_forum', 0, 'POST'); |
|
56 | + if ($dest > 0) { |
|
57 | + $pid = $dest; |
|
58 | + $forum_dest = $forumHandler->get($pid); |
|
59 | + $cid = $forum_dest->getVar('cat_id'); |
|
60 | + unset($forum_dest); |
|
61 | + } else { |
|
62 | + $cid = abs($dest); |
|
63 | + $pid = 0; |
|
64 | + } |
|
65 | + $forumObject = $forumHandler->get($forum_id); |
|
66 | + $forumObject->setVar('cat_id', $cid); |
|
67 | + $forumObject->setVar('parent_forum', $pid); |
|
68 | + $forumHandler->insert($forumObject); |
|
69 | + if ($forumHandler->insert($forumObject)) { |
|
70 | + if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
|
71 | + $forums = array_map('intval', array_values($subforums)); |
|
72 | + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
73 | + } |
|
74 | 74 | |
75 | - //$cacheHelper->delete('forum'); |
|
76 | - redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED); |
|
77 | - } else { |
|
78 | - redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); |
|
79 | - } |
|
80 | - } else { |
|
81 | - $box = '<select name="dest_forum">'; |
|
82 | - $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
83 | - $box .= newbbForumSelectBox($forum_id, 'all', true, true); |
|
84 | - $box .= '</select>'; |
|
75 | + //$cacheHelper->delete('forum'); |
|
76 | + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MOVED); |
|
77 | + } else { |
|
78 | + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); |
|
79 | + } |
|
80 | + } else { |
|
81 | + $box = '<select name="dest_forum">'; |
|
82 | + $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
83 | + $box .= newbbForumSelectBox($forum_id, 'all', true, true); |
|
84 | + $box .= '</select>'; |
|
85 | 85 | |
86 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
87 | - echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">'; |
|
88 | - echo '<input type="hidden" name="op" value="moveforum" />'; |
|
89 | - echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
90 | - echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
|
91 | - echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MOVETHISFORUM . '</strong></td>'; |
|
92 | - echo '</tr>'; |
|
93 | - echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
94 | - echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
95 | - echo '</table></form>'; |
|
96 | - echo '</td></tr></table>'; |
|
97 | - } |
|
98 | - break; |
|
86 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
87 | + echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">'; |
|
88 | + echo '<input type="hidden" name="op" value="moveforum" />'; |
|
89 | + echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
90 | + echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
|
91 | + echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MOVETHISFORUM . '</strong></td>'; |
|
92 | + echo '</tr>'; |
|
93 | + echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
94 | + echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
95 | + echo '</table></form>'; |
|
96 | + echo '</td></tr></table>'; |
|
97 | + } |
|
98 | + break; |
|
99 | 99 | |
100 | - case 'mergeforum': |
|
101 | - //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); |
|
100 | + case 'mergeforum': |
|
101 | + //if (!$newXoopsModuleGui) loadModuleAdminMenu(2, ""); |
|
102 | 102 | |
103 | - if (Request::getString('dest_forum', '', 'POST')) { |
|
104 | - $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST')); |
|
105 | - if (is_object($forum_dest)) { |
|
106 | - $cid = $forum_dest->getVar('cat_id'); |
|
107 | - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
108 | - $result_post = $GLOBALS['xoopsDB']->queryF($sql); |
|
103 | + if (Request::getString('dest_forum', '', 'POST')) { |
|
104 | + $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST')); |
|
105 | + if (is_object($forum_dest)) { |
|
106 | + $cid = $forum_dest->getVar('cat_id'); |
|
107 | + $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
108 | + $result_post = $GLOBALS['xoopsDB']->queryF($sql); |
|
109 | 109 | |
110 | - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
111 | - $result_topic = $GLOBALS['xoopsDB']->queryF($sql); |
|
110 | + $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
111 | + $result_topic = $GLOBALS['xoopsDB']->queryF($sql); |
|
112 | 112 | |
113 | - $forumObject = $forumHandler->get($forum_id); |
|
114 | - $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id)); |
|
115 | - if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
|
116 | - $forums = array_map('intval', array_values($subforums)); |
|
117 | - $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
118 | - } |
|
113 | + $forumObject = $forumHandler->get($forum_id); |
|
114 | + $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id)); |
|
115 | + if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
|
116 | + $forums = array_map('intval', array_values($subforums)); |
|
117 | + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
118 | + } |
|
119 | 119 | |
120 | - $forumHandler->delete($forumObject); |
|
120 | + $forumHandler->delete($forumObject); |
|
121 | 121 | |
122 | - $forumHandler->synchronization($forum_dest); |
|
123 | - unset($forum_dest); |
|
124 | - $cacheHelper->delete('forum'); |
|
122 | + $forumHandler->synchronization($forum_dest); |
|
123 | + unset($forum_dest); |
|
124 | + $cacheHelper->delete('forum'); |
|
125 | 125 | |
126 | - redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MERGED); |
|
127 | - } else { |
|
128 | - redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); |
|
129 | - } |
|
130 | - } else { |
|
131 | - $box = '<select name="dest_forum">'; |
|
132 | - $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
133 | - $box .= newbbForumSelectBox($forum_id, 'all'); |
|
134 | - $box .= '</select>'; |
|
135 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
136 | - echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post" name="forummove" id="forummove">'; |
|
137 | - echo '<input type="hidden" name="op" value="mergeforum" />'; |
|
138 | - echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
139 | - echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
|
140 | - echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MERGETHISFORUM . '</strong></td>'; |
|
141 | - echo '</tr>'; |
|
142 | - echo '<tr><td class="bg1" align="center">' . _AM_NEWBB_MERGETO_FORUM . '</td></tr>'; |
|
143 | - echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
144 | - echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
145 | - echo '</form></table>'; |
|
146 | - echo '</td></tr></table>'; |
|
147 | - } |
|
148 | - break; |
|
126 | + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_FORUM_MERGED); |
|
127 | + } else { |
|
128 | + redirect_header('admin_forum_manager.php?op=manage', 2, _AM_NEWBB_MSG_ERR_FORUM_MOVED); |
|
129 | + } |
|
130 | + } else { |
|
131 | + $box = '<select name="dest_forum">'; |
|
132 | + $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
133 | + $box .= newbbForumSelectBox($forum_id, 'all'); |
|
134 | + $box .= '</select>'; |
|
135 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
136 | + echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post" name="forummove" id="forummove">'; |
|
137 | + echo '<input type="hidden" name="op" value="mergeforum" />'; |
|
138 | + echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
139 | + echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
|
140 | + echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MERGETHISFORUM . '</strong></td>'; |
|
141 | + echo '</tr>'; |
|
142 | + echo '<tr><td class="bg1" align="center">' . _AM_NEWBB_MERGETO_FORUM . '</td></tr>'; |
|
143 | + echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
144 | + echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
145 | + echo '</form></table>'; |
|
146 | + echo '</td></tr></table>'; |
|
147 | + } |
|
148 | + break; |
|
149 | 149 | |
150 | - case 'save': |
|
150 | + case 'save': |
|
151 | 151 | |
152 | - if ($forum_id) { |
|
153 | - $forumObject = $forumHandler->get($forum_id); |
|
154 | - $message = _AM_NEWBB_FORUMUPDATE; |
|
155 | - } else { |
|
156 | - $forumObject = $forumHandler->create(); |
|
157 | - $message = _AM_NEWBB_FORUMCREATED; |
|
158 | - } |
|
152 | + if ($forum_id) { |
|
153 | + $forumObject = $forumHandler->get($forum_id); |
|
154 | + $message = _AM_NEWBB_FORUMUPDATE; |
|
155 | + } else { |
|
156 | + $forumObject = $forumHandler->create(); |
|
157 | + $message = _AM_NEWBB_FORUMCREATED; |
|
158 | + } |
|
159 | 159 | |
160 | - $forumObject->setVar('forum_name', Request::getString('forum_name', '', 'POST')); |
|
161 | - $forumObject->setVar('forum_desc', Request::getString('forum_desc', '', 'POST')); |
|
162 | - $forumObject->setVar('forum_order', Request::getInt('forum_order', 0, 'POST')); |
|
163 | - $forumObject->setVar('forum_moderator', Request::getArray('forum_moderator', [], 'POST')); |
|
164 | - $forumObject->setVar('parent_forum', Request::getInt('parent_forum', 0, 'POST')); |
|
165 | - $forumObject->setVar('attach_maxkb', Request::getInt('attach_maxkb', 0, 'POST')); |
|
166 | - $forumObject->setVar('attach_ext', Request::getString('attach_ext', '', 'POST')); |
|
167 | - $forumObject->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST')); |
|
168 | - if (Request::getInt('parent_forum', 0, 'POST')) { |
|
169 | - $parentObject = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']); |
|
170 | - $_POST['cat_id'] = $parentObject->getVar('cat_id'); |
|
171 | - } |
|
172 | - $forumObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
160 | + $forumObject->setVar('forum_name', Request::getString('forum_name', '', 'POST')); |
|
161 | + $forumObject->setVar('forum_desc', Request::getString('forum_desc', '', 'POST')); |
|
162 | + $forumObject->setVar('forum_order', Request::getInt('forum_order', 0, 'POST')); |
|
163 | + $forumObject->setVar('forum_moderator', Request::getArray('forum_moderator', [], 'POST')); |
|
164 | + $forumObject->setVar('parent_forum', Request::getInt('parent_forum', 0, 'POST')); |
|
165 | + $forumObject->setVar('attach_maxkb', Request::getInt('attach_maxkb', 0, 'POST')); |
|
166 | + $forumObject->setVar('attach_ext', Request::getString('attach_ext', '', 'POST')); |
|
167 | + $forumObject->setVar('hot_threshold', Request::getInt('hot_threshold', 0, 'POST')); |
|
168 | + if (Request::getInt('parent_forum', 0, 'POST')) { |
|
169 | + $parentObject = $forumHandler->get(Request::getInt('parent_forum', 0, 'POST'), ['cat_id']); |
|
170 | + $_POST['cat_id'] = $parentObject->getVar('cat_id'); |
|
171 | + } |
|
172 | + $forumObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
173 | 173 | |
174 | - if ($forumHandler->insert($forumObject)) { |
|
175 | - //$cacheHelper->delete('forum'); |
|
176 | - if (Request::getInt('perm_template', 0, 'POST')) { |
|
177 | - // /** var Newbb\PermissionHandler $permHandler */ |
|
178 | - // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
179 | - $perm_template = $permHandler->getTemplate(); |
|
180 | - /** @var \XoopsMemberHandler $memberHandler */ |
|
181 | - $memberHandler = xoops_getHandler('member'); |
|
182 | - $glist = $memberHandler->getGroupList(); |
|
183 | - $perms = $permHandler->getValidForumPerms(true); |
|
184 | - foreach (array_keys($glist) as $group) { |
|
185 | - foreach ($perms as $perm) { |
|
186 | - $ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); |
|
187 | - if (!in_array($forumObject->getVar('forum_id'), $ids)) { |
|
188 | - if (empty($perm_template[$group][$perm])) { |
|
189 | - $permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); |
|
190 | - } else { |
|
191 | - $permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); |
|
192 | - } |
|
193 | - } |
|
194 | - } |
|
195 | - } |
|
196 | - } |
|
197 | - redirect_header('admin_forum_manager.php', 2, $message); |
|
198 | - } else { |
|
199 | - redirect_header('admin_forum_manager.php?op=mod&forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR); |
|
200 | - } |
|
201 | - break; |
|
174 | + if ($forumHandler->insert($forumObject)) { |
|
175 | + //$cacheHelper->delete('forum'); |
|
176 | + if (Request::getInt('perm_template', 0, 'POST')) { |
|
177 | + // /** var Newbb\PermissionHandler $permHandler */ |
|
178 | + // $permHandler = Newbb\Helper::getInstance()->getHandler('Permission'); |
|
179 | + $perm_template = $permHandler->getTemplate(); |
|
180 | + /** @var \XoopsMemberHandler $memberHandler */ |
|
181 | + $memberHandler = xoops_getHandler('member'); |
|
182 | + $glist = $memberHandler->getGroupList(); |
|
183 | + $perms = $permHandler->getValidForumPerms(true); |
|
184 | + foreach (array_keys($glist) as $group) { |
|
185 | + foreach ($perms as $perm) { |
|
186 | + $ids = $permHandler->getItemIds($perm, $group, $xoopsModule->getVar('mid')); |
|
187 | + if (!in_array($forumObject->getVar('forum_id'), $ids)) { |
|
188 | + if (empty($perm_template[$group][$perm])) { |
|
189 | + $permHandler->deleteRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); |
|
190 | + } else { |
|
191 | + $permHandler->addRight($perm, $forumObject->getVar('forum_id'), $group, $xoopsModule->getVar('mid')); |
|
192 | + } |
|
193 | + } |
|
194 | + } |
|
195 | + } |
|
196 | + } |
|
197 | + redirect_header('admin_forum_manager.php', 2, $message); |
|
198 | + } else { |
|
199 | + redirect_header('admin_forum_manager.php?op=mod&forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR); |
|
200 | + } |
|
201 | + break; |
|
202 | 202 | |
203 | - case 'mod': |
|
204 | - $forumObject = $forumHandler->get($forum_id); |
|
205 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
206 | - break; |
|
203 | + case 'mod': |
|
204 | + $forumObject = $forumHandler->get($forum_id); |
|
205 | + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
206 | + break; |
|
207 | 207 | |
208 | - case 'del': |
|
209 | - if (1 !== Request::getInt('confirm', 0, 'POST')) { |
|
210 | - xoops_confirm(['op' => 'del', 'forum' => Request::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); |
|
211 | - break; |
|
212 | - } else { |
|
213 | - $forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST')); |
|
214 | - $forumHandler->delete($forumObject); |
|
215 | - //$cacheHelper->delete('forum'); |
|
216 | - redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED); |
|
217 | - } |
|
218 | - break; |
|
208 | + case 'del': |
|
209 | + if (1 !== Request::getInt('confirm', 0, 'POST')) { |
|
210 | + xoops_confirm(['op' => 'del', 'forum' => Request::getInt('forum', 0, 'GET'), 'confirm' => 1], 'admin_forum_manager.php', _AM_NEWBB_TWDAFAP); |
|
211 | + break; |
|
212 | + } else { |
|
213 | + $forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST')); |
|
214 | + $forumHandler->delete($forumObject); |
|
215 | + //$cacheHelper->delete('forum'); |
|
216 | + redirect_header('admin_forum_manager.php?op=manage', 1, _AM_NEWBB_FORUMREMOVED); |
|
217 | + } |
|
218 | + break; |
|
219 | 219 | |
220 | - case 'addforum': |
|
221 | - echo '<br>'; |
|
222 | - $parent_forum = Request::getInt('forum', 0, 'GET'); |
|
223 | - $cat_id = Request::getInt('cat_id', 0, 'GET'); |
|
224 | - if (!$parent_forum && !$cat_id) { |
|
225 | - break; |
|
226 | - } |
|
227 | - $forumObject = $forumHandler->create(); |
|
228 | - $forumObject->setVar('parent_forum', $parent_forum); |
|
229 | - $forumObject->setVar('cat_id', $cat_id); |
|
230 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
231 | - break; |
|
220 | + case 'addforum': |
|
221 | + echo '<br>'; |
|
222 | + $parent_forum = Request::getInt('forum', 0, 'GET'); |
|
223 | + $cat_id = Request::getInt('cat_id', 0, 'GET'); |
|
224 | + if (!$parent_forum && !$cat_id) { |
|
225 | + break; |
|
226 | + } |
|
227 | + $forumObject = $forumHandler->create(); |
|
228 | + $forumObject->setVar('parent_forum', $parent_forum); |
|
229 | + $forumObject->setVar('cat_id', $cat_id); |
|
230 | + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
231 | + break; |
|
232 | 232 | |
233 | - default: |
|
233 | + default: |
|
234 | 234 | |
235 | - // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
236 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
237 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
238 | - $criteriaCategory->setSort('cat_order'); |
|
239 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
240 | - if (0 === count($categories)) { |
|
241 | - redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
242 | - } |
|
235 | + // /** @var Newbb\CategoryHandler $categoryHandler */ |
|
236 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
237 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
238 | + $criteriaCategory->setSort('cat_order'); |
|
239 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
240 | + if (0 === count($categories)) { |
|
241 | + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
242 | + } |
|
243 | 243 | |
244 | - $echo = $adminObject->displayNavigation(basename(__FILE__)); |
|
245 | - $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
246 | - $echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
247 | - $echo .= "<tr align='center'>"; |
|
248 | - $echo .= "<th class='bg3' colspan='2'>" . _AM_NEWBB_NAME . '</th>'; |
|
249 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_EDIT . '</th>'; |
|
250 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_DELETE . '</th>'; |
|
251 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_ADD . '</th>'; |
|
252 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_MOVE . '</th>'; |
|
253 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>'; |
|
254 | - $echo .= '</tr>'; |
|
244 | + $echo = $adminObject->displayNavigation(basename(__FILE__)); |
|
245 | + $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
246 | + $echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
247 | + $echo .= "<tr align='center'>"; |
|
248 | + $echo .= "<th class='bg3' colspan='2'>" . _AM_NEWBB_NAME . '</th>'; |
|
249 | + $echo .= "<th class='bg3'>" . _AM_NEWBB_EDIT . '</th>'; |
|
250 | + $echo .= "<th class='bg3'>" . _AM_NEWBB_DELETE . '</th>'; |
|
251 | + $echo .= "<th class='bg3'>" . _AM_NEWBB_ADD . '</th>'; |
|
252 | + $echo .= "<th class='bg3'>" . _AM_NEWBB_MOVE . '</th>'; |
|
253 | + $echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>'; |
|
254 | + $echo .= '</tr>'; |
|
255 | 255 | |
256 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
257 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
258 | - $criteriaCategory->setSort('cat_order'); |
|
259 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
260 | - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
261 | - foreach (array_keys($categories) as $c) { |
|
262 | - $category = $categories[$c]; |
|
263 | - $cat_id = $c; |
|
264 | - $cat_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>'; |
|
265 | - $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
266 | - $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
267 | - $forum_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>'; |
|
268 | - $echo .= "<tr class='even' align='left'>"; |
|
269 | - $echo .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>'; |
|
270 | - $echo .= "<td align='center'>" . $cat_edit_link . '</td>'; |
|
271 | - $echo .= "<td align='center'>" . $cat_del_link . '</td>'; |
|
272 | - $echo .= "<td align='center'>" . $forum_add_link . '</td>'; |
|
273 | - $echo .= '<td></td>'; |
|
274 | - $echo .= '<td></td>'; |
|
275 | - $echo .= '</tr>'; |
|
276 | - if (!isset($forums[$c])) { |
|
277 | - continue; |
|
278 | - } |
|
279 | - $i = 0; |
|
280 | - foreach (array_keys($forums[$c]) as $f) { |
|
281 | - $forum = $forums[$c][$f]; |
|
282 | - $f_link = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>'; |
|
283 | - $f_edit_link = '<a href="admin_forum_manager.php?op=mod&forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>'; |
|
284 | - $f_del_link = '<a href="admin_forum_manager.php?op=del&forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>'; |
|
285 | - $sf_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>'; |
|
286 | - $f_move_link = '<a href="admin_forum_manager.php?op=moveforum&forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>'; |
|
287 | - $f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>'; |
|
256 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
257 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
258 | + $criteriaCategory->setSort('cat_order'); |
|
259 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
260 | + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
261 | + foreach (array_keys($categories) as $c) { |
|
262 | + $category = $categories[$c]; |
|
263 | + $cat_id = $c; |
|
264 | + $cat_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>'; |
|
265 | + $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
266 | + $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
267 | + $forum_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>'; |
|
268 | + $echo .= "<tr class='even' align='left'>"; |
|
269 | + $echo .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>'; |
|
270 | + $echo .= "<td align='center'>" . $cat_edit_link . '</td>'; |
|
271 | + $echo .= "<td align='center'>" . $cat_del_link . '</td>'; |
|
272 | + $echo .= "<td align='center'>" . $forum_add_link . '</td>'; |
|
273 | + $echo .= '<td></td>'; |
|
274 | + $echo .= '<td></td>'; |
|
275 | + $echo .= '</tr>'; |
|
276 | + if (!isset($forums[$c])) { |
|
277 | + continue; |
|
278 | + } |
|
279 | + $i = 0; |
|
280 | + foreach (array_keys($forums[$c]) as $f) { |
|
281 | + $forum = $forums[$c][$f]; |
|
282 | + $f_link = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>'; |
|
283 | + $f_edit_link = '<a href="admin_forum_manager.php?op=mod&forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>'; |
|
284 | + $f_del_link = '<a href="admin_forum_manager.php?op=del&forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>'; |
|
285 | + $sf_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>'; |
|
286 | + $f_move_link = '<a href="admin_forum_manager.php?op=moveforum&forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>'; |
|
287 | + $f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>'; |
|
288 | 288 | |
289 | - $class = (($i++) % 2) ? 'odd' : 'even'; |
|
290 | - $echo .= "<tr class='" . $class . "' align='left'><td></td>"; |
|
291 | - $echo .= '<td><strong>' . $f_link . '</strong></td>'; |
|
292 | - $echo .= "<td align='center'>" . $f_edit_link . '</td>'; |
|
293 | - $echo .= "<td align='center'>" . $f_del_link . '</td>'; |
|
294 | - $echo .= "<td align='center'>" . $sf_add_link . '</td>'; |
|
295 | - $echo .= "<td align='center'>" . $f_move_link . '</td>'; |
|
296 | - $echo .= "<td align='center'>" . $f_merge_link . '</td>'; |
|
297 | - $echo .= '</tr>'; |
|
298 | - } |
|
299 | - } |
|
300 | - unset($forums, $categories); |
|
289 | + $class = (($i++) % 2) ? 'odd' : 'even'; |
|
290 | + $echo .= "<tr class='" . $class . "' align='left'><td></td>"; |
|
291 | + $echo .= '<td><strong>' . $f_link . '</strong></td>'; |
|
292 | + $echo .= "<td align='center'>" . $f_edit_link . '</td>'; |
|
293 | + $echo .= "<td align='center'>" . $f_del_link . '</td>'; |
|
294 | + $echo .= "<td align='center'>" . $sf_add_link . '</td>'; |
|
295 | + $echo .= "<td align='center'>" . $f_move_link . '</td>'; |
|
296 | + $echo .= "<td align='center'>" . $f_merge_link . '</td>'; |
|
297 | + $echo .= '</tr>'; |
|
298 | + } |
|
299 | + } |
|
300 | + unset($forums, $categories); |
|
301 | 301 | |
302 | - echo $echo; |
|
303 | - echo '</table>'; |
|
304 | - echo '</td></tr></table>'; |
|
305 | - echo '<fieldset>'; |
|
306 | - echo '<legend> ' . _MI_NEWBB_ADMENU_FORUM . ' </legend>'; |
|
307 | - echo _AM_NEWBB_HELP_FORUM_TAB; |
|
308 | - echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
309 | - echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
310 | - echo '<br>' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . ' - ' . _AM_NEWBB_CREATEFORUM; |
|
311 | - echo '<br>' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ' - ' . _AM_NEWBB_MOVE; |
|
312 | - echo '<br>' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ' - ' . _AM_NEWBB_MERGE; |
|
313 | - echo '</fieldset>'; |
|
314 | - break; |
|
302 | + echo $echo; |
|
303 | + echo '</table>'; |
|
304 | + echo '</td></tr></table>'; |
|
305 | + echo '<fieldset>'; |
|
306 | + echo '<legend> ' . _MI_NEWBB_ADMENU_FORUM . ' </legend>'; |
|
307 | + echo _AM_NEWBB_HELP_FORUM_TAB; |
|
308 | + echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
309 | + echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
310 | + echo '<br>' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . ' - ' . _AM_NEWBB_CREATEFORUM; |
|
311 | + echo '<br>' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ' - ' . _AM_NEWBB_MOVE; |
|
312 | + echo '<br>' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ' - ' . _AM_NEWBB_MERGE; |
|
313 | + echo '</fieldset>'; |
|
314 | + break; |
|
315 | 315 | } |
316 | 316 | require_once __DIR__ . '/admin_footer.php'; |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | use Xmf\Request; |
33 | 33 | use XoopsModules\Newbb; |
34 | 34 | |
35 | -require_once __DIR__ . '/admin_header.php'; |
|
35 | +require_once __DIR__.'/admin_header.php'; |
|
36 | 36 | require_once $GLOBALS['xoops']->path('class/xoopstree.php'); |
37 | 37 | require_once $GLOBALS['xoops']->path('class/pagenav.php'); |
38 | -require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
39 | -require_once dirname(__DIR__) . '/include/functions.render.php'; |
|
38 | +require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
39 | +require_once dirname(__DIR__).'/include/functions.render.php'; |
|
40 | 40 | |
41 | 41 | $cacheHelper = Newbb\Utility::cleanCache(); |
42 | 42 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($forumHandler->insert($forumObject)) { |
70 | 70 | if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
71 | 71 | $forums = array_map('intval', array_values($subforums)); |
72 | - $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
72 | + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '('.implode(', ', $forums).')', 'IN')); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | //$cacheHelper->delete('forum'); |
@@ -79,19 +79,19 @@ discard block |
||
79 | 79 | } |
80 | 80 | } else { |
81 | 81 | $box = '<select name="dest_forum">'; |
82 | - $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
82 | + $box .= '<option value=0 selected>'._SELECT.'</option>'; |
|
83 | 83 | $box .= newbbForumSelectBox($forum_id, 'all', true, true); |
84 | 84 | $box .= '</select>'; |
85 | 85 | |
86 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
86 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
87 | 87 | echo '<form action="./admin_forum_manager.php" method="post" name="forummove" id="forummove">'; |
88 | 88 | echo '<input type="hidden" name="op" value="moveforum" />'; |
89 | - echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
89 | + echo '<input type="hidden" name="forum" value='.$forum_id.' />'; |
|
90 | 90 | echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
91 | - echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MOVETHISFORUM . '</strong></td>'; |
|
91 | + echo '<td class="bg2" align="center"><strong>'._AM_NEWBB_MOVETHISFORUM.'</strong></td>'; |
|
92 | 92 | echo '</tr>'; |
93 | - echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
94 | - echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
93 | + echo '<tr><td class="bg1" align="center">'.$box.'</td></tr>'; |
|
94 | + echo '<tr><td align="center"><input type="submit" name="save" value='._GO.' class="button" /></td></tr>'; |
|
95 | 95 | echo '</table></form>'; |
96 | 96 | echo '</td></tr></table>'; |
97 | 97 | } |
@@ -104,17 +104,17 @@ discard block |
||
104 | 104 | $forum_dest = $forumHandler->get(Request::getString('dest_forum', '', 'POST')); |
105 | 105 | if (is_object($forum_dest)) { |
106 | 106 | $cid = $forum_dest->getVar('cat_id'); |
107 | - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
107 | + $sql = ' UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' SET forum_id='.Request::getInt('dest_forum', 0, 'POST')." WHERE forum_id=$forum_id"; |
|
108 | 108 | $result_post = $GLOBALS['xoopsDB']->queryF($sql); |
109 | 109 | |
110 | - $sql = ' UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' SET forum_id=' . Request::getInt('dest_forum', 0, 'POST') . " WHERE forum_id=$forum_id"; |
|
110 | + $sql = ' UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' SET forum_id='.Request::getInt('dest_forum', 0, 'POST')." WHERE forum_id=$forum_id"; |
|
111 | 111 | $result_topic = $GLOBALS['xoopsDB']->queryF($sql); |
112 | 112 | |
113 | 113 | $forumObject = $forumHandler->get($forum_id); |
114 | 114 | $forumHandler->updateAll('parent_forum', Request::getInt('dest_forum', 0, 'POST'), new \Criteria('parent_forum', $forum_id)); |
115 | 115 | if ($cid !== $forumObject->getVar('cat_id') && $subforums = newbbGetSubForum($forum_id)) { |
116 | 116 | $forums = array_map('intval', array_values($subforums)); |
117 | - $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '(' . implode(', ', $forums) . ')', 'IN')); |
|
117 | + $forumHandler->updateAll('cat_id', $cid, new \Criteria('forum_id', '('.implode(', ', $forums).')', 'IN')); |
|
118 | 118 | } |
119 | 119 | |
120 | 120 | $forumHandler->delete($forumObject); |
@@ -129,19 +129,19 @@ discard block |
||
129 | 129 | } |
130 | 130 | } else { |
131 | 131 | $box = '<select name="dest_forum">'; |
132 | - $box .= '<option value=0 selected>' . _SELECT . '</option>'; |
|
132 | + $box .= '<option value=0 selected>'._SELECT.'</option>'; |
|
133 | 133 | $box .= newbbForumSelectBox($forum_id, 'all'); |
134 | 134 | $box .= '</select>'; |
135 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
136 | - echo '<form action="' . xoops_getenv('PHP_SELF') . '" method="post" name="forummove" id="forummove">'; |
|
135 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
136 | + echo '<form action="'.xoops_getenv('PHP_SELF').'" method="post" name="forummove" id="forummove">'; |
|
137 | 137 | echo '<input type="hidden" name="op" value="mergeforum" />'; |
138 | - echo '<input type="hidden" name="forum" value=' . $forum_id . ' />'; |
|
138 | + echo '<input type="hidden" name="forum" value='.$forum_id.' />'; |
|
139 | 139 | echo '<table border="0" cellpadding="1" cellspacing="0" align="center" valign="top" width="95%"><tr>'; |
140 | - echo '<td class="bg2" align="center"><strong>' . _AM_NEWBB_MERGETHISFORUM . '</strong></td>'; |
|
140 | + echo '<td class="bg2" align="center"><strong>'._AM_NEWBB_MERGETHISFORUM.'</strong></td>'; |
|
141 | 141 | echo '</tr>'; |
142 | - echo '<tr><td class="bg1" align="center">' . _AM_NEWBB_MERGETO_FORUM . '</td></tr>'; |
|
143 | - echo '<tr><td class="bg1" align="center">' . $box . '</td></tr>'; |
|
144 | - echo '<tr><td align="center"><input type="submit" name="save" value=' . _GO . ' class="button" /></td></tr>'; |
|
142 | + echo '<tr><td class="bg1" align="center">'._AM_NEWBB_MERGETO_FORUM.'</td></tr>'; |
|
143 | + echo '<tr><td class="bg1" align="center">'.$box.'</td></tr>'; |
|
144 | + echo '<tr><td align="center"><input type="submit" name="save" value='._GO.' class="button" /></td></tr>'; |
|
145 | 145 | echo '</form></table>'; |
146 | 146 | echo '</td></tr></table>'; |
147 | 147 | } |
@@ -196,13 +196,13 @@ discard block |
||
196 | 196 | } |
197 | 197 | redirect_header('admin_forum_manager.php', 2, $message); |
198 | 198 | } else { |
199 | - redirect_header('admin_forum_manager.php?op=mod&forum=' . $forumObject->getVar('forum_id') . '', 2, _AM_NEWBB_FORUM_ERROR); |
|
199 | + redirect_header('admin_forum_manager.php?op=mod&forum='.$forumObject->getVar('forum_id').'', 2, _AM_NEWBB_FORUM_ERROR); |
|
200 | 200 | } |
201 | 201 | break; |
202 | 202 | |
203 | 203 | case 'mod': |
204 | 204 | $forumObject = $forumHandler->get($forum_id); |
205 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
205 | + require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/form.forum.php'); |
|
206 | 206 | break; |
207 | 207 | |
208 | 208 | case 'del': |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $forumObject = $forumHandler->create(); |
228 | 228 | $forumObject->setVar('parent_forum', $parent_forum); |
229 | 229 | $forumObject->setVar('cat_id', $cat_id); |
230 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/include/form.forum.php'); |
|
230 | + require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/include/form.forum.php'); |
|
231 | 231 | break; |
232 | 232 | |
233 | 233 | default: |
@@ -242,15 +242,15 @@ discard block |
||
242 | 242 | } |
243 | 243 | |
244 | 244 | $echo = $adminObject->displayNavigation(basename(__FILE__)); |
245 | - $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
245 | + $echo .= "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
246 | 246 | $echo .= "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
247 | 247 | $echo .= "<tr align='center'>"; |
248 | - $echo .= "<th class='bg3' colspan='2'>" . _AM_NEWBB_NAME . '</th>'; |
|
249 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_EDIT . '</th>'; |
|
250 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_DELETE . '</th>'; |
|
251 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_ADD . '</th>'; |
|
252 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_MOVE . '</th>'; |
|
253 | - $echo .= "<th class='bg3'>" . _AM_NEWBB_MERGE . '</th>'; |
|
248 | + $echo .= "<th class='bg3' colspan='2'>"._AM_NEWBB_NAME.'</th>'; |
|
249 | + $echo .= "<th class='bg3'>"._AM_NEWBB_EDIT.'</th>'; |
|
250 | + $echo .= "<th class='bg3'>"._AM_NEWBB_DELETE.'</th>'; |
|
251 | + $echo .= "<th class='bg3'>"._AM_NEWBB_ADD.'</th>'; |
|
252 | + $echo .= "<th class='bg3'>"._AM_NEWBB_MOVE.'</th>'; |
|
253 | + $echo .= "<th class='bg3'>"._AM_NEWBB_MERGE.'</th>'; |
|
254 | 254 | $echo .= '</tr>'; |
255 | 255 | |
256 | 256 | // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
@@ -261,15 +261,15 @@ discard block |
||
261 | 261 | foreach (array_keys($categories) as $c) { |
262 | 262 | $category = $categories[$c]; |
263 | 263 | $cat_id = $c; |
264 | - $cat_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/index.php?viewcat=' . $cat_id . '">' . $category . '</a>'; |
|
265 | - $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
266 | - $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $cat_id . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
267 | - $forum_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $cat_id . '">' . newbbDisplayImage('new_forum') . '</a>'; |
|
264 | + $cat_link = '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/index.php?viewcat='.$cat_id.'">'.$category.'</a>'; |
|
265 | + $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id='.$cat_id.'">'.newbbDisplayImage('admin_edit', _EDIT).'</a>'; |
|
266 | + $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id='.$cat_id.'">'.newbbDisplayImage('admin_delete', _DELETE).'</a>'; |
|
267 | + $forum_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id='.$cat_id.'">'.newbbDisplayImage('new_forum').'</a>'; |
|
268 | 268 | $echo .= "<tr class='even' align='left'>"; |
269 | - $echo .= "<td width='100%' colspan='2'><strong>" . $cat_link . '</strong></td>'; |
|
270 | - $echo .= "<td align='center'>" . $cat_edit_link . '</td>'; |
|
271 | - $echo .= "<td align='center'>" . $cat_del_link . '</td>'; |
|
272 | - $echo .= "<td align='center'>" . $forum_add_link . '</td>'; |
|
269 | + $echo .= "<td width='100%' colspan='2'><strong>".$cat_link.'</strong></td>'; |
|
270 | + $echo .= "<td align='center'>".$cat_edit_link.'</td>'; |
|
271 | + $echo .= "<td align='center'>".$cat_del_link.'</td>'; |
|
272 | + $echo .= "<td align='center'>".$forum_add_link.'</td>'; |
|
273 | 273 | $echo .= '<td></td>'; |
274 | 274 | $echo .= '<td></td>'; |
275 | 275 | $echo .= '</tr>'; |
@@ -279,21 +279,21 @@ discard block |
||
279 | 279 | $i = 0; |
280 | 280 | foreach (array_keys($forums[$c]) as $f) { |
281 | 281 | $forum = $forums[$c][$f]; |
282 | - $f_link = $forum['prefix'] . '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname', 'n') . '/viewforum.php?forum=' . $f . '">' . $forum['forum_name'] . '</a>'; |
|
283 | - $f_edit_link = '<a href="admin_forum_manager.php?op=mod&forum=' . $f . '">' . newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT) . '</a>'; |
|
284 | - $f_del_link = '<a href="admin_forum_manager.php?op=del&forum=' . $f . '">' . newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE) . '</a>'; |
|
285 | - $sf_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id=' . $c . '&forum=' . $f . '">' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . '</a>'; |
|
286 | - $f_move_link = '<a href="admin_forum_manager.php?op=moveforum&forum=' . $f . '">' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . '</a>'; |
|
287 | - $f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&forum=' . $f . '">' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . '</a>'; |
|
282 | + $f_link = $forum['prefix'].'<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname', 'n').'/viewforum.php?forum='.$f.'">'.$forum['forum_name'].'</a>'; |
|
283 | + $f_edit_link = '<a href="admin_forum_manager.php?op=mod&forum='.$f.'">'.newbbDisplayImage('admin_edit', _AM_NEWBB_EDIT).'</a>'; |
|
284 | + $f_del_link = '<a href="admin_forum_manager.php?op=del&forum='.$f.'">'.newbbDisplayImage('admin_delete', _AM_NEWBB_DELETE).'</a>'; |
|
285 | + $sf_add_link = '<a href="admin_forum_manager.php?op=addforum&cat_id='.$c.'&forum='.$f.'">'.newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM).'</a>'; |
|
286 | + $f_move_link = '<a href="admin_forum_manager.php?op=moveforum&forum='.$f.'">'.newbbDisplayImage('admin_move', _AM_NEWBB_MOVE).'</a>'; |
|
287 | + $f_merge_link = '<a href="admin_forum_manager.php?op=mergeforum&forum='.$f.'">'.newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE).'</a>'; |
|
288 | 288 | |
289 | 289 | $class = (($i++) % 2) ? 'odd' : 'even'; |
290 | - $echo .= "<tr class='" . $class . "' align='left'><td></td>"; |
|
291 | - $echo .= '<td><strong>' . $f_link . '</strong></td>'; |
|
292 | - $echo .= "<td align='center'>" . $f_edit_link . '</td>'; |
|
293 | - $echo .= "<td align='center'>" . $f_del_link . '</td>'; |
|
294 | - $echo .= "<td align='center'>" . $sf_add_link . '</td>'; |
|
295 | - $echo .= "<td align='center'>" . $f_move_link . '</td>'; |
|
296 | - $echo .= "<td align='center'>" . $f_merge_link . '</td>'; |
|
290 | + $echo .= "<tr class='".$class."' align='left'><td></td>"; |
|
291 | + $echo .= '<td><strong>'.$f_link.'</strong></td>'; |
|
292 | + $echo .= "<td align='center'>".$f_edit_link.'</td>'; |
|
293 | + $echo .= "<td align='center'>".$f_del_link.'</td>'; |
|
294 | + $echo .= "<td align='center'>".$sf_add_link.'</td>'; |
|
295 | + $echo .= "<td align='center'>".$f_move_link.'</td>'; |
|
296 | + $echo .= "<td align='center'>".$f_merge_link.'</td>'; |
|
297 | 297 | $echo .= '</tr>'; |
298 | 298 | } |
299 | 299 | } |
@@ -303,14 +303,14 @@ discard block |
||
303 | 303 | echo '</table>'; |
304 | 304 | echo '</td></tr></table>'; |
305 | 305 | echo '<fieldset>'; |
306 | - echo '<legend> ' . _MI_NEWBB_ADMENU_FORUM . ' </legend>'; |
|
306 | + echo '<legend> '._MI_NEWBB_ADMENU_FORUM.' </legend>'; |
|
307 | 307 | echo _AM_NEWBB_HELP_FORUM_TAB; |
308 | - echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
309 | - echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
310 | - echo '<br>' . newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM) . ' - ' . _AM_NEWBB_CREATEFORUM; |
|
311 | - echo '<br>' . newbbDisplayImage('admin_move', _AM_NEWBB_MOVE) . ' - ' . _AM_NEWBB_MOVE; |
|
312 | - echo '<br>' . newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE) . ' - ' . _AM_NEWBB_MERGE; |
|
308 | + echo '<br>'.newbbDisplayImage('admin_edit', _EDIT).' - '._EDIT; |
|
309 | + echo '<br>'.newbbDisplayImage('admin_delete', _DELETE).' - '._DELETE; |
|
310 | + echo '<br>'.newbbDisplayImage('new_forum', _AM_NEWBB_CREATEFORUM).' - '._AM_NEWBB_CREATEFORUM; |
|
311 | + echo '<br>'.newbbDisplayImage('admin_move', _AM_NEWBB_MOVE).' - '._AM_NEWBB_MOVE; |
|
312 | + echo '<br>'.newbbDisplayImage('admin_merge', _AM_NEWBB_MERGE).' - '._AM_NEWBB_MERGE; |
|
313 | 313 | echo '</fieldset>'; |
314 | 314 | break; |
315 | 315 | } |
316 | -require_once __DIR__ . '/admin_footer.php'; |
|
316 | +require_once __DIR__.'/admin_footer.php'; |
@@ -22,83 +22,83 @@ |
||
22 | 22 | $start = Request::getInt('start', 0, 'GET'); //(int)( @$_GET['start'] ); |
23 | 23 | |
24 | 24 | switch (Request::getString('type', '', 'GET')) {// @$_GET['type']) |
25 | - // irmtfan rewrite forum sync |
|
26 | - case 'forum': |
|
27 | - $result = newbbSynchronization('forum'); |
|
28 | - if (!empty($result)) { |
|
29 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
30 | - } |
|
31 | - break; |
|
32 | - // irmtfan rewrite topic sync |
|
33 | - case 'topic': |
|
34 | - $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); |
|
35 | - // /** @var Newbb\TopicHandler $topicHandler */ |
|
36 | - // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
37 | - $criteria = new \Criteria('approved', 1); |
|
38 | - if ($start >= ($count = $topicHandler->getCount($criteria))) { |
|
39 | - break; |
|
40 | - } |
|
41 | - $criteria->setStart($start); |
|
42 | - $criteria->setLimit($limit); |
|
43 | - $topicObjs = $topicHandler->getAll($criteria); |
|
44 | - foreach ($topicObjs as $tObj) { |
|
45 | - $topicHandler->synchronization($tObj); |
|
46 | - } |
|
47 | - $result = newbbSynchronization('topic'); |
|
48 | - redirect_header('admin_synchronization.php?type=topic&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
49 | - break; |
|
50 | - // irmtfan rewrite post sync |
|
51 | - case 'post': |
|
52 | - $result = newbbSynchronization('post'); |
|
53 | - if (!empty($result)) { |
|
54 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
55 | - } |
|
56 | - break; |
|
57 | - // irmtfan - user is not in recon functions - only here |
|
58 | - case 'user': |
|
59 | - $limit = Request::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); |
|
60 | - /** @var \XoopsUserHandler $userHandler */ |
|
61 | - $userHandler = xoops_getHandler('user'); |
|
62 | - if ($start >= ($count = $userHandler->getCount())) { |
|
63 | - break; |
|
64 | - } |
|
65 | - $sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users'); |
|
66 | - $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); |
|
67 | - while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
68 | - // irmtfan approved=1 AND |
|
69 | - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; |
|
70 | - $ret = $GLOBALS['xoopsDB']->query($sql); |
|
71 | - list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
72 | - // irmtfan approved=1 AND |
|
73 | - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_digest > 0 AND topic_poster = {$uid}"; |
|
74 | - $ret = $GLOBALS['xoopsDB']->query($sql); |
|
75 | - list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
76 | - // irmtfan approved=1 AND |
|
77 | - $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE uid = {$uid}"; |
|
78 | - $ret = $GLOBALS['xoopsDB']->query($sql); |
|
79 | - list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
25 | + // irmtfan rewrite forum sync |
|
26 | + case 'forum': |
|
27 | + $result = newbbSynchronization('forum'); |
|
28 | + if (!empty($result)) { |
|
29 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
30 | + } |
|
31 | + break; |
|
32 | + // irmtfan rewrite topic sync |
|
33 | + case 'topic': |
|
34 | + $limit = Request::getInt('limit', 1000, 'POST'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); |
|
35 | + // /** @var Newbb\TopicHandler $topicHandler */ |
|
36 | + // $topicHandler = Newbb\Helper::getInstance()->getHandler('Topic'); |
|
37 | + $criteria = new \Criteria('approved', 1); |
|
38 | + if ($start >= ($count = $topicHandler->getCount($criteria))) { |
|
39 | + break; |
|
40 | + } |
|
41 | + $criteria->setStart($start); |
|
42 | + $criteria->setLimit($limit); |
|
43 | + $topicObjs = $topicHandler->getAll($criteria); |
|
44 | + foreach ($topicObjs as $tObj) { |
|
45 | + $topicHandler->synchronization($tObj); |
|
46 | + } |
|
47 | + $result = newbbSynchronization('topic'); |
|
48 | + redirect_header('admin_synchronization.php?type=topic&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
49 | + break; |
|
50 | + // irmtfan rewrite post sync |
|
51 | + case 'post': |
|
52 | + $result = newbbSynchronization('post'); |
|
53 | + if (!empty($result)) { |
|
54 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
55 | + } |
|
56 | + break; |
|
57 | + // irmtfan - user is not in recon functions - only here |
|
58 | + case 'user': |
|
59 | + $limit = Request::getInt('limit', 1000, 'GET'); //empty($_GET['limit']) ? 1000 : (int)($_GET['limit']); |
|
60 | + /** @var \XoopsUserHandler $userHandler */ |
|
61 | + $userHandler = xoops_getHandler('user'); |
|
62 | + if ($start >= ($count = $userHandler->getCount())) { |
|
63 | + break; |
|
64 | + } |
|
65 | + $sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users'); |
|
66 | + $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); |
|
67 | + while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
68 | + // irmtfan approved=1 AND |
|
69 | + $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; |
|
70 | + $ret = $GLOBALS['xoopsDB']->query($sql); |
|
71 | + list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
72 | + // irmtfan approved=1 AND |
|
73 | + $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_digest > 0 AND topic_poster = {$uid}"; |
|
74 | + $ret = $GLOBALS['xoopsDB']->query($sql); |
|
75 | + list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
76 | + // irmtfan approved=1 AND |
|
77 | + $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE uid = {$uid}"; |
|
78 | + $ret = $GLOBALS['xoopsDB']->query($sql); |
|
79 | + list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); |
|
80 | 80 | |
81 | - $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
82 | - } |
|
81 | + $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
82 | + } |
|
83 | 83 | |
84 | - redirect_header('admin_synchronization.php?type=user&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
85 | - break; |
|
86 | - // irmtfan rewrite stats reset |
|
87 | - case 'stats': |
|
88 | - $result = newbbSynchronization('stats'); |
|
89 | - break; |
|
90 | - // START irmtfan add read sync |
|
91 | - case 'read': |
|
92 | - $result = newbbSynchronization(['readtopic', 'readforum']); |
|
93 | - if (!empty($result)) { |
|
94 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
95 | - } |
|
96 | - exit(); |
|
97 | - // END irmtfan add read sync |
|
98 | - case 'misc': |
|
99 | - default: |
|
100 | - newbbSynchronization(); |
|
101 | - break; |
|
84 | + redirect_header('admin_synchronization.php?type=user&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
85 | + break; |
|
86 | + // irmtfan rewrite stats reset |
|
87 | + case 'stats': |
|
88 | + $result = newbbSynchronization('stats'); |
|
89 | + break; |
|
90 | + // START irmtfan add read sync |
|
91 | + case 'read': |
|
92 | + $result = newbbSynchronization(['readtopic', 'readforum']); |
|
93 | + if (!empty($result)) { |
|
94 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
95 | + } |
|
96 | + exit(); |
|
97 | + // END irmtfan add read sync |
|
98 | + case 'misc': |
|
99 | + default: |
|
100 | + newbbSynchronization(); |
|
101 | + break; |
|
102 | 102 | } |
103 | 103 | |
104 | 104 | // <legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_SYNCFORUM . '</legend>'; |
@@ -12,9 +12,9 @@ discard block |
||
12 | 12 | use Xmf\Request; |
13 | 13 | |
14 | 14 | // irmtfan - TODO - should be changed completly with Newbb new function newbbSynchronization |
15 | -require_once __DIR__ . '/admin_header.php'; |
|
15 | +require_once __DIR__.'/admin_header.php'; |
|
16 | 16 | xoops_cp_header(); |
17 | -require_once dirname(__DIR__) . '/include/functions.recon.php'; |
|
17 | +require_once dirname(__DIR__).'/include/functions.recon.php'; |
|
18 | 18 | $form = ''; |
19 | 19 | $form .= $adminObject->displayNavigation(basename(__FILE__)); |
20 | 20 | |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | case 'forum': |
27 | 27 | $result = newbbSynchronization('forum'); |
28 | 28 | if (!empty($result)) { |
29 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
29 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_FORUM.'<br>'._AM_NEWBB_DATABASEUPDATED); |
|
30 | 30 | } |
31 | 31 | break; |
32 | 32 | // irmtfan rewrite topic sync |
@@ -45,13 +45,13 @@ discard block |
||
45 | 45 | $topicHandler->synchronization($tObj); |
46 | 46 | } |
47 | 47 | $result = newbbSynchronization('topic'); |
48 | - redirect_header('admin_synchronization.php?type=topic&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
48 | + redirect_header('admin_synchronization.php?type=topic&start='.($start + $limit)."&limit={$limit}", 2, _AM_NEWBB_SYNCHING." {$count}: {$start} - ".($start + $limit)); |
|
49 | 49 | break; |
50 | 50 | // irmtfan rewrite post sync |
51 | 51 | case 'post': |
52 | 52 | $result = newbbSynchronization('post'); |
53 | 53 | if (!empty($result)) { |
54 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
54 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_POST.'<br>'._AM_NEWBB_DATABASEUPDATED); |
|
55 | 55 | } |
56 | 56 | break; |
57 | 57 | // irmtfan - user is not in recon functions - only here |
@@ -62,26 +62,26 @@ discard block |
||
62 | 62 | if ($start >= ($count = $userHandler->getCount())) { |
63 | 63 | break; |
64 | 64 | } |
65 | - $sql = ' SELECT uid' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('users'); |
|
65 | + $sql = ' SELECT uid'.' FROM '.$GLOBALS['xoopsDB']->prefix('users'); |
|
66 | 66 | $result = $GLOBALS['xoopsDB']->query($sql, $limit, $start); |
67 | 67 | while (false !== (list($uid) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
68 | 68 | // irmtfan approved=1 AND |
69 | - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_poster = {$uid}"; |
|
69 | + $sql = ' SELECT count(*)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." WHERE topic_poster = {$uid}"; |
|
70 | 70 | $ret = $GLOBALS['xoopsDB']->query($sql); |
71 | 71 | list($topics) = $GLOBALS['xoopsDB']->fetchRow($ret); |
72 | 72 | // irmtfan approved=1 AND |
73 | - $sql = ' SELECT count(*)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_digest > 0 AND topic_poster = {$uid}"; |
|
73 | + $sql = ' SELECT count(*)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." WHERE topic_digest > 0 AND topic_poster = {$uid}"; |
|
74 | 74 | $ret = $GLOBALS['xoopsDB']->query($sql); |
75 | 75 | list($digests) = $GLOBALS['xoopsDB']->fetchRow($ret); |
76 | 76 | // irmtfan approved=1 AND |
77 | - $sql = ' SELECT count(*), MAX(post_time)' . ' FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE uid = {$uid}"; |
|
77 | + $sql = ' SELECT count(*), MAX(post_time)'.' FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts')." WHERE uid = {$uid}"; |
|
78 | 78 | $ret = $GLOBALS['xoopsDB']->query($sql); |
79 | 79 | list($posts, $lastpost) = $GLOBALS['xoopsDB']->fetchRow($ret); |
80 | 80 | |
81 | - $GLOBALS['xoopsDB']->queryF(' REPLACE INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_user_stats') . " SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
81 | + $GLOBALS['xoopsDB']->queryF(' REPLACE INTO '.$GLOBALS['xoopsDB']->prefix('newbb_user_stats')." SET uid = '{$uid}', user_topics = '{$topics}', user_posts = '{$posts}', user_digests = '{$digests}', user_lastpost = '{$lastpost}'"); |
|
82 | 82 | } |
83 | 83 | |
84 | - redirect_header('admin_synchronization.php?type=user&start=' . ($start + $limit) . "&limit={$limit}", 2, _AM_NEWBB_SYNCHING . " {$count}: {$start} - " . ($start + $limit)); |
|
84 | + redirect_header('admin_synchronization.php?type=user&start='.($start + $limit)."&limit={$limit}", 2, _AM_NEWBB_SYNCHING." {$count}: {$start} - ".($start + $limit)); |
|
85 | 85 | break; |
86 | 86 | // irmtfan rewrite stats reset |
87 | 87 | case 'stats': |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | case 'read': |
92 | 92 | $result = newbbSynchronization(['readtopic', 'readforum']); |
93 | 93 | if (!empty($result)) { |
94 | - redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ . '<br>' . _AM_NEWBB_DATABASEUPDATED); |
|
94 | + redirect_header('admin_synchronization.php', 2, _AM_NEWBB_SYNC_TYPE_READ.'<br>'._AM_NEWBB_DATABASEUPDATED); |
|
95 | 95 | } |
96 | 96 | exit(); |
97 | 97 | // END irmtfan add read sync |
@@ -105,70 +105,70 @@ discard block |
||
105 | 105 | |
106 | 106 | $form .= '<form action="admin_synchronization.php" method="get">'; |
107 | 107 | $form .= '<div style="padding: 10px 2px;">'; |
108 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_FORUM . '</h2>'; |
|
108 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_FORUM.'</h2>'; |
|
109 | 109 | $form .= '<input type="hidden" name="type" value="forum">'; |
110 | 110 | // $form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="20">'; // irmtfan remove |
111 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
111 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
112 | 112 | $form .= '</div>'; |
113 | 113 | $form .= '</form>'; |
114 | 114 | |
115 | 115 | $form .= '<form action="admin_synchronization.php" method="get">'; |
116 | 116 | $form .= '<div style="padding: 10px 2px;">'; |
117 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_TOPIC . '</h2>'; |
|
117 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_TOPIC.'</h2>'; |
|
118 | 118 | $form .= '<input type="hidden" name="type" value="topic">'; |
119 | -$form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="1000">'; |
|
120 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
119 | +$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">'; |
|
120 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
121 | 121 | $form .= '</div>'; |
122 | 122 | $form .= '</form>'; |
123 | 123 | |
124 | 124 | $form .= '<form action="admin_synchronization.php" method="get">'; |
125 | 125 | $form .= '<div style="padding: 10px 2px;">'; |
126 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_POST . '</h2>'; |
|
126 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_POST.'</h2>'; |
|
127 | 127 | $form .= '<input type="hidden" name="type" value="post">'; |
128 | 128 | // $form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">'; // irmtfan remove |
129 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
129 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
130 | 130 | $form .= '</div>'; |
131 | 131 | $form .= '</form>'; |
132 | 132 | |
133 | 133 | $form .= '<form action="admin_synchronization.php" method="get">'; |
134 | 134 | $form .= '<div style="padding: 10px 2px;">'; |
135 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_USER . '</h2>'; |
|
135 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_USER.'</h2>'; |
|
136 | 136 | $form .= '<input type="hidden" name="type" value="user">'; |
137 | -$form .= _AM_NEWBB_SYNC_ITEMS . '<input type="text" name="limit" value="1000">'; |
|
138 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
137 | +$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">'; |
|
138 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
139 | 139 | $form .= '</div>'; |
140 | 140 | $form .= '</form>'; |
141 | 141 | // START irmtfan add read sync |
142 | 142 | $form .= '<form action="admin_synchronization.php" method="get">'; |
143 | 143 | $form .= '<div style="padding: 10px 2px;">'; |
144 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_READ . '</h2>'; |
|
144 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_READ.'</h2>'; |
|
145 | 145 | $form .= '<input type="hidden" name="type" value="read">'; |
146 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
146 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
147 | 147 | $form .= '</div>'; |
148 | 148 | $form .= '</form>'; |
149 | 149 | // END irmtfan add read sync |
150 | 150 | |
151 | 151 | $form .= '<form action="admin_synchronization.php" method="get">'; |
152 | 152 | $form .= '<div style="padding: 10px 2px;">'; |
153 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_STATS . '</h2>'; |
|
153 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_STATS.'</h2>'; |
|
154 | 154 | $form .= '<input type="hidden" name="type" value="stats">'; |
155 | 155 | //$form .= _AM_NEWBB_SYNC_ITEMS.'<input type="text" name="limit" value="1000">'; |
156 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
156 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
157 | 157 | $form .= '</div>'; |
158 | 158 | $form .= '</form>'; |
159 | 159 | |
160 | 160 | $form .= '<form action="admin_synchronization.php" method="get">'; |
161 | 161 | $form .= '<div style="padding: 10px 2px;">'; |
162 | -$form .= '<h2>' . _AM_NEWBB_SYNC_TYPE_MISC . '</h2>'; |
|
162 | +$form .= '<h2>'._AM_NEWBB_SYNC_TYPE_MISC.'</h2>'; |
|
163 | 163 | $form .= '<input type="hidden" name="type" value="misc">'; |
164 | -$form .= '<input type="submit" name="submit" value=' . _SUBMIT . ' />'; |
|
164 | +$form .= '<input type="submit" name="submit" value='._SUBMIT.' />'; |
|
165 | 165 | $form .= '</div>'; |
166 | 166 | $form .= '</form>'; |
167 | -echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
167 | +echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
168 | 168 | echo $form; |
169 | 169 | echo '</td></tr></table>'; |
170 | 170 | echo '<fieldset>'; |
171 | -echo '<legend> ' . _MI_NEWBB_ADMENU_SYNC . ' </legend>'; |
|
171 | +echo '<legend> '._MI_NEWBB_ADMENU_SYNC.' </legend>'; |
|
172 | 172 | echo _AM_NEWBB_HELP_SYNC_TAB; |
173 | 173 | echo '</fieldset>'; |
174 | -require_once __DIR__ . '/admin_footer.php'; |
|
174 | +require_once __DIR__.'/admin_footer.php'; |
@@ -39,156 +39,156 @@ discard block |
||
39 | 39 | echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
40 | 40 | |
41 | 41 | if (Request::hasVar('submit', 'POST')) { |
42 | - $post_list = null; |
|
43 | - $topic_list = null; |
|
44 | - $topics_number = 0; |
|
45 | - $posts_number = 0; |
|
46 | - $selected_forums = ''; |
|
47 | - // irmtfan fix if it is array |
|
48 | - $temp = Request::getArray('forums', null, 'POST'); |
|
49 | - if (!$temp || !$temp[0]) { |
|
50 | - redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR); |
|
51 | - } elseif (is_array(Request::getArray('forums', '', 'POST'))) { |
|
52 | - $selected_forums = implode(',', Request::getArray('forums', null, 'POST')); |
|
53 | - } else { |
|
54 | - $selected_forums = Request::getArray('forums', null, 'POST'); |
|
55 | - } |
|
42 | + $post_list = null; |
|
43 | + $topic_list = null; |
|
44 | + $topics_number = 0; |
|
45 | + $posts_number = 0; |
|
46 | + $selected_forums = ''; |
|
47 | + // irmtfan fix if it is array |
|
48 | + $temp = Request::getArray('forums', null, 'POST'); |
|
49 | + if (!$temp || !$temp[0]) { |
|
50 | + redirect_header('admin_forum_prune.php', 1, _AM_NEWBB_PRUNE_FORUMSELERROR); |
|
51 | + } elseif (is_array(Request::getArray('forums', '', 'POST'))) { |
|
52 | + $selected_forums = implode(',', Request::getArray('forums', null, 'POST')); |
|
53 | + } else { |
|
54 | + $selected_forums = Request::getArray('forums', null, 'POST'); |
|
55 | + } |
|
56 | 56 | |
57 | - $prune_days = Request::getInt('days', 0, 'POST'); |
|
58 | - $prune_ddays = time() - $prune_days; |
|
59 | - $archive = Request::getInt('archive', 0, 'POST'); |
|
60 | - $sticky = Request::getInt('sticky', 0, 'POST'); |
|
61 | - $digest = Request::getInt('digest', 0, 'POST'); |
|
62 | - $lock = Request::getInt('lock', 0, 'POST'); |
|
63 | - $hot = Request::getInt('hot', 0, 'POST'); |
|
64 | - $store = Request::getInt('store', null, 'POST'); |
|
57 | + $prune_days = Request::getInt('days', 0, 'POST'); |
|
58 | + $prune_ddays = time() - $prune_days; |
|
59 | + $archive = Request::getInt('archive', 0, 'POST'); |
|
60 | + $sticky = Request::getInt('sticky', 0, 'POST'); |
|
61 | + $digest = Request::getInt('digest', 0, 'POST'); |
|
62 | + $lock = Request::getInt('lock', 0, 'POST'); |
|
63 | + $hot = Request::getInt('hot', 0, 'POST'); |
|
64 | + $store = Request::getInt('store', null, 'POST'); |
|
65 | 65 | |
66 | - $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p |
|
66 | + $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p |
|
67 | 67 | WHERE t.forum_id IN (' . $selected_forums . ') |
68 | 68 | AND p.post_id =t.topic_last_post_id '; |
69 | 69 | |
70 | - if ($sticky) { |
|
71 | - $sql .= ' AND t.topic_sticky <> 1 '; |
|
72 | - } |
|
73 | - if ($digest) { |
|
74 | - $sql .= ' AND t.topic_digest <> 1 '; |
|
75 | - } |
|
76 | - if ($lock) { |
|
77 | - $sql .= ' AND t.topic_status <> 1 '; |
|
78 | - } |
|
79 | - if (0 !== $hot) { |
|
80 | - $sql .= ' AND t.topic_replies < ' . $hot . ' '; |
|
81 | - } |
|
70 | + if ($sticky) { |
|
71 | + $sql .= ' AND t.topic_sticky <> 1 '; |
|
72 | + } |
|
73 | + if ($digest) { |
|
74 | + $sql .= ' AND t.topic_digest <> 1 '; |
|
75 | + } |
|
76 | + if ($lock) { |
|
77 | + $sql .= ' AND t.topic_status <> 1 '; |
|
78 | + } |
|
79 | + if (0 !== $hot) { |
|
80 | + $sql .= ' AND t.topic_replies < ' . $hot . ' '; |
|
81 | + } |
|
82 | 82 | |
83 | - $sql .= ' AND p.post_time<= ' . $prune_ddays . ' '; |
|
84 | - // Ok now we have the sql query completed, go for topic_id's and posts_id's |
|
85 | - $topics = []; |
|
86 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
87 | - return _MD_NEWBB_ERROR; |
|
88 | - } |
|
89 | - // Dave_L code |
|
90 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
91 | - $topics[] = $row['topic_id']; |
|
92 | - } |
|
93 | - $topics_number = count($topics); |
|
94 | - $topic_list = implode(',', $topics); |
|
95 | - $post_list = ''; |
|
83 | + $sql .= ' AND p.post_time<= ' . $prune_ddays . ' '; |
|
84 | + // Ok now we have the sql query completed, go for topic_id's and posts_id's |
|
85 | + $topics = []; |
|
86 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
87 | + return _MD_NEWBB_ERROR; |
|
88 | + } |
|
89 | + // Dave_L code |
|
90 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
91 | + $topics[] = $row['topic_id']; |
|
92 | + } |
|
93 | + $topics_number = count($topics); |
|
94 | + $topic_list = implode(',', $topics); |
|
95 | + $post_list = ''; |
|
96 | 96 | |
97 | - if ('' !== $topic_list) { |
|
98 | - $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; |
|
97 | + if ('' !== $topic_list) { |
|
98 | + $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; |
|
99 | 99 | |
100 | - $posts = []; |
|
101 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
102 | - return _MD_NEWBB_ERROR; |
|
103 | - } |
|
104 | - // Dave_L code |
|
105 | - while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
106 | - $posts[] = $row['post_id']; |
|
107 | - } |
|
108 | - $posts_number = count($posts); |
|
109 | - $post_list = implode(',', $posts); |
|
110 | - } |
|
111 | - // OKZ Now we have al posts id and topics id |
|
112 | - if ('' !== $post_list) { |
|
113 | - // COPY POSTS TO OTHER FORUM |
|
114 | - if (null !== $store) { |
|
115 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
116 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
117 | - return _MD_NEWBB_ERROR; |
|
118 | - } |
|
100 | + $posts = []; |
|
101 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
102 | + return _MD_NEWBB_ERROR; |
|
103 | + } |
|
104 | + // Dave_L code |
|
105 | + while (false !== ($row = $GLOBALS['xoopsDB']->fetchArray($result))) { |
|
106 | + $posts[] = $row['post_id']; |
|
107 | + } |
|
108 | + $posts_number = count($posts); |
|
109 | + $post_list = implode(',', $posts); |
|
110 | + } |
|
111 | + // OKZ Now we have al posts id and topics id |
|
112 | + if ('' !== $post_list) { |
|
113 | + // COPY POSTS TO OTHER FORUM |
|
114 | + if (null !== $store) { |
|
115 | + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
116 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
117 | + return _MD_NEWBB_ERROR; |
|
118 | + } |
|
119 | 119 | |
120 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
121 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
122 | - return _MD_NEWBB_ERROR; |
|
123 | - } |
|
124 | - } else { |
|
125 | - // ARCHIVING POSTS |
|
126 | - if (1 == $archive) { |
|
127 | - $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); |
|
128 | - while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
129 | - $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); |
|
130 | - } |
|
131 | - } |
|
132 | - // DELETE POSTS |
|
133 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)"; |
|
134 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
135 | - return _MD_NEWBB_ERROR; |
|
136 | - } |
|
137 | - // DELETE TOPICS |
|
138 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)"; |
|
139 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
140 | - return _MD_NEWBB_ERROR; |
|
141 | - } |
|
142 | - // DELETE POSTS_TEXT |
|
143 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)"; |
|
144 | - if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
145 | - return _MD_NEWBB_ERROR; |
|
146 | - } |
|
147 | - // SYNC FORUMS AFTER DELETE |
|
148 | - // /** @var Newbb\ForumHandler $forumHandler */ |
|
149 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
150 | - $forumHandler->synchronization(); |
|
151 | - // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: |
|
152 | - } |
|
153 | - } |
|
120 | + $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
121 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
122 | + return _MD_NEWBB_ERROR; |
|
123 | + } |
|
124 | + } else { |
|
125 | + // ARCHIVING POSTS |
|
126 | + if (1 == $archive) { |
|
127 | + $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); |
|
128 | + while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
|
129 | + $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); |
|
130 | + } |
|
131 | + } |
|
132 | + // DELETE POSTS |
|
133 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)"; |
|
134 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
135 | + return _MD_NEWBB_ERROR; |
|
136 | + } |
|
137 | + // DELETE TOPICS |
|
138 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)"; |
|
139 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
140 | + return _MD_NEWBB_ERROR; |
|
141 | + } |
|
142 | + // DELETE POSTS_TEXT |
|
143 | + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)"; |
|
144 | + if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
|
145 | + return _MD_NEWBB_ERROR; |
|
146 | + } |
|
147 | + // SYNC FORUMS AFTER DELETE |
|
148 | + // /** @var Newbb\ForumHandler $forumHandler */ |
|
149 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
150 | + $forumHandler->synchronization(); |
|
151 | + // I THINK POSTS AND TOPICS HAVE BEEN DESTROYED :LOL: |
|
152 | + } |
|
153 | + } |
|
154 | 154 | |
155 | - $tform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF')); |
|
156 | - $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums)); |
|
157 | - $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number)); |
|
158 | - $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number)); |
|
159 | - $tform->display(); |
|
155 | + $tform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_RESULTS_TITLE, 'prune_results', xoops_getenv('PHP_SELF')); |
|
156 | + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_FORUMS, $selected_forums)); |
|
157 | + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_TOPICS, $topics_number)); |
|
158 | + $tform->addElement(new \XoopsFormLabel(_AM_NEWBB_PRUNE_RESULTS_POSTS, $posts_number)); |
|
159 | + $tform->display(); |
|
160 | 160 | } else { |
161 | - $sform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF')); |
|
162 | - $sform->setExtra('enctype="multipart/form-data"'); |
|
161 | + $sform = new \XoopsThemeForm(_AM_NEWBB_PRUNE_TITLE, 'prune', xoops_getenv('PHP_SELF')); |
|
162 | + $sform->setExtra('enctype="multipart/form-data"'); |
|
163 | 163 | |
164 | - /* Let User select the number of days |
|
164 | + /* Let User select the number of days |
|
165 | 165 | $sform->addElement( new \XoopsFormText(_AM_NEWBB_PRUNE_DAYS , 'days', 5, 10,100 ), true ); |
166 | 166 | */ |
167 | - // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"; |
|
168 | - // $result = $GLOBALS['xoopsDB']->query(); |
|
169 | - // Days selected by selbox (better error control :lol:) |
|
170 | - $days = new \XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); |
|
171 | - $days->addOptionArray([ |
|
172 | - 604800 => _AM_NEWBB_PRUNE_WEEK, |
|
173 | - 1209600 => _AM_NEWBB_PRUNE_2WEEKS, |
|
174 | - 2592000 => _AM_NEWBB_PRUNE_MONTH, |
|
175 | - 5184000 => _AM_NEWBB_PRUNE_2MONTH, |
|
176 | - 10368000 => _AM_NEWBB_PRUNE_4MONTH, |
|
177 | - 31536000 => _AM_NEWBB_PRUNE_YEAR, |
|
178 | - 63072000 => _AM_NEWBB_PRUNE_2YEARS |
|
179 | - ]); |
|
180 | - $sform->addElement($days); |
|
181 | - // START irmtfan remove hardcode db access |
|
182 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files |
|
183 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
184 | - $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories |
|
185 | - $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories |
|
186 | - $forumSelBox = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>'; |
|
187 | - $forumSelBox .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false |
|
188 | - $forumSelBox .= '</select>'; |
|
189 | - $forumEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); |
|
190 | - $storeEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); |
|
191 | - /* irmtfan remove hardcode |
|
167 | + // $sql="SELECT p.topic_id, p.post_id t.post_text FROM ".$GLOBALS['xoopsDB']->prefix("newbb_posts")." p, ".$GLOBALS['xoopsDB']->prefix("newbb_posts_text")." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"; |
|
168 | + // $result = $GLOBALS['xoopsDB']->query(); |
|
169 | + // Days selected by selbox (better error control :lol:) |
|
170 | + $days = new \XoopsFormSelect(_AM_NEWBB_PRUNE_DAYS, 'days', null, 1, false); |
|
171 | + $days->addOptionArray([ |
|
172 | + 604800 => _AM_NEWBB_PRUNE_WEEK, |
|
173 | + 1209600 => _AM_NEWBB_PRUNE_2WEEKS, |
|
174 | + 2592000 => _AM_NEWBB_PRUNE_MONTH, |
|
175 | + 5184000 => _AM_NEWBB_PRUNE_2MONTH, |
|
176 | + 10368000 => _AM_NEWBB_PRUNE_4MONTH, |
|
177 | + 31536000 => _AM_NEWBB_PRUNE_YEAR, |
|
178 | + 63072000 => _AM_NEWBB_PRUNE_2YEARS |
|
179 | + ]); |
|
180 | + $sform->addElement($days); |
|
181 | + // START irmtfan remove hardcode db access |
|
182 | + require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files |
|
183 | + require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
184 | + $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories |
|
185 | + $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories |
|
186 | + $forumSelBox = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>'; |
|
187 | + $forumSelBox .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false |
|
188 | + $forumSelBox .= '</select>'; |
|
189 | + $forumEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); |
|
190 | + $storeEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); |
|
191 | + /* irmtfan remove hardcode |
|
192 | 192 | $checkbox = new \XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); |
193 | 193 | $radiobox = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); |
194 | 194 | // PUAJJ I HATE IT, please tidy up |
@@ -206,52 +206,52 @@ discard block |
||
206 | 206 | echo "DB ERROR"; |
207 | 207 | } |
208 | 208 | */ |
209 | - // END irmtfan remove hardcode db access |
|
209 | + // END irmtfan remove hardcode db access |
|
210 | 210 | |
211 | - $sform->addElement(/*$checkbox*/ |
|
212 | - $forumEle); // irmtfan |
|
211 | + $sform->addElement(/*$checkbox*/ |
|
212 | + $forumEle); // irmtfan |
|
213 | 213 | |
214 | - $sticky_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); |
|
215 | - $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
216 | - $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
217 | - $sform->addElement($sticky_confirmation); |
|
214 | + $sticky_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STICKY, 'sticky', 1); |
|
215 | + $sticky_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
216 | + $sticky_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
217 | + $sform->addElement($sticky_confirmation); |
|
218 | 218 | |
219 | - $digest_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1); |
|
220 | - $digest_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
221 | - $digest_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
222 | - $sform->addElement($digest_confirmation); |
|
219 | + $digest_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_DIGEST, 'digest', 1); |
|
220 | + $digest_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
221 | + $digest_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
222 | + $sform->addElement($digest_confirmation); |
|
223 | 223 | |
224 | - $lock_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0); |
|
225 | - $lock_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
226 | - $lock_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
227 | - $sform->addElement($lock_confirmation); |
|
224 | + $lock_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_LOCK, 'lock', 0); |
|
225 | + $lock_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
226 | + $lock_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
227 | + $sform->addElement($lock_confirmation); |
|
228 | 228 | |
229 | - $hot_confirmation = new \XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false); |
|
230 | - $hot_confirmation->addOptionArray([ |
|
231 | - '0' => 0, |
|
232 | - '5' => 5, |
|
233 | - '10' => 10, |
|
234 | - '15' => 15, |
|
235 | - '20' => 20, |
|
236 | - '25' => 25, |
|
237 | - '30' => 30 |
|
238 | - ]); |
|
239 | - $sform->addElement($hot_confirmation); |
|
229 | + $hot_confirmation = new \XoopsFormSelect(_AM_NEWBB_PRUNE_HOT, 'hot', null, 1, false); |
|
230 | + $hot_confirmation->addOptionArray([ |
|
231 | + '0' => 0, |
|
232 | + '5' => 5, |
|
233 | + '10' => 10, |
|
234 | + '15' => 15, |
|
235 | + '20' => 20, |
|
236 | + '25' => 25, |
|
237 | + '30' => 30 |
|
238 | + ]); |
|
239 | + $sform->addElement($hot_confirmation); |
|
240 | 240 | |
241 | - $sform->addElement(/*$radiobox*/ |
|
242 | - $storeEle); // irmtfan |
|
241 | + $sform->addElement(/*$radiobox*/ |
|
242 | + $storeEle); // irmtfan |
|
243 | 243 | |
244 | - $archive_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); |
|
245 | - $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
246 | - $archive_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
247 | - $sform->addElement($archive_confirmation); |
|
244 | + $archive_confirmation = new \XoopsFormRadio(_AM_NEWBB_PRUNE_ARCHIVE, 'archive', 1); |
|
245 | + $archive_confirmation->addOption(1, _AM_NEWBB_PRUNE_YES); |
|
246 | + $archive_confirmation->addOption(0, _AM_NEWBB_PRUNE_NO); |
|
247 | + $sform->addElement($archive_confirmation); |
|
248 | 248 | |
249 | - $button_tray = new \XoopsFormElementTray('', ''); |
|
250 | - $button_tray->addElement(new \XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit')); |
|
251 | - $button_tray->addElement(new \XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset')); |
|
252 | - $sform->addElement($button_tray); |
|
249 | + $button_tray = new \XoopsFormElementTray('', ''); |
|
250 | + $button_tray->addElement(new \XoopsFormButton('', 'submit', _AM_NEWBB_PRUNE_SUBMIT, 'submit')); |
|
251 | + $button_tray->addElement(new \XoopsFormButton('', 'reset', _AM_NEWBB_PRUNE_RESET, 'reset')); |
|
252 | + $sform->addElement($button_tray); |
|
253 | 253 | |
254 | - $sform->display(); |
|
254 | + $sform->display(); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | echo '</td></tr></table>'; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | |
28 | 28 | use Xmf\Request; |
29 | 29 | |
30 | -require_once __DIR__ . '/admin_header.php'; |
|
30 | +require_once __DIR__.'/admin_header.php'; |
|
31 | 31 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
32 | 32 | |
33 | 33 | xoops_cp_header(); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | //if (!$newXoopsModuleGui) loadModuleAdminMenu(5, _AM_NEWBB_PRUNE_TITLE); |
37 | 37 | // else $adminObject->displayNavigation(basename(__FILE__)); |
38 | 38 | |
39 | -echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
39 | +echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
40 | 40 | |
41 | 41 | if (Request::hasVar('submit', 'POST')) { |
42 | 42 | $post_list = null; |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | $hot = Request::getInt('hot', 0, 'POST'); |
64 | 64 | $store = Request::getInt('store', null, 'POST'); |
65 | 65 | |
66 | - $sql = 'SELECT t.topic_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' t, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p |
|
67 | - WHERE t.forum_id IN (' . $selected_forums . ') |
|
66 | + $sql = 'SELECT t.topic_id FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics').' t, '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' p |
|
67 | + WHERE t.forum_id IN (' . $selected_forums.') |
|
68 | 68 | AND p.post_id =t.topic_last_post_id '; |
69 | 69 | |
70 | 70 | if ($sticky) { |
@@ -77,10 +77,10 @@ discard block |
||
77 | 77 | $sql .= ' AND t.topic_status <> 1 '; |
78 | 78 | } |
79 | 79 | if (0 !== $hot) { |
80 | - $sql .= ' AND t.topic_replies < ' . $hot . ' '; |
|
80 | + $sql .= ' AND t.topic_replies < '.$hot.' '; |
|
81 | 81 | } |
82 | 82 | |
83 | - $sql .= ' AND p.post_time<= ' . $prune_ddays . ' '; |
|
83 | + $sql .= ' AND p.post_time<= '.$prune_ddays.' '; |
|
84 | 84 | // Ok now we have the sql query completed, go for topic_id's and posts_id's |
85 | 85 | $topics = []; |
86 | 86 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $post_list = ''; |
96 | 96 | |
97 | 97 | if ('' !== $topic_list) { |
98 | - $sql = 'SELECT post_id FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' WHERE topic_id IN (' . $topic_list . ')'; |
|
98 | + $sql = 'SELECT post_id FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' WHERE topic_id IN ('.$topic_list.')'; |
|
99 | 99 | |
100 | 100 | $posts = []; |
101 | 101 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
@@ -112,35 +112,35 @@ discard block |
||
112 | 112 | if ('' !== $post_list) { |
113 | 113 | // COPY POSTS TO OTHER FORUM |
114 | 114 | if (null !== $store) { |
115 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
115 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_posts')." SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
116 | 116 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
117 | 117 | return _MD_NEWBB_ERROR; |
118 | 118 | } |
119 | 119 | |
120 | - $sql = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
120 | + $sql = 'UPDATE '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." SET forum_id=$store WHERE topic_id IN ($topic_list)"; |
|
121 | 121 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
122 | 122 | return _MD_NEWBB_ERROR; |
123 | 123 | } |
124 | 124 | } else { |
125 | 125 | // ARCHIVING POSTS |
126 | 126 | if (1 == $archive) { |
127 | - $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . ' p, ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); |
|
127 | + $result = $GLOBALS['xoopsDB']->query('SELECT p.topic_id, p.post_id, t.post_text FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts').' p, '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text')." t WHERE p.post_id IN ($post_list) AND p.post_id=t.post_id"); |
|
128 | 128 | while (false !== (list($topic_id, $post_id, $post_text) = $GLOBALS['xoopsDB']->fetchRow($result))) { |
129 | - $sql = $GLOBALS['xoopsDB']->query('INSERT INTO ' . $GLOBALS['xoopsDB']->prefix('newbb_archive') . " (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); |
|
129 | + $sql = $GLOBALS['xoopsDB']->query('INSERT INTO '.$GLOBALS['xoopsDB']->prefix('newbb_archive')." (topic_id, post_id, post_text) VALUES ($topic_id, $post_id, $post_text)"); |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | // DELETE POSTS |
133 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts') . " WHERE topic_id IN ($topic_list)"; |
|
133 | + $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts')." WHERE topic_id IN ($topic_list)"; |
|
134 | 134 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
135 | 135 | return _MD_NEWBB_ERROR; |
136 | 136 | } |
137 | 137 | // DELETE TOPICS |
138 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . " WHERE topic_id IN ($topic_list)"; |
|
138 | + $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_topics')." WHERE topic_id IN ($topic_list)"; |
|
139 | 139 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
140 | 140 | return _MD_NEWBB_ERROR; |
141 | 141 | } |
142 | 142 | // DELETE POSTS_TEXT |
143 | - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_posts_text') . " WHERE post_id IN ($post_list)"; |
|
143 | + $sql = 'DELETE FROM '.$GLOBALS['xoopsDB']->prefix('newbb_posts_text')." WHERE post_id IN ($post_list)"; |
|
144 | 144 | if (!$result = $GLOBALS['xoopsDB']->query($sql)) { |
145 | 145 | return _MD_NEWBB_ERROR; |
146 | 146 | } |
@@ -179,15 +179,15 @@ discard block |
||
179 | 179 | ]); |
180 | 180 | $sform->addElement($days); |
181 | 181 | // START irmtfan remove hardcode db access |
182 | - require_once $GLOBALS['xoops']->path('modules/' . $xoopsModule->getVar('dirname') . '/footer.php'); // to include js files |
|
183 | - require_once dirname(__DIR__) . '/include/functions.forum.php'; |
|
184 | - $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">";// disable all categories |
|
182 | + require_once $GLOBALS['xoops']->path('modules/'.$xoopsModule->getVar('dirname').'/footer.php'); // to include js files |
|
183 | + require_once dirname(__DIR__).'/include/functions.forum.php'; |
|
184 | + $forumSelMulti = "<select name=\"forums[]\" multiple=\"multiple\" onfocus = \"validate('forums[]','select', false,true)\">"; // disable all categories |
|
185 | 185 | $forumSelSingle = "<select name=\"store\" onfocus = \"validate('store','select', false,true)\">"; // disable all categories |
186 | - $forumSelBox = '<option value = 0 >-- ' . _AM_NEWBB_PERM_FORUMS . ' --</option>'; |
|
186 | + $forumSelBox = '<option value = 0 >-- '._AM_NEWBB_PERM_FORUMS.' --</option>'; |
|
187 | 187 | $forumSelBox .= newbbForumSelectBox(null, 'access', false); //$accessForums = nothing, $permission = "access", $delimitorCategory = false |
188 | 188 | $forumSelBox .= '</select>'; |
189 | - $forumEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti . $forumSelBox); |
|
190 | - $storeEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle . $forumSelBox); |
|
189 | + $forumEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_FORUMS, $forumSelMulti.$forumSelBox); |
|
190 | + $storeEle = new \XoopsFormLabel(_AM_NEWBB_PRUNE_STORE, $forumSelSingle.$forumSelBox); |
|
191 | 191 | /* irmtfan remove hardcode |
192 | 192 | $checkbox = new \XoopsFormCheckBox(_AM_NEWBB_PRUNE_FORUMS, 'forums'); |
193 | 193 | $radiobox = new \XoopsFormRadio(_AM_NEWBB_PRUNE_STORE, 'store'); |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | echo '</td></tr></table>'; |
258 | 258 | echo '<fieldset>'; |
259 | -echo '<legend> ' . _MI_NEWBB_ADMENU_PRUNE . ' </legend>'; |
|
259 | +echo '<legend> '._MI_NEWBB_ADMENU_PRUNE.' </legend>'; |
|
260 | 260 | echo _AM_NEWBB_HELP_PRUNE_TAB; |
261 | 261 | echo '</fieldset>'; |
262 | -require_once __DIR__ . '/admin_footer.php'; |
|
262 | +require_once __DIR__.'/admin_footer.php'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | */ |
50 | 50 | function newCategory() |
51 | 51 | { |
52 | - editCategory(); |
|
52 | + editCategory(); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -60,154 +60,154 @@ discard block |
||
60 | 60 | */ |
61 | 61 | function editCategory(\XoopsObject $categoryObject = null) |
62 | 62 | { |
63 | - global $xoopsModule; |
|
64 | - $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
65 | - if (null === $categoryObject) { |
|
66 | - $categoryObject = $categoryHandler->create(); |
|
67 | - } |
|
68 | - $groups_cat_access = null; |
|
69 | - require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
70 | - |
|
71 | - if (!$categoryObject->isNew()) { |
|
72 | - $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); |
|
73 | - } else { |
|
74 | - $sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF')); |
|
75 | - $categoryObject->setVar('cat_title', ''); |
|
76 | - $categoryObject->setVar('cat_image', ''); |
|
77 | - $categoryObject->setVar('cat_description', ''); |
|
78 | - $categoryObject->setVar('cat_order', 0); |
|
79 | - $categoryObject->setVar('cat_url', 'https://xoops.org/modules/newbb/ newBB Support'); |
|
80 | - } |
|
81 | - |
|
82 | - $sform->addElement(new \XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $categoryObject->getVar('cat_order')), false); |
|
83 | - $sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true); |
|
84 | - $sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false); |
|
85 | - |
|
86 | - $imgdir = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category'; |
|
87 | - $cat_image = $categoryObject->getVar('cat_image'); |
|
88 | - $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image; |
|
89 | - $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/'); |
|
90 | - array_unshift($graph_array, _NONE); |
|
91 | - $cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image')); |
|
92 | - $cat_image_select->addOptionArray($graph_array); |
|
93 | - $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); |
|
94 | - $cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); |
|
95 | - $cat_image_tray->addElement($cat_image_select); |
|
96 | - $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . $imgdir . '/' . $cat_image . " 'name='img' id='img' alt='' />")); |
|
97 | - $sform->addElement($cat_image_tray); |
|
98 | - |
|
99 | - $sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false); |
|
100 | - $sform->addElement(new \XoopsFormHidden('cat_id', $categoryObject->getVar('cat_id'))); |
|
101 | - |
|
102 | - $button_tray = new \XoopsFormElementTray('', ''); |
|
103 | - $button_tray->addElement(new \XoopsFormHidden('op', 'save')); |
|
104 | - |
|
105 | - $butt_save = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
|
106 | - $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"'); |
|
107 | - $button_tray->addElement($butt_save); |
|
108 | - if ($categoryObject->getVar('cat_id')) { |
|
109 | - $butt_delete = new \XoopsFormButton('', '', _CANCEL, 'submit'); |
|
110 | - $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"'); |
|
111 | - $button_tray->addElement($butt_delete); |
|
112 | - } |
|
113 | - $sform->addElement($button_tray); |
|
114 | - $sform->display(); |
|
63 | + global $xoopsModule; |
|
64 | + $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
65 | + if (null === $categoryObject) { |
|
66 | + $categoryObject = $categoryHandler->create(); |
|
67 | + } |
|
68 | + $groups_cat_access = null; |
|
69 | + require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
|
70 | + |
|
71 | + if (!$categoryObject->isNew()) { |
|
72 | + $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); |
|
73 | + } else { |
|
74 | + $sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF')); |
|
75 | + $categoryObject->setVar('cat_title', ''); |
|
76 | + $categoryObject->setVar('cat_image', ''); |
|
77 | + $categoryObject->setVar('cat_description', ''); |
|
78 | + $categoryObject->setVar('cat_order', 0); |
|
79 | + $categoryObject->setVar('cat_url', 'https://xoops.org/modules/newbb/ newBB Support'); |
|
80 | + } |
|
81 | + |
|
82 | + $sform->addElement(new \XoopsFormText(_AM_NEWBB_SETCATEGORYORDER, 'cat_order', 5, 10, $categoryObject->getVar('cat_order')), false); |
|
83 | + $sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true); |
|
84 | + $sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false); |
|
85 | + |
|
86 | + $imgdir = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category'; |
|
87 | + $cat_image = $categoryObject->getVar('cat_image'); |
|
88 | + $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image; |
|
89 | + $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/'); |
|
90 | + array_unshift($graph_array, _NONE); |
|
91 | + $cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image')); |
|
92 | + $cat_image_select->addOptionArray($graph_array); |
|
93 | + $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); |
|
94 | + $cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); |
|
95 | + $cat_image_tray->addElement($cat_image_select); |
|
96 | + $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . $imgdir . '/' . $cat_image . " 'name='img' id='img' alt='' />")); |
|
97 | + $sform->addElement($cat_image_tray); |
|
98 | + |
|
99 | + $sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false); |
|
100 | + $sform->addElement(new \XoopsFormHidden('cat_id', $categoryObject->getVar('cat_id'))); |
|
101 | + |
|
102 | + $button_tray = new \XoopsFormElementTray('', ''); |
|
103 | + $button_tray->addElement(new \XoopsFormHidden('op', 'save')); |
|
104 | + |
|
105 | + $butt_save = new \XoopsFormButton('', '', _SUBMIT, 'submit'); |
|
106 | + $butt_save->setExtra('onclick="this.form.elements.op.value=\'save\'"'); |
|
107 | + $button_tray->addElement($butt_save); |
|
108 | + if ($categoryObject->getVar('cat_id')) { |
|
109 | + $butt_delete = new \XoopsFormButton('', '', _CANCEL, 'submit'); |
|
110 | + $butt_delete->setExtra('onclick="this.form.elements.op.value=\'default\'"'); |
|
111 | + $button_tray->addElement($butt_delete); |
|
112 | + } |
|
113 | + $sform->addElement($button_tray); |
|
114 | + $sform->display(); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | switch ($op) { |
118 | - case 'mod': |
|
119 | - $categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create(); |
|
120 | - // if (!$newXoopsModuleGui) { |
|
121 | - // //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); |
|
122 | - // echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>'; |
|
123 | - // } else { |
|
124 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
125 | - // } |
|
126 | - echo '<br>'; |
|
127 | - editCategory($categoryObject); |
|
128 | - break; |
|
129 | - |
|
130 | - case 'del': |
|
131 | - if (!Request::getBool('confirm', '', 'POST')) { |
|
132 | - xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); |
|
133 | - break; |
|
134 | - } else { |
|
135 | - $categoryObject = $categoryHandler->create(false); |
|
136 | - $categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
137 | - $categoryHandler->delete($categoryObject); |
|
138 | - |
|
139 | - redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); |
|
140 | - } |
|
141 | - break; |
|
142 | - |
|
143 | - case 'save': |
|
144 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
145 | - $cacheHelper->delete('permission_category'); |
|
146 | - if ($cat_id) { |
|
147 | - $categoryObject = $categoryHandler->get($cat_id); |
|
148 | - $message = _AM_NEWBB_CATEGORYUPDATED; |
|
149 | - } else { |
|
150 | - $categoryObject = $categoryHandler->create(); |
|
151 | - $message = _AM_NEWBB_CATEGORYCREATED; |
|
152 | - } |
|
153 | - |
|
154 | - $categoryObject->setVar('cat_title', Request::getString('title', '', 'POST')); |
|
155 | - $categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST')); |
|
156 | - $categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST')); |
|
157 | - $categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST')); |
|
158 | - $categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST')); |
|
159 | - |
|
160 | - $cat_isNew = $categoryObject->isNew(); |
|
161 | - if (!$categoryHandler->insert($categoryObject)) { |
|
162 | - $message = _AM_NEWBB_DATABASEERROR; |
|
163 | - } |
|
164 | - if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) { |
|
165 | - $categoryHandler->applyPermissionTemplate($categoryObject); |
|
166 | - } |
|
167 | - redirect_header('admin_cat_manager.php', 2, $message); |
|
168 | - break; |
|
169 | - |
|
170 | - default: |
|
171 | - if (!$categories = $categoryHandler->getByPermission('all')) { |
|
172 | - $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
173 | - $adminObject->displayButton('left'); |
|
174 | - |
|
175 | - echo '<br>'; |
|
176 | - newCategory(); |
|
177 | - break; |
|
178 | - } |
|
179 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
180 | - $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
181 | - $adminObject->displayButton('left'); |
|
182 | - |
|
183 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
184 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
185 | - echo "<tr align='center'>"; |
|
186 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>'; |
|
187 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>'; |
|
188 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>'; |
|
189 | - echo '</tr>'; |
|
190 | - |
|
191 | - foreach ($categories as $key => $onecat) { |
|
192 | - $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
193 | - $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
194 | - $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>'; |
|
195 | - |
|
196 | - echo "<tr class='odd' align='left'>"; |
|
197 | - echo '<td>' . $cat_title_link . '</td>'; |
|
198 | - echo "<td align='center'>" . $cat_edit_link . '</td>'; |
|
199 | - echo "<td align='center'>" . $cat_del_link . '</td>'; |
|
200 | - echo '</tr>'; |
|
201 | - } |
|
202 | - echo '</table>'; |
|
203 | - echo '</td></tr></table>'; |
|
204 | - echo '<fieldset>'; |
|
205 | - echo '<legend> ' . _MI_NEWBB_ADMENU_CATEGORY . ' </legend>'; |
|
206 | - echo _AM_NEWBB_HELP_CATEGORY_TAB; |
|
207 | - echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
208 | - echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
209 | - echo '</fieldset>'; |
|
210 | - break; |
|
118 | + case 'mod': |
|
119 | + $categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create(); |
|
120 | + // if (!$newXoopsModuleGui) { |
|
121 | + // //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); |
|
122 | + // echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>'; |
|
123 | + // } else { |
|
124 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
125 | + // } |
|
126 | + echo '<br>'; |
|
127 | + editCategory($categoryObject); |
|
128 | + break; |
|
129 | + |
|
130 | + case 'del': |
|
131 | + if (!Request::getBool('confirm', '', 'POST')) { |
|
132 | + xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); |
|
133 | + break; |
|
134 | + } else { |
|
135 | + $categoryObject = $categoryHandler->create(false); |
|
136 | + $categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
137 | + $categoryHandler->delete($categoryObject); |
|
138 | + |
|
139 | + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); |
|
140 | + } |
|
141 | + break; |
|
142 | + |
|
143 | + case 'save': |
|
144 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
145 | + $cacheHelper->delete('permission_category'); |
|
146 | + if ($cat_id) { |
|
147 | + $categoryObject = $categoryHandler->get($cat_id); |
|
148 | + $message = _AM_NEWBB_CATEGORYUPDATED; |
|
149 | + } else { |
|
150 | + $categoryObject = $categoryHandler->create(); |
|
151 | + $message = _AM_NEWBB_CATEGORYCREATED; |
|
152 | + } |
|
153 | + |
|
154 | + $categoryObject->setVar('cat_title', Request::getString('title', '', 'POST')); |
|
155 | + $categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST')); |
|
156 | + $categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST')); |
|
157 | + $categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST')); |
|
158 | + $categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST')); |
|
159 | + |
|
160 | + $cat_isNew = $categoryObject->isNew(); |
|
161 | + if (!$categoryHandler->insert($categoryObject)) { |
|
162 | + $message = _AM_NEWBB_DATABASEERROR; |
|
163 | + } |
|
164 | + if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) { |
|
165 | + $categoryHandler->applyPermissionTemplate($categoryObject); |
|
166 | + } |
|
167 | + redirect_header('admin_cat_manager.php', 2, $message); |
|
168 | + break; |
|
169 | + |
|
170 | + default: |
|
171 | + if (!$categories = $categoryHandler->getByPermission('all')) { |
|
172 | + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
173 | + $adminObject->displayButton('left'); |
|
174 | + |
|
175 | + echo '<br>'; |
|
176 | + newCategory(); |
|
177 | + break; |
|
178 | + } |
|
179 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
180 | + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
181 | + $adminObject->displayButton('left'); |
|
182 | + |
|
183 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
184 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
185 | + echo "<tr align='center'>"; |
|
186 | + echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>'; |
|
187 | + echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>'; |
|
188 | + echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>'; |
|
189 | + echo '</tr>'; |
|
190 | + |
|
191 | + foreach ($categories as $key => $onecat) { |
|
192 | + $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
193 | + $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
194 | + $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>'; |
|
195 | + |
|
196 | + echo "<tr class='odd' align='left'>"; |
|
197 | + echo '<td>' . $cat_title_link . '</td>'; |
|
198 | + echo "<td align='center'>" . $cat_edit_link . '</td>'; |
|
199 | + echo "<td align='center'>" . $cat_del_link . '</td>'; |
|
200 | + echo '</tr>'; |
|
201 | + } |
|
202 | + echo '</table>'; |
|
203 | + echo '</td></tr></table>'; |
|
204 | + echo '<fieldset>'; |
|
205 | + echo '<legend> ' . _MI_NEWBB_ADMENU_CATEGORY . ' </legend>'; |
|
206 | + echo _AM_NEWBB_HELP_CATEGORY_TAB; |
|
207 | + echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
208 | + echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
209 | + echo '</fieldset>'; |
|
210 | + break; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $cacheHelper = Newbb\Utility::cleanCache(); |
@@ -115,99 +115,99 @@ |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | switch ($op) { |
118 | - case 'mod': |
|
119 | - $categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create(); |
|
120 | - // if (!$newXoopsModuleGui) { |
|
121 | - // //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); |
|
122 | - // echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>'; |
|
123 | - // } else { |
|
124 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
125 | - // } |
|
126 | - echo '<br>'; |
|
127 | - editCategory($categoryObject); |
|
128 | - break; |
|
129 | - |
|
130 | - case 'del': |
|
131 | - if (!Request::getBool('confirm', '', 'POST')) { |
|
132 | - xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); |
|
133 | - break; |
|
134 | - } else { |
|
135 | - $categoryObject = $categoryHandler->create(false); |
|
136 | - $categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
137 | - $categoryHandler->delete($categoryObject); |
|
138 | - |
|
139 | - redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); |
|
140 | - } |
|
141 | - break; |
|
142 | - |
|
143 | - case 'save': |
|
144 | - $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
145 | - $cacheHelper->delete('permission_category'); |
|
146 | - if ($cat_id) { |
|
147 | - $categoryObject = $categoryHandler->get($cat_id); |
|
148 | - $message = _AM_NEWBB_CATEGORYUPDATED; |
|
149 | - } else { |
|
150 | - $categoryObject = $categoryHandler->create(); |
|
151 | - $message = _AM_NEWBB_CATEGORYCREATED; |
|
152 | - } |
|
153 | - |
|
154 | - $categoryObject->setVar('cat_title', Request::getString('title', '', 'POST')); |
|
155 | - $categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST')); |
|
156 | - $categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST')); |
|
157 | - $categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST')); |
|
158 | - $categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST')); |
|
159 | - |
|
160 | - $cat_isNew = $categoryObject->isNew(); |
|
161 | - if (!$categoryHandler->insert($categoryObject)) { |
|
162 | - $message = _AM_NEWBB_DATABASEERROR; |
|
163 | - } |
|
164 | - if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) { |
|
165 | - $categoryHandler->applyPermissionTemplate($categoryObject); |
|
166 | - } |
|
167 | - redirect_header('admin_cat_manager.php', 2, $message); |
|
168 | - break; |
|
169 | - |
|
170 | - default: |
|
171 | - if (!$categories = $categoryHandler->getByPermission('all')) { |
|
172 | - $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
173 | - $adminObject->displayButton('left'); |
|
174 | - |
|
175 | - echo '<br>'; |
|
176 | - newCategory(); |
|
177 | - break; |
|
178 | - } |
|
179 | - $adminObject->displayNavigation(basename(__FILE__)); |
|
180 | - $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
181 | - $adminObject->displayButton('left'); |
|
182 | - |
|
183 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
184 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
185 | - echo "<tr align='center'>"; |
|
186 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>'; |
|
187 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>'; |
|
188 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>'; |
|
189 | - echo '</tr>'; |
|
190 | - |
|
191 | - foreach ($categories as $key => $onecat) { |
|
192 | - $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
193 | - $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
194 | - $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>'; |
|
195 | - |
|
196 | - echo "<tr class='odd' align='left'>"; |
|
197 | - echo '<td>' . $cat_title_link . '</td>'; |
|
198 | - echo "<td align='center'>" . $cat_edit_link . '</td>'; |
|
199 | - echo "<td align='center'>" . $cat_del_link . '</td>'; |
|
200 | - echo '</tr>'; |
|
201 | - } |
|
202 | - echo '</table>'; |
|
203 | - echo '</td></tr></table>'; |
|
204 | - echo '<fieldset>'; |
|
205 | - echo '<legend> ' . _MI_NEWBB_ADMENU_CATEGORY . ' </legend>'; |
|
206 | - echo _AM_NEWBB_HELP_CATEGORY_TAB; |
|
207 | - echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
208 | - echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
209 | - echo '</fieldset>'; |
|
210 | - break; |
|
118 | + case 'mod': |
|
119 | + $categoryObject = ($cat_id > 0) ? $categoryHandler->get($cat_id) : $categoryHandler->create(); |
|
120 | + // if (!$newXoopsModuleGui) { |
|
121 | + // //loadModuleAdminMenu(1, ( $cat_id > 0) ? _AM_NEWBB_EDITCATEGORY . $categoryObject->getVar('cat_title') : _AM_NEWBB_CREATENEWCATEGORY); |
|
122 | + // echo "<legend style='font-weight: bold; color: #900;'>" . _AM_NEWBB_EDITCATEGORY . '</legend>'; |
|
123 | + // } else { |
|
124 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
125 | + // } |
|
126 | + echo '<br>'; |
|
127 | + editCategory($categoryObject); |
|
128 | + break; |
|
129 | + |
|
130 | + case 'del': |
|
131 | + if (!Request::getBool('confirm', '', 'POST')) { |
|
132 | + xoops_confirm(['op' => 'del', 'cat_id' => Request::getInt('cat_id', 0, 'GET'), 'confirm' => 1], 'admin_cat_manager.php', _AM_NEWBB_WAYSYWTDTTAL); |
|
133 | + break; |
|
134 | + } else { |
|
135 | + $categoryObject = $categoryHandler->create(false); |
|
136 | + $categoryObject->setVar('cat_id', Request::getInt('cat_id', 0, 'POST')); |
|
137 | + $categoryHandler->delete($categoryObject); |
|
138 | + |
|
139 | + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CATEGORYDELETED); |
|
140 | + } |
|
141 | + break; |
|
142 | + |
|
143 | + case 'save': |
|
144 | + $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
|
145 | + $cacheHelper->delete('permission_category'); |
|
146 | + if ($cat_id) { |
|
147 | + $categoryObject = $categoryHandler->get($cat_id); |
|
148 | + $message = _AM_NEWBB_CATEGORYUPDATED; |
|
149 | + } else { |
|
150 | + $categoryObject = $categoryHandler->create(); |
|
151 | + $message = _AM_NEWBB_CATEGORYCREATED; |
|
152 | + } |
|
153 | + |
|
154 | + $categoryObject->setVar('cat_title', Request::getString('title', '', 'POST')); |
|
155 | + $categoryObject->setVar('cat_image', Request::getString('cat_image', '', 'POST')); |
|
156 | + $categoryObject->setVar('cat_order', Request::getInt('cat_order', 0, 'POST')); |
|
157 | + $categoryObject->setVar('cat_description', Request::getText('cat_description', '', 'POST')); |
|
158 | + $categoryObject->setVar('cat_url', Request::getString('cat_url', '', 'POST')); |
|
159 | + |
|
160 | + $cat_isNew = $categoryObject->isNew(); |
|
161 | + if (!$categoryHandler->insert($categoryObject)) { |
|
162 | + $message = _AM_NEWBB_DATABASEERROR; |
|
163 | + } |
|
164 | + if (($cat_id = $categoryObject->getVar('cat_id')) && $cat_isNew) { |
|
165 | + $categoryHandler->applyPermissionTemplate($categoryObject); |
|
166 | + } |
|
167 | + redirect_header('admin_cat_manager.php', 2, $message); |
|
168 | + break; |
|
169 | + |
|
170 | + default: |
|
171 | + if (!$categories = $categoryHandler->getByPermission('all')) { |
|
172 | + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
173 | + $adminObject->displayButton('left'); |
|
174 | + |
|
175 | + echo '<br>'; |
|
176 | + newCategory(); |
|
177 | + break; |
|
178 | + } |
|
179 | + $adminObject->displayNavigation(basename(__FILE__)); |
|
180 | + $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
|
181 | + $adminObject->displayButton('left'); |
|
182 | + |
|
183 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
184 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
185 | + echo "<tr align='center'>"; |
|
186 | + echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>'; |
|
187 | + echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>'; |
|
188 | + echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>'; |
|
189 | + echo '</tr>'; |
|
190 | + |
|
191 | + foreach ($categories as $key => $onecat) { |
|
192 | + $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
193 | + $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
194 | + $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>'; |
|
195 | + |
|
196 | + echo "<tr class='odd' align='left'>"; |
|
197 | + echo '<td>' . $cat_title_link . '</td>'; |
|
198 | + echo "<td align='center'>" . $cat_edit_link . '</td>'; |
|
199 | + echo "<td align='center'>" . $cat_del_link . '</td>'; |
|
200 | + echo '</tr>'; |
|
201 | + } |
|
202 | + echo '</table>'; |
|
203 | + echo '</td></tr></table>'; |
|
204 | + echo '<fieldset>'; |
|
205 | + echo '<legend> ' . _MI_NEWBB_ADMENU_CATEGORY . ' </legend>'; |
|
206 | + echo _AM_NEWBB_HELP_CATEGORY_TAB; |
|
207 | + echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
208 | + echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
209 | + echo '</fieldset>'; |
|
210 | + break; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | $cacheHelper = Newbb\Utility::cleanCache(); |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | use Xmf\Request; |
33 | 33 | use XoopsModules\Newbb; |
34 | 34 | |
35 | -require_once __DIR__ . '/admin_header.php'; |
|
36 | -require_once dirname(__DIR__) . '/include/functions.render.php'; |
|
35 | +require_once __DIR__.'/admin_header.php'; |
|
36 | +require_once dirname(__DIR__).'/include/functions.render.php'; |
|
37 | 37 | |
38 | 38 | xoops_cp_header(); |
39 | 39 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
70 | 70 | |
71 | 71 | if (!$categoryObject->isNew()) { |
72 | - $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY . ' ' . $categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); |
|
72 | + $sform = new \XoopsThemeForm(_AM_NEWBB_EDITCATEGORY.' '.$categoryObject->getVar('cat_title'), 'op', xoops_getenv('PHP_SELF')); |
|
73 | 73 | } else { |
74 | 74 | $sform = new \XoopsThemeForm(_AM_NEWBB_CREATENEWCATEGORY, 'op', xoops_getenv('PHP_SELF')); |
75 | 75 | $categoryObject->setVar('cat_title', ''); |
@@ -83,17 +83,17 @@ discard block |
||
83 | 83 | $sform->addElement(new \XoopsFormText(_AM_NEWBB_CATEGORY, 'title', 50, 80, $categoryObject->getVar('cat_title', 'E')), true); |
84 | 84 | $sform->addElement(new \XoopsFormDhtmlTextArea(_AM_NEWBB_CATEGORYDESC, 'cat_description', $categoryObject->getVar('cat_description', 'E'), 10, 60), false); |
85 | 85 | |
86 | - $imgdir = '/modules/' . $xoopsModule->getVar('dirname') . '/assets/images/category'; |
|
86 | + $imgdir = '/modules/'.$xoopsModule->getVar('dirname').'/assets/images/category'; |
|
87 | 87 | $cat_image = $categoryObject->getVar('cat_image'); |
88 | 88 | $cat_image = empty($cat_image) ? 'blank.gif' : $cat_image; |
89 | - $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . $imgdir . '/'); |
|
89 | + $graph_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH.$imgdir.'/'); |
|
90 | 90 | array_unshift($graph_array, _NONE); |
91 | 91 | $cat_image_select = new \XoopsFormSelect('', 'cat_image', $categoryObject->getVar('cat_image')); |
92 | 92 | $cat_image_select->addOptionArray($graph_array); |
93 | - $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/" . $imgdir . "/', '', '" . XOOPS_URL . "')\""); |
|
93 | + $cat_image_select->setExtra("onchange=\"showImgSelected('img', 'cat_image', '/".$imgdir."/', '', '".XOOPS_URL."')\""); |
|
94 | 94 | $cat_image_tray = new \XoopsFormElementTray(_AM_NEWBB_IMAGE, ' '); |
95 | 95 | $cat_image_tray->addElement($cat_image_select); |
96 | - $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='" . XOOPS_URL . $imgdir . '/' . $cat_image . " 'name='img' id='img' alt='' />")); |
|
96 | + $cat_image_tray->addElement(new \XoopsFormLabel('', "<br><img src='".XOOPS_URL.$imgdir.'/'.$cat_image." 'name='img' id='img' alt='' />")); |
|
97 | 97 | $sform->addElement($cat_image_tray); |
98 | 98 | |
99 | 99 | $sform->addElement(new \XoopsFormText(_AM_NEWBB_SPONSORLINK, 'cat_url', 50, 80, $categoryObject->getVar('cat_url', 'E')), false); |
@@ -180,32 +180,32 @@ discard block |
||
180 | 180 | $adminObject->addItemButton(_AM_NEWBB_CREATENEWCATEGORY, 'admin_cat_manager.php?op=mod', $icon = 'add'); |
181 | 181 | $adminObject->displayButton('left'); |
182 | 182 | |
183 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
183 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
184 | 184 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
185 | 185 | echo "<tr align='center'>"; |
186 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_CATEGORY1 . '</th>'; |
|
187 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_EDIT . '</th>'; |
|
188 | - echo "<th class='bg3' width='10%'>" . _AM_NEWBB_DELETE . '</th>'; |
|
186 | + echo "<th align='left' class='bg3'>"._AM_NEWBB_CATEGORY1.'</th>'; |
|
187 | + echo "<th class='bg3' width='10%'>"._AM_NEWBB_EDIT.'</th>'; |
|
188 | + echo "<th class='bg3' width='10%'>"._AM_NEWBB_DELETE.'</th>'; |
|
189 | 189 | echo '</tr>'; |
190 | 190 | |
191 | 191 | foreach ($categories as $key => $onecat) { |
192 | - $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_edit', _EDIT) . '</a>'; |
|
193 | - $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id=' . $onecat->getVar('cat_id') . '">' . newbbDisplayImage('admin_delete', _DELETE) . '</a>'; |
|
194 | - $cat_title_link = '<a href="' . XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php?cat=' . $onecat->getVar('cat_id') . '">' . $onecat->getVar('cat_title') . '</a>'; |
|
192 | + $cat_edit_link = '<a href="admin_cat_manager.php?op=mod&cat_id='.$onecat->getVar('cat_id').'">'.newbbDisplayImage('admin_edit', _EDIT).'</a>'; |
|
193 | + $cat_del_link = '<a href="admin_cat_manager.php?op=del&cat_id='.$onecat->getVar('cat_id').'">'.newbbDisplayImage('admin_delete', _DELETE).'</a>'; |
|
194 | + $cat_title_link = '<a href="'.XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/index.php?cat='.$onecat->getVar('cat_id').'">'.$onecat->getVar('cat_title').'</a>'; |
|
195 | 195 | |
196 | 196 | echo "<tr class='odd' align='left'>"; |
197 | - echo '<td>' . $cat_title_link . '</td>'; |
|
198 | - echo "<td align='center'>" . $cat_edit_link . '</td>'; |
|
199 | - echo "<td align='center'>" . $cat_del_link . '</td>'; |
|
197 | + echo '<td>'.$cat_title_link.'</td>'; |
|
198 | + echo "<td align='center'>".$cat_edit_link.'</td>'; |
|
199 | + echo "<td align='center'>".$cat_del_link.'</td>'; |
|
200 | 200 | echo '</tr>'; |
201 | 201 | } |
202 | 202 | echo '</table>'; |
203 | 203 | echo '</td></tr></table>'; |
204 | 204 | echo '<fieldset>'; |
205 | - echo '<legend> ' . _MI_NEWBB_ADMENU_CATEGORY . ' </legend>'; |
|
205 | + echo '<legend> '._MI_NEWBB_ADMENU_CATEGORY.' </legend>'; |
|
206 | 206 | echo _AM_NEWBB_HELP_CATEGORY_TAB; |
207 | - echo '<br>' . newbbDisplayImage('admin_edit', _EDIT) . ' - ' . _EDIT; |
|
208 | - echo '<br>' . newbbDisplayImage('admin_delete', _DELETE) . ' - ' . _DELETE; |
|
207 | + echo '<br>'.newbbDisplayImage('admin_edit', _EDIT).' - '._EDIT; |
|
208 | + echo '<br>'.newbbDisplayImage('admin_delete', _DELETE).' - '._DELETE; |
|
209 | 209 | echo '</fieldset>'; |
210 | 210 | break; |
211 | 211 | } |
@@ -213,4 +213,4 @@ discard block |
||
213 | 213 | $cacheHelper = Newbb\Utility::cleanCache(); |
214 | 214 | //$cacheHelper->delete('permission_category'); |
215 | 215 | |
216 | -require_once __DIR__ . '/admin_footer.php'; |
|
216 | +require_once __DIR__.'/admin_footer.php'; |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | */ |
33 | 33 | $op = Request::getCmd('op', ''); |
34 | 34 | $validOps = [ |
35 | - 'save_type', |
|
36 | - 'delete', |
|
37 | - 'template', |
|
38 | - 'save_template', |
|
39 | - 'apply', |
|
40 | - 'save_apply', |
|
41 | - 'forum', |
|
42 | - 'edit_forum', |
|
43 | - 'save_forum', |
|
44 | - 'add' |
|
35 | + 'save_type', |
|
36 | + 'delete', |
|
37 | + 'template', |
|
38 | + 'save_template', |
|
39 | + 'apply', |
|
40 | + 'save_apply', |
|
41 | + 'forum', |
|
42 | + 'edit_forum', |
|
43 | + 'save_forum', |
|
44 | + 'add' |
|
45 | 45 | ]; |
46 | 46 | if (!in_array($op, $validOps, true)) { |
47 | - $op = ''; |
|
47 | + $op = ''; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | ///** @var Newbb\TypeHandler $typeHandler */ |
@@ -52,386 +52,386 @@ discard block |
||
52 | 52 | $cacheHelper = new \Xmf\Module\Helper\Cache('newbb'); |
53 | 53 | |
54 | 54 | switch ($op) { |
55 | - case 'save_type': |
|
56 | - $type_names0 = $_POST['type_name']; |
|
57 | - $type_names = Request::getArray('type_name', null, 'POST'); |
|
58 | - $type_del = []; |
|
59 | - foreach (array_keys($type_names) as $key) { |
|
60 | - if (Request::getBool('isnew', '', 'POST')) { |
|
61 | - $typeObject = $typeHandler->create(); |
|
62 | - } elseif (!$typeObject = $typeHandler->get($key)) { |
|
63 | - continue; |
|
64 | - } |
|
65 | - |
|
66 | - // if (Request::getArray("type_del[$key]", '', 'POST')) { |
|
67 | - $temp = Request::getArray('type_del', '', 'POST'); |
|
68 | - if ($temp[$key]) { |
|
69 | - $type_del[] = $key; |
|
70 | - continue; |
|
71 | - } else { |
|
72 | - foreach (['type_name', 'type_color', 'type_description'] as $var) { |
|
73 | - // if ($typeObject->getVar($var) != @$_POST[$var][$key]) { |
|
74 | - // $typeObject->setVar($var, @$_POST[$var][$key]); |
|
75 | - // } |
|
76 | - $temp = Request::getArray($var, '', 'POST'); |
|
77 | - if ($typeObject->getVar($var) != $temp[$key]) { |
|
78 | - $typeObject->setVar($var, $temp[$key]); |
|
79 | - } |
|
80 | - |
|
81 | - // $typeObject->setVar($var, Request::getArray($var, '', 'POST')[$key]); |
|
82 | - } |
|
83 | - $typeHandler->insert($typeObject); |
|
84 | - unset($typeObject); |
|
85 | - } |
|
86 | - } |
|
87 | - if (count($type_del) > 0) { |
|
88 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
89 | - xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
|
90 | - } else { |
|
91 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
92 | - } |
|
93 | - break; |
|
94 | - |
|
95 | - case 'delete': |
|
96 | - $type_dels = @unserialize(Request::getString('type_del', '', 'POST')); |
|
97 | - foreach ($type_dels as $key) { |
|
98 | - if (!$typeObject = $typeHandler->get($key)) { |
|
99 | - continue; |
|
100 | - } |
|
101 | - $typeHandler->delete($typeObject); |
|
102 | - unset($typeObject); |
|
103 | - } |
|
104 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
105 | - break; |
|
106 | - |
|
107 | - case 'template': |
|
108 | - $typesObject = $typeHandler->getAll(); |
|
109 | - if (0 === count($typesObject)) { |
|
110 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
111 | - } |
|
112 | - |
|
113 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
114 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
115 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
116 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
117 | - $adminObject->displayButton('left'); |
|
118 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
121 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
122 | - echo "<tr align='center'>"; |
|
123 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
126 | - echo '</tr>'; |
|
127 | - |
|
128 | - if ($templates = $cacheHelper->read('type_template')) { |
|
129 | - arsort($templates); |
|
130 | - foreach ($templates as $order => $key) { |
|
131 | - if (!isset($typesObject[$key])) { |
|
132 | - continue; |
|
133 | - } |
|
134 | - $typeObject = $typesObject[$key]; |
|
135 | - echo "<tr class='even' align='left'>"; |
|
136 | - echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
139 | - echo '</tr>'; |
|
140 | - unset($typesObject[$key]); |
|
141 | - } |
|
142 | - echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
143 | - } |
|
144 | - foreach ($typesObject as $key => $typeObject) { |
|
145 | - echo "<tr class='odd' align='left'>"; |
|
146 | - echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
147 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
149 | - echo '</tr>'; |
|
150 | - } |
|
151 | - |
|
152 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
153 | - echo "<input type='hidden' name='op' value='save_template' />"; |
|
154 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
156 | - echo '</td></tr></table>'; |
|
157 | - echo '</form>'; |
|
158 | - echo '</td></tr></table>'; |
|
159 | - break; |
|
160 | - |
|
161 | - case 'save_template': |
|
162 | - $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
|
163 | - $cacheHelper->write('type_template', $templates); |
|
164 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | - break; |
|
166 | - |
|
167 | - case 'apply': |
|
168 | - if (!$templates = $cacheHelper->read('type_template')) { |
|
169 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | - } |
|
171 | - |
|
172 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
173 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
174 | - $criteriaCategory->setSort('cat_order'); |
|
175 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
176 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
177 | - $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
178 | - foreach (array_keys($forums) as $c) { |
|
179 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
180 | - foreach (array_keys($forums[$c]) as $f) { |
|
181 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
182 | - } |
|
183 | - } |
|
184 | - unset($forums, $categories); |
|
185 | - $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
186 | - $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); |
|
187 | - $fm_select->addOptionArray($fm_options); |
|
188 | - $fmform->addElement($fm_select); |
|
189 | - $tray = new \XoopsFormElementTray(''); |
|
190 | - $tray->addElement(new \XoopsFormHidden('op', 'save_apply')); |
|
191 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
192 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
193 | - $fmform->addElement($tray); |
|
194 | - |
|
195 | - //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); |
|
196 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
197 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
198 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
199 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
200 | - $adminObject->displayButton('left'); |
|
201 | - |
|
202 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
203 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
204 | - echo "<tr align='center'>"; |
|
205 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
208 | - echo '</tr>'; |
|
209 | - |
|
210 | - $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
211 | - arsort($templates); |
|
212 | - foreach ($templates as $order => $key) { |
|
213 | - if (!isset($typesObject[$key])) { |
|
214 | - continue; |
|
215 | - } |
|
216 | - $typeObject = $typesObject[$key]; |
|
217 | - echo "<tr class='even' align='left'>"; |
|
218 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | - echo '<td>' . $order . '</td>'; |
|
220 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
221 | - echo '</tr>'; |
|
222 | - unset($typesObject[$key]); |
|
223 | - } |
|
224 | - echo '</table>'; |
|
225 | - echo '</td></tr></table>'; |
|
226 | - echo '<br>'; |
|
227 | - $fmform->display(); |
|
228 | - break; |
|
229 | - |
|
230 | - case 'save_apply': |
|
231 | - if (!$templates = $cacheHelper->read('type_template')) { |
|
232 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | - } |
|
234 | - foreach (Request::getArray('forums', [], 'POST') as $forum) { |
|
235 | - if ($forum < 1) { |
|
236 | - continue; |
|
237 | - } |
|
238 | - $typeHandler->updateByForum($forum, array_flip($templates)); |
|
239 | - } |
|
240 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
241 | - break; |
|
242 | - |
|
243 | - case 'forum': |
|
244 | - // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
245 | - $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
246 | - $criteriaCategory->setSort('cat_order'); |
|
247 | - $categories = $categoryHandler->getList($criteriaCategory); |
|
248 | - if (empty($categories)) { |
|
249 | - redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
250 | - } |
|
251 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
252 | - $forums = $forumHandler->getTree(array_keys($categories)); |
|
253 | - if (empty($forums)) { |
|
254 | - redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); |
|
255 | - } |
|
256 | - |
|
257 | - foreach (array_keys($forums) as $c) { |
|
258 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
259 | - foreach (array_keys($forums[$c]) as $f) { |
|
260 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
261 | - } |
|
262 | - } |
|
263 | - unset($forums, $categories); |
|
264 | - $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
265 | - $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); |
|
266 | - $fm_select->addOptionArray($fm_options); |
|
267 | - $fmform->addElement($fm_select); |
|
268 | - $tray = new \XoopsFormElementTray(''); |
|
269 | - $tray->addElement(new \XoopsFormHidden('op', 'edit_forum')); |
|
270 | - $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
271 | - $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
272 | - $fmform->addElement($tray); |
|
273 | - |
|
274 | - //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); |
|
275 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
276 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
277 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
278 | - $adminObject->displayButton('left'); |
|
279 | - |
|
280 | - $fmform->display(); |
|
281 | - break; |
|
282 | - |
|
283 | - case 'edit_forum': |
|
284 | - if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
285 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | - } |
|
287 | - |
|
288 | - // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
289 | - if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
|
290 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | - } |
|
292 | - |
|
293 | - $typesObject = $typeHandler->getAll(); |
|
294 | - if (0 === count($typesObject)) { |
|
295 | - redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
296 | - } |
|
297 | - |
|
298 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
299 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
300 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
301 | - $adminObject->displayButton('left'); |
|
302 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
305 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
306 | - echo "<tr align='center'>"; |
|
307 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
310 | - echo '</tr>'; |
|
311 | - |
|
312 | - $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
|
313 | - $types_order = []; |
|
314 | - foreach ($types as $key => $type) { |
|
315 | - $types_order[] = $type['type_order']; |
|
316 | - } |
|
317 | - array_multisort($types_order, $types); |
|
318 | - foreach ($types as $key => $type) { |
|
319 | - if (!isset($typesObject[$type['type_id']])) { |
|
320 | - continue; |
|
321 | - } |
|
322 | - $typeObject = $typesObject[$type['type_id']]; |
|
323 | - echo "<tr class='even' align='left'>"; |
|
324 | - echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
327 | - echo '</tr>'; |
|
328 | - unset($typesObject[$type['type_id']]); |
|
329 | - } |
|
330 | - echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
331 | - foreach ($typesObject as $key => $typeObject) { |
|
332 | - echo "<tr class='odd' align='left'>"; |
|
333 | - echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
334 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
336 | - echo '</tr>'; |
|
337 | - } |
|
338 | - |
|
339 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
340 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | - echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
342 | - echo "<input type='hidden' name='op' value='save_forum' />"; |
|
343 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
345 | - echo '</td></tr></table>'; |
|
346 | - echo '</form>'; |
|
347 | - echo '</td></tr></table>'; |
|
348 | - break; |
|
349 | - |
|
350 | - case 'save_forum': |
|
351 | - if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
352 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | - } |
|
354 | - $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
|
355 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | - break; |
|
357 | - |
|
358 | - case 'add': |
|
359 | - default: |
|
360 | - $typesObject = $typeHandler->getAll(); |
|
361 | - if (0 === count($typesObject)) { |
|
362 | - $op = 'add'; |
|
363 | - $title = _AM_NEWBB_TYPE_ADD; |
|
364 | - } else { |
|
365 | - $title = _AM_NEWBB_TYPE_LIST; |
|
366 | - } |
|
367 | - |
|
368 | - if ('add' !== $op) { |
|
369 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
370 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
371 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
372 | - $adminObject->displayButton('left'); |
|
373 | - } |
|
374 | - echo _AM_NEWBB_TYPE_HELP; |
|
375 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | - echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
377 | - echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
378 | - echo "<tr align='center'>"; |
|
379 | - if ('add' !== $op) { |
|
380 | - echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
381 | - } |
|
382 | - echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | - echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
385 | - echo '</tr>'; |
|
55 | + case 'save_type': |
|
56 | + $type_names0 = $_POST['type_name']; |
|
57 | + $type_names = Request::getArray('type_name', null, 'POST'); |
|
58 | + $type_del = []; |
|
59 | + foreach (array_keys($type_names) as $key) { |
|
60 | + if (Request::getBool('isnew', '', 'POST')) { |
|
61 | + $typeObject = $typeHandler->create(); |
|
62 | + } elseif (!$typeObject = $typeHandler->get($key)) { |
|
63 | + continue; |
|
64 | + } |
|
65 | + |
|
66 | + // if (Request::getArray("type_del[$key]", '', 'POST')) { |
|
67 | + $temp = Request::getArray('type_del', '', 'POST'); |
|
68 | + if ($temp[$key]) { |
|
69 | + $type_del[] = $key; |
|
70 | + continue; |
|
71 | + } else { |
|
72 | + foreach (['type_name', 'type_color', 'type_description'] as $var) { |
|
73 | + // if ($typeObject->getVar($var) != @$_POST[$var][$key]) { |
|
74 | + // $typeObject->setVar($var, @$_POST[$var][$key]); |
|
75 | + // } |
|
76 | + $temp = Request::getArray($var, '', 'POST'); |
|
77 | + if ($typeObject->getVar($var) != $temp[$key]) { |
|
78 | + $typeObject->setVar($var, $temp[$key]); |
|
79 | + } |
|
80 | + |
|
81 | + // $typeObject->setVar($var, Request::getArray($var, '', 'POST')[$key]); |
|
82 | + } |
|
83 | + $typeHandler->insert($typeObject); |
|
84 | + unset($typeObject); |
|
85 | + } |
|
86 | + } |
|
87 | + if (count($type_del) > 0) { |
|
88 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
89 | + xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
|
90 | + } else { |
|
91 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
92 | + } |
|
93 | + break; |
|
94 | + |
|
95 | + case 'delete': |
|
96 | + $type_dels = @unserialize(Request::getString('type_del', '', 'POST')); |
|
97 | + foreach ($type_dels as $key) { |
|
98 | + if (!$typeObject = $typeHandler->get($key)) { |
|
99 | + continue; |
|
100 | + } |
|
101 | + $typeHandler->delete($typeObject); |
|
102 | + unset($typeObject); |
|
103 | + } |
|
104 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
105 | + break; |
|
106 | + |
|
107 | + case 'template': |
|
108 | + $typesObject = $typeHandler->getAll(); |
|
109 | + if (0 === count($typesObject)) { |
|
110 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
111 | + } |
|
112 | + |
|
113 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
114 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
115 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
116 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
117 | + $adminObject->displayButton('left'); |
|
118 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | + echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
121 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
122 | + echo "<tr align='center'>"; |
|
123 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
126 | + echo '</tr>'; |
|
127 | + |
|
128 | + if ($templates = $cacheHelper->read('type_template')) { |
|
129 | + arsort($templates); |
|
130 | + foreach ($templates as $order => $key) { |
|
131 | + if (!isset($typesObject[$key])) { |
|
132 | + continue; |
|
133 | + } |
|
134 | + $typeObject = $typesObject[$key]; |
|
135 | + echo "<tr class='even' align='left'>"; |
|
136 | + echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
139 | + echo '</tr>'; |
|
140 | + unset($typesObject[$key]); |
|
141 | + } |
|
142 | + echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
143 | + } |
|
144 | + foreach ($typesObject as $key => $typeObject) { |
|
145 | + echo "<tr class='odd' align='left'>"; |
|
146 | + echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
147 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
149 | + echo '</tr>'; |
|
150 | + } |
|
151 | + |
|
152 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
153 | + echo "<input type='hidden' name='op' value='save_template' />"; |
|
154 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
156 | + echo '</td></tr></table>'; |
|
157 | + echo '</form>'; |
|
158 | + echo '</td></tr></table>'; |
|
159 | + break; |
|
160 | + |
|
161 | + case 'save_template': |
|
162 | + $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
|
163 | + $cacheHelper->write('type_template', $templates); |
|
164 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | + break; |
|
166 | + |
|
167 | + case 'apply': |
|
168 | + if (!$templates = $cacheHelper->read('type_template')) { |
|
169 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | + } |
|
171 | + |
|
172 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
173 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
174 | + $criteriaCategory->setSort('cat_order'); |
|
175 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
176 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
177 | + $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
|
178 | + foreach (array_keys($forums) as $c) { |
|
179 | + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
180 | + foreach (array_keys($forums[$c]) as $f) { |
|
181 | + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
182 | + } |
|
183 | + } |
|
184 | + unset($forums, $categories); |
|
185 | + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
186 | + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forums', null, 10, true); |
|
187 | + $fm_select->addOptionArray($fm_options); |
|
188 | + $fmform->addElement($fm_select); |
|
189 | + $tray = new \XoopsFormElementTray(''); |
|
190 | + $tray->addElement(new \XoopsFormHidden('op', 'save_apply')); |
|
191 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
192 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
193 | + $fmform->addElement($tray); |
|
194 | + |
|
195 | + //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_TEMPLATE_APPLY); |
|
196 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
197 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
198 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
|
199 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
200 | + $adminObject->displayButton('left'); |
|
201 | + |
|
202 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
203 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
204 | + echo "<tr align='center'>"; |
|
205 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
208 | + echo '</tr>'; |
|
209 | + |
|
210 | + $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
211 | + arsort($templates); |
|
212 | + foreach ($templates as $order => $key) { |
|
213 | + if (!isset($typesObject[$key])) { |
|
214 | + continue; |
|
215 | + } |
|
216 | + $typeObject = $typesObject[$key]; |
|
217 | + echo "<tr class='even' align='left'>"; |
|
218 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | + echo '<td>' . $order . '</td>'; |
|
220 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
221 | + echo '</tr>'; |
|
222 | + unset($typesObject[$key]); |
|
223 | + } |
|
224 | + echo '</table>'; |
|
225 | + echo '</td></tr></table>'; |
|
226 | + echo '<br>'; |
|
227 | + $fmform->display(); |
|
228 | + break; |
|
229 | + |
|
230 | + case 'save_apply': |
|
231 | + if (!$templates = $cacheHelper->read('type_template')) { |
|
232 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | + } |
|
234 | + foreach (Request::getArray('forums', [], 'POST') as $forum) { |
|
235 | + if ($forum < 1) { |
|
236 | + continue; |
|
237 | + } |
|
238 | + $typeHandler->updateByForum($forum, array_flip($templates)); |
|
239 | + } |
|
240 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
|
241 | + break; |
|
242 | + |
|
243 | + case 'forum': |
|
244 | + // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
|
245 | + $criteriaCategory = new \CriteriaCompo(new \Criteria('1', 1)); |
|
246 | + $criteriaCategory->setSort('cat_order'); |
|
247 | + $categories = $categoryHandler->getList($criteriaCategory); |
|
248 | + if (empty($categories)) { |
|
249 | + redirect_header('admin_cat_manager.php', 2, _AM_NEWBB_CREATENEWCATEGORY); |
|
250 | + } |
|
251 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
252 | + $forums = $forumHandler->getTree(array_keys($categories)); |
|
253 | + if (empty($forums)) { |
|
254 | + redirect_header('admin_forum_manager.php', 2, _AM_NEWBB_CREATENEWFORUM); |
|
255 | + } |
|
256 | + |
|
257 | + foreach (array_keys($forums) as $c) { |
|
258 | + $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
259 | + foreach (array_keys($forums[$c]) as $f) { |
|
260 | + $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
261 | + } |
|
262 | + } |
|
263 | + unset($forums, $categories); |
|
264 | + $fmform = new \XoopsThemeForm(_AM_NEWBB_TYPE_FORUM, 'fmform', xoops_getenv('PHP_SELF'), 'post', true); |
|
265 | + $fm_select = new \XoopsFormSelect(_AM_NEWBB_PERM_FORUMS, 'forum', null, 5, false); |
|
266 | + $fm_select->addOptionArray($fm_options); |
|
267 | + $fmform->addElement($fm_select); |
|
268 | + $tray = new \XoopsFormElementTray(''); |
|
269 | + $tray->addElement(new \XoopsFormHidden('op', 'edit_forum')); |
|
270 | + $tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
|
271 | + $tray->addElement(new \XoopsFormButton('', 'reset', _CANCEL, 'reset')); |
|
272 | + $fmform->addElement($tray); |
|
273 | + |
|
274 | + //loadModuleAdminMenu(11, _AM_NEWBB_TYPE_FORUM); |
|
275 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
276 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
277 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
278 | + $adminObject->displayButton('left'); |
|
279 | + |
|
280 | + $fmform->display(); |
|
281 | + break; |
|
282 | + |
|
283 | + case 'edit_forum': |
|
284 | + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
285 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | + } |
|
287 | + |
|
288 | + // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
|
289 | + if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
|
290 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | + } |
|
292 | + |
|
293 | + $typesObject = $typeHandler->getAll(); |
|
294 | + if (0 === count($typesObject)) { |
|
295 | + redirect_header(xoops_getenv('PHP_SELF'), 2, _AM_NEWBB_TYPE_ADD_ERR); |
|
296 | + } |
|
297 | + |
|
298 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
299 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
300 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
301 | + $adminObject->displayButton('left'); |
|
302 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | + echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
305 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
306 | + echo "<tr align='center'>"; |
|
307 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | + echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | + echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
310 | + echo '</tr>'; |
|
311 | + |
|
312 | + $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
|
313 | + $types_order = []; |
|
314 | + foreach ($types as $key => $type) { |
|
315 | + $types_order[] = $type['type_order']; |
|
316 | + } |
|
317 | + array_multisort($types_order, $types); |
|
318 | + foreach ($types as $key => $type) { |
|
319 | + if (!isset($typesObject[$type['type_id']])) { |
|
320 | + continue; |
|
321 | + } |
|
322 | + $typeObject = $typesObject[$type['type_id']]; |
|
323 | + echo "<tr class='even' align='left'>"; |
|
324 | + echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
327 | + echo '</tr>'; |
|
328 | + unset($typesObject[$type['type_id']]); |
|
329 | + } |
|
330 | + echo "<tr><td colspan='3' height='5px'></td></tr>"; |
|
331 | + foreach ($typesObject as $key => $typeObject) { |
|
332 | + echo "<tr class='odd' align='left'>"; |
|
333 | + echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
|
334 | + echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | + echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
336 | + echo '</tr>'; |
|
337 | + } |
|
338 | + |
|
339 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
340 | + echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | + echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
342 | + echo "<input type='hidden' name='op' value='save_forum' />"; |
|
343 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
345 | + echo '</td></tr></table>'; |
|
346 | + echo '</form>'; |
|
347 | + echo '</td></tr></table>'; |
|
348 | + break; |
|
349 | + |
|
350 | + case 'save_forum': |
|
351 | + if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
|
352 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | + } |
|
354 | + $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
|
355 | + redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | + break; |
|
357 | + |
|
358 | + case 'add': |
|
359 | + default: |
|
360 | + $typesObject = $typeHandler->getAll(); |
|
361 | + if (0 === count($typesObject)) { |
|
362 | + $op = 'add'; |
|
363 | + $title = _AM_NEWBB_TYPE_ADD; |
|
364 | + } else { |
|
365 | + $title = _AM_NEWBB_TYPE_LIST; |
|
366 | + } |
|
367 | + |
|
368 | + if ('add' !== $op) { |
|
369 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_ADD, 'admin_type_manager.php?op=add', $icon = 'add'); |
|
370 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
371 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
372 | + $adminObject->displayButton('left'); |
|
373 | + } |
|
374 | + echo _AM_NEWBB_TYPE_HELP; |
|
375 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | + echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
377 | + echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
|
378 | + echo "<tr align='center'>"; |
|
379 | + if ('add' !== $op) { |
|
380 | + echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
381 | + } |
|
382 | + echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | + echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | + echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
385 | + echo '</tr>'; |
|
386 | 386 | |
387 | 387 | // $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); |
388 | - xoops_load('XoopsFormColorPicker'); |
|
389 | - |
|
390 | - if ('add' !== $op) { |
|
391 | - foreach ($typesObject as $key => $typeObject) { |
|
392 | - echo "<tr class='odd' align='left'>"; |
|
393 | - echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
|
394 | - echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
395 | - if ($isColorpicker) { |
|
396 | - $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
|
397 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
398 | - } else { |
|
399 | - echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
400 | - } |
|
401 | - echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
402 | - echo '</tr>'; |
|
403 | - } |
|
404 | - echo "<tr><td colspan='4' style='text-align:center;'>"; |
|
405 | - } else { |
|
406 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
407 | - $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
408 | - $adminObject->displayButton('left'); |
|
409 | - for ($i = 0; $i < 10; ++$i) { |
|
410 | - echo "<tr class='odd' align='left'>"; |
|
411 | - echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
|
412 | - if ($isColorpicker) { |
|
413 | - $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
|
414 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
415 | - } else { |
|
416 | - echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
|
417 | - } |
|
418 | - echo "<td><input type='text' name='type_description[{$i}]' value='' size='40' /></td>"; |
|
419 | - echo '</tr>'; |
|
420 | - } |
|
421 | - echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
422 | - echo "<input type='hidden' name='isnew' value='1' />"; |
|
423 | - } |
|
424 | - echo "<input type='hidden' name='op' value='save_type' />"; |
|
425 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
426 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
427 | - echo '</td></tr></table>'; |
|
428 | - echo '</form>'; |
|
429 | - echo '</td></tr></table>'; |
|
430 | - echo '<fieldset>'; |
|
431 | - echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
432 | - echo _AM_NEWBB_HELP_TYPE_TAB; |
|
433 | - echo '</fieldset>'; |
|
434 | - break; |
|
388 | + xoops_load('XoopsFormColorPicker'); |
|
389 | + |
|
390 | + if ('add' !== $op) { |
|
391 | + foreach ($typesObject as $key => $typeObject) { |
|
392 | + echo "<tr class='odd' align='left'>"; |
|
393 | + echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
|
394 | + echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
395 | + if ($isColorpicker) { |
|
396 | + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
|
397 | + echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
398 | + } else { |
|
399 | + echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
400 | + } |
|
401 | + echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
402 | + echo '</tr>'; |
|
403 | + } |
|
404 | + echo "<tr><td colspan='4' style='text-align:center;'>"; |
|
405 | + } else { |
|
406 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
|
407 | + $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
|
408 | + $adminObject->displayButton('left'); |
|
409 | + for ($i = 0; $i < 10; ++$i) { |
|
410 | + echo "<tr class='odd' align='left'>"; |
|
411 | + echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
|
412 | + if ($isColorpicker) { |
|
413 | + $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
|
414 | + echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
415 | + } else { |
|
416 | + echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
|
417 | + } |
|
418 | + echo "<td><input type='text' name='type_description[{$i}]' value='' size='40' /></td>"; |
|
419 | + echo '</tr>'; |
|
420 | + } |
|
421 | + echo "<tr><td colspan='3' style='text-align:center;'>"; |
|
422 | + echo "<input type='hidden' name='isnew' value='1' />"; |
|
423 | + } |
|
424 | + echo "<input type='hidden' name='op' value='save_type' />"; |
|
425 | + echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
426 | + echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
427 | + echo '</td></tr></table>'; |
|
428 | + echo '</form>'; |
|
429 | + echo '</td></tr></table>'; |
|
430 | + echo '<fieldset>'; |
|
431 | + echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
432 | + echo _AM_NEWBB_HELP_TYPE_TAB; |
|
433 | + echo '</fieldset>'; |
|
434 | + break; |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | require_once __DIR__ . '/admin_footer.php'; |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | |
13 | 13 | use Xmf\Request; |
14 | 14 | |
15 | -require_once __DIR__ . '/admin_header.php'; |
|
15 | +require_once __DIR__.'/admin_header.php'; |
|
16 | 16 | xoops_cp_header(); |
17 | 17 | echo '<br>'; |
18 | 18 | require_once $GLOBALS['xoops']->path('class/xoopsformloader.php'); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | } |
87 | 87 | if (count($type_del) > 0) { |
88 | - $type_list = $typeHandler->getList(new \Criteria('type_id', '(' . implode(', ', $type_del) . ')', 'IN')); |
|
88 | + $type_list = $typeHandler->getList(new \Criteria('type_id', '('.implode(', ', $type_del).')', 'IN')); |
|
89 | 89 | xoops_confirm(['op' => 'delete', 'type_del' => serialize($type_del)], xoops_getenv('PHP_SELF'), sprintf(_AM_NEWBB_TODEL_TYPE, implode(', ', array_values($type_list))), '', false); |
90 | 90 | } else { |
91 | 91 | redirect_header(xoops_getenv('PHP_SELF'), 2, _MD_NEWBB_DBUPDATED); |
@@ -115,14 +115,14 @@ discard block |
||
115 | 115 | $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE_APPLY, 'admin_type_manager.php?op=apply', $icon = 'add'); |
116 | 116 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
117 | 117 | $adminObject->displayButton('left'); |
118 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
119 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
120 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
118 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_ORDER_DESC.'</legend>'; |
|
119 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
120 | + echo "<form name='template' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
121 | 121 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
122 | 122 | echo "<tr align='center'>"; |
123 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
124 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
125 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
123 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
124 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
125 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
126 | 126 | echo '</tr>'; |
127 | 127 | |
128 | 128 | if ($templates = $cacheHelper->read('type_template')) { |
@@ -133,9 +133,9 @@ discard block |
||
133 | 133 | } |
134 | 134 | $typeObject = $typesObject[$key]; |
135 | 135 | echo "<tr class='even' align='left'>"; |
136 | - echo "<td><input type='text' name='type_order[{$key}]' value='" . $order . "' size='10' /></td>"; |
|
137 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
138 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
136 | + echo "<td><input type='text' name='type_order[{$key}]' value='".$order."' size='10' /></td>"; |
|
137 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
138 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
139 | 139 | echo '</tr>'; |
140 | 140 | unset($typesObject[$key]); |
141 | 141 | } |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | foreach ($typesObject as $key => $typeObject) { |
145 | 145 | echo "<tr class='odd' align='left'>"; |
146 | 146 | echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
147 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
148 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
147 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
148 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
149 | 149 | echo '</tr>'; |
150 | 150 | } |
151 | 151 | |
152 | 152 | echo "<tr><td colspan='3' style='text-align:center;'>"; |
153 | 153 | echo "<input type='hidden' name='op' value='save_template' />"; |
154 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
155 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
154 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
155 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
156 | 156 | echo '</td></tr></table>'; |
157 | 157 | echo '</form>'; |
158 | 158 | echo '</td></tr></table>'; |
@@ -161,12 +161,12 @@ discard block |
||
161 | 161 | case 'save_template': |
162 | 162 | $templates = array_flip(array_filter(Request::getArray('type_order', [], 'POST'))); |
163 | 163 | $cacheHelper->write('type_template', $templates); |
164 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
164 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _MD_NEWBB_DBUPDATED); |
|
165 | 165 | break; |
166 | 166 | |
167 | 167 | case 'apply': |
168 | 168 | if (!$templates = $cacheHelper->read('type_template')) { |
169 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
169 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE_ERR); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | // $categoryHandler = Newbb\Helper::getInstance()->getHandler('Category'); |
@@ -176,9 +176,9 @@ discard block |
||
176 | 176 | // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
177 | 177 | $forums = $forumHandler->getTree(array_keys($categories), 0, 'all'); |
178 | 178 | foreach (array_keys($forums) as $c) { |
179 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
179 | + $fm_options[-1 * $c] = '['.$categories[$c].']'; |
|
180 | 180 | foreach (array_keys($forums[$c]) as $f) { |
181 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
181 | + $fm_options[$f] = $forums[$c][$f]['prefix'].$forums[$c][$f]['forum_name']; |
|
182 | 182 | } |
183 | 183 | } |
184 | 184 | unset($forums, $categories); |
@@ -199,15 +199,15 @@ discard block |
||
199 | 199 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
200 | 200 | $adminObject->displayButton('left'); |
201 | 201 | |
202 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
202 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
203 | 203 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
204 | 204 | echo "<tr align='center'>"; |
205 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
206 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
207 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
205 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
206 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
207 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
208 | 208 | echo '</tr>'; |
209 | 209 | |
210 | - $typesObject = $typeHandler->getAll(new \Criteria('type_id', '(' . implode(', ', array_values($templates)) . ')', 'IN')); |
|
210 | + $typesObject = $typeHandler->getAll(new \Criteria('type_id', '('.implode(', ', array_values($templates)).')', 'IN')); |
|
211 | 211 | arsort($templates); |
212 | 212 | foreach ($templates as $order => $key) { |
213 | 213 | if (!isset($typesObject[$key])) { |
@@ -215,9 +215,9 @@ discard block |
||
215 | 215 | } |
216 | 216 | $typeObject = $typesObject[$key]; |
217 | 217 | echo "<tr class='even' align='left'>"; |
218 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
219 | - echo '<td>' . $order . '</td>'; |
|
220 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
218 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
219 | + echo '<td>'.$order.'</td>'; |
|
220 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
221 | 221 | echo '</tr>'; |
222 | 222 | unset($typesObject[$key]); |
223 | 223 | } |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | case 'save_apply': |
231 | 231 | if (!$templates = $cacheHelper->read('type_template')) { |
232 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
232 | + redirect_header(xoops_getenv('PHP_SELF').'?op=template', 2, _AM_NEWBB_TYPE_TEMPLATE); |
|
233 | 233 | } |
234 | 234 | foreach (Request::getArray('forums', [], 'POST') as $forum) { |
235 | 235 | if ($forum < 1) { |
@@ -255,9 +255,9 @@ discard block |
||
255 | 255 | } |
256 | 256 | |
257 | 257 | foreach (array_keys($forums) as $c) { |
258 | - $fm_options[-1 * $c] = '[' . $categories[$c] . ']'; |
|
258 | + $fm_options[-1 * $c] = '['.$categories[$c].']'; |
|
259 | 259 | foreach (array_keys($forums[$c]) as $f) { |
260 | - $fm_options[$f] = $forums[$c][$f]['prefix'] . $forums[$c][$f]['forum_name']; |
|
260 | + $fm_options[$f] = $forums[$c][$f]['prefix'].$forums[$c][$f]['forum_name']; |
|
261 | 261 | } |
262 | 262 | } |
263 | 263 | unset($forums, $categories); |
@@ -282,12 +282,12 @@ discard block |
||
282 | 282 | |
283 | 283 | case 'edit_forum': |
284 | 284 | if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
285 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
285 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | // $forumHandler = Newbb\Helper::getInstance()->getHandler('Forum'); |
289 | 289 | if (!$forumObject = $forumHandler->get(Request::getInt('forum', 0, 'POST'))) { |
290 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
290 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM_ERR); |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | $typesObject = $typeHandler->getAll(); |
@@ -299,14 +299,14 @@ discard block |
||
299 | 299 | $adminObject->addItemButton(_AM_NEWBB_TYPE_TEMPLATE, 'admin_type_manager.php?op=template', $icon = 'add'); |
300 | 300 | $adminObject->addItemButton(_AM_NEWBB_TYPE_FORUM, 'admin_type_manager.php?op=forum', $icon = 'add'); |
301 | 301 | $adminObject->displayButton('left'); |
302 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_ORDER_DESC . '</legend>'; |
|
303 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
304 | - echo "<form name='template' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
302 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_ORDER_DESC.'</legend>'; |
|
303 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
304 | + echo "<form name='template' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
305 | 305 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
306 | 306 | echo "<tr align='center'>"; |
307 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_ORDER . '</th>'; |
|
308 | - echo "<th class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
309 | - echo "<th class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
307 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_ORDER.'</th>'; |
|
308 | + echo "<th class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
309 | + echo "<th class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
310 | 310 | echo '</tr>'; |
311 | 311 | |
312 | 312 | $types = $typeHandler->getByForum(Request::getInt('forum', 0, 'POST')); |
@@ -321,9 +321,9 @@ discard block |
||
321 | 321 | } |
322 | 322 | $typeObject = $typesObject[$type['type_id']]; |
323 | 323 | echo "<tr class='even' align='left'>"; |
324 | - echo "<td><input type='text' name='type_order[" . $type['type_id'] . "]' value='" . $type['type_order'] . "' size='10' /></td>"; |
|
325 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
326 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
324 | + echo "<td><input type='text' name='type_order[".$type['type_id']."]' value='".$type['type_order']."' size='10' /></td>"; |
|
325 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
326 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
327 | 327 | echo '</tr>'; |
328 | 328 | unset($typesObject[$type['type_id']]); |
329 | 329 | } |
@@ -331,17 +331,17 @@ discard block |
||
331 | 331 | foreach ($typesObject as $key => $typeObject) { |
332 | 332 | echo "<tr class='odd' align='left'>"; |
333 | 333 | echo "<td><input type='text' name='type_order[{$key}]' value='0' size='10' /></td>"; |
334 | - echo "<td><em style='color:" . $typeObject->getVar('type_color') . ";'>" . $typeObject->getVar('type_name') . '</em></td>'; |
|
335 | - echo '<td>' . $typeObject->getVar('type_description') . '</td>'; |
|
334 | + echo "<td><em style='color:".$typeObject->getVar('type_color').";'>".$typeObject->getVar('type_name').'</em></td>'; |
|
335 | + echo '<td>'.$typeObject->getVar('type_description').'</td>'; |
|
336 | 336 | echo '</tr>'; |
337 | 337 | } |
338 | 338 | |
339 | 339 | echo "<tr><td colspan='3' style='text-align:center;'>"; |
340 | - echo '<legend style="font-weight: bold; color: #900;">' . _AM_NEWBB_TYPE_EDITFORUM_DESC . '</legend>'; |
|
341 | - echo "<input type='hidden' name='forum' value='" . Request::getInt('forum', 0, 'POST') . "' />"; |
|
340 | + echo '<legend style="font-weight: bold; color: #900;">'._AM_NEWBB_TYPE_EDITFORUM_DESC.'</legend>'; |
|
341 | + echo "<input type='hidden' name='forum' value='".Request::getInt('forum', 0, 'POST')."' />"; |
|
342 | 342 | echo "<input type='hidden' name='op' value='save_forum' />"; |
343 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
344 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
343 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
344 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
345 | 345 | echo '</td></tr></table>'; |
346 | 346 | echo '</form>'; |
347 | 347 | echo '</td></tr></table>'; |
@@ -349,10 +349,10 @@ discard block |
||
349 | 349 | |
350 | 350 | case 'save_forum': |
351 | 351 | if (!Request::getInt('forum', 0, 'POST') || Request::getInt('forum', 0, 'POST') < 1) { |
352 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
352 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _AM_NEWBB_TYPE_FORUM); |
|
353 | 353 | } |
354 | 354 | $typeHandler->updateByForum(Request::getInt('forum', 0, 'POST'), Request::getArray('type_order', null, 'POST')); |
355 | - redirect_header(xoops_getenv('PHP_SELF') . '?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
355 | + redirect_header(xoops_getenv('PHP_SELF').'?op=forum', 2, _MD_NEWBB_DBUPDATED); |
|
356 | 356 | break; |
357 | 357 | |
358 | 358 | case 'add': |
@@ -372,16 +372,16 @@ discard block |
||
372 | 372 | $adminObject->displayButton('left'); |
373 | 373 | } |
374 | 374 | echo _AM_NEWBB_TYPE_HELP; |
375 | - echo "<table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>"; |
|
376 | - echo "<form name='list' method='post' action='" . xoops_getenv('PHP_SELF') . "'>"; |
|
375 | + echo "<table width='100%' border='0' cellspacing='1' class='outer'>"."<tr><td class='odd'>"; |
|
376 | + echo "<form name='list' method='post' action='".xoops_getenv('PHP_SELF')."'>"; |
|
377 | 377 | echo "<table border='0' cellpadding='4' cellspacing='1' width='100%' class='outer'>"; |
378 | 378 | echo "<tr align='center'>"; |
379 | 379 | if ('add' !== $op) { |
380 | - echo "<th class='bg3' width='5%'>" . _DELETE . '</th>'; |
|
380 | + echo "<th class='bg3' width='5%'>"._DELETE.'</th>'; |
|
381 | 381 | } |
382 | - echo "<th align='left' class='bg3' width='20%'>" . _AM_NEWBB_TYPE_NAME . '</th>'; |
|
383 | - echo "<th class='bg3' width='15%'>" . _AM_NEWBB_TYPE_COLOR . '</th>'; |
|
384 | - echo "<th align='left' class='bg3'>" . _AM_NEWBB_TYPE_DESCRIPTION . '</th>'; |
|
382 | + echo "<th align='left' class='bg3' width='20%'>"._AM_NEWBB_TYPE_NAME.'</th>'; |
|
383 | + echo "<th class='bg3' width='15%'>"._AM_NEWBB_TYPE_COLOR.'</th>'; |
|
384 | + echo "<th align='left' class='bg3'>"._AM_NEWBB_TYPE_DESCRIPTION.'</th>'; |
|
385 | 385 | echo '</tr>'; |
386 | 386 | |
387 | 387 | // $isColorpicker = require_once $GLOBALS['xoops']->path('class/xoopsform/formcolorpicker.php'); |
@@ -391,14 +391,14 @@ discard block |
||
391 | 391 | foreach ($typesObject as $key => $typeObject) { |
392 | 392 | echo "<tr class='odd' align='left'>"; |
393 | 393 | echo "<td><input type='checkbox' name='type_del[{$key}]' /></td>"; |
394 | - echo "<td><input type='text' name='type_name[{$key}]' value='" . $typeObject->getVar('type_name') . "' size='10' /></td>"; |
|
394 | + echo "<td><input type='text' name='type_name[{$key}]' value='".$typeObject->getVar('type_name')."' size='10' /></td>"; |
|
395 | 395 | if ($isColorpicker) { |
396 | 396 | $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$key}]", $typeObject->getVar('type_color')); |
397 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
397 | + echo '<td>'.$form_colorpicker->render().'</td>'; |
|
398 | 398 | } else { |
399 | - echo "<td><input type='text' name='type_color[{$key}]' value='" . $typeObject->getVar('type_color') . "' size='10' /></td>"; |
|
399 | + echo "<td><input type='text' name='type_color[{$key}]' value='".$typeObject->getVar('type_color')."' size='10' /></td>"; |
|
400 | 400 | } |
401 | - echo "<td><input type='text' name='type_description[{$key}]' value='" . $typeObject->getVar('type_description') . "' size='30' /></td>"; |
|
401 | + echo "<td><input type='text' name='type_description[{$key}]' value='".$typeObject->getVar('type_description')."' size='30' /></td>"; |
|
402 | 402 | echo '</tr>'; |
403 | 403 | } |
404 | 404 | echo "<tr><td colspan='4' style='text-align:center;'>"; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | echo "<td><input type='text' name='type_name[{$i}]' value='' size='10' /></td>"; |
412 | 412 | if ($isColorpicker) { |
413 | 413 | $form_colorpicker = new \XoopsFormColorPicker('', "type_color[{$i}]", ''); |
414 | - echo '<td>' . $form_colorpicker->render() . '</td>'; |
|
414 | + echo '<td>'.$form_colorpicker->render().'</td>'; |
|
415 | 415 | } else { |
416 | 416 | echo "<td><input type='text' name='type_color[{$i}]' value='' size='10' /></td>"; |
417 | 417 | } |
@@ -422,16 +422,16 @@ discard block |
||
422 | 422 | echo "<input type='hidden' name='isnew' value='1' />"; |
423 | 423 | } |
424 | 424 | echo "<input type='hidden' name='op' value='save_type' />"; |
425 | - echo "<input type='submit' name='submit' value='" . _SUBMIT . "' /> "; |
|
426 | - echo "<input type='reset' value='" . _CANCEL . "' />"; |
|
425 | + echo "<input type='submit' name='submit' value='"._SUBMIT."' /> "; |
|
426 | + echo "<input type='reset' value='"._CANCEL."' />"; |
|
427 | 427 | echo '</td></tr></table>'; |
428 | 428 | echo '</form>'; |
429 | 429 | echo '</td></tr></table>'; |
430 | 430 | echo '<fieldset>'; |
431 | - echo '<legend> ' . _MI_NEWBB_ADMENU_TYPE . ' </legend>'; |
|
431 | + echo '<legend> '._MI_NEWBB_ADMENU_TYPE.' </legend>'; |
|
432 | 432 | echo _AM_NEWBB_HELP_TYPE_TAB; |
433 | 433 | echo '</fieldset>'; |
434 | 434 | break; |
435 | 435 | } |
436 | 436 | |
437 | -require_once __DIR__ . '/admin_footer.php'; |
|
437 | +require_once __DIR__.'/admin_footer.php'; |
@@ -39,84 +39,84 @@ |
||
39 | 39 | $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); |
40 | 40 | |
41 | 41 | $adminmenu[] = [ |
42 | - 'title' => _MI_NEWBB_ADMENU_INDEX, |
|
43 | - 'link' => 'admin/index.php', |
|
44 | - 'icon' => $pathIcon32 . 'home.png' |
|
42 | + 'title' => _MI_NEWBB_ADMENU_INDEX, |
|
43 | + 'link' => 'admin/index.php', |
|
44 | + 'icon' => $pathIcon32 . 'home.png' |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | $adminmenu[] = [ |
48 | - 'title' => _MI_NEWBB_ADMENU_CATEGORY, |
|
49 | - 'link' => 'admin/admin_cat_manager.php', |
|
50 | - 'icon' => $pathIcon32 . 'category.png' |
|
48 | + 'title' => _MI_NEWBB_ADMENU_CATEGORY, |
|
49 | + 'link' => 'admin/admin_cat_manager.php', |
|
50 | + 'icon' => $pathIcon32 . 'category.png' |
|
51 | 51 | ]; |
52 | 52 | |
53 | 53 | $adminmenu[] = [ |
54 | - 'title' => _MI_NEWBB_ADMENU_FORUM, |
|
55 | - 'link' => 'admin/admin_forum_manager.php', |
|
56 | - 'icon' => $pathIcon32 . 'forums.png' |
|
54 | + 'title' => _MI_NEWBB_ADMENU_FORUM, |
|
55 | + 'link' => 'admin/admin_forum_manager.php', |
|
56 | + 'icon' => $pathIcon32 . 'forums.png' |
|
57 | 57 | ]; |
58 | 58 | |
59 | 59 | $adminmenu[] = [ |
60 | - 'title' => _MI_NEWBB_ADMENU_PERMISSION, |
|
61 | - 'link' => 'admin/admin_permissions.php', |
|
62 | - 'icon' => $pathIcon32 . 'permissions.png' |
|
60 | + 'title' => _MI_NEWBB_ADMENU_PERMISSION, |
|
61 | + 'link' => 'admin/admin_permissions.php', |
|
62 | + 'icon' => $pathIcon32 . 'permissions.png' |
|
63 | 63 | ]; |
64 | 64 | |
65 | 65 | $adminmenu[] = [ |
66 | - 'title' => _MI_NEWBB_ADMENU_ORDER, |
|
67 | - 'link' => 'admin/admin_forum_reorder.php', |
|
68 | - 'icon' => $pathIcon32 . 'compfile.png' |
|
66 | + 'title' => _MI_NEWBB_ADMENU_ORDER, |
|
67 | + 'link' => 'admin/admin_forum_reorder.php', |
|
68 | + 'icon' => $pathIcon32 . 'compfile.png' |
|
69 | 69 | ]; |
70 | 70 | |
71 | 71 | $adminmenu[] = [ |
72 | - 'title' => _MI_NEWBB_ADMENU_PRUNE, |
|
73 | - 'link' => 'admin/admin_forum_prune.php', |
|
74 | - 'icon' => $pathIcon32 . 'update.png' |
|
72 | + 'title' => _MI_NEWBB_ADMENU_PRUNE, |
|
73 | + 'link' => 'admin/admin_forum_prune.php', |
|
74 | + 'icon' => $pathIcon32 . 'update.png' |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | $adminmenu[] = [ |
78 | - 'title' => _MI_NEWBB_ADMENU_REPORT, |
|
79 | - 'link' => 'admin/admin_report.php', |
|
80 | - 'icon' => $pathIcon32 . 'content.png' |
|
78 | + 'title' => _MI_NEWBB_ADMENU_REPORT, |
|
79 | + 'link' => 'admin/admin_report.php', |
|
80 | + 'icon' => $pathIcon32 . 'content.png' |
|
81 | 81 | ]; |
82 | 82 | |
83 | 83 | $adminmenu[] = [ |
84 | - 'title' => _MI_NEWBB_ADMENU_DIGEST, |
|
85 | - 'link' => 'admin/admin_digest.php', |
|
86 | - 'icon' => $pathIcon32 . 'digest.png' |
|
84 | + 'title' => _MI_NEWBB_ADMENU_DIGEST, |
|
85 | + 'link' => 'admin/admin_digest.php', |
|
86 | + 'icon' => $pathIcon32 . 'digest.png' |
|
87 | 87 | ]; |
88 | 88 | |
89 | 89 | $adminmenu[] = [ |
90 | - 'title' => _MI_NEWBB_ADMENU_VOTE, |
|
91 | - 'link' => 'admin/admin_votedata.php', |
|
92 | - 'icon' => $pathIcon32 . 'button_ok.png' |
|
90 | + 'title' => _MI_NEWBB_ADMENU_VOTE, |
|
91 | + 'link' => 'admin/admin_votedata.php', |
|
92 | + 'icon' => $pathIcon32 . 'button_ok.png' |
|
93 | 93 | ]; |
94 | 94 | |
95 | 95 | $adminmenu[] = [ |
96 | - 'title' => _MI_NEWBB_ADMENU_TYPE, |
|
97 | - 'link' => 'admin/admin_type_manager.php', |
|
98 | - 'icon' => $pathIcon32 . 'type.png' |
|
96 | + 'title' => _MI_NEWBB_ADMENU_TYPE, |
|
97 | + 'link' => 'admin/admin_type_manager.php', |
|
98 | + 'icon' => $pathIcon32 . 'type.png' |
|
99 | 99 | ]; |
100 | 100 | |
101 | 101 | $adminmenu[] = [ |
102 | - 'title' => _MI_NEWBB_ADMENU_GROUPMOD, |
|
103 | - 'link' => 'admin/admin_groupmod.php', |
|
104 | - 'icon' => $pathIcon32 . 'groupmod.png' |
|
102 | + 'title' => _MI_NEWBB_ADMENU_GROUPMOD, |
|
103 | + 'link' => 'admin/admin_groupmod.php', |
|
104 | + 'icon' => $pathIcon32 . 'groupmod.png' |
|
105 | 105 | ]; |
106 | 106 | |
107 | 107 | $adminmenu[] = [ |
108 | - 'title' => _MI_NEWBB_ADMENU_SYNC, |
|
109 | - 'link' => 'admin/admin_synchronization.php', |
|
110 | - 'icon' => $pathIcon32 . 'synchronized.png' |
|
108 | + 'title' => _MI_NEWBB_ADMENU_SYNC, |
|
109 | + 'link' => 'admin/admin_synchronization.php', |
|
110 | + 'icon' => $pathIcon32 . 'synchronized.png' |
|
111 | 111 | ]; |
112 | 112 | |
113 | 113 | $adminmenu[] = [ |
114 | - 'title' => _MI_NEWBB_ADMENU_MIGRATE, |
|
115 | - 'link' => 'admin/migrate.php', |
|
116 | - 'icon' => $pathIcon32 . 'database_go.png' |
|
114 | + 'title' => _MI_NEWBB_ADMENU_MIGRATE, |
|
115 | + 'link' => 'admin/migrate.php', |
|
116 | + 'icon' => $pathIcon32 . 'database_go.png' |
|
117 | 117 | ]; |
118 | 118 | $adminmenu[] = [ |
119 | - 'title' => _MI_NEWBB_ADMENU_ABOUT, |
|
120 | - 'link' => 'admin/about.php', |
|
121 | - 'icon' => $pathIcon32 . 'about.png' |
|
119 | + 'title' => _MI_NEWBB_ADMENU_ABOUT, |
|
120 | + 'link' => 'admin/about.php', |
|
121 | + 'icon' => $pathIcon32 . 'about.png' |
|
122 | 122 | ]; |
@@ -41,82 +41,82 @@ |
||
41 | 41 | $adminmenu[] = [ |
42 | 42 | 'title' => _MI_NEWBB_ADMENU_INDEX, |
43 | 43 | 'link' => 'admin/index.php', |
44 | - 'icon' => $pathIcon32 . 'home.png' |
|
44 | + 'icon' => $pathIcon32.'home.png' |
|
45 | 45 | ]; |
46 | 46 | |
47 | 47 | $adminmenu[] = [ |
48 | 48 | 'title' => _MI_NEWBB_ADMENU_CATEGORY, |
49 | 49 | 'link' => 'admin/admin_cat_manager.php', |
50 | - 'icon' => $pathIcon32 . 'category.png' |
|
50 | + 'icon' => $pathIcon32.'category.png' |
|
51 | 51 | ]; |
52 | 52 | |
53 | 53 | $adminmenu[] = [ |
54 | 54 | 'title' => _MI_NEWBB_ADMENU_FORUM, |
55 | 55 | 'link' => 'admin/admin_forum_manager.php', |
56 | - 'icon' => $pathIcon32 . 'forums.png' |
|
56 | + 'icon' => $pathIcon32.'forums.png' |
|
57 | 57 | ]; |
58 | 58 | |
59 | 59 | $adminmenu[] = [ |
60 | 60 | 'title' => _MI_NEWBB_ADMENU_PERMISSION, |
61 | 61 | 'link' => 'admin/admin_permissions.php', |
62 | - 'icon' => $pathIcon32 . 'permissions.png' |
|
62 | + 'icon' => $pathIcon32.'permissions.png' |
|
63 | 63 | ]; |
64 | 64 | |
65 | 65 | $adminmenu[] = [ |
66 | 66 | 'title' => _MI_NEWBB_ADMENU_ORDER, |
67 | 67 | 'link' => 'admin/admin_forum_reorder.php', |
68 | - 'icon' => $pathIcon32 . 'compfile.png' |
|
68 | + 'icon' => $pathIcon32.'compfile.png' |
|
69 | 69 | ]; |
70 | 70 | |
71 | 71 | $adminmenu[] = [ |
72 | 72 | 'title' => _MI_NEWBB_ADMENU_PRUNE, |
73 | 73 | 'link' => 'admin/admin_forum_prune.php', |
74 | - 'icon' => $pathIcon32 . 'update.png' |
|
74 | + 'icon' => $pathIcon32.'update.png' |
|
75 | 75 | ]; |
76 | 76 | |
77 | 77 | $adminmenu[] = [ |
78 | 78 | 'title' => _MI_NEWBB_ADMENU_REPORT, |
79 | 79 | 'link' => 'admin/admin_report.php', |
80 | - 'icon' => $pathIcon32 . 'content.png' |
|
80 | + 'icon' => $pathIcon32.'content.png' |
|
81 | 81 | ]; |
82 | 82 | |
83 | 83 | $adminmenu[] = [ |
84 | 84 | 'title' => _MI_NEWBB_ADMENU_DIGEST, |
85 | 85 | 'link' => 'admin/admin_digest.php', |
86 | - 'icon' => $pathIcon32 . 'digest.png' |
|
86 | + 'icon' => $pathIcon32.'digest.png' |
|
87 | 87 | ]; |
88 | 88 | |
89 | 89 | $adminmenu[] = [ |
90 | 90 | 'title' => _MI_NEWBB_ADMENU_VOTE, |
91 | 91 | 'link' => 'admin/admin_votedata.php', |
92 | - 'icon' => $pathIcon32 . 'button_ok.png' |
|
92 | + 'icon' => $pathIcon32.'button_ok.png' |
|
93 | 93 | ]; |
94 | 94 | |
95 | 95 | $adminmenu[] = [ |
96 | 96 | 'title' => _MI_NEWBB_ADMENU_TYPE, |
97 | 97 | 'link' => 'admin/admin_type_manager.php', |
98 | - 'icon' => $pathIcon32 . 'type.png' |
|
98 | + 'icon' => $pathIcon32.'type.png' |
|
99 | 99 | ]; |
100 | 100 | |
101 | 101 | $adminmenu[] = [ |
102 | 102 | 'title' => _MI_NEWBB_ADMENU_GROUPMOD, |
103 | 103 | 'link' => 'admin/admin_groupmod.php', |
104 | - 'icon' => $pathIcon32 . 'groupmod.png' |
|
104 | + 'icon' => $pathIcon32.'groupmod.png' |
|
105 | 105 | ]; |
106 | 106 | |
107 | 107 | $adminmenu[] = [ |
108 | 108 | 'title' => _MI_NEWBB_ADMENU_SYNC, |
109 | 109 | 'link' => 'admin/admin_synchronization.php', |
110 | - 'icon' => $pathIcon32 . 'synchronized.png' |
|
110 | + 'icon' => $pathIcon32.'synchronized.png' |
|
111 | 111 | ]; |
112 | 112 | |
113 | 113 | $adminmenu[] = [ |
114 | 114 | 'title' => _MI_NEWBB_ADMENU_MIGRATE, |
115 | 115 | 'link' => 'admin/migrate.php', |
116 | - 'icon' => $pathIcon32 . 'database_go.png' |
|
116 | + 'icon' => $pathIcon32.'database_go.png' |
|
117 | 117 | ]; |
118 | 118 | $adminmenu[] = [ |
119 | 119 | 'title' => _MI_NEWBB_ADMENU_ABOUT, |
120 | 120 | 'link' => 'admin/about.php', |
121 | - 'icon' => $pathIcon32 . 'about.png' |
|
121 | + 'icon' => $pathIcon32.'about.png' |
|
122 | 122 | ]; |
@@ -27,35 +27,35 @@ |
||
27 | 27 | */ |
28 | 28 | class Configurator |
29 | 29 | { |
30 | - public $name; |
|
31 | - public $paths = []; |
|
32 | - public $uploadFolders = []; |
|
33 | - public $copyBlankFiles = []; |
|
34 | - public $copyTestFolders = []; |
|
35 | - public $templateFolders = []; |
|
36 | - public $oldFiles = []; |
|
37 | - public $oldFolders = []; |
|
38 | - public $modCopyright; |
|
30 | + public $name; |
|
31 | + public $paths = []; |
|
32 | + public $uploadFolders = []; |
|
33 | + public $copyBlankFiles = []; |
|
34 | + public $copyTestFolders = []; |
|
35 | + public $templateFolders = []; |
|
36 | + public $oldFiles = []; |
|
37 | + public $oldFolders = []; |
|
38 | + public $modCopyright; |
|
39 | 39 | |
40 | - /** |
|
41 | - * Configurator constructor. |
|
42 | - */ |
|
43 | - public function __construct() |
|
44 | - { |
|
45 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
46 | - $capsDirName = strtoupper($moduleDirName); |
|
40 | + /** |
|
41 | + * Configurator constructor. |
|
42 | + */ |
|
43 | + public function __construct() |
|
44 | + { |
|
45 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
46 | + $capsDirName = strtoupper($moduleDirName); |
|
47 | 47 | |
48 | - require_once dirname(dirname(__DIR__)) . '/include/config.php'; |
|
49 | - $config = getConfig(); |
|
48 | + require_once dirname(dirname(__DIR__)) . '/include/config.php'; |
|
49 | + $config = getConfig(); |
|
50 | 50 | |
51 | - $this->name = $config->name; |
|
52 | - $this->paths = $config->paths; |
|
53 | - $this->uploadFolders = $config->uploadFolders; |
|
54 | - $this->copyBlankFiles = $config->copyBlankFiles; |
|
55 | - $this->copyTestFolders = $config->copyTestFolders; |
|
56 | - $this->templateFolders = $config->templateFolders; |
|
57 | - $this->oldFiles = $config->oldFiles; |
|
58 | - $this->oldFolders = $config->oldFolders; |
|
59 | - $this->modCopyright = $config->modCopyright; |
|
60 | - } |
|
51 | + $this->name = $config->name; |
|
52 | + $this->paths = $config->paths; |
|
53 | + $this->uploadFolders = $config->uploadFolders; |
|
54 | + $this->copyBlankFiles = $config->copyBlankFiles; |
|
55 | + $this->copyTestFolders = $config->copyTestFolders; |
|
56 | + $this->templateFolders = $config->templateFolders; |
|
57 | + $this->oldFiles = $config->oldFiles; |
|
58 | + $this->oldFolders = $config->oldFolders; |
|
59 | + $this->modCopyright = $config->modCopyright; |
|
60 | + } |
|
61 | 61 | } |
@@ -45,7 +45,7 @@ |
||
45 | 45 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
46 | 46 | $capsDirName = strtoupper($moduleDirName); |
47 | 47 | |
48 | - require_once dirname(dirname(__DIR__)) . '/include/config.php'; |
|
48 | + require_once dirname(dirname(__DIR__)).'/include/config.php'; |
|
49 | 49 | $config = getConfig(); |
50 | 50 | |
51 | 51 | $this->name = $config->name; |
@@ -17,63 +17,63 @@ |
||
17 | 17 | */ |
18 | 18 | trait VersionChecks |
19 | 19 | { |
20 | - /** |
|
21 | - * |
|
22 | - * Verifies XOOPS version meets minimum requirements for this module |
|
23 | - * @static |
|
24 | - * @param \XoopsModule $module |
|
25 | - * |
|
26 | - * @param null|string $requiredVer |
|
27 | - * @return bool true if meets requirements, false if not |
|
28 | - */ |
|
29 | - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | - { |
|
31 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
33 | - if (null === $module) { |
|
34 | - $module = \XoopsModule::getByDirname($moduleDirName); |
|
35 | - } |
|
36 | - xoops_loadLanguage('admin', $moduleDirName); |
|
20 | + /** |
|
21 | + * |
|
22 | + * Verifies XOOPS version meets minimum requirements for this module |
|
23 | + * @static |
|
24 | + * @param \XoopsModule $module |
|
25 | + * |
|
26 | + * @param null|string $requiredVer |
|
27 | + * @return bool true if meets requirements, false if not |
|
28 | + */ |
|
29 | + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
|
30 | + { |
|
31 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
32 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
33 | + if (null === $module) { |
|
34 | + $module = \XoopsModule::getByDirname($moduleDirName); |
|
35 | + } |
|
36 | + xoops_loadLanguage('admin', $moduleDirName); |
|
37 | 37 | |
38 | - //check for minimum XOOPS version |
|
39 | - $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
40 | - if (null === $requiredVer) { |
|
41 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
42 | - } |
|
43 | - $success = true; |
|
38 | + //check for minimum XOOPS version |
|
39 | + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
|
40 | + if (null === $requiredVer) { |
|
41 | + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
42 | + } |
|
43 | + $success = true; |
|
44 | 44 | |
45 | - if (version_compare($currentVer, $requiredVer, '<')) { |
|
46 | - $success = false; |
|
47 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
48 | - } |
|
45 | + if (version_compare($currentVer, $requiredVer, '<')) { |
|
46 | + $success = false; |
|
47 | + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
48 | + } |
|
49 | 49 | |
50 | - return $success; |
|
51 | - } |
|
50 | + return $success; |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * |
|
55 | - * Verifies PHP version meets minimum requirements for this module |
|
56 | - * @static |
|
57 | - * @param \XoopsModule $module |
|
58 | - * |
|
59 | - * @return bool true if meets requirements, false if not |
|
60 | - */ |
|
61 | - public static function checkVerPhp(\XoopsModule $module) |
|
62 | - { |
|
63 | - $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
64 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
65 | - xoops_loadLanguage('admin', $module->dirname()); |
|
66 | - // check for minimum PHP version |
|
67 | - $success = true; |
|
68 | - $verNum = PHP_VERSION; |
|
69 | - $reqVer = $module->getInfo('min_php'); |
|
70 | - if (false !== $reqVer && '' !== $reqVer) { |
|
71 | - if (version_compare($verNum, $reqVer, '<')) { |
|
72 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
73 | - $success = false; |
|
74 | - } |
|
75 | - } |
|
53 | + /** |
|
54 | + * |
|
55 | + * Verifies PHP version meets minimum requirements for this module |
|
56 | + * @static |
|
57 | + * @param \XoopsModule $module |
|
58 | + * |
|
59 | + * @return bool true if meets requirements, false if not |
|
60 | + */ |
|
61 | + public static function checkVerPhp(\XoopsModule $module) |
|
62 | + { |
|
63 | + $moduleDirName = basename(dirname(dirname(__DIR__))); |
|
64 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
65 | + xoops_loadLanguage('admin', $module->dirname()); |
|
66 | + // check for minimum PHP version |
|
67 | + $success = true; |
|
68 | + $verNum = PHP_VERSION; |
|
69 | + $reqVer = $module->getInfo('min_php'); |
|
70 | + if (false !== $reqVer && '' !== $reqVer) { |
|
71 | + if (version_compare($verNum, $reqVer, '<')) { |
|
72 | + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
73 | + $success = false; |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | - return $success; |
|
78 | - } |
|
77 | + return $success; |
|
78 | + } |
|
79 | 79 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) |
30 | 30 | { |
31 | 31 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
32 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
32 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
33 | 33 | if (null === $module) { |
34 | 34 | $module = \XoopsModule::getByDirname($moduleDirName); |
35 | 35 | } |
@@ -38,13 +38,13 @@ discard block |
||
38 | 38 | //check for minimum XOOPS version |
39 | 39 | $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string |
40 | 40 | if (null === $requiredVer) { |
41 | - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string |
|
41 | + $requiredVer = ''.$module->getInfo('min_xoops'); //making sure it's a string |
|
42 | 42 | } |
43 | 43 | $success = true; |
44 | 44 | |
45 | 45 | if (version_compare($currentVer, $requiredVer, '<')) { |
46 | 46 | $success = false; |
47 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
47 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | return $success; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | public static function checkVerPhp(\XoopsModule $module) |
62 | 62 | { |
63 | 63 | $moduleDirName = basename(dirname(dirname(__DIR__))); |
64 | - $moduleDirNameUpper = strtoupper($moduleDirName); |
|
64 | + $moduleDirNameUpper = strtoupper($moduleDirName); |
|
65 | 65 | xoops_loadLanguage('admin', $module->dirname()); |
66 | 66 | // check for minimum PHP version |
67 | 67 | $success = true; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $reqVer = $module->getInfo('min_php'); |
70 | 70 | if (false !== $reqVer && '' !== $reqVer) { |
71 | 71 | if (version_compare($verNum, $reqVer, '<')) { |
72 | - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
72 | + $module->setErrors(sprintf(constant('CO_'.$moduleDirNameUpper.'_ERROR_BAD_PHP'), $reqVer, $verNum)); |
|
73 | 73 | $success = false; |
74 | 74 | } |
75 | 75 | } |