From 2046a6546c8ed62b9a7b33305b6201458f2f8291 Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Wed, 12 Mar 2014 15:38:28 +0000 Subject: Allow user info to be retrieved without groups Some parts of dokuwiki (e.g. recent changes, old revisions) can requests lots of user info (to provide editor names) without requiring any group information. This change also implements caching of user info by authmysql & authpgsql plugins to avoid repeated querying of the DB to retrieve the same user information. --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 9fbebde94..6851cdea3 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1467,7 +1467,7 @@ function editorinfo($username) { case 'username': case 'email': case 'email_link': - if($auth) $info = $auth->getUserData($username); + if($auth) $info = $auth->getUserData($username, DokuWiki_Auth_Plugin::IGNORE_GROUPS); break; default: return hsc($username); -- cgit v1.2.3 From 06e3e0c7b506a637df1ea27c6a8a439756e7139d Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Fri, 14 Mar 2014 17:58:53 +0000 Subject: use $requireGroups constants in auth classes; comments; code improvements --- inc/common.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 6851cdea3..9ed9e84d4 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1454,13 +1454,14 @@ function shorten($keep, $short, $max, $min = 9, $char = '…') { } /** - * Return the users realname or e-mail address for use + * Return the users real name or e-mail address for use * in page footer and recent changes pages * * @author Andy Webber */ function editorinfo($username) { global $conf; + /* @var DokuWiki_Auth_Plugin $auth */ global $auth; switch($conf['showuseras']) { @@ -1473,7 +1474,7 @@ function editorinfo($username) { return hsc($username); } - if(isset($info) && $info) { + if(!empty($info)) { switch($conf['showuseras']) { case 'username': return hsc($info['name']); @@ -1485,9 +1486,9 @@ function editorinfo($username) { default: return hsc($username); } - } else { - return hsc($username); } + + return hsc($username); } /** -- cgit v1.2.3 From 2dc9e90007f12ac996b0e74479137a9dc6243c3c Mon Sep 17 00:00:00 2001 From: Christopher Smith Date: Sun, 4 May 2014 19:20:11 +0100 Subject: KISS - remove class constants for REQUIRE_GROUPS & IGNORE_GROUPS and replace with boolean values --- inc/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/common.php') diff --git a/inc/common.php b/inc/common.php index 9ed9e84d4..9b3c59e6e 100644 --- a/inc/common.php +++ b/inc/common.php @@ -1468,7 +1468,7 @@ function editorinfo($username) { case 'username': case 'email': case 'email_link': - if($auth) $info = $auth->getUserData($username, DokuWiki_Auth_Plugin::IGNORE_GROUPS); + if($auth) $info = $auth->getUserData($username, $requireGroups = false); break; default: return hsc($username); -- cgit v1.2.3