Skip to content
Snippets Groups Projects
Unverified Commit 8f34cf3d authored by Michael Große's avatar Michael Große
Browse files

Fix PHP Notices: Reduce error log noise

While DokuWiki suppresses PHP Notices they are still a code smell and
should be fixed. This fixes some PHP Notices that occurred.

Some of these fixes could be refactored into nicer code once we move to
PHP 7 and get access to the `??` operator.
parent ef365ccc
No related branches found
No related tags found
No related merge requests found
......@@ -839,12 +839,18 @@ class Doku_Renderer extends DokuWiki_Plugin {
return rawurlencode($match[0]);
}, $reference), $url);
$parsed = parse_url($reference);
if(!$parsed['port']) $parsed['port'] = 80;
$url = str_replace('{SCHEME}', $parsed['scheme'], $url);
$url = str_replace('{HOST}', $parsed['host'], $url);
$url = str_replace('{PORT}', $parsed['port'], $url);
$url = str_replace('{PATH}', $parsed['path'], $url);
$url = str_replace('{QUERY}', $parsed['query'], $url);
if (empty($parsed['scheme'])) $parsed['scheme'] = '';
if (empty($parsed['host'])) $parsed['host'] = '';
if (empty($parsed['port'])) $parsed['port'] = 80;
if (empty($parsed['path'])) $parsed['path'] = '';
if (empty($parsed['query'])) $parsed['query'] = '';
$url = strtr($url,[
'{SCHEME}' => $parsed['scheme'],
'{HOST}' => $parsed['host'],
'{PORT}' => $parsed['port'],
'{PATH}' => $parsed['path'],
'{QUERY}' => $parsed['query'] ,
]);
} else {
//default
$url = $url.rawurlencode($reference);
......
......@@ -1133,7 +1133,9 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
function internalmedia($src, $title = null, $align = null, $width = null,
$height = null, $cache = null, $linking = null, $return = false) {
global $ID;
list($src, $hash) = explode('#', $src, 2);
if (strpos($src, '#') !== false) {
list($src, $hash) = explode('#', $src, 2);
}
resolve_mediaid(getNS($ID), $src, $exists, $this->date_at, true);
$noLink = false;
......@@ -1154,7 +1156,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
if($exists) $link['title'] .= ' ('.filesize_h(filesize(mediaFN($src))).')';
}
if($hash) $link['url'] .= '#'.$hash;
if (!empty($hash)) $link['url'] .= '#'.$hash;
//markup non existing files
if(!$exists) {
......
......@@ -333,14 +333,14 @@ function search_allpages(&$data,$base,$file,$type,$lvl,$opts){
$item = array();
$item['id'] = pathID($file);
if(!$opts['skipacl'] && auth_quickaclcheck($item['id']) < AUTH_READ){
if(isset($opts['skipacl']) && !$opts['skipacl'] && auth_quickaclcheck($item['id']) < AUTH_READ){
return false;
}
$item['rev'] = filemtime($base.'/'.$file);
$item['mtime'] = $item['rev'];
$item['size'] = filesize($base.'/'.$file);
if($opts['hash']){
if(!empty($opts['hash'])){
$item['hash'] = md5(trim(rawWiki($item['id'])));
}
......
......@@ -530,7 +530,7 @@ function css_datauri($match){
if($size && $size < $conf['cssdatauri']){
$data = base64_encode(file_get_contents($local));
}
if($data){
if (!empty($data)){
$url = 'data:image/'.$ext.';base64,'.$data;
}else{
$url = $base.$url;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment