1 | <?php |
||||
2 | /* |
||||
3 | * You may not change or alter any portion of this comment or credits |
||||
4 | * of supporting developers from this source code or any supporting source code |
||||
5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
6 | * |
||||
7 | * This program is distributed in the hope that it will be useful, |
||||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
10 | */ |
||||
11 | |||||
12 | /** |
||||
13 | * @copyright XOOPS Project https://xoops.org/ |
||||
14 | * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||||
15 | * @package |
||||
16 | * @since |
||||
17 | * @author XOOPS Development Team, Kazumi Ono (AKA onokazu) |
||||
18 | */ |
||||
19 | use Xmf\Request; |
||||
20 | |||||
21 | // Check users rights |
||||
22 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
||||
23 | exit(_NOPERM); |
||||
24 | } |
||||
25 | |||||
26 | include_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; |
||||
27 | include_once XOOPS_ROOT_PATH . '/modules/system/admin/modulesadmin/modulesadmin.php'; |
||||
28 | XoopsLoad::load('XoopsFilterInput'); |
||||
29 | |||||
30 | if (isset($_POST)) { |
||||
31 | foreach ($_POST as $k => $v) { |
||||
32 | ${$k} = $v; |
||||
33 | } |
||||
34 | } |
||||
35 | |||||
36 | // Get Action type |
||||
37 | $op = Request::getString('op', 'list'); |
||||
38 | |||||
39 | if (in_array($op, array('confirm', 'submit', 'install_ok', 'update_ok', 'uninstall_ok'))) { |
||||
40 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
41 | $op = 'list'; |
||||
42 | } |
||||
43 | } |
||||
44 | $myts = \MyTextSanitizer::getInstance(); |
||||
45 | |||||
46 | switch ($op) { |
||||
47 | case 'list': |
||||
48 | // Define main template |
||||
49 | $GLOBALS['xoopsOption']['template_main'] = 'system_modules.tpl'; |
||||
50 | // Call Header |
||||
51 | xoops_cp_header(); |
||||
52 | // Define Stylesheet |
||||
53 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
54 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
||||
0 ignored issues
–
show
Deprecated Code
introduced
by
Loading history...
|
|||||
55 | // Define scripts |
||||
56 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||||
57 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
||||
58 | $xoTheme->addScript('modules/system/js/admin.js'); |
||||
59 | $xoTheme->addScript('modules/system/js/module.js'); |
||||
60 | // Define Breadcrumb and tips |
||||
61 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
62 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help')); |
||||
63 | $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS); |
||||
64 | $xoBreadCrumb->render(); |
||||
65 | // Get Module Handler |
||||
66 | /** @var XoopsModuleHandler $module_handler */ |
||||
67 | $module_handler = xoops_getHandler('module'); |
||||
68 | $criteria = new CriteriaCompo(); |
||||
69 | $criteria->setSort('weight'); |
||||
70 | $criteria->setOrder('ASC'); |
||||
71 | // Get all installed modules |
||||
72 | $installed_mods = $module_handler->getObjects($criteria); |
||||
73 | $listed_mods = array(); |
||||
74 | $i = 0; |
||||
75 | $install_mods = array(); |
||||
76 | $module = Request::getArray('module', array()); |
||||
77 | foreach ($installed_mods as $module) { |
||||
78 | /** @var XoopsModule $module */ |
||||
79 | $listed_mods[$i] = $module->toArray(); |
||||
80 | $listed_mods[$i]['name'] = htmlspecialchars($module->getVar('name'), ENT_QUOTES | ENT_HTML5); |
||||
81 | $listed_mods[$i]['image'] = $module->getInfo('image'); |
||||
82 | $listed_mods[$i]['adminindex'] = $module->getInfo('adminindex'); |
||||
83 | $listed_mods[$i]['version'] = $module->getVar('version'); |
||||
84 | $listed_mods[$i]['last_update'] = formatTimestamp($module->getVar('last_update'), 'm'); |
||||
85 | $listed_mods[$i]['author'] = $module->getInfo('author'); |
||||
86 | $listed_mods[$i]['credits'] = $module->getInfo('credits'); |
||||
87 | $listed_mods[$i]['license'] = $module->getInfo('license'); |
||||
88 | $listed_mods[$i]['description'] = $module->getInfo('description'); |
||||
89 | |||||
90 | if (true === $module->versionCompare($listed_mods[$i]['version'], $module->getInfo('version'))) { |
||||
91 | $listed_mods[$i]['warning_update'] = true; |
||||
92 | } else { |
||||
93 | $listed_mods[$i]['warning_update'] = false; |
||||
94 | } |
||||
95 | // Only to request the update because since xoops 2.5.11 the version is a character string.This condition can be removed from xoops 2.5.12. |
||||
96 | if (strpos($listed_mods[$i]['version'], '.') === false){ |
||||
97 | $listed_mods[$i]['warning_update'] = true; |
||||
98 | } |
||||
99 | |||||
100 | $install_mods[] = $module->getInfo('dirname'); |
||||
101 | unset($module); |
||||
102 | ++$i; |
||||
103 | } |
||||
104 | // Get module to install |
||||
105 | $dirlist = XoopsLists::getModulesList(); |
||||
106 | $toinstall_mods = array(); |
||||
107 | $i = 0; |
||||
108 | foreach ($dirlist as $file) { |
||||
109 | if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) { |
||||
110 | clearstatcache(); |
||||
111 | $file = trim($file); |
||||
112 | if (!in_array($file, $install_mods)) { |
||||
113 | ++$i; |
||||
114 | } |
||||
115 | } |
||||
116 | } |
||||
117 | $xoopsTpl->assign('toinstall_nb', $i); |
||||
118 | |||||
119 | $xoopsTpl->assign('install_mods', $listed_mods); |
||||
120 | $xoopsTpl->assign('mods_popup', $listed_mods); |
||||
121 | |||||
122 | // Call Footer |
||||
123 | xoops_cp_footer(); |
||||
124 | break; |
||||
125 | |||||
126 | case 'installlist': |
||||
127 | // Define main template |
||||
128 | $GLOBALS['xoopsOption']['template_main'] = 'system_modules.tpl'; |
||||
129 | // Call Header |
||||
130 | xoops_cp_header(); |
||||
131 | // Define Stylesheet |
||||
132 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
133 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/ui/' . xoops_getModuleOption('jquery_theme', 'system') . '/ui.all.css'); |
||||
0 ignored issues
–
show
The function
xoops_getModuleOption() has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
134 | // Define scripts |
||||
135 | $xoTheme->addScript('browse.php?Frameworks/jquery/jquery.js'); |
||||
136 | $xoTheme->addScript('browse.php?Frameworks/jquery/plugins/jquery.ui.js'); |
||||
137 | $xoTheme->addScript('modules/system/js/admin.js'); |
||||
138 | // Define Breadcrumb and tips |
||||
139 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
140 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_TOINSTALL); |
||||
141 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install'); |
||||
142 | $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_TIPS); |
||||
143 | $xoBreadCrumb->render(); |
||||
144 | // Get Module Handler |
||||
145 | /** @var XoopsModuleHandler $module_handler */ |
||||
146 | $module_handler = xoops_getHandler('module'); |
||||
147 | // Get all installed modules |
||||
148 | $installed_mods = $module_handler->getObjects(); |
||||
149 | foreach ($installed_mods as $module) { |
||||
150 | /** @var XoopsModule $module */ |
||||
151 | $install_mods[] = $module->getInfo('dirname'); |
||||
152 | } |
||||
153 | // Get module to install |
||||
154 | $dirlist = XoopsLists::getModulesList(); |
||||
155 | $toinstall_mods = array(); |
||||
156 | $i = 0; |
||||
157 | foreach ($dirlist as $file) { |
||||
158 | if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $file . '/xoops_version.php')) { |
||||
159 | clearstatcache(); |
||||
160 | $file = trim($file); |
||||
161 | if (!in_array($file, $install_mods)) { |
||||
162 | $module = $module_handler->create(); |
||||
163 | $module->loadInfo($file); |
||||
164 | $toinstall_mods[$i]['name'] = htmlspecialchars($module->getInfo('name'), ENT_QUOTES | ENT_HTML5); |
||||
165 | $toinstall_mods[$i]['dirname'] = $module->getInfo('dirname'); |
||||
166 | $toinstall_mods[$i]['image'] = $module->getInfo('image'); |
||||
167 | $toinstall_mods[$i]['version'] = $module->getInfo('version'); |
||||
168 | $toinstall_mods[$i]['author'] = $module->getInfo('author'); |
||||
169 | $toinstall_mods[$i]['credits'] = $module->getInfo('credits'); |
||||
170 | $toinstall_mods[$i]['license'] = $module->getInfo('license'); |
||||
171 | $toinstall_mods[$i]['description'] = $module->getInfo('description'); |
||||
172 | $toinstall_mods[$i]['mid'] = $i; // Use only for display popup |
||||
173 | unset($module); |
||||
174 | ++$i; |
||||
175 | } |
||||
176 | } |
||||
177 | } |
||||
178 | $xoopsTpl->assign('toinstall_mods', $toinstall_mods); |
||||
179 | $xoopsTpl->assign('mods_popup', $toinstall_mods); |
||||
180 | // Call Footer |
||||
181 | xoops_cp_footer(); |
||||
182 | //xoops_module_list(); |
||||
183 | break; |
||||
184 | |||||
185 | case 'order': |
||||
186 | // Get Module Handler |
||||
187 | /** @var XoopsModuleHandler $module_handler */ |
||||
188 | $module_handler = xoops_getHandler('module'); |
||||
189 | if (isset($_POST['mod'])) { |
||||
190 | $i = 1; |
||||
191 | foreach ($_POST['mod'] as $order) { |
||||
192 | if ($order > 0) { |
||||
193 | $module = $module_handler->get($order); |
||||
194 | //Change order only for visible modules |
||||
195 | if ($module->getVar('weight') != 0) { |
||||
196 | $module->setVar('weight', $i); |
||||
197 | if (!$module_handler->insert($module)) { |
||||
198 | $error = true; |
||||
199 | } |
||||
200 | ++$i; |
||||
201 | } |
||||
202 | } |
||||
203 | } |
||||
204 | } |
||||
205 | exit; |
||||
206 | break; |
||||
207 | |||||
208 | case 'confirm': |
||||
209 | // Define main template |
||||
210 | $GLOBALS['xoopsOption']['template_main'] = 'system_modules_confirm.tpl'; |
||||
211 | // Call Header |
||||
212 | xoops_cp_header(); |
||||
213 | // Define Stylesheet |
||||
214 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
215 | // Define Breadcrumb and tips |
||||
216 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
217 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_VALIDATE); |
||||
218 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#confirm'); |
||||
219 | $xoBreadCrumb->addTips(_AM_SYSTEM_MODULES_CONFIRM_TIPS); |
||||
220 | $xoBreadCrumb->render(); |
||||
221 | $errorMessage = array(); |
||||
222 | if (!is_writable(XOOPS_CACHE_PATH . '/')) { |
||||
223 | $errorMessage[] = sprintf(_MUSTWABLE, '<strong>' . XOOPS_CACHE_PATH . '/</strong>'); |
||||
224 | } |
||||
225 | if (count($errorMessage) > 0) { |
||||
226 | // Display Error |
||||
227 | xoops_error($errorMessage); |
||||
228 | // Call Footer |
||||
229 | xoops_cp_footer(); |
||||
230 | exit(); |
||||
231 | } |
||||
232 | $i = 0; |
||||
233 | $modifs_mods = array(); |
||||
234 | $module = empty($_POST['module']) ? array() : $_POST['module']; |
||||
235 | foreach ($module as $mid) { |
||||
236 | $mid = (int)$mid; |
||||
237 | $newname[$mid] = trim(XoopsFilterInput::clean($newname[$mid], 'STRING')); |
||||
238 | $modifs_mods[$i]['mid'] = $mid; |
||||
239 | $modifs_mods[$i]['oldname'] = $myts->htmlSpecialChars($myts->stripSlashesGPC($oldname[$mid])); |
||||
0 ignored issues
–
show
The function
MyTextSanitizer::stripSlashesGPC() has been deprecated: as of XOOPS 2.5.11 and will be removed in next XOOPS version
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||
240 | $modifs_mods[$i]['newname'] = $myts->htmlSpecialChars(trim($myts->stripSlashesGPC($newname[$mid]))); |
||||
0 ignored issues
–
show
The function
MyTextSanitizer::stripSlashesGPC() has been deprecated: as of XOOPS 2.5.11 and will be removed in next XOOPS version
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This function has been deprecated. The supplier of the function has supplied an explanatory message. The explanatory message should give you some clue as to whether and when the function will be removed and what other function to use instead.
Loading history...
|
|||||
241 | $modifs_mods[$i]['newstatus'] = isset($newstatus[$mid]) ? $myts->htmlSpecialChars($newstatus[$mid]) : 0; |
||||
242 | ++$i; |
||||
243 | } |
||||
244 | $xoopsTpl->assign('modifs_mods', $modifs_mods); |
||||
245 | $xoopsTpl->assign('input_security', $GLOBALS['xoopsSecurity']->getTokenHTML()); |
||||
246 | // Call Footer |
||||
247 | xoops_cp_footer(); |
||||
248 | break; |
||||
249 | |||||
250 | case 'display': |
||||
251 | // Get module handler |
||||
252 | /** @var XoopsModuleHandler $module_handler */ |
||||
253 | $module_handler = xoops_getHandler('module'); |
||||
254 | $module_id = Request::getInt('mid', 0); |
||||
255 | if ($module_id > 0) { |
||||
256 | /** @var XoopsModule $module */ |
||||
257 | $module = $module_handler->get($module_id); |
||||
258 | $old = $module->getVar('isactive'); |
||||
259 | // Set value |
||||
260 | $module->setVar('isactive', !$old); |
||||
261 | if (!$module_handler->insert($module)) { |
||||
262 | $error = true; |
||||
263 | } |
||||
264 | $blocks = XoopsBlock::getByModule($module_id); |
||||
265 | $bcount = count($blocks); |
||||
266 | for ($i = 0; $i < $bcount; ++$i) { |
||||
267 | $blocks[$i]->setVar('isactive', !$old); |
||||
268 | $blocks[$i]->store(); |
||||
269 | } |
||||
270 | //Set active modules in cache folder |
||||
271 | xoops_setActiveModules(); |
||||
272 | } |
||||
273 | break; |
||||
274 | |||||
275 | case 'display_in_menu': |
||||
276 | // Get module handler |
||||
277 | |||||
278 | $module_handler = xoops_getHandler('module'); |
||||
279 | $module_id = Request::getInt('mid', 0); |
||||
280 | if ($module_id > 0) { |
||||
281 | $module = $module_handler->get($module_id); |
||||
282 | $old = $module->getVar('weight'); |
||||
283 | // Set value |
||||
284 | $module->setVar('weight', !$old); |
||||
285 | if (!$module_handler->insert($module)) { |
||||
286 | $error = true; |
||||
287 | } |
||||
288 | } |
||||
289 | break; |
||||
290 | |||||
291 | case 'submit': |
||||
292 | $ret = array(); |
||||
293 | $write = false; |
||||
294 | $module = empty($_POST['module']) ? array() : $_POST['module']; |
||||
295 | foreach ($module as $mid) { |
||||
296 | if (isset($newstatus[$mid]) && $newstatus[$mid] == 1) { |
||||
297 | if ($oldstatus[$mid] == 0) { |
||||
298 | $ret[] = xoops_module_activate($mid); |
||||
299 | } |
||||
300 | } else { |
||||
301 | if ($oldstatus[$mid] == 1) { |
||||
302 | $ret[] = xoops_module_deactivate($mid); |
||||
303 | } |
||||
304 | } |
||||
305 | $newname[$mid] = trim(XoopsFilterInput::clean($newname[$mid], 'STRING')); |
||||
306 | if ($oldname[$mid] != $newname[$mid]) { |
||||
307 | $ret[] = xoops_module_change($mid, $newname[$mid]); |
||||
308 | $write = true; |
||||
309 | } |
||||
310 | } |
||||
311 | if ($write) { |
||||
312 | // Flush cache files for cpanel GUIs |
||||
313 | xoops_load('cpanel', 'system'); |
||||
314 | XoopsSystemCpanel::flush(); |
||||
315 | } |
||||
316 | |||||
317 | //Set active modules in cache folder |
||||
318 | xoops_setActiveModules(); |
||||
319 | // Define main template |
||||
320 | $GLOBALS['xoopsOption']['template_main'] = 'system_modules_confirm.tpl'; |
||||
321 | // Call Header |
||||
322 | xoops_cp_header(); |
||||
323 | // Define Stylesheet |
||||
324 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
325 | // Define Breadcrumb and tips |
||||
326 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
327 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_SUBMITRES); |
||||
328 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#submit'); |
||||
329 | $xoBreadCrumb->render(); |
||||
330 | if (count($ret) > 0) { |
||||
331 | $xoopsTpl->assign('result', $ret); |
||||
332 | } |
||||
333 | // Call Footer |
||||
334 | xoops_cp_footer(); |
||||
335 | break; |
||||
336 | |||||
337 | case 'install': |
||||
338 | $module = Request::getString('module', ''); |
||||
339 | $module = $myts->htmlSpecialChars($module); |
||||
340 | // Get module handler |
||||
341 | /** @var XoopsModuleHandler $module_handler */ |
||||
342 | $module_handler = xoops_getHandler('module'); |
||||
343 | $mod = $module_handler->create(); |
||||
344 | $mod->loadInfoAsVar($module); |
||||
345 | // Construct message |
||||
346 | if ($mod->getInfo('image') !== false && trim($mod->getInfo('image')) != '') { |
||||
347 | $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />'; |
||||
348 | } |
||||
349 | $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREINS; |
||||
350 | // Call Header |
||||
351 | xoops_cp_header(); |
||||
352 | // Define Stylesheet |
||||
353 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
354 | // Define Breadcrumb and tips |
||||
355 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
356 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL); |
||||
357 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install'); |
||||
358 | $xoBreadCrumb->render(); |
||||
359 | // Display question message |
||||
360 | xoops_confirm(array('module' => $module, 'op' => 'install_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_INSTALL); |
||||
361 | // Call Footer |
||||
362 | xoops_cp_footer(); |
||||
363 | break; |
||||
364 | |||||
365 | case 'install_ok': |
||||
366 | $ret = array(); |
||||
367 | $ret[] = xoops_module_install($module); |
||||
368 | // Flush cache files for cpanel GUIs |
||||
369 | xoops_load('cpanel', 'system'); |
||||
370 | XoopsSystemCpanel::flush(); |
||||
371 | //Set active modules in cache folder |
||||
372 | xoops_setActiveModules(); |
||||
373 | // Define main template |
||||
374 | $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
||||
375 | // Call Header |
||||
376 | xoops_cp_header(); |
||||
377 | // Define Stylesheet |
||||
378 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
379 | // Define Breadcrumb and tips |
||||
380 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
381 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_INSTALL); |
||||
382 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#install'); |
||||
383 | $xoBreadCrumb->render(); |
||||
384 | if (count($ret) > 0) { |
||||
385 | foreach ($ret as $msg) { |
||||
386 | if ($msg != '') { |
||||
387 | echo $msg; |
||||
388 | } |
||||
389 | } |
||||
390 | } |
||||
391 | xoops_module_delayed_clean_cache(); |
||||
392 | // Call Footer |
||||
393 | xoops_cp_footer(); |
||||
394 | break; |
||||
395 | |||||
396 | case 'uninstall': |
||||
397 | $module = Request::getString('module', ''); |
||||
398 | $module = $myts->htmlSpecialChars($module); |
||||
399 | $msgs = ''; |
||||
400 | // Get module handler |
||||
401 | /** @var XoopsModuleHandler $module_handler */ |
||||
402 | $module_handler = xoops_getHandler('module'); |
||||
403 | $mod = $module_handler->getByDirname($module); |
||||
404 | // Construct message |
||||
405 | if ($mod->getInfo('image') !== false && trim($mod->getInfo('image')) != '') { |
||||
406 | $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />'; |
||||
407 | } |
||||
408 | $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREUNINS; |
||||
409 | // Call Header |
||||
410 | xoops_cp_header(); |
||||
411 | // Define Stylesheet |
||||
412 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
413 | // Define Breadcrumb and tips |
||||
414 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
415 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL); |
||||
416 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete'); |
||||
417 | $xoBreadCrumb->render(); |
||||
418 | // Display Question |
||||
419 | xoops_confirm(array('module' => $module, 'op' => 'uninstall_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_UNINSTALL); |
||||
420 | // Call Footer |
||||
421 | xoops_cp_footer(); |
||||
422 | break; |
||||
423 | |||||
424 | case 'uninstall_ok': |
||||
425 | $module = Request::getString('module', ''); |
||||
426 | $ret = array(); |
||||
427 | $ret[] = xoops_module_uninstall($module); |
||||
428 | // Flush cache files for cpanel GUIs |
||||
429 | xoops_load('cpanel', 'system'); |
||||
430 | XoopsSystemCpanel::flush(); |
||||
431 | //Set active modules in cache folder |
||||
432 | xoops_setActiveModules(); |
||||
433 | // Define main template |
||||
434 | $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
||||
435 | // Call Header |
||||
436 | xoops_cp_header(); |
||||
437 | // Define Stylesheet |
||||
438 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
439 | // Define Breadcrumb and tips |
||||
440 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
441 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UNINSTALL); |
||||
442 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#delete'); |
||||
443 | $xoBreadCrumb->render(); |
||||
444 | if (count($ret) > 0) { |
||||
445 | foreach ($ret as $msg) { |
||||
446 | if ($msg != '') { |
||||
447 | echo $msg; |
||||
448 | } |
||||
449 | } |
||||
450 | } |
||||
451 | xoops_module_delayed_clean_cache(); |
||||
452 | // Call Footer |
||||
453 | xoops_cp_footer(); |
||||
454 | break; |
||||
455 | |||||
456 | case 'update': |
||||
457 | $module = Request::getString('module', ''); |
||||
458 | $module = $myts->htmlSpecialChars($module); |
||||
459 | // Get module handler |
||||
460 | /** @var XoopsModuleHandler $module_handler */ |
||||
461 | $module_handler = xoops_getHandler('module'); |
||||
462 | $mod = $module_handler->getByDirname($module); |
||||
463 | // Construct message |
||||
464 | if ($mod->getInfo('image') !== false && trim($mod->getInfo('image')) != '') { |
||||
465 | $msgs = '<img src="' . XOOPS_URL . '/modules/' . $mod->getVar('dirname', 'n') . '/' . trim($mod->getInfo('image')) . '" alt="" />'; |
||||
466 | } |
||||
467 | $msgs .= '<br><span style="font-size:smaller;">' . $mod->getVar('name', 's') . '</span><br><br>' . _AM_SYSTEM_MODULES_RUSUREUPD; |
||||
468 | // Call Header |
||||
469 | xoops_cp_header(); |
||||
470 | // Define Stylesheet |
||||
471 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
472 | // Define Breadcrumb and tips |
||||
473 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
474 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE); |
||||
475 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update'); |
||||
476 | $xoBreadCrumb->render(); |
||||
477 | // Display message |
||||
478 | xoops_confirm(array('module' => $module, 'op' => 'update_ok', 'fct' => 'modulesadmin'), 'admin.php', $msgs, _AM_SYSTEM_MODULES_UPDATE); |
||||
479 | // Call Footer |
||||
480 | xoops_cp_footer(); |
||||
481 | break; |
||||
482 | |||||
483 | case 'update_ok': |
||||
484 | $module = Request::getString('module', ''); |
||||
485 | $ret = array(); |
||||
486 | $ret[] = xoops_module_update($module); |
||||
487 | // Flush cache files for cpanel GUIs |
||||
488 | xoops_load('cpanel', 'system'); |
||||
489 | XoopsSystemCpanel::flush(); |
||||
490 | //Set active modules in cache folder |
||||
491 | xoops_setActiveModules(); |
||||
492 | // Define main template |
||||
493 | $GLOBALS['xoopsOption']['template_main'] = 'system_header.tpl'; |
||||
494 | // Call Header |
||||
495 | xoops_cp_header(); |
||||
496 | // Define Stylesheet |
||||
497 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/system/css/admin.css'); |
||||
498 | // Define Breadcrumb and tips |
||||
499 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_ADMIN, system_adminVersion('modulesadmin', 'adminpath')); |
||||
500 | $xoBreadCrumb->addLink(_AM_SYSTEM_MODULES_UPDATE); |
||||
501 | $xoBreadCrumb->addHelp(system_adminVersion('modulesadmin', 'help') . '#update'); |
||||
502 | $xoBreadCrumb->render(); |
||||
503 | if (count($ret) > 0) { |
||||
504 | foreach ($ret as $msg) { |
||||
505 | if ($msg != '') { |
||||
506 | echo $msg; |
||||
507 | } |
||||
508 | } |
||||
509 | } |
||||
510 | xoops_module_delayed_clean_cache(); |
||||
511 | // Call Footer |
||||
512 | xoops_cp_footer(); |
||||
513 | break; |
||||
514 | } |
||||
515 |