Subversion Repositories Applications.papyrus

Rev

Rev 76 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
66 jpm 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>                                                   |
9
// | Copyright 2002, 2003 David DELON                                                                     |
10
// | Copyright 2002 Patrick PAUL                                                                          |
11
// | Copyright  2003  Eric FELDSTEIN                                                                      |
12
// | All rights reserved.                                                                                 |
13
// | Redistribution and use in source and binary forms, with or without                                   |
14
// | modification, are permitted provided that the following conditions                                   |
15
// | are met:                                                                                             |
16
// | 1. Redistributions of source code must retain the above copyright                                    |
17
// | notice, this list of conditions and the following disclaimer.                                        |
18
// | 2. Redistributions in binary form must reproduce the above copyright                                 |
19
// | notice, this list of conditions and the following disclaimer in the                                  |
20
// | documentation and/or other materials provided with the distribution.                                 |
21
// | 3. The name of the author may not be used to endorse or promote products                             |
22
// | derived from this software without specific prior written permission.                                |
23
// |                                                                                                      |
24
// | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR                                 |
25
// | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES                            |
26
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.                              |
27
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,                                     |
28
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT                             |
29
// | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,                            |
30
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY                                |
31
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT                                  |
32
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF                             |
33
// | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.                                    |
34
// +------------------------------------------------------------------------------------------------------+
35
// CVS : $Id: instal_base_de_donnees.inc.php,v 1.1 2004-10-15 18:28:59 jpm Exp $
36
/**
37
* Page de création de la base de données de Papyrus.
38
*
39
* Page permettant de créer la base de données de Papyrus.
40
*
41
*@package Installateur
42
//Auteur original :
43
*@author        Hendrik MANS <hendrik@mans.de>
44
//Autres auteurs :
45
*@author        David DELON
46
*@author        Patrick PAUL
47
*@author        Eric FELDSTEIN
48
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
49
*@copyright     Tela-Botanica 2000-2004
50
*@version       $Revision: 1.1 $ $Date: 2004-10-15 18:28:59 $
51
// +------------------------------------------------------------------------------------------------------+
52
**/
53
 
54
// +------------------------------------------------------------------------------------------------------+
55
// |                                            ENTÊTE du PROGRAMME                                       |
56
// +------------------------------------------------------------------------------------------------------+
57
// Récupération des paramêtres de configuration du formulaire précédent
58
if (isset($_POST['config'])) {
59
    $config = $_POST['config'];
60
} else if (isset($_POST['config_serial'])) {
61
    $config = unserialize(stripslashes($_POST['config_serial']));
62
}
63
// +------------------------------------------------------------------------------------------------------+
64
// |                                          CORPS du PROGRAMME                                          |
65
// +------------------------------------------------------------------------------------------------------+
66
$sortie .= '    <h1>Installation de Papyrus</h1></h1>'."\n";
67
 
68
// Test de la configuration
69
$sortie .= '    <h2>Test de la configuration</h2>'."\n";
70
$erreur = testerConfig('Test connexion MySQL ...', $dblink = @mysql_connect($config['PAP_BDD_SERVEUR'], $config['PAP_BDD_UTILISATEUR'], $config['PAP_BDD_MOT_DE_PASSE']), '', 1, 0);
71
$erreur = testerConfig('Recherche base de donn&eacute;es ...', @mysql_select_db($config['PAP_BDD_NOM'], $dblink),
72
                '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);
73
$sortie .= '<br />'."\n";
74
 
75
if (!$version = GEN_VERSION) $version = '0.1';
76
switch ($version) {
77
    case '0.1':// Nouvelle installation de Papyrus 0.1
78
        $sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
79
        $tab_requete_sql = array();
80
        PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
81
        foreach ($tab_requete_sql as $value) {
82
            //$sortie .= $value['query'].'<br />'.$value['type'].'-'.$value['table_nom'].'<br /><br /><br />';
83
            $table_nom = '';
84
            if (!empty($value['table_nom'])) {
85
                $table_nom = $value['table_nom'];
86
            }
87
            $requete_type = '';
88
            if (!empty($value['type'])) {
89
                $requete_type = $value['type'];
90
            }
91
            if ($requete_type == 'create') {
92
                $erreur = testerConfig( 'Creation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
93
                                            'D&eacute;j&agrave; cr&eacute;&eacute;e ?', 0, $erreur);
94
            } else if ($requete_type == 'insert') {
95
                $erreur = testerConfig( 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
96
                                            'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
97
            }
98
        }
99
    break;
100
    case '0.2':// Installation de Papyrus 0.2
101
 
102
    break;
103
}
104
 
105
if ($erreur == 0 || $erreur == 1) {
106
    $sortie .= '    <p>A l\'&eacute;tape suivante, le programme d\'installation va essayer d\'&eacute;crire le fichier de '.
107
                'configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>. Assurez vous que le serveur web a bien le '.
108
                'droit d\'&eacute;crire dans ce fichier, sinon vous devrez le modifier manuellement.</p>'."\n";
109
 
110
    $sortie .= '    <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
111
    $sortie .= '      <input type="hidden" name="config" value="'.htmlentities(serialize($config)).'" />'."\n";
112
    $sortie .= '      <input type="submit" value="Continuer" />'."\n";
113
    $sortie .= '    </form>'."\n";
114
} else {
115
    $sortie .= '    <form action="'.donnerUrlCourante().'?installation=bdd" method="POST" />'."\n";
116
    $sortie .= '      <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
117
    $sortie .= '      <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
118
    $sortie .= '    </form>'."\n";
119
}
120
// +------------------------------------------------------------------------------------------------------+
121
// |                                            PIED du PROGRAMME                                         |
122
// +------------------------------------------------------------------------------------------------------+
123
 
124
 
125
/* +--Fin du code ----------------------------------------------------------------------------------------+
126
*
127
* $Log: not supported by cvs2svn $
128
*
129
* +-- Fin du code ----------------------------------------------------------------------------------------+
130
*/
131
?>