Example #1
0
function _checkCacheDir($path, $template, $classCounter)
{
    $permError = 0;
    // special test to see if existing cache files exist and are writable...
    if ($dh = @opendir($path)) {
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..' || $file == '.svn') {
                continue;
            }
            if (is_dir($path . $file)) {
                $rc = _checkCacheDir($path . $file . '/', $template, $classCounter);
                if ($rc > 0) {
                    $permError = 1;
                }
            } else {
                $ok = _isWritable($path . $file);
                if (!$ok) {
                    $template->set_var('location', $path . $file);
                    $template->set_var('status', $ok ? '<span class="yes">OK</span>' : '<span class="notwriteable">NOT WRITABLE</span>');
                    $template->set_var('rowclass', $classCounter % 2 + 1);
                    $classCounter++;
                    $template->parse('perm', 'perms', true);
                    if (!$ok) {
                        $permError = 1;
                    }
                }
            }
        }
        closedir($dh);
    }
    return $permError;
}
Example #2
0
function _checkCacheDir($path, &$data_arr)
{
    global $LANG_ENVCHECK;
    $permError = 0;
    // special test to see if existing cache files exist and are writable...
    if ($dh = @opendir($path)) {
        while (($file = readdir($dh)) !== false) {
            if ($file == '.' || $file == '..' || $file == '.svn') {
                continue;
            }
            if (is_dir($path . $file)) {
                $rc = _checkCacheDir($path . $file . '/', $data_arr);
                if ($rc > 0) {
                    $permError = 1;
                }
            } else {
                $ok = _isWritable($path . $file);
                if (!$ok) {
                    $data_arr[] = array('location' => $path . $file, 'status' => $ok ? '<span class="yes">OK</span>' : '<span class="notwriteable">' . $LANG_ENVCHECK['not_writable'] . '</span>');
                    if (!$ok) {
                        $permError = 1;
                    }
                }
            }
        }
        closedir($dh);
    }
    return $permError;
}