@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | * |
| 31 | 31 | * @param string $idForm L'id du formulaire |
| 32 | 32 | */ |
| 33 | - public function __construct($idForm=null) |
|
| 33 | + public function __construct($idForm = null) |
|
| 34 | 34 | { |
| 35 | 35 | $this->_kernel = getKernel(); |
| 36 | 36 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | */ |
| 57 | 57 | public function tokenCreate() |
| 58 | 58 | { |
| 59 | - if(is_null($this->idForm)) {throw new Exception('Form name is undefined.');} |
|
| 59 | + if (is_null($this->idForm)) {throw new Exception('Form name is undefined.'); } |
|
| 60 | 60 | |
| 61 | 61 | $Id = uniqid(rand(), true); |
| 62 | 62 | $date = new Date(); |
@@ -79,20 +79,20 @@ discard block |
||
| 79 | 79 | { |
| 80 | 80 | global $_SESSION, $_POST; |
| 81 | 81 | |
| 82 | - if(isset($_SESSION['token']) && is_array($_SESSION['token'])) |
|
| 82 | + if (isset($_SESSION['token']) && is_array($_SESSION['token'])) |
|
| 83 | 83 | { |
| 84 | - if(isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm])) |
|
| 84 | + if (isset($_SESSION['token'][$this->idForm]) && is_array($_SESSION['token'][$this->idForm])) |
|
| 85 | 85 | { |
| 86 | 86 | $token = $_SESSION['token'][$this->idForm]['token']; |
| 87 | 87 | $date_create = $_SESSION['token'][$this->idForm]['date']; |
| 88 | 88 | $date_createDT = new Date($date_create); |
| 89 | 89 | |
| 90 | - if(isset($_POST['token']) && $_POST['token'] == $token) |
|
| 90 | + if (isset($_POST['token']) && $_POST['token'] == $token) |
|
| 91 | 91 | { |
| 92 | 92 | $date_limit = new Date(); |
| 93 | 93 | $date_limit->modify('-15 minute'); |
| 94 | 94 | |
| 95 | - if($date_createDT >= $date_limit) |
|
| 95 | + if ($date_createDT >= $date_limit) |
|
| 96 | 96 | { |
| 97 | 97 | unset($_SESSION['token'][$this->idForm]); |
| 98 | 98 | return true; |
@@ -90,23 +90,23 @@ discard block |
||
| 90 | 90 | * @param string $nom Le nom de la futur classe |
| 91 | 91 | * @param array $options Les options de la classe |
| 92 | 92 | */ |
| 93 | - public function __construct($nom, $options=array()) |
|
| 93 | + public function __construct($nom, $options = array()) |
|
| 94 | 94 | { |
| 95 | 95 | $this->_kernel = getKernel(); |
| 96 | 96 | |
| 97 | 97 | $this->nom = $nom; |
| 98 | 98 | |
| 99 | - if(isset($options['indente'])) |
|
| 99 | + if (isset($options['indente'])) |
|
| 100 | 100 | { |
| 101 | 101 | $this->indente = $options['indente']; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if(isset($options['extends'])) |
|
| 104 | + if (isset($options['extends'])) |
|
| 105 | 105 | { |
| 106 | 106 | $this->extends = $options['extends']; |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | - if(isset($options['implements'])) |
|
| 109 | + if (isset($options['implements'])) |
|
| 110 | 110 | { |
| 111 | 111 | $this->implements = $options['implements']; |
| 112 | 112 | } |
@@ -138,21 +138,21 @@ discard block |
||
| 138 | 138 | * |
| 139 | 139 | * @return bool True si réussi, False si existe déjà. |
| 140 | 140 | */ |
| 141 | - public function createAttribut($nom, $opt=array()) |
|
| 141 | + public function createAttribut($nom, $opt = array()) |
|
| 142 | 142 | { |
| 143 | - if(in_array($nom, $this->attributs)) {return false;} |
|
| 143 | + if (in_array($nom, $this->attributs)) {return false; } |
|
| 144 | 144 | |
| 145 | - if(!isset($opt['porter'])) |
|
| 145 | + if (!isset($opt['porter'])) |
|
| 146 | 146 | { |
| 147 | 147 | $opt['porter'] = 'protected'; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | - if(!isset($opt['get'])) |
|
| 150 | + if (!isset($opt['get'])) |
|
| 151 | 151 | { |
| 152 | 152 | $opt['get'] = 1; |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | - if(!isset($opt['set'])) |
|
| 155 | + if (!isset($opt['set'])) |
|
| 156 | 156 | { |
| 157 | 157 | $opt['set'] = 1; |
| 158 | 158 | } |
@@ -161,12 +161,12 @@ discard block |
||
| 161 | 161 | $this->attributs_porter[] = $opt['porter']; |
| 162 | 162 | $this->attributs_option[] = $opt; |
| 163 | 163 | |
| 164 | - if($opt['get'] == 1) |
|
| 164 | + if ($opt['get'] == 1) |
|
| 165 | 165 | { |
| 166 | 166 | $this->get[] = $nom; |
| 167 | 167 | } |
| 168 | 168 | |
| 169 | - if($opt['set'] == 1) |
|
| 169 | + if ($opt['set'] == 1) |
|
| 170 | 170 | { |
| 171 | 171 | $this->set[] = $nom; |
| 172 | 172 | } |
@@ -184,9 +184,9 @@ discard block |
||
| 184 | 184 | * |
| 185 | 185 | * @return bool |
| 186 | 186 | */ |
| 187 | - public function createMethode($nom, $porter='protected') |
|
| 187 | + public function createMethode($nom, $porter = 'protected') |
|
| 188 | 188 | { |
| 189 | - if(in_array($nom, $this->methode)) {return false;} |
|
| 189 | + if (in_array($nom, $this->methode)) {return false; } |
|
| 190 | 190 | |
| 191 | 191 | $this->methode[] = $nom; |
| 192 | 192 | $this->methode_porter[] = $porter; |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | $javadoc = $code = ''; |
| 205 | 205 | $default = isset($this->attributs_option[$key]['default']) ? true : false; |
| 206 | 206 | |
| 207 | - $default_string = false; |
|
| 208 | - if( |
|
| 207 | + $default_string = false; |
|
| 208 | + if ( |
|
| 209 | 209 | isset($this->attributs_option[$key]['default_string']) && |
| 210 | 210 | $this->attributs_option[$key]['default_string'] == true |
| 211 | 211 | ) |
| 212 | 212 | { |
| 213 | - $default_string = true; |
|
| 213 | + $default_string = true; |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
@@ -224,13 +224,13 @@ discard block |
||
| 224 | 224 | $code .= $this->attributs_porter[$key].' $'.$this->attributs[$key]; |
| 225 | 225 | |
| 226 | 226 | //S'il y a une valeur par défaut |
| 227 | - if($default === true) |
|
| 227 | + if ($default === true) |
|
| 228 | 228 | { |
| 229 | 229 | $javadoc .= ' Par défaut à '; |
| 230 | 230 | $code .= ' = '; |
| 231 | 231 | |
| 232 | 232 | //Si la valeur par défaut est dite un string. On ajoute des ' |
| 233 | - if($default_string === true) |
|
| 233 | + if ($default_string === true) |
|
| 234 | 234 | { |
| 235 | 235 | $javadoc .= '\''; |
| 236 | 236 | $code .= '\''; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | $code .= $this->attributs_option[$key]['default']; |
| 241 | 241 | |
| 242 | 242 | //Si la valeur par défaut est dite un string. On ajoute des ' |
| 243 | - if($default_string === true) |
|
| 243 | + if ($default_string === true) |
|
| 244 | 244 | { |
| 245 | 245 | $javadoc .= '\''; |
| 246 | 246 | $code .= '\''; |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | protected function genereSet($key) |
| 282 | 282 | { |
| 283 | 283 | $nom = $this->set[$key]; |
| 284 | - if(!in_array('set_'.$nom, $this->methode_create)) |
|
| 284 | + if (!in_array('set_'.$nom, $this->methode_create)) |
|
| 285 | 285 | { |
| 286 | 286 | $this->file .= $this->indente."/**\n"; |
| 287 | 287 | $this->file .= $this->indente.' * Accesseur set vers '.$nom."\n".$this->indente." *\n"; |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | */ |
| 306 | 306 | protected function genereMethode($key) |
| 307 | 307 | { |
| 308 | - if(in_array($this->methode[$key], $this->methode_create)) {return;} |
|
| 308 | + if (in_array($this->methode[$key], $this->methode_create)) {return; } |
|
| 309 | 309 | |
| 310 | 310 | $this->file .= $this->indente."/**\n"; |
| 311 | 311 | $this->file .= $this->indente." * Description de ma méthode.\n"; |
@@ -327,15 +327,15 @@ discard block |
||
| 327 | 327 | $this->file .= "/**\n * La description de ma classe\n * @package MonProjet\n */\n"; |
| 328 | 328 | |
| 329 | 329 | $this->file .= 'class '.$this->nom; |
| 330 | - if(!empty($this->extends)) |
|
| 330 | + if (!empty($this->extends)) |
|
| 331 | 331 | { |
| 332 | 332 | $this->file .= ' extends '.$this->extends; |
| 333 | 333 | } |
| 334 | 334 | |
| 335 | - if(count($this->implements) > 0) |
|
| 335 | + if (count($this->implements) > 0) |
|
| 336 | 336 | { |
| 337 | 337 | $this->file .= ' implements '; |
| 338 | - foreach($this->implements as $key => $implement) |
|
| 338 | + foreach ($this->implements as $key => $implement) |
|
| 339 | 339 | { |
| 340 | 340 | $this->file .= ($key > 0) ? ', ' : ''; |
| 341 | 341 | $this->file .= $implement; |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | $this->file .= "\n{\n"; |
| 345 | 345 | |
| 346 | 346 | //Création des attributs |
| 347 | - foreach($this->attributs as $key => $attr) |
|
| 347 | + foreach ($this->attributs as $key => $attr) |
|
| 348 | 348 | { |
| 349 | 349 | $this->genereAttribut($key); |
| 350 | 350 | } |
@@ -357,21 +357,21 @@ discard block |
||
| 357 | 357 | $this->file .= $this->indente."public function __construct() {}\n\n"; |
| 358 | 358 | |
| 359 | 359 | //Les gets |
| 360 | - foreach($this->get as $key => $nom) |
|
| 360 | + foreach ($this->get as $key => $nom) |
|
| 361 | 361 | { |
| 362 | 362 | $this->genereGet($key); |
| 363 | - if(in_array($nom, $this->set)) |
|
| 363 | + if (in_array($nom, $this->set)) |
|
| 364 | 364 | { |
| 365 | 365 | $this->genereSet($key); |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
| 369 | - foreach($this->set as $key => $nom) |
|
| 369 | + foreach ($this->set as $key => $nom) |
|
| 370 | 370 | { |
| 371 | 371 | $this->genereSet($key); |
| 372 | 372 | } |
| 373 | 373 | |
| 374 | - foreach($this->methode as $key => $nom) |
|
| 374 | + foreach ($this->methode as $key => $nom) |
|
| 375 | 375 | { |
| 376 | 376 | $this->genereMethode($key); |
| 377 | 377 | } |
@@ -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 | } |
@@ -34,7 +34,8 @@ 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)) { |
|
| 38 | + //Au cas où la valeur à vérifier soit un array (peut arriver avec les POST) |
|
| 38 | 39 | { |
| 39 | 40 | foreach($string as $key => $val) |
| 40 | 41 | { |
@@ -42,6 +43,7 @@ discard block |
||
| 42 | 43 | //la clé non sécurisé existerais toujours et la sécurisation |
| 43 | 44 | //ne servirais à rien. |
| 44 | 45 | unset($string[$key]); |
| 46 | + } |
|
| 45 | 47 | |
| 46 | 48 | $key = secure($key, true, $null_cslashe); |
| 47 | 49 | $val = secure($val, $html, $null_cslashe); |
@@ -192,11 +194,12 @@ discard block |
||
| 192 | 194 | global $request, $path; |
| 193 | 195 | |
| 194 | 196 | //Envoi du status http |
| 195 | - if(function_exists('http_response_code')) //php >= 5.4 |
|
| 197 | + if(function_exists('http_response_code')) { |
|
| 198 | + //php >= 5.4 |
|
| 196 | 199 | { |
| 197 | 200 | http_response_code($num); |
| 198 | 201 | } |
| 199 | - else //php < 5.4 |
|
| 202 | + } else //php < 5.4 |
|
| 200 | 203 | { |
| 201 | 204 | header(':', true, $num); |
| 202 | 205 | } |
@@ -204,12 +207,10 @@ discard block |
||
| 204 | 207 | if(file_exists(path_controllers.'erreurs/'.$num.'.php')) |
| 205 | 208 | { |
| 206 | 209 | require_once(path_controllers.'erreurs/'.$num.'.php'); |
| 207 | - } |
|
| 208 | - elseif (file_exists(path_controllers.'erreurs.php')) |
|
| 210 | + } elseif (file_exists(path_controllers.'erreurs.php')) |
|
| 209 | 211 | { |
| 210 | 212 | require_once(path_controllers.'erreurs.php'); |
| 211 | - } |
|
| 212 | - else |
|
| 213 | + } else |
|
| 213 | 214 | { |
| 214 | 215 | echo 'Erreur '.$num; |
| 215 | 216 | } |
@@ -243,8 +244,7 @@ discard block |
||
| 243 | 244 | try |
| 244 | 245 | { |
| 245 | 246 | file_put_contents($file, rtrim($txt)."\n", FILE_APPEND); |
| 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 | } |
@@ -331,11 +331,13 @@ discard block |
||
| 331 | 331 | return false; |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - if(PHP_VERSION_ID >= 50400) //PHP >= 5.4.0 |
|
| 334 | + if(PHP_VERSION_ID >= 50400) { |
|
| 335 | + //PHP >= 5.4.0 |
|
| 335 | 336 | { |
| 336 | 337 | if(session_status() === PHP_SESSION_ACTIVE) |
| 337 | 338 | { |
| 338 | 339 | return true; |
| 340 | + } |
|
| 339 | 341 | } |
| 340 | 342 | |
| 341 | 343 | return false; |
@@ -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; |
@@ -78,21 +78,23 @@ discard block |
||
| 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)) { |
|
| 82 | + //Un fichier mit dans /web |
|
| 82 | 83 | { |
| 83 | 84 | $pathFile = $rootPath.'web'; |
| 84 | 85 | } |
| 85 | - elseif(strpos($request, '/modules/') !== false) //Un fichier non php mit dans un modules. |
|
| 86 | + } elseif(strpos($request, '/modules/') !== false) { |
|
| 87 | + //Un fichier non php mit dans un modules. |
|
| 86 | 88 | { |
| 87 | 89 | $modulePos = strpos($request, '/modules/') + 9; |
| 90 | + } |
|
| 88 | 91 | $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos)); |
| 89 | 92 | |
| 90 | 93 | if(!file_exists('modules/'.$moduleName.'/externe.php')) |
| 91 | 94 | { |
| 92 | 95 | $error = 403; |
| 93 | 96 | } |
| 94 | - } |
|
| 95 | - else |
|
| 97 | + } else |
|
| 96 | 98 | { |
| 97 | 99 | $error = 404; |
| 98 | 100 | } |
@@ -102,12 +104,10 @@ discard block |
||
| 102 | 104 | if($ext == 'css') |
| 103 | 105 | { |
| 104 | 106 | header('Content-type: text/css'); |
| 105 | - } |
|
| 106 | - elseif($ext == 'js') |
|
| 107 | + } elseif($ext == 'js') |
|
| 107 | 108 | { |
| 108 | 109 | header('Content-type: text/javascript'); |
| 109 | - } |
|
| 110 | - else |
|
| 110 | + } else |
|
| 111 | 111 | { |
| 112 | 112 | $finfo = finfo_open(FILEINFO_MIME_TYPE); |
| 113 | 113 | header('Content-type: '.finfo_file($finfo, $pathFile.$file)); |
@@ -116,8 +116,7 @@ discard block |
||
| 116 | 116 | echo file_get_contents($pathFile.$file); |
| 117 | 117 | exit; |
| 118 | 118 | } |
| 119 | - } |
|
| 120 | - elseif(substr($ext, 0, 3) == 'php' && !is_null($ext)) |
|
| 119 | + } elseif(substr($ext, 0, 3) == 'php' && !is_null($ext)) |
|
| 121 | 120 | { |
| 122 | 121 | $modulePos = strpos($request, '/modules/') + 9; |
| 123 | 122 | $moduleName = substr($request, $modulePos, (strpos($request, '/', $modulePos) - $modulePos)); |
@@ -130,13 +129,11 @@ discard block |
||
| 130 | 129 | if(in_array($afterModuleName, $moduleExterneAuthorized)) |
| 131 | 130 | { |
| 132 | 131 | require_once($rootPath.$request); |
| 133 | - } |
|
| 134 | - else |
|
| 132 | + } else |
|
| 135 | 133 | { |
| 136 | 134 | $error = 403; |
| 137 | 135 | } |
| 138 | - } |
|
| 139 | - else |
|
| 136 | + } else |
|
| 140 | 137 | { |
| 141 | 138 | $error = 404; |
| 142 | 139 | } |
@@ -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']); |
@@ -159,13 +159,11 @@ |
||
| 159 | 159 | if(file_exists($path.'/module.json')) |
| 160 | 160 | { |
| 161 | 161 | $Modules->newFromJson($path); |
| 162 | - } |
|
| 163 | - elseif(file_exists($path.'/'.$moduleName.'.php')) |
|
| 162 | + } elseif(file_exists($path.'/'.$moduleName.'.php')) |
|
| 164 | 163 | { |
| 165 | 164 | require_once($path.'/'.$moduleName.'.php'); |
| 166 | 165 | $Modules->addPath($moduleName, $path); |
| 167 | - } |
|
| 168 | - else {continue;} |
|
| 166 | + } else {continue;} |
|
| 169 | 167 | |
| 170 | 168 | $moduleInfos = $Modules->getModuleInfos($moduleName); |
| 171 | 169 | if(!file_exists($path.'/'.$moduleInfos['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 | } |
@@ -44,22 +44,13 @@ discard block |
||
| 44 | 44 | $err_severity == E_COMPILE_ERROR || |
| 45 | 45 | $err_severity == E_RECOVERABLE_ERROR |
| 46 | 46 | ) |
| 47 | - {$erreurType = 'Fatal';} |
|
| 48 | - |
|
| 49 | - elseif( |
|
| 47 | + {$erreurType = 'Fatal';} elseif( |
|
| 50 | 48 | $err_severity == E_WARNING || |
| 51 | 49 | $err_severity == E_CORE_WARNING || |
| 52 | 50 | $err_severity == E_USER_WARNING || |
| 53 | 51 | $err_severity == E_COMPILE_WARNING |
| 54 | 52 | ) |
| 55 | - {$erreurType = 'Fatal';} |
|
| 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';} |
|
| 53 | + {$erreurType = 'Fatal';} elseif($err_severity == E_PARSE) {$erreurType = 'Parse';} elseif($err_severity == E_NOTICE || $err_severity == E_USER_NOTICE) {$erreurType = 'Notice';} elseif($err_severity == E_STRICT) {$erreurType = 'Strict';} elseif($err_severity == E_RECOVERABLE_ERROR) {$erreurType = '/';} elseif($err_severity == E_DEPRECATED || $err_severity == E_USER_DEPRECATED) {$erreurType = 'Deprecated';} else {$erreurType = 'Unknow';} |
|
| 63 | 54 | |
| 64 | 55 | global $errorRender; |
| 65 | 56 | $errorRender($erreurType, $err_msg, $err_file, $err_line, debug_backtrace()); |
@@ -103,9 +94,7 @@ discard block |
||
| 103 | 94 | { |
| 104 | 95 | if($iArgs > 0) {echo ', ';} |
| 105 | 96 | |
| 106 | - if(is_array($args) || is_object($args)) {echo gettype($args);} |
|
| 107 | - elseif(is_null($args)) {echo 'null';} |
|
| 108 | - else {echo htmlentities($args);} |
|
| 97 | + if(is_array($args) || is_object($args)) {echo gettype($args);} elseif(is_null($args)) {echo 'null';} else {echo htmlentities($args);} |
|
| 109 | 98 | } |
| 110 | 99 | |
| 111 | 100 | echo ')'; |
@@ -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 | } |
@@ -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. |