Issues (314)

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/Files/Language/LanguageBlocks.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace XoopsModules\Modulebuilder\Files\Language;
4
5
use XoopsModules\Modulebuilder;
6
use XoopsModules\Modulebuilder\Files;
7
8
/*
9
 You may not change or alter any portion of this comment or credits
10
 of supporting developers from this source code or any supporting source code
11
 which is considered copyrighted (c) material of the original comment or credit authors.
12
13
 This program is distributed in the hope that it will be useful,
14
 but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16
 */
17
/**
18
 * modulebuilder module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops https://xoops.org 
26
 *                  Goffy https://myxoops.org
27
 *
28
 */
29
30
/**
31
 * Class LanguageBlocks.
32
 */
33
class LanguageBlocks extends Files\CreateFile
34
{
35
    /**
36
     * @var mixed
37
     */
38
    private $ld = null;
39
40
    /**
41
     * @public function constructor
42
     * @param null
43
     */
44
    public function __construct()
45
    {
46
        parent::__construct();
47
        $this->ld = LanguageDefines::getInstance();
48
    }
49
50
    /**
51
     * @static function getInstance
52
     * @param null
53
     * @return LanguageBlocks
54
     */
55
    public static function getInstance()
56
    {
57
        static $instance = false;
58
        if (!$instance) {
59
            $instance = new self();
60
        }
61
62
        return $instance;
63
    }
64
65
    /**
66
     * @public function write
67
     * @param string $module
68
     * @param mixed  $tables
69
     * @param string $filename
70
     */
71
    public function write($module, $tables, $filename)
72
    {
73
        $this->setModule($module);
74
        $this->setFileName($filename);
75
        $this->setTables($tables);
76
    }
77
78
    /**
79
     * @private function getLanguageBlock
80
     * @param string $language
81
     *
82
     * @return string
83
     */
84
    private function getLanguageBlock($language)
85
    {
86
        $tables = $this->getTables();
87
        $ret    = $this->ld->getAboveDefines('Admin Edit');
88
        $ret    .= $this->ld->getDefine($language, 'DISPLAY', 'How Many Items to Display');
89
        $ret    .= $this->ld->getDefine($language, 'DISPLAY_SPOTLIGHT', "How Many Items to Display (only valid if you select 'all')", true);
90
        $ret    .= $this->ld->getDefine($language, 'TITLE_LENGTH', 'Title Length');
91
        $ret    .= $this->ld->getDefine($language, 'CATTODISPLAY', 'Categories to Display');
92
        $ret    .= $this->ld->getDefine($language, 'ALLCAT', 'All Categories');
93
        foreach (\array_keys($tables) as $t) {
94
            if (1 === (int)$tables[$t]->getVar('table_blocks')) {
95
                $tableName        = $tables[$t]->getVar('table_name');
96
                $tableSoleName    = $tables[$t]->getVar('table_solename');
97
                $ucfTableName     = \ucfirst($tableName);
98
                $ucfTableSoleName = \ucfirst($tableSoleName);
99
                $stuTableName     = \mb_strtoupper($tableName);
100
                $stuTableSoleName = \mb_strtoupper($tableSoleName);
101
                $ret .= $this->ld->getAboveDefines($ucfTableName);
102
                $fields = $this->getTableFields($tables[$t]->getVar('table_mid'), $tables[$t]->getVar('table_id'));
103
                $ret .= $this->ld->getDefine($language, $stuTableName . '_TO_DISPLAY', $ucfTableName . ' to Display');
104
                $ret .= $this->ld->getDefine($language, 'ALL_' . $stuTableName, 'All ' . $ucfTableName);
105
                foreach (\array_keys($fields) as $f) {
106
                    if (1 === (int)$fields[$f]->getVar('field_block')) {
107
                        $fieldName = $fields[$f]->getVar('field_name');
108
                        $stuFieldName = \mb_strtoupper($fieldName);
109
                        $rpFieldName = $this->getRightString($fieldName);
110
                        $fieldNameDesc = \ucfirst($rpFieldName);
111
                        $ret .= $this->ld->getDefine($language, $stuFieldName, $fieldNameDesc);
112
                    }
113
                }
114
                $ret .= $this->ld->getDefine($language, $stuTableSoleName . '_GOTO', 'Goto ' . $ucfTableSoleName);
115
            }
116
        }
117
118
        return $ret;
119
    }
120
121
    /**
122
     * @private function getFooter
123
     * @param null
124
     * @return string
125
     */
126
    private function getLanguageFooter()
127
    {
128
        $ret = $this->ld->getBelowDefines('End');
129
        $ret .= $this->ld->getBlankLine();
130
131
        return $ret;
132
    }
133
134
    /**
135
     * @public function render
136
     * @param null
137
     * @return bool|string
138
     */
139
    public function render()
140
    {
141
        $module        = $this->getModule();
142
        $filename      = $this->getFileName();
143
        $moduleDirname = $module->getVar('mod_dirname');
144
        $language      = $this->getLanguage($moduleDirname, 'MB', '', false);
0 ignored issues
show
false of type false is incompatible with the type string expected by parameter $addFq of XoopsModules\Modulebuild...eateFile::getLanguage(). ( Ignorable by Annotation )

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

144
        $language      = $this->getLanguage($moduleDirname, 'MB', '', /** @scrutinizer ignore-type */ false);
Loading history...
145
        $content       = $this->getHeaderFilesComments($module);
146
        $content       .= $this->getLanguageBlock($language);
147
        $content       .= $this->getLanguageFooter();
148
149
        $this->create($moduleDirname, 'language/' . $GLOBALS['xoopsConfig']['language'], $filename, $content, \_AM_MODULEBUILDER_FILE_CREATED, \_AM_MODULEBUILDER_FILE_NOTCREATED);
150
151
        return $this->renderFile();
152
    }
153
}
154