GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (107)

Security Analysis    not enabled

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/widgets/TbSelect2.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
 * ##  TbSelect2 class file.
5
 *
6
 * @author Antonio Ramirez <[email protected]>
7
 * @copyright Copyright &copy; Clevertech 2012-
8
 * @license [New BSD License](http://www.opensource.org/licenses/bsd-license.php)
9
 */
10
11
/**
12
 * ## Select2 wrapper widget
13
 *
14
 * @see http://ivaynberg.github.io/select2/
15
 *
16
 * @package booster.widgets.forms.inputs
17
 */
18
class TbSelect2 extends CInputWidget {
19
20
	/**
21
	 * @var TbActiveForm when created via TbActiveForm.
22
	 * This attribute is set to the form that renders the widget
23
	 * @see TbActionForm->inputRow
24
	 */
25
	public $form;
26
27
	/**
28
	 * @var array @param data for generating the list options (value=>display)
29
	 */
30
	public $data = array();
31
32
	/**
33
	 * @var string[] the JavaScript event handlers.
34
	 */
35
	public $events = array();
36
37
	/**
38
	 * @var bool whether to display a dropdown select box or use it for tagging
39
	 */
40
	public $asDropDownList = true;
41
42
	/**
43
	 * @var string the default value.
44
	 */
45
	public $val;
46
47
	/**
48
	 * @var
49
	 */
50
	public $options;
51
52
	/**
53
	 * @var bool
54
	 * @since 2.1.0
55
	 */
56
	public $readonly = false;
57
58
	/**
59
	 * @var bool
60
	 * @since 2.1.0
61
	 */
62
	public $disabled = false;
63
64
	/**
65
	 * ### .init()
66
	 *
67
	 * Initializes the widget.
68
	 */
69 1
	public function init() {
70 1
		$this->normalizeData();
71
72 1
		$this->normalizeOptions();
73
74 1
		$this->addEmptyItemIfPlaceholderDefined();
75
76 1
		$this->setDefaultWidthIfEmpty();
77
78
		// disabled & readonly
79 1
		if (!empty($this->htmlOptions['readonly'])) {
80
			$this->readonly = true;
81
		}
82 1
		if (!empty($this->htmlOptions['disabled'])) {
83
			$this->disabled = true;
84
		}
85 1
	}
86
87
	/**
88
	 * ### .run()
89
	 *
90
	 * Runs the widget.
91
	 */
92 1
	public function run() {
93 1
		list($name, $id) = $this->resolveNameID();
94
95 1
		if ($this->hasModel()) {
96 1
			if ($this->form) {
97
				echo $this->asDropDownList ?
98
					$this->form->dropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) :
99
					$this->form->hiddenField($this->model, $this->attribute, $this->htmlOptions);
100
			} else {
101 1
				echo $this->asDropDownList ?
102 1
					CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions) :
103
					CHtml::activeHiddenField($this->model, $this->attribute, $this->htmlOptions);
104
			}
105 1
		} else {
106
			echo $this->asDropDownList ?
107
				CHtml::dropDownList($name, $this->value, $this->data, $this->htmlOptions) :
108
				CHtml::hiddenField($name, $this->value, $this->htmlOptions);
109
		}
110
111 1
		$this->registerClientScript($id);
112 1
	}
113
114
	/**
115
	 * ### .registerClientScript()
116
	 *
117
	 * Registers required client script for bootstrap select2. It is not used through bootstrap->registerPlugin
118
	 * in order to attach events if any
119
	 *
120
	 * @param $id
121
	 *
122
	 * @throws CException
123
	 */
124 1
	public function registerClientScript($id) {
125
126 1
		Booster::getBooster()->registerPackage('select2');
127
128 1
		$options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
129
130 1
		if (!empty($this->val)) {
131
			if (is_array($this->val)) {
132
				$data = CJSON::encode($this->val);
133
			} else {
134
				$data = $this->val;
135
			}
136
137
			$defValue = ".select2('val', $data)";
138
		} else
139 1
			$defValue = '';
140
141 1
		if ($this->readonly) {
142
			$defValue .= ".select2('readonly', true)";
143 1
		} elseif ($this->disabled) {
144
			$defValue .= ".select2('enable', false)";
145
		}
146
147 1
		ob_start();
148 1
		echo "jQuery('select#{$id}').select2({$options})";
149 1
		foreach ($this->events as $event => $handler) {
150
			echo ".on('{$event}', " . CJavaScript::encode($handler) . ")";
151 1
		}
152 1
		echo $defValue;
153
154 1
		Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->getId(), ob_get_clean() . ';');
155 1
	}
156
157 1
	private function setDefaultWidthIfEmpty() {
158 1
		if (empty($this->options['width'])) {
159 1
			$this->options['width'] = 'resolve';
160 1
		}
161 1
	}
162
163 1
	private function normalizeData() {
164 1
		if (!$this->data)
0 ignored issues
show
Bug Best Practice introduced by
The expression $this->data of type array is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
165 1
			$this->data = array();
166 1
	}
167
168 1
	private function addEmptyItemIfPlaceholderDefined() {
169 1
		if (!empty($this->htmlOptions['placeholder']))
170 1
			$this->options['placeholder'] = $this->htmlOptions['placeholder'];
171
172 1
		if (!empty($this->options['placeholder']) && empty($this->htmlOptions['multiple']))
173 1
			$this->prependDataWithEmptyItem();
174 1
	}
175
176 1
	private function normalizeOptions() {
177 1
		if (empty($this->options)) {
178 1
			$this->options = array();
179 1
		}
180 1
	}
181
182
	private function prependDataWithEmptyItem() {
183
		$this->data = array('' => '') + $this->data;
184
	}
185
186
}
187