Issues (380)

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.stats.php (1 issue)

Labels
Severity
1
<?php
2
/**
3
 * NewBB 5.0x,  the forum module for XOOPS project
4
 *
5
 * @copyright      XOOPS Project (https://xoops.org)
6
 * @license        GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html)
7
 * @author         Taiwen Jiang (phppp or D.J.) <[email protected]>
8
 * @since          4.00
9
 * @package        module::newbb
10
 */
11
12
use XoopsModules\Newbb;
13
14
15
16
defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php';
17
define('NEWBB_FUNCTIONS_STATS_LOADED', true);
18
19
if (!defined('NEWBB_FUNCTIONS_STATS')) {
20
    define('NEWBB_FUNCTIONS_STATS', 1);
21
22
    /**
23
     * @return mixed
24
     */
25
    function newbbGetStats()
26
    {
27
        /** @var Newbb\StatsHandler $statsHandler */
28
        $statsHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Stats');
29
        $stats        = $statsHandler->getStats();
0 ignored issues
show
The call to XoopsModules\Newbb\StatsHandler::getStats() has too few arguments starting with ids. ( Ignorable by Annotation )

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

29
        /** @scrutinizer ignore-call */ 
30
        $stats        = $statsHandler->getStats();

This check compares calls to functions or methods with their respective definitions. If the call has less arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
30
31
        return $stats;
32
    }
33
34
    /**
35
     * @param        $id
36
     * @param        $type
37
     * @param int    $increment
38
     * @return mixed
39
     */
40
    function newbbUpdateStats($id, $type, $increment = 1)
41
    {
42
        /** @var Newbb\StatsHandler $statsHandler */
43
        $statsHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Stats');
44
45
        return $statsHandler->update($id, $type, $increment);
46
    }
47
48
    /*
49
    * Gets the total number of topics in a form
50
    */
51
    /**
52
     * @param string $forum_id
53
     * @return mixed
54
     */
55
    function getTotalTopics($forum_id = '')
56
    {
57
        /** @var Newbb\TopicHandler $topicHandler */
58
        $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic');
59
        $criteria     = new \CriteriaCompo(new \Criteria('approved', 0, '>'));
60
        if ($forum_id) {
61
            $criteria->add(new \Criteria('forum_id', (int)$forum_id));
62
        }
63
64
        return $topicHandler->getCount($criteria);
65
    }
66
67
    /*
68
    * Returns the total number of posts in the whole system, a forum, or a topic
69
    * Also can return the number of users on the system.
70
    */
71
    /**
72
     * @param int    $id
73
     * @param string $type
74
     * @return mixed
75
     */
76
    function getTotalPosts($id = 0, $type = 'all')
77
    {
78
        /** @var Newbb\PostHandler $postHandler */
79
        $postHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Post');
80
        $criteria    = new \CriteriaCompo(new \Criteria('approved', 0, '>'));
81
        switch ($type) {
82
            case 'forum':
83
                if ($id > 0) {
84
                    $criteria->add(new \Criteria('forum_id', (int)$id));
85
                }
86
                break;
87
            case 'topic':
88
                if ($id > 0) {
89
                    $criteria->add(new \Criteria('topic_id', (int)$id));
90
                }
91
                break;
92
            case 'all':
93
            default:
94
                break;
95
        }
96
97
        return $postHandler->getCount($criteria);
98
    }
99
100
    /**
101
     * @return null
102
     */
103
    function getTotalViews()
104
    {
105
        $sql = 'SELECT sum(topic_views) FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' ';
106
        if (!$result = $GLOBALS['xoopsDB']->query($sql)) {
107
            return null;
108
        }
109
        list($total) = $GLOBALS['xoopsDB']->fetchRow($result);
110
111
        return $total;
112
    }
113
}
114