Code Duplication    Length = 23-23 lines in 2 locations

ecrire/urls/arbo.php 1 location

@@ 341-363 (lines=23) @@
338
339
	// Migration depuis anciennes URLs ?
340
	// traiter les injections domain.tld/spip.php/n/importe/quoi/rubrique23
341
	if ($GLOBALS['profondeur_url']<=0
342
	AND $_SERVER['REQUEST_METHOD'] != 'POST') {
343
		include_spip('inc/urls');
344
		$r = nettoyer_url_page($i, $contexte);
345
		if ($r) {
346
			list($contexte, $type,,, $suite) = $r;
347
			$_id = id_table_objet($type);
348
			$id_objet = $contexte[$_id];
349
			$url_propre = generer_url_entite($id_objet, $type);
350
			if (strlen($url_propre)
351
			AND !strstr($url,$url_propre)) {
352
				list(,$hash) = explode('#', $url_propre);
353
				$args = array();
354
				foreach(array_filter(explode('&', $suite)) as $fragment) {
355
					if ($fragment != "$_id=$id_objet")
356
						$args[] = $fragment;
357
				}
358
				$url_redirect = generer_url_entite($id_objet, $type, join('&',array_filter($args)), $hash);
359
360
				return array($contexte, $type, $url_redirect, $type);
361
			}
362
		}
363
	}
364
	/* Fin compatibilite anciennes urls */
365
366
	// Chercher les valeurs d'environnement qui indiquent l'url-propre

ecrire/urls/propres.php 1 location

@@ 255-277 (lines=23) @@
252
253
	// Migration depuis anciennes URLs ?
254
	// traiter les injections domain.tld/spip.php/n/importe/quoi/rubrique23
255
	if ($GLOBALS['profondeur_url']<=0
256
	AND $_SERVER['REQUEST_METHOD'] != 'POST') {
257
		include_spip('inc/urls');
258
		$r = nettoyer_url_page($i, $contexte);
259
		if ($r) {
260
			list($contexte, $type,,, $suite) = $r;
261
			$_id = id_table_objet($type);
262
			$id_objet = $contexte[$_id];
263
			$url_propre = generer_url_entite($id_objet, $type);
264
			if (strlen($url_propre)
265
			AND !strstr($url,$url_propre)) {
266
				list(,$hash) = explode('#', $url_propre);
267
				$args = array();
268
				foreach(array_filter(explode('&', $suite)) as $fragment) {
269
					if ($fragment != "$_id=$id_objet")
270
						$args[] = $fragment;
271
				}
272
				$url_redirect = generer_url_entite($id_objet, $type, join('&',array_filter($args)), $hash);
273
274
				return array($contexte, $type, $url_redirect, $type);
275
			}
276
		}
277
	}
278
	/* Fin compatibilite anciennes urls */
279
	// Chercher les valeurs d'environnement qui indiquent l'url-propre
280
	if (isset($_SERVER['REDIRECT_url_propre']))