7 |
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_SIGNATURES")) return;
|
|
|
17 |
define("_ECRIRE_INC_SIGNATURES", "1");
|
|
|
18 |
|
|
|
19 |
include_ecrire('inc_urls.php3');
|
|
|
20 |
|
|
|
21 |
function controle_signatures($script, $id, $debut, $where, $order, $limit=10) {
|
|
|
22 |
global $couleur_foncee;
|
|
|
23 |
|
|
|
24 |
$where = tronconne_signatures($script, $id, $debut, $where, $limit);
|
|
|
25 |
$request = spip_query("SELECT * FROM spip_signatures " .
|
|
|
26 |
($where ? " WHERE $where" : "") .
|
|
|
27 |
($order ? " ORDER BY $order" : "") .
|
|
|
28 |
" LIMIT " . ($debut ? "$debut," : "") . $limit);
|
|
|
29 |
|
|
|
30 |
while($row=spip_fetch_array($request)){
|
|
|
31 |
$id_signature = $row['id_signature'];
|
|
|
32 |
$id_article = $row['id_article'];
|
|
|
33 |
$date_time = $row['date_time'];
|
|
|
34 |
$nom_email= typo(echapper_tags($row['nom_email']));
|
|
|
35 |
$ad_email = echapper_tags($row['ad_email']);
|
|
|
36 |
$nom_site = typo(echapper_tags($row['nom_site']));
|
|
|
37 |
$url_site = echapper_tags($row['url_site']);
|
|
|
38 |
$statut = $row['statut'];
|
|
|
39 |
|
|
|
40 |
echo "<P>";
|
|
|
41 |
|
|
|
42 |
if ($statut=="poubelle"){
|
|
|
43 |
echo "<TABLE WIDTH=100% CELLPADDING=2 CELLSPACING=0 BORDER=0><TR><TD BGCOLOR='#FF0000'>";
|
|
|
44 |
}
|
|
|
45 |
|
|
|
46 |
echo "<TABLE WIDTH=100% CELLPADDING=3 CELLSPACING=0><TR><TD BGCOLOR='$couleur_foncee' class='verdana2' style='color: white;'><b>",
|
|
|
47 |
($nom_site ? "$nom_site / " : ""),
|
|
|
48 |
$nom_email,
|
|
|
49 |
"</b></TD></TR>",
|
|
|
50 |
"<TR><TD BGCOLOR='#FFFFFF' class='serif'>";
|
|
|
51 |
|
|
|
52 |
if ($statut=="publie"){
|
|
|
53 |
icone (_T('icone_supprimer_signature'), "$script?supp_petition=$id_signature&debut=$debut", "forum-interne-24.gif", "supprimer.gif", "right");
|
|
|
54 |
}
|
|
|
55 |
if ($statut=="poubelle"){
|
|
|
56 |
icone (_T('icone_valider_signature'), "$script?add_petition=$id_signature&debut=$debut", "forum-interne-24.gif", "creer.gif", "right");
|
|
|
57 |
}
|
|
|
58 |
|
|
|
59 |
echo "<FONT SIZE=2>".date_relative($date_time)."</FONT><BR>";
|
|
|
60 |
if ($statut=="poubelle"){
|
|
|
61 |
echo "<FONT SIZE=1 COLOR='red'>"._T('info_message_efface')."</FONT><BR>";
|
|
|
62 |
}
|
|
|
63 |
if (strlen($url_site)>6 AND strlen($nom_site)>0){
|
|
|
64 |
echo "<FONT SIZE=1>"._T('info_site_web')."</FONT> <A HREF='$url_site'>$nom_site</A><BR>";
|
|
|
65 |
}
|
|
|
66 |
if (strlen($ad_email)>0){
|
|
|
67 |
echo "<FONT SIZE=1>"._T('info_adresse_email')."</FONT> <A HREF='mailto:$ad_email'>$ad_email</A><BR>";
|
|
|
68 |
}
|
|
|
69 |
|
|
|
70 |
echo "<p>",message_de_signature($row),"</p>";
|
|
|
71 |
|
|
|
72 |
list($titre) = spip_fetch_array(spip_query("SELECT titre FROM spip_articles WHERE id_article=$id_article"));
|
|
|
73 |
|
|
|
74 |
if (!$id)
|
|
|
75 |
echo "<span class='arial1' style='float: $spip_lang_right; color: black; padding-$spip_lang_left: 4px;'><b>",
|
|
|
76 |
_T('info_numero_abbreviation'),
|
|
|
77 |
$id_article,
|
|
|
78 |
" </b></span>";
|
|
|
79 |
|
|
|
80 |
echo "<a href='",
|
|
|
81 |
(($statut == 'publie') ?
|
|
|
82 |
"../spip_redirect.php3" :
|
|
|
83 |
"articles.php3"),
|
|
|
84 |
"?id_article=$id_article",
|
|
|
85 |
"'>",
|
|
|
86 |
typo($titre),
|
|
|
87 |
"</a>";
|
|
|
88 |
|
|
|
89 |
echo "</TD></TR></TABLE>";
|
|
|
90 |
|
|
|
91 |
if ($statut=="poubelle"){
|
|
|
92 |
echo "</TD></TR></TABLE>";
|
|
|
93 |
}
|
|
|
94 |
}
|
|
|
95 |
}
|
|
|
96 |
|
|
|
97 |
function tronconne_signatures($script, $id_article, $debut, $where, $limit)
|
|
|
98 |
{
|
|
|
99 |
if ($id_article) {
|
|
|
100 |
$script .= "?id_article=$id_article&";
|
|
|
101 |
$where .= ($where ? " AND " : "") . "id_article=$id_article";
|
|
|
102 |
}
|
|
|
103 |
else $script .= '?';
|
|
|
104 |
|
|
|
105 |
$res = spip_query("SELECT COUNT(*) AS cnt FROM spip_signatures WHERE $where AND date_time>DATE_SUB(NOW(),INTERVAL 180 DAY)");
|
|
|
106 |
|
|
|
107 |
$total = ($row = spip_fetch_array($res)) ? $row['cnt'] : 0;
|
|
|
108 |
|
|
|
109 |
if ($total > $limit) {
|
|
|
110 |
for ($i = 0; $i < $total; $i += $limit){
|
|
|
111 |
if ($i > 0) echo " | ";
|
|
|
112 |
if ($i == $debut)
|
|
|
113 |
echo "<FONT SIZE=3><B>$i</B></FONT>";
|
|
|
114 |
else
|
|
|
115 |
echo "<A HREF='$script","debut=$i'>$i</A>";
|
|
|
116 |
}
|
|
|
117 |
}
|
|
|
118 |
return $where;
|
|
|
119 |
}
|
|
|
120 |
|
|
|
121 |
?>
|