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/Category.php (3 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
use XoopsModules\Oledrion;
24
25
/**
26
 * Product category management
27
 */
28
29
/**
30
 * Class Category
31
 */
32
class Category extends OledrionObject
33
{
34
    /**
35
     * constructor
36
     *
37
     * normally, this is called from child classes only
38
     */
39
    public function __construct()
40
    {
41
        $this->initVar('cat_cid', XOBJ_DTYPE_INT, null, false);
42
        $this->initVar('cat_pid', XOBJ_DTYPE_INT, null, false);
43
        $this->initVar('cat_title', XOBJ_DTYPE_TXTBOX, null, false);
44
        $this->initVar('cat_imgurl', XOBJ_DTYPE_TXTBOX, null, false);
45
        $this->initVar('cat_description', XOBJ_DTYPE_OTHER, null, false);
46
        $this->initVar('cat_advertisement', XOBJ_DTYPE_OTHER, null, false);
47
        $this->initVar('cat_metakeywords', XOBJ_DTYPE_TXTBOX, null, false);
48
        $this->initVar('cat_metadescription', XOBJ_DTYPE_TXTBOX, null, false);
49
        $this->initVar('cat_metatitle', XOBJ_DTYPE_TXTBOX, null, false);
50
        $this->initVar('cat_footer', XOBJ_DTYPE_OTHER, null, false);
51
        // Pour autoriser le html
52
        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
53
    }
54
55
    /**
56
     * Returns the image URL of the current category
57
     * @return string URL
58
     */
59
    public function getPictureUrl()
60
    {
61
        return OLEDRION_PICTURES_URL . '/' . $this->getVar('cat_imgurl');
62
    }
63
64
    /**
65
     * Return the image path of the current category
66
     * @return string The path
67
     */
68
    public function getPicturePath()
69
    {
70
        return OLEDRION_PICTURES_PATH . '/' . $this->getVar('cat_imgurl');
71
    }
72
73
    /**
74
     * Indicates whether the category image exists
75
     *
76
     * @return bool True if the image exists if not false
77
     */
78
    public function pictureExists()
79
    {
80
        $return = false;
81
        if ('' !== xoops_trim($this->getVar('cat_imgurl')) && file_exists(OLEDRION_PICTURES_PATH . '/' . $this->getVar('cat_imgurl'))) {
82
            $return = true;
83
        }
84
85
        return $return;
86
    }
87
88
    /**
89
     * Deletes the image associated with a category
90
     */
91
    public function deletePicture()
92
    {
93
        if ($this->pictureExists()) {
94
            if (false === @unlink(OLEDRION_PICTURES_PATH . '/' . $this->getVar('cat_imgurl'))) {
95
                throw new \RuntimeException('The picture ' . OLEDRION_PICTURES_PATH . '/' . $this->getVar('cat_imgurl') . ' could not be deleted.');
96
            }
97
        }
98
        $this->setVar('cat_imgurl', '');
99
    }
100
101
    /**
102
     * Returns the url to use to access the category taking into account the preferences of the module
103
     *
104
     * @return string The url to use
105
     */
106
    public function getLink()
107
    {
108
        require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php';
109
        $url = '';
110
        if (1 == Oledrion\Utility::getModuleOption('urlrewriting')) {
111
            // On utilise l'url rewriting
112
            $url = OLEDRION_URL . 'category-' . $this->getVar('cat_cid') . Oledrion\Utility::makeSeoUrl($this->getVar('cat_title', 'n')) . '.html';
0 ignored issues
show
It seems like $this->getVar('cat_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

112
            $url = OLEDRION_URL . 'category-' . $this->getVar('cat_cid') . Oledrion\Utility::makeSeoUrl(/** @scrutinizer ignore-type */ $this->getVar('cat_title', 'n')) . '.html';
Loading history...
113
        } else {
114
            // Pas d'utilisation de l'url rewriting
115
            $url = OLEDRION_URL . 'category.php?cat_cid=' . $this->getVar('cat_cid');
116
        }
117
118
        return $url;
119
    }
120
121
    /**
122
     * Gets the string to send in a <a> tag for the href attribute
123
     *
124
     * @return string|array
125
     */
126
    public function getHrefTitle()
127
    {
128
        return Oledrion\Utility::makeHrefTitle($this->getVar('cat_title'));
0 ignored issues
show
It seems like $this->getVar('cat_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

128
        return Oledrion\Utility::makeHrefTitle(/** @scrutinizer ignore-type */ $this->getVar('cat_title'));
Loading history...
129
    }
130
131
    /**
132
     * Returns the elements of the products formatted for display
133
     *
134
     * @param  string $format
135
     * @return array
136
     */
137
    public function toArray($format = 's')
138
    {
139
        $ret                     = [];
0 ignored issues
show
The assignment to $ret is dead and can be removed.
Loading history...
140
        $ret                     = parent::toArray($format);
141
        $ret['cat_full_imgurl']  = $this->getPictureUrl();
142
        $ret['cat_href_title']   = $this->getHrefTitle();
143
        $ret['cat_url_rewrited'] = $this->getLink();
144
145
        return $ret;
146
    }
147
}
148