376 |
jpm |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 5.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This file is part of eflore_bp. |
|
|
|
9 |
// | |
|
|
|
10 |
// | eflore_bp 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 |
// | eflore_bp 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 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
24 |
// CVS : $Id: RecueilDeDonnees.class.php,v 1.5 2007-07-25 17:45:19 jp_milcent Exp $
|
|
|
25 |
/**
|
|
|
26 |
* eflore_bp - ReccueilDeDonnee.php
|
|
|
27 |
*
|
|
|
28 |
* Description :
|
|
|
29 |
*
|
|
|
30 |
*@package eflore_bp
|
|
|
31 |
//Auteur original :
|
|
|
32 |
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
|
|
|
33 |
//Autres auteurs :
|
|
|
34 |
*@author Aucun
|
|
|
35 |
*@copyright Tela-Botanica 1999-2007
|
|
|
36 |
*@version $Revision: 1.5 $ $Date: 2007-07-25 17:45:19 $
|
|
|
37 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
38 |
*/
|
|
|
39 |
|
|
|
40 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
41 |
// | ENTÊTE du PROGRAMME |
|
|
|
42 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
43 |
|
|
|
44 |
|
|
|
45 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
46 |
// | CORPS du PROGRAMME |
|
|
|
47 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
48 |
class Wikini extends aModule {
|
|
|
49 |
|
|
|
50 |
private $bdd_principale = SC_BDD_NOM_PRINCIPALE;
|
|
|
51 |
private $bdd_options = array('debug' => 3);
|
|
|
52 |
private $bdd_dsn = SC_DSN_PRINCIPAL;
|
|
|
53 |
private $connexion = null;
|
|
|
54 |
private $sites = array('http://www.tela-botanica.org', 'http://www.outils-reseaux.org');
|
|
|
55 |
|
|
|
56 |
public function __construct()
|
|
|
57 |
{
|
|
|
58 |
$this->connexion = DB::connect($this->bdd_dsn, $this->bdd_options);
|
|
|
59 |
if (PEAR::isError($this->connexion)) {
|
|
|
60 |
$e = $this->connexion->getMessage();
|
|
|
61 |
trigger_error($e, E_USER_ERROR);
|
|
|
62 |
}
|
|
|
63 |
parent::__construct();
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
// La méthode executer est appellé par défaut
|
|
|
67 |
public function executer()
|
|
|
68 |
{
|
|
|
69 |
$this->poursuivreVers('config_fichier');
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
public function executerConfigFichier()
|
|
|
73 |
{
|
|
|
74 |
// Initialisation des variables
|
|
|
75 |
$this->setChrono('debut');
|
|
|
76 |
$aso_donnees = $this->getRegistre()->get('squelette_donnees');
|
|
|
77 |
|
|
|
78 |
// Gestion de l'url de l'envoie de mail
|
|
|
79 |
$url = clone $GLOBALS['_SCRIPT_']['url'];
|
|
|
80 |
$url->addQueryString('module', 'wikini');
|
|
|
81 |
$url->addQueryString('action', 'maj_fichier');
|
|
|
82 |
$aso_donnees['url'] = $url->getUrl();
|
|
|
83 |
|
|
|
84 |
// Attribution des données pour remplir le squelette
|
|
|
85 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
86 |
$this->setChrono('fin');
|
|
|
87 |
}
|
|
|
88 |
|
|
|
89 |
public function executerMajFichier()
|
|
|
90 |
{
|
|
|
91 |
// Initialisation des variables
|
|
|
92 |
$this->setChrono('debut');
|
|
|
93 |
$asso_donnees = array();
|
|
|
94 |
|
|
|
95 |
// Récupération des infos pour conpléter le squelette du courriel
|
|
|
96 |
if (isset($_POST['sc_chemin'])) {
|
|
|
97 |
$chemin = $_POST['sc_chemin'];
|
|
|
98 |
if (is_dir($chemin)) {
|
|
|
99 |
foreach (scandir($chemin) as $dossier) {
|
|
|
100 |
if (file_exists($fichier = $chemin.$dossier.DIRECTORY_SEPARATOR.'wakka.config.php')) {
|
|
|
101 |
$arrFile = file($fichier);
|
|
|
102 |
$handle = fopen($fichier, 'w');
|
|
|
103 |
if($handle != false){
|
|
|
104 |
// Set counters
|
|
|
105 |
$currentLine = 0;
|
|
|
106 |
$cntFile = count($arrFile);// Nombre de ligne
|
|
|
107 |
// Write contents, inserting $item as first item
|
|
|
108 |
while ($currentLine <= $cntFile){
|
|
|
109 |
if (isset($arrFile[$currentLine])) {
|
|
|
110 |
foreach ($_POST as $cle => $val) {
|
|
|
111 |
if ($val != '') {
|
|
|
112 |
if(preg_match('/"'.preg_replace('/^sc_/', '', $cle).'" =>/', $arrFile[$currentLine])) {
|
|
|
113 |
$arrFile[$currentLine] = preg_replace('/=> ".*"/', '=> "'.$val.'"', $arrFile[$currentLine]);
|
|
|
114 |
}
|
|
|
115 |
}
|
|
|
116 |
}
|
|
|
117 |
fwrite($handle, $arrFile[$currentLine]);
|
|
|
118 |
if (preg_match('/^\?>$/', $arrFile[$currentLine])) {
|
|
|
119 |
fclose($handle);
|
|
|
120 |
$currentLine = $cntFile;
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
$currentLine++;
|
|
|
124 |
}
|
|
|
125 |
} else {
|
|
|
126 |
trigger_error('Fichier '.$fichier.' impossible à ouvrir', E_USER_WARNING);
|
|
|
127 |
}
|
|
|
128 |
|
|
|
129 |
}
|
|
|
130 |
}
|
|
|
131 |
} else {
|
|
|
132 |
trigger_error('Le chemin suivant n\'est pas un dossier :'.$chemin, E_USER_WARNING);
|
|
|
133 |
}
|
|
|
134 |
}
|
|
|
135 |
|
|
|
136 |
// Attribution des données pour remplir le squelette
|
|
|
137 |
$this->getRegistre()->set('squelette_donnees', $asso_donnees);
|
|
|
138 |
$this->setChrono('fin');
|
|
|
139 |
|
|
|
140 |
// Nous ajoutons une action à éxecuter avant de rendre la main
|
|
|
141 |
$this->poursuivreVers('config_fichier');
|
|
|
142 |
}
|
|
|
143 |
|
|
|
144 |
public function executerSupprimerUtilisateur()
|
|
|
145 |
{
|
|
|
146 |
// Initialisation des variables
|
|
|
147 |
$this->setChrono('debut');
|
|
|
148 |
$aso_donnees = $this->getRegistre()->get('squelette_donnees');
|
|
|
149 |
|
|
|
150 |
// Gestion de l'url de l'envoie de mail
|
|
|
151 |
$url = clone $GLOBALS['_SCRIPT_']['url'];
|
|
|
152 |
$url->addQueryString('module', 'wikini');
|
|
|
153 |
$url->addQueryString('action', 'maj_utilisateur');
|
|
|
154 |
$aso_donnees['url'] = $url->getUrl();
|
|
|
155 |
|
|
|
156 |
// Attribution des données pour remplir le squelette
|
|
|
157 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
158 |
$this->setChrono('fin');
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
public function executerMajUtilisateur()
|
|
|
162 |
{
|
|
|
163 |
// Initialisation des variables
|
|
|
164 |
$this->setChrono('debut');
|
|
|
165 |
$asso_donnees = array();
|
|
|
166 |
|
|
|
167 |
// Récupération des infos pour conpléter le squelette du courriel
|
|
|
168 |
if (isset($_POST['sc_chemin'])) {
|
|
|
169 |
$chemin = $_POST['sc_chemin'];
|
|
|
170 |
if (is_dir($chemin)) {
|
|
|
171 |
foreach (scandir($chemin) as $dossier) {
|
|
|
172 |
if (file_exists($fichier = $chemin.$dossier.DIRECTORY_SEPARATOR.'wakka.config.php')) {
|
|
|
173 |
|
|
|
174 |
}
|
|
|
175 |
if (file_exists($fichier = $chemin.$dossier.DIRECTORY_SEPARATOR.'wakka.config.php')) {
|
|
|
176 |
// Initialisation de variables
|
|
|
177 |
$wakka_config = array();
|
|
|
178 |
$requetes = array();
|
|
|
179 |
|
|
|
180 |
// Récupération de la config du wikini
|
|
|
181 |
$tab_fichier = file($fichier);
|
|
|
182 |
foreach ($tab_fichier as $ligne_num => $ligne) {
|
|
|
183 |
if(preg_match('/"(.*)"\s*=>\s*"(.*)"\s*,/', $ligne, $match)) {
|
|
|
184 |
//trigger_error(print_r($match, true), E_USER_NOTICE);
|
|
|
185 |
$wakka_config[$match[1]] = $match[2];
|
|
|
186 |
}
|
|
|
187 |
}
|
|
|
188 |
//trigger_error(print_r($wakka_config, true), E_USER_NOTICE);
|
|
|
189 |
if (isset($wakka_config['mysql_user']) && isset($wakka_config['mysql_password']) && isset($wakka_config['mysql_host']) && isset($wakka_config['mysql_database'])) {
|
|
|
190 |
// Connexion à la base de données
|
|
|
191 |
$dsn = 'mysql://'.$wakka_config['mysql_user'].':'.$wakka_config['mysql_password'].'@'.$wakka_config['mysql_host'].'/'.$wakka_config['mysql_database'];
|
|
|
192 |
$this->connexion = DB::connect($dsn, $this->bdd_options);
|
|
|
193 |
if (PEAR::isError($this->connexion)) {
|
|
|
194 |
$e = $this->connexion->getMessage();
|
|
|
195 |
trigger_error($e, E_USER_ERROR);
|
|
|
196 |
}
|
|
|
197 |
|
|
|
198 |
// Traitement de la chaine utilisateur
|
|
|
199 |
$tab_utilisateurs = explode(',', trim($_POST['sc_utilisateur']));
|
|
|
200 |
$chaine_utilisateur = '';
|
|
|
201 |
foreach ($tab_utilisateurs as $utilisateur) {
|
|
|
202 |
$chaine_utilisateur .= '"'.trim($utilisateur).'", ';
|
|
|
203 |
}
|
|
|
204 |
$chaine_utilisateur = trim($chaine_utilisateur, ', ');
|
|
|
205 |
|
|
|
206 |
// Suppression de l'utilisateur
|
|
|
207 |
|
|
|
208 |
$requete = 'DELETE FROM '.$wakka_config['table_prefix'].'users '.
|
|
|
209 |
'WHERE name IN ('.$chaine_utilisateur.')';
|
|
|
210 |
$requetes[] = $requete."\n";
|
|
|
211 |
$res = $this->connexion->query($requete);
|
|
|
212 |
if (PEAR::isError($res)) {
|
|
|
213 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
214 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
215 |
}
|
|
|
216 |
|
|
|
217 |
// Stockage des requetes
|
|
|
218 |
if (count($requetes) > 0 ) {
|
|
|
219 |
$aso_donnees['wikinis'][] = array( 'dossier' => $dossier,
|
|
|
220 |
'nom' => $wakka_config['wakka_name'],
|
|
|
221 |
'version' => $wakka_config['wikini_version'],
|
|
|
222 |
'requetes' => $requetes);
|
|
|
223 |
}
|
|
|
224 |
} else {
|
|
|
225 |
trigger_error(print_r($wakka_config, true), E_USER_NOTICE);
|
|
|
226 |
}
|
|
|
227 |
}
|
|
|
228 |
}
|
|
|
229 |
} else {
|
|
|
230 |
trigger_error('Le chemin suivant n\'est pas un dossier :'.$chemin, E_USER_WARNING);
|
|
|
231 |
}
|
|
|
232 |
}
|
|
|
233 |
|
|
|
234 |
// Attribution des données pour remplir le squelette
|
|
|
235 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
236 |
$this->setChrono('fin');
|
|
|
237 |
|
|
|
238 |
// Nous ajoutons une action à éxecuter avant de rendre la main
|
|
|
239 |
$this->poursuivreVers('supprimer_utilisateur');
|
|
|
240 |
}
|
|
|
241 |
|
|
|
242 |
public function executerConfigBdd()
|
|
|
243 |
{
|
|
|
244 |
// Initialisation des variables
|
|
|
245 |
$this->setChrono('debut');
|
|
|
246 |
$aso_donnees = $this->getRegistre()->get('squelette_donnees');
|
|
|
247 |
|
|
|
248 |
// Gestion de l'url de l'envoie de mail
|
|
|
249 |
$url = clone $GLOBALS['_SCRIPT_']['url'];
|
|
|
250 |
$url->addQueryString('module', 'wikini');
|
|
|
251 |
$url->addQueryString('action', 'maj_bdd');
|
|
|
252 |
$aso_donnees['url'] = $url->getUrl();
|
|
|
253 |
|
|
|
254 |
// Attribution des données pour remplir le squelette
|
|
|
255 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
256 |
$this->setChrono('fin');
|
|
|
257 |
}
|
|
|
258 |
|
|
|
259 |
public function executerMajBdd()
|
|
|
260 |
{
|
|
|
261 |
// Initialisation des variables
|
|
|
262 |
$this->setChrono('debut');
|
|
|
263 |
$asso_donnees = array();
|
|
|
264 |
|
|
|
265 |
// Récupération des infos pour conpléter le squelette du courriel
|
|
|
266 |
if (isset($_POST['sc_chemin'])) {
|
|
|
267 |
$chemin = $_POST['sc_chemin'];
|
|
|
268 |
if (is_dir($chemin)) {
|
|
|
269 |
foreach (scandir($chemin) as $dossier) {
|
|
|
270 |
if (file_exists($fichier = $chemin.$dossier.DIRECTORY_SEPARATOR.'wakka.config.php')) {
|
|
|
271 |
|
|
|
272 |
}
|
|
|
273 |
if (file_exists($fichier = $chemin.$dossier.DIRECTORY_SEPARATOR.'wakka.config.php')) {
|
|
|
274 |
// Initialisation de variables
|
|
|
275 |
$wakka_config = array();
|
|
|
276 |
$requetes = array();
|
|
|
277 |
|
|
|
278 |
// Récupération de la config du wikini
|
|
|
279 |
$tab_fichier = file($fichier);
|
|
|
280 |
foreach ($tab_fichier as $ligne_num => $ligne) {
|
|
|
281 |
if(preg_match('/"(.*)"\s*=>\s*"(.*)"\s*,/', $ligne, $match)) {
|
|
|
282 |
//trigger_error(print_r($match, true), E_USER_NOTICE);
|
|
|
283 |
$wakka_config[$match[1]] = $match[2];
|
|
|
284 |
}
|
|
|
285 |
}
|
|
|
286 |
//trigger_error(print_r($wakka_config, true), E_USER_NOTICE);
|
|
|
287 |
if (isset($wakka_config['mysql_user']) && isset($wakka_config['mysql_password']) && isset($wakka_config['mysql_host']) && isset($wakka_config['mysql_database'])) {
|
|
|
288 |
// Connexion à la base de données
|
|
|
289 |
$dsn = 'mysql://'.$wakka_config['mysql_user'].':'.$wakka_config['mysql_password'].'@'.$wakka_config['mysql_host'].'/'.$wakka_config['mysql_database'];
|
|
|
290 |
$this->connexion = DB::connect($dsn, $this->bdd_options);
|
|
|
291 |
if (PEAR::isError($this->connexion)) {
|
|
|
292 |
$e = $this->connexion->getMessage();
|
|
|
293 |
trigger_error($e, E_USER_ERROR);
|
|
|
294 |
}
|
|
|
295 |
|
|
|
296 |
// Mise à jour des droits
|
|
|
297 |
$requete = 'UPDATE '.$wakka_config['table_prefix'].'acls '.
|
|
|
298 |
'SET list = "'.$wakka_config['default_write_acl'].'" '.
|
|
|
299 |
'WHERE privilege = "write" ';
|
|
|
300 |
$requetes[] = $requete."\n";
|
|
|
301 |
$res = $this->connexion->query($requete);
|
|
|
302 |
if (PEAR::isError($res)) {
|
|
|
303 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
304 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
305 |
}
|
|
|
306 |
|
|
|
307 |
$requete = 'UPDATE '.$wakka_config['table_prefix'].'acls '.
|
|
|
308 |
'SET list = "'.$wakka_config['default_read_acl'].'" '.
|
|
|
309 |
'WHERE privilege = "read" ';
|
|
|
310 |
$requetes[] = $requete."\n";
|
|
|
311 |
$res = $this->connexion->query($requete);
|
|
|
312 |
if (PEAR::isError($res)) {
|
|
|
313 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
314 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
315 |
}
|
|
|
316 |
|
|
|
317 |
$requete = 'UPDATE '.$wakka_config['table_prefix'].'acls '.
|
|
|
318 |
'SET list = "'.$wakka_config['default_comment_acl'].'" '.
|
|
|
319 |
'WHERE privilege = "comment" ';
|
|
|
320 |
$requetes[] = $requete."\n";
|
|
|
321 |
$res = $this->connexion->query($requete);
|
|
|
322 |
if (PEAR::isError($res)) {
|
|
|
323 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
324 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
325 |
}
|
|
|
326 |
|
|
|
327 |
$requete = 'DELETE FROM '.$wakka_config['table_prefix'].'acls '.
|
|
|
328 |
'WHERE page_tag = "ParametresUtilisateur"';
|
|
|
329 |
$requetes[] = $requete."\n";
|
|
|
330 |
$res = $this->connexion->query($requete);
|
|
|
331 |
if (PEAR::isError($res)) {
|
|
|
332 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
333 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
334 |
}
|
|
|
335 |
|
|
|
336 |
$requete = 'INSERT INTO '.$wakka_config['table_prefix'].'acls '.
|
|
|
337 |
'VALUES ("ParametresUtilisateur", "write", "*") ';
|
|
|
338 |
$requetes[] = $requete."\n";
|
|
|
339 |
$res = $this->connexion->query($requete);
|
|
|
340 |
if (PEAR::isError($res)) {
|
|
|
341 |
$requetes[] = $res->getMessage().$res->getDebugInfo();
|
|
|
342 |
trigger_error($res->getMessage().$res->getDebugInfo(), E_USER_WARNING);
|
|
|
343 |
}
|
|
|
344 |
|
|
|
345 |
|
|
|
346 |
// Stockage des requetes
|
|
|
347 |
if (count($requetes) > 0 ) {
|
|
|
348 |
$aso_donnees['wikinis'][] = array( 'dossier' => $dossier,
|
|
|
349 |
'nom' => $wakka_config['wakka_name'],
|
|
|
350 |
'version' => $wakka_config['wikini_version'],
|
|
|
351 |
'requetes' => $requetes);
|
|
|
352 |
}
|
|
|
353 |
} else {
|
|
|
354 |
trigger_error(print_r($wakka_config, true), E_USER_NOTICE);
|
|
|
355 |
}
|
|
|
356 |
}
|
|
|
357 |
}
|
|
|
358 |
} else {
|
|
|
359 |
trigger_error('Le chemin suivant n\'est pas un dossier :'.$chemin, E_USER_WARNING);
|
|
|
360 |
}
|
|
|
361 |
}
|
|
|
362 |
|
|
|
363 |
// Attribution des données pour remplir le squelette
|
|
|
364 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
365 |
$this->setChrono('fin');
|
|
|
366 |
|
|
|
367 |
// Nous ajoutons une action à éxecuter avant de rendre la main
|
|
|
368 |
$this->poursuivreVers('config_bdd');
|
|
|
369 |
}
|
|
|
370 |
|
|
|
371 |
public function executerNettoyage()
|
|
|
372 |
{
|
|
|
373 |
// Initialisation des variables
|
|
|
374 |
$this->setChrono('debut');
|
|
|
375 |
$aso_donnees = array();
|
|
|
376 |
|
|
|
377 |
$res = $this->connexion->query('SHOW TABLES');
|
|
|
378 |
if (PEAR::isError($res)) {
|
|
|
379 |
die($res->getMessage());
|
|
|
380 |
}
|
|
|
381 |
$tab_tables = array();
|
|
|
382 |
$ligne = '';
|
|
|
383 |
while ($res->fetchInto($ligne)) {
|
|
|
384 |
$tab_tables[] = $ligne[0];
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
foreach ($tab_tables as $table) {
|
|
|
388 |
$requetes = array();
|
|
|
389 |
// Referrers
|
|
|
390 |
if (preg_match('/_referrers$/', $table)) {
|
|
|
391 |
$site_nbre = count($this->sites);
|
|
|
392 |
$site_0 = $this->sites[0];
|
|
|
393 |
$requete = 'DELETE FROM '.$table.' '.
|
|
|
394 |
'WHERE referrer NOT LIKE "'.$site_0.'%" ';
|
|
|
395 |
for ($i = 1; $i < $site_nbre; $i++) {
|
|
|
396 |
$requete .= 'AND referrer NOT LIKE "'.$this->sites[$i].'%" ';
|
|
|
397 |
}
|
|
|
398 |
$requetes[] = $requete."\n";
|
|
|
399 |
$res = $this->connexion->query($requete);
|
|
|
400 |
if (PEAR::isError($res)) {
|
|
|
401 |
die($res->getMessage());
|
|
|
402 |
}
|
|
|
403 |
}
|
|
|
404 |
|
|
|
405 |
// Pages : commentaires
|
|
|
406 |
if (preg_match('/_pages$/', $table)) {
|
|
|
407 |
$requete = 'SELECT tag FROM '.$table.' '.
|
|
|
408 |
'WHERE tag LIKE "Comment%" ';
|
|
|
409 |
$requetes[] = $requete."\n";
|
|
|
410 |
$aso_pages = $this->connexion->getAll($requete, null, DB_FETCHMODE_ASSOC);
|
|
|
411 |
if (PEAR::isError($aso_pages)) {
|
|
|
412 |
die($aso_pages->getMessage());
|
|
|
413 |
}
|
|
|
414 |
if (count($aso_pages) > 0) {
|
|
|
415 |
$tab_pages = array();
|
|
|
416 |
foreach ($aso_pages as $page) {
|
|
|
417 |
if (preg_match('/^Comment\d+$/', $page['tag'])){
|
|
|
418 |
$tab_pages[] = $page['tag'];
|
|
|
419 |
}
|
|
|
420 |
}
|
|
|
421 |
if (count($tab_pages) > 0) {
|
|
|
422 |
$requete = 'DELETE FROM '.$table.' '.
|
|
|
423 |
'WHERE tag IN ("'.implode('","', $tab_pages).'") ';
|
|
|
424 |
$requetes[] = $requete."\n";
|
|
|
425 |
$res = $this->connexion->query($requete);
|
|
|
426 |
if (PEAR::isError($res)) {
|
|
|
427 |
die($res->getMessage());
|
|
|
428 |
}
|
|
|
429 |
}
|
|
|
430 |
}
|
|
|
431 |
}
|
|
|
432 |
|
|
|
433 |
// ACLs : commentaires
|
|
|
434 |
if (preg_match('/_acls$/', $table)) {
|
|
|
435 |
$requete = 'DELETE FROM '.$table.' '.
|
|
|
436 |
'WHERE page_tag LIKE "Comment%" ';
|
|
|
437 |
$requetes[] = $requete."\n";
|
|
|
438 |
$res = $this->connexion->query($requete);
|
|
|
439 |
if (PEAR::isError($res)) {
|
|
|
440 |
die($res->getMessage());
|
|
|
441 |
}
|
|
|
442 |
|
|
|
443 |
$requete = 'UPDATE '.$table.' '.
|
|
|
444 |
'SET list = "+" '.
|
|
|
445 |
'WHERE privilege = "comment" ';
|
|
|
446 |
$requetes[] = $requete."\n";
|
|
|
447 |
$res = $this->connexion->query($requete);
|
|
|
448 |
if (PEAR::isError($res)) {
|
|
|
449 |
die($res->getMessage());
|
|
|
450 |
}
|
|
|
451 |
}
|
|
|
452 |
// Stockage des requetes
|
|
|
453 |
if (count($requetes) > 0 ) {
|
|
|
454 |
$aso_table['nom'] = $table;
|
|
|
455 |
$aso_table['requetes'] = $requetes;
|
|
|
456 |
$aso_donnees['tables'][] = $aso_table;
|
|
|
457 |
}
|
|
|
458 |
}
|
|
|
459 |
|
|
|
460 |
// Attribution des données pour remplir le squelette
|
|
|
461 |
$this->getRegistre()->set('squelette_donnees', $aso_donnees);
|
|
|
462 |
$this->setChrono('fin');
|
|
|
463 |
}
|
|
|
464 |
}
|
|
|
465 |
|
|
|
466 |
/* +--Fin du code ----------------------------------------------------------------------------------------+
|
|
|
467 |
*
|
|
|
468 |
* $Log: RecueilDeDonnees.class.php,v $
|
|
|
469 |
* Revision 1.5 2007-07-25 17:45:19 jp_milcent
|
|
|
470 |
* Corrections des champs obligatoires.
|
|
|
471 |
*
|
|
|
472 |
* Revision 1.4 2007-07-24 14:31:57 jp_milcent
|
|
|
473 |
* Ajout dans les fichiers de configuration de l'hôte smtp.
|
|
|
474 |
*
|
|
|
475 |
* Revision 1.3 2007-07-11 13:11:06 jp_milcent
|
|
|
476 |
* Ajout de la vérification des donnés du formulaire côté serveur.
|
|
|
477 |
*
|
|
|
478 |
* Revision 1.2 2007-07-10 16:47:30 jp_milcent
|
|
|
479 |
* Ajout de l'identification et améliorations diverses.
|
|
|
480 |
*
|
|
|
481 |
* Revision 1.1 2007-07-09 19:29:26 jp_milcent
|
|
|
482 |
* Ajout du module Recueil de données
|
|
|
483 |
*
|
|
|
484 |
* Revision 1.1 2007-07-09 15:45:59 jp_milcent
|
|
|
485 |
* Début ajout du module de Reccueil de Données.
|
|
|
486 |
*
|
|
|
487 |
*
|
|
|
488 |
* +-- Fin du code ----------------------------------------------------------------------------------------+
|
|
|
489 |
*/
|
|
|
490 |
?>
|