summaryrefslogtreecommitdiff
path: root/lib/plugins/authmysql
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/authmysql')
-rw-r--r--lib/plugins/authmysql/auth.php975
-rw-r--r--lib/plugins/authmysql/conf/default.php34
-rw-r--r--lib/plugins/authmysql/conf/metadata.php34
-rw-r--r--lib/plugins/authmysql/lang/bg/settings.php17
-rw-r--r--lib/plugins/authmysql/lang/cs/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/de-informal/settings.php43
-rw-r--r--lib/plugins/authmysql/lang/de/settings.php42
-rw-r--r--lib/plugins/authmysql/lang/en/settings.php39
-rw-r--r--lib/plugins/authmysql/lang/eo/settings.php40
-rw-r--r--lib/plugins/authmysql/lang/fi/settings.php6
-rw-r--r--lib/plugins/authmysql/lang/fr/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/it/settings.php5
-rw-r--r--lib/plugins/authmysql/lang/ja/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/ko/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/lv/settings.php6
-rw-r--r--lib/plugins/authmysql/lang/nl/settings.php40
-rw-r--r--lib/plugins/authmysql/lang/pt-br/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/ru/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/sv/settings.php25
-rw-r--r--lib/plugins/authmysql/lang/zh-tw/settings.php41
-rw-r--r--lib/plugins/authmysql/lang/zh/settings.php41
-rw-r--r--lib/plugins/authmysql/plugin.info.txt7
22 files changed, 1641 insertions, 0 deletions
diff --git a/lib/plugins/authmysql/auth.php b/lib/plugins/authmysql/auth.php
new file mode 100644
index 000000000..036644a67
--- /dev/null
+++ b/lib/plugins/authmysql/auth.php
@@ -0,0 +1,975 @@
+<?php
+// must be run within Dokuwiki
+if(!defined('DOKU_INC')) die();
+
+/**
+ * MySQL authentication backend
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Chris Smith <chris@jalakai.co.uk>
+ * @author Matthias Grimm <matthias.grimmm@sourceforge.net>
+ * @author Jan Schumann <js@schumann-it.com>
+ */
+class auth_plugin_authmysql extends DokuWiki_Auth_Plugin {
+ /** @var resource holds the database connection */
+ protected $dbcon = 0;
+ /** @var int database version*/
+ protected $dbver = 0;
+ /** @var int database revision */
+ protected $dbrev = 0;
+ /** @var int database subrevision */
+ protected $dbsub = 0;
+
+ /**
+ * Constructor
+ *
+ * checks if the mysql interface is available, otherwise it will
+ * set the variable $success of the basis class to false
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+ public function __construct() {
+ parent::__construct();
+
+ if(!function_exists('mysql_connect')) {
+ $this->_debug("MySQL err: PHP MySQL extension not found.", -1, __LINE__, __FILE__);
+ $this->success = false;
+ return;
+ }
+
+ // set capabilities based upon config strings set
+ if(!$this->getConf('server') || !$this->getConf('user') || !$this->getConf('database')) {
+ $this->_debug("MySQL err: insufficient configuration.", -1, __LINE__, __FILE__);
+
+ $this->success = false;
+ return;
+ }
+
+ $this->cando['addUser'] = $this->_chkcnf(
+ array(
+ 'getUserInfo',
+ 'getGroups',
+ 'addUser',
+ 'getUserID',
+ 'getGroupID',
+ 'addGroup',
+ 'addUserGroup'
+ ), true
+ );
+ $this->cando['delUser'] = $this->_chkcnf(
+ array(
+ 'getUserID',
+ 'delUser',
+ 'delUserRefs'
+ ), true
+ );
+ $this->cando['modLogin'] = $this->_chkcnf(
+ array(
+ 'getUserID',
+ 'updateUser',
+ 'UpdateTarget'
+ ), true
+ );
+ $this->cando['modPass'] = $this->cando['modLogin'];
+ $this->cando['modName'] = $this->cando['modLogin'];
+ $this->cando['modMail'] = $this->cando['modLogin'];
+ $this->cando['modGroups'] = $this->_chkcnf(
+ array(
+ 'getUserID',
+ 'getGroups',
+ 'getGroupID',
+ 'addGroup',
+ 'addUserGroup',
+ 'delGroup',
+ 'getGroupID',
+ 'delUserGroup'
+ ), true
+ );
+ /* getGroups is not yet supported
+ $this->cando['getGroups'] = $this->_chkcnf(array('getGroups',
+ 'getGroupID'),false); */
+ $this->cando['getUsers'] = $this->_chkcnf(
+ array(
+ 'getUsers',
+ 'getUserInfo',
+ 'getGroups'
+ ), false
+ );
+ $this->cando['getUserCount'] = $this->_chkcnf(array('getUsers'), false);
+
+ if($this->getConf('debug') >= 2) {
+ $candoDebug = '';
+ foreach($this->cando as $cd => $value) {
+ if($value) { $value = 'yes'; } else { $value = 'no'; }
+ $candoDebug .= $cd . ": " . $value . " | ";
+ }
+ $this->_debug("authmysql cando: " . $candoDebug, 0, __LINE__, __FILE__);
+ }
+ }
+
+ /**
+ * Check if the given config strings are set
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ * @param array $keys
+ * @param bool $wop is this a check for a write operation?
+ * @return bool
+ */
+ protected function _chkcnf($keys, $wop = false) {
+ foreach($keys as $key) {
+ if(!$this->getConf($key)) return false;
+ }
+
+ /* write operation and lock array filled with tables names? */
+ if($wop && (!is_array($this->getConf('TablesToLock')) ||
+ !count($this->getConf('TablesToLock')))
+ ) {
+ return false;
+ }
+
+ return true;
+ }
+
+ /**
+ * Checks if the given user exists and the given plaintext password
+ * is correct. Furtheron it might be checked wether the user is
+ * member of the right group
+ *
+ * Depending on which SQL string is defined in the config, password
+ * checking is done here (getpass) or by the database (passcheck)
+ *
+ * @param string $user user who would like access
+ * @param string $pass user's clear text password to check
+ * @return bool
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+ public function checkPass($user, $pass) {
+ global $conf;
+ $rc = false;
+
+ if($this->_openDB()) {
+ $sql = str_replace('%{user}', $this->_escape($user), $this->getConf('checkPass'));
+ $sql = str_replace('%{pass}', $this->_escape($pass), $sql);
+ $sql = str_replace('%{dgroup}', $this->_escape($conf['defaultgroup']), $sql);
+ $result = $this->_queryDB($sql);
+
+ if($result !== false && count($result) == 1) {
+ if($this->getConf('forwardClearPass') == 1)
+ $rc = true;
+ else
+ $rc = auth_verifyPassword($pass, $result[0]['pass']);
+ }
+ $this->_closeDB();
+ }
+ return $rc;
+ }
+
+ /**
+ * Return user info
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user login to get data for
+ * @return array|bool
+ */
+ public function getUserData($user) {
+ if($this->_openDB()) {
+ $this->_lockTables("READ");
+ $info = $this->_getUserInfo($user);
+ $this->_unlockTables();
+ $this->_closeDB();
+ } else
+ $info = false;
+ return $info;
+ }
+
+ /**
+ * Create a new User. Returns false if the user already exists,
+ * null when an error occurred and true if everything went well.
+ *
+ * The new user will be added to the default group by this
+ * function if grps are not specified (default behaviour).
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Chris Smith <chris@jalakai.co.uk>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user nick of the user
+ * @param string $pwd clear text password
+ * @param string $name full name of the user
+ * @param string $mail email address
+ * @param array $grps array of groups the user should become member of
+ * @return bool|null
+ */
+ public function createUser($user, $pwd, $name, $mail, $grps = null) {
+ global $conf;
+
+ if($this->_openDB()) {
+ if(($info = $this->_getUserInfo($user)) !== false)
+ return false; // user already exists
+
+ // set defaultgroup if no groups were given
+ if($grps == null)
+ $grps = array($conf['defaultgroup']);
+
+ $this->_lockTables("WRITE");
+ $pwd = $this->getConf('forwardClearPass') ? $pwd : auth_cryptPassword($pwd);
+ $rc = $this->_addUser($user, $pwd, $name, $mail, $grps);
+ $this->_unlockTables();
+ $this->_closeDB();
+ if($rc) return true;
+ }
+ return null; // return error
+ }
+
+ /**
+ * Modify user data
+ *
+ * An existing user dataset will be modified. Changes are given in an array.
+ *
+ * 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
+ * automatically if configured.
+ *
+ * If one or more groups could't be updated, an error would be set. In
+ * this case the dataset might already be changed and we can't rollback
+ * the changes. Transactions would be really usefull 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.
+ *
+ * @author Chris Smith <chris@jalakai.co.uk>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user nick of the user to be changed
+ * @param array $changes array of field/value pairs to be changed (password will be clear text)
+ * @return bool true on success, false on error
+ */
+ public function modifyUser($user, $changes) {
+ $rc = false;
+
+ 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);
+
+ 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($grpdel as $group)
+ if(($this->_delUserFromGroup($user, $group)) == false)
+ $rc = false;
+ }
+ }
+
+ $this->_unlockTables();
+ $this->_closeDB();
+ }
+ return $rc;
+ }
+
+ /**
+ * [public function]
+ *
+ * Remove one or more users from the list of registered users
+ *
+ * @param array $users array of users to be deleted
+ * @return int the number of users deleted
+ *
+ * @author Christopher Smith <chris@jalakai.co.uk>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+ function deleteUsers($users) {
+ $count = 0;
+
+ if($this->_openDB()) {
+ if(is_array($users) && count($users)) {
+ $this->_lockTables("WRITE");
+ foreach($users as $user) {
+ if($this->_delUser($user))
+ $count++;
+ }
+ $this->_unlockTables();
+ }
+ $this->_closeDB();
+ }
+ return $count;
+ }
+
+ /**
+ * Counts users which meet certain $filter criteria.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param array $filter filter criteria in item/pattern pairs
+ * @return int count of found users
+ */
+ public function getUserCount($filter = array()) {
+ $rc = 0;
+
+ if($this->_openDB()) {
+ $sql = $this->_createSQLFilter($this->getConf('getUsers'), $filter);
+
+ if($this->dbver >= 4) {
+ $sql = substr($sql, 6); /* remove 'SELECT' or 'select' */
+ $sql = "SELECT SQL_CALC_FOUND_ROWS".$sql." LIMIT 1";
+ $this->_queryDB($sql);
+ $result = $this->_queryDB("SELECT FOUND_ROWS()");
+ $rc = $result[0]['FOUND_ROWS()'];
+ } else if(($result = $this->_queryDB($sql)))
+ $rc = count($result);
+
+ $this->_closeDB();
+ }
+ return $rc;
+ }
+
+ /**
+ * Bulk retrieval of user data
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param int $first index of first user to be returned
+ * @param int $limit max number of users to be returned
+ * @param array|string $filter array of field/pattern pairs
+ * @return array userinfo (refer getUserData for internal userinfo details)
+ */
+ public function retrieveUsers($first = 0, $limit = 10, $filter = array()) {
+ $out = array();
+
+ if($this->_openDB()) {
+ $this->_lockTables("READ");
+ $sql = $this->_createSQLFilter($this->getConf('getUsers'), $filter);
+ $sql .= " ".$this->getConf('SortOrder')." LIMIT $first, $limit";
+ $result = $this->_queryDB($sql);
+
+ if(!empty($result)) {
+ foreach($result as $user)
+ if(($info = $this->_getUserInfo($user['user'])))
+ $out[$user['user']] = $info;
+ }
+
+ $this->_unlockTables();
+ $this->_closeDB();
+ }
+ return $out;
+ }
+
+ /**
+ * Give user membership of a group
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user
+ * @param string $group
+ * @return bool true on success, false on error
+ */
+ protected function joinGroup($user, $group) {
+ $rc = false;
+
+ if($this->_openDB()) {
+ $this->_lockTables("WRITE");
+ $rc = $this->_addUserToGroup($user, $group);
+ $this->_unlockTables();
+ $this->_closeDB();
+ }
+ return $rc;
+ }
+
+ /**
+ * Remove user from a group
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user that leaves a group
+ * @param string $group group to leave
+ * @return bool
+ */
+ protected function leaveGroup($user, $group) {
+ $rc = false;
+
+ if($this->_openDB()) {
+ $this->_lockTables("WRITE");
+ $rc = $this->_delUserFromGroup($user, $group);
+ $this->_unlockTables();
+ $this->_closeDB();
+ }
+ return $rc;
+ }
+
+ /**
+ * MySQL is case-insensitive
+ */
+ public function isCaseSensitive() {
+ return false;
+ }
+
+ /**
+ * Adds a user to a group.
+ *
+ * If $force is set to true non existing groups would be created.
+ *
+ * The database connection must already be established. Otherwise
+ * this function does nothing and returns 'false'. It is strongly
+ * recommended to call this function only after all participating
+ * tables (group and usergroup) have been locked.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user to add to a group
+ * @param string $group name of the group
+ * @param bool $force create missing groups
+ * @return bool true on success, false on error
+ */
+ protected function _addUserToGroup($user, $group, $force = false) {
+ $newgroup = 0;
+
+ if(($this->dbcon) && ($user)) {
+ $gid = $this->_getGroupID($group);
+ if(!$gid) {
+ if($force) { // create missing groups
+ $sql = str_replace('%{group}', $this->_escape($group), $this->getConf('addGroup'));
+ $gid = $this->_modifyDB($sql);
+ $newgroup = 1; // group newly created
+ }
+ if(!$gid) return false; // group didn't exist and can't be created
+ }
+
+ $sql = $this->getConf('addUserGroup');
+ if(strpos($sql, '%{uid}') !== false) {
+ $uid = $this->_getUserID($user);
+ $sql = str_replace('%{uid}', $this->_escape($uid), $sql);
+ }
+ $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($newgroup) { // remove previously created group on error
+ $sql = str_replace('%{gid}', $this->_escape($gid), $this->getConf('delGroup'));
+ $sql = str_replace('%{group}', $this->_escape($group), $sql);
+ $this->_modifyDB($sql);
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Remove user from a group
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user that leaves a group
+ * @param string $group group to leave
+ * @return bool true on success, false on error
+ */
+ protected function _delUserFromGroup($user, $group) {
+ $rc = false;
+
+ if(($this->dbcon) && ($user)) {
+ $sql = $this->getConf('delUserGroup');
+ if(strpos($sql, '%{uid}') !== false) {
+ $uid = $this->_getUserID($user);
+ $sql = str_replace('%{uid}', $this->_escape($uid), $sql);
+ }
+ $gid = $this->_getGroupID($group);
+ if($gid) {
+ $sql = str_replace('%{user}', $this->_escape($user), $sql);
+ $sql = str_replace('%{gid}', $this->_escape($gid), $sql);
+ $sql = str_replace('%{group}', $this->_escape($group), $sql);
+ $rc = $this->_modifyDB($sql) == 0 ? true : false;
+ }
+ }
+ return $rc;
+ }
+
+ /**
+ * Retrieves a list of groups the user is a member off.
+ *
+ * The database connection must already be established
+ * for this function to work. Otherwise it will return
+ * false.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user whose groups should be listed
+ * @return bool|array false on error, all groups on success
+ */
+ protected function _getGroups($user) {
+ $groups = array();
+
+ if($this->dbcon) {
+ $sql = str_replace('%{user}', $this->_escape($user), $this->getConf('getGroups'));
+ $result = $this->_queryDB($sql);
+
+ if($result !== false && count($result)) {
+ foreach($result as $row)
+ $groups[] = $row['group'];
+ }
+ return $groups;
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the user id of a given user name
+ *
+ * The database connection must already be established
+ * for this function to work. Otherwise it will return
+ * false.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user whose id is desired
+ * @return mixed user id
+ */
+ protected function _getUserID($user) {
+ if($this->dbcon) {
+ $sql = str_replace('%{user}', $this->_escape($user), $this->getConf('getUserID'));
+ $result = $this->_queryDB($sql);
+ return $result === false ? false : $result[0]['id'];
+ }
+ return false;
+ }
+
+ /**
+ * Adds a new User to the database.
+ *
+ * The database connection must already be established
+ * for this function to work. Otherwise it will return
+ * false.
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @author Chris Smith <chris@jalakai.co.uk>
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user login of the user
+ * @param string $pwd encrypted password
+ * @param string $name full name of the user
+ * @param string $mail email address
+ * @param array $grps array of groups the user should become member of
+ * @return bool
+ */
+ protected function _addUser($user, $pwd, $name, $mail, $grps) {
+ if($this->dbcon && is_array($grps)) {
+ $sql = str_replace('%{user}', $this->_escape($user), $this->getConf('addUser'));
+ $sql = str_replace('%{pass}', $this->_escape($pwd), $sql);
+ $sql = str_replace('%{name}', $this->_escape($name), $sql);
+ $sql = str_replace('%{email}', $this->_escape($mail), $sql);
+ $uid = $this->_modifyDB($sql);
+ $gid = false;
+ $group = '';
+
+ if($uid) {
+ foreach($grps as $group) {
+ $gid = $this->_addUserToGroup($user, $group, 1);
+ if($gid === false) break;
+ }
+
+ if($gid !== false){
+ return true;
+ } else {
+ /* remove the new user and all group relations if a group can't
+ * be assigned. Newly created groups will remain in the database
+ * and won't be removed. This might create orphaned groups but
+ * is not a big issue so we ignore this problem here.
+ */
+ $this->_delUser($user);
+ $this->_debug("MySQL err: Adding user '$user' to group '$group' failed.", -1, __LINE__, __FILE__);
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Deletes a given user and all his group references.
+ *
+ * The database connection must already be established
+ * for this function to work. Otherwise it will return
+ * false.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user whose id is desired
+ * @return bool
+ */
+ protected function _delUser($user) {
+ if($this->dbcon) {
+ $uid = $this->_getUserID($user);
+ if($uid) {
+ $sql = str_replace('%{uid}', $this->_escape($uid), $this->getConf('delUserRefs'));
+ $this->_modifyDB($sql);
+ $sql = str_replace('%{uid}', $this->_escape($uid), $this->getConf('delUser'));
+ $sql = str_replace('%{user}', $this->_escape($user), $sql);
+ $this->_modifyDB($sql);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * getUserInfo
+ *
+ * Gets the data for a specific user The database connection
+ * must already be established for this function to work.
+ * Otherwise it will return 'false'.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $user user's nick to get data for
+ * @return bool|array false on error, user info on success
+ */
+ protected function _getUserInfo($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;
+ }
+
+ /**
+ * Updates the user info in the database
+ *
+ * Update a user data structure in the database according changes
+ * given in an array. The user name can only be changes if it didn't
+ * exists already. If the new user name exists the update procedure
+ * will be aborted. The database keeps unchanged.
+ *
+ * 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.
+ *
+ * @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) {
+ $sql = $this->getConf('updateUser')." ";
+ $cnt = 0;
+ $err = 0;
+
+ if($this->dbcon) {
+ foreach($changes as $item => $value) {
+ if($item == 'user') {
+ if(($this->_getUserID($changes['user']))) {
+ $err = 1; /* new username already exists */
+ break; /* abort update */
+ }
+ if($cnt++ > 0) $sql .= ", ";
+ $sql .= str_replace('%{user}', $value, $this->getConf('UpdateLogin'));
+ } else if($item == 'name') {
+ if($cnt++ > 0) $sql .= ", ";
+ $sql .= str_replace('%{name}', $value, $this->getConf('UpdateName'));
+ } else if($item == 'pass') {
+ if(!$this->getConf('forwardClearPass'))
+ $value = auth_cryptPassword($value);
+ if($cnt++ > 0) $sql .= ", ";
+ $sql .= str_replace('%{pass}', $value, $this->getConf('UpdatePass'));
+ } else if($item == 'mail') {
+ if($cnt++ > 0) $sql .= ", ";
+ $sql .= str_replace('%{email}', $value, $this->getConf('UpdateEmail'));
+ }
+ }
+
+ if($err == 0) {
+ if($cnt > 0) {
+ $sql .= " ".str_replace('%{uid}', $uid, $this->getConf('UpdateTarget'));
+ if(get_class($this) == 'auth_mysql') $sql .= " LIMIT 1"; //some PgSQL inheritance comp.
+ $this->_modifyDB($sql);
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Retrieves the group id of a given group name
+ *
+ * The database connection must already be established
+ * for this function to work. Otherwise it will return
+ * false.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $group group name which id is desired
+ * @return mixed group id
+ */
+ protected function _getGroupID($group) {
+ if($this->dbcon) {
+ $sql = str_replace('%{group}', $this->_escape($group), $this->getConf('getGroupID'));
+ $result = $this->_queryDB($sql);
+ return $result === false ? false : $result[0]['id'];
+ }
+ return false;
+ }
+
+ /**
+ * Opens a connection to a database and saves the handle for further
+ * usage in the object. The successful call to this functions is
+ * essential for most functions in this object.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @return bool
+ */
+ protected function _openDB() {
+ if(!$this->dbcon) {
+ $con = @mysql_connect($this->getConf('server'), $this->getConf('user'), $this->getConf('password'));
+ if($con) {
+ if((mysql_select_db($this->getConf('database'), $con))) {
+ if((preg_match('/^(\d+)\.(\d+)\.(\d+).*/', mysql_get_server_info($con), $result)) == 1) {
+ $this->dbver = $result[1];
+ $this->dbrev = $result[2];
+ $this->dbsub = $result[3];
+ }
+ $this->dbcon = $con;
+ if($this->getConf('charset')) {
+ mysql_query('SET CHARACTER SET "'.$this->getConf('charset').'"', $con);
+ }
+ return true; // connection and database successfully opened
+ } else {
+ mysql_close($con);
+ $this->_debug("MySQL err: No access to database {$this->getConf('database')}.", -1, __LINE__, __FILE__);
+ }
+ } else {
+ $this->_debug(
+ "MySQL err: Connection to {$this->getConf('user')}@{$this->getConf('server')} not possible.",
+ -1, __LINE__, __FILE__
+ );
+ }
+
+ return false; // connection failed
+ }
+ return true; // connection already open
+ }
+
+ /**
+ * Closes a database connection.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+ protected function _closeDB() {
+ if($this->dbcon) {
+ mysql_close($this->dbcon);
+ $this->dbcon = 0;
+ }
+ }
+
+ /**
+ * Sends a SQL query to the database and transforms the result into
+ * an associative array.
+ *
+ * This function is only able to handle queries that returns a
+ * table such as SELECT.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $query SQL string that contains the query
+ * @return array with the result table
+ */
+ protected function _queryDB($query) {
+ if($this->getConf('debug') >= 2) {
+ msg('MySQL query: '.hsc($query), 0, __LINE__, __FILE__);
+ }
+
+ $resultarray = array();
+ if($this->dbcon) {
+ $result = @mysql_query($query, $this->dbcon);
+ if($result) {
+ while(($t = mysql_fetch_assoc($result)) !== false)
+ $resultarray[] = $t;
+ mysql_free_result($result);
+ return $resultarray;
+ }
+ $this->_debug('MySQL err: '.mysql_error($this->dbcon), -1, __LINE__, __FILE__);
+ }
+ return false;
+ }
+
+ /**
+ * Sends a SQL query to the database
+ *
+ * This function is only able to handle queries that returns
+ * either nothing or an id value such as INPUT, DELETE, UPDATE, etc.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $query SQL string that contains the query
+ * @return int|bool insert id or 0, false on error
+ */
+ protected function _modifyDB($query) {
+ if($this->getConf('debug') >= 2) {
+ msg('MySQL query: '.hsc($query), 0, __LINE__, __FILE__);
+ }
+
+ if($this->dbcon) {
+ $result = @mysql_query($query, $this->dbcon);
+ if($result) {
+ $rc = mysql_insert_id($this->dbcon); //give back ID on insert
+ if($rc !== false) return $rc;
+ }
+ $this->_debug('MySQL err: '.mysql_error($this->dbcon), -1, __LINE__, __FILE__);
+ }
+ return false;
+ }
+
+ /**
+ * Locked a list of tables for exclusive access so that modifications
+ * to the database can't be disturbed by other threads. The list
+ * could be set with $conf['plugin']['authmysql']['TablesToLock'] = array()
+ *
+ * If aliases for tables are used in SQL statements, also this aliases
+ * must be locked. For eg. you use a table 'user' and the alias 'u' in
+ * some sql queries, the array must looks like this (order is important):
+ * array("user", "user AS u");
+ *
+ * MySQL V3 is not able to handle transactions with COMMIT/ROLLBACK
+ * so that this functionality is simulated by this function. Nevertheless
+ * it is not as powerful as transactions, it is a good compromise in safty.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $mode could be 'READ' or 'WRITE'
+ * @return bool
+ */
+ protected function _lockTables($mode) {
+ if($this->dbcon) {
+ $ttl = $this->getConf('TablesToLock');
+ if(is_array($ttl) && !empty($ttl)) {
+ if($mode == "READ" || $mode == "WRITE") {
+ $sql = "LOCK TABLES ";
+ $cnt = 0;
+ foreach($ttl as $table) {
+ if($cnt++ != 0) $sql .= ", ";
+ $sql .= "$table $mode";
+ }
+ $this->_modifyDB($sql);
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Unlock locked tables. All existing locks of this thread will be
+ * abrogated.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ */
+ protected function _unlockTables() {
+ if($this->dbcon) {
+ $this->_modifyDB("UNLOCK TABLES");
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Transforms the filter settings in an filter string for a SQL database
+ * The database connection must already be established, otherwise the
+ * original SQL string without filter criteria will be returned.
+ *
+ * @author Matthias Grimm <matthiasgrimm@users.sourceforge.net>
+ *
+ * @param string $sql SQL string to which the $filter criteria should be added
+ * @param array $filter array of filter criteria as pairs of item and pattern
+ * @return string SQL string with attached $filter criteria on success, original SQL string on error
+ */
+ protected function _createSQLFilter($sql, $filter) {
+ $SQLfilter = "";
+ $cnt = 0;
+
+ if($this->dbcon) {
+ foreach($filter as $item => $pattern) {
+ $tmp = '%'.$this->_escape($pattern).'%';
+ if($item == 'user') {
+ if($cnt++ > 0) $SQLfilter .= " AND ";
+ $SQLfilter .= str_replace('%{user}', $tmp, $this->getConf('FilterLogin'));
+ } else if($item == 'name') {
+ if($cnt++ > 0) $SQLfilter .= " AND ";
+ $SQLfilter .= str_replace('%{name}', $tmp, $this->getConf('FilterName'));
+ } else if($item == 'mail') {
+ if($cnt++ > 0) $SQLfilter .= " AND ";
+ $SQLfilter .= str_replace('%{email}', $tmp, $this->getConf('FilterEmail'));
+ } else if($item == 'grps') {
+ if($cnt++ > 0) $SQLfilter .= " AND ";
+ $SQLfilter .= str_replace('%{group}', $tmp, $this->getConf('FilterGroup'));
+ }
+ }
+
+ // we have to check SQLfilter here and must not use $cnt because if
+ // any of cnf['Filter????'] is not defined, a malformed SQL string
+ // would be generated.
+
+ if(strlen($SQLfilter)) {
+ $glue = strpos(strtolower($sql), "where") ? " AND " : " WHERE ";
+ $sql = $sql.$glue.$SQLfilter;
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Escape a string for insertion into the database
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ *
+ * @param string $string The string to escape
+ * @param boolean $like Escape wildcard chars as well?
+ * @return string
+ */
+ protected function _escape($string, $like = false) {
+ if($this->dbcon) {
+ $string = mysql_real_escape_string($string, $this->dbcon);
+ } else {
+ $string = addslashes($string);
+ }
+ if($like) {
+ $string = addcslashes($string, '%_');
+ }
+ return $string;
+ }
+
+ /**
+ * Wrapper around msg() but outputs only when debug is enabled
+ *
+ * @param string $message
+ * @param int $err
+ * @param int $line
+ * @param string $file
+ * @return void
+ */
+ protected function _debug($message, $err, $line, $file) {
+ if(!$this->getConf('debug')) return;
+ msg($message, $err, $line, $file);
+ }
+}
diff --git a/lib/plugins/authmysql/conf/default.php b/lib/plugins/authmysql/conf/default.php
new file mode 100644
index 000000000..427bea273
--- /dev/null
+++ b/lib/plugins/authmysql/conf/default.php
@@ -0,0 +1,34 @@
+<?php
+
+$conf['charset'] = 'utf8';
+$conf['server'] = '';
+$conf['user'] = '';
+$conf['password'] = '';
+$conf['database'] = '';
+$conf['debug'] = 0;
+$conf['forwardClearPass'] = 0;
+$conf['TablesToLock'] = array();
+$conf['checkPass'] = '';
+$conf['getUserInfo'] = '';
+$conf['getGroups'] = '';
+$conf['getUsers'] = '';
+$conf['FilterLogin'] = '';
+$conf['FilterName'] = '';
+$conf['FilterEmail'] = '';
+$conf['FilterGroup'] = '';
+$conf['SortOrder'] = '';
+$conf['addUser'] = '';
+$conf['addGroup'] = '';
+$conf['addUserGroup'] = '';
+$conf['delGroup'] = '';
+$conf['getUserID'] = '';
+$conf['delUser'] = '';
+$conf['delUserRefs'] = '';
+$conf['updateUser'] = '';
+$conf['UpdateLogin'] = '';
+$conf['UpdatePass'] = '';
+$conf['UpdateEmail'] = '';
+$conf['UpdateName'] = '';
+$conf['UpdateTarget'] = '';
+$conf['delUserGroup'] = '';
+$conf['getGroupID'] = ''; \ No newline at end of file
diff --git a/lib/plugins/authmysql/conf/metadata.php b/lib/plugins/authmysql/conf/metadata.php
new file mode 100644
index 000000000..05d150fdf
--- /dev/null
+++ b/lib/plugins/authmysql/conf/metadata.php
@@ -0,0 +1,34 @@
+<?php
+
+$meta['server'] = array('string');
+$meta['user'] = array('string');
+$meta['password'] = array('password');
+$meta['database'] = array('string');
+$meta['charset'] = array('string');
+$meta['debug'] = array('multichoice','_choices' => array(0,1,2));
+$meta['forwardClearPass'] = array('onoff');
+$meta['TablesToLock'] = array('array');
+$meta['checkPass'] = array('');
+$meta['getUserInfo'] = array('');
+$meta['getGroups'] = array('');
+$meta['getUsers'] = array('');
+$meta['FilterLogin'] = array('string');
+$meta['FilterName'] = array('string');
+$meta['FilterEmail'] = array('string');
+$meta['FilterGroup'] = array('string');
+$meta['SortOrder'] = array('string');
+$meta['addUser'] = array('');
+$meta['addGroup'] = array('');
+$meta['addUserGroup'] = array('');
+$meta['delGroup'] = array('');
+$meta['getUserID'] = array('');
+$meta['delUser'] = array('');
+$meta['delUserRefs'] = array('');
+$meta['updateUser'] = array('string');
+$meta['UpdateLogin'] = array('string');
+$meta['UpdatePass'] = array('string');
+$meta['UpdateEmail'] = array('string');
+$meta['UpdateName'] = array('string');
+$meta['UpdateTarget'] = array('string');
+$meta['delUserGroup'] = array('');
+$meta['getGroupID'] = array(''); \ No newline at end of file
diff --git a/lib/plugins/authmysql/lang/bg/settings.php b/lib/plugins/authmysql/lang/bg/settings.php
new file mode 100644
index 000000000..fcc7f625d
--- /dev/null
+++ b/lib/plugins/authmysql/lang/bg/settings.php
@@ -0,0 +1,17 @@
+<?php
+/**
+ * Bulgarian language file
+ *
+ * @author Kiril <neohidra@gmail.com>
+ */
+$lang['server'] = 'Вашият MySQL сървър';
+$lang['user'] = 'MySQL потребителско име';
+$lang['password'] = 'Парола за горния потребител';
+$lang['database'] = 'Име на базата от данни';
+$lang['charset'] = 'Набор от знаци, който се ползва в базата от данни';
+$lang['debug'] = 'Показване на допълнителна debug информация';
+
+
+$lang['debug_o_0'] = 'не';
+$lang['debug_o_1'] = 'само при грешка';
+$lang['debug_o_2'] = 'за всяко SQL запитване'; \ No newline at end of file
diff --git a/lib/plugins/authmysql/lang/cs/settings.php b/lib/plugins/authmysql/lang/cs/settings.php
new file mode 100644
index 000000000..7fedefbbb
--- /dev/null
+++ b/lib/plugins/authmysql/lang/cs/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Czech language file
+ *
+ * @author mkucera66@seznam.cz
+ */
+$lang['server'] = 'Váš server MySQL';
+$lang['user'] = 'Uživatelské jméno pro MySQL';
+$lang['password'] = 'Heslo tohoto uživatele';
+$lang['database'] = 'Použtá databáze';
+$lang['charset'] = 'znaková sada použitá v databázi';
+$lang['debug'] = 'Zobrazit dodatečné debugovací informace';
+$lang['forwardClearPass'] = 'Posílat uživatelské heslo jako čistý text do příkazů SQL namísto využití volby passcrypt.';
+$lang['TablesToLock'] = 'Čárkou oddělený seznam tabulek, které mohou být zamčené během operací zápisu';
+$lang['checkPass'] = 'Příkaz SQL pro kontrolu hesel';
+$lang['getUserInfo'] = 'Příkaz SQL pro získání informací o uživateli';
+$lang['getGroups'] = 'Příkaz SQL pro získání uživatelovy skupiny';
+$lang['getUsers'] = 'Příkaz SQL pro seznam všech uživatelů';
+$lang['FilterLogin'] = 'Příkaz SQL pro filtrování uživatelů podle přihlašovacího jména';
+$lang['FilterName'] = 'Příkaz SQL pro filtrování uživatelů podle celého jména';
+$lang['FilterEmail'] = 'Příkaz SQL pro filtrování uživatelů podle adres emailů';
+$lang['FilterGroup'] = 'Příkaz SQL pro filtrování uživatelů podle členství ve skupinách';
+$lang['SortOrder'] = 'Příkaz SQL pro řazení uživatelů';
+$lang['addUser'] = 'Příkaz SQL pro přidání nového uživatele';
+$lang['addGroup'] = 'Příkaz SQL pro přidání nové skupiny';
+$lang['addUserGroup'] = 'Příkaz SQL pro přidání uživatele do existující skupiny';
+$lang['delGroup'] = 'Příkaz SQL pro vymazání skupiny';
+$lang['getUserID'] = 'Příkaz SQL pro získání primárního klíče uživatele';
+$lang['delUser'] = 'Příkaz SQL pro vymazání uživatele';
+$lang['delUserRefs'] = 'Příkaz SQL pro odstranění členství uživatele se všech skupin';
+$lang['updateUser'] = 'Příkaz SQL pro aktualizaci uživatelského profilu';
+$lang['UpdateLogin'] = 'Klauzule pro aktualizaci přihlačovacího jména uživatele';
+$lang['UpdatePass'] = 'Klauzule pro aktualizaci hesla uživatele';
+$lang['UpdateEmail'] = 'Klauzule pro aktualizaci emailové adresy uživatele';
+$lang['UpdateName'] = 'Klauzule pro aktualizaci celého jména uživatele';
+$lang['UpdateTarget'] = 'Omezující klauzule pro identifikaci uživatele při aktualizaci';
+$lang['delUserGroup'] = 'Příkaz SQL pro zrušení členství uživatele v dané skupině';
+$lang['getGroupID'] = 'Příkaz SQL pro získání primárního klíče skupiny';
+$lang['debug_o_0'] = 'nic';
+$lang['debug_o_1'] = 'pouze při chybách';
+$lang['debug_o_2'] = 'všechny dotazy SQL';
diff --git a/lib/plugins/authmysql/lang/de-informal/settings.php b/lib/plugins/authmysql/lang/de-informal/settings.php
new file mode 100644
index 000000000..540979cf4
--- /dev/null
+++ b/lib/plugins/authmysql/lang/de-informal/settings.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * German informal language file
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Matthias Schulte <dokuwiki@lupo49.de>
+ * @author Volker Bödker <volker@boedker.de>
+ */
+$lang['server'] = 'MySQL-Server';
+$lang['user'] = 'Benutzername für den Zugriff auf den MySQL-Server.';
+$lang['password'] = 'Passwort des angegebenen Benutzers.';
+$lang['database'] = 'Zu verwendende Datenbank.';
+$lang['charset'] = 'Verwendetes Character-Set in der Datenbank.';
+$lang['debug'] = 'Debug-Informationen anzeigen?';
+$lang['forwardClearPass'] = 'Passwort der DokuWiki-Benutzer im Klartext an die Datenbank übergeben? (Im Normalfall wird die passcrypt-Option angewendet.)';
+$lang['TablesToLock'] = 'Eine Komma-separierte Liste von Tabellen, die vor Schreiboperationen gesperrt werden müssen.';
+$lang['checkPass'] = 'SQL-Kommando zum Überprüfen von Passwörtern.';
+$lang['getUserInfo'] = 'SQL-Kommando um Benutzerinformationen auszulesen.';
+$lang['getGroups'] = 'SQL-Kommando um Gruppen eines Benutzers auszulesen.';
+$lang['getUsers'] = 'SQL-Kommando um alle Benutzer auszulesen.';
+$lang['FilterLogin'] = 'SQL-Bedingung um Benutzer anhand ihres Anmeldenamens zu filtern.';
+$lang['FilterName'] = 'SQL-Bedingung um Benutzer anhand ihres Namens zu filtern.';
+$lang['FilterEmail'] = 'SQL-Bedingung um Benutzer anhand ihrer E-Mail-Adresse zu filtern.';
+$lang['FilterGroup'] = 'SQL-Bedingung um Benutzer anhand ihrer Gruppenzugehörigkeit zu filtern.';
+$lang['SortOrder'] = 'SQL-Bedingung um anhand der die Benutzerliste sortiert wird.';
+$lang['addUser'] = 'SQL-Kommando um einen neuen Benutzer anzulegen.';
+$lang['addGroup'] = 'SQL-Kommando um eine neue Gruppe anzulegen.';
+$lang['addUserGroup'] = 'SQL-Kommando um einen Benutzer zu einer Gruppe hinzuzufügen.';
+$lang['delGroup'] = 'SQL-Kommando um eine Gruppe zu löschen.';
+$lang['getUserID'] = 'SQL-Kommando um den Primärschlüssel des Benutzers auszulesen.';
+$lang['delUser'] = 'SQL-Kommando um einen Benutzer zu löschen.';
+$lang['delUserRefs'] = 'SQL-Kommando um einen Benutzer aus allen Gruppen zu entfernen.';
+$lang['updateUser'] = 'SQL-Kommando um das Profil eines Benutzers zu aktualisieren.';
+$lang['UpdateLogin'] = 'SQL-Bedingung um den Anmeldenamen eines Benutzers zu ändern.';
+$lang['UpdatePass'] = 'SQL-Bedingung um das Passwort eines Benutzers zu ändern.';
+$lang['UpdateEmail'] = 'SQL-Bedingung um die E-Mail-Adresse eines Benutzers zu ändern.';
+$lang['UpdateName'] = 'SQL-Bedingung um den Namen eines Benutzers zu ändern.';
+$lang['UpdateTarget'] = 'SQL-Bedingung zur eindeutigen Identifikation des Benutzers.';
+$lang['delUserGroup'] = 'SQL-Kommando um einen Benutzer aus einer angegeben Gruppe zu entfernen.';
+$lang['getGroupID'] = 'SQL-Kommando um den Primärschlüssel einer Gruppe auszulesen.';
+$lang['debug_o_0'] = 'Keine.';
+$lang['debug_o_1'] = 'Nur Fehler.';
+$lang['debug_o_2'] = 'Alle SQL-Abfragen.';
diff --git a/lib/plugins/authmysql/lang/de/settings.php b/lib/plugins/authmysql/lang/de/settings.php
new file mode 100644
index 000000000..97ba06a9d
--- /dev/null
+++ b/lib/plugins/authmysql/lang/de/settings.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * German language file
+ *
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Matthias Schulte <dokuwiki@lupo49.de>
+ */
+$lang['server'] = 'MySQL-Server';
+$lang['user'] = 'Benutzername für den Zugriff auf den MySQL-Server.';
+$lang['password'] = 'Passwort des angegebenen Benutzers.';
+$lang['database'] = 'Zu verwendende Datenbank.';
+$lang['charset'] = 'Verwendetes Character-Set in der Datenbank.';
+$lang['debug'] = 'Debug-Informationen anzeigen?';
+$lang['forwardClearPass'] = 'Passwort der DokuWiki-Benutzer im Klartext an die Datenbank übergeben? (Im Normalfall wird die passcrypt-Option angewendet.)';
+$lang['TablesToLock'] = 'Eine Komma-separierte Liste von Tabellen, die vor Schreiboperationen gesperrt werden müssen.';
+$lang['checkPass'] = 'SQL-Kommando zum Überprüfen von Passwörtern.';
+$lang['getUserInfo'] = 'SQL-Kommando um Benutzerinformationen auszulesen.';
+$lang['getGroups'] = 'SQL-Kommando um Gruppen eines Benutzers auszulesen.';
+$lang['getUsers'] = 'SQL-Kommando um alle Benutzer auszulesen.';
+$lang['FilterLogin'] = 'SQL-Bedingung um Benutzer anhand ihres Anmeldenamens zu filtern.';
+$lang['FilterName'] = 'SQL-Bedingung um Benutzer anhand ihres Namens zu filtern.';
+$lang['FilterEmail'] = 'SQL-Bedingung um Benutzer anhand ihrer E-Mail-Adresse zu filtern.';
+$lang['FilterGroup'] = 'SQL-Bedingung um Benutzer anhand ihrer Gruppenzugehörigkeit zu filtern.';
+$lang['SortOrder'] = 'SQL-Bedingung um anhand der die Benutzerliste sortiert wird.';
+$lang['addUser'] = 'SQL-Kommando um einen neuen Benutzer anzulegen.';
+$lang['addGroup'] = 'SQL-Kommando um eine neue Gruppe anzulegen.';
+$lang['addUserGroup'] = 'SQL-Kommando um einen Benutzer zu einer Gruppe hinzuzufügen.';
+$lang['delGroup'] = 'SQL-Kommando um eine Gruppe zu löschen.';
+$lang['getUserID'] = 'SQL-Kommando um den Primärschlüssel des Benutzers auszulesen.';
+$lang['delUser'] = 'SQL-Kommando um einen Benutzer zu löschen.';
+$lang['delUserRefs'] = 'SQL-Kommando um einen Benutzer aus allen Gruppen zu entfernen.';
+$lang['updateUser'] = 'SQL-Kommando um das Profil eines Benutzers zu aktualisieren.';
+$lang['UpdateLogin'] = 'SQL-Bedingung um den Anmeldenamen eines Benutzers zu ändern.';
+$lang['UpdatePass'] = 'SQL-Bedingung um das Passwort eines Benutzers zu ändern.';
+$lang['UpdateEmail'] = 'SQL-Bedingung um die E-Mail-Adresse eines Benutzers zu ändern.';
+$lang['UpdateName'] = 'SQL-Bedingung um den Namen eines Benutzers zu ändern.';
+$lang['UpdateTarget'] = 'SQL-Bedingung zur eindeutigen Identifikation des Benutzers.';
+$lang['delUserGroup'] = 'SQL-Kommando um einen Benutzer aus einer angegeben Gruppe zu entfernen.';
+$lang['getGroupID'] = 'SQL-Kommando um den Primärschlüssel einer Gruppe auszulesen.';
+$lang['debug_o_0'] = 'Keine.';
+$lang['debug_o_1'] = 'Nur Fehler.';
+$lang['debug_o_2'] = 'Alle SQL-Abfragen.';
diff --git a/lib/plugins/authmysql/lang/en/settings.php b/lib/plugins/authmysql/lang/en/settings.php
new file mode 100644
index 000000000..77e4806b9
--- /dev/null
+++ b/lib/plugins/authmysql/lang/en/settings.php
@@ -0,0 +1,39 @@
+<?php
+
+$lang['server'] = 'Your MySQL server';
+$lang['user'] = 'MySQL user name';
+$lang['password'] = 'Password for above user';
+$lang['database'] = 'Database to use';
+$lang['charset'] = 'Character set used in database';
+$lang['debug'] = 'Display additional debug information';
+$lang['forwardClearPass'] = 'Pass user passwords as cleartext to the SQL statements below, instead of using the passcrypt option';
+$lang['TablesToLock'] = 'Comma separated list of tables that should be locked on write operations';
+$lang['checkPass'] = 'SQL statement for checking passwords';
+$lang['getUserInfo'] = 'SQL statement for retrieving user information';
+$lang['getGroups'] = 'SQL statement for retrieving a user\'s group memberships';
+$lang['getUsers'] = 'SQL statement to list all users';
+$lang['FilterLogin'] = 'SQL clause for filtering users by login name';
+$lang['FilterName'] = 'SQL clause for filtering users by full name';
+$lang['FilterEmail'] = 'SQL clause for filtering users by email address';
+$lang['FilterGroup'] = 'SQL clause for filtering users by group membership';
+$lang['SortOrder'] = 'SQL clause to sort users';
+$lang['addUser'] = 'SQL statement to add a new user';
+$lang['addGroup'] = 'SQL statement to add a new group';
+$lang['addUserGroup'] = 'SQL statment to add a user to an existing group';
+$lang['delGroup'] = 'SQL statement to remove a group';
+$lang['getUserID'] = 'SQL statement to get the primary key of a user';
+$lang['delUser'] = 'SQL statement to delete a user';
+$lang['delUserRefs'] = 'SQL statement to remove a user from all groups';
+$lang['updateUser'] = 'SQL statement to update a user profile';
+$lang['UpdateLogin'] = 'Update clause for updating the user\'s login name';
+$lang['UpdatePass'] = 'Update clause for updating the user\'s password';
+$lang['UpdateEmail'] = 'Update clause for updating the user\'s email address';
+$lang['UpdateName'] = 'Update clause for updating the user\'s full name';
+$lang['UpdateTarget'] = 'Limit clause to identify the user when updating';
+$lang['delUserGroup'] = 'SQL statement to remove a user from a given group';
+$lang['getGroupID'] = 'SQL statement to get the primary key of a given group';
+
+
+$lang['debug_o_0'] = 'none';
+$lang['debug_o_1'] = 'on errors only';
+$lang['debug_o_2'] = 'all SQL queries'; \ No newline at end of file
diff --git a/lib/plugins/authmysql/lang/eo/settings.php b/lib/plugins/authmysql/lang/eo/settings.php
new file mode 100644
index 000000000..907c761f8
--- /dev/null
+++ b/lib/plugins/authmysql/lang/eo/settings.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Esperanto language file
+ *
+ */
+$lang['server'] = 'Via MySQL-servilo';
+$lang['user'] = 'MySQL uzantonomo';
+$lang['password'] = 'Pasvorto por tiu uzanto';
+$lang['database'] = 'Uzenda datumbazo';
+$lang['charset'] = 'Uzata tiparo en la datumbazo';
+$lang['debug'] = 'Ĉu montri aldonajn erarinformojn?';
+$lang['forwardClearPass'] = 'Ĉu transdoni pasvortojn klartekste al la SQL-frazoj sube anstataŭ uzi pasvortan kaŝon';
+$lang['TablesToLock'] = 'Komodisigita listo de tabeloj, al kiuj ne eblu skribi';
+$lang['checkPass'] = 'SQL-frazo por testi pasvortojn';
+$lang['getUserInfo'] = 'SQL-frazo por ricevi uzantajn informojn';
+$lang['getGroups'] = 'SQL-frazo por ricevi la grupmembrecojn de uzanto';
+$lang['getUsers'] = 'SQL-frazo por listigi ĉiujn uzantojn';
+$lang['FilterLogin'] = 'SQL-frazo por filtri uzantojn je ensaluta nomo';
+$lang['FilterName'] = 'SQL-frazo por filtri uzantojn je plena nomo';
+$lang['FilterEmail'] = 'SQL-frazo por filtri uzantojn je retpoŝtadreso';
+$lang['FilterGroup'] = 'SQL-frazo por filtri uzantojn je grupmembreco';
+$lang['SortOrder'] = 'SQL-frazo por ordigi uzantojn';
+$lang['addUser'] = 'SQL-frazo por aldoni novan uzanton';
+$lang['addGroup'] = 'SQL-frazo por aldoni novan grupon';
+$lang['addUserGroup'] = 'SQL-frazo por aldoni uzanton al ekzistanta grupo';
+$lang['delGroup'] = 'SQL-frazo por forigi grupon';
+$lang['getUserID'] = 'SQL-frazo por ricevi la ĉefan ŝlosilon de uzanto';
+$lang['delUser'] = 'SQL-frazo por forigi uzanton';
+$lang['delUserRefs'] = 'SQL-frazo por forigi uzanton el ĉiuj grupoj';
+$lang['updateUser'] = 'SQL-frazo por aktualigi uzantan profilon';
+$lang['UpdateLogin'] = 'Aktualiga frazo por uzanta ensalutnomo';
+$lang['UpdatePass'] = 'Aktualiga frazo por uzanta pasvorto';
+$lang['UpdateEmail'] = 'Aktualiga frazo por uzanta retpoŝtadreso';
+$lang['UpdateName'] = 'Aktualiga frazo por plena uzanta nomo';
+$lang['UpdateTarget'] = 'Limiga frazo por identigi la uzanton dum aktualigado';
+$lang['delUserGroup'] = 'SQL-frazo por forigi uzanton el indikita grupo';
+$lang['getGroupID'] = 'SQL-frazo por ricevi la ĉefan ŝlosilon de indikita grupo';
+$lang['debug_o_0'] = 'neniu';
+$lang['debug_o_1'] = 'nur dum eraroj';
+$lang['debug_o_2'] = 'ĉiuj SQL-serĉoj';
diff --git a/lib/plugins/authmysql/lang/fi/settings.php b/lib/plugins/authmysql/lang/fi/settings.php
new file mode 100644
index 000000000..d3aa13e07
--- /dev/null
+++ b/lib/plugins/authmysql/lang/fi/settings.php
@@ -0,0 +1,6 @@
+<?php
+/**
+ * Finnish language file
+ *
+ * @author Otto Vainio <otto@valjakko.net>
+ */
diff --git a/lib/plugins/authmysql/lang/fr/settings.php b/lib/plugins/authmysql/lang/fr/settings.php
new file mode 100644
index 000000000..dfb79b545
--- /dev/null
+++ b/lib/plugins/authmysql/lang/fr/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * French language file
+ *
+ * @author Bruno Veilleux <bruno.vey@gmail.com>
+ */
+$lang['server'] = 'Votre serveur MySQL';
+$lang['user'] = 'Nom d\'utilisateur MySQL';
+$lang['password'] = 'Mot de passe pour l\'utilisateur ci-dessus';
+$lang['database'] = 'Base de données à utiliser';
+$lang['charset'] = 'Jeu de caractères utilisé dans la base de données';
+$lang['debug'] = 'Afficher des informations de débogage supplémentaires';
+$lang['forwardClearPass'] = 'Passer les mots de passe aux requêtes SQL ci-dessous en cleartext plutôt qu\'avec l\'option passcrypt';
+$lang['TablesToLock'] = 'Liste séparée par des virgules des tables devant être verrouillées par les opérations d\'écriture';
+$lang['checkPass'] = 'Requête SQL pour la vérification des mots de passe';
+$lang['getUserInfo'] = 'Requête SQL pour la récupération des informations d\'un utilisateur';
+$lang['getGroups'] = 'Requête SQL pour la récupération des groupes d\'un utilisateur';
+$lang['getUsers'] = 'Requête SQL pour énumérer tous les utilisateurs';
+$lang['FilterLogin'] = 'Clause SQL pour filtrer les utilisateurs par identifiant';
+$lang['FilterName'] = 'Clause SQL pour filtrer les utilisateurs par nom complet';
+$lang['FilterEmail'] = 'Clause SQL pour filtrer les utilisateurs par adresse électronique';
+$lang['FilterGroup'] = 'Clause SQL pour filtrer les utilisateurs par groupes';
+$lang['SortOrder'] = 'Clause SQL pour trier les utilisateurs';
+$lang['addUser'] = 'Requête SQL pour ajouter un nouvel utilisateur';
+$lang['addGroup'] = 'Requête SQL pour ajouter un nouveau groupe';
+$lang['addUserGroup'] = 'Requête SQL pour ajouter un utilisateur à un groupe existant';
+$lang['delGroup'] = 'Requête SQL pour retirer un groupe';
+$lang['getUserID'] = 'Requête SQL pour obtenir la clé primaire d\'un utilisateur';
+$lang['delUser'] = 'Requête SQL pour supprimer un utilisateur';
+$lang['delUserRefs'] = 'Requête SQL pour retirer un utilisateur de tous les groupes';
+$lang['updateUser'] = 'Requête SQL pour mettre à jour le profil d\'un utilisateur';
+$lang['UpdateLogin'] = 'Clause de mise à jour pour mettre à jour l\'identifiant d\'un utilisateur';
+$lang['UpdatePass'] = 'Clause de mise à jour pour mettre à jour le mot de passe d\'un utilisateur';
+$lang['UpdateEmail'] = 'Clause de mise à jour pour mettre à jour l\'adresse électronique d\'un utilisateur';
+$lang['UpdateName'] = 'Clause de mise à jour pour mettre à jour le nom complet d\'un utilisateur';
+$lang['UpdateTarget'] = 'Clause de limite pour identifier l\'utilisateur durant une mise à jour';
+$lang['delUserGroup'] = 'Requête SQL pour retirer un utilisateur d\'un groupe donné';
+$lang['getGroupID'] = 'Requête SQL pour obtenir la clé primaire d\'un groupe donné';
+$lang['debug_o_0'] = 'aucun';
+$lang['debug_o_1'] = 'sur erreur seulement';
+$lang['debug_o_2'] = 'toutes les requêtes SQL';
diff --git a/lib/plugins/authmysql/lang/it/settings.php b/lib/plugins/authmysql/lang/it/settings.php
new file mode 100644
index 000000000..10ae72f87
--- /dev/null
+++ b/lib/plugins/authmysql/lang/it/settings.php
@@ -0,0 +1,5 @@
+<?php
+/**
+ * Italian language file
+ *
+ */
diff --git a/lib/plugins/authmysql/lang/ja/settings.php b/lib/plugins/authmysql/lang/ja/settings.php
new file mode 100644
index 000000000..45f938fec
--- /dev/null
+++ b/lib/plugins/authmysql/lang/ja/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Japanese language file
+ *
+ * @author Satoshi Sahara <sahara.satoshi@gmail.com>
+ */
+$lang['server'] = 'MySQL のホスト名';
+$lang['user'] = 'MySQL 接続用ユーザー名';
+$lang['password'] = 'MySQL 接続用ユーザーのパスワード';
+$lang['database'] = '使用するデータベース名';
+$lang['charset'] = 'データベースの文字コード';
+$lang['debug'] = 'デバック情報を表示する';
+$lang['forwardClearPass'] = '以下で定義する SQL ステートメントにおいて, パスワード変数 %{pass} を平文とする(DokiWiki側で暗号化しない)';
+$lang['TablesToLock'] = '書き込み時にロックするテーブル(コンマ区切りで列挙)';
+$lang['checkPass'] = 'パスワードの照合に用いる SQL ステートメント';
+$lang['getUserInfo'] = 'ユーザー情報の取得に用いる SQL ステートメント';
+$lang['getGroups'] = 'ユーザーが所属する全てのグループの取得に用いる SQL ステートメント';
+$lang['getUsers'] = 'ユーザーリストを取得する SQL ステートメント';
+$lang['FilterLogin'] = 'ユーザーリストをログイン名で絞り込む SQL 句';
+$lang['FilterName'] = 'ユーザーリストをフルネームで絞り込む SQL 句';
+$lang['FilterEmail'] = 'ユーザーリストをメールアドレスで絞り込む SQL 句';
+$lang['FilterGroup'] = 'ユーザーリストを所属グループで絞り込む SQL 句';
+$lang['SortOrder'] = 'ユーザーリストのソート方法を指定する SQL 句';
+$lang['addUser'] = '新規ユーザーを追加する SQL ステートメント';
+$lang['addGroup'] = '新規グループを追加する SQL ステートメント';
+$lang['addUserGroup'] = 'ユーザーをグループに配属する SQL ステートメント';
+$lang['delGroup'] = 'グループを削除する SQL ステートメント';
+$lang['getUserID'] = 'ユーザーIDの取得に用いる SQL ステートメント';
+$lang['delUser'] = 'ユーザーを削除する SQL ステートメント';
+$lang['delUserRefs'] = 'ユーザーのグループ所属を全て取り消す SQL ステートメント';
+$lang['updateUser'] = 'ユーザー情報を変更する SQL ステートメント';
+$lang['UpdateLogin'] = '変更後のログイン名を指定する SQL 句';
+$lang['UpdatePass'] = '変更後のパスワードを指定する SQL 句';
+$lang['UpdateEmail'] = '変更後のメールアドレスを指定する SQL 句';
+$lang['UpdateName'] = '変更後のフルネームを指定する SQL 句';
+$lang['UpdateTarget'] = '変更対象のユーザを特定するための SQL 句';
+$lang['delUserGroup'] = 'ユーザーをグループから除名する SQL ステートメント';
+$lang['getGroupID'] = 'グループIDの取得に用いる SQL ステートメント';
+$lang['debug_o_0'] = '表示しない';
+$lang['debug_o_1'] = 'エラー発生時のみ表示';
+$lang['debug_o_2'] = '全ての SQLクエリで表示';
diff --git a/lib/plugins/authmysql/lang/ko/settings.php b/lib/plugins/authmysql/lang/ko/settings.php
new file mode 100644
index 000000000..c5518b8cc
--- /dev/null
+++ b/lib/plugins/authmysql/lang/ko/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Korean language file
+ *
+ * @author Myeongjin <aranet100@gmail.com>
+ */
+$lang['server'] = 'MySQL 서버';
+$lang['user'] = 'MySQL 사용자 이름';
+$lang['password'] = '위 사용자의 비밀번호';
+$lang['database'] = '사용할 데이터베이스';
+$lang['charset'] = '데이터베이스에 사용하는 문자 집합';
+$lang['debug'] = '추가적인 디버그 정보 보이기';
+$lang['forwardClearPass'] = 'passcrypt 옵션을 사용하는 대신 아래 SQL 문에 일반 텍스트로 사용자 비밀번호를 전달';
+$lang['TablesToLock'] = '쓰기 작업에 잠궈야 하는 테이블의 쉼표로 구분한 목록';
+$lang['checkPass'] = '비밀번호를 확인하기 위한 SQL 문';
+$lang['getUserInfo'] = '사용자 정보를 가져오기 위한 SQL 문';
+$lang['getGroups'] = '사용자의 그룹 구성원을 가져오기 위한 SQL 문';
+$lang['getUsers'] = '모든 사용자를 나타낼 SQL 문';
+$lang['FilterLogin'] = '로그인 이름 별로 사용자를 필터하기 위한 SQL 조항';
+$lang['FilterName'] = '전체 이름 별로 사용자를 필터하기 위한 SQL 조항';
+$lang['FilterEmail'] = '이메일 주소 별로 사용자를 필터하기 위한 SQL 조항';
+$lang['FilterGroup'] = '그룹 구성원 별로 사용자를 필터하기 위한 SQL 조항';
+$lang['SortOrder'] = '사용자를 정렬할 SQL 조항';
+$lang['addUser'] = '새 사용자를 추가할 SQL 문';
+$lang['addGroup'] = '새 그룹을 추가할 SQL 문';
+$lang['addUserGroup'] = '기존 그룹에 사용자를 추가할 SQL 문';
+$lang['delGroup'] = '그룹을 제거할 SQL 문';
+$lang['getUserID'] = '사용자의 기본 키를 얻을 SQL 문';
+$lang['delUser'] = '사용자를 삭제할 SQL 문';
+$lang['delUserRefs'] = '모든 그룹에서 사용자를 제거할 SQL 문';
+$lang['updateUser'] = '사용자 프로필을 업데이트할 SQL 문';
+$lang['UpdateLogin'] = '사용자의 로그인 이름을 업데이트하기 위한 Update 조항';
+$lang['UpdatePass'] = '사용자의 비밀번호를 업데이트하기 위한 Update 조항';
+$lang['UpdateEmail'] = '사용자의 이메일 주소를 업데이트하기 위한 Update 조항';
+$lang['UpdateName'] = '사용자의 전체 이름을 업데이트하기 위한 Update 조항';
+$lang['UpdateTarget'] = '업데이트할 때 사용자를 식별할 Limit 조항';
+$lang['delUserGroup'] = '주어진 그룹에서 사용자를 제거할 SQL 문';
+$lang['getGroupID'] = '주어진 그룹의 기본 키를 얻을 SQL 문';
+$lang['debug_o_0'] = '없음';
+$lang['debug_o_1'] = '오류에만';
+$lang['debug_o_2'] = '모든 SQL 쿼리';
diff --git a/lib/plugins/authmysql/lang/lv/settings.php b/lib/plugins/authmysql/lang/lv/settings.php
new file mode 100644
index 000000000..ced5dabf8
--- /dev/null
+++ b/lib/plugins/authmysql/lang/lv/settings.php
@@ -0,0 +1,6 @@
+<?php
+/**
+ * Latvian, Lettish language file
+ *
+ * @author Aivars Miška <allefm@gmail.com>
+ */
diff --git a/lib/plugins/authmysql/lang/nl/settings.php b/lib/plugins/authmysql/lang/nl/settings.php
new file mode 100644
index 000000000..dc85b7eee
--- /dev/null
+++ b/lib/plugins/authmysql/lang/nl/settings.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Dutch language file
+ *
+ */
+$lang['server'] = 'Je MySQL server';
+$lang['user'] = 'MySql gebruikersnaam';
+$lang['password'] = 'Wachtwoord van bovenstaande gebruiker';
+$lang['database'] = 'Te gebruiken database';
+$lang['charset'] = 'Tekenset voor database';
+$lang['debug'] = 'Tonen aanvullende debuginformatie';
+$lang['forwardClearPass'] = 'Wachtwoorden als leesbare tekst in SQL commando\'s opnemen in plaats van versleutelde tekens';
+$lang['TablesToLock'] = 'Commagesepareerde lijst van tabellen die gelocked moeten worden bij schrijfacties';
+$lang['checkPass'] = 'SQL commando voor verifiëren van wachtwoorden';
+$lang['getUserInfo'] = 'SQL commando voor ophalen gebruikersinformatie';
+$lang['getGroups'] = 'SQL commando voor ophalen groepslidmaatschappen';
+$lang['getUsers'] = 'SQL commando voor tonen alle gebruikers';
+$lang['FilterLogin'] = 'SQL clausule voor filteren gebruikers op inlognaam';
+$lang['FilterName'] = 'SQL clausule voor filteren gebruikers op volledige naam';
+$lang['FilterEmail'] = 'SQL clausule voor filteren gebruikers op e-mailadres';
+$lang['FilterGroup'] = 'SQL clausule voor filteren gebruikers op groepslidmaatschap';
+$lang['SortOrder'] = 'SQL clausule voor sorteren gebruikers';
+$lang['addUser'] = 'SQL commando om een gebruiker toe te voegen';
+$lang['addGroup'] = 'SQL commando om een groep toe te voegen';
+$lang['addUserGroup'] = 'SQL commando om een gebruiker aan een groep toe te voegen';
+$lang['delGroup'] = 'SQL commando om een groep te verwijderen';
+$lang['getUserID'] = 'SQL commando om de de primaire sleutel van een gebruiker op te halen';
+$lang['delUser'] = 'SQL commando om een gebruiker te verwijderen';
+$lang['delUserRefs'] = 'SQL commando om een gebruiker uit alle groepen te verwijderen';
+$lang['updateUser'] = 'SQL commando om een gebruikersprofiel bij te werken';
+$lang['UpdateLogin'] = 'Bijwerkcommando om een inlognaam bij te werken';
+$lang['UpdatePass'] = 'Bijwerkcommando om een wachtwoord bij te werken';
+$lang['UpdateEmail'] = 'Bijwerkcommando om een e-mailadres bij te werken';
+$lang['UpdateName'] = 'Bijwerkcommando om een volledige naam te werken';
+$lang['UpdateTarget'] = 'Beperkingsclausule om gebruiker te identificeren voor bijwerken';
+$lang['delUserGroup'] = 'SQL commando om een gebruiker uit een bepaalde te verwijderen';
+$lang['getGroupID'] = 'SQL commando om de primaire sletel van een bepaalde groep op te halen';
+$lang['debug_o_0'] = 'geen';
+$lang['debug_o_1'] = 'alleen bij fouten';
+$lang['debug_o_2'] = 'alle SQL queries';
diff --git a/lib/plugins/authmysql/lang/pt-br/settings.php b/lib/plugins/authmysql/lang/pt-br/settings.php
new file mode 100644
index 000000000..5febedd13
--- /dev/null
+++ b/lib/plugins/authmysql/lang/pt-br/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Brazilian Portuguese language file
+ *
+ * @author Victor Westmann <victor.westmann@gmail.com>
+ */
+$lang['server'] = 'Seu servidor MySQL';
+$lang['user'] = 'usuário MySQL';
+$lang['password'] = 'Senha do usuário acima';
+$lang['database'] = 'Base de dados para usar';
+$lang['charset'] = 'Codificação de caracter usado na base de dados';
+$lang['debug'] = 'Mostrar informações adicionais de depuração';
+$lang['forwardClearPass'] = 'Passar senhas de usuários como texto puro para comandos SQL abaixo, ao invés de usar opção passcrypt';
+$lang['TablesToLock'] = 'Lista separada por vírgulas para tabelas que devem estar travadas em operações de escrita';
+$lang['checkPass'] = 'Comandos SQL para verificar senhas';
+$lang['getUserInfo'] = 'Comando SQL para obter informações de usuário';
+$lang['getGroups'] = 'Comando SQL para obter as credenciais de grupo de um usuário';
+$lang['getUsers'] = 'Comando SQL para listar todos os usuários';
+$lang['FilterLogin'] = 'Comando SQL para filtrar usuários pelo login';
+$lang['FilterName'] = 'Cláusula SQL para filtrar usuários por nome completo';
+$lang['FilterEmail'] = 'Cláusula SQL para filtrar usuários por endereço de email';
+$lang['FilterGroup'] = 'Cláusula SQL para filtrar usuários por membros de grupos';
+$lang['SortOrder'] = 'Cláusula SQL para ordenar usuários';
+$lang['addUser'] = 'Comando SQL para adicionar um novo usuário';
+$lang['addGroup'] = 'Comando SQL para adicionar um novo grupo';
+$lang['addUserGroup'] = 'Comando SQL para adicionar um usuário a um determinado grupo';
+$lang['delGroup'] = 'Comando SQL para remover um grupo';
+$lang['getUserID'] = 'Comando SQL para obter a chave primária de um usuário';
+$lang['delUser'] = 'Comando SQL para apagar um usuário';
+$lang['delUserRefs'] = 'Comando SQL para apagar um usuário de todos os grupos';
+$lang['updateUser'] = 'Comando SQL para atualizar perfil de usuário';
+$lang['UpdateLogin'] = 'Comando SQL para atualizar o login de um usuário';
+$lang['UpdatePass'] = 'Cláusula de atualização para atualizar senha de usuário';
+$lang['UpdateEmail'] = 'Cláusula de atualização para atualizar email do usuário';
+$lang['UpdateName'] = 'Cláusula de atualização para atualizar nome completo do usuário';
+$lang['UpdateTarget'] = 'Limitar cláusula para identificar usuário quando estiver atualizando';
+$lang['delUserGroup'] = 'Comando SQL para remover um usuário de um grupo determinado';
+$lang['getGroupID'] = 'Comando SQL para obter a chave primária de um grupo determinado';
+$lang['debug_o_0'] = 'nenhum';
+$lang['debug_o_1'] = 'apenas em erros';
+$lang['debug_o_2'] = 'todas as queries SQL';
diff --git a/lib/plugins/authmysql/lang/ru/settings.php b/lib/plugins/authmysql/lang/ru/settings.php
new file mode 100644
index 000000000..066598331
--- /dev/null
+++ b/lib/plugins/authmysql/lang/ru/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Russian language file
+ *
+ * @author Ivan I. Udovichenko (sendtome@mymailbox.pp.ua)
+ */
+$lang['server'] = 'Ваш MySQL-сервер';
+$lang['user'] = 'Имя пользователя MySQL';
+$lang['password'] = 'Пароль пользователя MySQL';
+$lang['database'] = 'Имя базы данных';
+$lang['charset'] = 'Используемый набор символов в базе данных';
+$lang['debug'] = 'Отображение дополнительной отладочной информации';
+$lang['forwardClearPass'] = 'Передача пароля пользователя открытым текстом, вместо зашифрованной формы в используемом выражении SQL';
+$lang['TablesToLock'] = 'Имена таблиц (через запятую), которые необходимо ограничение для записи';
+$lang['checkPass'] = 'Выражение SQL, осуществляющее проверку пароля';
+$lang['getUserInfo'] = 'Выражение SQL, осуществляющее извлечение информации о пользователе';
+$lang['getGroups'] = 'Выражение SQL, осуществляющее извлечение информации о членстве пользователе в группах';
+$lang['getUsers'] = 'Выражение SQL, осуществляющее извлечение полного списка пользователей';
+$lang['FilterLogin'] = 'Выражение SQL, осуществляющее фильтрацию пользователей по пользовательскому имени';
+$lang['FilterName'] = 'Выражение SQL, осуществляющее фильтрацию пользователей по полному имени';
+$lang['FilterEmail'] = 'Выражение SQL, осуществляющее фильтрацию пользователей по адресу электронной почты';
+$lang['FilterGroup'] = 'Выражение SQL, осуществляющее фильтрацию пользователей согласно членству в группе';
+$lang['SortOrder'] = 'Выражение SQL, осуществляющее сортировку пользователей';
+$lang['addUser'] = 'Выражение SQL, осуществляющее добавление нового опльзователя';
+$lang['addGroup'] = 'Выражение SQL, осуществляющее добавление новой группы';
+$lang['addUserGroup'] = 'Выражение SQL, осуществляющее добавление пользователя в существующую группу';
+$lang['delGroup'] = 'Выражение SQL, осуществляющее удаление группы';
+$lang['getUserID'] = 'Выражение SQL, обеспечивающее получение первичного ключа пользователя';
+$lang['delUser'] = 'Выражение SQL, осуществляющее удаление пользователя';
+$lang['delUserRefs'] = 'Выражение SQL, осуществляющее удаление пользователя из всех групп';
+$lang['updateUser'] = 'Выражение SQL, осуществляющее обновление профиля пользователя';
+$lang['UpdateLogin'] = 'Условие для обновления имени пользователя';
+$lang['UpdatePass'] = 'Условие для обновления пароля пользователя';
+$lang['UpdateEmail'] = 'Условие для обновления адреса электронной почты пользователя';
+$lang['UpdateName'] = 'Условие для обновления полного имени пользователя';
+$lang['UpdateTarget'] = 'Условие для идентификации пользователя при обновлении';
+$lang['delUserGroup'] = 'Выражение SQL, осуществляющее удаление пользователя из указанной группы';
+$lang['getGroupID'] = 'Выражение SQL, обеспечивающее получение первичного ключа указанной группы';
+$lang['debug_o_0'] = 'ни один из вариантов';
+$lang['debug_o_1'] = 'только при возникновении ошибок';
+$lang['debug_o_2'] = 'все SQL-запросы';
diff --git a/lib/plugins/authmysql/lang/sv/settings.php b/lib/plugins/authmysql/lang/sv/settings.php
new file mode 100644
index 000000000..027c64025
--- /dev/null
+++ b/lib/plugins/authmysql/lang/sv/settings.php
@@ -0,0 +1,25 @@
+<?php
+/**
+ * Swedish language file
+ *
+ * @author Smorkster Andersson smorkster@gmail.com
+ */
+$lang['server'] = 'Din MySQL server';
+$lang['user'] = 'Användarnamn för MySQL';
+$lang['password'] = 'Lösenord för användare ovan';
+$lang['database'] = 'Databas att använda';
+$lang['debug'] = 'Visa ytterligare felsökningsinformation';
+$lang['forwardClearPass'] = 'Skicka användares lösenord i klartext till SQL sats nedan, istället för att använda passcrypt alternativet';
+$lang['checkPass'] = 'SQL sats för kontroll av lösenord';
+$lang['getUserInfo'] = 'SQL sats för att hämta användarinformation';
+$lang['getGroups'] = 'SQL sats för att hämta en användares gruppmedlemskap';
+$lang['getUsers'] = 'SQL sats för att lista alla användare';
+$lang['addUser'] = 'SQL sats för att lägga till en användare';
+$lang['addGroup'] = 'SQL sats för att lägga till en grupp';
+$lang['addUserGroup'] = 'SQL sats för att lägga till en användare i en existerande grupp';
+$lang['delGroup'] = 'SQL sats för att ta bort en grupp';
+$lang['delUser'] = 'SQL sats för att ta bort en användare';
+$lang['delUserRefs'] = 'SQL sats för att ta bort en användare från alla grupper';
+$lang['updateUser'] = 'SQL sats för att uppdatera en användarprofil';
+$lang['delUserGroup'] = 'SQL sats för att ta bort en användare från en angiven grupp';
+$lang['debug_o_0'] = 'ingen';
diff --git a/lib/plugins/authmysql/lang/zh-tw/settings.php b/lib/plugins/authmysql/lang/zh-tw/settings.php
new file mode 100644
index 000000000..95d068150
--- /dev/null
+++ b/lib/plugins/authmysql/lang/zh-tw/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Chinese Traditional language file
+ *
+ * @author syaoranhinata@gmail.com
+ */
+$lang['server'] = '您的 MySQL 伺服器';
+$lang['user'] = 'MySQL 使用者名稱';
+$lang['password'] = '上述使用者的密碼';
+$lang['database'] = '使用的資料庫';
+$lang['charset'] = '資料庫使用的字符集';
+$lang['debug'] = '顯示額外除錯資訊';
+$lang['forwardClearPass'] = '以明文形式,把使用者密碼傳送给下列的 SQL 語句,而不使用 passcrypt 密碼加密選項';
+$lang['TablesToLock'] = '在寫操作時需要鎖定的數據表列表,以逗號分隔';
+$lang['checkPass'] = '檢查密碼的 SQL 語句';
+$lang['getUserInfo'] = '獲取使用者訊息的 SQL 語句';
+$lang['getGroups'] = '獲取使用者群組成員身份的 SQL 語句';
+$lang['getUsers'] = '把所有使用者列出的 SQL 語句';
+$lang['FilterLogin'] = '根據登入名稱來篩選使用者的 SQL 子句';
+$lang['FilterName'] = '根據全名來篩選使用者的 SQL 子句';
+$lang['FilterEmail'] = '根據電郵地址來篩選使用者的 SQL 子句';
+$lang['FilterGroup'] = '根據群組成員身份來篩選使用者的 SQL 子句';
+$lang['SortOrder'] = '對使用者排序的 SQL 子句';
+$lang['addUser'] = '增加新使用者的 SQL 語句';
+$lang['addGroup'] = '增加新群組的 SQL 語句';
+$lang['addUserGroup'] = '把使用者新增至現有群組的 SQL 語句';
+$lang['delGroup'] = '把群組刪除的 SQL 語句';
+$lang['getUserID'] = '取得使用者主鍵的 SQL 語句';
+$lang['delUser'] = '把使用者刪除的 SQL 語句';
+$lang['delUserRefs'] = '把使用者從所有群組裏刪除的 SQL 語句';
+$lang['updateUser'] = '更新使用者訊息的 SQL 語句';
+$lang['UpdateLogin'] = '更新使用者登入名稱的 Update 子句';
+$lang['UpdatePass'] = '更新帳號密碼的 Update 子句';
+$lang['UpdateEmail'] = '更新使用者電郵地址的 Update 子句';
+$lang['UpdateName'] = '更新使用者全名的 Update 子句';
+$lang['UpdateTarget'] = '在更新時識別使用者的 Limit 子句';
+$lang['delUserGroup'] = '把使用者從指定群組中刪除的 SQL 語句';
+$lang['getGroupID'] = '取得指定群組主鍵的 SQL 語句';
+$lang['debug_o_0'] = '無';
+$lang['debug_o_1'] = '僅在有錯誤時';
+$lang['debug_o_2'] = '所有 SQL 查詢';
diff --git a/lib/plugins/authmysql/lang/zh/settings.php b/lib/plugins/authmysql/lang/zh/settings.php
new file mode 100644
index 000000000..772f75ecd
--- /dev/null
+++ b/lib/plugins/authmysql/lang/zh/settings.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Chinese language file
+ *
+ * @author lainme <lainme993@gmail.com>
+ */
+$lang['server'] = '您的 MySQL 服务器';
+$lang['user'] = 'MySQL 用户名';
+$lang['password'] = '上述用户的密码';
+$lang['database'] = '使用的数据库';
+$lang['charset'] = '数据库中使用的字符集';
+$lang['debug'] = '显示额外调试信息';
+$lang['forwardClearPass'] = '将用户密码以明文形式传送给下面的 SQL 语句,而不使用 passcrypt 密码加密选项';
+$lang['TablesToLock'] = '在写操作时需要锁定的数据表列表,以逗号分隔';
+$lang['checkPass'] = '检查密码的 SQL 语句';
+$lang['getUserInfo'] = '获取用户信息的 SQL 语句';
+$lang['getGroups'] = '或许用户的组成员身份的 SQL 语句';
+$lang['getUsers'] = '列出所有用户的 SQL 语句';
+$lang['FilterLogin'] = '根据登录名筛选用户的 SQL 子句';
+$lang['FilterName'] = '根据全名筛选用户的 SQL 子句';
+$lang['FilterEmail'] = '根据电子邮件地址筛选用户的 SQL 子句';
+$lang['FilterGroup'] = '根据组成员身份筛选用户的 SQL 子句';
+$lang['SortOrder'] = '对用户排序的 SQL 子句';
+$lang['addUser'] = '添加新用户的 SQL 语句';
+$lang['addGroup'] = '添加新组的 SQL 语句';
+$lang['addUserGroup'] = '将用户添加到现有组的 SQL 语句';
+$lang['delGroup'] = '删除组的 SQL 语句';
+$lang['getUserID'] = '获取用户主键的 SQL 语句';
+$lang['delUser'] = '删除用户的 SQL 语句';
+$lang['delUserRefs'] = '从所有组中删除一个用户的 SQL 语句';
+$lang['updateUser'] = '更新用户信息的 SQL 语句';
+$lang['UpdateLogin'] = '更新用户登录名的 Update 子句';
+$lang['UpdatePass'] = '更新用户密码的 Update 子句';
+$lang['UpdateEmail'] = '更新用户电子邮件地址的 Update 子句';
+$lang['UpdateName'] = '更新用户全名的 Update 子句';
+$lang['UpdateTarget'] = '更新时识别用户的 Limit 子句';
+$lang['delUserGroup'] = '从指定组删除用户的 SQL 语句';
+$lang['getGroupID'] = '获取指定组主键的 SQL 语句';
+$lang['debug_o_0'] = '无';
+$lang['debug_o_1'] = '仅在有错误时';
+$lang['debug_o_2'] = '所有 SQL 查询';
diff --git a/lib/plugins/authmysql/plugin.info.txt b/lib/plugins/authmysql/plugin.info.txt
new file mode 100644
index 000000000..16fe27e74
--- /dev/null
+++ b/lib/plugins/authmysql/plugin.info.txt
@@ -0,0 +1,7 @@
+base authmysql
+author Andreas Gohr
+email andi@splitbrain.org
+date 2013-02-16
+name mysql auth plugin
+desc Provides authentication against a MySQL Server
+url http://www.dokuwiki.org/plugin:authmysql