Subversion Repositories Applications.papyrus

Compare Revisions

No changes between revisions

Ignore whitespace Rev 328 → Rev 458

/trunk/papyrus/applications/installateur/instal_base_de_donnees.inc.php
32,7 → 32,7
// | (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.11 2004-11-03 17:31:13 jpm Exp $
// CVS : $Id: instal_base_de_donnees.inc.php,v 1.12 2005-09-23 14:20:23 florian Exp $
/**
* Page de création de la base de données de Papyrus.
*
47,7 → 47,7
*@author Eric FELDSTEIN
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.11 $ $Date: 2004-11-03 17:31:13 $
*@version $Revision: 1.12 $ $Date: 2005-09-23 14:20:23 $
// +------------------------------------------------------------------------------------------------------+
**/
 
81,7 → 81,7
// +------------------------------------------------------------------------------------------------------+
 
// Affichage d'informations...
$sortie .= '<p class="etape_numero"><strong>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</strong></p>'."\n";
$sortie .= '<br /><h1>Etape n°'.$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;
88,75 → 88,74
$sortie_verif = '';
if ($_GET['installation'] == 'verif_bdd') {
// Test de la configuration à la base de données
$sortie_verif = ' <h2>Test de la configuration de la base de données</h2>'."\n";
$sortie_verif = ' <br /><h2>Test de la configuration de la base de données</h2>'."\n";
$dblink = @mysql_connect($bdd['PAP_BDD_SERVEUR'], $bdd['PAP_BDD_UTILISATEUR'], $bdd['PAP_BDD_MOT_DE_PASSE']);
$erreur = testerConfig( $sortie_verif, 'Test connexion MySQL ...', $dblink,
'Le nom du serveur, le nom d\'utilisateur ou le mot de passe sont érronés!', 1, $erreur);
$erreur = testerConfig($sortie_verif, 'Recherche base de donn&eacute;es ...', @mysql_select_db($bdd['PAP_BDD_NOM'], $dblink),
'La base de donn&eacute;es que vous avez choisie n\'existe pas, vous devez la cr&eacute;er avant d\'installer Papyrus !', 1, $erreur);
$erreur = testerConfig($sortie_verif, '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érifer vos paramêtres.', 1, $erreur);
$sortie_verif .= '<br />'."\n";
// 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.1;
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.1;
}
if (!defined('GEN_VERSION')) {
$version_maj = 0.1;
} else {
$version_maj = GEN_VERSION + 0;
}
$sortie_verif .= '<h2>Insertion des informations dans la base de données</h2>';
$sortie_verif .= '<div class="zone_requete">';
for ( $version = $version_actuelle; $version <= $version_maj; $version = $version + 0.1) {
//Insertion des requêtes présentes dans le fichier sql
$sortie_verif .= '<h2>Insertion des données du fichier sql version '.$version.'</h2>';
$sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
$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éation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Déjà créée ?', 0, $erreur);
} else if ($requete_type == 'alter') {
$erreur = testerConfig( $sortie_verif, 'Modification structure table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Déjà modifiée ?', 0, $erreur);
} else if ($requete_type == 'insert') {
$erreur = testerConfig( $sortie_verif, 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Données déjà présente ?', 0, $erreur);
}
}
switch ($version) {
case 0.1:// Nouvelle installation de Papyrus 0.1
//Insertion des requêtes dépendant du formulaire d'installation
$sortie_verif .= '<h2>Insertion des données dépendant du formulaire précé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ées déjà pré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");';
$erreur = testerConfig($sortie_verif, 'Insertion de l\'authentification...', @mysql_query($requete_auth, $dblink),
'Données déjà présente ?', 0, $erreur);
break;
case 0.2:// Mise à jour vers Papyrus 0.2
// Rien de spécifique, tout est dans le fichier sql.
break;
}
}
$sortie_verif .= '</div>';
}
if (!defined('GEN_VERSION')) {
$version_maj = 0.1;
} else {
$version_maj = GEN_VERSION + 0;
}
$sortie_verif .= '<h2>Insertion des informations dans la base de données</h2>';
$sortie_verif .= '<div class="zone_requete">';
for ( $version = $version_actuelle; $version <= $version_maj; $version = $version + 0.1) {
//Insertion des requêtes présentes dans le fichier sql
$sortie_verif .= '<h2>Insertion des données du fichier sql version '.$version.'</h2>';
$sql_contenu = PMA_readFile(INSTAL_CHEMIN_SQL.'papyrus_v'.$version.'.sql');
$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éation table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Déjà créée ?', 0, $erreur);
} else if ($requete_type == 'alter') {
$erreur = testerConfig( $sortie_verif, 'Modification structure table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Déjà modifiée ?', 0, $erreur);
} else if ($requete_type == 'insert') {
$erreur = testerConfig( $sortie_verif, 'Insertion table '.$table_nom.'...', @mysql_query($value['query'], $dblink),
'Données déjà présente ?', 0, $erreur);
}
}
switch ($version) {
case 0.1:// Nouvelle installation de Papyrus 0.1
//Insertion des requêtes dépendant du formulaire d'installation
$sortie_verif .= '<h2>Insertion des données dépendant du formulaire précé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ées déjà pré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");';
$erreur = testerConfig($sortie_verif, 'Insertion de l\'authentification...', @mysql_query($requete_auth, $dblink),
'Données déjà présente ?', 0, $erreur);
break;
case 0.2:// Mise à jour vers Papyrus 0.2
// Rien de spécifique, tout est dans le fichier sql.
break;
}
}
$sortie_verif .= '</div>';
}
 
// Gestion de l'affichage de sortie
204,7 → 203,7
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_bdd" method="post">';
$sortie_form .= ' <ul>'."\n";
$sortie_form .= '<li><h2>Configuration de la base de donn&eacute;es</h2></li>'."\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".
219,7 → 218,7
'</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">Non de l\'utilisateur MySQL :</label>'.
'<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".
236,6 → 235,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* 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.
*
/trunk/papyrus/applications/installateur/instal_preference.inc.php
31,7 → 31,7
// | (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.9 2005-04-12 16:09:45 jpm Exp $
// CVS : $Id: instal_preference.inc.php,v 1.10 2005-09-23 14:20:23 florian Exp $
/**
* Page d'initialisation de l'installation de Papyrus.
*
45,7 → 45,7
*@author Patrick PAUL
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $ $Date: 2005-04-12 16:09:45 $
*@version $Revision: 1.10 $ $Date: 2005-09-23 14:20:23 $
// +------------------------------------------------------------------------------------------------------+
**/
 
56,7 → 56,7
$num_etape = 1;
 
// Initialisation du tableau contenant les valeurs de configuration de la base de données
$tableau = array('ADMIN_PRENOM' => '', 'ADMIN_NOM' => '', 'ADMIN_LOGIN' => '', 'ADMIN_MAIL' => '', 'ADMIN_MDP_01' => '',
$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])) {
81,12 → 81,12
// +------------------------------------------------------------------------------------------------------+
 
// Affichage d'informations...
$sortie .= '<p class="etape_numero"><strong>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</strong></p>'."\n";
$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>'."\n";
'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' ) {
101,9 → 101,6
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_LOGIN'])) {
$sortie_verif .= '<p class="erreur">Le champ "Login" 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";
}
120,15 → 117,15
if (!isset($sortie_verif) && empty($sortie_verif)) {
// Premier appel du fichier...
$sortie .= creerFormulaire($pref);
$sortie .= '<li><input type="submit" value="Tester" /></li>'."\n";
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$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 .= '<li><input type="submit" value="Tester à nouveau" /></li>'."\n";
$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
135,9 → 132,9
$sortie .= creerFormulaire($pref, true);
$sortie .= ' </ul>'."\n";
$sortie .= ' </form>';
$sortie .= ' <p class="etape_info">A l\'&eacute;tape suivante, le programme d\'installation va essayer de configurer '.
$sortie .= ' <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 action="'.donnerUrlCourante().'?installation=form_bdd" method="POST" />'."\n";
$sortie .= ' <form 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";
153,12 → 150,12
$disabled = ' disabled="disabled" ';
}
$sortie_form = '';
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_pref" method="post">';
$sortie_form .= ' <ul>'."\n";
$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><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'].'" />'.
168,10 → 165,6
'<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_login">Login :</label>'.
'<input id="admin_login"'.$disabled.'type="text" size="30" name="pref[ADMIN_LOGIN]" value="'.$pref['ADMIN_LOGIN'].'" />'.
'</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";
190,7 → 183,7
'</select>'.
'</li>'."\n";
}
$sortie_form .= '<li><h2>Configuration de l\'URL</h2></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".
239,6 → 232,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* 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.
*
/trunk/papyrus/applications/installateur/bibliotheque/instal_installation.fonct.php
19,7 → 19,7
// | 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.4 2004-10-25 16:26:56 jpm Exp $
// CVS : $Id: instal_installation.fonct.php,v 1.5 2005-09-23 14:20:23 florian Exp $
/**
* Bibliothèque des fonctions de l'application Installateur de Papyrus.
*
33,7 → 33,7
//Autres auteurs :
*@author aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.4 $ $Date: 2004-10-25 16:26:56 $
*@version $Revision: 1.5 $ $Date: 2005-09-23 14:20:23 $
*/
 
// +------------------------------------------------------------------------------------------------------+
43,304 → 43,307
 
/**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
* 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">OK</span><br />'."\n";
return 0;
} else {
$sortie .= '<span class="failed">ECHEC</span>';
if ($texte_erreur) {
$sortie .= ': '.$texte_erreur;
}
$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();
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;
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 .= ' <span class="erreur">'.$texte_erreur.'</span>';
}
$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();
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.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.
*
*
* $Log: not supported by cvs2svn $
* 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 ----------------------------------------------------------------------------------------+
*/
?>
/trunk/papyrus/applications/installateur/installateur.php
19,7 → 19,7
// | 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.9 2004-10-27 11:43:32 jpm Exp $
// CVS : $Id: installateur.php,v 1.10 2005-09-23 14:20:23 florian Exp $
/**
* Application Installateur de Papyrus.
*
32,7 → 32,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $ $Date: 2004-10-27 11:43:32 $
*@version $Revision: 1.10 $ $Date: 2005-09-23 14:20:23 $
// +------------------------------------------------------------------------------------------------------+
**/
 
39,130 → 39,134
// +------------------------------------------------------------------------------------------------------+
// | 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';
// 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être 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 .= ' <title>Installation de Papyrus</title>'."\n";
$sortie .= ' <style type="text/css">'."\n";
$sortie .= ' p, body, td, li, input, select, textarea { font-family: Verdana; font-size: 13px; }'."\n";
$sortie .= ' h1 { font-size: 1.8em; text-align: center; color: #0C6628; }'."\n";
$sortie .= ' h2 { font-size: 1.2em; text-align: left; color: #0C6628; }'."\n";
$sortie .= ' input { color: #0C6628; }'."\n";
$sortie .= ' form ul { list-style-type: none; padding : 0px; }'."\n";
$sortie .= ' form ul li { clear:both;text-align: left; padding-left: 0px; margin-left: 0px; }'."\n";
$sortie .= ' form ul li label { float: left; width: 175px; text-align: left; }'."\n";
$sortie .= ' li { margin: 5px 5px 5px 5px; }'."\n";
$sortie .= ' a { color: #0000FF; }'."\n";
$sortie .= ' .ok { color: #008800; font-weight: bold; }'."\n";
$sortie .= ' .failed { color: #880000; font-weight: bold; }'."\n";
$sortie .= ' .erreur { color: red; font-weight: bold;}'."\n";
$sortie .= ' .zone_requete { height: 300px; width: 550px; overflow: scroll;}'."\n";
$sortie .= ' .etape_info { margin: 5px 10% 5px 10%; padding: 3px; text-align: center; background-color: #92C492; border: 1px dashed black; }'."\n";
$sortie .= ' .etape_numero { width: 200px; text-align: center; padding: 3px; font-size: 1.2em; border: 1px dotted black; color: #0C6628;}'."\n";
$sortie .= ' #fichier_config { background-color: #EEEEEE; padding: 10px 10px;}'."\n";
$sortie .= ' </style>'."\n";
$sortie .= ' </head>'."\n";
$sortie .= ' <body>'."\n";
$sortie .= ' <h1>Installation de Papyrus</h1></h1>'."\n";
// Message situation de l'installation
if (defined('PAP_VERSION')) {
$sortie .= '<p>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 <b>mettre &agrave; jour</b> Papyrus pour la version '.
INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez revoir vos informations de configuration ci-dessous.</p>'."\n";
} else {
$sortie .= '<p>Vous &ecirc;tes sur le point d\'installer Papyrus '.INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez configurer votre Papyrus en remplissant les formulaires étape par étape.</p>'."\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 .= ' </body>'."\n";
$sortie .= '</html>';
return $sortie;
}
function afficherContenuCorps()
{
// Entêtre 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>'."\n";
$sortie .= ' <div id="container">'."\n";
$sortie .= ' <div id="zone_bandeau" >'."\n";
$sortie .= ' <div id="logo">'."\n";
$sortie .= ' <a href="/" title="Retour en page d\'accueil">'."\n";
$sortie .= ' <img src="papyrus/applications/installateur/presentations/images/logo_papyrus.png" width="183" height="63" alt="Logo Papyrus" />'."\n";
$sortie .= ' </a>'."\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>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 <b>mettre &agrave; jour</b> Papyrus pour la version '.
INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez revoir vos informations de configuration ci-dessous.</p>'."\n";
} else {
$sortie .= '<p>Vous &ecirc;tes sur le point d\'installer Papyrus '.INSTAL_VERSION_NOUVELLE.'.<br />'.
'Veuillez configurer votre Papyrus en remplissant les formulaires étape par étape.</p>'."\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 .= ' <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;<a href="http://www.tela-botanica.org/">Tela Botanica</a> et <a href="http://www.ecole-et-nature.org/">Réseau Ecole et Nature</a> / 2004-2006'."\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.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 Génésia en Papyrus.
* Changement de l'arborescence.
*
* Revision 1.6 2004/04/22 08:25:48 jpm
* Transformation de $GS_GLOBAL en $_GEN_commun.
* $Log: not supported by cvs2svn $
* 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 Génésia 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.
*
/trunk/papyrus/applications/installateur/presentations/styles/installateur.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;}
/trunk/papyrus/applications/installateur/presentations/images/logo-xhtml11.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/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
/trunk/papyrus/applications/installateur/presentations/images/deco_menu.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/papyrus/applications/installateur/presentations/images/deco_menu.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/papyrus/applications/installateur/presentations/images/picto.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/papyrus/applications/installateur/presentations/images/picto.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/papyrus/applications/installateur/presentations/images/grass.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/papyrus/applications/installateur/presentations/images/grass.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/papyrus/applications/installateur/presentations/images/logo-firefox.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/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
/trunk/papyrus/applications/installateur/presentations/images/logo_papyrus.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/papyrus/applications/installateur/presentations/images/logo_papyrus.png
New file
Property changes:
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/trunk/papyrus/applications/installateur/presentations/images/logo-css.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/trunk/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
/trunk/papyrus/applications/installateur/instal_fichier.inc.php
32,7 → 32,7
// | (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.9 2005-04-12 16:09:45 jpm Exp $
// CVS : $Id: instal_fichier.inc.php,v 1.10 2005-09-23 14:20:23 florian Exp $
/**
* Page de création des fichiers nécessaire à l'installation de Papyrus.
*
46,7 → 46,7
*@author Patrick PAUL
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.9 $ $Date: 2005-04-12 16:09:45 $
*@version $Revision: 1.10 $ $Date: 2005-09-23 14:20:23 $
// +------------------------------------------------------------------------------------------------------+
**/
 
89,7 → 89,7
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
// Affichage d'informations...
$sortie .= '<p class="etape_numero"><strong>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</strong></p>'."\n";
$sortie .= '<br /><h1>Etape n°'.$num_etape.' sur '.INSTAL_NBRE_ETAPE.'.</h1>'."\n";
 
// Correction éventuelle des informations saisies par l'utilisateur
if (ereg('^[\/\\]', $fichier['PAP_FTP_RACINE']) == false) {
102,7 → 102,7
$sortie_verif = '';
if ($_GET['installation'] == 'verif_fichier') {
// Test de la configuration du FTP
$sortie_verif .= ' <h2>Test de la connexion FTP</h2>'."\n";
$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êtres FTP saisies ne permettent pas l\'identification !', 1, $erreur);
128,36 → 128,37
}
}
$configCode .= implode("\n", $entries)."\n\n?>";
// 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, où 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 ê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);
}
// Nous écrivons le fichier de config sur le disque
$fp = @fopen($url_ftp, 'w');
$txt_ecriture_conf = '&Eacute;criture sur le serveur de <tt>'.$chemin_fpt_absolu.'</tt>...';
$txt_ecriture_conf_erreur = '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.$chemin_fpt_absolu.
'</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
'<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire '.
'<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
'correctement.</p>';
$txt_ecriture_conf_erreur .= '<div id="fichier_config">'."\n";
$txt_ecriture_conf_erreur .= '<xmp>'.$configCode.'</xmp>'."\n";
$txt_ecriture_conf_erreur .= '</div>'."\n";
$erreur = testerConfig($sortie_verif, $txt_ecriture_conf, $fp, $txt_ecriture_conf_erreur, 1, $erreur);
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, où 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 ê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);
}
// Nous écrivons le fichier de config sur le disque
$fp = @fopen($url_ftp, 'w');
$txt_ecriture_conf = '&Eacute;criture sur le serveur de <tt>'.$chemin_fpt_absolu.'</tt>...';
$txt_ecriture_conf_erreur = '<p><span class="failed">AVERTISSEMENT:</span> Le fichier de configuration <tt>'.$chemin_fpt_absolu.
'</tt> n\'a pu &ecirc;tre cr&eacute;&eacute;. Veuillez vous assurez que votre serveur a les droits '.
'd\'acc&egrave;s en &eacute;criture pour ce fichier. Si pour une raison quelconque vous ne pouvez pas '.
'faire &ccedil;a vous devez copier les informations suivantes dans un fichier et les transf&eacute;rer '.
'au moyen d\'un logiciel de transfert de fichier (ftp) sur le serveur dans un fichier '.
'<tt>pap_config.inc.php</tt> directement dans le r&eacute;pertoire <tt>configuration</tt> du répertoire '.
'<tt>papyrus</tt> de Papyrus. Une fois que vous aurez fait cela, votre site Papyrus devrait fonctionner '.
'correctement.</p>';
$txt_ecriture_conf_erreur .= '<div id="fichier_config">'."\n";
$txt_ecriture_conf_erreur .= '<xmp>'.$configCode.'</xmp>'."\n";
$txt_ecriture_conf_erreur .= '</div>'."\n";
$erreur = testerConfig($sortie_verif, $txt_ecriture_conf, $fp, $txt_ecriture_conf_erreur, 1, $erreur);
}
}
 
// Gestion de l'affichage
204,9 → 205,8
}
$sortie_form .= ' <form action="'.donnerUrlCourante().'?installation=verif_fichier" method="post">';
$sortie_form .= ' <ul>'."\n";
$sortie_form .= '<li><h2>Configuration du FTP et des chemins d\'accès</h2></li>'."\n";
$sortie_form .= '<li>Le nom de la machine à laquelle vous vous connectez pour accéder à votre dépôt FTP. En '.
'g&eacute;n&eacute;ral c\'est le nom de domaine du site où vous voulez installer Papyrus.</li>'."\n";
$sortie_form .= '<li><br /><h2>Configuration du FTP et des chemins d\'accès</h2></li>'."\n";
$sortie_form .= '<li>Entrer le nom de dommaine pour accéder à votre dépô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'].'" />'.
223,10 → 223,10
'<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 de l\'utilisateur pour le serveur FTP :</label>'.
'<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 connecter par FTP sur le serveur où vous avez déposé les fichiers de Papyrus, le '.
$sortie_form .= '<li>Lorsque vous vous connectez par FTP sur le serveur où vous avez déposé les fichiers de Papyrus, le '.
'dossier le plus haut auquel vous pouvez accé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";
245,6 → 245,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* 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.
*