Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 65 → Rev 66

/trunk/papyrus/applications/installateur/instal_base_de_donnees.inc.php
New file
0,0 → 1,131
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (c) 2002, Hendrik Mans <hendrik@mans.de> |
// | Copyright 2002, 2003 David DELON |
// | Copyright 2002 Patrick PAUL |
// | Copyright 2003 Eric FELDSTEIN |
// | All rights reserved. |
// | Redistribution and use in source and binary forms, with or without |
// | modification, are permitted provided that the following conditions |
// | are met: |
// | 1. Redistributions of source code must retain the above copyright |
// | notice, this list of conditions and the following disclaimer. |
// | 2. Redistributions in binary form must reproduce the above copyright |
// | notice, this list of conditions and the following disclaimer in the |
// | documentation and/or other materials provided with the distribution. |
// | 3. The name of the author may not be used to endorse or promote products |
// | derived from this software without specific prior written permission. |
// | |
// | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
// | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
// | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
// | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: instal_base_de_donnees.inc.php,v 1.1 2004-10-15 18:28:59 jpm Exp $
/**
* Page de création de la base de données de Papyrus.
*
* Page permettant de créer la base de données de Papyrus.
*
*@package Installateur
//Auteur original :
*@author Hendrik MANS <hendrik@mans.de>
//Autres auteurs :
*@author David DELON
*@author Patrick PAUL
*@author Eric FELDSTEIN
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-10-15 18:28:59 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Récupération des paramêtres de configuration du formulaire précédent
if (isset($_POST['config'])) {
$config = $_POST['config'];
} else if (isset($_POST['config_serial'])) {
$config = unserialize(stripslashes($_POST['config_serial']));
}
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";
 
// Test de la configuration
$sortie .= ' <h2>Test de la configuration</h2>'."\n";
$erreur = testerConfig('Test connexion MySQL ...', $dblink = @mysql_connect($config['PAP_BDD_SERVEUR'], $config['PAP_BDD_UTILISATEUR'], $config['PAP_BDD_MOT_DE_PASSE']), '', 1, 0);
$erreur = testerConfig('Recherche base de donn&eacute;es ...', @mysql_select_db($config['PAP_BDD_NOM'], $dblink),
'La base de donn&eacute;es que vous avez choisie n\'existe pas, vous devez la cr&eacute;er avant d\'installer Papyrus !', 1, $erreur);
$sortie .= '<br />'."\n";
 
if (!$version = GEN_VERSION) $version = '0.1';
switch ($version) {
case '0.1':// Nouvelle installation de Papyrus 0.1
$sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
$tab_requete_sql = array();
PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
foreach ($tab_requete_sql as $value) {
//$sortie .= $value['query'].'<br />'.$value['type'].'-'.$value['table_nom'].'<br /><br /><br />';
$table_nom = '';
if (!empty($value['table_nom'])) {
$table_nom = $value['table_nom'];
}
$requete_type = '';
if (!empty($value['type'])) {
$requete_type = $value['type'];
}
if ($requete_type == 'create') {
$erreur = testerConfig( 'Creation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'D&eacute;j&agrave; cr&eacute;&eacute;e ?', 0, $erreur);
} else if ($requete_type == 'insert') {
$erreur = testerConfig( 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
}
}
break;
case '0.2':// Installation de Papyrus 0.2
break;
}
 
if ($erreur == 0 || $erreur == 1) {
$sortie .= ' <p>A l\'&eacute;tape suivante, le programme d\'installation va essayer d\'&eacute;crire le fichier de '.
'configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>. Assurez vous que le serveur web a bien le '.
'droit d\'&eacute;crire dans ce fichier, sinon vous devrez le modifier manuellement.</p>'."\n";
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
$sortie .= ' <input type="hidden" name="config" value="'.htmlentities(serialize($config)).'" />'."\n";
$sortie .= ' <input type="submit" value="Continuer" />'."\n";
$sortie .= ' </form>'."\n";
} else {
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=bdd" method="POST" />'."\n";
$sortie .= ' <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
$sortie .= ' <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
$sortie .= ' </form>'."\n";
}
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>