Completed
Pull Request — master (#41)
by
unknown
01:10
created
ecrire/install/etape_1.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 
24 24
 /**
@@ -35,45 +35,45 @@  discard block
 block discarded – undo
35 35
  *
36 36
  */
37 37
 function install_etape_1_dist() {
38
-	echo install_debut_html();
38
+    echo install_debut_html();
39 39
 
40
-	// stopper en cas de grosse incompatibilite de l'hebergement
41
-	tester_compatibilite_hebergement();
40
+    // stopper en cas de grosse incompatibilite de l'hebergement
41
+    tester_compatibilite_hebergement();
42 42
 
43
-	// Recuperer les anciennes donnees pour plus de facilite (si presentes)
44
-	$s = !@is_readable(_FILE_CONNECT_TMP) ? ''
45
-		: analyse_fichier_connection(_FILE_CONNECT_TMP);
43
+    // Recuperer les anciennes donnees pour plus de facilite (si presentes)
44
+    $s = !@is_readable(_FILE_CONNECT_TMP) ? ''
45
+        : analyse_fichier_connection(_FILE_CONNECT_TMP);
46 46
 
47
-	list($adresse_db, $login_db) = $s ? $s : login_hebergeur();
47
+    list($adresse_db, $login_db) = $s ? $s : login_hebergeur();
48 48
 
49
-	$chmod = (isset($_GET['chmod']) and preg_match(',^[0-9]+$,', $_GET['chmod'])) ?
50
-		sprintf('%04o', $_GET['chmod']) : '0777';
49
+    $chmod = (isset($_GET['chmod']) and preg_match(',^[0-9]+$,', $_GET['chmod'])) ?
50
+        sprintf('%04o', $_GET['chmod']) : '0777';
51 51
 
52
-	if (@is_readable(_FILE_CHMOD_TMP)) {
53
-		$s = @join('', @file(_FILE_CHMOD_TMP));
54
-		if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
55
-			$chmod = $regs[1];
56
-		}
57
-	}
52
+    if (@is_readable(_FILE_CHMOD_TMP)) {
53
+        $s = @join('', @file(_FILE_CHMOD_TMP));
54
+        if (preg_match("#define\('_SPIP_CHMOD', (.*)\)#", $s, $regs)) {
55
+            $chmod = $regs[1];
56
+        }
57
+    }
58 58
 
59 59
 
60
-	$db = [$adresse_db, _T('entree_base_donnee_2')];
61
-	$login = [$login_db, _T('entree_login_connexion_2')];
62
-	$pass = ['', _T('entree_mot_passe_2')];
60
+    $db = [$adresse_db, _T('entree_base_donnee_2')];
61
+    $login = [$login_db, _T('entree_login_connexion_2')];
62
+    $pass = ['', _T('entree_mot_passe_2')];
63 63
 
64
-	$predef = [
65
-		defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
66
-		defined('_INSTALL_HOST_DB'),
67
-		defined('_INSTALL_USER_DB'),
68
-		defined('_INSTALL_PASS_DB')
69
-	];
64
+    $predef = [
65
+        defined('_INSTALL_SERVER_DB') ? _INSTALL_SERVER_DB : '',
66
+        defined('_INSTALL_HOST_DB'),
67
+        defined('_INSTALL_USER_DB'),
68
+        defined('_INSTALL_PASS_DB')
69
+    ];
70 70
 
71 71
 
72
-	echo info_progression_etape(1, 'etape_', 'install/');
72
+    echo info_progression_etape(1, 'etape_', 'install/');
73 73
 
74
-	// ces deux chaines de langues doivent etre reecrites
74
+    // ces deux chaines de langues doivent etre reecrites
75 75
 #	echo info_etape(_T('info_connexion_mysql'), _T('texte_connexion_mysql').aide ("install1", true));
76
-	echo info_etape(_T('info_connexion_base_donnee'));
77
-	echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
78
-	echo install_fin_html();
76
+    echo info_etape(_T('info_connexion_base_donnee'));
77
+    echo install_connexion_form($db, $login, $pass, $predef, "\n<input type='hidden' name='chmod' value='$chmod' />", 2);
78
+    echo install_fin_html();
79 79
 }
Please login to merge, or discard this patch.
ecrire/install/etape_2.php 2 patches
Indentation   +121 added lines, -121 removed lines patch added patch discarded remove patch
@@ -11,91 +11,91 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('base/abstract_sql');
18 18
 
19 19
 // https://code.spip.net/@install_etape_2_dist
20 20
 function install_etape_2_dist() {
21
-	$adresse_db = defined('_INSTALL_HOST_DB')
22
-		? _INSTALL_HOST_DB
23
-		: _request('adresse_db');
21
+    $adresse_db = defined('_INSTALL_HOST_DB')
22
+        ? _INSTALL_HOST_DB
23
+        : _request('adresse_db');
24 24
 
25
-	if (preg_match(',(.*):(.*),', $adresse_db, $r)) {
26
-		list(, $adresse_db, $port) = $r;
27
-	} else {
28
-		$port = '';
29
-	}
25
+    if (preg_match(',(.*):(.*),', $adresse_db, $r)) {
26
+        list(, $adresse_db, $port) = $r;
27
+    } else {
28
+        $port = '';
29
+    }
30 30
 
31
-	$login_db = defined('_INSTALL_USER_DB')
32
-		? _INSTALL_USER_DB
33
-		: _request('login_db');
31
+    $login_db = defined('_INSTALL_USER_DB')
32
+        ? _INSTALL_USER_DB
33
+        : _request('login_db');
34 34
 
35
-	$pass_db = defined('_INSTALL_PASS_DB')
36
-		? _INSTALL_PASS_DB
37
-		: _request('pass_db');
35
+    $pass_db = defined('_INSTALL_PASS_DB')
36
+        ? _INSTALL_PASS_DB
37
+        : _request('pass_db');
38 38
 
39
-	$server_db = defined('_INSTALL_SERVER_DB')
40
-		? _INSTALL_SERVER_DB
41
-		: _request('server_db');
39
+    $server_db = defined('_INSTALL_SERVER_DB')
40
+        ? _INSTALL_SERVER_DB
41
+        : _request('server_db');
42 42
 
43
-	$name_db = defined('_INSTALL_NAME_DB')
44
-		? _INSTALL_NAME_DB
45
-		: '';
43
+    $name_db = defined('_INSTALL_NAME_DB')
44
+        ? _INSTALL_NAME_DB
45
+        : '';
46 46
 
47
-	$chmod = _request('chmod');
47
+    $chmod = _request('chmod');
48 48
 
49
-	$link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db);
50
-	$GLOBALS['connexions'][$server_db] = $link;
49
+    $link = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $name_db, $server_db);
50
+    $GLOBALS['connexions'][$server_db] = $link;
51 51
 
52
-	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
53
-		= $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
52
+    $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
53
+        = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
54 54
 
55
-	echo install_debut_html();
55
+    echo install_debut_html();
56 56
 
57 57
 // prenons toutes les dispositions possibles pour que rien ne s'affiche !
58 58
 
59
-	/*
59
+    /*
60 60
 	 * /!\ sqlite3/PDO : erreur sur join(', ', $link)
61 61
 	 * L'objet PDO ne peut pas etre transformee en chaine
62 62
 	 * Un echo $link ne fonctionne pas non plus
63 63
 	 * Il faut utiliser par exemple print_r($link)
64 64
 	 */
65
-	//echo "\n<!--\n", join(', ', $link), " $login_db ";
66
-	$db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0;
67
-	//echo join(', ', $GLOBALS['connexions'][$server_db]);
68
-	//echo "\n-->\n";
65
+    //echo "\n<!--\n", join(', ', $link), " $login_db ";
66
+    $db_connect = 0; // revoirfunction_exists($ferrno) ? $ferrno() : 0;
67
+    //echo join(', ', $GLOBALS['connexions'][$server_db]);
68
+    //echo "\n-->\n";
69 69
 
70
-	if (($db_connect == '0') && $link) {
71
-		echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>';
72
-		echo info_progression_etape(2, 'etape_', 'install/');
70
+    if (($db_connect == '0') && $link) {
71
+        echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>';
72
+        echo info_progression_etape(2, 'etape_', 'install/');
73 73
 
74
-		echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true));
74
+        echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true));
75 75
 
76
-		echo "\n", '<!-- ', sql_version($server_db), ' -->';
77
-		list($checked, $res) = install_etape_2_bases($login_db, $server_db);
76
+        echo "\n", '<!-- ', sql_version($server_db), ' -->';
77
+        list($checked, $res) = install_etape_2_bases($login_db, $server_db);
78 78
 
79
-		$hidden = (defined('_SPIP_CHMOD')
80
-				? ''
81
-				: ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />"))
82
-			. predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
79
+        $hidden = (defined('_SPIP_CHMOD')
80
+                ? ''
81
+                : ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />"))
82
+            . predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
83 83
 
84
-		echo install_etape_2_form($hidden, $checked, $res, 3);
85
-	} else {
86
-		echo info_progression_etape(1, 'etape_', 'install/', true);
84
+        echo install_etape_2_form($hidden, $checked, $res, 3);
85
+    } else {
86
+        echo info_progression_etape(1, 'etape_', 'install/', true);
87 87
 
88
-		echo "<div class='error'>";
89
-		echo info_etape(_T('info_connexion_base'));
90
-		echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>';
91
-		echo '<p>' . _T('avis_connexion_echec_2') . '</p>';
88
+        echo "<div class='error'>";
89
+        echo info_etape(_T('info_connexion_base'));
90
+        echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>';
91
+        echo '<p>' . _T('avis_connexion_echec_2') . '</p>';
92 92
 
93
-		echo "<p style='font-size: small;'>",
94
-		_T('avis_connexion_echec_3'),
95
-		'</p></div>';
96
-	}
93
+        echo "<p style='font-size: small;'>",
94
+        _T('avis_connexion_echec_3'),
95
+        '</p></div>';
96
+    }
97 97
 
98
-	echo install_fin_html();
98
+    echo install_fin_html();
99 99
 }
100 100
 
101 101
 // Liste les bases accessibles,
@@ -103,77 +103,77 @@  discard block
 block discarded – undo
103 103
 
104 104
 // https://code.spip.net/@install_etape_2_bases
105 105
 function install_etape_2_bases($login_db, $server_db) {
106
-	$res = install_etape_liste_bases($server_db, $login_db);
107
-	if ($res) {
108
-		list($checked, $bases) = $res;
109
-
110
-		return [
111
-			$checked,
112
-			"<label for='choix_db'><b>"
113
-			. _T('texte_choix_base_2')
114
-			. '</b><br />'
115
-			. _T('texte_choix_base_3')
116
-			. '</label>'
117
-			. "<ul>\n<li>"
118
-			. join("</li>\n<li>", $bases)
119
-			. "</li>\n</ul><p>"
120
-			. _T('info_ou')
121
-			. ' '
122
-		];
123
-	}
124
-	$res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b>
106
+    $res = install_etape_liste_bases($server_db, $login_db);
107
+    if ($res) {
108
+        list($checked, $bases) = $res;
109
+
110
+        return [
111
+            $checked,
112
+            "<label for='choix_db'><b>"
113
+            . _T('texte_choix_base_2')
114
+            . '</b><br />'
115
+            . _T('texte_choix_base_3')
116
+            . '</label>'
117
+            . "<ul>\n<li>"
118
+            . join("</li>\n<li>", $bases)
119
+            . "</li>\n</ul><p>"
120
+            . _T('info_ou')
121
+            . ' '
122
+        ];
123
+    }
124
+    $res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b>
125 125
 		' . _T('avis_lecture_noms_bases_2') . '<p>';
126 126
 
127
-	$checked = false;
128
-	if ($login_db) {
129
-		// Si un login comporte un point, le nom de la base est plus
130
-		// probablement le login sans le point -- testons pour savoir
131
-		$test_base = $login_db;
132
-		$ok = sql_selectdb($test_base, $server_db);
133
-		$test_base2 = str_replace('.', '_', $test_base);
134
-		if (sql_selectdb($test_base2, $server_db)) {
135
-			$test_base = $test_base2;
136
-			$ok = true;
137
-		}
138
-
139
-		if ($ok) {
140
-			$res .= _T('avis_lecture_noms_bases_3')
141
-				. '<ul>'
142
-				. '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />"
143
-				. "<label for='stand'>" . $test_base . "</label></li>\n"
144
-				. '</ul>'
145
-				. '<p>' . _T('info_ou') . ' ';
146
-			$checked = true;
147
-		}
148
-	}
149
-
150
-	return [$checked, $res];
127
+    $checked = false;
128
+    if ($login_db) {
129
+        // Si un login comporte un point, le nom de la base est plus
130
+        // probablement le login sans le point -- testons pour savoir
131
+        $test_base = $login_db;
132
+        $ok = sql_selectdb($test_base, $server_db);
133
+        $test_base2 = str_replace('.', '_', $test_base);
134
+        if (sql_selectdb($test_base2, $server_db)) {
135
+            $test_base = $test_base2;
136
+            $ok = true;
137
+        }
138
+
139
+        if ($ok) {
140
+            $res .= _T('avis_lecture_noms_bases_3')
141
+                . '<ul>'
142
+                . '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />"
143
+                . "<label for='stand'>" . $test_base . "</label></li>\n"
144
+                . '</ul>'
145
+                . '<p>' . _T('info_ou') . ' ';
146
+            $checked = true;
147
+        }
148
+    }
149
+
150
+    return [$checked, $res];
151 151
 }
152 152
 
153 153
 // https://code.spip.net/@install_etape_2_form
154 154
 function install_etape_2_form($hidden, $checked, $res, $etape) {
155
-	return generer_form_ecrire('install', (
156
-		"\n<input type='hidden' name='etape' value='$etape' />"
157
-		. $hidden
158
-		. (defined('_INSTALL_NAME_DB')
159
-			? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>'
160
-			: "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n"
161
-			. $res
162
-			. "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'"
163
-			. ($checked ? '' : " checked='checked'")
164
-			. " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>"
165
-			. "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n"
166
-		)
167
-
168
-		. ((defined('_INSTALL_TABLE_PREFIX')
169
-			or $GLOBALS['table_prefix'] != 'spip')
170
-			? '<h3>' . _T('install_table_prefix_hebergeur') . '  <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>'
171
-			: '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n"
172
-			. "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>'
173
-			. "\n<input type='text' id='tprefix' name='tprefix' class='text' value='"
174
-			. 'spip' # valeur par defaut
175
-			. "' size='20' /></p></fieldset>"
176
-		)
177
-
178
-		. bouton_suivant()));
155
+    return generer_form_ecrire('install', (
156
+        "\n<input type='hidden' name='etape' value='$etape' />"
157
+        . $hidden
158
+        . (defined('_INSTALL_NAME_DB')
159
+            ? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>'
160
+            : "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n"
161
+            . $res
162
+            . "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'"
163
+            . ($checked ? '' : " checked='checked'")
164
+            . " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>"
165
+            . "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n"
166
+        )
167
+
168
+        . ((defined('_INSTALL_TABLE_PREFIX')
169
+            or $GLOBALS['table_prefix'] != 'spip')
170
+            ? '<h3>' . _T('install_table_prefix_hebergeur') . '  <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>'
171
+            : '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n"
172
+            . "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>'
173
+            . "\n<input type='text' id='tprefix' name='tprefix' class='text' value='"
174
+            . 'spip' # valeur par defaut
175
+            . "' size='20' /></p></fieldset>"
176
+        )
177
+
178
+        . bouton_suivant()));
179 179
 }
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	$GLOBALS['connexions'][$server_db] = $link;
51 51
 
52 52
 	$GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']]
53
-		= $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']];
53
+		= $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']];
54 54
 
55 55
 	echo install_debut_html();
56 56
 
@@ -68,18 +68,18 @@  discard block
 block discarded – undo
68 68
 	//echo "\n-->\n";
69 69
 
70 70
 	if (($db_connect == '0') && $link) {
71
-		echo "<div class='success'><b>" . _T('info_connexion_ok') . '</b></div>';
71
+		echo "<div class='success'><b>"._T('info_connexion_ok').'</b></div>';
72 72
 		echo info_progression_etape(2, 'etape_', 'install/');
73 73
 
74
-		echo info_etape(_T('menu_aide_installation_choix_base') . aider('install2', true));
74
+		echo info_etape(_T('menu_aide_installation_choix_base').aider('install2', true));
75 75
 
76 76
 		echo "\n", '<!-- ', sql_version($server_db), ' -->';
77 77
 		list($checked, $res) = install_etape_2_bases($login_db, $server_db);
78 78
 
79 79
 		$hidden = (defined('_SPIP_CHMOD')
80 80
 				? ''
81
-				: ("\n<input type='hidden' name='chmod' value='" . spip_htmlspecialchars($chmod) . "' />"))
82
-			. predef_ou_cache($adresse_db . ($port ? ':' . $port : ''), $login_db, $pass_db, $server_db);
81
+				: ("\n<input type='hidden' name='chmod' value='".spip_htmlspecialchars($chmod)."' />"))
82
+			. predef_ou_cache($adresse_db.($port ? ':'.$port : ''), $login_db, $pass_db, $server_db);
83 83
 
84 84
 		echo install_etape_2_form($hidden, $checked, $res, 3);
85 85
 	} else {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 
88 88
 		echo "<div class='error'>";
89 89
 		echo info_etape(_T('info_connexion_base'));
90
-		echo '<h3>' . _T('avis_connexion_echec_1') . '</h3>';
91
-		echo '<p>' . _T('avis_connexion_echec_2') . '</p>';
90
+		echo '<h3>'._T('avis_connexion_echec_1').'</h3>';
91
+		echo '<p>'._T('avis_connexion_echec_2').'</p>';
92 92
 
93 93
 		echo "<p style='font-size: small;'>",
94 94
 		_T('avis_connexion_echec_3'),
@@ -121,8 +121,8 @@  discard block
 block discarded – undo
121 121
 			. ' '
122 122
 		];
123 123
 	}
124
-	$res = '<b>' . _T('avis_lecture_noms_bases_1') . '</b>
125
-		' . _T('avis_lecture_noms_bases_2') . '<p>';
124
+	$res = '<b>'._T('avis_lecture_noms_bases_1').'</b>
125
+		' . _T('avis_lecture_noms_bases_2').'<p>';
126 126
 
127 127
 	$checked = false;
128 128
 	if ($login_db) {
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 		if ($ok) {
140 140
 			$res .= _T('avis_lecture_noms_bases_3')
141 141
 				. '<ul>'
142
-				. '<li><input name="choix_db" value="' . $test_base . "\" type='radio' id='stand' checked='checked' />"
143
-				. "<label for='stand'>" . $test_base . "</label></li>\n"
142
+				. '<li><input name="choix_db" value="'.$test_base."\" type='radio' id='stand' checked='checked' />"
143
+				. "<label for='stand'>".$test_base."</label></li>\n"
144 144
 				. '</ul>'
145
-				. '<p>' . _T('info_ou') . ' ';
145
+				. '<p>'._T('info_ou').' ';
146 146
 			$checked = true;
147 147
 		}
148 148
 	}
@@ -156,20 +156,20 @@  discard block
 block discarded – undo
156 156
 		"\n<input type='hidden' name='etape' value='$etape' />"
157 157
 		. $hidden
158 158
 		. (defined('_INSTALL_NAME_DB')
159
-			? '<h3>' . _T('install_nom_base_hebergeur') . ' <tt>' . _INSTALL_NAME_DB . '</tt>' . '</h3>'
160
-			: "\n<fieldset><legend>" . _T('texte_choix_base_1') . "</legend>\n"
159
+			? '<h3>'._T('install_nom_base_hebergeur').' <tt>'._INSTALL_NAME_DB.'</tt>'.'</h3>'
160
+			: "\n<fieldset><legend>"._T('texte_choix_base_1')."</legend>\n"
161 161
 			. $res
162 162
 			. "\n<input name=\"choix_db\" value=\"new_spip\" type='radio' id='nou'"
163 163
 			. ($checked ? '' : " checked='checked'")
164
-			. " />\n<label for='nou'>" . _T('info_creer_base') . "</label></p>\n<p>"
164
+			. " />\n<label for='nou'>"._T('info_creer_base')."</label></p>\n<p>"
165 165
 			. "\n<input type='text' name='table_new' class='text' value=\"spip\" size='20' /></p></fieldset>\n"
166 166
 		)
167 167
 
168 168
 		. ((defined('_INSTALL_TABLE_PREFIX')
169 169
 			or $GLOBALS['table_prefix'] != 'spip')
170
-			? '<h3>' . _T('install_table_prefix_hebergeur') . '  <tt>' . $GLOBALS['table_prefix'] . '</tt>' . '</h3>'
171
-			: '<fieldset><legend>' . _T('texte_choix_table_prefix') . "</legend>\n"
172
-			. "<p><label for='table_prefix'>" . _T('info_table_prefix') . '</label></p><p>'
170
+			? '<h3>'._T('install_table_prefix_hebergeur').'  <tt>'.$GLOBALS['table_prefix'].'</tt>'.'</h3>'
171
+			: '<fieldset><legend>'._T('texte_choix_table_prefix')."</legend>\n"
172
+			. "<p><label for='table_prefix'>"._T('info_table_prefix').'</label></p><p>'
173 173
 			. "\n<input type='text' id='tprefix' name='tprefix' class='text' value='"
174 174
 			. 'spip' # valeur par defaut
175 175
 			. "' size='20' /></p></fieldset>"
Please login to merge, or discard this patch.
ecrire/install/etape_4.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 
17 17
 include_spip('inc/headers');
@@ -19,62 +19,62 @@  discard block
 block discarded – undo
19 19
 // https://code.spip.net/@install_etape_4_dist
20 20
 function install_etape_4_dist() {
21 21
 
22
-	// creer le repertoire cache, qui sert partout !
23
-	if (!@file_exists(_DIR_CACHE)) {
24
-		$rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE);
25
-		$rep = sous_repertoire(_DIR_TMP, $rep, true, true);
26
-	}
22
+    // creer le repertoire cache, qui sert partout !
23
+    if (!@file_exists(_DIR_CACHE)) {
24
+        $rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE);
25
+        $rep = sous_repertoire(_DIR_TMP, $rep, true, true);
26
+    }
27 27
 
28 28
 
29
-	echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"');
30
-	echo info_progression_etape(4, 'etape_', 'install/');
29
+    echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"');
30
+    echo info_progression_etape(4, 'etape_', 'install/');
31 31
 
32
-	echo "<div class='success'><b>"
33
-		. _T('info_derniere_etape')
34
-		. '</b><p>'
35
-		. _T('info_utilisation_spip')
36
-		. '</p></div>';
32
+    echo "<div class='success'><b>"
33
+        . _T('info_derniere_etape')
34
+        . '</b><p>'
35
+        . _T('info_utilisation_spip')
36
+        . '</p></div>';
37 37
 
38 38
 
39
-	echo '<p>'
40
-		. _T(
41
-			'plugin_info_plugins_dist_1',
42
-			['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>']
43
-		)
44
-		. '</p>';
39
+    echo '<p>'
40
+        . _T(
41
+            'plugin_info_plugins_dist_1',
42
+            ['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>']
43
+        )
44
+        . '</p>';
45 45
 
46
-	// installer les extensions
47
-	include_spip('inc/plugin');
48
-	$afficher = charger_fonction('afficher_liste', 'plugins');
49
-	echo $afficher(
50
-		self(),
51
-		liste_plugin_files(_DIR_PLUGINS_DIST),
52
-		[],
53
-		[],
54
-		_DIR_PLUGINS_DIST,
55
-		'afficher_nom_plugin'
56
-	);
46
+    // installer les extensions
47
+    include_spip('inc/plugin');
48
+    $afficher = charger_fonction('afficher_liste', 'plugins');
49
+    echo $afficher(
50
+        self(),
51
+        liste_plugin_files(_DIR_PLUGINS_DIST),
52
+        [],
53
+        [],
54
+        _DIR_PLUGINS_DIST,
55
+        'afficher_nom_plugin'
56
+    );
57 57
 
58
-	// si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape
59
-	// car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour)
60
-	// au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin
61
-	// et procede alors a l'installation
62
-	if (
63
-		!isset($GLOBALS['meta']['version_installee'])
64
-		or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))
65
-	) {
66
-		plugin_installes_meta();
67
-	}
58
+    // si la base de SPIP est up, on peut installer les plugins, sinon on passe cette etape
59
+    // car les plugins supposent que la base de SPIP est dans son etat normal (mise a jour)
60
+    // au premier passage dans l'espace prive on aura une demande d'upgrade qui se poursuit sur la page plugin
61
+    // et procede alors a l'installation
62
+    if (
63
+        !isset($GLOBALS['meta']['version_installee'])
64
+        or ($GLOBALS['spip_version_base'] == (str_replace(',', '.', $GLOBALS['meta']['version_installee'])))
65
+    ) {
66
+        plugin_installes_meta();
67
+    }
68 68
 
69
-	// mettre a jour si necessaire l'adresse du site
70
-	// securite si on arrive plus a se loger
71
-	include_spip('inc/config');
72
-	appliquer_adresse_site('');
69
+    // mettre a jour si necessaire l'adresse du site
70
+    // securite si on arrive plus a se loger
71
+    include_spip('inc/config');
72
+    appliquer_adresse_site('');
73 73
 
74
-	// aller a la derniere etape qui clos l'install et redirige
75
-	$suite = "\n<input type='hidden' name='etape' value='fin' />"
76
-		. bouton_suivant(_T('login_espace_prive'));
74
+    // aller a la derniere etape qui clos l'install et redirige
75
+    $suite = "\n<input type='hidden' name='etape' value='fin' />"
76
+        . bouton_suivant(_T('login_espace_prive'));
77 77
 
78
-	echo generer_form_ecrire('install', $suite);
79
-	echo install_fin_html();
78
+    echo generer_form_ecrire('install', $suite);
79
+    echo install_fin_html();
80 80
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 
22 22
 	// creer le repertoire cache, qui sert partout !
23 23
 	if (!@file_exists(_DIR_CACHE)) {
24
-		$rep = preg_replace(',' . _DIR_TMP . ',', '', _DIR_CACHE);
24
+		$rep = preg_replace(','._DIR_TMP.',', '', _DIR_CACHE);
25 25
 		$rep = sous_repertoire(_DIR_TMP, $rep, true, true);
26 26
 	}
27 27
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
 	echo '<p>'
40 40
 		. _T(
41 41
 			'plugin_info_plugins_dist_1',
42
-			['plugins_dist' => '<tt>' . joli_repertoire(_DIR_PLUGINS_DIST) . '</tt>']
42
+			['plugins_dist' => '<tt>'.joli_repertoire(_DIR_PLUGINS_DIST).'</tt>']
43 43
 		)
44 44
 		. '</p>';
45 45
 
Please login to merge, or discard this patch.
ecrire/install/etape_ldap5.php 2 patches
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -11,85 +11,85 @@
 block discarded – undo
11 11
 \***************************************************************************/
12 12
 
13 13
 if (!defined('_ECRIRE_INC_VERSION')) {
14
-	return;
14
+    return;
15 15
 }
16 16
 include_spip('inc/headers');
17 17
 include_spip('auth/ldap');
18 18
 
19 19
 // https://code.spip.net/@install_etape_ldap5_dist
20 20
 function install_etape_ldap5_dist() {
21
-	etape_ldap5_save();
22
-	etape_ldap5_suite();
21
+    etape_ldap5_save();
22
+    etape_ldap5_suite();
23 23
 }
24 24
 
25 25
 function etape_ldap5_save() {
26
-	if (!@file_exists(_FILE_CONNECT_TMP)) {
27
-		redirige_url_ecrire('install');
28
-	}
26
+    if (!@file_exists(_FILE_CONNECT_TMP)) {
27
+        redirige_url_ecrire('install');
28
+    }
29 29
 
30
-	ecrire_meta('ldap_statut_import', _request('statut_ldap'));
30
+    ecrire_meta('ldap_statut_import', _request('statut_ldap'));
31 31
 
32
-	lire_fichier(_FILE_CONNECT_TMP, $conn);
32
+    lire_fichier(_FILE_CONNECT_TMP, $conn);
33 33
 
34
-	if ($p = strpos($conn, "'');")) {
35
-		ecrire_fichier(
36
-			_FILE_CONNECT_TMP,
37
-			substr($conn, 0, $p + 1)
38
-			. _FILE_LDAP
39
-			. substr($conn, $p + 1)
40
-		);
41
-	}
34
+    if ($p = strpos($conn, "'');")) {
35
+        ecrire_fichier(
36
+            _FILE_CONNECT_TMP,
37
+            substr($conn, 0, $p + 1)
38
+            . _FILE_LDAP
39
+            . substr($conn, $p + 1)
40
+        );
41
+    }
42 42
 
43
-	$adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\");
44
-	$login_ldap = addcslashes(_request('login_ldap'), "'\\");
45
-	$pass_ldap = addcslashes(_request('pass_ldap'), "'\\");
46
-	$port_ldap = addcslashes(_request('port_ldap'), "'\\");
47
-	$tls_ldap = addcslashes(_request('tls_ldap'), "'\\");
48
-	$protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\");
49
-	$base_ldap = addcslashes(_request('base_ldap'), "'\\");
50
-	$base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\");
43
+    $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\");
44
+    $login_ldap = addcslashes(_request('login_ldap'), "'\\");
45
+    $pass_ldap = addcslashes(_request('pass_ldap'), "'\\");
46
+    $port_ldap = addcslashes(_request('port_ldap'), "'\\");
47
+    $tls_ldap = addcslashes(_request('tls_ldap'), "'\\");
48
+    $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\");
49
+    $base_ldap = addcslashes(_request('base_ldap'), "'\\");
50
+    $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\");
51 51
 
52
-	$conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n"
53
-		. "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n"
54
-		. "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n"
55
-		. (($tls_ldap != 'oui') ? '' :
56
-			"@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
57
-		. "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n";
52
+    $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n"
53
+        . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n"
54
+        . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n"
55
+        . (($tls_ldap != 'oui') ? '' :
56
+            "@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
57
+        . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n";
58 58
 
59
-	$champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [];
60
-	$res = '';
61
-	foreach ($champs as $champ => $v) {
62
-		$nom = 'ldap_' . $champ;
63
-		$val = trim(_request($nom));
64
-		if (preg_match('/^\w*$/', $val)) {
65
-			if ($val) {
66
-				$val = _q($val);
67
-			}
68
-		} else {
69
-			$val = 'array(' . _q(preg_split('/\W+/', $val)) . ')';
70
-		};
71
-		if ($val) {
72
-			$res .= "'$champ' => " . $val . ',';
73
-		}
74
-	}
75
-	$conn .= "\$GLOBALS['ldap_champs'] = array($res);\n";
59
+    $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [];
60
+    $res = '';
61
+    foreach ($champs as $champ => $v) {
62
+        $nom = 'ldap_' . $champ;
63
+        $val = trim(_request($nom));
64
+        if (preg_match('/^\w*$/', $val)) {
65
+            if ($val) {
66
+                $val = _q($val);
67
+            }
68
+        } else {
69
+            $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')';
70
+        };
71
+        if ($val) {
72
+            $res .= "'$champ' => " . $val . ',';
73
+        }
74
+    }
75
+    $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n";
76 76
 
77
-	install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn);
77
+    install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn);
78 78
 }
79 79
 
80 80
 function etape_ldap5_suite() {
81
-	echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"');
81
+    echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"');
82 82
 
83
-	echo info_etape(
84
-		_T('info_ldap_ok'),
85
-		info_progression_etape(5, 'etape_ldap', 'install/'),
86
-		_T('info_terminer_installation')
87
-	);
83
+    echo info_etape(
84
+        _T('info_ldap_ok'),
85
+        info_progression_etape(5, 'etape_ldap', 'install/'),
86
+        _T('info_terminer_installation')
87
+    );
88 88
 
89
-	echo generer_form_ecrire('install', (
90
-		"<input type='hidden' name='etape' value='3' />" .
91
-		"<input type='hidden' name='ldap_present' value='true' />"
92
-		. bouton_suivant()));
89
+    echo generer_form_ecrire('install', (
90
+        "<input type='hidden' name='etape' value='3' />" .
91
+        "<input type='hidden' name='ldap_present' value='true' />"
92
+        . bouton_suivant()));
93 93
 
94
-	echo install_fin_html();
94
+    echo install_fin_html();
95 95
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -52,29 +52,28 @@  discard block
 block discarded – undo
52 52
 	$conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n"
53 53
 		. "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n"
54 54
 		. "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n"
55
-		. (($tls_ldap != 'oui') ? '' :
56
-			"@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
55
+		. (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n")
57 56
 		. "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n";
58 57
 
59 58
 	$champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : [];
60 59
 	$res = '';
61 60
 	foreach ($champs as $champ => $v) {
62
-		$nom = 'ldap_' . $champ;
61
+		$nom = 'ldap_'.$champ;
63 62
 		$val = trim(_request($nom));
64 63
 		if (preg_match('/^\w*$/', $val)) {
65 64
 			if ($val) {
66 65
 				$val = _q($val);
67 66
 			}
68 67
 		} else {
69
-			$val = 'array(' . _q(preg_split('/\W+/', $val)) . ')';
68
+			$val = 'array('._q(preg_split('/\W+/', $val)).')';
70 69
 		};
71 70
 		if ($val) {
72
-			$res .= "'$champ' => " . $val . ',';
71
+			$res .= "'$champ' => ".$val.',';
73 72
 		}
74 73
 	}
75 74
 	$conn .= "\$GLOBALS['ldap_champs'] = array($res);\n";
76 75
 
77
-	install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn);
76
+	install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn);
78 77
 }
79 78
 
80 79
 function etape_ldap5_suite() {
@@ -87,7 +86,7 @@  discard block
 block discarded – undo
87 86
 	);
88 87
 
89 88
 	echo generer_form_ecrire('install', (
90
-		"<input type='hidden' name='etape' value='3' />" .
89
+		"<input type='hidden' name='etape' value='3' />".
91 90
 		"<input type='hidden' name='ldap_present' value='true' />"
92 91
 		. bouton_suivant()));
93 92
 
Please login to merge, or discard this patch.
ecrire/genie/mail.php 2 patches
Indentation   +27 added lines, -27 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
 
23 23
 /**
@@ -32,35 +32,35 @@  discard block
 block discarded – undo
32 32
  * @return int
33 33
  */
34 34
 function genie_mail_dist($t) {
35
-	$adresse_neuf = $GLOBALS['meta']['adresse_neuf'];
36
-	$jours_neuf = $GLOBALS['meta']['jours_neuf'];
35
+    $adresse_neuf = $GLOBALS['meta']['adresse_neuf'];
36
+    $jours_neuf = $GLOBALS['meta']['jours_neuf'];
37 37
 
38
-	$now = time();
39
-	if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) {
40
-		ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf)));
41
-	}
38
+    $now = time();
39
+    if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) {
40
+        ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf)));
41
+    }
42 42
 
43
-	$page = recuperer_fond(
44
-		'nouveautes',
45
-		['date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf],
46
-		['raw' => true]
47
-	);
43
+    $page = recuperer_fond(
44
+        'nouveautes',
45
+        ['date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf],
46
+        ['raw' => true]
47
+    );
48 48
 
49
-	if (strlen(trim($page['texte']))) {
50
-		// recuperer les entetes envoyes par #HTTP_HEADER
51
-		$headers = '';
52
-		if (isset($page['entetes']) and count($page['entetes'])) {
53
-			foreach ($page['entetes'] as $k => $v) {
54
-				$headers .= (strlen($v) ? "$k: $v" : $k) . "\n";
55
-			}
56
-		}
49
+    if (strlen(trim($page['texte']))) {
50
+        // recuperer les entetes envoyes par #HTTP_HEADER
51
+        $headers = '';
52
+        if (isset($page['entetes']) and count($page['entetes'])) {
53
+            foreach ($page['entetes'] as $k => $v) {
54
+                $headers .= (strlen($v) ? "$k: $v" : $k) . "\n";
55
+            }
56
+        }
57 57
 
58
-		include_spip('inc/notifications');
59
-		notifications_envoyer_mails($adresse_neuf, $page['texte'], '', '', $headers);
60
-		ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now));
61
-	} else {
62
-		spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours");
63
-	}
58
+        include_spip('inc/notifications');
59
+        notifications_envoyer_mails($adresse_neuf, $page['texte'], '', '', $headers);
60
+        ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now));
61
+    } else {
62
+        spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours");
63
+    }
64 64
 
65
-	return 1;
65
+    return 1;
66 66
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
 		$headers = '';
52 52
 		if (isset($page['entetes']) and count($page['entetes'])) {
53 53
 			foreach ($page['entetes'] as $k => $v) {
54
-				$headers .= (strlen($v) ? "$k: $v" : $k) . "\n";
54
+				$headers .= (strlen($v) ? "$k: $v" : $k)."\n";
55 55
 			}
56 56
 		}
57 57
 
Please login to merge, or discard this patch.
ecrire/genie/mise_a_jour.php 2 patches
Indentation   +116 added lines, -116 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
 
23 23
 /**
@@ -27,15 +27,15 @@  discard block
 block discarded – undo
27 27
  * @return int
28 28
  */
29 29
 function genie_mise_a_jour_dist($t) {
30
-	include_spip('inc/meta');
31
-	$maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']);
32
-	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non');
30
+    include_spip('inc/meta');
31
+    $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']);
32
+    ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non');
33 33
 
34
-	mise_a_jour_ecran_securite();
34
+    mise_a_jour_ecran_securite();
35 35
 
36
-	spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj');
36
+    spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj');
37 37
 
38
-	return 1;
38
+    return 1;
39 39
 }
40 40
 
41 41
 // TODO : fournir une URL sur spip.net pour maitriser la diffusion d'une nouvelle version de l'ecran via l'update auto
@@ -52,46 +52,46 @@  discard block
 block discarded – undo
52 52
  * ou de ne repondre une 304 que si le md5 est bon
53 53
  */
54 54
 function mise_a_jour_ecran_securite() {
55
-	// TODO : url https avec verification du certificat
56
-	return;
57
-
58
-	// si l'ecran n'est pas deja present ou pas updatable, sortir
59
-	if (
60
-		!_URL_ECRAN_SECURITE
61
-		or !file_exists($filename = _DIR_ETC . 'ecran_securite.php')
62
-		or !is_writable($filename)
63
-		or !$last_modified = filemtime($filename)
64
-		or !$md5 = md5_file($filename)
65
-	) {
66
-		return false;
67
-	}
68
-
69
-	include_spip('inc/distant');
70
-	$tmp_file = _DIR_TMP . 'ecran_securite.php';
71
-	$url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5);
72
-	$url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']);
73
-	$res = recuperer_url($url, [
74
-		'if_modified_since' => $last_modified,
75
-		'file' => $tmp_file
76
-	]);
77
-
78
-	// si il y a une version plus recente que l'on a recu correctement
79
-	if (
80
-		$res['status'] == 200
81
-		and $res['length']
82
-		and $tmp_file = $res['file']
83
-	) {
84
-		if ($md5 !== md5_file($tmp_file)) {
85
-			// on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale
86
-			include_once $tmp_file;
87
-			// ok, on le copie a la place de l'ecran existant
88
-			// en backupant l'ecran avant, au cas ou
89
-			@copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified));
90
-			@rename($tmp_file, $filename);
91
-		} else {
92
-			@unlink($tmp_file);
93
-		}
94
-	}
55
+    // TODO : url https avec verification du certificat
56
+    return;
57
+
58
+    // si l'ecran n'est pas deja present ou pas updatable, sortir
59
+    if (
60
+        !_URL_ECRAN_SECURITE
61
+        or !file_exists($filename = _DIR_ETC . 'ecran_securite.php')
62
+        or !is_writable($filename)
63
+        or !$last_modified = filemtime($filename)
64
+        or !$md5 = md5_file($filename)
65
+    ) {
66
+        return false;
67
+    }
68
+
69
+    include_spip('inc/distant');
70
+    $tmp_file = _DIR_TMP . 'ecran_securite.php';
71
+    $url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5);
72
+    $url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']);
73
+    $res = recuperer_url($url, [
74
+        'if_modified_since' => $last_modified,
75
+        'file' => $tmp_file
76
+    ]);
77
+
78
+    // si il y a une version plus recente que l'on a recu correctement
79
+    if (
80
+        $res['status'] == 200
81
+        and $res['length']
82
+        and $tmp_file = $res['file']
83
+    ) {
84
+        if ($md5 !== md5_file($tmp_file)) {
85
+            // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale
86
+            include_once $tmp_file;
87
+            // ok, on le copie a la place de l'ecran existant
88
+            // en backupant l'ecran avant, au cas ou
89
+            @copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified));
90
+            @rename($tmp_file, $filename);
91
+        } else {
92
+            @unlink($tmp_file);
93
+        }
94
+    }
95 95
 }
96 96
 
97 97
 /**
@@ -109,54 +109,54 @@  discard block
 block discarded – undo
109 109
  * @return string
110 110
  */
111 111
 function info_maj($dir, $file, $version) {
112
-	include_spip('inc/plugin');
113
-
114
-	list($maj, $min, $rev) = preg_split('/\D+/', $version);
115
-
116
-	$nom = _DIR_CACHE_XML . _VERSIONS_LISTE;
117
-	$page = !file_exists($nom) ? '' : file_get_contents($nom);
118
-	$page = info_maj_cache($nom, $dir, $page);
119
-
120
-	// reperer toutes les versions de numero majeur superieur ou egal
121
-	// (a revoir quand on arrivera a SPIP V10 ...)
122
-	$p = substr('0123456789', intval($maj));
123
-	$p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
124
-	preg_match_all($p, $page, $m, PREG_SET_ORDER);
125
-	$page = $page_majeure = '';
126
-
127
-	// branche en cours d'utilisation
128
-	$branche = implode('.', array_slice(explode('.', $version, 3), 0, 2));
129
-
130
-	foreach ($m as $v) {
131
-		$v = array_pad($v, 5, 0);
132
-		list(, $maj2, $min2, , $rev2) = $v;
133
-		$branche_maj = $maj2 . '.' . $min2;
134
-		$version_maj = $maj2 . '.' . $min2 . '.' . $rev2;
135
-		// d'abord les mises à jour de la même branche
136
-		if (
137
-			(spip_version_compare($version, $version_maj, '<'))
138
-			and (spip_version_compare($page, $version_maj, '<'))
139
-			and spip_version_compare($branche, $branche_maj, '=')
140
-		) {
141
-			$page = $version_maj;
142
-		}
143
-		// puis les mises à jours majeures
144
-		if (
145
-			(spip_version_compare($version, $version_maj, '<'))
146
-			and (spip_version_compare($page, $version_maj, '<'))
147
-			and spip_version_compare($branche, $branche_maj, '<')
148
-		) {
149
-			$page_majeure = $version_maj;
150
-		}
151
-	}
152
-	if (!$page and !$page_majeure) {
153
-		return '';
154
-	}
155
-
156
-	$message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : '';
157
-	$message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : '';
158
-
159
-	return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>';
112
+    include_spip('inc/plugin');
113
+
114
+    list($maj, $min, $rev) = preg_split('/\D+/', $version);
115
+
116
+    $nom = _DIR_CACHE_XML . _VERSIONS_LISTE;
117
+    $page = !file_exists($nom) ? '' : file_get_contents($nom);
118
+    $page = info_maj_cache($nom, $dir, $page);
119
+
120
+    // reperer toutes les versions de numero majeur superieur ou egal
121
+    // (a revoir quand on arrivera a SPIP V10 ...)
122
+    $p = substr('0123456789', intval($maj));
123
+    $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
124
+    preg_match_all($p, $page, $m, PREG_SET_ORDER);
125
+    $page = $page_majeure = '';
126
+
127
+    // branche en cours d'utilisation
128
+    $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2));
129
+
130
+    foreach ($m as $v) {
131
+        $v = array_pad($v, 5, 0);
132
+        list(, $maj2, $min2, , $rev2) = $v;
133
+        $branche_maj = $maj2 . '.' . $min2;
134
+        $version_maj = $maj2 . '.' . $min2 . '.' . $rev2;
135
+        // d'abord les mises à jour de la même branche
136
+        if (
137
+            (spip_version_compare($version, $version_maj, '<'))
138
+            and (spip_version_compare($page, $version_maj, '<'))
139
+            and spip_version_compare($branche, $branche_maj, '=')
140
+        ) {
141
+            $page = $version_maj;
142
+        }
143
+        // puis les mises à jours majeures
144
+        if (
145
+            (spip_version_compare($version, $version_maj, '<'))
146
+            and (spip_version_compare($page, $version_maj, '<'))
147
+            and spip_version_compare($branche, $branche_maj, '<')
148
+        ) {
149
+            $page_majeure = $version_maj;
150
+        }
151
+    }
152
+    if (!$page and !$page_majeure) {
153
+        return '';
154
+    }
155
+
156
+    $message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : '';
157
+    $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : '';
158
+
159
+    return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>';
160 160
 }
161 161
 
162 162
 /**
@@ -177,25 +177,25 @@  discard block
 block discarded – undo
177 177
  *     Contenu du fichier de cache de l'info de maj de SPIP.
178 178
  */
179 179
 function info_maj_cache($nom, $dir, $page = '') {
180
-	include_spip('inc/acces');
181
-	$alea_ephemere = charger_aleas();
182
-	$re = '<archives id="a' . $alea_ephemere . '">';
183
-	if (preg_match("/$re/", $page)) {
184
-		return $page;
185
-	}
186
-
187
-	$url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE;
188
-	$a = file_exists($nom) ? filemtime($nom) : '';
189
-	include_spip('inc/distant');
190
-	$res = recuperer_url_cache($url, ['if_modified_since' => $a]);
191
-	// Si rien de neuf (ou inaccessible), garder l'ancienne
192
-	if ($res) {
193
-		$page = $res['page'] ? $res['page'] : $page;
194
-	}
195
-	// Placer l'indicateur de fraicheur
196
-	$page = preg_replace('/^<archives.*?>/', $re, $page);
197
-	sous_repertoire(_DIR_CACHE_XML);
198
-	ecrire_fichier($nom, $page);
199
-
200
-	return $page;
180
+    include_spip('inc/acces');
181
+    $alea_ephemere = charger_aleas();
182
+    $re = '<archives id="a' . $alea_ephemere . '">';
183
+    if (preg_match("/$re/", $page)) {
184
+        return $page;
185
+    }
186
+
187
+    $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE;
188
+    $a = file_exists($nom) ? filemtime($nom) : '';
189
+    include_spip('inc/distant');
190
+    $res = recuperer_url_cache($url, ['if_modified_since' => $a]);
191
+    // Si rien de neuf (ou inaccessible), garder l'ancienne
192
+    if ($res) {
193
+        $page = $res['page'] ? $res['page'] : $page;
194
+    }
195
+    // Placer l'indicateur de fraicheur
196
+    $page = preg_replace('/^<archives.*?>/', $re, $page);
197
+    sous_repertoire(_DIR_CACHE_XML);
198
+    ecrire_fichier($nom, $page);
199
+
200
+    return $page;
201 201
 }
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -29,11 +29,11 @@  discard block
 block discarded – undo
29 29
 function genie_mise_a_jour_dist($t) {
30 30
 	include_spip('inc/meta');
31 31
 	$maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']);
32
-	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : '', 'non');
32
+	ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : '', 'non');
33 33
 
34 34
 	mise_a_jour_ecran_securite();
35 35
 
36
-	spip_log('Verification version SPIP : ' . ($maj ? $maj : 'version a jour'), 'verifie_maj');
36
+	spip_log('Verification version SPIP : '.($maj ? $maj : 'version a jour'), 'verifie_maj');
37 37
 
38 38
 	return 1;
39 39
 }
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	// si l'ecran n'est pas deja present ou pas updatable, sortir
59 59
 	if (
60 60
 		!_URL_ECRAN_SECURITE
61
-		or !file_exists($filename = _DIR_ETC . 'ecran_securite.php')
61
+		or !file_exists($filename = _DIR_ETC.'ecran_securite.php')
62 62
 		or !is_writable($filename)
63 63
 		or !$last_modified = filemtime($filename)
64 64
 		or !$md5 = md5_file($filename)
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	}
68 68
 
69 69
 	include_spip('inc/distant');
70
-	$tmp_file = _DIR_TMP . 'ecran_securite.php';
70
+	$tmp_file = _DIR_TMP.'ecran_securite.php';
71 71
 	$url = parametre_url(_URL_ECRAN_SECURITE, 'md5', $md5);
72 72
 	$url = parametre_url($url, 'vspip', $GLOBALS['spip_version_branche']);
73 73
 	$res = recuperer_url($url, [
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 			include_once $tmp_file;
87 87
 			// ok, on le copie a la place de l'ecran existant
88 88
 			// en backupant l'ecran avant, au cas ou
89
-			@copy($filename, $filename . '-bck-' . date('Y-m-d-His', $last_modified));
89
+			@copy($filename, $filename.'-bck-'.date('Y-m-d-His', $last_modified));
90 90
 			@rename($tmp_file, $filename);
91 91
 		} else {
92 92
 			@unlink($tmp_file);
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
 
114 114
 	list($maj, $min, $rev) = preg_split('/\D+/', $version);
115 115
 
116
-	$nom = _DIR_CACHE_XML . _VERSIONS_LISTE;
116
+	$nom = _DIR_CACHE_XML._VERSIONS_LISTE;
117 117
 	$page = !file_exists($nom) ? '' : file_get_contents($nom);
118 118
 	$page = info_maj_cache($nom, $dir, $page);
119 119
 
120 120
 	// reperer toutes les versions de numero majeur superieur ou egal
121 121
 	// (a revoir quand on arrivera a SPIP V10 ...)
122 122
 	$p = substr('0123456789', intval($maj));
123
-	$p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
123
+	$p = ',/'.$file.'\D+(['.$p.']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i';
124 124
 	preg_match_all($p, $page, $m, PREG_SET_ORDER);
125 125
 	$page = $page_majeure = '';
126 126
 
@@ -129,9 +129,9 @@  discard block
 block discarded – undo
129 129
 
130 130
 	foreach ($m as $v) {
131 131
 		$v = array_pad($v, 5, 0);
132
-		list(, $maj2, $min2, , $rev2) = $v;
133
-		$branche_maj = $maj2 . '.' . $min2;
134
-		$version_maj = $maj2 . '.' . $min2 . '.' . $rev2;
132
+		list(, $maj2, $min2,, $rev2) = $v;
133
+		$branche_maj = $maj2.'.'.$min2;
134
+		$version_maj = $maj2.'.'.$min2.'.'.$rev2;
135 135
 		// d'abord les mises à jour de la même branche
136 136
 		if (
137 137
 			(spip_version_compare($version, $version_maj, '<'))
@@ -153,10 +153,10 @@  discard block
 block discarded – undo
153 153
 		return '';
154 154
 	}
155 155
 
156
-	$message = $page ? _T('nouvelle_version_spip', ['version' => $page]) . ($page_majeure ? ' | ' : '') : '';
156
+	$message = $page ? _T('nouvelle_version_spip', ['version' => $page]).($page_majeure ? ' | ' : '') : '';
157 157
 	$message .= $page_majeure ? _T('nouvelle_version_spip_majeure', ['version' => $page_majeure]) : '';
158 158
 
159
-	return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>';
159
+	return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>".$message.'</a>';
160 160
 }
161 161
 
162 162
 /**
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
 function info_maj_cache($nom, $dir, $page = '') {
180 180
 	include_spip('inc/acces');
181 181
 	$alea_ephemere = charger_aleas();
182
-	$re = '<archives id="a' . $alea_ephemere . '">';
182
+	$re = '<archives id="a'.$alea_ephemere.'">';
183 183
 	if (preg_match("/$re/", $page)) {
184 184
 		return $page;
185 185
 	}
186 186
 
187
-	$url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE;
187
+	$url = _VERSIONS_SERVEUR.$dir.'/'._VERSIONS_LISTE;
188 188
 	$a = file_exists($nom) ? filemtime($nom) : '';
189 189
 	include_spip('inc/distant');
190 190
 	$res = recuperer_url_cache($url, ['if_modified_since' => $a]);
Please login to merge, or discard this patch.
ecrire/genie/maintenance.php 2 patches
Indentation   +47 added lines, -47 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
 
23 23
 /**
@@ -35,18 +35,18 @@  discard block
 block discarded – undo
35 35
  */
36 36
 function genie_maintenance_dist($t) {
37 37
 
38
-	// (re)mettre .htaccess avec deny from all
39
-	// dans les deux repertoires dits inaccessibles par http
40
-	include_spip('inc/acces');
41
-	verifier_htaccess(_DIR_ETC);
42
-	verifier_htaccess(_DIR_TMP);
38
+    // (re)mettre .htaccess avec deny from all
39
+    // dans les deux repertoires dits inaccessibles par http
40
+    include_spip('inc/acces');
41
+    verifier_htaccess(_DIR_ETC);
42
+    verifier_htaccess(_DIR_TMP);
43 43
 
44
-	// Verifier qu'aucune table n'est crashee
45
-	if (!_request('reinstall')) {
46
-		verifier_crash_tables();
47
-	}
44
+    // Verifier qu'aucune table n'est crashee
45
+    if (!_request('reinstall')) {
46
+        verifier_crash_tables();
47
+    }
48 48
 
49
-	return 1;
49
+    return 1;
50 50
 }
51 51
 
52 52
 
@@ -63,33 +63,33 @@  discard block
 block discarded – undo
63 63
  *     des tables qui ont crashé.
64 64
  */
65 65
 function verifier_crash_tables() {
66
-	if (spip_connect()) {
67
-		include_spip('base/serial');
68
-		include_spip('base/auxiliaires');
69
-		$crash = [];
70
-		foreach (['tables_principales', 'tables_auxiliaires'] as $com) {
71
-			foreach ($GLOBALS[$com] as $table => $desc) {
72
-				if (
73
-					!sql_select('*', $table, '', '', '', 1)
74
-					and !defined('spip_interdire_cache')
75
-				) { # cas "LOST CONNECTION"
76
-				$crash[] = $table;
77
-				}
78
-			}
79
-		}
80
-		#$crash[] = 'test';
81
-		if ($crash) {
82
-			ecrire_meta('message_crash_tables', serialize($crash));
83
-			spip_log('crash des tables', 'err');
84
-			spip_log($crash, 'err');
85
-		} else {
86
-			effacer_meta('message_crash_tables');
87
-		}
66
+    if (spip_connect()) {
67
+        include_spip('base/serial');
68
+        include_spip('base/auxiliaires');
69
+        $crash = [];
70
+        foreach (['tables_principales', 'tables_auxiliaires'] as $com) {
71
+            foreach ($GLOBALS[$com] as $table => $desc) {
72
+                if (
73
+                    !sql_select('*', $table, '', '', '', 1)
74
+                    and !defined('spip_interdire_cache')
75
+                ) { # cas "LOST CONNECTION"
76
+                $crash[] = $table;
77
+                }
78
+            }
79
+        }
80
+        #$crash[] = 'test';
81
+        if ($crash) {
82
+            ecrire_meta('message_crash_tables', serialize($crash));
83
+            spip_log('crash des tables', 'err');
84
+            spip_log($crash, 'err');
85
+        } else {
86
+            effacer_meta('message_crash_tables');
87
+        }
88 88
 
89
-		return $crash;
90
-	}
89
+        return $crash;
90
+    }
91 91
 
92
-	return false;
92
+    return false;
93 93
 }
94 94
 
95 95
 /**
@@ -105,15 +105,15 @@  discard block
 block discarded – undo
105 105
  * @return string
106 106
  */
107 107
 function message_crash_tables() {
108
-	if ($crash = verifier_crash_tables()) {
109
-		return
110
-			'<strong>' . _T('texte_recuperer_base') . '</strong><br />'
111
-			. ' <tt>' . join(', ', $crash) . '</tt><br />'
112
-			. generer_form_ecrire(
113
-				'base_repair',
114
-				_T('texte_crash_base'),
115
-				'',
116
-				_T('bouton_tenter_recuperation')
117
-			);
118
-	}
108
+    if ($crash = verifier_crash_tables()) {
109
+        return
110
+            '<strong>' . _T('texte_recuperer_base') . '</strong><br />'
111
+            . ' <tt>' . join(', ', $crash) . '</tt><br />'
112
+            . generer_form_ecrire(
113
+                'base_repair',
114
+                _T('texte_crash_base'),
115
+                '',
116
+                _T('bouton_tenter_recuperation')
117
+            );
118
+    }
119 119
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -107,8 +107,8 @@
 block discarded – undo
107 107
 function message_crash_tables() {
108 108
 	if ($crash = verifier_crash_tables()) {
109 109
 		return
110
-			'<strong>' . _T('texte_recuperer_base') . '</strong><br />'
111
-			. ' <tt>' . join(', ', $crash) . '</tt><br />'
110
+			'<strong>'._T('texte_recuperer_base').'</strong><br />'
111
+			. ' <tt>'.join(', ', $crash).'</tt><br />'
112 112
 			. generer_form_ecrire(
113 113
 				'base_repair',
114 114
 				_T('texte_crash_base'),
Please login to merge, or discard this patch.
ecrire/genie/optimiser.php 2 patches
Indentation   +111 added lines, -111 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
 
23 23
 include_spip('base/abstract_sql');
@@ -35,26 +35,26 @@  discard block
 block discarded – undo
35 35
  **/
36 36
 function genie_optimiser_dist($t) {
37 37
 
38
-	optimiser_base_une_table();
39
-	optimiser_base();
40
-	optimiser_caches_contextes();
38
+    optimiser_base_une_table();
39
+    optimiser_base();
40
+    optimiser_caches_contextes();
41 41
 
42
-	// la date souhaitee pour le tour suivant = apres-demain a 4h du mat ;
43
-	// sachant qu'on a un delai de 48h, on renvoie aujourd'hui a 4h du mat
44
-	// avec une periode de flou entre 2h et 6h pour ne pas saturer un hebergeur
45
-	// qui aurait beaucoup de sites SPIP
46
-	return -(mktime(2, 0, 0) + rand(0, 3600 * 4));
42
+    // la date souhaitee pour le tour suivant = apres-demain a 4h du mat ;
43
+    // sachant qu'on a un delai de 48h, on renvoie aujourd'hui a 4h du mat
44
+    // avec une periode de flou entre 2h et 6h pour ne pas saturer un hebergeur
45
+    // qui aurait beaucoup de sites SPIP
46
+    return -(mktime(2, 0, 0) + rand(0, 3600 * 4));
47 47
 }
48 48
 
49 49
 /**
50 50
  * Vider les contextes ajax de plus de 48h
51 51
  */
52 52
 function optimiser_caches_contextes() {
53
-	sous_repertoire(_DIR_CACHE, 'contextes');
54
-	if (is_dir($d = _DIR_CACHE . 'contextes')) {
55
-		include_spip('inc/invalideur');
56
-		purger_repertoire($d, ['mtime' => time() - 48 * 24 * 3600, 'limit' => 10000]);
57
-	}
53
+    sous_repertoire(_DIR_CACHE, 'contextes');
54
+    if (is_dir($d = _DIR_CACHE . 'contextes')) {
55
+        include_spip('inc/invalideur');
56
+        purger_repertoire($d, ['mtime' => time() - 48 * 24 * 3600, 'limit' => 10000]);
57
+    }
58 58
 }
59 59
 
60 60
 /**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
  * @return void
70 70
  **/
71 71
 function optimiser_base($attente = 86400) {
72
-	optimiser_base_disparus($attente);
72
+    optimiser_base_disparus($attente);
73 73
 }
74 74
 
75 75
 
@@ -86,28 +86,28 @@  discard block
 block discarded – undo
86 86
  **/
87 87
 function optimiser_base_une_table() {
88 88
 
89
-	$tables = [];
90
-	$result = sql_showbase();
91
-
92
-	// on n'optimise qu'une seule table a chaque fois,
93
-	// pour ne pas vautrer le systeme
94
-	// lire http://dev.mysql.com/doc/refman/5.0/fr/optimize-table.html
95
-	while ($row = sql_fetch($result)) {
96
-		$tables[] = array_shift($row);
97
-	}
98
-
99
-	spip_log('optimiser_base_une_table ' . json_encode($tables), 'genie' . _LOG_DEBUG);
100
-	if ($tables) {
101
-		$table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables);
102
-		ecrire_config('optimiser_table', $table_op);
103
-		$q = $tables[$table_op];
104
-		spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
105
-		if (sql_optimize($q)) {
106
-			spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
107
-		} else {
108
-			spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG);
109
-		}
110
-	}
89
+    $tables = [];
90
+    $result = sql_showbase();
91
+
92
+    // on n'optimise qu'une seule table a chaque fois,
93
+    // pour ne pas vautrer le systeme
94
+    // lire http://dev.mysql.com/doc/refman/5.0/fr/optimize-table.html
95
+    while ($row = sql_fetch($result)) {
96
+        $tables[] = array_shift($row);
97
+    }
98
+
99
+    spip_log('optimiser_base_une_table ' . json_encode($tables), 'genie' . _LOG_DEBUG);
100
+    if ($tables) {
101
+        $table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables);
102
+        ecrire_config('optimiser_table', $table_op);
103
+        $q = $tables[$table_op];
104
+        spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
105
+        if (sql_optimize($q)) {
106
+            spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
107
+        } else {
108
+            spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG);
109
+        }
110
+    }
111 111
 }
112 112
 
113 113
 
@@ -133,18 +133,18 @@  discard block
 block discarded – undo
133 133
  *     Nombre de suppressions
134 134
  **/
135 135
 function optimiser_sansref($table, $id, $sel, $and = '') {
136
-	$in = [];
137
-	while ($row = sql_fetch($sel)) {
138
-		$in[$row['id']] = true;
139
-	}
140
-	sql_free($sel);
141
-
142
-	if ($in) {
143
-		sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : ''));
144
-		spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG);
145
-	}
146
-
147
-	return count($in);
136
+    $in = [];
137
+    while ($row = sql_fetch($sel)) {
138
+        $in[$row['id']] = true;
139
+    }
140
+    sql_free($sel);
141
+
142
+    if ($in) {
143
+        sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : ''));
144
+        spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG);
145
+    }
146
+
147
+    return count($in);
148 148
 }
149 149
 
150 150
 
@@ -166,81 +166,81 @@  discard block
 block discarded – undo
166 166
  **/
167 167
 function optimiser_base_disparus($attente = 86400) {
168 168
 
169
-	# format = 20060610110141, si on veut forcer une optimisation tout de suite
170
-	$mydate = date('Y-m-d H:i:s', time() - $attente);
171
-	$mydate_quote = sql_quote($mydate);
169
+    # format = 20060610110141, si on veut forcer une optimisation tout de suite
170
+    $mydate = date('Y-m-d H:i:s', time() - $attente);
171
+    $mydate_quote = sql_quote($mydate);
172 172
 
173
-	$n = 0;
173
+    $n = 0;
174 174
 
175
-	//
176
-	// Rubriques
177
-	//
175
+    //
176
+    // Rubriques
177
+    //
178 178
 
179
-	# les articles qui sont dans une id_rubrique inexistante
180
-	# attention on controle id_rubrique>0 pour ne pas tuer les articles
181
-	# specialement affectes a une rubrique non-existante (plugin,
182
-	# cf. https://core.spip.net/issues/1549 )
183
-	$res = sql_select(
184
-		'A.id_article AS id',
185
-		'spip_articles AS A
179
+    # les articles qui sont dans une id_rubrique inexistante
180
+    # attention on controle id_rubrique>0 pour ne pas tuer les articles
181
+    # specialement affectes a une rubrique non-existante (plugin,
182
+    # cf. https://core.spip.net/issues/1549 )
183
+    $res = sql_select(
184
+        'A.id_article AS id',
185
+        'spip_articles AS A
186 186
 		        LEFT JOIN spip_rubriques AS R
187 187
 		          ON A.id_rubrique=R.id_rubrique',
188
-		"A.id_rubrique > 0
188
+        "A.id_rubrique > 0
189 189
 			 AND R.id_rubrique IS NULL
190 190
 		         AND A.maj < $mydate_quote"
191
-	);
191
+    );
192 192
 
193
-	$n += optimiser_sansref('spip_articles', 'id_article', $res);
193
+    $n += optimiser_sansref('spip_articles', 'id_article', $res);
194 194
 
195
-	// les articles a la poubelle
196
-	sql_delete('spip_articles', "statut='poubelle' AND maj < $mydate_quote");
195
+    // les articles a la poubelle
196
+    sql_delete('spip_articles', "statut='poubelle' AND maj < $mydate_quote");
197 197
 
198
-	//
199
-	// Auteurs
200
-	//
198
+    //
199
+    // Auteurs
200
+    //
201 201
 
202
-	include_spip('action/editer_liens');
203
-	// optimiser les liens de tous les auteurs vers des objets effaces
204
-	// et depuis des auteurs effaces
205
-	$n += objet_optimiser_liens(['auteur' => '*'], '*');
202
+    include_spip('action/editer_liens');
203
+    // optimiser les liens de tous les auteurs vers des objets effaces
204
+    // et depuis des auteurs effaces
205
+    $n += objet_optimiser_liens(['auteur' => '*'], '*');
206 206
 
207
-	# effacer les auteurs poubelle qui ne sont lies a rien
208
-	$res = sql_select(
209
-		'A.id_auteur AS id',
210
-		'spip_auteurs AS A
207
+    # effacer les auteurs poubelle qui ne sont lies a rien
208
+    $res = sql_select(
209
+        'A.id_auteur AS id',
210
+        'spip_auteurs AS A
211 211
 		      	LEFT JOIN spip_auteurs_liens AS L
212 212
 		          ON L.id_auteur=A.id_auteur',
213
-		"L.id_auteur IS NULL
213
+        "L.id_auteur IS NULL
214 214
 		       	AND A.statut='5poubelle' AND A.maj < $mydate_quote"
215
-	);
216
-
217
-	$n += optimiser_sansref('spip_auteurs', 'id_auteur', $res);
218
-
219
-	# supprimer les auteurs 'nouveau' qui n'ont jamais donne suite
220
-	# au mail de confirmation (45 jours pour repondre, ca devrait suffire)
221
-	if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) {
222
-		define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600);
223
-	}
224
-	sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
225
-
226
-	/**
227
-	 * Permet aux plugins de compléter l'optimisation suite aux éléments disparus
228
-	 *
229
-	 * L'index 'data' est un entier indiquant le nombre d'optimisations
230
-	 * qui ont été réalisées (par exemple le nombre de suppressions faites)
231
-	 * et qui doit être incrémenté par les fonctions
232
-	 * utilisant ce pipeline si elles suppriment des éléments.
233
-	 *
234
-	 * @pipeline_appel optimiser_base_disparus
235
-	 */
236
-	$n = pipeline('optimiser_base_disparus', [
237
-		'args' => [
238
-			'attente' => $attente,
239
-			'date' => $mydate
240
-		],
241
-		'data' => $n
242
-	]);
243
-
244
-
245
-	spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG);
215
+    );
216
+
217
+    $n += optimiser_sansref('spip_auteurs', 'id_auteur', $res);
218
+
219
+    # supprimer les auteurs 'nouveau' qui n'ont jamais donne suite
220
+    # au mail de confirmation (45 jours pour repondre, ca devrait suffire)
221
+    if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) {
222
+        define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600);
223
+    }
224
+    sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
225
+
226
+    /**
227
+     * Permet aux plugins de compléter l'optimisation suite aux éléments disparus
228
+     *
229
+     * L'index 'data' est un entier indiquant le nombre d'optimisations
230
+     * qui ont été réalisées (par exemple le nombre de suppressions faites)
231
+     * et qui doit être incrémenté par les fonctions
232
+     * utilisant ce pipeline si elles suppriment des éléments.
233
+     *
234
+     * @pipeline_appel optimiser_base_disparus
235
+     */
236
+    $n = pipeline('optimiser_base_disparus', [
237
+        'args' => [
238
+            'attente' => $attente,
239
+            'date' => $mydate
240
+        ],
241
+        'data' => $n
242
+    ]);
243
+
244
+
245
+    spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG);
246 246
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
  */
52 52
 function optimiser_caches_contextes() {
53 53
 	sous_repertoire(_DIR_CACHE, 'contextes');
54
-	if (is_dir($d = _DIR_CACHE . 'contextes')) {
54
+	if (is_dir($d = _DIR_CACHE.'contextes')) {
55 55
 		include_spip('inc/invalideur');
56 56
 		purger_repertoire($d, ['mtime' => time() - 48 * 24 * 3600, 'limit' => 10000]);
57 57
 	}
@@ -96,16 +96,16 @@  discard block
 block discarded – undo
96 96
 		$tables[] = array_shift($row);
97 97
 	}
98 98
 
99
-	spip_log('optimiser_base_une_table ' . json_encode($tables), 'genie' . _LOG_DEBUG);
99
+	spip_log('optimiser_base_une_table '.json_encode($tables), 'genie'._LOG_DEBUG);
100 100
 	if ($tables) {
101 101
 		$table_op = intval(lire_config('optimiser_table', 0) + 1) % sizeof($tables);
102 102
 		ecrire_config('optimiser_table', $table_op);
103 103
 		$q = $tables[$table_op];
104
-		spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
104
+		spip_log("optimiser_base_une_table : debut d'optimisation de la table $q", 'genie'._LOG_DEBUG);
105 105
 		if (sql_optimize($q)) {
106
-			spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie' . _LOG_DEBUG);
106
+			spip_log("optimiser_base_une_table : fin d'optimisation de la table $q", 'genie'._LOG_DEBUG);
107 107
 		} else {
108
-			spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie' . _LOG_DEBUG);
108
+			spip_log("optimiser_base_une_table : Pas d'optimiseur necessaire", 'genie'._LOG_DEBUG);
109 109
 		}
110 110
 	}
111 111
 }
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 	sql_free($sel);
141 141
 
142 142
 	if ($in) {
143
-		sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : ''));
144
-		spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie' . _LOG_DEBUG);
143
+		sql_delete($table, sql_in($id, array_keys($in)).($and ? " AND $and" : ''));
144
+		spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: ".implode(', ', array_keys($in)), 'genie'._LOG_DEBUG);
145 145
 	}
146 146
 
147 147
 	return count($in);
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 	if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) {
222 222
 		define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600);
223 223
 	}
224
-	sql_delete('spip_auteurs', "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
224
+	sql_delete('spip_auteurs', "statut='nouveau' AND maj < ".sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU))));
225 225
 
226 226
 	/**
227 227
 	 * Permet aux plugins de compléter l'optimisation suite aux éléments disparus
@@ -242,5 +242,5 @@  discard block
 block discarded – undo
242 242
 	]);
243 243
 
244 244
 
245
-	spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie' . _LOG_DEBUG);
245
+	spip_log("optimiser_base_disparus : {$n} lien(s) mort(s)", 'genie'._LOG_DEBUG);
246 246
 }
Please login to merge, or discard this patch.
ecrire/inc/drapeau_edition.php 1 patch
Indentation   +111 added lines, -111 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
  * @package SPIP\Core\Drapeaux\Edition
31 31
  **/
32 32
 if (!defined('_ECRIRE_INC_VERSION')) {
33
-	return;
33
+    return;
34 34
 }
35 35
 
36 36
 
@@ -45,46 +45,46 @@  discard block
 block discarded – undo
45 45
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
46 46
  **/
47 47
 function lire_tableau_edition() {
48
-	$edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
-	if (!$edition) {
50
-		return [];
51
-	}
52
-	$changed = false;
48
+    $edition = @unserialize($GLOBALS['meta']['drapeau_edition']);
49
+    if (!$edition) {
50
+        return [];
51
+    }
52
+    $changed = false;
53 53
 
54
-	$bon_pour_le_service = time() - 3600;
55
-	// parcourir le tableau et virer les vieux
56
-	foreach ($edition as $objet => $data) {
57
-		if (!is_array($data)) {
58
-			unset($edition[$objet]);
59
-		} // vieille version
60
-		else {
61
-			foreach ($data as $id => $tab) {
62
-				if (!is_array($tab)) {
63
-					unset($edition[$objet][$tab]);
64
-				} // vieille version
65
-				else {
66
-					foreach ($tab as $n => $duo) {
67
-						if (current($duo) < $bon_pour_le_service) {
68
-							unset($edition[$objet][$id][$n]);
69
-							$changed = true;
70
-						}
71
-					}
72
-				}
73
-				if (!$edition[$objet][$id]) {
74
-					unset($edition[$objet][$id]);
75
-				}
76
-			}
77
-		}
78
-		if (!$edition[$objet]) {
79
-			unset($edition[$objet]);
80
-		}
81
-	}
54
+    $bon_pour_le_service = time() - 3600;
55
+    // parcourir le tableau et virer les vieux
56
+    foreach ($edition as $objet => $data) {
57
+        if (!is_array($data)) {
58
+            unset($edition[$objet]);
59
+        } // vieille version
60
+        else {
61
+            foreach ($data as $id => $tab) {
62
+                if (!is_array($tab)) {
63
+                    unset($edition[$objet][$tab]);
64
+                } // vieille version
65
+                else {
66
+                    foreach ($tab as $n => $duo) {
67
+                        if (current($duo) < $bon_pour_le_service) {
68
+                            unset($edition[$objet][$id][$n]);
69
+                            $changed = true;
70
+                        }
71
+                    }
72
+                }
73
+                if (!$edition[$objet][$id]) {
74
+                    unset($edition[$objet][$id]);
75
+                }
76
+            }
77
+        }
78
+        if (!$edition[$objet]) {
79
+            unset($edition[$objet]);
80
+        }
81
+    }
82 82
 
83
-	if ($changed) {
84
-		ecrire_tableau_edition($edition);
85
-	}
83
+    if ($changed) {
84
+        ecrire_tableau_edition($edition);
85
+    }
86 86
 
87
-	return $edition;
87
+    return $edition;
88 88
 }
89 89
 
90 90
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *     `[ type d'objet ][id_objet][id_auteur][nom de l'auteur] = time()`
98 98
  **/
99 99
 function ecrire_tableau_edition($edition) {
100
-	ecrire_meta('drapeau_edition', serialize($edition));
100
+    ecrire_meta('drapeau_edition', serialize($edition));
101 101
 }
102 102
 
103 103
 /**
@@ -117,24 +117,24 @@  discard block
 block discarded – undo
117 117
  *     Type d'objet édité
118 118
  */
119 119
 function signale_edition($id, $auteur, $type = 'article') {
120
-	include_spip('base/objets');
121
-	include_spip('inc/filtres');
122
-	if (objet_info($type, 'editable') !== 'oui') {
123
-		return;
124
-	}
120
+    include_spip('base/objets');
121
+    include_spip('inc/filtres');
122
+    if (objet_info($type, 'editable') !== 'oui') {
123
+        return;
124
+    }
125 125
 
126
-	$edition = lire_tableau_edition();
127
-	if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) {
128
-		$nom = $auteur['nom'];
129
-	} else {
130
-		$nom = $id_a = $GLOBALS['ip'];
131
-	}
126
+    $edition = lire_tableau_edition();
127
+    if (isset($auteur['id_auteur']) and $id_a = $auteur['id_auteur']) {
128
+        $nom = $auteur['nom'];
129
+    } else {
130
+        $nom = $id_a = $GLOBALS['ip'];
131
+    }
132 132
 
133
-	if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
134
-		$edition[$type][$id] = [];
135
-	}
136
-	$edition[$type][$id][$id_a][$nom] = time();
137
-	ecrire_tableau_edition($edition);
133
+    if (!isset($edition[$type][$id]) or !is_array($edition[$type][$id])) {
134
+        $edition[$type][$id] = [];
135
+    }
136
+    $edition[$type][$id][$id_a][$nom] = time();
137
+    ecrire_tableau_edition($edition);
138 138
 }
139 139
 
140 140
 /**
@@ -151,9 +151,9 @@  discard block
 block discarded – undo
151 151
  */
152 152
 function qui_edite($id, $type = 'article') {
153 153
 
154
-	$edition = lire_tableau_edition();
154
+    $edition = lire_tableau_edition();
155 155
 
156
-	return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
156
+    return empty($edition[$type][$id]) ? [] : $edition[$type][$id];
157 157
 }
158 158
 
159 159
 /**
@@ -167,22 +167,22 @@  discard block
 block discarded – undo
167 167
  *     Liste de tableaux `['nom_auteur_modif' => x|y|z, 'date_diff' => n]`
168 168
  */
169 169
 function mention_qui_edite($id, $type = 'article') {
170
-	$modif = qui_edite($id, $type);
171
-	unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
170
+    $modif = qui_edite($id, $type);
171
+    unset($modif[$GLOBALS['visiteur_session']['id_auteur']]);
172 172
 
173
-	if ($modif) {
174
-		$quand = 0;
175
-		foreach ($modif as $duo) {
176
-			$auteurs[] = typo(key($duo));
177
-			$quand = max($quand, current($duo));
178
-		}
173
+    if ($modif) {
174
+        $quand = 0;
175
+        foreach ($modif as $duo) {
176
+            $auteurs[] = typo(key($duo));
177
+            $quand = max($quand, current($duo));
178
+        }
179 179
 
180
-		// format lie a la chaine de langue 'avis_article_modifie'
181
-		return [
182
-			'nom_auteur_modif' => join(' | ', $auteurs),
183
-			'date_diff' => ceil((time() - $quand) / 60)
184
-		];
185
-	}
180
+        // format lie a la chaine de langue 'avis_article_modifie'
181
+        return [
182
+            'nom_auteur_modif' => join(' | ', $auteurs),
183
+            'date_diff' => ceil((time() - $quand) / 60)
184
+        ];
185
+    }
186 186
 }
187 187
 
188 188
 /**
@@ -196,25 +196,25 @@  discard block
 block discarded – undo
196 196
  *     Liste de tableaux `['objet' => x, 'id_objet' => n]`
197 197
  */
198 198
 function liste_drapeau_edition($id_auteur) {
199
-	$edition = lire_tableau_edition();
200
-	$objets_ouverts = [];
199
+    $edition = lire_tableau_edition();
200
+    $objets_ouverts = [];
201 201
 
202
-	foreach ($edition as $objet => $data) {
203
-		foreach ($data as $id => $auteurs) {
204
-			if (
205
-				isset($auteurs[$id_auteur])
206
-				and is_array($auteurs[$id_auteur]) // precaution
207
-				and (array_pop($auteurs[$id_auteur]) > time() - 3600)
208
-			) {
209
-				$objets_ouverts[] = [
210
-					'objet' => $objet,
211
-					'id_objet' => $id,
212
-				];
213
-			}
214
-		}
215
-	}
202
+    foreach ($edition as $objet => $data) {
203
+        foreach ($data as $id => $auteurs) {
204
+            if (
205
+                isset($auteurs[$id_auteur])
206
+                and is_array($auteurs[$id_auteur]) // precaution
207
+                and (array_pop($auteurs[$id_auteur]) > time() - 3600)
208
+            ) {
209
+                $objets_ouverts[] = [
210
+                    'objet' => $objet,
211
+                    'id_objet' => $id,
212
+                ];
213
+            }
214
+        }
215
+    }
216 216
 
217
-	return $objets_ouverts;
217
+    return $objets_ouverts;
218 218
 }
219 219
 
220 220
 /**
@@ -227,15 +227,15 @@  discard block
 block discarded – undo
227 227
  * @return void
228 228
  */
229 229
 function debloquer_tous($id_auteur) {
230
-	$edition = lire_tableau_edition();
231
-	foreach ($edition as $objet => $data) {
232
-		foreach ($data as $id => $auteurs) {
233
-			if (isset($auteurs[$id_auteur])) {
234
-				unset($edition[$objet][$id][$id_auteur]);
235
-				ecrire_tableau_edition($edition);
236
-			}
237
-		}
238
-	}
230
+    $edition = lire_tableau_edition();
231
+    foreach ($edition as $objet => $data) {
232
+        foreach ($data as $id => $auteurs) {
233
+            if (isset($auteurs[$id_auteur])) {
234
+                unset($edition[$objet][$id][$id_auteur]);
235
+                ecrire_tableau_edition($edition);
236
+            }
237
+        }
238
+    }
239 239
 }
240 240
 
241 241
 /**
@@ -253,19 +253,19 @@  discard block
 block discarded – undo
253 253
  * @return void
254 254
  */
255 255
 function debloquer_edition($id_auteur, $id_objet, $type = 'article') {
256
-	$edition = lire_tableau_edition();
256
+    $edition = lire_tableau_edition();
257 257
 
258
-	foreach ($edition as $objet => $data) {
259
-		if ($objet == $type) {
260
-			foreach ($data as $id => $auteurs) {
261
-				if (
262
-					$id == $id_objet
263
-					and isset($auteurs[$id_auteur])
264
-				) {
265
-					unset($edition[$objet][$id][$id_auteur]);
266
-					ecrire_tableau_edition($edition);
267
-				}
268
-			}
269
-		}
270
-	}
258
+    foreach ($edition as $objet => $data) {
259
+        if ($objet == $type) {
260
+            foreach ($data as $id => $auteurs) {
261
+                if (
262
+                    $id == $id_objet
263
+                    and isset($auteurs[$id_auteur])
264
+                ) {
265
+                    unset($edition[$objet][$id][$id_auteur]);
266
+                    ecrire_tableau_edition($edition);
267
+                }
268
+            }
269
+        }
270
+    }
271 271
 }
Please login to merge, or discard this patch.