Issues (201)

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.

includes/Admin/View/CategoryForm.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
2
namespace Redaxscript\Admin\View;
3
4
use Redaxscript\Admin;
5
use Redaxscript\Dater;
6
use Redaxscript\Html;
7
use Redaxscript\Module;
8
use Redaxscript\Validator;
9
use function count;
10
use function json_decode;
11
12
/**
13
 * children class to create the category form
14
 *
15
 * @since 3.0.0
16
 *
17
 * @package Redaxscript
18
 * @category View
19
 * @author Henry Ruhs
20
 */
21
22
class CategoryForm extends ViewAbstract
23
{
24
	/**
25
	 * render the view
26
	 *
27
	 * @since 3.0.0
28
	 *
29
	 * @param int $categoryId identifier of the category
30
	 *
31
	 * @return string
32
	 */
33
34 4
	public function render(int $categoryId = null) : string
35
	{
36 4
		$output = Module\Hook::trigger('adminCategoryFormStart');
37 4
		$helperOption = new Helper\Option($this->_language);
38 4
		$categoryModel = new Admin\Model\Category();
39 4
		$category = $categoryModel->getById($categoryId);
40 4
		$nameValidator = new Validator\Name();
41 4
		$aliasValidator = new Validator\Alias();
42 4
		$dater = new Dater();
43 4
		$dater->init($category?->date);
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_OBJECT_OPERATOR
Loading history...
44
45
		/* html element */
46
47 4
		$titleElement = new Html\Element();
48
		$titleElement
49 4
			->init('h2',
50
			[
51 4
				'class' => 'rs-admin-title-content',
52
			])
53 4
			->text($category?->id ? $category?->title : $this->_language->get('category_new'));
54 4
		$formElement = new Admin\Html\Form($this->_registry, $this->_language);
55 4
		$formElement->init(
56
		[
57
			'form' =>
58
			[
59 4
				'class' => 'rs-admin-js-validate rs-admin-js-alias rs-admin-fn-tab rs-admin-component-tab rs-admin-form-default rs-admin-form-category'
60
			],
61
			'button' =>
62
			[
63
				'create' =>
64
				[
65
					'name' => self::class
66
				],
67
				'save' =>
68
				[
69
					'name' => self::class
70
				]
71
			],
72
			'link' =>
73
			[
74
				'cancel' =>
75
				[
76 4
					'href' => $this->_registry->get('categoriesEdit') && $this->_registry->get('categoriesDelete') ? $this->_registry->get('parameterRoute') . 'admin/view/categories' : $this->_registry->get('parameterRoute') . 'admin'
77
				],
78
				'delete' =>
79
				[
80 4
					'href' => $category?->id ? $this->_registry->get('parameterRoute') . 'admin/delete/categories/' . $category?->id . '/' . $this->_registry->get('token') : null
81
				]
82
			]
83
		]);
84
85
		/* create the form */
86
87
		$formElement
88
89
			/* category */
90
91 4
			->radio(
92
			[
93 4
				'id' => self::class . '\Category',
94
				'class' => 'rs-admin-fn-status-tab',
95
				'name' => self::class . '\Tab',
96
				'checked' => 'checked'
97
			])
98 4
			->label($this->_language->get('category'),
99
			[
100 4
				'class' => 'rs-admin-fn-toggle-tab rs-admin-label-tab',
101
				'for' => self::class . '\Category'
102
			])
103 4
			->append('<ul class="rs-admin-fn-content-tab rs-admin-box-tab"><li>')
104 4
			->label($this->_language->get('title'),
105
			[
106 4
				'for' => 'title'
107
			])
108 4
			->text(
109
			[
110 4
				'autofocus' => 'autofocus',
111 4
				'class' => 'rs-admin-js-alias-input rs-admin-field-default rs-admin-field-text',
112 4
				'id' => 'title',
113 4
				'name' => 'title',
114 4
				'pattern' => $nameValidator->getPattern(),
115 4
				'required' => 'required',
116 4
				'value' => $category?->title
117
			])
118 4
			->append('</li><li>')
119 4
			->label($this->_language->get('alias'),
120
			[
121 4
				'for' => 'alias'
122
			])
123 4
			->text(
124
			[
125 4
				'class' => 'rs-admin-js-alias-output rs-admin-field-default rs-admin-field-text',
126 4
				'id' => 'alias',
127 4
				'name' => 'alias',
128 4
				'pattern' => $aliasValidator->getPattern(),
129 4
				'required' => 'required',
130 4
				'value' => $category?->alias
131
			])
132 4
			->append('</li><li>')
133 4
			->label($this->_language->get('description'),
134
			[
135 4
				'for' => 'description'
136
			])
137 4
			->textarea(
138
			[
139 4
				'class' => 'rs-admin-js-resize rs-admin-field-textarea rs-admin-field-small',
140 4
				'id' => 'description',
141 4
				'name' => 'description',
142 4
				'rows' => 1,
143 4
				'value' => $category?->description
144
			])
145 4
			->append('</li><li>')
146 4
			->label($this->_language->get('keywords'),
147
			[
148 4
				'for' => 'keywords'
149
			])
150 4
			->textarea(
151
			[
152 4
				'class' => 'rs-admin-js-resize rs-admin-field-textarea rs-admin-field-small',
153 4
				'id' => 'keywords',
154 4
				'name' => 'keywords',
155 4
				'rows' => 1,
156 4
				'value' => $category?->keywords
157
			])
158 4
			->append('</li><li>')
159 4
			->label($this->_language->get('robots'),
160
			[
161 4
				'for' => 'robots'
162
			])
163 4
			->select($helperOption->getRobotArray(),
164
			[
165 4
				$category?->robots
166
			],
167
			[
168 4
				'id' => 'robots',
169
				'name' => 'robots'
170
			])
171 4
			->append('</li></ul>')
172
173
			/* general */
174
175 4
			->radio(
176
			[
177 4
				'id' => self::class . '\General',
178
				'class' => 'rs-admin-fn-status-tab',
179
				'name' => self::class . '\Tab'
180
			])
181 4
			->label($this->_language->get('general'),
182
			[
183 4
				'class' => 'rs-admin-fn-toggle-tab rs-admin-label-tab',
184
				'for' => self::class . '\General'
185
			])
186 4
			->append('<ul class="rs-admin-fn-content-tab rs-admin-box-tab"><li>')
187 4
			->label($this->_language->get('language'),
188
			[
189 4
				'for' => 'language'
190
			])
191 4
			->select($helperOption->getLanguageArray(),
192
			[
193 4
				$category?->language
194
			],
195
			[
196 4
				'id' => 'language',
197
				'name' => 'language'
198
			])
199 4
			->append('</li><li>')
200 4
			->label($this->_language->get('template'),
201
			[
202 4
				'for' => 'template'
203
			])
204 4
			->select($helperOption->getTemplateArray(),
205
			[
206 4
				$category?->template
207
			],
208
			[
209 4
				'id' => 'template',
210
				'name' => 'template'
211
			])
212 4
			->append('</li><li>')
213 4
			->label($this->_language->get('category_sibling'),
214
			[
215 4
				'for' => 'sibling'
216
			])
217 4
			->select($helperOption->getSiblingForCategoryArray($category?->id),
218
			[
219 4
				$category?->sibling
220
			],
221
			[
222 4
				'id' => 'sibling',
223
				'name' => 'sibling'
224
			])
225 4
			->append('</li><li>')
226 4
			->label($this->_language->get('category_parent'),
227
			[
228 4
				'for' => 'parent'
229
			])
230 4
			->select($helperOption->getParentForCategoryArray($category?->id),
231
			[
232 4
				$category?->parent
233
			],
234
			[
235 4
				'id' => 'parent',
236
				'name' => 'parent'
237
			])
238 4
			->append('</li></ul>')
239
240
			/* customize */
241
242 4
			->radio(
243
			[
244 4
				'id' => self::class . '\Customize',
245
				'class' => 'rs-admin-fn-status-tab',
246
				'name' => self::class . '\Tab'
247
			])
248 4
			->label($this->_language->get('customize'),
249
			[
250 4
				'class' => 'rs-admin-fn-toggle-tab rs-admin-label-tab',
251
				'for' => self::class . '\Customize'
252
			])
253 4
			->append('<ul class="rs-admin-fn-content-tab rs-admin-box-tab"><li>')
254 4
			->label($this->_language->get('status'),
255
			[
256 4
				'for' => 'status'
257
			])
258 4
			->checkbox(!$category?->id || $category?->status ?
259
			[
260 4
				'id' => 'status',
261
				'class' => 'rs-admin-fn-status-switch',
262
				'name' => 'status',
263
				'checked' => 'checked'
264
			] :
265
			[
266 4
				'id' => 'status',
267
				'class' => 'rs-admin-fn-status-switch',
268
				'name' => 'status'
269
			])
270 4
			->label(null,
271
			[
272 4
				'class' => 'rs-admin-label-switch',
273 4
				'for' => 'status',
274 4
				'data-on' => $this->_language->get('publish'),
275 4
				'data-off' => $this->_language->get('unpublish')
276
			])
277 4
			->append('</li><li>')
278 4
			->label($this->_language->get('rank'),
279
			[
280 4
				'for' => 'rank'
281
			])
282 4
			->number(
283
			[
284 4
				'id' => 'rank',
285 4
				'name' => 'rank',
286 4
				'value' => $category?->id ? $category?->rank : $categoryModel->query()->max('rank') + 1
287
			])
288 4
			->append('</li>');
289 4
		if ($this->_registry->get('groupsEdit'))
290
		{
291
			$formElement
292 4
				->append('<li>')
293 4
				->label($this->_language->get('access'),
294
				[
295 4
					'for' => 'access'
296
				])
297 4
				->select($helperOption->getGroupArray(),
298 4
				(array)json_decode($category?->access),
299
				[
300 4
					'id' => 'access',
301 4
					'name' => 'access[]',
302 4
					'multiple' => 'multiple',
303 4
					'size' => count($helperOption->getGroupArray())
304
				])
305 4
				->append('</li>');
306
		}
307
		$formElement
308 4
			->append('<li>')
309 4
			->label($this->_language->get('date'),
310
			[
311 4
				'for' => 'date'
312
			])
313 4
			->datetime(
314
			[
315 4
				'id' => 'date',
316 4
				'name' => 'date',
317 4
				'value' => $dater->formatField()
318
			])
319 4
			->append('</li></ul>');
320 4
		if ($category?->id)
321
		{
322 4
			$formElement
323 4
				->hidden(
324
				[
325 4
					'name' => 'id',
326 4
					'value' => $category?->id
327 4
				]);
328 4
		}
329
		$formElement
330 2
			->token()
331
			->append('<div class="rs-admin-wrapper-button">')
332 1
			->cancel();
333
		if ($category?->id)
334 2
		{
335
			if ($this->_registry->get('categoriesDelete'))
336 2
			{
337
				$formElement->delete();
338
			}
339 2
			if ($this->_registry->get('categoriesEdit'))
340
			{
341 1
				$formElement->save();
342
			}
343 4
		}
344
		else if ($this->_registry->get('categoriesNew'))
345
		{
346
			$formElement->create();
347 4
		}
348 4
		$formElement->append('</div>');
349 4
350
		/* collect output */
351
352
		$output .= $titleElement . $formElement;
353
		$output .= Module\Hook::trigger('adminCategoryFormEnd');
354
		return $output;
355
	}
356
}
357