From c61d75cbe6be79c9e06cb41140a10a8b25da8366 Mon Sep 17 00:00:00 2001 From: "Committo,Ergo:sum" <esj@rezo.net> Date: Fri, 16 Dec 2005 22:00:53 +0000 Subject: [PATCH] surcharge possible, et 2 scories --- .gitattributes | 1 + ecrire/import_all.php3 | 48 ++------------------------------ ecrire/inc_admin.php3 | 3 +- ecrire/inc_import_all.php | 58 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 47 deletions(-) create mode 100644 ecrire/inc_import_all.php diff --git a/.gitattributes b/.gitattributes index ae1785b7e5..3c19022fb1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -293,6 +293,7 @@ ecrire/inc_export_all.php -text ecrire/inc_forum_admin.php -text ecrire/inc_forum_envoi.php -text ecrire/inc_headers.php -text +ecrire/inc_import_all.php -text ecrire/inc_install.php -text ecrire/inc_js_menu_rubriques.php -text ecrire/inc_lang_liste.php -text diff --git a/ecrire/import_all.php3 b/ecrire/import_all.php3 index bd166dffb2..9540eeeaa1 100644 --- a/ecrire/import_all.php3 +++ b/ecrire/import_all.php3 @@ -10,52 +10,8 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - $reinstall = 'non'; include ("inc.php3"); - -include_ecrire ("inc_import.php3"); -include_ecrire("inc_texte.php3"); - -function verifier_version_sauvegarde ($archive) { - global $spip_version; - global $flag_gz; - - $ok = @file_exists(_DIR_SESSIONS . $archive); - $gz = $flag_gz; - $_fopen = ($gz) ? gzopen : fopen; - $_fread = ($gz) ? gzread : fread; - $buf_len = 1024; // la version doit etre dans le premier ko - - if ($ok) { - $f = $_fopen(_DIR_SESSIONS . $archive, "rb"); - $buf = $_fread($f, $buf_len); - - if (ereg("<SPIP [^>]* version_base=\"([0-9\.]+)\" ", $buf, $regs) - AND $regs[1] == $spip_version) - return false; // c'est bon - else - return _T('avis_erreur_version_archive', array('archive' => $archive)); - } else - return _T('avis_probleme_archive', array('archive' => $archive)); -} - -if ($archive) { - $action = _T('info_restauration_sauvegarde', array('archive' => $archive)); - $commentaire = verifier_version_sauvegarde ($archive); -} - -debut_admin($action, $commentaire); - - -$archive = _DIR_SESSIONS . $archive; - -ecrire_meta("debut_restauration", "debut"); -ecrire_meta("fichier_restauration", $archive); -ecrire_meta("status_restauration", "0"); -ecrire_metas(); - -fin_admin($action); - -redirige_par_entete("index.php3"); +$var_f = include_fonction(basename($SCRIPT_NAME, _EXTENSION_PHP)); +$var_f(); ?> diff --git a/ecrire/inc_admin.php3 b/ecrire/inc_admin.php3 index 2711fd21d7..62cf295dfc 100644 --- a/ecrire/inc_admin.php3 +++ b/ecrire/inc_admin.php3 @@ -24,7 +24,7 @@ function debut_admin($action, $commentaire='') { global $connect_statut; if ((!$action) || ($connect_statut != "0minirezo")) { - include_ecrire ("inc_minipre.php3"); + include_ecrire ("inc_minipres.php"); install_debut_html(_T('info_acces_refuse'));install_fin_html(); exit; } @@ -35,6 +35,7 @@ function debut_admin($action, $commentaire='') { } include_ecrire ("inc_minipres.php"); + include_ecrire ("inc_texte.php3"); install_debut_html(_T('info_action', array('action' => $action))); if ($commentaire) { diff --git a/ecrire/inc_import_all.php b/ecrire/inc_import_all.php new file mode 100644 index 0000000000..f6f3667eca --- /dev/null +++ b/ecrire/inc_import_all.php @@ -0,0 +1,58 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2005 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + +function verifier_version_sauvegarde ($archive) { + global $spip_version; + global $flag_gz; + + $ok = @file_exists(_DIR_SESSIONS . $archive); + $gz = $flag_gz; + $_fopen = ($gz) ? gzopen : fopen; + $_fread = ($gz) ? gzread : fread; + $buf_len = 1024; // la version doit etre dans le premier ko + + if ($ok) { + $f = $_fopen(_DIR_SESSIONS . $archive, "rb"); + $buf = $_fread($f, $buf_len); + + if (ereg("<SPIP [^>]* version_base=\"([0-9\.]+)\" ", $buf, $regs) + AND $regs[1] == $spip_version) + return false; // c'est bon + else + return _T('avis_erreur_version_archive', array('archive' => $archive)); + } else + return _T('avis_probleme_archive', array('archive' => $archive)); +} + +function import_all_dist() +{ + global $archive; + if ($archive) { + $action = _T('info_restauration_sauvegarde', array('archive' => $archive)); + $commentaire = verifier_version_sauvegarde ($archive); +} + + debut_admin($action, $commentaire); + + + $archive = _DIR_SESSIONS . $archive; + + ecrire_meta("debut_restauration", "debut"); + ecrire_meta("fichier_restauration", $archive); + ecrire_meta("status_restauration", "0"); + ecrire_metas(); + + fin_admin($action); + + header("Location: ./"); +} +?> -- GitLab