Example #1
0
function check_files()
{
    global $config_values;
    $myuid = posix_getuid();
    $configDir = platform_getConfigDir() . '/';
    if (!is_writable($configDir)) {
        echo "<div id=\"errorDialog\" class=\"dialog_window\" style=\"display: block\">Please create the directory {$configDir} and make sure it's readable and writeable for the user running the webserver (uid: {$myuid}). </div>";
    }
    $cwd = getcwd();
    if (!(get_base_dir() . '/web' == $cwd)) {
        echo "<div id=\"errorDialog\" class=\"dialog_window\" style=\"display: block\">Please edit the config.php file and set the basedir to:<br /> \"{$cwd}\".<br />Then click your browsers refresh button.</div>";
        return;
    }
    $toCheck['cache_dir'] = $config_values['Settings']['Cache Dir'];
    if (strtolower($config_values['Settings']['Transmission Host']) == 'localhost' || $config_values['Settings']['Transmission Host'] == '127.0.0.1') {
        $toCheck['download_dir'] = $config_values['Settings']['Download Dir'];
    }
    $deepDir = $config_values['Settings']['Deep Directories'];
    $error = false;
    foreach ($toCheck as $key => $file) {
        if (!file_exists($file)) {
            $error .= "{$key}:&nbsp;<i>\"{$file}\"</i>&nbsp;&nbsp;does not exist <br />";
        }
        if (!$deepDir && $key == 'download_dir') {
            break;
        }
        if (!is_writable($file)) {
            $error .= "{$key}:&nbsp;<i>\"{$file}\"</i>&nbsp;&nbsp;is not writable for uid: {$myuid} <br />";
        }
        if (!is_readable($file)) {
            $error .= "{$key}:&nbsp;<i>\"{$file}\"</i>&nbsp;&nbsp;is not readable for uid: {$myuid} <br />";
        }
    }
    if ($error) {
        echo "<div id=\"errorDialog\" class=\"dialog_window\" style=\"display: block\">{$error}</div>";
    }
}
Example #2
0
function platform_getConfigCache()
{
    return platform_getConfigDir() . "/twx-config.cache";
}