summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlsces <lester@lsces.co.uk>2026-02-02 21:05:12 +0000
committerlsces <lester@lsces.co.uk>2026-02-02 21:05:12 +0000
commitbebc6163d8c123b646d068437e06954a745e9f6b (patch)
tree1201acd38954a623edfbc906bbbd3e0e217c4986
parent302401f8a856a16ea04b0f08c8facb22e4ebd719 (diff)
downloadmessages-bebc6163d8c123b646d068437e06954a745e9f6b.tar.gz
messages-bebc6163d8c123b646d068437e06954a745e9f6b.tar.bz2
messages-bebc6163d8c123b646d068437e06954a745e9f6b.zip
Restructure layout in line with namespace addition and PHP8.4 style rules
-rwxr-xr-x[-rw-r--r--]admin/admin_messages_inc.php1
-rwxr-xr-x[-rw-r--r--]admin/schema_inc.php0
-rw-r--r--admin/upgrade_inc.php91
-rwxr-xr-x[-rw-r--r--]broadcast.php12
-rwxr-xr-x[-rw-r--r--]compose.php25
-rwxr-xr-x[-rw-r--r--]contact.php8
-rwxr-xr-x[-rw-r--r--]icons/pkg_messages.gifbin1326 -> 1326 bytes
-rwxr-xr-x[-rw-r--r--]icons/pkg_messages.pngbin1859 -> 1859 bytes
-rwxr-xr-x[-rw-r--r--]includes/bit_setup_inc.php1
-rwxr-xr-x[-rw-r--r--]includes/classes/Messages.php14
-rwxr-xr-x[-rw-r--r--]includes/user_preferences_inc.php9
-rwxr-xr-x[-rw-r--r--]index.php0
-rwxr-xr-x[-rw-r--r--]message_box.php30
-rwxr-xr-x[-rw-r--r--]modules/mod_unread_messages.tpl0
-rwxr-xr-x[-rw-r--r--]read.php13
-rwxr-xr-x[-rw-r--r--]templates/admin_messages.tpl0
-rwxr-xr-x[-rw-r--r--]templates/broadcast.tpl0
-rwxr-xr-x[-rw-r--r--]templates/compose.tpl0
-rwxr-xr-x[-rw-r--r--]templates/contact.tpl0
-rwxr-xr-x[-rw-r--r--]templates/html_head_inc.tpl0
-rwxr-xr-x[-rw-r--r--]templates/index.php0
-rwxr-xr-x[-rw-r--r--]templates/mailbox.tpl0
-rwxr-xr-x[-rw-r--r--]templates/menu_messages_admin.tpl0
-rwxr-xr-x[-rw-r--r--]templates/message_notification.tpl0
-rwxr-xr-x[-rw-r--r--]templates/messages_nav.tpl0
-rwxr-xr-x[-rw-r--r--]templates/preferences_inc.tpl0
-rwxr-xr-x[-rw-r--r--]templates/read.tpl0
-rwxr-xr-x[-rw-r--r--]templates/user_preferences_inc.tpl0
28 files changed, 52 insertions, 152 deletions
diff --git a/admin/admin_messages_inc.php b/admin/admin_messages_inc.php
index 8f62d56..ba55556 100644..100755
--- a/admin/admin_messages_inc.php
+++ b/admin/admin_messages_inc.php
@@ -15,4 +15,3 @@ if( !empty( $_REQUEST['anonymous_settings'] ) ) {
}
$gBitSystem->setHelpInfo( 'Features', 'Settings', 'Help with the features settings' );
-?>
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 3630605..3630605 100644..100755
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
diff --git a/admin/upgrade_inc.php b/admin/upgrade_inc.php
deleted file mode 100644
index 836e93b..0000000
--- a/admin/upgrade_inc.php
+++ /dev/null
@@ -1,91 +0,0 @@
-<?php
-global $gBitSystem, $gUpgradeFrom, $gUpgradeTo;
-
-$upgrades = array(
- 'BONNIE' => array(
- 'BWR1' => array(
-
-// STEP 1
-array( 'DATADICT' => array(
- array( 'RENAMECOLUMN' => array(
- 'messu_messages' => array(
- '`msgId`' => '`msg_id` I4 AUTO',
- '`isRead`' => '`is_read` VARCHAR(1)',
- '`isReplied`' => '`is_replied` VARCHAR(1)',
- '`isFlagged`' => '`is_flagged` VARCHAR(1)',
- '`user_to`' => '`msg_to` X',
- '`user_cc`' => '`msg_cc` X',
- '`user_bcc`' => '`msg_bcc` X',
- ),
- )),
- array( 'ALTER' => array(
- 'messu_messages' => array(
- 'to_user_id' => array( '`to_user_id`', 'I4' ),
- 'from_user_id' => array( '`from_user_id`', 'I4' ),
- ),
- ))
-)),
-
-// STEP 3
-array( 'QUERY' =>
- array( 'SQL92' => array(
- "UPDATE `".BIT_DB_PREFIX."messu_messages` SET `to_user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."messu_messages`.`user`)",
- "UPDATE `".BIT_DB_PREFIX."messu_messages` SET `from_user_id`=(SELECT `user_id` FROM `".BIT_DB_PREFIX."users_users` WHERE `".BIT_DB_PREFIX."users_users`.`login`=`".BIT_DB_PREFIX."messu_messages`.`user_from`)",
- ),
-)),
-
-// STEP 4
-array( 'DATADICT' => array(
- array( 'DROPCOLUMN' => array(
- 'messu_messages' => array( '`user`', '`user_from`' ),
- )),
-)),
-
- )
- ),
-
-
-
-// next upgrade path
- 'BWR1' => array(
- 'BWR2' => array(
-
-array( 'DATADICT' => array(
- array( 'ALTER' => array(
- 'messu_messages' => array(
- 'group_id' => array( '`group_id`', 'I4' ),
- ),
- )),
- // de-tikify tables
- array( 'RENAMETABLE' => array(
- 'messu_messages' => 'messages',
- )),
- array( 'CREATE' => array (
- 'messages_system_map' => "
- msg_id I4,
- to_user_id I4 NOTNULL,
- is_read C(1),
- is_flagged C(1),
- is_replied C(1),
- priority I4,
- is_hidden C(1)
- CONSTRAINT ', CONSTRAINT `messages_system_message_ref` FOREIGN KEY (`msg_id`) REFERENCES `".BIT_DB_PREFIX."messages` (`msg_id`)'
- "
- )),
- array( 'RENAMECOLUMN' => array(
- 'messages' => array(
- '`date`' => '`msg_date` I8'
- ),
- )),
-)),
-
- )
- ),
-);
-
-if( isset( $upgrades[$gUpgradeFrom][$gUpgradeTo] ) ) {
- $gBitSystem->registerUpgrade( MESSAGES_PKG_NAME, $upgrades[$gUpgradeFrom][$gUpgradeTo] );
-}
-
-
-?>
diff --git a/broadcast.php b/broadcast.php
index 57eb60d..0c30dbf 100644..100755
--- a/broadcast.php
+++ b/broadcast.php
@@ -1,4 +1,5 @@
<?php
+
/**
* message package modules
*
@@ -12,11 +13,11 @@
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
-
-include_once( MESSAGES_PKG_CLASS_PATH.'Messages.php' );
+use Bitweaver\Messages\Messages;
+use Bitweaver\KernelTools;
if( !$gBitUser->isRegistered() ) {
- $gBitSmarty->fatalError( tra( "You are not logged in" ) );
+// $gBitSmarty->fatalError( KernelTools::tra( "You are not logged in" ) );
}
$gBitSystem->isPackageActive( 'messages', TRUE );
@@ -35,7 +36,7 @@ if( isset( $_REQUEST['send'] ) ) {
}
if( $gBitUser->isAdmin() ) {
- $pListHash = array('sort_mode' => 'group_id_asc');
+ $pListHash = [ 'sort_mode' => 'group_id_asc' ];
$groups = $gBitUser->getAllGroups( $pListHash );
} else {
$gBitUser->loadGroups();
@@ -44,5 +45,4 @@ if( $gBitUser->isAdmin() ) {
$gBitSmarty->assign( 'groups', $groups );
$gBitSmarty->assign( 'feedback', $feedback );
-$gBitSystem->display( 'bitpackage:messages/broadcast.tpl', NULL, array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:messages/broadcast.tpl', NULL, [ 'display_mode' => 'display' ]);
diff --git a/compose.php b/compose.php
index 4ef75ac..2ef3f96 100644..100755
--- a/compose.php
+++ b/compose.php
@@ -1,4 +1,5 @@
<?php
+
/**
* message package modules
*
@@ -16,11 +17,12 @@
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
-require_once( MESSAGES_PKG_CLASS_PATH.'Messages.php' );
+use Bitweaver\Messages\Messages;
+use Bitweaver\KernelTools;
if( !$gBitUser->isRegistered() ) {
- $gBitSmarty->assign('msg', tra("You are not logged in"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
+ $gBitSmarty->assign('msg', KernelTools::tra("You are not logged in"));
+ $gBitSystem->display( 'error.tpl' , NULL, [ 'display_mode' => 'display' ]);
die;
}
@@ -58,7 +60,7 @@ if( !empty( $_REQUEST['action']['reply'] ) || !empty( $_REQUEST['action']['reply
// Strip Re:Re:Re: from subject
if(isset($_REQUEST['action']['reply']) || isset($_REQUEST['action']['replyall'])) {
- $_REQUEST['subject'] = tra("Re: ").preg_replace("/^(".tra("Re: ").")+/i", "", $_REQUEST['subject']);
+ $_REQUEST['subject'] = KernelTools::tra("Re: ").preg_replace("/^(".KernelTools::tra("Re: ").")+/i", "", $_REQUEST['subject']);
}
$gBitSmarty->assign('to', $_REQUEST['to']);
@@ -70,14 +72,14 @@ $gBitSmarty->assign('priority', $_REQUEST['priority']);
$gBitSmarty->assign('sent', 0);
$feedback = array();
-$gBitSmarty->assignByRef( 'feedback', $feedback );
+$gBitSmarty->assign( 'feedback', $feedback );
if (isset($_REQUEST['replyto']) || isset($_REQUEST['replyallto'])) {
- $flagHash = array(
+ $flagHash = [
'msg_id' => $_REQUEST['msg_id'],
'act' => 'is_replied',
'actval' => 'y',
- );
+ ];
$messages->flagMessage( $flagHash );
}
@@ -99,7 +101,7 @@ if (isset($_REQUEST['send'])) {
if( !empty( $toUser ) ) {
$_REQUEST['to_login'] = $toUser;
if( $messages->postMessage( $_REQUEST ) ) {
- $feedback['success'][] = tra( "Message will be sent to: " ).' '.$toUser;
+ $feedback['success'][] = KernelTools::tra( "Message will be sent to: " ).' '.$toUser;
} else {
$feedback['error'][] = $messages->mErrors['compose'];
}
@@ -107,12 +109,11 @@ if (isset($_REQUEST['send'])) {
}
$gBitSmarty->assign('sent', 1);
} else {
- $feedback['error'][] = tra('ERROR: No valid users to send the message.');
+ $feedback['error'][] = KernelTools::tra('ERROR: No valid users to send the message.');
}
} else {
- $feedback['error'][] = tra( 'ERROR: Either the subject or body must contain text.' );
+ $feedback['error'][] = KernelTools::tra( 'ERROR: Either the subject or body must contain text.' );
}
}
-$gBitSystem->display( 'bitpackage:messages/compose.tpl', 'Compose Message' , array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:messages/compose.tpl', 'Compose Message' , [ 'display_mode' => 'display' ]);
diff --git a/contact.php b/contact.php
index 79082b4..affaaeb 100644..100755
--- a/contact.php
+++ b/contact.php
@@ -1,4 +1,5 @@
<?php
+
/**
* message package modules
*
@@ -16,21 +17,22 @@
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
-require_once( MESSAGES_PKG_CLASS_PATH.'Messages.php' );
+use Bitweaver\Messages\Messages;
+use Bitweaver\KernelTools;
$gBitSystem->verifyFeature( 'messages_site_contact' );
$messages = new Messages();
if( !empty( $_REQUEST['send'] )) {
if( empty( $_REQUEST['subject'] ) && empty( $_REQUEST['body'] ) ) {
- $gBitSystem->fatalError( tra( "Either a subject or a message body is required." ));
+ $gBitSystem->fatalError( KernelTools::tra( "Either a subject or a message body is required." ));
}
$postHash = $_REQUEST;
$postHash['to_login'] = $postHash['msg_to'] = $gBitSystem->getConfig( 'messages_contact_user' );
$messages->postMessage( $postHash );
- $feedback['success'] = tra( 'Your message was sent to' ).': '.$gBitSystem->getConfig( 'messages_contact_user' );
+ $feedback['success'] = KernelTools::tra( 'Your message was sent to' ).': '.$gBitSystem->getConfig( 'messages_contact_user' );
$gBitSmarty->assign( 'feedback', $feedback );
}
diff --git a/icons/pkg_messages.gif b/icons/pkg_messages.gif
index 42f080e..42f080e 100644..100755
--- a/icons/pkg_messages.gif
+++ b/icons/pkg_messages.gif
Binary files differ
diff --git a/icons/pkg_messages.png b/icons/pkg_messages.png
index 280fc92..280fc92 100644..100755
--- a/icons/pkg_messages.png
+++ b/icons/pkg_messages.png
Binary files differ
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php
index 5c5c2b5..38c9e5f 100644..100755
--- a/includes/bit_setup_inc.php
+++ b/includes/bit_setup_inc.php
@@ -15,7 +15,6 @@ define( 'MESSAGES_PKG_CLASS_PATH', BIT_ROOT_PATH . basename( $pRegisterHash['pac
$gBitSystem->registerPackage( $pRegisterHash );
if( $gBitSystem->isPackageActive( 'messages' ) && $gBitUser->hasPermission( 'p_messages_send' ) ) {
- require_once MESSAGES_PKG_CLASS_PATH . 'Messages.php';
$messages = new Messages();
$unreadMsgs = $messages->unreadMessages( $gBitUser->mUserId );
$gBitSmarty->assign( 'unreadMsgs', $unreadMsgs );
diff --git a/includes/classes/Messages.php b/includes/classes/Messages.php
index e53042e..104f02a 100644..100755
--- a/includes/classes/Messages.php
+++ b/includes/classes/Messages.php
@@ -229,8 +229,8 @@ class Messages extends BitBase {
// ====================== insane message mergin and sorting ======================
$sort_mode = $pListHash['sort_mode'];
$ret = [];
- $normalMessageCount = count($normalMessages);
- $systemMessageCount = count($systemMessages);
+ $normalMessageCount = \count($normalMessages);
+ $systemMessageCount = \count($systemMessages);
$normalMsg = $systemMsg = NULL;
if (strpos($sort_mode, '_asc') !== FALSE) {
$sortType = '_asc';
@@ -361,11 +361,7 @@ class Messages extends BitBase {
$bindVars[] = '%'.strtoupper( $pListHash['find'] ).'%';
}
- if( !empty( $pListHash['neighbour'] ) && $pListHash['neighbour'] == 'prev' ) {
- $query = "SELECT MAX(`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm WHERE `to_user_id`=? AND `msg_id` < ? $whereSql";
- } else {
- $query = "SELECT MIN(`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm WHERE `to_user_id`=? AND `msg_id` > ? $whereSql";
- }
+ $query = ( !empty( $pListHash['neighbour'] ) && $pListHash['neighbour'] == 'prev' ) ? "SELECT MAX(`msg_id`) FROM `" . BIT_DB_PREFIX . "messages` mm WHERE `to_user_id`=? AND `msg_id` < ? $whereSql" : "SELECT MIN(`msg_id`) FROM `" . BIT_DB_PREFIX . "messages` mm WHERE `to_user_id`=? AND `msg_id` > ? $whereSql";
$msg_id = $this->mDb->getOne( $query, $bindVars );
return( !empty( $msg_id ) ? $msg_id : FALSE );
@@ -403,9 +399,9 @@ class Messages extends BitBase {
// Standard user to user messages
$normalCount = $this->mDb->getOne( "select count( * ) from `".BIT_DB_PREFIX."messages` where `to_user_id`=? and `is_read`=?", [ $pUserId, 'n' ] );
// Broadcast messages where they have a messages_system_map row but is_read is not yet set
- $broadcastCount = $this->mDb->getOne("SELECT COUNT(mm.`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm INNER JOIN `".BIT_DB_PREFIX."messages_system_map` msm ON (mm.`msg_id` = msm.`msg_id` AND msm.`is_read` <> 'y' AND `is_hidden` <> 'y' AND msm.`to_user_id`= ?) WHERE mm.`to_user_id` = ? AND mm.`group_id` IN (SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `user_id`= ?) ", array($pUserId, ROOT_USER_ID, $pUserId));
+ $broadcastCount = $this->mDb->getOne("SELECT COUNT(mm.`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm INNER JOIN `".BIT_DB_PREFIX."messages_system_map` msm ON (mm.`msg_id` = msm.`msg_id` AND msm.`is_read` <> 'y' AND `is_hidden` <> 'y' AND msm.`to_user_id`= ?) WHERE mm.`to_user_id` = ? AND mm.`group_id` IN (SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `user_id`= ?) ", [ $pUserId, ROOT_USER_ID, $pUserId ]);
// Broadcast messages where they do not yet have a messages_system_map row
- $broadcastCount2 = $this->mDb->getOne("SELECT COUNT(mm.`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm WHERE mm.`to_user_id` = ? AND mm.`group_id` IN (SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `user_id` = ?) AND NOT EXISTS ( SELECT msm.`msg_id` FROM `".BIT_DB_PREFIX."messages_system_map` msm WHERE msm.`msg_id` = mm.`msg_id` AND msm.`to_user_id` = ?)", array(ROOT_USER_ID, $pUserId, $pUserId));
+ $broadcastCount2 = $this->mDb->getOne("SELECT COUNT(mm.`msg_id`) FROM `".BIT_DB_PREFIX."messages` mm WHERE mm.`to_user_id` = ? AND mm.`group_id` IN (SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `user_id` = ?) AND NOT EXISTS ( SELECT msm.`msg_id` FROM `".BIT_DB_PREFIX."messages_system_map` msm WHERE msm.`msg_id` = mm.`msg_id` AND msm.`to_user_id` = ?)", [ ROOT_USER_ID, $pUserId, $pUserId ]);
return $normalCount + $broadcastCount + $broadcastCount2;
}
diff --git a/includes/user_preferences_inc.php b/includes/user_preferences_inc.php
index eca829e..1a2d377 100644..100755
--- a/includes/user_preferences_inc.php
+++ b/includes/user_preferences_inc.php
@@ -10,9 +10,8 @@
$title = "User Messages";
if( isset( $_REQUEST['messprefs'] ) ) {
- $editUser->storePreference( 'messages_alert', !empty( $_REQUEST['messages_alert'] ) ? 'y' : 'n', USERS_PKG_NAME );
- $editUser->storePreference( 'messages_max_records', $_REQUEST['messages_max_records'], USERS_PKG_NAME );
- $editUser->storePreference( 'messages_min_priority', !empty( $_REQUEST['messages_min_priority'] ) ? $_REQUEST['messages_min_priority'] : NULL, USERS_PKG_NAME );
- $editUser->storePreference( 'messages_allow_messages', !empty( $_REQUEST['messages_allow_messages'] ) ? 'y' : 'n', USERS_PKG_NAME );
+ $editUser->storePreference( 'messages_alert', !empty( $_REQUEST['messages_alert'] ) ? 'y' : 'n' );
+ $editUser->storePreference( 'messages_max_records', $_REQUEST['messages_max_records'] );
+ $editUser->storePreference( 'messages_min_priority', !empty( $_REQUEST['messages_min_priority'] ) ? $_REQUEST['messages_min_priority'] : NULL );
+ $editUser->storePreference( 'messages_allow_messages', !empty( $_REQUEST['messages_allow_messages'] ) ? 'y' : 'n' );
}
-?>
diff --git a/index.php b/index.php
index 3e305fe..3e305fe 100644..100755
--- a/index.php
+++ b/index.php
diff --git a/message_box.php b/message_box.php
index 5a84d2b..177f876 100644..100755
--- a/message_box.php
+++ b/message_box.php
@@ -1,4 +1,5 @@
<?php
+
/**
* message package modules
*
@@ -16,10 +17,12 @@
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
-require_once( MESSAGES_PKG_CLASS_PATH.'Messages.php' );
+use Bitweaver\Messages\Messages;
+use Bitweaver\KernelTools;
+
if( !$gBitUser->isRegistered() ) {
- $gBitSmarty->assign('msg', tra("You are not logged in"));
+ $gBitSmarty->assign('msg', KernelTools::tra("You are not logged in"));
$gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
die;
}
@@ -35,11 +38,11 @@ $max_records = $gBitSystem->getConfig( 'max_records', 20 );
if (isset($_REQUEST["mark"]) && isset($_REQUEST["msg"])) {
foreach( array_keys( $_REQUEST["msg"] ) as $msg_id ) {
$parts = explode( '_', $_REQUEST['action'] );
- $flagHash = array(
- 'msg_id' => $msg_id ,
- 'act' => $parts[0].'_'.$parts[1],
+ $flagHash = [
+ 'msg_id' => $msg_id,
+ 'act' => "$parts[0]_$parts[1]",
'actval' => $parts[2],
- );
+ ];
$messages->flagMessage( $flagHash );
}
}
@@ -60,22 +63,13 @@ if( !empty( $_REQUEST['filter'] ) ) {
}
}
-if ( empty( $_REQUEST["sort_mode"] ) ) {
- $_REQUEST['sort_mode'] = 'msg_date_desc';
-} else {
- $_REQUEST['sort_mode'] = $_REQUEST["sort_mode"];
-}
+$_REQUEST['sort_mode'] = ( empty( $_REQUEST["sort_mode"] ) ) ? 'msg_date_desc' : $_REQUEST["sort_mode"];
-if (isset($_REQUEST["find"])) {
- $find = $_REQUEST["find"];
-} else {
- $find = '';
-}
+$find = ( isset( $_REQUEST["find"] ) ) ? $_REQUEST["find"] : '';
$listHash = $_REQUEST;
$items = $messages->getList( $listHash );
$gBitSmarty->assign( 'items', $items );
$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );
-$gBitSystem->display( 'bitpackage:messages/mailbox.tpl', 'Message box' , array( 'display_mode' => 'display' ));
-?>
+$gBitSystem->display( 'bitpackage:messages/mailbox.tpl', 'Message box' , [ 'display_mode' => 'display' ]);
diff --git a/modules/mod_unread_messages.tpl b/modules/mod_unread_messages.tpl
index 5b18442..5b18442 100644..100755
--- a/modules/mod_unread_messages.tpl
+++ b/modules/mod_unread_messages.tpl
diff --git a/read.php b/read.php
index fe68231..bbef5aa 100644..100755
--- a/read.php
+++ b/read.php
@@ -1,4 +1,5 @@
<?php
+
/**
* message package modules
*
@@ -16,10 +17,12 @@
* required setup
*/
require_once( '../kernel/includes/setup_inc.php' );
-require_once( MESSAGES_PKG_CLASS_PATH.'Messages.php' );
+use Bitweaver\Messages\Messages;
+use Bitweaver\KernelTools;
+
if( !$gBitUser->isRegistered() ) {
- $gBitSystem->fatalError( tra( "You are not logged in" ) );
+ $gBitSystem->fatalError( KernelTools::tra( "You are not logged in" ) );
}
$gBitSystem->isPackageActive( 'messages' );
@@ -47,11 +50,11 @@ $gBitSmarty->assign('next', $next);
$gBitSmarty->assign('prev', $prev);
// Mark the message as read
-$flagHash = array(
+$flagHash = [
'msg_id' => $_REQUEST['msg_id'],
'act' => 'is_read',
'actval' => 'y',
-);
+];
$messages->flagMessage( $flagHash );
// Get the message and assign its data to template vars
@@ -59,5 +62,3 @@ $msg = $messages->getMessage( $gBitUser->mUserId, $_REQUEST['msg_id']);
$gBitSmarty->assign( 'msg', $msg );
$gBitSystem->display( 'bitpackage:messages/read.tpl', NULL, array( 'display_mode' => 'display' ));
-
-?>
diff --git a/templates/admin_messages.tpl b/templates/admin_messages.tpl
index 75ba08f..75ba08f 100644..100755
--- a/templates/admin_messages.tpl
+++ b/templates/admin_messages.tpl
diff --git a/templates/broadcast.tpl b/templates/broadcast.tpl
index 5654afd..5654afd 100644..100755
--- a/templates/broadcast.tpl
+++ b/templates/broadcast.tpl
diff --git a/templates/compose.tpl b/templates/compose.tpl
index a4d7b0f..a4d7b0f 100644..100755
--- a/templates/compose.tpl
+++ b/templates/compose.tpl
diff --git a/templates/contact.tpl b/templates/contact.tpl
index 96a5dec..96a5dec 100644..100755
--- a/templates/contact.tpl
+++ b/templates/contact.tpl
diff --git a/templates/html_head_inc.tpl b/templates/html_head_inc.tpl
index 08dd42d..08dd42d 100644..100755
--- a/templates/html_head_inc.tpl
+++ b/templates/html_head_inc.tpl
diff --git a/templates/index.php b/templates/index.php
index 3e305fe..3e305fe 100644..100755
--- a/templates/index.php
+++ b/templates/index.php
diff --git a/templates/mailbox.tpl b/templates/mailbox.tpl
index a8a9e64..a8a9e64 100644..100755
--- a/templates/mailbox.tpl
+++ b/templates/mailbox.tpl
diff --git a/templates/menu_messages_admin.tpl b/templates/menu_messages_admin.tpl
index a2ee6d6..a2ee6d6 100644..100755
--- a/templates/menu_messages_admin.tpl
+++ b/templates/menu_messages_admin.tpl
diff --git a/templates/message_notification.tpl b/templates/message_notification.tpl
index 56fa855..56fa855 100644..100755
--- a/templates/message_notification.tpl
+++ b/templates/message_notification.tpl
diff --git a/templates/messages_nav.tpl b/templates/messages_nav.tpl
index f8aa757..f8aa757 100644..100755
--- a/templates/messages_nav.tpl
+++ b/templates/messages_nav.tpl
diff --git a/templates/preferences_inc.tpl b/templates/preferences_inc.tpl
index 0388191..0388191 100644..100755
--- a/templates/preferences_inc.tpl
+++ b/templates/preferences_inc.tpl
diff --git a/templates/read.tpl b/templates/read.tpl
index e496809..e496809 100644..100755
--- a/templates/read.tpl
+++ b/templates/read.tpl
diff --git a/templates/user_preferences_inc.tpl b/templates/user_preferences_inc.tpl
index 6304990..6304990 100644..100755
--- a/templates/user_preferences_inc.tpl
+++ b/templates/user_preferences_inc.tpl