From 64273335d1bae12b2fe7d9664e1665d6e69d47af Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Fri, 24 Aug 2012 09:43:50 +0200 Subject: more $INPUT use FS#2577 --- lib/exe/ajax.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 945091f34..496b2f1a1 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -162,7 +162,8 @@ function ajax_lock(){ * @author Andreas Gohr */ function ajax_draftdel(){ - $id = cleanID($_REQUEST['id']); + global $INPUT; + $id = cleanID($INPUT->str('id')); if(empty($id)) return; $client = $_SERVER['REMOTE_USER']; @@ -218,11 +219,11 @@ function ajax_medialist(){ * @author Kate Arzamastseva */ function ajax_mediadetails(){ - global $DEL, $NS, $IMG, $AUTH, $JUMPTO, $REV, $lang, $fullscreen, $conf; + global $DEL, $NS, $IMG, $AUTH, $JUMPTO, $REV, $lang, $fullscreen, $conf, $INPUT; $fullscreen = true; require_once(DOKU_INC.'lib/exe/mediamanager.php'); - if ($_REQUEST['image']) $image = cleanID($_REQUEST['image']); + if ($INPUT->has('image')) $image = cleanID($INPUT->str('image')); if (isset($IMG)) $image = $IMG; if (isset($JUMPTO)) $image = $JUMPTO; if (isset($REV) && !$JUMPTO) $rev = $REV; @@ -237,25 +238,26 @@ function ajax_mediadetails(){ */ function ajax_mediadiff(){ global $NS; + global $INPUT; - if ($_REQUEST['image']) $image = cleanID($_REQUEST['image']); + if ($INPUT->has('image')) $image = cleanID($INPUT->str('image')); $NS = $_POST['ns']; - $auth = auth_quickaclcheck("$ns:*"); + $auth = auth_quickaclcheck("$NS:*"); media_diff($image, $NS, $auth, true); } function ajax_mediaupload(){ - global $NS, $MSG; + global $NS, $MSG, $INPUT; if ($_FILES['qqfile']['tmp_name']) { - $id = ((empty($_POST['mediaid'])) ? $_FILES['qqfile']['name'] : $_POST['mediaid']); - } elseif (isset($_GET['qqfile'])) { - $id = $_GET['qqfile']; + $id = $INPUT->post->str('mediaid', $_FILES['qqfile']['name']); + } elseif ($INPUT->get->has('qqfile')) { + $id = $INPUT->get->str('qqfile'); } $id = cleanID($id); - $NS = $_REQUEST['ns']; + $NS = $INPUT->str('ns'); $ns = $NS.':'.getNS($id); $AUTH = auth_quickaclcheck("$ns:*"); @@ -264,7 +266,7 @@ function ajax_mediaupload(){ if ($_FILES['qqfile']['error']) unset($_FILES['qqfile']); if ($_FILES['qqfile']['tmp_name']) $res = media_upload($NS, $AUTH, $_FILES['qqfile']); - if (isset($_GET['qqfile'])) $res = media_upload_xhr($NS, $AUTH); + if ($INPUT->get->has('qqfile')) $res = media_upload_xhr($NS, $AUTH); if ($res) $result = array('success' => true, 'link' => media_managerURL(array('ns' => $ns, 'image' => $NS.':'.$id), '&'), -- cgit v1.2.3 From cd2f903b3e35c080dc9c1aa0c9f7383573dcae31 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Fri, 7 Sep 2012 21:10:44 +0200 Subject: Correct and add some PHPDoc comments, initialize some variables --- lib/exe/indexer.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/exe') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index e149770c0..1ccede923 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -175,6 +175,7 @@ function sendDigest() { } $subscriptions = subscription_find($ID, array('style' => '(digest|list)', 'escaped' => true)); + /** @var auth_basic $auth */ global $auth; global $lang; global $conf; -- cgit v1.2.3 From 356d9c9ea239fe5fe0ac5ecc2c294e768f672059 Mon Sep 17 00:00:00 2001 From: Hakan Sandell Date: Sat, 8 Sep 2012 15:02:28 +0200 Subject: Replacing $_REQUEST variables with $INPUT wrapper, init.php --- lib/exe/ajax.php | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 496b2f1a1..9989269cf 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -14,10 +14,10 @@ session_write_close(); header('Content-Type: text/html; charset=utf-8'); //call the requested function -if(isset($_POST['call'])){ - $call = $_POST['call']; -}else if(isset($_GET['call'])){ - $call = $_GET['call']; +if($INPUT->post->has('call')){ + $call = $INPUT->post->str('call'); +}else if($INPUT->get->has('call')){ + $call = $INPUT->get->str('call'); }else{ exit; } @@ -43,9 +43,10 @@ if(function_exists($callfn)){ function ajax_qsearch(){ global $conf; global $lang; + global $INPUT; - $query = $_POST['q']; - if(empty($query)) $query = $_GET['q']; + $query = $INPUT->post->str('q'); + if(empty($query)) $query = $INPUT->get->str('q'); if(empty($query)) return; $query = urldecode($query); @@ -81,9 +82,10 @@ function ajax_qsearch(){ function ajax_suggestions() { global $conf; global $lang; + global $INPUT; - $query = cleanID($_POST['q']); - if(empty($query)) $query = cleanID($_GET['q']); + $query = cleanID($INPUT->post->str('q')); + if(empty($query)) $query = cleanID($INPUT->get->str('q')); if(empty($query)) return; $data = array(); @@ -121,8 +123,9 @@ function ajax_lock(){ global $lang; global $ID; global $INFO; + global $INPUT; - $ID = cleanID($_POST['id']); + $ID = cleanID($INPUT->post->str('id')); if(empty($ID)) return; $INFO = pageinfo(); @@ -137,15 +140,15 @@ function ajax_lock(){ echo 1; } - if($conf['usedraft'] && $_POST['wikitext']){ + if($conf['usedraft'] && $INPUT->post->str('wikitext')){ $client = $_SERVER['REMOTE_USER']; if(!$client) $client = clientIP(true); $draft = array('id' => $ID, - 'prefix' => substr($_POST['prefix'], 0, -1), - 'text' => $_POST['wikitext'], - 'suffix' => $_POST['suffix'], - 'date' => (int) $_POST['date'], + 'prefix' => substr($INPUT->post->str('prefix'), 0, -1), + 'text' => $INPUT->post->str('wikitext'), + 'suffix' => $INPUT->post->str('suffix'), + 'date' => $INPUT->post->int('date'), 'client' => $client, ); $cname = getCacheName($draft['client'].$ID,'.draft'); @@ -180,9 +183,10 @@ function ajax_draftdel(){ */ function ajax_medians(){ global $conf; + global $INPUT; // wanted namespace - $ns = cleanID($_POST['ns']); + $ns = cleanID($INPUT->post->str('ns')); $dir = utf8_encodeFN(str_replace(':','/',$ns)); $lvl = count(explode(':',$ns)); @@ -203,9 +207,10 @@ function ajax_medians(){ function ajax_medialist(){ global $conf; global $NS; + global $INPUT; - $NS = cleanID($_POST['ns']); - if ($_POST['do'] == 'media') { + $NS = cleanID($INPUT->post->str('ns')); + if ($INPUT->post->str('do') == 'media') { tpl_mediaFileList(); } else { tpl_mediaContent(true); @@ -241,7 +246,7 @@ function ajax_mediadiff(){ global $INPUT; if ($INPUT->has('image')) $image = cleanID($INPUT->str('image')); - $NS = $_POST['ns']; + $NS = $INPUT->post->str('ns'); $auth = auth_quickaclcheck("$NS:*"); media_diff($image, $NS, $auth, true); } @@ -310,9 +315,10 @@ function dir_delete($path) { */ function ajax_index(){ global $conf; + global $INPUT; // wanted namespace - $ns = cleanID($_POST['idx']); + $ns = cleanID($INPUT->post->str('idx')); $dir = utf8_encodeFN(str_replace(':','/',$ns)); $lvl = count(explode(':',$ns)); @@ -333,8 +339,9 @@ function ajax_index(){ function ajax_linkwiz(){ global $conf; global $lang; + global $INPUT; - $q = ltrim(trim($_POST['q']),':'); + $q = ltrim(trim($INPUT->post->str('q')),':'); $id = noNS($q); $ns = getNS($q); -- cgit v1.2.3 From 5373d8473e7ebb71c7d2b85a36a511358343d1ac Mon Sep 17 00:00:00 2001 From: Hakan Sandell Date: Sat, 8 Sep 2012 15:03:03 +0200 Subject: Replacing $_REQUEST variables with $INPUT wrapper, fetch.php --- lib/exe/fetch.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index 150812b55..e8f189256 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -152,12 +152,12 @@ function sendFile($file,$mime,$dl,$cache){ * @returns array(STATUS, STATUSMESSAGE) */ function checkFileStatus(&$media, &$file, $rev='') { - global $MIME, $EXT, $CACHE; + global $MIME, $EXT, $CACHE, $INPUT; //media to local file if(preg_match('#^(https?)://#i',$media)){ //check hash - if(substr(md5(auth_cookiesalt().$media),0,6) != $_REQUEST['hash']){ + if(substr(md5(auth_cookiesalt().$media),0,6) != $INPUT->str('hash')){ return array( 412, 'Precondition Failed'); } //handle external images -- cgit v1.2.3 From 28c7c067399b7a0c1844ca0f7d46d260b632ec08 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 9 Sep 2012 23:17:20 +0100 Subject: added missing DETAIL_STARTED event to lib/exe/detail.php --- lib/exe/detail.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index ea46bc037..e597db3a2 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -2,6 +2,7 @@ if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../'); define('DOKU_MEDIADETAIL',1); require_once(DOKU_INC.'inc/init.php'); +trigger_event('DETAIL_STARTED', $tmp=array()); //close session session_write_close(); -- cgit v1.2.3 From e71b260a0446cb34eacbd16234691eca41feb9b1 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Sep 2012 00:10:23 +0200 Subject: Simplify js_compress() for regular expressions FS#2593 This simplifies a while loop in the js_compress() code. The functionality of the new code is completely identical to the old code but it uses less comparisons and according to FS#2593 it is thus a lot faster. --- lib/exe/js.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/js.php b/lib/exe/js.php index 634e21207..42979eeed 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -301,10 +301,8 @@ function js_compress($s){ // now move forward and find the end of it $j = 1; while($s{$i+$j} != '/'){ - while( ($s{$i+$j} != '\\') && ($s{$i+$j} != '/')){ - $j = $j + 1; - } if($s{$i+$j} == '\\') $j = $j + 2; + else $j++; } $result .= substr($s,$i,$j+1); $i = $i + $j + 1; -- cgit v1.2.3 From 14977bd2edded61cecdc10116826eef384777e82 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Sep 2012 21:57:56 +0200 Subject: Fix CSS cache handling and CSS output This fixes several problems: - the CSS cache was only updated when either the CSS files for all media types or one of the global files was modified - when only the screen CSS was changed, the screen CSS was regenerated but then the cache was printed which either caused duplicated screen CSS output when gzip output was disabled or invalid output with gzip enabled as first the plain text screen CSS and then the gzip-compressed cache file was printed Now first all CSS files are collected, then the cache is checked once and only after this the CSS content is collected. --- lib/exe/css.php | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 8de3db11b..0ad9dee06 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -64,21 +64,27 @@ function css_out(){ // start output buffering ob_start(); + // Array of needed files and their web locations, the latter ones + // are needed to fix relative paths in the stylesheets + $files = array(); + + $cache_files = getConfigFiles('main'); + $cache_files[] = $tplinc.'style.ini'; + $cache_files[] = __FILE__; + foreach($mediatypes as $mediatype) { - // Array of needed files and their web locations, the latter ones - // are needed to fix relative paths in the stylesheets - $files = array(); + $files[$mediatype] = array(); // load core styles - $files[DOKU_INC.'lib/styles/'.$mediatype.'.css'] = DOKU_BASE.'lib/styles/'; + $files[$mediatype][DOKU_INC.'lib/styles/'.$mediatype.'.css'] = DOKU_BASE.'lib/styles/'; // load jQuery-UI theme if ($mediatype == 'screen') { - $files[DOKU_INC.'lib/scripts/jquery/jquery-ui-theme/smoothness.css'] = DOKU_BASE.'lib/scripts/jquery/jquery-ui-theme/'; + $files[$mediatype][DOKU_INC.'lib/scripts/jquery/jquery-ui-theme/smoothness.css'] = DOKU_BASE.'lib/scripts/jquery/jquery-ui-theme/'; } // load plugin styles - $files = array_merge($files, css_pluginstyles($mediatype)); + $files[$mediatype] = array_merge($files[$mediatype], css_pluginstyles($mediatype)); // load template styles if (isset($tplstyles[$mediatype])) { - $files = array_merge($files, $tplstyles[$mediatype]); + $files[$mediatype] = array_merge($files[$mediatype], $tplstyles[$mediatype]); } // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility if (isset($config_cascade['userstyle']['default'])) { @@ -86,7 +92,7 @@ function css_out(){ } // load user styles if(isset($config_cascade['userstyle'][$mediatype])){ - $files[$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; + $files[$mediatype][$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; } // load rtl styles // note: this adds the rtl styles only to the 'screen' media type @@ -94,20 +100,20 @@ function css_out(){ // please use "[dir=rtl]" in any css file in all, screen or print mode instead if ($mediatype=='screen') { if($lang['direction'] == 'rtl'){ - if (isset($tplstyles['rtl'])) $files = array_merge($files, $tplstyles['rtl']); + if (isset($tplstyles['rtl'])) $files[$mediatype] = array_merge($files[$mediatype], $tplstyles['rtl']); } } - $cache_files = array_merge(array_keys($files), getConfigFiles('main')); - $cache_files[] = $tplinc.'style.ini'; - $cache_files[] = __FILE__; + $cache_files = array_merge($cache_files, array_keys($files[$mediatype])); + } - // check cache age & handle conditional request - // This may exit if a cache can be used - http_cached($cache->cache, - $cache->useCache(array('files' => $cache_files))); + // check cache age & handle conditional request + // This may exit if a cache can be used + http_cached($cache->cache, + $cache->useCache(array('files' => $cache_files))); - // build the stylesheet + // build the stylesheet + foreach ($mediatypes as $mediatype) { // print the default classes for interwiki links and file downloads if ($mediatype == 'screen') { @@ -117,7 +123,7 @@ function css_out(){ // load files $css_content = ''; - foreach($files as $file => $location){ + foreach($files[$mediatype] as $file => $location){ $css_content .= css_loadfile($file, $location); } switch ($mediatype) { -- cgit v1.2.3 From dbf794bf86316c93b56454ab5d2c658598cce617 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Sep 2012 22:46:47 +0200 Subject: Set default userstyle only once as screen userstyle --- lib/exe/css.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 0ad9dee06..cee806ef4 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -61,6 +61,11 @@ function css_out(){ } } + // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility + if (isset($config_cascade['userstyle']['default'])) { + $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; + } + // start output buffering ob_start(); @@ -86,10 +91,6 @@ function css_out(){ if (isset($tplstyles[$mediatype])) { $files[$mediatype] = array_merge($files[$mediatype], $tplstyles[$mediatype]); } - // if old 'default' userstyle setting exists, make it 'screen' userstyle for backwards compatibility - if (isset($config_cascade['userstyle']['default'])) { - $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; - } // load user styles if(isset($config_cascade['userstyle'][$mediatype])){ $files[$mediatype][$config_cascade['userstyle'][$mediatype]] = DOKU_BASE; -- cgit v1.2.3 From c5c68de9adc23077defdd39f9264286a62fb2e0e Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Sep 2012 22:47:22 +0200 Subject: Load rtl userstyle as it is still supported (did it ever work?) --- lib/exe/css.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index cee806ef4..fb639fc7e 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -102,6 +102,7 @@ function css_out(){ if ($mediatype=='screen') { if($lang['direction'] == 'rtl'){ if (isset($tplstyles['rtl'])) $files[$mediatype] = array_merge($files[$mediatype], $tplstyles['rtl']); + if (isset($config_cascade['userstyle']['rtl'])) $files[$mediatype][$config_cascade['userstyle']['rtl']] = DOKU_BASE; } } -- cgit v1.2.3 From 3899c2ecc4140de70c555215188bab73b4870e10 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Tue, 18 Sep 2012 22:53:59 +0200 Subject: Start output buffering in lib/exe/css.php only when the CSS is generated This prevents buffering of the cache file output. --- lib/exe/css.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index fb639fc7e..8899ff193 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -66,9 +66,6 @@ function css_out(){ $config_cascade['userstyle']['screen'] = $config_cascade['userstyle']['default']; } - // start output buffering - ob_start(); - // Array of needed files and their web locations, the latter ones // are needed to fix relative paths in the stylesheets $files = array(); @@ -114,6 +111,9 @@ function css_out(){ http_cached($cache->cache, $cache->useCache(array('files' => $cache_files))); + // start output buffering + ob_start(); + // build the stylesheet foreach ($mediatypes as $mediatype) { -- cgit v1.2.3 From 0e6f9f08b1c948f45d1867346a4502021afa55bc Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 7 Oct 2012 15:30:38 +0100 Subject: added support for local style.ini files --- lib/exe/css.php | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 8899ff193..dd69c94cf 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -49,14 +49,17 @@ 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) { + $ini = parse_ini_file($styleini, true); + foreach($ini['stylesheets'] as $file => $mode) { $tplstyles[$mode][$tplinc.$file] = $tpldir; } } @@ -71,7 +74,8 @@ function css_out(){ $files = array(); $cache_files = getConfigFiles('main'); - $cache_files[] = $tplinc.'style.ini'; + if ($styleini) + $cache_files[] = $styleini; $cache_files[] = __FILE__; foreach($mediatypes as $mediatype) { @@ -173,13 +177,26 @@ function css_out(){ * @author Andreas Gohr */ function css_applystyle($css,$tplinc){ - if(@file_exists($tplinc.'style.ini')){ - $ini = parse_ini_file($tplinc.'style.ini',true); + $styleini = css_styleini($tplinc); + + if($styleini){ + $ini = parse_ini_file($styleini,true); $css = strtr($css,$ini['replacements']); } return $css; } +/** + * If either exist, get the template's style.local.ini or style.ini file. + */ +function css_styleini($tplinc) { + if(@file_exists($tplinc.'style.local.ini')) + return $tplinc.'style.local.ini'; + if(@file_exists($tplinc.'style.ini')) + return $tplinc.'style.ini'; + return ''; +} + /** * Prints classes for interwikilinks * -- cgit v1.2.3 From 0ac69508958a06e566a51fb6a74802401ebe5eb5 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Thu, 11 Oct 2012 13:26:47 +0100 Subject: changed local style.ini to be merged with standard one --- lib/exe/css.php | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index dd69c94cf..ae160558a 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -58,8 +58,7 @@ function css_out(){ // load template styles $tplstyles = array(); if ($styleini) { - $ini = parse_ini_file($styleini, true); - foreach($ini['stylesheets'] as $file => $mode) { + foreach($styleini['stylesheets'] as $file => $mode) { $tplstyles[$mode][$tplinc.$file] = $tpldir; } } @@ -74,8 +73,8 @@ function css_out(){ $files = array(); $cache_files = getConfigFiles('main'); - if ($styleini) - $cache_files[] = $styleini; + $cache_files[] = $tplinc.'style.ini'; + $cache_files[] = $tplinc.'style.local.ini'; $cache_files[] = __FILE__; foreach($mediatypes as $mediatype) { @@ -180,21 +179,31 @@ function css_applystyle($css,$tplinc){ $styleini = css_styleini($tplinc); if($styleini){ - $ini = parse_ini_file($styleini,true); - $css = strtr($css,$ini['replacements']); + $css = strtr($css,$styleini['replacements']); } return $css; } /** - * If either exist, get the template's style.local.ini or style.ini file. + * Get contents of merged style.ini and style.local.ini as an array. + * + * @author Anika Henke */ function css_styleini($tplinc) { - if(@file_exists($tplinc.'style.local.ini')) - return $tplinc.'style.local.ini'; - if(@file_exists($tplinc.'style.ini')) - return $tplinc.'style.ini'; - return ''; + $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; } /** -- cgit v1.2.3 From cacfb6067895a011e255d9f940a8dac2fa2c1110 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Fri, 12 Oct 2012 23:15:53 +0100 Subject: fixed interwiki and filetype styles being included in all css modes --- lib/exe/css.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index ae160558a..1e662c64a 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -122,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 -- cgit v1.2.3 From 58789954a7642c133920f37a51fd3dbb5d76cbde Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 23 Oct 2012 18:08:57 +0200 Subject: correctly check hash parameter in media dispatcher FS#2648 --- lib/exe/fetch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') 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 -- cgit v1.2.3 From 46a853c3756aa4abe582ccb0de6f4e1f4b2035c4 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 27 Nov 2012 17:39:04 +0100 Subject: correct return in sendDigest() the function always returned true, even if no action was taken. This resulted in no further indexer tasks being run. --- lib/exe/indexer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php index 1ccede923..c336514cd 100644 --- a/lib/exe/indexer.php +++ b/lib/exe/indexer.php @@ -181,6 +181,8 @@ function sendDigest() { global $conf; global $USERINFO; + $sent = false; + // remember current user info $olduinfo = $USERINFO; $olduser = $_SERVER['REMOTE_USER']; @@ -236,9 +238,11 @@ function sendDigest() { foreach($change_ids as $change_id) { subscription_send_digest($USERINFO['mail'], $change_id, $lastupdate); + $sent = true; } } elseif ($style === 'list') { subscription_send_list($USERINFO['mail'], $change_ids, $id); + $sent = true; } // TODO: Handle duplicate subscriptions. @@ -252,7 +256,7 @@ function sendDigest() { $USERINFO = $olduinfo; $_SERVER['REMOTE_USER'] = $olduser; echo 'sendDigest(): finished'.NL; - return true; + return $sent; } /** -- cgit v1.2.3