aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/inc
diff options
context:
space:
mode:
Diffstat (limited to 'inc')
-rw-r--r--inc/Cache/Cache.php13
-rw-r--r--inc/Cache/CacheInstructions.php2
-rw-r--r--inc/Search/Indexer.php4
-rw-r--r--inc/html.php2
-rw-r--r--inc/init.php4
-rw-r--r--inc/io.php2
-rw-r--r--inc/media.php4
-rw-r--r--inc/parser/renderer.php16
-rw-r--r--inc/parser/xhtml.php16
-rw-r--r--inc/template.php7
10 files changed, 43 insertions, 27 deletions
diff --git a/inc/Cache/Cache.php b/inc/Cache/Cache.php
index ab64da5cb..af82e6bf6 100644
--- a/inc/Cache/Cache.php
+++ b/inc/Cache/Cache.php
@@ -78,9 +78,13 @@ class Cache
$this->depends = $depends;
$this->addDependencies();
- if ($this->_event) {
- return $this->stats(Event::createAndTrigger(
- $this->_event, $this, array($this, 'makeDefaultCacheDecision'))
+ if ($this->getEvent()) {
+ return $this->stats(
+ Event::createAndTrigger(
+ $this->getEvent(),
+ $this,
+ array($this, 'makeDefaultCacheDecision')
+ )
);
}
@@ -105,7 +109,6 @@ class Cache
*/
public function makeDefaultCacheDecision()
{
-
if ($this->_nocache) {
return false;
} // caching turned off
@@ -170,7 +173,7 @@ class Cache
return false;
}
- return io_savefile($this->cache, $data);
+ return io_saveFile($this->cache, $data);
}
/**
diff --git a/inc/Cache/CacheInstructions.php b/inc/Cache/CacheInstructions.php
index 3c4786105..acd02abae 100644
--- a/inc/Cache/CacheInstructions.php
+++ b/inc/Cache/CacheInstructions.php
@@ -41,6 +41,6 @@ class CacheInstructions extends \dokuwiki\Cache\CacheParser
return false;
}
- return io_savefile($this->cache, serialize($instructions));
+ return io_saveFile($this->cache, serialize($instructions));
}
}
diff --git a/inc/Search/Indexer.php b/inc/Search/Indexer.php
index 8770ac794..a29e5b28b 100644
--- a/inc/Search/Indexer.php
+++ b/inc/Search/Indexer.php
@@ -1000,7 +1000,7 @@ class Indexer {
if (!empty($lines))
fwrite($fh, "\n");
fclose($fh);
- if (isset($conf['fperm']))
+ if ($conf['fperm'])
chmod($fn.'.tmp', $conf['fperm']);
io_rename($fn.'.tmp', $fn.'.idx');
return true;
@@ -1067,7 +1067,7 @@ class Indexer {
fwrite($fh, $line);
}
fclose($fh);
- if (isset($conf['fperm']))
+ if ($conf['fperm'])
chmod($fn.'.tmp', $conf['fperm']);
io_rename($fn.'.tmp', $fn.'.idx');
return true;
diff --git a/inc/html.php b/inc/html.php
index 1287cb4e9..1f494d46b 100644
--- a/inc/html.php
+++ b/inc/html.php
@@ -1940,7 +1940,7 @@ function html_edit(){
if ($wr) {
// sets changed to true when previewed
- echo '<script type="text/javascript">/*<![CDATA[*/'. NL;
+ echo '<script>/*<![CDATA[*/'. NL;
echo 'textChanged = ' . ($mod ? 'true' : 'false');
echo '/*!]]>*/</script>' . NL;
} ?>
diff --git a/inc/init.php b/inc/init.php
index 69ef6f15a..f9bb53472 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -340,7 +340,7 @@ function init_files(){
$fh = @fopen($file,'a');
if($fh){
fclose($fh);
- if(!empty($conf['fperm'])) chmod($file, $conf['fperm']);
+ if($conf['fperm']) chmod($file, $conf['fperm']);
}else{
nice_die("$file is not writable. Check your permissions settings!");
}
@@ -405,7 +405,7 @@ function init_creationmodes(){
// check what is set automatically by the system on file creation
// and set the fperm param if it's not what we want
- $auto_fmode = 0666 & ~$umask;
+ $auto_fmode = $conf['fmode'] & ~$umask;
if($auto_fmode != $conf['fmode']) $conf['fperm'] = $conf['fmode'];
// check what is set automatically by the system on file creation
diff --git a/inc/io.php b/inc/io.php
index 18aae25e7..1dfabe845 100644
--- a/inc/io.php
+++ b/inc/io.php
@@ -252,7 +252,7 @@ function _io_saveFile($file, $content, $append) {
fclose($fh);
}
- if(!$fileexists and !empty($conf['fperm'])) chmod($file, $conf['fperm']);
+ if(!$fileexists and $conf['fperm']) chmod($file, $conf['fperm']);
return true;
}
diff --git a/inc/media.php b/inc/media.php
index ec40df5ef..cc29bd16c 100644
--- a/inc/media.php
+++ b/inc/media.php
@@ -2082,7 +2082,7 @@ function media_resize_image($file, $ext, $w, $h=0){
media_resize_imageIM($ext, $file, $info[0], $info[1], $local, $w, $h) ||
media_resize_imageGD($ext, $file, $info[0], $info[1], $local, $w, $h)
) {
- if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']);
+ if($conf['fperm']) @chmod($local, $conf['fperm']);
return $local;
}
//still here? resizing failed
@@ -2149,7 +2149,7 @@ function media_crop_image($file, $ext, $w, $h=0){
if( $mtime > @filemtime($file) ||
media_crop_imageIM($ext,$file,$info[0],$info[1],$local,$cw,$ch,$cx,$cy) ||
media_resize_imageGD($ext,$file,$cw,$ch,$local,$cw,$ch,$cx,$cy) ){
- if(!empty($conf['fperm'])) @chmod($local, $conf['fperm']);
+ if($conf['fperm']) @chmod($local, $conf['fperm']);
return media_resize_image($local,$ext, $w, $h);
}
diff --git a/inc/parser/renderer.php b/inc/parser/renderer.php
index 6aba6506c..a03b84c8e 100644
--- a/inc/parser/renderer.php
+++ b/inc/parser/renderer.php
@@ -845,10 +845,13 @@ abstract class Doku_Renderer extends Plugin {
//get interwiki URL
if(isset($this->interwiki[$shortcut])) {
$url = $this->interwiki[$shortcut];
- } else {
- // Default to Google I'm feeling lucky
- $url = 'https://www.google.com/search?q={URL}&amp;btnI=lucky';
- $shortcut = 'go';
+ }elseif(isset($this->interwiki['default'])) {
+ $shortcut = 'default';
+ $url = $this->interwiki[$shortcut];
+ }else{
+ // not parsable interwiki outputs '' to make sure string manipluation works
+ $shortcut = '';
+ $url = '';
}
//split into hash and url part
@@ -880,8 +883,9 @@ abstract class Doku_Renderer extends Plugin {
'{PATH}' => $parsed['path'],
'{QUERY}' => $parsed['query'] ,
]);
- } else {
- //default
+ } else if($url != '') {
+ // make sure when no url is defined, we keep it null
+ // default
$url = $url.rawurlencode($reference);
}
//handle as wiki links
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
index 662883416..169f4f9f4 100644
--- a/inc/parser/xhtml.php
+++ b/inc/parser/xhtml.php
@@ -1062,11 +1062,13 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
$link['url'] = $url;
$link['title'] = htmlspecialchars($link['url']);
- //output formatted
+ // output formatted
if($returnonly) {
+ if($url == '') return $link['name'];
return $this->_formatLink($link);
} else {
- $this->doc .= $this->_formatLink($link);
+ if($url == '') $this->doc .= $link['name'];
+ else $this->doc .= $this->_formatLink($link);
}
}
@@ -1248,9 +1250,17 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
list($shortcut, $reference) = explode('>', $src, 2);
$exists = null;
$src = $this->_resolveInterWiki($shortcut, $reference, $exists);
+ if($src == '' && empty($title)){
+ // make sure at least something will be shown in this case
+ $title = $reference;
+ }
}
list($src, $hash) = explode('#', $src, 2);
$noLink = false;
+ if($src == '') {
+ // only output plaintext without link if there is no src
+ $noLink = true;
+ }
$render = ($linking == 'linkonly') ? false : true;
$link = $this->_getMediaLinkConf($src, $title, $align, $width, $height, $cache, $render);
@@ -1637,7 +1647,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if(!$render) {
// if the picture is not supposed to be rendered
// return the title of the picture
- if(!$title) {
+ if($title === null || $title === "") {
// just show the sourcename
$title = $this->_xmlEntities(\dokuwiki\Utf8\PhpString::basename(noNS($src)));
}
diff --git a/inc/template.php b/inc/template.php
index 1aeef1fee..798fea52e 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -332,7 +332,7 @@ function tpl_metaheaders($alt = true) {
// load stylesheets
$head['link'][] = array(
- 'rel' => 'stylesheet', 'type'=> 'text/css',
+ 'rel' => 'stylesheet',
'href'=> DOKU_BASE.'lib/exe/css.php?t='.rawurlencode($conf['template']).'&tseed='.$tseed
);
@@ -342,13 +342,12 @@ function tpl_metaheaders($alt = true) {
}
jsinfo();
$script .= 'var JSINFO = ' . json_encode($JSINFO).';';
- $head['script'][] = array('type'=> 'text/javascript', '_data'=> $script);
+ $head['script'][] = array('_data'=> $script);
// load jquery
$jquery = getCdnUrls();
foreach($jquery as $src) {
$head['script'][] = array(
- 'type' => 'text/javascript',
'charset' => 'utf-8',
'_data' => '',
'src' => $src,
@@ -357,7 +356,7 @@ function tpl_metaheaders($alt = true) {
// load our javascript dispatcher
$head['script'][] = array(
- 'type'=> 'text/javascript', 'charset'=> 'utf-8', '_data'=> '',
+ 'charset'=> 'utf-8', '_data'=> '',
'src' => DOKU_BASE.'lib/exe/js.php'.'?t='.rawurlencode($conf['template']).'&tseed='.$tseed,
) + ($conf['defer_js'] ? [ 'defer' => 'defer'] : []);