Subversion Repositories Applications.papyrus

Compare Revisions

Ignore whitespace Rev 67 → Rev 68

/trunk/papyrus/applications/installateur/instal_fichier.inc.php
New file
0,0 → 1,119
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (c) 2002, Hendrik Mans <hendrik@mans.de> |
// | Copyright 2002, 2003 David DELON |
// | Copyright 2002 Patrick PAUL |
// | Copyright 2003 Jean-Pascal MILCENT |
// | All rights reserved. |
// | Redistribution and use in source and binary forms, with or without |
// | modification, are permitted provided that the following conditions |
// | are met: |
// | 1. Redistributions of source code must retain the above copyright |
// | notice, this list of conditions and the following disclaimer. |
// | 2. Redistributions in binary form must reproduce the above copyright |
// | notice, this list of conditions and the following disclaimer in the |
// | documentation and/or other materials provided with the distribution. |
// | 3. The name of the author may not be used to endorse or promote products |
// | derived from this software without specific prior written permission. |
// | |
// | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
// | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
// | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
// | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
// | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
// | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
// | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
// | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
// | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
// | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: instal_fichier.inc.php,v 1.1 2004-10-18 09:11:05 jpm Exp $
/**
* Page de création du fichier de configuration de Papyrus.
*
* Page permettant de créer le fichier de configuration de Papyrus.
*
*@package Installateur
//Auteur original :
*@author Hendrik MANS <hendrik@mans.de>
//Autres auteurs :
*@author David DELON
*@author Patrick PAUL
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.1 $ $Date: 2004-10-18 09:11:05 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Récupération des paramêtres de configuration du formulaire précédent
if (isset($_POST['config'])) {
$config = unserialize(stripslashes($_POST['config']));
} else if (isset($_POST['config_serial'])) {
$config = unserialize(stripslashes($_POST['config_serial']));
}
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$configCode = "<?php\n// pap_config.inc.php construit le ".strftime("%c")."\n// ne changez pas la version de Papyrus manuellement!\n\n";
$entries[] = 'define(\''.INSTAL_VERSION_NOUVELLE_NOM.'\',\''.INSTAL_VERSION_NOUVELLE.'\');'."\n";
foreach ($config as $k => $v) {
$entries[] = 'define(\''.$k.'\',\''.$v.'\');'."\n";
}
$entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
$configCode .= implode("\n", $entries)."\n\n?>";
 
$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";
 
// Tentative d'écriture du fichier de config
$sortie .= "<b>Cr&eacute;ation du fichier de configuration en cours...</b><br>\n";
$erreur = testerConfig('&Eacute;criture du fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.'</tt>...',
$fp = @fopen(INSTAL_CHEMIN_CONFIG, 'w'), '', 0, 0);
if ($fp) {
// Ecriture du fichier...
fwrite($fp, $configCode);
fclose($fp);
$sortie .= '<p>Voila c\'est termin&eacute; ! Vous pouvez <a href="'.donnerUrlCourante().'">retourner sur votre site '.
'Papyrus</a>. Il est conseill&eacute; de retirer l\'acc&egrave;s en &eacute;criture au fichier '.
'<tt>pap_config.inc.php</tt>. Ceci peut &ecirc;tre une faille dans la s&eacute;curit&eacute;.</p>';
} else {
// Problème...
$sortie .= '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.INSTAL_CHEMIN_CONFIG.
'</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
'<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire'.
'<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
'correctement.</p>'."\n";
$sortie .= ' <form action="'.donnerUrlCourante().'?installation=config" method="POST" />'."\n";
$sortie .= ' <input type="hidden" name="config_serial" value="'.htmlentities(serialize($config)).'" />'."\n";
$sortie .= ' <input type="submit" value="Essayer &agrave; nouveau" />'."\n";
$sortie .= ' </form>'."\n";
$sortie .= '<div style="background-color: #EEEEEE; padding: 10px 10px;">'."\n";
$sortie .= '<xmp>'.$configCode.'</xmp>'."\n";
$sortie .= '</div>'."\n";
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.1 2004/10/15 18:28:59 jpm
* Début appli installateur de Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>