(2003-2009) * @author Froxlor team (2010-) * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt * @package Functions * */ /** * Function which returns a correct dirname, means to add slashes at the beginning and at the end if there weren't some * * @param string $dir * The dirname * * @return string The corrected dirname */ function makeCorrectDir($dir) { if (is_string($dir) && strlen($dir) > 0) { $dir = trim($dir); if (substr($dir, - 1, 1) != '/') { $dir .= '/'; } if (substr($dir, 0, 1) != '/') { $dir = '/' . $dir; } $dir = makeSecurePath($dir); return $dir; } throw new Exception("Cannot validate directory in " . __FUNCTION__ . " which is very dangerous."); }