From: <var...@us...> - 2023-07-14 10:03:51
|
Revision: 11050 http://sourceforge.net/p/phpwiki/code/11050 Author: vargenau Date: 2023-07-14 10:03:49 +0000 (Fri, 14 Jul 2023) Log Message: ----------- lib/WikiUser: PHP 7: add types for function arguments and return 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/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 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/BogoLogin.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -29,7 +29,7 @@ { public $_authmethod = 'BogoLogin'; - public function userExists() + public function userExists(): bool { if (isWikiWord($this->_userid)) { $this->_level = WIKIAUTH_BOGO; Modified: trunk/lib/WikiUser/Db.php =================================================================== --- trunk/lib/WikiUser/Db.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/Db.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -88,7 +88,7 @@ /* Since we properly quote the username, we allow most chars here. Just " ; and ' is forbidden, max length: 48 as defined in the schema. */ - public function isValidName($userid = false) + public function isValidName($userid = false): bool { if (!$userid) { $userid = $this->_userid; @@ -102,7 +102,7 @@ return true; } - public function mayChangePass() + public function mayChangePass(): bool { return !isset($this->_authupdate); } Modified: trunk/lib/WikiUser/Facebook.php =================================================================== --- trunk/lib/WikiUser/Facebook.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/Facebook.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -96,7 +96,7 @@ } // TODO: msearch facebook for the username - public function userExists() + public function userExists(): bool { if (!loadPhpExtension('openssl')) { trigger_error( Modified: trunk/lib/WikiUser/File.php =================================================================== --- trunk/lib/WikiUser/File.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/File.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -61,12 +61,12 @@ } } - public function mayChangePass() + public function mayChangePass(): bool { return $this->_may_change; } - public function userExists() + public function userExists(): bool { if (!$this->isValidName()) { return $this->_tryNextUser(); Modified: trunk/lib/WikiUser/FusionForge.php =================================================================== --- trunk/lib/WikiUser/FusionForge.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/FusionForge.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -105,7 +105,7 @@ : WIKIAUTH_ANON; } - public function mayChangePass() + public function mayChangePass(): bool { return false; } Modified: trunk/lib/WikiUser/HttpAuth.php =================================================================== --- trunk/lib/WikiUser/HttpAuth.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/HttpAuth.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -61,7 +61,7 @@ // FIXME! This doesn't work yet! // Allow httpauth by other method: Admin for now only - public function _fake_auth($userid, $passwd) + public function _fake_auth($userid, $passwd): bool { return false; @@ -169,7 +169,7 @@ : WIKIAUTH_ANON; } - public function mayChangePass() + public function mayChangePass(): bool { return false; } Modified: trunk/lib/WikiUser/HttpAuthUpper.php =================================================================== --- trunk/lib/WikiUser/HttpAuthUpper.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/HttpAuthUpper.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -62,7 +62,7 @@ // FIXME! This doesn't work yet! // Allow httpauth by other method: Admin for now only - public function _fake_auth($userid, $passwd) + public function _fake_auth($userid, $passwd): bool { return false; @@ -180,7 +180,7 @@ : WIKIAUTH_ANON; } - public function mayChangePass() + public function mayChangePass(): bool { return false; } Modified: trunk/lib/WikiUser/IMAP.php =================================================================== --- trunk/lib/WikiUser/IMAP.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/IMAP.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -75,7 +75,7 @@ } //CHECKME: this will not be okay for the auth policy strict - public function userExists() + public function userExists(): bool { return true; @@ -89,7 +89,7 @@ */ } - public function mayChangePass() + public function mayChangePass(): bool { if (DEBUG & _DEBUG_LOGIN) { trigger_error(get_class($this) . "::mayChangePass => false", E_USER_WARNING); Modified: trunk/lib/WikiUser/LDAP.php =================================================================== --- trunk/lib/WikiUser/LDAP.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/LDAP.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -97,7 +97,7 @@ * * @see http://www.faqs.org/rfcs/rfc4514.html LDAP String Representation of Distinguished Names */ - private function _stringEscape($name) + private function _stringEscape($name): string { return strtr( utf8_encode($name), @@ -115,7 +115,7 @@ * LDAP names may contain every utf-8 character. However we restrict them a bit for convenience. * @see _stringEscape() */ - public function isValidName($userid = false) + public function isValidName($userid = false): bool { if (!$userid) { $userid = $this->_userid; @@ -132,7 +132,7 @@ * @return string The 3rd argument to ldap_search() * @see http://www.faqs.org/rfcs/rfc4514.html LDAP String Representation of Distinguished Names */ - private function _searchparam($userid) + private function _searchparam(string $userid): string { $euserid = $this->_stringEscape($userid); // Need to set the right root search information. See config/config.ini @@ -241,7 +241,7 @@ } - public function userExists() + public function userExists(): bool { $this->_userid = trim($this->_userid); $userid = $this->_userid; @@ -271,7 +271,7 @@ return $this->_tryNextUser(); } - public function mayChangePass() + public function mayChangePass(): bool { return false; } Modified: trunk/lib/WikiUser/LdapUpper.php =================================================================== --- trunk/lib/WikiUser/LdapUpper.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/LdapUpper.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -43,7 +43,7 @@ return ''; } - public function userExists() + public function userExists(): bool { // lowercase check and uppercase visibility $this->_userid = trim(strtoupper($this->_userid)); Modified: trunk/lib/WikiUser/OpenID.php =================================================================== --- trunk/lib/WikiUser/OpenID.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/OpenID.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -49,7 +49,7 @@ * @param mixed $extensions extension object or array of extensions objects * @return bool */ - public function verify($params, &$identity = "", $extensions = null) + public function verify(array $params, string &$identity = "", $extensions = null): bool { $version = 1.1; $this->_setError(""); @@ -119,13 +119,13 @@ * @return bool */ public function _checkId( - $immediate, - $id, - $returnTo = null, - $root = null, - $extensions = null, - $response = null - ) + bool $immediate, + string $id, + string $returnTo = null, + string $root = null, + $extensions = null, + $response = null + ): bool { $this->_setError(''); @@ -244,7 +244,7 @@ } /* do nothing. the login/redirect is done in checkPass */ - public function userExists() + public function userExists(): bool { if (!$this->isValidName($this->_userid)) { return $this->_tryNextUser(); @@ -264,7 +264,7 @@ } // no quotes and shorter than 128 - public function isValidName($userid = false) + public function isValidName($userid = false): bool { if (!$this->_userid) { return false; Modified: trunk/lib/WikiUser/POP3.php =================================================================== --- trunk/lib/WikiUser/POP3.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/POP3.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -98,7 +98,7 @@ return $this->_level; } - public function __userExists() + public function __userExists(): bool { if (DEBUG & _DEBUG_LOGIN) { trigger_error(get_class($this) . "::userExists => true (dummy)", E_USER_WARNING); Modified: trunk/lib/WikiUser/PdoDb.php =================================================================== --- trunk/lib/WikiUser/PdoDb.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/PdoDb.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -61,7 +61,7 @@ return $this; } - public function userExists() + public function userExists(): bool { /** * @var WikiRequest $request @@ -211,7 +211,7 @@ } } - public function mayChangePass() + public function mayChangePass(): bool { /** * @var WikiRequest $request @@ -221,7 +221,7 @@ return $request->_dbi->getAuthParam('auth_update'); } - public function storePass($submitted_password) + public function storePass($submitted_password): bool { /** * @var WikiRequest $request Modified: trunk/lib/WikiUser/PearDb.php =================================================================== --- trunk/lib/WikiUser/PearDb.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/PearDb.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -60,7 +60,7 @@ return $this; } - public function userExists() + public function userExists(): bool { /** * @var WikiRequest $request @@ -184,7 +184,7 @@ } } - public function mayChangePass() + public function mayChangePass(): bool { /** * @var WikiRequest $request @@ -194,7 +194,7 @@ return $request->_dbi->getAuthParam('auth_update'); } - public function storePass($submitted_password) + public function storePass($submitted_password): bool { /** * @var WikiRequest $request Modified: trunk/lib/WikiUser/PersonalPage.php =================================================================== --- trunk/lib/WikiUser/PersonalPage.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/PersonalPage.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -33,7 +33,7 @@ /* Very loose checking, since we properly quote the PageName. Just trim spaces, ... See lib/stdlib.php */ - public function isValidName($userid = false) + public function isValidName($userid = false): bool { if (!$userid) { $userid = $this->_userid; @@ -42,7 +42,7 @@ return $WikiPageName->isValid() and ($userid === $WikiPageName->name); } - public function userExists() + public function userExists(): bool { return $this->_HomePagehandle and $this->_HomePagehandle->exists(); } Modified: trunk/lib/WikiUser/Session.php =================================================================== --- trunk/lib/WikiUser/Session.php 2023-07-14 09:44:40 UTC (rev 11049) +++ trunk/lib/WikiUser/Session.php 2023-07-14 10:03:49 UTC (rev 11050) @@ -68,17 +68,17 @@ $this->_authmethod = 'Session'; } - public function userExists() + public function userExists(): bool { return !empty($this->_userid); } - public function checkPass($submitted_password) + public function checkPass($submitted_password): bool { return $this->userExists() and $this->_level > -1; } - public function mayChangePass() + public function mayChangePass(): bool { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |