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 (1881)

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.

nextgen-importer/class-nextgen-pagination.php (41 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
 * Pagination Class. Adapted from http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
4
 * Original author: Victor De la Rocha
5
 * Date: 28/11/2015
6
 */
7
if ( ! class_exists( 'FooGalleryNextGenPagination' ) ) {
8
9
	class FooGalleryNextGenPagination {
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
10
11
		/* Default values */
12
		var $item_count = 100;
0 ignored issues
show
The visibility should be declared for property $item_count.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
13
		var $limit = 10;
0 ignored issues
show
The visibility should be declared for property $limit.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
14
		var $target = "";
0 ignored issues
show
The visibility should be declared for property $target.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
15
		var $page = 1;
0 ignored issues
show
The visibility should be declared for property $page.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
16
		var $adjacents = 2;
0 ignored issues
show
The visibility should be declared for property $adjacents.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
17
		var $parameterName = "paged";
0 ignored issues
show
The visibility should be declared for property $parameterName.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
18
		var $urlF = false;//urlFriendly
0 ignored issues
show
The visibility should be declared for property $urlF.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
19
		var $start = -1;
0 ignored issues
show
The visibility should be declared for property $start.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
20
		var $end = -1;
0 ignored issues
show
The visibility should be declared for property $end.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
21
		var $page_count = 10;
0 ignored issues
show
The visibility should be declared for property $page_count.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
22
		var $url = false;
0 ignored issues
show
The visibility should be declared for property $url.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
23
24
		/* Next and previous buttons */
25
		var $nextI = "›";
0 ignored issues
show
The visibility should be declared for property $nextI.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
26
		var $prevI = "‹";
0 ignored issues
show
The visibility should be declared for property $prevI.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
27
28
		/* Processing variables */
29
		var $calculate = false;
0 ignored issues
show
The visibility should be declared for property $calculate.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
30
		var $pagination = '';
0 ignored issues
show
The visibility should be declared for property $pagination.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
31
		var $errors = false;
0 ignored issues
show
The visibility should be declared for property $errors.

The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using

class A {
    var $property;
}

the property is implicitly global.

To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.

Loading history...
32
33
		#Total items
34
		function items( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
35
			$this->item_count = (int) $value;
36
		}
37
38
		#how many items to show per page
39
		function limit( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
40
			$this->limit = (int) $value;
41
		}
42
43
		#Page to sent the page value
44
		function target( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
45
			$this->target = $value;
46
		}
47
48
		#Current page
49
		function currentPage( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
50
			$this->page = (int) $value;
51
		}
52
53
		#How many adjacent pages should be shown on each side of the current page?
54
		function adjacents( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
55
			$this->adjacents = (int) $value;
56
		}
57
58
		#show counter?
59
		function showCounter( $value = "" ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
60
			$this->showCounter = ( $value === true ) ? true : false;
0 ignored issues
show
The property showCounter does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
61
		}
62
63
		#to change the class name of the pagination div
64
		function changeClass( $value = "" ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
65
			$this->className = $value;
0 ignored issues
show
The property className does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
66
		}
67
68
		function nextLabel( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
69
			$this->nextT = $value;
0 ignored issues
show
The property nextT does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
70
		}
71
72
		function nextIcon( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
73
			$this->nextI = $value;
74
		}
75
76
		function prevLabel( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
77
			$this->prevT = $value;
0 ignored issues
show
The property prevT does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
78
		}
79
80
		function prevIcon( $value ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
81
			$this->prevI = $value;
82
		}
83
84
		#to change the class name of the pagination div
85
		function parameterName( $value = "" ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
86
			$this->parameterName = $value;
87
		}
88
89
		function render($echo = true) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
90
			if ( ! $this->calculate ) {
91
				$this->calculate();
92
			}
93
			if ( $echo ) {
94
				echo $this->pagination;
95
			} else {
96
				return $this->pagination;
97
			}
98
		}
99
100
		function get_page_number_url( $page_number ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
101
			return esc_url( add_query_arg( $this->parameterName, $page_number, $this->url ) );
102
		}
103
104
		function calculate() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
105
			$this->pagination = "";
106
			$this->calculate = true;
107
			$this->errors = false;
108
109
			if ( $this->urlF and $this->urlF != '%' and strpos( $this->target, $this->urlF ) === false ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
110
				//Es necesario especificar el comodin para sustituir
111
				$this->errors = "Especificaste un wildcard para sustituir, pero no existe en el target";
0 ignored issues
show
Documentation Bug introduced by
The property $errors was declared of type boolean, but 'Especificaste un wildca...no existe en el target' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
112
				return;
113
			} elseif ( $this->urlF and $this->urlF == '%' and strpos( $this->target, $this->urlF ) === false ) {
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
114
				$this->errors = "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina";
0 ignored issues
show
Documentation Bug introduced by
The property $errors was declared of type boolean, but 'Es necesario especifica...l n�mero de p�gina' is of type string. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
115
				return;
116
			}
117
118
			$n = $this->nextI;
119
			$p = $this->prevI;
120
121
			/* Setup vars for query. */
122
			if ( $this->page ) {
123
				$this->start = ( $this->page - 1 ) * $this->limit; //first item to display on this page
124
				$this->end = $this->start + $this->limit - 1;
125
			} else {
126
				$this->start = 0; //if no page var is given, set start to 0
127
				$this->end = $this->limit - 1;
128
			}
129
130
			/* Setup page vars for display. */
131
			$counter  = 1;
132
			$prev     = $this->page - 1;                            //previous page is page - 1
133
			$next     = $this->page + 1;                            //next page is page + 1
134
			$this->page_count = ceil( $this->item_count / $this->limit );        //lastpage is = total pages / items per page, rounded up.
0 ignored issues
show
Documentation Bug introduced by
The property $page_count was declared of type integer, but ceil($this->item_count / $this->limit) is of type double. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
135
			$lpm1     = $this->page_count - 1;                        //last page minus 1
136
137
			/*
138
				Now we apply our rules and draw the pagination object.
139
				We're actually saving the code to a variable in case we want to draw it more than once.
140
			*/
141
142
			if ( $this->page_count > 1 ) {
143
				if ( $this->page ) {
144
					//anterior button
145
					if ( $this->page > 1 ) {
146
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $prev ) . "\" class=\"prev\">$p</a>";
147
					} else {
148
						$this->pagination .= "<span class=\"disabled\">$p</span>";
149
					}
150
				}
151
				//pages
152
				if ( $this->page_count < 7 + ( $this->adjacents * 2 ) ) {//not enough pages to bother breaking it up
153
					for ( $counter = 1; $counter <= $this->page_count; $counter ++ ) {
154
						if ( $counter == $this->page ) {
155
							$this->pagination .= "<span class=\"selected-page\">$counter</span>";
156
						} else {
157
							$this->pagination .= "<a href=\"" . $this->get_page_number_url( $counter ) . "\">$counter</a>";
158
						}
159
					}
160
				} elseif ( $this->page_count > 5 + ( $this->adjacents * 2 ) ) {//enough pages to hide some
161
					//close to beginning; only hide later pages
162
					if ( $this->page < 1 + ( $this->adjacents * 2 ) ) {
163
						for ( $counter = 1; $counter < 4 + ( $this->adjacents * 2 ); $counter ++ ) {
164
							if ( $counter == $this->page ) {
165
								$this->pagination .= "<span class=\"selected-page\">$counter</span>";
166
							} else {
167
								$this->pagination .= "<a href=\"" . $this->get_page_number_url( $counter ) . "\">$counter</a>";
168
							}
169
						}
170
						$this->pagination .= "...";
171
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $lpm1 ) . "\">$lpm1</a>";
172
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $this->page_count ) . "\">$this->page_count</a>";
173
					} //in middle; hide some front and some back
174
					elseif ( $this->page_count - ( $this->adjacents * 2 ) > $this->page && $this->page > ( $this->adjacents * 2 ) ) {
175
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( 1 ) . "\">1</a>";
176
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( 2 ) . "\">2</a>";
177
						$this->pagination .= "...";
178
						for ( $counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter ++ ) {
179
							if ( $counter == $this->page ) {
180
								$this->pagination .= "<span class=\"selected-page\">$counter</span>";
181
							} else {
182
								$this->pagination .= "<a href=\"" . $this->get_page_number_url( $counter ) . "\">$counter</a>";
183
							}
184
						}
185
						$this->pagination .= "...";
186
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $lpm1 ) . "\">$lpm1</a>";
187
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $this->page_count ) . "\">$this->page_count</a>";
188
					} //close to end; only hide early pages
189
					else {
190
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( 1 ) . "\">1</a>";
191
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( 2 ) . "\">2</a>";
192
						$this->pagination .= "...";
193
						for ( $counter = $this->page_count - ( 2 + ( $this->adjacents * 2 ) ); $counter <= $this->page_count; $counter ++ ) {
194
							if ( $counter == $this->page ) {
195
								$this->pagination .= "<span class=\"selected-page\">$counter</span>";
196
							} else {
197
								$this->pagination .= "<a href=\"" . $this->get_page_number_url( $counter ) . "\">$counter</a>";
198
							}
199
						}
200
					}
201
				}
202
				if ( $this->page ) {
203
					//siguiente button
204
					if ( $this->page < $counter - 1 ) {
205
						$this->pagination .= "<a href=\"" . $this->get_page_number_url( $next ) . "\" class=\"next\">$n</a>";
206
					} else {
207
						$this->pagination .= "<span class=\"disabled\">$n</span>";
208
					}
209
				}
210
			}
211
		}
212
	}
213
}