This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||
2 | /** |
||
3 | * Module: Lexikon - glossary module |
||
4 | * Author: hsalazar |
||
5 | * Licence: GNU |
||
6 | */ |
||
7 | |||
8 | use Xmf\Module\Admin; |
||
9 | use Xmf\Request; |
||
10 | use XoopsModules\Lexikon\{ |
||
11 | Helper, |
||
12 | Utility |
||
13 | }; |
||
14 | /** @var Helper $helper */ |
||
15 | |||
16 | // -- General Stuff -- // |
||
17 | require_once __DIR__ . '/admin_header.php'; |
||
18 | |||
19 | |||
20 | $helper = Helper::getInstance(); |
||
21 | |||
22 | $myts = \MyTextSanitizer::getInstance(); |
||
23 | xoops_cp_header(); |
||
24 | xoops_load('XoopsUserUtility'); |
||
25 | $adminObject = Admin::getInstance(); |
||
26 | $adminObject->displayNavigation(basename(__FILE__)); |
||
27 | $adminObject->addItemButton(_AM_LEXIKON_CREATECAT, 'category.php?op=addcat', 'add'); |
||
28 | $adminObject->displayButton('left'); |
||
29 | $op = ''; |
||
30 | |||
31 | /* -- Available operations -- */ |
||
32 | |||
33 | /** |
||
34 | * |
||
35 | */ |
||
36 | function categoryDefault() |
||
37 | { |
||
38 | $helper = Helper::getInstance(); |
||
39 | $op = 'default'; |
||
40 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
41 | require_once XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||
42 | |||
43 | $startentry = \Xmf\Request::getInt('startentry', 0, 'GET'); |
||
44 | $startcat = \Xmf\Request::getInt('startcat', 0, 'GET'); |
||
45 | $startsub = \Xmf\Request::getInt('startsub', 0, 'GET'); |
||
46 | $datesub = \Xmf\Request::getInt('datesub', 0, 'GET'); |
||
47 | |||
48 | global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule, $entryID, $pathIcon16; |
||
49 | |||
50 | $myts = \MyTextSanitizer::getInstance(); |
||
51 | // lx_adminMenu(1, _AM_LEXIKON_CATS); |
||
52 | $result01 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxcategories') . ' '); |
||
53 | [$totalcategories] = $xoopsDB->fetchRow($result01); |
||
54 | |||
55 | $result02 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0'); |
||
56 | [$totalpublished] = $xoopsDB->fetchRow($result02); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
![]() |
|||
57 | |||
58 | $result03 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit = '1' AND request = '0' "); |
||
59 | [$totalsubmitted] = $xoopsDB->fetchRow($result03); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
60 | |||
61 | $result04 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit = '1' AND request = '1' "); |
||
62 | [$totalrequested] = $xoopsDB->fetchRow($result04); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
63 | |||
64 | if (1 == $helper->getConfig('multicats')) { |
||
65 | /** |
||
66 | * Code to show existing categories |
||
67 | **/ |
||
68 | |||
69 | echo " <table class='outer' width='100%' border='0'> |
||
70 | <tr> |
||
71 | <td colspan='7' class='odd'> |
||
72 | <strong>" . _AM_LEXIKON_SHOWCATS . ' (' . $totalcategories . ')' . '</strong></td></tr>'; |
||
73 | echo '<tr>'; |
||
74 | // create existing columns table //doppio |
||
75 | $resultC1 = $xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxcategories') . ' '); |
||
76 | [$numrows] = $xoopsDB->fetchRow($resultC1); |
||
77 | $sql = 'SELECT * FROM ' . $xoopsDB->prefix('lxcategories') . ' ORDER BY weight'; |
||
78 | $resultC2 = $xoopsDB->query($sql, $helper->getConfig('perpage'), $startcat); |
||
79 | |||
80 | echo "<th style='width:40px; text-align:center;'>" . _AM_LEXIKON_ID . "</td> |
||
81 | <th style='text-align:center;'><b>" . _AM_LEXIKON_WEIGHT . "</b></td> |
||
82 | <th style='width:30%; text-align:center;'>" . _AM_LEXIKON_CATNAME . "</td> |
||
83 | <th style='width:10px; text-align:center;'>" . _AM_LEXIKON_ENTRIES . "</td> |
||
84 | <th style='width:*; text-align:center;'>" . _AM_LEXIKON_DESCRIP . "</td> |
||
85 | <th style='width:60px; text-align:center;'>" . _AM_LEXIKON_ACTION . '</td> |
||
86 | </tr>'; |
||
87 | |||
88 | $class = 'odd'; |
||
89 | if ($numrows > 0) { // That is, if there ARE columns in the system |
||
90 | while (list($categoryID, $name, $description, $total, $weight, $logourl) = $xoopsDB->fetchRow($resultC2)) { |
||
91 | $name = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5); |
||
92 | $description = strip_tags(htmlspecialchars_decode($description)); |
||
93 | $modify = "<a href='category.php?op=mod&categoryID=" . $categoryID . "'><img src=" . $pathIcon16 . "/edit.png alt='" . _AM_LEXIKON_EDITCAT . "'></a>"; |
||
94 | $delete = "<a href='category.php?op=del&categoryID=" . $categoryID . "'><img src=" . $pathIcon16 . "/delete.png alt='" . _AM_LEXIKON_DELETECAT . "'></a>"; |
||
95 | |||
96 | echo "<tr class='" . $class . "'>"; |
||
97 | $class = ('even' === $class) ? 'odd' : 'even'; |
||
98 | |||
99 | echo " |
||
100 | <td style='text-align:center;'>" . $categoryID . "</td> |
||
101 | <td style='width:10; text-align:center;'>" . $weight . "</td> |
||
102 | <td style='text-align:left;'><a href='../category.php?categoryID=" . $categoryID . "'>" . $name . "</a></td> |
||
103 | <td style='text-align:center;'>" . $total . "</td> |
||
104 | <td style='text-align:left;'>" . $description . "</td> |
||
105 | <td style='text-align:center;'>" . $modify . '-' . $delete . '</td> |
||
106 | </tr></div>'; |
||
107 | } |
||
108 | } else { // that is, $numrows = 0, there's no columns yet |
||
109 | echo '<div><tr>'; |
||
110 | echo "<td class='odd' align='center' colspan= '7'>" . _AM_LEXIKON_NOCATS . '</td>'; |
||
111 | echo '</tr></div>'; |
||
112 | $categoryID = '0'; |
||
113 | } |
||
114 | echo "</table>\n"; |
||
115 | $pagenav = new \XoopsPageNav($numrows, $helper->getConfig('perpage'), $startcat, 'startcat'); |
||
116 | echo '<div style="text-align:right;">' . $pagenav->renderNav(8) . '</div>'; |
||
117 | echo "<br><br>\n"; |
||
118 | echo '</div>'; |
||
119 | } else { |
||
120 | redirect_header('index.php', 1, sprintf(_AM_LEXIKON_SINGLECAT, '')); |
||
121 | } |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Code to edit categories |
||
126 | * @param string $categoryID |
||
127 | */ |
||
128 | function categoryEdit($categoryID = '') |
||
129 | { |
||
130 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
131 | require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
132 | require_once XOOPS_ROOT_PATH . '/class/xoopsform/grouppermform.php'; |
||
133 | |||
134 | $utility = new Utility(); |
||
135 | |||
136 | $weight = 1; |
||
137 | $name = ''; |
||
138 | $description = ''; |
||
139 | $logourl = ''; |
||
140 | |||
141 | global $xoopsUser, $xoopsConfig, $xoopsDB, $xoopsModule; |
||
142 | |||
143 | $helper = Helper::getInstance(); |
||
144 | |||
145 | // If there is a parameter, and the id exists, retrieve data: we're editing a column |
||
146 | if ($categoryID) { |
||
147 | $result = $xoopsDB->query( |
||
148 | ' |
||
149 | SELECT categoryID, name, description, total, weight,logourl |
||
150 | FROM ' . $xoopsDB->prefix('lxcategories') . " |
||
151 | WHERE categoryID = '$categoryID'" |
||
152 | ); |
||
153 | |||
154 | [$categoryID, $name, $description, $total, $weight, $logourl] = $xoopsDB->fetchRow($result); |
||
155 | $myts = \MyTextSanitizer::getInstance(); |
||
156 | $name = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5); |
||
157 | //permissions |
||
158 | /** @var \XoopsMemberHandler $memberHandler */ |
||
159 | $memberHandler = xoops_getHandler('member'); |
||
160 | $group_list = $memberHandler->getGroupList(); |
||
161 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
162 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
163 | |||
164 | $groups = $grouppermHandler->getGroupIds('lexikon_view', $categoryID, $xoopsModule->getVar('mid')); |
||
165 | // $groups = $groups; |
||
166 | if (0 == $xoopsDB->getRowsNum($result)) { |
||
167 | redirect_header('index.php', 1, _AM_LEXIKON_NOCATTOEDIT); |
||
168 | } |
||
169 | if (0 == $xoopsDB->getRowsNum($result)) { |
||
170 | redirect_header('index.php', 1, _AM_LEXIKON_NOCATTOEDIT); |
||
171 | } |
||
172 | //$myts = \MyTextSanitizer::getInstance(); |
||
173 | // lx_adminMenu(1, _AM_LEXIKON_CATS); |
||
174 | |||
175 | echo "<strong style='color: #2F5376;margin-top: 6px;font-size:medium'>" . _AM_LEXIKON_CATSHEADER . '</strong>'; |
||
176 | $sform = new \XoopsThemeForm(_AM_LEXIKON_MODCAT . ": $name", 'op', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
177 | } else { |
||
178 | //$myts = \MyTextSanitizer::getInstance(); |
||
179 | // lx_adminMenu(1, _AM_LEXIKON_CATS); |
||
180 | $groups = true; |
||
181 | echo "<strong style='color: #2F5376;margin-top: 6px;font-size:medium'>" . _AM_LEXIKON_CATSHEADER . '</strong>'; |
||
182 | $sform = new \XoopsThemeForm(_AM_LEXIKON_NEWCAT, 'op', xoops_getenv('SCRIPT_NAME'), 'post', true); |
||
183 | } |
||
184 | |||
185 | $sform->setExtra('enctype="multipart/form-data"'); |
||
186 | $sform->addElement(new \XoopsFormText(_AM_LEXIKON_CATNAME, 'name', 50, 80, $name), true); |
||
187 | |||
188 | $editor = $utility::getWysiwygForm(_AM_LEXIKON_CATDESCRIPT, 'description', $description, 7, 60); |
||
189 | $sform->addElement($editor, true); |
||
190 | unset($editor); |
||
191 | |||
192 | $sform->addElement(new \XoopsFormText(_AM_LEXIKON_CATPOSIT, 'weight', 4, 4, $weight), true); |
||
193 | $sform->addElement(new \XoopsFormHidden('categoryID', $categoryID)); |
||
194 | //CategoryImage |
||
195 | if (1 == $helper->getConfig('useshots')) { |
||
196 | //CategoryImage :: Common querys from Article module by phppp |
||
197 | $image_option_tray = new \XoopsFormElementTray('<strong>' . _AM_LEXIKON_CATIMGUPLOAD . '</strong>', '<br>'); |
||
198 | $image_option_tray->addElement(new \XoopsFormFile('', 'userfile', '')); |
||
199 | $sform->addElement($image_option_tray); |
||
200 | unset($image_tray); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
201 | unset($image_option_tray); |
||
202 | |||
203 | $path_catimg = 'uploads/' . $xoopsModule->getVar('dirname') . '/categories/images'; |
||
204 | $image_option_tray = new \XoopsFormElementTray(_AM_LEXIKON_CATIMAGE . '<br>' . _AM_LEXIKON_CATIMG_DSC . '<br>' . $path_catimg); |
||
205 | $image_array = \XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH . '/' . $path_catimg . '/'); |
||
206 | array_unshift($image_array, _NONE); |
||
207 | |||
208 | $image_select = new \XoopsFormSelect('', 'logourl', $logourl); |
||
209 | $image_select->addOptionArray($image_array); |
||
210 | $image_select->setExtra("onchange=\"showImgSelected('img', 'logourl', '/" . $path_catimg . "/', '', '" . XOOPS_URL . "')\""); |
||
211 | $image_tray = new \XoopsFormElementTray('', ' '); |
||
212 | $image_tray->addElement($image_select); |
||
213 | if (!empty($logourl) && file_exists(XOOPS_ROOT_PATH . '/' . $path_catimg . '/' . $logourl)) { |
||
214 | $image_tray->addElement(new \XoopsFormLabel('', "<div style='padding: 4px;'><img src=\"" . XOOPS_URL . '/' . $path_catimg . '/' . $logourl . '" name="img" id="img" alt="" ></div>')); |
||
215 | } else { |
||
216 | $image_tray->addElement(new \XoopsFormLabel('', "<div style='padding: 4px;'><img src=\"" . XOOPS_URL . '/' . $path_catimg . '/blank.gif" name="img" id="img" alt="" ></div>')); |
||
217 | } |
||
218 | $image_option_tray->addElement($image_tray); |
||
219 | $sform->addElement($image_option_tray); |
||
220 | } |
||
221 | $sform->addElement(new \XoopsFormSelectGroup(_AM_LEXIKON_CAT_GROUPSVIEW, 'groups', true, $groups, 5, true)); |
||
222 | |||
223 | $buttonTray = new \XoopsFormElementTray('', ''); |
||
224 | $hidden = new \XoopsFormHidden('op', 'addcategory'); |
||
225 | $buttonTray->addElement($hidden); |
||
226 | |||
227 | // No ID for column -- then it's new column, button says 'Create' |
||
228 | if (!$categoryID) { |
||
229 | $butt_create = new \XoopsFormButton('', '', _AM_LEXIKON_CREATE, 'submit'); |
||
230 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); |
||
231 | $buttonTray->addElement($butt_create); |
||
232 | |||
233 | $butt_clear = new \XoopsFormButton('', '', _AM_LEXIKON_CLEAR, 'reset'); |
||
234 | $buttonTray->addElement($butt_clear); |
||
235 | |||
236 | $butt_cancel = new \XoopsFormButton('', '', _AM_LEXIKON_CANCEL, 'button'); |
||
237 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
238 | $buttonTray->addElement($butt_cancel); |
||
239 | } else { // button says 'Update' |
||
240 | $butt_create = new \XoopsFormButton('', '', _AM_LEXIKON_MODIFY, 'submit'); |
||
241 | $butt_create->setExtra('onclick="this.form.elements.op.value=\'addcategory\'"'); |
||
242 | $buttonTray->addElement($butt_create); |
||
243 | |||
244 | $butt_cancel = new \XoopsFormButton('', '', _AM_LEXIKON_CANCEL, 'button'); |
||
245 | $butt_cancel->setExtra('onclick="history.go(-1)"'); |
||
246 | $buttonTray->addElement($butt_cancel); |
||
247 | } |
||
248 | |||
249 | $sform->addElement($buttonTray); |
||
250 | $sform->display(); |
||
251 | unset($hidden); |
||
252 | } |
||
253 | |||
254 | /** |
||
255 | * Code to delete existing categories |
||
256 | * @param string $categoryID |
||
257 | */ |
||
258 | function categoryDelete($categoryID = '') |
||
259 | { |
||
260 | //global $xoopsDB, $xoopsConfig; |
||
261 | global $xoopsConfig, $xoopsDB, $xoopsModule; |
||
262 | $idc = Request::getInt('categoryID', ''); |
||
263 | if ('' == $idc) { |
||
264 | $idc = $_GET['categoryID']; |
||
265 | } |
||
266 | if ($idc <= 0) { |
||
267 | header('location: category.php'); |
||
268 | exit(); |
||
269 | } |
||
270 | |||
271 | $ok = Request::getInt('ok', 0, 'POST'); //isset($_POST['ok']) ? \Xmf\Request::getInt('ok', 0, 'POST') : 0; |
||
272 | $result = $xoopsDB->query('SELECT categoryID, name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $idc"); |
||
273 | [$categoryID, $name] = $xoopsDB->fetchRow($result); |
||
274 | // confirmed, so delete |
||
275 | if (1 == $ok) { |
||
276 | //get all entries in the category |
||
277 | $result3 = $xoopsDB->query('SELECT entryID from ' . $xoopsDB->prefix('lxentries') . " where categoryID = $idc"); |
||
278 | //now for each entry, delete the coments |
||
279 | while (list($entryID) = $xoopsDB->fetchRow($result3)) { |
||
280 | xoops_comment_delete($xoopsModule->getVar('mid'), $entryID); |
||
281 | xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'term', $entryID); |
||
282 | } |
||
283 | $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID='$idc'"); |
||
284 | $result2 = $xoopsDB->query('DELETE FROM ' . $xoopsDB->prefix('lxentries') . " WHERE categoryID = $idc"); |
||
285 | // remove permissions |
||
286 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_view', $categoryID); |
||
287 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_submit', $categoryID); |
||
288 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_approve', $categoryID); |
||
289 | xoops_groupperm_deletebymoditem($xoopsModule->getVar('mid'), 'lexikon_request', $categoryID); |
||
290 | // delete notifications |
||
291 | xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'global', $categoryID); |
||
292 | xoops_notification_deletebyitem($xoopsModule->getVar('mid'), 'category', $categoryID); |
||
293 | |||
294 | redirect_header('category.php', 1, sprintf(_AM_LEXIKON_CATISDELETED, $name)); |
||
295 | } else { |
||
296 | xoops_confirm(['op' => 'del', 'categoryID' => $categoryID, 'ok' => 1, 'name' => $name], 'category.php', _AM_LEXIKON_DELETETHISCAT . '<br>' . $name, _AM_LEXIKON_DELETE); |
||
297 | require_once __DIR__ . '/admin_footer.php'; |
||
298 | } |
||
299 | } |
||
300 | |||
301 | /** |
||
302 | * @param string $categoryID |
||
303 | */ |
||
304 | function categorySave($categoryID = '') |
||
305 | { |
||
306 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
307 | require_once XOOPS_ROOT_PATH . '/class/uploader.php'; |
||
308 | global $xoopsUser, $xoopsConfig, $xoopsModule, $xoopsDB, $myts, $categoryID; |
||
309 | |||
310 | $helper = Helper::getInstance(); |
||
311 | //print_r ($_POST); |
||
312 | $categoryID = Request::getInt('categoryID', 0); |
||
313 | $weight = Request::getInt('weight', 0); //isset($_POST['weight']) ? \Xmf\Request::getInt('weight', 0, 'POST') : \Xmf\Request::getInt('weight', 0, 'GET'); |
||
314 | $name = Request::getString('name', ''); //isset($_POST['name']) ? htmlspecialchars($_POST['name']) : htmlspecialchars($_GET['name']); |
||
315 | $description = htmlspecialchars(Request::getString('description', ''), ENT_QUOTES | ENT_HTML5); //isset($_POST['description']) ? htmlspecialchars($_POST['description']) : htmlspecialchars($_GET['description']); |
||
316 | $description = &$myts->xoopsCodeDecode($myts->censorString($description), $allowimage = 1); |
||
317 | $name = $myts->addSlashes(Request::getString('name', '', 'POST')); |
||
318 | $logourl = $myts->addSlashes(Request::getString('logourl', '', 'POST')); |
||
319 | $groups = Request::getArray('group', [], 'POST'); //isset($_POST['groups']) ? $_POST['groups'] : array(); |
||
320 | // image upload |
||
321 | $logourl = ''; |
||
322 | $maxfilesize = $helper->getConfig('imguploadsize'); |
||
323 | $maxfilewidth = $helper->getConfig('imguploadwd'); |
||
324 | $maxfileheight = $helper->getConfig('imguploadwd'); |
||
325 | if (!empty($_FILES['userfile']['name'])) { |
||
326 | $allowed_mimetypes = [ |
||
327 | 'image/gif', |
||
328 | 'image/jpeg', |
||
329 | 'image/pjpeg', |
||
330 | 'image/x-png', |
||
331 | 'image/png', |
||
332 | ]; |
||
333 | $uploader = new \XoopsMediaUploader(XOOPS_ROOT_PATH . '/uploads/' . $xoopsModule->getVar('dirname') . '/categories/images/', $allowed_mimetypes, $maxfilesize, $maxfilewidth, $maxfileheight); |
||
334 | |||
335 | if ($uploader->fetchMedia($_POST['xoops_upload_file'][0])) { |
||
336 | if (!$uploader->upload()) { |
||
337 | echo $uploader->getErrors(); |
||
338 | } else { |
||
339 | echo '<h4>' . _AM_LEXIKON_FILESUCCESS . '</h4>'; |
||
340 | $logourl = $uploader->getSavedFileName(); |
||
341 | } |
||
342 | } else { |
||
343 | echo $uploader->getErrors(); |
||
344 | } |
||
345 | } |
||
346 | $logourl = empty($logourl) ? (empty($_POST['logourl']) ? '' : $_POST['logourl']) : $logourl; |
||
347 | |||
348 | // Run the query and update the data |
||
349 | if (!$_POST['categoryID']) { |
||
350 | if ($xoopsDB->query( |
||
351 | 'INSERT INTO ' . $xoopsDB->prefix('lxcategories') . " (categoryID, name, description, weight, logourl) |
||
352 | VALUES (0, '$name', '$description', '$weight', '$logourl')" |
||
353 | )) { |
||
354 | $newid = $xoopsDB->getInsertId(); |
||
355 | // Increment author's posts count (only if it's a new definition) |
||
356 | if (is_object($xoopsUser) && empty($categoryID)) { |
||
357 | /** @var \XoopsMemberHandler $memberHandler */ |
||
358 | $memberHandler = xoops_getHandler('member'); |
||
359 | $submitter = $memberHandler->getUser($uid); |
||
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
|
|||
360 | if (is_object($submitter)) { |
||
361 | $submitter->setVar('posts', $submitter->getVar('posts') + 1); |
||
362 | $res = $memberHandler->insertUser($submitter, true); |
||
363 | unset($submitter); |
||
364 | } |
||
365 | } |
||
366 | //notification |
||
367 | if (!empty($helper->getConfig('notification_enabled'))) { |
||
368 | if (0 == $newid) { |
||
369 | $newid = $xoopsDB->getInsertId(); |
||
370 | } |
||
371 | global $xoopsModule; |
||
372 | /** @var \XoopsNotificationHandler $notificationHandler */ |
||
373 | $notificationHandler = xoops_getHandler('notification'); |
||
374 | $tags = []; |
||
375 | $tags['ITEM_NAME'] = $name; |
||
376 | $tags['ITEM_URL'] = XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/category.php?categoryID=' . $newid; |
||
377 | $notificationHandler->triggerEvent('global', 0, 'new_category', $tags); |
||
378 | } |
||
379 | lx_save_Permissions($groups, $categoryID, 'lexikon_view'); |
||
380 | redirect_header('category.php', 1, _AM_LEXIKON_CATCREATED); |
||
381 | } else { |
||
382 | redirect_header('index.php', 1, _AM_LEXIKON_NOTUPDATED); |
||
383 | } |
||
384 | } else { |
||
385 | if ($xoopsDB->queryF( |
||
386 | ' |
||
387 | UPDATE ' . $xoopsDB->prefix('lxcategories') . " |
||
388 | SET name = '$name', description = '$description', weight = '$weight' , logourl = '$logourl' |
||
389 | WHERE categoryID = '$categoryID'" |
||
390 | )) { |
||
391 | lx_save_Permissions($groups, $categoryID, 'lexikon_view'); |
||
392 | redirect_header('category.php', 1, _AM_LEXIKON_CATMODIFIED); |
||
393 | } else { |
||
394 | redirect_header('index.php', 1, _AM_LEXIKON_NOTUPDATED); |
||
395 | } |
||
396 | } |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * Available operations |
||
401 | **/ |
||
402 | $op = 'default'; |
||
403 | if (\Xmf\Request::hasVar('op', 'POST')) { |
||
404 | $op = $_POST['op']; |
||
405 | } else { |
||
406 | if (\Xmf\Request::hasVar('op', 'GET')) { |
||
407 | $op = $_GET['op']; |
||
408 | } |
||
409 | } |
||
410 | |||
411 | switch ($op) { |
||
412 | case 'mod': |
||
413 | $categoryID = Request::getInt('categoryID', 0); |
||
414 | categoryEdit($categoryID); |
||
415 | break; |
||
416 | case 'addcat': |
||
417 | categoryEdit(); |
||
418 | break; |
||
419 | case 'addcategory': |
||
420 | categorySave(); |
||
421 | break; |
||
422 | case 'del': |
||
423 | categoryDelete(); |
||
424 | break; |
||
425 | case 'default': |
||
426 | default: |
||
427 | categoryDefault(); |
||
428 | break; |
||
429 | } |
||
430 | require_once __DIR__ . '/admin_footer.php'; |
||
431 |