@@ -150,8 +150,7 @@ |
||
150 | 150 | foreach ($emails as $name => $email) { |
151 | 151 | if(is_numeric($name)){ |
152 | 152 | $this->setTo($email); |
153 | - } |
|
154 | - else{ |
|
153 | + } else{ |
|
155 | 154 | $this->setTo($email, $name); |
156 | 155 | } |
157 | 156 | } |
@@ -93,8 +93,7 @@ |
||
93 | 93 | $logger->info('Delete cookie item ['.$item.']'); |
94 | 94 | unset($_COOKIE[$item]); |
95 | 95 | return true; |
96 | - } |
|
97 | - else{ |
|
96 | + } else{ |
|
98 | 97 | $logger->warning('Cookie item ['.$item.'] to be deleted does not exists'); |
99 | 98 | return false; |
100 | 99 | } |
@@ -487,8 +487,7 @@ discard block |
||
487 | 487 | } |
488 | 488 | chdir($destination_directory); |
489 | 489 | } |
490 | - } |
|
491 | - else{ |
|
490 | + } else{ |
|
492 | 491 | $this->logger->warning('Can not create the upload directory [' .$destination_directory. ']'); |
493 | 492 | } |
494 | 493 | } |
@@ -640,8 +639,7 @@ discard block |
||
640 | 639 | // set original filename if not have a new name |
641 | 640 | if (empty($this->filename)) { |
642 | 641 | $this->filename = $this->file_array[$this->input]['name']; |
643 | - } |
|
644 | - else{ |
|
642 | + } else{ |
|
645 | 643 | // Replace %s for extension in filename |
646 | 644 | // Before: /[\w\d]*(.[\d\w]+)$/i |
647 | 645 | // After: /^[\s[:alnum:]\-\_\.]*\.([\d\w]+)$/iu |
@@ -223,8 +223,7 @@ discard block |
||
223 | 223 | if(! Security::validateCSRF()){ |
224 | 224 | show_error('Invalide data, Cross Site Request Forgery do his job, the data to validate is corrupted.'); |
225 | 225 | } |
226 | - } |
|
227 | - else{ |
|
226 | + } else{ |
|
228 | 227 | $this->logger->info('CSRF is not enabled in configuration or not set manully, no need to check it'); |
229 | 228 | } |
230 | 229 | } |
@@ -234,8 +233,7 @@ discard block |
||
234 | 233 | foreach ($this->getData() as $inputName => $inputVal) { |
235 | 234 | if(is_array($this->data[$inputName])){ |
236 | 235 | $this->data[$inputName] = array_map('trim', $this->data[$inputName]); |
237 | - } |
|
238 | - else{ |
|
236 | + } else{ |
|
239 | 237 | $this->data[$inputName] = trim($this->data[$inputName]); |
240 | 238 | } |
241 | 239 | |
@@ -604,8 +602,7 @@ discard block |
||
604 | 602 | if ($inputVal == '' && $callbackReturn == true) { |
605 | 603 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
606 | 604 | } |
607 | - } |
|
608 | - else if($inputVal == '') { |
|
605 | + } else if($inputVal == '') { |
|
609 | 606 | $this->_setError($inputName, $ruleName, $this->_getLabel($inputName)); |
610 | 607 | } |
611 | 608 | } |
@@ -664,8 +661,7 @@ discard block |
||
664 | 661 | $this->_setError($inputName, $ruleName . ',post:key', array($this->_getLabel($inputName), $this->_getLabel(str_replace('post:', '', $doNotEqual)))); |
665 | 662 | continue; |
666 | 663 | } |
667 | - } |
|
668 | - else{ |
|
664 | + } else{ |
|
669 | 665 | if ($inputVal == $doNotEqual) { |
670 | 666 | $this->_setError($inputName, $ruleName . ',string', array($this->_getLabel($inputName), $doNotEqual)); |
671 | 667 | continue; |
@@ -222,8 +222,7 @@ |
||
222 | 222 | } |
223 | 223 | $str .= '</tr>'; |
224 | 224 | $str .= '</thead>'; |
225 | - } |
|
226 | - else{ |
|
225 | + } else{ |
|
227 | 226 | //no need check for footer |
228 | 227 | $use_footer = false; |
229 | 228 | } |
@@ -41,8 +41,7 @@ discard block |
||
41 | 41 | require_once CONFIG_PATH . 'config_pagination.php'; |
42 | 42 | if(empty($config) || ! is_array($config)){ |
43 | 43 | show_error('No configuration found in ' . CONFIG_PATH . 'config_pagination.php'); |
44 | - } |
|
45 | - else{ |
|
44 | + } else{ |
|
46 | 45 | if(! empty($overwriteConfig)){ |
47 | 46 | $config = array_merge($config, $overwriteConfig); |
48 | 47 | } |
@@ -50,8 +49,7 @@ discard block |
||
50 | 49 | Config::setAll($config); |
51 | 50 | unset($config); |
52 | 51 | } |
53 | - } |
|
54 | - else{ |
|
52 | + } else{ |
|
55 | 53 | show_error('Unable to find the pagination configuration file'); |
56 | 54 | } |
57 | 55 | } |
@@ -83,18 +81,15 @@ discard block |
||
83 | 81 | $currentUrl = Url::current(); |
84 | 82 | if($queryString == ''){ |
85 | 83 | $query = '?' . $pageQueryName . '='; |
86 | - } |
|
87 | - else{ |
|
84 | + } else{ |
|
88 | 85 | $tab = explode($pageQueryName . '=', $queryString); |
89 | 86 | $nb = count($tab); |
90 | 87 | if($nb == 1){ |
91 | 88 | $query = '?' . $queryString . '&' . $pageQueryName . '='; |
92 | - } |
|
93 | - else{ |
|
89 | + } else{ |
|
94 | 90 | if($tab[0] == ''){ |
95 | 91 | $query = '?' . $pageQueryName . '='; |
96 | - } |
|
97 | - else{ |
|
92 | + } else{ |
|
98 | 93 | $query = '?' . $tab[0] . '' . $pageQueryName . '='; |
99 | 94 | } |
100 | 95 | } |
@@ -113,20 +108,17 @@ discard block |
||
113 | 108 | if($numberOfLink % 2 == 0){ |
114 | 109 | $start = $currentPageNumber - ($numberOfLink / 2) + 1; |
115 | 110 | $end = $currentPageNumber + ($numberOfLink / 2); |
116 | - } |
|
117 | - else{ |
|
111 | + } else{ |
|
118 | 112 | $start = $currentPageNumber - floor($numberOfLink / 2); |
119 | 113 | $end = $currentPageNumber + floor($numberOfLink / 2); |
120 | 114 | } |
121 | 115 | if($start <= 1){ |
122 | 116 | $begin = 1; |
123 | 117 | $end = $numberOfLink; |
124 | - } |
|
125 | - else if($start > 1 && $end < $numberOfPage){ |
|
118 | + } else if($start > 1 && $end < $numberOfPage){ |
|
126 | 119 | $begin = $start; |
127 | 120 | $end = $end; |
128 | - } |
|
129 | - else{ |
|
121 | + } else{ |
|
130 | 122 | $begin = ($numberOfPage - $numberOfLink) + 1; |
131 | 123 | $end = $numberOfPage; |
132 | 124 | } |
@@ -138,32 +130,27 @@ discard block |
||
138 | 130 | for($i = $begin; $i <= $end; $i++){ |
139 | 131 | if($i == $currentPageNumber){ |
140 | 132 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
141 | - } |
|
142 | - else{ |
|
133 | + } else{ |
|
143 | 134 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '" ' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close']; |
144 | 135 | } |
145 | 136 | } |
146 | 137 | $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
147 | - } |
|
148 | - else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){ |
|
138 | + } else if($currentPageNumber > 1 && $currentPageNumber < $numberOfPage){ |
|
149 | 139 | $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close']; |
150 | 140 | for($i = $begin; $i <= $end; $i++){ |
151 | 141 | if($i == $currentPageNumber){ |
152 | 142 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
153 | - } |
|
154 | - else{ |
|
143 | + } else{ |
|
155 | 144 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i .'</a>' . $this->config['digit_close']; |
156 | 145 | } |
157 | 146 | } |
158 | 147 | $navbar .= $this->config['next_open']."<a href='$query".($currentPageNumber + 1)."'>".$this->config['next_text']."</a>".$this->config['next_close']; |
159 | - } |
|
160 | - else if($currentPageNumber == $numberOfPage){ |
|
148 | + } else if($currentPageNumber == $numberOfPage){ |
|
161 | 149 | $navbar .= $this->config['previous_open'] . '<a href="' . $query . ($currentPageNumber - 1) . '">' . $this->config['previous_text'] . '</a>' . $this->config['previous_close']; |
162 | 150 | for($i = $begin; $i <= $end; $i++){ |
163 | 151 | if($i == $currentPageNumber){ |
164 | 152 | $navbar .= $this->config['active_link_open'] . $currentPageNumber . $this->config['active_link_close']; |
165 | - } |
|
166 | - else{ |
|
153 | + } else{ |
|
167 | 154 | $navbar .= $this->config['digit_open'] . '<a href="' . $query . $i . '"' . attributes_to_string($this->config['attributes']) . '>' . $i . '</a>' . $this->config['digit_close']; |
168 | 155 | } |
169 | 156 | } |
@@ -921,20 +921,15 @@ |
||
921 | 921 | if(preg_match('#trident/([0-9\.]+);#i', $this->_agent, $aresult)){ |
922 | 922 | if($aresult[1] == '3.1'){ |
923 | 923 | $this->setVersion('7.0'); |
924 | - } |
|
925 | - else if($aresult[1] == '4.0'){ |
|
924 | + } else if($aresult[1] == '4.0'){ |
|
926 | 925 | $this->setVersion('8.0'); |
927 | - } |
|
928 | - else if($aresult[1] == '5.0'){ |
|
926 | + } else if($aresult[1] == '5.0'){ |
|
929 | 927 | $this->setVersion('9.0'); |
930 | - } |
|
931 | - else if($aresult[1] == '6.0'){ |
|
928 | + } else if($aresult[1] == '6.0'){ |
|
932 | 929 | $this->setVersion('10.0'); |
933 | - } |
|
934 | - else if($aresult[1] == '7.0'){ |
|
930 | + } else if($aresult[1] == '7.0'){ |
|
935 | 931 | $this->setVersion('11.0'); |
936 | - } |
|
937 | - else if($aresult[1] == '8.0'){ |
|
932 | + } else if($aresult[1] == '8.0'){ |
|
938 | 933 | $this->setVersion('11.0'); |
939 | 934 | } |
940 | 935 | } |
@@ -55,17 +55,13 @@ |
||
55 | 55 | |
56 | 56 | if (isset($_SERVER["HTTP_CLIENT_IP"])) { |
57 | 57 | $ip = $_SERVER["HTTP_CLIENT_IP"]; |
58 | - } |
|
59 | - else if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { |
|
58 | + } else if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) { |
|
60 | 59 | $ip = $_SERVER["HTTP_X_FORWARDED_FOR"]; |
61 | - } |
|
62 | - else if (isset($_SERVER["HTTP_X_FORWARDED"])) { |
|
60 | + } else if (isset($_SERVER["HTTP_X_FORWARDED"])) { |
|
63 | 61 | $ip = $_SERVER["HTTP_X_FORWARDED"]; |
64 | - } |
|
65 | - else if (isset($_SERVER["HTTP_FORWARDED_FOR"])) { |
|
62 | + } else if (isset($_SERVER["HTTP_FORWARDED_FOR"])) { |
|
66 | 63 | $ip = $_SERVER["HTTP_FORWARDED_FOR"]; |
67 | - } |
|
68 | - else if (isset($_SERVER["HTTP_FORWARDED"])) { |
|
64 | + } else if (isset($_SERVER["HTTP_FORWARDED"])) { |
|
69 | 65 | $ip = $_SERVER["HTTP_FORWARDED"]; |
70 | 66 | } |
71 | 67 |
@@ -224,16 +224,14 @@ discard block |
||
224 | 224 | ); |
225 | 225 | if(isset($http_status[$code])){ |
226 | 226 | $text = $http_status[$code]; |
227 | - } |
|
228 | - else{ |
|
227 | + } else{ |
|
229 | 228 | show_error('No HTTP status text found for your code please check it.'); |
230 | 229 | } |
231 | 230 | } |
232 | 231 | |
233 | 232 | if(strpos(php_sapi_name(), 'cgi') === 0){ |
234 | 233 | header('Status: ' . $code . ' ' . $text, TRUE); |
235 | - } |
|
236 | - else{ |
|
234 | + } else{ |
|
237 | 235 | $proto = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'; |
238 | 236 | header($proto . ' ' . $code . ' ' . $text, TRUE, $code); |
239 | 237 | } |
@@ -271,11 +269,9 @@ discard block |
||
271 | 269 | */ |
272 | 270 | if(isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off'){ |
273 | 271 | return true; |
274 | - } |
|
275 | - else if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ |
|
272 | + } else if(isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https'){ |
|
276 | 273 | return true; |
277 | - } |
|
278 | - else if(isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){ |
|
274 | + } else if(isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off'){ |
|
279 | 275 | return true; |
280 | 276 | } |
281 | 277 | return false; |
@@ -313,8 +309,7 @@ discard block |
||
313 | 309 | function php_exception_handler($ex){ |
314 | 310 | if (str_ireplace(array('off', 'none', 'no', 'false', 'null'), '', ini_get('display_errors'))){ |
315 | 311 | show_error('An exception is occured in file '. $ex->getFile() .' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception #' . $ex->getCode()); |
316 | - } |
|
317 | - else{ |
|
312 | + } else{ |
|
318 | 313 | save_to_log('error', 'An exception is occured in file ' . $ex->getFile() . ' at line ' . $ex->getLine() . ' raison : ' . $ex->getMessage(), 'PHP Exception'); |
319 | 314 | } |
320 | 315 | exit(1); |
@@ -431,15 +426,13 @@ discard block |
||
431 | 426 | function clean_input($str){ |
432 | 427 | if(is_array($str)){ |
433 | 428 | $str = array_map('clean_input', $str); |
434 | - } |
|
435 | - else if(is_object($str)){ |
|
429 | + } else if(is_object($str)){ |
|
436 | 430 | $obj = $str; |
437 | 431 | foreach ($str as $var => $value) { |
438 | 432 | $obj->$var = clean_input($value); |
439 | 433 | } |
440 | 434 | $str = $obj; |
441 | - } |
|
442 | - else{ |
|
435 | + } else{ |
|
443 | 436 | $str = htmlspecialchars(strip_tags($str), ENT_QUOTES, 'UTF-8'); |
444 | 437 | } |
445 | 438 | return $str; |
@@ -510,8 +503,7 @@ discard block |
||
510 | 503 | session_save_path($sessionSavePath); |
511 | 504 | $logger->info('Session save path: ' . $sessionSavePath); |
512 | 505 | } |
513 | - } |
|
514 | - else if($sessionHandler == 'database'){ |
|
506 | + } else if($sessionHandler == 'database'){ |
|
515 | 507 | //load database session handle library |
516 | 508 | //Model |
517 | 509 | require_once CORE_CLASSES_MODEL_PATH . 'Model.php'; |
@@ -522,8 +514,7 @@ discard block |
||
522 | 514 | $DBS =& class_loader('DBSessionHandler', 'classes'); |
523 | 515 | session_set_save_handler($DBS, true); |
524 | 516 | $logger->info('session save path: ' . get_config('session_save_path')); |
525 | - } |
|
526 | - else{ |
|
517 | + } else{ |
|
527 | 518 | show_error('Invalid session handler configuration'); |
528 | 519 | } |
529 | 520 | $lifetime = get_config('session_cookie_lifetime', 0); |