Si cela peut aider : <? //safe_glob() by BigueNique at yahoo dot ca //Function glob() is prohibited on some servers for security reasons as stated on: //http://seclists.org/fulldisclosure/2005/Sep/0001.html //(Message "Warning: glob() has been disabled for security reasons in (script) on line (line)") //safe_glob() intends to replace glob() for simple applications //using readdir() & fnmatch() instead. //Since fnmatch() is not available on Windows or other non-POSFIX, I rely //on soywiz at php dot net fnmatch clone. //On the final hand, safe_glob() supports basic wildcards on one directory. //Supported flags: GLOB_MARK. GLOB_NOSORT, GLOB_ONLYDIR //Return false if path doesn't exist, and an empty array is no file matches the pattern function safe_glob($pattern, $flags=0) { $split=explode('/',$pattern); $match=array_pop($split); $path=implode('/',$split); if (($dir=opendir($path))!==false) { $glob=array(); while(($file=readdir($dir))!==false) { if (fnmatch($match,$file)) { if ((is_dir("$path/$file"))||(!($flags&GLOB_ONLYDIR))) { if ($flags&GLOB_MARK) $file.='/'; $glob[]=$file; } } } closedir($dir); if (!($flags&GLOB_NOSORT)) sort($glob); return $glob; } else { return false; } }
//thanks to soywiz for the following function, posted on http://php.net/fnmatch //soywiz at php dot net //17-Jul-2006 10:12 //A better "fnmatch" alternative for windows that converts a fnmatch pattern into a preg one. It should work on PHP >= 4.0.0 if (!function_exists('fnmatch')) { function fnmatch($pattern, $string) { return @preg_match('/^' . strtr(addcslashes($pattern, '\\.+^$() {}=!<>|'), array('*' => '.*', '?' => '.?')) . '$/i', $string); } } ?> devrait simuler une fonction glob On 14 mar, 11:25, Tristan Rivoallan <[EMAIL PROTECTED]> wrote: > sgue35 a écrit :> Pour info mon pb vient que le safe_mode est à 0 chez Free > donc tout > > hébergeur qui met le safe_mode à 0 n'accepte pas glob. > > histoire d'éviter d'avoir à maintenir une version hackée de symfony, on > pourrait par exemple : > > * créer une méthode statique sfFinder::glob() utilisant la fonction > native php ou une implémentation maison (via un mixin ?) en fonction de > l'état du safemode > * remplacer tous les appels à glob dans symfony par un appel à cette > méthode > * proposer ça sous forme de patch > > si le patch est intégré, tout le monde est content et on progresse vers > le déploiement aisé de symfony en shared hosting. > > j'essaye d'obtenir une réponse de principe de fabien aujourd'hui. > > ++ > tristan --~--~---------~--~----~------------~-------~--~----~ Vous avez reçu ce message, car vous êtes abonné au groupe Groupe "Symfony-fr" de Google Groupes. Pour transmettre des messages à ce groupe, envoyez un e-mail à l'adresse [email protected] Pour résilier votre abonnement à ce groupe, envoyez un e-mail à l'adresse [EMAIL PROTECTED] Pour afficher d'autres options, visitez ce groupe à l'adresse http://groups.google.com/group/symfony-fr?hl=fr -~----------~----~----~----~------~----~------~--~---
