| 434 | 
           ddelon | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           /*vim: set expandtab tabstop=4 shiftwidth=4: */
  | 
        
        
            | 
            | 
           3 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           4 | 
           // | PHP version 4.1                                                                                      |
  | 
        
        
            | 
            | 
           5 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           6 | 
           // | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
  | 
        
        
            | 
            | 
           7 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           8 | 
           // | This file is part of Papyrus.                                                                        |
  | 
        
        
            | 
            | 
           9 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           10 | 
           // | Foobar is free software; you can redistribute it and/or modify                                       |
  | 
        
        
            | 
            | 
           11 | 
           // | it under the terms of the GNU General Public License as published by                                 |
  | 
        
        
            | 
            | 
           12 | 
           // | the Free Software Foundation; either version 2 of the License, or                                    |
  | 
        
        
            | 
            | 
           13 | 
           // | (at your option) any later version.                                                                  |
  | 
        
        
            | 
            | 
           14 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           15 | 
           // | Foobar is distributed in the hope that it will be useful,                                            |
  | 
        
        
            | 
            | 
           16 | 
           // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
  | 
        
        
            | 
            | 
           17 | 
           // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
  | 
        
        
            | 
            | 
           18 | 
           // | GNU General Public License for more details.                                                         |
  | 
        
        
            | 
            | 
           19 | 
           // |                                                                                                      |
  | 
        
        
            | 
            | 
           20 | 
           // | You should have received a copy of the GNU General Public License                                    |
  | 
        
        
            | 
            | 
           21 | 
           // | along with Foobar; if not, write to the Free Software                                                |
  | 
        
        
            | 
            | 
           22 | 
           // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
  | 
        
        
            | 
            | 
           23 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
           | 970 | 
           florian | 
           24 | 
           // CVS : $Id: adwi_wikini.fonct.php,v 1.10 2006-10-05 08:56:12 florian Exp $
  | 
        
        
           | 434 | 
           ddelon | 
           25 | 
           /**
  | 
        
        
            | 
            | 
           26 | 
           * Contient les fonctions de l'application gestion des Wikini
  | 
        
        
            | 
            | 
           27 | 
           *
  | 
        
        
            | 
            | 
           28 | 
           *
  | 
        
        
            | 
            | 
           29 | 
           *
  | 
        
        
            | 
            | 
           30 | 
           *
  | 
        
        
            | 
            | 
           31 | 
           *@package Admin_Wikini
  | 
        
        
            | 
            | 
           32 | 
           *@subpackage Fonctions
  | 
        
        
            | 
            | 
           33 | 
           //Auteur original :
  | 
        
        
            | 
            | 
           34 | 
           *@author        David Delon <david.delon@tela-botanica.org>
  | 
        
        
            | 
            | 
           35 | 
           //Autres auteurs :
  | 
        
        
            | 
            | 
           36 | 
           *@author        Aucun
  | 
        
        
            | 
            | 
           37 | 
           *@copyright     Tela-Botanica 2000-2004
  | 
        
        
           | 970 | 
           florian | 
           38 | 
           *@version       $Revision: 1.10 $
  | 
        
        
           | 434 | 
           ddelon | 
           39 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           40 | 
           */
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           43 | 
           // |                                           LISTE de FONCTIONS                                         |
  | 
        
        
            | 
            | 
           44 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           45 | 
              | 
        
        
            | 
            | 
           46 | 
           /* CRUD */
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
           /**
  | 
        
        
            | 
            | 
           49 | 
            *
  | 
        
        
            | 
            | 
           50 | 
            * D du CRUD
  | 
        
        
            | 
            | 
           51 | 
            * @return
  | 
        
        
            | 
            | 
           52 | 
            */
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
            | 
            | 
           54 | 
           function adwi_supprimer_wikini($id_wikini, &$db) {
  | 
        
        
           | 439 | 
           ddelon | 
           55 | 
              | 
        
        
            | 
            | 
           56 | 
           // Suppression enregistrement
  | 
        
        
            | 
            | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
           	$valeur = adwi_valeurs_par_defaut($id_wikini,$db );
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
           | 434 | 
           ddelon | 
           60 | 
               $requete = "delete from gen_wikini where gewi_id_wikini =$id_wikini" ;
  | 
        
        
            | 
            | 
           61 | 
               $resultat = $db->query ($requete) ;
  | 
        
        
           | 439 | 
           ddelon | 
           62 | 
              | 
        
        
            | 
            | 
           63 | 
           // Suppression tables Wikini ...
  | 
        
        
           | 436 | 
           ddelon | 
           64 | 
              | 
        
        
           | 439 | 
           ddelon | 
           65 | 
               include_once ADWI_CHEMIN_BIBLIOTHEQUE.'gestion_wikini.class.php' ;
  | 
        
        
            | 
            | 
           66 | 
              | 
        
        
            | 
            | 
           67 | 
               $g_wikini = new gestion_wikini($db);
  | 
        
        
            | 
            | 
           68 | 
              | 
        
        
            | 
            | 
           69 | 
           	if ((!isset($valeur['table_prefix'])) || (empty($config_wikini['$valeur'])))  {
  | 
        
        
            | 
            | 
           70 | 
           		$valeur['table_prefix'] = $valeur['code_alpha_wikini'];
  | 
        
        
            | 
            | 
           71 | 
           	}
  | 
        
        
            | 
            | 
           72 | 
              | 
        
        
            | 
            | 
           73 | 
            	$g_wikini->suppression_tables ($valeur['table_prefix']);
  | 
        
        
            | 
            | 
           74 | 
              | 
        
        
            | 
            | 
           75 | 
           	if (GEN_FTP_UTILISE) {
  | 
        
        
            | 
            | 
           76 | 
           	    /** Inclusion bibliothèque de PEAR gérant le FTP.*/
  | 
        
        
            | 
            | 
           77 | 
           	    require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'Net/FTP.php';
  | 
        
        
            | 
            | 
           78 | 
              | 
        
        
            | 
            | 
           79 | 
           	    // création de l'objet pear ftp
  | 
        
        
            | 
            | 
           80 | 
           	    $objet_pear_ftp = new Net_FTP(PAP_FTP_SERVEUR, PAP_FTP_PORT);
  | 
        
        
            | 
            | 
           81 | 
           	    // création de la connexion
  | 
        
        
            | 
            | 
           82 | 
           	    $ftp_conn = $objet_pear_ftp->connect(PAP_FTP_SERVEUR, PAP_FTP_PORT);
  | 
        
        
            | 
            | 
           83 | 
           	    // identification
  | 
        
        
            | 
            | 
           84 | 
           	    $ftp_login_result = $objet_pear_ftp->login(PAP_FTP_UTILISATEUR, PAP_FTP_MOT_DE_PASSE);
  | 
        
        
            | 
            | 
           85 | 
              | 
        
        
            | 
            | 
           86 | 
           	    // Gestion des erreurs ftp
  | 
        
        
            | 
            | 
           87 | 
           	    if ((PEAR::isError($ftp_conn) || PEAR::isError($ftp_login_result))) {
  | 
        
        
            | 
            | 
           88 | 
           	        $message =  '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de se connecter par ftp.<br />'.
  | 
        
        
            | 
            | 
           89 | 
           	                    'Serveur : '. PAP_FTP_SERVEUR .'<br />'.
  | 
        
        
            | 
            | 
           90 | 
           	                    'Utilisateur : '. PAP_FTP_UTILISATEUR .'<br />'.
  | 
        
        
            | 
            | 
           91 | 
           	                    'Erreur connexion : '.$ftp_conn->getMessage().'<br />'.
  | 
        
        
            | 
            | 
           92 | 
           	                    'Erreur login : '.$ftp_login_result->getMessage().'<br />'.
  | 
        
        
            | 
            | 
           93 | 
           	                    'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           94 | 
           	                    'Fichier n° : '. __FILE__ .'<br /><p>';
  | 
        
        
            | 
            | 
           95 | 
           	        print  $message;
  | 
        
        
            | 
            | 
           96 | 
           	    }
  | 
        
        
            | 
            | 
           97 | 
              | 
        
        
            | 
            | 
           98 | 
           	    $chemin_wikini = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP;
  | 
        
        
           | 913 | 
           ddelon | 
           99 | 
              | 
        
        
            | 
            | 
           100 | 
           	    if ($valeur['code_alpha_wikini']!='') {
  | 
        
        
           | 439 | 
           ddelon | 
           101 | 
              | 
        
        
           | 913 | 
           ddelon | 
           102 | 
           		    $resultat = $objet_pear_ftp->rm($chemin_wikini, true);
  | 
        
        
            | 
            | 
           103 | 
              | 
        
        
            | 
            | 
           104 | 
           		    if (PEAR::isError($resultat)) {
  | 
        
        
            | 
            | 
           105 | 
           		        $message =  '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
  | 
        
        
            | 
            | 
           106 | 
           		                    'Wikini : '. $chemin_wikini .'<br />'.
  | 
        
        
            | 
            | 
           107 | 
           		                    'Erreur origine : '. $resultat->getMessage() .'<br />'.
  | 
        
        
            | 
            | 
           108 | 
           		                    'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           109 | 
           		                    'Fichier n° : '. __FILE__ .'<br /></p>';
  | 
        
        
            | 
            | 
           110 | 
           		            print $message;
  | 
        
        
            | 
            | 
           111 | 
           		    }
  | 
        
        
            | 
            | 
           112 | 
           	    }
  | 
        
        
           | 439 | 
           ddelon | 
           113 | 
              | 
        
        
            | 
            | 
           114 | 
           	}
  | 
        
        
            | 
            | 
           115 | 
              | 
        
        
            | 
            | 
           116 | 
           // else {
  | 
        
        
            | 
            | 
           117 | 
              | 
        
        
            | 
            | 
           118 | 
           // Gestion sans FTP à faire
  | 
        
        
            | 
            | 
           119 | 
              | 
        
        
            | 
            | 
           120 | 
           	//}
  | 
        
        
            | 
            | 
           121 | 
              | 
        
        
            | 
            | 
           122 | 
              | 
        
        
            | 
            | 
           123 | 
              | 
        
        
           | 434 | 
           ddelon | 
           124 | 
           }
  | 
        
        
            | 
            | 
           125 | 
              | 
        
        
            | 
            | 
           126 | 
           /**
  | 
        
        
            | 
            | 
           127 | 
            *
  | 
        
        
            | 
            | 
           128 | 
            *
  | 
        
        
            | 
            | 
           129 | 
            * @return
  | 
        
        
            | 
            | 
           130 | 
            */
  | 
        
        
            | 
            | 
           131 | 
              | 
        
        
           | 436 | 
           ddelon | 
           132 | 
           function adwi_valeurs_par_code_alpha($code_alpha_wikini, &$db) {
  | 
        
        
            | 
            | 
           133 | 
              | 
        
        
            | 
            | 
           134 | 
           	$requete = "select * from gen_wikini where gewi_code_alpha_wikini='". $code_alpha_wikini."'" ;
  | 
        
        
            | 
            | 
           135 | 
               $resultat = $db->query ($requete) ;
  | 
        
        
            | 
            | 
           136 | 
            	if (DB::isError ($resultat)) {
  | 
        
        
            | 
            | 
           137 | 
                   $GLOBALS['_GEN_commun']['debogage_erreur']->gererErreur(E_USER_WARNING, "Echec de la requete : $requete<br />".$resultat->getMessage(),
  | 
        
        
            | 
            | 
           138 | 
                                                                                   __FILE__, __LINE__, 'admin_wikini')   ;
  | 
        
        
            | 
            | 
           139 | 
                   return ;
  | 
        
        
            | 
            | 
           140 | 
               }
  | 
        
        
            | 
            | 
           141 | 
              | 
        
        
            | 
            | 
           142 | 
              | 
        
        
            | 
            | 
           143 | 
           	$ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
  | 
        
        
            | 
            | 
           144 | 
           	$resultat->free();
  | 
        
        
            | 
            | 
           145 | 
           	unset ($requete, $resultat);
  | 
        
        
            | 
            | 
           146 | 
           	return adwi_valeurs_par_defaut($ligne->gewi_id_wikini,$db);
  | 
        
        
           | 439 | 
           ddelon | 
           147 | 
              | 
        
        
           | 436 | 
           ddelon | 
           148 | 
           }
  | 
        
        
            | 
            | 
           149 | 
              | 
        
        
            | 
            | 
           150 | 
              | 
        
        
           | 434 | 
           ddelon | 
           151 | 
           function adwi_valeurs_par_defaut($id_wikini, &$db) {
  | 
        
        
           | 439 | 
           ddelon | 
           152 | 
              | 
        
        
           | 434 | 
           ddelon | 
           153 | 
              | 
        
        
            | 
            | 
           154 | 
               // requete sur gen_wikin
  | 
        
        
            | 
            | 
           155 | 
              | 
        
        
            | 
            | 
           156 | 
               $requete = "select * from gen_wikini where gewi_id_wikini=$id_wikini" ;
  | 
        
        
            | 
            | 
           157 | 
               $resultat = $db->query ($requete) ;
  | 
        
        
            | 
            | 
           158 | 
               if (DB::isError ($resultat)) {
  | 
        
        
            | 
            | 
           159 | 
                   trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(), E_USER_WARNING) ;
  | 
        
        
            | 
            | 
           160 | 
                   return ;
  | 
        
        
            | 
            | 
           161 | 
               }
  | 
        
        
            | 
            | 
           162 | 
               $tableau_retour = array () ;
  | 
        
        
            | 
            | 
           163 | 
               $ligne = $resultat->fetchRow (DB_FETCHMODE_OBJECT) ;
  | 
        
        
            | 
            | 
           164 | 
              | 
        
        
            | 
            | 
           165 | 
               $tableau_retour['code_alpha_wikini'] = $ligne->gewi_code_alpha_wikini;
  | 
        
        
            | 
            | 
           166 | 
               $tableau_retour['bdd_hote'] = $ligne->gewi_bdd_hote ;
  | 
        
        
            | 
            | 
           167 | 
               $tableau_retour['bdd_nom'] = $ligne->gewi_bdd_nom;
  | 
        
        
            | 
            | 
           168 | 
               $tableau_retour['bdd_utilisateur'] = $ligne->gewi_bdd_utilisateur;
  | 
        
        
            | 
            | 
           169 | 
               $tableau_retour['bdd_mdp'] = $ligne->gewi_bdd_mdp;
  | 
        
        
            | 
            | 
           170 | 
               $tableau_retour['table_prefix'] = $ligne->gewi_table_prefix ;
  | 
        
        
            | 
            | 
           171 | 
               $tableau_retour['page'] = $ligne->gewi_page;
  | 
        
        
           | 437 | 
           ddelon | 
           172 | 
               $tableau_retour['chemin'] = $ligne->gewi_chemin ;
  | 
        
        
           | 434 | 
           ddelon | 
           173 | 
              | 
        
        
            | 
            | 
           174 | 
               unset ($requete, $resultat);
  | 
        
        
            | 
            | 
           175 | 
               return $tableau_retour ;
  | 
        
        
            | 
            | 
           176 | 
           }
  | 
        
        
            | 
            | 
           177 | 
              | 
        
        
            | 
            | 
           178 | 
           /**
  | 
        
        
            | 
            | 
           179 | 
            *
  | 
        
        
            | 
            | 
           180 | 
            * C du CRUD
  | 
        
        
           | 857 | 
           florian | 
           181 | 
            * @return int id_wikini_bdd
  | 
        
        
           | 434 | 
           ddelon | 
           182 | 
            */
  | 
        
        
            | 
            | 
           183 | 
              | 
        
        
            | 
            | 
           184 | 
              | 
        
        
           | 970 | 
           florian | 
           185 | 
           function insertion ($valeur, &$db) {
  | 
        
        
           | 434 | 
           ddelon | 
           186 | 
           	// Calcul dernier identifiant
  | 
        
        
            | 
            | 
           187 | 
               $id_wikini_bdd = SQL_obtenirNouveauId ($db, 'gen_wikini', 'gewi_id_wikini') ;
  | 
        
        
            | 
            | 
           188 | 
               $requete = "insert into gen_wikini set gewi_id_wikini ="
  | 
        
        
            | 
            | 
           189 | 
                           .$id_wikini_bdd.","
  | 
        
        
           | 436 | 
           ddelon | 
           190 | 
                           .requete_wikini($valeur) ;
  | 
        
        
           | 434 | 
           ddelon | 
           191 | 
               $resultat = $db->query ($requete) ;
  | 
        
        
            | 
            | 
           192 | 
               if (DB::isError ($resultat)) {
  | 
        
        
            | 
            | 
           193 | 
                   trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
  | 
        
        
            | 
            | 
           194 | 
               }
  | 
        
        
           | 439 | 
           ddelon | 
           195 | 
              | 
        
        
            | 
            | 
           196 | 
           	if (GEN_FTP_UTILISE) {
  | 
        
        
            | 
            | 
           197 | 
           	    /** Inclusion bibliothèque de PEAR gérant le FTP.*/
  | 
        
        
            | 
            | 
           198 | 
           	    require_once ADWI_CHEMIN_BIBLIOTHEQUE_PEAR.'Net/FTP.php';
  | 
        
        
            | 
            | 
           199 | 
              | 
        
        
            | 
            | 
           200 | 
           	    // création de l'objet pear ftp
  | 
        
        
            | 
            | 
           201 | 
           	    $objet_pear_ftp = new Net_FTP(PAP_FTP_SERVEUR, PAP_FTP_PORT);
  | 
        
        
            | 
            | 
           202 | 
           	    // création de la connexion
  | 
        
        
            | 
            | 
           203 | 
           	    $ftp_conn = $objet_pear_ftp->connect(PAP_FTP_SERVEUR, PAP_FTP_PORT);
  | 
        
        
            | 
            | 
           204 | 
           	    // identification
  | 
        
        
            | 
            | 
           205 | 
           	    $ftp_login_result = $objet_pear_ftp->login(PAP_FTP_UTILISATEUR, PAP_FTP_MOT_DE_PASSE);
  | 
        
        
            | 
            | 
           206 | 
              | 
        
        
            | 
            | 
           207 | 
           	    // Gestion des erreurs ftp
  | 
        
        
            | 
            | 
           208 | 
           	    if ((PEAR::isError($ftp_conn) || PEAR::isError($ftp_login_result))) {
  | 
        
        
            | 
            | 
           209 | 
           	        $message =  '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de se connecter par ftp.<br />'.
  | 
        
        
            | 
            | 
           210 | 
           	                    'Serveur : '. PAP_FTP_SERVEUR .'<br />'.
  | 
        
        
            | 
            | 
           211 | 
           	                    'Utilisateur : '. PAP_FTP_UTILISATEUR .'<br />'.
  | 
        
        
            | 
            | 
           212 | 
           	                    'Erreur connexion : '.$ftp_conn->getMessage().'<br />'.
  | 
        
        
            | 
            | 
           213 | 
           	                    'Erreur login : '.$ftp_login_result->getMessage().'<br />'.
  | 
        
        
            | 
            | 
           214 | 
           	                    'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           215 | 
           	                    'Fichier n° : '. __FILE__ .'<br /><p>';
  | 
        
        
            | 
            | 
           216 | 
           	        print  $message;
  | 
        
        
            | 
            | 
           217 | 
           	    }
  | 
        
        
            | 
            | 
           218 | 
           	    $objet_pear_ftp->mkdir(PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini']) ;
  | 
        
        
            | 
            | 
           219 | 
              | 
        
        
            | 
            | 
           220 | 
           	    $chemin_wikini_bibliotheque = ADWI_CHEMIN_BIBLIOTHEQUE_WIKINI;
  | 
        
        
            | 
            | 
           221 | 
           	    $chemin_wikini = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP;
  | 
        
        
            | 
            | 
           222 | 
              | 
        
        
           | 481 | 
           ddelon | 
           223 | 
           	    // Overwrite = fale (3eme parametre)
  | 
        
        
           | 439 | 
           ddelon | 
           224 | 
           	    $resultat = $objet_pear_ftp->putRecursive($chemin_wikini_bibliotheque, $chemin_wikini, false, FTP_BINARY);
  | 
        
        
            | 
            | 
           225 | 
              | 
        
        
            | 
            | 
           226 | 
           	    if (PEAR::isError($resultat)) {
  | 
        
        
            | 
            | 
           227 | 
           	        $message =  '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
  | 
        
        
            | 
            | 
           228 | 
           	                    'Fichier origine : '. $chemin_wikini_bibliotheque .'<br />'.
  | 
        
        
            | 
            | 
           229 | 
           	                    'Fichier copié : '. $chemin_wikini .'<br />'.
  | 
        
        
            | 
            | 
           230 | 
           	                    'Erreur origine : '. $resultat->getMessage() .'<br />'.
  | 
        
        
            | 
            | 
           231 | 
           	                    'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           232 | 
           	                    'Fichier n° : '. __FILE__ .'<br /></p>';
  | 
        
        
            | 
            | 
           233 | 
           	            print $message;
  | 
        
        
            | 
            | 
           234 | 
           	    }
  | 
        
        
            | 
            | 
           235 | 
           	}
  | 
        
        
            | 
            | 
           236 | 
              | 
        
        
            | 
            | 
           237 | 
           	// else {
  | 
        
        
            | 
            | 
           238 | 
              | 
        
        
            | 
            | 
           239 | 
           	// Gestion sans FTP à faire
  | 
        
        
            | 
            | 
           240 | 
              | 
        
        
            | 
            | 
           241 | 
           		//}
  | 
        
        
            | 
            | 
           242 | 
              | 
        
        
            | 
            | 
           243 | 
               // Creation tables wikini
  | 
        
        
            | 
            | 
           244 | 
              | 
        
        
            | 
            | 
           245 | 
               include_once ADWI_CHEMIN_BIBLIOTHEQUE.'gestion_wikini.class.php' ;
  | 
        
        
           | 954 | 
           florian | 
           246 | 
              | 
        
        
           | 439 | 
           ddelon | 
           247 | 
               $g_wikini = new gestion_wikini($db);
  | 
        
        
            | 
            | 
           248 | 
              | 
        
        
            | 
            | 
           249 | 
              | 
        
        
            | 
            | 
           250 | 
           	if ((!isset($valeur['table_prefix'])) || (empty($config_wikini['$valeur'])))  {
  | 
        
        
            | 
            | 
           251 | 
           		$valeur['table_prefix'] = $valeur['code_alpha_wikini'];
  | 
        
        
            | 
            | 
           252 | 
           	}
  | 
        
        
           | 954 | 
           florian | 
           253 | 
               $g_wikini->creation_tables($valeur['table_prefix']);
  | 
        
        
           | 439 | 
           ddelon | 
           254 | 
              | 
        
        
            | 
            | 
           255 | 
            	// Creation Wakka.config.php
  | 
        
        
            | 
            | 
           256 | 
              | 
        
        
            | 
            | 
           257 | 
            	$config_wikini = adwi_config_wikini($valeur['code_alpha_wikini'] ,$db );
  | 
        
        
            | 
            | 
           258 | 
              | 
        
        
            | 
            | 
           259 | 
              | 
        
        
            | 
            | 
           260 | 
           	$base_url=parse_url(PAP_URL);
  | 
        
        
            | 
            | 
           261 | 
           	$dirname_base_url=dirname($base_url['path']);
  | 
        
        
            | 
            | 
           262 | 
           	$config_base_url=$dirname_base_url.GEN_SEP.ADWI_CHEMIN_WIKINI.GEN_SEP.$config_wikini['code_alpha_wikini'].GEN_SEP."wakka.php?wiki=";
  | 
        
        
            | 
            | 
           263 | 
           	$config_base_url = str_replace("//", "/", $config_base_url);
  | 
        
        
            | 
            | 
           264 | 
              | 
        
        
            | 
            | 
           265 | 
              | 
        
        
            | 
            | 
           266 | 
           	$config = array(
  | 
        
        
            | 
            | 
           267 | 
               "wakka_version" => "0.1.1",
  | 
        
        
            | 
            | 
           268 | 
           	"wikini_version" => "0.4.3",
  | 
        
        
            | 
            | 
           269 | 
               'mysql_host'            => $config_wikini['bdd_hote'],
  | 
        
        
            | 
            | 
           270 | 
               'mysql_database'        => $config_wikini['bdd_nom'],
  | 
        
        
            | 
            | 
           271 | 
               'mysql_user'            => $config_wikini['bdd_utilisateur'],
  | 
        
        
            | 
            | 
           272 | 
               'mysql_password'        => $config_wikini['bdd_mdp'],
  | 
        
        
            | 
            | 
           273 | 
               'table_prefix'          => $config_wikini['table_prefix'],
  | 
        
        
            | 
            | 
           274 | 
               'root_page'             => $config_wikini['page'],
  | 
        
        
            | 
            | 
           275 | 
               'wakka_name'            => $config_wikini['code_alpha_wikini'],
  | 
        
        
            | 
            | 
           276 | 
               'base_url'              => $config_base_url,
  | 
        
        
            | 
            | 
           277 | 
               'rewrite_mode'          => '0',
  | 
        
        
            | 
            | 
           278 | 
               'meta_keywords'         => '',
  | 
        
        
            | 
            | 
           279 | 
               'meta_description'      => '',
  | 
        
        
            | 
            | 
           280 | 
               'action_path'           => 'actions',
  | 
        
        
            | 
            | 
           281 | 
               'handler_path'          => 'handlers',
  | 
        
        
            | 
            | 
           282 | 
               'header_action'         => 'header',
  | 
        
        
            | 
            | 
           283 | 
               'footer_action'         => 'footer',
  | 
        
        
            | 
            | 
           284 | 
               'navigation_links'      => 'DerniersChangements :: DerniersCommentaires :: ParametresUtilisateur',
  | 
        
        
            | 
            | 
           285 | 
               'referrers_purge_time'  => 24,
  | 
        
        
            | 
            | 
           286 | 
               'pages_purge_time'      => 90,
  | 
        
        
            | 
            | 
           287 | 
               'default_write_acl'     => '*',
  | 
        
        
            | 
            | 
           288 | 
               'default_read_acl'      => '*',
  | 
        
        
            | 
            | 
           289 | 
               'default_comment_acl'   => '*',
  | 
        
        
            | 
            | 
           290 | 
               'preview_before_save'   => '0');
  | 
        
        
            | 
            | 
           291 | 
              | 
        
        
            | 
            | 
           292 | 
              | 
        
        
            | 
            | 
           293 | 
              | 
        
        
            | 
            | 
           294 | 
           	// convert config array into PHP code
  | 
        
        
            | 
            | 
           295 | 
           	$configCode = "<?php\n// wakka.config.php créée ".strftime("%c")."\n// ne changez pas la wikini_version manuellement!\n\n\$wakkaConfig = array(\n";
  | 
        
        
            | 
            | 
           296 | 
           	foreach ($config as $k => $v)
  | 
        
        
            | 
            | 
           297 | 
           	{
  | 
        
        
            | 
            | 
           298 | 
           		$entries[] = "\t\"".$k."\" => \"".$v."\"";
  | 
        
        
            | 
            | 
           299 | 
           	}
  | 
        
        
            | 
            | 
           300 | 
           	$configCode .= implode(",\n", $entries).");\n?>";
  | 
        
        
            | 
            | 
           301 | 
              | 
        
        
            | 
            | 
           302 | 
              | 
        
        
            | 
            | 
           303 | 
           	$tempfn = tempnam("","");
  | 
        
        
            | 
            | 
           304 | 
           	$temp = fopen($tempfn, "w");
  | 
        
        
            | 
            | 
           305 | 
              | 
        
        
            | 
            | 
           306 | 
           	fwrite($temp, $configCode);
  | 
        
        
            | 
            | 
           307 | 
           	fclose($temp);
  | 
        
        
            | 
            | 
           308 | 
              | 
        
        
            | 
            | 
           309 | 
              | 
        
        
            | 
            | 
           310 | 
           	$fichier_config_source = $tempfn;
  | 
        
        
            | 
            | 
           311 | 
               $fichier_config_cible = PAP_FTP_RACINE.ADWI_CHEMIN_WIKINI.$valeur['code_alpha_wikini'].GEN_SEP."wakka.config.php";
  | 
        
        
            | 
            | 
           312 | 
              | 
        
        
            | 
            | 
           313 | 
               $resultat = $objet_pear_ftp->put($fichier_config_source, $fichier_config_cible, false, FTP_BINARY);
  | 
        
        
            | 
            | 
           314 | 
              | 
        
        
            | 
            | 
           315 | 
               if (PEAR::isError($resultat)) {
  | 
        
        
            | 
            | 
           316 | 
                   $message =  '<p class="pap_erreur"> ERREUR Papyrus admin : impossible de copier le wikini de reference par ftp.<br />'.
  | 
        
        
           | 832 | 
           florian | 
           317 | 
                               'Fichier origine : '. $chemin_wikini_bibliotheque .'<br />'.
  | 
        
        
           | 439 | 
           ddelon | 
           318 | 
                               'Fichier copié : '. $chemin_wikini .'<br />'.
  | 
        
        
            | 
            | 
           319 | 
                               'Erreur origine : '. $resultat->getMessage() .'<br />'.
  | 
        
        
            | 
            | 
           320 | 
                               'Ligne n° : '. __LINE__ .'<br />'.
  | 
        
        
            | 
            | 
           321 | 
                               'Fichier n° : '. __FILE__ .'<br /></p>';
  | 
        
        
            | 
            | 
           322 | 
                       print $message;
  | 
        
        
            | 
            | 
           323 | 
               }
  | 
        
        
            | 
            | 
           324 | 
              | 
        
        
            | 
            | 
           325 | 
           	$objet_pear_ftp->disconnect();
  | 
        
        
            | 
            | 
           326 | 
              | 
        
        
            | 
            | 
           327 | 
           	unlink($tempfn);
  | 
        
        
            | 
            | 
           328 | 
              | 
        
        
           | 434 | 
           ddelon | 
           329 | 
           }
  | 
        
        
            | 
            | 
           330 | 
              | 
        
        
            | 
            | 
           331 | 
           /**
  | 
        
        
            | 
            | 
           332 | 
            *
  | 
        
        
            | 
            | 
           333 | 
            * U du CRUD
  | 
        
        
            | 
            | 
           334 | 
            * @return
  | 
        
        
            | 
            | 
           335 | 
            */
  | 
        
        
            | 
            | 
           336 | 
              | 
        
        
            | 
            | 
           337 | 
              | 
        
        
            | 
            | 
           338 | 
           function mise_a_jour ($valeur, &$db) {
  | 
        
        
           | 436 | 
           ddelon | 
           339 | 
               $requete = "update gen_wikini set ".requete_wikini($valeur)
  | 
        
        
           | 434 | 
           ddelon | 
           340 | 
                           .' where gewi_id_wikini ='.$GLOBALS['id_wikini'] ;
  | 
        
        
            | 
            | 
           341 | 
               $resultat = $db->query ($requete) ;
  | 
        
        
            | 
            | 
           342 | 
               if (DB::isError ($resultat)) {
  | 
        
        
            | 
            | 
           343 | 
                   trigger_error("Echec de la requete : $requete<br />".$resultat->getMessage(),E_USER_WARNING) ;
  | 
        
        
            | 
            | 
           344 | 
               }
  | 
        
        
            | 
            | 
           345 | 
           }
  | 
        
        
            | 
            | 
           346 | 
              | 
        
        
            | 
            | 
           347 | 
           /**
  | 
        
        
            | 
            | 
           348 | 
            *
  | 
        
        
            | 
            | 
           349 | 
            * Formate code sql pour insertion à partir des valeurs entrees dans le formulaire
  | 
        
        
            | 
            | 
           350 | 
            *
  | 
        
        
            | 
            | 
           351 | 
            * @return  string  un morceau de code SQL
  | 
        
        
            | 
            | 
           352 | 
            */
  | 
        
        
            | 
            | 
           353 | 
              | 
        
        
           | 436 | 
           ddelon | 
           354 | 
           function requete_wikini (&$valeur) {
  | 
        
        
           | 434 | 
           ddelon | 
           355 | 
               return   'gewi_code_alpha_wikini ="'.$valeur['code_alpha_wikini'].'", '
  | 
        
        
            | 
            | 
           356 | 
                       .'gewi_bdd_hote ="'.$valeur['bdd_hote'].'", '
  | 
        
        
            | 
            | 
           357 | 
                       .'gewi_bdd_nom="'.$valeur['bdd_nom'].'", '
  | 
        
        
            | 
            | 
           358 | 
                       .'gewi_bdd_utilisateur ="'.$valeur['bdd_utilisateur'].'", '
  | 
        
        
            | 
            | 
           359 | 
                       .'gewi_bdd_mdp="'.$valeur['bdd_mdp'].'", '
  | 
        
        
            | 
            | 
           360 | 
                       .'gewi_table_prefix="'.$valeur['table_prefix'].'", '
  | 
        
        
           | 437 | 
           ddelon | 
           361 | 
                       .'gewi_chemin="'.$valeur['chemin'].'", '
  | 
        
        
           | 434 | 
           ddelon | 
           362 | 
                       .'gewi_page="'.$valeur['page'].'"';
  | 
        
        
            | 
            | 
           363 | 
           }
  | 
        
        
            | 
            | 
           364 | 
              | 
        
        
            | 
            | 
           365 | 
              | 
        
        
           | 439 | 
           ddelon | 
           366 | 
           function adwi_config_wikini($code_alpha_wikini,&$db) {
  | 
        
        
            | 
            | 
           367 | 
              | 
        
        
            | 
            | 
           368 | 
           	$config_wikini = adwi_valeurs_par_code_alpha($code_alpha_wikini,$db );
  | 
        
        
            | 
            | 
           369 | 
              | 
        
        
            | 
            | 
           370 | 
           	// Parametres de base de donnée de Papyrus par défaut
  | 
        
        
            | 
            | 
           371 | 
              | 
        
        
            | 
            | 
           372 | 
           	if ((!isset($config_wikini['bdd_hote'])) || (empty($config_wikini['bdd_hote']))) {
  | 
        
        
            | 
            | 
           373 | 
           	   $config_wikini['bdd_hote'] = PAP_BDD_SERVEUR;
  | 
        
        
            | 
            | 
           374 | 
           	}
  | 
        
        
            | 
            | 
           375 | 
              | 
        
        
            | 
            | 
           376 | 
           	if ((!isset($config_wikini['bdd_nom'])) || (empty($config_wikini['bdd_nom'])))  {
  | 
        
        
            | 
            | 
           377 | 
           	   $config_wikini['bdd_nom'] = PAP_BDD_NOM;
  | 
        
        
            | 
            | 
           378 | 
           	}
  | 
        
        
            | 
            | 
           379 | 
              | 
        
        
            | 
            | 
           380 | 
           	if ((!isset($config_wikini['bdd_utilisateur'])) || (empty($config_wikini['bdd_utilisateur'])))  {
  | 
        
        
            | 
            | 
           381 | 
           	   $config_wikini['bdd_utilisateur'] = PAP_BDD_UTILISATEUR;
  | 
        
        
            | 
            | 
           382 | 
           	}
  | 
        
        
            | 
            | 
           383 | 
              | 
        
        
            | 
            | 
           384 | 
           	if ((!isset($config_wikini['bdd_mdp'])) || (empty($config_wikini['bdd_mdp'])))  {
  | 
        
        
            | 
            | 
           385 | 
           	   $config_wikini['bdd_mdp'] = PAP_BDD_MOT_DE_PASSE;
  | 
        
        
            | 
            | 
           386 | 
           	}
  | 
        
        
            | 
            | 
           387 | 
              | 
        
        
            | 
            | 
           388 | 
           	if ((!isset($config_wikini['table_prefix'])) || (empty($config_wikini['table_prefix'])))  {
  | 
        
        
            | 
            | 
           389 | 
           		$config_wikini['table_prefix'] = $code_alpha_wikini.'_';
  | 
        
        
            | 
            | 
           390 | 
           	}
  | 
        
        
            | 
            | 
           391 | 
              | 
        
        
            | 
            | 
           392 | 
              | 
        
        
            | 
            | 
           393 | 
           	// Ordre de selection de la page de demarrage :
  | 
        
        
            | 
            | 
           394 | 
              | 
        
        
            | 
            | 
           395 | 
           	// Page par defaut du Wiki enregistré
  | 
        
        
            | 
            | 
           396 | 
           	// PagePrincipale
  | 
        
        
            | 
            | 
           397 | 
              | 
        
        
            | 
            | 
           398 | 
           	if ((!isset($config_wikini['page']))  || (empty($config_wikini['page']))) {
  | 
        
        
            | 
            | 
           399 | 
           	   	$config_wikini['page'] = 'PagePrincipale';
  | 
        
        
            | 
            | 
           400 | 
           	}
  | 
        
        
            | 
            | 
           401 | 
              | 
        
        
            | 
            | 
           402 | 
              | 
        
        
            | 
            | 
           403 | 
           	/** Constante stockant le chemin du dossier contenant le site Wikini en cours */
  | 
        
        
            | 
            | 
           404 | 
              | 
        
        
            | 
            | 
           405 | 
           	if ((!isset($config_wikini['chemin'])) || (empty($config_wikini['chemin'])))  {
  | 
        
        
            | 
            | 
           406 | 
           		$config_wikini['chemin'] = GEN_CHEMIN_WIKINI.$config_wikini['code_alpha_wikini'].GEN_SEP;
  | 
        
        
            | 
            | 
           407 | 
           	}
  | 
        
        
            | 
            | 
           408 | 
              | 
        
        
            | 
            | 
           409 | 
              | 
        
        
            | 
            | 
           410 | 
           	return $config_wikini;
  | 
        
        
            | 
            | 
           411 | 
           }
  | 
        
        
            | 
            | 
           412 | 
              | 
        
        
           | 434 | 
           ddelon | 
           413 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           414 | 
           // |                                            PIED du PROGRAMME                                         |
  | 
        
        
            | 
            | 
           415 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           416 | 
              | 
        
        
            | 
            | 
           417 | 
              | 
        
        
            | 
            | 
           418 | 
           /* +--Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           419 | 
           *
  | 
        
        
            | 
            | 
           420 | 
           * $Log: not supported by cvs2svn $
  | 
        
        
           | 970 | 
           florian | 
           421 | 
           * Revision 1.9  2006/09/21 14:18:06  florian
  | 
        
        
            | 
            | 
           422 | 
           * changement du wiki de base (ajout du gestionnaire d'extension), amélioration de l'intégrateur wiki
  | 
        
        
            | 
            | 
           423 | 
           *
  | 
        
        
           | 954 | 
           florian | 
           424 | 
           * Revision 1.8  2006/07/19 13:55:01  ddelon
  | 
        
        
            | 
            | 
           425 | 
           * Bug suppression de Wiki
  | 
        
        
            | 
            | 
           426 | 
           *
  | 
        
        
           | 913 | 
           ddelon | 
           427 | 
           * Revision 1.7  2006/06/02 09:12:16  florian
  | 
        
        
            | 
            | 
           428 | 
           * ajout constante chemin
  | 
        
        
            | 
            | 
           429 | 
           *
  | 
        
        
           | 857 | 
           florian | 
           430 | 
           * Revision 1.6  2006/04/28 12:41:26  florian
  | 
        
        
            | 
            | 
           431 | 
           * corrections erreurs chemin
  | 
        
        
            | 
            | 
           432 | 
           *
  | 
        
        
           | 832 | 
           florian | 
           433 | 
           * Revision 1.5  2005/09/28 16:29:39  ddelon
  | 
        
        
            | 
            | 
           434 | 
           * Merge modification projet
  | 
        
        
            | 
            | 
           435 | 
           *
  | 
        
        
           | 481 | 
           ddelon | 
           436 | 
           * Revision 1.4  2005/09/09 09:37:17  ddelon
  | 
        
        
            | 
            | 
           437 | 
           * Integrateur Wikini et administration des Wikini
  | 
        
        
            | 
            | 
           438 | 
           *
  | 
        
        
           | 439 | 
           ddelon | 
           439 | 
           * Revision 1.3  2005/09/02 11:29:25  ddelon
  | 
        
        
            | 
            | 
           440 | 
           * Integrateur Wikini et administration des Wikini
  | 
        
        
            | 
            | 
           441 | 
           *
  | 
        
        
           | 437 | 
           ddelon | 
           442 | 
           * Revision 1.2  2005/08/31 17:34:52  ddelon
  | 
        
        
            | 
            | 
           443 | 
           * Integrateur Wikini et administration des Wikini
  | 
        
        
            | 
            | 
           444 | 
           *
  | 
        
        
           | 436 | 
           ddelon | 
           445 | 
           * Revision 1.1  2005/08/25 08:59:12  ddelon
  | 
        
        
            | 
            | 
           446 | 
           * Integrateur Wikini et administration des Wikini
  | 
        
        
            | 
            | 
           447 | 
           *
  | 
        
        
           | 434 | 
           ddelon | 
           448 | 
           * Revision 1.1  2005/03/09 10:44:04  jpm
  | 
        
        
            | 
            | 
           449 | 
           * Mise au norme du nom du fichier.
  | 
        
        
            | 
            | 
           450 | 
           *
  | 
        
        
            | 
            | 
           451 | 
           * Revision 1.2  2005/03/09 10:40:33  alex
  | 
        
        
            | 
            | 
           452 | 
           * version initiale
  | 
        
        
            | 
            | 
           453 | 
           *
  | 
        
        
            | 
            | 
           454 | 
           * Revision 1.1  2004/12/13 18:07:28  alex
  | 
        
        
            | 
            | 
           455 | 
           * version initiale
  | 
        
        
            | 
            | 
           456 | 
           *
  | 
        
        
            | 
            | 
           457 | 
           *
  | 
        
        
            | 
            | 
           458 | 
           * +-- Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           459 | 
           */
  | 
        
        
            | 
            | 
           460 | 
           ?>
  |