diff options
Diffstat (limited to 'lib/exe')
-rw-r--r-- | lib/exe/css.php | 40 | ||||
-rw-r--r-- | lib/exe/fetch.php | 2 |
2 files changed, 35 insertions, 7 deletions
diff --git a/lib/exe/css.php b/lib/exe/css.php index 8899ff193..1e662c64a 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -49,14 +49,16 @@ function css_out(){ $tpldir = tpl_basedir(); } + // used style.ini file + $styleini = css_styleini($tplinc); + // The generated script depends on some dynamic options $cache = new cache('styles'.$_SERVER['HTTP_HOST'].$_SERVER['SERVER_PORT'].DOKU_BASE.$tplinc.$type,'.css'); // load template styles $tplstyles = array(); - if(@file_exists($tplinc.'style.ini')){ - $ini = parse_ini_file($tplinc.'style.ini',true); - foreach($ini['stylesheets'] as $file => $mode){ + if ($styleini) { + foreach($styleini['stylesheets'] as $file => $mode) { $tplstyles[$mode][$tplinc.$file] = $tpldir; } } @@ -72,6 +74,7 @@ function css_out(){ $cache_files = getConfigFiles('main'); $cache_files[] = $tplinc.'style.ini'; + $cache_files[] = $tplinc.'style.local.ini'; $cache_files[] = __FILE__; foreach($mediatypes as $mediatype) { @@ -119,8 +122,10 @@ function css_out(){ // print the default classes for interwiki links and file downloads if ($mediatype == 'screen') { + print '@media screen {'; css_interwiki(); css_filetypes(); + print '}'; } // load files @@ -173,14 +178,37 @@ function css_out(){ * @author Andreas Gohr <andi@splitbrain.org> */ function css_applystyle($css,$tplinc){ - if(@file_exists($tplinc.'style.ini')){ - $ini = parse_ini_file($tplinc.'style.ini',true); - $css = strtr($css,$ini['replacements']); + $styleini = css_styleini($tplinc); + + if($styleini){ + $css = strtr($css,$styleini['replacements']); } return $css; } /** + * Get contents of merged style.ini and style.local.ini as an array. + * + * @author Anika Henke <anika@selfthinker.org> + */ +function css_styleini($tplinc) { + $styleini = array(); + + foreach (array($tplinc.'style.ini', $tplinc.'style.local.ini') as $ini) { + $tmp = (@file_exists($ini)) ? parse_ini_file($ini, true) : array(); + + foreach($tmp as $key => $value) { + if(array_key_exists($key, $styleini) && is_array($value)) { + $styleini[$key] = array_merge($styleini[$key], $tmp[$key]); + } else { + $styleini[$key] = $value; + } + } + } + return $styleini; +} + +/** * Prints classes for interwikilinks * * Interwiki links have two classes: 'interwiki' and 'iw_$name>' where diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index e8f189256..52e7ebe1e 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -157,7 +157,7 @@ function checkFileStatus(&$media, &$file, $rev='') { //media to local file if(preg_match('#^(https?)://#i',$media)){ //check hash - if(substr(md5(auth_cookiesalt().$media),0,6) != $INPUT->str('hash')){ + if(substr(md5(auth_cookiesalt().$media),0,6) !== $INPUT->str('hash')){ return array( 412, 'Precondition Failed'); } //handle external images |