@@ -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 | |
@@ -226,11 +220,9 @@ discard block |
||
| 226 | 220 | // trigger_error("Votre route n'existe pas : ".$_SERVER['REQUEST_URI'], E_USER_NOTICE); |
| 227 | 221 | // } |
| 228 | 222 | } |
| 229 | - } |
|
| 230 | - else if (Request::isCliRequest()) { |
|
| 223 | + } else if (Request::isCliRequest()) { |
|
| 231 | 224 | |
| 232 | - if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } |
|
| 233 | - else { $aArguments = $argv; } |
|
| 225 | + if (isset($_SERVER['argv'])) { $aArguments = $_SERVER['argv']; } else { $aArguments = $argv; } |
|
| 234 | 226 | |
| 235 | 227 | define('PORTAL', 'Batch'); |
| 236 | 228 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -240,8 +232,7 @@ discard block |
||
| 240 | 232 | $sBatchName = "phpunit"; |
| 241 | 233 | $aArguments[0] = "bin/console"; |
| 242 | 234 | $aArguments[1] = "phpunit"; |
| 243 | - } |
|
| 244 | - else { |
|
| 235 | + } else { |
|
| 245 | 236 | $sBatchName = $aArguments[1]; |
| 246 | 237 | } |
| 247 | 238 | |
@@ -290,8 +281,7 @@ discard block |
||
| 290 | 281 | if (isset($oBatch->controller) && isset($oBatch->action)) { |
| 291 | 282 | |
| 292 | 283 | echo $this->_loadController($oBatch->controller, $oBatch->action, array($aOptions)); |
| 293 | - } |
|
| 294 | - else { |
|
| 284 | + } else { |
|
| 295 | 285 | |
| 296 | 286 | if (Request::isCliRequest()) { |
| 297 | 287 | |
@@ -334,8 +324,7 @@ discard block |
||
| 334 | 324 | } |
| 335 | 325 | } |
| 336 | 326 | } |
| 337 | - } |
|
| 338 | - else if (defined('STDIN')) { |
|
| 327 | + } else if (defined('STDIN')) { |
|
| 339 | 328 | |
| 340 | 329 | $oBatch = Config::get('Route')->batch->script->{$sRoute}; |
| 341 | 330 | echo $this->_loadController($oBatch->controller, $oBatch->action, $aParams); |
@@ -397,8 +386,7 @@ discard block |
||
| 397 | 386 | }, |
| 398 | 387 | $sRoute |
| 399 | 388 | ); |
| 400 | - } |
|
| 401 | - else { |
|
| 389 | + } else { |
|
| 402 | 390 | |
| 403 | 391 | $sFinalRoute = '.*'; |
| 404 | 392 | } |
@@ -448,8 +436,7 @@ discard block |
||
| 448 | 436 | |
| 449 | 437 | $oMobileDetect = new \Mobile_Detect; |
| 450 | 438 | |
| 451 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 452 | - else { $sCacheExt = ''; } |
|
| 439 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 453 | 440 | |
| 454 | 441 | $mCacheReturn = Cache::get($RequestUri.$sCacheExt, $oRoute->cache->max_age); |
| 455 | 442 | |
@@ -472,17 +459,14 @@ discard block |
||
| 472 | 459 | if ($oRoute->content_type == 'json') { |
| 473 | 460 | |
| 474 | 461 | header('Content-type: application/json; charset='.$sCharset.''); |
| 475 | - } |
|
| 476 | - else if ($oRoute->content_type == 'html') { |
|
| 462 | + } else if ($oRoute->content_type == 'html') { |
|
| 477 | 463 | |
| 478 | 464 | header('Content-type: text/html; charset='.$sCharset.''); |
| 479 | - } |
|
| 480 | - else if ($oRoute->content_type == 'jpeg') { |
|
| 465 | + } else if ($oRoute->content_type == 'jpeg') { |
|
| 481 | 466 | |
| 482 | 467 | header('Content-type: image/jpeg'); |
| 483 | 468 | } |
| 484 | - } |
|
| 485 | - else { |
|
| 469 | + } else { |
|
| 486 | 470 | |
| 487 | 471 | header('Content-type: text/html; charset='.$sCharset.''); |
| 488 | 472 | } |
@@ -503,21 +487,17 @@ discard block |
||
| 503 | 487 | if (isset($_GET[$sName]) && $_GET[$sName] != '') { |
| 504 | 488 | |
| 505 | 489 | $aEntries[] = $_GET[$sName]; |
| 506 | - } |
|
| 507 | - else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 490 | + } else if (isset($oRoute->defaults_constraints) && is_object($oRoute->defaults_constraints) |
|
| 508 | 491 | && isset($oRoute->defaults_constraints->{$sName})) { |
| 509 | 492 | |
| 510 | 493 | $aEntries[] = $oRoute->defaults_constraints->{$sName}; |
| 511 | - } |
|
| 512 | - else if (isset($_GET[$sName])) { |
|
| 494 | + } else if (isset($_GET[$sName])) { |
|
| 513 | 495 | |
| 514 | 496 | $aEntries[] = $_GET[$sName]; |
| 515 | - } |
|
| 516 | - else if (preg_match('/'.$sType.'/', '')) { |
|
| 497 | + } else if (preg_match('/'.$sType.'/', '')) { |
|
| 517 | 498 | |
| 518 | 499 | $aEntries[] = ''; |
| 519 | - } |
|
| 520 | - else { |
|
| 500 | + } else { |
|
| 521 | 501 | |
| 522 | 502 | $this->_oLogger->warning('Error: Parameter '.$sName.' not exists!'); |
| 523 | 503 | break; |
@@ -529,8 +509,7 @@ discard block |
||
| 529 | 509 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 530 | 510 | |
| 531 | 511 | } |
| 532 | - } |
|
| 533 | - else { |
|
| 512 | + } else { |
|
| 534 | 513 | |
| 535 | 514 | $mReturn = $this->_loadController($oController, $sActionName, $aEntries); |
| 536 | 515 | } |
@@ -542,8 +521,7 @@ discard block |
||
| 542 | 521 | $mReturn = json_encode($mReturn, JSON_PRETTY_PRINT); |
| 543 | 522 | } |
| 544 | 523 | } |
| 545 | - } |
|
| 546 | - else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 524 | + } else if (isset($oRoute->template) && isset($oRoute->layout) && $oRoute->layout === true) { |
|
| 547 | 525 | |
| 548 | 526 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 549 | 527 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -560,8 +538,7 @@ discard block |
||
| 560 | 538 | |
| 561 | 539 | $mReturn = $oLayout->assign('model', DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.PORTAL.DIRECTORY_SEPARATOR.'View'.DIRECTORY_SEPARATOR.$oRoute->template.'.tpl') |
| 562 | 540 | ->fetch(); |
| 563 | - } |
|
| 564 | - else if (isset($oRoute->template)) { |
|
| 541 | + } else if (isset($oRoute->template)) { |
|
| 565 | 542 | |
| 566 | 543 | define('PORTAL', preg_replace('/^\\\\Venus\\\\src\\\\([a-zA-Z0-9_]+)\\\\.+$/', '$1', $oRoute->template)); |
| 567 | 544 | set_include_path(get_include_path().PATH_SEPARATOR.'src'.PATH_SEPARATOR.PORTAL.PATH_SEPARATOR.'public'); |
@@ -585,8 +562,7 @@ discard block |
||
| 585 | 562 | |
| 586 | 563 | $oMobileDetect = new \Mobile_Detect; |
| 587 | 564 | |
| 588 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 589 | - else { $sCacheExt = ''; } |
|
| 565 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 590 | 566 | |
| 591 | 567 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 592 | 568 | |
@@ -640,8 +616,7 @@ discard block |
||
| 640 | 616 | |
| 641 | 617 | $oMobileDetect = new \Mobile_Detect; |
| 642 | 618 | |
| 643 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 644 | - else { $sCacheExt = ''; } |
|
| 619 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 645 | 620 | |
| 646 | 621 | $mCacheReturn = Cache::get($sActionName.$sCacheExt, $aPhpDoc['Cache']['maxage']); |
| 647 | 622 | |
@@ -682,8 +657,7 @@ discard block |
||
| 682 | 657 | |
| 683 | 658 | $oMobileDetect = new \Mobile_Detect; |
| 684 | 659 | |
| 685 | - if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } |
|
| 686 | - else { $sCacheExt = ''; } |
|
| 660 | + if ($oMobileDetect->isMobile()) { $sCacheExt = '.mobi'; } else { $sCacheExt = ''; } |
|
| 687 | 661 | |
| 688 | 662 | if (defined('COMPRESS_HTML') && COMPRESS_HTML) { |
| 689 | 663 | |
@@ -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' and filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } |
|
| 150 | - elseif ($sFile > '0' and filetype($sName.$sFile) == "dir") { remove_dir($sName.$sFile."\\"); } |
|
| 148 | + if ($sFile > '0' and filetype($sName.$sFile) == "file") { unlink($sName.$sFile); } elseif ($sFile > '0' and 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 | { |