Subversion Repositories Applications.papyrus

Rev

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

Rev Author Line No. Line
68 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  Jean-Pascal MILCENT                                                                 |
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_fichier.inc.php,v 1.1 2004-10-18 09:11:05 jpm Exp $
36
/**
37
* Page de création du fichier de configuration de Papyrus.
38
*
39
* Page permettant de créer le fichier de configuration 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        Jean-Pascal MILCENT <jpm@tela-botanica.org>
48
*@copyright     Tela-Botanica 2000-2004
49
*@version       $Revision: 1.1 $ $Date: 2004-10-18 09:11:05 $
50
// +------------------------------------------------------------------------------------------------------+
51
**/
52
 
53
// +------------------------------------------------------------------------------------------------------+
54
// |                                            ENTÊTE du PROGRAMME                                       |
55
// +------------------------------------------------------------------------------------------------------+
56
// Récupération des paramêtres de configuration du formulaire précédent
57
if (isset($_POST['config'])) {
58
    $config = unserialize(stripslashes($_POST['config']));
59
} else if (isset($_POST['config_serial'])) {
60
    $config = unserialize(stripslashes($_POST['config_serial']));
61
}
62
// +------------------------------------------------------------------------------------------------------+
63
// |                                          CORPS du PROGRAMME                                          |
64
// +------------------------------------------------------------------------------------------------------+
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";
67
foreach ($config as $k => $v) {
68
    $entries[] = 'define(\''.$k.'\',\''.$v.'\');'."\n";
69
}
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?>";
72
 
73
$sortie .= '    <h1>Installation de Papyrus</h1></h1>'."\n";
74
 
75
// Tentative d'écriture du fichier de config
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>...',
78
                        $fp = @fopen(INSTAL_CHEMIN_CONFIG, 'w'), '', 0, 0);
79
if ($fp) {
80
    // Ecriture du fichier...
81
    fwrite($fp, $configCode);
82
    fclose($fp);
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 '.
85
                '<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>';
86
} else {
87
    // Problème...
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 '.
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 '.
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'.
94
                '<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
95
                'correctement.</p>'."\n";
96
    $sortie .= '    <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
97
    $sortie .= '      <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
98
    $sortie .= '      <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
99
    $sortie .= '    </form>'."\n";
100
    $sortie .= '<div style="background-color: #EEEEEE; padding: 10px 10px;">'."\n";
101
    $sortie .= '<xmp>'.$configCode.'</xmp>'."\n";
102
    $sortie .= '</div>'."\n";
103
}
104
 
105
// +------------------------------------------------------------------------------------------------------+
106
// |                                            PIED du PROGRAMME                                         |
107
// +------------------------------------------------------------------------------------------------------+
108
 
109
 
110
/* +--Fin du code ----------------------------------------------------------------------------------------+
111
*
112
* $Log: not supported by cvs2svn $
113
* Revision 1.1  2004/10/15 18:28:59  jpm
114
* Début appli installateur de Papyrus.
115
*
116
*
117
* +-- Fin du code ----------------------------------------------------------------------------------------+
118
*/
119
?>