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 /admin | |
| 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 'admin')
| -rwxr-xr-x | admin/admin_login_inc.php | 50 | ||||
| -rwxr-xr-x | admin/admin_users_inc.php | 31 | ||||
| -rw-r--r-- | admin/api_help_inc.php | 78 | ||||
| -rwxr-xr-x | admin/assign_user.php | 10 | ||||
| -rwxr-xr-x | admin/edit_group.php | 20 | ||||
| -rwxr-xr-x | admin/edit_role.php | 8 | ||||
| -rwxr-xr-x | admin/index.php | 11 | ||||
| -rwxr-xr-x | admin/permissions.php | 8 | ||||
| -rwxr-xr-x | admin/role_permissions.php | 2 | ||||
| -rw-r--r-- | admin/schema_inc.php | 19 | ||||
| -rwxr-xr-x | admin/upgrade_inc.php | 439 | ||||
| -rwxr-xr-x | admin/user_activity.php | 4 | ||||
| -rwxr-xr-x | admin/users_import.php | 2 | ||||
| -rw-r--r-- | admin/verify_emails.php | 6 | ||||
| -rw-r--r-- | admin/verify_emails_role.php | 4 |
15 files changed, 334 insertions, 358 deletions
diff --git a/admin/admin_login_inc.php b/admin/admin_login_inc.php index d0209df..07a6343 100755 --- a/admin/admin_login_inc.php +++ b/admin/admin_login_inc.php @@ -10,53 +10,53 @@ use Bitweaver\Users\BitHybridAuthManager; require_once USERS_PKG_CLASS_PATH.'BaseAuth.php'; -$loginSettings = array( - 'users_allow_register' => array( +$loginSettings = [ + 'users_allow_register' => [ 'label' => "Users can register", 'type' => "checkbox", 'note' => "Registration is attempted for the lowest level supporting the creation of new users.", - ), - 'send_welcome_email' => array( + ], + 'send_welcome_email' => [ 'label' => "Send registration welcome email", 'type' => "checkbox", 'note' => "Upon successful registration, this will send the user an email with login information, including their password.", - ), - 'after_reg_url' => array( + ], + 'after_reg_url' => [ 'label' => "After registration url", 'type' => "text", 'note' => "Set a url users will be directed to after registration. Default is your site's home page.", - ), - 'users_login_homepage' => array( + ], + 'users_login_homepage' => [ 'label' => "After login url", 'type' => "text", 'note' => "Set a custom url where users will be directed after logging in. It should not include a leading slash or subdirectory. Default is users/my.php", - ), - 'users_eponymous_groups' => array( + ], + 'users_eponymous_groups' => [ 'label' => "Create a group for each user", 'type' => "checkbox", 'note' => "This will create a group for each user with the same name as the user. This might be useful if you want to assign different permission settings to every user.", - ), - 'users_forgot_pass' => array( + ], + 'users_forgot_pass' => [ 'label' => "Remind passwords by email", 'type' => "checkbox", 'note' => "This will display a 'forgot password' link on the login page and allow users to have their password sent to their registered email address.", - ), - 'users_remember_me' => array( + ], + 'users_remember_me' => [ 'label' => "Remember me feature", 'type' => "checkbox", 'note' => "Registered users will stay logged even if they close their browser.", - ), - 'cookie_domain' => array( + ], + 'cookie_domain' => [ 'label' => "Remember me domain", 'type' => "text", 'note' => "Remember to use a '.' wildcard prefix if you want domain wide cookies.<br />e.g.: <strong>.mysite.com</strong> for a domain called <strong>www.mysite.com</strong>", - ), - 'cookie_path' => array( + ], + 'cookie_path' => [ 'label' => "Remember me path", 'type' => "text", 'note' => "The path '/foo' would match '/foobar' and '/foo/bar.html'", - ), -); + ], +]; $gBitSmarty->assign( 'loginSettings', $loginSettings ); $registerSettings = [ @@ -218,7 +218,6 @@ $httpSettings = [ ]; $gBitSmarty->assign( 'httpSettings', $httpSettings ); - if (defined ('ROLE_MODEL') ) { $listHash = [ 'sort_mode' => 'role_name_asc' ]; $gBitSmarty->assign( 'roleList', $gBitUser->getAllRoles( $listHash )); @@ -253,7 +252,7 @@ if( !empty( $_POST ) ) { } // Save all preferences - foreach( array( 'loginprefs'=>'loginSettings', 'registerprefs'=>'registerSettings', 'httpprefs'=>'httpSettings' ) as $prefGroup=>$prefHash ) { + foreach( [ 'loginprefs'=>'loginSettings', 'registerprefs'=>'registerSettings', 'httpprefs'=>'httpSettings' ] as $prefGroup=>$prefHash ) { $settings = $$prefHash; foreach( array_keys( $settings ) as $feature ) { if( $settings[$feature]['type'] == 'text' ) { @@ -280,10 +279,10 @@ if( !empty( $_POST ) ) { if( isset( $_REQUEST['registration_group_choice'] ) ) { $listHash = []; - $groupList = ( defined( 'ROLE_MODEL' ) ) - ? $gBitUser->getAllRoles( $listHash ) + $groupList = ( defined( 'ROLE_MODEL' ) ) + ? $gBitUser->getAllRoles( $listHash ) : $gBitUser->getAllGroups( $listHash ); - + $in = []; $out = []; foreach( $groupList as $gr ) { @@ -310,7 +309,6 @@ if( !empty( $_POST ) ) { $gBitSmarty->assign( 'hybridProviders', $gBitHybridAuthManager->getAllProviders() ); - $listHash = []; // This needs to be made more generic so that it picks up all plugins diff --git a/admin/admin_users_inc.php b/admin/admin_users_inc.php index 24793b3..7e612cf 100755 --- a/admin/admin_users_inc.php +++ b/admin/admin_users_inc.php @@ -1,32 +1,31 @@ <?php -$formFeatures = array( - 'users_preferences' => array( +$formFeatures = [ + 'users_preferences' => [ 'label' => 'User Preferences', 'note' => 'Users can view and modify their personal preferences.', 'page' => 'UserPreferences', - ), - 'users_change_language' => array( + ], + 'users_change_language' => [ 'label' => 'Registered users can change language', - 'note' => 'Allows users to view a translated version of the site.' - ), - 'users_watches' => array( + 'note' => 'Allows users to view a translated version of the site.', + ], + 'users_watches' => [ 'label' => 'User Watches', 'note' => 'Users can mark pages to be watched. If a watched page is modified, the user is informed.', 'page' => 'UserWatches', - ), - 'display_users_content_list' => array( + ], + 'display_users_content_list' => [ 'label' => 'Display User\'s Content', 'note' => 'Display listing of all content owned by this user on the user My page.', 'page' => 'UserContentList', - ), -); - + ], +]; $gBitSmarty->assign( 'formFeatures', $formFeatures ); if( isset( $_REQUEST['settings'] ) ) { foreach ( array_keys( $formFeatures ) as $feature) { - $gBitSystem->storeConfig( $feature, (isset( $_REQUEST['settings'][$feature][0] ) ? $_REQUEST['settings'][$feature][0] : 'n'), USERS_PKG_NAME ); + $gBitSystem->storeConfig( $feature, ($_REQUEST['settings'][$feature][0] ?? 'n'), USERS_PKG_NAME ); } if( $customFields = explode( ',', $_REQUEST['settings']['custom_user_fields'] ) ) { @@ -34,9 +33,9 @@ if( isset( $_REQUEST['settings'] ) ) { $customFields = implode( ',', $customFields ); } $gBitSystem->storeConfig( 'custom_user_fields', $customFields, USERS_PKG_NAME ); - $gBitSystem->storeConfig( 'users_display_name', (isset( $_REQUEST['settings']['users_display_name'] ) ? $_REQUEST['settings']['users_display_name'] : 'real_name'), USERS_PKG_NAME ); - $gBitSystem->storeConfig( 'users_themes', (isset( $_REQUEST['settings']['users_themes'][0] ) ? $_REQUEST['settings']['users_themes'][0] : null), USERS_PKG_NAME ); - $gBitSystem->storeConfig( 'users_layouts', (isset( $_REQUEST['settings']['users_layouts'][0] ) ? $_REQUEST['settings']['users_layouts'][0] : null), USERS_PKG_NAME ); + $gBitSystem->storeConfig( 'users_display_name', ($_REQUEST['settings']['users_display_name'] ?? 'real_name'), USERS_PKG_NAME ); + $gBitSystem->storeConfig( 'users_themes', ($_REQUEST['settings']['users_themes'][0] ?? null), USERS_PKG_NAME ); + $gBitSystem->storeConfig( 'users_layouts', ($_REQUEST['settings']['users_layouts'][0] ?? null), USERS_PKG_NAME ); } ?> diff --git a/admin/api_help_inc.php b/admin/api_help_inc.php index 4930e1a..bb2e1ef 100644 --- a/admin/api_help_inc.php +++ b/admin/api_help_inc.php @@ -2,26 +2,26 @@ global $gApiHelp, $gBitUser, $gBitSystem; -$gApiHelp['User Registration'] = array( - 'Request Methods' => array( +$gApiHelp['User Registration'] = [ + 'Request Methods' => [ 'method' => 'POST '.API_PKG_URI.'users/register', 'help' => '', - 'parameters' => array( + 'parameters' => [ 'POST '.API_PKG_URI.'users' => 'POST can be used for creation *and* updating existing user objects', 'PUT '.API_PKG_URI.'users' => 'A PUT will perform identically to POST', 'GET '.API_PKG_URI.'users' => 'Once authenticated, and GET to this URL will return JSON of the active user object', - ), - ), - 'Sendable Properties' => array( + ], + ], + 'Sendable Properties' => [ 'help' => 'These are mutable parameters can be sent to the host to store information about the user', - 'parameters' => array( - 'email' => 'valid email, * required for registration.', - 'password' => 'Password to be saved with account. Will be salted and hashed and is irrecoverable. * required for registration', - 'login' => 'username consisting of alphanumeric letters, optional for registration, though a default will be assigned if not set', - 'real_name' => 'The user\'s full name, including first and last names, optional', - ), - ), - 'Examples' => array( + 'parameters' => [ + 'email' => 'valid email, * required for registration.', + 'password' => 'Password to be saved with account. Will be salted and hashed and is irrecoverable. * required for registration', + 'login' => 'username consisting of alphanumeric letters, optional for registration, though a default will be assigned if not set', + 'real_name' => 'The user\'s full name, including first and last names, optional', + ], + ], + 'Examples' => [ 'help' => '', 'code' => '<code>COMMAND: echo -n \'{"email":"test@example.com","password":"s3cr3t"}\' |lwp-request -se -C test:foobar -c "application/json" -H \'API: API consumer_key="bad6ed95edfd983c8cb58cd397a242a2f83cd80c"\' -m PUT '.API_PKG_URI.'users/authenticate @@ -36,34 +36,34 @@ Server: Apache/2.2.3 (CentOS) Set-Cookie: BWSESSION=2ishv84g637mrp7o07hd8829f6; path='.$gBitSystem->getConfig( 'cookie_path', '/' ).'; domain='.$gBitSystem->getConfig( 'cookie_domain' ).' Set-Cookie: <strong>'.$gBitUser->getSiteCookieName().'=2ishv84g637mrp7o07hd8829f6M</strong>; path=/ </code>', - ), -); + ], +]; -$gApiHelp['User Authentication'] = array( - 'Authentication' => array( +$gApiHelp['User Authentication'] = [ + 'Authentication' => [ 'method' => 'POST '.API_PKG_URI.'users/authenticate', 'help' => 'Authentication is performed once per session (application launch) using the standard <a href="http://en.wikipedia.org/wiki/Basic_access_authentication">HTTP Basic Authentication</a>. Once authentication is successful, a cookie named "'.$gBitUser->getSiteCookieName().'" will be returned for the user. That cookie can be included for every request which will automatically identify the user for the lifetime of the cookie. For stateless (without session) applications, you can simply include the <strong>Authorization</strong> header with the username and password for every request.', - 'parameters' => array( + 'parameters' => [ 'Authorization: Basic <em>base64encode(username + ":" + password)</em>' => 'HTTP Basic authenictaion sent via HTTP headers. Most frameworks will handle this for you automatically with a simple call. For example AFNetworking <a href=http://engineering.gowalla.com/AFNetworking/Classes/AFHTTPClient.html">::setAuthorizationHeaderWithUsername</a>', - ), - ), - 'Receivable Properties' => array( + ], + ], + 'Receivable Properties' => [ 'help' => 'In addition to the sendable properties listed above, these parameters will be sent by the host with information about the user.', - 'parameters' => array( - 'last_login' => '', - 'current_login' => '', - 'registration_date' => '', - 'is_registered' => '', - 'portrait_url' => '', - 'avatar_url' => '', - 'logo_url' => '', - 'email' => '', - 'login' => '', - 'real_name' => '', - 'user' => '', - ), - ), - 'Examples' => array( + 'parameters' => [ + 'last_login' => '', + 'current_login' => '', + 'registration_date' => '', + 'is_registered' => '', + 'portrait_url' => '', + 'avatar_url' => '', + 'logo_url' => '', + 'email' => '', + 'login' => '', + 'real_name' => '', + 'user' => '', + ], + ], + 'Examples' => [ 'help' => 'The following is a command-line test of user authentication. Notice the Set-Cookie values returned. Your client should store these values and send them for all subsequent requests.', 'code' => '<code>COMMAND: curl -i -u "test@example.com:s3cr3t" --header \'API: API consumer_key="bad6ed95edfd983c8cb58cd397a242a2f83cd80c"\' -X GET '.API_PKG_URI.'users/authenticate @@ -87,5 +87,5 @@ Set-Cookie: <strong>'.$gBitUser->getSiteCookieName().'=2ishv84g637mrp7o07hd8829f X-Powered-By: PHP/5.3.1 {"user_id":"1002","content_id":"1043","email":"text@example.com","login":"test","real_name":"Test User","provpass":null,"provpass_expires":null,"default_group_id":null,"last_login":"1342734606","current_login":"1342734606","registration_date":"1341806036","challenge":null,"pass_due":"1429048188","created":null,"avatar_attachment_id":null,"portrait_attachment_id":null,"logo_attachment_id":null,"avatar_file_name":null,"avatar_mime_type":null,"portrait_file_name":null,"portrait_mime_type":null,"logo_file_name":null,"logo_mime_type":null,"uu_user_id":"1002","user":"text","valid":true,"is_registered":true,"portrait_path":null,"portrait_url":null,"avatar_path":null,"avatar_url":null,"logo_path":null,"logo_url":null,"first_name":"Test User"}</code>', - ), -); + ], +]; diff --git a/admin/assign_user.php b/admin/assign_user.php index 80757b3..696a445 100755 --- a/admin/assign_user.php +++ b/admin/assign_user.php @@ -11,7 +11,7 @@ use Bitweaver\KernelTools; $gBitSystem->verifyPermission( 'p_users_admin' ); -if (!$gBitUser->userExists( array( 'user_id' => $_REQUEST["assign_user"] ) ) ) { +if (!$gBitUser->userExists( [ 'user_id' => $_REQUEST["assign_user"] ] ) ) { $gBitSystem->fatalError( KernelTools::tra( "User doesnt exist" )); } @@ -39,17 +39,15 @@ if( isset( $_REQUEST["action"] ) ) { } $gBitSmarty->assign( 'assignUser', $assignUser ); -$listHash = array( 'sort_mode' => 'group_name_asc' ); +$listHash = [ 'sort_mode' => 'group_name_asc' ]; $gBitSmarty->assign('groups', $gBitUser->getAllGroups( $listHash )); $gBitSystem->setBrowserTitle( 'Edit User: '.$assignUser->mUsername ); if($gBitSystem->isPackageActive("quota")) { - include(QUOTA_PKG_INCLUDE_PATH.'quota_inc.php'); + include(QUOTA_PKG_INCLUDE_PATH.'quota_inc.php'); } - - // Display the template -$gBitSystem->display( 'bitpackage:users/admin_assign_user.tpl', null, array( 'display_mode' => 'admin' )); +$gBitSystem->display( 'bitpackage:users/admin_assign_user.tpl', null, [ 'display_mode' => 'admin' ]); ?> diff --git a/admin/edit_group.php b/admin/edit_group.php index fe5bcec..1c1c0ee 100755 --- a/admin/edit_group.php +++ b/admin/edit_group.php @@ -18,10 +18,10 @@ if( count( $_GET ) > 2 || count( $_POST ) > 2 ) { } if( !empty( $_REQUEST['group_id'] ) ) { - $permListHash = array( + $permListHash = [ 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : null, 'package' => !empty( $_REQUEST['package'] ) ? $_REQUEST['package'] : null, - ); + ]; $allPerms = $gBitUser->getGroupPermissions( $permListHash ); } @@ -34,11 +34,11 @@ if( !empty( $_REQUEST["cancel"] ) ) { } else { $gBitSystem->setBrowserTitle( KernelTools::tra( 'Confirm Batch Group Assignment' ) ); $formHash['batch_assign'] = $_REQUEST["batch_assign"]; - $msgHash = array( + $msgHash = [ 'label' => KernelTools::tra( 'Batch Assign Users to Group' ), 'confirm_item' => $groupInfo['group_name'], 'warning' => KernelTools::tra( 'This will assign every user on the site to the group' ).' <strong>'.$groupInfo['group_name'].'</strong>', - ); + ]; $gBitSystem->confirmDialog( $formHash,$msgHash ); } } elseif( isset($_REQUEST["members"] ) ) { @@ -81,10 +81,10 @@ if( !empty( $_REQUEST["cancel"] ) ) { unset( $_REQUEST['group_id'] ); } else { $gBitSystem->setBrowserTitle( KernelTools::tra( 'Delete group') ); - $msgHash = array( + $msgHash = [ 'confirm_item' => KernelTools::tra( 'Are you sure you want to permantly remove the group' )." <strong>$groupInfo[group_name]</strong>".'?', 'warning' => KernelTools::tra( 'This cannot be undone.' ), - ); + ]; $gBitSystem->confirmDialog( $formHash,$msgHash ); } // $mid = 'bitpackage:users/admin_groups_list.tpl'; @@ -117,7 +117,7 @@ if( !empty( $_REQUEST['group_id'] ) || (!empty( $_REQUEST["action"] ) && $_REQUE $gBitSmarty->assign( 'permPackages', $permPackages ); // get grouplist separately from the $users stuff to avoid splitting of data due to pagination - $listHash = array( 'sort_mode' => 'group_name_asc' ); + $listHash = [ 'sort_mode' => 'group_name_asc' ]; /* // get content and pass it on to the template @@ -128,14 +128,14 @@ if( !empty( $_REQUEST['group_id'] ) || (!empty( $_REQUEST["action"] ) && $_REQUE $gBitSmarty->assign( 'contentList', $cList ); $gBitSmarty->assign( 'contentSelect', $contentSelect ); */ - $contentTypes = array( '' => KernelTools::tra( 'All Content' ) ); + $contentTypes = [ '' => KernelTools::tra( 'All Content' ) ]; foreach( $gLibertySystem->mContentTypes as $cType ) { $contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName( $cType['content_type_guid'] ); } $gBitSmarty->assign( 'contentTypes', $contentTypes ); } else { // get grouplist separately from the $users stuff to avoid splitting of data due to pagination - $listHash = array( 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' ); + $listHash = [ 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' ]; } $gBitSmarty->assign('groupList', $gBitUser->getAllGroups( $listHash )); @@ -162,5 +162,5 @@ $gBitSmarty->assign('successMsg',$successMsg); $gBitSmarty->assign('errorMsg',$errorMsg); // Display the template for group administration -$gBitSystem->display( $mid , null, array( 'display_mode' => 'edit' )); +$gBitSystem->display( $mid , null, [ 'display_mode' => 'edit' ]); ?> diff --git a/admin/edit_role.php b/admin/edit_role.php index f5029d2..5de2f10 100755 --- a/admin/edit_role.php +++ b/admin/edit_role.php @@ -35,11 +35,11 @@ if( !empty( $_REQUEST["cancel"] ) ) { } else { $gBitSystem->setBrowserTitle( KernelTools::tra( 'Confirm Batch Role Assignment' ) ); $formHash['batch_assign'] = $_REQUEST["batch_assign"]; - $msgHash = array( + $msgHash = [ 'label' => KernelTools::tra( 'Batch Assign Users to Role' ), 'confirm_item' => $roleInfo['role_name'], 'warning' => KernelTools::tra( 'This will assign every user on the site to the role' ).' <strong>'.$roleInfo['role_name'].'</strong>', - ); + ]; $gBitSystem->confirmDialog( $formHash,$msgHash ); } } elseif( isset($_REQUEST["members"] ) ) { @@ -96,10 +96,10 @@ if( !empty( $_REQUEST["cancel"] ) ) { unset( $_REQUEST['role_id'] ); } else { $gBitSystem->setBrowserTitle( KernelTools::tra('Delete role') ); - $msgHash = array( + $msgHash = [ 'confirm_item' => KernelTools::tra( 'Are you sure you want to remove the role?' ), 'warning' => KernelTools::tra( 'This will permentally delete the role' )." <strong>$roleInfo[role_name]</strong>", - ); + ]; $gBitSystem->confirmDialog( $formHash,$msgHash ); } } elseif ($_REQUEST["action"] == 'remove') { diff --git a/admin/index.php b/admin/index.php index d78c8a7..b2ea0af 100755 --- a/admin/index.php +++ b/admin/index.php @@ -5,6 +5,7 @@ // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization namespace Bitweaver\Users; + use Bitweaver\BitBase; use Bitweaver\KernelTools; @@ -46,7 +47,7 @@ if( isset($_REQUEST["newuser"] ) ) { if ( !isset( $feedback['error'] ) ){ $feedback['error'] = []; } - $feedback['error'] = array_merge( $feedback['error'], $gBitUser->mErrors ); + $feedback['error'] = array_merge( $feedback['error'], $gBitUser->mErrors ); } } else { $gBitSystem->setBrowserTitle( 'Assume User Identity' ); @@ -79,7 +80,7 @@ if( isset( $_REQUEST["action"] ) ) { fputcsv( $fp, $hash ); } fclose( $fp ); - header( "Content-Type: text/csv" ); + header( "Content-Type: text/csv" ); header('Content-disposition: attachment;filename='.$gBitSystem->getConfig('site_title', 'Site').'-users-export-'.date('Y-m-d_Hi').'.csv'); readfile( $file ); flush(); @@ -100,14 +101,14 @@ if( isset( $_REQUEST["action"] ) ) { if( !empty( $delUsers ) ) { $feedback['success'][] = KernelTools::tra( 'Users deleted' ).": <ul>$delUsers</ul>"; - } + } if( !empty( $errDelUsers ) ) { $feedback['error'][] = KernelTools::tra( 'Users not deleted' ).": <ul>$errDelUsers</ul>"; } } else { foreach( $_REQUEST['batch_user_ids'] as $uid ) { - $formHash['input'][] = ( $userInfo = $gBitUser->getUserInfo( [ 'user_id' => $uid ] ) ) - ? '<input type="hidden" name="batch_user_ids[]" value="' . $uid . '"/>' . "{$userInfo['real_name']} ({$userInfo['login']})<br/><{$userInfo['email']}>" + $formHash['input'][] = ( $userInfo = $gBitUser->getUserInfo( [ 'user_id' => $uid ] ) ) + ? '<input type="hidden" name="batch_user_ids[]" value="' . $uid . '"/>' . "{$userInfo['real_name']} ({$userInfo['login']})<br/><{$userInfo['email']}>" : '<span class="error"/>' . $uid . ' ' . KernelTools::tra( 'not found' ) . '</span>'; } $formHash['input'][] = "<input type='checkbox' name='delete_user_content' value='all' checked='checked'/> ".KernelTools::tra( 'Delete all content created by this user' ); diff --git a/admin/permissions.php b/admin/permissions.php index 2f6629f..3f3075d 100755 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -7,10 +7,10 @@ $gBitSystem->verifyPermission( 'p_admin' ); $feedback = []; // get a list of all groups and their permissions -$listHash = array( +$listHash = [ 'only_root_groups' => true, - 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc' -); + 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'group_name_asc', +]; $allGroups = $gBitUser->getAllGroups( $listHash ); $allPerms = $gBitUser->getGroupPermissions( $_REQUEST ); @@ -44,5 +44,5 @@ $gBitSmarty->assign( 'permPackages', $gBitUser->getPermissionPackages() ); $gBitSmarty->assign( 'feedback', $feedback ); $gBitSmarty->assign( 'contentWithPermissions', LibertyContent::getContentWithPermissionsList() ); -$gBitSystem->display( 'bitpackage:users/admin_permissions.tpl', KernelTools::tra( 'Permission Maintenance' ), array( 'display_mode' => 'admin' )); +$gBitSystem->display( 'bitpackage:users/admin_permissions.tpl', KernelTools::tra( 'Permission Maintenance' ), [ 'display_mode' => 'admin' ]); ?> diff --git a/admin/role_permissions.php b/admin/role_permissions.php index c50dd8b..001323f 100755 --- a/admin/role_permissions.php +++ b/admin/role_permissions.php @@ -9,7 +9,7 @@ $feedback = []; // get a list of all roles and their permissions $listHash = [ 'only_root_roles' => true, - 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'role_name_asc' + 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'role_name_asc', ]; $allRoles = $gBitUser->getAllRoles( $listHash ); $allPerms = $gBitUser->getRolePermissions( $_REQUEST ); diff --git a/admin/schema_inc.php b/admin/schema_inc.php index a9ff140..d96e5a0 100644 --- a/admin/schema_inc.php +++ b/admin/schema_inc.php @@ -1,7 +1,7 @@ <?php global $gBitInstaller; -$tables = (defined( 'ROLE_MODEL' )) +$tables = (defined( 'ROLE_MODEL' )) ? [ 'users_users' => " @@ -270,25 +270,24 @@ $gBitInstaller->registerUserPermissions( USERS_PKG_NAME, [ //array(USERS_PKG_NAME,'usermenu','n'), ] ); -$team_indices = (defined( 'ROLE_MODEL' )) +$team_indices = (defined( 'ROLE_MODEL' )) ? [ 'users_roles_user_idx' => [ 'table' => 'users_roles', 'cols' => 'user_id', 'opts' => null ], 'users_roles_user_name_idx' => [ 'table' => 'users_roles', 'cols' => 'user_id,role_name', 'opts' => [ 'UNIQUE' ] ], 'users_role_perm_role_idx' => [ 'table' => 'users_role_permissions', 'cols' => 'role_id', 'opts' => null ], 'users_role_perm_perm_idx' => [ 'table' => 'users_role_permissions', 'cols' => 'perm_name', 'opts' => null ], 'users_roles_map_user_idx' => [ 'table' => 'users_roles_map', 'cols' => 'user_id', 'opts' => null ], - 'users_roles_map_role_idx' => [ 'table' => 'users_roles_map', 'cols' => 'role_id', 'opts' => null ] - ] + 'users_roles_map_role_idx' => [ 'table' => 'users_roles_map', 'cols' => 'role_id', 'opts' => null ], + ] : [ 'users_groups_user_idx' => [ 'table' => 'users_groups', 'cols' => 'user_id', 'opts' => NULL ], 'users_groups_user_name_idx' => [ 'table' => 'users_groups', 'cols' => 'user_id,group_name', 'opts' => [ 'UNIQUE' ] ], 'users_group_perm_group_idx' => [ 'table' => 'users_group_permissions', 'cols' => 'group_id', 'opts' => null ], 'users_group_perm_perm_idx' => [ 'table' => 'users_group_permissions', 'cols' => 'perm_name', 'opts' => null ], 'users_groups_map_user_idx' => [ 'table' => 'users_groups_map', 'cols' => 'user_id', 'opts' => null ], - 'users_groups_map_group_idx' => [ 'table' => 'users_groups_map', 'cols' => 'group_id', 'opts' => null ] + 'users_groups_map_group_idx' => [ 'table' => 'users_groups_map', 'cols' => 'group_id', 'opts' => null ], ]; - $indices = [ ...$team_indices, 'users_users_email_idx' => [ 'table' => 'users_users', 'cols' => 'email', 'opts' => [ 'UNIQUE' ] ], 'users_auth_user_idx' => [ 'table' => 'users_auth_map', 'cols' => 'user_id', 'opts' => null ], @@ -354,8 +353,8 @@ $gBitInstaller->registerUserPermissions( USERS_PKG_NAME, [ // Package Requirements $gBitInstaller->registerRequirements( USERS_PKG_NAME, [ - 'liberty' => array( 'min' => '5.0.0' ), - 'kernel' => array( 'min' => '5.0.0' ), - 'themes' => array( 'min' => '5.0.0' ), - 'languages' => array( 'min' => '5.0.0' ), + 'liberty' => [ 'min' => '5.0.0' ], + 'kernel' => [ 'min' => '5.0.0' ], + 'themes' => [ 'min' => '5.0.0' ], + 'languages' => [ 'min' => '5.0.0' ], ]); diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php index 089f23b..7cad315 100755 --- a/admin/upgrade_inc.php +++ b/admin/upgrade_inc.php @@ -1,31 +1,29 @@ <?php global $gBitSystem, $gUpgradeFrom, $gUpgradeTo, $gBitDb; -$upgrades = array( +$upgrades = [ +'TIKIWIKI19' => [ + 'TIKIWIKI18' => [ -'TIKIWIKI19' => array ( - 'TIKIWIKI18' => array ( +[ 'DATADICT' => [ +[ 'ALTER' => [ + 'tiki_user_tasks' => [ + 'title' => [ '`title`', 'VARCHAR(250)' ], + 'description' => [ '`description`', 'X' ], + ], +]], +[ 'RENAMECOLUMN' => [ + 'tiki_pages' => [ '`created`' => '`date` I8' ], +]], +]], -array( 'DATADICT' => array( -array( 'ALTER' => array( - 'tiki_user_tasks' => array( - 'title' => array( '`title`', 'VARCHAR(250)' ), - 'description' => array( '`description`', 'X' ), - ), -)), -array( 'RENAMECOLUMN' => array( - 'tiki_pages' => array( '`created`' => '`date` I8' ), -)), -)), - -array( 'QUERY' => - array( 'SQL92' => array( +[ 'QUERY' => + [ 'SQL92' => [ "UPDATE `".BIT_DB_PREFIX."tiki_user_tasks` SET `title`= (SELECT `title` FROM `".BIT_DB_PREFIX."tiki_user_tasks_history` WHERE `".BIT_DB_PREFIX."tiki_user_tasks`.`taskId`=`belongs_to`)", "UPDATE `".BIT_DB_PREFIX."tiki_user_tasks` SET `description`= (SELECT `description` FROM `".BIT_DB_PREFIX."tiki_user_tasks_history` WHERE `".BIT_DB_PREFIX."tiki_user_tasks`.`taskId`=`belongs_to`)", - ) -)), - + ], +], ], /* @@ -44,8 +42,8 @@ CREATE TABLE tiki_user_tasks_history ( completed integer(14) DEFAULT NULL, -- date of the completation if it is null it is not yet completed deleted integer(14) DEFAULT NULL, -- date of the deleteation it it is null it is not deleted status char(1) DEFAULT NULL, -- null := waiting, - -- o := open / in progress, - -- c := completed -> (percentage = 100) + -- o := open / in progress, + -- c := completed -> (percentage = 100) percentage int(4) DEFAULT NULL, accepted_creator char(1) DEFAULT NULL, -- y - yes, n - no, null - waiting accepted_user char(1) DEFAULT NULL, -- y - yes, n - no, null - waiting @@ -64,35 +62,32 @@ ALTER TABLE tiki_user_tasks ADD completed int(14) default NULL; ALTER TABLE tiki_user_tasks ADD percentage int(4) default NULL; */ - ) -), - - - + ], +], -'BONNIE' => array( - 'BWR1' => array( +'BONNIE' => [ + 'BWR1' => [ // STEP 1 -array( 'QUERY' => - array( 'MYSQL' => array( +[ 'QUERY' => + [ 'MYSQL' => [ "ALTER TABLE `".BIT_DB_PREFIX."tiki_user_preferences` DROP PRIMARY KEY", "ALTER TABLE `".BIT_DB_PREFIX."users_usergroups` DROP PRIMARY KEY", "ALTER TABLE `".BIT_DB_PREFIX."users_grouppermissions` DROP PRIMARY KEY", "ALTER TABLE `".BIT_DB_PREFIX."tiki_group_inclusion` DROP PRIMARY KEY", "ALTER TABLE `".BIT_DB_PREFIX."tiki_user_watches` DROP PRIMARY KEY", - )), -), + ]], +], // STEP 1 -array( 'DATADICT' => array( -array( 'RENAMETABLE' => array( +[ 'DATADICT' => [ +[ 'RENAMETABLE' => [ 'users_usergroups' => 'users_groups_map', 'tiki_group_inclusion' => 'users_groups_inclusion', - ) -), -array( 'RENAMECOLUMN' => array( - 'users_users' => array( + ], +], +[ 'RENAMECOLUMN' => [ + 'users_users' => [ '`userId`' => '`user_id` I4', '`lastLogin`' => '`last_login` I8', '`currentLogin`' => '`current_login` I8', @@ -103,115 +98,114 @@ array( 'RENAMECOLUMN' => array( // '`avatarData`' => '`avatar_data`', // '`avatarLibName`' => '`avatar_lib_name`', // '`avatarType`' => '`avatar_type`', - ), - 'users_groups_map' => array( - '`userId`' => '`user_id` I4' - ), - 'tiki_semaphores' => array( '`semName`' => '`sem_name` C(250)', - '`timestamp`' => '`created` I8' ), - 'tiki_user_preferences' => array( - '`prefName`' => '`pref_name` C(40)' - ), + ], + 'users_groups_map' => [ + '`userId`' => '`user_id` I4', + ], + 'tiki_semaphores' => [ '`semName`' => '`sem_name` C(250)', + '`timestamp`' => '`created` I8', ], + 'tiki_user_preferences' => [ + '`prefName`' => '`pref_name` C(40)', + ], // 'users_groups_inclusion' => array('`groupName`', '`group_name`'), // 'users_groups_inclusion' => array('`includeGroup`', '`include_group`'), - 'tiki_user_bookmarks_folders' => array( + 'tiki_user_bookmarks_folders' => [ '`folderId`' => '`folder_id` I4', '`parentId`' => '`parent_id` I4', - ), - 'tiki_user_bookmarks_urls' => array( + ], + 'tiki_user_bookmarks_urls' => [ '`urlId`' => '`url_id` I4', '`lastUpdated`' => '`last_updated` I8', '`folderId`' => '`folder_id` I4', - ), - 'tiki_user_menus' => array( + ], + 'tiki_user_menus' => [ '`menuId`' => '`menu_id` I4', - ), - 'users_grouppermissions' => array( + ], + 'users_grouppermissions' => [ '`permName`' => '`perm_name` C(30)', - ), - 'users_groups' => array( + ], + 'users_groups' => [ '`groupName`' => '`group_name` C(30)', '`groupDesc`' => '`group_desc` C(255)', '`groupHome`' => '`group_home` C(255)', - ), - 'users_groups_map' => array( - '`userId`' => '`user_id` I4' - ), - 'users_objectpermissions' => array( + ], + 'users_groups_map' => [ + '`userId`' => '`user_id` I4', + ], + 'users_objectpermissions' => [ '`permName`' => '`perm_name` C(30)', '`objectType`' => '`object_type` C(20)', - ), - 'users_permissions' => array( + ], + 'users_permissions' => [ '`permName`' => '`perm_name` C(30)', '`permDesc`' => '`perm_desc` C(250)', '`type`' => '`package` C(100)', - ), - 'tiki_userfiles' => array( + ], + 'tiki_userfiles' => [ '`fileId`' => '`file_id` I4', '`isFile`' => '`is_file` C(1)', - ), - 'tiki_user_tasks' => array( + ], + 'tiki_user_tasks' => [ '`taskId`' => '`task_id` I4' , - ) -)), + ], +]], -array( 'ALTER' => array( - 'users_users' => array( - 'content_id' => array( '`content_id`', 'I4' ), - 'default_group_id' => array( '`default_group_id`', 'I4' ), - 'real_name' => array( '`real_name`', 'VARCHAR(64)'), - 'avatar_attachment_id' => array( '`avatar_attachment_id`', 'I4' ), - 'portrait_attachment_id' => array( '`portrait_attachment_id`', 'I4' ), - 'logo_attachment_id' => array( '`logo_attachment_id`', 'I4' ), +[ 'ALTER' => [ + 'users_users' => [ + 'content_id' => [ '`content_id`', 'I4' ], + 'default_group_id' => [ '`default_group_id`', 'I4' ], + 'real_name' => [ '`real_name`', 'VARCHAR(64)'], + 'avatar_attachment_id' => [ '`avatar_attachment_id`', 'I4' ], + 'portrait_attachment_id' => [ '`portrait_attachment_id`', 'I4' ], + 'logo_attachment_id' => [ '`logo_attachment_id`', 'I4' ], - ), - 'tiki_semaphores' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_sessions' => array( - 'user_id' => array( '`user_id`', 'I4' ), - 'session_id' => array( '`session_id`', 'VARCHAR(32)' ), - ), - 'tiki_user_bookmarks_folders' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_user_bookmarks_urls' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_user_menus' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_user_preferences' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_user_tasks' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'tiki_user_watches' => array( - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'users_groups' => array( - 'group_id' => array( '`group_id`', 'I4' ), - 'user_id' => array( '`user_id`', 'I4' ), - ), - 'users_grouppermissions' => array( - 'group_id' => array( '`group_id`', 'I4' ), - ), - 'users_objectpermissions' => array( - 'group_id' => array( '`group_id`', 'I4' ), - 'object_id' => array( '`object_id`', 'I4' ), - ), - 'users_groups_map' => array( - 'group_id' => array( '`group_id`', 'I4' ), - ), - 'users_groups_inclusion' => array( - 'group_id' => array( '`group_id`', 'I4' ), - 'include_group_id' => array( '`include_group_id`', 'I4' ), - ), -)), + ], + 'tiki_semaphores' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_sessions' => [ + 'user_id' => [ '`user_id`', 'I4' ], + 'session_id' => [ '`session_id`', 'VARCHAR(32)' ], + ], + 'tiki_user_bookmarks_folders' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_user_bookmarks_urls' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_user_menus' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_user_preferences' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_user_tasks' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'tiki_user_watches' => [ + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'users_groups' => [ + 'group_id' => [ '`group_id`', 'I4' ], + 'user_id' => [ '`user_id`', 'I4' ], + ], + 'users_grouppermissions' => [ + 'group_id' => [ '`group_id`', 'I4' ], + ], + 'users_objectpermissions' => [ + 'group_id' => [ '`group_id`', 'I4' ], + 'object_id' => [ '`object_id`', 'I4' ], + ], + 'users_groups_map' => [ + 'group_id' => [ '`group_id`', 'I4' ], + ], + 'users_groups_inclusion' => [ + 'group_id' => [ '`group_id`', 'I4' ], + 'include_group_id' => [ '`include_group_id`', 'I4' ], + ], +]], - -array( 'CREATE' => array ( +[ 'CREATE' => [ 'users_cnxn' => " user_id I4, cookie C(64), @@ -224,12 +218,12 @@ array( 'CREATE' => array ( CONSTRAINTS ', CONSTRAINT `users_cnxn_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)' ", -)), +]], -)), +]], // STEP 2 -array( 'PHP' => ' +[ 'PHP' => ' global $gBitSystem, $gBitDb; $max = $gBitDb->GetOne( "SELECT MAX(user_id) FROM `'.BIT_DB_PREFIX.'users_users`" ); $gBitSystem->mDb->CreateSequence( "users_users_user_id_seq", $max + 1 ); @@ -241,23 +235,20 @@ array( 'PHP' => ' $id = $gBitDb->GenID( "users_groups_id_seq" ); $gBitDb->query( "UPDATE `'.BIT_DB_PREFIX.'users_groups` SET group_id=? WHERE group_name=?", array( $id, $name ) ); } -' ), +' ], // STEP 3 -array( 'QUERY' => - array( 'SQL92' => array( +[ 'QUERY' => + [ 'SQL92' => [ "UPDATE `".BIT_DB_PREFIX."users_grouppermissions` SET `perm_name`=replace(`perm_name`,'tiki_','bit_')", "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`=replace(`perm_name`,'tiki_','bit_')", "UPDATE `".BIT_DB_PREFIX."users_objectpermissions` SET `perm_name`=replace(`perm_name`,'tiki_','bit_')", - - - "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email`, `user_id` ) VALUES ('Anonymous', 'anonymous', 'anonymous@localhost', ".ANONYMOUS_USER_ID.")", // TikiWiki assigns the creator user foreign key as 'system' even if there is now 'system' user - XOXO spiderr // In order for all pages to upgrade, there must be at least an 'admin' and 'system' user - "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email`, `user_id` ) VALUES ('Administrator', 'admin', 'root@localhost', ".ROOT_USER_ID.")", - "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email` ) VALUES ('System', 'system', 'system@localhost' )", + "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email`, `user_id` ) VALUES ('Administrator', 'admin', 'root@localhost', ".ROOT_USER_ID.")", + "INSERT INTO `".BIT_DB_PREFIX."users_users` (`real_name`, `login`, `email` ) VALUES ('System', 'system', 'system@localhost' )", "UPDATE `".BIT_DB_PREFIX."tiki_semaphores` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_semaphores`.`user`)", "UPDATE `".BIT_DB_PREFIX."tiki_semaphores` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_semaphores`.`user`)", "UPDATE `".BIT_DB_PREFIX."tiki_sessions` SET `user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."tiki_sessions`.`user`)", @@ -278,37 +269,36 @@ array( 'QUERY' => "update `".BIT_DB_PREFIX."tiki_user_watches` set `type` = 'bitpage' where `type` = 'Wiki page'", "update `".BIT_DB_PREFIX."tiki_user_watches` set `type` = 'bitpage' where `type` = 'Wiki-Seite'", - - ), -)), + ], +], ], // STEP 4 -array( 'DATADICT' => array( -array( 'DROPCOLUMN' => array( - 'tiki_semaphores' => array( '`user`' ), - 'tiki_sessions' => array( '`user`', '`sessionId`' ), - 'users_groups_map' => array( '`groupName`' ), - 'users_grouppermissions' => array( '`groupName`' ), - 'users_objectpermissions' => array( '`groupName`' ), - 'users_groups_inclusion' => array( '`groupName`' ), - 'tiki_user_bookmarks_folders' => array( '`user`' ), - 'tiki_user_bookmarks_urls' => array( '`user`' ), - 'tiki_user_menus' => array( '`user`' ), - 'tiki_user_preferences' => array( '`user`' ), - 'tiki_user_tasks' => array( '`user`' ), - 'tiki_user_watches' => array( '`user`' ), - )), -)), +[ 'DATADICT' => [ +[ 'DROPCOLUMN' => [ + 'tiki_semaphores' => [ '`user`' ], + 'tiki_sessions' => [ '`user`', '`sessionId`' ], + 'users_groups_map' => [ '`groupName`' ], + 'users_grouppermissions' => [ '`groupName`' ], + 'users_objectpermissions' => [ '`groupName`' ], + 'users_groups_inclusion' => [ '`groupName`' ], + 'tiki_user_bookmarks_folders' => [ '`user`' ], + 'tiki_user_bookmarks_urls' => [ '`user`' ], + 'tiki_user_menus' => [ '`user`' ], + 'tiki_user_preferences' => [ '`user`' ], + 'tiki_user_tasks' => [ '`user`' ], + 'tiki_user_watches' => [ '`user`' ], + ]], +]], // STEP 5 -array( 'QUERY' => - array( 'SQL92' => array( +[ 'QUERY' => + [ 'SQL92' => [ "INSERT INTO `".BIT_DB_PREFIX."users_groups_map` (`group_id`, `user_id` ) VALUES ( -1, ".ANONYMOUS_USER_ID." )", - ), -)), + ], +], ], // STEP 2 -array( 'PHP' => ' +[ 'PHP' => ' global $gBitSystem, $gBitDb; $adminGroup = $gBitDb->GetOne( "SELECT `group_id` FROM `'.BIT_DB_PREFIX.'users_grouppermissions` where perm_name=\'bit_p_admin\'" ); if( empty( $adminGroup ) ) { @@ -320,70 +310,68 @@ array( 'PHP' => ' $gBitDb->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_groups_map` (`group_id`,`user_id`) VALUES ( $adminGroup, '.ROOT_USER_ID.' )" ); $gBitDb->query( "INSERT INTO `'.BIT_DB_PREFIX.'users_grouppermissions` (`perm_name`, `group_id`) VALUES( \'bit_p_admin\', $adminGroup )" ); } -' ), +' ], // STEP 4 -array( 'DATADICT' => array( -array( 'CREATEINDEX' => array( - 'tiki_sema_user_idx' => array( 'tiki_semaphores', '`user_id`', [] ), - 'tiki_user_prefs_idx' => array( 'tiki_user_preferences', '`user_id`', [] ), - 'tiki_user_prefs_un_idx' => array( 'tiki_user_preferences', '`user_id`,`pref_name`', array( 'UNIQUE' ) ), - 'users_groups_map_user_idx' => array( 'users_groups_map', '`user_id`', [] ), - 'users_groups_map_group_idx' => array( 'users_groups_map', '`group_id`', [] ), - 'users_groups_map_ug_idx' => array( 'users_groups_map', '`user_id`,`group_id`', array( 'UNIQUE' ) ), - 'users_groupperms_group_idx' => array( 'users_grouppermissions', '`group_id`', [] ), - 'users_groupperms_group_idx' => array( 'users_grouppermissions', '`group_id`,`perm_name`', array( 'UNIQUE' ) ), - 'users_groups_inc_group_idx' => array( 'users_groups_inclusion', '`group_id`', [] ), - 'users_groups_inc_gi_idx' => array( 'users_groups_inclusion', '`group_id`,`include_group_id`', array( 'UNIQUE' ) ), - 'users_groups_gi_idx' => array( 'users_groups', '`group_id`', array('UNIQUE') ), - )), -)), - +[ 'DATADICT' => [ +[ 'CREATEINDEX' => [ + 'tiki_sema_user_idx' => [ 'tiki_semaphores', '`user_id`', [] ], + 'tiki_user_prefs_idx' => [ 'tiki_user_preferences', '`user_id`', [] ], + 'tiki_user_prefs_un_idx' => [ 'tiki_user_preferences', '`user_id`,`pref_name`', [ 'UNIQUE' ] ], + 'users_groups_map_user_idx' => [ 'users_groups_map', '`user_id`', [] ], + 'users_groups_map_group_idx' => [ 'users_groups_map', '`group_id`', [] ], + 'users_groups_map_ug_idx' => [ 'users_groups_map', '`user_id`,`group_id`', [ 'UNIQUE' ] ], + 'users_groupperms_group_idx' => [ 'users_grouppermissions', '`group_id`', [] ], + 'users_groupperms_group_idx' => [ 'users_grouppermissions', '`group_id`,`perm_name`', [ 'UNIQUE' ] ], + 'users_groups_inc_group_idx' => [ 'users_groups_inclusion', '`group_id`', [] ], + 'users_groups_inc_gi_idx' => [ 'users_groups_inclusion', '`group_id`,`include_group_id`', [ 'UNIQUE' ] ], + 'users_groups_gi_idx' => [ 'users_groups', '`group_id`', ['UNIQUE'] ], + ]], +]], + ], +], - ) -), - -'BWR1' => array( - 'BWR2' => array( +'BWR1' => [ + 'BWR2' => [ // STEP 1 -array( 'DATADICT' => array( - array( 'CREATE' => array ( +[ 'DATADICT' => [ + [ 'CREATE' => [ 'users_favorites_map' => " favorite_content_id I4 PRIMARY, user_id I4 PRIMARY, map_position I4 CONSTRAINT ', CONSTRAINT `users_fav_user_ref` FOREIGN KEY (`user_id`) REFERENCES `".BIT_DB_PREFIX."users_users` (`user_id`)' ", - )), - array( 'RENAMETABLE' => array( + ]], + [ 'RENAMETABLE' => [ 'tiki_semaphores' => 'users_semaphores', 'users_objectpermissions' => 'users_object_permissions', 'users_grouppermissions' => 'users_group_permissions', 'tiki_user_watches' => 'users_watches', - )), - array( 'RENAMECOLUMN' => array( - 'users_watches' => array( - '`type`' => '`watch_type` C(200)' - ), - 'users_group_permissions' => array( - '`value`' => "`perm_value` C(1) default ''" - ), - 'users_users' => array( - '`password`' => '`user_password` C(32)' - ), - 'users_permissions' => array( - '`level`' => '`perm_level` C(80)' - ), - )), - array( 'DROPTABLE' => array( + ]], + [ 'RENAMECOLUMN' => [ + 'users_watches' => [ + '`type`' => '`watch_type` C(200)', + ], + 'users_group_permissions' => [ + '`value`' => "`perm_value` C(1) default ''", + ], + 'users_users' => [ + '`password`' => '`user_password` C(32)', + ], + 'users_permissions' => [ + '`level`' => '`perm_level` C(80)', + ], + ]], + [ 'DROPTABLE' => [ 'tiki_sessions', - 'users_groups_inclusion' - )), -)), + 'users_groups_inclusion', + ]], +]], -array( 'QUERY' => - array( 'SQL92' => array( +[ 'QUERY' => + [ 'SQL92' => [ "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`='p_shoutbox_view' WHERE `perm_name`='bit_p_view_shoutbox'", "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`='p_shoutbox_admin' WHERE `perm_name`='bit_p_admin_shoutbox'", "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`='p_shoutbox_post' WHERE `perm_name`='bit_p_post_shoutbox'", @@ -500,8 +488,6 @@ array( 'QUERY' => "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`='p_nexus_insert_item' WHERE `perm_name`='bit_p_insert_nexus_item'", "UPDATE `".BIT_DB_PREFIX."users_permissions` SET `perm_name`='p_nexus_create_menus' WHERE `perm_name`='bit_p_create_nexus_menus'", - - "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_shoutbox_view' WHERE `perm_name`='bit_p_view_shoutbox'", "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_shoutbox_admin' WHERE `perm_name`='bit_p_admin_shoutbox'", "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_shoutbox_post' WHERE `perm_name`='bit_p_post_shoutbox'", @@ -617,31 +603,30 @@ array( 'QUERY' => "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_articles_admin' WHERE `perm_name`='bit_p_admin_articles'", "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_nexus_insert_item' WHERE `perm_name`='bit_p_insert_nexus_item'", "UPDATE `".BIT_DB_PREFIX."users_group_permissions` SET `perm_name`='p_nexus_create_menus' WHERE `perm_name`='bit_p_create_nexus_menus'", - ) -)), + ], +], ], -array( 'DATADICT' => array( - array('ALTER' => array( - 'users_users' => array( - 'provpass_expires' => array( '`provpass_expires`', 'I8' ), - ), - 'users_groups' => array( +[ 'DATADICT' => [ + ['ALTER' => [ + 'users_users' => [ + 'provpass_expires' => [ '`provpass_expires`', 'I8' ], + ], + 'users_groups' => [ 'is_public' => '`is_public` C(1)' , 'after_registration_page' => '`after_registration_page` C(255)' , - ), - 'users_cnxn' => array( - 'assume_user_id' => array( '`assume_user_id`', 'I4' ), - ), - )), - ) -), + ], + 'users_cnxn' => [ + 'assume_user_id' => [ '`assume_user_id`', 'I4' ], + ], + ]], + ], +], -)), -); +], ], +]; if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) { $gBitSystem->registerUpgrade( USERS_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] ); } - ?> diff --git a/admin/user_activity.php b/admin/user_activity.php index 18a28a3..3940e69 100755 --- a/admin/user_activity.php +++ b/admin/user_activity.php @@ -20,10 +20,10 @@ if( !empty( $_REQUEST['ip'] ) ) { if( $userId = (int)BitBase::getParameter( $_REQUEST, 'user_id' ) ) { $listHash['user_id'] = $userId; - $gBitSmarty->assign( 'userInfo', $gBitUser->getUserInfo( array( 'user_id' => $userId ) ) ); + $gBitSmarty->assign( 'userInfo', $gBitUser->getUserInfo( [ 'user_id' => $userId ] ) ); } $gBitSmarty->assign( 'userActivity', $gBitUser->getUserActivity( $listHash )); $gBitSmarty->assign( 'listInfo', $listHash['listInfo'] ); -$gBitSystem->display( 'bitpackage:users/user_activity.tpl', 'User Activity' , array( 'display_mode' => 'admin' )); +$gBitSystem->display( 'bitpackage:users/user_activity.tpl', 'User Activity' , [ 'display_mode' => 'admin' ]); diff --git a/admin/users_import.php b/admin/users_import.php index 689c482..0c460be 100755 --- a/admin/users_import.php +++ b/admin/users_import.php @@ -110,5 +110,5 @@ if ( defined( 'ROLE_MODEL' ) ) { } // Display the template -$gBitSystem->display( 'bitpackage:users/users_import.tpl', (!empty( $title ) ? $title : 'Import Users' ) , array( 'display_mode' => 'admin' )); +$gBitSystem->display( 'bitpackage:users/users_import.tpl', (!empty( $title ) ? $title : 'Import Users' ) , [ 'display_mode' => 'admin' ]); ?> diff --git a/admin/verify_emails.php b/admin/verify_emails.php index 2078d61..9e614f6 100644 --- a/admin/verify_emails.php +++ b/admin/verify_emails.php @@ -6,11 +6,11 @@ // Initialization require_once( '../../kernel/includes/setup_inc.php' ); -if( $validatedGroup = $gBitSystem->getConfig( 'users_validate_email_group' ) ) { +if( $validatedGroup = $gBitSystem->getConfig( 'users_validate_email_group' ) ) { $gBitUser->verifyTicket(); $whereSql = ''; - $bindVars = array( $gBitSystem->getConfig('users_validate_email_group') ); + $bindVars = [ $gBitSystem->getConfig('users_validate_email_group') ]; if( !empty( $_REQUEST['start_user_id'] ) ) { $whereSql = " AND user_id>?"; $bindVars[] = $_REQUEST['start_user_id']; @@ -34,7 +34,5 @@ if( $validatedGroup = $gBitSystem->getConfig( 'users_validate_email_group' ) ) { print "<br/>\n"; flush(); } -} else { - } diff --git a/admin/verify_emails_role.php b/admin/verify_emails_role.php index a34becc..433cd6c 100644 --- a/admin/verify_emails_role.php +++ b/admin/verify_emails_role.php @@ -6,11 +6,10 @@ // Initialization require_once( '../../kernel/includes/setup_inc.php' ); - $gBitUser->verifyTicket(); $whereSql = ''; - $bindVars = array( $gBitSystem->getConfig('users_validate_email_role') ); + $bindVars = [ $gBitSystem->getConfig('users_validate_email_role') ]; if( !empty( $_REQUEST['start_user_id'] ) ) { $whereSql = " AND user_id>?"; $bindVars[] = $_REQUEST['start_user_id']; @@ -35,4 +34,3 @@ require_once( '../../kernel/includes/setup_inc.php' ); flush(); } - |
