Subversion Repositories Applications.papyrus

Compare Revisions

No changes between revisions

Ignore whitespace Rev 1978 → Rev 1979

/branches/v3.0-aha/papyrus/applications/installateur/installateur.php
New file
0,0 → 1,220
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: installateur.php,v 1.16 2007-04-20 13:31:42 florian Exp $
/**
* Application Installateur de Papyrus.
*
* Application permettant de gérer l'installation et les erreurs liés à l'abscence de base de données,
* d'extenssin PHP...
*
*@package Installateur
//Auteur original :
*@author
'AND gm_ce_i18n = "'.GEN_I18N_ID_DEFAUT.'" ';
$resultat = $db->query($requete);
 
(DB::isError($resultat)) ? die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete)) : '';
$ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT);
if ($langue_test!=GEN_I18N_ID_DEFAUT) {
return GEN_rechercheMenuIdentifiantVersionParDefaut($db,$ligne->gm_id_menu);
}
} Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.16 $ $Date: 2007-04-20 13:31:42 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Constante de l'application Installateur. On devrait créer un fichier de config et un de langue pour rendre l'appli portable...
preg_match('/^(.*)papyrus.php/', $_SERVER['SCRIPT_FILENAME'], $instal_tab_txt);
define('INSTAL_CHEMIN_ABSOLU', $instal_tab_txt[1]);
/** Nom du dossier contenant l'application Installateur.*/
define('INSTAL_DOSSIER_APPLI', INSTAL_CHEMIN_ABSOLU.GEN_CHEMIN_APPLICATION.'installateur'.GEN_SEP);
/** Nom du dossier contenant la bibliothèque de code de l'application Installateur.*/
define('INSTAL_DOSSIER_BIBLIO', INSTAL_DOSSIER_APPLI.'bibliotheque'.GEN_SEP);
/** Chemin vers le fichier de configuration de base de l'application Papyrus.*/
define('INSTAL_CHEMIN_CONFIG', GEN_CHEMIN_CONFIG.GEN_FICHIER_CONFIG);
/** Nom du fichier de configuration de Papyrus à créer.*/
define('INSTAL_FICHIER_CONFIG', GEN_FICHIER_CONFIG);
/** Chemin vers le fichier de configuration de base de l'application Papyrus.*/
define('INSTAL_CHEMIN_SQL', INSTAL_CHEMIN_ABSOLU.GEN_CHEMIN_INSTAL);
/** Nom de la constante stockant le numéro de la nouvelle version de l'application Papyrus.*/
define('INSTAL_VERSION_NOUVELLE_NOM', 'PAP_VERSION');
/** Numéro de la nouvelle version de l'application Papyrus.*/
define('INSTAL_VERSION_NOUVELLE', GEN_VERSION);
if (defined('PAP_VERSION')) {
define('INSTAL_VERSION_ANCIENNE', PAP_VERSION);
} else {
define('INSTAL_VERSION_ANCIENNE', '');
}
/** Nombre d'étapes totale de l'installation.*/
define('INSTAL_NBRE_ETAPE', 3);
 
// Fichiers à inclure
require_once INSTAL_DOSSIER_BIBLIO.'instal_installation.fonct.php';
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
function afficherContenuCorps()
{
// Entête XHTML des pages de l'installation de Papyrus
$sortie = '';
$sortie .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'."\n";
$sortie .= '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'."\n";
$sortie .= '<html xmlns="http://www.w3.org/1999/xhtml" lang="fr-FR" xml:lang="fr-FR">'."\n";
$sortie .= ' <head>'."\n";
$sortie .= ' <link rel="stylesheet" type="text/css" media="screen" title="Installateur" href="papyrus/applications/installateur/presentations/styles/installateur.css" />'."\n";
$sortie .= ' <title>Installation de Papyrus</title>'."\n";
$sortie .= ' </head>'."\n";
$sortie .= ' <body xml:lang="fr" lang="fr" >'."\n";
$sortie .= ' <div id="page">'."\n";
$sortie .= ' <div id="zone_bandeau">'."\n";
$sortie .= ' <div id="logo">'."\n";
$sortie .= ' <img src="papyrus/applications/installateur/presentations/images/Logo_papyrus.jpg" alt="Logo Papyrus" />'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' <div id="site_nom">'."\n";
$sortie .= ' <h1>Installation de Papyrus</h1>'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' <div id="zone_contenu">'."\n";
// Message situation de l'installation
if (defined('PAP_VERSION')) {
$sortie .= '<p class="zone_info">Votre syst&egrave;me Papyrus existant a &eacute;t&eacute; reconnu comme &eacute;tant la version '.
INSTAL_VERSION_ANCIENNE.'.<br />'.
'Vous &ecirc;tes sur le point de <strong>mettre &agrave; jour</strong> Papyrus pour la version '.
INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez revoir vos informations de configuration ci-dessous.</p><br style="clear:both;">'."\n";
} else {
$sortie .= '<p class="zone_info">Vous &ecirc;tes sur le point d\'installer Papyrus '.INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez configurer votre Papyrus en remplissant les formulaires &eacute;tape par &eacute;tape.</p><br style="clear:both;">'."\n";
}
if(!isset($_GET['installation']) || ($_GET['installation'] == 'form_pref' || $_GET['installation'] == 'verif_pref')) {
include_once GEN_CHEMIN_APPLICATION.'installateur/instal_preference.inc.php';
} else if($_GET['installation'] == 'form_bdd' || $_GET['installation'] == 'verif_bdd') {
include_once GEN_CHEMIN_APPLICATION.'installateur/instal_base_de_donnees.inc.php';
} else if($_GET['installation'] == 'form_fichier' || $_GET['installation'] == 'verif_fichier') {
include_once GEN_CHEMIN_APPLICATION.'installateur/instal_fichier.inc.php';
}
// Pied XHTML des pages de l'installation de Papyrus
$sortie .= ' </div>'."\n";
$sortie .= ' <div id="zone_pied">'."\n";
$sortie .= ' <div id="copyright">'."\n";
$sortie .= ' <a href="http://frenchmozilla.org"><img src="papyrus/applications/installateur/presentations/images/logo-firefox.png" alt="Logo Firefox" /></a>&nbsp;'."\n";
$sortie .= ' <a href="http://validator.w3.org/check?uri=referer"><img src="papyrus/applications/installateur/presentations/images/logo-xhtml11.png" alt="Logo XHTML" /></a>&nbsp;'."\n";
$sortie .= ' <a href="http://jigsaw.w3.org/css-validator/check/referer"><img src="papyrus/applications/installateur/presentations/images/logo-css.png" alt="Logo CSS" /></a><br />'."\n";
$sortie .= ' &copy;&nbsp;<a href="http://www.tela-botanica.org/">Tela Botanica</a> et <a href="http://www.ecole-et-nature.org/">R&eacute;seau Ecole et Nature</a> / 2004-2006<br />'."\n";
$sortie .= ' Site utilisant <a href="http://outils-reseaux.org/wiki_papyrus">Papyrus, le CMS coop&eacute;ratif</a>'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' </div>'."\n";
$sortie .= ' </body>'."\n";
$sortie .= '</html>';
return $sortie;
}
 
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.15 2006/10/16 15:49:07 ddelon
* Refactorisation code mulitlinguisme et gestion menu invisibles
*
* Revision 1.14 2006/10/09 14:35:50 ddelon
* bug caractere invalide trainant dans fichier
*
* Revision 1.13 2006/10/05 15:17:29 florian
* changement presentation
*
* Revision 1.12 2006/10/05 15:11:17 florian
* changement presentation
*
* Revision 1.11 2006/10/05 14:41:53 florian
* changement presentation
*
* Revision 1.10 2005/09/23 14:20:23 florian
* nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.9 2004/10/27 11:43:32 jpm
* Correction bogues diff mise à jour / installation.
*
* Revision 1.8 2004/10/25 10:22:48 jpm
* Correction de quelques bogues, ajouts d'explications pour l'utilisateur et modification des styles CSS.
*
* Revision 1.7 2004/10/22 17:23:04 jpm
* Simplification del'installation de Papyrus.
*
* Revision 1.6 2004/10/19 17:01:12 jpm
* Correction bogues.
*
* Revision 1.5 2004/10/19 16:47:28 jpm
* Transformation en fonction de l'appel de l'application.
*
* Revision 1.4 2004/10/19 15:59:18 jpm
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
* Ajout des constantes FTP.
*
* Revision 1.3 2004/10/18 09:12:09 jpm
* Changement de nom d'un fichier.
*
* Revision 1.2 2004/10/15 18:28:59 jpm
* Début appli installateur de Papyrus.
*
* Revision 1.1 2004/06/16 14:33:13 jpm
* Changement de nom de Papyrus en Papyrus.
* Changement de l'arborescence.
*
* Revision 1.6 2004/04/22 08:25:48 jpm
* Transformation de $GS_GLOBAL en $_GEN_commun.
*
* Revision 1.5 2004/04/08 13:21:05 jpm
* Le code pour l'installation uniquement.
*
* Revision 1.4 2004/04/08 12:25:16 jpm
* Suppression de tous le code réalisant les vérifications. L'application Installateur ne fera qu'installer Papyrus et non vérifier son bon fonctionnement.
*
* Revision 1.3 2004/04/02 16:37:51 jpm
* Modification des commentaires.
*
* Revision 1.2 2004/03/31 16:57:16 jpm
* Ajout de la gestion des erreur de base de données, de la connexion à celle-ci et des extenssions php disponibles.
*
* Revision 1.1 2004/03/29 11:00:12 jpm
* Transfert d'un morceau de code gérant les erreurs et l'installation mais qui a actuellement aucun effet sur Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Agraphe.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Agraphe.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Main_Erreur.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Main_Erreur.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-xhtml11.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-xhtml11.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_descendre.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_descendre.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_diminuer.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_diminuer.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_modifier.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_modifier.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_fermer.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_fermer.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_administrer.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_administrer.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_monter.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_monter.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_ouvrir.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_ouvrir.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_supprimer.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_supprimer.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_augmenter.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_augmenter.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_ajouter.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/navigation/adme_ajouter.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Calendrier-coin-jaune.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Calendrier-coin-jaune.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Infos.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Infos.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/picto.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/picto.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Logo_papyrus.jpg
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Logo_papyrus.jpg
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Bandeau_haut.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Bandeau_haut.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-firefox.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-firefox.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Bandeau_bas.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Bandeau_bas.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_gauche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_gauche.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_gauche.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_droit.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_droit.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/left_both_green.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/left_both_green.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_droit.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_droit.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_milieu.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_milieu.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/right_both_green.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/right_both_green.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_milieu.gif
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/Boutons/onglet_contenu_hover_milieu.gif
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-css.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/branches/v3.0-aha/papyrus/applications/installateur/presentations/images/logo-css.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/branches/v3.0-aha/papyrus/applications/installateur/presentations/styles/installateur.old.css
New file
0,0 → 1,38
* {padding: 0;margin: 0;}
body {font-family: Tahoma, Arial, Helvetica, sans-serif;text-align: center;color: #566047;line-height: 19px;
background: #FBFBE5 url(../images/grass.png) right bottom fixed no-repeat;}
a, a:link, a:visited {color: #566047;text-decoration: underline;background: transparent;}
a:hover {color: #6878C6;background: transparent;text-decoration: none;}
a:active, a:focus {color: #566047;background-color: #FBFBE5;}
p {line-height: 19px;}
acronym {font-weight: bold;text-decoration: none;border-bottom: none;}
#container {margin: auto;text-align: left;width: 760px;border-left:solid 2px #BCBCAB;border-right:solid 2px #BCBCAB;}
#zone_bandeau {color: #566047;background: #E9EBD3;width: 760px;height: 70px;margin:5px auto;
border-top:solid 3px #838E6C;border-bottom:solid 3px #838E6C;}
#logo {float : left;margin: 3px 0 0 10px;}
#site_nom {width:300px;text-align: center;margin:20px auto;background: transparent;color: #566047;}
#zone_contenu {margin: 6px;font-size:70%;}
#zone_pied {clear:both;text-align:center;background: #E9EBD3;color: #566047;width: 760px;height: 40px;margin:5px auto;
border-top:solid 3px #838E6C;border-bottom:solid 3px #838E6C;font-size:70%;padding-top:5px;}
h1, h2, h3 {margin-bottom: 10px;height: 22px;border-bottom: 1px solid #7D8965;}
h1 {font-size: 1.5em;}
h2 {font-size: 1.3em;}
h3 {font-size: 1.2em;}
li {text-align:left;margin-left:20px;}
table {border-collapse: collapse;border-spacing: 0;}
th, td {text-align:left;padding:2px;border: solid 1px }
tt {font-size:12px;}
img {border:0;}
fieldset {border:solid 1px #7D8965;padding:3px;margin:2px;}
legend {font-weight:bold;}
input:hover {background:#7D8965;color: #FBFBE5;}
input, select, textarea {font-family: Tahoma, Arial, Helvetica, sans-serif;font-size:11px;color: #566047;background:#FDFDF3;border:solid 1px #7D8965;}
/* Mise en ligne des formulaires */
form li {margin:0;padding:0;display: block;}
form ul {margin:0;padding:0;list-style-type: none;}
form label {clear:both;float: left;width:250px;font-weight:bold;}
.liste_bouton li {display:inline;}
.erreur {color:red;}
.etape_info {margin:10px auto;padding 5px;text-align:center;width:90%;border: 1px solid green;color:green;}
.ok {text-align:center;border: 1px solid green;color:green;}
.failed {text-align:center;border: 1px solid red;color:red;}
/branches/v3.0-aha/papyrus/applications/installateur/presentations/styles/installateur.css
New file
0,0 → 1,105
/*****************Proprietes generales******************************************/
* {margin: 0; padding: 0;text-indent:0;}
body {background:#FFF;font:12px Myriad, Arial, sans-serif;color:#000;text-align:center;}
hr {margin:2px; width:100%; color: #7F8343; background-color: #7F8343; height: 1px;}
a {margin:0;padding:0;text-decoration: underline;color: #000;}
a:hover {text-decoration: underline;color:#C3D759;}
table {width:480px;margin:0 auto; border: 1px solid #006495;border-spacing:0;border-collapse:collapse;}
.table_cadre {width:480px;margin:2px;}
th {font-size:11px;padding:2px;text-align:center;border: 1px solid #006495;font-weight: normal;background:#3082AA;height:23px;}
td {font-size:11px;text-align:center;border: 1px solid #006495;background:#FFF;height:23px;}
td:hover {background: #C3D759;}
.code { background: #FFFFFF; border: solid #888888 2px; font-family: 'Courier New', Courier; width: 90%; height: 350px; overflow: scroll; padding: 3px; }
.navi {padding:0;margin:0;text-align:center;}
.other_month {color:#AAA;}
.current_day {background: #FBB63C; color: #FFF;}
.label_inscription {margin: 2px;float:left; clear:both; width:170px; text-align:right; }
.symbole_obligatoire {color:red;}
.input_inscription {float:left; width:180px;}
.input_inscription input, .input_inscription select {margin: 2px;border: 1px solid #000;font:12px Myriad, Arial, sans-serif; }
.erreur {background-color:#FFEEEE;border:1px;
border: 1px dotted #A81106;padding:1px;margin:3px;}
/*****************Titres********************************************************/
h1, h2, h3, h4, h5, h6 {font-family: Myriad, Arial, sans-serif;text-align:left;margin:4px 0;}
h1 {font-size:22px; color: #BBD049;border-bottom: solid #7FB1CA 1px ;}
h2 {font-size:18px; color: #A81106;}
h3 {font-size:17px; color: #000;}
h4 {font-size:16px; color: #FFF;background: #006495;border: 1px solid #C3D759;;-moz-border-radius:5px}
h5 {font-size:16px; color: #006495;border-bottom: solid #006495 1px;}
h6 {font-size:32px; color: #006495;}
/*****************Boutons et formulaires****************************************/
a img {border: none;}
form li {list-style-type:none;color:#000;}
form table, form td, form th {border:0}
form td:hover {background: transparent;}
label {padding-right:10px;}
input {margin:2px;background:#EEEEE9;}
/*****************Listes********************************************************/
ul {padding:0;margin: 0 0 0 10px;}
li {padding:0;margin: 2px 0 0 0;color:#000;}
/*--------------------------------------------------------------------------------------------------------------*/
/* Structure de la page */
#page {position: relative;top:3px;width: 760px; text-align: left;margin: 0 auto;}
.page {clear:both;background-color:transparent;text-align: justify;line-height: 22px;}
#zone_bandeau {height: 130px;background: url(../images/Bandeau_haut.png) no-repeat top left;}
#logo {position: absolute;top: 10px;left: 30px;}
#site_nom {position: absolute;top: 40px;left: 210px;width:500px;}
#site_nom h1 {margin: 0 auto;width:500px;font-size: 30px; font-family: Georgia, serif;color:#3082AA;border:0;}
#site_nom h6 { margin: 0 auto;width:500px;}
#vous_etes_ici {clear:both;float:left;width:762px;margin: 0 0 10px 20px;}
#zone_contenu {float:left; margin : 10px auto; padding : 10px ;width: 740px;_width: 760px;border: 1px solid #3082AA;-moz-border-radius:10px;}
#zone_bandeau_menu {clear: both;float:left;width:178px;border: 1px solid #7FB1CA;background: #7FB1CA;-moz-border-radius:10px;margin : 5px; padding:0;}
#zone_bandeau_menu h1 {width:90%;padding:0;margin:10px auto 6px auto;font:13px Myriad, Arial, sans-serif;font-weight: bold;text-align:center;color:#A01B12;background:transparent;border-bottom:1px solid #FFF;}
#menu ul {display: block;margin:3px 3px 3px 20px;padding:0;}
#menu li, #menu li li {margin:2px 0;padding:0;}
#menu li ul {margin:4px 0 2px 2px;padding:0;}
.calendar {width:160px;margin:0 auto;}
#menu li a {display: block;padding: 3px; margin: 0 3px 0 3px; width: 145px; text-decoration: none; color: #FFF; background: transparent ;border: 1px solid #7FB1CA; height:17px;text-align:left;}
#menu li a:hover {color: #000;background: #C3D759;width: 145px;border: 1px solid #006495;}
#menus_communs {float:right;text-align : right;width:600px;margin:10px 10px 0 0;}
#menus_communs li {padding: 0 1px;list-style-type:none; display: inline;background: transparent;}
#menus_communs a:hover {color: #7FB1CA;}
#zone_menu {float:left;margin: 0 20px 10px 20px;padding:1px;height:26px;background: #BBD049;}
#zone_menu ul {margin:0;padding:0;color: #000;}
#zone_menu li {list-style-type:none;float: left;margin:1px;padding:0;width: 135px;background: #3082AA;height:23px;}
#zone_menu li:hover {background: #C3D759;}
#zone_menu li a {display: block;padding: 3px; width: 135px; color : #FFF;text-decoration: none; background: transparent; height:17px;text-align:center;}
#zone_menu li a:hover {color: #000;}
#zone_onglets {float : right;margin : 0 20px -1px 0 ;text-align:left;font-weight:bold;}
#zone_onglets ul { margin:0; padding:0; list-style:none;}
#zone_onglets li { background:url(../images/Boutons/right_both_green.png) no-repeat right top; float:left; margin:0; padding:0; color: #006495;}
#zone_onglets a {float:left; display:block; color: #006495; font-size:12px; background:url(../images/Boutons/left_both_green.png) no-repeat left top; width:.1em; white-space:nowrap;/*2 lignes ajoutees pour compatibilite IE : extension de la zone cliquable a l'ensemble de zone_contenu_haut*/ padding:5px 15px 4px; text-decoration:none;}
/* On retablit le float a sa valeur correct mais le hack de l'antislash commente cache cette regle a IE5-Mac \*/ #zone_onglets a {float:none;} /* End IE5-Mac hack */
#zone_onglets > ul a { width:auto;} /*propriete ajoutee pour contredire la ligne speciale IE (ci dessus) pour les autres navigateurs*/
#zone_onglets li:hover { background-position:100% -150px;}
#zone_onglets li:hover a { background-position:0% -150px;}
#zone_onglets .inactif { border-bottom:0px solid; font-weight:normal;}
#zone_onglets .actif, #zone_onglets .actif { position:relative; background-position:100% -150px; padding-bottom:2px; font-weight:bold;}
#zone_onglets .actif a, #zone_onglets .actif a { position:relative; background-position:0% -150px; padding-bottom:3px;}
#zone_contenu_tete {float :left; width : 530px; padding : 10px 0 0 20px;}
.zone_alert, .pap_erreur {float:left;clear:both;text-indent : 0; text-align: left;min-height:56px;width : 460px; margin : 5px 0 5px 0; border: 1px solid #A81106; background: #FFF url(../images/Main_Erreur.png) no-repeat top left;padding: 5px 0px 5px 76px;-moz-border-radius:12px;}
.zone_info, .etape_info {float:left;clear:both;-moz-border-radius:12px; text-indent : 0; text-align: left;min-height:56px;width :460px; margin : 0 15px 15px 0; border: 1px solid #D0DF7F; background: #FFF url(../images/Infos.png) no-repeat top left;padding: 5px 0px 5px 76px;}
#zone_contenu_corps {text-indent : 15px; float: left; width:521px; margin : 20px 0px 10px 20px;padding : 0 0px 10px 0; text-align: justify;}
.spacer {width:742px;clear: both;}
#zone_pied {margin: 3px 0 10px 0;padding:0;float:left;width: 762px;height : 65px;background: url(../images/Bandeau_bas.png) repeat-x top left;}
#zone_pied a {font: 12px arial, sans-serif; color: #006495;}
#zone_pied a:hover {text-decoration: none;font: 12px arial, sans-serif; color: #FFF;}
/*-------------------------------APPLETTES--------------------------------------*/
#moteur_recherche {clear:both;float:right;margin:0 5px 0 0;padding:0;width:180px;height: 33px;text-align:right;}
#moteur_recherche legend {display:none;}
#moteur_recherche fieldset {margin:0;padding:0;border: 0;}
#moteur_recherche label {display:none;}
#more_motif {padding:2px;width:140px;border:#000 1px groove;font: 12px arial, sans-serif; color: #000;}
#sesi_ok, #more_ok {border:#B77744 1px solid;font: 12px arial, sans-serif; color: #FFF;padding:0;margin:0;background: #B77744;text-transform: uppercase;}
#selecteur_monde {clear:right;float:right;margin:25px 5px 0 0;padding:0;width: 180px;height: 33px;text-align:right;}
#selecteur_monde select {font: 12px arial, sans-serif;width:140px;border:#000 1px groove;}
#selecteur_monde legend { display: none;}
#selecteur_monde fieldset { border: 0; margin: 0; padding: 0;}
#copyright {margin:15px 0 10px 10px;padding : 0;float:left;width: 400px;}
#copyright a {color: #006495;;}
#copyright a:hover {color: #222;}
#identification {width:170px;margin:0 auto;}
#identification fieldset {border: 1px #FFF;margin: 0 auto;padding: 5px;background:#FFF;-moz-border-radius:20px;}
#identification legend {display: none;}
#identification label {display: block;}
#identification input {border:1px solid #000;}
/branches/v3.0-aha/papyrus/applications/installateur/instal_fichier.inc.php
New file
0,0 → 1,474
<?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.36 2007-08-28 14:37:11 jp_milcent Exp $
/**
* Page de creation des fichiers necessaire a l'installation de Papyrus.
*
* Page permettant de creer 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.36 $ $Date: 2007-08-28 14:37:11 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Numéro de l'étape d'installation :
$num_etape = 3;
 
// Initialisation du tableau contenant les valeurs de configuration de la base de données
$tableau = array( 'PAP_FTP_SERVEUR' => '', 'PAP_FTP_PORT' => '', 'PAP_FTP_UTILISATEUR' => '',
'PAP_FTP_MOT_DE_PASSE' => '', 'PAP_FTP_RACINE' => '');
foreach ($tableau as $cle => $val) {
if (!empty($_POST['fichier'][$cle])) {
$fichier[$cle] = $_POST['fichier'][$cle];
} else if (defined($cle)) {
$fichier[$cle] = constant($cle);
} else {
if ($cle == 'PAP_FTP_SERVEUR') {
$fichier[$cle] = $_SERVER['HTTP_HOST'];
} else if ($cle == 'PAP_FTP_PORT') {
$fichier[$cle] = 21;
} else {
$fichier[$cle] = '';
}
}
}
 
// Récupération des paramêtres de configuration du formulaire précédent
if (isset($_POST['pref_serial'])) {
$pref = unserialize(stripslashes($_POST['pref_serial']));
}
if (isset($_POST['bdd'])) {
$bdd = $_POST['bdd'];
} else if (isset($_POST['bdd_serial'])) {
$bdd = unserialize(stripslashes($_POST['bdd_serial']));
}
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Affichage d'informations...
$sortie .= '<br /><h1>Étape n&deg;'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</h1>'."\n";
 
// Correction éventuelle des informations saisies par l'utilisateur
if (ereg('^[\/\\]', $fichier['PAP_FTP_RACINE']) == false) {
// le chemin FTP ne doit pas commencer par un slash, nous le supprimons
$fichier['PAP_FTP_RACINE'] = GEN_SEP.$fichier['PAP_FTP_RACINE'];
}
 
// Nous vérifions si nous sommes en phase de test du formulaire de config de l'écriture de fichier
$erreur = 0;
$sortie_verif = '';
if ($_GET['installation'] == 'verif_fichier') {
// Test de la configuration du FTP
$sortie_verif .= ' <br /><h2>Test de la connexion FTP</h2>'."\n";
$erreur = testerConfig($sortie_verif, 'Test connexion FTP ...', $ftp = @ftp_connect($fichier['PAP_FTP_SERVEUR'], $fichier['PAP_FTP_PORT']), '', 1, $erreur);
$erreur = testerConfig($sortie_verif, 'Test identification sur le serveur FTP ...', @ftp_login($ftp, $fichier['PAP_FTP_UTILISATEUR'],
$fichier['PAP_FTP_MOT_DE_PASSE']), 'Les param&ecirc;tres FTP saisies ne permettent pas l\'identification !', 1, $erreur);
$sortie_verif .= '<br />'."\n";
$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 ($bdd as $cle => $val) {
$entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
}
$entries[] = "define('PAP_DSN', 'mysql://'.PAP_BDD_UTILISATEUR.':'.PAP_BDD_MOT_DE_PASSE.'@'.PAP_BDD_SERVEUR.'/'.PAP_BDD_NOM);"."\n";
foreach ($fichier as $cle => $val) {
$entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
}
foreach ($pref as $cle => $val) {
// Nous recuperons uniquement les constantes a stocker dans le fichier de config (leur nom commence par PAP_)
if (preg_match('/^PAP_/', $cle)) {
if (preg_match('/^[0-9]+|(?i:true|false)$/', $val)) {
$entries[] = 'define(\''.$cle.'\','.$val.');'."\n";
} else {
$entries[] = 'define(\''.$cle.'\',\''.$val.'\');'."\n";
}
}
}
$configCode .= implode("\n", $entries)."\n\n?>";
if ($erreur == 0) {
// +-----------------------------------------------------------------------------------------------------------+
// Tentative d'écriture du fichier de config
$sortie_verif .= ' <h2>Ecriture des fichiers sur le serveur par FTP</h2>'."\n";
$chemin_fpt_absolu = $fichier['PAP_FTP_RACINE'].INSTAL_CHEMIN_CONFIG;
$url_ftp = 'ftp://'.$fichier['PAP_FTP_UTILISATEUR'].':'.$fichier['PAP_FTP_MOT_DE_PASSE'].
'@'.$fichier['PAP_FTP_SERVEUR'].$chemin_fpt_absolu;
// Dans le cas, ou nous mettons à jour Papyrus, il faut supprimer l'ancien fichier de config
if (INSTAL_VERSION_ANCIENNE != '') {
$txt_suppression = 'Suppression de <tt>'.$chemin_fpt_absolu.'</tt>...';
$txt_suppression_erreur = '<p>Le fichier <tt>'.$chemin_fpt_absolu.'</tt> ne peut &ecirc;tre supprimer automatiquement. '.
'Veuillez utiliser un logiciel de transfert de fichier par FTP pour le supprimer.</p>';
$erreur = testerConfig($sortie_verif, $txt_suppression, unlink($url_ftp), $txt_suppression_erreur, 1, $erreur);
}
$tempfn = tempnam('','');
$temp = fopen($tempfn, 'w');
 
fwrite($temp, $configCode);
fclose($temp);
$fichier_config_source = $tempfn;
$fichier_config_cible = $fichier['PAP_FTP_RACINE'].'papyrus/configuration/pap_config.inc.php';
// Nous écrivons le fichier de config sur le disque
$txt_ecriture_conf = '&Eacute;criture sur le serveur de <tt>'.$fichier_config_cible.'</tt>...';
$txt_ecriture_conf_erreur = '<span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.$fichier_config_cible.
'</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.';
$txt_ecriture_conf_erreur .= '<div class="code"><code><pre>'.htmlentities($configCode).'</pre></code></div>'."\n";
$erreur = testerConfig($sortie_verif, $txt_ecriture_conf,
ftp_put($ftp, $fichier_config_cible, $fichier_config_source, FTP_ASCII),
$txt_ecriture_conf_erreur, 1, $erreur);
 
// +-----------------------------------------------------------------------------------------------------------+
// Tentative d'écriture du fichier .htaccess
$fichier_htaccess_chemin = $fichier['PAP_FTP_RACINE'].'.htaccess';
$url_ftp_htaccess = 'ftp://'.$fichier['PAP_FTP_UTILISATEUR'].':'.$fichier['PAP_FTP_MOT_DE_PASSE'].
'@'.$fichier['PAP_FTP_SERVEUR'].$fichier['PAP_FTP_RACINE'].'/.htaccess';
if (isset($pref['PAP_HTACCESS_REGENERATION']) && $pref['PAP_HTACCESS_REGENERATION'] == 1) {
$txt_suppression_htaccess = 'Suppression de <tt>'.$fichier_htaccess_chemin.'</tt>...';
$txt_suppression_htaccess_erreur = '<p>Le fichier <tt>'.$fichier_htaccess_chemin.'</tt> ne peut &ecirc;tre supprimer automatiquement. '.
'Veuillez utiliser un logiciel de transfert de fichier par FTP pour le supprimer.</p>';
$erreur = testerConfig($sortie_verif, $txt_suppression_htaccess, unlink($url_ftp_htaccess), $txt_suppression_htaccess_erreur, 1, $erreur);
}
$url_parse = parse_url('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
$prefixe = dirname($url_parse['path']);
// Gestion des urls du style : http://www.tela-botanica.org/~mon_home/
$prefixe_tilde = '';
if (preg_match('/^\/~/', $prefixe)) {
$prefixe_tilde = $prefixe.'/';
}
$url = 'http://'.$_SERVER['HTTP_HOST'].$prefixe;
if (isset($pref['PAP_URL_REECRITURE']) && $pref['PAP_URL_REECRITURE'] == 1) {
$on_off = 'on';
} else {
$on_off = 'off';
}
$contenu_htaccess = '# Raccourci pour les menus et sites de Papyrus'."\n".
'RewriteEngine '.$on_off."\n".
'# si le fichier ou le dossier existe dans le système de fichier on l\'utilise directement'."\n".
'RewriteCond %{REQUEST_FILENAME} !-d'."\n".
'RewriteCond %{REQUEST_FILENAME} !-f'."\n\n".
'# Réecriture d\'url pour valider les inscriptions'."\n".
'RewriteRule ^ins_([0-9a-z]*)$ page:inscription?id=$1 [QSA,L]'."\n".
'# Réecriture d\'url pour les applications de Papyrus n\'utilisant pas correctement Pap_URL'."\n".
'# ATTENTION : ne marche pas pour les formulaires en mode POST !'."\n".
'RewriteRule ^([^\/]+)&(.*)$ '.$url.'/$1?$2 [QSA,L,R=301]'."\n".
'# Réecriture d\'url pour les vieux permaliens'."\n".
'RewriteCond %{REQUEST_FILENAME}/ !-d'."\n".
'RewriteRule ^([^\/\?:.]+)$ '.$url.'/page:$1 [QSA,L,R=301]'."\n".
'# Redirection d\'url pour le sélecteur de site'."\n".
'# Le point d\'interrogation sans rien aprés, vide la QUERY_STRING sinon elle est concacténée à l\'url et cela plante...'."_n".
'# Le "/" initial dans la RewriteCond est obligatoire!'."\n".
'RewriteCond %{REQUEST_URI}?%{QUERY_STRING} ^'.$prefixe.'/papyrus\.php\?site=([^&]+)$'."\n".
'RewriteRule ^papyrus.php$ '.$url.'/site:%1? [L,R=301]'."\n\n".
'# Réecriture d\'url pour les sites de Papyrus : à modifier si les valeurs par défaut ont été changées'."\n".
'RewriteRule ^site:.+$ '.$prefixe_tilde.'papyrus.php [QSA,L]'."\n".
'# Réecriture d\'url pour les menus de Papyrus : à modifier si les valeurs par défaut ont été changées'."\n".
'RewriteRule ^page:.+$ '.$prefixe_tilde.'papyrus.php [QSA,L]'."\n\n".
'# Gestion des erreurs 404'."\n".
'ErrorDocument 404 '.$prefixe.'/erreur_http.php?erreur=404';
if (file_exists($fichier_htaccess_chemin)) {
$sortie_verif .='<p>Attention: Un fichier .htaccess est d&eacute;j&agrave; pr&eacute;sent sur le serveur.'.
'<br />'.$fichier_htaccess_chemin.
'<br />Veillez &agrave; le configurer correctement<br /><br />'.
'Contenu par d&eacute;faut: <br /><br /> ErrorDocument 404 /erreur_404.php';
} else {
$tempfn = tempnam('', '');
$temp = fopen($tempfn, 'w');
fwrite($temp, $contenu_htaccess);
fclose($temp);
$fichier_config_source = $tempfn;
$fichier_config_cible = $fichier_htaccess_chemin;
$txt_ecriture_conf_erreur = 'AVERTISSEMENT: Le fichier .htaccess <tt>'.$fichier_config_cible.
'</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>.htaccess</tt> directement &agrave la racine de '.
'<tt>papyrus</tt> de Papyrus.';
$txt_ecriture_conf_erreur .= '<div class="code"><code><pre>'.htmlentities($contenu_htaccess).'</pre></code></div>'."\n";
$txt_ecriture_conf = '&Eacute;criture sur le serveur du fichier .htaccess... <tt>'.$fichier_config_cible.'</tt>'."\n";
$erreur = testerConfig($sortie_verif, $txt_ecriture_conf, ftp_put($ftp, $fichier_config_cible,$fichier_config_source, FTP_ASCII), $txt_ecriture_conf_erreur, 1, 0);
 
}
// maj_fichier_config_appli($ftp,$fichier,'api/fckeditor/editor/filemanager/browser/default/connectors/php/config.php',array("Caldeira"=>"DDDDD"));
}
}
 
 
// Mise à jour des fichiers de configuration de chaque application :
function maj_fichier_config_appli($ftp, $fichier, $fichierconfig, $elements) {
$tempfn = tempnam('', '');
ftp_get($ftp,$tempfn,$fichier['PAP_FTP_RACINE'].$fichierconfig,FTP_ASCII);
$fp = fopen($tempfn, 'r');
if ($fp) {
while (!feof($fp)) {
$cont .= fread($fp, 500);
}
fclose($fp);
$fp = fopen($tempfn, 'w');
if ($fp) {
foreach ($elements as $element) {
list($expr,$rempl)=$elements;
preg_replace('/'.$expr.'/',$rempl,$cont);
}
fwrite($fp, $cont);
fclose($fp);
ftp_put($ftp, $fichier['PAP_FTP_RACINE'].$fichierconfig, $tempfn, FTP_ASCII);
}
}
}
 
// Gestion de l'affichage
if ($erreur == 0 && empty($sortie_verif)) {
// Premier appel du fichier...
$sortie .= creerFormulaire($fichier);
$sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
$sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
$sortie .= '<li><input type="submit" value="Tester" /></li>'."\n";
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
} else if ($erreur == 2 && !empty($sortie_verif)) {
// Verification du fichier avec interuption...
$sortie .= creerFormulaire($fichier);
$sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
$sortie .= '<li><input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" /></li>'."\n";
$sortie .= '<li><input type="submit" value="Tester &agrave; nouveau" /></li>'."\n";
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$sortie .= $sortie_verif;
} else if (($erreur == 0 || $erreur == 1) && !empty($sortie_verif)) {
// Verification du fichier sans interuption... passage a l'etape suivante
$sortie .= creerFormulaire($fichier, true);
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$sortie .= $sortie_verif;
// Ecriture du fichier...
fwrite($fp, $configCode);
fclose($fp);
$sortie .= ' <br /><p class="etape_info">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>'."\n";
}
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE DES FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
// Creation du formulaire de configuration de la base de donnees
function creerFormulaire($fichier, $bln_lecture = false) {
$disabled = '';
if ($bln_lecture) {
$disabled = ' disabled="disabled" ';
}
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_fichier" method="post">';
$sortie_form .= ' <ul>'."\n";
$sortie_form .= '<li><br /><h2>Configuration du FTP et des chemins d\'acc&egrave;s</h2></li>'."\n";
$sortie_form .= '<li>Entrer le nom de dommaine pour acc&eacute;der &agrave; votre d&eacute;p&ocirc;t FTP</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="ftp_serveur">Nom du serveur FTP :</label>'.
'<input id="ftp_serveur"'.$disabled.'type="text" size="30" name="fichier[PAP_FTP_SERVEUR]" value="'.$fichier['PAP_FTP_SERVEUR'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Le num&eacute;ro du port pour le service FTP sur la machine h&eacute;bergeant Papyrus. '.
'En g&eacute;n&eacute;ral c\'est 21.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="ftp_port">N&deg; du port d\'acc&egrave;s au serveur FTP :</label>'.
'<input id="ftp_port"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_PORT]" value="'.$fichier['PAP_FTP_PORT'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Nom et mot de passe FTP qui sera utilis&eacute; pour se connecter &agrave; au d&eacute;p&ocirc;t FTP.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="ftp_utilisateur">Nom d\'utilisateur pour le serveur FTP :</label>'.
'<input id="ftp_utilisateur"'.$disabled.'type="text" size="20" name="fichier[PAP_FTP_UTILISATEUR]" value="'.$fichier['PAP_FTP_UTILISATEUR'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="ftp_mot_de_passe">Mot de passe pour le serveur FTP :</label>'.
'<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'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Lorsque vous vous connectez par FTP sur le serveur o&ugrave; vous avez d&eacute;pos&eacute; les fichiers de Papyrus, le '.
'dossier le plus haut auquel vous pouvez acc&eacute;der dans l\'arborescence est la racine. Il vous faut donc '.
'indiquez dans le champ ci-dessous le chemin absolu depuis cette racine jusqu\'au dossier contenant le fichier '.
'<tt>papyrus.php</tt>. Exemple : <i>/www/</i></li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="ftp_racine">Racine d&eacute;p&ocirc;t FTP :</label>'.
'<input id="ftp_racine"'.$disabled.'type="text" size="60" name="fichier[PAP_FTP_RACINE]" value="'.$fichier['PAP_FTP_RACINE'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Si vous voulez générer un nouveau fichier .htaccess, cochez cette case (si vous ne savez pas ce qu\'est un fichier .htaccess '.
'n\'activez pas cette option).</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="htaccess_regeneration">Remplacer mon fichier .htacces :</label>'.
'<input id="htaccess_regeneration"'.$disabled.'type="checkbox" name="pref[PAP_HTACCESS_REGENERATION]" value="1" />'.
'Activation'.'</li>'."\n";
return $sortie_form;
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.35 2007-06-26 12:08:18 jp_milcent
* Correction de l'encodage et de la création du htaccess.
*
* Revision 1.34 2007-04-20 14:55:24 alexandre_tb
* charset
*
* Revision 1.33 2007/04/20 12:55:07 ddelon
* config fckeditor
*
* Revision 1.32 2007/04/20 12:49:41 ddelon
* config fckeditor
*
* Revision 1.31 2007/04/20 10:15:15 alexandre_tb
* correction typo
*
* Revision 1.30 2007/04/20 09:18:09 alexandre_tb
* correction pb encodage
*
* Revision 1.29 2007/04/20 09:13:37 alexandre_tb
* correction pb encodage
*
* Revision 1.28 2007/04/20 09:05:46 alexandre_tb
* correction pb encodage
*
* Revision 1.27 2007/04/19 16:53:57 neiluj
* fix de l'upload des fichiers de conf (ftp_put)
*
* Revision 1.26 2007/04/19 15:34:35 neiluj
* préparration release (livraison) "Narmer" - v0.25
*
* Revision 1.25 2006/12/01 15:43:01 alexandre_tb
* prise en compte dans le rewriteengine de l'activation ou non de la reecriture
*
* Revision 1.24 2006/12/01 11:47:10 alexandre_tb
* suppression de var_dump
*
* Revision 1.23 2006/12/01 11:46:11 alexandre_tb
* correction creation .htaccess
*
* Revision 1.22 2006/11/30 17:41:30 alexandre_tb
* ecriture htaccess
*
* Revision 1.21 2006/11/30 17:36:29 alexandre_tb
* ecriture htaccess
*
* Revision 1.20 2006/11/30 16:41:42 alexandre_tb
* ecriture htaccess
*
* Revision 1.19 2006/11/30 15:50:25 ddelon
* installation fichier
*
* Revision 1.18 2006/11/30 15:34:51 alexandre_tb
* ecriture htaccess
*
* Revision 1.17 2006/11/30 15:27:31 alexandre_tb
* ecriture htaccess
*
* Revision 1.16 2006/11/30 14:52:42 alexandre_tb
* Ecriture du fichier htaccess lors de l installation
*
* Revision 1.15 2006/10/09 14:35:27 ddelon
* bug caractere invalie trainant dans fichier
*
* Revision 1.14 2006/10/06 15:34:30 florian
* mise en commentaire .htaccess
*
* Revision 1.13 2006/10/06 15:23:00 florian
* amelioration graphique de l'installateur
*
* Revision 1.12 2006/10/06 14:49:45 ddelon
* ecriture htaccess a l'installation
*
* Revision 1.11 2006/10/06 14:46:15 alexandre_tb
* ecriture du fichier .htaccess
*
* Revision 1.10 2005/09/23 14:20:23 florian
* Nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.9 2005/04/12 16:09:45 jpm
* Amélioration de la gestion de la constante de redirection des urls et de la gestion des constantes de type entier et booléen.
*
* Revision 1.8 2004/10/25 16:26:35 jpm
* Début gestion des mises à jours.
*
* Revision 1.7 2004/10/25 10:22:48 jpm
* Correction de quelques bogues, ajouts d'explications pour l'utilisateur et modification des styles CSS.
*
* Revision 1.6 2004/10/22 17:39:14 jpm
* Correction gestion du slash devant le chemin racine ftp.
*
* Revision 1.5 2004/10/22 17:23:04 jpm
* Simplification del'installation de Papyrus.
*
* Revision 1.4 2004/10/19 17:01:12 jpm
* Correction bogues.
*
* Revision 1.3 2004/10/19 15:59:18 jpm
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
* Ajout des constantes FTP.
*
* Revision 1.2 2004/10/18 09:12:09 jpm
* Changement de nom d'un fichier.
*
* Revision 1.1 2004/10/18 09:11:05 jpm
* Changement de nom du fichier.
*
* Revision 1.1 2004/10/15 18:28:59 jpm
* Début appli installateur de Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v3.0-aha/papyrus/applications/installateur/instal_base_de_donnees.inc.php
New file
0,0 → 1,401
<?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 Eric FELDSTEIN |
// | 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_base_de_donnees.inc.php,v 1.35 2007-08-28 14:37:11 jp_milcent Exp $
/**
* Page de création de la base de données de Papyrus.
*
* Page permettant de créer la base de données de Papyrus.
*
*@package Installateur
//Auteur original :
*@author Hendrik MANS <hendrik@mans.de>
//Autres auteurs :
*@author David DELON
*@author Patrick PAUL
*@author Eric FELDSTEIN
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.35 $ $Date: 2007-08-28 14:37:11 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Numéro de l'étape d'installation :
$num_etape = 2;
 
// Initialisation du tableau contenant les valeurs de configuration de la base de données
$tableau = array('PAP_BDD_SERVEUR' => '', 'PAP_BDD_NOM' => '', 'PAP_BDD_UTILISATEUR' => '', 'PAP_BDD_MOT_DE_PASSE' => '');
foreach ($tableau as $cle => $val) {
if ($_POST['bdd'][$cle] != '') {
$bdd[$cle] = $_POST['bdd'][$cle];
} else if (defined($cle)) {
$bdd[$cle] = constant($cle);
} else {
$bdd[$cle] = '';
}
}
 
// Récupération des paramêtres de configuration du formulaire précédent
if (isset($_POST['pref'])) {
$pref = $_POST['pref'];
} else if (isset($_POST['pref_serial'])) {
$pref = unserialize(stripslashes($_POST['pref_serial']));
}
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// Affichage d'informations...
$sortie .= '<br /><h1>Etape n&deg;'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</h1>'."\n";
 
// Nous vérifions si nous sommes en phase de test du formulaire de config de la base de données
$erreur = 0;
$sortie_verif = '';
if ($_GET['installation'] == 'verif_bdd') {
// Test de la configuration à la base de données
$sortie_test .= ' <br /><h2>Test de la configuration de la base de donn&eacute;es</h2>'."\n";
$dblink = @mysql_connect($bdd['PAP_BDD_SERVEUR'], $bdd['PAP_BDD_UTILISATEUR'], $bdd['PAP_BDD_MOT_DE_PASSE']);
$erreur = testerConfig($sortie_test, 'Test connexion au serveur MySQL, recherche base de donn&eacute;es ...', @mysql_select_db($bdd['PAP_BDD_NOM'], $dblink),
'<br />La base de donn&eacute;es, le serveur MySQL, ou votre identifiant / mot de passe sont invalides, veuillez vérifier vos paramêtres.', 1, $erreur);
$sortie .= '<br />'."\n";
if ($erreur==0) {
// L'exécution du SQL peut commencer...
if (!defined('PAP_VERSION')) {
$version_actuelle = 0.1;
} else {
// On ajoute pour éviter l'étape qui a déjà eu lieu lors d'une installation précédente!
$version_actuelle = PAP_VERSION + 0.01;
}
if (!defined('GEN_VERSION')) {
$version_maj = 0.1;
} else {
$version_maj = GEN_VERSION + 0.01;
}
$sortie_test .= '<h2>Insertion des informations dans la base de donn&eacute;es</h2>';
for ( $version = $version_actuelle; $version <= $version_maj; $version = $version + 0.01) {
//Insertion des requêtes présentes dans le fichier sql
$file_sql_contenu = INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql';
if (file_exists($file_sql_contenu)) {
$sortie_verif .= '<h2>Insertion des donn&eacute;es du fichier sql version '.$version.'</h2>';
$sql_contenu = PMA_readFile($file_sql_contenu);
} else
unset($sql_contenu);
$tab_requete_sql = array();
PMA_splitSqlFile($tab_requete_sql, $sql_contenu, '');
foreach ($tab_requete_sql as $value) {
$table_nom = '';
if (!empty($value['table_nom'])) {
$table_nom = $value['table_nom'];
}
$requete_type = '';
if (!empty($value['type'])) {
$requete_type = $value['type'];
}
if ($requete_type == 'create') {
$erreur = testerConfig( $sortie_verif, 'Cr&eacute;ation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'D&eacute;j&agrave; cr&eacute;&eacute;e ?', 0, $erreur);
} else if ($requete_type == 'alter') {
$erreur = testerConfig( $sortie_verif, 'Modification structure table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'D&eacute;j&agrave; modifi&eacute;e ?', 0, $erreur);
} else if ($requete_type == 'insert') {
$erreur = testerConfig( $sortie_verif, 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
}
}
// Chargement des hooks sql : fichier sql de configuration spécifiques à chaque application
$d = dir(GEN_CHEMIN_CLIENT);
$sql_contenu_hook = '';
while (false !== ($repertoire = $d->read())) {
$hook=GEN_CHEMIN_CLIENT.$repertoire.GEN_SEP.'documentation'.GEN_SEP.$repertoire.'_v'.$version.'.sql';
if (file_exists($hook)) {
$sortie_verif .= '<h2>Insertion des informations dans la base de données, fichier : '.$hook.' </h2>';
$sql_contenu_hook = PMA_readFile($hook);
$tab_requete_sql = array();
PMA_splitSqlFile($tab_requete_sql, $sql_contenu_hook, '');
foreach ($tab_requete_sql as $value) {
$table_nom = '';
if (!empty($value['table_nom'])) {
$table_nom = $value['table_nom'];
}
$requete_type = '';
if (!empty($value['type'])) {
$requete_type = $value['type'];
}
if ($requete_type == 'create') {
$erreur = testerConfig( $sortie_verif, 'Cr&eacute;ation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'D&eacute;j&agrave; cr&eacute;&eacute; ?', 0, $erreur);
} else if ($requete_type == 'alter') {
$erreur = testerConfig( $sortie_verif, 'Modification structure table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'D&eacute;j&agrave; modifi&eacute;e ?', 0, $erreur);
} else if ($requete_type == 'insert') {
$erreur = testerConfig( $sortie_verif, 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
}
}
}
}
}
//Insertion des requêtes dépendant du formulaire d'installation
$sortie_verif .= '<h2>Insertion des donn&eacute;es d&eacute;pendant du formulaire pr&eacute;c&eacute;dent</h2>';
$requete_admin = 'INSERT INTO gen_annuaire VALUES (1, "'.$pref['ADMIN_I18N'].'", "'.$pref['ADMIN_NOM'].
'", "'.$pref['ADMIN_PRENOM'].'", "'.md5($pref['ADMIN_MDP_01']).'", "'.
$pref['ADMIN_MAIL'].'");';
$erreur = testerConfig($sortie_verif, 'Insertion de l\'administrateur...', @mysql_query($requete_admin, $dblink),
'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
$requete_auth = 'INSERT INTO gen_site_auth_bdd VALUES (1, "mysql://'.
$bdd['PAP_BDD_UTILISATEUR'].':'.$bdd['PAP_BDD_MOT_DE_PASSE'].'@'.$bdd['PAP_BDD_SERVEUR'].'/'.$bdd['PAP_BDD_NOM'].'", "gen_annuaire", "ga_mail", '.
'"ga_mot_de_passe", "md5","chp_personne_prenom=ga_prenom chp_personne_nom=ga_nom");';
$erreur = testerConfig($sortie_verif, 'Insertion de l\'authentification...', @mysql_query($requete_auth, $dblink),
'Données déjà présente ?', 0, $erreur);
$url_inscription = preg_replace ('/papyrus\.php/', 'page:inscription', $pref['PAP_URL']);
$url_inscription_erreur = preg_replace ('/papyrus\.php/', 'page:inscription?action&#61;mdp_oubli', $pref['PAP_URL']);
$requete_auth = 'INSERT INTO gen_site_auth_bdd VALUES (2, "mysql://'.
$bdd['PAP_BDD_UTILISATEUR'].':'.$bdd['PAP_BDD_MOT_DE_PASSE'].'@'.$bdd['PAP_BDD_SERVEUR'].'/'.$bdd['PAP_BDD_NOM'].'", "annuaire", "a_mail", '.
'"a_mot_de_passe", "md5","chp_personne_prenom=a_prenom chp_personne_nom=a_nom '.
'url_inscription='.$url_inscription.' url_inscription_modif='.$url_inscription.' url_erreur='.$url_inscription_erreur.'");';
 
$erreur = testerConfig($sortie_verif, 'Insertion de l\'authentification utilisateurs ...', @mysql_query($requete_auth, $dblink),
'Donn&eacute;es d&eacute;j&agrave; pr&eacute;sente ?', 0, $erreur);
}
}
 
// Gestion de l'affichage de sortie
if ($erreur == 0 && empty($sortie_verif)) {
// Premier appel du fichier...
$sortie .= creerFormulaire($bdd);
$sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
$sortie .= '<li><input type="submit" value="Tester" /></li>'."\n";
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
} else if ($erreur == 2 && !empty($sortie_test)) {
// Vérification du fichier avec interuption...
$sortie .= creerFormulaire($bdd);
$sortie .= $sortie_test;
$sortie .= '<li><input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" /></li>'."\n";
$sortie .= '<li><input type="submit" value="Tester &agrave; nouveau" /></li>'."\n";
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
//$sortie .= '<div class="code"><code>'.$sortie_verif.'</code></div>';
} else if (($erreur == 0 || $erreur == 1) && !empty($sortie_verif)) {
// Vérification du fichier sans interuption... passage à l'étape suivante
$sortie .= creerFormulaire($bdd, true);
$sortie .= $sortie_test;
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$sortie .= '<div class="code"><code>'.$sortie_verif.'</code></div>';
$sortie .= ' <br /><p class="etape_info">A l\'&eacute;tape suivante, le programme d\'installation va essayer d\'&eacute;crire le fichier de '.
'configuration <tt>'.INSTAL_FICHIER_CONFIG.'</tt>.<br />Assurez vous que le serveur web a bien le '.
'droit d\'&eacute;crire dans ce fichier, sinon vous devrez le modifier manuellement.</p>'."\n";
$sortie .= ' <form style="clear:both;" action="'.donnerUrlCourante().'?installation=form_fichier" method="POST" />'."\n";
$sortie .= ' <input type="hidden" name="bdd_serial" value="'.htmlentities(serialize($bdd)).'" />'."\n";
$sortie .= ' <input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" />'."\n";
$sortie .= ' <input type="submit" value="Continuer" />'."\n";
$sortie .= ' </form>'."\n";
}
// +------------------------------------------------------------------------------------------------------+
// | LISTE DES FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
// Création du formulaire de configuration de la base de données
function creerFormulaire($bdd, $bln_lecture = false) {
$disabled = '';
if ($bln_lecture) {
$disabled = ' disabled="disabled" ';
}
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_bdd" method="post">';
$sortie_form .= ' <ul>'."\n";
$sortie_form .= '<li><br /><h2>Configuration de la base de donn&eacute;es</h2></li>'."\n";
$sortie_form .= '<li>La machine sur laquelle se trouve votre serveur MySQL. En g&eacute;n&eacute;ral c\'est "localhost" '.
'(ie, la m&ecirc;me machine que celle o&ugrave; se trouve les pages de Papyrus.).</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="mysql_serveur">Nom du serveur MySQL :</label>'.
'<input id="mysql_serveur"'.$disabled.'type="text" size="30" name="bdd[PAP_BDD_SERVEUR]" value="'.$bdd['PAP_BDD_SERVEUR'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>La base de donn&eacute;es MySQL &agrave; utiliser pour Papyrus. Cette base de donn&eacute;es doit d&eacute;j&agrave; '.
'exister avant de pouvoir continuer.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="mysql_database">Base de donn&eacute;es MySQL :</label>'.
'<input id="mysql_database"'.$disabled.'type="text" size="30" name="bdd[PAP_BDD_NOM]" value="'.$bdd['PAP_BDD_NOM'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Nom et mot de passe de l\'utilisateur MySQL qui sera utilis&eacute; pour se connecter &agrave; votre base de donn&eacute;es.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="mysql_user">Nom de l\'utilisateur MySQL :</label>'.
'<input id="mysql_user"'.$disabled.'type="text" size="30" name="bdd[PAP_BDD_UTILISATEUR]" value="'.$bdd['PAP_BDD_UTILISATEUR'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="mysql_password">Mot de passe MySQL :</label>'.
'<input id="mysql_password"'.$disabled.'type="password" size="30" name="bdd[PAP_BDD_MOT_DE_PASSE]" value="'.$bdd['PAP_BDD_MOT_DE_PASSE'].'" />'.
'</li>'."\n";
return $sortie_form;
}
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.34 2007-06-26 12:08:18 jp_milcent
* Correction de l'encodage et de la création du htaccess.
*
* Revision 1.33 2007-06-25 12:15:07 alexandre_tb
* merge from narmer
*
* Revision 1.32 2007/04/20 09:05:46 alexandre_tb
* correction pb encodage
*
* Revision 1.31 2007/04/19 16:19:45 neiluj
* optimisation
*
* Revision 1.30 2007/04/19 16:18:05 neiluj
* correction bug lecture fichier SQL
*
* Revision 1.29 2006/12/01 14:05:57 alexandre_tb
* affichage des mesages d erreurs quand on se trompe dans les parametres mysql
*
* Revision 1.28 2006/10/06 15:23:00 florian
* amelioration graphique de l'installateur
*
* Revision 1.27 2006/10/06 10:35:38 alexandre_tb
* correction du lien vers l'inscription.
*
* Revision 1.26 2006/10/05 18:38:36 ddelon
* reglage inititialisation base de donnes : authorisation utilisateur
*
* Revision 1.25 2006/10/05 17:56:37 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.24 2006/10/05 17:39:35 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.23 2006/10/05 17:16:21 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.22 2006/10/05 16:44:02 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.21 2006/10/05 16:39:01 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.20 2006/10/05 16:25:58 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.19 2006/10/05 15:38:22 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.18 2006/10/05 15:27:53 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.17 2006/10/05 15:04:00 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.16 2006/10/05 15:00:56 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.15 2006/10/05 14:41:12 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.14 2006/10/05 14:24:58 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.13 2006/10/05 14:01:21 ddelon
* Gestion hooks creation base de donnee
*
* Revision 1.12 2005/09/23 14:20:23 florian
* nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.11 2004/11/03 17:31:13 jpm
* Corrections bogues erreurs noms de variables (suite).
*
* Revision 1.10 2004/11/03 17:26:19 jpm
* Corrections bogues erreurs noms de variables.
*
* Revision 1.9 2004/10/27 11:43:32 jpm
* Correction bogues diff mise à jour / installation.
*
* Revision 1.8 2004/10/26 18:41:12 jpm
* Correction bogue pour la mise à jour.
*
* Revision 1.7 2004/10/25 16:26:35 jpm
* Début gestion des mises à jours.
*
* Revision 1.6 2004/10/25 10:22:48 jpm
* Correction de quelques bogues, ajouts d'explications pour l'utilisateur et modification des styles CSS.
*
* Revision 1.5 2004/10/22 17:56:28 jpm
* Correction erreur auth.
*
* Revision 1.4 2004/10/22 17:23:04 jpm
* Simplification del'installation de Papyrus.
*
* Revision 1.3 2004/10/19 16:47:28 jpm
* Transformation en fonction de l'appel de l'application.
*
* Revision 1.2 2004/10/19 15:59:18 jpm
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
* Ajout des constantes FTP.
*
* Revision 1.1 2004/10/15 18:28:59 jpm
* Début appli installateur de Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v3.0-aha/papyrus/applications/installateur/instal_preference.inc.php
New file
0,0 → 1,273
<?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 |
// | 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_preference.inc.php,v 1.12 2006-10-06 15:23:00 florian Exp $
/**
* Page d'initialisation de l'installation de Papyrus.
*
* Contenu de la page par défaut de l'installation 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.12 $ $Date: 2006-10-06 15:23:00 $
// +------------------------------------------------------------------------------------------------------+
**/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Numéro de l'étape d'installation :
$num_etape = 1;
 
// Initialisation du tableau contenant les valeurs de configuration de la base de données
$tableau = array('ADMIN_PRENOM' => '', 'ADMIN_NOM' => '', 'ADMIN_MAIL' => '', 'ADMIN_MDP_01' => '',
'ADMIN_MDP_02' => '', 'ADMIN_I18N' => '', 'PAP_URL' => '', 'PAP_CHEMIN_RACINE' => '', 'PAP_URL_REECRITURE' => '0');
foreach ($tableau as $cle => $val) {
if (!empty($_POST['pref'][$cle])) {
$pref[$cle] = $_POST['pref'][$cle];
} else if (defined($cle)) {
$pref[$cle] = constant($cle);
if ($cle == 'PAP_CHEMIN_RACINE') $pref[$cle] = INSTAL_CHEMIN_ABSOLU;
} else {
if ($cle == 'PAP_URL') {
$pref[$cle] = 'http://'.$_SERVER['SERVER_NAME'].
($_SERVER['SERVER_PORT'] != 80 ? ':'.$_SERVER['SERVER_PORT'] : '').
$_SERVER['REQUEST_URI'];
} else if ($cle == 'PAP_CHEMIN_RACINE') {
$pref[$cle] = INSTAL_CHEMIN_ABSOLU;
} else {
$pref[$cle] = '';
}
}
}
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
// Affichage d'informations...
$sortie .= '<br /><h1>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</h1>'."\n";
$sortie .= '<p>NOTE: Ce programme d\'installation va essayer de modifier les options de configurations dans le '.
'fichier <tt>pap_config.inc.php</tt>, situ&eacute; dans le r&eacute;pertoire <tt>configuration</tt> du réportoire '.
'<tt>papyrus</tt>. Pour que cela fonctionne, 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 '.
'devrez modifier ce fichier manuellement (ce programme d\'installation vous dira comment).</p><br />'."\n";
 
// Nous vérifions si nous sommes en phase de test du formulaire de config des préférences
if ($_GET['installation'] == 'verif_pref' ) {
$sortie_verif = '';
$sortie_verif .= testerPresenceExtension();
// En mise à jour, nous n'affichons pas les champs pour saisir un administrateur
if (!defined(INSTAL_VERSION_NOUVELLE_NOM)) {
// Nous vérifions que l'utilisateur à bien saisie les infos dans les champs du formulaire
if(empty($_POST['pref']['ADMIN_PRENOM'])) {
$sortie_verif .= '<p class="erreur">Le champ "Prénom" ne doit pas être vide!</p>'."\n";
}
if(empty($_POST['pref']['ADMIN_NOM'])) {
$sortie_verif .= '<p class="erreur">Le champ "Nom" ne doit pas être vide!</p>'."\n";
}
if(empty($_POST['pref']['ADMIN_MAIL'])) {
$sortie_verif .= '<p class="erreur">Le champ "Courriel" ne doit pas être vide!</p>'."\n";
}
if(empty($_POST['pref']['ADMIN_MDP_01'])) {
$sortie_verif .= '<p class="erreur">Le champ "Mot de passe" ne doit pas être vide!</p>'."\n";
}
if($_POST['pref']['ADMIN_MDP_01'] != $_POST['pref']['ADMIN_MDP_02']) {
$sortie_verif .= '<p class="erreur">Le deux mots de passes saisis pour le compte administrateur sont différents!</p>'."\n";
}
}
}
 
// Gestion de l'affichage de sortie
if (!isset($sortie_verif) && empty($sortie_verif)) {
// Premier appel du fichier...
$sortie .= creerFormulaire($pref);
$sortie .= ' </ul>'."\n";
$sortie .= '<input type="submit" value="Passer à l\'étape suivante" />'."\n";
$sortie .= '</form>';
} else if (isset($sortie_verif) && !empty($sortie_verif)) {
// Vérification du fichier avec interuption...
$sortie .= $sortie_verif;
$sortie .= creerFormulaire($pref);
$sortie .= ' </ul>'."\n";
$sortie .= '<input type="submit" value="Tester à nouveau" />'."\n";
$sortie .= ' </form>';
} else if (isset($sortie_verif) && empty($sortie_verif)) {
// Vérification du fichier sans interuption... passage à l'étape suivante
$sortie .= creerFormulaire($pref, true);
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$sortie .= ' <br /><p class="etape_info">La configuration est OK. A l\'&eacute;tape suivante, le programme d\'installation va essayer de configurer '.
'et créer la base de données.</p>'."\n";
$sortie .= ' <form style="clear:both;" action="'.donnerUrlCourante().'?installation=form_bdd" method="post">'."\n";
$sortie .= ' <input type="hidden" name="pref_serial" value="'.htmlentities(serialize($pref)).'" />'."\n";
$sortie .= ' <input type="submit" value="Continuer" />'."\n";
$sortie .= ' </form>'."\n";
}
// +------------------------------------------------------------------------------------------------------+
// | LISTE DES FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
// Création du formulaire de configuration de la base de donneés
function creerFormulaire($pref, $bln_lecture = false) {
$disabled = '';
if ($bln_lecture) {
$disabled = ' disabled="disabled" ';
}
$sortie_form = '';
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_pref" method="post">'."\n";
$sortie_form .= '<ul>'."\n";
// En mise à jour, nous n'affichons pas les champs pour saisir un administrateur
if (!defined(INSTAL_VERSION_NOUVELLE_NOM)) {
$sortie_form .= '<li><h2>Configuration d\'un administrateur de Papyrus</h2></li>'."\n";
$sortie_form .= '<li>Tous les champs ci-dessous sont obligatoires.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_prenom">Prénom :</label>'.
'<input id="admin_prenom"'.$disabled.'type="text" size="30" name="pref[ADMIN_PRENOM]" value="'.$pref['ADMIN_PRENOM'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_nom">Nom :</label>'.
'<input id="admin_nom"'.$disabled.'type="text" size="30" name="pref[ADMIN_NOM]" value="'.$pref['ADMIN_NOM'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_mail">Courriel :</label>'.
'<input id="admin_mail"'.$disabled.'type="text" size="30" name="pref[ADMIN_MAIL]" value="'.$pref['ADMIN_MAIL'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_mdp_01">Mot de passe :</label>'.
'<input id="admin_mdp_01"'.$disabled.'type="password" size="10" name="pref[ADMIN_MDP_01]" value="'.$pref['ADMIN_MDP_01'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_mdp_02">Taper à nouveau votre mot de passe :</label>'.
'<input id="admin_mdp_02"'.$disabled.'type="password" size="10" name="pref[ADMIN_MDP_02]" value="'.$pref['ADMIN_MDP_02'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="admin_i18n">Langue :</label>'.
'<select id="admin_i18n"'.$disabled.'name="pref[ADMIN_I18N]">'.
'<option value="fr-FR" selected="selected">français</option>'.
'</select>'.
'</li>'."\n";
}
$sortie_form .= '<li>&nbsp;</li>'."\n".'<li><h2>Configuration de l\'URL</h2></li>'."\n";
$sortie_form .= '<li>L\'URL courante dans la barre d\'adresse de votre navigateur devrait correspondre à la valeur '.
'présente dans le champ ci-dessous. Si ce n\'est pas le cas, veuillez corriger la valeur ci-dessous.'."\n";
$sortie_form .= '<li>'."\n".
'<label for="url_courante">URL courante :</label>'.
'<input id="url_courante"'.$disabled.'type="text" size="60" name="pref[PAP_URL]" value="'.$pref['PAP_URL'].'" />'.
'</li>'."\n";
$sortie_form .= '<li>Le mode "redirection automatique" doit &ecirc;tre s&eacute;lectionn&eacute; uniquement si '.
'vous utilisez Papyrus avec la redirection d\'URL (si vous ne savez pas ce qu\'est la redirection d\'URL '.
'n\'activez pas cette option).</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="rewrite_mode">Mode "redirection" :</label>'.
'<input id="rewrite_mode"'.$disabled.'type="checkbox" name="pref[PAP_URL_REECRITURE]" value="1" />'.
'Activation'.'</li>'."\n";
$sortie_form .= '<li>Le champ suivant devrait contenir le chemin d\'accès absolu vers le fichier <tt>papyrus.php</tt> '.
'sur le serveur où sont déposés les fichiers de Papyrus.</li>'."\n";
$sortie_form .= '<li>'."\n".
'<label for="web_racine">Dossier de <tt>papyrus.php</tt> :</label>'.
'<input id="web_racine"'.$disabled.'type="text" size="60" name="pref[PAP_CHEMIN_RACINE]" value="'.$pref['PAP_CHEMIN_RACINE'].'" />'.
'</li>'."\n";
return $sortie_form;
}
 
// Vérification des variables d'environnement de PHP.
function testerPresenceExtension() {
$message = '';
$phrase_deb = '<p class="erreur">Pour fonctionner Papyrus à besoin que l\'extension PHP : ';
$phrase_fin = 'soit installée sur le serveur.<br /> Sans cette extension vous ne pourrez pas installer Papyrus !</p>';
// Nous avons besoin de quelques extensions
if (! extension_loaded('mysql')) {
$message .= $phrase_deb.'MYSQL'.$phrase_fin;
}
if (! extension_loaded('ftp')) {
$message .= $phrase_deb.'FTP'.$phrase_fin;
}
if (! extension_loaded('gd')) {
$message .= $phrase_deb.'GD'.$phrase_fin;
}
return $message;
}
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.11 2006/10/05 15:14:18 alexandre_tb
* Mise en place du chemin par défaut
*
* Revision 1.10 2005/09/23 14:20:23 florian
* nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.9 2005/04/12 16:09:45 jpm
* Amélioration de la gestion de la constante de redirection des urls et de la gestion des constantes de type entier et booléen.
*
* Revision 1.8 2004/10/27 11:43:32 jpm
* Correction bogues diff mise à jour / installation.
*
* Revision 1.7 2004/10/25 10:22:48 jpm
* Correction de quelques bogues, ajouts d'explications pour l'utilisateur et modification des styles CSS.
*
* Revision 1.6 2004/10/22 17:23:04 jpm
* Simplification del'installation de Papyrus.
*
* Revision 1.5 2004/10/22 09:07:18 jpm
* Début simplification installateur.
*
* Revision 1.4 2004/10/19 17:01:12 jpm
* Correction bogues.
*
* Revision 1.3 2004/10/19 16:47:28 jpm
* Transformation en fonction de l'appel de l'application.
*
* Revision 1.2 2004/10/19 15:59:18 jpm
* Ajout de la gestion des valeurs propre à Papyrus à insérer dans la base de données.
* Ajout des constantes FTP.
*
* Revision 1.1 2004/10/15 18:28:59 jpm
* Début appli installateur de Papyrus.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>
/branches/v3.0-aha/papyrus/applications/installateur/bibliotheque/instal_installation.fonct.php
New file
0,0 → 1,356
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This library is free software; you can redistribute it and/or |
// | modify it under the terms of the GNU Lesser General Public |
// | License as published by the Free Software Foundation; either |
// | version 2.1 of the License, or (at your option) any later version. |
// | |
// | This library is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | Lesser General Public License for more details. |
// | |
// | You should have received a copy of the GNU Lesser General Public |
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: instal_installation.fonct.php,v 1.7 2007-01-04 17:06:03 alexandre_tb Exp $
/**
* Bibliothèque des fonctions de l'application Installateur de Papyrus.
*
* Ce sous-paquetage contient les fonctions de l'application Installateur de Papyrus. Cette application gère
* l'installation de Papyrus (base de données).
*
*@package Installateur
*@subpackage Fonctions
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.7 $ $Date: 2007-01-04 17:06:03 $
*/
 
// +------------------------------------------------------------------------------------------------------+
// | LISTE de FONCTIONS |
// +------------------------------------------------------------------------------------------------------+
 
 
/**Fonction donnerUrlCourante() - Retourne la base de l'url courante.
*
* Cette fonction renvoie la base de l'url courante.
* Origine : fonction provenant du fichier header.php de Wikini version 0.4.1
* Licence : la même que celle figurant dans l'entête du fichier header.php de Wikini version 0.4.1
* ou le fichier install_defaut.inc.php de cette application.
* Auteurs : Hendrik MANS, David DELON, Patrick PAUL, Jean-Pascal MILCENT
*
* @return string l'url courante.
*/
function donnerUrlCourante()
{
list($url, ) = explode('?', $_SERVER['REQUEST_URI']);
return $url;
}
 
/**Fonction testerConfig() - Retourne un message en fonction du résultat du test.
*
* Cette fonction retourne un message en fonction du résultat du test.
* Origine : fonction provenant du fichier header.php de Wikini version 0.4.1
* Licence : la même que celle figurant dans l'entête du fichier header.php de Wikini version 0.4.1
* ou le fichier install_defaut.inc.php de cette application.
* Auteurs : Hendrik MANS, David DELON, Patrick PAUL, Jean-Pascal MILCENT
*
* @return string l'url courante.
*/
function testerConfig(&$sortie, $texte, $test, $texte_erreur = '', $stop_erreur = 1, $erreur) {
if ($erreur == 2) {
return 2;
}
$sortie .= $texte.' ';
if ($test) {
$sortie .= '<span class="ok">&nbsp;OK&nbsp;</span><br />'."\n";
return 0;
} else {
$sortie .= '<span class="failed">&nbsp;ECHEC&nbsp;</span>';
if ($texte_erreur) {
$sortie .= '<p class="erreur">'.$texte_erreur.'</p>';
}
$sortie .= '<br />'."\n" ;
if ($stop_erreur == 1) {
return 2;
} else {
return 1;
}
}
}
/**
* Removes comment lines and splits up large sql files into individual queries
*
* Last revision: September 23, 2001 - gandon
* Origine : fonction provenant de PhpMyAdmin version 2.6.0-pl1
* Licence : GNU
* Auteurs : voir le fichier Documentation.txt ou Documentation.html de PhpMyAdmin.
*
* @param array the splitted sql commands
* @param string the sql commands
* @param integer the MySQL release number (because certains php3 versions
* can't get the value of a constant from within a function)
*
* @return boolean always true
*
* @access public
*/
function PMA_splitSqlFile(&$ret, $sql, $release)
{
// do not trim, see bug #1030644
//$sql = trim($sql);
$sql = rtrim($sql, "\n\r");
$sql_len = strlen($sql);
$char = '';
$string_start = '';
$in_string = FALSE;
$nothing = TRUE;
$time0 = time();
 
for ($i = 0; $i < $sql_len; ++$i) {
$char = $sql[$i];
 
// We are in a string, check for not escaped end of strings except for
// backquotes that can't be escaped
if ($in_string) {
for (;;) {
$i = strpos($sql, $string_start, $i);
// No end of string found -> add the current substring to the
// returned array
if (!$i) {
$tab_info = retournerInfoRequete($sql);
$ret[] = array('query' => $sql, 'table_nom' => $tab_info['table_nom'], 'type' => $tab_info['type']);
return TRUE;
}
// Backquotes or no backslashes before quotes: it's indeed the
// end of the string -> exit the loop
else if ($string_start == '`' || $sql[$i-1] != '\\') {
$string_start = '';
$in_string = FALSE;
break;
}
// one or more Backslashes before the presumed end of string...
else {
// ... first checks for escaped backslashes
$j = 2;
$escaped_backslash = FALSE;
while ($i-$j > 0 && $sql[$i-$j] == '\\') {
$escaped_backslash = !$escaped_backslash;
$j++;
}
// ... if escaped backslashes: it's really the end of the
// string -> exit the loop
if ($escaped_backslash) {
$string_start = '';
$in_string = FALSE;
break;
}
// ... else loop
else {
$i++;
}
} // end if...elseif...else
} // end for
} // end if (in string)
// lets skip comments (/*, -- and #)
else if (($char == '-' && $sql_len > $i + 2 && $sql[$i + 1] == '-' && $sql[$i + 2] <= ' ') || $char == '#' || ($char == '/' && $sql_len > $i + 1 && $sql[$i + 1] == '*')) {
$i = strpos($sql, $char == '/' ? '*/' : "\n", $i);
// didn't we hit end of string?
if ($i === FALSE) {
break;
}
if ($char == '/') $i++;
}
 
// We are not in a string, first check for delimiter...
else if ($char == ';') {
// if delimiter found, add the parsed part to the returned array
$retour_sql = substr($sql, 0, $i);
$tab_info = retournerInfoRequete($retour_sql);
$ret[] = array('query' => $retour_sql, 'empty' => $nothing, 'table_nom' => $tab_info['table_nom'], 'type' => $tab_info['type']);
$nothing = TRUE;
$sql = ltrim(substr($sql, min($i + 1, $sql_len)));
$sql_len = strlen($sql);
if ($sql_len) {
$i = -1;
} else {
// The submited statement(s) end(s) here
return TRUE;
}
} // end else if (is delimiter)
 
// ... then check for start of a string,...
else if (($char == '"') || ($char == '\'') || ($char == '`')) {
$in_string = TRUE;
$nothing = FALSE;
$string_start = $char;
} // end else if (is start of string)
 
elseif ($nothing) {
$nothing = FALSE;
}
 
// loic1: send a fake header each 30 sec. to bypass browser timeout
$time1 = time();
if ($time1 >= $time0 + 30) {
$time0 = $time1;
header('X-pmaPing: Pong');
} // end if
} // end for
 
// add any rest to the returned array
if (!empty($sql) && preg_match('@[^[:space:]]+@', $sql)) {
$tab_info = retournerInfoRequete($sql);
$ret[] = array('query' => $sql, 'empty' => $nothing, 'table_nom' => $tab_info['table_nom'], 'type' => $tab_info['type']);
}
 
return TRUE;
}
 
/**Fonction retournerInfoRequete() - Retourne le type de requête sql et le nom de la table touchée.
*
* Cette fonction retourne un tableau associatif contenant en clé 'table_nom' le nom de la table touchée
* et en clé 'type' le type de requête (create, alter, insert, update...).
* Licence : la même que celle figurant dans l'entête de ce fichier
* Auteurs : Jean-Pascal MILCENT
*
* @author Jean-Pascal MILCENT <jpm@tela-botanica.org>
* @return string l'url courante.
*/
function retournerInfoRequete($sql)
{
$requete = array();
$resultat='';
if (preg_match('/(?i:CREATE TABLE) +(.+) +\(/', $sql, $resultat)) {
if (isset($resultat[1])) {
$requete['table_nom'] = $resultat[1];
}
$requete['type'] = 'create';
} else if (preg_match('/(?i:ALTER TABLE) +(.+) +/', $sql, $resultat)) {
if (isset($resultat[1])) {
$requete['table_nom'] = $resultat[1];
}
$requete['type'] = 'alter';
} else if (preg_match('/(?i:INSERT INTO) +(.+) +(?i:\(|VALUES +\()/', $sql, $resultat)) {
if (isset($resultat[1])) {
$requete['table_nom'] = $resultat[1];
}
$requete['type'] = 'insert';
} else if (preg_match('/(?i:UPDATE) +(.+) +(?i:SET)/', $sql, $resultat)) {
if (isset($resultat[1])) {
$requete['table_nom'] = $resultat[1];
}
$requete['type'] = 'update';
}
return $requete;
}
/**
* Reads (and decompresses) a (compressed) file into a string
*
* Origine : fonction provenant de PhpMyAdmin version 2.6.0-pl1
* Licence : GNU
* Auteurs : voir le fichier Documentation.txt ou Documentation.html de PhpMyAdmin.
*
* @param string the path to the file
* @param string the MIME type of the file, if empty MIME type is autodetected
*
* @global array the phpMyAdmin configuration
*
* @return string the content of the file or
* boolean FALSE in case of an error.
*/
function PMA_readFile($path, $mime = '')
{
global $cfg;
 
if (!file_exists($path)) {
return FALSE;
}
switch ($mime) {
case '':
$file = @fopen($path, 'rb');
if (!$file) {
return FALSE;
}
$test = fread($file, 3);
fclose($file);
if ($test[0] == chr(31) && $test[1] == chr(139)) return PMA_readFile($path, 'application/x-gzip');
if ($test == 'BZh') return PMA_readFile($path, 'application/x-bzip');
return PMA_readFile($path, 'text/plain');
case 'text/plain':
$file = @fopen($path, 'rb');
if (!$file) {
return FALSE;
}
$content = fread($file, filesize($path));
fclose($file);
break;
case 'application/x-gzip':
if ($cfg['GZipDump'] && @function_exists('gzopen')) {
$file = @gzopen($path, 'rb');
if (!$file) {
return FALSE;
}
$content = '';
while (!gzeof($file)) {
$content .= gzgetc($file);
}
gzclose($file);
} else {
return FALSE;
}
break;
case 'application/x-bzip':
if ($cfg['BZipDump'] && @function_exists('bzdecompress')) {
$file = @fopen($path, 'rb');
if (!$file) {
return FALSE;
}
$content = fread($file, filesize($path));
fclose($file);
$content = bzdecompress($content);
} else {
return FALSE;
}
break;
default:
return FALSE;
}
return $content;
}
/* +--Fin du code ---------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.6 2006/04/28 12:41:49 florian
* corrections erreurs chemin
*
* Revision 1.5 2005/09/23 14:20:23 florian
* nouvel habillage installateur, plus correction de quelques bugs
*
* Revision 1.4 2004/10/25 16:26:56 jpm
* Ajout de la gestion des requêtes de type alter et update.
*
* Revision 1.3 2004/10/19 16:47:06 jpm
* Modification de la gestion du texte de sortie dans la fonction testerConfig().
*
* Revision 1.2 2004/10/15 18:28:44 jpm
* Ajout de fonction utilisée pour l'installation de Papyrus.
*
* Revision 1.1 2004/06/16 14:34:12 jpm
* Changement de nom de Génésia en Papyrus.
* Changement de l'arborescence.
*
* +--Fin du code ----------------------------------------------------------------------------------------+
*/
?>