AttachmentManager::validRelativePath PHP Метод

validRelativePath() публичный Метод

Check if the given path is part of the subdirectories under the base_dir.
public validRelativePath ( string $path ) : boolean
$path string the relative path to be checked
Результат boolean true if the path exists, false otherwise
    function validRelativePath($path)
    {
        $dirs = $this->getDirs();
        if ($path == '/') {
            return true;
        }
        //check the path given in the url against the
        //list of paths in the system.
        for ($i = 0; $i < count($dirs); $i++) {
            $key = key($dirs);
            //we found the path
            if ($key == $path) {
                return true;
            }
            next($dirs);
        }
        return false;
    }