[ 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 include ("inc_lab.php"); 15 16 include_spip("ecrire.php"); 17 include_spip("revisions.php"); 18 19 20 21 // 22 // Lire l'article 23 // 24 25 $champs = array('surtitre', 'titre', 'soustitre', 'descriptif', 'nom_site', 'url_site', 'chapo', 'texte', 'ps'); 26 27 $query = "SELECT * FROM spip_articles WHERE id_article='$id_article'"; 28 $result = spip_query($query); 29 30 if ($row = spip_fetch_array($result)) { 31 $id_article = $row["id_article"]; 32 $id_rubrique = $row["id_rubrique"]; 33 $date = $row["date"]; 34 $statut_article = $row["statut"]; 35 $maj = $row["maj"]; 36 $date_redac = $row["date_redac"]; 37 $visites = $row["visites"]; 38 $referers = $row["referers"]; 39 $extra = $row["extra"]; 40 $id_trad = $row["id_trad"]; 41 } 42 43 if (!($id_version = intval($id_version))) { 44 $id_version = $row['id_version']; 45 } 46 $textes = recuperer_version($id_article, $id_version); 47 48 $id_diff = intval($id_diff); 49 if (!$id_diff) { 50 $diff_auto = true; 51 $query = "SELECT id_version FROM spip_versions WHERE id_article=$id_article ". 52 "AND id_version<$id_version ORDER BY id_version DESC LIMIT 0,1"; 53 if ($result = spip_query($query)) { 54 $row = spip_fetch_array($result); 55 $id_diff = $row['id_version']; 56 } 57 } 58 59 // 60 // Calculer le diff 61 // 62 63 if ($id_version && $id_diff) { 64 include_spip("diff.php"); 65 66 if ($id_diff > $id_version) { 67 $t = $id_version; 68 $id_version = $id_diff; 69 $id_diff = $t; 70 $old = $textes; 71 $new = $textes = recuperer_version($id_article, $id_version); 72 } 73 else { 74 $old = recuperer_version($id_article, $id_diff); 75 $new = $textes; 76 } 77 78 $textes = array(); 79 80 foreach ($champs as $champ) { 81 if (!$new[$champ] && !$old[$champ]) continue; 82 83 $diff = new Diff(new DiffTexte); 84 $textes[$champ] = afficher_diff($diff->comparer(preparer_diff($new[$champ]), preparer_diff($old[$champ]))); 85 } 86 } 87 88 if (is_array($textes)) 89 foreach ($textes as $var => $t) $$var = $t; 90 91 92 93 debut_page(_T('info_historique')." « $titre »", "documents", "articles"); 94 95 debut_grand_cadre(); 96 97 afficher_hierarchie($id_rubrique); 98 99 fin_grand_cadre(); 100 101 102 103 ////////////////////////////////////////////////////// 104 // Affichage de la colonne de gauche 105 // 106 107 debut_gauche(); 108 109 110 debut_raccourcis(); 111 icone_horizontale(_T('icone_retour_article'), "articles.php3?id_article=$id_article", "article-24.gif","rien.gif"); 112 icone_horizontale(_T('icone_suivi_revisions'), "suivi_revisions.php3", "historique-24.gif","rien.gif"); 113 fin_raccourcis(); 114 115 116 ////////////////////////////////////////////////////// 117 // Affichage de la colonne de droite 118 // 119 120 debut_droite(); 121 122 changer_typo('','article'.$id_article); 123 124 echo "<a name='diff'></a>\n"; 125 126 debut_cadre_relief(); 127 128 // 129 // Titre, surtitre, sous-titre 130 // 131 132 if ($statut_article=='publie') { 133 $logo_statut = "puce-verte.gif"; 134 } 135 else if ($statut_article=='prepa') { 136 $logo_statut = "puce-blanche.gif"; 137 } 138 else if ($statut_article=='prop') { 139 $logo_statut = "puce-orange.gif"; 140 } 141 else if ($statut_article == 'refuse') { 142 $logo_statut = "puce-rouge.gif"; 143 } 144 else if ($statut_article == 'poubelle') { 145 $logo_statut = "puce-poubelle.gif"; 146 } 147 148 149 echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>"; 150 echo "<tr width='100%'><td width='100%' valign='top'>"; 151 if ($surtitre) { 152 echo "<span $dir_lang><font face='arial,helvetica' size='3'><b>"; 153 echo typo($surtitre); 154 echo "</b></font></span>\n"; 155 } 156 gros_titre($titre, $logo_statut); 157 158 if ($soustitre) { 159 echo "<span $dir_lang><font face='arial,helvetica' size='3'><b>"; 160 echo typo($soustitre); 161 echo "</b></font></span>\n"; 162 } 163 164 165 if ($descriptif OR $url_site OR $nom_site) { 166 echo "<p><div align='left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>"; 167 echo "<font size='2' face='Verdana,Arial,Sans,sans-serif'>"; 168 $texte_case = ($descriptif) ? "{{"._T('info_descriptif')."}} $descriptif\n\n" : ''; 169 $texte_case .= ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : ''; 170 echo propre($texte_case); 171 echo "</font>"; 172 echo "</div>"; 173 } 174 175 echo "</td>"; 176 177 echo "<td align='center'>"; 178 179 // L'article est-il editable ? 180 $query = "SELECT * FROM spip_auteurs_articles WHERE id_article=$id_article AND id_auteur=$connect_id_auteur"; 181 $result_auteur = spip_query($query); 182 $flag_auteur = (spip_num_rows($result_auteur) > 0); 183 $flag_editable = (acces_rubrique($id_rubrique) 184 OR ($flag_auteur AND ($statut_article == 'prepa' OR $statut_article == 'prop' OR $statut_article == 'poubelle'))); 185 186 if ($flag_editable) 187 icone(_T('icone_modifier_article'), "articles_edit.php3?id_article=$id_article", "article-24.gif", "edit.gif"); 188 189 echo "</td>"; 190 191 echo "</tr></table>"; 192 193 194 ////////////////////////////////////////////////////// 195 // Affichage des versions 196 // 197 198 debut_cadre_relief(); 199 200 $query = "SELECT id_version, titre_version, date, v.id_auteur, a.nom ". 201 "FROM spip_versions AS v, spip_auteurs AS a ". 202 "WHERE id_article=$id_article AND v.id_auteur=a.id_auteur ORDER BY id_version DESC"; 203 $result = spip_query($query); 204 205 echo "<ul class='verdana3'>"; 206 while ($row = spip_fetch_array($result)) { 207 echo "<li>\n"; 208 $date = affdate_heure($row['date']); 209 $version_aff = $row['id_version']; 210 $titre_version = typo($row['titre_version']); 211 $titre_aff = $titre_version ? $titre_version : $date; 212 if ($version_aff != $id_version) { 213 $link = new Link(); 214 $link->addVar('id_version', $version_aff); 215 $link->delVar('id_diff'); 216 echo "<a href='".$link->getUrl('diff')."' title=\""._T('info_historique_affiche')."\">$titre_aff</a>"; 217 } 218 else { 219 echo "<b>$titre_aff</b>"; 220 } 221 echo " (".typo($row['nom']).")"; 222 #if ($options == 'avancees') { // note : c'est redondant car on ne peut arriver sur cette page qu'en options avancees... 223 //echo " <span style='color:#989898; font-size: 80%; font-weight: bold;'><i>#".$row['id_version']."</i></span>"; 224 if ($version_aff != $id_version) { 225 echo " <span class='verdana2'>"; 226 if ($version_aff == $id_diff) { 227 echo "<b>("._T('info_historique_comparaison').")</b>"; 228 } 229 else { 230 $link = new Link(); 231 $link->addVar('id_version', $id_version); 232 $link->addVar('id_diff', $version_aff); 233 echo "(<a href='".$link->getUrl('diff'). 234 "'>"._T('info_historique_comparaison')."</a>)"; 235 } 236 echo "</span>"; 237 } 238 #} // fin avancees 239 echo "</li>\n"; 240 } 241 echo "</ul>\n"; 242 243 fin_cadre_relief(); 244 245 246 ////////////////////////////////////////////////////// 247 // Corps de la version affichee 248 // 249 250 if ($id_version) { 251 echo "\n\n<div align='justify'>"; 252 253 // pour l'affichage du virtuel 254 unset($virtuel); 255 if (substr($chapo, 0, 1) == '=') { 256 $virtuel = substr($chapo, 1); 257 } 258 259 if ($virtuel) { 260 debut_boite_info(); 261 echo _T('info_renvoi_article')." ".propre("<center>[->$virtuel]</center>"); 262 fin_boite_info(); 263 } 264 else { 265 echo "<div $dir_lang><b>"; 266 $revision_nbsp = ($options == "avancees"); // a regler pour relecture des nbsp dans les articles 267 echo justifier(propre_diff($chapo)); 268 echo "</b></div>\n\n"; 269 270 echo "<div $dir_lang>"; 271 echo justifier(propre_diff($texte)); 272 echo "</div>"; 273 274 if ($ps) { 275 echo debut_cadre_enfonce(); 276 echo "<div $dir_lang><font size='2' face='Verdana,Arial,Sans,sans-serif'>"; 277 echo justifier("<b>"._T('info_ps')."</b> ".propre_diff($ps)); 278 echo "</font></div>"; 279 echo fin_cadre_enfonce(); 280 } 281 $revision_nbsp = false; 282 283 if ($les_notes) { 284 echo debut_cadre_relief(); 285 echo "<div $dir_lang><font size='2'>"; 286 echo justifier("<b>"._T('info_notes')." :</b> ".$les_notes); 287 echo "</font></div>"; 288 echo fin_cadre_relief(); 289 } 290 291 if ($champs_extra AND $extra) { 292 include_spip("extra.php"); 293 extra_affichage($extra, "articles"); 294 } 295 } 296 } 297 298 fin_cadre_relief(); 299 300 301 fin_page(); 302 303 ?>
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 |