Completed
Push — master ( fb0017...92433c )
by cam
01:14
created
ecrire/action/tester.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
 			} else {
44 44
 				# Attention GD sait lire le gif mais pas forcement l'ecrire
45 45
 				if (function_exists('ImageCreateFromGIF')) {
46
-					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
46
+					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK.'test.gif');
47 47
 					if ($srcImage) {
48 48
 						$gd_formats_read_gif = ',gif';
49 49
 						ImageDestroy($srcImage);
@@ -67,28 +67,28 @@  discard block
 block discarded – undo
67 67
 			# les formats disponibles en ecriture... (cf. inc_logos)
68 68
 
69 69
 			if (function_exists('ImageCreateFromJPEG')) {
70
-				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
70
+				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK.'test.jpg');
71 71
 				if ($srcImage) {
72 72
 					$gd_formats[] = 'jpg';
73 73
 					ImageDestroy($srcImage);
74 74
 				}
75 75
 			}
76 76
 			if (function_exists('ImageCreateFromGIF')) {
77
-				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
77
+				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK.'test.gif');
78 78
 				if ($srcImage) {
79 79
 					$gd_formats[] = 'gif';
80 80
 					ImageDestroy($srcImage);
81 81
 				}
82 82
 			}
83 83
 			if (function_exists('ImageCreateFromPNG')) {
84
-				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
84
+				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK.'test.png');
85 85
 				if ($srcImage) {
86 86
 					$gd_formats[] = 'png';
87 87
 					ImageDestroy($srcImage);
88 88
 				}
89 89
 			}
90 90
 			if (function_exists('ImageCreateFromWEBP')) {
91
-				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
91
+				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK.'test.webp');
92 92
 				if ($srcImage) {
93 93
 					$gd_formats[] = 'webp';
94 94
 					ImageDestroy($srcImage);
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
 			}
97 97
 		}
98 98
 
99
-		if (! empty($gd_formats)) {
99
+		if (!empty($gd_formats)) {
100 100
 			$gd_formats = join(',', $gd_formats);
101 101
 		}
102
-		ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
102
+		ecrire_meta('gd_formats_read', $gd_formats.$gd_formats_read_gif);
103 103
 		ecrire_meta('gd_formats', $gd_formats);
104 104
 	} // verifier les formats netpbm
105 105
 	else {
@@ -123,9 +123,9 @@  discard block
 block discarded – undo
123 123
 				_PNMSCALE_COMMAND
124 124
 			);
125 125
 
126
-			$vignette = _ROOT_IMG_PACK . 'test.jpg';
127
-			$dest = _DIR_VAR . 'test-jpg.jpg';
128
-			$commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
126
+			$vignette = _ROOT_IMG_PACK.'test.jpg';
127
+			$dest = _DIR_VAR.'test-jpg.jpg';
128
+			$commande = "$jpegtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
129 129
 			spip_log($commande);
130 130
 			exec($commande);
131 131
 			if ($taille = @getimagesize($dest)) {
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 			}
136 136
 			$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137 137
 			$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
-			$vignette = _ROOT_IMG_PACK . 'test.gif';
139
-			$dest = _DIR_VAR . 'test-gif.jpg';
140
-			$commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
138
+			$vignette = _ROOT_IMG_PACK.'test.gif';
139
+			$dest = _DIR_VAR.'test-gif.jpg';
140
+			$commande = "$giftopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
141 141
 			spip_log($commande);
142 142
 			exec($commande);
143 143
 			if ($taille = @getimagesize($dest)) {
@@ -147,9 +147,9 @@  discard block
 block discarded – undo
147 147
 			}
148 148
 
149 149
 			$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
-			$vignette = _ROOT_IMG_PACK . 'test.png';
151
-			$dest = _DIR_VAR . 'test-gif.jpg';
152
-			$commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
150
+			$vignette = _ROOT_IMG_PACK.'test.png';
151
+			$dest = _DIR_VAR.'test-gif.jpg';
152
+			$commande = "$pngtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest";
153 153
 			spip_log($commande);
154 154
 			exec($commande);
155 155
 			if ($taille = @getimagesize($dest)) {
@@ -173,9 +173,9 @@  discard block
 block discarded – undo
173 173
 		include_spip('inc/filtres');
174 174
 		include_spip('inc/filtres_images_mini');
175 175
 		$taille_preview = 150;
176
-		$image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
176
+		$image = _image_valeurs_trans(_DIR_IMG_PACK.'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
177 177
 
178
-		$image['fichier_dest'] = _DIR_VAR . "test_$arg";
178
+		$image['fichier_dest'] = _DIR_VAR."test_$arg";
179 179
 
180 180
 		if (
181 181
 			$preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
Please login to merge, or discard this patch.
Indentation   +152 added lines, -152 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
 /**
@@ -30,155 +30,155 @@  discard block
 block discarded – undo
30 30
  * redirige sur l'image ainsi créée (sinon sur une image d'echec).
31 31
  **/
32 32
 function action_tester_dist() {
33
-	$arg = _request('arg');
34
-
35
-	$gd_formats = [];
36
-	$gd_formats_read_gif = '';
37
-	// verifier les formats acceptes par GD
38
-	if ($arg == 'gd1') {
39
-		// Si GD est installe et php >= 4.0.2
40
-		if (function_exists('imagetypes')) {
41
-			if (imagetypes() & IMG_GIF) {
42
-				$gd_formats[] = 'gif';
43
-			} else {
44
-				# Attention GD sait lire le gif mais pas forcement l'ecrire
45
-				if (function_exists('ImageCreateFromGIF')) {
46
-					$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
47
-					if ($srcImage) {
48
-						$gd_formats_read_gif = ',gif';
49
-						ImageDestroy($srcImage);
50
-					}
51
-				}
52
-			}
53
-
54
-			if (imagetypes() & IMG_JPG) {
55
-				$gd_formats[] = 'jpg';
56
-			}
57
-			if (imagetypes() & IMG_PNG) {
58
-				$gd_formats[] = 'png';
59
-			}
60
-			if (imagetypes() & IMG_WEBP) {
61
-				$gd_formats[] = 'webp';
62
-			}
63
-		} else {
64
-			# ancienne methode de detection des formats, qui en plus
65
-			# est bugguee car elle teste les formats en lecture
66
-			# alors que la valeur deduite sert a identifier
67
-			# les formats disponibles en ecriture... (cf. inc_logos)
68
-
69
-			if (function_exists('ImageCreateFromJPEG')) {
70
-				$srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
71
-				if ($srcImage) {
72
-					$gd_formats[] = 'jpg';
73
-					ImageDestroy($srcImage);
74
-				}
75
-			}
76
-			if (function_exists('ImageCreateFromGIF')) {
77
-				$srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
78
-				if ($srcImage) {
79
-					$gd_formats[] = 'gif';
80
-					ImageDestroy($srcImage);
81
-				}
82
-			}
83
-			if (function_exists('ImageCreateFromPNG')) {
84
-				$srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
85
-				if ($srcImage) {
86
-					$gd_formats[] = 'png';
87
-					ImageDestroy($srcImage);
88
-				}
89
-			}
90
-			if (function_exists('ImageCreateFromWEBP')) {
91
-				$srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
92
-				if ($srcImage) {
93
-					$gd_formats[] = 'webp';
94
-					ImageDestroy($srcImage);
95
-				}
96
-			}
97
-		}
98
-
99
-		if (! empty($gd_formats)) {
100
-			$gd_formats = join(',', $gd_formats);
101
-		}
102
-		ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
103
-		ecrire_meta('gd_formats', $gd_formats);
104
-	} // verifier les formats netpbm
105
-	else {
106
-		if ($arg == 'netpbm') {
107
-			if (!defined('_PNMSCALE_COMMAND')) {
108
-				define('_PNMSCALE_COMMAND', 'pnmscale');
109
-			} // Securite : mes_options.php peut preciser le chemin absolu
110
-			if (_PNMSCALE_COMMAND == '') {
111
-				return;
112
-			}
113
-			$netpbm_formats = [];
114
-
115
-			$jpegtopnm_command = str_replace(
116
-				'pnmscale',
117
-				'jpegtopnm',
118
-				_PNMSCALE_COMMAND
119
-			);
120
-			$pnmtojpeg_command = str_replace(
121
-				'pnmscale',
122
-				'pnmtojpeg',
123
-				_PNMSCALE_COMMAND
124
-			);
125
-
126
-			$vignette = _ROOT_IMG_PACK . 'test.jpg';
127
-			$dest = _DIR_VAR . 'test-jpg.jpg';
128
-			$commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
129
-			spip_log($commande);
130
-			exec($commande);
131
-			if ($taille = @getimagesize($dest)) {
132
-				if ($taille[1] == 10) {
133
-					$netpbm_formats[] = 'jpg';
134
-				}
135
-			}
136
-			$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137
-			$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
-			$vignette = _ROOT_IMG_PACK . 'test.gif';
139
-			$dest = _DIR_VAR . 'test-gif.jpg';
140
-			$commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
141
-			spip_log($commande);
142
-			exec($commande);
143
-			if ($taille = @getimagesize($dest)) {
144
-				if ($taille[1] == 10) {
145
-					$netpbm_formats[] = 'gif';
146
-				}
147
-			}
148
-
149
-			$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
-			$vignette = _ROOT_IMG_PACK . 'test.png';
151
-			$dest = _DIR_VAR . 'test-gif.jpg';
152
-			$commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
153
-			spip_log($commande);
154
-			exec($commande);
155
-			if ($taille = @getimagesize($dest)) {
156
-				if ($taille[1] == 10) {
157
-					$netpbm_formats[] = 'png';
158
-				}
159
-			}
160
-
161
-			ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: []));
162
-		}
163
-	}
164
-
165
-	// et maintenant envoyer la vignette de tests
166
-	if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) {
167
-		include_spip('inc/filtres');
168
-		include_spip('inc/filtres_images_mini');
169
-		$taille_preview = 150;
170
-		$image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
171
-
172
-		$image['fichier_dest'] = _DIR_VAR . "test_$arg";
173
-
174
-		if (
175
-			$preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
176
-			and ($preview['width'] * $preview['height'] > 0)
177
-		) {
178
-			redirige_par_entete($preview['fichier']);
179
-		}
180
-	}
181
-
182
-	# image echec
183
-	redirige_par_entete(chemin_image('echec-reducteur-xx.svg'));
33
+    $arg = _request('arg');
34
+
35
+    $gd_formats = [];
36
+    $gd_formats_read_gif = '';
37
+    // verifier les formats acceptes par GD
38
+    if ($arg == 'gd1') {
39
+        // Si GD est installe et php >= 4.0.2
40
+        if (function_exists('imagetypes')) {
41
+            if (imagetypes() & IMG_GIF) {
42
+                $gd_formats[] = 'gif';
43
+            } else {
44
+                # Attention GD sait lire le gif mais pas forcement l'ecrire
45
+                if (function_exists('ImageCreateFromGIF')) {
46
+                    $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
47
+                    if ($srcImage) {
48
+                        $gd_formats_read_gif = ',gif';
49
+                        ImageDestroy($srcImage);
50
+                    }
51
+                }
52
+            }
53
+
54
+            if (imagetypes() & IMG_JPG) {
55
+                $gd_formats[] = 'jpg';
56
+            }
57
+            if (imagetypes() & IMG_PNG) {
58
+                $gd_formats[] = 'png';
59
+            }
60
+            if (imagetypes() & IMG_WEBP) {
61
+                $gd_formats[] = 'webp';
62
+            }
63
+        } else {
64
+            # ancienne methode de detection des formats, qui en plus
65
+            # est bugguee car elle teste les formats en lecture
66
+            # alors que la valeur deduite sert a identifier
67
+            # les formats disponibles en ecriture... (cf. inc_logos)
68
+
69
+            if (function_exists('ImageCreateFromJPEG')) {
70
+                $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . 'test.jpg');
71
+                if ($srcImage) {
72
+                    $gd_formats[] = 'jpg';
73
+                    ImageDestroy($srcImage);
74
+                }
75
+            }
76
+            if (function_exists('ImageCreateFromGIF')) {
77
+                $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . 'test.gif');
78
+                if ($srcImage) {
79
+                    $gd_formats[] = 'gif';
80
+                    ImageDestroy($srcImage);
81
+                }
82
+            }
83
+            if (function_exists('ImageCreateFromPNG')) {
84
+                $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . 'test.png');
85
+                if ($srcImage) {
86
+                    $gd_formats[] = 'png';
87
+                    ImageDestroy($srcImage);
88
+                }
89
+            }
90
+            if (function_exists('ImageCreateFromWEBP')) {
91
+                $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . 'test.webp');
92
+                if ($srcImage) {
93
+                    $gd_formats[] = 'webp';
94
+                    ImageDestroy($srcImage);
95
+                }
96
+            }
97
+        }
98
+
99
+        if (! empty($gd_formats)) {
100
+            $gd_formats = join(',', $gd_formats);
101
+        }
102
+        ecrire_meta('gd_formats_read', $gd_formats . $gd_formats_read_gif);
103
+        ecrire_meta('gd_formats', $gd_formats);
104
+    } // verifier les formats netpbm
105
+    else {
106
+        if ($arg == 'netpbm') {
107
+            if (!defined('_PNMSCALE_COMMAND')) {
108
+                define('_PNMSCALE_COMMAND', 'pnmscale');
109
+            } // Securite : mes_options.php peut preciser le chemin absolu
110
+            if (_PNMSCALE_COMMAND == '') {
111
+                return;
112
+            }
113
+            $netpbm_formats = [];
114
+
115
+            $jpegtopnm_command = str_replace(
116
+                'pnmscale',
117
+                'jpegtopnm',
118
+                _PNMSCALE_COMMAND
119
+            );
120
+            $pnmtojpeg_command = str_replace(
121
+                'pnmscale',
122
+                'pnmtojpeg',
123
+                _PNMSCALE_COMMAND
124
+            );
125
+
126
+            $vignette = _ROOT_IMG_PACK . 'test.jpg';
127
+            $dest = _DIR_VAR . 'test-jpg.jpg';
128
+            $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
129
+            spip_log($commande);
130
+            exec($commande);
131
+            if ($taille = @getimagesize($dest)) {
132
+                if ($taille[1] == 10) {
133
+                    $netpbm_formats[] = 'jpg';
134
+                }
135
+            }
136
+            $giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
137
+            $pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
138
+            $vignette = _ROOT_IMG_PACK . 'test.gif';
139
+            $dest = _DIR_VAR . 'test-gif.jpg';
140
+            $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
141
+            spip_log($commande);
142
+            exec($commande);
143
+            if ($taille = @getimagesize($dest)) {
144
+                if ($taille[1] == 10) {
145
+                    $netpbm_formats[] = 'gif';
146
+                }
147
+            }
148
+
149
+            $pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
150
+            $vignette = _ROOT_IMG_PACK . 'test.png';
151
+            $dest = _DIR_VAR . 'test-gif.jpg';
152
+            $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest";
153
+            spip_log($commande);
154
+            exec($commande);
155
+            if ($taille = @getimagesize($dest)) {
156
+                if ($taille[1] == 10) {
157
+                    $netpbm_formats[] = 'png';
158
+                }
159
+            }
160
+
161
+            ecrire_meta('netpbm_formats', join(',', $netpbm_formats ?: []));
162
+        }
163
+    }
164
+
165
+    // et maintenant envoyer la vignette de tests
166
+    if (in_array($arg, ['gd1', 'gd2', 'imagick', 'convert', 'netpbm'])) {
167
+        include_spip('inc/filtres');
168
+        include_spip('inc/filtres_images_mini');
169
+        $taille_preview = 150;
170
+        $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg');
171
+
172
+        $image['fichier_dest'] = _DIR_VAR . "test_$arg";
173
+
174
+        if (
175
+            $preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
176
+            and ($preview['width'] * $preview['height'] > 0)
177
+        ) {
178
+            redirige_par_entete($preview['fichier']);
179
+        }
180
+    }
181
+
182
+    # image echec
183
+    redirige_par_entete(chemin_image('echec-reducteur-xx.svg'));
184 184
 }
Please login to merge, or discard this patch.
ecrire/action/logout.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -89,7 +89,7 @@
 block discarded – undo
89 89
 				_T('login_deconnexion_ok'),
90 90
 				_T('login_verifiez_navigateur'),
91 91
 				_T('login_retour_public'),
92
-				'redirect=' . _DIR_RESTREINT_ABS,
92
+				'redirect='._DIR_RESTREINT_ABS,
93 93
 				_T('login_test_navigateur'),
94 94
 				true
95 95
 			);
Please login to merge, or discard this patch.
Indentation   +80 added lines, -80 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('inc/cookie');
@@ -34,73 +34,73 @@  discard block
 block discarded – undo
34 34
  *
35 35
  */
36 36
 function action_logout_dist() {
37
-	$logout = _request('logout');
38
-	$url = securiser_redirect_action(_request('url'));
39
-	// cas particulier, logout dans l'espace public
40
-	if ($logout == 'public' and !$url) {
41
-		$url = url_de_base();
42
-	}
37
+    $logout = _request('logout');
38
+    $url = securiser_redirect_action(_request('url'));
39
+    // cas particulier, logout dans l'espace public
40
+    if ($logout == 'public' and !$url) {
41
+        $url = url_de_base();
42
+    }
43 43
 
44
-	// seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
45
-	if (
46
-		isset($GLOBALS['visiteur_session']['id_auteur'])
47
-		and is_numeric($GLOBALS['visiteur_session']['id_auteur'])
48
-		// des sessions anonymes avec id_auteur=0 existent, mais elle n'ont pas de statut : double check
49
-		and isset($GLOBALS['visiteur_session']['statut'])
50
-	) {
51
-		// il faut un jeton pour fermer la session (eviter les CSRF)
52
-		if (
53
-			!$jeton = _request('jeton')
54
-			or !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
55
-		) {
56
-			$jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
57
-			$action = generer_url_action('logout', "jeton=$jeton");
58
-			$action = parametre_url($action, 'logout', _request('logout'));
59
-			$action = parametre_url($action, 'url', _request('url'));
60
-			include_spip('inc/minipres');
61
-			include_spip('inc/filtres');
62
-			$texte = bouton_action(_T('spip:icone_deconnecter'), $action);
63
-			$texte = "<div class='boutons'>$texte</div>";
64
-			$texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
65
-			$res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
66
-			echo $res;
44
+    // seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
45
+    if (
46
+        isset($GLOBALS['visiteur_session']['id_auteur'])
47
+        and is_numeric($GLOBALS['visiteur_session']['id_auteur'])
48
+        // des sessions anonymes avec id_auteur=0 existent, mais elle n'ont pas de statut : double check
49
+        and isset($GLOBALS['visiteur_session']['statut'])
50
+    ) {
51
+        // il faut un jeton pour fermer la session (eviter les CSRF)
52
+        if (
53
+            !$jeton = _request('jeton')
54
+            or !verifier_jeton_logout($jeton, $GLOBALS['visiteur_session'])
55
+        ) {
56
+            $jeton = generer_jeton_logout($GLOBALS['visiteur_session']);
57
+            $action = generer_url_action('logout', "jeton=$jeton");
58
+            $action = parametre_url($action, 'logout', _request('logout'));
59
+            $action = parametre_url($action, 'url', _request('url'));
60
+            include_spip('inc/minipres');
61
+            include_spip('inc/filtres');
62
+            $texte = bouton_action(_T('spip:icone_deconnecter'), $action);
63
+            $texte = "<div class='boutons'>$texte</div>";
64
+            $texte .= '<script type="text/javascript">document.write("<style>body{visibility:hidden;}</style>");window.document.forms[0].submit();</script>';
65
+            $res = minipres(_T('spip:icone_deconnecter'), $texte, ['all_inline' => true]);
66
+            echo $res;
67 67
 
68
-			return;
69
-		}
68
+            return;
69
+        }
70 70
 
71
-		include_spip('inc/auth');
72
-		auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
73
-		// le logout explicite vaut destruction de toutes les sessions
74
-		if (isset($_COOKIE['spip_session'])) {
75
-			$session = charger_fonction('session', 'inc');
76
-			$session($GLOBALS['visiteur_session']['id_auteur']);
77
-			spip_setcookie('spip_session', $_COOKIE['spip_session'], [
78
-				'expires' => time() - 3600
79
-			]);
80
-		}
81
-		// si authentification http, et que la personne est loge,
82
-		// pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
83
-		if (
84
-			isset($_SERVER['PHP_AUTH_USER'])
85
-			and !$GLOBALS['ignore_auth_http']
86
-			and $GLOBALS['auth_can_disconnect']
87
-		) {
88
-			ask_php_auth(
89
-				_T('login_deconnexion_ok'),
90
-				_T('login_verifiez_navigateur'),
91
-				_T('login_retour_public'),
92
-				'redirect=' . _DIR_RESTREINT_ABS,
93
-				_T('login_test_navigateur'),
94
-				true
95
-			);
96
-		}
97
-	}
71
+        include_spip('inc/auth');
72
+        auth_trace($GLOBALS['visiteur_session'], '0000-00-00 00:00:00');
73
+        // le logout explicite vaut destruction de toutes les sessions
74
+        if (isset($_COOKIE['spip_session'])) {
75
+            $session = charger_fonction('session', 'inc');
76
+            $session($GLOBALS['visiteur_session']['id_auteur']);
77
+            spip_setcookie('spip_session', $_COOKIE['spip_session'], [
78
+                'expires' => time() - 3600
79
+            ]);
80
+        }
81
+        // si authentification http, et que la personne est loge,
82
+        // pour se deconnecter, il faut proposer un nouveau formulaire de connexion http
83
+        if (
84
+            isset($_SERVER['PHP_AUTH_USER'])
85
+            and !$GLOBALS['ignore_auth_http']
86
+            and $GLOBALS['auth_can_disconnect']
87
+        ) {
88
+            ask_php_auth(
89
+                _T('login_deconnexion_ok'),
90
+                _T('login_verifiez_navigateur'),
91
+                _T('login_retour_public'),
92
+                'redirect=' . _DIR_RESTREINT_ABS,
93
+                _T('login_test_navigateur'),
94
+                true
95
+            );
96
+        }
97
+    }
98 98
 
99
-	// Rediriger en contrant le cache navigateur (Safari3)
100
-	include_spip('inc/headers');
101
-	redirige_par_entete($url
102
-		? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
103
-		: generer_url_public('login'));
99
+    // Rediriger en contrant le cache navigateur (Safari3)
100
+    include_spip('inc/headers');
101
+    redirige_par_entete($url
102
+        ? parametre_url($url, 'var_hasard', uniqid(random_int(0, mt_getrandmax())), '&')
103
+        : generer_url_public('login'));
104 104
 }
105 105
 
106 106
 /**
@@ -111,17 +111,17 @@  discard block
 block discarded – undo
111 111
  * @return string
112 112
  */
113 113
 function generer_jeton_logout($session, $alea = null) {
114
-	if (is_null($alea)) {
115
-		include_spip('inc/acces');
116
-		$alea = charger_aleas();
117
-	}
114
+    if (is_null($alea)) {
115
+        include_spip('inc/acces');
116
+        $alea = charger_aleas();
117
+    }
118 118
 
119
-	$jeton = md5($session['date_session']
120
-		. $session['id_auteur']
121
-		. $session['statut']
122
-		. $alea);
119
+    $jeton = md5($session['date_session']
120
+        . $session['id_auteur']
121
+        . $session['statut']
122
+        . $alea);
123 123
 
124
-	return $jeton;
124
+    return $jeton;
125 125
 }
126 126
 
127 127
 /**
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
  * @return bool
136 136
  */
137 137
 function verifier_jeton_logout($jeton, $session) {
138
-	if (generer_jeton_logout($session) === $jeton) {
139
-		return true;
140
-	}
138
+    if (generer_jeton_logout($session) === $jeton) {
139
+        return true;
140
+    }
141 141
 
142
-	if (generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton) {
143
-		return true;
144
-	}
142
+    if (generer_jeton_logout($session, $GLOBALS['meta']['alea_ephemere_ancien']) === $jeton) {
143
+        return true;
144
+    }
145 145
 
146
-	return false;
146
+    return false;
147 147
 }
Please login to merge, or discard this patch.
ecrire/action/forcer_job.php 1 patch
Indentation   +11 added lines, -11 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
 /**
@@ -26,15 +26,15 @@  discard block
 block discarded – undo
26 26
  * @return void
27 27
  */
28 28
 function action_forcer_job_dist() {
29
-	$securiser_action = charger_fonction('securiser_action', 'inc');
30
-	$id_job = $securiser_action();
29
+    $securiser_action = charger_fonction('securiser_action', 'inc');
30
+    $id_job = $securiser_action();
31 31
 
32
-	if (
33
-		$id_job = intval($id_job)
34
-		and autoriser('forcer', 'job', $id_job)
35
-	) {
36
-		include_spip('inc/queue');
37
-		include_spip('inc/genie');
38
-		queue_schedule([$id_job]);
39
-	}
32
+    if (
33
+        $id_job = intval($id_job)
34
+        and autoriser('forcer', 'job', $id_job)
35
+    ) {
36
+        include_spip('inc/queue');
37
+        include_spip('inc/genie');
38
+        queue_schedule([$id_job]);
39
+    }
40 40
 }
Please login to merge, or discard this patch.
ecrire/action/purger.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
  * @package SPIP\Core\Cache
17 17
  **/
18 18
 if (!defined('_ECRIRE_INC_VERSION')) {
19
-	return;
19
+    return;
20 20
 }
21 21
 
22 22
 /**
@@ -39,57 +39,57 @@  discard block
 block discarded – undo
39 39
  *     de l'action sécurisée.
40 40
  */
41 41
 function action_purger_dist($arg = null) {
42
-	if (is_null($arg)) {
43
-		$securiser_action = charger_fonction('securiser_action', 'inc');
44
-		$arg = $securiser_action();
45
-	}
42
+    if (is_null($arg)) {
43
+        $securiser_action = charger_fonction('securiser_action', 'inc');
44
+        $arg = $securiser_action();
45
+    }
46 46
 
47
-	include_spip('inc/invalideur');
47
+    include_spip('inc/invalideur');
48 48
 
49
-	spip_log("purger $arg");
49
+    spip_log("purger $arg");
50 50
 
51
-	switch ($arg) {
52
-		case 'inhibe_cache':
53
-			// inhiber le cache pendant 24h
54
-			ecrire_meta('cache_inhib', $_SERVER['REQUEST_TIME'] + 24 * 3600);
55
-			break;
56
-		case 'reactive_cache':
57
-			effacer_meta('cache_inhib');
58
-			break;
51
+    switch ($arg) {
52
+        case 'inhibe_cache':
53
+            // inhiber le cache pendant 24h
54
+            ecrire_meta('cache_inhib', $_SERVER['REQUEST_TIME'] + 24 * 3600);
55
+            break;
56
+        case 'reactive_cache':
57
+            effacer_meta('cache_inhib');
58
+            break;
59 59
 
60
-		case 'cache':
61
-			supprime_invalideurs();
62
-			@spip_unlink(_CACHE_RUBRIQUES);
63
-			@spip_unlink(_CACHE_CHEMIN);
64
-			@spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz');
65
-			// on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3
66
-			// _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT
67
-			// pour eviter des problemes de concurence
68
-			// cf https://core.spip.net/issues/2989
69
-			//@spip_unlink(_CACHE_PIPELINES);
70
-			//@spip_unlink(_CACHE_PLUGINS_PATH);
71
-			//@spip_unlink(_CACHE_PLUGINS_FCT);
72
-			@spip_unlink(_CACHE_PLUGINS_OPT);
73
-			purger_repertoire(_DIR_CACHE, ['subdir' => true]);
74
-			purger_repertoire(_DIR_AIDE);
75
-			purger_repertoire(_DIR_VAR . 'cache-css');
76
-			purger_repertoire(_DIR_VAR . 'cache-js');
77
-			break;
60
+        case 'cache':
61
+            supprime_invalideurs();
62
+            @spip_unlink(_CACHE_RUBRIQUES);
63
+            @spip_unlink(_CACHE_CHEMIN);
64
+            @spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz');
65
+            // on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3
66
+            // _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT
67
+            // pour eviter des problemes de concurence
68
+            // cf https://core.spip.net/issues/2989
69
+            //@spip_unlink(_CACHE_PIPELINES);
70
+            //@spip_unlink(_CACHE_PLUGINS_PATH);
71
+            //@spip_unlink(_CACHE_PLUGINS_FCT);
72
+            @spip_unlink(_CACHE_PLUGINS_OPT);
73
+            purger_repertoire(_DIR_CACHE, ['subdir' => true]);
74
+            purger_repertoire(_DIR_AIDE);
75
+            purger_repertoire(_DIR_VAR . 'cache-css');
76
+            purger_repertoire(_DIR_VAR . 'cache-js');
77
+            break;
78 78
 
79
-		case 'squelettes':
80
-			purger_repertoire(_DIR_SKELS);
81
-			break;
79
+        case 'squelettes':
80
+            purger_repertoire(_DIR_SKELS);
81
+            break;
82 82
 
83
-		case 'vignettes':
84
-			purger_repertoire(_DIR_VAR . 'cache-gd2', ['subdir' => true]);
85
-			purger_repertoire(_DIR_VAR . 'cache-texte', ['subdir' => true]);
86
-			purger_repertoire(_DIR_VAR . 'cache-vignettes', ['subdir' => true]);
87
-			purger_repertoire(_DIR_VAR . 'cache-TeX', ['subdir' => true]);
88
-			supprime_invalideurs();
89
-			purger_repertoire(_DIR_CACHE, ['subdir' => true]);
90
-			break;
91
-	}
83
+        case 'vignettes':
84
+            purger_repertoire(_DIR_VAR . 'cache-gd2', ['subdir' => true]);
85
+            purger_repertoire(_DIR_VAR . 'cache-texte', ['subdir' => true]);
86
+            purger_repertoire(_DIR_VAR . 'cache-vignettes', ['subdir' => true]);
87
+            purger_repertoire(_DIR_VAR . 'cache-TeX', ['subdir' => true]);
88
+            supprime_invalideurs();
89
+            purger_repertoire(_DIR_CACHE, ['subdir' => true]);
90
+            break;
91
+    }
92 92
 
93
-	// le faire savoir aux plugins
94
-	pipeline('trig_purger', $arg);
93
+    // le faire savoir aux plugins
94
+    pipeline('trig_purger', $arg);
95 95
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			supprime_invalideurs();
62 62
 			@spip_unlink(_CACHE_RUBRIQUES);
63 63
 			@spip_unlink(_CACHE_CHEMIN);
64
-			@spip_unlink(_DIR_TMP . 'plugin_xml_cache.gz');
64
+			@spip_unlink(_DIR_TMP.'plugin_xml_cache.gz');
65 65
 			// on ne supprime que _CACHE_PLUGINS_OPT qui declenche la reconstruction des 3
66 66
 			// _CACHE_PIPELINES _CACHE_PLUGINS_PATH et _CACHE_PLUGINS_FCT
67 67
 			// pour eviter des problemes de concurence
@@ -72,8 +72,8 @@  discard block
 block discarded – undo
72 72
 			@spip_unlink(_CACHE_PLUGINS_OPT);
73 73
 			purger_repertoire(_DIR_CACHE, ['subdir' => true]);
74 74
 			purger_repertoire(_DIR_AIDE);
75
-			purger_repertoire(_DIR_VAR . 'cache-css');
76
-			purger_repertoire(_DIR_VAR . 'cache-js');
75
+			purger_repertoire(_DIR_VAR.'cache-css');
76
+			purger_repertoire(_DIR_VAR.'cache-js');
77 77
 			break;
78 78
 
79 79
 		case 'squelettes':
@@ -81,10 +81,10 @@  discard block
 block discarded – undo
81 81
 			break;
82 82
 
83 83
 		case 'vignettes':
84
-			purger_repertoire(_DIR_VAR . 'cache-gd2', ['subdir' => true]);
85
-			purger_repertoire(_DIR_VAR . 'cache-texte', ['subdir' => true]);
86
-			purger_repertoire(_DIR_VAR . 'cache-vignettes', ['subdir' => true]);
87
-			purger_repertoire(_DIR_VAR . 'cache-TeX', ['subdir' => true]);
84
+			purger_repertoire(_DIR_VAR.'cache-gd2', ['subdir' => true]);
85
+			purger_repertoire(_DIR_VAR.'cache-texte', ['subdir' => true]);
86
+			purger_repertoire(_DIR_VAR.'cache-vignettes', ['subdir' => true]);
87
+			purger_repertoire(_DIR_VAR.'cache-TeX', ['subdir' => true]);
88 88
 			supprime_invalideurs();
89 89
 			purger_repertoire(_DIR_CACHE, ['subdir' => true]);
90 90
 			break;
Please login to merge, or discard this patch.
ecrire/action/confirmer_inscription.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@
 block discarded – undo
55 55
 			if (autoriser('ecrire', '', '', $auteur['id_auteur'])) {
56 56
 				// poser un cookie admin aussi
57 57
 				$cookie = charger_fonction('cookie', 'action');
58
-				$cookie('@' . $GLOBALS['visiteur_session']['login']);
58
+				$cookie('@'.$GLOBALS['visiteur_session']['login']);
59 59
 				$GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
60 60
 			} else {
61 61
 				$GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
Please login to merge, or discard this patch.
Indentation   +44 added lines, -44 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
 /**
@@ -27,51 +27,51 @@  discard block
 block discarded – undo
27 27
  * @return void
28 28
  */
29 29
 function action_confirmer_inscription_dist() {
30
-	$jeton = _request('jeton');
31
-	$email = _request('email');
30
+    $jeton = _request('jeton');
31
+    $email = _request('email');
32 32
 
33
-	include_spip('action/inscrire_auteur');
34
-	if (
35
-		$auteur = auteur_verifier_jeton($jeton)
36
-		and $auteur['email'] == $email
37
-		and $auteur['statut'] == 'nouveau'
38
-	) {
39
-		// d'abord on confirme son statut
40
-		$auteur = confirmer_statut_inscription($auteur);
33
+    include_spip('action/inscrire_auteur');
34
+    if (
35
+        $auteur = auteur_verifier_jeton($jeton)
36
+        and $auteur['email'] == $email
37
+        and $auteur['statut'] == 'nouveau'
38
+    ) {
39
+        // d'abord on confirme son statut
40
+        $auteur = confirmer_statut_inscription($auteur);
41 41
 
42
-		// OK c'est un nouvel inscrit qui confirme :
43
-		// on le loge => ca va confirmer son statut et c'est plus sympa
44
-		include_spip('inc/auth');
45
-		auth_loger($auteur);
42
+        // OK c'est un nouvel inscrit qui confirme :
43
+        // on le loge => ca va confirmer son statut et c'est plus sympa
44
+        include_spip('inc/auth');
45
+        auth_loger($auteur);
46 46
 
47
-		// et on efface son jeton
48
-		auteur_effacer_jeton($auteur['id_auteur']);
47
+        // et on efface son jeton
48
+        auteur_effacer_jeton($auteur['id_auteur']);
49 49
 
50
-		// si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur
51
-		// TODO: ne semble pas marcher si inscrit non visiteur, a debug
52
-		if (!_request('redirect')) {
53
-			// on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
54
-			if (autoriser('ecrire', '', '', $auteur['id_auteur'])) {
55
-				// poser un cookie admin aussi
56
-				$cookie = charger_fonction('cookie', 'action');
57
-				$cookie('@' . $GLOBALS['visiteur_session']['login']);
58
-				$GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
59
-			} else {
60
-				$GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
61
-			}
62
-		}
63
-	} else {
64
-		// lien perime :
65
-		if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
66
-			// on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
67
-			if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) {
68
-				$GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
69
-			} else {
70
-				$GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
71
-			}
72
-		} else {
73
-			// rediriger vers la page de login si pas encore loge
74
-			$GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect'));
75
-		}
76
-	}
50
+        // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur
51
+        // TODO: ne semble pas marcher si inscrit non visiteur, a debug
52
+        if (!_request('redirect')) {
53
+            // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
54
+            if (autoriser('ecrire', '', '', $auteur['id_auteur'])) {
55
+                // poser un cookie admin aussi
56
+                $cookie = charger_fonction('cookie', 'action');
57
+                $cookie('@' . $GLOBALS['visiteur_session']['login']);
58
+                $GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
59
+            } else {
60
+                $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
61
+            }
62
+        }
63
+    } else {
64
+        // lien perime :
65
+        if (!empty($GLOBALS['visiteur_session']['id_auteur'])) {
66
+            // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos
67
+            if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) {
68
+                $GLOBALS['redirect'] = _DIR_RESTREINT_ABS;
69
+            } else {
70
+                $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site'];
71
+            }
72
+        } else {
73
+            // rediriger vers la page de login si pas encore loge
74
+            $GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect'));
75
+        }
76
+    }
77 77
 }
Please login to merge, or discard this patch.
ecrire/action/etre_webmestre.php 1 patch
Indentation   +21 added lines, -21 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('inc/actions');
@@ -29,23 +29,23 @@  discard block
 block discarded – undo
29 29
  * @return void
30 30
  */
31 31
 function action_etre_webmestre_dist() {
32
-	$securiser_action = charger_fonction('securiser_action', 'inc');
33
-	$time = $securiser_action();
32
+    $securiser_action = charger_fonction('securiser_action', 'inc');
33
+    $time = $securiser_action();
34 34
 
35
-	if (
36
-		time() - $time < 15 * 60
37
-		and $GLOBALS['visiteur_session']['statut'] == '0minirezo'
38
-		and $GLOBALS['visiteur_session']['webmestre'] !== 'oui'
39
-	) {
40
-		$action = _T('info_admin_etre_webmestre');
41
-		$admin = charger_fonction('admin', 'inc');
42
-		// lance la verif par ftp et l'appel
43
-		// a base_etre_webmestre_dist quand c'est OK
44
-		if ($r = $admin('etre_webmestre', $action)) {
45
-			echo $r;
46
-			exit;
47
-		}
48
-	}
35
+    if (
36
+        time() - $time < 15 * 60
37
+        and $GLOBALS['visiteur_session']['statut'] == '0minirezo'
38
+        and $GLOBALS['visiteur_session']['webmestre'] !== 'oui'
39
+    ) {
40
+        $action = _T('info_admin_etre_webmestre');
41
+        $admin = charger_fonction('admin', 'inc');
42
+        // lance la verif par ftp et l'appel
43
+        // a base_etre_webmestre_dist quand c'est OK
44
+        if ($r = $admin('etre_webmestre', $action)) {
45
+            echo $r;
46
+            exit;
47
+        }
48
+    }
49 49
 }
50 50
 
51 51
 /**
@@ -54,8 +54,8 @@  discard block
 block discarded – undo
54 54
  * @return void
55 55
  */
56 56
 function base_etre_webmestre_dist() {
57
-	if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' and $GLOBALS['visiteur_session']['webmestre'] !== 'oui') {
58
-		include_spip('action/editer_auteur');
59
-		auteur_instituer($GLOBALS['visiteur_session']['id_auteur'], ['webmestre' => 'oui'], true);
60
-	}
57
+    if ($GLOBALS['visiteur_session']['statut'] == '0minirezo' and $GLOBALS['visiteur_session']['webmestre'] !== 'oui') {
58
+        include_spip('action/editer_auteur');
59
+        auteur_instituer($GLOBALS['visiteur_session']['id_auteur'], ['webmestre' => 'oui'], true);
60
+    }
61 61
 }
Please login to merge, or discard this patch.
ecrire/action/referencer_traduction.php 2 patches
Indentation   +45 added lines, -45 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
 /**
@@ -41,54 +41,54 @@  discard block
 block discarded – undo
41 41
  */
42 42
 function action_referencer_traduction_dist($objet, $id_objet, $id_trad) {
43 43
 
44
-	// ne rien faire si id_trad est ambigu
45
-	if (!is_numeric($id_trad)) {
46
-		return false;
47
-	}
44
+    // ne rien faire si id_trad est ambigu
45
+    if (!is_numeric($id_trad)) {
46
+        return false;
47
+    }
48 48
 
49
-	$table_objet_sql = table_objet_sql($objet);
50
-	$id_table_objet = id_table_objet($objet);
49
+    $table_objet_sql = table_objet_sql($objet);
50
+    $id_table_objet = id_table_objet($objet);
51 51
 
52
-	// on a fourni un id_trad : affectation ou modification du groupe de trad
53
-	if ($id_trad) {
54
-		// selectionner l'objet cible, qui doit etre different de nous-meme,
55
-		// et quitter s'il n'existe pas
56
-		$id_lier = sql_getfetsel(
57
-			'id_trad',
58
-			$table_objet_sql,
59
-			"$id_table_objet=" . intval($id_trad) . " AND NOT($id_table_objet=" . intval($id_objet) . ')'
60
-		);
61
-		if ($id_lier === null) {
62
-			spip_log("echec lien de trad vers objet $objet/$id_objet incorrect ($id_trad)");
52
+    // on a fourni un id_trad : affectation ou modification du groupe de trad
53
+    if ($id_trad) {
54
+        // selectionner l'objet cible, qui doit etre different de nous-meme,
55
+        // et quitter s'il n'existe pas
56
+        $id_lier = sql_getfetsel(
57
+            'id_trad',
58
+            $table_objet_sql,
59
+            "$id_table_objet=" . intval($id_trad) . " AND NOT($id_table_objet=" . intval($id_objet) . ')'
60
+        );
61
+        if ($id_lier === null) {
62
+            spip_log("echec lien de trad vers objet $objet/$id_objet incorrect ($id_trad)");
63 63
 
64
-			return false;
65
-		}
64
+            return false;
65
+        }
66 66
 
67
-		// $id_lier est le numero du groupe de traduction
68
-		// Si l'objet vise n'est pas deja traduit, son identifiant devient
69
-		// le nouvel id_trad de ce nouveau groupe et on l'affecte aux deux
70
-		// objets
71
-		if ($id_lier == 0) {
72
-			sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "$id_table_objet IN ($id_trad, $id_objet)");
73
-		} // si id_lier = id_objet alors on veut changer la reference de tout le groupe de trad
74
-		elseif ($id_lier == $id_objet) {
75
-			sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "id_trad = $id_lier");
76
-		} // sinon ajouter notre objet dans le groupe
77
-		else {
78
-			sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=" . intval($id_objet));
79
-		}
80
-	} // on a fourni un id_trad nul : sortir id_objet du groupe de trad
81
-	else {
82
-		$old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=" . intval($id_objet));
83
-		// supprimer le lien de traduction
84
-		sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=" . intval($id_objet));
67
+        // $id_lier est le numero du groupe de traduction
68
+        // Si l'objet vise n'est pas deja traduit, son identifiant devient
69
+        // le nouvel id_trad de ce nouveau groupe et on l'affecte aux deux
70
+        // objets
71
+        if ($id_lier == 0) {
72
+            sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "$id_table_objet IN ($id_trad, $id_objet)");
73
+        } // si id_lier = id_objet alors on veut changer la reference de tout le groupe de trad
74
+        elseif ($id_lier == $id_objet) {
75
+            sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "id_trad = $id_lier");
76
+        } // sinon ajouter notre objet dans le groupe
77
+        else {
78
+            sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=" . intval($id_objet));
79
+        }
80
+    } // on a fourni un id_trad nul : sortir id_objet du groupe de trad
81
+    else {
82
+        $old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=" . intval($id_objet));
83
+        // supprimer le lien de traduction
84
+        sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=" . intval($id_objet));
85 85
 
86
-		// Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero.
87
-		$cpt = sql_countsel($table_objet_sql, 'id_trad=' . intval($old_id_trad));
88
-		if ($cpt == 1) {
89
-			sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad=' . intval($old_id_trad));
90
-		}
91
-	}
86
+        // Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero.
87
+        $cpt = sql_countsel($table_objet_sql, 'id_trad=' . intval($old_id_trad));
88
+        if ($cpt == 1) {
89
+            sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad=' . intval($old_id_trad));
90
+        }
91
+    }
92 92
 
93
-	return true;
93
+    return true;
94 94
 }
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$id_lier = sql_getfetsel(
57 57
 			'id_trad',
58 58
 			$table_objet_sql,
59
-			"$id_table_objet=" . intval($id_trad) . " AND NOT($id_table_objet=" . intval($id_objet) . ')'
59
+			"$id_table_objet=".intval($id_trad)." AND NOT($id_table_objet=".intval($id_objet).')'
60 60
 		);
61 61
 		if ($id_lier === null) {
62 62
 			spip_log("echec lien de trad vers objet $objet/$id_objet incorrect ($id_trad)");
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 			sql_updateq($table_objet_sql, ['id_trad' => $id_trad], "id_trad = $id_lier");
76 76
 		} // sinon ajouter notre objet dans le groupe
77 77
 		else {
78
-			sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=" . intval($id_objet));
78
+			sql_updateq($table_objet_sql, ['id_trad' => $id_lier], "$id_table_objet=".intval($id_objet));
79 79
 		}
80 80
 	} // on a fourni un id_trad nul : sortir id_objet du groupe de trad
81 81
 	else {
82
-		$old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=" . intval($id_objet));
82
+		$old_id_trad = sql_getfetsel('id_trad', $table_objet_sql, "$id_table_objet=".intval($id_objet));
83 83
 		// supprimer le lien de traduction
84
-		sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=" . intval($id_objet));
84
+		sql_updateq($table_objet_sql, ['id_trad' => 0], "$id_table_objet=".intval($id_objet));
85 85
 
86 86
 		// Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero.
87
-		$cpt = sql_countsel($table_objet_sql, 'id_trad=' . intval($old_id_trad));
87
+		$cpt = sql_countsel($table_objet_sql, 'id_trad='.intval($old_id_trad));
88 88
 		if ($cpt == 1) {
89
-			sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad=' . intval($old_id_trad));
89
+			sql_updateq($table_objet_sql, ['id_trad' => 0], 'id_trad='.intval($old_id_trad));
90 90
 		}
91 91
 	}
92 92
 
Please login to merge, or discard this patch.
ecrire/action/confirmer_email.php 2 patches
Indentation   +19 added lines, -19 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
 /**
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
  * @return void
29 29
  */
30 30
 function action_confirmer_email_dist() {
31
-	$securiser_action = charger_fonction('securiser_action', 'inc');
32
-	$arg = $securiser_action();
31
+    $securiser_action = charger_fonction('securiser_action', 'inc');
32
+    $arg = $securiser_action();
33 33
 
34
-	include_spip('inc/filtres');
35
-	if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) {
36
-		include_spip('action/editer_auteur');
37
-		auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]);
38
-	}
39
-	// verifier avant de rediriger pour invalider le message de confirmation
40
-	// si ca n'a pas marche
41
-	if (
42
-		$redirect = _request('redirect') and !$arg == sql_getfetsel(
43
-			'email',
44
-			'spip_auteurs',
45
-			'id_auteur=' . intval($GLOBALS['visiteur_session'])
46
-		)
47
-	) {
48
-		$GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', '');
49
-	}
34
+    include_spip('inc/filtres');
35
+    if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) {
36
+        include_spip('action/editer_auteur');
37
+        auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], ['email' => $arg]);
38
+    }
39
+    // verifier avant de rediriger pour invalider le message de confirmation
40
+    // si ca n'a pas marche
41
+    if (
42
+        $redirect = _request('redirect') and !$arg == sql_getfetsel(
43
+            'email',
44
+            'spip_auteurs',
45
+            'id_auteur=' . intval($GLOBALS['visiteur_session'])
46
+        )
47
+    ) {
48
+        $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', '');
49
+    }
50 50
 }
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 		$redirect = _request('redirect') and !$arg == sql_getfetsel(
43 43
 			'email',
44 44
 			'spip_auteurs',
45
-			'id_auteur=' . intval($GLOBALS['visiteur_session'])
45
+			'id_auteur='.intval($GLOBALS['visiteur_session'])
46 46
 		)
47 47
 	) {
48 48
 		$GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', '');
Please login to merge, or discard this patch.
ecrire/action/auth.php 1 patch
Indentation   +22 added lines, -22 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
 /**
@@ -25,25 +25,25 @@  discard block
 block discarded – undo
25 25
  */
26 26
 function action_auth_dist() {
27 27
 
28
-	$securiser_action = charger_fonction('securiser_action', 'inc');
29
-	$arg = $securiser_action();
30
-
31
-	if (!preg_match(',^(\w+)[/](.+)$,', $arg, $r)) {
32
-		spip_log("action_auth_dist $arg pas compris");
33
-	} else {
34
-		$auth_methode = $r[1];
35
-		$login = $r[2];
36
-		include_spip('inc/auth');
37
-		$res = auth_terminer_identifier_login($auth_methode, $login);
38
-
39
-		if (is_string($res)) { // Erreur
40
-			$redirect = _request('redirect');
41
-			$redirect = parametre_url($redirect, 'var_erreur', $res, '&');
42
-			include_spip('inc/headers');
43
-			redirige_par_entete($redirect);
44
-		}
45
-
46
-		// sinon on loge l'auteur identifie, et on finit (redirection automatique)
47
-		auth_loger($res);
48
-	}
28
+    $securiser_action = charger_fonction('securiser_action', 'inc');
29
+    $arg = $securiser_action();
30
+
31
+    if (!preg_match(',^(\w+)[/](.+)$,', $arg, $r)) {
32
+        spip_log("action_auth_dist $arg pas compris");
33
+    } else {
34
+        $auth_methode = $r[1];
35
+        $login = $r[2];
36
+        include_spip('inc/auth');
37
+        $res = auth_terminer_identifier_login($auth_methode, $login);
38
+
39
+        if (is_string($res)) { // Erreur
40
+            $redirect = _request('redirect');
41
+            $redirect = parametre_url($redirect, 'var_erreur', $res, '&');
42
+            include_spip('inc/headers');
43
+            redirige_par_entete($redirect);
44
+        }
45
+
46
+        // sinon on loge l'auteur identifie, et on finit (redirection automatique)
47
+        auth_loger($res);
48
+    }
49 49
 }
Please login to merge, or discard this patch.