Completed
Push — master ( 2e55e3...8b905c )
by cam
04:29
created
ecrire/inc/securiser_action.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
  * @param string|null $url_action
80 80
  * @return bool
81 81
  */
82
-function demander_confirmation_avant_action($titre, $titre_bouton, $url_action=null) {
82
+function demander_confirmation_avant_action($titre, $titre_bouton, $url_action = null) {
83 83
 
84 84
 	if (!$url_action) {
85 85
 		$url_action = self();
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 	$corps = "<div style='text-align:center;'>$bouton_action</div>";
103 103
 
104 104
 	include_spip("inc/minipres");
105
-	echo minipres($titre,$corps);
105
+	echo minipres($titre, $corps);
106 106
 	exit;
107 107
 }
108 108
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 		if ($mode === -1) {
144 144
 			return array('action' => $action, 'arg' => $arg, 'hash' => $hash);
145 145
 		} else {
146
-			return generer_url_action($action, "arg=" . rawurlencode($arg) . "&hash=$hash" . (!$r ? '' : "&redirect=$r"),
146
+			return generer_url_action($action, "arg=".rawurlencode($arg)."&hash=$hash".(!$r ? '' : "&redirect=$r"),
147 147
 				$mode, $public);
148 148
 		}
149 149
 	}
@@ -152,9 +152,9 @@  discard block
 block discarded – undo
152 152
 	$hash = calculer_action_auteur("$action-$arg");
153 153
 	$att .= " style='margin: 0px; border: 0px'";
154 154
 	if ($redirect) {
155
-		$redirect = "\n\t\t<input name='redirect' type='hidden' value='" . str_replace("'", '&#39;', $redirect) . "' />";
155
+		$redirect = "\n\t\t<input name='redirect' type='hidden' value='".str_replace("'", '&#39;', $redirect)."' />";
156 156
 	}
157
-	$mode .= $redirect . "
157
+	$mode .= $redirect."
158 158
 <input name='hash' type='hidden' value='$hash' />
159 159
 <input name='arg' type='hidden' value='$arg' />";
160 160
 
@@ -224,12 +224,12 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function _action_auteur($action, $id_auteur, $pass, $alea) {
226 226
 	static $sha = array();
227
-	if (!isset($sha[$id_auteur . $pass . $alea])) {
227
+	if (!isset($sha[$id_auteur.$pass.$alea])) {
228 228
 		if (!isset($GLOBALS['meta'][$alea])) {
229
-			if (!$exec = _request('exec') or !autoriser_sans_cookie($exec)){
229
+			if (!$exec = _request('exec') or !autoriser_sans_cookie($exec)) {
230 230
 				include_spip('inc/acces');
231 231
 				charger_aleas();
232
-				if (empty($GLOBALS['meta'][$alea])){
232
+				if (empty($GLOBALS['meta'][$alea])) {
233 233
 					include_spip('inc/minipres');
234 234
 					echo minipres();
235 235
 					spip_log("$alea indisponible");
@@ -238,12 +238,12 @@  discard block
 block discarded – undo
238 238
 			}
239 239
 		}
240 240
 		include_spip('auth/sha256.inc');
241
-		$sha[$id_auteur . $pass . $alea] = spip_sha256($id_auteur . $pass . @$GLOBALS['meta'][$alea]);
241
+		$sha[$id_auteur.$pass.$alea] = spip_sha256($id_auteur.$pass.@$GLOBALS['meta'][$alea]);
242 242
 	}
243 243
 	if (function_exists('sha1')) {
244
-		return sha1($action . $sha[$id_auteur . $pass . $alea]);
244
+		return sha1($action.$sha[$id_auteur.$pass.$alea]);
245 245
 	} else {
246
-		return md5($action . $sha[$id_auteur . $pass . $alea]);
246
+		return md5($action.$sha[$id_auteur.$pass.$alea]);
247 247
 	}
248 248
 }
249 249
 
@@ -323,9 +323,9 @@  discard block
 block discarded – undo
323 323
  */
324 324
 function calculer_cle_action($action) {
325 325
 	if (function_exists('sha1')) {
326
-		return sha1($action . secret_du_site());
326
+		return sha1($action.secret_du_site());
327 327
 	} else {
328
-		return md5($action . secret_du_site());
328
+		return md5($action.secret_du_site());
329 329
 	}
330 330
 }
331 331
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	// On nettoie l’URL de tous les var_.
366 366
 	$url = nettoyer_uri_var($url);
367 367
 
368
-	$token = _action_auteur('previsualiser-' . $url, $id_auteur, null, $alea);
368
+	$token = _action_auteur('previsualiser-'.$url, $id_auteur, null, $alea);
369 369
 	return "$id_auteur-$token";
370 370
 }
371 371
 
Please login to merge, or discard this patch.