From 1015a57dff9a6f85b8e0534d280aa1e09945a598 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sat, 16 Feb 2013 21:08:09 +0000 Subject: FS#2415 add to mediamanager (refactor pageinfo() and shift MEDIAMANAGER_STARTED after mediainfo() sets up ) --- lib/exe/mediamanager.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index 04dd178cc..7e0543540 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -7,15 +7,11 @@ require_once(DOKU_INC.'inc/init.php'); - trigger_event('MEDIAMANAGER_STARTED',$tmp=array()); - session_write_close(); //close session - global $INPUT; // handle passed message if($INPUT->str('msg1')) msg(hsc($INPUT->str('msg1')),1); if($INPUT->str('err')) msg(hsc($INPUT->str('err')),-1); - // get namespace to display (either direct or from deletion order) if($INPUT->str('delete')){ $DEL = cleanID($INPUT->str('delete')); @@ -29,10 +25,14 @@ $NS = getNS($IMG); }else{ $NS = cleanID($INPUT->str('ns')); + $IMG = null; } - // check auth - $AUTH = auth_quickaclcheck("$NS:*"); + $INFO = mediainfo(); + $AUTH = $INFO['perm']; // shortcut for historical reasons + + trigger_event('MEDIAMANAGER_STARTED',$tmp=array()); + session_write_close(); //close session // do not display the manager if user does not have read access if($AUTH < AUTH_READ && !$fullscreen) { -- cgit v1.2.3 From ca22711e6b0caa2525d6134c28bf0af78e8fcda3 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 3 Mar 2013 18:30:48 +0000 Subject: make global, ensure created in mediamanager is global and merged with any pre-existing --- lib/exe/mediamanager.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/exe') diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php index a205c4570..3ec749cd8 100644 --- a/lib/exe/mediamanager.php +++ b/lib/exe/mediamanager.php @@ -12,6 +12,7 @@ if($INPUT->str('msg1')) msg(hsc($INPUT->str('msg1')),1); if($INPUT->str('err')) msg(hsc($INPUT->str('err')),-1); + global $DEL; // get namespace to display (either direct or from deletion order) if($INPUT->str('delete')){ $DEL = cleanID($INPUT->str('delete')); @@ -28,7 +29,8 @@ $IMG = null; } - $INFO = mediainfo(); + global $INFO; + $INFO = !empty($INFO) ? array_merge($INFO, mediainfo()) : mediainfo(); $AUTH = $INFO['perm']; // shortcut for historical reasons trigger_event('MEDIAMANAGER_STARTED',$tmp=array()); -- cgit v1.2.3 From b613287149ac4707ec40a96b1b6fe8b190fa6439 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 3 Mar 2013 18:34:33 +0000 Subject: include image info in in detail.php; ensure populated before DETAIL_STARTED event --- lib/exe/detail.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'lib/exe') diff --git a/lib/exe/detail.php b/lib/exe/detail.php index db635c016..7008b126f 100644 --- a/lib/exe/detail.php +++ b/lib/exe/detail.php @@ -2,13 +2,18 @@ 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(); $IMG = getID('media'); $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()); + +//close session +session_write_close(); + if($conf['allowdebug'] && $INPUT->has('debug')){ print '
';
     foreach(explode(' ','basedir userewrite baseurl useslash') as $x){
@@ -39,10 +44,6 @@ if($AUTH >= AUTH_READ){
     $ERROR = p_locale_xhtml('denied');
 }
 
-// this makes some general infos available as well as the info about the
-// "parent" page
-$INFO = pageinfo();
-
 //start output and load template
 header('Content-Type: text/html; charset=utf-8');
 include(template('detail.php'));
-- 
cgit v1.2.3


From 3074e3428bd5d1e38078dbac80a1eb9b96f917d7 Mon Sep 17 00:00:00 2001
From: Christopher Smith 
Date: Sun, 3 Mar 2013 18:35:27 +0000
Subject: fix comment grammar

---
 lib/exe/mediamanager.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'lib/exe')

diff --git a/lib/exe/mediamanager.php b/lib/exe/mediamanager.php
index 3ec749cd8..66e5ddc82 100644
--- a/lib/exe/mediamanager.php
+++ b/lib/exe/mediamanager.php
@@ -54,7 +54,7 @@
         exit;
     }
 
-    // give info on PHP catched upload errors
+    // give info on PHP caught upload errors
     if($_FILES['upload']['error']){
         switch($_FILES['upload']['error']){
             case 1:
-- 
cgit v1.2.3


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.