summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--_test/tests/inc/init_checkssl.test.php81
-rw-r--r--inc/auth.php7
-rw-r--r--inc/common.php2
-rw-r--r--inc/fulltext.php2
-rw-r--r--inc/init.php12
-rw-r--r--inc/lang/ta/lang.php7
-rw-r--r--inc/lang/zh/lang.php2
-rw-r--r--lib/plugins/auth.php5
-rw-r--r--lib/plugins/authad/auth.php3
-rw-r--r--lib/plugins/authldap/auth.php13
-rw-r--r--lib/plugins/authmysql/auth.php188
-rw-r--r--lib/plugins/authpgsql/auth.php8
-rw-r--r--lib/plugins/authplain/auth.php3
-rw-r--r--lib/plugins/extension/helper/list.php10
14 files changed, 280 insertions, 63 deletions
diff --git a/_test/tests/inc/init_checkssl.test.php b/_test/tests/inc/init_checkssl.test.php
new file mode 100644
index 000000000..c57d3c37e
--- /dev/null
+++ b/_test/tests/inc/init_checkssl.test.php
@@ -0,0 +1,81 @@
+<?php
+
+class init_checkssl_test extends DokuWikiTest {
+
+ /**
+ * Running behind an SSL proxy, HTTP between server and proxy
+ * HTTPS not set
+ * HTTP_X_FORWARDED_PROTO
+ * set to https
+ */
+ function test1() {
+ $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
+
+ $this->assertEquals(is_ssl(), true);
+ }
+
+ /**
+ * Running behind a plain HTTP proxy, HTTP between server and proxy
+ * HTTPS not set
+ * HTTP_X_FORWARDED_PROTO set to http
+ */
+ function test2() {
+ $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'http';
+
+ $this->assertEquals(is_ssl(), false);
+ }
+
+ /**
+ * Running behind an SSL proxy, HTTP between server and proxy
+ * HTTPS set to off,
+ * HTTP_X_FORWARDED_PROTO set to https
+ */
+ function test3() {
+ $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
+ $_SERVER['HTTPS'] = 'off';
+
+ $this->assertEquals(is_ssl(), true);
+ }
+
+ /**
+ * Not running behind a proxy, HTTPS server
+ * HTTPS set to on,
+ * HTTP_X_FORWARDED_PROTO not set
+ */
+ function test4() {
+ $_SERVER['HTTPS'] = 'on';
+
+ $this->assertEquals(is_ssl(), true);
+ }
+
+ /**
+ * Not running behind a proxy, plain HTTP server
+ * HTTPS not set
+ * HTTP_X_FORWARDED_PROTO not set
+ */
+ function test5() {
+ $this->assertEquals(is_ssl(), false);
+ }
+
+ /**
+ * Not running behind a proxy, plain HTTP server
+ * HTTPS set to off
+ * HTTP_X_FORWARDED_PROTO not set
+ */
+ function test6() {
+ $_SERVER['HTTPS'] = 'off';
+ $this->assertEquals(is_ssl(), false);
+ }
+
+ /**
+ * Running behind an SSL proxy, SSL between proxy and HTTP server
+ * HTTPS set to on,
+ * HTTP_X_FORWARDED_PROTO set to https
+ */
+ function test7() {
+ $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
+ $_SERVER['HTTPS'] = 'on';
+
+ $this->assertEquals(is_ssl(), true);
+ }
+}
diff --git a/inc/auth.php b/inc/auth.php
index 037f7e78f..e938830ef 100644
--- a/inc/auth.php
+++ b/inc/auth.php
@@ -639,6 +639,7 @@ function auth_isMember($memberlist, $user, array $groups) {
// compare cleaned values
foreach($members as $member) {
+ if($member == '@ALL' ) return true;
if(!$auth->isCaseSensitive()) $member = utf8_strtolower($member);
if($member[0] == '@') {
$member = $auth->cleanGroup(substr($member, 1));
@@ -923,7 +924,7 @@ function auth_sendPassword($user, $password) {
if(!$auth) return false;
$user = $auth->cleanUser($user);
- $userinfo = $auth->getUserData($user);
+ $userinfo = $auth->getUserData($user, $requireGroups = false);
if(!$userinfo['mail']) return false;
@@ -1185,7 +1186,7 @@ function act_resendpwd() {
}
$user = io_readfile($tfile);
- $userinfo = $auth->getUserData($user);
+ $userinfo = $auth->getUserData($user, $requireGroups = false);
if(!$userinfo['mail']) {
msg($lang['resendpwdnouser'], -1);
return false;
@@ -1237,7 +1238,7 @@ function act_resendpwd() {
$user = trim($auth->cleanUser($INPUT->post->str('login')));
}
- $userinfo = $auth->getUserData($user);
+ $userinfo = $auth->getUserData($user, $requireGroups = false);
if(!$userinfo['mail']) {
msg($lang['resendpwdnouser'], -1);
return false;
diff --git a/inc/common.php b/inc/common.php
index 503155c46..e56285f62 100644
--- a/inc/common.php
+++ b/inc/common.php
@@ -1583,7 +1583,7 @@ 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
*
* @param string|null $username or null when currently logged-in user should be used
diff --git a/inc/fulltext.php b/inc/fulltext.php
index dd918f214..aaef090e1 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -215,7 +215,7 @@ function ft_pageLookup($id, $in_ns=false, $in_title=false){
function _ft_pageLookup(&$data){
// split out original parameters
$id = $data['id'];
- if (preg_match('/(?:^| )@(\w+)/', $id, $matches)) {
+ if (preg_match('/(?:^| )(?:@|ns:)([\w:]+)/', $id, $matches)) {
$ns = cleanID($matches[1]) . ':';
$id = str_replace($matches[0], '', $id);
}
diff --git a/inc/init.php b/inc/init.php
index 4ff239787..d825b5250 100644
--- a/inc/init.php
+++ b/inc/init.php
@@ -456,10 +456,6 @@ function getBaseURL($abs=null){
$port = '';
}
- if(!$port && isset($_SERVER['SERVER_PORT'])) {
- $port = $_SERVER['SERVER_PORT'];
- }
-
if(is_null($port)){
$port = '';
}
@@ -490,6 +486,14 @@ function getBaseURL($abs=null){
* @returns bool true when SSL is active
*/
function is_ssl(){
+ // check if we are behind a reverse proxy
+ if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
+ if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {
+ return true;
+ } else {
+ return false;
+ }
+ }
if (!isset($_SERVER['HTTPS']) ||
preg_match('/^(|off|false|disabled)$/i',$_SERVER['HTTPS'])){
return false;
diff --git a/inc/lang/ta/lang.php b/inc/lang/ta/lang.php
index 4a1da3531..a5b89527a 100644
--- a/inc/lang/ta/lang.php
+++ b/inc/lang/ta/lang.php
@@ -10,7 +10,7 @@ $lang['btn_show'] = 'பக்கத்தை காண்பி ';
$lang['btn_create'] = 'இந்த பக்கத்தை உருவாக்கு ';
$lang['btn_search'] = 'தேடு';
$lang['btn_save'] = 'சேமி ';
-$lang['btn_revs'] = 'old திருத்தங்கள்';
+$lang['btn_revs'] = 'பழைய திருத்தங்கள்';
$lang['btn_recent'] = 'சமீபத்திய மாற்றங்கள்';
$lang['btn_upload'] = 'பதிவேற்று';
$lang['btn_cancel'] = 'ரத்து';
@@ -30,3 +30,8 @@ $lang['fullname'] = 'உண்மையான பெயர்';
$lang['email'] = 'மின்னஞ்சல்';
$lang['profile'] = 'பயன்படுத்துபவர் விவரம்';
$lang['minoredit'] = 'சிறிய மாற்றங்கள்';
+$lang['media_historytab'] = 'வரலாறு';
+$lang['media_list_rows'] = 'வரிசைகள் ';
+$lang['media_sort_name'] = 'பெயர் ';
+$lang['media_sort_date'] = 'தேதி ';
+$lang['media_namespaces'] = 'பெயர்வெளியை தேர்வுசெய் ';
diff --git a/inc/lang/zh/lang.php b/inc/lang/zh/lang.php
index c8a76b66b..797a9b7a1 100644
--- a/inc/lang/zh/lang.php
+++ b/inc/lang/zh/lang.php
@@ -23,6 +23,7 @@
* @author Cupen <Cupenoruler@foxmail.com>
* @author xiqingongzi <Xiqingongzi@Gmail.com>
* @author qinghao <qingxianhao@gmail.com>
+ * @author Yuwei Sun <yuwei@hrz.tu-chemnitz.de>
*/
$lang['encoding'] = 'utf-8';
$lang['direction'] = 'ltr';
@@ -302,6 +303,7 @@ $lang['i_modified'] = '由于安全上的考虑,该脚本只能用
<a href="http://dokuwiki.org/install">Dokuwiki 安装指南</a>';
$lang['i_funcna'] = 'PHP 功能 <code>%s</code> 无法使用。也许您的服务器提供商因为某些原因禁用了它。';
$lang['i_phpver'] = '您的 PHP 版本 <code>%s</code> 低于最低要求的 <code>%s</code>。您需要升级您的 PHP 版本。';
+$lang['i_mbfuncoverload'] = '为了运行DocuWiki,您必须在php.ini中禁用mbstring.func_overload。';
$lang['i_permfail'] = 'DokuWiki 无法写入 <code>%s</code>。您需要修改该路径的权限设定!';
$lang['i_confexists'] = '<code>%s</code> 已经存在';
$lang['i_writeerr'] = '无法创建 <code>%s</code>。您需要检查该路径/文件的权限设定并手动创建该文件。';
diff --git a/lib/plugins/auth.php b/lib/plugins/auth.php
index b04735639..b38b591a3 100644
--- a/lib/plugins/auth.php
+++ b/lib/plugins/auth.php
@@ -229,14 +229,15 @@ class DokuWiki_Auth_Plugin extends DokuWiki_Plugin {
* at least these fields:
*
* name string full name of the user
- * mail string email addres of the user
+ * mail string email address of the user
* grps array list of groups the user is in
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $user the user name
+ * @param bool $requireGroups whether or not the returned data must include groups
* @return array containing user data or false
*/
- public function getUserData($user) {
+ public function getUserData($user, $requireGroups=true) {
if(!$this->cando['external']) msg("no valid authorisation system in use", -1);
return false;
}
diff --git a/lib/plugins/authad/auth.php b/lib/plugins/authad/auth.php
index 0860e5756..a3119dda6 100644
--- a/lib/plugins/authad/auth.php
+++ b/lib/plugins/authad/auth.php
@@ -177,9 +177,10 @@ class auth_plugin_authad extends DokuWiki_Auth_Plugin {
*
* @author James Van Lommel <james@nosq.com>
* @param string $user
+ * @param bool $requireGroups (optional) - ignored, groups are always supplied by this plugin
* @return array
*/
- public function getUserData($user) {
+ public function getUserData($user, $requireGroups=true) {
global $conf;
global $lang;
global $ID;
diff --git a/lib/plugins/authldap/auth.php b/lib/plugins/authldap/auth.php
index 0d5e130ea..b22b82ecc 100644
--- a/lib/plugins/authldap/auth.php
+++ b/lib/plugins/authldap/auth.php
@@ -103,7 +103,7 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
return true;
} else {
// See if we can find the user
- $info = $this->getUserData($user, true);
+ $info = $this->_getUserData($user, true);
if(empty($info['dn'])) {
return false;
} else {
@@ -146,10 +146,19 @@ class auth_plugin_authldap extends DokuWiki_Auth_Plugin {
* @author Steffen Schoch <schoch@dsb.net>
*
* @param string $user
+ * @param bool $requireGroups (optional) - ignored, groups are always supplied by this plugin
+ * @return array containing user data or false
+ */
+ public function getUserData($user, $requireGroups=true) {
+ return $this->_getUserData($user);
+ }
+
+ /**
+ * @param string $user
* @param bool $inbind authldap specific, true if in bind phase
* @return array containing user data or false
*/
- public function getUserData($user, $inbind = false) {
+ protected function _getUserData($user, $inbind = false) {
global $conf;
if(!$this->_openLDAP()) return false;
diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php
index 1e6e6a4a9..95c62f636 100644
--- a/lib/plugins/authmysql/auth.php
+++ b/lib/plugins/authmysql/auth.php
@@ -21,6 +21,9 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
/** @var int database subrevision */
protected $dbsub = 0;
+ /** @var array cache to avoid re-reading user info data */
+ protected $cacheUserInfo = array();
+
/**
* Constructor
*
@@ -157,10 +160,11 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$result = $this->_queryDB($sql);
if($result !== false && count($result) == 1) {
- if($this->getConf('forwardClearPass') == 1)
+ if($this->getConf('forwardClearPass') == 1) {
$rc = true;
- else
+ } else {
$rc = auth_verifyPassword($pass, $result[0]['pass']);
+ }
}
$this->_closeDB();
}
@@ -174,16 +178,23 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*
* @param string $user user login to get data for
+ * @param bool $requireGroups when true, group membership information should be included in the returned array;
+ * when false, it maybe included, but is not required by the caller
* @return array|bool
*/
- public function getUserData($user) {
+ public function getUserData($user, $requireGroups=true) {
+ if($this->_cacheExists($user, $requireGroups)) {
+ return $this->cacheUserInfo[$user];
+ }
+
if($this->_openDB()) {
$this->_lockTables("READ");
- $info = $this->_getUserInfo($user);
+ $info = $this->_getUserInfo($user, $requireGroups);
$this->_unlockTables();
$this->_closeDB();
- } else
+ } else {
$info = false;
+ }
return $info;
}
@@ -209,12 +220,14 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
global $conf;
if($this->_openDB()) {
- if(($info = $this->_getUserInfo($user)) !== false)
+ if(($info = $this->_getUserInfo($user)) !== false) {
return false; // user already exists
+ }
// set defaultgroup if no groups were given
- if($grps == null)
+ if($grps == null) {
$grps = array($conf['defaultgroup']);
+ }
$this->_lockTables("WRITE");
$pwd = $this->getConf('forwardClearPass') ? $pwd : auth_cryptPassword($pwd);
@@ -234,17 +247,17 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
* The dataset update will be rejected if the user name should be changed
* to an already existing one.
*
- * The password must be provides unencrypted. Pasword cryption is done
+ * The password must be provided unencrypted. Pasword encryption is done
* automatically if configured.
*
- * If one or more groups could't be updated, an error would be set. In
+ * If one or more groups can't be updated, an error will be set. In
* this case the dataset might already be changed and we can't rollback
- * the changes. Transactions would be really usefull here.
+ * the changes. Transactions would be really useful here.
*
* modifyUser() may be called without SQL statements defined that are
* needed to change group membership (for example if only the user profile
- * should be modified). In this case we asure that we don't touch groups
- * even $changes['grps'] is set by mistake.
+ * should be modified). In this case we assure that we don't touch groups
+ * even when $changes['grps'] is set by mistake.
*
* @author Chris Smith <chris@jalakai.co.uk>
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
@@ -256,27 +269,30 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
public function modifyUser($user, $changes) {
$rc = false;
- if(!is_array($changes) || !count($changes))
+ if(!is_array($changes) || !count($changes)) {
return true; // nothing to change
+ }
if($this->_openDB()) {
$this->_lockTables("WRITE");
- if(($uid = $this->_getUserID($user))) {
- $rc = $this->_updateUserInfo($changes, $uid);
+ $rc = $this->_updateUserInfo($user, $changes);
- if($rc && isset($changes['grps']) && $this->cando['modGroups']) {
- $groups = $this->_getGroups($user);
- $grpadd = array_diff($changes['grps'], $groups);
- $grpdel = array_diff($groups, $changes['grps']);
+ if($rc && isset($changes['grps']) && $this->cando['modGroups']) {
+ $groups = $this->_getGroups($user);
+ $grpadd = array_diff($changes['grps'], $groups);
+ $grpdel = array_diff($groups, $changes['grps']);
- foreach($grpadd as $group)
- if(($this->_addUserToGroup($user, $group, 1)) == false)
- $rc = false;
+ foreach($grpadd as $group) {
+ if(($this->_addUserToGroup($user, $group, 1)) == false) {
+ $rc = false;
+ }
+ }
- foreach($grpdel as $group)
- if(($this->_delUserFromGroup($user, $group)) == false)
- $rc = false;
+ foreach($grpdel as $group) {
+ if(($this->_delUserFromGroup($user, $group)) == false) {
+ $rc = false;
+ }
}
}
@@ -304,8 +320,9 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
if(is_array($users) && count($users)) {
$this->_lockTables("WRITE");
foreach($users as $user) {
- if($this->_delUser($user))
+ if($this->_delUser($user)) {
$count++;
+ }
}
$this->_unlockTables();
}
@@ -367,9 +384,11 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$result = $this->_queryDB($sql);
if(!empty($result)) {
- foreach($result as $user)
- if(($info = $this->_getUserInfo($user['user'])))
+ foreach($result as $user) {
+ if(($info = $this->_getUserInfo($user['user']))) {
$out[$user['user']] = $info;
+ }
+ }
}
$this->_unlockTables();
@@ -466,7 +485,10 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$sql = str_replace('%{user}', $this->_escape($user), $sql);
$sql = str_replace('%{gid}', $this->_escape($gid), $sql);
$sql = str_replace('%{group}', $this->_escape($group), $sql);
- if($this->_modifyDB($sql) !== false) return true;
+ if($this->_modifyDB($sql) !== false) {
+ $this->_flushUserInfoCache($user);
+ return true;
+ }
if($newgroup) { // remove previously created group on error
$sql = str_replace('%{gid}', $this->_escape($gid), $this->getConf('delGroup'));
@@ -501,6 +523,10 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$sql = str_replace('%{gid}', $this->_escape($gid), $sql);
$sql = str_replace('%{group}', $this->_escape($group), $sql);
$rc = $this->_modifyDB($sql) == 0 ? true : false;
+
+ if ($rc) {
+ $this->_flushUserInfoCache($user);
+ }
}
}
return $rc;
@@ -526,8 +552,9 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$result = $this->_queryDB($sql);
if($result !== false && count($result)) {
- foreach($result as $row)
+ foreach($result as $row) {
$groups[] = $row['group'];
+ }
}
return $groups;
}
@@ -590,6 +617,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
}
if($gid !== false){
+ $this->_flushUserInfoCache($user);
return true;
} else {
/* remove the new user and all group relations if a group can't
@@ -614,7 +642,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
*
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*
- * @param string $user user whose id is desired
+ * @param string $user username of the user to be deleted
* @return bool
*/
protected function _delUser($user) {
@@ -626,16 +654,96 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$sql = str_replace('%{uid}', $this->_escape($uid), $this->getConf('delUser'));
$sql = str_replace('%{user}', $this->_escape($user), $sql);
$this->_modifyDB($sql);
+ $this->_flushUserInfoCache($user);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Flush cached user information
+ *
+ * @author Christopher Smith <chris@jalakai.co.uk>
+ *
+ * @param string $user username of the user whose data is to be removed from the cache
+ * if null, empty the whole cache
+ * @return none
+ */
+ protected function _flushUserInfoCache($user=null) {
+ if (is_null($user)) {
+ $this->cacheUserInfo = array();
+ } else {
+ unset($this->cacheUserInfo[$user]);
+ }
+ }
+
+ /**
+ * Quick lookup to see if a user's information has been cached
+ *
+ * This test does not need a database connection or read lock
+ *
+ * @author Christopher Smith <chris@jalakai.co.uk>
+ *
+ * @param string $user username to be looked up in the cache
+ * @param bool $requireGroups true, if cached info should include group memberships
+ *
+ * @return bool existence of required user information in the cache
+ */
+ protected function _cacheExists($user, $requireGroups=true) {
+ if (isset($this->cacheUserInfo[$user])) {
+ if (!is_array($this->cacheUserInfo[$user])) {
+ return true; // user doesn't exist
+ }
+
+ if (!$requireGroups || isset($this->cacheUserInfo[$user]['grps'])) {
return true;
}
}
+
return false;
}
/**
- * getUserInfo
+ * Get a user's information
+ *
+ * The database connection must already be established for this function to work.
+ *
+ * @author Christopher Smith <chris@jalakai.co.uk>
+ *
+ * @param string $user username of the user whose information is being reterieved
+ * @param bool $requireGroups true if group memberships should be included
+ * @param bool $useCache true if ok to return cached data & to cache returned data
+ *
+ * @return mixed false|array false if the user doesn't exist
+ * array containing user information if user does exist
+ */
+ protected function _getUserInfo($user, $requireGroups=true, $useCache=true) {
+ $info = null;
+
+ if ($useCache && isset($this->cacheUserInfo[$user])) {
+ $info = $this->cacheUserInfo[$user];
+ }
+
+ if (is_null($info)) {
+ $info = $this->_retrieveUserInfo($user);
+ }
+
+ if (($requireGroups == true) && $info && !isset($info['grps'])) {
+ $info['grps'] = $this->_getGroups($user);
+ }
+
+ if ($useCache) {
+ $this->cacheUserInfo[$user] = $info;
+ }
+
+ return $info;
+ }
+
+ /**
+ * retrieveUserInfo
*
- * Gets the data for a specific user The database connection
+ * Gets the data for a specific user. The database connection
* must already be established for this function to work.
* Otherwise it will return 'false'.
*
@@ -644,12 +752,11 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
* @param string $user user's nick to get data for
* @return bool|array false on error, user info on success
*/
- protected function _getUserInfo($user) {
+ protected function _retrieveUserInfo($user) {
$sql = str_replace('%{user}', $this->_escape($user), $this->getConf('getUserInfo'));
$result = $this->_queryDB($sql);
if($result !== false && count($result)) {
$info = $result[0];
- $info['grps'] = $this->_getGroups($user);
return $info;
}
return false;
@@ -666,20 +773,26 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
* The database connection has already to be established for this
* function to work. Otherwise it will return 'false'.
*
- * The password will be crypted if necessary.
+ * The password will be encrypted if necessary.
*
+ * @param string $user user's nick being updated
* @param array $changes array of items to change as pairs of item and value
* @param mixed $uid user id of dataset to change, must be unique in DB
* @return bool true on success or false on error
*
* @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
*/
- protected function _updateUserInfo($changes, $uid) {
+ protected function _updateUserInfo($user, $changes) {
$sql = $this->getConf('updateUser')." ";
$cnt = 0;
$err = 0;
if($this->dbcon) {
+ $uid = $this->_getUserID($user);
+ if ($uid === false) {
+ return false;
+ }
+
foreach($changes as $item => $value) {
if($item == 'user') {
if(($this->_getUserID($changes['user']))) {
@@ -707,6 +820,7 @@ class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
$sql .= " ".str_replace('%{uid}', $uid, $this->getConf('UpdateTarget'));
if(get_class($this) == 'auth_mysql') $sql .= " LIMIT 1"; //some PgSQL inheritance comp.
$this->_modifyDB($sql);
+ $this->_flushUserInfoCache($user);
}
return true;
}
diff --git a/lib/plugins/authpgsql/auth.php b/lib/plugins/authpgsql/auth.php
index e51b39858..99f3ed443 100644
--- a/lib/plugins/authpgsql/auth.php
+++ b/lib/plugins/authpgsql/auth.php
@@ -160,7 +160,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql {
$result = $this->_queryDB($sql);
foreach($result as $user)
- if(($info = $this->_getUserInfo($user['user'])))
+ if(($info = $this->_getCachedUserInfo($user['user'])))
$out[$user['user']] = $info;
$this->_unlockTables();
@@ -212,7 +212,10 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql {
$sql = str_replace('%{user}', addslashes($user), $sql);
$sql = str_replace('%{gid}', addslashes($gid), $sql);
$sql = str_replace('%{group}', addslashes($group), $sql);
- if($this->_modifyDB($sql) !== false) return true;
+ if($this->_modifyDB($sql) !== false) {
+ $this->_flushUserInfoCache($user);
+ return true;
+ }
if($newgroup) { // remove previously created group on error
$sql = str_replace('%{gid}', addslashes($gid), $this->conf['delGroup']);
@@ -267,6 +270,7 @@ class auth_plugin_authpgsql extends auth_plugin_authmysql {
}
if($gid !== false){
+ $this->_flushUserInfoCache($user);
return true;
} else {
/* remove the new user and all group relations if a group can't
diff --git a/lib/plugins/authplain/auth.php b/lib/plugins/authplain/auth.php
index e53f56667..b3ca988b9 100644
--- a/lib/plugins/authplain/auth.php
+++ b/lib/plugins/authplain/auth.php
@@ -76,9 +76,10 @@ class auth_plugin_authplain extends DokuWiki_Auth_Plugin {
*
* @author Andreas Gohr <andi@splitbrain.org>
* @param string $user
+ * @param bool $requireGroups (optional) ignored by this plugin, grps info always supplied
* @return array|bool
*/
- public function getUserData($user) {
+ public function getUserData($user, $requireGroups=true) {
if($this->users === null) $this->_loadUserData();
return isset($this->users[$user]) ? $this->users[$user] : false;
}
diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php
index 47edca8c1..9b1988d84 100644
--- a/lib/plugins/extension/helper/list.php
+++ b/lib/plugins/extension/helper/list.php
@@ -387,7 +387,8 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
$return .= '<dd>';
$return .= hsc($extension->getInstalledVersion());
$return .= '</dd>';
- } else {
+ }
+ if (!$extension->isBundled()) {
$return .= '<dt>'.$this->getLang('install_date').'</dt>';
$return .= '<dd>';
$return .= ($extension->getUpdateDate() ? hsc($extension->getUpdateDate()) : $this->getLang('unknown'));
@@ -401,13 +402,6 @@ class helper_plugin_extension_list extends DokuWiki_Plugin {
$return .= '</dd>';
}
- if($extension->getInstallDate()) {
- $return .= '<dt>'.$this->getLang('installed').'</dt>';
- $return .= '<dd>';
- $return .= hsc($extension->getInstallDate());
- $return .= '</dd>';
- }
-
$return .= '<dt>'.$this->getLang('provides').'</dt>';
$return .= '<dd><bdi>';
$return .= ($extension->getTypes() ? hsc(implode(', ', $extension->getTypes())) : $default);