Completed
Push — spip-3.0 ( cd2822...016705 )
by cam
08:31
created
ecrire/action/etre_webmestre.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 include_spip('inc/actions');
16 18
 
Please login to merge, or discard this patch.
ecrire/action/tester.php 1 patch
Braces   +33 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 // Tester nos capacites
16 18
 // http://doc.spip.org/@action_tester_dist
@@ -36,13 +38,13 @@  discard block
 block discarded – undo
36 38
 				}
37 39
 			}
38 40
 
39
-			if (imagetypes() & IMG_JPG)
40
-				$gd_formats[] = "jpg";
41
-			if (imagetypes() & IMG_PNG)
42
-				$gd_formats[] = "png";
43
-		}
44
-
45
-		else {	# ancienne methode de detection des formats, qui en plus
41
+			if (imagetypes() & IMG_JPG) {
42
+							$gd_formats[] = "jpg";
43
+			}
44
+			if (imagetypes() & IMG_PNG) {
45
+							$gd_formats[] = "png";
46
+			}
47
+		} else {	# ancienne methode de detection des formats, qui en plus
46 48
 				# est bugguee car elle teste les formats en lecture
47 49
 				# alors que la valeur deduite sert a identifier
48 50
 				# les formats disponibles en ecriture... (cf. inc_logos)
@@ -71,7 +73,9 @@  discard block
 block discarded – undo
71 73
 			}
72 74
 		}
73 75
 
74
-		if ($gd_formats) $gd_formats = join(",", $gd_formats);
76
+		if ($gd_formats) {
77
+		    $gd_formats = join(",", $gd_formats);
78
+		}
75 79
 		ecrire_meta("gd_formats_read", $gd_formats.$gd_formats_read_gif);
76 80
 		ecrire_meta("gd_formats", $gd_formats);
77 81
 	}
@@ -79,7 +83,9 @@  discard block
 block discarded – undo
79 83
 	// verifier les formats netpbm
80 84
 	else if ($arg == "netpbm") {
81 85
 		define('_PNMSCALE_COMMAND', 'pnmscale'); // chemin a changer dans mes_options
82
-		if (_PNMSCALE_COMMAND == '') return;
86
+		if (_PNMSCALE_COMMAND == '') {
87
+		    return;
88
+		}
83 89
 		$netpbm_formats= Array();
84 90
 
85 91
 		$jpegtopnm_command = str_replace("pnmscale",
@@ -93,7 +99,9 @@  discard block
 block discarded – undo
93 99
 		spip_log($commande);
94 100
 		exec($commande);
95 101
 		if ($taille = @getimagesize($dest)) {
96
-			if ($taille[1] == 10) $netpbm_formats[] = "jpg";
102
+			if ($taille[1] == 10) {
103
+			    $netpbm_formats[] = "jpg";
104
+			}
97 105
 		}
98 106
 		$giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND);
99 107
 		$pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND);
@@ -103,7 +111,9 @@  discard block
 block discarded – undo
103 111
 		spip_log($commande);
104 112
 		exec($commande);
105 113
 		if ($taille = @getimagesize($dest)) {
106
-			if ($taille[1] == 10) $netpbm_formats[] = "gif";
114
+			if ($taille[1] == 10) {
115
+			    $netpbm_formats[] = "gif";
116
+			}
107 117
 		}
108 118
 
109 119
 		$pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND);
@@ -113,14 +123,17 @@  discard block
 block discarded – undo
113 123
 		spip_log($commande);
114 124
 		exec($commande);
115 125
 		if ($taille = @getimagesize($dest)) {
116
-			if ($taille[1] == 10) $netpbm_formats[] = "png";
126
+			if ($taille[1] == 10) {
127
+			    $netpbm_formats[] = "png";
128
+			}
117 129
 		}
118 130
 
119 131
 
120
-		if ($netpbm_formats)
121
-			$netpbm_formats = join(",", $netpbm_formats);
122
-		else
123
-			$netpbm_formats = '';
132
+		if ($netpbm_formats) {
133
+					$netpbm_formats = join(",", $netpbm_formats);
134
+		} else {
135
+					$netpbm_formats = '';
136
+		}
124 137
 		ecrire_meta("netpbm_formats", $netpbm_formats);
125 138
 	}
126 139
 
@@ -133,8 +146,9 @@  discard block
 block discarded – undo
133 146
 
134 147
 		$image['fichier_dest']=_DIR_VAR."test_$arg";
135 148
 		if ($preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true)
136
-		AND ($preview['width'] * $preview['height'] > 0))
137
-			redirige_par_entete($preview['fichier']);
149
+		AND ($preview['width'] * $preview['height'] > 0)) {
150
+					redirige_par_entete($preview['fichier']);
151
+		}
138 152
 	}
139 153
 
140 154
 	# image echec
Please login to merge, or discard this patch.
ecrire/action/supprimer_rubrique.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 include_spip('inc/charsets');	# pour le nom de fichier
16 18
 
Please login to merge, or discard this patch.
ecrire/action/session.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 // Pour poser une variable de session
16 18
 // poster sur cette action en indiquant var/val
Please login to merge, or discard this patch.
ecrire/action/editer_article.php 1 patch
Braces   +43 added lines, -27 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 // http://doc.spip.org/@action_editer_article_dist
16 18
 function action_editer_article_dist($arg=null) {
@@ -25,19 +27,23 @@  discard block
 block discarded – undo
25 27
 	// mais on verifie qu'on a toutes les donnees qu'il faut.
26 28
 	if (!$id_article = intval($arg)) {
27 29
 		$id_parent = _request('id_parent');
28
-		if (!$id_parent)
29
-			$err = _L("creation interdite d'un article sans rubrique");
30
-		elseif(!autoriser('creerarticledans','rubrique',$id_parent))
31
-			$err = _T("info_creerdansrubrique_non_autorise");
32
-		else
33
-			$id_article = article_inserer($id_parent);
30
+		if (!$id_parent) {
31
+					$err = _L("creation interdite d'un article sans rubrique");
32
+		} elseif(!autoriser('creerarticledans','rubrique',$id_parent)) {
33
+					$err = _T("info_creerdansrubrique_non_autorise");
34
+		} else {
35
+					$id_article = article_inserer($id_parent);
36
+		}
34 37
 	}
35 38
 
36 39
 	// Enregistre l'envoi dans la BD
37
-	if ($id_article > 0) $err = article_modifier($id_article);
40
+	if ($id_article > 0) {
41
+	    $err = article_modifier($id_article);
42
+	}
38 43
 
39
-	if ($err)
40
-		spip_log("echec editeur article: $err",_LOG_ERREUR);
44
+	if ($err) {
45
+			spip_log("echec editeur article: $err",_LOG_ERREUR);
46
+	}
41 47
 
42 48
 	return array($id_article,$err);
43 49
 }
@@ -83,8 +89,9 @@  discard block
 block discarded – undo
83 89
 			'indexation' => $indexation,
84 90
 			'date_modif' => 'date_modif' // champ a mettre a date('Y-m-d H:i:s') s'il y a modif
85 91
 		),
86
-		$c))
87
-		return $err;
92
+		$c)) {
93
+			return $err;
94
+	}
88 95
 
89 96
 	// Modification de statut, changement de rubrique ?
90 97
 	$c = collecter_requests(array('date', 'statut', 'id_parent'),array(),$set);
@@ -108,7 +115,9 @@  discard block
 block discarded – undo
108 115
 	if (!$id_rubrique = intval($id_rubrique)) {
109 116
 		$row = sql_fetsel("id_rubrique, id_secteur, lang", "spip_rubriques", "id_parent=0",'', '0+titre,titre', "1");
110 117
 		$id_rubrique = $row['id_rubrique'];
111
-	} else $row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=$id_rubrique");
118
+	} else {
119
+	    $row = sql_fetsel("lang, id_secteur", "spip_rubriques", "id_rubrique=$id_rubrique");
120
+	}
112 121
 
113 122
 	// eviter $id_secteur = NULL (erreur sqlite) si la requete precedente echoue 
114 123
 	// cas de id_rubrique = -1 par exemple avec plugin "pages"
@@ -203,12 +212,13 @@  discard block
 block discarded – undo
203 212
 
204 213
 	// cf autorisations dans inc/instituer_article
205 214
 	if ($s != $statut OR ($d AND $d != $date)) {
206
-		if (autoriser('publierdans', 'rubrique', $id_rubrique))
207
-			$statut = $champs['statut'] = $s;
208
-		else if (autoriser('modifier', 'article', $id_article) AND $s != 'publie')
209
-			$statut = $champs['statut'] = $s;
210
-		else
211
-			spip_log("editer_article $id_article refus " . join(' ', $c));
215
+		if (autoriser('publierdans', 'rubrique', $id_rubrique)) {
216
+					$statut = $champs['statut'] = $s;
217
+		} else if (autoriser('modifier', 'article', $id_article) AND $s != 'publie') {
218
+					$statut = $champs['statut'] = $s;
219
+		} else {
220
+					spip_log("editer_article $id_article refus " . join(' ', $c));
221
+		}
212 222
 
213 223
 		// En cas de publication, fixer la date a "maintenant"
214 224
 		// sauf si $c commande autre chose
@@ -217,10 +227,11 @@  discard block
 block discarded – undo
217 227
 		if ($champs['statut'] == 'publie'
218 228
 		 OR ($champs['statut'] == 'prop' AND ($d OR !in_array($statut_ancien, array('publie', 'prop'))))
219 229
 		) {
220
-			if ($d OR strtotime($d=$date)>time())
221
-				$champs['date'] = $date = $d;
222
-			else
223
-				$champs['date'] = $date = date('Y-m-d H:i:s');
230
+			if ($d OR strtotime($d=$date)>time()) {
231
+							$champs['date'] = $date = $d;
232
+			} else {
233
+							$champs['date'] = $date = date('Y-m-d H:i:s');
234
+			}
224 235
 		}
225 236
 	}
226 237
 
@@ -235,8 +246,9 @@  discard block
 block discarded – undo
235 246
 		// et que le demandeur n'est pas admin de la rubrique de destination
236 247
 		// repasser l'article en statut 'propose'.
237 248
 		if ($statut == 'publie'
238
-		AND !autoriser('publierdans', 'rubrique', $id_parent))
239
-			$champs['statut'] = 'prop';
249
+		AND !autoriser('publierdans', 'rubrique', $id_parent)) {
250
+					$champs['statut'] = 'prop';
251
+		}
240 252
 	}
241 253
 
242 254
 	// Envoyer aux plugins
@@ -253,7 +265,9 @@  discard block
 block discarded – undo
253 265
 		)
254 266
 	);
255 267
 
256
-	if (!count($champs)) return '';
268
+	if (!count($champs)) {
269
+	    return '';
270
+	}
257 271
 
258 272
 	// Envoyer les modifs.
259 273
 
@@ -313,7 +327,9 @@  discard block
 block discarded – undo
313 327
 		}
314 328
 	}
315 329
 
316
-	if (!$champs) return;
330
+	if (!$champs) {
331
+	    return;
332
+	}
317 333
 
318 334
 	sql_updateq('spip_articles', $champs, "id_article=$id_article");
319 335
 
Please login to merge, or discard this patch.
ecrire/action/instituer_objet.php 1 patch
Braces   +11 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined("_ECRIRE_INC_VERSION")) return;
13
+if (!defined("_ECRIRE_INC_VERSION")) {
14
+    return;
15
+}
14 16
 
15 17
 /**
16 18
  * Instituer un objet avec les puces rapides
@@ -25,8 +27,14 @@  discard block
 block discarded – undo
25 27
 	}
26 28
 
27 29
 	list($objet, $id_objet, $statut) = preg_split('/\W/', $arg);
28
-	if (!$statut) $statut = _request('statut_nouv'); // cas POST
29
-	if (!$statut) return; // impossible mais sait-on jamais
30
+	if (!$statut) {
31
+	    $statut = _request('statut_nouv');
32
+	}
33
+	// cas POST
34
+	if (!$statut) {
35
+	    return;
36
+	}
37
+	// impossible mais sait-on jamais
30 38
 
31 39
 	if ($id_objet = intval($id_objet)
32 40
 		AND autoriser('instituer',$objet,$id_objet,'',array('statut'=>$statut))){
Please login to merge, or discard this patch.
ecrire/action/converser.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 include_spip('inc/cookie');
16 18
 
@@ -30,15 +32,17 @@  discard block
 block discarded – undo
30 32
 	$lang = action_converser_changer_langue($update_session);
31 33
 	$redirect = rawurldecode(_request('redirect'));
32 34
 
33
-	if (!$redirect) $redirect = _DIR_RESTREINT_ABS;
35
+	if (!$redirect) {
36
+	    $redirect = _DIR_RESTREINT_ABS;
37
+	}
34 38
 	$redirect = parametre_url($redirect,'lang',$lang,'&');
35 39
 	redirige_par_entete($redirect, true);
36 40
 }
37 41
 
38 42
 function action_converser_changer_langue($update_session){
39
-	if ($lang = _request('var_lang'))
40
-		action_converser_post($lang);
41
-	elseif ($lang = _request('var_lang_ecrire')) {
43
+	if ($lang = _request('var_lang')) {
44
+			action_converser_post($lang);
45
+	} elseif ($lang = _request('var_lang_ecrire')) {
42 46
 		if ($update_session) {
43 47
 			sql_updateq("spip_auteurs", array("lang" => $lang), "id_auteur = " . $GLOBALS['visiteur_session']['id_auteur']);
44 48
 			$GLOBALS['visiteur_session']['lang'] = $lang;
@@ -63,8 +67,9 @@  discard block
 block discarded – undo
63 67
 		include_spip('inc/lang');
64 68
 		if (changer_langue($lang)) {
65 69
 			spip_setcookie('spip_lang', $_COOKIE['spip_lang'] = $lang, time() + 365 * 24 * 3600);
66
-			if ($ecrire)
67
-				spip_setcookie('spip_lang_ecrire', $_COOKIE['spip_lang_ecrire'] = $lang, time() + 365 * 24 * 3600);
70
+			if ($ecrire) {
71
+							spip_setcookie('spip_lang_ecrire', $_COOKIE['spip_lang_ecrire'] = $lang, time() + 365 * 24 * 3600);
72
+			}
68 73
 		}
69 74
 	}
70 75
 }
Please login to merge, or discard this patch.
ecrire/action/logout.php 1 patch
Braces   +12 added lines, -7 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 include_spip('inc/cookie');
16 18
 
@@ -28,8 +30,9 @@  discard block
 block discarded – undo
28 30
 	$logout =_request('logout');
29 31
 	$url = securiser_redirect_action(_request('url'));
30 32
 	// cas particulier, logout dans l'espace public
31
-	if ($logout == 'public' AND !$url)
32
-		$url = url_de_base();
33
+	if ($logout == 'public' AND !$url) {
34
+			$url = url_de_base();
35
+	}
33 36
 
34 37
 	// seul le loge peut se deloger (mais id_auteur peut valoir 0 apres une restauration avortee)
35 38
 	if (isset($GLOBALS['visiteur_session']['id_auteur']) 
@@ -116,14 +119,16 @@  discard block
 block discarded – undo
116 119
  * @return bool
117 120
  */
118 121
 function verifier_jeton_logout($jeton,$session){
119
-	if (generer_jeton_logout($session)===$jeton)
120
-		return true;
122
+	if (generer_jeton_logout($session)===$jeton) {
123
+			return true;
124
+	}
121 125
 	if (!isset($GLOBALS['meta']['alea_ephemere_ancien'])){
122 126
 		include_spip('base/abstract_sql');
123 127
 		$GLOBALS['meta']['alea_ephemere_ancien'] = sql_getfetsel('valeur', 'spip_meta', "nom='alea_ephemere_ancien'");
124 128
 	}
125
-	if (generer_jeton_logout($session,$GLOBALS['meta']['alea_ephemere_ancien'])===$jeton)
126
-		return true;
129
+	if (generer_jeton_logout($session,$GLOBALS['meta']['alea_ephemere_ancien'])===$jeton) {
130
+			return true;
131
+	}
127 132
 	return false;
128 133
 }
129 134
 
Please login to merge, or discard this patch.
ecrire/action/referencer_traduction.php 1 patch
Braces   +9 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,7 +10,9 @@  discard block
 block discarded – undo
10 10
  *  Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne.   *
11 11
 \***************************************************************************/
12 12
 
13
-if (!defined('_ECRIRE_INC_VERSION')) return;
13
+if (!defined('_ECRIRE_INC_VERSION')) {
14
+    return;
15
+}
14 16
 
15 17
 /**
16 18
  * Definir le lien de traduction vers un objet de reference
@@ -26,7 +28,9 @@  discard block
 block discarded – undo
26 28
 function action_referencer_traduction_dist($objet, $id_objet, $id_trad) {
27 29
 
28 30
 	// ne rien faire si id_trad est ambigu
29
-	if (!is_numeric($id_trad)) return false;
31
+	if (!is_numeric($id_trad)) {
32
+	    return false;
33
+	}
30 34
 
31 35
 	$table_objet_sql = table_objet_sql($objet);
32 36
 	$id_table_objet = id_table_objet($objet);
@@ -65,8 +69,9 @@  discard block
 block discarded – undo
65 69
 
66 70
 		// Verifier si l'ancien groupe ne comporte plus qu'un seul objet. Alors mettre a zero.
67 71
 		$cpt = sql_countsel($table_objet_sql, "id_trad=".intval($old_id_trad));
68
-		if ($cpt == 1)
69
-			sql_updateq($table_objet_sql, array("id_trad" => 0), "id_trad=".intval($old_id_trad));
72
+		if ($cpt == 1) {
73
+					sql_updateq($table_objet_sql, array("id_trad" => 0), "id_trad=".intval($old_id_trad));
74
+		}
70 75
 	}
71 76
 
72 77
 	return true;
Please login to merge, or discard this patch.