5 |
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 |
//
|
|
|
15 |
// Ce fichier ne sera execute qu'une fois
|
|
|
16 |
if (defined("_ECRIRE_INC_URLS")) return;
|
|
|
17 |
define("_ECRIRE_INC_URLS", "1");
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
function generer_url_article($id_article) {
|
|
|
21 |
if (($row = spip_fetch_array(spip_query(
|
|
|
22 |
"SELECT statut FROM spip_articles WHERE id_article=$id_article"
|
|
|
23 |
))) AND ($row['statut'] == 'publie'))
|
|
|
24 |
return "../spip_redirect.php3?id_article=$id_article";
|
|
|
25 |
else
|
|
|
26 |
return "articles.php3?id_article=$id_article";
|
|
|
27 |
}
|
|
|
28 |
|
|
|
29 |
function generer_url_rubrique($id_rubrique) {
|
|
|
30 |
if (($row = spip_fetch_array(spip_query(
|
|
|
31 |
"SELECT statut FROM spip_rubriques WHERE id_rubrique=$id_rubrique"
|
|
|
32 |
))) AND ($row['statut'] == 'publie'))
|
|
|
33 |
return "../spip_redirect.php3?id_rubrique=$id_rubrique";
|
|
|
34 |
else
|
|
|
35 |
return "naviguer.php3?id_rubrique=$id_rubrique";
|
|
|
36 |
}
|
|
|
37 |
|
|
|
38 |
function generer_url_breve($id_breve) {
|
|
|
39 |
if (($row = spip_fetch_array(spip_query(
|
|
|
40 |
"SELECT statut FROM spip_breves WHERE id_breve=$id_breve"
|
|
|
41 |
))) AND ($row['statut'] == 'publie'))
|
|
|
42 |
return "../spip_redirect.php3?id_breve=$id_breve";
|
|
|
43 |
else
|
|
|
44 |
return "breves_voir.php3?id_breve=$id_breve";
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
function generer_url_forum($id_forum) {
|
|
|
48 |
$url = "../spip_redirect.php3?id_forum=$id_forum";
|
|
|
49 |
return $url;
|
|
|
50 |
}
|
|
|
51 |
|
|
|
52 |
function generer_url_mot($id_mot) {
|
|
|
53 |
$url = "../spip_redirect.php3?id_mot=$id_mot";
|
|
|
54 |
return $url;
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
function generer_url_site($id_syndic) {
|
|
|
58 |
$url = "../spip_redirect.php3?id_syndic=$id_syndic";
|
|
|
59 |
return $url;
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
function generer_url_auteur($id_auteur) {
|
|
|
63 |
$url = "../spip_redirect.php3?id_auteur=$id_auteur";
|
|
|
64 |
return $url;
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
function generer_url_document($id_document) {
|
|
|
68 |
if (intval($id_document) <= 0)
|
|
|
69 |
return '';
|
|
|
70 |
if ($row = @spip_fetch_array(spip_query("SELECT fichier,distant
|
|
|
71 |
FROM spip_documents WHERE id_document = $id_document"))) {
|
|
|
72 |
if ($row['distant'] == 'oui') {
|
|
|
73 |
$url = $row['fichier'];
|
|
|
74 |
} else {
|
|
|
75 |
$url = '../' . ($row['fichier']);
|
|
|
76 |
if ((lire_meta("creer_htaccess")) == 'oui')
|
|
|
77 |
$url = "../spip_acces_doc.php3?id_document=$id_document";
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
return $url;
|
|
|
81 |
}
|
|
|
82 |
|
|
|
83 |
?>
|