Issues (340)

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

1
<?php declare(strict_types=1);
2
/**
3
 * NewBB,  the forum module for XOOPS project
4
 *
5
 * @copyright      XOOPS Project (https://xoops.org)
6
 * @license        GNU GPL 2.0 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
 */
10
defined('NEWBB_FUNCTIONS_INI') || require __DIR__ . '/functions.ini.php';
11
define('NEWBB_FUNCTIONS_TIME_LOADED', true);
12
13
if (!defined('NEWBB_FUNCTIONS_TIME')) {
14
    define('NEWBB_FUNCTIONS_TIME', 1);
15
16
    /**
17
     * Function to convert UNIX time to formatted time string
18
     * @param int $time
19
     * @param string  $format
20
     * @param string  $timeoffset
21
     * @return string
22
     */
23
    function newbbFormatTimestamp(int $time, string $format = 'c', string $timeoffset = ''): string
24
    {
25
        xoops_loadLanguage('locale');
26
        $newbbConfig = newbbLoadConfig();
27
28
        $format = \mb_strtolower($format);
29
        if ('reg' === $format || '' === $format) {
30
            $format = 'c';
31
        }
32
        if (('custom' === $format || 'c' === $format) && !empty($newbbConfig['formatTimestamp_custom'])) {
33
            $format = $newbbConfig['formatTimestamp_custom'];
34
        }
35
36
        return XoopsLocal::formatTimestamp($time, $format, $timeoffset);
37
    }
38
39
    /**
40
     * @param int $selected
41
     * @return string
42
     */
43
    function newbbSinceSelectBox(int $selected = 100): string
44
    {
45
        $newbbConfig = newbbLoadConfig();
46
        // irmtfan - new method to get user inputs
47
        preg_match_all('/-?\d+/', (string) $newbbConfig['since_options'], $match);
48
        $select_array = array_unique($match[0]);
49
        //$select_array = explode(',', $newbbConfig['since_options']);
50
        //$select_array = array_map('trim', $select_array);
51
        // irmtfan - if the array is empty do not show selection box
52
        if (!$select_array) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $select_array of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
53
            $since = $newbbConfig['since_default'];
54
            switch ($since) {
55
                case 0:
56
                    $forum_since = _MD_NEWBB_BEGINNING;
57
                    break;
58
                case 365:
59
                    $forum_since = _MD_NEWBB_THELASTYEAR;
60
                    break;
61
                default:
62
                    if ($since > 0) {
63
                        $forum_since = sprintf(_MD_NEWBB_FROMLASTDAYS, $since);
64
                    } else {
65
                        $forum_since = sprintf(_MD_NEWBB_FROMLASTHOURS, abs($since));
66
                    }
67
            }
68
69
            return $forum_since;
70
        }
71
        $forum_selection_since = '<select class="form-control" name="since" id="since">';
72
        // irmtfan no option when no selected value
73
        $forum_selection_since .= '<option value="">--------</option>';
74
        foreach ($select_array as $since) {
75
            $forum_selection_since .= '<option value="' . $since . '"' . (($selected == $since) ? ' selected="selected"' : '') . '>';
76
            // START irmtfan functional since 0 and 365
77
            switch ($since) {
78
                case 0:
79
                    $forum_selection_since .= _MD_NEWBB_BEGINNING;
80
                    break;
81
                case 365:
82
                    $forum_selection_since .= _MD_NEWBB_THELASTYEAR;
83
                    break;
84
                default:
85
                    if ($since > 0) {
86
                        $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTDAYS, $since);
87
                    } else {
88
                        $forum_selection_since .= sprintf(_MD_NEWBB_FROMLASTHOURS, abs((int)$since));
89
                    }
90
            }
91
            // END irmtfan functional since 0 and 365
92
            $forum_selection_since .= '</option>';
93
        }
94
        // irmtfan remove hardcodes
95
        //$forum_selection_since .= '<option value="365"'.(($selected === 365) ? ' selected="selected"' : '').'>'._MD_NEWBB_THELASTYEAR.'</option>';
96
        //$forum_selection_since .= '<option value="0"'.(($selected === 0) ? ' selected="selected"' : '').'>'._MD_NEWBB_BEGINNING.'</option>';
97
        $forum_selection_since .= '</select>';
98
99
        return $forum_selection_since;
100
    }
101
102
    /**
103
     * @param int $since
104
     *
105
     * @return int
106
     *
107
     * @psalm-return 0|positive-int
108
     */
109
    function newbbGetSinceTime(int $since = 100)
110
    {
111
        // irmtfan bad coding
112
        //if ($since==1000) return 0;
113
        if ($since > 0) {
114
            return (int)$since * 24 * 3600;
115
        }
116
117
        return (int)abs($since) * 3600;
118
    }
119
}
120