@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | (peut être génant sur un nom de variable dans le cas par exemple de $_POST['coucou'] ou $_POST['cou_cou'] pour l'exemple au-dessus) |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | - if(is_array($string)) //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST) |
|
| 37 | + if (is_array($string)) //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST) |
|
| 38 | 38 | { |
| 39 | - foreach($string as $key => $val) |
|
| 39 | + foreach ($string as $key => $val) |
|
| 40 | 40 | { |
| 41 | 41 | //Dans le cas où après si $key est modifié, alors la valeur pour |
| 42 | 42 | //la clé non sécurisé existerais toujours et la sécurisation |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | // On regarde si le type de string est un nombre entier (int) |
| 57 | - if(ctype_digit($string)) |
|
| 57 | + if (ctype_digit($string)) |
|
| 58 | 58 | { |
| 59 | 59 | $string = intval($string); |
| 60 | 60 | return $string; |
@@ -67,17 +67,17 @@ discard block |
||
| 67 | 67 | //commenté car problème de notice si php < 5.4 |
| 68 | 68 | //if(defined(ENT_HTML401)) {$optHtmlentities .= ' | '.ENT_HTML401;} //à partir de php5.4 |
| 69 | 69 | |
| 70 | - if($html === false) |
|
| 70 | + if ($html === false) |
|
| 71 | 71 | { |
| 72 | 72 | $string = htmlentities($string, $optHtmlentities, 'UTF-8'); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(function_exists('DB_protect')) |
|
| 75 | + if (function_exists('DB_protect')) |
|
| 76 | 76 | { |
| 77 | 77 | $string = DB_protect($string); |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | - if($null_cslashe === false) |
|
| 80 | + if ($null_cslashe === false) |
|
| 81 | 81 | { |
| 82 | 82 | $string = addcslashes($string, '%_'); |
| 83 | 83 | } |
@@ -131,14 +131,14 @@ discard block |
||
| 131 | 131 | */ |
| 132 | 132 | function post($key, $default = null, $html = false) |
| 133 | 133 | { |
| 134 | - if(!isset($_POST[$key])) |
|
| 134 | + if (!isset($_POST[$key])) |
|
| 135 | 135 | { |
| 136 | 136 | return $default; |
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | $post = $_POST[$key]; |
| 140 | 140 | |
| 141 | - if(is_string($post)) |
|
| 141 | + if (is_string($post)) |
|
| 142 | 142 | { |
| 143 | 143 | $post = trim($post); |
| 144 | 144 | } |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | function get($key, $default = null) |
| 158 | 158 | { |
| 159 | - if(!isset($_GET[$key])) |
|
| 159 | + if (!isset($_GET[$key])) |
|
| 160 | 160 | { |
| 161 | 161 | return $default; |
| 162 | 162 | } |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function ErrorView($num, $cleanCache = true) |
| 186 | 186 | { |
| 187 | - if($cleanCache) |
|
| 187 | + if ($cleanCache) |
|
| 188 | 188 | { |
| 189 | 189 | ob_clean(); //On efface tout ce qui a pu être mis dans le buffer pour l'affichage |
| 190 | 190 | } |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | global $request, $path; |
| 193 | 193 | |
| 194 | 194 | //Envoi du status http |
| 195 | - if(function_exists('http_response_code')) //php >= 5.4 |
|
| 195 | + if (function_exists('http_response_code')) //php >= 5.4 |
|
| 196 | 196 | { |
| 197 | 197 | http_response_code($num); |
| 198 | 198 | } |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | header(':', true, $num); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - if(file_exists(path_controllers.'erreurs/'.$num.'.php')) |
|
| 204 | + if (file_exists(path_controllers.'erreurs/'.$num.'.php')) |
|
| 205 | 205 | { |
| 206 | 206 | require_once(path_controllers.'erreurs/'.$num.'.php'); |
| 207 | 207 | } |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | */ |
| 228 | 228 | function logfile($file, $txt, $date = true) |
| 229 | 229 | { |
| 230 | - if($date === true) |
|
| 230 | + if ($date === true) |
|
| 231 | 231 | { |
| 232 | 232 | $date = new \BFW\Date(); |
| 233 | 233 | $dateTxt = $date->getJour() |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | { |
| 245 | 245 | file_put_contents($file, rtrim($txt)."\n", FILE_APPEND); |
| 246 | 246 | } |
| 247 | - catch(\Exception $e) |
|
| 247 | + catch (\Exception $e) |
|
| 248 | 248 | { |
| 249 | 249 | echo '<br/>Impossible d\'écrire dans le fichier : '.$file.'<br/>'; |
| 250 | 250 | } |
@@ -259,39 +259,39 @@ discard block |
||
| 259 | 259 | */ |
| 260 | 260 | function verifTypeData($vars) |
| 261 | 261 | { |
| 262 | - if(!is_array($vars)) |
|
| 262 | + if (!is_array($vars)) |
|
| 263 | 263 | { |
| 264 | 264 | return false; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | - foreach($vars as $var) |
|
| 267 | + foreach ($vars as $var) |
|
| 268 | 268 | { |
| 269 | - if(!is_array($var)) |
|
| 269 | + if (!is_array($var)) |
|
| 270 | 270 | { |
| 271 | 271 | return false; |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if(!(!empty($var['type']) && isset($var['data']))) |
|
| 274 | + if (!(!empty($var['type']) && isset($var['data']))) |
|
| 275 | 275 | { |
| 276 | 276 | return false; |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - if($var['type'] == 'int') |
|
| 279 | + if ($var['type'] == 'int') |
|
| 280 | 280 | { |
| 281 | 281 | $var['type'] = 'integer'; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - if($var['type'] == 'float') |
|
| 284 | + if ($var['type'] == 'float') |
|
| 285 | 285 | { |
| 286 | 286 | $var['type'] = 'double'; |
| 287 | 287 | } |
| 288 | 288 | |
| 289 | - if(!is_string($var['type'])) |
|
| 289 | + if (!is_string($var['type'])) |
|
| 290 | 290 | { |
| 291 | 291 | return false; |
| 292 | 292 | } |
| 293 | 293 | |
| 294 | - if(gettype($var['data']) != $var['type']) |
|
| 294 | + if (gettype($var['data']) != $var['type']) |
|
| 295 | 295 | { |
| 296 | 296 | return false; |
| 297 | 297 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | { |
| 310 | 310 | global $BFWKernel; |
| 311 | 311 | |
| 312 | - if(!(isset($BFWKernel) && is_object($BFWKernel) && get_class($BFWKernel) == 'BFW\Kernel')) |
|
| 312 | + if (!(isset($BFWKernel) && is_object($BFWKernel) && get_class($BFWKernel) == 'BFW\Kernel')) |
|
| 313 | 313 | { |
| 314 | 314 | $BFWKernel = new \BFW\Kernel; |
| 315 | 315 | } |
@@ -326,14 +326,14 @@ discard block |
||
| 326 | 326 | */ |
| 327 | 327 | function is_session_started() |
| 328 | 328 | { |
| 329 | - if(php_sapi_name() === 'cli') |
|
| 329 | + if (php_sapi_name() === 'cli') |
|
| 330 | 330 | { |
| 331 | 331 | return false; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(PHP_VERSION_ID >= 50400) //PHP >= 5.4.0 |
|
| 334 | + if (PHP_VERSION_ID >= 50400) //PHP >= 5.4.0 |
|
| 335 | 335 | { |
| 336 | - if(session_status() === PHP_SESSION_ACTIVE) |
|
| 336 | + if (session_status() === PHP_SESSION_ACTIVE) |
|
| 337 | 337 | { |
| 338 | 338 | return true; |
| 339 | 339 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | return false; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - if(session_id() !== '') |
|
| 344 | + if (session_id() !== '') |
|
| 345 | 345 | { |
| 346 | 346 | return true; |
| 347 | 347 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | */ |
| 44 | 44 | function displayMsg($msg, $colorTxt = null, $colorBg = null, $style = 'normal') |
| 45 | 45 | { |
| 46 | - if($colorTxt == null) |
|
| 46 | + if ($colorTxt == null) |
|
| 47 | 47 | { |
| 48 | 48 | echo $msg."\n"; |
| 49 | 49 | return; |
@@ -55,26 +55,26 @@ discard block |
||
| 55 | 55 | $colorEnd = ''; |
| 56 | 56 | |
| 57 | 57 | $styleNum = styleForShell($style); |
| 58 | - if($styleNum === false) |
|
| 58 | + if ($styleNum === false) |
|
| 59 | 59 | { |
| 60 | 60 | $styleNum = styleForShell('normal'); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $colorTxtNum = colorForShell('white', 'txt'); |
| 64 | - if($colorTxt !== null) |
|
| 64 | + if ($colorTxt !== null) |
|
| 65 | 65 | { |
| 66 | 66 | $colorTxtNumArg = colorForShell($colorTxt, 'txt'); |
| 67 | - if($colorTxtNumArg !== false) |
|
| 67 | + if ($colorTxtNumArg !== false) |
|
| 68 | 68 | { |
| 69 | 69 | $colorTxtNum = $colorTxtNumArg; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $colorBgNum = colorForShell('black', 'bg'); |
| 74 | - if($colorBg !== null) |
|
| 74 | + if ($colorBg !== null) |
|
| 75 | 75 | { |
| 76 | 76 | $colorBgNumArg = colorForShell($colorBg, 'bg'); |
| 77 | - if($colorBgNumArg !== false) |
|
| 77 | + if ($colorBgNumArg !== false) |
|
| 78 | 78 | { |
| 79 | 79 | $colorBgNum = $colorBgNumArg; |
| 80 | 80 | } |
@@ -94,72 +94,72 @@ discard block |
||
| 94 | 94 | function colorForShell($color, $type) |
| 95 | 95 | { |
| 96 | 96 | //Possibilité d'améliorer la compléxité du script via des boucles etc... |
| 97 | - if($type == 'txt') |
|
| 97 | + if ($type == 'txt') |
|
| 98 | 98 | { |
| 99 | - if($color == 'black') |
|
| 99 | + if ($color == 'black') |
|
| 100 | 100 | { |
| 101 | 101 | return 30; |
| 102 | 102 | } |
| 103 | - elseif($color == 'red') |
|
| 103 | + elseif ($color == 'red') |
|
| 104 | 104 | { |
| 105 | 105 | return 31; |
| 106 | 106 | } |
| 107 | - elseif($color == 'green') |
|
| 107 | + elseif ($color == 'green') |
|
| 108 | 108 | { |
| 109 | 109 | return 32; |
| 110 | 110 | } |
| 111 | - elseif($color == 'yellow') |
|
| 111 | + elseif ($color == 'yellow') |
|
| 112 | 112 | { |
| 113 | 113 | return 33; |
| 114 | 114 | } |
| 115 | - elseif($color == 'blue') |
|
| 115 | + elseif ($color == 'blue') |
|
| 116 | 116 | { |
| 117 | 117 | return 34; |
| 118 | 118 | } |
| 119 | - elseif($color == 'magenta') |
|
| 119 | + elseif ($color == 'magenta') |
|
| 120 | 120 | { |
| 121 | 121 | return 35; |
| 122 | 122 | } |
| 123 | - elseif($color == 'cyan') |
|
| 123 | + elseif ($color == 'cyan') |
|
| 124 | 124 | { |
| 125 | 125 | return 36; |
| 126 | 126 | } |
| 127 | - elseif($color == 'white') |
|
| 127 | + elseif ($color == 'white') |
|
| 128 | 128 | { |
| 129 | 129 | return 37; |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | - elseif($type == 'bg') |
|
| 132 | + elseif ($type == 'bg') |
|
| 133 | 133 | { |
| 134 | - if($color == 'black') |
|
| 134 | + if ($color == 'black') |
|
| 135 | 135 | { |
| 136 | 136 | return 40; |
| 137 | 137 | } |
| 138 | - elseif($color == 'red') |
|
| 138 | + elseif ($color == 'red') |
|
| 139 | 139 | { |
| 140 | 140 | return 41; |
| 141 | 141 | } |
| 142 | - elseif($color == 'green') |
|
| 142 | + elseif ($color == 'green') |
|
| 143 | 143 | { |
| 144 | 144 | return 42; |
| 145 | 145 | } |
| 146 | - elseif($color == 'yellow') |
|
| 146 | + elseif ($color == 'yellow') |
|
| 147 | 147 | { |
| 148 | 148 | return 43; |
| 149 | 149 | } |
| 150 | - elseif($color == 'blue') |
|
| 150 | + elseif ($color == 'blue') |
|
| 151 | 151 | { |
| 152 | 152 | return 44; |
| 153 | 153 | } |
| 154 | - elseif($color == 'magenta') |
|
| 154 | + elseif ($color == 'magenta') |
|
| 155 | 155 | { |
| 156 | 156 | return 45; |
| 157 | 157 | } |
| 158 | - elseif($color == 'cyan') |
|
| 158 | + elseif ($color == 'cyan') |
|
| 159 | 159 | { |
| 160 | 160 | return 46; |
| 161 | 161 | } |
| 162 | - elseif($color == 'white') |
|
| 162 | + elseif ($color == 'white') |
|
| 163 | 163 | { |
| 164 | 164 | return 47; |
| 165 | 165 | } |
@@ -173,39 +173,39 @@ discard block |
||
| 173 | 173 | */ |
| 174 | 174 | function styleForShell($style) |
| 175 | 175 | { |
| 176 | - if($style == 'normal') |
|
| 176 | + if ($style == 'normal') |
|
| 177 | 177 | { |
| 178 | 178 | return 0; |
| 179 | 179 | } |
| 180 | - elseif($style == 'bold') |
|
| 180 | + elseif ($style == 'bold') |
|
| 181 | 181 | { |
| 182 | 182 | return 1; |
| 183 | 183 | } |
| 184 | - elseif($style == 'not-bold') |
|
| 184 | + elseif ($style == 'not-bold') |
|
| 185 | 185 | { |
| 186 | 186 | return 21; |
| 187 | 187 | } |
| 188 | - elseif($style == 'underline') |
|
| 188 | + elseif ($style == 'underline') |
|
| 189 | 189 | { |
| 190 | 190 | return 4; |
| 191 | 191 | } |
| 192 | - elseif($style == 'not-underline') |
|
| 192 | + elseif ($style == 'not-underline') |
|
| 193 | 193 | { |
| 194 | 194 | return 24; |
| 195 | 195 | } |
| 196 | - elseif($style == 'blink') |
|
| 196 | + elseif ($style == 'blink') |
|
| 197 | 197 | { |
| 198 | 198 | return 5; |
| 199 | 199 | } |
| 200 | - elseif($style == 'not-blink') |
|
| 200 | + elseif ($style == 'not-blink') |
|
| 201 | 201 | { |
| 202 | 202 | return 25; |
| 203 | 203 | } |
| 204 | - elseif($style == 'reverse') |
|
| 204 | + elseif ($style == 'reverse') |
|
| 205 | 205 | { |
| 206 | 206 | return 7; |
| 207 | 207 | } |
| 208 | - elseif($style == 'not-reverse') |
|
| 208 | + elseif ($style == 'not-reverse') |
|
| 209 | 209 | { |
| 210 | 210 | return 27; |
| 211 | 211 | } |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | * @package bfw |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if(!isset($rootPath)) |
|
| 13 | +if (!isset($rootPath)) |
|
| 14 | 14 | { |
| 15 | - if(!isset($myVendorName)) |
|
| 15 | + if (!isset($myVendorName)) |
|
| 16 | 16 | { |
| 17 | 17 | $myVendorName = 'vendor'; |
| 18 | 18 | } |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | //Si multi-domain, recherche du domaine courant |
| 30 | 30 | $base_url_config = $base_url; |
| 31 | -if(is_array($base_url)) |
|
| 31 | +if (is_array($base_url)) |
|
| 32 | 32 | { |
| 33 | - foreach($base_url as $url) |
|
| 33 | + foreach ($base_url as $url) |
|
| 34 | 34 | { |
| 35 | - if(strpos($url, $_SERVER['SERVER_NAME']) !== false) |
|
| 35 | + if (strpos($url, $_SERVER['SERVER_NAME']) !== false) |
|
| 36 | 36 | { |
| 37 | 37 | $base_url = $url; |
| 38 | 38 | break; |
@@ -40,13 +40,13 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | //Si pas trouvé, on prend le premier domaine |
| 43 | - if(is_array($base_url)) |
|
| 43 | + if (is_array($base_url)) |
|
| 44 | 44 | { |
| 45 | 45 | $base_url = $base_url[0]; |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | -if(substr($base_url, -1) == '/') |
|
| 49 | +if (substr($base_url, -1) == '/') |
|
| 50 | 50 | { |
| 51 | 51 | $base_url = substr($base_url, 0, -1); |
| 52 | 52 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | $error = null; |
| 56 | 56 | $exBaseUrl = explode('/', $base_url); |
| 57 | 57 | |
| 58 | -if(count($exBaseUrl) > 3) |
|
| 58 | +if (count($exBaseUrl) > 3) |
|
| 59 | 59 | { |
| 60 | 60 | unset($exBaseUrl[0], $exBaseUrl[1], $exBaseUrl[2]); |
| 61 | 61 | $imBaseUrl = '/'.implode('/', $exBaseUrl); |
@@ -64,30 +64,30 @@ discard block |
||
| 64 | 64 | $request = substr($request, $lenBaseUrl); |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | -if(!($request == '/index.php' || $request == '/')) |
|
| 67 | +if (!($request == '/index.php' || $request == '/')) |
|
| 68 | 68 | { |
| 69 | 69 | $ext = null; |
| 70 | - if(strpos($request, '.') !== false) |
|
| 70 | + if (strpos($request, '.') !== false) |
|
| 71 | 71 | { |
| 72 | 72 | $ext = substr($request, (strrpos($request, '.') + 1)); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $file = $request; |
| 76 | 76 | |
| 77 | - if(substr($ext, 0, 3) != 'php' && !is_null($ext)) |
|
| 77 | + if (substr($ext, 0, 3) != 'php' && !is_null($ext)) |
|
| 78 | 78 | { |
| 79 | 79 | $pathFile = ''; |
| 80 | 80 | |
| 81 | - if(file_exists($rootPath.'web/'.$file)) //Un fichier mit dans /web |
|
| 81 | + if (file_exists($rootPath.'web/'.$file)) //Un fichier mit dans /web |
|
| 82 | 82 | { |
| 83 | 83 | $pathFile = $rootPath.'web'; |
| 84 | 84 | } |
| 85 | - elseif(strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules. |
|
| 85 | + elseif (strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules. |
|
| 86 | 86 | { |
| 87 | 87 | $modulePos = strpos($request, '/modules/') + 9; |
| 88 | 88 | $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos)); |
| 89 | 89 | |
| 90 | - if(!file_exists('modules/'.$moduleName.'/externe.php')) |
|
| 90 | + if (!file_exists('modules/'.$moduleName.'/externe.php')) |
|
| 91 | 91 | { |
| 92 | 92 | $error = 403; |
| 93 | 93 | } |
@@ -97,13 +97,13 @@ discard block |
||
| 97 | 97 | $error = 404; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(is_null($error)) |
|
| 100 | + if (is_null($error)) |
|
| 101 | 101 | { |
| 102 | - if($ext == 'css') |
|
| 102 | + if ($ext == 'css') |
|
| 103 | 103 | { |
| 104 | 104 | header('Content-type: text/css'); |
| 105 | 105 | } |
| 106 | - elseif($ext == 'js') |
|
| 106 | + elseif ($ext == 'js') |
|
| 107 | 107 | { |
| 108 | 108 | header('Content-type: text/javascript'); |
| 109 | 109 | } |
@@ -117,17 +117,17 @@ discard block |
||
| 117 | 117 | exit; |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | - elseif(substr($ext, 0, 3) == 'php' && !is_null($ext)) |
|
| 120 | + elseif (substr($ext, 0, 3) == 'php' && !is_null($ext)) |
|
| 121 | 121 | { |
| 122 | 122 | $modulePos = strpos($request, '/modules/') + 9; |
| 123 | 123 | $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos)); |
| 124 | 124 | |
| 125 | - if(file_exists($rootPath.'modules/'.$moduleName.'/externe.php')) |
|
| 125 | + if (file_exists($rootPath.'modules/'.$moduleName.'/externe.php')) |
|
| 126 | 126 | { |
| 127 | 127 | $afterModuleName = $modulePos + strlen($moduleName) + 1; |
| 128 | 128 | require_once('modules/'.$moduleName.'/externe.php'); |
| 129 | 129 | |
| 130 | - if(in_array($afterModuleName, $moduleExterneAuthorized)) |
|
| 130 | + if (in_array($afterModuleName, $moduleExterneAuthorized)) |
|
| 131 | 131 | { |
| 132 | 132 | require_once($rootPath.$request); |
| 133 | 133 | } |
@@ -146,25 +146,25 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | require_once(__DIR__.'/BFW_init.php'); |
| 148 | 148 | |
| 149 | -if(!is_null($error)) |
|
| 149 | +if (!is_null($error)) |
|
| 150 | 150 | { |
| 151 | 151 | Errorview($error, false); |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | -if(kernelModuleLoad_ctr_test == true) |
|
| 154 | +if (kernelModuleLoad_ctr_test == true) |
|
| 155 | 155 | { |
| 156 | - if(cliMode === true) |
|
| 156 | + if (cliMode === true) |
|
| 157 | 157 | { |
| 158 | 158 | $opt = getopt('f:'); |
| 159 | 159 | |
| 160 | - if(!isset($opt['f'])) |
|
| 160 | + if (!isset($opt['f'])) |
|
| 161 | 161 | { |
| 162 | 162 | echo 'Error: No file specified.'."\n"; |
| 163 | 163 | exit; |
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $file = $opt['f']; |
| 167 | - if(!file_exists(path.'cli/'.$file.'.php')) |
|
| 167 | + if (!file_exists(path.'cli/'.$file.'.php')) |
|
| 168 | 168 | { |
| 169 | 169 | echo 'File to execute not found.'."\n"; |
| 170 | 170 | exit; |
@@ -8,9 +8,9 @@ discard block |
||
| 8 | 8 | ob_start(); //Tamporisation du tampon de sortie html. Permet que le code html ne sorte qu'à la fin et non petit à petit (permet d'utiliser les fonctions changeant les headers ou cookie à n'importe quel moment par exemple) |
| 9 | 9 | |
| 10 | 10 | //Définition des chemins d'accès |
| 11 | -if(!isset($rootPath)) |
|
| 11 | +if (!isset($rootPath)) |
|
| 12 | 12 | { |
| 13 | - if(!isset($myVendorName)) |
|
| 13 | + if (!isset($myVendorName)) |
|
| 14 | 14 | { |
| 15 | 15 | $myVendorName = 'vendor'; |
| 16 | 16 | } |
@@ -19,30 +19,30 @@ discard block |
||
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | //Fichier de config |
| 22 | -if(!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false)) |
|
| 22 | +if (!isset($forceConfig) || (isset($forceConfig) && $forceConfig == false)) |
|
| 23 | 23 | { |
| 24 | 24 | require_once($rootPath.'configs/bfw_config.php'); |
| 25 | 25 | } |
| 26 | 26 | //Fichier de config |
| 27 | 27 | |
| 28 | -if((isset($noSession) && $noSession == false) || !isset($noSession)) |
|
| 28 | +if ((isset($noSession) && $noSession == false) || !isset($noSession)) |
|
| 29 | 29 | { |
| 30 | 30 | session_set_cookie_params(0); //permet de detruire le cookie de session si le navigateur quitte |
| 31 | 31 | session_start(); //Ouverture des sessions |
| 32 | 32 | } |
| 33 | 33 | |
| 34 | 34 | //Class Loader |
| 35 | -if(!isset($loader)) |
|
| 35 | +if (!isset($loader)) |
|
| 36 | 36 | { |
| 37 | 37 | $loader = require($rootPath.'vendor/autoload.php'); |
| 38 | 38 | $loaderAddPsr4 = 'addPsr4'; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | -if(!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace';} //Default of PSR4 library |
|
| 41 | +if (!isset($loaderAddPsr4)) {$loaderAddPsr4 = 'addNamespace'; } //Default of PSR4 library |
|
| 42 | 42 | |
| 43 | 43 | $loader->$loaderAddPsr4('controller\\', $rootPath.'controllers/'); |
| 44 | -$loader->$loaderAddPsr4('modules\\', $rootPath.'modules/'); |
|
| 45 | -$loader->$loaderAddPsr4('modeles\\', $rootPath.'modeles/'); |
|
| 44 | +$loader->$loaderAddPsr4('modules\\', $rootPath.'modules/'); |
|
| 45 | +$loader->$loaderAddPsr4('modeles\\', $rootPath.'modeles/'); |
|
| 46 | 46 | //Class Loader |
| 47 | 47 | |
| 48 | 48 | //Instancie la classe Kernel |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | $modulesToLoad = array(); |
| 62 | 62 | |
| 63 | 63 | //SQL |
| 64 | -if($bd_enabled) |
|
| 64 | +if ($bd_enabled) |
|
| 65 | 65 | { |
| 66 | 66 | $modulesToLoad['bd'] = array('name' => $bd_module, 'action' => 'load'); |
| 67 | 67 | } |
@@ -72,32 +72,32 @@ discard block |
||
| 72 | 72 | //Controller |
| 73 | 73 | $modulesToLoad['ctr'] = array('name' => $ctr_module, 'action' => 'test'); |
| 74 | 74 | |
| 75 | -foreach($modulesToLoad as $key => $moduleLoad) |
|
| 75 | +foreach ($modulesToLoad as $key => $moduleLoad) |
|
| 76 | 76 | { |
| 77 | - if(!empty($moduleLoad['name'])) |
|
| 77 | + if (!empty($moduleLoad['name'])) |
|
| 78 | 78 | { |
| 79 | 79 | $pathToModule = $rootPath.'modules/'.$moduleLoad['name']; |
| 80 | - if(empty($pathToModule)) |
|
| 80 | + if (empty($pathToModule)) |
|
| 81 | 81 | { |
| 82 | 82 | continue; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | - if(is_link($pathToModule)) |
|
| 85 | + if (is_link($pathToModule)) |
|
| 86 | 86 | { |
| 87 | 87 | $pathToModule = readlink($pathToModule); |
| 88 | 88 | |
| 89 | - if(file_exists($pathToModule.'/bfw_modules_info.php')) |
|
| 89 | + if (file_exists($pathToModule.'/bfw_modules_info.php')) |
|
| 90 | 90 | { |
| 91 | 91 | require_once($pathToModule.'/bfw_modules_info.php'); |
| 92 | 92 | |
| 93 | - if(!empty($modulePath)) |
|
| 93 | + if (!empty($modulePath)) |
|
| 94 | 94 | { |
| 95 | 95 | $pathToModule .= '/'.$modulePath; |
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if(!file_exists($pathToModule.'/kernel_init.php')) |
|
| 100 | + if (!file_exists($pathToModule.'/kernel_init.php')) |
|
| 101 | 101 | { |
| 102 | 102 | define('kernelModuleLoad_'.$key.'_test', false); |
| 103 | 103 | throw new \Exception('Module '.$moduleLoad['name'].' not found.'); |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | define('kernelModuleLoad_'.$key.'_test', true); |
| 107 | 107 | define('kernelModuleLoad_'.$key.'_path', $pathToModule.'/kernel_init.php'); |
| 108 | 108 | |
| 109 | - if($moduleLoad['action'] == 'load') |
|
| 109 | + if ($moduleLoad['action'] == 'load') |
|
| 110 | 110 | { |
| 111 | 111 | require_once($pathToModule.'/kernel_init.php'); |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | 114 | |
| 115 | - if(!defined('kernelModuleLoad_'.$key.'_test')) |
|
| 115 | + if (!defined('kernelModuleLoad_'.$key.'_test')) |
|
| 116 | 116 | { |
| 117 | 117 | define('kernelModuleLoad_'.$key.'_test', false); |
| 118 | 118 | } |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | //Serveur memcache (permet de stocker des infos direct sur la ram avec ou sans limite dans le temps) |
| 123 | 123 | $Memcache = null; |
| 124 | -if($memcache_enabled === true) |
|
| 124 | +if ($memcache_enabled === true) |
|
| 125 | 125 | { |
| 126 | 126 | $Memcache = new BFW\Ram($memcache_host, $memcache_port); |
| 127 | 127 | } |
@@ -145,30 +145,30 @@ discard block |
||
| 145 | 145 | */ |
| 146 | 146 | define('modulesLoadTime_EndInit', 'endInit'); |
| 147 | 147 | |
| 148 | -if(file_exists($rootPath.'modules')) |
|
| 148 | +if (file_exists($rootPath.'modules')) |
|
| 149 | 149 | { |
| 150 | 150 | $dir = opendir($rootPath.'modules'); |
| 151 | 151 | $dir_arr = array('.', '..', '.htaccess'); |
| 152 | 152 | |
| 153 | - while(false !== ($moduleName = readdir($dir))) |
|
| 153 | + while (false !== ($moduleName = readdir($dir))) |
|
| 154 | 154 | { |
| 155 | 155 | $path = $rootPath.'modules/'.$moduleName; |
| 156 | - if(is_link($path)) {$path = readlink($path);} |
|
| 156 | + if (is_link($path)) {$path = readlink($path); } |
|
| 157 | 157 | |
| 158 | 158 | //Si le fichier existe, on inclus le fichier principal du module |
| 159 | - if(file_exists($path.'/module.json')) |
|
| 159 | + if (file_exists($path.'/module.json')) |
|
| 160 | 160 | { |
| 161 | 161 | $Modules->newFromJson($path); |
| 162 | 162 | } |
| 163 | - elseif(file_exists($path.'/'.$moduleName.'.php')) |
|
| 163 | + elseif (file_exists($path.'/'.$moduleName.'.php')) |
|
| 164 | 164 | { |
| 165 | 165 | require_once($path.'/'.$moduleName.'.php'); |
| 166 | 166 | $Modules->addPath($moduleName, $path); |
| 167 | 167 | } |
| 168 | - else {continue;} |
|
| 168 | + else {continue; } |
|
| 169 | 169 | |
| 170 | 170 | $moduleInfos = $Modules->getModuleInfos($moduleName); |
| 171 | - if(!file_exists($path.'/'.$moduleInfos['runFile'])) |
|
| 171 | + if (!file_exists($path.'/'.$moduleInfos['runFile'])) |
|
| 172 | 172 | { |
| 173 | 173 | $Modules->loaded($moduleName); |
| 174 | 174 | } |
@@ -178,14 +178,14 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Module); |
| 181 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 181 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 182 | 182 | { |
| 183 | - foreach($modulesToLoad as $moduleToLoad) |
|
| 183 | + foreach ($modulesToLoad as $moduleToLoad) |
|
| 184 | 184 | { |
| 185 | 185 | $infos = $Modules->getModuleInfos($moduleToLoad); |
| 186 | 186 | $path = $infos['path']; |
| 187 | 187 | |
| 188 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
| 188 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
| 189 | 189 | { |
| 190 | 190 | $Modules->loaded($moduleToLoad); |
| 191 | 191 | require_once($path.'/'.$infos['runFile']); |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | |
| 201 | 201 | //Chargement des modules |
| 202 | 202 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_Visiteur); |
| 203 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 203 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 204 | 204 | { |
| 205 | - foreach($modulesToLoad as $moduleToLoad) |
|
| 205 | + foreach ($modulesToLoad as $moduleToLoad) |
|
| 206 | 206 | { |
| 207 | 207 | $infos = $Modules->getModuleInfos($moduleToLoad); |
| 208 | 208 | $path = $infos['path']; |
| 209 | 209 | |
| 210 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
| 210 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
| 211 | 211 | { |
| 212 | 212 | $Modules->loaded($moduleToLoad); |
| 213 | 213 | require_once($path.'/'.$infos['runFile']); |
@@ -250,14 +250,14 @@ discard block |
||
| 250 | 250 | |
| 251 | 251 | //Chargement des modules |
| 252 | 252 | $modulesToLoad = $Modules->listToLoad(modulesLoadTime_EndInit); |
| 253 | -if(is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 253 | +if (is_array($modulesToLoad) && count($modulesToLoad) > 0) |
|
| 254 | 254 | { |
| 255 | - foreach($modulesToLoad as $moduleToLoad) |
|
| 255 | + foreach ($modulesToLoad as $moduleToLoad) |
|
| 256 | 256 | { |
| 257 | 257 | $infos = $Modules->getModuleInfos($moduleToLoad); |
| 258 | 258 | $path = $infos['path']; |
| 259 | 259 | |
| 260 | - if(file_exists($path.'/'.$infos['runFile'])) |
|
| 260 | + if (file_exists($path.'/'.$infos['runFile'])) |
|
| 261 | 261 | { |
| 262 | 262 | $Modules->loaded($moduleToLoad); |
| 263 | 263 | require_once($path.'/'.$infos['runFile']); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if($DebugMode && $errorRender) |
|
| 2 | +if ($DebugMode && $errorRender) |
|
| 3 | 3 | { |
| 4 | 4 | function exception_handler($exception) |
| 5 | 5 | { |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | set_exception_handler('exception_handler'); |
| 17 | 17 | |
| 18 | - set_error_handler(function ($err_severity, $err_msg, $err_file, $err_line) |
|
| 18 | + set_error_handler(function($err_severity, $err_msg, $err_file, $err_line) |
|
| 19 | 19 | { |
| 20 | 20 | /* |
| 21 | 21 | http://fr2.php.net/manual/fr/function.set-error-handler.php#113567 |
@@ -37,29 +37,29 @@ discard block |
||
| 37 | 37 | / 32767 E_ALL (integer) All errors and warnings, as supported, except of level E_STRICT prior to PHP 5.4.0. 32767 in PHP 5.4.x, 30719 in PHP 5.3.x, 6143 in PHP 5.2.x, 2047 previously |
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | - if( |
|
| 40 | + if ( |
|
| 41 | 41 | $err_severity == E_ERROR || |
| 42 | 42 | $err_severity == E_CORE_ERROR || |
| 43 | 43 | $err_severity == E_USER_ERROR || |
| 44 | 44 | $err_severity == E_COMPILE_ERROR || |
| 45 | 45 | $err_severity == E_RECOVERABLE_ERROR |
| 46 | 46 | ) |
| 47 | - {$erreurType = 'Fatal';} |
|
| 47 | + {$erreurType = 'Fatal'; } |
|
| 48 | 48 | |
| 49 | - elseif( |
|
| 49 | + elseif ( |
|
| 50 | 50 | $err_severity == E_WARNING || |
| 51 | 51 | $err_severity == E_CORE_WARNING || |
| 52 | 52 | $err_severity == E_USER_WARNING || |
| 53 | 53 | $err_severity == E_COMPILE_WARNING |
| 54 | 54 | ) |
| 55 | - {$erreurType = 'Fatal';} |
|
| 55 | + {$erreurType = 'Fatal'; } |
|
| 56 | 56 | |
| 57 | - elseif($err_severity == E_PARSE) {$erreurType = 'Parse';} |
|
| 58 | - elseif($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice';} |
|
| 59 | - elseif($err_severity == E_STRICT) {$erreurType = 'Strict';} |
|
| 60 | - elseif($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/';} |
|
| 61 | - elseif($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated';} |
|
| 62 | - else {$erreurType = 'Unknow';} |
|
| 57 | + elseif ($err_severity == E_PARSE) {$erreurType = 'Parse'; } |
|
| 58 | + elseif ($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice'; } |
|
| 59 | + elseif ($err_severity == E_STRICT) {$erreurType = 'Strict'; } |
|
| 60 | + elseif ($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/'; } |
|
| 61 | + elseif ($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated'; } |
|
| 62 | + else {$erreurType = 'Unknow'; } |
|
| 63 | 63 | |
| 64 | 64 | global $errorRender; |
| 65 | 65 | $errorRender($erreurType, $err_msg, $err_file, $err_line, debug_backtrace()); |
@@ -91,27 +91,27 @@ discard block |
||
| 91 | 91 | <p class="title">Niarf, une erreur s\'est produite</p> |
| 92 | 92 | <p class="info">'.$erreurType.' Error : <strong>'.$err_msg.'</strong> in '.$err_file.' at line '.$err_line.'</p> |
| 93 | 93 | <fieldset><pre>'; |
| 94 | - foreach($backtrace as $i => $info) |
|
| 94 | + foreach ($backtrace as $i => $info) |
|
| 95 | 95 | { |
| 96 | 96 | echo '#'.$i.' '.$info['function']; |
| 97 | 97 | |
| 98 | - if(isset($info['args']) && count($info['args']) > 0) |
|
| 98 | + if (isset($info['args']) && count($info['args']) > 0) |
|
| 99 | 99 | { |
| 100 | 100 | echo '('; |
| 101 | 101 | |
| 102 | - foreach($info['args'] as $iArgs => $args) |
|
| 102 | + foreach ($info['args'] as $iArgs => $args) |
|
| 103 | 103 | { |
| 104 | - if($iArgs > 0) {echo ', ';} |
|
| 104 | + if ($iArgs > 0) {echo ', '; } |
|
| 105 | 105 | |
| 106 | - if(is_array($args) || is_object($args)) {echo gettype($args);} |
|
| 107 | - elseif(is_null($args)) {echo 'null';} |
|
| 108 | - else {echo htmlentities($args);} |
|
| 106 | + if (is_array($args) || is_object($args)) {echo gettype($args); } |
|
| 107 | + elseif (is_null($args)) {echo 'null'; } |
|
| 108 | + else {echo htmlentities($args); } |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | echo ')'; |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - if(isset($info['file'], $info['line'])) |
|
| 114 | + if (isset($info['file'], $info['line'])) |
|
| 115 | 115 | { |
| 116 | 116 | echo ' called at ['.$info['file'].' line '.$info['line'].']'; |
| 117 | 117 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * |
| 71 | 71 | * @param string $date (default: "now") La date sur laquelle travailler. Si pas indiqué, il s'agit de la date actuelle. |
| 72 | 72 | */ |
| 73 | - public function __construct($date="now"); |
|
| 73 | + public function __construct($date = "now"); |
|
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | 76 | * Modifie une données de la date |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * Si string : aaaa-mm-jj hh:mm:ss |
| 93 | 93 | * Si array : [0]=>partie date (aaaa-mm-jj), [1]=>partie heure (hh:mm:ss) |
| 94 | 94 | */ |
| 95 | - public function getSql($decoupe=false); |
|
| 95 | + public function getSql($decoupe = false); |
|
| 96 | 96 | |
| 97 | 97 | /** |
| 98 | 98 | * Modifie le timezone |
@@ -161,5 +161,5 @@ discard block |
||
| 161 | 161 | * |
| 162 | 162 | * @return string La date simplifié |
| 163 | 163 | */ |
| 164 | - public function aff_simple($tout=1, $minus=false); |
|
| 164 | + public function aff_simple($tout = 1, $minus = false); |
|
| 165 | 165 | } |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | * |
| 33 | 33 | * @throws \Exception Erreur sur la déclaration des options |
| 34 | 34 | */ |
| 35 | - public function newMod($name, $params=array()); |
|
| 35 | + public function newMod($name, $params = array()); |
|
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * Permet de vérifier si un module existe |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * |
| 82 | 82 | * @return array Liste des modules non chargé |
| 83 | 83 | */ |
| 84 | - public function listNotLoad($regen=false); |
|
| 84 | + public function listNotLoad($regen = false); |
|
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | 87 | * Permet de savoir si des modules n'ont pas pu être chargé |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | * |
| 19 | 19 | * @param string $idForm L'id du formulaire |
| 20 | 20 | */ |
| 21 | - public function __construct($idForm=null); |
|
| 21 | + public function __construct($idForm = null); |
|
| 22 | 22 | |
| 23 | 23 | /** |
| 24 | 24 | * Accesseur set sur id_form |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @return bool |
| 39 | 39 | */ |
| 40 | - public function setVal($key, $data, $expire=0); |
|
| 40 | + public function setVal($key, $data, $expire = 0); |
|
| 41 | 41 | |
| 42 | 42 | /** |
| 43 | 43 | * On modifie le temps avant expiration des infos sur le serveur memcached pour une clé choisie. |