From 00e3e3940de140e6fe6ce3c558c71a47f676b456 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 3 Aug 2013 17:17:58 +0200 Subject: fix the default ordering of media files to be "natural". also allow the order to be specified in more places. --- lib/exe/ajax.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/ajax.php b/lib/exe/ajax.php index 9769503a7..6e2011cd9 100644 --- a/lib/exe/ajax.php +++ b/lib/exe/ajax.php @@ -219,10 +219,11 @@ function ajax_medialist(){ global $INPUT; $NS = cleanID($INPUT->post->str('ns')); + $sort = $INPUT->post->bool('recent') ? 'date' : 'natural'; if ($INPUT->post->str('do') == 'media') { tpl_mediaFileList(); } else { - tpl_mediaContent(true); + tpl_mediaContent(true, $sort); } } -- cgit v1.2.3 From b8983d3a45d16afc81d527fc2616f8c43bbf2c87 Mon Sep 17 00:00:00 2001 From: Matt Perry Date: Tue, 20 Aug 2013 21:18:30 -0700 Subject: Fix CodeSniffer violations Remove whitespace from end of lines to reduce the number of CodeSniffer violations. --- lib/exe/detail.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index 7008b126f..7aae08f76 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -11,8 +11,8 @@ $ID = cleanID($INPUT->str('id')); $INFO = array_merge(pageinfo(),mediainfo()); trigger_event('DETAIL_STARTED', $tmp=array()); -//close session -session_write_close(); +//close session +session_write_close(); if($conf['allowdebug'] && $INPUT->has('debug')){ print '
';
-- 
cgit v1.2.3


From d91ab76f52f59d264301e18c28a0d3bae996fab8 Mon Sep 17 00:00:00 2001
From: Matt Perry 
Date: Tue, 27 Aug 2013 01:18:10 -0700
Subject: Fix CodeSniffer violations

Fix violations for the following sniff
DokuWiki.Functions.OpeningFunctionBrace

Also removed an extraneous semicolon.
---
 lib/exe/css.php | 3 +--
 lib/exe/js.php  | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

(limited to 'lib/exe')

diff --git a/lib/exe/css.php b/lib/exe/css.php
index 9e1e22e1a..60e17ae82 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -465,8 +465,7 @@ function css_pluginstyles($mediatype='screen'){
  *
  * @author Gabriel Birke 
  */
-function css_moveimports($css)
-{
+function css_moveimports($css) {
     if(!preg_match_all('/@import\s+(?:url\([^)]+\)|"[^"]+")\s*[^;]*;\s*/', $css, $matches, PREG_OFFSET_CAPTURE)) {
         return $css;
     }
diff --git a/lib/exe/js.php b/lib/exe/js.php
index 4b4b598de..76238a81b 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -194,8 +194,7 @@ function js_pluginscripts(){
  *
  * @author Gabriel Birke 
  */
-function js_pluginstrings()
-{
+function js_pluginstrings() {
     global $conf;
     $pluginstrings = array();
     $plugins = plugin_list();
-- 
cgit v1.2.3


From f591e7b075b936baf7357625ef7edb37fe4feaa3 Mon Sep 17 00:00:00 2001
From: Matt Perry 
Date: Tue, 27 Aug 2013 01:45:47 -0700
Subject: Fix CodeSniffer violations

Fix violations for the following sniff
DokuWiki.WhiteSpace.ScopeIndent
---
 lib/exe/indexer.php | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

(limited to 'lib/exe')

diff --git a/lib/exe/indexer.php b/lib/exe/indexer.php
index 57bee8925..3ab117736 100644
--- a/lib/exe/indexer.php
+++ b/lib/exe/indexer.php
@@ -31,12 +31,12 @@ else header('Content-Type: text/plain');
 $tmp = array(); // No event data
 $evt = new Doku_Event('INDEXER_TASKS_RUN', $tmp);
 if ($evt->advise_before()) {
-  runIndexer() or
-  runSitemapper() or
-  sendDigest() or
-  runTrimRecentChanges() or
-  runTrimRecentChanges(true) or
-  $evt->advise_after();
+    runIndexer() or
+    runSitemapper() or
+    sendDigest() or
+    runTrimRecentChanges() or
+    runTrimRecentChanges(true) or
+    $evt->advise_after();
 }
 
 if(!$output) {
@@ -85,13 +85,13 @@ function runTrimRecentChanges($media_changes = false) {
             $out_lines = array();
 
             for ($i=0; $i
Date: Tue, 8 Oct 2013 00:06:46 +0200
Subject: Use in cookie a correct path, added DOKU_COOKIEPATH to js constants
 Fixes FS#2837

---
 lib/exe/js.php | 1 +
 1 file changed, 1 insertion(+)

(limited to 'lib/exe')

diff --git a/lib/exe/js.php b/lib/exe/js.php
index 76238a81b..fc7a869c2 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -89,6 +89,7 @@ function js_out(){
     // add some global variables
     print "var DOKU_BASE   = '".DOKU_BASE."';";
     print "var DOKU_TPL    = '".tpl_basedir()."';";
+    print "var DOKU_COOKIEPATH = '" . (empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']) . "';";
     // FIXME: Move those to JSINFO
     print "var DOKU_UHN    = ".((int) useHeading('navigation')).";";
     print "var DOKU_UHC    = ".((int) useHeading('content')).";";
-- 
cgit v1.2.3


From df5d307ea8bac1f5030d42af363ae9f7469a63f2 Mon Sep 17 00:00:00 2001
From: Gerrit Uitslag 
Date: Thu, 10 Oct 2013 15:53:03 +0200
Subject: add cookie secure parameter to cookies set by javascript

---
 lib/exe/js.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'lib/exe')

diff --git a/lib/exe/js.php b/lib/exe/js.php
index fc7a869c2..040b8874d 100644
--- a/lib/exe/js.php
+++ b/lib/exe/js.php
@@ -86,16 +86,20 @@ function js_out(){
     // start output buffering and build the script
     ob_start();
 
+    $json = new JSON();
     // add some global variables
     print "var DOKU_BASE   = '".DOKU_BASE."';";
     print "var DOKU_TPL    = '".tpl_basedir()."';";
-    print "var DOKU_COOKIEPATH = '" . (empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir']) . "';";
+    print "var DOKU_COOKIE_PARAM = " . $json->encode(
+            array(
+                 'path' => empty($conf['cookiedir']) ? DOKU_REL : $conf['cookiedir'],
+                 'secure' => $conf['securecookie'] && is_ssl()
+            )).";";
     // FIXME: Move those to JSINFO
     print "var DOKU_UHN    = ".((int) useHeading('navigation')).";";
     print "var DOKU_UHC    = ".((int) useHeading('content')).";";
 
     // load JS specific translations
-    $json = new JSON();
     $lang['js']['plugins'] = js_pluginstrings();
     $templatestrings = js_templatestrings();
     if(!empty($templatestrings)) {
-- 
cgit v1.2.3


From 9c7a681b5de7bebb468569a1a416000935b3b3d7 Mon Sep 17 00:00:00 2001
From: Andreas Gohr 
Date: Sat, 12 Oct 2013 18:56:40 +0200
Subject: removed css_moveimports() this is now done by lessphp

---
 lib/exe/css.php | 25 -------------------------
 1 file changed, 25 deletions(-)

(limited to 'lib/exe')

diff --git a/lib/exe/css.php b/lib/exe/css.php
index 60e17ae82..afba5fc02 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -148,9 +148,6 @@ function css_out(){
     // parse less
     $css = css_parseless($css);
 
-    // place all remaining @import statements at the top of the file
-    $css = css_moveimports($css);
-
     // compress whitespace and comments
     if($conf['compress']){
         $css = css_compress($css);
@@ -459,28 +456,6 @@ function css_pluginstyles($mediatype='screen'){
     return $list;
 }
 
-/**
- * Move all @import statements in a combined stylesheet to the top so they
- * aren't ignored by the browser.
- *
- * @author Gabriel Birke 
- */
-function css_moveimports($css) {
-    if(!preg_match_all('/@import\s+(?:url\([^)]+\)|"[^"]+")\s*[^;]*;\s*/', $css, $matches, PREG_OFFSET_CAPTURE)) {
-        return $css;
-    }
-    $newCss  = "";
-    $imports = "";
-    $offset  = 0;
-    foreach($matches[0] as $match) {
-        $newCss  .= substr($css, $offset, $match[1] - $offset);
-        $imports .= $match[0];
-        $offset   = $match[1] + strlen($match[0]);
-    }
-    $newCss .= substr($css, $offset);
-    return $imports.$newCss;
-}
-
 /**
  * Very simple CSS optimizer
  *
-- 
cgit v1.2.3


From 205907a73eaf15c53de98f153e90890706e79cbe Mon Sep 17 00:00:00 2001
From: furun 
Date: Tue, 15 Oct 2013 11:34:31 +0200
Subject: compact some CSS styles to their shorthand syntax FS#2509

---
 lib/exe/css.php | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'lib/exe')

diff --git a/lib/exe/css.php b/lib/exe/css.php
index afba5fc02..6dfdf06e8 100644
--- a/lib/exe/css.php
+++ b/lib/exe/css.php
@@ -473,8 +473,19 @@ function css_compress($css){
     $css = preg_replace('/ ?([;,{}\/]) ?/','\\1',$css);
     $css = preg_replace('/ ?: /',':',$css);
 
+    // number compression
+    $css = preg_replace('/([: ])0+(\.\d+?)0*((?:pt|pc|in|mm|cm|em|ex|px)\b|%)(?=[^\{]*[;\}])/', '$1$2$3', $css); // "0.1em" to ".1em", "1.10em" to "1.1em"
+    $css = preg_replace('/([: ])\.(0)+((?:pt|pc|in|mm|cm|em|ex|px)\b|%)(?=[^\{]*[;\}])/', '$1$2', $css); // ".0em" to "0"
+    $css = preg_replace('/([: ]0)0*(\.0*)?((?:pt|pc|in|mm|cm|em|ex|px)(?=[^\{]*[;\}])\b|%)/', '$1', $css); // "0.0em" to "0"
+    $css = preg_replace('/([: ]\d+)(\.0*)((?:pt|pc|in|mm|cm|em|ex|px)(?=[^\{]*[;\}])\b|%)/', '$1$3', $css); // "1.0em" to "1em"
+    $css = preg_replace('/([: ])0+(\d+|\d*\.\d+)((?:pt|pc|in|mm|cm|em|ex|px)(?=[^\{]*[;\}])\b|%)/', '$1$2$3', $css); // "001em" to "1em"
+
+    // shorten attributes (1em 1em 1em 1em -> 1em)
+    $css = preg_replace('/(?
Date: Tue, 15 Oct 2013 16:36:56 +0200
Subject: fix expression passed by reference

---
 lib/exe/detail.php       | 4 +++-
 lib/exe/mediamanager.php | 3 ++-
 2 files changed, 5 insertions(+), 2 deletions(-)

(limited to 'lib/exe')

diff --git a/lib/exe/detail.php b/lib/exe/detail.php
index 7aae08f76..e3c81d877 100644
--- a/lib/exe/detail.php
+++ b/lib/exe/detail.php
@@ -9,7 +9,9 @@ $ID   = cleanID($INPUT->str('id'));
 // this makes some general infos available as well as the info about the
 // "parent" page
 $INFO = array_merge(pageinfo(),mediainfo());
-trigger_event('DETAIL_STARTED', $tmp=array());
+
+$tmp = array();
+trigger_event('DETAIL_STARTED', $tmp);
 
 //close session
 session_write_close();
diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index d9e4a6b04..d94a24c74 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -34,7 +34,8 @@
     $JSINFO = array('id' => '', 'namespace' => '');
     $AUTH = $INFO['perm'];    // shortcut for historical reasons
 
-    trigger_event('MEDIAMANAGER_STARTED',$tmp=array());
+    $tmp = array();
+    trigger_event('MEDIAMANAGER_STARTED', $tmp);
     session_write_close();  //close session
 
     // do not display the manager if user does not have read access
-- 
cgit v1.2.3