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 | * 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 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
15 | * @package |
||
16 | * @author XOOPS Development Team |
||
17 | */ |
||
18 | |||
19 | use XoopsModules\About\{ |
||
20 | Helper, |
||
21 | Utility, |
||
22 | Common\Configurator |
||
23 | }; |
||
24 | |||
25 | /** @var Helper $helper */ |
||
26 | /** @var Utility $utility */ |
||
27 | /** @var Configurator $configurator */ |
||
28 | |||
29 | if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
||
30 | || !$GLOBALS['xoopsUser']->isAdmin()) { |
||
31 | exit('Restricted access' . PHP_EOL); |
||
32 | } |
||
33 | |||
34 | /** |
||
35 | * @param string $tablename |
||
36 | * |
||
37 | * @return bool |
||
38 | */ |
||
39 | function tableExists($tablename) |
||
40 | { |
||
41 | $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); |
||
42 | |||
43 | return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
||
44 | } |
||
45 | |||
46 | /** |
||
47 | * Prepares system prior to attempting to install module |
||
48 | * @param \XoopsModule $module {@link XoopsModule} |
||
49 | * |
||
50 | * @return bool true if ready to install, false if not |
||
51 | */ |
||
52 | function xoops_module_pre_update_about(\XoopsModule $module) |
||
53 | { |
||
54 | $utility = new Utility(); |
||
55 | |||
56 | $xoopsSuccess = $utility::checkVerXoops($module); |
||
57 | $phpSuccess = $utility::checkVerPhp($module); |
||
58 | |||
59 | return $xoopsSuccess && $phpSuccess; |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * Performs tasks required during update of the module |
||
64 | * @param \XoopsModule $module {@link XoopsModule} |
||
65 | * @param null $previousVersion |
||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||
66 | * |
||
67 | * @return bool true if update successful, false if not |
||
68 | */ |
||
69 | function xoops_module_update_about(\XoopsModule $module, $previousVersion = null) |
||
70 | { |
||
71 | $moduleDirName = basename(dirname(__DIR__)); |
||
72 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||
0 ignored issues
–
show
|
|||
73 | |||
74 | |||
75 | $helper = Helper::getInstance(); |
||
0 ignored issues
–
show
|
|||
76 | $utility = new Utility(); |
||
77 | $configurator = new Configurator(); |
||
78 | |||
79 | if ($previousVersion < 240) { |
||
80 | //delete old HTML templates |
||
81 | if (count($configurator->templateFolders) > 0) { |
||
82 | foreach ($configurator->templateFolders as $folder) { |
||
83 | $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
||
84 | if (is_dir($templateFolder)) { |
||
85 | $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
||
86 | foreach ($templateList as $k => $v) { |
||
87 | $fileInfo = new \SplFileInfo($templateFolder . $v); |
||
88 | if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
||
89 | if (is_file($templateFolder . $v)) { |
||
90 | unlink($templateFolder . $v); |
||
91 | } |
||
92 | } |
||
93 | } |
||
94 | } |
||
95 | } |
||
96 | } |
||
97 | |||
98 | // --- DELETE OLD FILES --------------- |
||
99 | if (count($configurator->oldFiles) > 0) { |
||
100 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||
101 | foreach (array_keys($configurator->oldFiles) as $i) { |
||
102 | $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
||
103 | if (is_file($tempFile)) { |
||
104 | unlink($tempFile); |
||
105 | } |
||
106 | } |
||
107 | } |
||
108 | |||
109 | // --- DELETE OLD FOLDERS --------------- |
||
110 | xoops_load('XoopsFile'); |
||
111 | if (count($configurator->oldFolders) > 0) { |
||
112 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||
113 | foreach (array_keys($configurator->oldFolders) as $i) { |
||
114 | $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
||
115 | /* @var XoopsObjectHandler $folderHandler */ |
||
116 | $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); |
||
117 | $folderHandler->delete($tempFolder); |
||
118 | } |
||
119 | } |
||
120 | |||
121 | // --- CREATE FOLDERS --------------- |
||
122 | if (count($configurator->uploadFolders) > 0) { |
||
123 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||
124 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||
125 | $utility::createFolder($configurator->uploadFolders[$i]); |
||
126 | } |
||
127 | } |
||
128 | |||
129 | // --- COPY blank.png FILES --------------- |
||
130 | if (count($configurator->copyBlankFiles) > 0) { |
||
131 | $file = dirname(__DIR__) . '/assets/images/blank.png'; |
||
132 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||
133 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||
134 | $utility::copyFile($file, $dest); |
||
135 | } |
||
136 | } |
||
137 | |||
138 | //delete .html entries from the tpl table |
||
139 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
||
140 | $GLOBALS['xoopsDB']->queryF($sql); |
||
141 | |||
142 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||
143 | $grouppermHandler = xoops_getHandler('groupperm'); |
||
144 | |||
145 | return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
||
146 | } |
||
147 | |||
148 | return true; |
||
149 | } |
||
150 |