From 5c2eed9a193e9341fbfee63d4a973898acdc5ee5 Mon Sep 17 00:00:00 2001 From: lisps Date: Thu, 21 Nov 2013 15:50:52 +0100 Subject: add parameter at($DATE_AT) and mind revisions --- lib/exe/detail.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index cd3f362ad..daa55f405 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -5,6 +5,9 @@ require_once(DOKU_INC.'inc/init.php'); $IMG = getID('media'); $ID = cleanID($INPUT->str('id')); +$REV = & $INPUT->ref('rev'); +//sanitize revision +$REV = preg_replace('/[^0-9]/', '', $REV); // this makes some general info available as well as the info about the // "parent" page @@ -35,7 +38,7 @@ $ERROR = false; $AUTH = auth_quickaclcheck($IMG); if($AUTH >= AUTH_READ){ // check if image exists - $SRC = mediaFN($IMG); + $SRC = mediaFN($IMG,$REV); if(!@file_exists($SRC)){ //doesn't exist! http_status(404); -- cgit v1.2.3 From 4bde2196a1e3572cead3f4d4e4b6a5a752bd62b3 Mon Sep 17 00:00:00 2001 From: lisps Date: Fri, 22 Nov 2013 09:04:44 +0100 Subject: remove property rev from xhtml.php changed variable name $create_time to $modified_time --- lib/exe/detail.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index daa55f405..cc29d5b87 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -5,9 +5,7 @@ require_once(DOKU_INC.'inc/init.php'); $IMG = getID('media'); $ID = cleanID($INPUT->str('id')); -$REV = & $INPUT->ref('rev'); -//sanitize revision -$REV = preg_replace('/[^0-9]/', '', $REV); +$REV = $INPUT->int('rev'); // this makes some general info available as well as the info about the // "parent" page -- cgit v1.2.3 From 7d247a3cecc7d9f7d6e3c84a3589c591d7ed09c0 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Sat, 11 Oct 2014 10:41:57 +0200 Subject: preserve comments in less if 'compress' config disabled Otherwise comments are never visible in css.php --- lib/exe/css.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index 6c1d60751..f7235fd4e 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -166,8 +166,11 @@ function css_out(){ * @return string */ function css_parseless($css) { + global $conf; + $less = new lessc(); $less->importDir[] = DOKU_INC; + $less->setPreserveComments(!$conf['compress']); if (defined('DOKU_UNITTEST')){ $less->importDir[] = TMP_DIR; -- cgit v1.2.3 From 70daee86e69783928d3da887a3a3e26b8ab74734 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Tue, 14 Oct 2014 16:12:08 +0200 Subject: Corrected compression for ++ and -- operator. Partially fixes #897. --- lib/exe/js.php | 34 +++++++++++++++++++++++----------- 1 file changed, 23 insertions(+), 11 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/js.php b/lib/exe/js.php index bec12ef7a..2ab78dfc3 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -289,6 +289,10 @@ function js_compress($s){ // items that don't need spaces next to them $chars = "^&|!+\-*\/%=\?:;,{}()<>% \t\n\r'\"[]"; + // items which need a space if the sign before and after whitespace is equal. + // E.g. '+ ++' may not be compressed to '+++' --> syntax error. + $ops = "+-"; + $regex_starters = array("(", "=", "[", "," , ":", "!"); $whitespaces_chars = array(" ", "\t", "\n", "\r", "\0", "\x0B"); @@ -389,19 +393,27 @@ function js_compress($s){ // whitespaces if( $ch == ' ' || $ch == "\r" || $ch == "\n" || $ch == "\t" ){ - // leading spaces - if($i+1 < $slen && (strpos($chars,$s[$i+1]) !== false)){ - $i = $i + 1; - continue; - } - // trailing spaces - // if this ch is space AND the last char processed - // is special, then skip the space $lch = substr($result,-1); - if($lch && (strpos($chars,$lch) !== false)){ - $i = $i + 1; - continue; + + // Only consider deleting whitespace if the signs before and after + // are not equal and are not an operator which may not follow itself. + if ((!$lch || $s[$i+1] == ' ') + || $lch != $s[$i+1] + || strpos($ops,$s[$i+1]) === false) { + // leading spaces + if($i+1 < $slen && (strpos($chars,$s[$i+1]) !== false)){ + $i = $i + 1; + continue; + } + // trailing spaces + // if this ch is space AND the last char processed + // is special, then skip the space + if($lch && (strpos($chars,$lch) !== false)){ + $i = $i + 1; + continue; + } } + // else after all of this convert the "whitespace" to // a single space. It will get appended below $ch = ' '; -- cgit v1.2.3 From 5c5b52fd17bf855ab64656790b39ff43450902c9 Mon Sep 17 00:00:00 2001 From: LarsDW223 Date: Wed, 15 Oct 2014 10:48:15 +0200 Subject: Fixed JavaScript compression. The compressor did not recognize a regular expression after a '&&' ot '||' operator. So it could happen that code had been cut off if the regular expression included '\//' (which was treated as a single line comment because of the regular expression not being recognized). Finally fixes #897. --- lib/exe/js.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/js.php b/lib/exe/js.php index 2ab78dfc3..545ba7b23 100644 --- a/lib/exe/js.php +++ b/lib/exe/js.php @@ -293,7 +293,7 @@ function js_compress($s){ // E.g. '+ ++' may not be compressed to '+++' --> syntax error. $ops = "+-"; - $regex_starters = array("(", "=", "[", "," , ":", "!"); + $regex_starters = array("(", "=", "[", "," , ":", "!", "&", "|"); $whitespaces_chars = array(" ", "\t", "\n", "\r", "\0", "\x0B"); -- cgit v1.2.3 From fd18b5f4e227c2b114d961b81feecce658597226 Mon Sep 17 00:00:00 2001 From: Gerrit Uitslag Date: Wed, 22 Oct 2014 11:07:46 +0200 Subject: visibility from private to protected for DokuCssFile --- lib/exe/css.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/css.php b/lib/exe/css.php index f7235fd4e..9645b96bc 100644 --- a/lib/exe/css.php +++ b/lib/exe/css.php @@ -421,7 +421,7 @@ class DokuCssFile { protected $filepath; // file system path to the CSS/Less file protected $location; // base url location of the CSS/Less file - private $relative_path = null; + protected $relative_path = null; public function __construct($file) { $this->filepath = $file; @@ -454,7 +454,7 @@ class DokuCssFile { * * @return string relative file system path */ - private function getRelativePath(){ + protected function getRelativePath(){ if (is_null($this->relative_path)) { $basedir = array(DOKU_INC); -- cgit v1.2.3