Issues (267)

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.

letter.php (13 issues)

1
<?php
2
/**
3
 * Module: Xooopstube
4
 * Licence: GNU
5
 */
6
7
use Xmf\Request;
8
use XoopsModules\Xoopstube\{
9
    Helper,
10
    Utility
11
};
12
/** @var Helper $helper */
13
14
require_once __DIR__ . '/header.php';
15
$GLOBALS['xoopsOption']['template_main'] = 'lx_letter.tpl';
16
require_once XOOPS_ROOT_PATH . '/header.php';
17
require_once XOOPS_ROOT_PATH . '/modules/lexikon/include/common.inc.php';
18
$helper  = Helper::getInstance();
19
$utility = new Utility();
20
21
global $xoTheme, $xoopsUser;
22
$myts = \MyTextSanitizer::getInstance();
23
24
$init = Request::getString('init', 0, 'GET');
25
$xoopsTpl->assign('firstletter', $init);
26
require_once XOOPS_ROOT_PATH . '/class/pagenav.php';
27
$start = Request::getInt('start', 0, 'GET');
28
29
$publishedwords = $utility::countWords();
30
$xoopsTpl->assign('publishedwords', $publishedwords);
31
32
//permissions
33
/** @var \XoopsGroupPermHandler $grouppermHandler */
34
$grouppermHandler = xoops_getHandler('groupperm');
35
$groups           = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS;
36
$module_id        = $xoopsModule->getVar('mid');
37
$allowed_cats     = $grouppermHandler->getItemIds('lexikon_view', $groups, $module_id);
38
$catids           = implode(',', $allowed_cats);
39
$catperms         = " AND categoryID IN ($catids) ";
40
41
$xoopsTpl->assign('multicats', (int)$helper->getConfig('multicats'));
42
43
if (!function_exists('mb_ucfirst') && function_exists('mb_substr')) {
44
    /**
45
     * @param $string
46
     * @return string
47
     */
48
    function mb_ucfirst($string)
49
    {
50
        $string = mb_ereg_replace('^[\ ]+', '', $string);
51
        $string = mb_strtoupper(mb_substr($string, 0, 1, 'UTF-8'), 'UTF-8') . mb_substr($string, 1, mb_strlen($string), 'UTF-8');
52
53
        return $string;
54
    }
55
}
56
// To display the linked letter list
57
$alpha = $utility::getAlphaArray();
58
$xoopsTpl->assign('alpha', $alpha);
59
60
[$howmanyother] = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '#' AND offline ='0' " . $catperms . ' '));
61
$xoopsTpl->assign('totalother', $howmanyother);
62
63
// To display the list of categories
64
if (1 == $helper->getConfig('multicats')) {
65
    $xoopsTpl->assign('block0', $utility::getCategoryArray());
66
    $xoopsTpl->assign('layout', CONFIG_CATEGORY_LAYOUT_PLAIN);
0 ignored issues
show
The constant CONFIG_CATEGORY_LAYOUT_PLAIN was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
67
    if ($utility::getModuleOption('useshots')) {
68
        $xoopsTpl->assign('show_screenshot', true);
69
        $xoopsTpl->assign('logo_maximgwidth', $helper->getConfig('logo_maximgwidth'));
70
        $xoopsTpl->assign('lang_noscreenshot', _MD_LEXIKON_NOSHOTS);
0 ignored issues
show
The constant _MD_LEXIKON_NOSHOTS was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
71
    } else {
72
        $xoopsTpl->assign('show_screenshot', false);
73
    }
74
}
75
76
// No initial: we need to see all letters
77
if (!$init) {
78
    $entriesarray = [];
79
    $pagetype     = 0;
80
81
    // How many entries will we show in this page?
82
    //$queryA = "SELECT w. * , c.name AS catname FROM ".$xoopsDB -> prefix( 'lxentries' )." w LEFT JOIN ".$xoopsDB -> prefix( 'lxcategories' )." c ON w.categoryID = c.categoryID WHERE w.submit = '0' AND w.offline = '0' ORDER BY w.term ASC";
83
    //$resultA = $xoopsDB -> query ($queryA, $helper->getConfig('indexperpage'), $start );
84
    $queryA  = 'SELECT * FROM ' . $xoopsDB->prefix('lxentries') . " WHERE offline = '0' AND submit = '0' " . $catperms . ' ORDER BY term ASC';
85
    $resultA = $xoopsDB->query($queryA, $helper->getConfig('indexperpage'), $start);
86
87
    $allentries   = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' " . $catperms . ' ORDER BY term ASC ');
88
    $totalentries = $xoopsDB->getRowsNum($allentries);
89
    $xoopsTpl->assign('totalentries', $totalentries);
90
91
    while (list($entryID, $categoryID, $term, $init, $definition, $ref, $url, $uid, $submit, $datesub, $counter, $html, $smiley, $xcodes, $breaks, $block, $offline, $comments) = $xoopsDB->fetchRow($resultA)) {
92
        $eachentry        = [];
93
        $xoopsModule      = XoopsModule::getByDirname('lexikon');
94
        $eachentry['dir'] = $xoopsModule->dirname();
95
96
        if (1 == $helper->getConfig('multicats')) {
97
            $eachentry['catid'] = (int)$categoryID;
98
            $resultF            = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC");
99
            while (list($name) = $xoopsDB->fetchRow($resultF)) {
100
                $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5);
101
            }
102
        }
103
104
        $eachentry['id']   = (int)$entryID;
105
        $eachentry['term'] = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5));
106
107
        if ((0 != $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing $helper->getConfig('com_rule') of type mixed|null to 0; this is ambiguous as not only 0 == 0 is true, but null == 0 is true, too. Consider using a strict comparison ===.
Loading history...
108
            if (0 != $comments) {
109
                $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . '&nbsp;' . _COMMENTS . '</a>';
110
            } else {
111
                $eachentry['comments'] = '';
112
            }
113
        }
114
115
        if (!XOOPS_USE_MULTIBYTES) {
116
            $eachentry['definition'] = $myts->displayTarea($definition, $html, $smiley, $xcodes, 1, $breaks);
117
        }
118
119
        // Functional links
120
        $microlinks              = $utility::getServiceLinks($eachentry);
0 ignored issues
show
The method getServiceLinks() does not exist on XoopsModules\Xoopstube\Utility. ( Ignorable by Annotation )

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

120
        /** @scrutinizer ignore-call */ 
121
        $microlinks              = $utility::getServiceLinks($eachentry);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
121
        $eachentry['microlinks'] = $microlinks;
122
123
        $entriesarray['single'][] = $eachentry;
124
    }
125
    $pagenav                = new \XoopsPageNav($totalentries, $helper->getConfig('indexperpage'), $start, 'start');
126
    $entriesarray['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav(6) . '</div>';
127
128
    $xoopsTpl->assign('entriesarray', $entriesarray);
129
    $xoopsTpl->assign('pagetype', '0');
130
    $xoopsTpl->assign('pageinitial', _MD_LEXIKON_ALL);
0 ignored issues
show
The constant _MD_LEXIKON_ALL was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
131
132
    $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . ' - ' . _MD_LEXIKON_ALL, ENT_QUOTES | ENT_HTML5));
0 ignored issues
show
The method createPageTitle() does not exist on XoopsModules\Xoopstube\Utility. ( Ignorable by Annotation )

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

132
    $utility::/** @scrutinizer ignore-call */ 
133
              createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . ' - ' . _MD_LEXIKON_ALL, ENT_QUOTES | ENT_HTML5));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
The constant _MD_LEXIKON_BROWSELETTER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
133
} else {    // $init does exist
134
    $pagetype = 1;
135
    // There IS an initial letter, so we want to show just that letter's terms
136
    $entriesarray2 = [];
137
138
    // How many entries will we show in this page?
139
    if (_MD_LEXIKON_OTHER == $init) {
0 ignored issues
show
The constant _MD_LEXIKON_OTHER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
140
        $queryB  = 'SELECT entryID, categoryID, term, definition, uid, html, smiley, xcodes, breaks, comments FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' AND init = '#' " . $catperms . '  ORDER BY term ASC';
141
        $resultB = $xoopsDB->query($queryB, $helper->getConfig('indexperpage'), $start);
142
    } else {
143
        $queryB  = 'SELECT entryID, categoryID, term, definition, uid, html, smiley, xcodes, breaks, comments FROM ' . $xoopsDB->prefix('lxentries') . " WHERE submit ='0' AND offline = '0' AND init = '$init' AND init != '#' " . $catperms . '  ORDER BY term ASC';
144
        $resultB = $xoopsDB->query($queryB, $helper->getConfig('indexperpage'), $start);
145
    }
146
147
    $entrieshere = $xoopsDB->getRowsNum($resultB);
148
    if (0 == $entrieshere) {
149
        redirect_header('<script>javascript:history.go(-1)</script>', 1, _MD_LEXIKON_NOTERMSINLETTER);
0 ignored issues
show
The constant _MD_LEXIKON_NOTERMSINLETTER was not found. Maybe you did not declare it correctly or list all dependencies?
Loading history...
150
    }
151
152
    if (_MD_LEXIKON_OTHER == $init) {
153
        $allentries = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '#' AND submit ='0' AND offline = '0' " . $catperms . '  ORDER BY term ASC ');
154
    } else {
155
        $allentries = $xoopsDB->query('SELECT entryID FROM ' . $xoopsDB->prefix('lxentries') . " WHERE init = '$init' AND init != '#' AND submit ='0' AND offline = '0' " . $catperms . '  ORDER BY term ASC ');
156
    }
157
    $totalentries = $xoopsDB->getRowsNum($allentries);
158
    $xoopsTpl->assign('totalentries', $totalentries);
159
    $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . (isset($init['init']) ? (' - ' . $init['init']) : ''), ENT_QUOTES | ENT_HTML5));
160
161
    while (list($entryID, $categoryID, $term, $definition, $uid, $html, $smiley, $xcodes, $breaks, $comments) = $xoopsDB->fetchRow($resultB)) {
162
        $eachentry        = [];
163
        $xoopsModule      = XoopsModule::getByDirname('lexikon');
164
        $eachentry['dir'] = $xoopsModule->dirname();
165
166
        if (1 == $helper->getConfig('multicats')) {
167
            $eachentry['catid'] = (int)$categoryID;
168
            $resultF            = $xoopsDB->query('SELECT name FROM ' . $xoopsDB->prefix('lxcategories') . " WHERE categoryID = $categoryID ORDER BY name ASC");
169
            while (list($name) = $xoopsDB->fetchRow($resultF)) {
170
                $eachentry['catname'] = htmlspecialchars($name, ENT_QUOTES | ENT_HTML5);
171
            }
172
        }
173
        $eachentry['id']   = (int)$entryID;
174
        $eachentry['term'] = mb_ucfirst(htmlspecialchars($term, ENT_QUOTES | ENT_HTML5));
175
        if ('#' === $init) {
176
            $eachentry['init'] = _MD_LEXIKON_OTHER;
177
        } else {
178
            $eachentry['init'] = $init;
179
        }
180
181
        if ((0 != $helper->getConfig('com_rule')) || ((0 != $helper->getConfig('com_rule')) && is_object($xoopsUser))) {
0 ignored issues
show
Bug Best Practice introduced by
It seems like you are loosely comparing $helper->getConfig('com_rule') of type mixed|null to 0; this is ambiguous as not only 0 == 0 is true, but null == 0 is true, too. Consider using a strict comparison ===.
Loading history...
182
            if (0 != $comments) {
183
                $eachentry['comments'] = "<a href='entry.php?entryID=" . $eachentry['id'] . "'>" . $comments . '&nbsp;' . _COMMENTS . '</a>';
184
            } else {
185
                $eachentry['comments'] = '';
186
            }
187
        }
188
        if (!XOOPS_USE_MULTIBYTES) {
189
            $eachentry['definition'] = $myts->displayTarea($definition, $html, $smiley, $xcodes, 1, $breaks);
190
        }
191
192
        // Functional links
193
        $microlinks              = $utility::getServiceLinks($eachentry);
194
        $eachentry['microlinks'] = $microlinks;
195
196
        $entriesarray2['single'][] = $eachentry;
197
    }
198
    $pagenav                 = new \XoopsPageNav($totalentries, $helper->getConfig('indexperpage'), $start, 'init=' . $eachentry['init'] . '&start');
199
    $entriesarray2['navbar'] = '<div style="text-align:right;">' . $pagenav->renderNav(6) . '</div>';
200
201
    $xoopsTpl->assign('entriesarray2', $entriesarray2);
202
    $xoopsTpl->assign('pagetype', '1');
203
    if ('#' === $eachentry['init']) {
204
        $xoopsTpl->assign('pageinitial', _MD_LEXIKON_OTHER);
205
        $utility::createPageTitle(htmlspecialchars(_MD_LEXIKON_BROWSELETTER . ' - ' . _MD_LEXIKON_OTHER, ENT_QUOTES | ENT_HTML5));
206
    } else {
207
        $xoopsTpl->assign('pageinitial', mb_ucfirst($eachentry['init']));
208
    }
209
}
210
211
$xoopsTpl->assign('lang_modulename', $xoopsModule->name());
212
$xoopsTpl->assign('lang_moduledirname', $xoopsModule->getVar('dirname'));
213
$xoopsTpl->assign('alpha', $alpha);
214
if (1 == $helper->getConfig('syndication')) {
215
    $xoopsTpl->assign('syndication', true);
216
}
217
if ($xoopsUser) {
218
    $xoopsTpl->assign('syndication', true);
219
}
220
// Meta data
221
if (0 == $publishedwords) {
222
    $meta_description = xoops_substr($utility::convertHtml2text($eachentry['definition']), 0, 150);
0 ignored issues
show
It seems like $utility::convertHtml2te...achentry['definition']) can also be of type array and string[]; however, parameter $str of xoops_substr() does only seem to accept string, 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

222
    $meta_description = xoops_substr(/** @scrutinizer ignore-type */ $utility::convertHtml2text($eachentry['definition']), 0, 150);
Loading history...
223
    if (1 == $helper->getConfig('multicats')) {
224
        $utility::extractKeywords($xoopsModule->name() . ' ,' . $eachentry['term'] . ', ' . $meta_description);
0 ignored issues
show
The method extractKeywords() does not exist on XoopsModules\Xoopstube\Utility. ( Ignorable by Annotation )

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

224
        $utility::/** @scrutinizer ignore-call */ 
225
                  extractKeywords($xoopsModule->name() . ' ,' . $eachentry['term'] . ', ' . $meta_description);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
225
        $utility::getMetaDescription(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ' ' . $eachentry['catname'] . ' ' . $eachentry['term']);
0 ignored issues
show
The method getMetaDescription() does not exist on XoopsModules\Xoopstube\Utility. ( Ignorable by Annotation )

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

225
        $utility::/** @scrutinizer ignore-call */ 
226
                  getMetaDescription(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ' ' . $eachentry['catname'] . ' ' . $eachentry['term']);

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
226
    } else {
227
        $utility::extractKeywords(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ', ' . $eachentry['term'] . ', ' . $meta_description);
228
        $utility::getMetaDescription(htmlspecialchars($xoopsModule->name(), ENT_QUOTES | ENT_HTML5) . ' ' . $eachentry['term'] . ' ' . $meta_description);
229
    }
230
}
231
232
$xoopsTpl->assign('xoops_module_header', '<link rel="stylesheet" type="text/css" href="assets/css/style.css">');
233
234
require_once XOOPS_ROOT_PATH . '/footer.php';
235