1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
<?php
/*
* $Horde: horde/css.php,v 1.7.2.14 2005/01/03 11:25:44 jan Exp $
*
* Copyright 2000-2005 Charles J. Hagenbuch <chuck@horde.org>
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
*/
@define('HORDE_BASE', dirname(__FILE__));
require_once HORDE_BASE . '/lib/Horde.php';
require_once HORDE_BASE . '/lib/Registry.php';
require_once HORDE_BASE . '/lib/Browser.php';
$registry = &Registry::singleton();
$browser = new Browser();
// Figure out if we've been inlined, or called directly.
$send_headers = strstr($_SERVER['PHP_SELF'], 'css.php');
// Set initial $mtime of this script.
$mtime = getlastmod();
if (@file_exists(HORDE_BASE . '/config/horde.php')) {
include HORDE_BASE . '/config/horde.php';
} else {
$conf['css']['cached'] = false;
}
if (Horde::getFormData('inherit') !== 'no') {
if (@file_exists(HORDE_BASE . '/config/html.php')) {
if ($conf['css']['cached']) {
$hmtime = filemtime(HORDE_BASE . '/config/html.php');
if ($hmtime > $mtime) {
$mtime = $hmtime;
}
}
include HORDE_BASE . '/config/html.php';
} else {
@include HORDE_BASE . '/config/html.php.dist';
}
}
$app = Horde::getFormData('app');
if (!empty($app)) {
$conf_file = $registry->applicationFilePath('%application%/config/conf.php', $app);
if (@file_exists($conf_file)) {
include $conf_file;
}
$css_file = $registry->applicationFilePath('%application%/config/html.php', $app);
if (@file_exists($css_file)) {
if ($conf['css']['cached']) {
$amtime = filemtime($css_file);
if ($amtime > $mtime) {
$mtime = $amtime;
}
}
include $css_file;
}
}
if ($send_headers) {
if ($conf['css']['cached']) {
$mod_gmt = gmdate('D, d M Y H:i:s', $mtime) . ' GMT';
header('Last-Modified: ' . $mod_gmt);
header('Cache-Control: public, max-age=86400');
} else {
header('Expires: -1');
header('Pragma: no-cache');
header('Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0');
}
header('Content-Type: text/css; charset=iso-8859-1');
}
if (is_array($css)) {
foreach ($css as $class => $params) {
echo "$class{";
if (is_array($params)) {
foreach ($params as $key => $val) {
echo "$key:$val;";
}
}
echo '} ';
}
}
|