Issues (311)

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.

include/functions.php (13 issues)

1
<?php declare(strict_types=1);
2
3
/*
4
 You may not change or alter any portion of this comment or credits
5
 of supporting developers from this source code or any supporting source code
6
 which is considered copyrighted (c) material of the original comment or credit authors.
7
8
 This program is distributed in the hope that it will be useful,
9
 but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
*/
12
13
/**
14
 * wgEvents module for xoops
15
 *
16
 * @copyright    2021 XOOPS Project (https://xoops.org)
17
 * @license      GPL 2.0 or later
18
 * @package      wgevents
19
 * @since        1.0.0
20
 * @min_xoops    2.5.11 Beta1
21
 * @author       Goffy - Wedega - Email:[email protected] - Website:https://xoops.wedega.com
22
 */
23
24
/**
25
 * function add selected cats to block
26
 *
27
 * @param  $cats
28
 * @return string
29
 */
30
function wgevents_block_addCatSelect($cats)
31
{
32
    $cat_sql = '(';
33
    if (\is_array($cats)) {
34
        $cat_sql .= current($cats);
35
        \array_shift($cats);
36
        foreach ($cats as $cat) {
37
            $cat_sql .= ',' . $cat;
38
        }
39
    }
40
    $cat_sql .= ')';
41
    return $cat_sql;
42
}
43
44
/**
45
 * Get the permissions ids
46
 *
47
 * @param  $permtype
48
 * @param  $dirname
49
 * @return mixed $itemIds
50
 */
51
function wgeventsGetMyItemIds($permtype, $dirname)
52
{
53
    global $xoopsUser;
54
    static $permissions = [];
55
    if (\is_array($permissions) && \array_key_exists($permtype, $permissions)) {
56
        return $permissions[$permtype];
57
    }
58
    $moduleHandler = \xoops_getHandler('module');
59
    $wgeventsModule = $moduleHandler->getByDirname($dirname);
0 ignored issues
show
The method getByDirname() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsModuleHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

59
    /** @scrutinizer ignore-call */ 
60
    $wgeventsModule = $moduleHandler->getByDirname($dirname);
Loading history...
60
    $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : \XOOPS_GROUP_ANONYMOUS;
61
    $grouppermHandler = \xoops_getHandler('groupperm');
62
    return $grouppermHandler->getItemIds($permtype, $groups, $wgeventsModule->getVar('mid'));
0 ignored issues
show
The method getItemIds() does not exist on XoopsObjectHandler. It seems like you code against a sub-type of XoopsObjectHandler such as XoopsGroupPermHandler or XoopsPersistableObjectHandler. ( Ignorable by Annotation )

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

62
    return $grouppermHandler->/** @scrutinizer ignore-call */ getItemIds($permtype, $groups, $wgeventsModule->getVar('mid'));
Loading history...
63
}
64
65
/**
66
 * Add content as meta tag to template
67
 * @param $content
68
 * @return void
69
 */
70
71
function wgeventsMetaKeywords($content)
72
{
73
    global $xoopsTpl, $xoTheme;
74
    $myts = MyTextSanitizer::getInstance();
75
    $content= $myts->undoHtmlSpecialChars($myts->displayTarea($content));
76
    if(isset($xoTheme) && \is_object($xoTheme)) {
77
        $xoTheme->addMeta( 'meta', 'keywords', \strip_tags($content));
78
    } else {    // Compatibility for old Xoops versions
79
        $xoopsTpl->assign('xoops_meta_keywords', \strip_tags($content));
80
    }
81
}
82
83
/**
84
 * Add content as meta description to template
85
 * @param $content
86
 * @return void
87
 */
88
 
89
function wgeventsMetaDescription($content)
90
{
91
    global $xoopsTpl, $xoTheme;
92
    $myts = MyTextSanitizer::getInstance();
93
    $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content));
94
    if(isset($xoTheme) && \is_object($xoTheme)) {
95
        $xoTheme->addMeta( 'meta', 'description', \strip_tags($content));
96
    } else {    // Compatibility for old Xoops versions
97
        $xoopsTpl->assign('xoops_meta_description', \strip_tags($content));
98
    }
99
}
100
101
/**
102
 * Rewrite all url
103
 *
104
 * @param string  $module  module name
105
 * @param array   $array   array
106
 * @param string  $type    type
107
 * @return null|string $type    string replacement for any blank case
108
 */
109
function wgevents_RewriteUrl($module, $array, $type = 'content')
110
{
111
    $comment = '';
112
    $helper = \XoopsModules\Wgevents\Helper::getInstance();
113
    $textblockHandler = $helper->getHandler('textblocks');
0 ignored issues
show
The assignment to $textblockHandler is dead and can be removed.
Loading history...
114
    $length_id = (int)$helper->getConfig('length_id');
115
    $rewrite_url = $helper->getConfig('rewrite_url');
116
117
    $id = $array['content_id'];
118
    if (0 !== $length_id) {
119
        while (\strlen($id) < $length_id) {
120
            $id = '0' . $id;
121
        }
122
    }
123
124
    if (isset($array['topic_alias']) && $array['topic_alias']) {
125
        $topic_name = $array['topic_alias'];
126
    } else {
127
        $topic_name = wgevents_Filter(xoops_getModuleOption('static_name', $module));
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

127
        $topic_name = wgevents_Filter(/** @scrutinizer ignore-deprecated */ xoops_getModuleOption('static_name', $module));
Loading history...
128
    }
129
130
    switch ($rewrite_url) {
131
132
        case 'none':
133
            if($topic_name) {
134
                 $topic_name = 'topic=' . $topic_name . '&amp;';
135
            }
136
            $rewrite_base = '/modules/';
137
            $page = 'page=' . $array['content_alias'];
138
            return \XOOPS_URL . $rewrite_base . $module . '/' . $type . '.php?' . $topic_name . 'id=' . $id . '&amp;' . $page . $comment;
139
140
        case 'rewrite':
141
            if($topic_name) {
142
                $topic_name .= '/';
143
            }
144
            $rewrite_base = xoops_getModuleOption('rewrite_mode', $module);
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

144
            $rewrite_base = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_mode', $module);
Loading history...
145
            $rewrite_ext = xoops_getModuleOption('rewrite_ext', $module);
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

145
            $rewrite_ext = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_ext', $module);
Loading history...
146
            $module_name = '';
147
            if(xoops_getModuleOption('rewrite_name', $module)) {
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

147
            if(/** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_name', $module)) {
Loading history...
148
                $module_name = xoops_getModuleOption('rewrite_name', $module) . '/';
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

148
                $module_name = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_name', $module) . '/';
Loading history...
149
            }
150
            $page = $array['content_alias'];
151
            $type .= '/';
152
            $id .= '/';
153
            if ('content/' === $type) {
154
                $type = '';
155
            }
156
            if ('comment-edit/' === $type || 'comment-reply/' === $type || 'comment-delete/' === $type) {
157
                return \XOOPS_URL . $rewrite_base . $module_name . $type . $id . '/';
158
            }
159
160
            return \XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name  . $id . $page . $rewrite_ext;
161
162
        case 'short':
163
            if($topic_name) {
164
                $topic_name .= '/';
165
            }
166
            $rewrite_base = xoops_getModuleOption('rewrite_mode', $module);
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

166
            $rewrite_base = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_mode', $module);
Loading history...
167
            $rewrite_ext = xoops_getModuleOption('rewrite_ext', $module);
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

167
            $rewrite_ext = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_ext', $module);
Loading history...
168
            $module_name = '';
169
            if(xoops_getModuleOption('rewrite_name', $module)) {
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

169
            if(/** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_name', $module)) {
Loading history...
170
                $module_name = xoops_getModuleOption('rewrite_name', $module) . '/';
0 ignored issues
show
Deprecated Code introduced by
The function xoops_getModuleOption() has been deprecated. ( Ignorable by Annotation )

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

170
                $module_name = /** @scrutinizer ignore-deprecated */ xoops_getModuleOption('rewrite_name', $module) . '/';
Loading history...
171
            }
172
            $page = $array['content_alias'];
173
            $type .= '/';
174
            if ('content/' === $type) {
175
                $type = '';
176
            }
177
            if ('comment-edit/' === $type || 'comment-reply/' === $type || 'comment-delete/' === $type) {
178
                return \XOOPS_URL . $rewrite_base . $module_name . $type . $id . '/';
179
            }
180
181
            return \XOOPS_URL . $rewrite_base . $module_name . $type . $topic_name . $page . $rewrite_ext;
182
    }
183
    return null;
184
}
185
/**
186
 * Replace all escape, character, ... for display a correct url
187
 *
188
 * @param string $url      string to transform
189
 * @param string $type     string replacement for any blank case
190
 * @return string $url
191
 */
192
function wgevents_Filter($url, $type = '') {
193
194
    // Get regular expression from module setting. default setting is : `[^a-z0-9]`i
195
    $helper = \XoopsModules\Wgevents\Helper::getInstance();
196
    $textblockHandler = $helper->getHandler('textblocks');
0 ignored issues
show
The assignment to $textblockHandler is dead and can be removed.
Loading history...
197
    $regular_expression = $helper->getConfig('regular_expression');
198
199
    $url = \strip_tags($url);
200
    $url .= \preg_replace('`\[.*\]`U', '', $url);
201
    $url .= \preg_replace('`&(amp;)?#?[a-z0-9]+;`i', '-', $url);
202
    $url .= \htmlentities($url, ENT_COMPAT, 'utf-8');
203
    $url .= \preg_replace('`&([a-z])(acute|uml|circ|grave|ring|cedil|slash|tilde|caron|lig);`i', "\1", $url);
204
    $url .= \preg_replace([$regular_expression, '`[-]+`'], '-', $url);
205
    return ('' == $url) ? $type : \strtolower(\trim($url, '-'));
206
}