[Openfirst-cvscommit] base/config version.php,1.1,1.2
Brought to you by:
xtimg
From: <xt...@us...> - 2003-09-28 17:35:38
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1:/tmp/cvs-serv21590 Modified Files: version.php Log Message: Make the versions script actually as expected, it will now prevent huge listings of good files, unless an option to have them listed is turned on. Index: version.php =================================================================== RCS file: /cvsroot/openfirst/base/config/version.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** version.php 30 Aug 2003 18:25:02 -0000 1.1 --- version.php 28 Sep 2003 17:33:22 -0000 1.2 *************** *** 32,35 **** --- 32,56 ---- if(isset($user->user) == true && $user->membertype == "administrator") { + + // Recursive glob functionality based on original code from: + // st...@to... + // as posted to php.net manual for glob() function reference. + + function rglob($sDir, $sPattern, $nFlags = NULL) { + $sDir = escapeshellcmd($sDir); + + $aFiles = glob("$sDir/$sPattern", $nFlags); + + foreach (glob("$sDir/*", GLOB_ONLYDIR) as $sSubDir) { + $aSubFiles = rglob($sSubDir, $sPattern, $nFlags); + $aFiles = array_merge($aFiles, $aSubFiles); + } + + // The array we return contains the files we found, and the + // files all of our children found. + + return $aFiles; + } + ?> *************** *** 42,91 **** <?php if(function_exists("glob")) { ! foreach (glob("../*/*/*/*/*/*/*") as $filename) { ! if(is_file($filename)) { ! $mod = str_replace("../", "", $filename); ! $mod = substr($mod, 0, strpos($mod, "/", 2)); ! $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! } ! } ! foreach (glob("../*/*/*/*/*/*") as $filename) { ! if(is_file($filename)) { ! $mod = str_replace("../", "", $filename); ! $mod = substr($mod, 0, strpos($mod, "/", 2)); ! $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! } ! } ! foreach (glob("../*/*/*/*/*") as $filename) { ! if(is_file($filename)) { ! $mod = str_replace("../", "", $filename); ! $mod = substr($mod, 0, strpos($mod, "/", 2)); ! $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! } ! } ! foreach (glob("../*/*/*/*") as $filename) { ! if(is_file($filename)) { ! $mod = str_replace("../", "", $filename); ! $mod = substr($mod, 0, strpos($mod, "/", 2)); ! $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! } ! } ! foreach (glob("../*/*/*") as $filename) { ! if(is_file($filename)) { ! $mod = str_replace("../", "", $filename); ! $mod = substr($mod, 0, strpos($mod, "/", 2)); ! $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! } ! } ! foreach (glob("../*") as $filename) { if(is_file($filename)) { $mod = str_replace("../", "", $filename); $mod = substr($mod, 0, strpos($mod, "/", 2)); $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?md5=" . md5_file($filename) . "&module=$mod&file=$fil"); } } --- 63,73 ---- <?php if(function_exists("glob")) { ! foreach (rglob("..", "*") as $filename) { if(is_file($filename)) { $mod = str_replace("../", "", $filename); $mod = substr($mod, 0, strpos($mod, "/", 2)); $fil = str_replace("../$mod/", "", $filename); ! @include("http://update.openfirst.org/versions.php?showgood=f&md5=" . md5_file($filename) . "&module=$mod&file=$fil"); ! unset($filename); } } |