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 | * @since |
||||
17 | * @author XOOPS Development Team |
||||
18 | */ |
||||
19 | if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) |
||||
20 | || !$GLOBALS['xoopsUser']->isAdmin()) { |
||||
21 | exit('Restricted access' . PHP_EOL); |
||||
22 | } |
||||
23 | |||||
24 | require_once dirname(__DIR__) . '/preloads/autoloader.php'; |
||||
25 | |||||
26 | /** |
||||
27 | * @param string $tablename |
||||
28 | * |
||||
29 | * @return bool |
||||
30 | */ |
||||
31 | function tableExists($tablename) |
||||
32 | { |
||||
33 | $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); |
||||
34 | |||||
35 | return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; |
||||
36 | } |
||||
37 | |||||
38 | /** |
||||
39 | * Prepares system prior to attempting to install module |
||||
40 | * @param \XoopsModule $module {@link XoopsModule} |
||||
41 | * |
||||
42 | * @return bool true if ready to install, false if not |
||||
43 | */ |
||||
44 | function xoops_module_pre_update_newbb(\XoopsModule $module) |
||||
45 | { |
||||
46 | $moduleDirName = basename(dirname(__DIR__)); |
||||
0 ignored issues
–
show
Unused Code
introduced
by
![]() |
|||||
47 | |||||
48 | /** @var \XoopsModules\Newbb\Utility $utility */ |
||||
49 | $utility = new \XoopsModules\Newbb\Utility(); |
||||
50 | /** @var \XoopsModules\Newbb\Common\Configurator $configurator */ |
||||
51 | $configurator = new \XoopsModules\Newbb\Common\Configurator(); |
||||
52 | |||||
53 | $xoopsSuccess = $utility::checkVerXoops($module); |
||||
54 | $phpSuccess = $utility::checkVerPhp($module); |
||||
55 | |||||
56 | $migrator = new \XoopsModules\Newbb\Common\Migrate($configurator); |
||||
57 | $migrator->synchronizeSchema(); |
||||
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
|
|||||
66 | * |
||||
67 | * @return bool true if update successful, false if not |
||||
68 | */ |
||||
69 | function xoops_module_update_newbb(\XoopsModule $module, $previousVersion = null) |
||||
70 | { |
||||
71 | $moduleDirName = basename(dirname(__DIR__)); |
||||
72 | $moduleDirNameUpper = mb_strtoupper($moduleDirName); |
||||
0 ignored issues
–
show
|
|||||
73 | |||||
74 | /** @var \XoopsModules\Newbb\Helper $helper */ /** @var \XoopsModules\Newbb\Utility $utility */ |
||||
75 | /** @var \XoopsModules\Newbb\Common\Configurator $configurator */ |
||||
76 | $helper = \XoopsModules\Newbb\Helper::getInstance(); |
||||
0 ignored issues
–
show
|
|||||
77 | $utility = new \XoopsModules\Newbb\Utility(); |
||||
78 | $configurator = new \XoopsModules\Newbb\Common\Configurator(); |
||||
79 | |||||
80 | if ($previousVersion < 510) { |
||||
81 | //delete old HTML templates |
||||
82 | if (count($configurator->templateFolders) > 0) { |
||||
83 | foreach ($configurator->templateFolders as $folder) { |
||||
84 | $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); |
||||
85 | if (is_dir($templateFolder)) { |
||||
86 | $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); |
||||
0 ignored issues
–
show
It seems like
scandir($templateFolder, SCANDIR_SORT_NONE) can also be of type false ; however, parameter $array1 of array_diff() does only seem to accept array , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
87 | foreach ($templateList as $k => $v) { |
||||
88 | $fileInfo = new \SplFileInfo($templateFolder . $v); |
||||
89 | if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { |
||||
90 | if (is_file($templateFolder . $v)) { |
||||
91 | unlink($templateFolder . $v); |
||||
92 | } |
||||
93 | } |
||||
94 | } |
||||
95 | } |
||||
96 | } |
||||
97 | } |
||||
98 | |||||
99 | // --- DELETE OLD FILES --------------- |
||||
100 | if (count($configurator->oldFiles) > 0) { |
||||
101 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
102 | foreach (array_keys($configurator->oldFiles) as $i) { |
||||
103 | $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); |
||||
104 | if (is_file($tempFile)) { |
||||
105 | unlink($tempFile); |
||||
106 | } |
||||
107 | } |
||||
108 | } |
||||
109 | |||||
110 | // --- DELETE OLD FOLDERS --------------- |
||||
111 | xoops_load('XoopsFile'); |
||||
112 | if (count($configurator->oldFolders) > 0) { |
||||
113 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
114 | foreach (array_keys($configurator->oldFolders) as $i) { |
||||
115 | $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); |
||||
116 | /* @var \XoopsObjectHandler $folderHandler */ |
||||
117 | $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); |
||||
118 | $folderHandler->delete($tempFolder); |
||||
119 | } |
||||
120 | } |
||||
121 | |||||
122 | // --- CREATE FOLDERS --------------- |
||||
123 | if (count($configurator->uploadFolders) > 0) { |
||||
124 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||||
125 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||||
126 | $utility::createFolder($configurator->uploadFolders[$i]); |
||||
127 | } |
||||
128 | } |
||||
129 | |||||
130 | // --- COPY blank.png FILES --------------- |
||||
131 | if (count($configurator->copyBlankFiles) > 0) { |
||||
132 | $file = dirname(__DIR__) . '/assets/images/blank.png'; |
||||
133 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||||
134 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||||
135 | $utility::copyFile($file, $dest); |
||||
136 | } |
||||
137 | } |
||||
138 | |||||
139 | //delete .html entries from the tpl table |
||||
140 | $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; |
||||
141 | $GLOBALS['xoopsDB']->queryF($sql); |
||||
142 | |||||
143 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
144 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
145 | |||||
146 | return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); |
||||
147 | } |
||||
148 | |||||
149 | return true; |
||||
150 | } |
||||
151 |