Subversion Repositories Sites.tela-botanica.org

Compare Revisions

Ignore whitespace Rev 266 → Rev 267

/trunk/scripts/index.html
New file
0,0 → 1,21
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Bienvenue sur la liste des scripts pour Tela Botanica - Le réseau de la botanique francophone</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-style-type" content="text/css" />
<meta http-equiv="Content-script-type" content="text/javascript" />
<meta http-equiv="Content-language" content="fr" />
<meta name="robots" content="noindex,nofollow" />
<meta name="author" content="Tela Botanica" />
<link rel="shortcut icon" type="image/x-icon" href="sites/commun/generique/images/favicones/tela_botanica.ico" />
<link rel="icon" type="image/png" href="sites/commun/generique/images/favicones/tela_botanica.png" />
</head>
<body>
<h1>Liste des scripts</h1>
<ul id="liste_scripts">
<li id="script_1"><a href="nettoyage_wikini.php">Nettoyer les Wikini</a></li>
</ul>
</body>
</html>
/trunk/scripts/.htaccess
New file
0,0 → 1,9
AddHandler application/x-httpd-php5 .php
AddHandler application/x-httpd-php5 .php3
AuthUserFile /home/telabotap/www/phpmyadmin/.htpasswd
AuthGroupFile /dev/null
AuthName "Administrateur"
AuthType Basic
<Limit GET POST>
require valid-user
</Limit>
/trunk/scripts/nettoyage_wikini.php
New file
0,0 → 1,161
<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */
// +------------------------------------------------------------------------------------------------------+
// | PHP version 5.1 |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 1999-2006 Tela Botanica (accueil@tela-botanica.org) |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of tela_botanica_v4. |
// | |
// | Foobar is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation; either version 2 of the License, or |
// | (at your option) any later version. |
// | |
// | Foobar is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with Foobar; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id$
/**
* tela_botanica_v4 - nettoyage_wikini.php
*
* Description :
*
*@package tela_botanica_v4
//Auteur original :
*@author Jean-Pascal MILCENT <jpm@tela-botanica.org>
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 1999-2007
*@version $Revision$ $Date$
// +------------------------------------------------------------------------------------------------------+
*/
 
// +------------------------------------------------------------------------------------------------------+
// | ENTÊTE du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
define('CHEMIN_PEAR', '../api/pear/');
$GLOBALS['_NETTOYAGE_']['sites'] = array('http://www.tela-botanica.org', 'http://www.outils-reseaux.org');
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
$Nettoyage = new Nettoyage();
$Nettoyage->nettoyageGlobal();
 
// +------------------------------------------------------------------------------------------------------+
// | CLASSES du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
class Nettoyage {
public function __construct()
{
$fichier_ini = 'bdd.ini';
if (file_exists($fichier_ini)) {
$this->parserFichierIni($fichier_ini);
require_once CHEMIN_PEAR.'DB.php';
$this->connexion = DB::connect($this->bdd_dsn, $this->bdd_options);
if (PEAR::isError($this->connexion)) {
$e = $this->connexion->getMessage();
trigger_error($e, E_USER_ERROR);
}
}
}
public function nettoyageGlobal()
{
$res = $this->connexion->query('SHOW TABLES');
if (PEAR::isError($res)) {
die($res->getMessage());
}
$tab_tables = array();
$ligne = '';
while ($res->fetchInto($ligne)) {
$tab_tables[] = $ligne[0];
}
 
echo '<pre>';
foreach ($tab_tables as $table) {
echo "\n".$table."\n";
 
// Referrers
if (preg_match('/_referrers$/', $table)) {
$site_nbre = count($GLOBALS['_NETTOYAGE_']['sites']);
$site_0 = $GLOBALS['_NETTOYAGE_']['sites'][0];
$requete = 'DELETE FROM '.$table.' '.
'WHERE referrer NOT LIKE "'.$site_0.'%" ';
for ($i = 1; $i < $site_nbre; $i++) {
$requete .= 'AND referrer NOT LIKE "'.$GLOBALS['_NETTOYAGE_']['sites'][$i].'%" ';
}
echo $requete."\n";
$res = $this->connexion->query($requete);
if (PEAR::isError($res)) {
die($res->getMessage());
}
}
 
// Pages : commentaires
if (preg_match('/_pages$/', $table)) {
$requete = 'DELETE FROM '.$table.' '.
'WHERE tag LIKE "Comment%" ';
echo $requete."\n";
$res = $this->connexion->query($requete);
if (PEAR::isError($res)) {
die($res->getMessage());
}
}
// ACLs : commentaires
if (preg_match('/_acls$/', $table)) {
$requete = 'DELETE FROM '.$table.' '.
'WHERE page_tag LIKE "Comment%" ';
echo $requete."\n";
$res = $this->connexion->query($requete);
if (PEAR::isError($res)) {
die($res->getMessage());
}
$requete = 'UPDATE '.$table.' '.
'SET list = "+" '.
'WHERE privilege = "comment" ';
echo $requete."\n";
$res = $this->connexion->query($requete);
if (PEAR::isError($res)) {
die($res->getMessage());
}
}
}
echo '</pre>';
}
private function parserFichierIni($fichier_ini)
{
if (file_exists($fichier_ini)) {
$aso_ini = parse_ini_file($fichier_ini);
foreach ($aso_ini as $cle => $val) {
if (preg_match('/^php:(.+)$/', $val, $correspondances)) {
eval('$this->$cle = '.$correspondances[1].';');
} else if (preg_match('/^php-static:(.+)$/', $val, $correspondances)) {
eval('self::$'.$cle.' = '.$correspondances[1].';');
} else {
$this->$cle = $val;
}
}
} else {
return false;
}
}
}
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log$
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>