Rev 76 | Rev 98 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
<?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.3 2004-10-19 16:47:28 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.3 $ $Date: 2004-10-19 16:47:28 $// +------------------------------------------------------------------------------------------------------+**/// +------------------------------------------------------------------------------------------------------+// | ENTÊTE du PROGRAMME |// +------------------------------------------------------------------------------------------------------+// Récupération des paramêtres de configuration du formulaire précédentif (isset($_POST['config'])) {$config = $_POST['config'];} else if (isset($_POST['config_serial'])) {$config = unserialize(stripslashes($_POST['config_serial']));}if (isset($_POST['bdd'])) {$bdd = $_POST['bdd'];} else if (isset($_POST['bdd_serial'])) {$bdd = unserialize(stripslashes($_POST['bdd_serial']));}// +------------------------------------------------------------------------------------------------------+// | CORPS du PROGRAMME |// +------------------------------------------------------------------------------------------------------+$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";// Test de la configuration$sortie .= ' <h2>Test de la configuration de la base de données</h2>'."\n";$erreur = testerConfig($sortie, 'Test connexion MySQL ...', $dblink = @mysql_connect($config['PAP_BDD_SERVEUR'], $config['PAP_BDD_UTILISATEUR'], $config['PAP_BDD_MOT_DE_PASSE']), '', 1, 0);$erreur = testerConfig($sortie, 'Recherche base de données ...', @mysql_select_db($config['PAP_BDD_NOM'], $dblink),'La base de données que vous avez choisie n\'existe pas, vous devez la cré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//Insertion des requêtes présentes dans le fichier sql$sortie .= '<h2>Insertion des données du fichier sql dans la base</h2>';$sortie .= '<div class="zone_requete">';$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) {$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($sortie, 'Creation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),'Déjà créée ?', 0, $erreur);} else if ($requete_type == 'insert') {$erreur = testerConfig($sortie, 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),'Données déjà présente ?', 0, $erreur);}}$sortie .= '</div>';//Insertion des requêtes dépendant du formulaire d'installation$sortie .= '<h2>Insertion des données dépendant du formulaire précédent</h2>';$requete_admin = 'INSERT INTO gen_annuaire VALUES (1, "'.$bdd['ADMIN_I18N'].'", "'.$bdd['ADMIN_NOM'].'", "'.$bdd['ADMIN_PRENOM'].'", "'.md5($bdd['ADMIN_MDP_01']).'", "'.$bdd['ADMIN_MAIL'].'");';$erreur = testerConfig($sortie, 'Insertion de l\'administrateur...', @mysql_query($requete_admin, $dblink),'Données déjà présente ?', 0, $erreur);break;case '0.2':// Installation de Papyrus 0.2break;}if ($erreur == 0 || $erreur == 1) {$sortie .= ' <p>A l\'étape suivante, le programme d\'installation va essayer d\'écrire le fichier de '.'configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>. Assurez vous que le serveur web a bien le '.'droit d\'é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="hidden" name="bdd" value="'.htmlentities(serialize($bdd)).'" />'."\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="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" />'."\n";$sortie .= ' <input type="submit" value="Essayer à nouveau" />'."\n";$sortie .= ' </form>'."\n";}// +------------------------------------------------------------------------------------------------------+// | PIED du PROGRAMME |// +------------------------------------------------------------------------------------------------------+/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.2 2004/10/19 15:59:18 jpm* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.* Ajout des constantes FTP.** Revision 1.1 2004/10/15 18:28:59 jpm* Début appli installateur de Papyrus.*** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>