Esempio n. 1
0
function printfile($pathname, $raw = false)
{
    if (substr($pathname, -1) == '/') {
        return printdir($pathname);
    }
    if (Luxor::isRestricted($pathname)) {
        $GLOBALS['notification']->push(sprintf(_("You do not have permission to view %s."), $pathname), 'horde.error');
        return '';
    }
    $cache = $GLOBALS['injector']->getInstance('Horde_Cache');
    $lastmod = $GLOBALS['index']->getLastModified($pathname);
    $key = 'luxor_' . $pathname;
    if ($raw) {
        $key .= '_raw';
    }
    $output = $cache->get($key, time() - $lastmod);
    if (true || !$output) {
        $output = $raw ? printfile_raw($pathname) : printfile_markup($pathname);
        if (!empty($output)) {
            $cache->set($key, $output);
        }
    }
    return $output;
}