3 /***************************************************************************\
4 * SPIP, Systeme de publication pour l'internet *
6 * Copyright (c) 2001-2007 *
7 * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
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 \***************************************************************************/
13 if (!defined("_ECRIRE_INC_VERSION")) return;
15 include_spip('inc/actions');
17 // http://doc.spip.org/@afficher_sites
18 function afficher_sites($titre_table, $requete)
20 global $couleur_claire;
22 $tmp_var = 't_' . substr(md5(join(' ',$requete)), 0, 4);
24 return affiche_tranche_bandeau($requete, "site-24.gif", $couleur_claire, "black", $tmp_var, $titre_table, false
, array('','',''), array('arial11', 'arial1', 'arial1'), 'afficher_sites_boucle');
27 // http://doc.spip.org/@afficher_sites_boucle
28 function afficher_sites_boucle($row, &$tous_id, $voir_logo, $bof)
30 global $spip_lang_right;
32 $id_syndic=$row["id_syndic"];
33 if (autoriser('voir','site',$id_syndic)){
34 $id_rubrique=$row["id_rubrique"];
35 $nom_site=sinon(typo($row["nom_site"]), _T('info_sans_titre'));
36 $url_site=$row["url_site"];
37 $url_syndic=$row["url_syndic"];
38 $syndication=$row["syndication"];
39 $statut=$row["statut"];
41 $tous_id[] = $id_syndic;
45 if (acces_restreint_rubrique($id_rubrique))
46 $puce = 'puce-verte-anim.gif';
48 $puce='puce-verte-breve.gif';
49 $title = _T('info_site_reference');
52 if (acces_restreint_rubrique($id_rubrique))
53 $puce = 'puce-orange-anim.gif';
55 $puce='puce-orange-breve.gif';
56 $title = _T('info_site_attente');
59 if (acces_restreint_rubrique($id_rubrique))
60 $puce = 'puce-poubelle-anim.gif';
62 $puce='puce-poubelle-breve.gif';
63 $title = _T('info_site_refuse');
66 if ($syndication == 'off' OR $syndication == 'sus') {
67 $puce = 'puce-orange-anim.gif';
68 $title = _T('info_panne_site_syndique');
71 $s = "<a href=\"".generer_url_ecrire("sites","id_syndic=$id_syndic")."\" title=\"$title\">";
74 $chercher_logo = charger_fonction('chercher_logo', 'inc');
75 if ($logo = $chercher_logo($id_syndic, 'id_syndic', 'on')) {
76 list($fid, $dir, $nom, $format) = $logo;
77 include_spip('inc/filtres_images');
78 $logo = image_reduire("<img src='$fid' alt='' />", 26, 20);
80 $s .= "<span style='float: $spip_lang_right; margin-top: -2px; margin-bottom: -2px;'>$logo</span>";
84 $s .= http_img_pack($puce, $statut, "class='puce'") ." ";
86 $s .= typo($nom_site);
88 $s .= "</a> <span class='spip_xx-small'>[<a href='$url_site'>"._T('lien_visite_site')."</a>]</span>";
93 if ($syndication == 'off' OR $syndication == 'sus') {
94 $s .= "<span style='color: red;'>"._T('info_probleme_grave')." </span>";
96 if ($syndication == "oui" or $syndication == "off" OR $syndication == 'sus'){
97 $s .= "<span style='color: red;'>"._T('info_syndication')."</span>";
101 if ($syndication == "oui" OR $syndication == "off" OR $syndication == "sus") {
102 $total_art = spip_fetch_array(spip_query("SELECT COUNT(*) AS n FROM spip_syndic_articles WHERE id_syndic='$id_syndic'"));
103 $s = " " . $total_art['n'] . " " . _T('info_syndication_articles');
113 // http://doc.spip.org/@afficher_syndic_articles
114 function afficher_syndic_articles($titre_table, $requete, $id = 0) {
115 global $connect_statut, $spip_lang_right;
117 $col = (($connect_statut == '0minirezo') ?
3 : 2) +
($id==0);
118 $tmp_var = 't_' . substr(md5(join(' ',$requete)), 0, 4);
120 if (!$requete['FROM']) $requete['FROM']= 'spip_syndic_articles';
123 $largeurs = array(7, '', '100');
124 $styles = array('','arial11', 'arial1');
126 $largeurs = array(7, '');
127 $styles = array('','arial11');
129 if ($connect_statut == '0minirezo') {
131 $styles[] = 'arial1';
134 return affiche_tranche_bandeau($requete, "site-24.gif", "#999999", "white", $tmp_var, $titre_table, $obligatoire, $largeurs, $styles, 'afficher_syndic_articles_boucle', array($tmp_var, $id));
137 // http://doc.spip.org/@afficher_syndic_articles_boucle
138 function afficher_syndic_articles_boucle($row, &$my_sites, $bof, $redirect)
140 global $connect_statut, $spip_lang_right;
144 $id_syndic_article=$row["id_syndic_article"];
145 $id_syndic=$row["id_syndic"];
146 if (autoriser('voir','site',$id_syndic)){
147 $titre=safehtml($row["titre"]);
150 $lesauteurs=typo($row["lesauteurs"]);
151 $statut=$row["statut"];
152 $descriptif=safehtml($row["descriptif"]);
154 if ($statut=='publie') {
155 $puce='puce-verte.gif';
157 else if ($statut == "refuse") {
158 $puce = 'puce-poubelle.gif';
161 else if ($statut == "dispo") { // moderation : a valider
162 $puce = 'puce-rouge.gif';
165 else if ($statut == "off") { // feed d'un site en mode "miroir"
166 $puce = 'puce-rouge-anim.gif';
169 $vals[] = http_img_pack($puce, $statut, "class='puce'");
171 $s = "<a href='$url'>$titre</a>";
173 $date = affdate_court($date);
174 if (strlen($lesauteurs) > 0) $date = $lesauteurs.', '.$date;
177 // Tags : d'un cote les enclosures, de l'autre les liens
178 if($e = afficher_enclosures($row['tags']))
182 if (strlen($descriptif) > 0) {
183 // couper un texte vraiment tres long
184 if (strlen($descriptif) > 10000)
185 $descriptif = safehtml(spip_substr($descriptif, 0, 6000)).' (...)';
187 $descriptif = safehtml($descriptif);
188 $s .= '<div class="arial1">'
189 # 385px = largeur de la colonne ou s'affiche le texte
190 . filtrer('image_reduire',$descriptif, 385, 550)
195 if ($tags = afficher_tags($row['tags']))
196 $s .= "<div style='float:$spip_lang_right;'> <em>"
197 . $tags . '</em></div>';
200 if (strlen($row['url_source']))
201 $s .= "<div style='float:$spip_lang_right;'>"
202 . propre("[".$row['source']."->".$row['url_source']."]")
204 else if (strlen($row['source']))
205 $s .= "<div style='float:$spip_lang_right;'>"
206 . typo($row['source'])
211 // on n'affiche pas la colonne 'site' lorsqu'on regarde un site precis
212 if ($GLOBALS['exec'] != 'sites') {
213 // $my_sites cache les resultats des requetes sur les sites
214 if (!$my_sites[$id_syndic])
215 $my_sites[$id_syndic] = spip_fetch_array(spip_query("SELECT nom_site, moderation, miroir FROM spip_syndic WHERE id_syndic=$id_syndic"));
217 $aff = $my_sites[$id_syndic]['nom_site'];
218 if ($my_sites[$id_syndic]['moderation'] == 'oui')
219 $aff = "<i>$aff</i>";
221 $s = "<a href='" . generer_url_ecrire("sites","id_syndic=$id_syndic") . "'>$aff</a>";
226 if ($connect_statut == '0minirezo'){
227 list($tmp_var, $id) = $redirect;
228 $redirect = ($tmp_var . '=' . intval(_request($tmp_var)))
229 . (!$id ?
'' : "&id_syndic=$id");
231 if ($statut == "publie"){
232 $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-refuse", $GLOBALS['exec'], $redirect) . "'><span style='color: black'>"._T('info_bloquer_lien')."</span></a>]";
235 else if ($statut == "refuse"){
236 $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_retablir_lien')."</a>]";
238 else if ($statut == "off"
239 AND $my_sites[$id_syndic]['miroir'] == 'oui') {
240 $s = '('._T('syndic_lien_obsolete').')';
242 else /* 'dispo' ou 'off' (dans le cas ancien site 'miroir') */
244 $s = "[<a href='". redirige_action_auteur('instituer_syndic',"$id_syndic_article-publie", $GLOBALS['exec'], $redirect) . "'>"._T('info_valider_lien')."</a>]";