@@ -51,8 +51,7 @@ |
||
| 51 | 51 | |
| 52 | 52 | $sCmd = self::TYPESCRIPT_WINDOWS." ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
| 53 | 53 | $sContent = shell_exec($sCmd); |
| 54 | - } |
|
| 55 | - else { |
|
| 54 | + } else { |
|
| 56 | 55 | |
| 57 | 56 | $sCmd = "tsc ".$sFile." --outDir ".__DIR__.'../../'.CACHE_DIR.$sFolder.'/'; |
| 58 | 57 | $sContent = shell_exec($sCmd); |
@@ -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 | /** |
@@ -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); |
@@ -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 | |
@@ -118,8 +118,7 @@ |
||
| 118 | 118 | */ |
| 119 | 119 | public function redirect(string $sUrl, int $iHttpCode = 301) |
| 120 | 120 | { |
| 121 | - if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); } |
|
| 122 | - else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); } |
|
| 121 | + if ($iHttpCode === 301) { header('Status: 301 Moved Permanently', false, 301); } else if ($iHttpCode === 302) { header('Status: Moved Temporarily', false, 301); } |
|
| 123 | 122 | |
| 124 | 123 | header('Location: '.$sUrl); |
| 125 | 124 | exit; |
@@ -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; |
@@ -60,8 +60,7 @@ |
||
| 60 | 60 | echo "\n\n"; |
| 61 | 61 | echo " > Check realized on ".$options['a']; |
| 62 | 62 | echo "\n\n"; |
| 63 | - } |
|
| 64 | - else { |
|
| 63 | + } else { |
|
| 65 | 64 | echo "\n\n"; |
| 66 | 65 | echo Bash::setBackground(" ", 'red'); |
| 67 | 66 | echo Bash::setBackground(" [WARNING] A web server is not used ", 'red'); |
@@ -50,8 +50,7 @@ discard block |
||
| 50 | 50 | /** |
| 51 | 51 | * option -p [portail] |
| 52 | 52 | */ |
| 53 | - if (isset($aOptions['p'])) { $sPortal = $aOptions['p']; } |
|
| 54 | - else { $sPortal = 'Batch'; } |
|
| 53 | + if (isset($aOptions['p'])) { $sPortal = $aOptions['p']; } else { $sPortal = 'Batch'; } |
|
| 55 | 54 | |
| 56 | 55 | if (!preg_match('/^[a-zA-Z0-9]+$/', $sPortal)) { |
| 57 | 56 | |
@@ -67,16 +66,14 @@ discard block |
||
| 67 | 66 | |
| 68 | 67 | echo 'The batch can`t create public folders for '.$sPortal.'! Please check the rights.'; |
| 69 | 68 | throw new \Exception('The batch can`t create public folders for '.$sPortal.'! Please check the rights.'); |
| 70 | - } |
|
| 71 | - else { |
|
| 69 | + } else { |
|
| 72 | 70 | |
| 73 | 71 | if (!file_exists($sPrivatePath.'Controller')) { |
| 74 | 72 | |
| 75 | 73 | mkdir($sPublicPath . 'css', 0777, true); |
| 76 | 74 | mkdir($sPublicPath . 'js', 0777, true); |
| 77 | 75 | mkdir($sPublicPath . 'img', 0777, true); |
| 78 | - } |
|
| 79 | - else { |
|
| 76 | + } else { |
|
| 80 | 77 | |
| 81 | 78 | echo 'The Project (public part) ' . $sPrivatePath . " exists\n"; |
| 82 | 79 | } |
@@ -86,8 +83,7 @@ discard block |
||
| 86 | 83 | |
| 87 | 84 | echo 'The batch can`t create private folders for '.$sPortal.'! Please check the rights.'; |
| 88 | 85 | throw new \Exception('The batch can`t create private folders for '.$sPortal.'! Please check the rights.'); |
| 89 | - } |
|
| 90 | - else { |
|
| 86 | + } else { |
|
| 91 | 87 | |
| 92 | 88 | if (!file_exists($sPrivatePath.'Controller')) { |
| 93 | 89 | |
@@ -97,8 +93,7 @@ discard block |
||
| 97 | 93 | mkdir($sPrivatePath . 'View', 0777, true); |
| 98 | 94 | mkdir($sPrivatePath . 'conf', 0777, true); |
| 99 | 95 | mkdir($sPrivatePath . 'common', 0777, true); |
| 100 | - } |
|
| 101 | - else { |
|
| 96 | + } else { |
|
| 102 | 97 | |
| 103 | 98 | echo 'The Project (private part) ' . $sPrivatePath . " exists\n"; |
| 104 | 99 | } |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | |
| 49 | 49 | require $sFileClassName; |
| 50 | 50 | } |
| 51 | - } |
|
| 52 | - else { |
|
| 51 | + } else { |
|
| 53 | 52 | |
| 54 | 53 | if (strstr($sFileName, 'Venus\\') && file_exists(preg_replace('#^(src/[a-zA-Z0-9_]+/)#', '$1app/', str_replace(['\\', '/'], '/', str_replace('conf', '', __DIR__).str_replace('Venus\\', '', $sFileName))))) { |
| 55 | 54 | |