Issues (277)

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.

Ajax/bootstrap/html/HtmlButton.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
namespace Ajax\bootstrap\html;
4
5
use Ajax\JsUtils;
6
use Ajax\bootstrap\html\base\HtmlBsDoubleElement;
7
use Ajax\bootstrap\html\base\CssRef;
8
9
/**
10
 * Twitter Bootstrap Button component
11
 * @see http://getbootstrap.com/css/#buttons
12
 * @author jc
13
 * @version 1.001
14
 */
15
class HtmlButton extends HtmlBsDoubleElement {
16
17
	/**
18
	 * Constructs an HTML Bootstrap button
19
	 * @param string $identifier HTML id
20
	 * @param string $value value of the Button
21
	 * @param string $cssStyle btn-default, btn-primary...
22
	 * @param string $onClick JS Code for click event
23
	 */
24 View Code Duplication
	public function __construct($identifier, $value="", $cssStyle=null, $onClick=null) {
0 ignored issues
show
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
25
		parent::__construct($identifier, "button");
26
		$this->setProperty("class", "btn btn-default");
27
		$this->setProperty("role", "button");
28
		$this->content=$value;
29
		if (isset($cssStyle)) {
30
			$this->setStyle($cssStyle);
31
		}
32
		if (isset($onClick)) {
33
			$this->onClick($onClick);
34
		}
35
	}
36
37
	/**
38
	 * Set the button value
39
	 * @param string $value
40
	 * @return \Ajax\bootstrap\html\HtmlButton
41
	 */
42
	public function setValue($value) {
43
		$this->content=$value;
44
		return $this;
45
	}
46
47
	/**
48
	 * define the button style
49
	 * avaible values : "btn-default","btn-primary","btn-success","btn-info","btn-warning","btn-danger"
50
	 * @param string|int $cssStyle
51
	 * @return \Ajax\bootstrap\html\HtmlButton default : "btn-default"
52
	 */
53
	public function setStyle($cssStyle) {
54
		return $this->addToPropertyCtrl("class", CssRef::getStyle($cssStyle, "btn"), CssRef::Styles("btn"));
55
	}
56
57
	/**
58
	 * define the button size
59
	 * available values : "btn-lg","","btn-sm","btn-xs"
60
	 * @param string|int $size
61
	 * @return \Ajax\bootstrap\html\HtmlButton default : ""
62
	 */
63
	public function setSize($size) {
64
		if (is_int($size)) {
65
			return $this->addToPropertyUnique("class", CssRef::sizes()[$size], CssRef::sizes());
66
		}
67
		return $this->addToPropertyCtrl("class", $size, CssRef::sizes());
68
	}
69
70
	/**
71
	 * Sets the "active" css class to the button
72
	 * @return \Ajax\bootstrap\html\HtmlButton
73
	 */
74
	public function setActive() {
75
		return $this->addToPropertyCtrl("class", "active", array (
76
				"active"
77
		));
78
	}
79
80
	/**
81
	 * Disables the button
82
	 * @return \Ajax\bootstrap\html\HtmlButton
83
	 */
84
	public function setDisabled() {
85
		return $this->addToPropertyCtrl("class", "disabled", array (
86
				"disabled"
87
		));
88
	}
89
90
	public function setToggled() {
91
		return $this->setProperty("data-toggle", "button");
92
	}
93
94
	/*
95
	 * (non-PHPdoc)
96
	 * @see BaseHtml::run()
97
	 */
98
	public function run(JsUtils $js) {
99
		$this->_bsComponent=$js->bootstrap()->generic("#".$this->identifier);
100
		if (array_key_exists("data-toggle", $this->properties)) {
101
			$this->_bsComponent->addCode("$.fn.toggled=function(){return this.hasClass('active');};");
102
		}
103
		$this->addEventsOnRun($js);
104
		return $this->_bsComponent;
105
	}
106
107
108
109
	/*
110
	 * (non-PHPdoc)
111
	 * @see \Ajax\bootstrap\html\BaseHtml::fromArray()
112
	 */
113
	public function fromArray($array) {
114
		$array=parent::fromArray($array);
115
		foreach ( $array as $key => $value ) {
116
			$this->setProperty($key, $value);
117
		}
118
		return $array;
119
	}
120
}