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.

modules/Dialog/Dialog.php (1 issue)

Labels
Severity

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\Modules\Dialog;
3
4
use Redaxscript\Head;
5
use Redaxscript\Html;
6
use Redaxscript\Module;
7
8
/**
9
 * shared module to replace alert, confirm and prompt
10
 *
11
 * @since 4.0.0
12
 *
13
 * @package Redaxscript
14
 * @category Modules
15
 * @author Henry Ruhs
16
 */
17
18
class Dialog extends Module\Module
19
{
20
	/**
21
	 * array of the module
22
	 *
23
	 * @var array
24
	 */
25
26
	protected static array $_moduleArray =
0 ignored issues
show
This code did not parse for me. Apparently, there is an error somewhere around this line:

Syntax error, unexpected T_ARRAY, expecting T_FUNCTION or T_CONST
Loading history...
27
	[
28
		'name' => 'Dialog',
29
		'alias' => 'Dialog',
30
		'author' => 'Redaxmedia',
31
		'description' => 'Shared module to replace alert, confirm and prompt',
32
		'version' => '5.0.0',
33
		'license' => 'MIT'
34
	];
35
36
	/**
37
	 * array of the option
38
	 *
39
	 * @var array
40
	 */
41
42
	protected array $_optionArray =
43
	[
44
		'className' =>
45
		[
46
			'overlay' => 'rs-overlay-dialog',
47
			'component' => 'rs-component-dialog',
48
			'title' => 'rs-title-dialog',
49
			'box' => 'rs-box-dialog',
50
			'text' => 'rs-text-dialog',
51
			'field' => 'rs-js-input rs-field-default rs-field-text',
52
			'button' => 'rs-button-default',
53
			'buttonOk' => 'rs-js-ok rs-button-ok',
54
			'buttonCancel' => 'rs-js-cancel rs-button-cancel'
55
		]
56
	];
57
58
	/**
59
	 * renderStart
60
	 *
61
	 * @since 4.0.0
62
	 */
63
64
	public function renderStart() : void
65
	{
66
		$firstParameter = $this->_registry->get('firstParameter');
67
		$secondParameter = $this->_registry->get('secondParameter');
68
		$thirdParameter = $this->_registry->get('thirdParameter');
69
70
		/* link */
71
72
		$link = Head\Link::getInstance();
73
		$link
74
			->init()
75
			->appendFile('modules/Dialog/dist/styles/dialog.min.css');
76
77
		/* script */
78
79
		$script = Head\Script::getInstance();
80
		$script
81
			->init('foot')
82
			->appendFile(
83
			[
84
				'modules/Dialog/assets/scripts/init.js',
85
				'modules/Dialog/dist/scripts/dialog.min.js'
86
			]);
87
88
		/* route as needed */
89
90
		if ($firstParameter === 'module' && ($secondParameter === 'dialog' || $secondParameter === 'admin-dialog'))
91
		{
92
			$this->_registry->set('renderBreak', true);
93
			$dialog = $secondParameter === 'admin-dialog' ? new Admin\Dialog($this->_registry, $this->_request, $this->_language, $this->_config) : $this;
94
			$message = $this->_request->getStream('message');
95
			$title = $this->_request->getStream('title');
96
97
			/* run as needed */
98
99
			if ($thirdParameter === 'alert')
100
			{
101
				echo $dialog->alert($message, $title);
102
			}
103
			if ($thirdParameter === 'confirm')
104
			{
105
				echo $dialog->confirm($message, $title);
106
			}
107
			if ($thirdParameter === 'prompt')
108
			{
109
				echo $dialog->prompt($message, $title);
110
			}
111
		}
112
	}
113
114
	/**
115
	 * alert
116
	 *
117
	 * @since 4.0.0
118
	 *
119
	 * @param string $message message of the alert
120
	 * @param string $title title of the alert
121
	 *
122
	 * @return string
123
	 */
124
125
	public function alert(string $message = null, string $title = null) : string
126
	{
127
		return $this->_dialog('alert', $message, $title ? : $this->_language->get('_dialog')['alert']);
128
	}
129
130
	/**
131
	 * confirm
132
	 *
133
	 * @since 4.0.0
134
	 *
135
	 * @param string $message message of the confirm
136
	 * @param string $title title of the confirm
137
	 *
138
	 * @return string
139
	 */
140
141
	public function confirm(string $message = null, string $title = null) : string
142
	{
143
		return $this->_dialog('confirm', $message, $title ? : $this->_language->get('_dialog')['confirm']);
144
	}
145
146
	/**
147
	 * prompt
148
	 *
149
	 * @since 4.0.0
150
	 *
151
	 * @param string $message message of the prompt
152
	 * @param string $title title of the prompt
153
	 *
154
	 * @return string
155
	 */
156
157
	public function prompt(string $message = null, string $title = null) : string
158
	{
159
		return $this->_dialog('prompt', $message, $title ? : $this->_language->get('_dialog')['prompt']);
160
	}
161
162
	/**
163
	 * dialog
164
	 *
165
	 * @since 4.0.0
166
	 *
167
	 * @param string $type type of the dialog
168
	 * @param string $message message of the dialog
169
	 * @param string $title title of the dialog
170
	 *
171
	 * @return string
172
	 */
173
174
	protected function _dialog(string $type = null, string $message = null, string $title = null) : string
175
	{
176
		$output = null;
177
178
		/* html elements */
179
180
		$element = new Html\Element();
181
		$overlayElement = $element
182
			->copy()
183
			->init('div',
184
			[
185
				'class' => $this->_optionArray['className']['overlay']
186
			]);
187
		$dialogElement = $element
188
			->copy()
189
			->init('div',
190
			[
191
				'class' => $this->_optionArray['className']['component']
192
			]);
193
		$titleElement = $element
194
			->copy()
195
			->init('h3',
196
			[
197
				'class' => $this->_optionArray['className']['title']
198
			])
199
			->text($title);
200
		$boxElement = $element
201
			->copy()
202
			->init('div',
203
			[
204
				'class' => $this->_optionArray['className']['box']
205
			]);
206
		$textElement = $message ? $element
207
			->copy()
208
			->init('p',
209
			[
210
				'class' => $this->_optionArray['className']['text']
211
			])
212
			->text($message) : null;
213
		$fieldElement = $type === 'prompt' ? $element
214
			->copy()
215
			->init('input',
216
			[
217
				'class' => $this->_optionArray['className']['field']
218
			]) : null;
219
		$buttonElement = $element
220
			->copy()
221
			->init('button',
222
			[
223
				'class' => $this->_optionArray['className']['button']
224
			]);
225
		$buttonOkElement = $buttonElement
226
			->copy()
227
			->addClass($this->_optionArray['className']['buttonOk'])
228
			->text($this->_language->get('ok'));
229
		$buttonCancelElement = $type === 'confirm' || $type === 'prompt' ? $buttonElement
230
			->copy()
231
			->addClass($this->_optionArray['className']['buttonCancel'])
232
			->text($this->_language->get('cancel')) : null;
233
234
		/* collect output */
235
236
		$output = $overlayElement->html(
237
			$dialogElement->html(
238
				$titleElement .
239
				$boxElement->html(
240
					$textElement .
241
					$fieldElement .
242
					$buttonOkElement .
243
					$buttonCancelElement
244
				)
245
			)
246
		);
247
		return $output;
248
	}
249
}
250