From: <var...@us...> - 2022-03-24 13:44:58
|
Revision: 11012 http://sourceforge.net/p/phpwiki/code/11012 Author: vargenau Date: 2022-03-24 13:44:55 +0000 (Thu, 24 Mar 2022) Log Message: ----------- run php-cs-fixer Modified Paths: -------------- trunk/lib/WikiUser/BogoLogin.php trunk/lib/WikiUser/Db.php trunk/lib/WikiUser/Facebook.php trunk/lib/WikiUser/File.php trunk/lib/WikiUser/Forbidden.php trunk/lib/WikiUser/FusionForge.php trunk/lib/WikiUser/HttpAuth.php trunk/lib/WikiUser/HttpAuthUpper.php trunk/lib/WikiUser/IMAP.php trunk/lib/WikiUser/LDAP.php trunk/lib/WikiUser/LdapUpper.php trunk/lib/WikiUser/OpenID.php trunk/lib/WikiUser/POP3.php trunk/lib/WikiUser/PdoDb.php trunk/lib/WikiUser/PearDb.php trunk/lib/WikiUser/PersonalPage.php trunk/lib/WikiUser/Session.php Modified: trunk/lib/WikiUser/BogoLogin.php =================================================================== --- trunk/lib/WikiUser/BogoLogin.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/BogoLogin.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -27,10 +27,9 @@ */ class _BogoLoginPassUser extends _PassUser { - public $_authmethod = 'BogoLogin'; - function userExists() + public function userExists() { if (isWikiWord($this->_userid)) { $this->_level = WIKIAUTH_BOGO; @@ -44,7 +43,7 @@ /** A BogoLoginUser requires no password at all * But if there's one stored, we override it with the PersonalPagePassUser instead */ - function checkPass($submitted_password) + public function checkPass($submitted_password) { if ($this->_prefs->get('passwd')) { if (isset($this->_prefs->_method) and $this->_prefs->_method == 'HomePage') { Modified: trunk/lib/WikiUser/Db.php =================================================================== --- trunk/lib/WikiUser/Db.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/Db.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -44,14 +44,15 @@ * * Flat files auth is handled by the auth method "File". */ -class _DbPassUser - extends _PassUser +class _DbPassUser extends _PassUser { - public $_authselect, $_authupdate, $_authcreate; + public $_authselect; + public $_authupdate; + public $_authcreate; // This can only be called from _PassUser, because the parent class // sets the auth_dbi and pref methods, before this class is initialized. - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { /** * @var WikiRequest $request @@ -59,11 +60,13 @@ global $request; if (!$this->_prefs) { - if ($prefs) $this->_prefs = $prefs; + if ($prefs) { + $this->_prefs = $prefs; + } } - if (!isset($this->_prefs->_method)) + if (!isset($this->_prefs->_method)) { parent::__construct($UserName); - elseif (!$this->isValidName($UserName)) { + } elseif (!$this->isValidName($UserName)) { trigger_error(_("Invalid username."), E_USER_WARNING); return false; } @@ -85,17 +88,22 @@ /* Since we properly quote the username, we allow most chars here. Just " ; and ' is forbidden, max length: 48 as defined in the schema. */ - function isValidName($userid = false) + public function isValidName($userid = false) { - if (!$userid) $userid = $this->_userid; - if (strcspn($userid, ";'\"") != strlen($userid)) return false; - if (strlen($userid) > 48) return false; + if (!$userid) { + $userid = $this->_userid; + } + if (strcspn($userid, ";'\"") != strlen($userid)) { + return false; + } + if (strlen($userid) > 48) { + return false; + } return true; } - function mayChangePass() + public function mayChangePass() { return !isset($this->_authupdate); } - } Modified: trunk/lib/WikiUser/Facebook.php =================================================================== --- trunk/lib/WikiUser/Facebook.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/Facebook.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -29,13 +29,12 @@ // requires the openssl extension require_once 'lib/HttpClient.php'; -class _FacebookPassUser - extends _PassUser +class _FacebookPassUser extends _PassUser { /** * Preferences are handled in _PassUser */ - function checkPass($password) + public function checkPass($password) { $userid = $this->_userid; if (!loadPhpExtension('openssl')) { @@ -42,33 +41,52 @@ trigger_error( sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'Facebook'), - E_USER_WARNING); + E_USER_WARNING + ); return $this->_tryNextUser(); } $web = new HttpClient("www.facebook.com", 80); - if (DEBUG & _DEBUG_LOGIN) $web->setDebug(true); + if (DEBUG & _DEBUG_LOGIN) { + $web->setDebug(true); + } // collect cookies from http://www.facebook.com/login.php $web->persist_cookies = true; $web->cookie_host = 'www.facebook.com'; $firstlogin = $web->get("/login.php"); if (!$firstlogin) { - if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) - trigger_error(sprintf(_("Facebook connect failed with %d %s"), - $web->status, $web->errormsg), - E_USER_WARNING); + if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) { + trigger_error( + sprintf( + _("Facebook connect failed with %d %s"), + $web->status, + $web->errormsg + ), + E_USER_WARNING + ); + } } // Switch from http to https://login.facebook.com/login.php $web->port = 443; $web->host = 'login.facebook.com'; if (!($retval = $web->post("/login.php", array('user' => $userid, 'pass' => $password)))) { - if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) - trigger_error(sprintf(_("Facebook login failed with %d %s"), - $web->status, $web->errormsg), - E_USER_WARNING); + if (DEBUG & (_DEBUG_LOGIN | _DEBUG_VERBOSE)) { + trigger_error( + sprintf( + _("Facebook login failed with %d %s"), + $web->status, + $web->errormsg + ), + E_USER_WARNING + ); + } } $this->_authmethod = 'Facebook'; - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval", - E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error( + get_class($this) . "::checkPass => $retval", + E_USER_WARNING + ); + } if ($retval) { $this->_level = WIKIAUTH_USER; } else { @@ -78,17 +96,19 @@ } // TODO: msearch facebook for the username - function userExists() + public function userExists() { if (!loadPhpExtension('openssl')) { trigger_error( sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'Facebook'), - E_USER_WARNING); + E_USER_WARNING + ); return $this->_tryNextUser(); } - if (DEBUG & _DEBUG_LOGIN) + if (DEBUG & _DEBUG_LOGIN) { trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); + } return true; } } Modified: trunk/lib/WikiUser/File.php =================================================================== --- trunk/lib/WikiUser/File.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/File.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -24,8 +24,7 @@ include_once 'lib/pear/File_Passwd.php'; -class _FilePassUser - extends _PassUser +class _FilePassUser extends _PassUser /** * Check users defined in a .htaccess style file * username:crypt\n... @@ -33,22 +32,27 @@ * Preferences are handled in _PassUser */ { - public $_file, $_may_change; + public $_file; + public $_may_change; // This can only be called from _PassUser, because the parent class // sets the pref methods, before this class is initialized. - function __construct($UserName = '', $prefs = false, $file = '') + public function __construct($UserName = '', $prefs = false, $file = '') { if (!$this->_prefs and is_a($this, "_FilePassUser")) { - if ($prefs) $this->_prefs = $prefs; - if (!isset($this->_prefs->_method)) + if ($prefs) { + $this->_prefs = $prefs; + } + if (!isset($this->_prefs->_method)) { parent::__construct($UserName); + } } $this->_userid = $UserName; // read the .htaccess style file. $this->_may_change = defined('AUTH_USER_FILE_STORABLE') && AUTH_USER_FILE_STORABLE; - if (empty($file) and defined('AUTH_USER_FILE')) + if (empty($file) and defined('AUTH_USER_FILE')) { $file = AUTH_USER_FILE; + } if (empty($file)) { return; } @@ -57,24 +61,25 @@ } } - function mayChangePass() + public function mayChangePass() { return $this->_may_change; } - function userExists() + public function userExists() { if (!$this->isValidName()) { return $this->_tryNextUser(); } $this->_authmethod = 'File'; - if (isset($this->_file->users[$this->_userid])) + if (isset($this->_file->users[$this->_userid])) { return true; + } return $this->_tryNextUser(); } - function checkPass($submitted_password) + public function checkPass($submitted_password) { if (!$this->isValidName()) { trigger_error(_("Invalid username."), E_USER_WARNING); @@ -86,8 +91,9 @@ if ($this->_file->verifyPassword($this->_userid, $submitted_password)) { $this->_authmethod = 'File'; $this->_level = WIKIAUTH_USER; - if ($this->isAdmin()) // member of the Administrators group + if ($this->isAdmin()) { // member of the Administrators group $this->_level = WIKIAUTH_ADMIN; + } return $this->_level; } @@ -94,14 +100,17 @@ return $this->_tryNextPass($submitted_password); } - function storePass($submitted_password) + public function storePass($submitted_password) { if (!$this->isValidName()) { return false; } if ($this->_may_change) { - $this->_file = new File_Passwd($this->_file->filename, true, - $this->_file->filename . '.lock'); + $this->_file = new File_Passwd( + $this->_file->filename, + true, + $this->_file->filename . '.lock' + ); $result = $this->_file->modUser($this->_userid, $submitted_password); $this->_file->close(); $this->_file = new File_Passwd($this->_file->filename, false); Modified: trunk/lib/WikiUser/Forbidden.php =================================================================== --- trunk/lib/WikiUser/Forbidden.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/Forbidden.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -27,10 +27,9 @@ * That's why this class is empty, but must exist. */ -class _ForbiddenPassUser - extends _ForbiddenUser +class _ForbiddenPassUser extends _ForbiddenUser { - function dummy() + public function dummy() { return; } Modified: trunk/lib/WikiUser/FusionForge.php =================================================================== --- trunk/lib/WikiUser/FusionForge.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/FusionForge.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -26,19 +26,21 @@ * */ -class _FusionForgePassUser - extends _PassUser +class _FusionForgePassUser extends _PassUser { - public $_is_external = 0; - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { - if ($prefs) $this->_prefs = $prefs; - if (!isset($this->_prefs->_method)) + if ($prefs) { + $this->_prefs = $prefs; + } + if (!isset($this->_prefs->_method)) { parent::__construct($UserName); - if ($UserName) + } + if ($UserName) { $this->_userid = $UserName; + } $this->_authmethod = 'FusionForge'; // Is this double check really needed? @@ -50,7 +52,7 @@ } } - function userExists() + public function userExists() { global $group_id; @@ -96,7 +98,7 @@ return false; } - function checkPass($submitted_password) + public function checkPass($submitted_password) { return $this->userExists() ? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER) @@ -103,7 +105,7 @@ : WIKIAUTH_ANON; } - function mayChangePass() + public function mayChangePass() { return false; } Modified: trunk/lib/WikiUser/HttpAuth.php =================================================================== --- trunk/lib/WikiUser/HttpAuth.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/HttpAuth.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -35,16 +35,19 @@ * header('Authorization: Basic '.base64_encode("$userid:$passwd")."\r\n"; */ -class _HttpAuthPassUser - extends _PassUser +class _HttpAuthPassUser extends _PassUser { - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { - if ($prefs) $this->_prefs = $prefs; - if (!isset($this->_prefs->_method)) + if ($prefs) { + $this->_prefs = $prefs; + } + if (!isset($this->_prefs->_method)) { parent::__construct($UserName); - if ($UserName) + } + if ($UserName) { $this->_userid = $UserName; + } $this->_authmethod = 'HttpAuth'; // Is this double check really needed? @@ -58,7 +61,7 @@ // FIXME! This doesn't work yet! // Allow httpauth by other method: Admin for now only - function _fake_auth($userid, $passwd) + public function _fake_auth($userid, $passwd) { return false; @@ -74,39 +77,48 @@ */ } - function logout() + public function logout() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; + } // Maybe we should random the realm to really force a logout. // But the next login will fail. // TODO: On AUTH_TYPE=NTLM this will fail. Only Basic supported so far. header('WWW-Authenticate: Basic realm="' . WIKI_NAME . '"'); - if (strstr(php_sapi_name(), 'apache')) + if (strstr(php_sapi_name(), 'apache')) { header('HTTP/1.0 401 Unauthorized'); - else - header("Status: 401 Access Denied"); //IIS and CGI need that + } else { + header("Status: 401 Access Denied"); + } //IIS and CGI need that unset($GLOBALS['REMOTE_USER']); unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_PW']); } - function _http_username() + public function _http_username() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; - if (!empty($_SERVER['PHP_AUTH_USER'])) + } + if (!empty($_SERVER['PHP_AUTH_USER'])) { return $_SERVER['PHP_AUTH_USER']; - if (!empty($_SERVER['REMOTE_USER'])) + } + if (!empty($_SERVER['REMOTE_USER'])) { return $_SERVER['REMOTE_USER']; - if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) + } + if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) { return $GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']; - if (!empty($GLOBALS['REMOTE_USER'])) + } + if (!empty($GLOBALS['REMOTE_USER'])) { return $GLOBALS['REMOTE_USER']; + } // IIS + Basic if (!empty($_SERVER['HTTP_AUTHORIZATION'])) { - list($userid, $passwd) = explode(':', - base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); + list($userid, $passwd) = explode( + ':', + base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)) + ); return $userid; } return ''; @@ -113,10 +125,11 @@ } // force http auth authorization - function userExists() + public function userExists() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; + } $username = $this->_http_username(); if (strstr($username, "\\") and isset($_SERVER['AUTH_TYPE']) @@ -142,13 +155,14 @@ // we should check if he is a member of admin, // because HttpAuth has its own logic. $this->_level = WIKIAUTH_USER; - if ($this->isAdmin()) + if ($this->isAdmin()) { $this->_level = WIKIAUTH_ADMIN; + } return $this; } // ignore password, this is checked by the webservers http auth. - function checkPass($submitted_password) + public function checkPass($submitted_password) { return $this->userExists() ? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER) @@ -155,7 +169,7 @@ : WIKIAUTH_ANON; } - function mayChangePass() + public function mayChangePass() { return false; } Modified: trunk/lib/WikiUser/HttpAuthUpper.php =================================================================== --- trunk/lib/WikiUser/HttpAuthUpper.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/HttpAuthUpper.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -36,16 +36,19 @@ * header('Authorization: Basic '.base64_encode("$userid:$passwd")."\r\n"; */ -class _HttpAuthUpperPassUser - extends _PassUser +class _HttpAuthUpperPassUser extends _PassUser { - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { - if ($prefs) $this->_prefs = $prefs; - if (!isset($this->_prefs->_method)) + if ($prefs) { + $this->_prefs = $prefs; + } + if (!isset($this->_prefs->_method)) { parent::__construct($UserName); - if ($UserName) + } + if ($UserName) { $this->_userid = $UserName; + } $this->_authmethod = 'HttpAuthUpper'; // Is this double check really needed? @@ -59,7 +62,7 @@ // FIXME! This doesn't work yet! // Allow httpauth by other method: Admin for now only - function _fake_auth($userid, $passwd) + public function _fake_auth($userid, $passwd) { return false; @@ -75,39 +78,48 @@ */ } - function logout() + public function logout() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; + } // Maybe we should random the realm to really force a logout. // But the next login will fail. // TODO: On AUTH_TYPE=NTLM this will fail. Only Basic supported so far. header('WWW-Authenticate: Basic realm="' . WIKI_NAME . '"'); - if (strstr(php_sapi_name(), 'apache')) + if (strstr(php_sapi_name(), 'apache')) { header('HTTP/1.0 401 Unauthorized'); - else - header("Status: 401 Access Denied"); //IIS and CGI need that + } else { + header("Status: 401 Access Denied"); + } //IIS and CGI need that unset($GLOBALS['REMOTE_USER']); unset($_SERVER['PHP_AUTH_USER']); unset($_SERVER['PHP_AUTH_PW']); } - function _http_username() + public function _http_username() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; - if (!empty($_SERVER['PHP_AUTH_USER'])) + } + if (!empty($_SERVER['PHP_AUTH_USER'])) { return $_SERVER['PHP_AUTH_USER']; - if (!empty($_SERVER['REMOTE_USER'])) + } + if (!empty($_SERVER['REMOTE_USER'])) { return $_SERVER['REMOTE_USER']; - if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) + } + if (!empty($GLOBALS['HTTP_ENV_VARS']['REMOTE_USER'])) { return $GLOBALS['HTTP_ENV_VARS']['REMOTE_USER']; - if (!empty($GLOBALS['REMOTE_USER'])) + } + if (!empty($GLOBALS['REMOTE_USER'])) { return $GLOBALS['REMOTE_USER']; + } // IIS + Basic if (!empty($_SERVER['HTTP_AUTHORIZATION'])) { - list($userid, $passwd) = explode(':', - base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6))); + list($userid, $passwd) = explode( + ':', + base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)) + ); return $userid; } return ''; @@ -114,7 +126,7 @@ } // special: force upcase username - function UserName() + public function UserName() { if (!empty($this->_userid)) { $this->_userid = strtoupper($this->_userid); @@ -124,10 +136,11 @@ } // force http auth authorization - function userExists() + public function userExists() { - if (!isset($_SERVER)) + if (!isset($_SERVER)) { $_SERVER =& $GLOBALS['HTTP_SERVER_VARS']; + } $username = strtoupper($this->_http_username()); if (strstr($username, "\\") and isset($_SERVER['AUTH_TYPE']) @@ -153,13 +166,14 @@ // we should check if he is a member of admin, // because HttpAuth has its own logic. $this->_level = WIKIAUTH_USER; - if ($this->isAdmin()) + if ($this->isAdmin()) { $this->_level = WIKIAUTH_ADMIN; + } return $this; } // ignore password, this is checked by the webservers http auth. - function checkPass($submitted_password) + public function checkPass($submitted_password) { return $this->userExists() ? ($this->isAdmin() ? WIKIAUTH_ADMIN : WIKIAUTH_USER) @@ -166,7 +180,7 @@ : WIKIAUTH_ANON; } - function mayChangePass() + public function mayChangePass() { return false; } Modified: trunk/lib/WikiUser/IMAP.php =================================================================== --- trunk/lib/WikiUser/IMAP.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/IMAP.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -22,8 +22,7 @@ * */ -class _IMAPPassUser - extends _PassUser +class _IMAPPassUser extends _PassUser /** * Define the var IMAP_AUTH_HOST in config/config.ini (with port probably) * @@ -30,39 +29,53 @@ * Preferences are handled in _PassUser */ { - function checkPass($submitted_password) + public function checkPass($submitted_password) { if (!$this->isValidName()) { - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING); + } trigger_error(_("Invalid username."), E_USER_WARNING); return $this->_tryNextPass($submitted_password); } if (!$this->_checkPassLength($submitted_password)) { - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING); + } return WIKIAUTH_FORBIDDEN; } $userid = $this->_userid; - $mbox = @imap_open("{" . IMAP_AUTH_HOST . "}", - $userid, $submitted_password, OP_HALFOPEN); + $mbox = @imap_open( + "{" . IMAP_AUTH_HOST . "}", + $userid, + $submitted_password, + OP_HALFOPEN + ); if ($mbox) { imap_close($mbox); $this->_authmethod = 'IMAP'; - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => ok", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => ok", E_USER_WARNING); + } $this->_level = WIKIAUTH_USER; return $this->_level; } else { if ($submitted_password != "") { // if LENGTH 0 is allowed - trigger_error(_("Unable to connect to IMAP server ") . IMAP_AUTH_HOST, - E_USER_WARNING); + trigger_error( + _("Unable to connect to IMAP server ") . IMAP_AUTH_HOST, + E_USER_WARNING + ); } } - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => wrong", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => wrong", E_USER_WARNING); + } return $this->_tryNextPass($submitted_password); } //CHECKME: this will not be okay for the auth policy strict - function userExists() + public function userExists() { return true; @@ -76,9 +89,11 @@ */ } - function mayChangePass() + public function mayChangePass() { - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING); + } return false; } } Modified: trunk/lib/WikiUser/LDAP.php =================================================================== --- trunk/lib/WikiUser/LDAP.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/LDAP.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -22,8 +22,7 @@ * */ -class _LDAPPassUser - extends _PassUser +class _LDAPPassUser extends _PassUser /** * Define the vars LDAP_AUTH_HOST and LDAP_BASE_DN in config/config.ini * @@ -34,7 +33,7 @@ * ->_init() * connect and bind to the LDAP host */ - function _init() + public function _init() { if ($this->_ldap = ldap_connect(LDAP_AUTH_HOST)) { // must be a valid LDAP server! global $LDAP_SET_OPTION; @@ -45,19 +44,27 @@ ldap_set_option($this->_ldap, $key, $value); } } - if (LDAP_AUTH_USER) - if (LDAP_AUTH_PASSWORD) + if (LDAP_AUTH_USER) { + if (LDAP_AUTH_PASSWORD) { // Windows Active Directory Server is strict $r = ldap_bind($this->_ldap, LDAP_AUTH_USER, LDAP_AUTH_PASSWORD); - else + } else { $r = ldap_bind($this->_ldap, LDAP_AUTH_USER); - else - $r = true; // anonymous bind allowed + } + } else { + $r = true; + } // anonymous bind allowed if (!$r) { $this->_free(); - trigger_error(sprintf(_("Unable to bind LDAP server %s using %s %s"), - LDAP_AUTH_HOST, LDAP_AUTH_USER, LDAP_AUTH_PASSWORD), - E_USER_WARNING); + trigger_error( + sprintf( + _("Unable to bind LDAP server %s using %s %s"), + LDAP_AUTH_HOST, + LDAP_AUTH_USER, + LDAP_AUTH_PASSWORD + ), + E_USER_WARNING + ); return false; } return $this->_ldap; @@ -69,10 +76,14 @@ /** * free and close the bound ressources */ - function _free() + public function _free() { - if (isset($this->_sr) and is_resource($this->_sr)) ldap_free_result($this->_sr); - if (isset($this->_ldap) and is_resource($this->_ldap)) ldap_close($this->_ldap); + if (isset($this->_sr) and is_resource($this->_sr)) { + ldap_free_result($this->_sr); + } + if (isset($this->_ldap) and is_resource($this->_ldap)) { + ldap_close($this->_ldap); + } unset($this->_sr); unset($this->_ldap); } @@ -88,7 +99,8 @@ */ private function _stringEscape($name) { - return strtr(utf8_encode($name), + return strtr( + utf8_encode($name), array("*" => "\\2a", "?" => "\\3f", "(" => "\\28", @@ -95,7 +107,8 @@ ")" => "\\29", "\\" => "\\5c", '"' => '\"', - "\0" => "\\00")); + "\0" => "\\00") + ); } /** @@ -102,9 +115,11 @@ * LDAP names may contain every utf-8 character. However we restrict them a bit for convenience. * @see _stringEscape() */ - function isValidName($userid = false) + public function isValidName($userid = false) { - if (!$userid) $userid = $this->_userid; + if (!$userid) { + $userid = $this->_userid; + } // We are more restrictive here, but must allow explitly utf-8 return preg_match("/^[\-\w_\.@ ]+$/u", $userid) and strlen($userid) < 64; } @@ -137,9 +152,8 @@ * @see http://www.faqs.org/rfcs/rfc4514.html LDAP String Representation of Distinguished Names * @see http://www.faqs.org/rfcs/rfc3454.html stringprep */ - function checkPass($submitted_password) + public function checkPass($submitted_password) { - $this->_authmethod = 'LDAP'; $this->_userid = trim($this->_userid); $userid = $this->_userid; @@ -175,8 +189,9 @@ } $info = ldap_get_entries($ldap, $this->_sr); if (empty($info["count"])) { - if (DEBUG) + if (DEBUG) { trigger_error(_("User not found in LDAP"), E_USER_WARNING); + } $this->_free(); return $this->_tryNextPass($submitted_password); } @@ -209,10 +224,13 @@ } } } - if (DEBUG) - trigger_error(_("Wrong password: ") . + if (DEBUG) { + trigger_error( + _("Wrong password: ") . str_repeat("*", strlen($submitted_password)), - E_USER_WARNING); + E_USER_WARNING + ); + } $this->_free(); } else { $this->_free(); @@ -223,13 +241,15 @@ } - function userExists() + public function userExists() { $this->_userid = trim($this->_userid); $userid = $this->_userid; if (strstr($userid, '*')) { - trigger_error(fmt("Invalid username “%s” for LDAP Auth", $userid), - E_USER_WARNING); + trigger_error( + fmt("Invalid username “%s” for LDAP Auth", $userid), + E_USER_WARNING + ); return false; } if ($ldap = $this->_init()) { @@ -251,9 +271,8 @@ return $this->_tryNextUser(); } - function mayChangePass() + public function mayChangePass() { return false; } - } Modified: trunk/lib/WikiUser/LdapUpper.php =================================================================== --- trunk/lib/WikiUser/LdapUpper.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/LdapUpper.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -29,21 +29,21 @@ * Define the vars LDAP_AUTH_HOST, LDAP_BASE_DN, LDAP_SEARCH_FILTER in config/config.ini * Preferences are handled in _PassUser */ -class _LdapUpperPassUser - extends _LDAPPassUser +class _LdapUpperPassUser extends _LDAPPassUser { - function UserName() + public function UserName() { if (!empty($this->_userid)) { $this->_userid = trim(strtoupper($this->_userid)); - if (!empty($this->_HomePagehandle) and is_object($this->_HomePagehandle)) + if (!empty($this->_HomePagehandle) and is_object($this->_HomePagehandle)) { $this->_HomePagehandle->_pagename = $this->_userid; + } return strtoupper($this->_userid); } return ''; } - function userExists() + public function userExists() { // lowercase check and uppercase visibility $this->_userid = trim(strtoupper($this->_userid)); Modified: trunk/lib/WikiUser/OpenID.php =================================================================== --- trunk/lib/WikiUser/OpenID.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/OpenID.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -31,8 +31,7 @@ // requires the openssl extension require_once 'lib/HttpClient.php'; -class _OpenIDPassUser - extends _PassUser +class _OpenIDPassUser extends _PassUser /** * Preferences are handled in _PassUser */ @@ -50,7 +49,7 @@ * @param mixed $extensions extension object or array of extensions objects * @return bool */ - function verify($params, &$identity = "", $extensions = null) + public function verify($params, &$identity = "", $extensions = null) { $version = 1.1; $this->_setError(""); @@ -119,8 +118,14 @@ * object to perform HTTP or HTML form redirection * @return bool */ - function _checkId($immediate, $id, $returnTo = null, $root = null, - $extensions = null, $response = null) + public function _checkId( + $immediate, + $id, + $returnTo = null, + $root = null, + $extensions = null, + $response = null + ) { $this->_setError(''); @@ -143,7 +148,8 @@ $handle, $macFunc, $secret, - $expires) + $expires + ) ) { /* Use dumb mode */ unset($handle); @@ -179,7 +185,9 @@ // See lib/WikiUser/FaceBook.php how to handle http requests $web = new HttpClient("$server", 80); - if (DEBUG & _DEBUG_LOGIN) $web->setDebug(true); + if (DEBUG & _DEBUG_LOGIN) { + $web->setDebug(true); + } if (empty($root)) { //$root = Zend_OpenId::selfUrl(); @@ -203,25 +211,30 @@ return true; } - function _setError($message) + public function _setError($message) { $this->_error = $message; } - function checkPass($password) + public function checkPass($password) { if (!loadPhpExtension('openssl')) { trigger_error( sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'OpenID'), - E_USER_WARNING); + E_USER_WARNING + ); return $this->_tryNextUser(); } $retval = $this->_checkId(false, $id, $returnTo, $root, $extensions, $response); $this->_authmethod = 'OpenID'; - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval", - E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error( + get_class($this) . "::checkPass => $retval", + E_USER_WARNING + ); + } if ($retval) { $this->_level = WIKIAUTH_USER; } else { @@ -231,27 +244,31 @@ } /* do nothing. the login/redirect is done in checkPass */ - function userExists() + public function userExists() { if (!$this->isValidName($this->_userid)) { return $this->_tryNextUser(); } if (!loadPhpExtension('openssl')) { - trigger_error - (sprintf(_("The PECL %s extension cannot be loaded."), "openssl") + trigger_error( + sprintf(_("The PECL %s extension cannot be loaded."), "openssl") . sprintf(_(" %s AUTH ignored."), 'OpenID'), - E_USER_WARNING); + E_USER_WARNING + ); return $this->_tryNextUser(); } - if (DEBUG & _DEBUG_LOGIN) + if (DEBUG & _DEBUG_LOGIN) { trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); + } return true; } // no quotes and shorter than 128 - function isValidName($userid = false) + public function isValidName($userid = false) { - if (!$this->_userid) return false; + if (!$this->_userid) { + return false; + } return !preg_match('/[\"\']/', $this->_userid) and strlen($this->_userid) < 128; } } Modified: trunk/lib/WikiUser/POP3.php =================================================================== --- trunk/lib/WikiUser/POP3.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/POP3.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -24,30 +24,33 @@ require_once 'lib/WikiUser/IMAP.php'; -class _POP3PassUser - extends _IMAPPassUser +class _POP3PassUser extends _IMAPPassUser { /** * Define the var POP3_AUTH_HOST in config/config.ini * Preferences are handled in _PassUser */ - function checkPass($submitted_password) + public function checkPass($submitted_password) { if (!$this->isValidName()) { trigger_error(_("Invalid username."), E_USER_WARNING); - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => failed isValidName", E_USER_WARNING); + } return $this->_tryNextPass($submitted_password); } if (!$this->_checkPassLength($submitted_password)) { - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => failed checkPassLength", E_USER_WARNING); + } return WIKIAUTH_FORBIDDEN; } $userid = $this->_userid; $pass = $submitted_password; $host = defined('POP3_AUTH_HOST') ? POP3_AUTH_HOST : 'localhost:110'; - if (defined('POP3_AUTH_PORT')) + if (defined('POP3_AUTH_PORT')) { $port = POP3_AUTH_PORT; - elseif (strstr($host, ':')) { + } elseif (strstr($host, ':')) { list(, $port) = explode(':', $host); } else { $port = 110; @@ -78,11 +81,15 @@ fgets($fp, 1024); fclose($fp); } else { - trigger_error(sprintf(_("Couldn't connect to %s"), "POP3_AUTH_HOST " . $host . ':' . $port), - E_USER_WARNING); + trigger_error( + sprintf(_("Couldn't connect to %s"), "POP3_AUTH_HOST " . $host . ':' . $port), + E_USER_WARNING + ); } $this->_authmethod = 'POP3'; - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::checkPass => $retval", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::checkPass => $retval", E_USER_WARNING); + } if ($retval) { $this->_level = WIKIAUTH_USER; } else { @@ -91,9 +98,11 @@ return $this->_level; } - function __userExists() + public function __userExists() { - if (DEBUG & _DEBUG_LOGIN) trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); + if (DEBUG & _DEBUG_LOGIN) { + trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); + } return true; } } Modified: trunk/lib/WikiUser/PdoDb.php =================================================================== --- trunk/lib/WikiUser/PdoDb.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/PdoDb.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -24,8 +24,7 @@ include_once 'lib/WikiUser/Db.php'; -class _PdoDbPassUser - extends _DbPassUser +class _PdoDbPassUser extends _DbPassUser /** * PDO DB methods (PHP5) * prepare, bind, execute. @@ -37,7 +36,7 @@ { public $_authmethod = 'PDODb'; - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { /** * @var WikiRequest $request @@ -62,7 +61,7 @@ return $this; } - function userExists() + public function userExists() { /** * @var WikiRequest $request @@ -99,17 +98,22 @@ trigger_error("SQL Error: " . $e->getMessage(), E_USER_WARNING); return false; } - if ($this->_authselect->fetchColumn()) + if ($this->_authselect->fetchColumn()) { return true; + } } else { - if (!$dbi->getAuthParam('auth_user_exists')) - trigger_error(fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'), - E_USER_WARNING); + if (!$dbi->getAuthParam('auth_user_exists')) { + trigger_error( + fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'), + E_USER_WARNING + ); + } $this->_authcheck = $dbh->prepare($dbi->getAuthParam('auth_check')); $this->_authcheck->bindParam("userid", $this->_userid, PDO::PARAM_STR, 48); $this->_authcheck->execute(); - if ($this->_authcheck->fetchColumn()) + if ($this->_authcheck->fetchColumn()) { return true; + } } // User does not exist yet. // Maybe the user is allowed to create himself. Generally not wanted in @@ -136,13 +140,14 @@ trigger_error("SQL Error: " . $e->getMessage(), E_USER_WARNING); return false; } - if ($rs) + if ($rs) { return true; + } } return $this->_tryNextUser(); } - function checkPass($submitted_password) + public function checkPass($submitted_password) { //global $DBAuthParams; $this->getAuthDbh(); @@ -155,12 +160,19 @@ if (!$this->_checkPassLength($submitted_password)) { return WIKIAUTH_FORBIDDEN; } - if (!isset($this->_authselect)) + if (!isset($this->_authselect)) { $this->userExists(); - if (!isset($this->_authselect)) - trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”", - 'DBAUTH_AUTH_CHECK', 'SQL'), - E_USER_WARNING); + } + if (!isset($this->_authselect)) { + trigger_error( + fmt( + "Either %s is missing or DATABASE_TYPE != “%s”", + 'DBAUTH_AUTH_CHECK', + 'SQL' + ), + E_USER_WARNING + ); + } //NOTE: for auth_crypt_method='crypt' defined('ENCRYPTED_PASSWD',true) must be set if ($this->_auth_crypt_method == 'crypt') { @@ -199,7 +211,7 @@ } } - function mayChangePass() + public function mayChangePass() { /** * @var WikiRequest $request @@ -209,7 +221,7 @@ return $request->_dbi->getAuthParam('auth_update'); } - function storePass($submitted_password) + public function storePass($submitted_password) { /** * @var WikiRequest $request @@ -231,9 +243,14 @@ } } if (empty($this->_authupdate)) { - trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”", - 'DBAUTH_AUTH_UPDATE', 'SQL'), - E_USER_WARNING); + trigger_error( + fmt( + "Either %s is missing or DATABASE_TYPE != “%s”", + 'DBAUTH_AUTH_UPDATE', + 'SQL' + ), + E_USER_WARNING + ); return false; } Modified: trunk/lib/WikiUser/PearDb.php =================================================================== --- trunk/lib/WikiUser/PearDb.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/PearDb.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -24,8 +24,7 @@ include_once 'lib/WikiUser/Db.php'; -class _PearDbPassUser - extends _DbPassUser +class _PearDbPassUser extends _DbPassUser /** * Pear DB methods * Now optimized not to use prepare, ...query(sprintf($sql,quote())) instead. @@ -36,7 +35,7 @@ { public $_authmethod = 'PearDb'; - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { /** * @var WikiRequest $request @@ -61,7 +60,7 @@ return $this; } - function userExists() + public function userExists() { /** * @var WikiRequest $request @@ -80,8 +79,10 @@ $dbi =& $request->_dbi; // Prepare the configured auth statements if ($dbi->getAuthParam('auth_check') and empty($this->_authselect)) { - $this->_authselect = $this->prepare($dbi->getAuthParam('auth_check'), - array("password", "userid")); + $this->_authselect = $this->prepare( + $dbi->getAuthParam('auth_check'), + array("password", "userid") + ); } //NOTE: for auth_crypt_method='crypt' no special auth_user_exists is needed if (!$dbi->getAuthParam('auth_user_exists') @@ -89,16 +90,21 @@ and $this->_authselect ) { $rs = $dbh->query(sprintf($this->_authselect, $dbh->quote($this->_userid))); - if ($rs->numRows()) + if ($rs->numRows()) { return true; + } } else { - if (!$dbi->getAuthParam('auth_user_exists')) - trigger_error(fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'), - E_USER_WARNING); + if (!$dbi->getAuthParam('auth_user_exists')) { + trigger_error( + fmt("%s is missing", 'DBAUTH_AUTH_USER_EXISTS'), + E_USER_WARNING + ); + } $this->_authcheck = $this->prepare($dbi->getAuthParam('auth_user_exists'), "userid"); $rs = $dbh->query(sprintf($this->_authcheck, $dbh->quote($this->_userid))); - if ($rs->numRows()) + if ($rs->numRows()) { return true; + } } // User does not exist yet. // Maybe the user is allowed to create himself. Generally not wanted in @@ -105,8 +111,10 @@ // external databases, but maybe wanted for the wiki database, for performance // reasons if (empty($this->_authcreate) and $dbi->getAuthParam('auth_create')) { - $this->_authcreate = $this->prepare($dbi->getAuthParam('auth_create'), - array("password", "userid")); + $this->_authcreate = $this->prepare( + $dbi->getAuthParam('auth_create'), + array("password", "userid") + ); } if (!empty($this->_authcreate) and isset($GLOBALS['HTTP_POST_VARS']['auth']) and @@ -113,15 +121,17 @@ isset($GLOBALS['HTTP_POST_VARS']['auth']['passwd']) ) { $passwd = $GLOBALS['HTTP_POST_VARS']['auth']['passwd']; - $dbh->simpleQuery(sprintf($this->_authcreate, + $dbh->simpleQuery(sprintf( + $this->_authcreate, $dbh->quote($passwd), - $dbh->quote($this->_userid))); + $dbh->quote($this->_userid) + )); return true; } return $this->_tryNextUser(); } - function checkPass($submitted_password) + public function checkPass($submitted_password) { //global $DBAuthParams; $this->getAuthDbh(); @@ -134,12 +144,19 @@ if (!$this->_checkPassLength($submitted_password)) { return WIKIAUTH_FORBIDDEN; } - if (!isset($this->_authselect)) + if (!isset($this->_authselect)) { $this->userExists(); - if (!isset($this->_authselect)) - trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”", - 'DBAUTH_AUTH_CHECK', 'SQL'), - E_USER_WARNING); + } + if (!isset($this->_authselect)) { + trigger_error( + fmt( + "Either %s is missing or DATABASE_TYPE != “%s”", + 'DBAUTH_AUTH_CHECK', + 'SQL' + ), + E_USER_WARNING + ); + } //NOTE: for auth_crypt_method='crypt' defined('ENCRYPTED_PASSWD',true) must be set $dbh = &$this->_auth_dbi; @@ -148,9 +165,11 @@ $result = $this->_checkPass($submitted_password, $stored_password); } else { // be position independent - $okay = $dbh->getOne(sprintf($this->_authselect, + $okay = $dbh->getOne(sprintf( + $this->_authselect, $dbh->quote($submitted_password), - $dbh->quote($this->_userid))); + $dbh->quote($this->_userid) + )); $result = !empty($okay); } @@ -165,7 +184,7 @@ } } - function mayChangePass() + public function mayChangePass() { /** * @var WikiRequest $request @@ -175,7 +194,7 @@ return $request->_dbi->getAuthParam('auth_update'); } - function storePass($submitted_password) + public function storePass($submitted_password) { /** * @var WikiRequest $request @@ -189,13 +208,20 @@ $dbh = &$this->_auth_dbi; $dbi =& $request->_dbi; if ($dbi->getAuthParam('auth_update') and empty($this->_authupdate)) { - $this->_authupdate = $this->prepare($dbi->getAuthParam('auth_update'), - array("password", "userid")); + $this->_authupdate = $this->prepare( + $dbi->getAuthParam('auth_update'), + array("password", "userid") + ); } if (empty($this->_authupdate)) { - trigger_error(fmt("Either %s is missing or DATABASE_TYPE != “%s”", - 'DBAUTH_AUTH_UPDATE', 'SQL'), - E_USER_WARNING); + trigger_error( + fmt( + "Either %s is missing or DATABASE_TYPE != “%s”", + 'DBAUTH_AUTH_UPDATE', + 'SQL' + ), + E_USER_WARNING + ); return false; } @@ -202,8 +228,11 @@ if ($this->_auth_crypt_method == 'crypt') { $submitted_password = crypt($submitted_password); } - $dbh->simpleQuery(sprintf($this->_authupdate, - $dbh->quote($submitted_password), $dbh->quote($this->_userid))); + $dbh->simpleQuery(sprintf( + $this->_authupdate, + $dbh->quote($submitted_password), + $dbh->quote($this->_userid) + )); return true; } } Modified: trunk/lib/WikiUser/PersonalPage.php =================================================================== --- trunk/lib/WikiUser/PersonalPage.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/PersonalPage.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -26,8 +26,7 @@ * This class is only to simplify the auth method dispatcher. * It inherits almost all all methods from _PassUser. */ -class _PersonalPagePassUser - extends _PassUser +class _PersonalPagePassUser extends _PassUser { public $_authmethod = 'PersonalPage'; @@ -34,14 +33,16 @@ /* Very loose checking, since we properly quote the PageName. Just trim spaces, ... See lib/stdlib.php */ - function isValidName($userid = false) + public function isValidName($userid = false) { - if (!$userid) $userid = $this->_userid; + if (!$userid) { + $userid = $this->_userid; + } $WikiPageName = new WikiPageName($userid); return $WikiPageName->isValid() and ($userid === $WikiPageName->name); } - function userExists() + public function userExists() { return $this->_HomePagehandle and $this->_HomePagehandle->exists(); } @@ -50,7 +51,7 @@ * BUT if the user already has a homepage with an empty password * stored, allow login but warn him to change it. */ - function checkPass($submitted_password) + public function checkPass($submitted_password) { if ($this->userExists()) { $stored_password = $this->_prefs->get('passwd'); @@ -61,22 +62,26 @@ _("You stored an empty password in your “%s” page.") . "\n" . _("Your access permissions are only for a BogoUser.") . "\n" . _("Please set a password in UserPreferences."), - $this->_userid), E_USER_WARNING); + $this->_userid + ), E_USER_WARNING); $this->_level = WIKIAUTH_BOGO; } else { - if (!empty($submitted_password)) + if (!empty($submitted_password)) { trigger_error(sprintf( _("PersonalPage login method:") . "\n" . _("You stored an empty password in your “%s” page.") . "\n" . _("Given password ignored.") . "\n" . _("Please set a password in UserPreferences."), - $this->_userid), E_USER_WARNING); + $this->_userid + ), E_USER_WARNING); + } $this->_level = WIKIAUTH_USER; } return $this->_level; } - if ($this->_checkPass($submitted_password, $stored_password)) + if ($this->_checkPass($submitted_password, $stored_password)) { return ($this->_level = WIKIAUTH_USER); + } return _PassUser::checkPass($submitted_password); } else { return WIKIAUTH_ANON; Modified: trunk/lib/WikiUser/Session.php =================================================================== --- trunk/lib/WikiUser/Session.php 2022-03-24 13:43:02 UTC (rev 11011) +++ trunk/lib/WikiUser/Session.php 2022-03-24 13:44:55 UTC (rev 11012) @@ -30,16 +30,18 @@ * define('AUTH_SESS_LEVEL',2); */ -class _SessionPassUser - extends _PassUser +class _SessionPassUser extends _PassUser { - function __construct($UserName = '', $prefs = false) + public function __construct($UserName = '', $prefs = false) { - if ($prefs) $this->_prefs = $prefs; + if ($prefs) { + $this->_prefs = $prefs; + } if (!defined("AUTH_SESS_USER") or !defined("AUTH_SESS_LEVEL")) { trigger_error( "AUTH_SESS_USER or AUTH_SESS_LEVEL is not defined for the SessionPassUser method", - E_USER_ERROR); + E_USER_ERROR + ); exit; } $sess =& $GLOBALS['HTTP_SESSION_VARS']; @@ -59,23 +61,24 @@ } else { $this->_userid = $sess[AUTH_SESS_USER]; } - if (!isset($this->_prefs->_method)) + if (!isset($this->_prefs->_method)) { parent::__construct($this->_userid); + } $this->_level = AUTH_SESS_LEVEL; $this->_authmethod = 'Session'; } - function userExists() + public function userExists() { return !empty($this->_userid); } - function checkPass($submitted_password) + public function checkPass($submitted_password) { return $this->userExists() and $this->_level > -1; } - function mayChangePass() + public function mayChangePass() { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |