diff options
| author | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:55:19 +0100 |
|---|---|---|
| committer | Lester Caine <lester@lsces.co.uk> | 2026-05-14 09:55:19 +0100 |
| commit | 513bc9e03522f0bfc0e307a8e40a517e746de2bc (patch) | |
| tree | bed44d24c1ef1ee8d3801b74fe0fac68e1f779f4 /auth | |
| parent | 70ebf6a972f511a904a7775ec792dc2523bf3e13 (diff) | |
| download | users-513bc9e03522f0bfc0e307a8e40a517e746de2bc.tar.gz users-513bc9e03522f0bfc0e307a8e40a517e746de2bc.tar.bz2 users-513bc9e03522f0bfc0e307a8e40a517e746de2bc.zip | |
php-cs-fixer tidies to php8.5 standards
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'auth')
| -rwxr-xr-x | auth/bit/auth.php | 6 | ||||
| -rwxr-xr-x | auth/imap/auth.php | 27 | ||||
| -rwxr-xr-x | auth/ldap/auth.php | 9 | ||||
| -rwxr-xr-x | auth/locate/auth.php | 15 | ||||
| -rwxr-xr-x | auth/multisites/auth.php | 17 |
5 files changed, 37 insertions, 37 deletions
diff --git a/auth/bit/auth.php b/auth/bit/auth.php index 17e118e..4b195c2 100755 --- a/auth/bit/auth.php +++ b/auth/bit/auth.php @@ -34,7 +34,7 @@ class BitAuth extends BaseAuth { $loginCol = ' UPPER(`'.(strpos( $user, '@' ) ? 'email' : 'login').'`)'; // first verify that the user exists $query = "select `email`, `login`, `user_id`, `user_password` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?"; - $result = $gBitDb->query( $query, array( $loginVal ) ); + $result = $gBitDb->query( $query, [ $loginVal ] ); if( !$result->numRows() ) { $this->mErrors['login'] = 'User not found'; } else { @@ -48,7 +48,7 @@ class BitAuth extends BaseAuth { // TODO - this needs cleaning up - wolff_borg if( !$gBitSystem->isFeatureActive( 'feature_challenge' ) || empty($response) ) { $query = "select `user_id`, `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ? and (`hash`=? or `hash`=?)"; - if ( $row = $gBitDb->getRow( $query, array( $loginVal, $hash, $hash2 ) ) ) { + if ( $row = $gBitDb->getRow( $query, [ $loginVal, $hash, $hash2 ] ) ) { // auto-update old hashes with simple and standard md5( password ) $hashUpdate = ''; if( $row['hash'] == $hash ) { @@ -67,7 +67,7 @@ class BitAuth extends BaseAuth { } else { // Use challenge-reponse method // Compare pass against md5(user,challenge,hash) - $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", array( $user ) ); + $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", [ $user ] ); if (!isset($_SESSION["challenge"])) { $this->mErrors[] = 'Invalid challenge'; $ret=PASSWORD_INCORRECT; diff --git a/auth/imap/auth.php b/auth/imap/auth.php index a8fb8b3..2887254 100755 --- a/auth/imap/auth.php +++ b/auth/imap/auth.php @@ -12,6 +12,7 @@ * @subpackage auth */ namespace Bitweaver\Users; + use Bitweaver\KernelTools; class IMAPAuth extends BaseAuth { @@ -43,7 +44,7 @@ class IMAPAuth extends BaseAuth { if(empty($this->mConfig["email"])) { $this->mInfo["email"] = $user; } else { - $info=array('login'=>$user); + $info=['login'=>$user]; $replace_func = create_function('$matches','$info = '.var_export($info,true).'; $m = $matches[0]; $m = substr($m,1,strlen($m)-2); @@ -76,37 +77,37 @@ class IMAPAuth extends BaseAuth { } function getSettings() { - return array( - 'users_imap_server' => array( + return [ + 'users_imap_server' => [ 'label' => "IMAP Server", 'type' => "text", 'note' => "", 'default' => '', - ), - 'users_imap_ssl' => array( + ], + 'users_imap_ssl' => [ 'label' => "Connect Using SSL", 'type' => "checkbox", 'note' => "", 'default' => 'y', - ), - 'users_imap_sslvalidate' => array( + ], + 'users_imap_sslvalidate' => [ 'label' => "Require SSL Certificate to be valid", 'type' => "checkbox", 'note' => "", 'default' => 'n', - ), - 'users_imap_port' => array( + ], + 'users_imap_port' => [ 'label' => "IMAP Port", 'type' => "text", 'note' => "", 'default' => '993', - ), - 'users_imap_email' => array( + ], + 'users_imap_email' => [ 'label' => "LDAP User E-Mail Address", 'type' => "text", 'note' => "If empty the login is used.<br />Otherwise all %login% is replaced with the login name, and the result used as the email address.<br />Please remember to include the @ sign", 'default' => "%login%@redhat.com", - ), - ); + ], + ]; } } diff --git a/auth/ldap/auth.php b/auth/ldap/auth.php index b0e599f..709e5e7 100755 --- a/auth/ldap/auth.php +++ b/auth/ldap/auth.php @@ -9,6 +9,7 @@ * required setup */ namespace Bitweaver\Users; + use Bitweaver\KernelTools; if (file_exists(UTIL_PKG_INCLUDE_PATH."pear/Auth/Auth.php")) { @@ -76,7 +77,7 @@ class LDAPAuth extends BaseAuth { $success = $a->storage->fetchData($user_utf8, $pass, false); if ($success == false) { - $this->mErrors['login'] = isset($a->storage->options['status']) ? $a->storage->options['status'] : 'Not authenticated'; + $this->mErrors['login'] = $a->storage->options['status'] ?? 'Not authenticated'; return PASSWORD_INCORRECT; } } @@ -124,18 +125,18 @@ class LDAPAuth extends BaseAuth { global $gBitDb; // set additional attributes here if (empty($userattr["email"])) { - $userattr["email"] = $gBitDb->getOne("select `email` from `".BIT_DB_PREFIX."users_users` where `login`=?", array($userattr["login"])); + $userattr["email"] = $gBitDb->getOne("select `email` from `".BIT_DB_PREFIX."users_users` where `login`=?", [$userattr["login"]]); } // set the Auth options $a = new \Auth("LDAP", $this->mConfig); // check if the login correct if ($a->addUser($userattr["login"], $userattr["password"], $userattr) === true) { return true; - } else { + } // otherwise use the error status given back $this->mErrors['create'] = $a->getStatus(); return false; - } + } function canManageAuth() { diff --git a/auth/locate/auth.php b/auth/locate/auth.php index 2d6bf14..77197f5 100755 --- a/auth/locate/auth.php +++ b/auth/locate/auth.php @@ -15,7 +15,6 @@ * @subpackage auth */ namespace Bitweaver\Users; -use Bitweaver\KernelTools; class LocateAuth extends BaseAuth { @@ -39,7 +38,7 @@ class LocateAuth extends BaseAuth { $loginCol = ' UPPER(`'.(strpos( $user, '@' ) ? 'email' : 'login').'`)'; // first verify that the user exists $query = "select `email`, `login`, `user_id`, `user_password` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?"; - $result = $gBitDb->query( $query, array( $loginVal ) ); + $result = $gBitDb->query( $query, [ $loginVal ] ); if( !$result->numRows() ) { $this->mErrors['login'] = 'User not found'; } else { @@ -53,7 +52,7 @@ class LocateAuth extends BaseAuth { // TODO - this needs cleaning up - wolff_borg if( !$gBitSystem->isFeatureActive( 'feature_challenge' ) || empty($response) ) { $query = "select `user_id`, `content_id`, `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ? and (`hash`=? or `hash`=?)"; - if ( $row = $gBitDb->getRow( $query, array( $loginVal, $hash, $hash2 ) ) ) { + if ( $row = $gBitDb->getRow( $query, [ $loginVal, $hash, $hash2 ] ) ) { // auto-update old hashes with simple and standard md5( password ) $hashUpdate = ''; if( $row['hash'] == $hash ) { @@ -90,7 +89,7 @@ class LocateAuth extends BaseAuth { } else { // Use challenge-reponse method // Compare pass against md5(user,challenge,hash) - $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", array( $user ) ); + $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", [ $user ] ); if (!isset($_SESSION["challenge"])) { $this->mErrors[] = 'Invalid challenge'; $ret=PASSWORD_INCORRECT; @@ -118,18 +117,18 @@ class LocateAuth extends BaseAuth { global $gBitSystem; if( $gBitSystem->isPackageActive( 'contact' ) ) { return TRUE; - } else { - return FALSE; } + return FALSE; + } function isSupported() { global $gBitSystem; if( $gBitSystem->isPackageActive( 'contact' ) ) { return TRUE; - } else { - return FALSE; } + return FALSE; + } function createUser( &$pUserHash ) { diff --git a/auth/multisites/auth.php b/auth/multisites/auth.php index 680f4e4..cf44c0d 100755 --- a/auth/multisites/auth.php +++ b/auth/multisites/auth.php @@ -12,7 +12,6 @@ * @subpackage auth */ namespace Bitweaver\Users; -use Bitweaver\KernelTools; class MultisitesAuth extends BaseAuth { @@ -36,7 +35,7 @@ class MultisitesAuth extends BaseAuth { $loginCol = ' UPPER(`'.(strpos( $user, '@' ) ? 'email' : 'login').'`)'; // first verify that the user exists $query = "select `email`, `login`, `user_id`, `user_password` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?"; - $result = $gBitDb->query( $query, array( $loginVal ) ); + $result = $gBitDb->query( $query, [ $loginVal ] ); if( !$result->numRows() ) { $this->mErrors['login'] = 'User not found'; } else { @@ -50,7 +49,7 @@ class MultisitesAuth extends BaseAuth { // TODO - this needs cleaning up - wolff_borg if( !$gBitSystem->isFeatureActive( 'feature_challenge' ) || empty($response) ) { $query = "select `user_id`, `content_id`, `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ? and (`hash`=? or `hash`=?)"; - if ( $row = $gBitDb->getRow( $query, array( $loginVal, $hash, $hash2 ) ) ) { + if ( $row = $gBitDb->getRow( $query, [ $loginVal, $hash, $hash2 ] ) ) { // auto-update old hashes with simple and standard md5( password ) $hashUpdate = ''; if( $row['hash'] == $hash ) { @@ -62,7 +61,7 @@ class MultisitesAuth extends BaseAuth { $query = "update `".BIT_DB_PREFIX."users_users` set $hashUpdate `last_login`=`current_login`, `current_login`=? where `user_id`=?"; $result = $gBitDb->query($query, $bindVars ); $query = "select `multisite_id` from `".BIT_DB_PREFIX."multisite_content` where `content_id` = ?"; - $sites = $gBitDb->getAll($query, array( $row['content_id'] ) ); + $sites = $gBitDb->getAll($query, [ $row['content_id'] ] ); if ( !$sites ) { $ret=USER_VALID; } else { @@ -85,7 +84,7 @@ class MultisitesAuth extends BaseAuth { } else { // Use challenge-reponse method // Compare pass against md5(user,challenge,hash) - $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", array( $user ) ); + $hash = $gBitDb->getOne("select `hash` from `".BIT_DB_PREFIX."users_users` where " . $gBitDb->convertBinary(). " $loginCol = ?", [ $user ] ); if (!isset($_SESSION["challenge"])) { $this->mErrors[] = 'Invalid challenge'; $ret=PASSWORD_INCORRECT; @@ -113,18 +112,18 @@ class MultisitesAuth extends BaseAuth { global $gBitSystem; if( $gBitSystem->isPackageActive( 'multisites' ) ) { return TRUE; - } else { - return FALSE; } + return FALSE; + } function isSupported() { global $gBitSystem; if( $gBitSystem->isPackageActive( 'multisites' ) ) { return TRUE; - } else { - return FALSE; } + return FALSE; + } function createUser( &$pUserHash ) { |
