Issues (116)

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

1
<?php
2
3
namespace XoopsModules\Xooghost;
4
5
/**
6
 * XooPaginate : Page navigation manager
7
 *
8
 * You may not change or alter any portion of this comment or credits
9
 * of supporting developers from this source code or any supporting source code
10
 * which is considered copyrighted (c) material of the original comment or credit authors.
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 *
15
 * @copyright       XOOPS Project (https://xoops.org)
16
 * @license         GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html)
17
 * @package         Xooghost
18
 * @since           2.6.0
19
 * @author          Laurent JEN (Aka DuGris)
20
 */
21
use Xoops\Core\Request;
22
23
/**
24
 * Class XooPaginate
25
 */
26
class XooPaginate
27
{
28
    private $prev;
29
    private $next;
30
    private $first;
31
    private $last;
32
33
    private $total;
34
    private $perpage;
35
    private $current;
36
    private $extra;
37
    private $url;
38
    private $offset;
39
40
    /**
41
     * @param        $total_items
42
     * @param        $items_perpage
43
     * @param        $current_start
44
     * @param string $start_name
45
     * @param string $extra_arg
46
     * @param int    $offset
47
     */
48
    public function __construct($total_items, $items_perpage, $current_start, $start_name = 'start', $extra_arg = '', $offset = 1)
49
    {
50
        $this->total = (int)$total_items;
51
        $this->perpage = (int)$items_perpage;
52
        $this->current = (int)$current_start;
53
        $this->extra = $extra_arg;
54
        if ('' != $extra_arg && ('&amp;' !== mb_substr($extra_arg, -5) || '&' !== mb_substr($extra_arg, -1))) {
55
            $this->extra = '&amp;' . $extra_arg;
56
        }
57
        $this->url = Request::getString('PHP_SELF', '', 'SERVER') . '?' . trim($start_name) . '=';
58
        $this->offset = (int)$offset;
59
60
        $this->render();
61
    }
62
63
    /**
64
     * @param $key
65
     *
66
     * @return mixed
67
     */
68
    public function getValue($key)
69
    {
70
        return $this->$key;
71
    }
72
73
    public function display()
74
    {
75
        echo $this->render();
76
    }
77
78
    /**
79
     * @return mixed|string
80
     */
81
    private function render()
82
    {
83
        $xoops = \Xoops::getInstance();
84
        $xoops->tpl()->assign('xoopaginate', $this);
85
86
        $total_pages = ceil($this->total / $this->perpage);
87
        $i = 0;
88
        if (0 != $this->total && 0 != $this->perpage) {
89
            if (($this->current - $this->perpage) >= 0) {
90
                $this->prev = $this->url . ($this->current - $this->perpage) . $this->extra;
91
                $this->first = $this->url . 0 . $this->extra;
92
            }
93
94
            $counter = 1;
95
            $current_page = (int)floor(($this->current + $this->perpage) / $this->perpage);
96
            while ($counter <= $total_pages) {
97
                if ($counter == $current_page) {
98
                    $pages[$i]['text'] = $counter;
99
                    $pages[$i]['link'] = $this->url . (($counter - 1) * $this->perpage) . $this->extra;
100
                    $pages[$i]['value'] = (($counter - 1) * $this->perpage);
101
102
                    ++$i;
103
                } elseif (($counter > $current_page - $this->offset && $counter < $current_page + $this->offset) || 1 == $counter || $counter == $total_pages) {
104
                    if ($counter == $total_pages && $current_page < $total_pages - $this->offset) {
105
                        $pages[$i]['link'] = false;
106
                        $pages[$i]['text'] = '...';
107
                        $pages[$i]['value'] = '.';
108
                        ++$i;
109
                    }
110
                    $pages[$i]['text'] = $counter;
111
                    $pages[$i]['link'] = $this->url . (($counter - 1) * $this->perpage) . $this->extra;
112
                    $pages[$i]['value'] = (($counter - 1) * $this->perpage);
113
                    ++$i;
114
                    if (1 == $counter && $current_page > 1 + $this->offset) {
115
                        $pages[$i]['link'] = false;
116
                        $pages[$i]['text'] = '...';
117
                        $pages[$i]['value'] = '.';
118
                        ++$i;
119
                    }
120
                }
121
                ++$counter;
122
            }
123
124
            if (($this->current + $this->perpage) < $this->total) {
125
                $this->next = $this->url . ($this->current + $this->perpage) . $this->extra;
126
                $this->last = $this->url . (($counter - 2) * $this->perpage) . $this->extra;
127
            }
128
        }
129
        if ($this->total >= $this->perpage && ceil($this->total / $this->perpage) > 1) {
130
            $xoops->tpl()->assign('xoopages', $pages);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $pages does not seem to be defined for all execution paths leading up to this point.
Loading history...
131
        }
132
133
        return $xoops->tpl()->fetch('module:xooghost/xoo_paginate.tpl');
134
    }
135
}
136