Issues (608)

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/Lists.php (7 issues)

1
<?php
2
3
namespace XoopsModules\Oledrion;
4
5
/*
6
 You may not change or alter any portion of this comment or credits
7
 of supporting developers from this source code or any supporting source code
8
 which is considered copyrighted (c) material of the original comment or credit authors.
9
10
 This program is distributed in the hope that it will be useful,
11
 but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
*/
14
15
/**
16
 * oledrion
17
 *
18
 * @copyright   {@link https://xoops.org/ XOOPS Project}
19
 * @license     {@link http://www.fsf.org/copyleft/gpl.html GNU public license}
20
 * @author      Hervé Thouzard (http://www.herve-thouzard.com/)
21
 */
22
23
/**
24
 * Gestion des listes utilisateurs
25
 *
26
 * @since 2.3.2009.06.13
27
 */
28
29
use XoopsModules\Oledrion;
30
31
/**
32
 * Class Lists
33
 */
34
class Lists extends OledrionObject
35
{
36
    /**
37
     * constructor
38
     *
39
     * normally, this is called from child classes only
40
     */
41
    public function __construct()
42
    {
43
        $this->initVar('list_id', XOBJ_DTYPE_INT, null, false);
44
        $this->initVar('list_uid', XOBJ_DTYPE_INT, null, false);
45
        $this->initVar('list_title', XOBJ_DTYPE_TXTBOX, null, false);
46
        $this->initVar('list_date', XOBJ_DTYPE_INT, null, false);
47
        $this->initVar('list_productscount', XOBJ_DTYPE_INT, null, false);
48
        $this->initVar('list_views', XOBJ_DTYPE_INT, null, false);
49
        $this->initVar('list_password', XOBJ_DTYPE_TXTBOX, null, false);
50
        $this->initVar('list_type', XOBJ_DTYPE_INT, null, false);
51
        $this->initVar('list_description', XOBJ_DTYPE_OTHER, null, false);
52
    }
53
54
    /**
55
     * Indique si la liste courante est accessible de l'utilisateur courant
56
     *
57
     * @return bool
58
     */
59
    public function isSuitableForCurrentUser()
60
    {
61
        $uid = Oledrion\Utility::getCurrentUserID();
62
        if (Constants::OLEDRION_LISTS_PRIVATE == $this->getVar('list_type')) {
63
            if (0 == $uid || $uid != $this->getVar('list_uid')) {
64
                return false;
65
            }
66
        }
67
68
        return true;
69
    }
70
71
    /**
72
     * Retourne un tableau associatif qui pour chaque type de liste indique son type sous forme de texte
73
     *
74
     * @return array
75
     */
76
    public static function getTypesArray()
77
    {
78
        return [
79
            Constants::OLEDRION_LISTS_PRIVATE   => _OLEDRION_LIST_PRIVATE,
80
            Constants::OLEDRION_LISTS_WISH      => _OLEDRION_LIST_PUBLIC_WISH_LIST,
81
            Constants::OLEDRION_LISTS_RECOMMEND => _OLEDRION_LIST_PUBLIC_RECOMMENDED_LIST,
82
        ];
83
    }
84
85
    /**
86
     * Retourne la description de la liste courante
87
     *
88
     * @return string
89
     */
90
    public function getListTypeDescription()
91
    {
92
        $description = static::getTypesArray();
93
94
        return $description[$this->list_type];
0 ignored issues
show
Bug Best Practice introduced by
The property list_type does not exist on XoopsModules\Oledrion\Lists. Since you implemented __get, consider adding a @property annotation.
Loading history...
95
    }
96
97
    /**
98
     * Retourne l'url à utiliser pour accéder à la liste en tenant compte des préférences du module
99
     *
100
     * @return string L'url à utiliser
101
     */
102
    public function getLink()
103
    {
104
        $url = '';
105
        if (1 == Oledrion\Utility::getModuleOption('urlrewriting')) {
106
            // On utilise l'url rewriting
107
            $url = OLEDRION_URL . 'list-' . $this->getVar('list_id') . Oledrion\Utility::makeSeoUrl($this->getVar('list_title', 'n')) . '.html';
0 ignored issues
show
It seems like $this->getVar('list_title', 'n') can also be of type array and array; however, parameter $content of XoopsModules\Oledrion\Utility::makeSeoUrl() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

107
            $url = OLEDRION_URL . 'list-' . $this->getVar('list_id') . Oledrion\Utility::makeSeoUrl(/** @scrutinizer ignore-type */ $this->getVar('list_title', 'n')) . '.html';
Loading history...
108
        } else {
109
            // Pas d'utilisation de l'url rewriting
110
            $url = OLEDRION_URL . 'list.php?list_id=' . $this->getVar('list_id');
111
        }
112
113
        return $url;
114
    }
115
116
    /**
117
     * Retourne la date de création de la liste formatée
118
     *
119
     * @param  string $format
120
     * @return string
121
     */
122
    public function getFormatedDate($format = 's')
123
    {
124
        return formatTimestamp($this->list_date, $format);
0 ignored issues
show
Bug Best Practice introduced by
The property list_date does not exist on XoopsModules\Oledrion\Lists. Since you implemented __get, consider adding a @property annotation.
Loading history...
125
    }
126
127
    /**
128
     * Rentourne la chaine à utiliser dans une balise <a> pour l'attribut href
129
     *
130
     * @return string
131
     */
132
    public function getHrefTitle()
133
    {
134
        return Oledrion\Utility::makeHrefTitle($this->getVar('list_title'));
0 ignored issues
show
It seems like $this->getVar('list_title') can also be of type array and array; however, parameter $title of XoopsModules\Oledrion\Utility::makeHrefTitle() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

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

134
        return Oledrion\Utility::makeHrefTitle(/** @scrutinizer ignore-type */ $this->getVar('list_title'));
Loading history...
135
    }
136
137
    /**
138
     * Retourne le nom de l'auteur de la liste courante
139
     *
140
     * @return string
141
     */
142
    public function getListAuthorName()
143
    {
144
        return \XoopsUser::getUnameFromId($this->getVar('list_uid', true));
0 ignored issues
show
true of type true is incompatible with the type null|string expected by parameter $format of XoopsObject::getVar(). ( Ignorable by Annotation )

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

144
        return \XoopsUser::getUnameFromId($this->getVar('list_uid', /** @scrutinizer ignore-type */ true));
Loading history...
145
    }
146
147
    /**
148
     * Retourne les éléments formatés pour affichage (en général)
149
     *
150
     * @param  string $format
151
     * @return array
152
     */
153
    public function toArray($format = 's')
154
    {
155
        $ret                          = [];
0 ignored issues
show
The assignment to $ret is dead and can be removed.
Loading history...
156
        $ret                          = parent::toArray($format);
157
        $ret['list_type_description'] = $this->getListTypeDescription();
158
        $ret['list_href_title']       = $this->getHrefTitle();
159
        $ret['list_url_rewrited']     = $this->getLink();
160
        $ret['list_formated_date']    = $this->getFormatedDate();
161
        $ret['list_username']         = $this->getListAuthorName();
162
        $ret['list_formated_count']   = sprintf(_OLEDRION_PRODUCTS_COUNT, $this->getVar('list_productscount'));
0 ignored issues
show
It seems like $this->getVar('list_productscount') can also be of type array and array; however, parameter $values of sprintf() does only seem to accept double|integer|string, maybe add an additional type check? ( Ignorable by Annotation )

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

162
        $ret['list_formated_count']   = sprintf(_OLEDRION_PRODUCTS_COUNT, /** @scrutinizer ignore-type */ $this->getVar('list_productscount'));
Loading history...
163
164
        return $ret;
165
    }
166
}
167