Exemplo n.º 1
0
if (!in_array($type, array('all', 'ie', 'editor', 'plugins', 'parents', 'theme'))) {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}

if ($type === 'ie') {
    css_send_ie_css($themename, $rev, $etag, !empty($slashargument));
}

$candidatedir = "$CFG->cachedir/theme/$themename/css";
$etag = "$themename/$rev/$type";
if (!$usesvg) {
    // Add to the sheet name, one day we'll be able to just drop this.
    $candidatedir .= '/nosvg';
    $etag .= '/nosvg';
}
$candidatesheet = "$candidatedir/$type.css";
$etag = sha1($etag);

if (file_exists($candidatesheet)) {
    if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
        // we do not actually need to verify the etag value because our files
Exemplo n.º 2
0
if (!in_array($type, array('all', 'ie', 'editor', 'plugins', 'parents', 'theme'))) {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}

if (file_exists("$CFG->dirroot/theme/$themename/config.php")) {
    // exists
} else if (!empty($CFG->themedir) and file_exists("$CFG->themedir/$themename/config.php")) {
    // exists
} else {
    header('HTTP/1.0 404 not found');
    die('Theme was not found, sorry.');
}

if ($type === 'ie') {
    css_send_ie_css($themename, $rev);
}

$candidatesheet = "$CFG->cachedir/theme/$themename/css/$type.css";

if (file_exists($candidatesheet)) {
    if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
        // we do not actually need to verify the etag value because our files
        // never change in cache because we increment the rev parameter
        $lifetime = 60*60*24*30; // 30 days
        header('HTTP/1.1 304 Not Modified');
        header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
        header('Cache-Control: max-age='.$lifetime);
        header('Content-Type: text/css; charset=utf-8');
        die;
    }