@@ -196,8 +196,8 @@ discard block |
||
| 196 | 196 | * |
| 197 | 197 | * @access private |
| 198 | 198 | * @param string $sFileToMerge file to get |
| 199 | - * @param object $base base |
|
| 200 | - * @return object |
|
| 199 | + * @param stdClass $base base |
|
| 200 | + * @return stdClass |
|
| 201 | 201 | */ |
| 202 | 202 | private static function _mergeAndGetConf(string $sFileToMerge, \StdClass $base) : \StdClass |
| 203 | 203 | { |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * |
| 223 | 223 | * @access private |
| 224 | 224 | * @param $oConfFiles |
| 225 | - * @param StdClass $base |
|
| 225 | + * @param stdClass $base |
|
| 226 | 226 | * @return multitype:array multitype:array |
| 227 | 227 | */ |
| 228 | 228 | private static function _recursiveGet($oConfFiles, StdClass $base) : array |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | */ |
| 51 | 51 | public static function get(string $sName, string $sPortal = null, bool $bNoDoRedirect = false) |
| 52 | 52 | { |
| 53 | - if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } |
|
| 54 | - else { $sNameCache = $sName; } |
|
| 53 | + if ($bNoDoRedirect === true) { $sNameCache = $sName.'_true'; } else { $sNameCache = $sName; } |
|
| 55 | 54 | |
| 56 | 55 | if ($sPortal === null || !is_string($sPortal)) { |
| 57 | 56 | |
@@ -59,8 +58,7 @@ discard block |
||
| 59 | 58 | |
| 60 | 59 | $sPortal = PORTAL; |
| 61 | 60 | $aDirectories = array($sPortal); |
| 62 | - } |
|
| 63 | - else { |
|
| 61 | + } else { |
|
| 64 | 62 | |
| 65 | 63 | $sPortal = ''; |
| 66 | 64 | $aDirectories = scandir(str_replace('core', 'src', __DIR__)); |
@@ -187,8 +185,7 @@ discard block |
||
| 187 | 185 | { |
| 188 | 186 | $oConfig = self::get($sName, null, true); |
| 189 | 187 | |
| 190 | - if (isset($oConfig->redirect)) { return $oConfig->redirect; } |
|
| 191 | - else { return PORTAL; } |
|
| 188 | + if (isset($oConfig->redirect)) { return $oConfig->redirect; } else { return PORTAL; } |
|
| 192 | 189 | } |
| 193 | 190 | |
| 194 | 191 | /** |
@@ -207,8 +204,7 @@ discard block |
||
| 207 | 204 | |
| 208 | 205 | list($oConfFiles, $base) = self::_recursiveGet($oConfFiles, $base); |
| 209 | 206 | return $base; |
| 210 | - } |
|
| 211 | - else { |
|
| 207 | + } else { |
|
| 212 | 208 | |
| 213 | 209 | echo "The Json ".$sFileToMerge." has an error! Please verify!\n"; |
| 214 | 210 | $oDebug = Debug::getInstance(); |
@@ -232,12 +228,10 @@ discard block |
||
| 232 | 228 | if (is_object($oConfFiles) && is_object($base) && !isset($base->$sKey)) { |
| 233 | 229 | |
| 234 | 230 | $base->$sKey = $oConfFiles->$sKey; |
| 235 | - } |
|
| 236 | - else if (is_array($oConfFiles) && is_array($base) && !isset($base[$sKey])) { |
|
| 231 | + } else if (is_array($oConfFiles) && is_array($base) && !isset($base[$sKey])) { |
|
| 237 | 232 | |
| 238 | 233 | $base[$sKey] = $oConfFiles[$sKey]; |
| 239 | - } |
|
| 240 | - else if (!isset($base->$sKey) && is_array($mOne)) { |
|
| 234 | + } else if (!isset($base->$sKey) && is_array($mOne)) { |
|
| 241 | 235 | |
| 242 | 236 | $base->$sKey = new \StdClass; |
| 243 | 237 | list($oConfFiles, $base) = self::_recursiveGet($mOne, $base->$sKey); |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | * |
| 119 | 119 | * @access public |
| 120 | 120 | * @param mixed $mKey |
| 121 | - * @return void |
|
| 121 | + * @return boolean |
|
| 122 | 122 | */ |
| 123 | 123 | public function __isset($mKey) |
| 124 | 124 | { |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | * |
| 131 | 131 | * @access public |
| 132 | 132 | * @param mixed $mOffset |
| 133 | - * @return mixed |
|
| 133 | + * @return boolean |
|
| 134 | 134 | */ |
| 135 | 135 | function offsetExists($mOffset) |
| 136 | 136 | { |
@@ -62,15 +62,13 @@ discard block |
||
| 62 | 62 | if (!is_callable($data = $this->_aDataType[$mKey][$mKey]) || (is_string($data) && function_exists($data))) { |
| 63 | 63 | |
| 64 | 64 | return $data; |
| 65 | - } |
|
| 66 | - else { |
|
| 65 | + } else { |
|
| 67 | 66 | |
| 68 | 67 | $dataStore = &$this->_aDataType[$mKey]; |
| 69 | 68 | $dataStore[$mKey] = call_user_func($data, null); |
| 70 | 69 | return $dataStore[$mKey]; |
| 71 | 70 | } |
| 72 | - } |
|
| 73 | - else { |
|
| 71 | + } else { |
|
| 74 | 72 | |
| 75 | 73 | return null; |
| 76 | 74 | } |
@@ -89,8 +87,7 @@ discard block |
||
| 89 | 87 | |
| 90 | 88 | $this->_aClosures[$mKey] = $mValue; |
| 91 | 89 | $this->_aDataType[$mKey] = &$this->_aClosures; |
| 92 | - } |
|
| 93 | - else { |
|
| 90 | + } else { |
|
| 94 | 91 | |
| 95 | 92 | $this->_aData[$mKey] = $mValue; |
| 96 | 93 | $this->_aDataType[$mKey] = &$this->_aData; |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * run the routeur |
| 91 | 91 | * |
| 92 | 92 | * @access public |
| 93 | - * @return void |
|
| 93 | + * @return null|boolean |
|
| 94 | 94 | */ |
| 95 | 95 | public function run() |
| 96 | 96 | { |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | * load a route |
| 379 | 379 | * |
| 380 | 380 | * @access private |
| 381 | - * @param stdClass $oRoute one route |
|
| 381 | + * @param \stdClass $oRoute one route |
|
| 382 | 382 | * @param string $RequestUri URI |
| 383 | 383 | * @return void |
| 384 | 384 | */ |
@@ -131,14 +131,12 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | echo file_get_contents(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.$_SERVER['REQUEST_URI']); |
| 133 | 133 | exit; |
| 134 | - } |
|
| 135 | - else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 134 | + } else if (strstr($_SERVER['REQUEST_URI'], '.css') |
|
| 136 | 135 | && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI']))) { |
| 137 | 136 | |
| 138 | 137 | Less::toCss(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.css/', '.less', $_SERVER['REQUEST_URI'])); |
| 139 | 138 | exit; |
| 140 | - } |
|
| 141 | - else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 139 | + } else if (strstr($_SERVER['REQUEST_URI'], '.js') |
|
| 142 | 140 | && file_exists(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI']))) { |
| 143 | 141 | |
| 144 | 142 | Typescript::toJs(__DIR__.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'plugins'.DIRECTORY_SEPARATOR.$sPlugin.DIRECTORY_SEPARATOR.'public'.preg_replace('/\.js/', '.ts', $_SERVER['REQUEST_URI'])); |
@@ -167,8 +165,7 @@ discard block |
||
| 167 | 165 | header('Status: 301 Moved Permanently', false, 301); |
| 168 | 166 | header('Location: '.$oHost->location); |
| 169 | 167 | exit; |
| 170 | - } |
|
| 171 | - else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 168 | + } else if (preg_match('#getCss\?#', $_SERVER['REQUEST_URI'])) { |
|
| 172 | 169 | |
| 173 | 170 | foreach ($_GET as $sKey => $sValue) { |
| 174 | 171 | |
@@ -179,8 +176,7 @@ discard block |
||
| 179 | 176 | } |
| 180 | 177 | |
| 181 | 178 | exit; |
| 182 | - } |
|
| 183 | - else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 179 | + } else if (preg_match('#getJs\?#', $_SERVER['REQUEST_URI'])) { |
|
| 184 | 180 | |
| 185 | 181 | foreach ($_GET as $sKey => $sValue) { |
| 186 | 182 | |
@@ -191,8 +187,7 @@ discard block |
||
| 191 | 187 | } |
| 192 | 188 | |
| 193 | 189 | exit; |
| 194 | - } |
|
| 195 | - else if (isset($oHost->routes)) { |
|
| 190 | + } else if (isset($oHost->routes)) { |
|
| 196 | 191 | |
| 197 | 192 | foreach($oHost->routes as $sKey => $oRoute) { |
| 198 | 193 | |
@@ -201,8 +196,7 @@ discard block |
||
| 201 | 196 | if ($mReturn === 403) { |
| 202 | 197 | |
| 203 | 198 | $this->_getPage403(); |
| 204 | - } |
|
| 205 | - else if ($mReturn === true) { |
|
| 199 | + } else if ($mReturn === true) { |
|
| 206 | 200 | |
| 207 | 201 | if (isset($oRoute->cache)) { $this->_checkCache($oRoute->cache); } |
| 208 | 202 | |
@@ -215,11 +209,9 @@ discard block |
||
| 215 | 209 | } |
| 216 | 210 | } |
| 217 | 211 | } |
| 218 | - } |
|
| 219 | - else if (Request::isCliRequest()) { |
|
| 212 | + } else if (Request::isCliRequest()) { |
|
| 220 | 213 | |
| 221 | - if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } |
|
| 222 | - else { $aArguments = $argv; } |
|
| 214 | + if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } else { $aArguments = $argv; } |
|
| 223 | 215 | |
| 224 | 216 | define('PORTAL', 'Batch'); |
| 225 | 217 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -229,8 +221,7 @@ discard block |
||
| 229 | 221 | $sBatchName = "phpunit"; |
| 230 | 222 | $aArguments[0] = "bin/console"; |
| 231 | 223 | $aArguments[1] = "phpunit"; |
| 232 | - } |
|
| 233 | - else { |
|
| 224 | + } else { |
|
| 234 | 225 | $sBatchName = $aArguments[1]; |
| 235 | 226 | } |
| 236 | 227 | |
@@ -279,8 +270,7 @@ discard block |
||
| 279 | 270 | if (isset($oBatch->controller) && isset($oBatch->action)) { |
| 280 | 271 | |
| 281 | 272 | echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions)); |
| 282 | - } |
|
| 283 | - else { |
|
| 273 | + } else { |
|
| 284 | 274 | |
| 285 | 275 | if (Request::isCliRequest()) { |
| 286 | 276 | |
@@ -323,8 +313,7 @@ discard block |
||
| 323 | 313 | } |
| 324 | 314 | } |
| 325 | 315 | } |
| 326 | - } |
|
| 327 | - else if (defined('STDIN')) { |
|
| 316 | + } else if (defined('STDIN')) { |
|
| 328 | 317 | |
| 329 | 318 | $oBatch = Config::get('Route')->batch->script->{$sRoute}; |
| 330 | 319 | echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams); |
@@ -386,8 +375,7 @@ discard block |
||
| 386 | 375 | }, |
| 387 | 376 | $sRoute |
| 388 | 377 | ); |
| 389 | - } |
|
| 390 | - else { |
|
| 378 | + } else { |
|
| 391 | 379 | |
| 392 | 380 | $sFinalRoute = '.*'; |
| 393 | 381 | } |
@@ -437,8 +425,7 @@ discard block |
||
| 437 | 425 | |
| 438 | 426 | $oMobileDetect = new \Mobile_Detect; |
| 439 | 427 | |
| 440 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 441 | - else { $sCacheExt = ''; } |
|
| 428 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 442 | 429 | |
| 443 | 430 | $mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age); |
| 444 | 431 | |
@@ -461,17 +448,14 @@ discard block |
||
| 461 | 448 | if ($oRoute->content_type == 'json') { |
| 462 | 449 | |
| 463 | 450 | header('Content-type: application/json; charset='.$sCharset.''); |
| 464 | - } |
|
| 465 | - else if ($oRoute->content_type == 'html') { |
|
| 451 | + } else if ($oRoute->content_type == 'html') { |
|
| 466 | 452 | |
| 467 | 453 | header('Content-type: text/html; charset='.$sCharset.''); |
| 468 | - } |
|
| 469 | - else if ($oRoute->content_type == 'jpeg') { |
|
| 454 | + } else if ($oRoute->content_type == 'jpeg') { |
|
| 470 | 455 | |
| 471 | 456 | header('Content-type: image/jpeg'); |
| 472 | 457 | } |
| 473 | - } |
|
| 474 | - else { |
|
| 458 | + } else { |
|
| 475 | 459 | |
| 476 | 460 | header('Content-type: text/html; charset='.$sCharset.''); |
| 477 | 461 | } |
@@ -492,21 +476,17 @@ discard block |
||
| 492 | 476 | if (isset($_GET[$sName]) && $_GET[$sName] != '') { |
| 493 | 477 | |
| 494 | 478 | $aEntries[] = $_GET[$sName]; |
| 495 | - } |
|
| 496 | - else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 479 | + } else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 497 | 480 | && isset($oRoute->defaults_constraints->{$sName})) { |
| 498 | 481 | |
| 499 | 482 | $aEntries[] = $oRoute->defaults_constraints->{$sName}; |
| 500 | - } |
|
| 501 | - else if (isset($_GET[$sName])) { |
|
| 483 | + } else if (isset($_GET[$sName])) { |
|
| 502 | 484 | |
| 503 | 485 | $aEntries[] = $_GET[$sName]; |
| 504 | - } |
|
| 505 | - else if (preg_match('/'.$sType.'/', '')) { |
|
| 486 | + } else if (preg_match('/'.$sType.'/', '')) { |
|
| 506 | 487 | |
| 507 | 488 | $aEntries[] = ''; |
| 508 | - } |
|
| 509 | - else { |
|
| 489 | + } else { |
|
| 510 | 490 | |
| 511 | 491 | $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!'); |
| 512 | 492 | break; |
@@ -518,8 +498,7 @@ discard block |
||
| 518 | 498 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 519 | 499 | |
| 520 | 500 | } |
| 521 | - } |
|
| 522 | - else { |
|
| 501 | + } else { |
|
| 523 | 502 | |
| 524 | 503 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 525 | 504 | } |
@@ -531,8 +510,7 @@ discard block |
||
| 531 | 510 | $mReturn = json_encode($mReturn, JSON_PRETTY_PRINT); |
| 532 | 511 | } |
| 533 | 512 | } |
| 534 | - } |
|
| 535 | - else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 513 | + } else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 536 | 514 | |
| 537 | 515 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 538 | 516 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -549,8 +527,7 @@ discard block |
||
| 549 | 527 | |
| 550 | 528 | $mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl') |
| 551 | 529 | ->fetch(); |
| 552 | - } |
|
| 553 | - else if (isset($oRoute->template)) { |
|
| 530 | + } else if (isset($oRoute->template)) { |
|
| 554 | 531 | |
| 555 | 532 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 556 | 533 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -574,8 +551,7 @@ discard block |
||
| 574 | 551 | |
| 575 | 552 | $oMobileDetect = new \Mobile_Detect; |
| 576 | 553 | |
| 577 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 578 | - else { $sCacheExt = ''; } |
|
| 554 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 579 | 555 | |
| 580 | 556 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 581 | 557 | |
@@ -629,8 +605,7 @@ discard block |
||
| 629 | 605 | |
| 630 | 606 | $oMobileDetect = new \Mobile_Detect; |
| 631 | 607 | |
| 632 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 633 | - else { $sCacheExt = ''; } |
|
| 608 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 634 | 609 | |
| 635 | 610 | $mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']); |
| 636 | 611 | |
@@ -671,8 +646,7 @@ discard block |
||
| 671 | 646 | |
| 672 | 647 | $oMobileDetect = new \Mobile_Detect; |
| 673 | 648 | |
| 674 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 675 | - else { $sCacheExt = ''; } |
|
| 649 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 676 | 650 | |
| 677 | 651 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 678 | 652 | |
@@ -63,7 +63,7 @@ |
||
| 63 | 63 | * check security of access |
| 64 | 64 | * |
| 65 | 65 | * @access public |
| 66 | - * @return void |
|
| 66 | + * @return null|boolean |
|
| 67 | 67 | */ |
| 68 | 68 | |
| 69 | 69 | public function checkSecurity() { |
@@ -95,8 +95,7 @@ discard block |
||
| 95 | 95 | header('HTTP/1.0 401 Unauthorized'); |
| 96 | 96 | echo $oSecurity->cancelled; |
| 97 | 97 | exit; |
| 98 | - } |
|
| 99 | - else { |
|
| 98 | + } else { |
|
| 100 | 99 | |
| 101 | 100 | self::$_sLogin = $_SERVER['PHP_AUTH_USER']; |
| 102 | 101 | self::$_sPassword = $_SERVER['PHP_AUTH_PW']; |
@@ -105,8 +104,7 @@ discard block |
||
| 105 | 104 | if (!$this->_checkAccess()) { return false; } |
| 106 | 105 | if (!$this->_checkBlackListIps()) { return false; } |
| 107 | 106 | } |
| 108 | - } |
|
| 109 | - else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'http_basic_validate_by_controller') { |
|
| 107 | + } else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'http_basic_validate_by_controller') { |
|
| 110 | 108 | |
| 111 | 109 | if (!isset($_SERVER['PHP_AUTH_USER'])) { |
| 112 | 110 | |
@@ -117,8 +115,7 @@ discard block |
||
| 117 | 115 | header('HTTP/1.0 401 Unauthorized'); |
| 118 | 116 | echo $oSecurity->cancelled; |
| 119 | 117 | exit; |
| 120 | - } |
|
| 121 | - else { |
|
| 118 | + } else { |
|
| 122 | 119 | |
| 123 | 120 | self::$_sLogin = $_SERVER['PHP_AUTH_USER']; |
| 124 | 121 | self::$_sPassword = $_SERVER['PHP_AUTH_PW']; |
@@ -132,8 +129,7 @@ discard block |
||
| 132 | 129 | if (!$this->_checkAccess()) { return false; } |
| 133 | 130 | if (!$this->_checkBlackListIps()) { return false; } |
| 134 | 131 | } |
| 135 | - } |
|
| 136 | - else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'controller') { |
|
| 132 | + } else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'controller') { |
|
| 137 | 133 | |
| 138 | 134 | // it's an action of one controller that it return true or false for the authentification |
| 139 | 135 | |
@@ -152,8 +148,7 @@ discard block |
||
| 152 | 148 | if (isset($oSecurity->requires_channel) && $oSecurity->requires_channel == 'https' && !Request::isHttpsRequest()) { |
| 153 | 149 | |
| 154 | 150 | return false; |
| 155 | - } |
|
| 156 | - else if (isset($oSecurity->requires_channel) && $oSecurity->requires_channel == 'http' && ((Request::isHttpRequest() |
|
| 151 | + } else if (isset($oSecurity->requires_channel) && $oSecurity->requires_channel == 'http' && ((Request::isHttpRequest() |
|
| 157 | 152 | && Request::isHttpsRequest()) || !Request::isHttpRequest())) { |
| 158 | 153 | |
| 159 | 154 | return false; |
@@ -180,8 +175,7 @@ discard block |
||
| 180 | 175 | |
| 181 | 176 | if (preg_match('#'.$sPathAccess.'#', str_replace($this->_sBaseUri, '', $_SERVER['REQUEST_URI']))) { |
| 182 | 177 | |
| 183 | - if (in_array($this->getUserRole(), $aParams->roles)) { return true; } |
|
| 184 | - else { return false; } |
|
| 178 | + if (in_array($this->getUserRole(), $aParams->roles)) { return true; } else { return false; } |
|
| 185 | 179 | } |
| 186 | 180 | } |
| 187 | 181 | } |
@@ -223,9 +217,7 @@ discard block |
||
| 223 | 217 | $sLogin = self::$_sLogin; |
| 224 | 218 | $sPassword = Config::get('Security')->users->$sLogin->password; |
| 225 | 219 | |
| 226 | - if ($sPassword == self::$_sPassword) { return true; } |
|
| 227 | - else if ($sPassword == md5(self::$_sPassword)) { return true; } |
|
| 228 | - else { return false; } |
|
| 220 | + if ($sPassword == self::$_sPassword) { return true; } else if ($sPassword == md5(self::$_sPassword)) { return true; } else { return false; } |
|
| 229 | 221 | } |
| 230 | 222 | |
| 231 | 223 | /** |
@@ -241,8 +233,7 @@ discard block |
||
| 241 | 233 | |
| 242 | 234 | $sLogin = self::$_sLogin; |
| 243 | 235 | return Config::get('Security')->users->$sLogin->roles; |
| 244 | - } |
|
| 245 | - else { |
|
| 236 | + } else { |
|
| 246 | 237 | |
| 247 | 238 | return ''; |
| 248 | 239 | } |
@@ -259,8 +250,7 @@ discard block |
||
| 259 | 250 | |
| 260 | 251 | public function isGranted(string $sRole) : bool { |
| 261 | 252 | |
| 262 | - if ($sRole == $this->getUserRole() || $this->getUserRole() == '') { return true; } |
|
| 263 | - else { return false; } |
|
| 253 | + if ($sRole == $this->getUserRole() || $this->getUserRole() == '') { return true; } else { return false; } |
|
| 264 | 254 | } |
| 265 | 255 | |
| 266 | 256 | /** |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | * @access public |
| 43 | 43 | * @param string $sCode code of the url between "routes" and "route" in Route.conf |
| 44 | 44 | * @param array $aParams parameters to create the url |
| 45 | - * @return void |
|
| 45 | + * @return string |
|
| 46 | 46 | * |
| 47 | 47 | * @tutorial If I have this route I could make my URL: |
| 48 | 48 | * |
@@ -96,12 +96,10 @@ |
||
| 96 | 96 | |
| 97 | 97 | if (preg_match('#'.$sType.'#', $aParams[$sName])) { |
| 98 | 98 | |
| 99 | - if ($aParams[$sName]) { $sRoute = str_replace('[/:'.$sName.']', '/'.$aParams[$sName], $sRoute); } |
|
| 100 | - else { $sRoute = str_replace('[/:'.$sName.']', '', $sRoute); } |
|
| 99 | + if ($aParams[$sName]) { $sRoute = str_replace('[/:'.$sName.']', '/'.$aParams[$sName], $sRoute); } else { $sRoute = str_replace('[/:'.$sName.']', '', $sRoute); } |
|
| 101 | 100 | $sRoute = str_replace('[:'.$sName.']', $aParams[$sName], $sRoute); |
| 102 | 101 | continue; |
| 103 | - } |
|
| 104 | - else if (isset($oRoute->defaults_constraints) |
|
| 102 | + } else if (isset($oRoute->defaults_constraints) |
|
| 105 | 103 | && isset($oRoute->defaults_constraints->{$sName}) |
| 106 | 104 | && preg_match('#'.$sType.'#', $oRoute->defaults_constraints->{$sName})) { |
| 107 | 105 | |
@@ -503,7 +503,7 @@ discard block |
||
| 503 | 503 | * Get the UID of the connected user, or 0 |
| 504 | 504 | * if the Facebook user is not connected. |
| 505 | 505 | * |
| 506 | - * @return string the UID if available. |
|
| 506 | + * @return integer the UID if available. |
|
| 507 | 507 | */ |
| 508 | 508 | public function getUser() { |
| 509 | 509 | if ($this->user !== null) { |
@@ -757,6 +757,7 @@ discard block |
||
| 757 | 757 | * either logged in to Facebook or has granted an offline access permission. |
| 758 | 758 | * |
| 759 | 759 | * @param string $code An authorization code. |
| 760 | + * @param string $redirect_uri |
|
| 760 | 761 | * @return mixed An access token exchanged for the authorization code, or |
| 761 | 762 | * false if an access token could not be generated. |
| 762 | 763 | */ |
@@ -1135,7 +1136,7 @@ discard block |
||
| 1135 | 1136 | /** |
| 1136 | 1137 | * Build the URL for given domain alias, path and parameters. |
| 1137 | 1138 | * |
| 1138 | - * @param $name string The name of the domain |
|
| 1139 | + * @param string $name string The name of the domain |
|
| 1139 | 1140 | * @param $path string Optional path (without a leading slash) |
| 1140 | 1141 | * @param $params array Optional query parameters |
| 1141 | 1142 | * |
@@ -1402,6 +1403,9 @@ discard block |
||
| 1402 | 1403 | return self::endsWith($big, '.'.$small); |
| 1403 | 1404 | } |
| 1404 | 1405 | |
| 1406 | + /** |
|
| 1407 | + * @param string $small |
|
| 1408 | + */ |
|
| 1405 | 1409 | protected static function endsWith($big, $small) { |
| 1406 | 1410 | $len = strlen($small); |
| 1407 | 1411 | if ($len === 0) { |
@@ -361,8 +361,7 @@ |
||
| 361 | 361 | 'fb_exchange_token' => $this->getAccessToken(), |
| 362 | 362 | ) |
| 363 | 363 | ); |
| 364 | - } |
|
| 365 | - catch (FacebookApiException $e) { |
|
| 364 | + } catch (FacebookApiException $e) { |
|
| 366 | 365 | // most likely that user very recently revoked authorization. |
| 367 | 366 | // In any event, we don't have an access token, so say so. |
| 368 | 367 | return false; |
@@ -150,6 +150,9 @@ |
||
| 150 | 150 | return self::FBSS_COOKIE_NAME . '_' . $this->getAppId(); |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | + /** |
|
| 154 | + * @param string $key |
|
| 155 | + */ |
|
| 153 | 156 | protected function constructSessionVariableName($key) { |
| 154 | 157 | $parts = array('fb', $this->getAppId(), $key); |
| 155 | 158 | if ($this->sharedSessionID) { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | * |
| 98 | 98 | * @access public |
| 99 | 99 | * @param string $sName name of the session |
| 100 | - * @return mixed |
|
| 100 | + * @return boolean |
|
| 101 | 101 | */ |
| 102 | 102 | public function delete(string $sName) |
| 103 | 103 | { |
@@ -108,7 +108,6 @@ discard block |
||
| 108 | 108 | * flush the cache |
| 109 | 109 | * |
| 110 | 110 | * @access public |
| 111 | - * @param string $sName name of the session |
|
| 112 | 111 | * @return mixed |
| 113 | 112 | */ |
| 114 | 113 | public function flush() |
@@ -121,7 +120,7 @@ discard block |
||
| 121 | 120 | * |
| 122 | 121 | * @access public |
| 123 | 122 | * @param string $sName name of the session |
| 124 | - * @return mixed |
|
| 123 | + * @return string |
|
| 125 | 124 | */ |
| 126 | 125 | private function _getSubDirectory($sName) |
| 127 | 126 | { |
@@ -85,8 +85,7 @@ discard block |
||
| 85 | 85 | if (file_exists($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')) { |
| 86 | 86 | |
| 87 | 87 | return unserialize(file_get_contents($this->_sFolder.$this->_getSubDirectory($sName).md5($sName).'.fil.cac')); |
| 88 | - } |
|
| 89 | - else { |
|
| 88 | + } else { |
|
| 90 | 89 | |
| 91 | 90 | return false; |
| 92 | 91 | } |
@@ -146,8 +145,7 @@ discard block |
||
| 146 | 145 | |
| 147 | 146 | while (($sFile = readdir($rDirectory)) !== false) { |
| 148 | 147 | |
| 149 | - if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } |
|
| 150 | - elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); } |
|
| 148 | + if ($sFile > '0' && filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' && filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); } |
|
| 151 | 149 | } |
| 152 | 150 | |
| 153 | 151 | closedir($rDirectory); |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | * @param string $sName name of the session |
| 38 | 38 | * @param int $iFlags flags |
| 39 | 39 | * @param int $iTimeout expiration of cache |
| 40 | - * @return mixed |
|
| 40 | + * @return boolean |
|
| 41 | 41 | */ |
| 42 | 42 | public function get(string $sName, int &$iFlags = null, int $iTimeout = 0) |
| 43 | 43 | { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | * @param mixed $mValue value of this sesion var |
| 53 | 53 | * @param int $iFlag unused |
| 54 | 54 | * @param int $iExpire expiration of cache |
| 55 | - * @return \Venus\lib\Cache\Apc |
|
| 55 | + * @return boolean |
|
| 56 | 56 | */ |
| 57 | 57 | public function set(string $sName, $mValue, int $iFlag = 0, int $iExpire = false) |
| 58 | 58 | { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | * flush the cache |
| 64 | 64 | * |
| 65 | 65 | * @access public |
| 66 | - * @return mixed |
|
| 66 | + * @return boolean |
|
| 67 | 67 | */ |
| 68 | 68 | public function flush() |
| 69 | 69 | { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * |
| 76 | 76 | * @access public |
| 77 | 77 | * @param string $sName name of the session |
| 78 | - * @return mixed |
|
| 78 | + * @return boolean |
|
| 79 | 79 | */ |
| 80 | 80 | public function delete(string $sName) |
| 81 | 81 | { |
@@ -88,9 +88,8 @@ discard block |
||
| 88 | 88 | * @access public |
| 89 | 89 | * @param string $sName name of the session |
| 90 | 90 | * @param mixed $mValue value of this sesion var |
| 91 | - * @param int $iFlag unused |
|
| 92 | 91 | * @param int $iExpire expiration of cache |
| 93 | - * @return mixed |
|
| 92 | + * @return boolean |
|
| 94 | 93 | */ |
| 95 | 94 | public function add($sName, $mValue, $iExpire = false) |
| 96 | 95 | { |