From d572baf83c5a6d61a7f97aa4d115eba76c5f106c Mon Sep 17 00:00:00 2001 From: Klap-in Date: Tue, 21 May 2013 21:40:37 +0200 Subject: Add check for token when resizing and caching external images --- lib/exe/fetch.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/exe') diff --git a/lib/exe/fetch.php b/lib/exe/fetch.php index 7a2250373..5967494bf 100644 --- a/lib/exe/fetch.php +++ b/lib/exe/fetch.php @@ -60,6 +60,7 @@ if (defined('SIMPLE_TEST')) { if($evt->advise_before()) { // redirects if($data['status'] > 300 && $data['status'] <= 304) { + if (defined('SIMPLE_TEST')) return; //TestResponse doesn't recognize redirects send_redirect($data['statusmessage']); } // send any non 200 status -- cgit v1.2.3 From 88833bac87e7fb295c0479a8260d1d63051bca8d Mon Sep 17 00:00:00 2001 From: flammy Date: Mon, 24 Jun 2013 15:05:59 +0300 Subject: Fixes validation problems with base64 encoded images in CSS. --- lib/exe/css.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 1e662c64a..768c8eda4 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -314,7 +314,7 @@ function css_datauri($match){ $data = base64_encode(file_get_contents($local)); } if($data){ - $url = 'data:image/'.$ext.';base64,'.$data; + $url = '\'data:image/'.$ext.';base64,'.$data.'\''; }else{ $url = $base.$url; } -- cgit v1.2.3 From 6b0ec830e5ac0044252908630e52d4494f1df570 Mon Sep 17 00:00:00 2001 From: Michael Hamann Date: Sun, 21 Jul 2013 22:59:27 +0200 Subject: In debug mode: catch and log JS errors with file information When debugging is enabled (allowdebug enabled) JS errors are now catched for each non-core JS file and logged with the additional information from which file they came. This should make it easier to find out which plugin is the cause for broken JS code. The feature isn't enabled by default as defining functions inside try-clauses isn't allowed in strict mode and causes a warning at least in Firefox. --- lib/exe/js.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/exe') diff --git a/lib/exe/js.php b/lib/exe/js.php index 4ff48133e..06769d895 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -104,10 +104,13 @@ function js_out(){ // load files foreach($files as $file){ $ismin = (substr($file,-7) == '.min.js'); + $debugjs = ($conf['allowdebug'] && strpos($file, DOKU_INC.'lib/scripts/') !== 0); echo "\n\n/* XXXXXXXXXX begin of ".str_replace(DOKU_INC, '', $file) ." XXXXXXXXXX */\n\n"; if($ismin) echo "\n/* BEGIN NOCOMPRESS */\n"; + if ($debugjs) echo "\ntry {\n"; js_load($file); + if ($debugjs) echo "\n} catch (e) {\n logError(e, '".str_replace(DOKU_INC, '', $file)."');\n}\n"; if($ismin) echo "\n/* END NOCOMPRESS */\n"; echo "\n\n/* XXXXXXXXXX end of " . str_replace(DOKU_INC, '', $file) . " XXXXXXXXXX */\n\n"; } -- cgit v1.2.3 From 654436fbc9a7765d9faacab950c7d3e8508b747c Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Sun, 21 Jul 2013 23:21:00 +0100 Subject: fixed references to images in old template (FS#2816) --- lib/exe/opensearch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/opensearch.php b/lib/exe/opensearch.php index 73939c347..98f5f52d5 100644 --- a/lib/exe/opensearch.php +++ b/lib/exe/opensearch.php @@ -21,7 +21,7 @@ if(file_exists(DOKU_INC.'favicon.ico')){ }elseif(file_exists(tpl_incdir().'favicon.ico')){ $ico = DOKU_URL.'lib/tpl/'.$conf['template'].'/favicon.ico'; }else{ - $ico = DOKU_URL.'lib/tpl/default/images/favicon.ico'; + $ico = DOKU_URL.'lib/tpl/dokuwiki/images/favicon.ico'; } // output -- cgit v1.2.3 From d4a1ece8f011dd69db05b83d2f98e3207f1a7e48 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 29 Jul 2013 20:06:01 +0200 Subject: add LESS support still needs testing --- lib/exe/css.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 1e662c64a..4a9c825c1 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -154,7 +154,11 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); - // place all @import statements at the top of the file + // parse LESS + $less = new lessc(); + $css = $less->compile($css); + + // place all remaining @import statements at the top of the file $css = css_moveimports($css); // compress whitespace and comments @@ -175,6 +179,9 @@ function css_out(){ * Does placeholder replacements in the style according to * the ones defined in a templates style.ini file * + * This also adds the ini defined placeholders as less variables + * (sans the surrounding __ and with a ini_ prefix) + * * @author Andreas Gohr */ function css_applystyle($css,$tplinc){ @@ -182,6 +189,13 @@ function css_applystyle($css,$tplinc){ if($styleini){ $css = strtr($css,$styleini['replacements']); + + $less = ''; + foreach($styleini as $key => $value){ + $key = trim($key, '_'); + $key = '@ini_'.$key; + $less .= "$key: $value\n"; + } } return $css; } @@ -333,14 +347,17 @@ function css_pluginstyles($mediatype='screen'){ $plugins = plugin_list(); foreach ($plugins as $p){ $list[DOKU_PLUGIN."$p/$mediatype.css"] = DOKU_BASE."lib/plugins/$p/"; + $list[DOKU_PLUGIN."$p/$mediatype.less"] = DOKU_BASE."lib/plugins/$p/"; // alternative for screen.css if ($mediatype=='screen') { $list[DOKU_PLUGIN."$p/style.css"] = DOKU_BASE."lib/plugins/$p/"; + $list[DOKU_PLUGIN."$p/style.less"] = DOKU_BASE."lib/plugins/$p/"; } // @deprecated 2012-04-09: rtl will cease to be a mode of its own, // please use "[dir=rtl]" in any css file in all, screen or print mode instead if($lang['direction'] == 'rtl'){ $list[DOKU_PLUGIN."$p/rtl.css"] = DOKU_BASE."lib/plugins/$p/"; + $list[DOKU_PLUGIN."$p/rtl.less"] = DOKU_BASE."lib/plugins/$p/"; } } return $list; -- cgit v1.2.3 From c51b334ee77310dc0055311092f224be0342cd65 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 30 Jul 2013 12:07:15 +0200 Subject: fixed ini replacement to less variables stuff --- lib/exe/css.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 4a9c825c1..04516e8ba 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -191,11 +191,13 @@ function css_applystyle($css,$tplinc){ $css = strtr($css,$styleini['replacements']); $less = ''; - foreach($styleini as $key => $value){ + foreach($styleini['replacements'] as $key => $value){ $key = trim($key, '_'); $key = '@ini_'.$key; - $less .= "$key: $value\n"; + $less .= "$key: $value;\n"; } + + $css = $less.$css; } return $css; } -- cgit v1.2.3 From cbe37079b2519e6a79696ab6525a61498ab3c3a6 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 30 Jul 2013 15:56:29 +0200 Subject: convert ini replacements to less vars first This makes it possible to safely overwrite ini replacements from within any less file --- lib/exe/css.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 04516e8ba..0157e6a40 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -154,6 +154,9 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); + print $css; + + // parse LESS $less = new lessc(); $css = $less->compile($css); @@ -188,15 +191,21 @@ function css_applystyle($css,$tplinc){ $styleini = css_styleini($tplinc); if($styleini){ - $css = strtr($css,$styleini['replacements']); - + // we convert ini replacements to LESS variable names + // and build a list of variable: value; pairs $less = ''; foreach($styleini['replacements'] as $key => $value){ - $key = trim($key, '_'); - $key = '@ini_'.$key; - $less .= "$key: $value;\n"; + $lkey = trim($key, '_'); + $lkey = '@ini_'.$lkey; + $less .= "$lkey: $value;\n"; + + $styleini['replacements'][$key] = $lkey; } + // we now replace all old ini replacements with LESS variables + $css = strtr($css, $styleini['replacements']); + + // now prepend the list of LESS variables as the very first thing $css = $less.$css; } return $css; -- cgit v1.2.3 From fbaa87779929e23ede8a79fd3890ef493fdb1d81 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Tue, 30 Jul 2013 16:00:28 +0200 Subject: removed debug statement. sorry --- lib/exe/css.php | 3 --- 1 file changed, 3 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 0157e6a40..cd531ef35 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -154,9 +154,6 @@ function css_out(){ // apply style replacements $css = css_applystyle($css,$tplinc); - print $css; - - // parse LESS $less = new lessc(); $css = $less->compile($css); -- cgit v1.2.3 From fd975da73e627193ca68a681ea6b2556c8327f63 Mon Sep 17 00:00:00 2001 From: Anika Henke Date: Wed, 31 Jul 2013 11:58:47 +0100 Subject: removed possibility to have rtl.less files in plugins --- lib/exe/css.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index cd531ef35..5c966db82 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -365,7 +365,6 @@ function css_pluginstyles($mediatype='screen'){ // please use "[dir=rtl]" in any css file in all, screen or print mode instead if($lang['direction'] == 'rtl'){ $list[DOKU_PLUGIN."$p/rtl.css"] = DOKU_BASE."lib/plugins/$p/"; - $list[DOKU_PLUGIN."$p/rtl.less"] = DOKU_BASE."lib/plugins/$p/"; } } return $list; -- cgit v1.2.3 From acd3eb673b5f7c26fc8ec53d0147b30769e2a866 Mon Sep 17 00:00:00 2001 From: Klap-in Date: Fri, 2 Aug 2013 13:41:42 +0200 Subject: Enable LANG.template.