Issues (85)

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/Table/Render.php (3 issues)

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
 * @package    Fuel\Common
4
 * @version    2.0
5
 * @author     Fuel Development Team
6
 * @license    MIT License
7
 * @copyright  2010 - 2015 Fuel Development Team
8
 * @link       http://fuelphp.com
9
 */
10
11
namespace Fuel\Common\Table;
12
13
use Fuel\Common\Table;
14
15
/**
16
 * Uses a table structure built with Table to create HTML
17
 *
18
 * @package Fuel\Common
19
 *
20
 * @since 2.0
21
 */
22
abstract class Render
23
{
24
	/**
25
	 * Renders the given table into a string. Output depends on the subclass
26
	 *
27
	 * @param Table $table
28
	 *
29
	 * @return string
30
	 */
31
	public function renderTable(Table $table)
32
	{
33
		//Generate each row
34
		$rows = $this->buildRows($table);
35
36
		$headerRows = $this->buildHeaders($table);
37
38
		$footerRows = $this->buildFooters($table);
39
40
		return $this->container($table, $rows, $headerRows, $footerRows);
41
	}
42
43
	/**
44
	 * Renders the main body rows for the table
45
	 *
46
	 * @param Table $table
47
	 *
48
	 * @return array
49
	 */
50 View Code Duplication
	protected function buildRows(Table $table)
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...
51
	{
52
		//Generate each row
53
		$rows = array();
54
55
		foreach ( $table->getRows() as $row )
56
		{
57
			//Build the cells for each row
58
			$cells = array();
59
60
			foreach ( $row as $cell )
61
			{
62
				$cells[] = $this->cell($cell);
63
			}
64
65
			$rows[] = $this->row($row, $cells);
66
		}
67
68
		return $rows;
69
	}
70
71
	/**
72
	 * Renders the header rows for the table
73
	 *
74
	 * @param Table $table
75
	 *
76
	 * @return array
77
	 */
78 View Code Duplication
	protected function buildHeaders(Table $table)
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...
79
	{
80
		//Generate each row
81
		$rows = array();
82
83
		foreach ( $table->getHeaderRows() as $row )
84
		{
85
			//Build the cells for each row
86
			$cells = array();
87
88
			foreach ( $row as $cell )
89
			{
90
				$cells[] = $this->headerCell($cell);
91
			}
92
93
			$rows[] = $this->headerRow($row, $cells);
94
		}
95
96
		return $rows;
97
	}
98
99
	/**
100
	 * Renders the footer rows for the table
101
	 *
102
	 * @param Table $table
103
	 *
104
	 * @return array
105
	 */
106 View Code Duplication
	protected function buildFooters(Table $table)
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...
107
	{
108
		//Generate each row
109
		$rows = array();
110
111
		foreach ( $table->getFooterRows() as $row )
112
		{
113
			//Build the cells for each row
114
			$cells = array();
115
116
			foreach ( $row as $cell )
117
			{
118
				$cells[] = $this->footerCell($cell);
119
			}
120
121
			$rows[] = $this->footerRow($row, $cells);
122
		}
123
124
		return $rows;
125
	}
126
127
	/**
128
	 * Should generate the container tag, eg: &lt;table&gt;
129
	 *
130
	 * @param Table $table
131
	 * @param array $rows
132
	 * @param array $headerRows
133
	 * @param array $footerRows
134
	 *
135
	 * @return mixed Should Ideally be a string that can be printed later
136
	 */
137
	protected abstract function container(
138
		Table $table,
139
		array $rows,
140
		array $headerRows,
141
		array $footerRows
142
	);
143
144
	/**
145
	 * Renders a normal Row
146
	 *
147
	 * @param Row   $row
148
	 * @param array $cells
149
	 *
150
	 * @return mixed Should ideally be a string that can be printed by container()
151
	 */
152
	protected abstract function row(Row $row, array $cells);
153
154
	/**
155
	 * Renders a header Row
156
	 *
157
	 * @param Row   $row
158
	 * @param array $cells
159
	 *
160
	 * @return mixed Should ideally be a string that can be printed by container()
161
	 */
162
	protected abstract function headerRow(Row $row, array $cells);
163
164
	/**
165
	 * Renders a footer Row
166
	 *
167
	 * @param Row   $row
168
	 * @param array $cells
169
	 *
170
	 * @return mixed Should ideally be a string that can be printed by
171
	 * container()
172
	 */
173
	protected abstract function footerRow(Row $row, array $cells);
174
175
	/**
176
	 * Renders a normal cell
177
	 *
178
	 * @param Cell
179
	 */
180
	protected abstract function cell(Cell $cell);
181
182
	/**
183
	 * Renders a header cell
184
	 *
185
	 * @param Cell
186
	 */
187
	protected abstract function headerCell(Cell $cell);
188
189
	/**
190
	 * Renders a footer cell
191
	 *
192
	 * @param Cell
193
	 */
194
	protected abstract function footerCell(Cell $cell);
195
}
196