Completed
Pull Request — master (#40)
by
unknown
04:13
created
ecrire/base/objets.php 1 patch
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -974,8 +974,9 @@
 block discarded – undo
974 974
 	static $tables = array();
975 975
 	if (!isset($tables[$serveur])){
976 976
 		$tables[$serveur] = array();
977
-		if (!function_exists("sql_alltable"))
978
-			include_spip("base/abstract_sql");
977
+		if (!function_exists("sql_alltable")) {
978
+					include_spip("base/abstract_sql");
979
+		}
979 980
 		$ts = sql_alltable('%',$serveur); // toutes les tables
980 981
 		foreach ($ts as $t){
981 982
 			$tables[$serveur][$t] = $t;
Please login to merge, or discard this patch.
ecrire/inc/plugin.php 1 patch
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -555,11 +555,9 @@  discard block
 block discarded – undo
555 555
 		if (!isset($msg[$p])) {
556 556
 			if (isset($resume['erreur']) and $resume['erreur']) {
557 557
 				$msg[$p] = array($resume['erreur']);
558
-			}
559
-			elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
558
+			} elseif (!plugin_version_compatible($k['compatibilite'], $GLOBALS['spip_version_branche'], 'spip')) {
560 559
 				$msg[$p] = array(plugin_message_incompatibilite($k['compatibilite'], $GLOBALS['spip_version_branche'], 'SPIP', 'necessite'));
561
-			}
562
-			elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) {
560
+			} elseif (!$msg[$p] = plugin_necessite($k['necessite'], $liste, 'necessite')) {
563 561
 				$msg[$p] = plugin_necessite($k['utilise'], $liste, 'utilise');
564 562
 			}
565 563
 		} else {
@@ -1154,10 +1152,12 @@  discard block
 block discarded – undo
1154 1152
 					}
1155 1153
 					$nom = $nomlower;
1156 1154
 					// une action vide est une declaration qui ne doit pas etre compilee !
1157
-					if (!isset($GLOBALS['spip_pipeline'][$nom])) // creer le pipeline eventuel
1155
+					if (!isset($GLOBALS['spip_pipeline'][$nom])) {
1156
+					    // creer le pipeline eventuel
1158 1157
 					{
1159 1158
 						$GLOBALS['spip_pipeline'][$nom] = "";
1160 1159
 					}
1160
+					}
1161 1161
 					if ($action) {
1162 1162
 						if (strpos($GLOBALS['spip_pipeline'][$nom], "|$prefix$action") === false) {
1163 1163
 							$GLOBALS['spip_pipeline'][$nom] = preg_replace(",(\|\||$),", "|$prefix$action\\1",
@@ -1400,8 +1400,7 @@  discard block
 block discarded – undo
1400 1400
 	if (file_exists($nom)) {
1401 1401
 		if (substr($nom, -4) == '.php') {
1402 1402
 			$fichier_tmp = substr($nom, 0, -4) . '.tmp.php';
1403
-		}
1404
-		else {
1403
+		} else {
1405 1404
 			$fichier_tmp = $nom . '.tmp';
1406 1405
 		}
1407 1406
 		file_put_contents($fichier_tmp, $contenu);
Please login to merge, or discard this patch.
prive/formulaires/editer_auteur.php 1 patch
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -351,11 +351,15 @@  discard block
 block discarded – undo
351 351
 		$erreurs = array();
352 352
 		$erreurs = auteur_reset_password($res['id_auteur'], $erreurs);
353 353
 		if (isset($erreurs['message_ok'])) {
354
-			if (!isset($res['message_ok'])) $res['message_ok'] = '';
354
+			if (!isset($res['message_ok'])) {
355
+			    $res['message_ok'] = '';
356
+			}
355 357
 			$res['message_ok'] = trim($res['message_ok'] . ' ' . $erreurs['message_ok']);
356 358
 		}
357 359
 		if (isset($erreurs['message_erreur']) and $erreurs['message_erreur']) {
358
-			if (!isset($res['message_erreur'])) $res['message_erreur'] = '';
360
+			if (!isset($res['message_erreur'])) {
361
+			    $res['message_erreur'] = '';
362
+			}
359 363
 			$res['message_erreur'] = trim($res['message_erreur'] . ' ' . $erreurs['message_erreur']);
360 364
 		}
361 365
 	}
@@ -439,8 +443,7 @@  discard block
 block discarded – undo
439 443
 			if (!isset($contexte['lang']) or !$contexte['lang']) {
440 444
 				if (isset($row['lang']) and $row['lang']) {
441 445
 					$contexte['lang'] = $row['lang'];
442
-				}
443
-				else {
446
+				} else {
444 447
 					$contexte['lang'] = $GLOBALS['meta']['langue_site'];
445 448
 				}
446 449
 			}
Please login to merge, or discard this patch.
ecrire/action/editer_liens.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -512,8 +512,7 @@
 block discarded – undo
512 512
 		$desc = $trouver_table($table_lien);
513 513
 		if ($desc and isset($desc['field']['rang_lien'])) {
514 514
 			$triables[$table_lien] = true;
515
-		}
516
-		else {
515
+		} else {
517 516
 			$triables[$table_lien] = false;
518 517
 		}
519 518
 	}
Please login to merge, or discard this patch.
config/ecran_securite.php 1 patch
Braces   +80 added lines, -46 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 /*
15 15
  * Test utilisateur
16 16
  */
17
-if (isset($_GET['test_ecran_securite']))
17
+if (isset($_GET['test_ecran_securite'])) {
18 18
 	$ecran_securite_raison = 'test '._ECRAN_SECURITE;
19
+}
19 20
 
20 21
 /*
21 22
  * Monitoring
@@ -243,18 +244,21 @@  discard block
 block discarded – undo
243 244
  * (id_base est une variable de la config des widgets de WordPress)
244 245
  */
245 246
 $_exceptions = array('id_table','id_base','id_parent','id_article_pdf');
246
-foreach ($_GET as $var => $val)
247
+foreach ($_GET as $var => $val) {
247 248
 	if ($_GET[$var] and strncmp($var, "id_", 3) == 0
248 249
 		and !in_array($var, $_exceptions))
249 250
 		$_GET[$var] = is_array($_GET[$var])?@array_map('intval', $_GET[$var]):intval($_GET[$var]);
250
-foreach ($_POST as $var => $val)
251
+}
252
+foreach ($_POST as $var => $val) {
251 253
 	if ($_POST[$var] and strncmp($var, "id_", 3) == 0
252 254
 		and !in_array($var, $_exceptions))
253 255
 		$_POST[$var] = is_array($_POST[$var])?@array_map('intval', $_POST[$var]):intval($_POST[$var]);
254
-foreach ($GLOBALS as $var => $val)
256
+}
257
+foreach ($GLOBALS as $var => $val) {
255 258
 	if ($GLOBALS[$var] and strncmp($var, "id_", 3) == 0
256 259
 		and !in_array($var, $_exceptions))
257 260
 		$GLOBALS[$var] = is_array($GLOBALS[$var])?@array_map('intval', $GLOBALS[$var]):intval($GLOBALS[$var]);
261
+}
258 262
 
259 263
 /*
260 264
  * Interdit la variable $cjpeg_command, qui était utilisée sans
@@ -266,11 +270,13 @@  discard block
 block discarded – undo
266 270
  * Contrôle de quelques variables (XSS)
267 271
  */
268 272
 foreach(array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) {
269
-	if (isset($_GET[$var]))
270
-		$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
271
-	if (isset($_POST[$var]))
272
-		$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
273
-}
273
+	if (isset($_GET[$var])) {
274
+			$_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]);
275
+	}
276
+	if (isset($_POST[$var])) {
277
+			$_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]);
278
+	}
279
+	}
274 280
 
275 281
 /*
276 282
  * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x)
@@ -284,41 +290,49 @@  discard block
 block discarded – undo
284 290
  */
285 291
 if (isset($_REQUEST['mode']) and isset($_REQUEST['page'])
286 292
 and !in_array($_REQUEST['mode'], array("6forum", "1comite"))
287
-and $_REQUEST['page'] == "identifiants")
293
+and $_REQUEST['page'] == "identifiants") {
288 294
 	$ecran_securite_raison = "identifiants";
295
+}
289 296
 
290 297
 /*
291 298
  * Agenda joue à l'injection php
292 299
  */
293 300
 if (isset($_REQUEST['partie_cal'])
294
-and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal']))
301
+and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])) {
295 302
 	$ecran_securite_raison = "partie_cal";
303
+}
296 304
 if (isset($_REQUEST['echelle'])
297
-and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle']))
305
+and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])) {
298 306
 	$ecran_securite_raison = "echelle";
307
+}
299 308
 
300 309
 /*
301 310
  * Espace privé
302 311
  */
303 312
 if (isset($_REQUEST['exec'])
304
-and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec']))
313
+and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])) {
305 314
 	$ecran_securite_raison = "exec";
315
+}
306 316
 if (isset($_REQUEST['cherche_auteur'])
307
-and preg_match(',[<],', (string)$_REQUEST['cherche_auteur']))
317
+and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])) {
308 318
 	$ecran_securite_raison = "cherche_auteur";
319
+}
309 320
 if (isset($_REQUEST['exec'])
310 321
 and $_REQUEST['exec'] == 'auteurs'
311
-and preg_match(',[<],', (string)$_REQUEST['recherche']))
322
+and preg_match(',[<],', (string)$_REQUEST['recherche'])) {
312 323
 	$ecran_securite_raison = "recherche";
324
+}
313 325
 if (isset($_REQUEST['exec'])
314 326
 and $_REQUEST['exec'] == 'info_plugin'
315
-and preg_match(',[<],', (string)$_REQUEST['plugin']))
327
+and preg_match(',[<],', (string)$_REQUEST['plugin'])) {
316 328
 	$ecran_securite_raison = "plugin";
329
+}
317 330
 if (isset($_REQUEST['exec'])
318 331
 and $_REQUEST['exec'] == 'puce_statut'
319 332
 and isset($_REQUEST['id'])
320
-and !intval($_REQUEST['id']))
333
+and !intval($_REQUEST['id'])) {
321 334
 	$ecran_securite_raison = "puce_statut";
335
+}
322 336
 if (isset($_REQUEST['action'])
323 337
 and $_REQUEST['action'] == 'configurer') {
324 338
 	if (@file_exists('inc_version.php')
@@ -343,21 +357,24 @@  discard block
 block discarded – undo
343 357
 	@get_magic_quotes_gpc() ?
344 358
 		stripslashes(serialize($_REQUEST)) : serialize($_REQUEST),
345 359
 	chr(0)
346
-) !== false)
360
+) !== false) {
347 361
 	$ecran_securite_raison = "%00";
362
+}
348 363
 
349 364
 /*
350 365
  * Bloque les requêtes fond=formulaire_
351 366
  */
352 367
 if (isset($_REQUEST['fond'])
353
-and preg_match(',^formulaire_,i', $_REQUEST['fond']))
368
+and preg_match(',^formulaire_,i', $_REQUEST['fond'])) {
354 369
 	$ecran_securite_raison = "fond=formulaire_";
370
+}
355 371
 
356 372
 /*
357 373
  * Bloque les requêtes du type ?GLOBALS[type_urls]=toto (bug vieux php)
358 374
  */
359
-if (isset($_REQUEST['GLOBALS']))
375
+if (isset($_REQUEST['GLOBALS'])) {
360 376
 	$ecran_securite_raison = "GLOBALS[GLOBALS]";
377
+}
361 378
 
362 379
 /*
363 380
  * Bloque les requêtes des bots sur:
@@ -370,29 +387,34 @@  discard block
 block discarded – undo
370 387
 		or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_') )
371 388
 		or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI']))
372 389
 )
373
-)
390
+) {
374 391
 	$ecran_securite_raison = "robot agenda/double pagination";
392
+}
375 393
 
376 394
 /*
377 395
  * Bloque une vieille page de tests de CFG (<1.11)
378 396
  * Bloque un XSS sur une page inexistante
379 397
  */
380 398
 if (isset($_REQUEST['page'])) {
381
-	if ($_REQUEST['page'] == 'test_cfg')
382
-		$ecran_securite_raison = "test_cfg";
383
-	if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page']))
384
-		$ecran_securite_raison = "xsspage";
399
+	if ($_REQUEST['page'] == 'test_cfg') {
400
+			$ecran_securite_raison = "test_cfg";
401
+	}
402
+	if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) {
403
+			$ecran_securite_raison = "xsspage";
404
+	}
385 405
 	if ($_REQUEST['page'] == '404'
386
-	and isset($_REQUEST['erreur']))
387
-		$ecran_securite_raison = "xss404";
388
-}
406
+	and isset($_REQUEST['erreur'])) {
407
+			$ecran_securite_raison = "xss404";
408
+	}
409
+	}
389 410
 
390 411
 /*
391 412
  * XSS par array
392 413
  */
393
-foreach (array('var_login') as $var)
394
-if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var]))
414
+foreach (array('var_login') as $var) {
415
+    if (isset($_REQUEST[$var]) and is_array($_REQUEST[$var]))
395 416
 	$ecran_securite_raison = "xss ".$var;
417
+}
396 418
 
397 419
 /*
398 420
  * Parade antivirale contre un cheval de troie
@@ -402,18 +424,21 @@  discard block
 block discarded – undo
402 424
 	function tmp_lkojfghx2($a = 0, $b = 0, $c = 0, $d = 0) {
403 425
 		// si jamais on est arrivé ici sur une erreur php
404 426
 		// et qu'un autre gestionnaire d'erreur est défini, l'appeller
405
-		if ($b && $GLOBALS['tmp_xhgfjokl'])
406
-			call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d);
427
+		if ($b && $GLOBALS['tmp_xhgfjokl']) {
428
+					call_user_func($GLOBALS['tmp_xhgfjokl'], $a, $b, $c, $d);
429
+		}
407 430
 	}
408 431
 }
409
-if (isset($_POST['tmp_lkojfghx3']))
432
+if (isset($_POST['tmp_lkojfghx3'])) {
410 433
 	$ecran_securite_raison = "gumblar";
434
+}
411 435
 
412 436
 /*
413 437
  * Outils XML mal sécurisés < 2.0.9
414 438
  */
415
-if (isset($_REQUEST['transformer_xml']))
439
+if (isset($_REQUEST['transformer_xml'])) {
416 440
 	$ecran_securite_raison = "transformer_xml";
441
+}
417 442
 
418 443
 /*
419 444
  * Outils XML mal sécurisés again
@@ -432,11 +457,13 @@  discard block
 block discarded – undo
432 457
  * Sauvegarde mal securisée < 2.0.9
433 458
  */
434 459
 if (isset($_REQUEST['nom_sauvegarde'])
435
-and strstr((string)$_REQUEST['nom_sauvegarde'], '/'))
460
+and strstr((string)$_REQUEST['nom_sauvegarde'], '/')) {
436 461
 	$ecran_securite_raison = 'nom_sauvegarde manipulee';
462
+}
437 463
 if (isset($_REQUEST['znom_sauvegarde'])
438
-and strstr((string)$_REQUEST['znom_sauvegarde'], '/'))
464
+and strstr((string)$_REQUEST['znom_sauvegarde'], '/')) {
439 465
 	$ecran_securite_raison = 'znom_sauvegarde manipulee';
466
+}
440 467
 
441 468
 
442 469
 /*
@@ -444,8 +471,9 @@  discard block
 block discarded – undo
444 471
  * on vérifie 'page' pour ne pas bloquer ... drupal
445 472
  */
446 473
 if (isset($_REQUEST['op']) and isset($_REQUEST['page'])
447
-and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op']))
474
+and $_REQUEST['op'] !== preg_replace('/[^\-\w]/', '', $_REQUEST['op'])) {
448 475
 	$ecran_securite_raison = 'op';
476
+}
449 477
 
450 478
 /*
451 479
  * Forms & Table ne se méfiait pas assez des uploads de fichiers
@@ -453,8 +481,9 @@  discard block
 block discarded – undo
453 481
 if (count($_FILES)){
454 482
 	foreach($_FILES as $k => $v){
455 483
 		 if (preg_match(',^fichier_\d+$,', $k)
456
-		 and preg_match(',\.php,i', $v['name']))
457
-		 	unset($_FILES[$k]);
484
+		 and preg_match(',\.php,i', $v['name'])) {
485
+		 		 	unset($_FILES[$k]);
486
+		 }
458 487
 	}
459 488
 }
460 489
 /*
@@ -471,21 +500,24 @@  discard block
 block discarded – undo
471 500
  * reinstall=oui un peu trop permissif
472 501
  */
473 502
 if (isset($_REQUEST['reinstall'])
474
-and $_REQUEST['reinstall'] == 'oui')
503
+and $_REQUEST['reinstall'] == 'oui') {
475 504
 	$ecran_securite_raison = 'reinstall=oui';
505
+}
476 506
 
477 507
 /*
478 508
  * Échappement xss referer
479 509
  */
480
-if (isset($_SERVER['HTTP_REFERER']))
510
+if (isset($_SERVER['HTTP_REFERER'])) {
481 511
 	$_SERVER['HTTP_REFERER'] = strtr($_SERVER['HTTP_REFERER'], '<>"\'', '[]##');
512
+}
482 513
 
483 514
 
484 515
 /*
485 516
  * Echappement HTTP_X_FORWARDED_HOST
486 517
  */
487
-if (isset($_SERVER['HTTP_X_FORWARDED_HOST']))
518
+if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
488 519
 	$_SERVER['HTTP_X_FORWARDED_HOST'] = strtr($_SERVER['HTTP_X_FORWARDED_HOST'], "<>?\"\{\}\$'` \r\n", '____________');
520
+}
489 521
 
490 522
 
491 523
 /*
@@ -493,9 +525,10 @@  discard block
 block discarded – undo
493 525
  */
494 526
 if (strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false or isset($_REQUEST['var_memotri'])){
495 527
 	$zzzz = implode("", array_keys($_REQUEST));
496
-	if (strlen($zzzz) != strcspn($zzzz, '<>"\''))
497
-		$ecran_securite_raison = 'Cle incorrecte en $_REQUEST';
498
-}
528
+	if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) {
529
+			$ecran_securite_raison = 'Cle incorrecte en $_REQUEST';
530
+	}
531
+	}
499 532
 
500 533
 /*
501 534
  * Injection par connect
@@ -544,8 +577,9 @@  discard block
 block discarded – undo
544 577
 /*
545 578
  * Bloque les bots quand le load déborde
546 579
  */
547
-if (!defined('_ECRAN_SECURITE_LOAD'))
580
+if (!defined('_ECRAN_SECURITE_LOAD')) {
548 581
 	define('_ECRAN_SECURITE_LOAD', 4);
582
+}
549 583
 
550 584
 if (
551 585
 	defined('_ECRAN_SECURITE_LOAD')
Please login to merge, or discard this patch.
ecrire/inc/filtres.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3385,8 +3385,7 @@
 block discarded – undo
3385 3385
 		$balise_svg = inserer_attribut($balise_svg, 'aria-labelledby', $id);
3386 3386
 		$title = "<title id=\"$id\">" . entites_html($alt)."</title>\n";
3387 3387
 		$balise_svg .= $title;
3388
-	}
3389
-	else {
3388
+	} else {
3390 3389
 		$balise_svg = inserer_attribut($balise_svg, 'aria-hidden', 'true');
3391 3390
 	}
3392 3391
 	$svg = str_replace($balise_svg_source, $balise_svg, $svg);
Please login to merge, or discard this patch.
ecrire/inc/utils.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -2308,12 +2308,13 @@  discard block
 block discarded – undo
2308 2308
 		define('_DIR_CHMOD', $pi);
2309 2309
 	}
2310 2310
 
2311
-	if (!isset($GLOBALS['test_dirs']))
2312
-		// Pas $pi car il est bon de le mettre hors ecriture apres intstall
2311
+	if (!isset($GLOBALS['test_dirs'])) {
2312
+			// Pas $pi car il est bon de le mettre hors ecriture apres intstall
2313 2313
 		// il sera rajoute automatiquement si besoin a l'etape 2 de l'install
2314 2314
 	{
2315 2315
 		$GLOBALS['test_dirs'] = array($pa, $ti, $ta);
2316 2316
 	}
2317
+	}
2317 2318
 
2318 2319
 	// Declaration des fichiers
2319 2320
 
@@ -3390,8 +3391,7 @@  discard block
 block discarded – undo
3390 3391
 			  and $h = svg_dimension_to_pixels($attrs['height'])) {
3391 3392
 				$width = $w;
3392 3393
 				$height = $h;
3393
-			}
3394
-			elseif (isset($attrs['viewBox'])) {
3394
+			} elseif (isset($attrs['viewBox'])) {
3395 3395
 				$viewbox = trim($attrs['viewBox']);
3396 3396
 				$viewbox = preg_replace(",\s+,", " ", $viewbox);
3397 3397
 				$viewbox = explode(" ", $viewbox);
Please login to merge, or discard this patch.
ecrire/inc/filtres_images_lib_mini.php 1 patch
Braces   +4 added lines, -9 removed lines patch added patch discarded remove patch
@@ -357,8 +357,7 @@  discard block
 block discarded – undo
357 357
 			process_image_svg_identite($ret);
358 358
 			$ret['creer'] = false;
359 359
 		}
360
-	}
361
-	else {
360
+	} else {
362 361
 		if (!function_exists($ret["fonction_imagecreatefrom"])) {
363 362
 			return false;
364 363
 		}
@@ -404,8 +403,7 @@  discard block
 block discarded – undo
404 403
 
405 404
 	if (isset($info['mime'])) {
406 405
 		$mime = $info['mime'];
407
-	}
408
-	else {
406
+	} else {
409 407
 		$mime = image_type_to_mime_type($info[2]);
410 408
 	}
411 409
 
@@ -1100,9 +1098,7 @@  discard block
 block discarded – undo
1100 1098
 	if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) {
1101 1099
 		$vignette = $destination . '.' . $format;
1102 1100
 		@copy($image, $vignette);
1103
-	}
1104
-
1105
-	elseif ($valeurs["format_source"] === 'svg') {
1101
+	} elseif ($valeurs["format_source"] === 'svg') {
1106 1102
 		if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)){
1107 1103
 			$format_sortie = 'svg';
1108 1104
 			$vignette = $destination . "." . $format_sortie;
@@ -1527,8 +1523,7 @@  discard block
 block discarded – undo
1527 1523
 		$date = test_espace_prive() ? ('?' . $date) : '';
1528 1524
 
1529 1525
 		return _image_ecrire_tag($image, array('src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight));
1530
-	}
1531
-	else {
1526
+	} else {
1532 1527
 		# BMP, tiff ... les redacteurs osent tout!
1533 1528
 		return $img;
1534 1529
 	}
Please login to merge, or discard this patch.
ecrire/inc/svg.php 1 patch
Braces   +8 added lines, -16 removed lines patch added patch discarded remove patch
@@ -65,8 +65,7 @@  discard block
 block discarded – undo
65 65
 	}
66 66
 	if (is_null($maxlen)) {
67 67
 		$image = file_get_contents($fichier);
68
-	}
69
-	else {
68
+	} else {
70 69
 		$image = file_get_contents($fichier, false,null,0, $maxlen);
71 70
 	}
72 71
 	// est-ce bien une image svg ?
@@ -193,8 +192,7 @@  discard block
 block discarded – undo
193 192
 
194 193
 	if ($start === false or $start === 'end') {
195 194
 		$svg = str_replace("</svg>", $shapes . "</svg>", $svg);
196
-	}
197
-	else {
195
+	} else {
198 196
 		$p = stripos($svg, "<svg");
199 197
 		$p = strpos($svg, ">", $p);
200 198
 		$svg = substr_replace($svg, $shapes, $p+1, 0);
@@ -255,8 +253,7 @@  discard block
 block discarded – undo
255 253
 	if (strpos($couleur, "rgb(")===0) {
256 254
 		$c = explode(',', substr($couleur, 4));
257 255
 		$couleur = _couleur_dec_to_hex(intval($c[0]), intval($c[1]), intval($c[2]));
258
-	}
259
-	else {
256
+	} else {
260 257
 		$couleur = couleur_html_to_hex($couleur);
261 258
 	}
262 259
 	$couleur = '#'.ltrim($couleur,'#');
@@ -297,8 +294,7 @@  discard block
 block discarded – undo
297 294
 		// il nous faut une viewBox
298 295
 		if (!isset($attributs['viewBox'])) {
299 296
 			$viewBox = "0 0 " . $attributs['width'] . " " . $attributs['height'];
300
-		}
301
-		else {
297
+		} else {
302 298
 			$viewBox = $attributs['viewBox'];
303 299
 		}
304 300
 		// et on la convertit en px
@@ -411,8 +407,7 @@  discard block
 block discarded – undo
411 407
 			if (isset($attributs['viewBox'])) {
412 408
 				$viewBox = explode(' ', $attributs['viewBox']);
413 409
 				$rect = "<rect x=\"".$viewBox[0]."\" y=\"".$viewBox[1]."\" width=\"".$viewBox[2]."\" height=\"".$viewBox[3]."\" fill=\"$background_color\"/>";
414
-			}
415
-			else {
410
+			} else {
416 411
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
417 412
 			}
418 413
 			$svg = svg_insert_shapes($svg, $rect);
@@ -440,8 +435,7 @@  discard block
 block discarded – undo
440 435
 			if (isset($attributs['viewBox'])) {
441 436
 				$viewBox = explode(' ', $attributs['viewBox']);
442 437
 				$rect = "<rect x=\"".$viewBox[0]."\" y=\"".$viewBox[1]."\" width=\"".$viewBox[2]."\" height=\"".$viewBox[3]."\" fill=\"$background_color\" opacity=\"$opacity\"/>";
443
-			}
444
-			else {
438
+			} else {
445 439
 				$rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>";
446 440
 			}
447 441
 			$svg = svg_insert_shapes($svg, $rect, false);
@@ -501,8 +495,7 @@  discard block
 block discarded – undo
501 495
 			$x = intval($viewBox[0]) + intval($viewBox[2]/2);
502 496
 			$mx = -$x;
503 497
 			$transform = "translate($x, 0) $transform translate($mx, 0)";
504
-		}
505
-		else {
498
+		} else {
506 499
 			$transform = "scale(1,-1)";
507 500
 
508 501
 			$y = intval($viewBox[1]) + intval($viewBox[3]/2);
@@ -561,8 +554,7 @@  discard block
 block discarded – undo
561 554
 			$c = array_shift($colors);
562 555
 			if (strlen($c) == 4) {
563 556
 				$short[] = $c;
564
-			}
565
-			else {
557
+			} else {
566 558
 				$long[] = $c;
567 559
 			}
568 560
 		}
Please login to merge, or discard this patch.