Issues (519)

Security Analysis    not enabled

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

  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.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  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.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  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.
  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.
  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.
  Header Injection
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.

class/Building.php (3 issues)

1
<?php namespace XoopsModules\Tdmcreate;
2
3
use XoopsModules\Tdmcreate;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 */
14
15
/**
16
 * Building class.
17
 *
18
 * @copyright       XOOPS Project (https://xoops.org)
19
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
20
 *
21
 * @since           2.5.x
22
 *
23
 * @author          TDM TEAM DEV MODULE
24
 *
25
 * @version         $Id: building.php 12425 2014-02-23 22:40:09Z timgno $
26
 */
27
28
/**
29
 * Class Building.
30
 */
31
class Building
32
{
33
    /**
34
     *  @static function getInstance
35
     *
36
     *  @param null
37
     *
38
     * @return Building
39
     */
40
    public static function getInstance()
41
    {
42
        static $instance = false;
43
        if (!$instance) {
44
            $instance = new self();
45
        }
46
47
        return $instance;
48
    }
49
50
    /**
51
     * @param bool $action
52
     *
53
     * @return \XoopsThemeForm
54
     */
55
    public function getForm($action = false)
56
    {
57
        $tc = Tdmcreate\Helper::getInstance();
58
        if (false === $action) {
59
            $action = $_SERVER['REQUEST_URI'];
60
        }
61
        xoops_load('XoopsFormLoader');
62
        $form = new \XoopsThemeForm(_AM_TDMCREATE_ADMIN_CONST, 'buildform', $action, 'post', true);
63
        $form->setExtra('enctype="multipart/form-data"');
64
        $moduleObj = $tc->getHandler('modules')->getObjects(null);
0 ignored issues
show
The method getObjects() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of said class. However, the method does not exist in XoopsRankHandler or XoUserHandler. Are you sure you never get one of those? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

64
        $moduleObj = $tc->getHandler('modules')->/** @scrutinizer ignore-call */ getObjects(null);
Loading history...
65
        $mod_select = new \XoopsFormSelect(_AM_TDMCREATE_CONST_MODULES, 'mod_id', 'mod_id');
66
        $mod_select->addOption('', _AM_TDMCREATE_BUILD_MODSELOPT);
67
        foreach ($moduleObj as $mod) {
68
            $mod_select->addOption($mod->getVar('mod_id'), $mod->getVar('mod_name'));
69
        }
70
        $form->addElement($mod_select, true);
71
72
        $form->addElement(new \XoopsFormHidden('op', 'build'));
73
        $form->addElement(new \XoopsFormButton(_REQUIRED . ' <sup class="red bold">*</sup>', 'submit', _SUBMIT, 'submit'));
74
75
        return $form;
76
    }
77
78
    /**
79
     * @param string $dir
80
     * @param string $pattern
81
     */
82
    public function clearDir($dir, $pattern = '*')
83
    {
84
        // Find all files and folders matching pattern
85
        $files = glob($dir . "/$pattern");
86
        // Interate thorugh the files and folders
87
        foreach ($files as $file) {
88
            // if it's a directory then re-call clearDir function to delete files inside this directory
89
            if (is_dir($file) && !in_array($file, ['..', '.'])) {
90
                // Remove the directory itself
91
                $this->clearDir($file, $pattern);
92
            } elseif ((__FILE__ != $file) && is_file($file)) {
93
                // Make sure you don't delete the current script
94
                unlink($file);
95
            }
96
        }
97
        rmdir($dir);
98
    }
99
100
    /**
101
     * @param string $src
102
     * @param string $dst
103
     */
104
    public function copyDir($src, $dst)
105
    {
106
        $dir = opendir($src);
107
        if (!mkdir($dst) && !is_dir($dst)) {
108
            throw new \RuntimeException(sprintf('Directory "%s" was not created', $dst));
109
        }
110
        while (false !== ($file = readdir($dir))) {
0 ignored issues
show
It seems like $dir can also be of type false; however, parameter $dir_handle of readdir() does only seem to accept resource, 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 ignore-type  annotation

110
        while (false !== ($file = readdir(/** @scrutinizer ignore-type */ $dir))) {
Loading history...
111
            if (('.' !== $file) && ('..' !== $file)) {
112
                if (is_dir($src . '/' . $file)) {
113
                    // Copy the directory itself
114
                    $this->copyDir($src . '/' . $file, $dst . '/' . $file);
115
                } else {
116
                    // Make sure you copy the current script
117
                    copy($src . '/' . $file, $dst . '/' . $file);
118
                }
119
            }
120
        }
121
        closedir($dir);
0 ignored issues
show
It seems like $dir can also be of type false; however, parameter $dir_handle of closedir() does only seem to accept resource, 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 ignore-type  annotation

121
        closedir(/** @scrutinizer ignore-type */ $dir);
Loading history...
122
    }
123
}
124