[ Index ]
 

Code source de SPIP 1.8.3

Accédez au Source d'autres logiciels libres | Soutenez Angelica Josefina !

title

Body

[fermer]

/ecrire/ -> export.php3 (source)

   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_version.php3");
  15  
  16  include_ecrire  ("inc_auth.php3");
  17  include_ecrire  ("inc_export.php3");
  18  include_ecrire  ("inc_admin.php3");
  19  include_ecrire  ("inc_presentation.php3");
  20  
  21  // Liste un sommaire d'objets de n'importe quel type
  22  // a la condition d'etre publics et plus recents que $maj
  23  function liste_objets($result, $type) {
  24      global $maj;
  25      global $articles;
  26      if ($result) while ($row = spip_fetch_array($result)) {
  27          $t_id = $row["id_$type"];
  28          $t_statut = $row["statut"];
  29          $t_maj = mysql_timestamp_to_time($row["maj"]);
  30          if ($t_maj > $maj && (!$t_statut || $t_statut == "publie")) {
  31              echo "$type $t_id $t_maj\n";
  32              if ($type == "article") $articles[]=$t_id;
  33          }
  34      }
  35      spip_free_result($result);
  36  }
  37  
  38  // Liste un sommaire recursif de rubriques
  39  // a condition que la mise a jour soit plus recente que $maj
  40  function liste_rubriques($result) {
  41      global $maj;
  42      global $rubriques;
  43      if ($result) while ($row=spip_fetch_array($result)) {
  44          $id_rubrique = $row['id_rubrique'];
  45          $id_parent = $row['id_parent'];
  46          $titre = $row['titre'];
  47          $descriptif = $row['descriptif'];
  48          $texte = $row['texte'];
  49          $rubrique_maj = mysql_timestamp_to_time($row["maj"]);
  50          if ($rubrique_maj > $maj) {
  51              echo "rubrique $id_rubrique $rubrique_maj\n";
  52          }
  53          $t_rubriques[] = $id_rubrique;
  54      }
  55      spip_free_result($result);
  56       if ($t_rubriques) {
  57           $t_rubriques = join(",", $t_rubriques);
  58           $rubriques[] = $t_rubriques;
  59           $query = "SELECT * FROM spip_rubriques WHERE id_parent IN ($t_rubriques)";
  60          liste_rubriques(spip_query($query));
  61      }
  62  }
  63  
  64  
  65  
  66  Header("Content-Type: text/plain");
  67  
  68  if ($id_rubrique)
  69      $query="SELECT * FROM spip_rubriques WHERE id_rubrique='$id_rubrique'";
  70  else
  71      $query="SELECT * FROM spip_rubriques WHERE id_parent=0";
  72  
  73  liste_rubriques(spip_query($query));
  74  
  75  if ($rubriques) {
  76      $rubriques = join(",", $rubriques);
  77  
  78      $query = "SELECT id_article, statut, maj FROM spip_articles WHERE id_rubrique IN ($rubriques)";
  79      liste_objets(spip_query($query), "article");
  80  
  81      $query = "SELECT id_breve, statut, maj FROM spip_breves WHERE id_rubrique IN ($rubriques)";
  82      liste_objets(spip_query($query), "breve");
  83  
  84      if ($articles) {
  85          $articles = join(",", $articles);
  86  
  87          $query = "SELECT DISTINCT spip_auteurs.id_auteur, maj FROM spip_auteurs, spip_auteurs_articles AS lien WHERE id_article IN ($articles) AND spip_auteurs.id_auteur=lien.id_auteur";
  88          liste_objets(spip_query($query), "auteur");
  89      }
  90  }
  91  
  92  
  93  exit;
  94  
  95  ?>


Généré le : Thu Feb 22 22:27:47 2007 par Balluche grâce à PHPXref 0.7