From: Jimmy C. <ji...@ad...> - 2002-12-31 06:39:25
|
Seems I've ran into a problem with the latest devel, sqm_topdir() is suppose to return the correct path, but in my setup (open base directory restrictions) it errors out because it is trying to check if files outside of my home directory are directories. The problem really is the logic. Here is the original function function sqm_topdir(){ $topdir = ''; /** * $levels is just to avoid a potential infinite loop in case * things are REALLY broken. Shouldn't really ever happen. */ $levels = 0; while (!(is_dir("$topdir/functions") && is_dir("$topdir/src")) && $levels < 10){ $topdir .= '../'; $levels++; } return $topdir; } So in this scenario, we first check to see whether "$topdir/functions" is a directory, and since $topdir = "", then that means we are checking on "/functions" which will definitely not be in my home directory and will error out. A simple fix for this is below, granted a better fix can problaly be made, but this works for me. function sqm_topdir(){ $topdir = '.'; /** * $levels is just to avoid a potential infinite loop in case * things are REALLY broken. Shouldn't really ever happen. */ $levels = 0; while (!(is_dir("$topdir/functions") && is_dir("$topdir/src")) && $levels < 10){ if ($topdir == '.') $topdir = ''; $topdir .= '../'; $levels++; } return $topdir; } We modify to start out as "./functions" now, which seems more logical since that parses out to be the current directory. Then we just add a small check to see if it was the first check, and if so, reset $topdir so it will then be set to "../" and run as intended from now on. Hope someone else needs this fix and we can get it merged into CVS. Jimmy |