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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
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 (http://www.gnu.org/licenses/gpl-2.0.html) |
||
15 | * @package |
||
16 | * @since |
||
17 | * @author XOOPS Development Team |
||
18 | */ |
||
19 | |||
20 | //require_once __DIR__ . '/setup.php'; |
||
21 | |||
22 | /** |
||
23 | * |
||
24 | * Prepares system prior to attempting to install module |
||
25 | * @param XoopsModule $module {@link XoopsModule} |
||
26 | * |
||
27 | * @return bool true if ready to install, false if not |
||
28 | */ |
||
29 | function xoops_module_pre_install_planet(\XoopsModule $module) |
||
30 | { |
||
31 | include __DIR__ . '/../preloads/autoloader.php'; |
||
32 | /** @var \Utility $utility */ |
||
33 | $utility = new \XoopsModules\Planet\Utility(); |
||
34 | $xoopsSuccess = $utility::checkVerXoops($module); |
||
35 | $phpSuccess = $utility::checkVerPhp($module); |
||
36 | |||
37 | if (false !== $xoopsSuccess && false !== $phpSuccess) { |
||
38 | $moduleTables =& $module->getInfo('tables'); |
||
39 | foreach ($moduleTables as $table) { |
||
40 | $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | return $xoopsSuccess && $phpSuccess; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * |
||
49 | * Performs tasks required during installation of the module |
||
50 | * @param XoopsModule $module {@link XoopsModule} |
||
51 | * |
||
52 | * @return bool true if installation successful, false if not |
||
53 | */ |
||
54 | function xoops_module_install_planet(\XoopsModule $module) |
||
55 | { |
||
56 | require_once __DIR__ . '/../../../mainfile.php'; |
||
57 | require_once __DIR__ . '/../include/config.php'; |
||
58 | |||
59 | $moduleDirName = basename(dirname(__DIR__)); |
||
60 | |||
61 | $helper = Planet\Helper::getInstance(); |
||
62 | $utility = new Planet\Utility(); |
||
0 ignored issues
–
show
|
|||
63 | $configurator = new Planet\Configurator(); |
||
64 | // Load language files |
||
65 | $helper->loadLanguage('admin'); |
||
66 | $helper->loadLanguage('modinfo'); |
||
67 | |||
68 | // default Permission Settings ---------------------- |
||
69 | global $xoopsModule; |
||
70 | $moduleId = $xoopsModule->getVar('mid'); |
||
71 | $moduleId2 = $helper->getModule()->mid(); |
||
0 ignored issues
–
show
$moduleId2 is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
72 | $gpermHandler = xoops_getHandler('groupperm'); |
||
73 | // access rights ------------------------------------------ |
||
74 | $gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||
75 | $gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||
76 | $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); |
||
77 | $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); |
||
78 | $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); |
||
79 | |||
80 | // --- CREATE FOLDERS --------------- |
||
81 | View Code Duplication | if (count($configurator->uploadFolders) > 0) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
82 | // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { |
||
83 | foreach (array_keys($configurator->uploadFolders) as $i) { |
||
84 | $utilityClass::createFolder($configurator->uploadFolders[$i]); |
||
0 ignored issues
–
show
The variable
$utilityClass does not exist. Did you mean $utility ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
85 | } |
||
86 | } |
||
87 | |||
88 | // --- COPY blank.png FILES --------------- |
||
89 | View Code Duplication | if (count($configurator->copyBlankFiles) > 0) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
90 | $file = __DIR__ . '/../assets/images/blank.png'; |
||
91 | foreach (array_keys($configurator->copyBlankFiles) as $i) { |
||
92 | $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; |
||
93 | $utilityClass::copyFile($file, $dest); |
||
0 ignored issues
–
show
The variable
$utilityClass does not exist. Did you mean $utility ?
This check looks for variables that are accessed but have not been defined. It raises an issue if it finds another variable that has a similar name. The variable may have been renamed without also renaming all references. ![]() |
|||
94 | } |
||
95 | } |
||
96 | //delete .html entries from the tpl table |
||
97 | $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; |
||
0 ignored issues
–
show
|
|||
98 | $xoopsDB->queryF($sql); |
||
99 | |||
100 | return true; |
||
101 | } |
||
102 | |||
103 | //====================================================== |
||
104 | |||
105 | $indexFile = 'index.html'; |
||
106 | $blankFile = $GLOBALS['xoops']->path('modules/randomquote/assets/images/icons/blank.gif'); |
||
107 | |||
108 | //Creation du dossier "uploads" pour le module à la racine du site |
||
109 | $module_uploads = $GLOBALS['xoops']->path('uploads/randomquote'); |
||
110 | if (!is_dir($module_uploads)) { |
||
111 | mkdir($module_uploads, 0777); |
||
112 | } |
||
113 | chmod($module_uploads, 0777); |
||
114 | copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/index.html')); |
||
115 | |||
116 | //Creation du fichier citas dans uploads |
||
117 | $module_uploads = $GLOBALS['xoops']->path('uploads/randomquote/citas'); |
||
118 | if (!is_dir($module_uploads)) { |
||
119 | mkdir($module_uploads, 0777); |
||
120 | } |
||
121 | chmod($module_uploads, 0777); |
||
122 | copy($indexFile, $GLOBALS['xoops']->path('uploads/randomquote/citas/index.html')); |
||
123 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.