[ Index ] |
|
Code source de SPIP 1.8.3 |
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_SUIVI_REVISIONS")) return; 17 define("_ECRIRE_INC_SUIVI_REVISIONS", "1"); 18 19 include_ecrire ("inc_lab.php"); 20 include_spip("ecrire.php"); 21 22 function afficher_para_modifies ($texte, $court = false) { 23 // Limiter la taille de l'affichage 24 if ($court) $max = 200; 25 else $max = 2000; 26 27 $paras = explode ("\n",$texte); 28 for ($i = 0; $i < count($paras) AND strlen($texte_ret) < $max; $i++) { 29 if (strpos($paras[$i], '"diff-')) $texte_ret .= $paras[$i]."\n\n"; 30 } 31 $texte = $texte_ret; 32 return $texte; 33 } 34 35 function afficher_suivi_versions ($debut = 0, $id_secteur = 0, $id_auteur = false, $lang = "", $court = false, $rss = false) { 36 global $dir_lang; 37 38 $nb_aff = 10; 39 $champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'nom_site', 'url_site', 'chapo', 'texte', 'ps'); 40 41 if ($id_auteur) { 42 $req_where = " AND articles.statut IN ('prepa','prop','publie')"; 43 $req_where = " AND versions.id_auteur = $id_auteur"; 44 } else { 45 $req_where = " AND articles.statut IN ('prop','publie')"; 46 } 47 48 if (strlen($lang) > 0) 49 $req_where .= " AND articles.lang='".addslashes($lang)."'"; 50 51 if ($id_secteur > 0) 52 $req_where .= " AND articles.id_secteur = ".intval($id_secteur); 53 54 $query = " 55 SELECT versions.*, articles.statut, articles.titre 56 FROM spip_versions AS versions, spip_articles AS articles 57 WHERE versions.id_article = articles.id_article AND versions.id_version > 1 $req_where "; 58 59 $result = spip_query($query . " ORDER BY versions.date DESC LIMIT $debut, $nb_aff"); 60 if (spip_num_rows($result) > 0) { 61 62 // Afficher l'entete de la boite 63 if (!$rss) { 64 $titre_table = _T('icone_suivi_revisions').aide('suivimodif'); 65 if ($court) 66 $titre_table = afficher_plus("suivi_revisions.php3") 67 . $titre_table; 68 69 echo "<div style='height: 12px;'></div>"; 70 echo "<div class='liste'>"; 71 bandeau_titre_boite2($titre_table, "historique-24.gif"); 72 73 $total = spip_num_rows(spip_query($query . "LIMIT 0, 149")); 74 75 if ($total > $nb_aff) { 76 $nb_tranches = ceil($total / $nb_aff); 77 78 echo "<div class='arial2' style='background-color: #dddddd; padding: 5px;'>"; 79 80 for ($i = 0; $i < $nb_tranches; $i++) { 81 if ($i > 0) echo " | "; 82 if ($i*$nb_aff == $debut) echo "<b>"; 83 else echo "<a href='suivi_revisions.php3?debut=".($i * $nb_aff)."&id_secteur=$id_secteur&uniq_auteur=$uniq_auteur&lang_choisie=$lang'>"; 84 echo (($i * $nb_aff) + 1); 85 if ($i*$nb_aff == $debut) echo "</b>"; 86 else echo "</a>"; 87 } 88 echo "</div>"; 89 } 90 } 91 92 // Afficher les 10 elements 93 while ($row = spip_fetch_array($result)) { 94 $id_version = $row['id_version']; 95 $id_auteur = $row['id_auteur']; 96 $date = $row['date']; 97 $id_article = $row['id_article']; 98 $statut = $row['statut']; 99 $titre = propre($row['titre']); 100 $query_auteur = " 101 SELECT nom,email 102 FROM spip_auteurs 103 WHERE id_auteur = $id_auteur"; 104 $row_auteur = spip_fetch_array(spip_query($query_auteur)); 105 $nom = typo($row_auteur["nom"]); 106 $email = $row_auteur['email']; 107 108 109 $logo_statut = "puce-".puce_statut($statut).".gif"; 110 111 if (!$rss) { 112 echo "<div class='tr_liste' style='padding: 5px; border-top: 1px solid #aaaaaa;'>"; 113 114 echo "<span class='arial2'>"; 115 if (!$court) echo bouton_block_visible("$id_version-$id_article-$id_auteur"); 116 echo "<img src='" . _DIR_IMG_PACK . "$logo_statut' border='0'> "; 117 echo "<a class='$statut' style='font-weight: bold;' href='articles_versions.php3?id_article=$id_article'>$titre</a>"; 118 echo "</span>"; 119 echo "<span class='arial1'$dir_lang>"; 120 echo " ".date_relative($date)." "; 121 if (strlen($nom)>0) echo "($nom)"; 122 echo "</span>"; 123 } else { 124 $item = array( 125 'title' => $titre, 126 'url' => lire_meta('adresse_site').'/'._DIR_RESTREINT_ABS."articles_versions.php3?id_article=$id_article&id_version=$id_version", 127 'date' => $date, 128 'author' => $nom, 129 'email' => $email 130 ); 131 } 132 133 if (!$court) { 134 $query_diff = " 135 SELECT id_version 136 FROM spip_versions 137 WHERE id_article=$id_article AND id_version<$id_version 138 ORDER BY id_version DESC LIMIT 0,1"; 139 if ($result_diff = spip_query($query_diff)) { 140 $row_diff = spip_fetch_array($result_diff); 141 $id_diff = $row_diff['id_version']; 142 } 143 144 145 $query_art = " 146 SELECT * 147 FROM spip_articles 148 WHERE id_article='$id_article'"; 149 $result_art = spip_query($query_art); 150 151 if ($row_art = spip_fetch_array($result_art)) { 152 $id_article = $row_art["id_article"]; 153 $id_rubrique = $row_art["id_rubrique"]; 154 $date = $row_art["date"]; 155 $statut_article = $row_art["statut"]; 156 $maj = $row_art["maj"]; 157 $date_redac = $row_art["date_redac"]; 158 $visites = $row_art["visites"]; 159 $referers = $row_art["referers"]; 160 $extra = $row_art["extra"]; 161 $id_trad = $row_art["id_trad"]; 162 } 163 164 $textes = recuperer_version($id_article, $id_version); 165 166 if ($id_version && $id_diff) { 167 if ($id_diff > $id_version) { 168 $t = $id_version; 169 $id_version = $id_diff; 170 $id_diff = $t; 171 $old = $textes; 172 $new = $textes = recuperer_version($id_article, $id_version); 173 } 174 else { 175 $old = recuperer_version($id_article, $id_diff); 176 $new = $textes; 177 } 178 $textes = array(); 179 foreach ($champs as $champ) { 180 if (!$new[$champ] && !$old[$champ]) continue; 181 $diff = new Diff(new DiffTexte); 182 $textes[$champ] = afficher_para_modifies(afficher_diff($diff->comparer(preparer_diff($new[$champ]), preparer_diff($old[$champ]))), $court); 183 } 184 } 185 186 if (!$rss) 187 echo debut_block_visible("$id_version-$id_article-$id_auteur"); 188 189 if (is_array($textes)) 190 foreach ($textes as $var => $t) { 191 if (strlen($t) > 0) { 192 if (!$rss) echo "<blockquote class='serif1'>"; 193 $aff = propre_diff($t); 194 if ($GLOBALS['les_notes']) { 195 $aff .= '<p>'.$GLOBALS['les_notes']; 196 $GLOBALS['les_notes'] = ''; 197 } 198 if (!$rss) { 199 echo $aff; 200 echo "</blockquote>"; 201 } else 202 $item['description'] = $aff; 203 } 204 } 205 if (!$rss) echo fin_block(); 206 } 207 208 if (!$rss) echo "</div>"; 209 210 if ($rss) 211 $items[] = $item; 212 } 213 if (!$rss) echo "</div>"; 214 } 215 216 if ($rss) 217 return $items; 218 } 219 220 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Feb 22 22:27:47 2007 | par Balluche grâce à PHPXref 0.7 |