@@ -26,7 +26,7 @@ |
||
26 | 26 | appropriate mainfile.php to have been previously created, possibly using the |
27 | 27 | <info>ci-bootstrap</info> command (only available if mainfile.php does not exist.) |
28 | 28 | EOT |
29 | - ); |
|
29 | + ); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | /** |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $output->writeln(strip_tags($message)); |
62 | 62 | } |
63 | 63 | } |
64 | - if ($result===false) { |
|
64 | + if ($result === false) { |
|
65 | 65 | $output->writeln(sprintf('<error>Install of %s module failed!</error>', $module)); |
66 | 66 | } else { |
67 | 67 | $output->writeln(sprintf('<info>Install of %s module completed.</info>', $module)); |
@@ -76,14 +76,14 @@ discard block |
||
76 | 76 | 'system_user', |
77 | 77 | array( |
78 | 78 | // 'uid' => 1, // mediumint(8) unsigned NOT NULL auto_increment, |
79 | - 'uname' => $adminname, // varchar(25) NOT NULL default '', |
|
80 | - 'email' => 'nobody@localhost', // varchar(60) NOT NULL default '', |
|
81 | - 'user_regdate' => $regdate, // int(10) unsigned NOT NULL default '0', |
|
82 | - 'user_viewemail' => 1, // tinyint(1) unsigned NOT NULL default '0', |
|
83 | - 'pass' => $adminpass, // varchar(255) NOT NULL default '', |
|
84 | - 'rank' => 7, // smallint(5) unsigned NOT NULL default '0', |
|
85 | - 'level' => 5, // tinyint(3) unsigned NOT NULL default '1', |
|
86 | - 'last_login' => $regdate, // int(10) unsigned NOT NULL default '0', |
|
79 | + 'uname' => $adminname, // varchar(25) NOT NULL default '', |
|
80 | + 'email' => 'nobody@localhost', // varchar(60) NOT NULL default '', |
|
81 | + 'user_regdate' => $regdate, // int(10) unsigned NOT NULL default '0', |
|
82 | + 'user_viewemail' => 1, // tinyint(1) unsigned NOT NULL default '0', |
|
83 | + 'pass' => $adminpass, // varchar(255) NOT NULL default '', |
|
84 | + 'rank' => 7, // smallint(5) unsigned NOT NULL default '0', |
|
85 | + 'level' => 5, // tinyint(3) unsigned NOT NULL default '1', |
|
86 | + 'last_login' => $regdate, // int(10) unsigned NOT NULL default '0', |
|
87 | 87 | ) |
88 | 88 | ); |
89 | 89 | $output->writeln(sprintf('<info>Inserted %d user.</info>', $result)); |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | $tableau = array_filter($tableau, array(static::stopWordsObject(), 'check')); |
277 | 277 | $title = implode("-", $tableau); |
278 | 278 | |
279 | - $title = (empty($title)) ? '' : $title . $extension; |
|
279 | + $title = (empty($title)) ? '' : $title.$extension; |
|
280 | 280 | return $title; |
281 | 281 | } |
282 | 282 | |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | |
303 | 303 | $start = empty($pos) ? 0 : min($pos); |
304 | 304 | |
305 | - $start = max($start - (int) ($length / 2), 0); |
|
305 | + $start = max($start - (int)($length / 2), 0); |
|
306 | 306 | |
307 | 307 | $pre = ($start > 0); // need an ellipsis in front? |
308 | 308 | if (function_exists('mb_strlen')) { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | } |
339 | 339 | } |
340 | 340 | } |
341 | - $haystack = ($pre ? static::ELLIPSIS : '') . trim($haystack) . ($post ? static::ELLIPSIS : ''); |
|
341 | + $haystack = ($pre ? static::ELLIPSIS : '').trim($haystack).($post ? static::ELLIPSIS : ''); |
|
342 | 342 | return $haystack; |
343 | 343 | } |
344 | 344 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | protected static function getNeedlePositions($haystack, $needles) |
376 | 376 | { |
377 | 377 | $pos = array(); |
378 | - $needles = empty($needles) ? array() : (array) $needles; |
|
378 | + $needles = empty($needles) ? array() : (array)$needles; |
|
379 | 379 | foreach ($needles as $needle) { |
380 | 380 | if (function_exists('mb_stripos')) { |
381 | 381 | $i = mb_stripos($haystack, $needle, 0, static::ENCODING); |
@@ -442,10 +442,10 @@ discard block |
||
442 | 442 | { |
443 | 443 | $search = array( |
444 | 444 | "'<script[^>]*?>.*?</script>'si", // Strip out javascript |
445 | - "'<img.*?/>'si", // Strip out img tags |
|
446 | - "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags |
|
447 | - "'([\r\n])[\s]+'", // Strip out white space |
|
448 | - "'&(quot|#34);'i", // Replace HTML entities |
|
445 | + "'<img.*?/>'si", // Strip out img tags |
|
446 | + "'<[\/\!]*?[^<>]*?>'si", // Strip out HTML tags |
|
447 | + "'([\r\n])[\s]+'", // Strip out white space |
|
448 | + "'&(quot|#34);'i", // Replace HTML entities |
|
449 | 449 | "'&(amp|#38);'i", |
450 | 450 | "'&(lt|#60);'i", |
451 | 451 | "'&(gt|#62);'i", |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | |
477 | 477 | preg_replace_callback( |
478 | 478 | '/&#(\d+);/', |
479 | - function ($matches) { |
|
479 | + function($matches) { |
|
480 | 480 | return chr($matches[1]); |
481 | 481 | }, |
482 | 482 | $document |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function __construct($ip) |
35 | 35 | { |
36 | - if (!filter_var((string) $ip, FILTER_VALIDATE_IP)) { |
|
36 | + if (!filter_var((string)$ip, FILTER_VALIDATE_IP)) { |
|
37 | 37 | $this->ip = false; |
38 | 38 | } else { |
39 | 39 | $this->ip = $this->normalize($ip); |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | $bits = ''; |
155 | 155 | for ($i = 0; $i < $length; $i++) { |
156 | 156 | $byte = decbin(ord($binaryIp[$i])); |
157 | - $bits .= substr("00000000" . $byte, -8); |
|
157 | + $bits .= substr("00000000".$byte, -8); |
|
158 | 158 | } |
159 | 159 | return $bits; |
160 | 160 | } |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | $encoding = static::ENCODING; |
70 | 70 | return preg_replace_callback( |
71 | 71 | '#((?:(?!<[/a-z]).)*)([^>]*>|$)#si', |
72 | - function ($capture) use ($needle, $pre, $post, $encoding) { |
|
72 | + function($capture) use ($needle, $pre, $post, $encoding) { |
|
73 | 73 | $haystack = $capture[1]; |
74 | 74 | if (function_exists('mb_substr')) { |
75 | 75 | $p1 = mb_stripos($haystack, $needle, 0, $encoding); |
76 | 76 | $l1 = mb_strlen($needle, $encoding); |
77 | 77 | $ret = ''; |
78 | 78 | while ($p1 !== false) { |
79 | - $ret .= mb_substr($haystack, 0, $p1, $encoding) . $pre |
|
80 | - . mb_substr($haystack, $p1, $l1, $encoding) . $post; |
|
79 | + $ret .= mb_substr($haystack, 0, $p1, $encoding).$pre |
|
80 | + . mb_substr($haystack, $p1, $l1, $encoding).$post; |
|
81 | 81 | $haystack = mb_substr($haystack, $p1 + $l1, mb_strlen($haystack), $encoding); |
82 | 82 | $p1 = mb_stripos($haystack, $needle, 0, $encoding); |
83 | 83 | } |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | $l1 = strlen($needle); |
87 | 87 | $ret = ''; |
88 | 88 | while ($p1 !== false) { |
89 | - $ret .= substr($haystack, 0, $p1) . $pre . substr($haystack, $p1, $l1) . $post; |
|
89 | + $ret .= substr($haystack, 0, $p1).$pre.substr($haystack, $p1, $l1).$post; |
|
90 | 90 | $haystack = substr($haystack, $p1 + $l1); |
91 | 91 | $p1 = stripos($haystack, $needle); |
92 | 92 | } |
93 | 93 | } |
94 | - $ret .= $haystack . $capture[2]; |
|
94 | + $ret .= $haystack.$capture[2]; |
|
95 | 95 | |
96 | 96 | return $ret; |
97 | 97 | }, |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | public function getSigning() |
36 | 36 | { |
37 | - return (string) $this->storage->fetch($this->name); |
|
37 | + return (string)$this->storage->fetch($this->name); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function getVerifying() |
46 | 46 | { |
47 | - return (string) $this->storage->fetch($this->name); |
|
47 | + return (string)$this->storage->fetch($this->name); |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | /** |
@@ -57,7 +57,7 @@ |
||
57 | 57 | */ |
58 | 58 | protected function fileName($name) |
59 | 59 | { |
60 | - return $this->storagePath . "/{$this->systemSecret}-key-{$name}.php"; |
|
60 | + return $this->storagePath."/{$this->systemSecret}-key-{$name}.php"; |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -121,7 +121,7 @@ |
||
121 | 121 | if (!isset($this->targetDefinitions)) { |
122 | 122 | $this->targetDefinitions = Yaml::read($this->tableDefinitionFile); |
123 | 123 | if (null === $this->targetDefinitions) { |
124 | - throw new \RuntimeException("No schema definition " . $this->tableDefinitionFile); |
|
124 | + throw new \RuntimeException("No schema definition ".$this->tableDefinitionFile); |
|
125 | 125 | } |
126 | 126 | } |
127 | 127 | return $this->targetDefinitions; |
@@ -112,8 +112,8 @@ |
||
112 | 112 | */ |
113 | 113 | public function create($payload, $expirationOffset = 0) |
114 | 114 | { |
115 | - if ((int) $expirationOffset > 0) { |
|
116 | - $payload['exp'] = time() + (int) $expirationOffset; |
|
115 | + if ((int)$expirationOffset > 0) { |
|
116 | + $payload['exp'] = time() + (int)$expirationOffset; |
|
117 | 117 | } |
118 | 118 | $value = JWT::encode($payload, $this->key->getSigning(), $this->algorithm); |
119 | 119 | return $value; |
@@ -34,13 +34,13 @@ discard block |
||
34 | 34 | */ |
35 | 35 | class FilterInput |
36 | 36 | { |
37 | - protected $tagsArray; // default is empty array |
|
38 | - protected $attrArray; // default is empty array |
|
37 | + protected $tagsArray; // default is empty array |
|
38 | + protected $attrArray; // default is empty array |
|
39 | 39 | |
40 | - protected $tagsMethod; // default is 0 |
|
41 | - protected $attrMethod; // default is 0 |
|
40 | + protected $tagsMethod; // default is 0 |
|
41 | + protected $attrMethod; // default is 0 |
|
42 | 42 | |
43 | - protected $xssAuto; // default is 1 |
|
43 | + protected $xssAuto; // default is 1 |
|
44 | 44 | protected $tagBlacklist = array( |
45 | 45 | 'applet', |
46 | 46 | 'body', |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | $attrArray[$i] = strtolower($attrArray[$i]); |
95 | 95 | } |
96 | 96 | // assign to member vars |
97 | - $this->tagsArray = (array) $tagsArray; |
|
98 | - $this->attrArray = (array) $attrArray; |
|
97 | + $this->tagsArray = (array)$tagsArray; |
|
98 | + $this->attrArray = (array)$attrArray; |
|
99 | 99 | $this->tagsMethod = $tagsMethod; |
100 | 100 | $this->attrMethod = $attrMethod; |
101 | 101 | $this->xssAuto = $xssAuto; |
@@ -213,61 +213,61 @@ discard block |
||
213 | 213 | case 'INT': |
214 | 214 | case 'INTEGER': |
215 | 215 | // Only use the first integer value |
216 | - preg_match('/-?\d+/', (string) $source, $matches); |
|
217 | - $result = @ (int) $matches[0]; |
|
216 | + preg_match('/-?\d+/', (string)$source, $matches); |
|
217 | + $result = @ (int)$matches[0]; |
|
218 | 218 | break; |
219 | 219 | |
220 | 220 | case 'FLOAT': |
221 | 221 | case 'DOUBLE': |
222 | 222 | // Only use the first floating point value |
223 | - preg_match('/-?\d+(\.\d+)?/', (string) $source, $matches); |
|
224 | - $result = @ (float) $matches[0]; |
|
223 | + preg_match('/-?\d+(\.\d+)?/', (string)$source, $matches); |
|
224 | + $result = @ (float)$matches[0]; |
|
225 | 225 | break; |
226 | 226 | |
227 | 227 | case 'BOOL': |
228 | 228 | case 'BOOLEAN': |
229 | - $result = (bool) $source; |
|
229 | + $result = (bool)$source; |
|
230 | 230 | break; |
231 | 231 | |
232 | 232 | case 'WORD': |
233 | - $result = (string) preg_replace('/[^A-Z_]/i', '', $source); |
|
233 | + $result = (string)preg_replace('/[^A-Z_]/i', '', $source); |
|
234 | 234 | break; |
235 | 235 | |
236 | 236 | case 'ALPHANUM': |
237 | 237 | case 'ALNUM': |
238 | - $result = (string) preg_replace('/[^A-Z0-9]/i', '', $source); |
|
238 | + $result = (string)preg_replace('/[^A-Z0-9]/i', '', $source); |
|
239 | 239 | break; |
240 | 240 | |
241 | 241 | case 'CMD': |
242 | - $result = (string) preg_replace('/[^A-Z0-9_\.-]/i', '', $source); |
|
242 | + $result = (string)preg_replace('/[^A-Z0-9_\.-]/i', '', $source); |
|
243 | 243 | $result = strtolower($result); |
244 | 244 | break; |
245 | 245 | |
246 | 246 | case 'BASE64': |
247 | - $result = (string) preg_replace('/[^A-Z0-9\/+=]/i', '', $source); |
|
247 | + $result = (string)preg_replace('/[^A-Z0-9\/+=]/i', '', $source); |
|
248 | 248 | break; |
249 | 249 | |
250 | 250 | case 'STRING': |
251 | - $result = (string) $this->process($source); |
|
251 | + $result = (string)$this->process($source); |
|
252 | 252 | break; |
253 | 253 | |
254 | 254 | case 'ARRAY': |
255 | - $result = (array) $this->process($source); |
|
255 | + $result = (array)$this->process($source); |
|
256 | 256 | break; |
257 | 257 | |
258 | 258 | case 'PATH': |
259 | - $source = trim((string) $source); |
|
259 | + $source = trim((string)$source); |
|
260 | 260 | $pattern = '/^([-_\.\/A-Z0-9=&%?~]+)(.*)$/i'; |
261 | 261 | preg_match($pattern, $source, $matches); |
262 | - $result = @ (string) $matches[1]; |
|
262 | + $result = @ (string)$matches[1]; |
|
263 | 263 | break; |
264 | 264 | |
265 | 265 | case 'USERNAME': |
266 | - $result = (string) preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source); |
|
266 | + $result = (string)preg_replace('/[\x00-\x1F\x7F<>"\'%&]/', '', $source); |
|
267 | 267 | break; |
268 | 268 | |
269 | 269 | case 'WEBURL': |
270 | - $result = (string) $this->process($source); |
|
270 | + $result = (string)$this->process($source); |
|
271 | 271 | // allow only relative, http or https |
272 | 272 | $urlparts = parse_url($result); |
273 | 273 | if (!empty($urlparts['scheme']) |
@@ -282,17 +282,17 @@ discard block |
||
282 | 282 | break; |
283 | 283 | |
284 | 284 | case 'EMAIL': |
285 | - $result = (string) $source; |
|
286 | - if (!filter_var((string) $source, FILTER_VALIDATE_EMAIL)) { |
|
285 | + $result = (string)$source; |
|
286 | + if (!filter_var((string)$source, FILTER_VALIDATE_EMAIL)) { |
|
287 | 287 | $result = ''; |
288 | 288 | } |
289 | 289 | break; |
290 | 290 | |
291 | 291 | case 'IP': |
292 | - $result = (string) $source; |
|
292 | + $result = (string)$source; |
|
293 | 293 | // this may be too restrictive. |
294 | 294 | // Should the FILTER_FLAG_NO_PRIV_RANGE flag be excluded? |
295 | - if (!filter_var((string) $source, FILTER_VALIDATE_IP)) { |
|
295 | + if (!filter_var((string)$source, FILTER_VALIDATE_IP)) { |
|
296 | 296 | $result = ''; |
297 | 297 | } |
298 | 298 | break; |
@@ -425,20 +425,20 @@ discard block |
||
425 | 425 | // reconstruct tag with allowed attributes |
426 | 426 | if (!$isCloseTag) { |
427 | 427 | $attrSet = $this->filterAttr($attrSet); |
428 | - $preTag .= '<' . $tagName; |
|
428 | + $preTag .= '<'.$tagName; |
|
429 | 429 | $attrSetCount = count($attrSet); |
430 | 430 | for ($i = 0; $i < $attrSetCount; ++$i) { |
431 | - $preTag .= ' ' . $attrSet[$i]; |
|
431 | + $preTag .= ' '.$attrSet[$i]; |
|
432 | 432 | } |
433 | 433 | // reformat single tags to XHTML |
434 | - if (strpos($fromTagOpen, "</" . $tagName)) { |
|
434 | + if (strpos($fromTagOpen, "</".$tagName)) { |
|
435 | 435 | $preTag .= '>'; |
436 | 436 | } else { |
437 | 437 | $preTag .= ' />'; |
438 | 438 | } |
439 | 439 | } else { |
440 | 440 | // just the tagname |
441 | - $preTag .= '</' . $tagName . '>'; |
|
441 | + $preTag .= '</'.$tagName.'>'; |
|
442 | 442 | } |
443 | 443 | } |
444 | 444 | // find next tag's start |
@@ -515,13 +515,13 @@ discard block |
||
515 | 515 | if ((!$attrFound && $this->attrMethod) || ($attrFound && !$this->attrMethod)) { |
516 | 516 | if ($attrSubSet[1]) { |
517 | 517 | // attr has value |
518 | - $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[1] . '"'; |
|
518 | + $newSet[] = $attrSubSet[0].'="'.$attrSubSet[1].'"'; |
|
519 | 519 | } elseif ($attrSubSet[1] == "0") { |
520 | 520 | // attr has decimal zero as value |
521 | - $newSet[] = $attrSubSet[0] . '="0"'; |
|
521 | + $newSet[] = $attrSubSet[0].'="0"'; |
|
522 | 522 | } else { |
523 | 523 | // reformat single attributes to XHTML |
524 | - $newSet[] = $attrSubSet[0] . '="' . $attrSubSet[0] . '"'; |
|
524 | + $newSet[] = $attrSubSet[0].'="'.$attrSubSet[0].'"'; |
|
525 | 525 | } |
526 | 526 | } |
527 | 527 | } |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | // convert decimal |
545 | 545 | $source = preg_replace_callback( |
546 | 546 | '/&#(\d+);/m', |
547 | - function ($matches) { |
|
547 | + function($matches) { |
|
548 | 548 | return chr($matches[1]); |
549 | 549 | }, |
550 | 550 | $source |
@@ -552,8 +552,8 @@ discard block |
||
552 | 552 | // convert hex notation |
553 | 553 | $source = preg_replace_callback( |
554 | 554 | '/&#x([a-f0-9]+);/mi', |
555 | - function ($matches) { |
|
556 | - return chr('0x' . $matches[1]); |
|
555 | + function($matches) { |
|
556 | + return chr('0x'.$matches[1]); |
|
557 | 557 | }, |
558 | 558 | $source |
559 | 559 | ); |
@@ -595,37 +595,37 @@ discard block |
||
595 | 595 | $name = $input[0]; |
596 | 596 | $type = isset($input[1]) ? $input[1] : 'string'; |
597 | 597 | $default = isset($input[2]) ? |
598 | - (($require && $require==$name) ? '': $input[2]) : ''; |
|
598 | + (($require && $require == $name) ? '' : $input[2]) : ''; |
|
599 | 599 | $trim = isset($input[3]) ? $input[3] : true; |
600 | 600 | $maxlen = isset($input[4]) ? $input[4] : 0; |
601 | 601 | $value = $default; |
602 | 602 | switch ($source) { |
603 | 603 | case 'get': |
604 | 604 | if (isset($_GET[$name])) { |
605 | - $value=$_GET[$name]; |
|
605 | + $value = $_GET[$name]; |
|
606 | 606 | } |
607 | 607 | break; |
608 | 608 | case 'post': |
609 | 609 | if (isset($_POST[$name])) { |
610 | - $value=$_POST[$name]; |
|
610 | + $value = $_POST[$name]; |
|
611 | 611 | } |
612 | 612 | break; |
613 | 613 | case 'cookie': |
614 | 614 | if (isset($_COOKIE[$name])) { |
615 | - $value=$_COOKIE[$name]; |
|
615 | + $value = $_COOKIE[$name]; |
|
616 | 616 | } |
617 | 617 | break; |
618 | 618 | } |
619 | 619 | if ($trim) { |
620 | 620 | $value = trim($value); |
621 | 621 | } |
622 | - if ($maxlen>0) { |
|
622 | + if ($maxlen > 0) { |
|
623 | 623 | if (function_exists('mb_strlen')) { |
624 | - if (mb_strlen($value)>$maxlen) { |
|
625 | - $value=mb_substr($value, 0, $maxlen); |
|
624 | + if (mb_strlen($value) > $maxlen) { |
|
625 | + $value = mb_substr($value, 0, $maxlen); |
|
626 | 626 | } |
627 | 627 | } else { |
628 | - $value=substr($value, 0, $maxlen); |
|
628 | + $value = substr($value, 0, $maxlen); |
|
629 | 629 | } |
630 | 630 | if ($trim) { |
631 | 631 | $value = trim($value); |