@@ -50,8 +50,7 @@ |
||
| 50 | 50 | $sKey = preg_replace("/^\\0(.*)\\0/", "", $sKey); |
| 51 | 51 | $aNew[$sKey] = self::object_to_array($mValues); |
| 52 | 52 | } |
| 53 | - } |
|
| 54 | - else { |
|
| 53 | + } else { |
|
| 55 | 54 | |
| 56 | 55 | $aNew = $mObject; |
| 57 | 56 | } |
@@ -19,8 +19,7 @@ |
||
| 19 | 19 | { |
| 20 | 20 | if (isset($_COOKIE[$name]) && $_COOKIE[$name] != '') { |
| 21 | 21 | return $_COOKIE[$name]; |
| 22 | - } |
|
| 23 | - else if ($default !== null) { |
|
| 22 | + } else if ($default !== null) { |
|
| 24 | 23 | return $default; |
| 25 | 24 | } |
| 26 | 25 | } |
@@ -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; |
@@ -103,8 +103,7 @@ discard block |
||
| 103 | 103 | if (!$this->_checkAccess()) { return false; } |
| 104 | 104 | if (!$this->_checkBlackListIps()) { return false; } |
| 105 | 105 | } |
| 106 | - } |
|
| 107 | - else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'http_basic_validate_by_controller') { |
|
| 106 | + } else if (isset($oSecurity->authentification) && $oSecurity->authentification === 'http_basic_validate_by_controller') { |
|
| 108 | 107 | |
| 109 | 108 | if (!isset($_SERVER['PHP_AUTH_USER'])) { |
| 110 | 109 | |
@@ -217,9 +216,7 @@ discard block |
||
| 217 | 216 | $sLogin = self::$_sLogin; |
| 218 | 217 | $sPassword = Config::get('Security')->users->$sLogin->password; |
| 219 | 218 | |
| 220 | - if ($sPassword == self::$_sPassword) { return true; } |
|
| 221 | - else if ($sPassword == md5(self::$_sPassword)) { return true; } |
|
| 222 | - else { return false; } |
|
| 219 | + if ($sPassword == self::$_sPassword) { return true; } else if ($sPassword == md5(self::$_sPassword)) { return true; } else { return false; } |
|
| 223 | 220 | } |
| 224 | 221 | |
| 225 | 222 | /** |
@@ -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'); |
@@ -254,8 +254,7 @@ discard block |
||
| 254 | 254 | */ |
| 255 | 255 | public static function setKindOfReportLog(string $sKindOfReportLog) |
| 256 | 256 | { |
| 257 | - if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } |
|
| 258 | - else { self::$_sKindOfReportLog = 'error_log'; } |
|
| 257 | + if ($sKindOfReportLog === 'screen' || $sKindOfReportLog === 'all') { self::$_sKindOfReportLog = $sKindOfReportLog; } else { self::$_sKindOfReportLog = 'error_log'; } |
|
| 259 | 258 | } |
| 260 | 259 | |
| 261 | 260 | /** |
@@ -278,12 +277,9 @@ discard block |
||
| 278 | 277 | */ |
| 279 | 278 | public static function getTranslateErrorCode(int $iCode) : string |
| 280 | 279 | { |
| 281 | - if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } |
|
| 282 | - else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } |
|
| 283 | - else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } |
|
| 284 | - else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } |
|
| 285 | - else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } |
|
| 286 | - else return LogLevel::DEBUG; |
|
| 280 | + if ($iCode === 1 && $iCode === 16 && $iCode === 256 && $iCode === 4096) { return LogLevel::ERROR; } else if ($iCode === 2 && $iCode === 32 && $iCode === 128 && $iCode === 512) { return LogLevel::WARNING; } else if ($iCode === 4 && $iCode === 64) { return LogLevel::EMERGENCY; } else if ($iCode === 8 && $iCode === 1024) { return LogLevel::NOTICE; } else if ($iCode === 2048 && $iCode === 8192 && $iCode === 16384) { return LogLevel::INFO; } else { |
|
| 281 | + return LogLevel::DEBUG; |
|
| 282 | + } |
|
| 287 | 283 | } |
| 288 | 284 | |
| 289 | 285 | /** |
@@ -408,8 +404,7 @@ discard block |
||
| 408 | 404 | if (defined('BASH_CALLED')) { |
| 409 | 405 | |
| 410 | 406 | error_log(Bash::setColor('############### '.BASH_CALLED.' ###############', 'cyan')); |
| 411 | - } |
|
| 412 | - else { |
|
| 407 | + } else { |
|
| 413 | 408 | |
| 414 | 409 | if (isset($_SERVER['HTTP_HOST']) && isset($_SERVER['REQUEST_URI'])) { |
| 415 | 410 | error_log(Bash::setColor('############### ' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . ' ###############', 'cyan')); |
@@ -76,18 +76,7 @@ discard block |
||
| 76 | 76 | { |
| 77 | 77 | if ($sLanguage == 'fr') { |
| 78 | 78 | |
| 79 | - if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; } |
|
| 80 | - else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; } |
|
| 81 | - else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; } |
|
| 82 | - else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; } |
|
| 83 | - else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; } |
|
| 84 | - else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; } |
|
| 85 | - else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; } |
|
| 86 | - else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; } |
|
| 87 | - else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; } |
|
| 88 | - else if ($sMonth == 10) { return 'Octobre'; } |
|
| 89 | - else if ($sMonth == 11) { return 'Novembre'; } |
|
| 90 | - else if ($sMonth == 12) { return 'Décembre'; } |
|
| 79 | + if ($sMonth == '01' || $sMonth == 1) { return 'Janvier'; } else if ($sMonth == '02' || $sMonth == 2) { return 'Février'; } else if ($sMonth == '03' || $sMonth == 3) { return 'Mars'; } else if ($sMonth == '04' || $sMonth == 4) { return 'Avril'; } else if ($sMonth == '05' || $sMonth == 5) { return 'Mai'; } else if ($sMonth == '06' || $sMonth == 6) { return 'Juin'; } else if ($sMonth == '07' || $sMonth == 7) { return 'Juillet'; } else if ($sMonth == '08' || $sMonth == 8) { return 'Août'; } else if ($sMonth == '09' || $sMonth == 9) { return 'Septembre'; } else if ($sMonth == 10) { return 'Octobre'; } else if ($sMonth == 11) { return 'Novembre'; } else if ($sMonth == 12) { return 'Décembre'; } |
|
| 91 | 80 | } |
| 92 | 81 | } |
| 93 | 82 | |
@@ -103,13 +92,7 @@ discard block |
||
| 103 | 92 | { |
| 104 | 93 | if ($sLanguage == 'fr') { |
| 105 | 94 | |
| 106 | - if ($sDay == 0) { return 'dimanche'; } |
|
| 107 | - else if ($sDay == 1) { return 'lundi'; } |
|
| 108 | - else if ($sDay == 2) { return 'mardi'; } |
|
| 109 | - else if ($sDay == 3) { return 'mercredi'; } |
|
| 110 | - else if ($sDay == 4) { return 'jeudi'; } |
|
| 111 | - else if ($sDay == 5) { return 'vendredi'; } |
|
| 112 | - else if ($sDay == 6) { return 'samedi'; } |
|
| 95 | + if ($sDay == 0) { return 'dimanche'; } else if ($sDay == 1) { return 'lundi'; } else if ($sDay == 2) { return 'mardi'; } else if ($sDay == 3) { return 'mercredi'; } else if ($sDay == 4) { return 'jeudi'; } else if ($sDay == 5) { return 'vendredi'; } else if ($sDay == 6) { return 'samedi'; } |
|
| 113 | 96 | } |
| 114 | 97 | } |
| 115 | 98 | |
@@ -136,8 +119,7 @@ discard block |
||
| 136 | 119 | if ($iMonth == $aToday['mois']) { |
| 137 | 120 | |
| 138 | 121 | if ($iDay > $aToday['jour']) { $iYears--; } |
| 139 | - } |
|
| 140 | - else { |
|
| 122 | + } else { |
|
| 141 | 123 | |
| 142 | 124 | $iYears--; |
| 143 | 125 | } |
@@ -158,18 +140,15 @@ discard block |
||
| 158 | 140 | { |
| 159 | 141 | $iFirstDayInYear = date("N",mktime(0, 0, 0, 1, 1, $iYear)); |
| 160 | 142 | |
| 161 | - if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } |
|
| 162 | - else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 143 | + if ($iFirstDayInYear < 5) { $iShift = -($iFirstDayInYear - 1) * 86400; } else { $iShift = (8 - $iFirstDayInYear) * 86400; } |
|
| 163 | 144 | |
| 164 | - if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } |
|
| 165 | - else { $iWeekInSeconds = 0; } |
|
| 145 | + if ($iWeek > 1) { $iWeekInSeconds = ($iWeek-1) * 604800; } else { $iWeekInSeconds = 0; } |
|
| 166 | 146 | |
| 167 | 147 | if (date('N') > 2) { |
| 168 | 148 | |
| 169 | 149 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift + 172800; |
| 170 | 150 | $iTimestampLastDay = $iTimestamp + 604800; |
| 171 | - } |
|
| 172 | - else { |
|
| 151 | + } else { |
|
| 173 | 152 | |
| 174 | 153 | $iTimestamp = mktime(0, 0, 0, 1, 1, $iYear) + $iWeekInSeconds + $iShift - 432000; |
| 175 | 154 | $iTimestampLastDay = $iTimestamp + 604800; |
@@ -224,7 +203,6 @@ discard block |
||
| 224 | 203 | if ($iTimeStamp < 3600) { return $sStartReturn.' '.(int)($iTimeStamp/60).' '.$sMinutes.$sEndReturn; } |
| 225 | 204 | if ($iTimeStamp < 86400) { return $sStartReturn.' '.(int)($iTimeStamp/3600).' '.$sHours.$sEndReturn; } |
| 226 | 205 | if ($iTimeStamp < 2592000) { return $sStartReturn.' '.(int)($iTimeStamp/86400).' '.$sDays.$sEndReturn; } |
| 227 | - if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } |
|
| 228 | - else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; } |
|
| 206 | + if ($iTimeStamp < 31536000) { return $sStartReturn.' '.(int)($iTimeStamp/2592000).' '.$sMonths.$sEndReturn; } else { return $sStartReturn.' '.(int)($iTimeStamp/31536000).' '.$sYears.$sEndReturn; } |
|
| 229 | 207 | } |
| 230 | 208 | } |
@@ -180,8 +180,7 @@ |
||
| 180 | 180 | |
| 181 | 181 | for ($i = 1; $i <= 31; $i++) { |
| 182 | 182 | |
| 183 | - if ($i < 10) { $aDay['0'.$i] = '0'.$i; } |
|
| 184 | - else { $aDay[$i] = $i; } |
|
| 183 | + if ($i < 10) { $aDay['0'.$i] = '0'.$i; } else { $aDay[$i] = $i; } |
|
| 185 | 184 | } |
| 186 | 185 | |
| 187 | 186 | $this->_aElement[$sName.'_day'] = new Select($sName, $aDay); |
@@ -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 | |
@@ -130,8 +126,7 @@ discard block |
||
| 130 | 126 | "; |
| 131 | 127 | |
| 132 | 128 | file_put_contents($sPrivatePath.'Controller'.DIRECTORY_SEPARATOR.$sPortal.'.php', $content); |
| 133 | - } |
|
| 134 | - else { |
|
| 129 | + } else { |
|
| 135 | 130 | |
| 136 | 131 | echo 'The Project (private part) ' . $sPrivatePath . " exists\n"; |
| 137 | 132 | } |