Line 30... |
Line 30... |
30 |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
30 |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
31 |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
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 |
|
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. |
|
33 |
// | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
34 |
// +------------------------------------------------------------------------------------------------------+
|
35 |
// CVS : $Id: instal_base_de_donnees.inc.php,v 1.1 2004-10-15 18:28:59 jpm Exp $
|
35 |
// CVS : $Id: instal_base_de_donnees.inc.php,v 1.2 2004-10-19 15:59:18 jpm Exp $
|
36 |
/**
|
36 |
/**
|
37 |
* Page de création de la base de données de Papyrus.
|
37 |
* Page de création de la base de données de Papyrus.
|
38 |
*
|
38 |
*
|
39 |
* Page permettant de créer la base de données de Papyrus.
|
39 |
* Page permettant de créer la base de données de Papyrus.
|
40 |
*
|
40 |
*
|
Line 45... |
Line 45... |
45 |
*@author David DELON
|
45 |
*@author David DELON
|
46 |
*@author Patrick PAUL
|
46 |
*@author Patrick PAUL
|
47 |
*@author Eric FELDSTEIN
|
47 |
*@author Eric FELDSTEIN
|
48 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
48 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
49 |
*@copyright Tela-Botanica 2000-2004
|
49 |
*@copyright Tela-Botanica 2000-2004
|
50 |
*@version $Revision: 1.1 $ $Date: 2004-10-15 18:28:59 $
|
50 |
*@version $Revision: 1.2 $ $Date: 2004-10-19 15:59:18 $
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
51 |
// +------------------------------------------------------------------------------------------------------+
|
52 |
**/
|
52 |
**/
|
Line 53... |
Line 53... |
53 |
|
53 |
|
54 |
// +------------------------------------------------------------------------------------------------------+
|
54 |
// +------------------------------------------------------------------------------------------------------+
|
Line 58... |
Line 58... |
58 |
if (isset($_POST['config'])) {
|
58 |
if (isset($_POST['config'])) {
|
59 |
$config = $_POST['config'];
|
59 |
$config = $_POST['config'];
|
60 |
} else if (isset($_POST['config_serial'])) {
|
60 |
} else if (isset($_POST['config_serial'])) {
|
61 |
$config = unserialize(stripslashes($_POST['config_serial']));
|
61 |
$config = unserialize(stripslashes($_POST['config_serial']));
|
62 |
}
|
62 |
}
|
- |
|
63 |
if (isset($_POST['bdd'])) {
|
- |
|
64 |
$bdd = $_POST['bdd'];
|
- |
|
65 |
} else if (isset($_POST['bdd_serial'])) {
|
- |
|
66 |
$bdd = unserialize(stripslashes($_POST['bdd_serial']));
|
- |
|
67 |
}
|
63 |
// +------------------------------------------------------------------------------------------------------+
|
68 |
// +------------------------------------------------------------------------------------------------------+
|
64 |
// | CORPS du PROGRAMME |
|
69 |
// | CORPS du PROGRAMME |
|
65 |
// +------------------------------------------------------------------------------------------------------+
|
70 |
// +------------------------------------------------------------------------------------------------------+
|
66 |
$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";
|
71 |
$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";
|
Line 67... |
Line 72... |
67 |
|
72 |
|
68 |
// Test de la configuration
|
73 |
// Test de la configuration
|
69 |
$sortie .= ' <h2>Test de la configuration</h2>'."\n";
|
74 |
$sortie .= ' <h2>Test de la configuration de la base de données</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);
|
75 |
$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ées ...', @mysql_select_db($config['PAP_BDD_NOM'], $dblink),
|
76 |
$erreur = testerConfig('Recherche base de données ...', @mysql_select_db($config['PAP_BDD_NOM'], $dblink),
|
72 |
'La base de données que vous avez choisie n\'existe pas, vous devez la créer avant d\'installer Papyrus !', 1, $erreur);
|
77 |
'La base de données que vous avez choisie n\'existe pas, vous devez la créer avant d\'installer Papyrus !', 1, $erreur);
|
Line 73... |
Line 78... |
73 |
$sortie .= '<br />'."\n";
|
78 |
$sortie .= '<br />'."\n";
|
74 |
|
79 |
|
75 |
if (!$version = GEN_VERSION) $version = '0.1';
|
80 |
if (!$version = GEN_VERSION) $version = '0.1';
|
- |
|
81 |
switch ($version) {
|
- |
|
82 |
case '0.1':// Nouvelle installation de Papyrus 0.1
|
- |
|
83 |
//Insertion des requêtes présentes dans le fichier sql
|
76 |
switch ($version) {
|
84 |
$sortie .= '<h2>Insertion des données du fichier sql dans la base</h2>';
|
77 |
case '0.1':// Nouvelle installation de Papyrus 0.1
|
85 |
$sortie .= '<div class="zone_requete">';
|
78 |
$sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
|
86 |
$sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
|
79 |
$tab_requete_sql = array();
|
87 |
$tab_requete_sql = array();
|
80 |
PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
|
- |
|
81 |
foreach ($tab_requete_sql as $value) {
|
88 |
PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
|
82 |
//$sortie .= $value['query'].'<br />'.$value['type'].'-'.$value['table_nom'].'<br /><br /><br />';
|
89 |
foreach ($tab_requete_sql as $value) {
|
83 |
$table_nom = '';
|
90 |
$table_nom = '';
|
84 |
if (!empty($value['table_nom'])) {
|
91 |
if (!empty($value['table_nom'])) {
|
85 |
$table_nom = $value['table_nom'];
|
92 |
$table_nom = $value['table_nom'];
|
Line 94... |
Line 101... |
94 |
} else if ($requete_type == 'insert') {
|
101 |
} else if ($requete_type == 'insert') {
|
95 |
$erreur = testerConfig( 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
|
102 |
$erreur = testerConfig( 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
|
96 |
'Données déjà présente ?', 0, $erreur);
|
103 |
'Données déjà présente ?', 0, $erreur);
|
97 |
}
|
104 |
}
|
98 |
}
|
105 |
}
|
- |
|
106 |
$sortie .= '</div>';
|
- |
|
107 |
//Insertion des requêtes dépendant du formulaire d'installation
|
- |
|
108 |
$sortie .= '<h2>Insertion des données dépendant du formulaire précédent</h2>';
|
- |
|
109 |
$requete_admin = 'INSERT INTO gen_annuaire VALUES (1, "'.$bdd['ADMIN_I18N'].'", "'.$bdd['ADMIN_NOM'].
|
- |
|
110 |
'", "'.$bdd['ADMIN_PRENOM'].'", "'.md5($bdd['ADMIN_MDP_01']).'", "'.
|
- |
|
111 |
$bdd['ADMIN_MAIL'].'");';
|
- |
|
112 |
$erreur = testerConfig( 'Insertion de l\'administrateur...', @mysql_query($requete_admin, $dblink),
|
- |
|
113 |
'Données déjà présente ?', 0, $erreur);
|
99 |
break;
|
114 |
break;
|
100 |
case '0.2':// Installation de Papyrus 0.2
|
115 |
case '0.2':// Installation de Papyrus 0.2
|
Line 101... |
Line 116... |
101 |
|
116 |
|
102 |
break;
|
117 |
break;
|
Line 107... |
Line 122... |
107 |
'configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>. Assurez vous que le serveur web a bien le '.
|
122 |
'configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>. Assurez vous que le serveur web a bien le '.
|
108 |
'droit d\'écrire dans ce fichier, sinon vous devrez le modifier manuellement.</p>'."\n";
|
123 |
'droit d\'écrire dans ce fichier, sinon vous devrez le modifier manuellement.</p>'."\n";
|
Line 109... |
Line 124... |
109 |
|
124 |
|
110 |
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
|
125 |
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
|
- |
|
126 |
$sortie .= ' <input type="hidden" name="config" value="'.htmlentities(serialize($config)).'" />'."\n";
|
111 |
$sortie .= ' <input type="hidden" name="config" value="'.htmlentities(serialize($config)).'" />'."\n";
|
127 |
$sortie .= ' <input type="hidden" name="bdd" value="'.htmlentities(serialize($bdd)).'" />'."\n";
|
112 |
$sortie .= ' <input type="submit" value="Continuer" />'."\n";
|
128 |
$sortie .= ' <input type="submit" value="Continuer" />'."\n";
|
113 |
$sortie .= ' </form>'."\n";
|
129 |
$sortie .= ' </form>'."\n";
|
114 |
} else {
|
130 |
} else {
|
115 |
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=bdd" method="POST" />'."\n";
|
131 |
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=bdd" method="POST" />'."\n";
|
- |
|
132 |
$sortie .= ' <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
|
116 |
$sortie .= ' <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
|
133 |
$sortie .= ' <input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" />'."\n";
|
117 |
$sortie .= ' <input type="submit" value="Essayer à nouveau" />'."\n";
|
134 |
$sortie .= ' <input type="submit" value="Essayer à nouveau" />'."\n";
|
118 |
$sortie .= ' </form>'."\n";
|
135 |
$sortie .= ' </form>'."\n";
|
119 |
}
|
136 |
}
|
120 |
// +------------------------------------------------------------------------------------------------------+
|
137 |
// +------------------------------------------------------------------------------------------------------+
|
Line 123... |
Line 140... |
123 |
|
140 |
|
124 |
|
141 |
|
125 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
142 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
- |
|
143 |
*
|
- |
|
144 |
* $Log: not supported by cvs2svn $
|
- |
|
145 |
* Revision 1.1 2004/10/15 18:28:59 jpm
|
126 |
*
|
146 |
* Début appli installateur de Papyrus.
|
127 |
* $Log: not supported by cvs2svn $
|
147 |
*
|
128 |
*
|
148 |
*
|
129 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
149 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
130 |
*/
|
150 |
*/
|