Ejemplo n.º 1
0
function fixDir($dir)
{
    if (is_dir($dir)) {
        if ($d = opendir($dir)) {
            while ($f = readdir($d)) {
                if ($f == '.' || $f == '..') {
                    continue;
                }
                fixDir($dir . '/' . $f);
            }
            closedir($d);
        }
    } else {
        if (preg_match('/\\.d$/', $dir)) {
            $c = file_get_contents($dir);
            if (strpos($c, '    ') !== false) {
                $c = str_replace("\t", "\t\t", $c);
                $c = str_replace("    ", "\t", $c);
                file_put_contents($dir, $c);
            }
        }
    }
}
Ejemplo n.º 2
0
function getArguments($input)
{
    global $scriptPath, $baseURL;
    if (is_file($scriptPath . $input)) {
        $dir = fixDir(dirname($input));
        $file = basename($input);
        return array($dir, $file);
    } elseif (is_file(stripslashes($scriptPath . $input))) {
        $input = stripslashes($input);
        $dir = fixDir(dirname($input));
        $file = basename($input);
        return array($dir, $file);
    } elseif (is_dir($scriptPath . $input)) {
        $dir = fixDir($input);
        return array($dir, "");
    } elseif (is_dir(stripslashes($scriptPath . $input))) {
        $input = stripslashes($input);
        $dir = fixDir($input);
        return array($dir, "");
    }
    # Should never occur. But if it does, return to the base of the gallery
    header("Location: {$baseURL}");
}