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 {@link https://xoops.org/ XOOPS Project} |
||||
14 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
15 | * @package extcal |
||||
16 | * @since |
||||
17 | * @author XOOPS Development Team, |
||||
18 | */ |
||||
19 | |||||
20 | use XoopsModules\Extcal\{Helper, |
||||
21 | Utility, |
||||
22 | Common |
||||
23 | }; |
||||
24 | |||||
25 | if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
||||
26 | || !$GLOBALS['xoopsUser']->isAdmin()) { |
||||
27 | exit('Restricted access' . PHP_EOL); |
||||
28 | } |
||||
29 | |||||
30 | |||||
31 | |||||
32 | /** |
||||
33 | * Prepares system prior to attempting to install module |
||||
34 | * @param \XoopsModule $module {@link XoopsModule} |
||||
35 | * |
||||
36 | * @return bool true if ready to install, false if not |
||||
37 | */ |
||||
38 | function xoops_module_pre_update_extcal(\XoopsModule $module) |
||||
39 | { |
||||
40 | $utility = new Utility(); |
||||
41 | |||||
42 | $xoopsSuccess = $utility::checkVerXoops($module); |
||||
43 | $phpSuccess = $utility::checkVerPhp($module); |
||||
44 | |||||
45 | return $xoopsSuccess && $phpSuccess; |
||||
46 | |||||
47 | /* |
||||
48 | |||||
49 | // XoopsLoad::load('migrate', 'extcal'); |
||||
50 | $configurator = new Common\Configurator(); |
||||
51 | |||||
52 | //create upload folders |
||||
53 | $uploadFolders = $configurator->uploadFolders; |
||||
54 | foreach ($uploadFolders as $value) { |
||||
55 | $utility::prepareFolder($value); |
||||
56 | } |
||||
57 | |||||
58 | $migrator = new Common\Migrate($configurator); |
||||
59 | $migrator->synchronizeSchema(); |
||||
60 | |||||
61 | return true; |
||||
62 | */ |
||||
63 | } |
||||
64 | |||||
65 | /** |
||||
66 | * Performs tasks required during update of the module |
||||
67 | * @param \XoopsModule $module {@link XoopsModule} |
||||
68 | * @param null $previousVersion |
||||
0 ignored issues
–
show
Documentation
Bug
introduced
by
![]() |
|||||
69 | * |
||||
70 | * @return bool true if update successful, false if not |
||||
71 | */ |
||||
72 | function xoops_module_update_extcal(\XoopsModule $module, $previousVersion = null) |
||||
73 | { |
||||
74 | // global $xoopsDB; |
||||
75 | $moduleDirName = basename(dirname(__DIR__)); |
||||
76 | |||||
77 | $newVersion = $module->getVar('version') * 100; |
||||
78 | if ($newVersion == $previousVersion) { |
||||
79 | return true; |
||||
80 | } |
||||
81 | |||||
82 | $fld = XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/versions/'; |
||||
83 | $cls = 'Extcal_%1$s'; |
||||
84 | |||||
85 | $version = [ |
||||
86 | '2_04' => 204, |
||||
87 | '2_15' => 215, |
||||
88 | '2_21' => 221, |
||||
89 | '2_28' => 228, |
||||
90 | '2_29' => 229, |
||||
91 | '2_33' => 233, |
||||
92 | '2_34' => 234, |
||||
93 | '2_35' => 235, |
||||
94 | '2_37' => 237, |
||||
95 | ]; |
||||
96 | |||||
97 | // while (list($key, $val) = each($version)) { |
||||
98 | foreach ($version as $key => $val) { |
||||
99 | if ($previousVersion < $val) { |
||||
100 | $name = sprintf($cls, $key); |
||||
101 | $f = $fld . $name . '.php'; |
||||
102 | //ext_echo ("<hr>{$f}<hr>"); |
||||
103 | if (is_readable($f)) { |
||||
104 | echo "update version: {$key} = {$val}<br>"; |
||||
105 | require_once $f; |
||||
106 | $cl = new $name($module, ['previousVersion' => $previousVersion]); |
||||
0 ignored issues
–
show
|
|||||
107 | } |
||||
108 | } |
||||
109 | } |
||||
110 | |||||
111 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||||
0 ignored issues
–
show
|
|||||
112 | |||||
113 | /** @var Utility $utility */ |
||||
114 | /** @var Common\Configurator $configurator */ |
||||
115 | $utility = new Utility(); |
||||
116 | $configurator = new Common\Configurator(); |
||||
117 | |||||
118 | $migrator = new Common\Migrate($configurator); |
||||
0 ignored issues
–
show
The call to
XoopsModules\Extcal\Common\Migrate::__construct() has too many arguments starting with $configurator .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue. If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above. ![]() |
|||||
119 | $migrator->synchronizeSchema(); |
||||
120 | |||||
121 | if ($previousVersion < 241) { |
||||
122 | //delete old HTML templates |
||||
123 | if (count($configurator->templateFolders) > 0) { |
||||
124 | foreach ($configurator->templateFolders as $folder) { |
||||
125 | $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
||||
126 | if (is_dir($templateFolder)) { |
||||
127 | $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
||||
128 | foreach ($templateList as $k => $v) { |
||||
129 | $fileInfo = new \SplFileInfo($templateFolder . $v); |
||||
130 | if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
||||
131 | if (is_file($templateFolder . $v)) { |
||||
132 | unlink($templateFolder . $v); |
||||
133 | } |
||||
134 | } |
||||
135 | } |
||||
136 | } |
||||
137 | } |
||||
138 | } |
||||
139 | |||||
140 | // --- COPY blank.png FILES --------------- |
||||
141 | if (count($configurator->copyBlankFiles) > 0) { |
||||
142 | $file = dirname(__DIR__) . '/assets/images/blank.png'; |
||||
143 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||||
144 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||||
145 | $utility::copyFile($file, $dest); |
||||
146 | } |
||||
147 | } |
||||
148 | |||||
149 | // --- DELETE OLD FILES --------------- |
||||
150 | if (count($configurator->oldFiles) > 0) { |
||||
151 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
152 | foreach (array_keys($configurator->oldFiles) as $i) { |
||||
153 | $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
||||
154 | if (is_file($tempFile)) { |
||||
155 | unlink($tempFile); |
||||
156 | } |
||||
157 | } |
||||
158 | } |
||||
159 | |||||
160 | //--------------------- |
||||
161 | |||||
162 | //delete .html entries from the tpl table |
||||
163 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
||||
164 | $GLOBALS['xoopsDB']->queryF($sql); |
||||
165 | |||||
166 | // Load class XoopsFile ==================== |
||||
167 | xoops_load('XoopsFile'); |
||||
168 | |||||
169 | //delete /images directory ============ |
||||
170 | $imagesDirectory = $GLOBALS['xoops']->path('modules/' . $module->getVar('dirname', 'n') . '/images/'); |
||||
171 | $folderHandler = \XoopsFile::getHandler('folder', $imagesDirectory); |
||||
172 | $folderHandler->delete($imagesDirectory); |
||||
173 | } |
||||
174 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
175 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
176 | |||||
177 | return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
||||
178 | } |
||||
179 |