Issues (371)

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.

class/Log.php (1 issue)

1
<?php declare(strict_types=1);
2
3
namespace XoopsModules\Xoopspoll;
4
5
/*
6
               XOOPS - PHP Content Management System
7
                   Copyright (c) 2000-2020 XOOPS.org
8
                      <https://xoops.org>
9
 This program is free software; you can redistribute it and/or modify
10
 it under the terms of the GNU General Public License as published by
11
 the Free Software Foundation; either version 2 of the License, or
12
 (at your option) any later version.
13
14
 You may not change or alter any portion of this comment or credits
15
 of supporting developers from this source code or any supporting
16
 source code which is considered copyrighted (c) material of the
17
 original comment or credit authors.
18
19
 This program is distributed in the hope that it will be useful,
20
 but WITHOUT ANY WARRANTY; without even the implied warranty of
21
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
 GNU General Public License for more details.
23
24
 You should have received a copy of the GNU General Public License
25
 along with this program; if not, write to the Free Software
26
 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
27
*/
28
29
/**
30
 * Log class for the XoopsPoll Module
31
 *
32
 * @copyright ::  {@link https://xoops.org/ XOOPS Project}
33
 * @license   ::  {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2.0 or later}
34
 * @subpackage::  class
35
 * @since     ::  1.40
36
 * @author    ::  {@link https://www.myweb.ne.jp/ Kazumi Ono (AKA onokazu)}
37
 **/
38
39
use XoopsModules\Xoopspoll\{
40
    Helper
0 ignored issues
show
This use statement conflicts with another class in this namespace, XoopsModules\Xoopspoll\Helper. Consider defining an alias.

Let?s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let?s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
41
};
42
43
/**
44
 * Log() class definition for Log Objects
45
 * @author:: zyspec <[email protected]>
46
 * @uses  ::   xoops_getModuleHandler poll module handler for class use
47
 */
48
class Log extends \XoopsObject
49
{
50
    public int    $log_id;
51
    public int    $poll_id;
52
    public int    $option_id;
53
    public string $ip;
54
    public int    $user_id;
55
    public int    $time;
56
57
    //  class Log extends \XoopsObject {
58
    //    var $db;
59
60
    /**
61
     * Constructor
62
     * @param int|null $id
63
     */
64
    public function __construct(int $id = null)
65
    {
66
        parent::__construct();
67
        $this->initVar('log_id', \XOBJ_DTYPE_INT, 0);
68
        $this->initVar('poll_id', \XOBJ_DTYPE_INT, null, true);
69
        $this->initVar('option_id', \XOBJ_DTYPE_INT, null, true);
70
        $this->initVar('ip', \XOBJ_DTYPE_OTHER, null);
71
        $this->initVar('user_id', \XOBJ_DTYPE_INT, 0);
72
        $this->initVar('time', \XOBJ_DTYPE_INT, null);
73
//        if (!empty($id) && \is_array($id)) {
74
//            $this->assignVars($id);
75
//        }
76
    }
77
78
    /**
79
     * The following method is provided for backward compatibility with newbb
80
     * @param int $pid
81
     * @return mixed
82
     * @deprecated since Xoopspoll 1.40, please use LogHandler & Log
83
     */
84
    public static function deleteByPollId(int $pid): mixed
85
    {
86
        $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
87
        $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
88
        /** @var LogHandler $slogHandler */
89
        $slogHandler = self::getStaticLogHandler();
90
        $criteria    = new \Criteria('poll_id', (int)$pid, '=');
91
92
        return $slogHandler->deleteAll($criteria);
93
    }
94
95
    /**
96
     * @param int $opt_id
97
     * @return mixed
98
     */
99
    public static function deleteByOptionId(int $opt_id): mixed
100
    {
101
        $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
102
        $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
103
104
        /** @var LogHandler $slogHandler */
105
        $slogHandler = self::getStaticLogHandler();
106
        $criteria    = new \Criteria('option_id', (int)$opt_id, '=');
107
108
        return $slogHandler->deleteAll($criteria);
109
    }
110
111
    /**
112
     * @param int $pid
113
     * @param string $ip
114
     * @param int $uid
115
     * @return mixed
116
     */
117
    public static function hasVoted(int $pid, string $ip, int $uid): mixed
118
    {
119
        $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
120
        $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
121
122
        /** @var LogHandler $slogHandler */
123
        $slogHandler = self::getStaticLogHandler();
124
125
        return $slogHandler->hasVoted($pid, $ip, $uid);
126
    }
127
128
    /**
129
     * @return bool
130
     */
131
    private static function getStaticLogHandler(): bool
132
    {
133
        static $logHandler;
134
        $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1);
135
        $GLOBALS['xoopsLogger']->addDeprecated(__CLASS__ . '::' . __FUNCTION__ . ' is deprecated since Xoopspoll 1.40, please use Log and LogHandler methods instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}");
136
137
        if (!isset($logHandler)) {
138
            $logHandler = Helper::getInstance()->getHandler('Log');
139
        }
140
141
        return $logHandler;
142
    }
143
    /**#@-*/
144
}
145