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.

admin/admin_votedata.php (1 issue)

Labels
Severity
1
<?php
2
//
3
// ------------------------------------------------------------------------ //
4
// XOOPS - PHP Content Management System                      //
5
// Copyright (c) 2000-2020 XOOPS.org                           //
6
// <https://xoops.org>                             //
7
// ------------------------------------------------------------------------ //
8
// This program is free software; you can redistribute it and/or modify     //
9
// it under the terms of the GNU General Public License as published by     //
10
// the Free Software Foundation; either version 2 of the License, or        //
11
// (at your option) any later version.                                      //
12
// //
13
// You may not change or alter any portion of this comment or credits       //
14
// of supporting developers from this source code or any supporting         //
15
// source code which is considered copyrighted (c) material of the          //
16
// original comment or credit authors.                                      //
17
// //
18
// This program is distributed in the hope that it will be useful,          //
19
// but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
// GNU General Public License for more details.                             //
22
// //
23
// You should have received a copy of the GNU General Public License        //
24
// along with this program; if not, write to the Free Software              //
25
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
// ------------------------------------------------------------------------ //
27
// Author: Kazumi Ono (AKA onokazu)                                          //
28
// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ //
29
// Project: XOOPS Project                                                    //
30
// ------------------------------------------------------------------------- //
31
32
use Xmf\Request;
33
34
require_once __DIR__ . '/admin_header.php';
35
36
$op = $op = Request::getString('op', Request::getCmd('op', '', 'POST'), 'GET'); //!empty($_GET['op'])? $_GET['op'] : (!empty($_POST['op'])?$_POST['op']:"");
37
38
switch ($op) {
39
    case 'delvotes':
40
        $rid      = Request::getInt('rid', 0, 'GET');
41
        $topic_id = Request::getInt('topic_id', 0, 'GET');
42
        $sql      = $GLOBALS['xoopsDB']->queryF('DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . " WHERE ratingid = $rid");
43
        $GLOBALS['xoopsDB']->query($sql);
44
45
        $query       = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' WHERE topic_id = ' . $topic_id . ' ';
46
        $voteresult  = $GLOBALS['xoopsDB']->query($query);
47
        $votesDB     = $GLOBALS['xoopsDB']->getRowsNum($voteresult);
48
        $totalrating = 0;
49
        while (list($rating) = $GLOBALS['xoopsDB']->fetchRow($voteresult)) {
50
            $totalrating += $rating;
51
        }
52
        $finalrating = $totalrating / $votesDB;
53
        $finalrating = number_format($finalrating, 4);
54
        $sql         = sprintf('UPDATE `%s` SET rating = %u, votes = %u WHERE topic_id = %u', $GLOBALS['xoopsDB']->prefix('newbb_topics'), $finalrating, $votesDB, $topic_id);
55
        $GLOBALS['xoopsDB']->queryF($sql);
56
57
        redirect_header('admin_votedata.php', 1, _AM_NEWBB_VOTEDELETED);
58
        break;
59
    case 'main':
60
    default:
61
        $start         = Request::getInt('start', 0, 'POST');
62
        $useravgrating = '0';
63
        $uservotes     = '0';
64
65
        $sql     = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ORDER BY ratingtimestamp DESC';
66
        $results = $GLOBALS['xoopsDB']->query($sql, 20, $start);
67
        $votes   = $GLOBALS['xoopsDB']->getRowsNum($results);
68
69
        $sql           = 'SELECT rating FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_votedata') . ' ';
70
        $result2       = $GLOBALS['xoopsDB']->query($sql, 20, $start);
71
        $uservotes     = $GLOBALS['xoopsDB']->getRowsNum($result2);
72
        $useravgrating = 0;
73
74
        while (list($rating2) = $GLOBALS['xoopsDB']->fetchRow($result2)) {
75
            //            $useravgrating = $useravgrating + $rating2;
76
            $useravgrating += $rating2;
77
        }
78
        if ($useravgrating > 0) {
79
            //            $useravgrating = $useravgrating / $uservotes;
80
            $useravgrating /= $uservotes;
81
            $useravgrating = number_format($useravgrating, 2);
82
        }
83
84
        xoops_cp_header();
85
        $adminObject->displayNavigation(basename(__FILE__));
86
87
        echo "<div style='padding: 8px;'>\n
88
        <div><strong>" . _AM_NEWBB_VOTE_USERAVG . ": </strong>$useravgrating</div>\n
89
        <div><strong>" . _AM_NEWBB_VOTE_TOTALRATE . ": </strong>$uservotes</div>\n
90
        <div style='padding: 8px;'>\n
91
        <ul><li> " . _AM_NEWBB_VOTE_DELETEDSC . "</li></ul>
92
        <div>\n
93
        <br>\n
94
        <table width='100%' border='0' cellspacing='1' class='outer'>" . "<tr><td class='odd'>
95
        <table width='100%' cellspacing='1' cellpadding='2' class='outer'>\n
96
        <tr>\n
97
        <th align='center'>" . _AM_NEWBB_VOTE_ID . "</th>\n
98
        <th align='center'>" . _AM_NEWBB_VOTE_USER . "</th>\n
99
        <th align='center'>" . _AM_NEWBB_VOTE_IP . "</th>\n
100
        <th align='center'>" . _AM_NEWBB_VOTE_FILETITLE . "</th>\n
101
        <th align='center'>" . _AM_NEWBB_VOTE_RATING . "</th>\n
102
        <th align='center'>" . _AM_NEWBB_VOTE_DATE . "</th>\n
103
        <th align='center'>" . _AM_NEWBB_ACTION . "</th></tr>\n";
104
105
        if (0 == $votes) {
106
            echo "<tr><td align='center' colspan='7' class='head'>" . _AM_NEWBB_VOTE_NOVOTES . '</td></tr>';
107
        }
108
        while (list($ratingid, $topic_id, $ratinguser, $rating, $ratinghostname, $ratingtimestamp) = $GLOBALS['xoopsDB']->fetchRow($results)) {
109
            $sql        = 'SELECT topic_title FROM ' . $GLOBALS['xoopsDB']->prefix('newbb_topics') . ' WHERE topic_id=' . $topic_id . ' ';
110
            $down_array = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql));
111
112
            $formatted_date = formatTimestamp($ratingtimestamp, _DATESTRING);
113
            $ratinguname    = newbbGetUnameFromId($ratinguser, $GLOBALS['xoopsModuleConfig']['show_realname']);
114
            echo "
115
        <tr>\n
116
        <td class='head' align='center'>$ratingid</td>\n
117
        <td class='even' align='center'>$ratinguname</td>\n
118
        <td class='even' align='center' >$ratinghostname</td>\n
119
        <td class='even' align='left'><a href='" . XOOPS_URL . '/modules/newbb/viewtopic.php?topic_id=' . $topic_id . "' target='topic'>" . $myts->htmlSpecialChars($down_array['topic_title']) . "</a></td>\n
120
        <td class='even' align='center'>$rating</td>\n
121
        <td class='even' align='center'>$formatted_date</td>\n
122
        <td class='even' align='center'><strong><a href='admin_votedata.php?op=delvotes&amp;topic_id=$topic_id&amp;rid=$ratingid'>" . newbbDisplayImage('p_delete', _DELETE) . "</a></strong></td>\n
123
        </tr>\n";
124
        }
125
        echo '</table>';
126
        echo '</td></tr></table>';
127
        //Include page navigation
128
        require_once $GLOBALS['xoops']->path('class/pagenav.php');
129
        $page    = ($votes > 10) ? _AM_NEWBB_INDEX_PAGE : '';
130
        $pagenav = new \XoopsPageNav($page, 20, $start, 'start');
0 ignored issues
show
$page of type string is incompatible with the type integer expected by parameter $total_items of XoopsPageNav::__construct(). ( Ignorable by Annotation )

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

130
        $pagenav = new \XoopsPageNav(/** @scrutinizer ignore-type */ $page, 20, $start, 'start');
Loading history...
131
        echo '<div align="right" style="padding: 8px;">' . $page . '' . $pagenav->renderImageNav(4) . '</div>';
132
        echo '<fieldset>';
133
        echo '<legend>&nbsp;' . _MI_NEWBB_ADMENU_VOTE . '&nbsp;</legend>';
134
        echo _AM_NEWBB_HELP_VOTE_TAB;
135
        echo '</fieldset>';
136
        break;
137
}
138
require_once __DIR__ . '/admin_footer.php';
139