@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | defined('URLS_PAGE_EXEMPLE') || define('URLS_PAGE_EXEMPLE', 'spip.php?article12'); |
@@ -37,23 +37,23 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function urls_page_generer_url_objet_dist(int $id, string $objet, string $args = '', string $ancre = ''): string { |
| 39 | 39 | |
| 40 | - if ($generer_url_externe = charger_fonction_url($objet, 'defaut')) { |
|
| 41 | - $url = $generer_url_externe($id, $args, $ancre); |
|
| 42 | - // une url === null indique "je ne traite pas cette url, appliquez le calcul standard" |
|
| 43 | - // une url vide est une url vide, ne rien faire de plus |
|
| 44 | - if (!is_null($url)) { |
|
| 45 | - return $url; |
|
| 46 | - } |
|
| 47 | - } |
|
| 40 | + if ($generer_url_externe = charger_fonction_url($objet, 'defaut')) { |
|
| 41 | + $url = $generer_url_externe($id, $args, $ancre); |
|
| 42 | + // une url === null indique "je ne traite pas cette url, appliquez le calcul standard" |
|
| 43 | + // une url vide est une url vide, ne rien faire de plus |
|
| 44 | + if (!is_null($url)) { |
|
| 45 | + return $url; |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | - $url = \_debut_urls_page . $objet . \_separateur_urls_page |
|
| 50 | - . $id . \_terminaison_urls_page; |
|
| 49 | + $url = \_debut_urls_page . $objet . \_separateur_urls_page |
|
| 50 | + . $id . \_terminaison_urls_page; |
|
| 51 | 51 | |
| 52 | - if ($args) { |
|
| 53 | - $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 54 | - } |
|
| 52 | + if ($args) { |
|
| 53 | + $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 54 | + } |
|
| 55 | 55 | |
| 56 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 56 | + return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | /** |
@@ -69,27 +69,27 @@ discard block |
||
| 69 | 69 | */ |
| 70 | 70 | function urls_page_decoder_url_dist(string $url, string $entite, array $contexte = []): array { |
| 71 | 71 | |
| 72 | - // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 73 | - if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') { |
|
| 74 | - return [[], '404']; |
|
| 75 | - } |
|
| 72 | + // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 73 | + if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') { |
|
| 74 | + return [[], '404']; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - include_spip('inc/urls'); |
|
| 78 | - $r = nettoyer_url_page($url, $contexte); |
|
| 79 | - if ($r) { |
|
| 80 | - array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 81 | - return $r; |
|
| 82 | - } |
|
| 77 | + include_spip('inc/urls'); |
|
| 78 | + $r = nettoyer_url_page($url, $contexte); |
|
| 79 | + if ($r) { |
|
| 80 | + array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 81 | + return $r; |
|
| 82 | + } |
|
| 83 | 83 | |
| 84 | - /* |
|
| 84 | + /* |
|
| 85 | 85 | * Le bloc qui suit sert a faciliter les transitions depuis |
| 86 | 86 | * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html' |
| 87 | 87 | * Il est inutile de le recopier si vous personnalisez vos URLs |
| 88 | 88 | * et votre .htaccess |
| 89 | 89 | */ |
| 90 | - // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 91 | - // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 92 | - $url_propre = $url ?? $_SERVER['REDIRECT_url_propre'] ?? $_ENV['url_propre'] ?? ''; |
|
| 93 | - return urls_transition_retrouver_anciennes_url_propres($url_propre, $entite, $contexte); |
|
| 94 | - /* Fin du bloc compatibilite url-propres */ |
|
| 90 | + // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 91 | + // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 92 | + $url_propre = $url ?? $_SERVER['REDIRECT_url_propre'] ?? $_ENV['url_propre'] ?? ''; |
|
| 93 | + return urls_transition_retrouver_anciennes_url_propres($url_propre, $entite, $contexte); |
|
| 94 | + /* Fin du bloc compatibilite url-propres */ |
|
| 95 | 95 | } |