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/HtmlTabs.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
/**
6
 * Composant Twitter Bootstrap Tabs
7
 *
8
 * @author jc
9
 * @version 1.001
10
 */
11
use Ajax\bootstrap\html\content\HtmlTabItem;
12
use Ajax\JsUtils;
13
use Ajax\bootstrap\components\Tabs;
14
use Ajax\bootstrap\html\base\HtmlBsDoubleElement;
15
use Ajax\bootstrap\html\content\HtmlTabContent;
16
17
18
class HtmlTabs extends HtmlBsDoubleElement {
19
	protected $tabs=array ();
20
	protected $_tabsType="tabs";
21
	protected $stacked="";
22
23
	public function __construct($identifier, $tagName="ul") {
24
		parent::__construct($identifier, $tagName);
25
		$this->_template="<%tagName% %properties%>%tabs%</%tagName%>%content%";
26
		$this->setProperty("class", "nav nav-".$this->_tabsType);
27
	}
28
29
	protected function addTab_($tab, $index=null) {
30
		if($tab instanceof HtmlDropdown){
31
			$tab->setMTagName("li");
32
		}
33
		if (isset($index)) {
34
			$inserted=array (
35
					$tab
36
			);
37
			array_splice($this->tabs, $index, 0, $inserted);
38
		} else
39
			$this->tabs []=$tab;
40
	}
41
42
	public function setActive($index){
43
		for ($i=0;$i<sizeof($this->tabs);$i++){
0 ignored issues
show
Performance Best Practice introduced by
It seems like you are calling the size function sizeof() as part of the test condition. You might want to compute the size beforehand, and not on each iteration.

If the size of the collection does not change during the iteration, it is generally a good practice to compute it beforehand, and not on each iteration:

for ($i=0; $i<count($array); $i++) { // calls count() on each iteration
}

// Better
for ($i=0, $c=count($array); $i<$c; $i++) { // calls count() just once
}
Loading history...
44
			$this->tabs[$i]->setActive($i==$index);
45
		}
46
	}
47
48
	public function disable($index){
49
		$this->tabs[$index]->disable();
50
	}
51
52
	public function addTab($element, $index=null) {
53
		$iid=$this->countTabs()+1;
54
		$tab=$element;
55
		if (is_string($element)) {
56
			$tab=new HtmlTabItem("tab-".$this->identifier."-".$iid, $element);
57
			$this->addTab_($tab, $index);
58
		} elseif (is_array($element)) {
59
			$tab=new HtmlTabItem("tab-".$this->identifier."-".$iid);
60
			$tab->fromArray($element);
61
			$this->addTab_($tab, $index);
62
		} else {
63
			$this->addTab_($tab, $index);
64
		}
65
		return $tab;
66
	}
67
68
	/*
69
	 * (non-PHPdoc)
70
	 * @see \Ajax\bootstrap\html\HtmlSingleElement::fromArray()
71
	 */
72
	public function fromArray($array) {
73
		$array=parent::fromArray($array);
74
		$this->addTabs($array);
75
		return $array;
76
	}
77
78
	public function addTabs($tabs) {
79
		foreach ( $tabs as $tab ) {
80
			$this->addTab($tab);
81
		}
82
		return $this;
83
	}
84
85
	public function getTabstype() {
86
		return $this->_tabsType;
87
	}
88
89
	public function setTabstype($_tabsType="tabs") {
90
		$this->_tabsType=$_tabsType;
91
		return $this;
92
	}
93
94
	/*
95
	 * (non-PHPdoc)
96
	 * @see \Ajax\bootstrap\html\BaseHtml::compile()
97
	 */
98
	public function compile(JsUtils $js=NULL, &$view=NULL) {
99
		$this->setProperty("class", "nav nav-".$this->_tabsType." ".$this->stacked);
100
		return parent::compile($js, $view);
101
	}
102
103
	/*
104
	 * (non-PHPdoc)
105
	 * @see \Ajax\bootstrap\html\HtmlDoubleElement::run()
106
	 */
107
	public function run(JsUtils $js) {
108
		$this->_bsComponent=new Tabs($js);
109
		foreach ( $this->tabs as $tab ) {
110
			$this->_bsComponent->addTab($tab->run($js));
111
		}
112
		$this->addEventsOnRun($js);
113
		return $this->_bsComponent;
114
	}
115
116
	public function createTabContents() {
117
		$tabContent=new HtmlTabContent("tabcontent-".$this->identifier);
118
		foreach ( $this->tabs as $tab ) {
119
			if ($tab instanceof HtmlTabItem)
120
				$tabContent->addTabItem($tab->getHref());
121
			elseif ($tab instanceof HtmlDropdown) {
122
				foreach ( $tab->getItems() as $dropdownItem ) {
123
					$tabContent->addTabItem($dropdownItem->getHref());
124
				}
125
			}
126
		}
127
		return $tabContent;
128
	}
129
130
	public function addTabContents() {
131
		$this->content=$this->createTabContents();
132
	}
133
134
	public function getTabContent($index) {
135
		$this->content->getTabItem($index);
136
	}
137
138
	public function setContentToTab($index, $text) {
139
		$tabContentItem=$this->content->getTabItem($index);
140
		if (isset($tabContentItem))
141
			$tabContentItem->setContent($text);
142
	}
143
144
	public function countTabs() {
145
		return sizeof($this->tabs);
146
	}
147
148
	public function getTabItem($index) {
149
		if ($index<sizeof($this->content->get))
150
			return $this->content;
151
	}
152
153
	public function fadeEffect() {
154
		if (sizeof($this->content->getTabItems())>0) {
155
			$this->content->getTabItem(0)->addToProperty("class", "fade in");
156
			$size=sizeof($this->tabs);
157
			for($index=0; $index<$size; $index++) {
158
				$this->content->getTabItem($index)->addToProperty("class", "fade");
159
			}
160
		}
161
	}
162
	
163
	public function on($event, $jsCode,$stopPropagation=false,$preventDefault=false){
164
		foreach ($this->tabs as $tab){
165
			$tab->on($event,$jsCode,$stopPropagation,$preventDefault);
166
		}
167
		return $this;
168
	}
169
170
	public function setStacked($stacked=true){
171
		if($stacked)
172
			$this->stacked="nav-stacked";
173
		else $this->stacked="";
174
	}
175
176
	/* (non-PHPdoc)
177
	 * @see \Ajax\bootstrap\html\base\BaseHtml::fromDatabaseObject()
178
	 */
179
	public function fromDatabaseObject($object, $function) {
180
		$this->addTab($function($object));
181
	}
182
}