Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

"glob() has been disabled for security reasons"

edited August 2006 in Vanilla 1.0 Help
I'm getting that error when I enable the Attachments 1.4 and the Vanillacons extensions. I realize that this is a server-side problem, so asked my admin what can be done about it and I got this answer: "glob function is disabled for security reasons and never will be enabled. You can use mod_rewrite, it's working fine." ehm... and to tell the truth I don't know if this would solve my problem (and how!) :] Could someone please help me with this?


  • Options
    MarkMark Vanilla Staff

    The extension authors should take a look into this one. Maybe put their names in the discussion topic?
  • Options

    glob function can be replaced with something like this:
    (i just lifted it from, but i've used it before)

    <?php function myglob($pattern) {#get pathname (everything up until the last / or \) $path=$output=null; if(PHP_OS=='WIN32') $slash='\\'; else $slash='/'; $lastpos=strrpos($pattern,$slash); if(!($lastpos===false)) {$path=substr($pattern,0,-$lastpos-1); #negative length means take from the right $pattern=substr($pattern,$lastpos); } else {#no dir info, use current dir $path=getcwd(); } $handle=@ opendir($path); if($handle===false) return false; while($dir=readdir($handle)) {if(pattern_match($pattern,$dir)) $output[]=$dir; } closedir($handle); if(is_array($output)) return $output; return false; } function pattern_match($pattern,$string) {#basically prepare a regular expression $out=null; $chunks=explode(';',$pattern); foreach($chunks as $pattern) {$escape=array('$','^','.','{','}', '(',')','[',']','|'); while(strpos($pattern,'**')!==false) $pattern=str_replace('**','*',$pattern); foreach($escape as $probe) $pattern=str_replace($probe,"\\$probe",$pattern); $pattern=str_replace('?*','*', str_replace('*?','*', str_replace('*',".*", str_replace('?','.{1,1}',$pattern)))); $out[]=$pattern; } if(count($out)==1) return(eregi("^$out[0]$",$string)); else foreach($out as $tester) if(eregi("^$tester$",$string)) return true; return false; } ?>
This discussion has been closed.