| 4 | 
           david | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
              | 
        
        
            | 
            | 
           3 | 
           /***************************************************************************\
  | 
        
        
            | 
            | 
           4 | 
            *  SPIP, Systeme de publication pour l'internet                           *
  | 
        
        
            | 
            | 
           5 | 
            *                                                                         *
  | 
        
        
            | 
            | 
           6 | 
            *  Copyright (c) 2001-2005                                                *
  | 
        
        
            | 
            | 
           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 | 
           // executer une seule fois
  | 
        
        
            | 
            | 
           15 | 
           if (defined("_INC_URLS2")) return;
  | 
        
        
            | 
            | 
           16 | 
           define("_INC_URLS2", "1");
  | 
        
        
            | 
            | 
           17 | 
              | 
        
        
            | 
            | 
           18 | 
           function generer_url_article($id_article) {
  | 
        
        
            | 
            | 
           19 | 
           	return "article.php3?id_article=$id_article";
  | 
        
        
            | 
            | 
           20 | 
           }
  | 
        
        
            | 
            | 
           21 | 
              | 
        
        
            | 
            | 
           22 | 
           function generer_url_rubrique($id_rubrique) {
  | 
        
        
            | 
            | 
           23 | 
           	return "rubrique.php3?id_rubrique=$id_rubrique";
  | 
        
        
            | 
            | 
           24 | 
           }
  | 
        
        
            | 
            | 
           25 | 
              | 
        
        
            | 
            | 
           26 | 
           function generer_url_breve($id_breve) {
  | 
        
        
            | 
            | 
           27 | 
           	return "breve.php3?id_breve=$id_breve";
  | 
        
        
            | 
            | 
           28 | 
           }
  | 
        
        
            | 
            | 
           29 | 
              | 
        
        
            | 
            | 
           30 | 
           function generer_url_mot($id_mot) {
  | 
        
        
            | 
            | 
           31 | 
           	return "mot.php3?id_mot=$id_mot";
  | 
        
        
            | 
            | 
           32 | 
           }
  | 
        
        
            | 
            | 
           33 | 
              | 
        
        
            | 
            | 
           34 | 
           function generer_url_site($id_syndic) {
  | 
        
        
            | 
            | 
           35 | 
           	return "site.php3?id_syndic=$id_syndic";
  | 
        
        
            | 
            | 
           36 | 
           }
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
           function generer_url_auteur($id_auteur) {
  | 
        
        
            | 
            | 
           39 | 
           	return "auteur.php3?id_auteur=$id_auteur";
  | 
        
        
            | 
            | 
           40 | 
           }
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           function generer_url_document($id_document) {
  | 
        
        
            | 
            | 
           43 | 
           	if (intval($id_document) <= 0)
  | 
        
        
            | 
            | 
           44 | 
           		return '';
  | 
        
        
            | 
            | 
           45 | 
           	if ((lire_meta("creer_htaccess")) == 'oui')
  | 
        
        
            | 
            | 
           46 | 
           		return "spip_acces_doc.php3?id_document=$id_document";
  | 
        
        
            | 
            | 
           47 | 
           	if ($row = @spip_fetch_array(spip_query("SELECT fichier FROM spip_documents WHERE id_document = $id_document")))
  | 
        
        
            | 
            | 
           48 | 
           		return ($row['fichier']);
  | 
        
        
            | 
            | 
           49 | 
           	return '';
  | 
        
        
            | 
            | 
           50 | 
           }
  | 
        
        
            | 
            | 
           51 | 
              | 
        
        
            | 
            | 
           52 | 
           function recuperer_parametres_url($fond, $url) {
  | 
        
        
            | 
            | 
           53 | 
           	global $contexte;
  | 
        
        
            | 
            | 
           54 | 
              | 
        
        
            | 
            | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
           	/*
  | 
        
        
            | 
            | 
           57 | 
           	 * Le bloc qui suit sert a faciliter les transitions depuis
  | 
        
        
            | 
            | 
           58 | 
           	 * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html'
  | 
        
        
            | 
            | 
           59 | 
           	 * Il est inutile de le recopier si vous personnalisez vos URLs
  | 
        
        
            | 
            | 
           60 | 
           	 * et votre .htaccess
  | 
        
        
            | 
            | 
           61 | 
           	 */
  | 
        
        
            | 
            | 
           62 | 
           	// Si on est revenu en mode html, mais c'est une ancienne url_propre
  | 
        
        
            | 
            | 
           63 | 
           	// on ne redirige pas, on assume le nouveau contexte (si possible)
  | 
        
        
            | 
            | 
           64 | 
           	if ($url_propre = $GLOBALS['_SERVER']['REDIRECT_url_propre']
  | 
        
        
            | 
            | 
           65 | 
           	OR $url_propre = $GLOBALS['HTTP_ENV_VARS']['url_propre']
  | 
        
        
            | 
            | 
           66 | 
           	AND preg_match(',^(article|breve|rubrique|mot|auteur|site)$,', $fond)) {
  | 
        
        
            | 
            | 
           67 | 
           		$url_propre = preg_replace('/^[_+-]{0,2}(.*?)[_+-]{0,2}(\.html)?$/',
  | 
        
        
            | 
            | 
           68 | 
           			'$1', $url_propre);
  | 
        
        
            | 
            | 
           69 | 
           		if ($r = spip_query("SELECT ".id_table_objet($fond)." AS id
  | 
        
        
            | 
            | 
           70 | 
           		FROM spip_".table_objet($fond)."
  | 
        
        
            | 
            | 
           71 | 
           		WHERE url_propre = '".addslashes($url_propre)."'")
  | 
        
        
            | 
            | 
           72 | 
           		AND $t = spip_fetch_array($r))
  | 
        
        
            | 
            | 
           73 | 
           			$contexte[id_table_objet($fond)] = $t['id'];
  | 
        
        
            | 
            | 
           74 | 
           	}
  | 
        
        
            | 
            | 
           75 | 
           	/* Fin du bloc compatibilite url-propres */
  | 
        
        
            | 
            | 
           76 | 
              | 
        
        
            | 
            | 
           77 | 
           	return;
  | 
        
        
            | 
            | 
           78 | 
           }
  | 
        
        
            | 
            | 
           79 | 
              | 
        
        
            | 
            | 
           80 | 
           //
  | 
        
        
            | 
            | 
           81 | 
           // URLs des forums
  | 
        
        
            | 
            | 
           82 | 
           //
  | 
        
        
            | 
            | 
           83 | 
              | 
        
        
            | 
            | 
           84 | 
           function generer_url_forum($id_forum, $show_thread=false) {
  | 
        
        
            | 
            | 
           85 | 
           	include_ecrire('inc_forum.php3');
  | 
        
        
            | 
            | 
           86 | 
           	return generer_url_forum_dist($id_forum, $show_thread);
  | 
        
        
            | 
            | 
           87 | 
           }
  | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
           ?>
  |