Completed
Push — master ( c2652d...a4fa78 )
by cam
01:40
created
ecrire/action/tester_taille.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
76 76
 		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
77 77
 			$t *= 0.9; // marge de securite
78
-			echo round($t / 1_000_000, 3) . ' Mpx';
78
+			echo round($t / 1_000_000, 3).' Mpx';
79 79
 		} else {
80 80
 			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
81 81
 			$t = 0;
@@ -111,19 +111,19 @@  discard block
 block discarded – undo
111 111
 	$image_source = chemin_image('test.png');
112 112
 	$GLOBALS['redirect'] = generer_url_action(
113 113
 		'tester_taille',
114
-		"i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
114
+		"i=$i&arg=".$GLOBALS['taille_min'].'-'.$GLOBALS['taille_test']
115 115
 	);
116 116
 
117 117
 	ob_start('action_tester_taille_error_handler');
118 118
 	filtrer('image_recadre', $image_source, $taille, $taille);
119
-	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
119
+	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-".$GLOBALS['taille_max']);
120 120
 
121 121
 	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
122 122
 	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
123 123
 	if ($GLOBALS['taille_min'] == 0) {
124 124
 		$taille = $GLOBALS['taille_max'];
125 125
 		filtrer('image_recadre', $image_source, $taille, $taille);
126
-		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
126
+		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-".$GLOBALS['taille_max']);
127 127
 	}
128 128
 	ob_end_clean();
129 129
 
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 
19 19
 if (!defined('_ECRIRE_INC_VERSION')) {
20
-	return;
20
+    return;
21 21
 }
22 22
 include_spip('inc/headers');
23 23
 
@@ -34,12 +34,12 @@  discard block
 block discarded – undo
34 34
  *     Sortie du buffer
35 35
  **/
36 36
 function action_tester_taille_error_handler($output) {
37
-	// on est ici, donc echec lors de la creation de l'image
38
-	if (!empty($GLOBALS['redirect'])) {
39
-		return redirige_formulaire($GLOBALS['redirect']);
40
-	}
37
+    // on est ici, donc echec lors de la creation de l'image
38
+    if (!empty($GLOBALS['redirect'])) {
39
+        return redirige_formulaire($GLOBALS['redirect']);
40
+    }
41 41
 
42
-	return $output;
42
+    return $output;
43 43
 }
44 44
 
45 45
 
@@ -57,77 +57,77 @@  discard block
 block discarded – undo
57 57
  **/
58 58
 function action_tester_taille_dist() {
59 59
 
60
-	if (!autoriser('configurer')) {
61
-		return;
62
-	}
63
-
64
-	$taille = _request('arg');
65
-	$taille = explode('-', (string) $taille);
66
-
67
-	$GLOBALS['taille_max'] = end($taille);
68
-	$GLOBALS['taille_min'] = 0;
69
-	if (count($taille) > 1) {
70
-		$GLOBALS['taille_min'] = reset($taille);
71
-	}
72
-
73
-	// si l'intervalle est assez petit, on garde la valeur min
74
-	if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
75
-		$t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
76
-		if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
77
-			$t *= 0.9; // marge de securite
78
-			echo round($t / 1_000_000, 3) . ' Mpx';
79
-		} else {
80
-			// c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
81
-			$t = 0;
82
-			echo '&infin;';
83
-		}
84
-		ecrire_meta('max_taille_vignettes', $t, 'non');
85
-		die();
86
-	}
87
-
88
-	$taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
89
-
90
-	include_spip('inc/filtres');
91
-	// des inclusions representatives d'un hit prive et/ou public pour la conso memoire
92
-	include_spip('public/assembler');
93
-	include_spip('public/balises');
94
-	include_spip('public/boucles');
95
-	include_spip('public/cacher');
96
-	include_spip('public/compiler');
97
-	include_spip('public/composer');
98
-	include_spip('public/criteres');
99
-	include_spip('public/interfaces');
100
-	include_spip('public/parametrer');
101
-	include_spip('public/phraser_html');
102
-	include_spip('public/references');
103
-
104
-	include_spip('inc/presentation');
105
-	include_spip('inc/charsets');
106
-	include_spip('inc/documents');
107
-	include_spip('inc/header');
108
-	propre('<doc1>'); // charger propre avec le trairement d'un modele
109
-
110
-	$i = _request('i') + 1;
111
-	$image_source = chemin_image('test.png');
112
-	$GLOBALS['redirect'] = generer_url_action(
113
-		'tester_taille',
114
-		"i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
115
-	);
116
-
117
-	ob_start('action_tester_taille_error_handler');
118
-	filtrer('image_recadre', $image_source, $taille, $taille);
119
-	$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
120
-
121
-	// si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
122
-	// si $GLOBALS['taille_min']==0 (car on est au premier coup)
123
-	if ($GLOBALS['taille_min'] == 0) {
124
-		$taille = $GLOBALS['taille_max'];
125
-		filtrer('image_recadre', $image_source, $taille, $taille);
126
-		$GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
127
-	}
128
-	ob_end_clean();
129
-
130
-
131
-	// on est ici, donc pas de plantage
132
-	echo redirige_formulaire($GLOBALS['redirect']);
60
+    if (!autoriser('configurer')) {
61
+        return;
62
+    }
63
+
64
+    $taille = _request('arg');
65
+    $taille = explode('-', (string) $taille);
66
+
67
+    $GLOBALS['taille_max'] = end($taille);
68
+    $GLOBALS['taille_min'] = 0;
69
+    if (count($taille) > 1) {
70
+        $GLOBALS['taille_min'] = reset($taille);
71
+    }
72
+
73
+    // si l'intervalle est assez petit, on garde la valeur min
74
+    if ($GLOBALS['taille_max'] * $GLOBALS['taille_max'] - $GLOBALS['taille_min'] * $GLOBALS['taille_min'] < 50000) {
75
+        $t = ($GLOBALS['taille_min'] * $GLOBALS['taille_min']);
76
+        if ($GLOBALS['taille_min'] !== $GLOBALS['taille_max']) {
77
+            $t *= 0.9; // marge de securite
78
+            echo round($t / 1_000_000, 3) . ' Mpx';
79
+        } else {
80
+            // c'est un cas "on a reussi la borne max initiale, donc on a pas de limite connue"
81
+            $t = 0;
82
+            echo '&infin;';
83
+        }
84
+        ecrire_meta('max_taille_vignettes', $t, 'non');
85
+        die();
86
+    }
87
+
88
+    $taille = $GLOBALS['taille_test'] = round(($GLOBALS['taille_max'] + $GLOBALS['taille_min']) / 2);
89
+
90
+    include_spip('inc/filtres');
91
+    // des inclusions representatives d'un hit prive et/ou public pour la conso memoire
92
+    include_spip('public/assembler');
93
+    include_spip('public/balises');
94
+    include_spip('public/boucles');
95
+    include_spip('public/cacher');
96
+    include_spip('public/compiler');
97
+    include_spip('public/composer');
98
+    include_spip('public/criteres');
99
+    include_spip('public/interfaces');
100
+    include_spip('public/parametrer');
101
+    include_spip('public/phraser_html');
102
+    include_spip('public/references');
103
+
104
+    include_spip('inc/presentation');
105
+    include_spip('inc/charsets');
106
+    include_spip('inc/documents');
107
+    include_spip('inc/header');
108
+    propre('<doc1>'); // charger propre avec le trairement d'un modele
109
+
110
+    $i = _request('i') + 1;
111
+    $image_source = chemin_image('test.png');
112
+    $GLOBALS['redirect'] = generer_url_action(
113
+        'tester_taille',
114
+        "i=$i&arg=" . $GLOBALS['taille_min'] . '-' . $GLOBALS['taille_test']
115
+    );
116
+
117
+    ob_start('action_tester_taille_error_handler');
118
+    filtrer('image_recadre', $image_source, $taille, $taille);
119
+    $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
120
+
121
+    // si la valeur intermediaire a reussi, on teste la valeur maxi qui est peut etre sous estimee
122
+    // si $GLOBALS['taille_min']==0 (car on est au premier coup)
123
+    if ($GLOBALS['taille_min'] == 0) {
124
+        $taille = $GLOBALS['taille_max'];
125
+        filtrer('image_recadre', $image_source, $taille, $taille);
126
+        $GLOBALS['redirect'] = generer_url_action('tester_taille', "i=$i&arg=$taille-" . $GLOBALS['taille_max']);
127
+    }
128
+    ob_end_clean();
129
+
130
+
131
+    // on est ici, donc pas de plantage
132
+    echo redirige_formulaire($GLOBALS['redirect']);
133 133
 }
Please login to merge, or discard this patch.
ecrire/action/supprimer_rubrique.php 2 patches
Indentation   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('inc/charsets');  # pour le nom de fichier
@@ -29,45 +29,45 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function action_supprimer_rubrique_dist($id_rubrique = null) {
31 31
 
32
-	if (is_null($id_rubrique)) {
33
-		$securiser_action = charger_fonction('securiser_action', 'inc');
34
-		$id_rubrique = $securiser_action();
35
-	}
32
+    if (is_null($id_rubrique)) {
33
+        $securiser_action = charger_fonction('securiser_action', 'inc');
34
+        $id_rubrique = $securiser_action();
35
+    }
36 36
 
37
-	if ((int) $id_rubrique) {
38
-		sql_delete('spip_rubriques', 'id_rubrique=' . (int) $id_rubrique);
39
-		// Les admin restreints qui n'administraient que cette rubrique
40
-		// deviennent redacteurs
41
-		// (il y a sans doute moyen de faire ca avec un having)
37
+    if ((int) $id_rubrique) {
38
+        sql_delete('spip_rubriques', 'id_rubrique=' . (int) $id_rubrique);
39
+        // Les admin restreints qui n'administraient que cette rubrique
40
+        // deviennent redacteurs
41
+        // (il y a sans doute moyen de faire ca avec un having)
42 42
 
43
-		$q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . (int) $id_rubrique);
44
-		while ($r = sql_fetch($q)) {
45
-			$id_auteur = $r['id_auteur'];
46
-			// degrader avant de supprimer la restriction d'admin
47
-			// section critique sur les droits
48
-			$n = sql_countsel(
49
-				'spip_auteurs_liens',
50
-				"objet='rubrique' AND id_objet!=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
51
-			);
52
-			if (!$n) {
53
-				include_spip('action/editer_auteur');
54
-				auteur_modifier($id_auteur, ['statut' => '1comite']);
55
-			}
56
-			sql_delete(
57
-				'spip_auteurs_liens',
58
-				"objet='rubrique' AND id_objet=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
59
-			);
60
-		}
61
-		// menu_rubriques devra recalculer
62
-		effacer_meta('date_calcul_rubriques');
43
+        $q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . (int) $id_rubrique);
44
+        while ($r = sql_fetch($q)) {
45
+            $id_auteur = $r['id_auteur'];
46
+            // degrader avant de supprimer la restriction d'admin
47
+            // section critique sur les droits
48
+            $n = sql_countsel(
49
+                'spip_auteurs_liens',
50
+                "objet='rubrique' AND id_objet!=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
51
+            );
52
+            if (!$n) {
53
+                include_spip('action/editer_auteur');
54
+                auteur_modifier($id_auteur, ['statut' => '1comite']);
55
+            }
56
+            sql_delete(
57
+                'spip_auteurs_liens',
58
+                "objet='rubrique' AND id_objet=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
59
+            );
60
+        }
61
+        // menu_rubriques devra recalculer
62
+        effacer_meta('date_calcul_rubriques');
63 63
 
64
-		// Une rubrique supprimable n'avait pas le statut "publie"
65
-		// donc rien de neuf pour la rubrique parente
66
-		include_spip('inc/rubriques');
67
-		calculer_langues_rubriques();
64
+        // Une rubrique supprimable n'avait pas le statut "publie"
65
+        // donc rien de neuf pour la rubrique parente
66
+        include_spip('inc/rubriques');
67
+        calculer_langues_rubriques();
68 68
 
69
-		// invalider les caches marques de cette rubrique
70
-		include_spip('inc/invalideur');
71
-		suivre_invalideur("id='rubrique/$id_rubrique'");
72
-	}
69
+        // invalider les caches marques de cette rubrique
70
+        include_spip('inc/invalideur');
71
+        suivre_invalideur("id='rubrique/$id_rubrique'");
72
+    }
73 73
 }
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	return;
20 20
 }
21 21
 
22
-include_spip('inc/charsets');  # pour le nom de fichier
22
+include_spip('inc/charsets'); # pour le nom de fichier
23 23
 
24 24
 /**
25 25
  * Effacer une rubrique
@@ -35,19 +35,19 @@  discard block
 block discarded – undo
35 35
 	}
36 36
 
37 37
 	if ((int) $id_rubrique) {
38
-		sql_delete('spip_rubriques', 'id_rubrique=' . (int) $id_rubrique);
38
+		sql_delete('spip_rubriques', 'id_rubrique='.(int) $id_rubrique);
39 39
 		// Les admin restreints qui n'administraient que cette rubrique
40 40
 		// deviennent redacteurs
41 41
 		// (il y a sans doute moyen de faire ca avec un having)
42 42
 
43
-		$q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=" . (int) $id_rubrique);
43
+		$q = sql_select('id_auteur', 'spip_auteurs_liens', "objet='rubrique' AND id_objet=".(int) $id_rubrique);
44 44
 		while ($r = sql_fetch($q)) {
45 45
 			$id_auteur = $r['id_auteur'];
46 46
 			// degrader avant de supprimer la restriction d'admin
47 47
 			// section critique sur les droits
48 48
 			$n = sql_countsel(
49 49
 				'spip_auteurs_liens',
50
-				"objet='rubrique' AND id_objet!=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
50
+				"objet='rubrique' AND id_objet!=".(int) $id_rubrique.' AND id_auteur='.(int) $id_auteur
51 51
 			);
52 52
 			if (!$n) {
53 53
 				include_spip('action/editer_auteur');
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 			}
56 56
 			sql_delete(
57 57
 				'spip_auteurs_liens',
58
-				"objet='rubrique' AND id_objet=" . (int) $id_rubrique . ' AND id_auteur=' . (int) $id_auteur
58
+				"objet='rubrique' AND id_objet=".(int) $id_rubrique.' AND id_auteur='.(int) $id_auteur
59 59
 			);
60 60
 		}
61 61
 		// menu_rubriques devra recalculer
Please login to merge, or discard this patch.
ecrire/action/session.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 		&& $_SERVER['REQUEST_METHOD'] == 'POST'
38 38
 	) {
39 39
 		include_spip('inc/session');
40
-		session_set('session_' . $var, $val = _request('val'));
40
+		session_set('session_'.$var, $val = _request('val'));
41 41
 		#spip_log("autosave:$var:$val",'autosave');
42 42
 	}
43 43
 
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -31,16 +31,16 @@  discard block
 block discarded – undo
31 31
  *   Envoyer en réponse : json contenant toutes les variables publiques de la session
32 32
  **/
33 33
 function action_session_dist() {
34
-	if (
35
-		($var = _request('var'))
36
-		&& preg_match(',^[a-z_0-9-]+$,i', (string) $var)
37
-		&& $_SERVER['REQUEST_METHOD'] == 'POST'
38
-	) {
39
-		include_spip('inc/session');
40
-		session_set('session_' . $var, $val = _request('val'));
41
-		#spip_log("autosave:$var:$val",'autosave');
42
-	}
34
+    if (
35
+        ($var = _request('var'))
36
+        && preg_match(',^[a-z_0-9-]+$,i', (string) $var)
37
+        && $_SERVER['REQUEST_METHOD'] == 'POST'
38
+    ) {
39
+        include_spip('inc/session');
40
+        session_set('session_' . $var, $val = _request('val'));
41
+        #spip_log("autosave:$var:$val",'autosave');
42
+    }
43 43
 
44
-	# TODO: mode lecture de session ; n'afficher que ce qu'il faut
45
-	#echo json_encode($GLOBALS['visiteur_session']);
44
+    # TODO: mode lecture de session ; n'afficher que ce qu'il faut
45
+    #echo json_encode($GLOBALS['visiteur_session']);
46 46
 }
Please login to merge, or discard this patch.
ecrire/action/relancer_inscription.php 1 patch
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -25,22 +25,22 @@  discard block
 block discarded – undo
25 25
  * @return void
26 26
  */
27 27
 function action_relancer_inscription_dist() {
28
-	$securiser_action = charger_fonction('securiser_action', 'inc');
29
-	$id_auteur = $securiser_action();
28
+    $securiser_action = charger_fonction('securiser_action', 'inc');
29
+    $id_auteur = $securiser_action();
30 30
 
31
-	if ((int) $id_auteur && autoriser('relancer', 'inscription')) {
32
-		$auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur");
33
-		if ($auteur['statut'] == 'nouveau') {
34
-			include_spip('action/inscrire_auteur');
35
-			action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]);
36
-		}
37
-	} elseif ($id_auteur === '*' && autoriser('relancer', 'inscription')) {
38
-		$auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'");
39
-		if (is_array($auteurs)) {
40
-			include_spip('action/inscrire_auteur');
41
-			while ($row = array_pop($auteurs)) {
42
-				action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]);
43
-			}
44
-		}
45
-	}
31
+    if ((int) $id_auteur && autoriser('relancer', 'inscription')) {
32
+        $auteur = sql_fetsel('prefs, email, nom, statut', 'spip_auteurs', "id_auteur=$id_auteur");
33
+        if ($auteur['statut'] == 'nouveau') {
34
+            include_spip('action/inscrire_auteur');
35
+            action_inscrire_auteur_dist($auteur['prefs'], $auteur['email'], $auteur['nom'], ['force_nouveau' => true]);
36
+        }
37
+    } elseif ($id_auteur === '*' && autoriser('relancer', 'inscription')) {
38
+        $auteurs = sql_allfetsel('prefs, email, nom', 'spip_auteurs', "statut='nouveau'");
39
+        if (is_array($auteurs)) {
40
+            include_spip('action/inscrire_auteur');
41
+            while ($row = array_pop($auteurs)) {
42
+                action_inscrire_auteur_dist($row['prefs'], $row['email'], $row['nom'], ['force_nouveau' => true]);
43
+            }
44
+        }
45
+    }
46 46
 }
Please login to merge, or discard this patch.
ecrire/urls/page.php 2 patches
Indentation   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 defined('URLS_PAGE_EXEMPLE') || define('URLS_PAGE_EXEMPLE', 'spip.php?article12');
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
  */
30 30
 function urls_page_generer_url_objet_dist(int $id, string $objet, string $args = '', string $ancre = ''): string {
31 31
 
32
-	if ($generer_url_externe = charger_fonction_url($objet, 'defaut')) {
33
-		$url = $generer_url_externe($id, $args, $ancre);
34
-		// une url === null indique "je ne traite pas cette url, appliquez le calcul standard"
35
-		// une url vide est une url vide, ne rien faire de plus
36
-		if (!is_null($url)) {
37
-			return $url;
38
-		}
39
-	}
32
+    if ($generer_url_externe = charger_fonction_url($objet, 'defaut')) {
33
+        $url = $generer_url_externe($id, $args, $ancre);
34
+        // une url === null indique "je ne traite pas cette url, appliquez le calcul standard"
35
+        // une url vide est une url vide, ne rien faire de plus
36
+        if (!is_null($url)) {
37
+            return $url;
38
+        }
39
+    }
40 40
 
41
-	$url = \_debut_urls_page . $objet . \_separateur_urls_page
42
-		. $id . \_terminaison_urls_page;
41
+    $url = \_debut_urls_page . $objet . \_separateur_urls_page
42
+        . $id . \_terminaison_urls_page;
43 43
 
44
-	if ($args) {
45
-		$args = strpos($url, '?') ? "&$args" : "?$args";
46
-	}
44
+    if ($args) {
45
+        $args = strpos($url, '?') ? "&$args" : "?$args";
46
+    }
47 47
 
48
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
48
+    return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
49 49
 }
50 50
 
51 51
 /**
@@ -61,27 +61,27 @@  discard block
 block discarded – undo
61 61
  */
62 62
 function urls_page_decoder_url_dist(string $url, string $entite, array $contexte = []): array {
63 63
 
64
-	// traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
65
-	if ($GLOBALS['profondeur_url'] > 0 && $entite == 'sommaire') {
66
-		return [[], '404'];
67
-	}
64
+    // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23
65
+    if ($GLOBALS['profondeur_url'] > 0 && $entite == 'sommaire') {
66
+        return [[], '404'];
67
+    }
68 68
 
69
-	include_spip('inc/urls');
70
-	$r = nettoyer_url_page($url, $contexte);
71
-	if ($r) {
72
-		array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
-		return $r;
74
-	}
69
+    include_spip('inc/urls');
70
+    $r = nettoyer_url_page($url, $contexte);
71
+    if ($r) {
72
+        array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici
73
+        return $r;
74
+    }
75 75
 
76
-	/*
76
+    /*
77 77
 	 * Le bloc qui suit sert a faciliter les transitions depuis
78 78
 	 * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html'
79 79
 	 * Il est inutile de le recopier si vous personnalisez vos URLs
80 80
 	 * et votre .htaccess
81 81
 	 */
82
-	// Si on est revenu en mode html, mais c'est une ancienne url_propre
83
-	// on ne redirige pas, on assume le nouveau contexte (si possible)
84
-	$url_propre = $url ?? $_SERVER['REDIRECT_url_propre'] ?? $_ENV['url_propre'] ?? '';
85
-	return urls_transition_retrouver_anciennes_url_propres($url_propre, $entite, $contexte);
86
-	/* Fin du bloc compatibilite url-propres */
82
+    // Si on est revenu en mode html, mais c'est une ancienne url_propre
83
+    // on ne redirige pas, on assume le nouveau contexte (si possible)
84
+    $url_propre = $url ?? $_SERVER['REDIRECT_url_propre'] ?? $_ENV['url_propre'] ?? '';
85
+    return urls_transition_retrouver_anciennes_url_propres($url_propre, $entite, $contexte);
86
+    /* Fin du bloc compatibilite url-propres */
87 87
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite
23 23
 define('_separateur_urls_page', '');
24 24
 # on peut indiquer '' si on a installe le .htaccess
25
-define('_debut_urls_page', get_spip_script('./') . '?');
25
+define('_debut_urls_page', get_spip_script('./').'?');
26 26
 #######
27 27
 /**
28 28
  * Generer l'url d'un objet SPIP
@@ -38,14 +38,14 @@  discard block
 block discarded – undo
38 38
 		}
39 39
 	}
40 40
 
41
-	$url = \_debut_urls_page . $objet . \_separateur_urls_page
42
-		. $id . \_terminaison_urls_page;
41
+	$url = \_debut_urls_page.$objet.\_separateur_urls_page
42
+		. $id.\_terminaison_urls_page;
43 43
 
44 44
 	if ($args) {
45 45
 		$args = strpos($url, '?') ? "&$args" : "?$args";
46 46
 	}
47 47
 
48
-	return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : '');
48
+	return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : '');
49 49
 }
50 50
 
51 51
 /**
Please login to merge, or discard this patch.
ecrire/base/connect_sql.php 3 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -87,8 +87,7 @@  discard block
 block discarded – undo
87 87
 			if (!isset($GLOBALS['db_ok'])) {
88 88
 				spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89 89
 			}
90
-		}
91
-		else {
90
+		} else {
92 91
 			spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93 92
 		}
94 93
 		if (!isset($GLOBALS['db_ok'])) {
@@ -453,8 +452,7 @@  discard block
 block discarded – undo
453 452
 					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
454 453
 				) {
455 454
 					$part .= array_shift($textes);
456
-				}
457
-				else {
455
+				} else {
458 456
 					break;
459 457
 				}
460 458
 			}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18 18
 	return;
19 19
 }
20
-require_once _ROOT_RESTREINT . 'base/objets.php';
20
+require_once _ROOT_RESTREINT.'base/objets.php';
21 21
 
22 22
 
23 23
 /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 				defined('_DIR_CONNECT')
63 63
 				&& preg_match('/^[\w\.]*$/', $serveur)
64 64
 			) {
65
-				$f = _DIR_CONNECT . $serveur . '.php';
65
+				$f = _DIR_CONNECT.$serveur.'.php';
66 66
 				if (!is_readable($f) && !$install) {
67 67
 					// chercher une declaration de serveur dans le path
68 68
 					// qui peut servir à des plugins à declarer des connexions à une base sqlite
@@ -110,8 +110,8 @@  discard block
 block discarded – undo
110 110
 	// chargement de la version du jeu de fonctions
111 111
 	// si pas dans le fichier par defaut
112 112
 	$type = $GLOBALS['db_ok']['type'];
113
-	$jeu = 'spip_' . $type . '_functions_' . $version;
114
-	if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
113
+	$jeu = 'spip_'.$type.'_functions_'.$version;
114
+	if (!isset($GLOBALS[$jeu]) && !find_in_path($type.'_'.$version.'.php', 'req/', true)) {
115 115
 		spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116 116
 		// ne plus reessayer
117 117
 		return $GLOBALS['connexions'][$index][$version] = [];
@@ -171,9 +171,9 @@  discard block
 block discarded – undo
171 171
 	$connexion = spip_connect($serveur);
172 172
 	$e = sql_errno($serveur);
173 173
 	$t = ($connexion['type'] ?? 'sql');
174
-	$m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim((string) $connexion['last']);
175
-	$f = $t . $serveur;
176
-	spip_log($m, $f . '.' . _LOG_ERREUR);
174
+	$m = "Erreur $e de $t: ".sql_error($serveur)."\nin ".sql_error_backtrace()."\n".trim((string) $connexion['last']);
175
+	$f = $t.$serveur;
176
+	spip_log($m, $f.'.'._LOG_ERREUR);
177 177
 }
178 178
 
179 179
 /**
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 	// si en cours d'installation ou si db=@test@ on ne pose rien
260 260
 	// car c'est un test de connexion
261 261
 	if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
-		$f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
262
+		$f = _DIR_TMP.$type.'.'.substr(md5($host.$port.$db), 0, 8).'.out';
263 263
 	} elseif ($db == '@test@') {
264 264
 		$db = '';
265 265
 	}
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 	// En cas d'indisponibilite du serveur, eviter de le bombarder
299 299
 	if ($f) {
300 300
 		@touch($f);
301
-		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
301
+		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type.'.'._LOG_HS);
302 302
 	}
303 303
 	return null;
304 304
 }
@@ -395,11 +395,11 @@  discard block
 block discarded – undo
395 395
 	} elseif (is_array($a)) {
396 396
 		return implode(',', array_map('_q', $a));
397 397
 	} elseif (is_scalar($a)) {
398
-		return ("'" . addslashes($a) . "'");
398
+		return ("'".addslashes($a)."'");
399 399
 	} elseif ($a === null) {
400 400
 		return "''";
401 401
 	}
402
-	throw new \RuntimeException('Can’t use _q with ' . gettype($a));
402
+	throw new \RuntimeException('Can’t use _q with '.gettype($a));
403 403
 }
404 404
 
405 405
 /**
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 				$next = reset($textes);
451 451
 				if (
452 452
 					str_starts_with((string) $next, "'")
453
-					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
453
+					&& strpos($query_echappees, $part.$next, $currentpos) === $nextpos
454 454
 				) {
455 455
 					$part .= array_shift($textes);
456 456
 				}
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
 			$parts[$k] = [
463 463
 				'texte' => $part,
464 464
 				'position' => $nextpos,
465
-				'placeholder' => '%' . $k . '$s',
465
+				'placeholder' => '%'.$k.'$s',
466 466
 			];
467 467
 			$currentpos = $nextpos + strlen((string) $part);
468 468
 		}
Please login to merge, or discard this patch.
Indentation   +319 added lines, -319 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
  * @package SPIP\Core\SQL
16 16
  **/
17 17
 if (!defined('_ECRIRE_INC_VERSION')) {
18
-	return;
18
+    return;
19 19
 }
20 20
 require_once _ROOT_RESTREINT . 'base/objets.php';
21 21
 
@@ -41,125 +41,125 @@  discard block
 block discarded – undo
41 41
  **/
42 42
 function spip_connect($serveur = '', $version = '') {
43 43
 
44
-	$serveur = is_string($serveur) ? strtolower($serveur) : '';
45
-	$index = $serveur ?: 0;
46
-	if (!$version) {
47
-		$version = $GLOBALS['spip_sql_version'];
48
-	}
49
-	if (isset($GLOBALS['connexions'][$index][$version])) {
50
-		return $GLOBALS['connexions'][$index];
51
-	}
52
-
53
-	include_spip('base/abstract_sql');
54
-	$install = (_request('exec') == 'install');
55
-
56
-	// Premiere connexion ?
57
-	if (!($old = isset($GLOBALS['connexions'][$index]))) {
58
-		$f = '';
59
-		if ($serveur) {
60
-			// serveur externe et nom de serveur bien ecrit ?
61
-			if (
62
-				defined('_DIR_CONNECT')
63
-				&& preg_match('/^[\w\.]*$/', $serveur)
64
-			) {
65
-				$f = _DIR_CONNECT . $serveur . '.php';
66
-				if (!is_readable($f) && !$install) {
67
-					// chercher une declaration de serveur dans le path
68
-					// qui peut servir à des plugins à declarer des connexions à une base sqlite
69
-					// Ex: sert aux boucles POUR et au plugin-dist dump pour se connecter sur le sqlite du dump
70
-					$f = find_in_path("$serveur.php", 'connect/');
71
-				}
72
-			}
73
-		} else {
74
-			if (defined('_FILE_CONNECT') && _FILE_CONNECT) {
75
-				// init du serveur principal
76
-				$f = _FILE_CONNECT;
77
-			} elseif ($install && defined('_FILE_CONNECT_TMP')) {
78
-				// installation en cours
79
-				$f = _FILE_CONNECT_TMP;
80
-			}
81
-		}
82
-
83
-		unset($GLOBALS['db_ok']);
84
-		unset($GLOBALS['spip_connect_version']);
85
-		if ($f && is_readable($f)) {
86
-			include($f);
87
-			if (!isset($GLOBALS['db_ok'])) {
88
-				spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89
-			}
90
-		}
91
-		else {
92
-			spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93
-		}
94
-		if (!isset($GLOBALS['db_ok'])) {
95
-			// fera mieux la prochaine fois
96
-			if ($install) {
97
-				return false;
98
-			}
99
-			// ne plus reessayer si ce n'est pas l'install
100
-			return $GLOBALS['connexions'][$index] = false;
101
-		}
102
-		$GLOBALS['connexions'][$index] = $GLOBALS['db_ok'];
103
-	}
104
-	// si la connexion a deja ete tentee mais a echoue, le dire!
105
-	if (!$GLOBALS['connexions'][$index]) {
106
-		return false;
107
-	}
108
-
109
-	// la connexion a reussi ou etait deja faite.
110
-	// chargement de la version du jeu de fonctions
111
-	// si pas dans le fichier par defaut
112
-	$type = $GLOBALS['db_ok']['type'];
113
-	$jeu = 'spip_' . $type . '_functions_' . $version;
114
-	if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
115
-		spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116
-		// ne plus reessayer
117
-		return $GLOBALS['connexions'][$index][$version] = [];
118
-	}
119
-	$GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu];
120
-	if ($old) {
121
-		return $GLOBALS['connexions'][$index];
122
-	}
123
-
124
-	$GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0;
125
-
126
-	// initialisation de l'alphabet utilise dans les connexions SQL
127
-	// si l'installation l'a determine.
128
-	// Celui du serveur principal l'impose aux serveurs secondaires
129
-	// s'ils le connaissent
130
-
131
-	if (!$serveur) {
132
-		$charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']);
133
-		if (!$charset) {
134
-			unset($GLOBALS['connexions'][$index]);
135
-			spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT);
136
-
137
-			return false;
138
-		}
139
-	} else {
140
-		if ($GLOBALS['db_ok']['charset']) {
141
-			$charset = $GLOBALS['db_ok']['charset'];
142
-		}
143
-		// spip_meta n'existe pas toujours dans la base
144
-		// C'est le cas d'un dump sqlite par exemple
145
-		elseif (
146
-			$GLOBALS['connexions'][$index]['spip_connect_version']
147
-			&& sql_showtable('spip_meta', true, $serveur)
148
-			&& ($r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur))
149
-		) {
150
-			$charset = $r;
151
-		} else {
152
-			$charset = -1;
153
-		}
154
-	}
155
-	if ($charset != -1) {
156
-		$f = $GLOBALS[$jeu]['set_charset'];
157
-		if (function_exists($f)) {
158
-			$f($charset, $serveur);
159
-		}
160
-	}
161
-
162
-	return $GLOBALS['connexions'][$index];
44
+    $serveur = is_string($serveur) ? strtolower($serveur) : '';
45
+    $index = $serveur ?: 0;
46
+    if (!$version) {
47
+        $version = $GLOBALS['spip_sql_version'];
48
+    }
49
+    if (isset($GLOBALS['connexions'][$index][$version])) {
50
+        return $GLOBALS['connexions'][$index];
51
+    }
52
+
53
+    include_spip('base/abstract_sql');
54
+    $install = (_request('exec') == 'install');
55
+
56
+    // Premiere connexion ?
57
+    if (!($old = isset($GLOBALS['connexions'][$index]))) {
58
+        $f = '';
59
+        if ($serveur) {
60
+            // serveur externe et nom de serveur bien ecrit ?
61
+            if (
62
+                defined('_DIR_CONNECT')
63
+                && preg_match('/^[\w\.]*$/', $serveur)
64
+            ) {
65
+                $f = _DIR_CONNECT . $serveur . '.php';
66
+                if (!is_readable($f) && !$install) {
67
+                    // chercher une declaration de serveur dans le path
68
+                    // qui peut servir à des plugins à declarer des connexions à une base sqlite
69
+                    // Ex: sert aux boucles POUR et au plugin-dist dump pour se connecter sur le sqlite du dump
70
+                    $f = find_in_path("$serveur.php", 'connect/');
71
+                }
72
+            }
73
+        } else {
74
+            if (defined('_FILE_CONNECT') && _FILE_CONNECT) {
75
+                // init du serveur principal
76
+                $f = _FILE_CONNECT;
77
+            } elseif ($install && defined('_FILE_CONNECT_TMP')) {
78
+                // installation en cours
79
+                $f = _FILE_CONNECT_TMP;
80
+            }
81
+        }
82
+
83
+        unset($GLOBALS['db_ok']);
84
+        unset($GLOBALS['spip_connect_version']);
85
+        if ($f && is_readable($f)) {
86
+            include($f);
87
+            if (!isset($GLOBALS['db_ok'])) {
88
+                spip_log("spip_connect: fichier de connexion '$f' OK mais echec connexion au serveur", _LOG_HS);
89
+            }
90
+        }
91
+        else {
92
+            spip_log("spip_connect: fichier de connexion '$f' non trouve, pas de connexion serveur", _LOG_HS);
93
+        }
94
+        if (!isset($GLOBALS['db_ok'])) {
95
+            // fera mieux la prochaine fois
96
+            if ($install) {
97
+                return false;
98
+            }
99
+            // ne plus reessayer si ce n'est pas l'install
100
+            return $GLOBALS['connexions'][$index] = false;
101
+        }
102
+        $GLOBALS['connexions'][$index] = $GLOBALS['db_ok'];
103
+    }
104
+    // si la connexion a deja ete tentee mais a echoue, le dire!
105
+    if (!$GLOBALS['connexions'][$index]) {
106
+        return false;
107
+    }
108
+
109
+    // la connexion a reussi ou etait deja faite.
110
+    // chargement de la version du jeu de fonctions
111
+    // si pas dans le fichier par defaut
112
+    $type = $GLOBALS['db_ok']['type'];
113
+    $jeu = 'spip_' . $type . '_functions_' . $version;
114
+    if (!isset($GLOBALS[$jeu]) && !find_in_path($type . '_' . $version . '.php', 'req/', true)) {
115
+        spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS);
116
+        // ne plus reessayer
117
+        return $GLOBALS['connexions'][$index][$version] = [];
118
+    }
119
+    $GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu];
120
+    if ($old) {
121
+        return $GLOBALS['connexions'][$index];
122
+    }
123
+
124
+    $GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0;
125
+
126
+    // initialisation de l'alphabet utilise dans les connexions SQL
127
+    // si l'installation l'a determine.
128
+    // Celui du serveur principal l'impose aux serveurs secondaires
129
+    // s'ils le connaissent
130
+
131
+    if (!$serveur) {
132
+        $charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']);
133
+        if (!$charset) {
134
+            unset($GLOBALS['connexions'][$index]);
135
+            spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT);
136
+
137
+            return false;
138
+        }
139
+    } else {
140
+        if ($GLOBALS['db_ok']['charset']) {
141
+            $charset = $GLOBALS['db_ok']['charset'];
142
+        }
143
+        // spip_meta n'existe pas toujours dans la base
144
+        // C'est le cas d'un dump sqlite par exemple
145
+        elseif (
146
+            $GLOBALS['connexions'][$index]['spip_connect_version']
147
+            && sql_showtable('spip_meta', true, $serveur)
148
+            && ($r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur))
149
+        ) {
150
+            $charset = $r;
151
+        } else {
152
+            $charset = -1;
153
+        }
154
+    }
155
+    if ($charset != -1) {
156
+        $f = $GLOBALS[$jeu]['set_charset'];
157
+        if (function_exists($f)) {
158
+            $f($charset, $serveur);
159
+        }
160
+    }
161
+
162
+    return $GLOBALS['connexions'][$index];
163 163
 }
164 164
 
165 165
 /**
@@ -168,12 +168,12 @@  discard block
 block discarded – undo
168 168
  * @param string $serveur Nom du connecteur de bdd utilisé
169 169
  **/
170 170
 function spip_sql_erreur($serveur = '') {
171
-	$connexion = spip_connect($serveur);
172
-	$e = sql_errno($serveur);
173
-	$t = ($connexion['type'] ?? 'sql');
174
-	$m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim((string) $connexion['last']);
175
-	$f = $t . $serveur;
176
-	spip_log($m, $f . '.' . _LOG_ERREUR);
171
+    $connexion = spip_connect($serveur);
172
+    $e = sql_errno($serveur);
173
+    $t = ($connexion['type'] ?? 'sql');
174
+    $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim((string) $connexion['last']);
175
+    $f = $t . $serveur;
176
+    spip_log($m, $f . '.' . _LOG_ERREUR);
177 177
 }
178 178
 
179 179
 /**
@@ -195,23 +195,23 @@  discard block
 block discarded – undo
195 195
  *     - array : description de la connexion, si l'instruction sql est indisponible pour cette connexion
196 196
  **/
197 197
 function spip_connect_sql($version, $ins = '', $serveur = '', $continue = false) {
198
-	$desc = spip_connect($serveur, $version);
199
-	if (
200
-		$desc
201
-		&& ($f = ($desc[$version][$ins] ?? ''))
202
-		&& function_exists($f)
203
-	) {
204
-		return $f;
205
-	}
206
-	if ($continue) {
207
-		return $desc;
208
-	}
209
-	if ($ins) {
210
-		spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR);
211
-	}
212
-	include_spip('inc/minipres');
213
-	echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]);
214
-	exit;
198
+    $desc = spip_connect($serveur, $version);
199
+    if (
200
+        $desc
201
+        && ($f = ($desc[$version][$ins] ?? ''))
202
+        && function_exists($f)
203
+    ) {
204
+        return $f;
205
+    }
206
+    if ($continue) {
207
+        return $desc;
208
+    }
209
+    if ($ins) {
210
+        spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR);
211
+    }
212
+    include_spip('inc/minipres');
213
+    echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]);
214
+    exit;
215 215
 }
216 216
 
217 217
 /**
@@ -237,70 +237,70 @@  discard block
 block discarded – undo
237 237
  * @return array|null Description de la connexion
238 238
  */
239 239
 function spip_connect_db(
240
-	$host,
241
-	$port,
242
-	$login,
243
-	#[\SensitiveParameter] $pass,
244
-	$db = '',
245
-	$type = 'mysql',
246
-	$prefixe = '',
247
-	$auth = '',
248
-	$charset = ''
240
+    $host,
241
+    $port,
242
+    $login,
243
+    #[\SensitiveParameter] $pass,
244
+    $db = '',
245
+    $type = 'mysql',
246
+    $prefixe = '',
247
+    $auth = '',
248
+    $charset = ''
249 249
 ) {
250
-	// temps avant nouvelle tentative de connexion
251
-	// suite a une connection echouee
252
-	if (!defined('_CONNECT_RETRY_DELAY')) {
253
-		define('_CONNECT_RETRY_DELAY', 30);
254
-	}
255
-
256
-	$f = '';
257
-	// un fichier de identifiant par combinaison (type,host,port,db)
258
-	// pour ne pas declarer tout indisponible d'un coup
259
-	// si en cours d'installation ou si db=@test@ on ne pose rien
260
-	// car c'est un test de connexion
261
-	if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
-		$f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
263
-	} elseif ($db == '@test@') {
264
-		$db = '';
265
-	}
266
-
267
-	if (
268
-		$f
269
-		&& @file_exists($f)
270
-		&& (time() - @filemtime($f) < _CONNECT_RETRY_DELAY)
271
-	) {
272
-		spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS);
273
-
274
-		return null;
275
-	}
276
-
277
-	if (!$prefixe) {
278
-		$prefixe = $GLOBALS['table_prefix'] ?? $db;
279
-	}
280
-	$h = charger_fonction($type, 'req', true);
281
-	if (!$h) {
282
-		spip_log("les requetes $type ne sont pas fournies", _LOG_HS);
283
-
284
-		return null;
285
-	}
286
-	if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) {
287
-		if (!is_array($auth)) {
288
-			// compatibilite version 0.7 initiale
289
-			$g['ldap'] = $auth;
290
-			$auth = ['ldap' => $auth];
291
-		}
292
-		$g['authentification'] = $auth;
293
-		$g['type'] = $type;
294
-		$g['charset'] = $charset;
295
-
296
-		return $GLOBALS['db_ok'] = $g;
297
-	}
298
-	// En cas d'indisponibilite du serveur, eviter de le bombarder
299
-	if ($f) {
300
-		@touch($f);
301
-		spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
302
-	}
303
-	return null;
250
+    // temps avant nouvelle tentative de connexion
251
+    // suite a une connection echouee
252
+    if (!defined('_CONNECT_RETRY_DELAY')) {
253
+        define('_CONNECT_RETRY_DELAY', 30);
254
+    }
255
+
256
+    $f = '';
257
+    // un fichier de identifiant par combinaison (type,host,port,db)
258
+    // pour ne pas declarer tout indisponible d'un coup
259
+    // si en cours d'installation ou si db=@test@ on ne pose rien
260
+    // car c'est un test de connexion
261
+    if (!defined('_ECRIRE_INSTALL') && $db !== '@test@') {
262
+        $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out';
263
+    } elseif ($db == '@test@') {
264
+        $db = '';
265
+    }
266
+
267
+    if (
268
+        $f
269
+        && @file_exists($f)
270
+        && (time() - @filemtime($f) < _CONNECT_RETRY_DELAY)
271
+    ) {
272
+        spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS);
273
+
274
+        return null;
275
+    }
276
+
277
+    if (!$prefixe) {
278
+        $prefixe = $GLOBALS['table_prefix'] ?? $db;
279
+    }
280
+    $h = charger_fonction($type, 'req', true);
281
+    if (!$h) {
282
+        spip_log("les requetes $type ne sont pas fournies", _LOG_HS);
283
+
284
+        return null;
285
+    }
286
+    if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) {
287
+        if (!is_array($auth)) {
288
+            // compatibilite version 0.7 initiale
289
+            $g['ldap'] = $auth;
290
+            $auth = ['ldap' => $auth];
291
+        }
292
+        $g['authentification'] = $auth;
293
+        $g['type'] = $type;
294
+        $g['charset'] = $charset;
295
+
296
+        return $GLOBALS['db_ok'] = $g;
297
+    }
298
+    // En cas d'indisponibilite du serveur, eviter de le bombarder
299
+    if ($f) {
300
+        @touch($f);
301
+        spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS);
302
+    }
303
+    return null;
304 304
 }
305 305
 
306 306
 
@@ -332,32 +332,32 @@  discard block
 block discarded – undo
332 332
  *     - nom du charset sinon
333 333
  **/
334 334
 function spip_connect_main($connexion, $charset_sql_connexion = '') {
335
-	if ($GLOBALS['spip_connect_version'] < 0.1 && _DIR_RESTREINT) {
336
-		include_spip('inc/headers');
337
-		redirige_url_ecrire('upgrade', 'reinstall=oui');
338
-	}
339
-
340
-	if (!($f = $connexion['select'])) {
341
-		return false;
342
-	}
343
-	// si le charset est fourni, l'utiliser
344
-	if ($charset_sql_connexion) {
345
-		return $charset_sql_connexion;
346
-	}
347
-	// sinon on regarde la table spip_meta
348
-	// en cas d'erreur select retourne la requette (is_string=true donc)
349
-	if (
350
-		!($r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'"))
351
-		|| is_string($r)
352
-	) {
353
-		return false;
354
-	}
355
-	if (!($f = $connexion['fetch'])) {
356
-		return false;
357
-	}
358
-	$r = $f($r);
359
-
360
-	return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1;
335
+    if ($GLOBALS['spip_connect_version'] < 0.1 && _DIR_RESTREINT) {
336
+        include_spip('inc/headers');
337
+        redirige_url_ecrire('upgrade', 'reinstall=oui');
338
+    }
339
+
340
+    if (!($f = $connexion['select'])) {
341
+        return false;
342
+    }
343
+    // si le charset est fourni, l'utiliser
344
+    if ($charset_sql_connexion) {
345
+        return $charset_sql_connexion;
346
+    }
347
+    // sinon on regarde la table spip_meta
348
+    // en cas d'erreur select retourne la requette (is_string=true donc)
349
+    if (
350
+        !($r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'"))
351
+        || is_string($r)
352
+    ) {
353
+        return false;
354
+    }
355
+    if (!($f = $connexion['fetch'])) {
356
+        return false;
357
+    }
358
+    $r = $f($r);
359
+
360
+    return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1;
361 361
 }
362 362
 
363 363
 /**
@@ -373,16 +373,16 @@  discard block
 block discarded – undo
373 373
  * @return string Valeur échappée.
374 374
  **/
375 375
 function _q($a): string {
376
-	if (is_numeric($a)) {
377
-		return (string) $a;
378
-	} elseif (is_array($a)) {
379
-		return implode(',', array_map('_q', $a));
380
-	} elseif (is_scalar($a)) {
381
-		return ("'" . addslashes($a) . "'");
382
-	} elseif ($a === null) {
383
-		return "''";
384
-	}
385
-	throw new \RuntimeException('Can’t use _q with ' . gettype($a));
376
+    if (is_numeric($a)) {
377
+        return (string) $a;
378
+    } elseif (is_array($a)) {
379
+        return implode(',', array_map('_q', $a));
380
+    } elseif (is_scalar($a)) {
381
+        return ("'" . addslashes($a) . "'");
382
+    } elseif ($a === null) {
383
+        return "''";
384
+    }
385
+    throw new \RuntimeException('Can’t use _q with ' . gettype($a));
386 386
 }
387 387
 
388 388
 /**
@@ -398,75 +398,75 @@  discard block
 block discarded – undo
398 398
  * @return array
399 399
  */
400 400
 function query_echappe_textes($query, $uniqid = null) {
401
-	static $codeEchappements = null;
402
-	if (is_null($codeEchappements) || $uniqid) {
403
-		if (is_null($uniqid)) {
404
-			$uniqid = uniqid();
405
-		}
406
-		$uniqid = substr(md5((string) $uniqid), 0, 4);
407
-		$codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"];
408
-	}
409
-	if ($query === null) {
410
-		return $codeEchappements;
411
-	}
412
-
413
-	// si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien
414
-	// ce n'est pas un cas legitime
415
-	foreach ($codeEchappements as $codeEchappement) {
416
-		if (str_contains($query, (string) $codeEchappement)) {
417
-			return [$query, []];
418
-		}
419
-	}
420
-
421
-	$query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query);
422
-	if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) {
423
-		$textes = reset($textes);
424
-
425
-		$parts = [];
426
-		$currentpos = 0;
427
-		$k = 0;
428
-		while (count($textes)) {
429
-			$part = array_shift($textes);
430
-			$nextpos = strpos($query_echappees, (string) $part, $currentpos);
431
-			// si besoin recoller ensemble les doubles '' de sqlite (echappement des ')
432
-			while (count($textes) && str_ends_with((string) $part, "'")) {
433
-				$next = reset($textes);
434
-				if (
435
-					str_starts_with((string) $next, "'")
436
-					&& strpos($query_echappees, $part . $next, $currentpos) === $nextpos
437
-				) {
438
-					$part .= array_shift($textes);
439
-				}
440
-				else {
441
-					break;
442
-				}
443
-			}
444
-			$k++;
445
-			$parts[$k] = [
446
-				'texte' => $part,
447
-				'position' => $nextpos,
448
-				'placeholder' => '%' . $k . '$s',
449
-			];
450
-			$currentpos = $nextpos + strlen((string) $part);
451
-		}
452
-
453
-		// et on replace les parts une par une en commencant par la fin
454
-		while ($k > 0) {
455
-			$query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen((string) $parts[$k]['texte']));
456
-			$k--;
457
-		}
458
-		$textes = array_column($parts, 'texte');
459
-	} else {
460
-		$textes = [];
461
-	}
462
-
463
-	// si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux
464
-	// dans le doute on ne touche a rien
465
-	if (strpbrk($query_echappees, "'\"") !== false) {
466
-		return [$query, []];
467
-	}
468
-
469
-	return [$query_echappees, $textes];
401
+    static $codeEchappements = null;
402
+    if (is_null($codeEchappements) || $uniqid) {
403
+        if (is_null($uniqid)) {
404
+            $uniqid = uniqid();
405
+        }
406
+        $uniqid = substr(md5((string) $uniqid), 0, 4);
407
+        $codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"];
408
+    }
409
+    if ($query === null) {
410
+        return $codeEchappements;
411
+    }
412
+
413
+    // si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien
414
+    // ce n'est pas un cas legitime
415
+    foreach ($codeEchappements as $codeEchappement) {
416
+        if (str_contains($query, (string) $codeEchappement)) {
417
+            return [$query, []];
418
+        }
419
+    }
420
+
421
+    $query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query);
422
+    if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) {
423
+        $textes = reset($textes);
424
+
425
+        $parts = [];
426
+        $currentpos = 0;
427
+        $k = 0;
428
+        while (count($textes)) {
429
+            $part = array_shift($textes);
430
+            $nextpos = strpos($query_echappees, (string) $part, $currentpos);
431
+            // si besoin recoller ensemble les doubles '' de sqlite (echappement des ')
432
+            while (count($textes) && str_ends_with((string) $part, "'")) {
433
+                $next = reset($textes);
434
+                if (
435
+                    str_starts_with((string) $next, "'")
436
+                    && strpos($query_echappees, $part . $next, $currentpos) === $nextpos
437
+                ) {
438
+                    $part .= array_shift($textes);
439
+                }
440
+                else {
441
+                    break;
442
+                }
443
+            }
444
+            $k++;
445
+            $parts[$k] = [
446
+                'texte' => $part,
447
+                'position' => $nextpos,
448
+                'placeholder' => '%' . $k . '$s',
449
+            ];
450
+            $currentpos = $nextpos + strlen((string) $part);
451
+        }
452
+
453
+        // et on replace les parts une par une en commencant par la fin
454
+        while ($k > 0) {
455
+            $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen((string) $parts[$k]['texte']));
456
+            $k--;
457
+        }
458
+        $textes = array_column($parts, 'texte');
459
+    } else {
460
+        $textes = [];
461
+    }
462
+
463
+    // si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux
464
+    // dans le doute on ne touche a rien
465
+    if (strpbrk($query_echappees, "'\"") !== false) {
466
+        return [$query, []];
467
+    }
468
+
469
+    return [$query_echappees, $textes];
470 470
 }
471 471
 
472 472
 /**
@@ -480,14 +480,14 @@  discard block
 block discarded – undo
480 480
  * @return string
481 481
  */
482 482
 function query_reinjecte_textes($query, $textes) {
483
-	// recuperer les codes echappements
484
-	$codeEchappements = query_echappe_textes(null);
483
+    // recuperer les codes echappements
484
+    $codeEchappements = query_echappe_textes(null);
485 485
 
486
-	if (!empty($textes)) {
487
-		$query = sprintf($query, ...$textes);
488
-	}
486
+    if (!empty($textes)) {
487
+        $query = sprintf($query, ...$textes);
488
+    }
489 489
 
490
-	return str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query);
490
+    return str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query);
491 491
 }
492 492
 
493 493
 
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
  **/
507 507
 function spip_query($query, $serveur = '') {
508 508
 
509
-	$f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true);
509
+    $f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true);
510 510
 
511
-	return function_exists($f) ? $f($query, $serveur) : false;
511
+    return function_exists($f) ? $f($query, $serveur) : false;
512 512
 }
Please login to merge, or discard this patch.
ecrire/balise/id_logo_.php 2 patches
Indentation   +51 added lines, -51 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 
@@ -48,38 +48,38 @@  discard block
 block discarded – undo
48 48
  */
49 49
 function balise_ID_LOGO__dist($p) {
50 50
 
51
-	preg_match(',^ID_LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
52
-	$type = strtolower($regs[1]);
53
-	$suite_logo = $regs[2];
54
-
55
-	// cas de #ID_LOGO_SITE_SPIP
56
-	if ($type == 'site_spip') {
57
-		$type = 'site';
58
-		$_id_objet = "\"'0'\"";
59
-	}
60
-
61
-	$id_objet = id_table_objet($type);
62
-	if (!isset($_id_objet)) {
63
-		$_id_objet = champ_sql($id_objet, $p);
64
-	}
65
-
66
-	$connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
67
-	if ($type == 'document') {
68
-		$qconnect = _q($connect);
69
-		$doc = "quete_document($_id_objet, $qconnect)";
70
-		$code = "table_valeur($doc, 'id_vignette')";
71
-	} elseif ($connect) {
72
-		$code = "''";
73
-		spip_log('Les logos distants ne sont pas prevus');
74
-	} else {
75
-		$champ_logo = 'id';
76
-		$code = generer_code_logo($id_objet, $_id_objet, $type, '', "''", $p, $suite_logo, $champ_logo);
77
-	}
78
-
79
-	$p->code = $code;
80
-	$p->interdire_scripts = false;
81
-
82
-	return $p;
51
+    preg_match(',^ID_LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs);
52
+    $type = strtolower($regs[1]);
53
+    $suite_logo = $regs[2];
54
+
55
+    // cas de #ID_LOGO_SITE_SPIP
56
+    if ($type == 'site_spip') {
57
+        $type = 'site';
58
+        $_id_objet = "\"'0'\"";
59
+    }
60
+
61
+    $id_objet = id_table_objet($type);
62
+    if (!isset($_id_objet)) {
63
+        $_id_objet = champ_sql($id_objet, $p);
64
+    }
65
+
66
+    $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : '';
67
+    if ($type == 'document') {
68
+        $qconnect = _q($connect);
69
+        $doc = "quete_document($_id_objet, $qconnect)";
70
+        $code = "table_valeur($doc, 'id_vignette')";
71
+    } elseif ($connect) {
72
+        $code = "''";
73
+        spip_log('Les logos distants ne sont pas prevus');
74
+    } else {
75
+        $champ_logo = 'id';
76
+        $code = generer_code_logo($id_objet, $_id_objet, $type, '', "''", $p, $suite_logo, $champ_logo);
77
+    }
78
+
79
+    $p->code = $code;
80
+    $p->interdire_scripts = false;
81
+
82
+    return $p;
83 83
 }
84 84
 
85 85
 /**
@@ -108,28 +108,28 @@  discard block
 block discarded – undo
108 108
  *     Code compilé retournant le chemin du logo ou le code HTML du logo.
109 109
  **/
110 110
 function generer_code_logo($id_objet, $_id_objet, $type, $align, $_lien, $p, $suite, string $champ = ''): string {
111
-	$onoff = 'ON';
112
-	$_id_rubrique = "''";
111
+    $onoff = 'ON';
112
+    $_id_rubrique = "''";
113 113
 
114
-	if ($type === 'rubrique') {
115
-		$_id_rubrique = "quete_parent($_id_objet)";
116
-	}
114
+    if ($type === 'rubrique') {
115
+        $_id_rubrique = "quete_parent($_id_objet)";
116
+    }
117 117
 
118
-	if ($suite === '_SURVOL') {
119
-		$onoff = 'off';
120
-	} elseif ($suite === '_NORMAL') {
121
-		$onoff = 'on';
122
-	} elseif ($suite === '_RUBRIQUE') {
123
-		$_id_rubrique = champ_sql('id_rubrique', $p);
124
-	}
118
+    if ($suite === '_SURVOL') {
119
+        $onoff = 'off';
120
+    } elseif ($suite === '_NORMAL') {
121
+        $onoff = 'on';
122
+    } elseif ($suite === '_RUBRIQUE') {
123
+        $_id_rubrique = champ_sql('id_rubrique', $p);
124
+    }
125 125
 
126
-	$code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
126
+    $code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
127 127
 
128
-	if ($champ) {
129
-		return "table_valeur($code, '" . addslashes($champ) . "')";
130
-	}
128
+    if ($champ) {
129
+        return "table_valeur($code, '" . addslashes($champ) . "')";
130
+    }
131 131
 
132
-	$align = preg_replace(',\W,', '', $align);
132
+    $align = preg_replace(',\W,', '', $align);
133 133
 
134
-	return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
134
+    return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
135 135
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,10 +126,10 @@
 block discarded – undo
126 126
 	$code = "quete_logo('$id_objet', '$onoff', $_id_objet, $_id_rubrique)";
127 127
 
128 128
 	if ($champ) {
129
-		return "table_valeur($code, '" . addslashes($champ) . "')";
129
+		return "table_valeur($code, '".addslashes($champ)."')";
130 130
 	}
131 131
 
132 132
 	$align = preg_replace(',\W,', '', $align);
133 133
 
134
-	return "quete_html_logo($code, '$align', " . ($_lien ?: "''") . ')';
134
+	return "quete_html_logo($code, '$align', ".($_lien ?: "''").')';
135 135
 }
Please login to merge, or discard this patch.
ecrire/balise/formulaire_inscription.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  **/
17 17
 
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 include_spip('base/abstract_sql');
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  *     Pile complétée du code compilé
44 44
  **/
45 45
 function balise_FORMULAIRE_INSCRIPTION($p) {
46
-	return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', []);
46
+    return calculer_balise_dynamique($p, 'FORMULAIRE_INSCRIPTION', []);
47 47
 }
48 48
 
49 49
 /**
@@ -73,19 +73,19 @@  discard block
 block discarded – undo
73 73
  *   - chaîne vide sinon.
74 74
  */
75 75
 function balise_FORMULAIRE_INSCRIPTION_stat($args, $context_compil) {
76
-	[$mode, $id_ou_options, $retour] = array_pad($args, 3, null);
76
+    [$mode, $id_ou_options, $retour] = array_pad($args, 3, null);
77 77
 
78
-	// Compatibilité avec l'ancien param "id" dans les deux sens
79
-	if (!is_array($id_ou_options)) {
80
-		$options = ['id' => (int) $id_ou_options];
81
-		$id = $options['id'];
82
-	}else {
83
-		$options = $id_ou_options;
84
-		$id = (int) ($id_ou_options['id'] ?? 0);
85
-	}
78
+    // Compatibilité avec l'ancien param "id" dans les deux sens
79
+    if (!is_array($id_ou_options)) {
80
+        $options = ['id' => (int) $id_ou_options];
81
+        $id = $options['id'];
82
+    }else {
83
+        $options = $id_ou_options;
84
+        $id = (int) ($id_ou_options['id'] ?? 0);
85
+    }
86 86
 
87
-	include_spip('action/inscrire_auteur');
88
-	$mode = tester_statut_inscription($mode, $id);
87
+    include_spip('action/inscrire_auteur');
88
+    $mode = tester_statut_inscription($mode, $id);
89 89
 
90
-	return $mode ? [$mode, $options, $retour] : '';
90
+    return $mode ? [$mode, $options, $retour] : '';
91 91
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 	if (!is_array($id_ou_options)) {
80 80
 		$options = ['id' => (int) $id_ou_options];
81 81
 		$id = $options['id'];
82
-	}else {
82
+	} else {
83 83
 		$options = $id_ou_options;
84 84
 		$id = (int) ($id_ou_options['id'] ?? 0);
85 85
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 	if (!is_array($id_ou_options)) {
80 80
 		$options = ['id' => (int) $id_ou_options];
81 81
 		$id = $options['id'];
82
-	}else {
82
+	} else {
83 83
 		$options = $id_ou_options;
84 84
 		$id = (int) ($id_ou_options['id'] ?? 0);
85 85
 	}
Please login to merge, or discard this patch.
ecrire/xml/sax.php 2 patches
Indentation   +244 added lines, -244 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 \***************************************************************************/
11 11
 
12 12
 if (!defined('_ECRIRE_INC_VERSION')) {
13
-	return;
13
+    return;
14 14
 }
15 15
 
16 16
 include_spip('inc/charsets');
@@ -23,215 +23,215 @@  discard block
 block discarded – undo
23 23
  * @return string
24 24
  */
25 25
 function xml_entites_html($texte) {
26
-	if (!is_string($texte) || !$texte || strpbrk($texte, "&\"'<>") == false) {
27
-		return $texte;
28
-	}
26
+    if (!is_string($texte) || !$texte || strpbrk($texte, "&\"'<>") == false) {
27
+        return $texte;
28
+    }
29 29
 
30
-	if (!function_exists('spip_htmlspecialchars')) {
31
-		include_spip('inc/filtres_mini');
32
-	}
30
+    if (!function_exists('spip_htmlspecialchars')) {
31
+        include_spip('inc/filtres_mini');
32
+    }
33 33
 
34
-	return spip_htmlspecialchars($texte, ENT_QUOTES);
34
+    return spip_htmlspecialchars($texte, ENT_QUOTES);
35 35
 }
36 36
 
37 37
 function xml_debutElement($phraseur, $name, $attrs) {
38
-	$depth = $phraseur->depth;
39
-
40
-	$t = $phraseur->ouvrant[$depth] ?? ' ';
41
-	// espace initial signifie: deja integree au resultat
42
-	if ($t[0] != ' ') {
43
-		$phraseur->res .= '<' . $t . '>';
44
-		$phraseur->ouvrant[$depth] = ' ' . $t;
45
-	}
46
-	$t = $phraseur->contenu[$depth];
47
-	// n'indenter que s'il y a un separateur avant
48
-	$phraseur->res .= preg_replace("/[\n\t ]+$/", "\n$depth", $t);
49
-	$phraseur->contenu[$depth] = '';
50
-	$att = '';
51
-	$sep = ' ';
52
-	foreach ($attrs as $k => $v) {
53
-		$delim = str_contains($v, "'") ? '"' : "'";
54
-		$val = xml_entites_html($v);
55
-		$att .= $sep . $k . '=' . $delim
56
-			. ($delim !== '"' ? str_replace('&quot;', '"', $val) : $val)
57
-			. $delim;
58
-		$sep = "\n $depth";
59
-	}
60
-	$phraseur->depth .= '  ';
61
-	$phraseur->contenu[$phraseur->depth] = '';
62
-	$phraseur->ouvrant[$phraseur->depth] = $name . $att;
63
-	$phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax);
38
+    $depth = $phraseur->depth;
39
+
40
+    $t = $phraseur->ouvrant[$depth] ?? ' ';
41
+    // espace initial signifie: deja integree au resultat
42
+    if ($t[0] != ' ') {
43
+        $phraseur->res .= '<' . $t . '>';
44
+        $phraseur->ouvrant[$depth] = ' ' . $t;
45
+    }
46
+    $t = $phraseur->contenu[$depth];
47
+    // n'indenter que s'il y a un separateur avant
48
+    $phraseur->res .= preg_replace("/[\n\t ]+$/", "\n$depth", $t);
49
+    $phraseur->contenu[$depth] = '';
50
+    $att = '';
51
+    $sep = ' ';
52
+    foreach ($attrs as $k => $v) {
53
+        $delim = str_contains($v, "'") ? '"' : "'";
54
+        $val = xml_entites_html($v);
55
+        $att .= $sep . $k . '=' . $delim
56
+            . ($delim !== '"' ? str_replace('&quot;', '"', $val) : $val)
57
+            . $delim;
58
+        $sep = "\n $depth";
59
+    }
60
+    $phraseur->depth .= '  ';
61
+    $phraseur->contenu[$phraseur->depth] = '';
62
+    $phraseur->ouvrant[$phraseur->depth] = $name . $att;
63
+    $phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax);
64 64
 }
65 65
 
66 66
 function xml_finElement($phraseur, $name, $fusion_bal = false) {
67
-	$ouv = $phraseur->ouvrant[$phraseur->depth];
68
-
69
-	if ($ouv[0] != ' ') {
70
-		$phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv;
71
-	} else {
72
-		$ouv = '';
73
-	}
74
-	$t = $phraseur->contenu[$phraseur->depth];
75
-	$phraseur->depth = substr($phraseur->depth, 2);
76
-	$t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t);
77
-
78
-	// fusion <balise></balise> en <balise />.
79
-	// ATTENTION,  certains clients http croient que fusion ==> pas d'atttributs
80
-	// en particulier pour les balises Script et A.
81
-	// en presence d'attributs ne le faire que si la DTD est dispo et d'accord
82
-	// (param fusion_bal)
83
-
84
-	if ($t || ($ouv != $name && !$fusion_bal)) {
85
-		$phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>';
86
-	} else {
87
-		$phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>'));
88
-	}
67
+    $ouv = $phraseur->ouvrant[$phraseur->depth];
68
+
69
+    if ($ouv[0] != ' ') {
70
+        $phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv;
71
+    } else {
72
+        $ouv = '';
73
+    }
74
+    $t = $phraseur->contenu[$phraseur->depth];
75
+    $phraseur->depth = substr($phraseur->depth, 2);
76
+    $t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t);
77
+
78
+    // fusion <balise></balise> en <balise />.
79
+    // ATTENTION,  certains clients http croient que fusion ==> pas d'atttributs
80
+    // en particulier pour les balises Script et A.
81
+    // en presence d'attributs ne le faire que si la DTD est dispo et d'accord
82
+    // (param fusion_bal)
83
+
84
+    if ($t || ($ouv != $name && !$fusion_bal)) {
85
+        $phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>';
86
+    } else {
87
+        $phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>'));
88
+    }
89 89
 }
90 90
 
91 91
 function xml_textElement($phraseur, $data) {
92
-	$depth = $phraseur->depth;
93
-	$phraseur->contenu[$depth] .= preg_match('/^script/', $phraseur->ouvrant[$depth])
94
-		? $data
95
-		: xml_entites_html($data);
92
+    $depth = $phraseur->depth;
93
+    $phraseur->contenu[$depth] .= preg_match('/^script/', $phraseur->ouvrant[$depth])
94
+        ? $data
95
+        : xml_entites_html($data);
96 96
 }
97 97
 
98 98
 function xml_piElement($phraseur, $target, $data) {
99
-	$depth = $phraseur->depth;
100
-
101
-	if (strtolower($target) != 'php') {
102
-		$phraseur->contenu[$depth] .= $data;
103
-	} else {
104
-		ob_start();
105
-		eval($data);
106
-		$data = ob_get_contents();
107
-		ob_end_clean();
108
-		$phraseur->contenu[$depth] .= $data;
109
-	}
99
+    $depth = $phraseur->depth;
100
+
101
+    if (strtolower($target) != 'php') {
102
+        $phraseur->contenu[$depth] .= $data;
103
+    } else {
104
+        ob_start();
105
+        eval($data);
106
+        $data = ob_get_contents();
107
+        ob_end_clean();
108
+        $phraseur->contenu[$depth] .= $data;
109
+    }
110 110
 }
111 111
 
112 112
 
113 113
 function xml_defaultElement($phraseur, $data) {
114
-	$depth = $phraseur->depth;
114
+    $depth = $phraseur->depth;
115 115
 
116
-	if (!isset($phraseur->contenu[$depth])) {
117
-		$phraseur->contenu[$depth] = '';
118
-	}
119
-	$phraseur->contenu[$depth] .= $data;
116
+    if (!isset($phraseur->contenu[$depth])) {
117
+        $phraseur->contenu[$depth] = '';
118
+    }
119
+    $phraseur->contenu[$depth] .= $data;
120 120
 }
121 121
 
122 122
 function xml_parsestring($phraseur, $data) {
123
-	$phraseur->contenu[$phraseur->depth] = '';
124
-
125
-	if (!xml_parse($phraseur->sax, $data, true)) {
126
-		coordonnees_erreur(
127
-			$phraseur,
128
-			xml_error_string(xml_get_error_code($phraseur->sax))
129
-			. "<br />\n" .
130
-			($phraseur->depth
131
-				? '(' .
132
-					_T('erreur_balise_non_fermee') .
133
-					' <tt>' .
134
-					$phraseur->ouvrant[$phraseur->depth] .
135
-					'</tt> ' .
136
-					_T('ligne') .
137
-					' ' .
138
-					$phraseur->reperes[$phraseur->depth] .
139
-					") <br />\n"
140
-				: '')
141
-		);
142
-	}
123
+    $phraseur->contenu[$phraseur->depth] = '';
124
+
125
+    if (!xml_parse($phraseur->sax, $data, true)) {
126
+        coordonnees_erreur(
127
+            $phraseur,
128
+            xml_error_string(xml_get_error_code($phraseur->sax))
129
+            . "<br />\n" .
130
+            ($phraseur->depth
131
+                ? '(' .
132
+                    _T('erreur_balise_non_fermee') .
133
+                    ' <tt>' .
134
+                    $phraseur->ouvrant[$phraseur->depth] .
135
+                    '</tt> ' .
136
+                    _T('ligne') .
137
+                    ' ' .
138
+                    $phraseur->reperes[$phraseur->depth] .
139
+                    ") <br />\n"
140
+                : '')
141
+        );
142
+    }
143 143
 }
144 144
 
145 145
 function coordonnees_erreur($phraseur, $msg) {
146
-	$entete_length = substr_count($phraseur->entete, "\n");
147
-	$phraseur->err[] = [
148
-		$msg,
149
-		xml_get_current_line_number($phraseur->sax) + $entete_length,
150
-		xml_get_current_column_number($phraseur->sax)
151
-	];
146
+    $entete_length = substr_count($phraseur->entete, "\n");
147
+    $phraseur->err[] = [
148
+        $msg,
149
+        xml_get_current_line_number($phraseur->sax) + $entete_length,
150
+        xml_get_current_column_number($phraseur->sax)
151
+    ];
152 152
 }
153 153
 
154 154
 function xml_sax_dist($page, $apply = false, $phraseur = null, $doctype = '', $charset = null) {
155
-	if (is_null($charset)) {
156
-		$charset = $GLOBALS['meta']['charset'];
157
-	}
158
-	if ($apply) {
159
-		ob_start();
160
-		$r = is_array($apply) ? $page(...$apply) : $page();
161
-		$page = ob_get_contents();
162
-		ob_end_clean();
163
-		// fonction sans aucun "echo", ca doit etre le resultat
164
-		if (!$page) {
165
-			$page = $r;
166
-		}
167
-	}
168
-
169
-	if (!$page) {
170
-		return '';
171
-	}
172
-	// charger la DTD et transcoder les entites,
173
-	// et escamoter le doctype que sax mange en php5 mais pas en  php4
174
-	if (!$doctype) {
175
-		if (!$r = analyser_doctype($page)) {
176
-			$page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE
177
-				. preg_replace(_REGEXP_DOCTYPE, '', $page);
178
-			$r = analyser_doctype($page);
179
-		}
180
-		[$entete, $avail, $grammaire, $rotlvl] = array_pad($r, 4, null);
181
-		$page = substr($page, strlen($entete));
182
-	} else {
183
-		$avail = 'SYSTEM';
184
-		$grammaire = $doctype;
185
-		$rotlvl = basename($grammaire);
186
-	}
187
-
188
-	include_spip('xml/analyser_dtd');
189
-	$dtc = charger_dtd($grammaire, $avail, $rotlvl);
190
-	$page = sax_bug($page, $dtc, $charset);
191
-
192
-	// compatibilite Tidy espace public
193
-	if (!$phraseur) {
194
-		$indenter_xml = charger_fonction('indenter', 'xml');
195
-
196
-		return $indenter_xml($page, $apply);
197
-	}
198
-
199
-	$xml_parser = xml_parser_create($charset);
200
-
201
-	xml_set_element_handler(
202
-		$xml_parser,
203
-		[$phraseur, 'debutElement'],
204
-		[$phraseur, 'finElement']
205
-	);
206
-
207
-	xml_set_character_data_handler(
208
-		$xml_parser,
209
-		[$phraseur, 'textElement']
210
-	);
211
-
212
-	xml_set_processing_instruction_handler(
213
-		$xml_parser,
214
-		[$phraseur, 'piElement']
215
-	);
216
-
217
-	xml_set_default_handler(
218
-		$xml_parser,
219
-		[$phraseur, 'defaultElement']
220
-	);
221
-
222
-	xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
223
-
224
-	$phraseur->sax = $xml_parser;
225
-	if (isset($entete)) {
226
-		$phraseur->entete = $entete;
227
-	}
228
-	$phraseur->page = $page;
229
-	$phraseur->dtc = $dtc;
230
-	$phraseur->phraserTout($xml_parser, $page);
231
-	xml_parser_free($xml_parser);
232
-	$phraseur->sax = '';
233
-
234
-	return $phraseur;
155
+    if (is_null($charset)) {
156
+        $charset = $GLOBALS['meta']['charset'];
157
+    }
158
+    if ($apply) {
159
+        ob_start();
160
+        $r = is_array($apply) ? $page(...$apply) : $page();
161
+        $page = ob_get_contents();
162
+        ob_end_clean();
163
+        // fonction sans aucun "echo", ca doit etre le resultat
164
+        if (!$page) {
165
+            $page = $r;
166
+        }
167
+    }
168
+
169
+    if (!$page) {
170
+        return '';
171
+    }
172
+    // charger la DTD et transcoder les entites,
173
+    // et escamoter le doctype que sax mange en php5 mais pas en  php4
174
+    if (!$doctype) {
175
+        if (!$r = analyser_doctype($page)) {
176
+            $page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE
177
+                . preg_replace(_REGEXP_DOCTYPE, '', $page);
178
+            $r = analyser_doctype($page);
179
+        }
180
+        [$entete, $avail, $grammaire, $rotlvl] = array_pad($r, 4, null);
181
+        $page = substr($page, strlen($entete));
182
+    } else {
183
+        $avail = 'SYSTEM';
184
+        $grammaire = $doctype;
185
+        $rotlvl = basename($grammaire);
186
+    }
187
+
188
+    include_spip('xml/analyser_dtd');
189
+    $dtc = charger_dtd($grammaire, $avail, $rotlvl);
190
+    $page = sax_bug($page, $dtc, $charset);
191
+
192
+    // compatibilite Tidy espace public
193
+    if (!$phraseur) {
194
+        $indenter_xml = charger_fonction('indenter', 'xml');
195
+
196
+        return $indenter_xml($page, $apply);
197
+    }
198
+
199
+    $xml_parser = xml_parser_create($charset);
200
+
201
+    xml_set_element_handler(
202
+        $xml_parser,
203
+        [$phraseur, 'debutElement'],
204
+        [$phraseur, 'finElement']
205
+    );
206
+
207
+    xml_set_character_data_handler(
208
+        $xml_parser,
209
+        [$phraseur, 'textElement']
210
+    );
211
+
212
+    xml_set_processing_instruction_handler(
213
+        $xml_parser,
214
+        [$phraseur, 'piElement']
215
+    );
216
+
217
+    xml_set_default_handler(
218
+        $xml_parser,
219
+        [$phraseur, 'defaultElement']
220
+    );
221
+
222
+    xml_parser_set_option($xml_parser, XML_OPTION_CASE_FOLDING, false);
223
+
224
+    $phraseur->sax = $xml_parser;
225
+    if (isset($entete)) {
226
+        $phraseur->entete = $entete;
227
+    }
228
+    $phraseur->page = $page;
229
+    $phraseur->dtc = $dtc;
230
+    $phraseur->phraserTout($xml_parser, $page);
231
+    xml_parser_free($xml_parser);
232
+    $phraseur->sax = '';
233
+
234
+    return $phraseur;
235 235
 }
236 236
 
237 237
 // SAX ne dit pas si une Entite est dans un attribut ou non.
@@ -242,24 +242,24 @@  discard block
 block discarded – undo
242 242
 // sinon on se rabat sur ce qu'en connait SPIP en standard.
243 243
 
244 244
 function sax_bug($data, $dtc, $charset = null) {
245
-	if (is_null($charset)) {
246
-		$charset = $GLOBALS['meta']['charset'];
247
-	}
248
-
249
-	if ($dtc) {
250
-		$trans = [];
251
-
252
-		foreach ($dtc->entites as $k => $v) {
253
-			if (!strpos(' amp lt gt quot ', (string) $k)) {
254
-				$trans["&$k;"] = $v;
255
-			}
256
-		}
257
-		$data = strtr($data, $trans);
258
-	} else {
259
-		$data = html2unicode($data, true);
260
-	}
261
-
262
-	return unicode2charset($data, $charset);
245
+    if (is_null($charset)) {
246
+        $charset = $GLOBALS['meta']['charset'];
247
+    }
248
+
249
+    if ($dtc) {
250
+        $trans = [];
251
+
252
+        foreach ($dtc->entites as $k => $v) {
253
+            if (!strpos(' amp lt gt quot ', (string) $k)) {
254
+                $trans["&$k;"] = $v;
255
+            }
256
+        }
257
+        $data = strtr($data, $trans);
258
+    } else {
259
+        $data = html2unicode($data, true);
260
+    }
261
+
262
+    return unicode2charset($data, $charset);
263 263
 }
264 264
 
265 265
 // Retirer < ? xml... ? > et autre PI, ainsi que les commentaires en debut
@@ -269,48 +269,48 @@  discard block
 block discarded – undo
269 269
 // les autres formats RSS n'ont pas de DTD,
270 270
 // mais un XML Schema que SPIP ne fait pas encore lire.
271 271
 function analyser_doctype($data) {
272
-	if (!preg_match(_REGEXP_DOCTYPE, $data, $page)) {
273
-		if (preg_match(_REGEXP_XML, $data, $page)) {
274
-			[, $entete, $topelement] = $page;
275
-			if ($topelement == 'rss') {
276
-				return [
277
-					$entete,
278
-					'PUBLIC',
279
-					_DOCTYPE_RSS,
280
-					'rss-0.91.dtd'
281
-				];
282
-			} else {
283
-				$dtd = $topelement . '.dtd';
284
-				$f = find_in_path($dtd);
285
-				if (file_exists($f)) {
286
-					return [$entete, 'SYSTEM', $f, $dtd];
287
-				}
288
-			}
289
-		}
290
-		spip_log('Dtd pas vu pour ' . substr($data, 0, 100));
291
-
292
-		return [];
293
-	}
294
-	[$entete, , $topelement, $avail, $suite] = $page;
295
-
296
-	if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r) && !preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) {
297
-		return [];
298
-	}
299
-	[, $rotlvl, $suite] = $r;
300
-
301
-	if (!$suite) {
302
-		if ($avail != 'SYSTEM') {
303
-			return [];
304
-		}
305
-		$grammaire = $rotlvl;
306
-		$rotlvl = '';
307
-	} else {
308
-		if (!preg_match('/^"([^"]*)"\s*$/', $suite, $r) && !preg_match("/^'([^']*)'\s*$/", $suite, $r)) {
309
-			return [];
310
-		}
311
-
312
-		$grammaire = $r[1];
313
-	}
314
-
315
-	return [$entete, $avail, $grammaire, $rotlvl];
272
+    if (!preg_match(_REGEXP_DOCTYPE, $data, $page)) {
273
+        if (preg_match(_REGEXP_XML, $data, $page)) {
274
+            [, $entete, $topelement] = $page;
275
+            if ($topelement == 'rss') {
276
+                return [
277
+                    $entete,
278
+                    'PUBLIC',
279
+                    _DOCTYPE_RSS,
280
+                    'rss-0.91.dtd'
281
+                ];
282
+            } else {
283
+                $dtd = $topelement . '.dtd';
284
+                $f = find_in_path($dtd);
285
+                if (file_exists($f)) {
286
+                    return [$entete, 'SYSTEM', $f, $dtd];
287
+                }
288
+            }
289
+        }
290
+        spip_log('Dtd pas vu pour ' . substr($data, 0, 100));
291
+
292
+        return [];
293
+    }
294
+    [$entete, , $topelement, $avail, $suite] = $page;
295
+
296
+    if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r) && !preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) {
297
+        return [];
298
+    }
299
+    [, $rotlvl, $suite] = $r;
300
+
301
+    if (!$suite) {
302
+        if ($avail != 'SYSTEM') {
303
+            return [];
304
+        }
305
+        $grammaire = $rotlvl;
306
+        $rotlvl = '';
307
+    } else {
308
+        if (!preg_match('/^"([^"]*)"\s*$/', $suite, $r) && !preg_match("/^'([^']*)'\s*$/", $suite, $r)) {
309
+            return [];
310
+        }
311
+
312
+        $grammaire = $r[1];
313
+    }
314
+
315
+    return [$entete, $avail, $grammaire, $rotlvl];
316 316
 }
Please login to merge, or discard this patch.
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	$t = $phraseur->ouvrant[$depth] ?? ' ';
41 41
 	// espace initial signifie: deja integree au resultat
42 42
 	if ($t[0] != ' ') {
43
-		$phraseur->res .= '<' . $t . '>';
44
-		$phraseur->ouvrant[$depth] = ' ' . $t;
43
+		$phraseur->res .= '<'.$t.'>';
44
+		$phraseur->ouvrant[$depth] = ' '.$t;
45 45
 	}
46 46
 	$t = $phraseur->contenu[$depth];
47 47
 	// n'indenter que s'il y a un separateur avant
@@ -52,14 +52,14 @@  discard block
 block discarded – undo
52 52
 	foreach ($attrs as $k => $v) {
53 53
 		$delim = str_contains($v, "'") ? '"' : "'";
54 54
 		$val = xml_entites_html($v);
55
-		$att .= $sep . $k . '=' . $delim
55
+		$att .= $sep.$k.'='.$delim
56 56
 			. ($delim !== '"' ? str_replace('&quot;', '"', $val) : $val)
57 57
 			. $delim;
58 58
 		$sep = "\n $depth";
59 59
 	}
60 60
 	$phraseur->depth .= '  ';
61 61
 	$phraseur->contenu[$phraseur->depth] = '';
62
-	$phraseur->ouvrant[$phraseur->depth] = $name . $att;
62
+	$phraseur->ouvrant[$phraseur->depth] = $name.$att;
63 63
 	$phraseur->reperes[$phraseur->depth] = xml_get_current_line_number($phraseur->sax);
64 64
 }
65 65
 
@@ -67,13 +67,13 @@  discard block
 block discarded – undo
67 67
 	$ouv = $phraseur->ouvrant[$phraseur->depth];
68 68
 
69 69
 	if ($ouv[0] != ' ') {
70
-		$phraseur->ouvrant[$phraseur->depth] = ' ' . $ouv;
70
+		$phraseur->ouvrant[$phraseur->depth] = ' '.$ouv;
71 71
 	} else {
72 72
 		$ouv = '';
73 73
 	}
74 74
 	$t = $phraseur->contenu[$phraseur->depth];
75 75
 	$phraseur->depth = substr($phraseur->depth, 2);
76
-	$t = preg_replace("/[\n\t ]+$/", "\n" . $phraseur->depth, $t);
76
+	$t = preg_replace("/[\n\t ]+$/", "\n".$phraseur->depth, $t);
77 77
 
78 78
 	// fusion <balise></balise> en <balise />.
79 79
 	// ATTENTION,  certains clients http croient que fusion ==> pas d'atttributs
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
 	// (param fusion_bal)
83 83
 
84 84
 	if ($t || ($ouv != $name && !$fusion_bal)) {
85
-		$phraseur->res .= ($ouv ? ('<' . $ouv . '>') : '') . $t . '</' . $name . '>';
85
+		$phraseur->res .= ($ouv ? ('<'.$ouv.'>') : '').$t.'</'.$name.'>';
86 86
 	} else {
87
-		$phraseur->res .= ($ouv ? ('<' . $ouv . ' />') : ('</' . $name . '>'));
87
+		$phraseur->res .= ($ouv ? ('<'.$ouv.' />') : ('</'.$name.'>'));
88 88
 	}
89 89
 }
90 90
 
@@ -126,16 +126,16 @@  discard block
 block discarded – undo
126 126
 		coordonnees_erreur(
127 127
 			$phraseur,
128 128
 			xml_error_string(xml_get_error_code($phraseur->sax))
129
-			. "<br />\n" .
129
+			. "<br />\n".
130 130
 			($phraseur->depth
131
-				? '(' .
132
-					_T('erreur_balise_non_fermee') .
133
-					' <tt>' .
134
-					$phraseur->ouvrant[$phraseur->depth] .
135
-					'</tt> ' .
136
-					_T('ligne') .
137
-					' ' .
138
-					$phraseur->reperes[$phraseur->depth] .
131
+				? '('.
132
+					_T('erreur_balise_non_fermee').
133
+					' <tt>'.
134
+					$phraseur->ouvrant[$phraseur->depth].
135
+					'</tt> '.
136
+					_T('ligne').
137
+					' '.
138
+					$phraseur->reperes[$phraseur->depth].
139 139
 					") <br />\n"
140 140
 				: '')
141 141
 		);
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
 	// et escamoter le doctype que sax mange en php5 mais pas en  php4
174 174
 	if (!$doctype) {
175 175
 		if (!$r = analyser_doctype($page)) {
176
-			$page = _MESSAGE_DOCTYPE . _DOCTYPE_ECRIRE
176
+			$page = _MESSAGE_DOCTYPE._DOCTYPE_ECRIRE
177 177
 				. preg_replace(_REGEXP_DOCTYPE, '', $page);
178 178
 			$r = analyser_doctype($page);
179 179
 		}
@@ -280,18 +280,18 @@  discard block
 block discarded – undo
280 280
 					'rss-0.91.dtd'
281 281
 				];
282 282
 			} else {
283
-				$dtd = $topelement . '.dtd';
283
+				$dtd = $topelement.'.dtd';
284 284
 				$f = find_in_path($dtd);
285 285
 				if (file_exists($f)) {
286 286
 					return [$entete, 'SYSTEM', $f, $dtd];
287 287
 				}
288 288
 			}
289 289
 		}
290
-		spip_log('Dtd pas vu pour ' . substr($data, 0, 100));
290
+		spip_log('Dtd pas vu pour '.substr($data, 0, 100));
291 291
 
292 292
 		return [];
293 293
 	}
294
-	[$entete, , $topelement, $avail, $suite] = $page;
294
+	[$entete,, $topelement, $avail, $suite] = $page;
295 295
 
296 296
 	if (!preg_match('/^"([^"]*)"\s*(.*)$/', $suite, $r) && !preg_match("/^'([^']*)'\s*(.*)$/", $suite, $r)) {
297 297
 		return [];
Please login to merge, or discard this patch.