Issues (212)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

include/oninstall.php (7 issues)

Upgrade to new PHP Analysis Engine

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
$utility 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 $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.

Loading history...
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 $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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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.

Loading history...
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
The variable $xoopsDB does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
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