Subversion Repositories Applications.papyrus

Rev

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

Rev 68 Rev 69
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.1 2004-10-18 09:11:05 jpm Exp $
35
// CVS : $Id: instal_fichier.inc.php,v 1.2 2004-10-18 09:12:09 jpm Exp $
36
/**
36
/**
37
* Page de création du fichier de configuration 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.1 $ $Date: 2004-10-18 09:11:05 $
49
*@version       $Revision: 1.2 $ $Date: 2004-10-18 09:12:09 $
50
// +------------------------------------------------------------------------------------------------------+
50
// +------------------------------------------------------------------------------------------------------+
51
**/
51
**/
52
 
52
 
53
// +------------------------------------------------------------------------------------------------------+
53
// +------------------------------------------------------------------------------------------------------+
54
// |                                            ENTÊTE du PROGRAMME                                       |
54
// |                                            ENTÊTE du PROGRAMME                                       |
55
// +------------------------------------------------------------------------------------------------------+
55
// +------------------------------------------------------------------------------------------------------+
56
// Récupération des paramêtres de configuration du formulaire précédent
56
// Récupération des paramêtres de configuration du formulaire précédent
57
if (isset($_POST['config'])) {
57
if (isset($_POST['config'])) {
58
    $config = unserialize(stripslashes($_POST['config']));
58
    $config = unserialize(stripslashes($_POST['config']));
59
} else if (isset($_POST['config_serial'])) {
59
} else if (isset($_POST['config_serial'])) {
60
    $config = unserialize(stripslashes($_POST['config_serial']));
60
    $config = unserialize(stripslashes($_POST['config_serial']));
61
}
61
}
62
// +------------------------------------------------------------------------------------------------------+
62
// +------------------------------------------------------------------------------------------------------+
63
// |                                          CORPS du PROGRAMME                                          |
63
// |                                          CORPS du PROGRAMME                                          |
64
// +------------------------------------------------------------------------------------------------------+
64
// +------------------------------------------------------------------------------------------------------+
65
$configCode = "<?php\n// pap_config.inc.php construit le ".strftime("%c")."\n// ne changez pas la version de Papyrus manuellement!\n\n";
65
$configCode = "<?php\n// pap_config.inc.php construit le ".strftime("%c")."\n// ne changez pas la version de Papyrus manuellement!\n\n";
66
$entries[] = 'define(\''.INSTAL_VERSION_NOUVELLE_NOM.'\',\''.INSTAL_VERSION_NOUVELLE.'\');'."\n";
66
$entries[] = 'define(\''.INSTAL_VERSION_NOUVELLE_NOM.'\',\''.INSTAL_VERSION_NOUVELLE.'\');'."\n";
67
foreach ($config as $k => $v) {
67
foreach ($config as $k => $v) {
68
    $entries[] = 'define(\''.$k.'\',\''.$v.'\');'."\n";
68
    $entries[] = 'define(\''.$k.'\',\''.$v.'\');'."\n";
69
}
69
}
70
$entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
70
$entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
71
$configCode .= implode("\n", $entries)."\n\n?>";
71
$configCode .= implode("\n", $entries)."\n\n?>";
72
 
72
 
73
$sortie .= '    <h1>Installation de Papyrus</h1></h1>'."\n";
73
$sortie .= '    <h1>Installation de Papyrus</h1></h1>'."\n";
74
 
74
 
75
// Tentative d'écriture du fichier de config
75
// Tentative d'écriture du fichier de config
76
$sortie .= "<b>Cr&eacute;ation du fichier de configuration en cours...</b><br>\n";
76
$sortie .= "<b>Cr&eacute;ation du fichier de configuration en cours...</b><br>\n";
77
$erreur = testerConfig('&Eacute;criture du fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>...', 
77
$erreur = testerConfig('&Eacute;criture du fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>...', 
78
                        $fp = @fopen(INSTAL_CHEMIN_CONFIG, 'w'), '', 0, 0);
78
                        $fp = @fopen(INSTAL_CHEMIN_CONFIG, 'w'), '', 0, 0);
79
if ($fp) {
79
if ($fp) {
80
    // Ecriture du fichier...
80
    // Ecriture du fichier...
81
    fwrite($fp, $configCode);
81
    fwrite($fp, $configCode);
82
    fclose($fp);
82
    fclose($fp);
83
    $sortie .=  '<p>Voila c\'est termin&eacute; ! Vous pouvez <a href="'.donnerUrlCourante().'">retourner sur votre site '.
83
    $sortie .=  '<p>Voila c\'est termin&eacute; ! Vous pouvez <a href="'.donnerUrlCourante().'">retourner sur votre site '.
84
                'Papyrus</a>. Il est conseill&eacute; de retirer l\'acc&egrave;s en &eacute;criture au fichier '.
84
                'Papyrus</a>. Il est conseill&eacute; de retirer l\'acc&egrave;s en &eacute;criture au fichier '.
85
                '<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>';
85
                '<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>';
86
} else {
86
} else {
87
    // Problème...
87
    // Problème...
88
    $sortie .=  '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.
88
    $sortie .=  '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.
89
                '</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
89
                '</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
90
                'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
90
                'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
91
                'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
91
                'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
92
                'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
92
                'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
93
                '<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire'.
93
                '<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire'.
94
                '<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
94
                '<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
95
                'correctement.</p>'."\n";
95
                'correctement.</p>'."\n";
96
    $sortie .= '    <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
96
    $sortie .= '    <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
97
    $sortie .= '      <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
97
    $sortie .= '      <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
98
    $sortie .= '      <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
98
    $sortie .= '      <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
99
    $sortie .= '    </form>'."\n";
99
    $sortie .= '    </form>'."\n";
100
    $sortie .= '<div style="background-color: #EEEEEE; padding: 10px 10px;">'."\n";
100
    $sortie .= '<div style="background-color: #EEEEEE; padding: 10px 10px;">'."\n";
101
    $sortie .= '<xmp>'.$configCode.'</xmp>'."\n";
101
    $sortie .= '<xmp>'.$configCode.'</xmp>'."\n";
102
    $sortie .= '</div>'."\n";
102
    $sortie .= '</div>'."\n";
103
}
103
}
104
 
104
 
105
// +------------------------------------------------------------------------------------------------------+
105
// +------------------------------------------------------------------------------------------------------+
106
// |                                            PIED du PROGRAMME                                         |
106
// |                                            PIED du PROGRAMME                                         |
107
// +------------------------------------------------------------------------------------------------------+
107
// +------------------------------------------------------------------------------------------------------+
108
 
108
 
109
 
109
 
110
/* +--Fin du code ----------------------------------------------------------------------------------------+
110
/* +--Fin du code ----------------------------------------------------------------------------------------+
111
*
111
*
112
* $Log: not supported by cvs2svn $
112
* $Log: not supported by cvs2svn $
-
 
113
* Revision 1.1  2004/10/18 09:11:05  jpm
-
 
114
* Changement de nom du fichier.
-
 
115
*
113
* Revision 1.1  2004/10/15 18:28:59  jpm
116
* Revision 1.1  2004/10/15 18:28:59  jpm
114
* Début appli installateur de Papyrus.
117
* Début appli installateur de Papyrus.
115
*
118
*
116
*
119
*
117
* +-- Fin du code ----------------------------------------------------------------------------------------+
120
* +-- Fin du code ----------------------------------------------------------------------------------------+
118
*/
121
*/
119
?>
122
?>