Issues (55)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  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.
  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.
  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.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  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.
  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.
  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.
  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.
  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.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  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.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
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.

components/SeriesList.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php declare(strict_types=1);
2
3
namespace GinoPane\BlogTaxonomy\Components;
4
5
use Cms\Classes\Page;
6
use GinoPane\BlogTaxonomy\Plugin;
7
use GinoPane\BlogTaxonomy\Models\Series;
8
use GinoPane\BlogTaxonomy\Classes\ComponentAbstract;
9
use GinoPane\BlogTaxonomy\Classes\TranslateArrayTrait;
10
use GinoPane\BlogTaxonomy\Classes\PostListFiltersTrait;
11
12
/**
13
 * Class SeriesList
14
 *
15
 * @package GinoPane\BlogTaxonomy\Components
16
 */
17
class SeriesList extends ComponentAbstract
18
{
19
    const NAME = 'seriesList';
20
21
    use TranslateArrayTrait;
22
    use PostListFiltersTrait;
23
24
    /**
25
     * @var Series
26
     */
27
    public $series;
28
29
    /**
30
     * Reference to the page name for linking to series
31
     *
32
     * @var string
33
     */
34
    protected $seriesPage;
35
36
    /**
37
     * If the series list should be ordered by another attribute
38
     *
39
     * @var string
40
     */
41
    public $orderBy;
42
43
    /**
44
     * Whether display or not empty series
45
     *
46
     * @var bool
47
     */
48
    public $displayEmpty;
49
50
    /**
51
     * Limits the number of records to display
52
     *
53
     * @var int
54
     */
55
    public $limit;
56
57
    /**
58
     * Whether to query related posts or not
59
     *
60
     * @var bool
61
     */
62
    private $fetchPosts;
63
64
    /**
65
     * @return array
0 ignored issues
show
Consider making the return type a bit more specific; maybe use array<string,string>.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
66
     */
67
    public function componentDetails()
68
    {
69
        return [
70
            'name'        => Plugin::LOCALIZATION_KEY . 'components.series_list.name',
71
            'description' => Plugin::LOCALIZATION_KEY . 'components.series_list.description'
72
        ];
73
    }
74
75
    /**
76
     * @return array
77
     */
78
    public function defineProperties(): array
79
    {
80
        return array_merge([
81
            'displayEmpty' => [
82
                'title'       =>    Plugin::LOCALIZATION_KEY . 'components.series_list.display_empty_title',
83
                'description' =>    Plugin::LOCALIZATION_KEY . 'components.series_list.display_empty_description',
84
                'type'        =>    'checkbox',
85
                'default'     =>    false,
86
                'showExternalParam' => false
87
            ],
88
            'fetchPosts' => [
89
                'title'             => Plugin::LOCALIZATION_KEY . 'components.series_list.fetch_posts_title',
90
                'description'       => Plugin::LOCALIZATION_KEY . 'components.series_list.fetch_posts_description',
91
                'type'              => 'checkbox',
92
                'default'           => false,
93
                'showExternalParam' => false
94
            ],
95
            'limit' => [
96
                'title'             => Plugin::LOCALIZATION_KEY . 'components.series_list.limit_title',
97
                'description'       => Plugin::LOCALIZATION_KEY . 'components.series_list.limit_description',
98
                'type'              => 'string',
99
                'default'           => '0',
100
                'validationPattern' => '^[0-9]+$',
101
                'validationMessage' => Plugin::LOCALIZATION_KEY . 'components.series_list.limit_validation_message',
102
                'showExternalParam' => false
103
            ],
104
            'orderBy' => [
105
                'title'       =>    Plugin::LOCALIZATION_KEY . 'components.series_list.order_title',
106
                'description' =>    Plugin::LOCALIZATION_KEY . 'components.series_list.order_description',
107
                'type'        =>    'dropdown',
108
                'default'     =>    'title asc',
109
                'showExternalParam' => false
110
            ],
111
            'seriesPage' => [
112
                'group'         =>  Plugin::LOCALIZATION_KEY . 'components.post_list_abstract.links_group',
113
                'title'         =>  Plugin::LOCALIZATION_KEY . 'components.series_list.series_page_title',
114
                'description'   =>  Plugin::LOCALIZATION_KEY . 'components.series_list.series_page_description',
115
                'type'          =>  'dropdown',
116
                'default'       =>  'blog/series',
117
                'showExternalParam' => false
118
            ],
119
        ], $this->getPostFilterProperties());
120
    }
121
122
    /**
123
     * @return mixed
124
     */
125
    public function getSeriesPageOptions()
126
    {
127
        return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
128
    }
129
130
    /**
131
     * @return string[]
132
     */
133
    public function getOrderByOptions(): array
134
    {
135
        $order = $this->translate(Series::$sortingOptions);
136
137
        asort($order);
138
139
        return $order;
140
    }
141
142
    /**
143
     * Prepare and return a series list
144
     *
145
     * @return mixed
146
     */
147
    public function onRun()
148
    {
149
        $this->prepareVars();
150
151
        // Exceptions
152
        $this->populateFilters();
153
154
        $this->series = $this->listSeries();
155
    }
156
157
    /**
158
     * Get Series
159
     *
160
     * @return mixed
161
     */
162
    protected function listSeries()
163
    {
164
        $series = Series::listFrontend([
165
            'sort' => $this->orderBy,
166
            'displayEmpty' => $this->displayEmpty,
167
            'limit' => $this->limit,
168
            'fetchPosts' => $this->fetchPosts,
169
            'exceptPosts' => $this->exceptPosts,
170
            'includeCategories' => $this->includeCategories,
171
            'exceptCategories' => $this->exceptCategories
172
        ]);
173
174
        $this->handleUrls($series);
175
176
        return $series;
177
    }
178
179
    /**
180
     * @param $series
181
     */
182
    protected function handleUrls($series)
183
    {
184
        $seriesComponent = $this->getComponent(SeriesPosts::NAME, $this->seriesPage);
185
186
        $this->setUrls(
187
            $series,
188
            $this->seriesPage,
189
            $this->controller,
190
            [
191
                'series' => $this->urlProperty($seriesComponent, 'series')
192
            ]
193
        );
194
    }
195
196
    private function prepareVars(): void
197
    {
198
        $this->seriesPage = $this->getProperty('seriesPage');
199
        $this->orderBy = $this->getProperty('orderBy');
200
        $this->displayEmpty = (bool)$this->getProperty('displayEmpty');
201
        $this->fetchPosts = (bool)$this->getProperty('fetchPosts');
202
        $this->limit = $this->getProperty('limit');
203
    }
204
}
205