Exemplo n.º 1
0
function show_default_favicon()
{
    global $default_favicon;
    header('Content-Type: image/x-icon');
    header('Content-Disposition: inline; filename="default_favicon.ico"');
    $default_mtime = @filemtime($default_favicon);
    if (!httpConditional($default_mtime, 2592000, 2)) {
        readfile($default_favicon);
    }
}
Exemplo n.º 2
0
#
# ***** END LICENSE BLOCK *****
require '../../constants.php';
require LIB_PATH . '/lib_rss.php';
//Includes class autoloader
if (file_exists(DATA_PATH . '/do-install.txt')) {
    require APP_PATH . '/install.php';
} else {
    session_cache_limiter('');
    Minz_Session::init('FreshRSS');
    Minz_Session::_param('keepAlive', 1);
    //For Persona
    if (!file_exists(DATA_PATH . '/no-cache.txt')) {
        require LIB_PATH . '/http-conditional.php';
        $currentUser = Minz_Session::param('currentUser', '');
        $dateLastModification = $currentUser === '' ? time() : max(@filemtime(join_path(USERS_PATH, $currentUser, 'log.txt')), @filemtime(join_path(DATA_PATH, 'config.php')));
        if (httpConditional($dateLastModification, 0, 0, false, PHP_COMPRESSION, true)) {
            exit;
            //No need to send anything
        }
    }
    try {
        $front_controller = new FreshRSS();
        $front_controller->init();
        $front_controller->run();
    } catch (Exception $e) {
        echo '### Fatal error! ###<br />', "\n";
        Minz_Log::error($e->getMessage());
        echo 'See logs files.';
    }
}
Exemplo n.º 3
0
    return true;
}
$file_name = urldecode($_GET['f']);
$file_type = $_GET['t'];
$absolute_filename = realpath(EXTENSIONS_PATH . '/' . $file_name);
if (!is_valid_path($absolute_filename)) {
    header('HTTP/1.1 400 Bad Request');
    die;
}
switch ($file_type) {
    case 'css':
        header('Content-Type: text/css; charset=UTF-8');
        header('Content-Disposition: inline; filename="' . $file_name . '"');
        break;
    case 'js':
        header('Content-Type: application/javascript; charset=UTF-8');
        header('Content-Disposition: inline; filename="' . $file_name . '"');
        break;
    default:
        header('HTTP/1.1 400 Bad Request');
        die;
}
$mtime = @filemtime($absolute_filename);
if ($mtime === false) {
    header('HTTP/1.1 404 Not Found');
    die;
}
require LIB_PATH . '/http-conditional.php';
if (!httpConditional($mtime, 604800, 2)) {
    readfile($absolute_filename);
}
Exemplo n.º 4
0
#
# ***** END LICENSE BLOCK *****
if (file_exists('install.php')) {
    require 'install.php';
} else {
    require '../../constants.php';
    require LIB_PATH . '/lib_rss.php';
    //Includes class autoloader
    session_cache_limiter('');
    Minz_Session::init('FreshRSS');
    Minz_Session::_param('keepAlive', 1);
    //For Persona
    if (!file_exists(DATA_PATH . '/no-cache.txt')) {
        require LIB_PATH . '/http-conditional.php';
        $currentUser = Minz_Session::param('currentUser', '');
        $dateLastModification = $currentUser === '' ? time() : max(@filemtime(LOG_PATH . '/' . $currentUser . '.log'), @filemtime(DATA_PATH . '/config.php'));
        if (httpConditional($dateLastModification, 0, 0, false, false, true)) {
            exit;
            //No need to send anything
        }
    }
    try {
        $front_controller = new FreshRSS();
        $front_controller->init();
        $front_controller->run();
    } catch (Exception $e) {
        echo '### Fatal error! ###<br />', "\n";
        Minz_Log::record($e->getMessage(), Minz_Log::ERROR);
        echo 'See logs files.';
    }
}
Exemplo n.º 5
0
        return false;
    }
    return true;
}
$id = isset($_SERVER['QUERY_STRING']) ? $_SERVER['QUERY_STRING'] : '0';
if (!ctype_xdigit($id)) {
    $id = '0';
}
$txt = $favicons_dir . $id . '.txt';
$ico = $favicons_dir . $id . '.ico';
$icoMTime = @filemtime($ico);
$txtMTime = @filemtime($txt);
if ($icoMTime == false || $txtMTime > $icoMTime) {
    if ($txtMTime == false) {
        header('HTTP/1.1 404 Not Found');
        header('Content-Type: image/gif');
        readfile(PUBLIC_PATH . '/themes/icons/grey.gif');
        //TODO: Better 404 favicon
        die;
    }
    $url = file_get_contents($txt);
    if (!download_favicon($url, $ico)) {
        die;
    }
}
require LIB_PATH . '/http-conditional.php';
header('Content-Type: image/x-icon');
header('Content-Disposition: inline; filename="' . $id . '.ico"');
if (!httpConditional($icoMTime, 2592000, 2)) {
    readfile($ico);
}