Issues (964)

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/User/UserRss.php (8 issues)

1
<?php
2
3
namespace XoopsModules\Tdmcreate\Files\User;
4
5
use XoopsModules\Tdmcreate;
6
use XoopsModules\Tdmcreate\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
 * tdmcreate module.
19
 *
20
 * @copyright       XOOPS Project (https://xoops.org)
21
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
22
 *
23
 * @since           2.5.0
24
 *
25
 * @author          Txmod Xoops http://www.txmodxoops.org
26
 *
27
 */
28
29
/**
30
 * Class UserRss.
31
 */
32
class UserRss extends Files\CreateFile
33
{
34
    /**
35
     * @var mixed
36
     */
37
    private $uxc = null;
38
39
    /**
40
     * @var string
41
     */
42
    private $xc = null;
43
44
    /**
45
     * @var string
46
     */
47
    private $pc = null;
48
49
    /**
50
     * @public function constructor
51
     * @param null
52
     */
53
    public function __construct()
54
    {
55
        parent::__construct();
56
        $this->xc = Tdmcreate\Files\CreateXoopsCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...oopsCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreateXoopsCode is incompatible with the declared type string of property $xc.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
57
        $this->pc   = Tdmcreate\Files\CreatePhpCode::getInstance();
0 ignored issues
show
Documentation Bug introduced by
It seems like XoopsModules\Tdmcreate\F...ePhpCode::getInstance() of type XoopsModules\Tdmcreate\Files\CreatePhpCode is incompatible with the declared type string of property $pc.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
58
        $this->uxc  = UserXoopsCode::getInstance();
59
    }
60
61
    /**
62
     * @static function getInstance
63
     * @param null
64
     * @return UserRss
65
     */
66
    public static function getInstance()
67
    {
68
        static $instance = false;
69
        if (!$instance) {
70
            $instance = new self();
71
        }
72
73
        return $instance;
74
    }
75
76
    /**
77
     * @public function write
78
     * @param string $module
79
     * @param mixed  $table
80
     * @param string $filename
81
     */
82
    public function write($module, $table, $filename)
83
    {
84
        $this->setModule($module);
85
        $this->setTable($table);
86
        $this->setFileName($filename);
87
    }
88
89
    /**
90
     * @public function getUserRss
91
     * @param string $moduleDirname
92
     * @return string
93
     */
94
    public function getUserRss($moduleDirname)
95
    {
96
        $pc        = Tdmcreate\Files\CreatePhpCode::getInstance();
97
        $table     = $this->getTable();
98
        $tableName = $table->getVar('table_name');
99
        $fields    = $this->getTableFields($table->getVar('table_mid'), $table->getVar('table_id'));
100
        foreach (array_keys($fields) as $f) {
101
            $fieldName     = $fields[$f]->getVar('field_name');
102
            $fieldMain[]   = $fields[$f]->getVar('field_main');
103
            $fieldParent[] = $fields[$f]->getVar('field_parent');
104
105
            if (0 == $f) {
106
                $fieldId = $fieldName;
107
            }
108
            if (in_array(1, $fieldMain)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldMain seems to be defined later in this foreach loop on line 102. Are you sure it is defined here?
Loading history...
109
                $fpmf = $fieldName;
110
            }
111
            if (in_array(1, $fieldParent)) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldParent seems to be defined later in this foreach loop on line 103. Are you sure it is defined here?
Loading history...
112
                $fppf = $fieldName;
113
            } else {
114
                $fppf = 'cid';
115
            }
116
        }
117
118
        $ret = $pc->getPhpCodeUseNamespace(['Xmf', 'Request']);
119
        $ret .= $this->getInclude();
120
121
        $ret .= <<<EOT
122
123
\${$fppf} = Request::getInt('{$fppf}', 0, 'GET');
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fppf seems to be defined by a foreach iteration on line 100. Are you sure the iterator is never empty, otherwise this variable is not defined?
Loading history...
124
include_once XOOPS_ROOT_PATH.'/class/template.php';
125
if (function_exists('mb_http_output')) {
126
    mb_http_output('pass');
127
}
128
//header ('Content-Type:text/xml; charset=UTF-8');
129
\$xoopsModuleConfig['utf8'] = false;
130
131
\$tpl = new \XoopsTpl();
132
\$tpl->xoops_setCaching(2); //1 = Cache global, 2 = Cache individual (for template)
133
\$tpl->xoops_setCacheTime(\$helper->getConfig('timecacherss')*60); // Time of the cache on seconds
134
\$categories = {$moduleDirname}MyGetItemIds('{$moduleDirname}_view', '{$moduleDirname}');
135
\$criteria = new \CriteriaCompo();
136
137
\$criteria->add(new \Criteria('cat_status', 0, '!='));
138
\$criteria->add(new \Criteria('{$fppf}', '(' . implode(',', \$categories) . ')','IN'));
139
if (\${$fppf} != 0){
140
    \$criteria->add(new \Criteria('{$fppf}', \${$fppf}));
141
    \${$tableName} = \${$tableName}Handler->get(\${$fppf});
142
    \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name') . ' - ' . \${$tableName}->getVar('{$fpmf}');
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fpmf does not seem to be defined for all execution paths leading up to this point.
Loading history...
143
} else {
144
    \$title = \$xoopsConfig['sitename'] . ' - ' . \$xoopsModule->getVar('name');
145
}
146
\$criteria->setLimit(\$helper->getConfig('perpagerss'));
147
\$criteria->setSort('date');
148
\$criteria->setOrder('DESC');
149
\${$tableName}Arr = \${$tableName}Handler->getAll(\$criteria);
150
unset(\$criteria);
151
152
if (!\$tpl->is_cached('db:{$moduleDirname}_rss.tpl', \${$fppf})) {
153
    \$tpl->assign('channel_title', htmlspecialchars(\$title, ENT_QUOTES));
154
    \$tpl->assign('channel_link', XOOPS_URL.'/');
155
    \$tpl->assign('channel_desc', htmlspecialchars(\$xoopsConfig['slogan'], ENT_QUOTES));
156
    \$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
157
    \$tpl->assign('channel_webmaster', \$xoopsConfig['adminmail']);
158
    \$tpl->assign('channel_editor', \$xoopsConfig['adminmail']);
159
    \$tpl->assign('channel_category', 'Event');
160
    \$tpl->assign('channel_generator', 'XOOPS - ' . htmlspecialchars(\$xoopsModule->getVar('{$fpmf}'), ENT_QUOTES));
161
    \$tpl->assign('channel_language', _LANGCODE);
162
    if ( _LANGCODE == 'fr' ) {
163
        \$tpl->assign('docs', 'http://www.scriptol.fr/rss/RSS-2.0.html');
164
    } else {
165
        \$tpl->assign('docs', 'http://cyber.law.harvard.edu/rss/rss.html');
166
    }
167
    \$tpl->assign('image_url', XOOPS_URL . \$xoopsModuleConfig['logorss']);
168
    \$dimention = getimagesize(XOOPS_ROOT_PATH . \$xoopsModuleConfig['logorss']);
169
    if (empty(\$dimention[0])) {
170
        \$width = 88;
171
    } else {
172
       \$width = (\$dimention[0] > 144) ? 144 : \$dimention[0];
173
    }
174
    if (empty(\$dimention[1])) {
175
        \$height = 31;
176
    } else {
177
        \$height = (\$dimention[1] > 400) ? 400 : \$dimention[1];
178
    }
179
    \$tpl->assign('image_width', \$width);
180
    \$tpl->assign('image_height', \$height);
181
    foreach (array_keys(\${$tableName}Arr) as \$i) {
182
        \$description = \${$tableName}Arr[\$i]->getVar('description');
183
        //permet d'afficher uniquement la description courte
184
        if (strpos(\$description,'[pagebreak]')==false){
185
            \$description_short = \$description;
186
        } else {
187
            \$description_short = substr(\$description,0,strpos(\$description,'[pagebreak]'));
188
        }
189
        \$tpl->append('items', array('title' => htmlspecialchars(\${$tableName}Arr[\$i]->getVar('{$fpmf}'), ENT_QUOTES),
190
                                    'link' => XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&amp;{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'),
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $fieldId does not seem to be defined for all execution paths leading up to this point.
Loading history...
191
                                    'guid' => XOOPS_URL . '/modules/{$moduleDirname}/single.php?{$fppf}=' . \${$tableName}Arr[\$i]->getVar('{$fppf}') . '&amp;{$fieldId}=' . \${$tableName}Arr[\$i]->getVar('{$fieldId}'),
192
                                    'pubdate' => formatTimestamp(\${$tableName}Arr[\$i]->getVar('date'), 'rss'),
193
                                    'description' => htmlspecialchars(\$description_short, ENT_QUOTES)));
194
    }
195
}
196
header('Content-Type:text/xml; charset=' . _CHARSET);
197
\$tpl->display('db:{$moduleDirname}_rss.tpl', \${$fppf});
198
EOT;
199
200
        return $ret;
201
    }
202
203
    /**
204
     * @public function render
205
     * @param null
206
     * @return bool|string
207
     */
208
    public function render()
209
    {
210
        $module        = $this->getModule();
211
        $filename      = $this->getFileName();
212
        $moduleDirname = $module->getVar('mod_dirname');
213
        $language      = $this->getLanguage($moduleDirname, 'MA');
0 ignored issues
show
The assignment to $language is dead and can be removed.
Loading history...
214
        $content       = $this->getHeaderFilesComments($module);
215
        $content       .= $this->getUserRss($moduleDirname);
216
        $this->create($moduleDirname, '/', $filename, $content, _AM_TDMCREATE_FILE_CREATED, _AM_TDMCREATE_FILE_NOTCREATED);
217
218
        return $this->renderFile();
219
    }
220
}
221