summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-03-27 15:25:22 +0000
committerlsces <lester@lsces.co.uk>2026-03-27 15:25:22 +0000
commitffeb8d9f82705f35372bf324f56ba9dae44eed2c (patch)
tree1b8756d56d76197e7b35fa7c71606937e618b6ba
parent58a06634259893011a912c380ab78cf3c1bdc10e (diff)
downloadusers-ffeb8d9f82705f35372bf324f56ba9dae44eed2c.tar.gz
users-ffeb8d9f82705f35372bf324f56ba9dae44eed2c.tar.bz2
users-ffeb8d9f82705f35372bf324f56ba9dae44eed2c.zip
KernelTools usage
-rwxr-xr-xadmin/assign_role_user.php5
-rwxr-xr-xadmin/assign_user.php5
-rwxr-xr-xadmin/edit_group.php23
-rwxr-xr-xadmin/permissions.php8
-rwxr-xr-xadmin/users_import.php5
-rwxr-xr-xbookmark.php13
-rwxr-xr-xincludes/module_controls_inc.php8
-rwxr-xr-xmodules/mod_user_pages.php5
-rwxr-xr-xmy_groups.php21
-rwxr-xr-xusers_rss.php11
-rwxr-xr-xwatches.php4
11 files changed, 61 insertions, 47 deletions
diff --git a/admin/assign_role_user.php b/admin/assign_role_user.php
index 4178a65..29d4927 100755
--- a/admin/assign_role_user.php
+++ b/admin/assign_role_user.php
@@ -7,18 +7,19 @@
// ASSIGN USER TO ROLES
// Initialization
require_once( '../../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
$gBitSystem->verifyPermission( 'p_users_admin' );
if (!$gBitUser->userExists( array( 'user_id' => $_REQUEST["assign_user"] ) ) ) {
- $gBitSystem->fatalError( tra( "User doesnt exist" ));
+ $gBitSystem->fatalError( KernelTools::tra( "User doesnt exist" ));
}
$assignUser = new RolePermUser( $_REQUEST["assign_user"] );
$assignUser->load( true );
if( $assignUser->isAdmin() && !$gBitUser->isAdmin() ) {
- $gBitSystem->fatalError( tra( 'You cannot modify a system administrator.' ));
+ $gBitSystem->fatalError( KernelTools::tra( 'You cannot modify a system administrator.' ));
}
if( isset( $_REQUEST["action"] ) ) {
diff --git a/admin/assign_user.php b/admin/assign_user.php
index 73044fc..80757b3 100755
--- a/admin/assign_user.php
+++ b/admin/assign_user.php
@@ -7,11 +7,12 @@
// ASSIGN USER TO GROUPS
// Initialization
require_once( '../../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
$gBitSystem->verifyPermission( 'p_users_admin' );
if (!$gBitUser->userExists( array( 'user_id' => $_REQUEST["assign_user"] ) ) ) {
- $gBitSystem->fatalError( tra( "User doesnt exist" ));
+ $gBitSystem->fatalError( KernelTools::tra( "User doesnt exist" ));
}
$assignUser = new BitPermUser( $_REQUEST["assign_user"] );
@@ -19,7 +20,7 @@ $assignUser->setCacheableObject( false );
$assignUser->load( true );
if( $assignUser->isAdmin() && !$gBitUser->isAdmin() ) {
- $gBitSystem->fatalError( tra( 'You cannot modify a system administrator.' ));
+ $gBitSystem->fatalError( KernelTools::tra( 'You cannot modify a system administrator.' ));
}
if( isset( $_REQUEST["action"] ) ) {
diff --git a/admin/edit_group.php b/admin/edit_group.php
index 5adaf6d..fe5bcec 100755
--- a/admin/edit_group.php
+++ b/admin/edit_group.php
@@ -5,6 +5,7 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// Initialization
require_once( '../../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
// PERMISSIONS: NEEDS admin
$gBitSystem->verifyPermission( 'p_users_admin' );
@@ -31,12 +32,12 @@ if( !empty( $_REQUEST["cancel"] ) ) {
if( isset( $_REQUEST["confirm"] ) ) {
$gBitUser->batchAssignUsersToGroup( $_REQUEST['batch_assign'] );
} else {
- $gBitSystem->setBrowserTitle( tra( 'Confirm Batch Group Assignment' ) );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Confirm Batch Group Assignment' ) );
$formHash['batch_assign'] = $_REQUEST["batch_assign"];
$msgHash = array(
- 'label' => tra( 'Batch Assign Users to Group' ),
+ 'label' => KernelTools::tra( 'Batch Assign Users to Group' ),
'confirm_item' => $groupInfo['group_name'],
- 'warning' => tra( 'This will assign every user on the site to the group' ).' <strong>'.$groupInfo['group_name'].'</strong>',
+ 'warning' => KernelTools::tra( 'This will assign every user on the site to the group' ).' <strong>'.$groupInfo['group_name'].'</strong>',
);
$gBitSystem->confirmDialog( $formHash,$msgHash );
}
@@ -46,7 +47,7 @@ if( !empty( $_REQUEST["cancel"] ) ) {
$groupMembers = $gBitUser->getGroupUsers( $_REQUEST["members"] );
$gBitSmarty->assign( 'groupMembers', $groupMembers );
$mid = "bitpackage:users/group_list_members.tpl";
- $gBitSystem->setBrowserTitle( tra( 'Group Members' ).': '.$groupInfo['group_name'] );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Group Members' ).': '.$groupInfo['group_name'] );
} elseif( isset($_REQUEST["save"] ) ) {
if( empty($_REQUEST["name"] ) ) {
$_REQUEST["name"] = $_REQUEST["olgroup"];
@@ -79,10 +80,10 @@ if( !empty( $_REQUEST["cancel"] ) ) {
$successMsg = "The group ".$groupInfo['group_name']." was deleted.";
unset( $_REQUEST['group_id'] );
} else {
- $gBitSystem->setBrowserTitle( tra('Delete group') );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Delete group') );
$msgHash = array(
- 'confirm_item' => tra( 'Are you sure you want to permantly remove the group' )." <strong>$groupInfo[group_name]</strong>".'?',
- 'warning' => tra( 'This cannot be undone.' ),
+ '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 );
}
@@ -105,7 +106,7 @@ if( !empty( $_REQUEST["cancel"] ) ) {
$successMsg = 'The permission '.$_REQUEST['permission'].' was removed successflly. <a href="'.USERS_PKG_URL.'admin/edit_group.php?action=assign&amp;perm='.$_REQUEST['permission'].'&amp;group_id='.$_REQUEST['group_id'].'&amp;pacakge='.$_REQUEST['package'].'">Undo last action.</a>';
} elseif( $_REQUEST["action"] == 'create' ) {
$mid = 'bitpackage:users/admin_group_edit.tpl';
- $gBitSystem->setBrowserTitle( tra( 'Create New Group' ) );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Create New Group' ) );
} elseif ($_REQUEST["action"] == 'assign') {
$gBitUser->assignPermissionToGroup($_REQUEST["perm"], $_REQUEST['group_id']);
}
@@ -127,7 +128,7 @@ if( !empty( $_REQUEST['group_id'] ) || (!empty( $_REQUEST["action"] ) && $_REQUE
$gBitSmarty->assign( 'contentList', $cList );
$gBitSmarty->assign( 'contentSelect', $contentSelect );
*/
- $contentTypes = array( '' => tra( 'All Content' ) );
+ $contentTypes = array( '' => KernelTools::tra( 'All Content' ) );
foreach( $gLibertySystem->mContentTypes as $cType ) {
$contentTypes[$cType['content_type_guid']] = $gLibertySystem->getContentTypeName( $cType['content_type_guid'] );
}
@@ -148,10 +149,10 @@ if( empty( $mid ) ) {
$gBitSmarty->assign( 'groupInfo', $groupInfo );
$gBitSmarty->assign( 'allPerms', $allPerms );
- $gBitSystem->setBrowserTitle( tra( 'Admininster Group' ).': '.$groupInfo['group_name'] );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Admininster Group' ).': '.$groupInfo['group_name'] );
$mid = 'bitpackage:users/admin_group_edit.tpl';
} else {
- $gBitSystem->setBrowserTitle( tra( 'Admin List Groups' ) );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Admin List Groups' ) );
$_REQUEST['group_id'] = 0;
$mid = 'bitpackage:users/admin_groups_list.tpl';
}
diff --git a/admin/permissions.php b/admin/permissions.php
index 909a3b3..2f6629f 100755
--- a/admin/permissions.php
+++ b/admin/permissions.php
@@ -1,5 +1,7 @@
<?php
require_once( '../../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
+
$gBitSystem->verifyPermission( 'p_admin' );
$feedback = [];
@@ -25,14 +27,14 @@ if( !empty( $_REQUEST['save'] )) {
}
}
- $feedback['success'] = tra( "The permissions were successfully added to the requested groups." );
+ $feedback['success'] = KernelTools::tra( "The permissions were successfully added to the requested groups." );
// we need to update the groups list
$allGroups = $gBitUser->getAllGroups( $listHash );
}
// Check to see if we have unassigned permissions
if(( $unassignedPerms = $gBitUser->getUnassignedPerms() )) {
- $feedback['warning'] = tra( 'You have some permissions that are not assigned to any group. You need to assign these to at least one group each.' );
+ $feedback['warning'] = KernelTools::tra( 'You have some permissions that are not assigned to any group. You need to assign these to at least one group each.' );
$gBitSmarty->assign( 'unassignedPerms', $unassignedPerms );
}
@@ -42,5 +44,5 @@ $gBitSmarty->assign( 'permPackages', $gBitUser->getPermissionPackages() );
$gBitSmarty->assign( 'feedback', $feedback );
$gBitSmarty->assign( 'contentWithPermissions', LibertyContent::getContentWithPermissionsList() );
-$gBitSystem->display( 'bitpackage:users/admin_permissions.tpl', tra( 'Permission Maintenance' ), array( 'display_mode' => 'admin' ));
+$gBitSystem->display( 'bitpackage:users/admin_permissions.tpl', KernelTools::tra( 'Permission Maintenance' ), array( 'display_mode' => 'admin' ));
?>
diff --git a/admin/users_import.php b/admin/users_import.php
index 2dd7e2a..689c482 100755
--- a/admin/users_import.php
+++ b/admin/users_import.php
@@ -5,6 +5,7 @@
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
// Initialization
require_once( '../../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
$gBitSystem->verifyPermission( 'p_users_admin' );
@@ -25,7 +26,7 @@ if( isset( $_REQUEST["batchimport"])) {
// is the file a valid CSV file?
if( empty( $fields[0] ) ) {
- $gBitSystem->fatalError( tra( "The file is not a CSV file or has not a correct syntax" ));
+ $gBitSystem->fatalError( KernelTools::tra( "The file is not a CSV file or has not a correct syntax" ));
}
//now load the users in a table
@@ -41,7 +42,7 @@ if( isset( $_REQUEST["batchimport"])) {
// were there any users in the list?
if( !is_array( $userRecords ) ) {
- $gBitSystem->fatalError( tra( "No records were found. Check the file please!" ));
+ $gBitSystem->fatalError( KernelTools::tra( "No records were found. Check the file please!" ));
}
// Process user array
$added = 0;
diff --git a/bookmark.php b/bookmark.php
index 7ebfe2e..cc78ed3 100755
--- a/bookmark.php
+++ b/bookmark.php
@@ -11,6 +11,7 @@
* required setup
*/
require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
$statusCode = 205;
$error = true;
@@ -29,12 +30,12 @@ if( $gBitUser->isRegistered() ){
case 'add':
$gBitUser->storeFavorite( $_REQUEST['content_id'] );
$bookmarkState = 1;
- $msg = tra( 'This content has been added to your favorites' );
+ $msg = KernelTools::tra( 'This content has been added to your favorites' );
break;
case 'remove':
$gBitUser->expungeFavorite( $_REQUEST['content_id'] );
$bookmarkState = 0;
- $msg = tra( 'This content has been removed from your favorites' );
+ $msg = KernelTools::tra( 'This content has been removed from your favorites' );
break;
}
$gBitSmarty->assign( 'bookmarkState', $bookmarkState );
@@ -42,18 +43,18 @@ if( $gBitUser->isRegistered() ){
$error = false;
}else{
$statusCode = 401;
- $msg = tra( 'You can not bookmark this type of content, bookmarking denied' );
+ $msg = KernelTools::tra( 'You can not bookmark this type of content, bookmarking denied' );
}
}else{
$statusCode = 401;
- $msg = tra( 'You do not have permission to view this content, bookmarking denied' );
+ $msg = KernelTools::tra( 'You do not have permission to view this content, bookmarking denied' );
}
}else{
$statusCode = 400;
- $msg = tra( 'No content was specified to bookmark' );
+ $msg = KernelTools::tra( 'No content was specified to bookmark' );
}
}else{
- $msg = tra( 'You must be a registered user to bookmark content' );
+ $msg = KernelTools::tra( 'You must be a registered user to bookmark content' );
}
$gBitSmarty->assign( 'statusCode', $statusCode );
diff --git a/includes/module_controls_inc.php b/includes/module_controls_inc.php
index 3ef6fdc..fef85ee 100755
--- a/includes/module_controls_inc.php
+++ b/includes/module_controls_inc.php
@@ -11,22 +11,24 @@
/**
* Initialization
*/
+use Bitweaver\KernelTools;
+
$check_req = (isset($_REQUEST["mc_unassign"])
|| isset($_REQUEST["mc_up"])
|| isset($_REQUEST["mc_down"])
|| isset($_REQUEST["mc_move"]));
if (!$gBitUser->hasPermission( 'p_tidbits_configure_modules' ) && $check_req) {
- $gBitSmarty->assign('msg', tra("You dont have permission to use this feature"));
+ $gBitSmarty->assign('msg', KernelTools::tra( "You dont have permission to use this feature" ));
$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
die;
}
if ($site_user_assigned_modules != 'y' && $check_req) {
- $gBitSmarty->assign('msg', tra("This feature is disabled").": site_user_assigned_modules");
+ $gBitSmarty->assign('msg', KernelTools::tra( "This feature is disabled").": site_user_assigned_modules" );
$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
die;
}
if ( !$gBitUser->isRegistered() && $check_req) {
- $gBitSmarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSmarty->assign('msg', KernelTools::tra( "You must log in to use this feature" ));
$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
die;
}
diff --git a/modules/mod_user_pages.php b/modules/mod_user_pages.php
index 9ac19cb..4bb6c4d 100755
--- a/modules/mod_user_pages.php
+++ b/modules/mod_user_pages.php
@@ -8,6 +8,7 @@
* @subpackage modules
*/
+use Bitweaver\KernelTools;
global $gQueryUser, $gBitUser, $module_rows, $module_params, $gLibertySystem, $module_title;
@@ -19,11 +20,11 @@ if( !empty( $gQueryUser->mUserId ) ) {
if( empty( $module_title ) ) {
if( !empty( $module_params['content_type_guid'] ) && !empty( $gLibertySystem->mContentTypes[$module_params['content_type_guid']] ) ) {
- $title = tra( "Last Changes" ).': '.$gLibertySystem->getContentTypeName( $module_params['content_type_guid'], true );
+ $title = KernelTools::tra( "Last Changes" ).': '.$gLibertySystem->getContentTypeName( $module_params['content_type_guid'], true );
$gBitSmarty->assign( 'contentType', $module_params['content_type_guid'] );
} else {
$gBitSmarty->assign( 'contentType', false );
- $title = tra( "Last Changes" );
+ $title = KernelTools::tra( "Last Changes" );
}
$gBitSmarty->assign( 'moduleTitle', $title );
}
diff --git a/my_groups.php b/my_groups.php
index 6663426..341fc1b 100755
--- a/my_groups.php
+++ b/my_groups.php
@@ -12,12 +12,13 @@
* required setup
*/
require_once '../kernel/includes/setup_inc.php';
+use Bitweaver\KernelTools;
global $gBitUser, $gBitSystem;
// PERMISSIONS: registered user required
if ( !$gBitUser->isRegistered() ) {
- $gBitSystem->fatalError( tra( "You are not logged in." ));
+ $gBitSystem->fatalError( KernelTools::tra( "You are not logged in." ));
}
if( !empty( $_REQUEST["cancel"] ) ) {
@@ -45,7 +46,7 @@ if ( $gBitUser->hasPermission('p_users_create_personal_groups' ) ) {
$_REQUEST["name"] = $_REQUEST["olgroup"];
}
if( $gBitUser->storeGroup( $_REQUEST ) ) {
- $successMsg = tra("Group changes were saved sucessfully.");
+ $successMsg = KernelTools::tra( "Group changes were saved sucessfully." );
} else {
$errorMsg = $gBitUser->mErrors['groups'];
}
@@ -69,25 +70,25 @@ if ( $gBitUser->hasPermission('p_users_create_personal_groups' ) ) {
// Process a form to remove a group
if( $_REQUEST["action"] == 'delete' ) {
if( $gBitUser->getDefaultGroup( $_REQUEST['group_id'] ) ) {
- $errorMsg = tra("You cannot remove this group, as it is currently set as your 'Default' group");
+ $errorMsg = KernelTools::tra( "You cannot remove this group, as it is currently set as your 'Default' group" );
} else {
$gBitUser->expungeGroup( $_REQUEST['group_id'] );
- $successMsg = tra("The group was deleted.");
+ $successMsg = KernelTools::tra( "The group was deleted.");
unset( $_REQUEST['group_id'] );
}
// remove a permission from a group
} elseif ($_REQUEST["action"] == 'remove') {
$gBitUser->removePermissionFromGroup( $_REQUEST["permission"], $_REQUEST['group_id'] );
- $successMsg = tra("Permission Removed");
+ $successMsg = KernelTools::tra( "Permission Removed");
$mid = 'bitpackage:users/my_group_edit.tpl';
// Create a new group
} elseif( $_REQUEST["action"] == 'create' ) {
- $gBitSystem->setBrowserTitle( tra('Create New Group') );
+ $gBitSystem->setBrowserTitle( KernelTools::tra( 'Create New Group') );
$mid = 'bitpackage:users/my_group_edit.tpl';
// Assign a permission to a group
} elseif ($_REQUEST["action"] == 'assign') {
$gBitUser->assignPermissionToGroup($_REQUEST["perm"], $_REQUEST['group_id']);
- $successMsg = tra("Permission Assigned");
+ $successMsg = KernelTools::tra( "Permission Assigned" );
$mid = 'bitpackage:users/my_group_edit.tpl';
}
// Search for users to add
@@ -103,7 +104,7 @@ if ( $gBitUser->hasPermission('p_users_create_personal_groups' ) ) {
$gBitUser->addUserToGroup( $_REQUEST['assignuser'], $_REQUEST['group_id'] );
}
else {
- $errorMsg = tra("You can not assign users to this group.");
+ $errorMsg = KernelTools::tra( "You can not assign users to this group." );
}
}
$mid = 'bitpackage:users/my_group_edit.tpl';
@@ -137,10 +138,10 @@ if ( ( !empty( $_REQUEST['add_public_group'] ) || !empty( $_REQUEST['remove_publ
$groupInfo = $gBitUser->getGroupInfo( $_REQUEST['public_group_id'] );
if ( empty($groupInfo) || $groupInfo['is_public'] != 'y' ) {
if (empty($_REQUEST['add_public_group'])) {
- $errorMsg[] = tra("You can't join this group.");
+ $errorMsg[] = KernelTools::tra( "You can't join this group." );
}
else {
- $errorMsg[] = tra("You can't leave this group.");
+ $errorMsg[] = KernelTools::tra( "You can't leave this group." );
}
} elseif ( !empty( $_REQUEST['add_public_group'] ) ) {
$gBitUser->addUserToGroup( $gBitUser->mUserId, $_REQUEST['public_group_id'] );
diff --git a/users_rss.php b/users_rss.php
index c730f8c..e56cc6f 100755
--- a/users_rss.php
+++ b/users_rss.php
@@ -13,6 +13,7 @@
// ensure that we use absolute URLs everywhere
$_REQUEST['uri_mode'] = true;
require_once "../kernel/includes/setup_inc.php";
+use Bitweaver\KernelTools;
$gBitSystem->verifyPackage( 'rss' );
$gBitSystem->verifyFeature( 'users_rss' );
@@ -44,7 +45,7 @@ if( !$gBitUser->hasPermission( 'p_users_view_user_list' ) ) {
foreach( $feeds as $feed ) {
$item = new FeedItem();
- $item->title = tra( "New user registration" ).": ".$feed['login'];
+ $item->title = KernelTools::tra( "New user registration" ).": ".$feed['login'];
$item->link = $gBitUser->getDisplayUrl( $feed['login'] );
$item->description = '';
@@ -53,13 +54,13 @@ if( !$gBitUser->hasPermission( 'p_users_view_user_list' ) ) {
$item->description .= '<img alt="user portrait" title="'.$feed['login'].'" src="'.$feed['thumbnail_url'].'" /><br />';
}
if( !empty( $feed['real_name'] ) ) {
- $item->description .= tra( "Real Name" ).": ".$feed['real_name'].'<br />';
+ $item->description .= KernelTools::tra( "Real Name" ).": ".$feed['real_name'].'<br />';
}
- $item->description .= tra( "Login" ).': <a href="'.$gBitUser->getDisplayUrl( $feed['login'] ).'">'.$feed['login'].'</a><br />';
+ $item->description .= KernelTools::tra( "Login" ).': <a href="'.$gBitUser->getDisplayUrl( $feed['login'] ).'">'.$feed['login'].'</a><br />';
if( $gBitUser->hasPermission( 'p_users_admin' ) ) {
- $item->description .= tra( "Email Address" ).': <a href="mailto:'.$feed['email'].'">'.$feed['email'].'</a><br />';
+ $item->description .= KernelTools::tra( "Email Address" ).': <a href="mailto:'.$feed['email'].'">'.$feed['email'].'</a><br />';
}
- $item->description .= tra( "Member Since" ).": ".smarty_modifier_bit_short_datetime( $feed['registration_date'] ).'<br />';
+ $item->description .= KernelTools::tra( "Member Since" ).": ".smarty_modifier_bit_short_datetime( $feed['registration_date'] ).'<br />';
$item->date = ( int )$feed['registration_date'];
$item->source = BIT_BASE_URI;
diff --git a/watches.php b/watches.php
index 61d5346..1a622ae 100755
--- a/watches.php
+++ b/watches.php
@@ -12,9 +12,11 @@
* required setup
*/
include_once( '../kernel/includes/setup_inc.php' );
+use Bitweaver\KernelTools;
+
$user = $gBitUser->mUserId;
if (!$user) {
- $gBitSmarty->assign('msg', tra("You must log in to use this feature"));
+ $gBitSmarty->assign('msg', KernelTools::tra( "You must log in to use this feature" ));
$gBitSystem->display( 'error.tpl' , null, array( 'display_mode' => 'display' ));
die;
}