[ Index ]
 

Code source de SPIP 1.9.2c

Accédez au Source d'autres logiciels libres

title

Body

[fermer]

/ecrire/exec/ -> articles_versions.php (source)

   1  <?php
   2  
   3  /***************************************************************************\
   4   *  SPIP, Systeme de publication pour l'internet                           *
   5   *                                                                         *
   6   *  Copyright (c) 2001-2007                                                *
   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  if (!defined("_ECRIRE_INC_VERSION")) return;
  15  
  16  include_spip('inc/presentation');
  17  include_spip('inc/revisions');
  18  
  19  // http://doc.spip.org/@exec_articles_versions_dist
  20  function exec_articles_versions_dist()
  21  {
  22      include_spip('inc/suivi_versions');
  23  
  24      global $champs_extra, $chapo, $descriptif, $dir_lang, $id_article, $id_diff, $id_version, $les_notes, $nom_site, $options, $ps, $soustitre, $surtitre, $texte, $titre, $url_site;
  25  
  26  
  27  //
  28  // Lire l'article
  29  //
  30  
  31      $id_article = intval($id_article);
  32      $row = spip_fetch_array(spip_query("SELECT * FROM spip_articles WHERE id_article='$id_article'"));
  33      $commencer_page = charger_fonction('commencer_page', 'inc');
  34      if (!autoriser('voirrevisions', 'article', $id_article) 
  35          OR !$row) {
  36          echo $commencer_page(_T('info_historique'), "naviguer", "articles", isset($row["id_rubrique"])?$row["id_rubrique"]:0);
  37          echo "<strong>"._T('avis_acces_interdit')."</strong>";
  38          echo fin_page();
  39          exit;
  40      }
  41  
  42      $id_article = $row["id_article"];
  43      $id_rubrique = $row["id_rubrique"];
  44      $titre_defaut = $titre = $row["titre"];
  45      $date = $row["date"];
  46      $statut_article = $row["statut"];
  47      $maj = $row["maj"];
  48      $date_redac = $row["date_redac"];
  49      $visites = $row["visites"];
  50      $referers = $row["referers"];
  51      $extra = $row["extra"];
  52      $id_trad = $row["id_trad"];
  53  
  54      $last_version = false;
  55      if (!($id_version = intval($id_version))) {
  56          $id_version = $row['id_version'];
  57          $last_version = true;
  58      }
  59      $id_diff = intval($id_diff);
  60  
  61      $textes = revision_comparee($id_article, $id_version, 'complet', $id_diff);
  62      if (is_array($textes)) foreach ($textes as $var => $t) $$var = $t;
  63  
  64  
  65  
  66      echo $commencer_page(_T('info_historique')." &laquo; $titre &raquo;", "naviguer", "articles", $id_rubrique);
  67  
  68      debut_grand_cadre();
  69  
  70      echo afficher_hierarchie($id_rubrique);
  71  
  72      fin_grand_cadre();
  73  
  74  
  75  //////////////////////////////////////////////////////
  76  // Affichage de la colonne de gauche
  77  //
  78  
  79  debut_gauche();
  80  
  81  echo bloc_des_raccourcis(icone_horizontale(_T('icone_retour_article'), generer_url_ecrire("articles","id_article=$id_article"), "article-24.gif","rien.gif", false) .
  82              icone_horizontale(_T('icone_suivi_revisions'), generer_url_ecrire("suivi_revisions",""), "historique-24.gif","rien.gif", false));
  83  
  84  
  85  
  86  //////////////////////////////////////////////////////
  87  // Affichage de la colonne de droite
  88  //
  89  
  90  debut_droite();
  91  
  92  changer_typo('','article'.$id_article);
  93  
  94  echo "<a name='diff'></a>\n";
  95  
  96  debut_cadre_relief();
  97  
  98  //
  99  // Titre, surtitre, sous-titre
 100  //
 101  
 102  if ($statut_article=='publie') {
 103      $logo_statut = "puce-verte.gif";
 104  }
 105  else if ($statut_article=='prepa') {
 106      $logo_statut = "puce-blanche.gif";
 107  }
 108  else if ($statut_article=='prop') {
 109      $logo_statut = "puce-orange.gif";
 110  }
 111  else if ($statut_article == 'refuse') {
 112      $logo_statut = "puce-rouge.gif";
 113  }
 114  else if ($statut_article == 'poubelle') {
 115      $logo_statut = "puce-poubelle.gif";
 116  }
 117  
 118  
 119  echo "\n<table cellpadding='0' cellspacing='0' border='0' width='100%'>";
 120  echo "<tr><td style='width: 100%' valign='top'>";
 121  if ($surtitre) {
 122      echo "<span $dir_lang><span class='arial1 spip_medium'><b>", propre_diff($surtitre), "</b></span></span>\n";
 123  }
 124   gros_titre(propre_diff($titre), $logo_statut);
 125  
 126  if ($soustitre) {
 127      echo "<span $dir_lang><span class='arial1 spip_medium'><b>", propre_diff($soustitre), "</b></span></span>\n";
 128  }
 129  
 130  
 131  if ($descriptif OR $url_site OR $nom_site) {
 132      echo "<div align='left' style='padding: 5px; border: 1px dashed #aaaaaa; background-color: #e4e4e4;' $dir_lang>";
 133      $texte_case = ($descriptif) ? "{{"._T('info_descriptif')."}} $descriptif\n\n" : '';
 134      $texte_case .= ($nom_site.$url_site) ? "{{"._T('info_urlref')."}} [".$nom_site."->".$url_site."]" : '';
 135      echo "<span class='verdana1 spip_small'>", propre($texte_case), "</span>";
 136      echo "</div>";
 137  }
 138  
 139  echo "</td>";
 140  
 141  echo "<td align='center'>";
 142  
 143  // Icone de modification
 144  if (autoriser('modifier', 'article', $id_article))
 145      icone(
 146          _T('icone_modifier_article').'<br />('._T('version')." $id_version)",
 147          generer_url_ecrire("articles_edit",
 148              "id_article=$id_article".((!$last_version)?"&id_version=$id_version":"")),
 149          "article-24.gif",
 150          "edit.gif"
 151      );
 152  
 153  echo "</td>";
 154  
 155  echo "</tr></table>";
 156  
 157  fin_cadre_relief();
 158  
 159  //////////////////////////////////////////////////////
 160  // Affichage des versions
 161  //
 162  
 163  debut_cadre_relief();
 164  
 165  $result = spip_query("SELECT id_version, titre_version, date, id_auteur    FROM spip_versions WHERE id_article=$id_article ORDER BY id_version DESC");
 166  
 167  echo "<ul class='verdana3'>";
 168  while ($row = spip_fetch_array($result)) {
 169      echo "<li>\n";
 170      $date = affdate_heure($row['date']);
 171      $version_aff = $row['id_version'];
 172      $titre_version = typo($row['titre_version']);
 173      $titre_aff = $titre_version ? $titre_version : $date;
 174      if ($version_aff != $id_version) {
 175          $lien = parametre_url(self(), 'id_version', $version_aff);
 176          $lien = parametre_url($lien, 'id_diff', '');
 177          echo "<a href='".($lien.'#diff')."' title=\""._T('info_historique_affiche')."\">$titre_aff</a>";
 178      }
 179      else {
 180          echo "<b>$titre_aff</b>";
 181      }
 182  
 183      if (isset($row['id_auteur'])) {
 184          if ($row['id_auteur'] == intval($row['id_auteur'])
 185          AND $s = spip_query("SELECT nom FROM spip_auteurs WHERE id_auteur='".addslashes($row['id_auteur'])."'")) {
 186              $t = spip_fetch_array($s);
 187              echo " (".typo($t['nom']).")";
 188          } else {
 189              echo " (".$row['id_auteur'].")"; #IP edition anonyme
 190          }
 191      }
 192  
 193      if ($version_aff != $id_version) {
 194          echo " <span class='verdana2'>";
 195          if ($version_aff == $id_diff) {
 196              echo "<b>("._T('info_historique_comparaison').")</b>";
 197          }
 198          else {
 199              $lien = parametre_url(self(), 'id_version', $id_version);
 200              $lien = parametre_url($lien, 'id_diff', $version_aff);
 201              echo "(<a href='".($lien.'#diff').
 202              "'>"._T('info_historique_comparaison')."</a>)";
 203          }
 204          echo "</span>";
 205      }
 206      echo "</li>\n";
 207  }
 208  echo "</ul>\n";
 209  
 210  
 211  //////////////////////////////////////////////////////
 212  // Corps de la version affichee
 213  //
 214  
 215  if ($id_version) {
 216      echo "\n\n<div style='text-align: justify;'>";
 217  
 218      // pour l'affichage du virtuel
 219  
 220      if (substr($chapo, 0, 1) == '=') {
 221          $virtuel = substr($chapo, 1);
 222      }
 223      
 224      if ($virtuel) {
 225          debut_boite_info();
 226          echo _T('info_renvoi_article'),
 227              propre("<span style='text-align: center'> [->$virtuel]</span>");
 228          fin_boite_info();
 229      }
 230      else {
 231          echo "<div $dir_lang><b>";
 232          $revision_nbsp = ($options == "avancees");    // a regler pour relecture des nbsp dans les articles
 233          echo justifier(propre_diff($chapo));
 234          echo "</b></div>\n\n";
 235      
 236          echo "<div $dir_lang>";
 237          echo justifier(propre_diff($texte));
 238          echo "</div>";
 239      
 240          if ($ps) {
 241              echo debut_cadre_enfonce();
 242              echo "<div $dir_lang class='verdana1 spip_small'>", justifier("<b>"._T('info_ps')."</b> ".propre_diff($ps)), "</div>";
 243              echo fin_cadre_enfonce();
 244          }
 245          $revision_nbsp = false;
 246      
 247          if ($les_notes) {
 248              echo debut_cadre_relief();
 249              echo "<div $dir_lang><span class='spip_small'>", justifier("<b>"._T('info_notes')."&nbsp;:</b> ".$les_notes), "</span></div>";
 250              echo fin_cadre_relief();
 251          }
 252      
 253          if ($champs_extra AND $extra) {
 254              include_spip('inc/extra');
 255              echo extra_affichage($extra, "articles");
 256          }
 257      }
 258  }
 259  
 260  fin_cadre_relief();
 261  
 262  
 263  echo  fin_gauche(), fin_page();
 264  
 265  }
 266  
 267  ?>


Généré le : Wed Nov 21 10:20:27 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics