[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/ -> export_all.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  include  ("inc_version.php");
  20  
  21  include_ecrire  ("inc_auth.php");
  22  include_ecrire  ("inc_export.php");
  23  include_ecrire  ("inc_admin.php");
  24  include_ecrire  ("inc_presentation.php");
  25  
  26  if (!$archive) {
  27      if ($gz)
  28          $archive = "dump.xml.gz";
  29      else
  30          $archive = "dump.xml";
  31  }
  32  
  33  $action = _T('info_exportation_base', array('archive' => $archive));
  34  
  35  debut_admin ($action);
  36  
  37  $debug_limit = '';
  38  
  39  //$debug_limit = ' LIMIT 0,100';
  40  if (!$debut_limit)
  41      $debut_limit = 0;
  42  
  43  install_debut_html (_T('info_sauvegarde'));
  44  
  45  if (!$etape)
  46      echo "<p><blockquote><font size=2>" . _T('info_sauvegarde_echouee'). " <a href='export_all.php?etape=1&gz=$gz'>" . _T('info_procedez_par_etape'). "</a></font></blockquote><p>";
  47  
  48  if ($etape < 2) {
  49      $f = ($gz) ? @gzopen("data/$archive", "wb") : fopen("data/$archive", "wb");
  50  }              
  51  else {
  52      $f = ($gz) ? @gzopen("data/$archive", "ab") : fopen("data/$archive", "ab");
  53  }
  54  
  55  $_fputs = ($gz) ? gzputs : fputs;
  56  
  57  if ($etape < 2)
  58      $_fputs($f, "<" . "?xml version=\"1.0\" encoding=\"utf-8\"?" . ">\n<SPIP version=\"$spip_version_affichee\" version_base=\"$spip_version\" version_archive=\"$version_archive\">\n\n");
  59  
  60  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_rubriques";
  61  export_objets($query, "rubrique", $f, $gz, $etape, 1, _T('info_sauvegarde_rubriques'));
  62  
  63  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_auteurs";
  64  export_objets($query, "auteur", $f, $gz, $etape, 2, _T('info_sauvegarde_auteurs'));
  65  
  66  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_articles";
  67  export_objets($query, "article", $f, $gz, $etape, 3, _T('info_sauvegarde_articles'));
  68  
  69  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_types_documents";
  70  export_objets($query, "type_document", $f, $gz, $etape, 4, _T('info_sauvegarde_type_documents'));
  71  
  72  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_documents";
  73  export_objets($query, "document", $f, $gz, $etape, 5, _T('info_sauvegarde_documents'));
  74  
  75  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_mots";
  76  export_objets($query, "mot", $f, $gz, $etape, 6, _T('info_sauvegarde_mots_cles'));
  77  
  78  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_groupes_mots";
  79  export_objets($query, "groupe_mots", $f, $gz, $etape, 7, _T('info_sauvegarde_groupe_mots'));
  80  
  81  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_breves" . $debug_limit;
  82  export_objets($query, "breve", $f, $gz, $etape, 8, _T('info_sauvegarde_breves'));
  83  
  84  //$query = "SELECT * FROM ".$GLOBALS['table_prefix']."_messages";
  85  //export_objets($query, "message", $f, $gz, $etape, 9, _T('info_sauvegarde_messages'));
  86  
  87  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_forum WHERE statut='publie'" . $debug_limit;
  88  export_objets($query, "forum", $f, $gz, $etape, 9, _T('info_sauvegarde_forums'));
  89  
  90  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_petitions";
  91  export_objets($query, "petition", $f, $gz, $etape, 10, _T('info_sauvegarde_petitions'));
  92  
  93  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_signatures" . $debug_limit;
  94  export_objets($query, "signature", $f, $gz, $etape, 11, _T('info_sauvegarde_signatures'));
  95  
  96  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_syndic";
  97  export_objets($query, "syndic", $f, $gz, $etape, 12, _T('info_sauvegarde_sites_references'));
  98  
  99  $query = "SELECT * FROM " . $GLOBALS['table_prefix']. "_syndic_articles" . $debug_limit;
 100  export_objets($query, "syndic_article", $f, $gz, $etape, 13, _T('info_sauvegarde_articles_sites_ref'));
 101  
 102  /*$query = "SELECT * FROM ".$GLOBALS['table_prefix']."_visites".$debug_limit;
 103  export_objets($query, "".$GLOBALS['table_prefix']."_visite", $f, $gz, $etape, 14, _T('info_sauvegarde_visites'));
 104  
 105  $query = "SELECT * FROM ".$GLOBALS['table_prefix']."_referers".$debug_limit;
 106  export_objets($query, "".$GLOBALS['table_prefix']."_referers", $f, $gz, $etape, 15, _T('info_sauvegarde_refers'));
 107  */
 108  
 109  if (!$etape OR $etape == 13) {
 110      $_fputs($f, build_end_tag("SPIP"). "\n");
 111  
 112      echo "<p>" . _T('info_sauvegarde_reussi_01'). "</b><p>" . _T('info_sauvegarde_reussi_02', array('archive' => $archive)). " <a href='index.php'>" . _T('info_sauvegarde_reussi_03'). "</a> " . _T('info_sauvegarde_reussi_04'). "\n";
 113  }
 114  else {
 115      $etape_suivante = $etape + 1;
 116      if ($debut_limit > 1)
 117          echo "<p align='right'> <a href='export_all.php?etape=$etape&debut_limit=$debut_limit&gz=$gz'>>>>> " . _T('info_etape_suivante'). "</a>";
 118      else
 119          echo "<p align='right'> <a href='export_all.php?etape=$etape_suivante&gz=$gz'>>>>> " . _T('info_etape_suivante'). "</a>";
 120  }
 121  
 122  install_fin_html();
 123  
 124  if ($gz)
 125      gzclose ($f);
 126  else
 127      fclose ($f);
 128  
 129  if (!$etape OR $etape == 14)
 130      fin_admin ($action);
 131  
 132  exit;
 133  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7