Subversion Repositories Applications.papyrus

Rev

Rev 100 | Rev 328 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 100 Rev 108
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>                                                   |
8
// | Copyright (c) 2002, Hendrik Mans <hendrik@mans.de>                                                   |
9
// | Copyright 2002, 2003 David DELON                                                                     |
9
// | Copyright 2002, 2003 David DELON                                                                     |
10
// | Copyright 2002 Patrick PAUL                                                                          |
10
// | Copyright 2002 Patrick PAUL                                                                          |
11
// | Copyright  2003  Jean-Pascal MILCENT                                                                 |
11
// | Copyright  2003  Jean-Pascal MILCENT                                                                 |
12
// | All rights reserved.                                                                                 |
12
// | All rights reserved.                                                                                 |
13
// | Redistribution and use in source and binary forms, with or without                                   |
13
// | Redistribution and use in source and binary forms, with or without                                   |
14
// | modification, are permitted provided that the following conditions                                   |
14
// | modification, are permitted provided that the following conditions                                   |
15
// | are met:                                                                                             |
15
// | are met:                                                                                             |
16
// | 1. Redistributions of source code must retain the above copyright                                    |
16
// | 1. Redistributions of source code must retain the above copyright                                    |
17
// | notice, this list of conditions and the following disclaimer.                                        |
17
// | notice, this list of conditions and the following disclaimer.                                        |
18
// | 2. Redistributions in binary form must reproduce the above copyright                                 |
18
// | 2. Redistributions in binary form must reproduce the above copyright                                 |
19
// | notice, this list of conditions and the following disclaimer in the                                  |
19
// | notice, this list of conditions and the following disclaimer in the                                  |
20
// | documentation and/or other materials provided with the distribution.                                 |
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                             |
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.                                |
22
// | derived from this software without specific prior written permission.                                |
23
// |                                                                                                      |
23
// |                                                                                                      |
24
// | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR                                 |
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                            |
25
// | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES                            |
26
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.                              |
26
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.                              |
27
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,                                     |
27
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,                                     |
28
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT                             |
28
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT                             |
29
// | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,                            |
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                                |
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_fichier.inc.php,v 1.7 2004-10-25 10:22:48 jpm Exp $
35
// CVS : $Id: instal_fichier.inc.php,v 1.8 2004-10-25 16:26:35 jpm Exp $
36
/**
36
/**
37
* Page de création des fichiers nécessaire à l'installation de Papyrus.
37
* Page de création des fichiers nécessaire à l'installation de Papyrus.
38
*
38
*
39
* Page permettant de créer le fichier de configuration de Papyrus.
39
* Page permettant de créer le fichier de configuration de Papyrus.
40
*
40
*
41
*@package Installateur
41
*@package Installateur
42
//Auteur original :
42
//Auteur original :
43
*@author        Hendrik MANS <hendrik@mans.de>
43
*@author        Hendrik MANS <hendrik@mans.de>
44
//Autres auteurs :
44
//Autres auteurs :
45
*@author        David DELON
45
*@author        David DELON
46
*@author        Patrick PAUL
46
*@author        Patrick PAUL
47
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
47
*@author        Jean-Pascal MILCENT <jpm@tela-botanica.org>
48
*@copyright     Tela-Botanica 2000-2004
48
*@copyright     Tela-Botanica 2000-2004
49
*@version       $Revision: 1.7 $ $Date: 2004-10-25 10:22:48 $
49
*@version       $Revision: 1.8 $ $Date: 2004-10-25 16:26:35 $
50
// +------------------------------------------------------------------------------------------------------+
50
// +------------------------------------------------------------------------------------------------------+
51
**/
51
**/
52
 
52
 
53
// +------------------------------------------------------------------------------------------------------+
53
// +------------------------------------------------------------------------------------------------------+
54
// |                                            ENTÊTE du PROGRAMME                                       |
54
// |                                            ENTÊTE du PROGRAMME                                       |
55
// +------------------------------------------------------------------------------------------------------+
55
// +------------------------------------------------------------------------------------------------------+
56
// Numéro de l'étape d'installation :
56
// Numéro de l'étape d'installation :
57
$num_etape = 3;
57
$num_etape = 3;
58
 
58
 
59
// Initialisation du tableau contenant les valeurs de configuration de la base de données
59
// Initialisation du tableau contenant les valeurs de configuration de la base de données
60
$tableau = array(   'PAP_FTP_SERVEUR' => '', 'PAP_FTP_PORT' => '', 'PAP_FTP_UTILISATEUR' => '', 
60
$tableau = array(   'PAP_FTP_SERVEUR' => '', 'PAP_FTP_PORT' => '', 'PAP_FTP_UTILISATEUR' => '', 
61
                    'PAP_FTP_MOT_DE_PASSE' => '', 'PAP_FTP_RACINE' => '');
61
                    'PAP_FTP_MOT_DE_PASSE' => '', 'PAP_FTP_RACINE' => '');
62
foreach ($tableau as $cle => $val) {
62
foreach ($tableau as $cle => $val) {
63
    if (!empty($_POST['fichier'][$cle])) {
63
    if (!empty($_POST['fichier'][$cle])) {
64
        $fichier[$cle] = $_POST['fichier'][$cle];
64
        $fichier[$cle] = $_POST['fichier'][$cle];
65
    } else if (defined($cle)) {
65
    } else if (defined($cle)) {
66
        $fichier[$cle] = constant($cle);
66
        $fichier[$cle] = constant($cle);
67
    } else {
67
    } else {
68
        if ($cle == 'PAP_FTP_SERVEUR') {
68
        if ($cle == 'PAP_FTP_SERVEUR') {
69
            $fichier[$cle] = $_SERVER['HTTP_HOST'];
69
            $fichier[$cle] = $_SERVER['HTTP_HOST'];
70
        } else if ($cle == 'PAP_FTP_PORT') {
70
        } else if ($cle == 'PAP_FTP_PORT') {
71
            $fichier[$cle] = 21;
71
            $fichier[$cle] = 21;
72
        } else {
72
        } else {
73
            $fichier[$cle] = '';
73
            $fichier[$cle] = '';
74
        }
74
        }
75
    }
75
    }
76
}
76
}
77
 
77
 
78
// Récupération des paramêtres de configuration du formulaire précédent
78
// Récupération des paramêtres de configuration du formulaire précédent
79
if (isset($_POST['pref_serial'])) {
79
if (isset($_POST['pref_serial'])) {
80
    $pref = unserialize(stripslashes($_POST['pref_serial']));
80
    $pref = unserialize(stripslashes($_POST['pref_serial']));
81
}
81
}
82
if (isset($_POST['bdd'])) {
82
if (isset($_POST['bdd'])) {
83
    $bdd = $_POST['bdd'];
83
    $bdd = $_POST['bdd'];
84
} else if (isset($_POST['bdd_serial'])) {
84
} else if (isset($_POST['bdd_serial'])) {
85
    $bdd = unserialize(stripslashes($_POST['bdd_serial']));
85
    $bdd = unserialize(stripslashes($_POST['bdd_serial']));
86
}
86
}
87
 
87
 
88
// +------------------------------------------------------------------------------------------------------+
88
// +------------------------------------------------------------------------------------------------------+
89
// |                                          CORPS du PROGRAMME                                          |
89
// |                                          CORPS du PROGRAMME                                          |
90
// +------------------------------------------------------------------------------------------------------+
90
// +------------------------------------------------------------------------------------------------------+
91
// Affichage d'informations...
91
// Affichage d'informations...
92
$sortie .= '<p class="etape_numero"><strong>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</strong></p>'."\n";
92
$sortie .= '<p class="etape_numero"><strong>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</strong></p>'."\n";
93
 
93
 
94
// Correction éventuelle des informations saisies par l'utilisateur
94
// Correction éventuelle des informations saisies par l'utilisateur
95
if (ereg('^[\/\\]', $fichier['PAP_FTP_RACINE']) == false) {
95
if (ereg('^[\/\\]', $fichier['PAP_FTP_RACINE']) == false) {
96
    // le chemin FTP ne doit pas commencer par un slash, nous le supprimons
96
    // le chemin FTP ne doit pas commencer par un slash, nous le supprimons
97
    $fichier['PAP_FTP_RACINE'] = GEN_SEP.$fichier['PAP_FTP_RACINE'];
97
    $fichier['PAP_FTP_RACINE'] = GEN_SEP.$fichier['PAP_FTP_RACINE'];
98
}
98
}
99
 
99
 
100
// Nous vérifions si nous sommes en phase de test du formulaire de config de l'écriture de fichier
100
// Nous vérifions si nous sommes en phase de test du formulaire de config de l'écriture de fichier
101
$erreur = 0;
101
$erreur = 0;
102
$sortie_verif = '';
102
$sortie_verif = '';
103
if ($_GET['installation'] == 'verif_fichier') {
103
if ($_GET['installation'] == 'verif_fichier') {
104
    // Test de la configuration du FTP
104
    // Test de la configuration du FTP
105
    $sortie_verif .= '    <h2>Test de la connexion FTP</h2>'."\n";
105
    $sortie_verif .= '    <h2>Test de la connexion FTP</h2>'."\n";
106
    $erreur = testerConfig($sortie_verif, 'Test connexion FTP ...', $ftp = @ftp_connect($fichier['PAP_FTP_SERVEUR'], $fichier['PAP_FTP_PORT']), '', 1, $erreur);
106
    $erreur = testerConfig($sortie_verif, 'Test connexion FTP ...', $ftp = @ftp_connect($fichier['PAP_FTP_SERVEUR'], $fichier['PAP_FTP_PORT']), '', 1, $erreur);
107
    $erreur = testerConfig($sortie_verif, 'Test identification sur le serveur FTP ...', @ftp_login($ftp, $fichier['PAP_FTP_UTILISATEUR'],
107
    $erreur = testerConfig($sortie_verif, 'Test identification sur le serveur FTP ...', @ftp_login($ftp, $fichier['PAP_FTP_UTILISATEUR'],
108
                            $fichier['PAP_FTP_MOT_DE_PASSE']), 'Les paramêtres FTP saisies ne permettent pas l\'identification !', 1, $erreur);
108
                            $fichier['PAP_FTP_MOT_DE_PASSE']), 'Les paramêtres FTP saisies ne permettent pas l\'identification !', 1, $erreur);
109
    $sortie_verif .= '<br />'."\n";
109
    $sortie_verif .= '<br />'."\n";
110
    
110
    
111
    $configCode = "<?php\n// pap_config.inc.php construit le ".strftime("%c")."\n// ne changez pas la version de Papyrus manuellement!\n\n";
111
    $configCode = "<?php\n// pap_config.inc.php construit le ".strftime("%c")."\n// ne changez pas la version de Papyrus manuellement!\n\n";
112
    $entries[] = 'define(\''.INSTAL_VERSION_NOUVELLE_NOM.'\',\''.INSTAL_VERSION_NOUVELLE.'\');'."\n";
112
    $entries[] = 'define(\''.INSTAL_VERSION_NOUVELLE_NOM.'\',\''.INSTAL_VERSION_NOUVELLE.'\');'."\n";
113
    foreach ($bdd as $cle => $val) {
113
    foreach ($bdd as $cle => $val) {
114
        $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
114
        $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
115
    }
115
    }
116
    $entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
116
    $entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
117
    foreach ($fichier as $cle => $val) {
117
    foreach ($fichier as $cle => $val) {
118
        $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
118
        $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
119
    }
119
    }
120
    foreach ($pref as $cle => $val) {
120
    foreach ($pref as $cle => $val) {
121
        // Nous récupérons uniquement les constantes à stocker dans le fichier de config (leur nom commence par PAP_)
121
        // Nous récupérons uniquement les constantes à stocker dans le fichier de config (leur nom commence par PAP_)
122
        if (preg_match('/^PAP_/', $cle)) {
122
        if (preg_match('/^PAP_/', $cle)) {
123
            $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
123
            $entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
124
        }
124
        }
125
    }
125
    }
126
    $configCode .= implode("\n", $entries)."\n\n?>";
126
    $configCode .= implode("\n", $entries)."\n\n?>";
127
    
127
    
128
    // Tentative d'écriture du fichier de config
128
    // Tentative d'écriture du fichier de config
129
    $sortie_verif .= '    <h2>Ecriture des fichiers sur le serveur par FTP</h2>'."\n";
129
    $sortie_verif .= '    <h2>Ecriture des fichiers sur le serveur par FTP</h2>'."\n";
130
    $chemin_fpt_absolu = $fichier['PAP_FTP_RACINE'].INSTAL_CHEMIN_CONFIG;
130
    $chemin_fpt_absolu = $fichier['PAP_FTP_RACINE'].INSTAL_CHEMIN_CONFIG;
131
    $url_ftp =  'ftp://'.$fichier['PAP_FTP_UTILISATEUR'].':'.$fichier['PAP_FTP_MOT_DE_PASSE'].
131
    $url_ftp =  'ftp://'.$fichier['PAP_FTP_UTILISATEUR'].':'.$fichier['PAP_FTP_MOT_DE_PASSE'].
132
                '@'.$fichier['PAP_FTP_SERVEUR'].$chemin_fpt_absolu;
132
                '@'.$fichier['PAP_FTP_SERVEUR'].$chemin_fpt_absolu;
-
 
133
    
-
 
134
    // Dans le cas, où nous mettons à jour Papyrus, il faut supprimer l'ancien fichier de config
-
 
135
    if (INSTAL_VERSION_ANCIENNE != '') {
-
 
136
        $txt_suppression = 'Suppression de <tt>'.$chemin_fpt_absolu.'</tt>...';
-
 
137
        $txt_suppression_erreur =   '<p>Le fichier <tt>'.$chemin_fpt_absolu.'</tt> ne peut être supprimer automatiquement. '.
-
 
138
                                    'Veuillez utiliser un logiciel de transfert de fichier par FTP pour le supprimer.</p>';
-
 
139
        $erreur = testerConfig($sortie_verif, $txt_suppression, unlink($url_ftp), $txt_suppression_erreur, 1, $erreur);
-
 
140
    }
-
 
141
    
-
 
142
    // Nous écrivons le fichier de config sur le disque
133
    $fp = @fopen($url_ftp, 'w');
143
    $fp = @fopen($url_ftp, 'w');
134
    $txt_ecriture_conf = '&Eacute;criture sur le serveur de <tt>'.$chemin_fpt_absolu.'</tt>...';
144
    $txt_ecriture_conf = '&Eacute;criture sur le serveur de <tt>'.$chemin_fpt_absolu.'</tt>...';
135
    $txt_ecriture_conf_erreur = '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.$chemin_fpt_absolu.
145
    $txt_ecriture_conf_erreur = '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.$chemin_fpt_absolu.
136
                '</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
146
                '</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
137
                'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
147
                'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
138
                'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
148
                'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
139
                'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
149
                'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
140
                '<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire '.
150
                '<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire '.
141
                '<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
151
                '<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
142
                'correctement.</p>';
152
                'correctement.</p>';
143
    $txt_ecriture_conf_erreur .= '<div id="fichier_config">'."\n";
153
    $txt_ecriture_conf_erreur .= '<div id="fichier_config">'."\n";
144
    $txt_ecriture_conf_erreur .= '<xmp>'.$configCode.'</xmp>'."\n";
154
    $txt_ecriture_conf_erreur .= '<xmp>'.$configCode.'</xmp>'."\n";
145
    $txt_ecriture_conf_erreur .= '</div>'."\n";
155
    $txt_ecriture_conf_erreur .= '</div>'."\n";
146
    $erreur = testerConfig($sortie_verif, $txt_ecriture_conf, $fp, $txt_ecriture_conf_erreur, 1, $erreur);
156
    $erreur = testerConfig($sortie_verif, $txt_ecriture_conf, $fp, $txt_ecriture_conf_erreur, 1, $erreur);
147
}
157
}
148
 
158
 
149
// Gestion de l'affichage
159
// Gestion de l'affichage
150
if ($erreur == 0 && empty($sortie_verif)) {
160
if ($erreur == 0 && empty($sortie_verif)) {
151
    // Premier appel du fichier...
161
    // Premier appel du fichier...
152
    $sortie .= creerFormulaire($fichier);
162
    $sortie .= creerFormulaire($fichier);
153
    $sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
163
    $sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
154
    $sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
164
    $sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
155
    $sortie .= '<li><input type="submit" value="Tester" /></li>'."\n";
165
    $sortie .= '<li><input type="submit" value="Tester" /></li>'."\n";
156
    $sortie .= '      </ul>'."\n";
166
    $sortie .= '      </ul>'."\n";
157
    $sortie .= '    </form>';
167
    $sortie .= '    </form>';
158
} else if ($erreur == 2 && !empty($sortie_verif)) {
168
} else if ($erreur == 2 && !empty($sortie_verif)) {
159
    // Vérification du fichier avec interuption...
169
    // Vérification du fichier avec interuption...
160
    $sortie .= creerFormulaire($fichier);
170
    $sortie .= creerFormulaire($fichier);
161
    $sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
171
    $sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
162
    $sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
172
    $sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
163
    $sortie .= '<li><input type="submit" value="Tester à nouveau" /></li>'."\n";
173
    $sortie .= '<li><input type="submit" value="Tester à nouveau" /></li>'."\n";
164
    $sortie .= '      </ul>'."\n";
174
    $sortie .= '      </ul>'."\n";
165
    $sortie .= '    </form>';
175
    $sortie .= '    </form>';
166
    $sortie .= $sortie_verif;
176
    $sortie .= $sortie_verif;
167
} else if (($erreur == 0 || $erreur == 1) && !empty($sortie_verif)) {
177
} else if (($erreur == 0 || $erreur == 1) && !empty($sortie_verif)) {
168
    // Vérification du fichier sans interuption... passage à l'étape suivante
178
    // Vérification du fichier sans interuption... passage à l'étape suivante
169
    $sortie .= creerFormulaire($fichier, true);
179
    $sortie .= creerFormulaire($fichier, true);
170
    $sortie .= '      </ul>'."\n";
180
    $sortie .= '      </ul>'."\n";
171
    $sortie .= '    </form>';
181
    $sortie .= '    </form>';
172
    $sortie .= $sortie_verif;
182
    $sortie .= $sortie_verif;
173
    // Ecriture du fichier...
183
    // Ecriture du fichier...
174
    fwrite($fp, $configCode);
184
    fwrite($fp, $configCode);
175
    fclose($fp);
185
    fclose($fp);
176
    $sortie .= '    <p class="etape_info">Voila c\'est termin&eacute; ! Vous pouvez <a href="'.donnerUrlCourante().'">retourner sur votre site '.
186
    $sortie .= '    <p class="etape_info">Voila c\'est termin&eacute; ! Vous pouvez <a href="'.donnerUrlCourante().'">retourner sur votre site '.
177
                'Papyrus</a>. Il est conseill&eacute; de retirer l\'acc&egrave;s en &eacute;criture au fichier '.
187
                'Papyrus</a>. Il est conseill&eacute; de retirer l\'acc&egrave;s en &eacute;criture au fichier '.
178
                '<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>'."\n";
188
                '<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>'."\n";
179
}
189
}
180
 
190
 
181
// +------------------------------------------------------------------------------------------------------+
191
// +------------------------------------------------------------------------------------------------------+
182
// |                                            LISTE DES FONCTIONS                                       |
192
// |                                            LISTE DES FONCTIONS                                       |
183
// +------------------------------------------------------------------------------------------------------+
193
// +------------------------------------------------------------------------------------------------------+
184
 
194
 
185
// Création du formulaire de configuration de la base de donneés
195
// Création du formulaire de configuration de la base de donneés
186
function creerFormulaire($fichier, $bln_lecture = false) {
196
function creerFormulaire($fichier, $bln_lecture = false) {
187
    $disabled = '';
197
    $disabled = '';
188
    if ($bln_lecture) {
198
    if ($bln_lecture) {
189
        $disabled = ' disabled="disabled" ';
199
        $disabled = ' disabled="disabled" ';
190
    }
200
    }
191
    $sortie_form .= '    <form action="'.donnerUrlCourante().'?installation=verif_fichier" method="post">';
201
    $sortie_form .= '    <form action="'.donnerUrlCourante().'?installation=verif_fichier" method="post">';
192
    $sortie_form .= '      <ul>'."\n";
202
    $sortie_form .= '      <ul>'."\n";
193
    $sortie_form .=  '<li><h2>Configuration du FTP et des chemins d\'accès</h2></li>'."\n";
203
    $sortie_form .=  '<li><h2>Configuration du FTP et des chemins d\'accès</h2></li>'."\n";
194
    $sortie_form .= '<li>Le nom de la machine à laquelle vous vous connectez pour accéder à votre dépôt FTP. En '.
204
    $sortie_form .= '<li>Le nom de la machine à laquelle vous vous connectez pour accéder à votre dépôt FTP. En '.
195
                    'g&eacute;n&eacute;ral c\'est le nom de domaine du site où vous voulez installer Papyrus.</li>'."\n";
205
                    'g&eacute;n&eacute;ral c\'est le nom de domaine du site où vous voulez installer Papyrus.</li>'."\n";
196
    $sortie_form .=  '<li>'."\n".
206
    $sortie_form .=  '<li>'."\n".
197
                '<label for="ftp_serveur">Nom du serveur FTP :</label>'.
207
                '<label for="ftp_serveur">Nom du serveur FTP :</label>'.
198
                '<input id="ftp_serveur"'.$disabled.'type="text" size="30" name="fichier[PAP_FTP_SERVEUR]" value="'.$fichier['PAP_FTP_SERVEUR'].'" />'.
208
                '<input id="ftp_serveur"'.$disabled.'type="text" size="30" name="fichier[PAP_FTP_SERVEUR]" value="'.$fichier['PAP_FTP_SERVEUR'].'" />'.
199
                '</li>'."\n";
209
                '</li>'."\n";
200
    $sortie_form .= '<li>Le numéro du port pour le service FTP sur la machine hébergeant Papyrus. '.
210
    $sortie_form .= '<li>Le numéro du port pour le service FTP sur la machine hébergeant Papyrus. '.
201
                    'En g&eacute;n&eacute;ral c\'est 21.</li>'."\n";
211
                    'En g&eacute;n&eacute;ral c\'est 21.</li>'."\n";
202
    $sortie_form .=  '<li>'."\n".
212
    $sortie_form .=  '<li>'."\n".
203
                '<label for="ftp_port">N° du port d\'accès au serveur FTP :</label>'.
213
                '<label for="ftp_port">N° du port d\'accès au serveur FTP :</label>'.
204
                '<input id="ftp_port"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_PORT]" value="'.$fichier['PAP_FTP_PORT'].'" />'.
214
                '<input id="ftp_port"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_PORT]" value="'.$fichier['PAP_FTP_PORT'].'" />'.
205
                '</li>'."\n";
215
                '</li>'."\n";
206
    $sortie_form .=  '<li>Nom et mot de passe FTP qui sera utilis&eacute; pour se connecter &agrave; au dépôt FTP.</li>'."\n";
216
    $sortie_form .=  '<li>Nom et mot de passe FTP qui sera utilis&eacute; pour se connecter &agrave; au dépôt FTP.</li>'."\n";
207
    $sortie_form .=  '<li>'."\n".
217
    $sortie_form .=  '<li>'."\n".
208
                '<label for="ftp_utilisateur">Nom d\'utilisateur pour le serveur FTP :</label>'.
218
                '<label for="ftp_utilisateur">Nom d\'utilisateur pour le serveur FTP :</label>'.
209
                '<input id="ftp_utilisateur"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_UTILISATEUR]" value="'.$fichier['PAP_FTP_UTILISATEUR'].'" />'.
219
                '<input id="ftp_utilisateur"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_UTILISATEUR]" value="'.$fichier['PAP_FTP_UTILISATEUR'].'" />'.
210
                '</li>'."\n";
220
                '</li>'."\n";
211
    $sortie_form .=  '<li>'."\n".
221
    $sortie_form .=  '<li>'."\n".
212
                '<label for="ftp_mot_de_passe">Mot de passe de l\'utilisateur pour le serveur FTP :</label>'.
222
                '<label for="ftp_mot_de_passe">Mot de passe de l\'utilisateur pour le serveur FTP :</label>'.
213
                '<input id="ftp_mot_de_passe"'.$disabled.'type="password" size="20" name="fichier[PAP_FTP_MOT_DE_PASSE]" value="'.$fichier['PAP_FTP_MOT_DE_PASSE'].'" />'.
223
                '<input id="ftp_mot_de_passe"'.$disabled.'type="password" size="20" name="fichier[PAP_FTP_MOT_DE_PASSE]" value="'.$fichier['PAP_FTP_MOT_DE_PASSE'].'" />'.
214
                '</li>'."\n";
224
                '</li>'."\n";
215
    $sortie_form .=  '<li>Lorsque vous vous connecter par FTP sur le serveur où vous avez déposé les fichiers de Papyrus, le '.
225
    $sortie_form .=  '<li>Lorsque vous vous connecter par FTP sur le serveur où vous avez déposé les fichiers de Papyrus, le '.
216
                'dossier le plus haut auquel vous pouvez accéder dans l\'arborescence est la racine. Il vous faut donc '.
226
                'dossier le plus haut auquel vous pouvez accéder dans l\'arborescence est la racine. Il vous faut donc '.
217
                'indiquez dans le champ ci-dessous le chemin absolu depuis cette racine jusqu\'au dossier contenant le fichier '.
227
                'indiquez dans le champ ci-dessous le chemin absolu depuis cette racine jusqu\'au dossier contenant le fichier '.
218
                '<tt>papyrus.php</tt>. Exemple : <i>/www/</i></li>'."\n";
228
                '<tt>papyrus.php</tt>. Exemple : <i>/www/</i></li>'."\n";
219
    $sortie_form .=  '<li>'."\n".
229
    $sortie_form .=  '<li>'."\n".
220
                '<label for="ftp_racine">Racine dépôt FTP :</label>'.
230
                '<label for="ftp_racine">Racine dépôt FTP :</label>'.
221
                '<input id="ftp_racine"'.$disabled.'type="text" size="60" name="fichier[PAP_FTP_RACINE]" value="'.$fichier['PAP_FTP_RACINE'].'" />'.
231
                '<input id="ftp_racine"'.$disabled.'type="text" size="60" name="fichier[PAP_FTP_RACINE]" value="'.$fichier['PAP_FTP_RACINE'].'" />'.
222
                '</li>'."\n";
232
                '</li>'."\n";
223
    return $sortie_form;
233
    return $sortie_form;
224
}
234
}
225
 
235
 
226
// +------------------------------------------------------------------------------------------------------+
236
// +------------------------------------------------------------------------------------------------------+
227
// |                                            PIED du PROGRAMME                                         |
237
// |                                            PIED du PROGRAMME                                         |
228
// +------------------------------------------------------------------------------------------------------+
238
// +------------------------------------------------------------------------------------------------------+
229
 
239
 
230
 
240
 
231
/* +--Fin du code ----------------------------------------------------------------------------------------+
241
/* +--Fin du code ----------------------------------------------------------------------------------------+
232
*
242
*
233
* $Log: not supported by cvs2svn $
243
* $Log: not supported by cvs2svn $
-
 
244
* Revision 1.7  2004/10/25 10:22:48  jpm
-
 
245
* Correction de quelques bogues, ajouts d'explications pour l'utilisateur et modification des styles CSS.
-
 
246
*
234
* Revision 1.6  2004/10/22 17:39:14  jpm
247
* Revision 1.6  2004/10/22 17:39:14  jpm
235
* Correction gestion du slash devant le chemin racine ftp.
248
* Correction gestion du slash devant le chemin racine ftp.
236
*
249
*
237
* Revision 1.5  2004/10/22 17:23:04  jpm
250
* Revision 1.5  2004/10/22 17:23:04  jpm
238
* Simplification del'installation de Papyrus.
251
* Simplification del'installation de Papyrus.
239
*
252
*
240
* Revision 1.4  2004/10/19 17:01:12  jpm
253
* Revision 1.4  2004/10/19 17:01:12  jpm
241
* Correction bogues.
254
* Correction bogues.
242
*
255
*
243
* Revision 1.3  2004/10/19 15:59:18  jpm
256
* Revision 1.3  2004/10/19 15:59:18  jpm
244
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
257
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
245
* Ajout des constantes FTP.
258
* Ajout des constantes FTP.
246
*
259
*
247
* Revision 1.2  2004/10/18 09:12:09  jpm
260
* Revision 1.2  2004/10/18 09:12:09  jpm
248
* Changement de nom d'un fichier.
261
* Changement de nom d'un fichier.
249
*
262
*
250
* Revision 1.1  2004/10/18 09:11:05  jpm
263
* Revision 1.1  2004/10/18 09:11:05  jpm
251
* Changement de nom du fichier.
264
* Changement de nom du fichier.
252
*
265
*
253
* Revision 1.1  2004/10/15 18:28:59  jpm
266
* Revision 1.1  2004/10/15 18:28:59  jpm
254
* Début appli installateur de Papyrus.
267
* Début appli installateur de Papyrus.
255
*
268
*
256
*
269
*
257
* +-- Fin du code ----------------------------------------------------------------------------------------+
270
* +-- Fin du code ----------------------------------------------------------------------------------------+
258
*/
271
*/
259
?>
272
?>