Commit | Line | Data |
---|---|---|
c495c100 P |
1 | <?php |
2 | ||
3 | /***************************************************************************\ | |
4 | * SPIP, Systeme de publication pour l'internet * | |
5 | * * | |
6 | * Copyright (c) 2001-2007 * | |
7 | * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * | |
8 | * * | |
9 | * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * | |
10 | * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * | |
11 | \***************************************************************************/ | |
12 | ||
13 | ||
14 | ## type d'URLs obsolete | |
15 | ||
16 | if (!defined("_ECRIRE_INC_VERSION")) return; // securiser | |
17 | if (!function_exists('generer_url_article')) { // si la place n'est pas prise | |
18 | ||
19 | // http://doc.spip.org/@generer_url_article | |
20 | function generer_url_article($id_article) { | |
21 | return "article.php3?id_article=$id_article"; | |
22 | } | |
23 | ||
24 | // http://doc.spip.org/@generer_url_rubrique | |
25 | function generer_url_rubrique($id_rubrique) { | |
26 | return "rubrique.php3?id_rubrique=$id_rubrique"; | |
27 | } | |
28 | ||
29 | // http://doc.spip.org/@generer_url_breve | |
30 | function generer_url_breve($id_breve) { | |
31 | return "breve.php3?id_breve=$id_breve"; | |
32 | } | |
33 | ||
34 | // http://doc.spip.org/@generer_url_mot | |
35 | function generer_url_mot($id_mot) { | |
36 | return "mot.php3?id_mot=$id_mot"; | |
37 | } | |
38 | ||
39 | // http://doc.spip.org/@generer_url_site | |
40 | function generer_url_site($id_syndic) { | |
41 | return "site.php3?id_syndic=$id_syndic"; | |
42 | } | |
43 | ||
44 | // http://doc.spip.org/@generer_url_auteur | |
45 | function generer_url_auteur($id_auteur) { | |
46 | return "auteur.php3?id_auteur=$id_auteur"; | |
47 | } | |
48 | ||
49 | // http://doc.spip.org/@generer_url_document | |
50 | function generer_url_document($id_document) { | |
51 | if (intval($id_document) <= 0) | |
52 | return ''; | |
53 | if (($GLOBALS['meta']["creer_htaccess"]) == 'oui') | |
54 | return generer_url_action('autoriser',"arg=$id_document", true); | |
55 | $row = @spip_fetch_array(spip_query("SELECT fichier FROM spip_documents WHERE id_document = $id_document")); | |
56 | if ($row) return ($row['fichier']); | |
57 | return ''; | |
58 | } | |
59 | ||
60 | // http://doc.spip.org/@recuperer_parametres_url | |
61 | function recuperer_parametres_url(&$fond, $url) { | |
62 | global $contexte; | |
63 | ||
64 | ||
65 | /* | |
66 | * Le bloc qui suit sert a faciliter les transitions depuis | |
67 | * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html' | |
68 | * Il est inutile de le recopier si vous personnalisez vos URLs | |
69 | * et votre .htaccess | |
70 | */ | |
71 | // Si on est revenu en mode html, mais c'est une ancienne url_propre | |
72 | // on ne redirige pas, on assume le nouveau contexte (si possible) | |
73 | $url_propre = isset($_SERVER['REDIRECT_url_propre']) ? | |
74 | $_SERVER['REDIRECT_url_propre'] : | |
75 | (isset($GLOBALS['HTTP_ENV_VARS']['url_propre']) ? | |
76 | $GLOBALS['HTTP_ENV_VARS']['url_propre'] : | |
77 | ''); | |
78 | if ($url_propre AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) { | |
79 | $url_propre = (preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/', | |
80 | '$1', $url_propre)); | |
81 | $id = id_table_objet($fond); | |
82 | $r = spip_query("SELECT $id AS id FROM spip_" . table_objet($fond) . " WHERE url_propre = " . _q($url_propre)); | |
83 | if ($r AND $r = spip_fetch_array($r)) | |
84 | $contexte[$id] = $r['id']; | |
85 | } | |
86 | /* Fin du bloc compatibilite url-propres */ | |
87 | ||
88 | /* Compatibilite urls-page */ | |
89 | else if (preg_match( | |
90 | ',[?/&](article|breve|rubrique|mot|auteur|site)[=]?([0-9]+),', | |
91 | $url, $r)) { | |
92 | $fond = $r[1]; | |
93 | $contexte[id_table_objet($r[1])] = $r[2]; | |
94 | } | |
95 | /* Fin compatibilite urls-page */ | |
96 | ||
97 | return; | |
98 | } | |
99 | ||
100 | // | |
101 | // URLs des forums | |
102 | // | |
103 | ||
104 | // http://doc.spip.org/@generer_url_forum | |
105 | function generer_url_forum($id_forum, $show_thread=false) { | |
106 | include_spip('inc/forum'); | |
107 | return generer_url_forum_dist($id_forum, $show_thread); | |
108 | } | |
109 | } | |
110 | ?> |