Issues (139)

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.

src/Column/ColumnLink.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
3
/**
4
 * @copyright   Copyright (c) 2015 ublaboo <[email protected]>
5
 * @author      Pavel Janda <[email protected]>
6
 * @package     Ublaboo
7
 */
8
9
namespace Ublaboo\DataGrid\Column;
10
11
use Nette\Utils\Html;
12
use Ublaboo\DataGrid\DataGrid;
13
use Ublaboo\DataGrid\Exception\DataGridColumnRendererException;
14
use Ublaboo\DataGrid\Row;
15
16 1
class ColumnLink extends Column
17
{
18
19
	/**
20
	 * @var string
21
	 */
22
	protected $title;
23
24
	/**
25
	 * @var string
26
	 */
27
	protected $class;
28
29
	/**
30
	 * @var array
31
	 */
32
	protected $params;
33
34
	/**
35
	 * @var string
36
	 */
37
	protected $href;
38
39
	/**
40
	 * @var string
41
	 */
42
	protected $icon;
43
44
	/**
45
	 * @var array
46
	 */
47
	protected $data_attributes = [];
48
49
	/**
50
	 * @var bool
51
	 */
52
	protected $open_in_new_tab = false;
53
54
55
	/**
56
	 * @var array
57
	 */
58
	protected $parameters = [];
59
60
61
	/**
62
	 * @param DataGrid $grid
63
	 * @param string $key
64
	 * @param string $column
65
	 * @param string $name
66
	 * @param string $href
67
	 * @param array  $params
68
	 */
69
	public function __construct(DataGrid $grid, $key, $column, $name, $href, $params)
70
	{
71 1
		parent::__construct($grid, $key, $column, $name);
72
73 1
		$this->href = $href;
74 1
		$this->params = $params;
75 1
	}
76
77
78
	/**
79
	 * Render row item into template
80
	 * @param  Row   $row
81
	 * @return mixed
82
	 */
83
	public function render(Row $row)
84
	{
85
		/**
86
		 * Renderer function may be used
87
		 */
88
		try {
89 1
			return $this->useRenderer($row);
90 1
		} catch (DataGridColumnRendererException $e) {
0 ignored issues
show
Coding Style Comprehensibility introduced by
Consider adding a comment why this CATCH block is empty.
Loading history...
91
			/**
92
			 * Do not use renderer
93
			 */
94
		}
95
96 1
		$value = parent::render($row);
97
98 1
		if (!$value && !$this->icon) {
99
			return null;
100
		}
101
102 1
		$a = Html::el('a')
103 1
			->href($this->createLink(
104 1
				$this->grid,
105 1
				$this->href,
106 1
				$this->getItemParams($row, $this->params) + $this->parameters
107
			));
108
109 1
		if (!empty($this->data_attributes)) {
110
			foreach ($this->data_attributes as $key => $attr_value) {
111
				$a->data($key, $attr_value);
112
			}
113
		}
114
115 1
		if ($this->open_in_new_tab) {
116
			$a->addAttributes(['target' => '_blank']);
117
		}
118
119 1
		if ($this->title) {
120 1
			$a->title($this->title);
121
		}
122 1
		if ($this->class) {
123 1
			$a->class($this->class);
124
		}
125
126 1
		$element = $a;
127
128 1
		if ($this->icon) {
129
			$a->addHtml(Html::el('span')->class(DataGrid::$icon_prefix . $this->icon));
130
131
			if (strlen($value)) {
132
				$a->addHtml('&nbsp;');
133
			}
134
		}
135
136 1
		if ($this->isTemplateEscaped()) {
137 1
			$a->addText($value);
138
		} else {
139
			$a->addHtml($value);
140
		}
141
142 1
		return $element;
143
	}
144
145
146
	/**
147
	 * Add parameters to link
148
	 * @param array $parameters
149
	 * @return static
150
	 */
151
	public function addParameters(array $parameters)
152
	{
153
		$this->parameters = $parameters;
154
155
		return $this;
156
	}
157
158
159
	/**
160
	 * Set icon before simple link
161
	 * @param string      $icon
162
	 * @return ColumnLink
163
	 */
164
	public function setIcon($icon = null)
165
	{
166
		$this->icon = $icon;
167
168
		return $this;
169
	}
170
171
172
	/**
173
	 * Setting data attributes
174
	 * @param string $key
175
	 * @param mixed  $value
176
	 * @return static
177
	 */
178
	public function setDataAttribute($key, $value)
179
	{
180
		$this->data_attributes[$key] = $value;
181
182
		return $this;
183
	}
184
185
186
	/**
187
	 * Set attribute title
188
	 * @param string $title
189
	 */
190
	public function setTitle($title)
191
	{
192 1
		$this->title = $title;
193
194 1
		return $this;
195
	}
196
197
198
	/**
199
	 * Get attribute title
200
	 */
201
	public function getTitle()
202
	{
203
		return $this->title;
204
	}
205
206
207
	/**
208
	 * Set attribute class
209
	 * @param string $class
210
	 * @return $this
211
	 */
212
	public function setClass($class)
213
	{
214 1
		$this->class = $class;
215
216 1
		return $this;
217
	}
218
219
220
	/**
221
	 * Get attribute class
222
	 */
223
	public function getClass()
224
	{
225
		return $this->class;
226
	}
227
228
229
	/**
230
	 * Open link in new window/tab?
231
	 * @return boolean
232
	 */
233
	public function isOpenInNewTab()
234
	{
235
		return $this->open_in_new_tab;
236
	}
237
238
239
	/**
240
	 * Set link to open in new tab/window or not
241
	 * @param bool $open_in_new_tab
242
	 * @return $this
243
	 */
244
	public function setOpenInNewTab($open_in_new_tab = true)
245
	{
246
		$this->open_in_new_tab = $open_in_new_tab;
247
		return $this;
248
	}
249
}
250