diff --git a/ecrire/action/calculer_taille_cache.php b/ecrire/action/calculer_taille_cache.php index f74b01a4d178d0178edaac1558db22836cf2cef1..6a1b01a9be737674962da0bde4eb712bd6ee9e6c 100644 --- a/ecrire/action/calculer_taille_cache.php +++ b/ecrire/action/calculer_taille_cache.php @@ -75,7 +75,7 @@ function action_calculer_taille_cache_dist($arg = null) { * @return int Taille en octets */ function calculer_taille_dossier($dir) { - $handle = @opendir($dir); + $handle = opendir($dir); if (!$handle) { return 0; } diff --git a/ecrire/exec/admin_plugin.php b/ecrire/exec/admin_plugin.php index 03f9138489c4d976604dcf1657899fb14f10ae70..df4712dc1b6165a14cef2e634dfba501727b4786 100644 --- a/ecrire/exec/admin_plugin.php +++ b/ecrire/exec/admin_plugin.php @@ -297,7 +297,7 @@ function liste_librairies() { $libs = array(); foreach (array_reverse(creer_chemin()) as $d) { if (is_dir($dir = $d . 'lib/') - and $t = @opendir($dir) + and $t = opendir($dir) ) { while (($f = readdir($t)) !== false) { if ($f[0] != '.' diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php index a78f86928c65c1100b07e982587e471559686417..6531ad1eedc45ea81115c160907e74079b423dc8 100644 --- a/ecrire/inc/documents.php +++ b/ecrire/inc/documents.php @@ -100,15 +100,16 @@ function creer_repertoire_documents($ext) { * @param string $nom */ function effacer_repertoire_temporaire($nom) { - $d = opendir($nom); - while (($f = readdir($d)) !== false) { - if (is_file("$nom/$f")) { - spip_unlink("$nom/$f"); - } else { - if ($f <> '.' and $f <> '..' - and is_dir("$nom/$f") - ) { - effacer_repertoire_temporaire("$nom/$f"); + if ($d = opendir($nom)) { + while (($f = readdir($d)) !== false) { + if (is_file("$nom/$f")) { + spip_unlink("$nom/$f"); + } else { + if ($f <> '.' and $f <> '..' + and is_dir("$nom/$f") + ) { + effacer_repertoire_temporaire("$nom/$f"); + } } } } diff --git a/ecrire/inc/flock.php b/ecrire/inc/flock.php index 3b6439465bd3abff7770b479c7b5254e01c6f50c..2553cce92510ceacccbf4b9cf726e7fdeacc0a85 100644 --- a/ecrire/inc/flock.php +++ b/ecrire/inc/flock.php @@ -673,7 +673,7 @@ function preg_files($dir, $pattern = -1 /* AUTO */, $maxfiles = 10000, $recurs = $dir = '.'; } - if (@is_dir($dir) and is_readable($dir) and $d = @opendir($dir)) { + if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { while (($f = readdir($d)) !== false && ($nbfiles < $maxfiles)) { if ($f[0] != '.' # ignorer . .. .svn etc and $f != 'CVS' diff --git a/ecrire/inc/install.php b/ecrire/inc/install.php index df533f8955b2f855ba8346714ce0334aa1cac0c5..ab9d6c242b7f1acd298877cf7c75c23736b09353 100644 --- a/ecrire/inc/install.php +++ b/ecrire/inc/install.php @@ -354,7 +354,7 @@ function fieldset_champs($champs = array()) { function install_select_serveur() { $options = array(); $dir = _DIR_RESTREINT . 'req/'; - $d = @opendir($dir); + $d = opendir($dir); if (!$d) { return array(); } diff --git a/ecrire/inc/invalideur.php b/ecrire/inc/invalideur.php index 064929b5114347824800abc8f60fcdeb6564d06c..f5436c5c131fb553b1e1b3bb14e6a10e1ac192b7 100644 --- a/ecrire/inc/invalideur.php +++ b/ecrire/inc/invalideur.php @@ -50,7 +50,7 @@ if (!defined('_AGE_CACHE_ATIME')) { function nombre_de_fichiers_repertoire($dir, $nb_estim_taille = 20) { $taille = 0; // mesurer la taille de N fichiers au hasard dans le repertoire $nb = $nb_estim_taille; - if (!$h = @opendir($dir)) { + if (!$h = opendir($dir)) { return false; } $total = 0; @@ -84,7 +84,7 @@ function taille_du_cache() { $time = $GLOBALS['meta']['cache_mark']; for ($i=0; $i < 256; $i++) { $dir = _DIR_CACHE.sprintf('%02s', dechex($i)); - if (@is_dir($dir) AND is_readable($dir) AND $d = @opendir($dir)) { + if (@is_dir($dir) AND is_readable($dir) AND $d = opendir($dir)) { while (($f = readdir($d)) !== false) { if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) AND $a = stat("$dir/$f")) { $n++; @@ -178,7 +178,7 @@ function suivre_invalideur($cond, $modif = true) { * Nombre de fichiers supprimés **/ function purger_repertoire($dir, $options = array()) { - $handle = @opendir($dir); + $handle = opendir($dir); if (!$handle) { return; } diff --git a/ecrire/inc/plugin.php b/ecrire/inc/plugin.php index 81de076efb7f7ff2417bdd232cfe091ca35d5dd3..d79ee19be9a7cdb6f1d2e0991c1f7f9d77afd2ad 100644 --- a/ecrire/inc/plugin.php +++ b/ecrire/inc/plugin.php @@ -76,7 +76,7 @@ function fast_find_plugin_dirs($dir, $max_prof = 100) { } $subdirs = array(); - if (@is_dir($dir) and is_readable($dir) and $d = @opendir($dir)) { + if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { while (($f = readdir($d)) !== false) { if ($f[0] != '.' # ignorer . .. .svn etc and $f != 'CVS' diff --git a/ecrire/maj/svn10000.php b/ecrire/maj/svn10000.php index 7000a133f79091c3b42b9fcb65892c6a4e6a4e92..a11a901ef3bcf5b35af08fee7667a28bd34ee77e 100644 --- a/ecrire/maj/svn10000.php +++ b/ecrire/maj/svn10000.php @@ -654,11 +654,12 @@ $GLOBALS['maj'][19268] = array( **/ function supprimer_toutes_sessions() { spip_log("supprimer sessions auteur"); - $dir = opendir(_DIR_SESSIONS); - while (($f = readdir($dir)) !== false) { - spip_unlink(_DIR_SESSIONS . $f); - if (time() >= _TIME_OUT) { - return; + if ($dir = opendir(_DIR_SESSIONS)) { + while (($f = readdir($dir)) !== false) { + spip_unlink(_DIR_SESSIONS . $f); + if (time() >= _TIME_OUT) { + return; + } } } } @@ -674,18 +675,19 @@ $GLOBALS['maj'][21676] = array( function ranger_cache_gd2() { spip_log("ranger_cache_gd2"); $base = _DIR_VAR . "cache-gd2/"; - $dir = opendir($base); - while (($f = readdir($dir)) !== false) { - if (!is_dir($base . $f) and strncmp($f, ".", 1) !== 0 - and preg_match(",[0-9a-f]{32}\.\w+,", $f) - ) { - $sub = substr($f, 0, 2); - $sub = sous_repertoire($base, $sub); - @rename($base . $f, $sub . substr($f, 2)); - @unlink($base . $f); // au cas ou le rename a foire (collision) - } - if (time() >= _TIME_OUT) { - return; + if ($dir = opendir($base)) { + while (($f = readdir($dir)) !== false) { + if (!is_dir($base . $f) and strncmp($f, ".", 1) !== 0 + and preg_match(",[0-9a-f]{32}\.\w+,", $f) + ) { + $sub = substr($f, 0, 2); + $sub = sous_repertoire($base, $sub); + @rename($base . $f, $sub . substr($f, 2)); + @unlink($base . $f); // au cas ou le rename a foire (collision) + } + if (time() >= _TIME_OUT) { + return; + } } } } diff --git a/ecrire/public/composer.php b/ecrire/public/composer.php index b679a3604eebb53eb6cdf72d167e2fd9d60422df..46e00dc96fc299685e5ad11dbb383c53069d3197 100644 --- a/ecrire/public/composer.php +++ b/ecrire/public/composer.php @@ -550,7 +550,7 @@ function lister_objets_avec_logos($type) { . join('|', $GLOBALS['formats_logos']) . ")$/"; - if ($d = @opendir(_DIR_LOGOS)) { + if ($d = opendir(_DIR_LOGOS)) { while (($f = readdir($d)) !== false) { if (preg_match($type, $f, $r)) { $logos[] = $r[1]; diff --git a/prive/formulaires/declarer_bases.php b/prive/formulaires/declarer_bases.php index 8a7d4eb6d8b37d8308aeac257e1af1d09cdd0bbe..91a3fcd01f9aa2e02c5a769bf156adb1d70741ed 100644 --- a/prive/formulaires/declarer_bases.php +++ b/prive/formulaires/declarer_bases.php @@ -56,7 +56,7 @@ function formulaires_declarer_bases_charger_dist() { function liste_serveurs() { $options = array(); $dir = _DIR_RESTREINT . 'req/'; - $d = @opendir($dir); + $d = opendir($dir); if (!$d) { return array(); }