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 |
include ("inc.php3");
|
|
|
15 |
|
|
|
16 |
function forum_parent($id_forum) {
|
|
|
17 |
$row=spip_fetch_array(spip_query("
|
|
|
18 |
SELECT * FROM spip_forum WHERE id_forum=$id_forum AND statut != 'redac'
|
|
|
19 |
"));
|
|
|
20 |
if (!$row) return '';
|
|
|
21 |
$id_forum=$row['id_forum'];
|
|
|
22 |
$forum_id_parent=$row['id_parent'];
|
|
|
23 |
$forum_id_rubrique=$row['id_rubrique'];
|
|
|
24 |
$forum_id_article=$row['id_article'];
|
|
|
25 |
$forum_id_breve=$row['id_breve'];
|
|
|
26 |
$forum_id_syndic=$row['id_syndic'];
|
|
|
27 |
$forum_stat=$row['statut'];
|
|
|
28 |
|
|
|
29 |
if ($forum_id_article > 0) {
|
|
|
30 |
$row=spip_fetch_array(spip_query("
|
|
|
31 |
SELECT id_article, titre, statut FROM spip_articles WHERE id_article='$forum_id_article'"));
|
|
|
32 |
$id_article = $row['id_article'];
|
|
|
33 |
$titre = $row['titre'];
|
|
|
34 |
$statut = $row['statut'];
|
|
|
35 |
if ($forum_stat == "prive" OR $forum_stat == "privoff") {
|
|
|
36 |
return array('pref' => _T('item_reponse_article'),
|
|
|
37 |
'url' => "articles.php3?id_article=$id_article",
|
|
|
38 |
'type' => 'id_article',
|
|
|
39 |
'valeur' => $id_article,
|
|
|
40 |
'titre' => $titre);
|
|
|
41 |
} else {
|
|
|
42 |
return array('pref' => _T('lien_reponse_article'),
|
|
|
43 |
'url' => generer_url_article($id_article),
|
|
|
44 |
'type' => 'id_article',
|
|
|
45 |
'valeur' => $id_article,
|
|
|
46 |
'titre' => $titre,
|
|
|
47 |
'avant' => "<a href='articles_forum.php3?id_article=$id_article'><font color='red'>"._T('lien_forum_public'). "</font></a><br>");
|
|
|
48 |
}
|
|
|
49 |
}
|
|
|
50 |
else if ($forum_id_rubrique > 0) {
|
|
|
51 |
$row = spip_fetch_array(spip_query("
|
|
|
52 |
SELECT * FROM spip_rubriques WHERE id_rubrique=\"$forum_id_rubrique\""));
|
|
|
53 |
$id_rubrique = $row['id_rubrique'];
|
|
|
54 |
$titre = $row['titre'];
|
|
|
55 |
return array('pref' => _T('lien_reponse_rubrique'),
|
|
|
56 |
'url' => generer_url_rubrique($id_rubrique),
|
|
|
57 |
'type' => 'id_rubrique',
|
|
|
58 |
'valeur' => $id_rubrique,
|
|
|
59 |
'titre' => $titre);
|
|
|
60 |
}
|
|
|
61 |
else if ($forum_id_syndic > 0) {
|
|
|
62 |
$row = spip_fetch_array(spip_query("
|
|
|
63 |
SELECT * FROM spip_syndic WHERE id_syndic=\"$forum_id_syndic\""));
|
|
|
64 |
$id_syndic = $row['id_syndic'];
|
|
|
65 |
$titre = $row['nom_site'];
|
|
|
66 |
$statut = $row['statut'];
|
|
|
67 |
return array('pref' => _T('lien_reponse_site_reference'),
|
|
|
68 |
'url' => "sites.php3?id_syndic=$id_syndic",
|
|
|
69 |
'type' => 'id_syndic',
|
|
|
70 |
'valeur' => $id_syndic,
|
|
|
71 |
'titre' => $titre);
|
|
|
72 |
}
|
|
|
73 |
else if ($forum_id_breve > 0) {
|
|
|
74 |
$row = spip_fetch_array(spip_query("
|
|
|
75 |
SELECT * FROM spip_breves WHERE id_breve=\"$forum_id_breve\""));
|
|
|
76 |
$id_breve = $row['id_breve'];
|
|
|
77 |
$date_heure = $row['date_heure'];
|
|
|
78 |
$titre = $row['titre'];
|
|
|
79 |
if ($forum_stat == "prive") {
|
|
|
80 |
return array('pref' => _T('lien_reponse_breve'),
|
|
|
81 |
'url' => "breves_voir.php3?id_breve=$id_breve",
|
|
|
82 |
'type' => 'id_breve',
|
|
|
83 |
'valeur' => $id_breve,
|
|
|
84 |
'titre' => $titre);
|
|
|
85 |
} else {
|
|
|
86 |
return array('pref' => _T('lien_reponse_breve_2'),
|
|
|
87 |
'url' => generer_url_breve($id_breve),
|
|
|
88 |
'type' => 'id_breve',
|
|
|
89 |
'valeur' => $id_breve,
|
|
|
90 |
'titre' => $titre);
|
|
|
91 |
}
|
|
|
92 |
}
|
|
|
93 |
else if ($forum_stat == "privadm") {
|
|
|
94 |
$retour = forum_parent($forum_id_parent);
|
|
|
95 |
if ($retour) return $retour;
|
|
|
96 |
else return array('pref' => _T('info_message'),
|
|
|
97 |
'url' => 'forum_admin.php3',
|
|
|
98 |
'titre' => _T('info_forum_administrateur'));
|
|
|
99 |
}
|
|
|
100 |
else {
|
|
|
101 |
$retour = forum_parent($forum_id_parent);
|
|
|
102 |
if ($retour) return $retour;
|
|
|
103 |
else return array('pref' => _T('info_message'),
|
|
|
104 |
'url' => 'forum.php3',
|
|
|
105 |
'titre' => _T('info_forum_interne'));
|
|
|
106 |
}
|
|
|
107 |
}
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
function controle_forum($row, $rappel) {
|
|
|
111 |
global $couleur_foncee;
|
|
|
112 |
global $mots_cles_forums;
|
|
|
113 |
|
|
|
114 |
$id_forum = $row['id_forum'];
|
|
|
115 |
$forum_id_parent = $row['id_parent'];
|
|
|
116 |
$forum_id_rubrique = $row['id_rubrique'];
|
|
|
117 |
$forum_id_article = $row['id_article'];
|
|
|
118 |
$forum_id_breve = $row['id_breve'];
|
|
|
119 |
$forum_date_heure = $row['date_heure'];
|
|
|
120 |
$forum_titre = echapper_tags($row['titre']);
|
|
|
121 |
$forum_texte = echapper_tags($row['texte']);
|
|
|
122 |
$forum_auteur = echapper_tags($row['auteur']);
|
|
|
123 |
$forum_email_auteur = echapper_tags($row['email_auteur']);
|
|
|
124 |
$forum_nom_site = echapper_tags($row['nom_site']);
|
|
|
125 |
$forum_url_site = echapper_tags($row['url_site']);
|
|
|
126 |
$forum_stat = $row['statut'];
|
|
|
127 |
$forum_ip = $row['ip'];
|
|
|
128 |
$forum_id_auteur = $row["id_auteur"];
|
|
|
129 |
|
|
|
130 |
$r = forum_parent($id_forum);
|
|
|
131 |
$avant = $r['avant'];
|
|
|
132 |
$url = $r['url'];
|
|
|
133 |
$titre = $r['titre'];
|
|
|
134 |
$type = $r['type'];
|
|
|
135 |
$valeur = $r['valeur'];
|
|
|
136 |
$pref = $r['pref'];
|
|
|
137 |
|
|
|
138 |
$cadre = "";
|
|
|
139 |
|
|
|
140 |
$controle = "\n<br /><br /><a id='id$id_forum'></a>";
|
|
|
141 |
|
|
|
142 |
$controle .= debut_cadre_thread_forum("", true, "", typo($forum_titre));
|
|
|
143 |
|
|
|
144 |
if ($forum_stat=="off" OR $forum_stat == "privoff") {
|
|
|
145 |
$controle .= "<div style='border: 2px #ff0000 dashed;'>";
|
|
|
146 |
}
|
|
|
147 |
else if ($forum_stat=="prop") {
|
|
|
148 |
$controle .= "<div style='border: 2px yellow solid; background-color: white;'>";
|
|
|
149 |
}
|
|
|
150 |
else {
|
|
|
151 |
$controle .= "<div>";
|
|
|
152 |
}
|
|
|
153 |
|
|
|
154 |
$controle .= "<table width='100%' cellpadding='0' cellspacing='0' border='0'>\n<tr><td width='100%' valign='top'><table width='100%' cellpadding='5' cellspacing='0'>\n<tr><td class='serif'><span class='arial2'>" .
|
|
|
155 |
date_relative($forum_date_heure) .
|
|
|
156 |
"</span>";
|
|
|
157 |
if ($forum_auteur) {
|
|
|
158 |
if ($forum_email_auteur)
|
|
|
159 |
$forum_auteur="<a href=\"mailto:$forum_email_auteur?SUBJECT=".rawurlencode($forum_titre)."\">$forum_auteur</A>";
|
|
|
160 |
$controle .= "<span class='arial2'> / <B>$forum_auteur</B></span>";
|
|
|
161 |
}
|
|
|
162 |
|
|
|
163 |
$controle .= boutons_controle_forum($id_forum, $forum_stat, $forum_id_auteur, "$type=$valeur", $forum_ip);
|
|
|
164 |
|
|
|
165 |
$controle .= "\n<br />$avant<B>$pref <A HREF='$url'>$titre</A></B>" .
|
|
|
166 |
"<P align='justify'>".propre($forum_texte);
|
|
|
167 |
|
|
|
168 |
if (strlen($forum_url_site) > 10 AND strlen($forum_nom_site) > 3)
|
|
|
169 |
$controle .= "\n<div align='left' class='serif'><B><A HREF='$forum_url_site'>$forum_nom_site</A></B></div>";
|
|
|
170 |
|
|
|
171 |
if ($mots_cles_forums == "oui") {
|
|
|
172 |
$query_mots = "SELECT * FROM spip_mots AS mots, spip_mots_forum AS lien WHERE lien.id_forum = '$id_forum' AND lien.id_mot = mots.id_mot";
|
|
|
173 |
$result_mots = spip_query($query_mots);
|
|
|
174 |
|
|
|
175 |
while ($row_mots = spip_fetch_array($result_mots)) {
|
|
|
176 |
$titre_mot = propre($row_mots['titre']);
|
|
|
177 |
$type_mot = propre($row_mots['type']);
|
|
|
178 |
$controle .= "\n<li> <b>$type_mot :</b> $titre_mot";
|
|
|
179 |
}
|
|
|
180 |
}
|
|
|
181 |
|
|
|
182 |
$controle .= "</TD></TR></TABLE>";
|
|
|
183 |
$controle .= "</TD></TR></TABLE>\n";
|
|
|
184 |
|
|
|
185 |
$controle .= "</div>".fin_cadre_thread_forum(true);
|
|
|
186 |
return $controle;
|
|
|
187 |
}
|
|
|
188 |
|
|
|
189 |
debut_page(_T('titre_page_forum_suivi'), "redacteurs", "forum-controle");
|
|
|
190 |
|
|
|
191 |
if (!$page) $page = "public";
|
|
|
192 |
|
|
|
193 |
echo "<br><br><br>";
|
|
|
194 |
gros_titre(_T('titre_forum_suivi'));
|
|
|
195 |
barre_onglets("suivi_forum", $page);
|
|
|
196 |
|
|
|
197 |
if ($connect_statut != "0minirezo" OR !$connect_toutes_rubriques) {
|
|
|
198 |
echo "<B>"._T('avis_non_acces_page')."</B>";
|
|
|
199 |
exit;
|
|
|
200 |
}
|
|
|
201 |
|
|
|
202 |
debut_gauche();
|
|
|
203 |
debut_boite_info();
|
|
|
204 |
echo "<FONT FACE='Verdana,Arial,Sans,sans-serif' SIZE=2>";
|
|
|
205 |
echo _T('info_gauche_suivi_forum_2');
|
|
|
206 |
echo aide("suiviforum");
|
|
|
207 |
echo "</FONT>";
|
|
|
208 |
|
|
|
209 |
// Afficher le lien RSS
|
|
|
210 |
include_ecrire('inc_rss.php3');
|
|
|
211 |
$op = 'forums';
|
|
|
212 |
$args = array(
|
|
|
213 |
'page' => $page
|
|
|
214 |
);
|
|
|
215 |
echo "<div style='text-align: "
|
|
|
216 |
. $GLOBALS['spip_lang_right']
|
|
|
217 |
. ";'>"
|
|
|
218 |
. bouton_spip_rss($op, $args)
|
|
|
219 |
."</div>";
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
|
223 |
fin_boite_info();
|
|
|
224 |
debut_droite();
|
|
|
225 |
|
|
|
226 |
//
|
|
|
227 |
// Debut de la page de controle
|
|
|
228 |
//
|
|
|
229 |
|
|
|
230 |
// recuperer le critere SQL qui selectionne nos forums
|
|
|
231 |
$query_forum = critere_statut_controle_forum($page);
|
|
|
232 |
|
|
|
233 |
// Si un id_controle_forum est demande, on adapte le debut
|
|
|
234 |
if ($debut_id_forum = intval($debut_id_forum)
|
|
|
235 |
AND $d = spip_fetch_array(spip_query("SELECT date_heure FROM spip_forum
|
|
|
236 |
WHERE id_forum=$debut_id_forum"))) {
|
|
|
237 |
$result_forum = spip_query("SELECT id_forum FROM spip_forum
|
|
|
238 |
WHERE " . $query_forum . "
|
|
|
239 |
AND date_heure > '".$d['date_heure']."'");
|
|
|
240 |
$debut = spip_num_rows($result_forum);
|
|
|
241 |
}
|
|
|
242 |
if (!$debut=intval($debut)) $debut = 0;
|
|
|
243 |
|
|
|
244 |
$pack = 20; // nb de forums affiches par page
|
|
|
245 |
$enplus = 200; // intervalle affiche autour du debut
|
|
|
246 |
$limitdeb = ($debut > $enplus) ? $debut-$enplus : 0;
|
|
|
247 |
$limitnb = $debut + $enplus - $limitdeb;
|
|
|
248 |
$rappel = "page=$page";
|
|
|
249 |
$mots_cles_forums = lire_meta("mots_cles_forums");
|
|
|
250 |
$controle = '';
|
|
|
251 |
|
|
|
252 |
echo "<div class='serif2'>";
|
|
|
253 |
$i = $limitdeb;
|
|
|
254 |
if ($i>0) echo "<a href='controle_forum.php3?$rappel'>0</a> ... | ";
|
|
|
255 |
|
|
|
256 |
$result_forum = spip_query("
|
|
|
257 |
SELECT *
|
|
|
258 |
FROM spip_forum
|
|
|
259 |
WHERE " . $query_forum . "
|
|
|
260 |
ORDER BY date_heure DESC LIMIT $limitdeb, $limitnb"
|
|
|
261 |
);
|
|
|
262 |
|
|
|
263 |
while ($row = spip_fetch_array($result_forum)) {
|
|
|
264 |
|
|
|
265 |
// barre de navigation
|
|
|
266 |
if ($i == $pack*floor($i/$pack)) {
|
|
|
267 |
if ($i == $debut)
|
|
|
268 |
echo "<FONT SIZE=3><B>$i</B></FONT>";
|
|
|
269 |
else
|
|
|
270 |
echo "<a href='controle_forum.php3?$rappel&debut=$i'>$i</a>";
|
|
|
271 |
echo " | ";
|
|
|
272 |
}
|
|
|
273 |
// est-ce que ce message doit s'afficher dans la liste ?
|
|
|
274 |
if (($i>=$debut) AND ($i<($debut + $pack)))
|
|
|
275 |
$controle .= controle_forum($row, "$rappel&debut=$debut");
|
|
|
276 |
$i ++;
|
|
|
277 |
}
|
|
|
278 |
|
|
|
279 |
echo "<a href='controle_forum.php3?$rappel&debut=$i'>...</a>$controle</div>";
|
|
|
280 |
fin_page();
|
|
|
281 |
?>
|