diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php index f1290ddd7d489e6ba064a81216d6ef4b8a0cb34a..5e25c4456e95bcf88657d6474fa6059238047a6a 100644 --- a/conf/dokuwiki.php +++ b/conf/dokuwiki.php @@ -43,6 +43,10 @@ $conf['deaccent'] = 1; //deaccented chars in pagenames (1) or $conf['useheading'] = 0; //use the first heading in a page as its name $conf['refcheck'] = 1; //check for references before deleting media files $conf['refshow'] = 0; //how many references should be shown, 5 is a good value +$conf['showuseras'] = 'loginname'; // 'loginname' users login name + // 'username' users full name + // 'email' e-mail address (will be obfuscated as per mailguard) + // 'email_link' e-mail address as a mailto: link (obfuscated) /* Antispam Features */ diff --git a/inc/common.php b/inc/common.php index 5dfc498560e9d9aadf191deb6492a8be79ba94a0..962c05c37307056877ce5dd9d424cce467f25e85 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1271,4 +1271,41 @@ function shorten($keep,$short,$max,$min=9,$char='⌇'){ return $keep.utf8_substr($short,0,$half-1).$char.utf8_substr($short,$len-$half); } +/** + * Return the users realname or e-mail address for use + * in page footer and recent changes pages + * + * @author Andy Webber <dokuwiki AT andywebber DOT com> + */ +function editorinfo($username){ + global $conf; + global $auth; + + switch($conf['showuseras']){ + case 'username': + case 'email': + case 'email_link': + $info = $auth->getUserData($username); + break; + default: + return hsc($username); + } + + if(isset($info) && $info) { + switch($conf['showuseras']){ + case 'username': + return hsc($info['name']); + case 'email': + return obfuscate($info['mail']); + case 'email_link': + $mail=obfuscate($info['mail']); + return '<a href="mailto:'.$mail.'">'.$mail.'</a>'; + default: + return hsc($username); + } + } else { + return hsc($username); + } +} + //Setup VIM: ex: et ts=2 enc=utf-8 : diff --git a/inc/html.php b/inc/html.php index 24b811d29c28d6507b5f15ec836624305bd465f0..e7525ae2d172580c68cf6945c2c1ae0ca20d1537 100644 --- a/inc/html.php +++ b/inc/html.php @@ -438,7 +438,7 @@ function html_revisions($first=0){ print ' – '; print htmlspecialchars($INFO['sum']); print ' <span class="user">'; - print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):htmlspecialchars($INFO['editor']); + print (empty($INFO['editor']))?('('.$lang['external_edit'].')'):editorinfo($INFO['editor']); print '</span> '; print '('.$lang['current'].')'; @@ -482,7 +482,7 @@ function html_revisions($first=0){ print htmlspecialchars($info['sum']); print ' <span class="user">'; if($info['user']){ - print htmlspecialchars($info['user']); + print editorinfo($info['user']); }else{ print $info['ip']; } @@ -576,7 +576,7 @@ function html_recent($first=0){ print ' <span class="user">'; if($recent['user']){ - print htmlspecialchars($recent['user']); + print editorinfo($recent['user']); }else{ print $recent['ip']; } diff --git a/inc/template.php b/inc/template.php index 5997e0d33106605e99d1a622b5b03548bed7982a..0b37734d8598505654e92781344a1adb03d6e318 100644 --- a/inc/template.php +++ b/inc/template.php @@ -869,9 +869,8 @@ function tpl_youarehere($sep=' » '){ */ function tpl_userinfo(){ global $lang; - global $INFO; if($_SERVER['REMOTE_USER']){ - print $lang['loggedinas'].': '.$INFO['userinfo']['name']; + print $lang['loggedinas'].': '.editorinfo($_SERVER['REMOTE_USER']); return true; } return false; @@ -914,7 +913,7 @@ function tpl_pageinfo($ret=false){ $out .= $date; if($INFO['editor']){ $out .= ' '.$lang['by'].' '; - $out .= $INFO['editor']; + $out .= editorinfo($INFO['editor']); }else{ $out .= ' ('.$lang['external_edit'].')'; } @@ -922,7 +921,7 @@ function tpl_pageinfo($ret=false){ $out .= ' · '; $out .= $lang['lockedby']; $out .= ': '; - $out .= $INFO['locked']; + $out .= editorinfo($INFO['locked']); } if($ret){ return $out; diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index 864e79ee1eb9def13e79bd709acc4187bfa0c2e0..3de0bbd7dbe5d38818e8db6ffa480cc44041edc9 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -81,6 +81,7 @@ $lang['indexdelay'] = 'Time delay before indexing (sec)'; $lang['relnofollow'] = 'Use rel="nofollow" on external links'; $lang['mailguard'] = 'Obfuscate email addresses'; $lang['iexssprotect']= 'Check uploaded files for possibly malicious JavaScript or HTML code'; +$lang['showuseras'] = 'What to display when showing the user that last edited a page'; /* Authentication Options */ $lang['useacl'] = 'Use access control lists'; @@ -210,3 +211,9 @@ $lang['xsendfile_o_0'] = "don't use"; $lang['xsendfile_o_1'] = 'Proprietary lighttpd header (before release 1.5)'; $lang['xsendfile_o_2'] = 'Standard X-Sendfile header'; $lang['xsendfile_o_3'] = 'Proprietary Nginx X-Accel-Redirect header'; + +/* Display user info */ +$lang['showuseras_o_loginname'] = 'Login name'; +$lang['showuseras_o_username'] = "User's full name"; +$lang['showuseras_o_email'] = "User's e-mail addresss (obfuscated according to mailguard setting)"; +$lang['showuseras_o_email_link'] = "User's e-mail addresss as a mailto: link"; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 4c86c2370f29d1ca0767a7f86bb235e0841fa6cf..ee558b767c35a6bc315b844da3c3c257aa00e635 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -99,6 +99,7 @@ $meta['fullpath'] = array('onoff'); $meta['typography'] = array('multichoice','_choices' => array(0,1,2)); $meta['dformat'] = array('string'); $meta['signature'] = array('string'); +$meta['showuseras'] = array('multichoice','_choices' => array('loginname','username','email','email_link')); $meta['toptoclevel'] = array('multichoice','_choices' => array(1,2,3,4,5)); // 5 toc levels $meta['maxtoclevel'] = array('multichoice','_choices' => array(0,1,2,3,4,5)); $meta['maxseclevel'] = array('multichoice','_choices' => array(0,1,2,3,4,5)); // 0 for no sec edit buttons