diff options
author | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-03-10 23:57:01 +0100 |
---|---|---|
committer | Gerrit Uitslag <klapinklapin@gmail.com> | 2014-03-10 23:57:01 +0100 |
commit | f97db66038968542deefbf9817a3dd49b67b1904 (patch) | |
tree | 6995f5bfd7017999a743c327474afc7b9514d94f /inc/template.php | |
parent | 6384941886832589f7bb3c13bc18115499cf9369 (diff) | |
parent | 9f12fc1cc9e916c3172a0cf8953ed70fd18f2ec1 (diff) | |
download | rpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.gz rpg-f97db66038968542deefbf9817a3dd49b67b1904.tar.bz2 |
Merge remote-tracking branch 'origin/master' into userlink
Conflicts:
inc/parser/renderer.php
inc/template.php
Diffstat (limited to 'inc/template.php')
-rw-r--r-- | inc/template.php | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/inc/template.php b/inc/template.php index ba7279636..5a3bdea6a 100644 --- a/inc/template.php +++ b/inc/template.php @@ -210,7 +210,7 @@ function tpl_toc($return = false) { } else { $tocok = true; } - $toc = $meta['description']['tableofcontents']; + $toc = isset($meta['description']['tableofcontents']) ? $meta['description']['tableofcontents'] : null; if(!$tocok || !is_array($toc) || !$conf['tocminheads'] || count($toc) < $conf['tocminheads']) { $toc = array(); } @@ -291,6 +291,8 @@ function tpl_metaheaders($alt = true) { global $lang; global $conf; global $updateVersion; + /** @var Input $INPUT */ + global $INPUT; // prepare the head array $head = array(); @@ -401,7 +403,7 @@ function tpl_metaheaders($alt = true) { // make $INFO and other vars available to JavaScripts $json = new JSON(); $script = "var NS='".$INFO['namespace']."';"; - if($conf['useacl'] && !empty($_SERVER['REMOTE_USER'])) { + if($conf['useacl'] && $INPUT->server->str('REMOTE_USER')) { $script .= "var SIG='".toolbar_signature()."';"; } $script .= 'var JSINFO = '.$json->encode($JSINFO).';'; @@ -603,6 +605,8 @@ function tpl_get_action($type) { global $REV; global $ACT; global $conf; + /** @var Input $INPUT */ + global $INPUT; // check disabled actions and fix the badly named ones if($type == 'history') $type = 'revisions'; @@ -637,7 +641,7 @@ function tpl_get_action($type) { $accesskey = 'v'; } } else { - $params = array(); + $params = array('do' => ''); $type = 'show'; $accesskey = 'v'; } @@ -658,7 +662,7 @@ function tpl_get_action($type) { break; case 'top': $accesskey = 't'; - $params = array(); + $params = array('do' => ''); $id = '#dokuwiki__top'; break; case 'back': @@ -667,12 +671,12 @@ function tpl_get_action($type) { return false; } $id = $parent; - $params = array(); + $params = array('do' => ''); $accesskey = 'b'; break; case 'login': $params['sectok'] = getSecurityToken(); - if(isset($_SERVER['REMOTE_USER'])) { + if($INPUT->server->has('REMOTE_USER')) { if(!actionOK('logout')) { return false; } @@ -681,12 +685,12 @@ function tpl_get_action($type) { } break; case 'register': - if(!empty($_SERVER['REMOTE_USER'])) { + if($INPUT->server->str('REMOTE_USER')) { return false; } break; case 'resendpwd': - if(!empty($_SERVER['REMOTE_USER'])) { + if($INPUT->server->str('REMOTE_USER')) { return false; } break; @@ -703,14 +707,14 @@ function tpl_get_action($type) { $params['sectok'] = getSecurityToken(); break; case 'subscribe': - if(!$_SERVER['REMOTE_USER']) { + if(!$INPUT->server->str('REMOTE_USER')) { return false; } break; case 'backlink': break; case 'profile': - if(!isset($_SERVER['REMOTE_USER'])) { + if(!$INPUT->server->has('REMOTE_USER')) { return false; } break; @@ -885,7 +889,10 @@ function tpl_youarehere($sep = ' » ') { */ function tpl_userinfo() { global $lang; - if(isset($_SERVER['REMOTE_USER'])) { + /** @var Input $INPUT */ + global $INPUT; + + if($INPUT->server->str('REMOTE_USER')) { print $lang['loggedinas'].': '.userinfo(); return true; } @@ -1029,6 +1036,7 @@ function tpl_img_getTag($tags, $alt = '', $src = null) { */ function tpl_img($maxwidth = 0, $maxheight = 0, $link = true, $params = null) { global $IMG; + /** @var Input $INPUT */ global $INPUT; $w = tpl_img_getTag('File.Width'); $h = tpl_img_getTag('File.Height'); @@ -1241,6 +1249,7 @@ function tpl_mediaContent($fromajax = false, $sort='natural') { global $INUSE; global $NS; global $JUMPTO; + /** @var Input $INPUT */ global $INPUT; $do = $INPUT->extract('do')->str('do'); @@ -1290,6 +1299,7 @@ function tpl_mediaFileList() { global $NS; global $JUMPTO; global $lang; + /** @var Input $INPUT */ global $INPUT; $opened_tab = $INPUT->str('tab_files'); @@ -1330,7 +1340,9 @@ function tpl_mediaFileList() { * @author Kate Arzamastseva <pshns@ukr.net> */ function tpl_mediaFileDetails($image, $rev) { - global $AUTH, $NS, $conf, $DEL, $lang, $INPUT; + global $AUTH, $NS, $conf, $DEL, $lang; + /** @var Input $INPUT */ + global $INPUT; $removed = (!file_exists(mediaFN($image)) && file_exists(mediaMetaFN($image, '.changes')) && $conf['mediarevisions']); if(!$image || (!file_exists(mediaFN($image)) && !$removed) || $DEL) return; @@ -1408,12 +1420,14 @@ function tpl_actiondropdown($empty = '', $button = '>') { global $ID; global $REV; global $lang; + /** @var Input $INPUT */ + global $INPUT; echo '<form action="'.script().'" method="get" accept-charset="utf-8">'; echo '<div class="no">'; echo '<input type="hidden" name="id" value="'.$ID.'" />'; if($REV) echo '<input type="hidden" name="rev" value="'.$REV.'" />'; - if (!empty($_SERVER['REMOTE_USER'])) { + if ($INPUT->server->str('REMOTE_USER')) { echo '<input type="hidden" name="sectok" value="'.getSecurityToken().'" />'; } @@ -1779,11 +1793,14 @@ function tpl_media() { */ function tpl_classes() { global $ACT, $conf, $ID, $INFO; + /** @var Input $INPUT */ + global $INPUT; + $classes = array( 'dokuwiki', 'mode_'.$ACT, 'tpl_'.$conf['template'], - !empty($_SERVER['REMOTE_USER']) ? 'loggedIn' : '', + $INPUT->server->bool('REMOTE_USER') ? 'loggedIn' : '', $INFO['exists'] ? '' : 'notFound', ($ID == $conf['start']) ? 'home' : '', ); |