summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xadmin/schema_inc.php3
-rwxr-xr-xbroadcast.php2
-rwxr-xr-xcompose.php4
-rwxr-xr-xcontact.php2
-rwxr-xr-xincludes/bit_setup_inc.php1
-rwxr-xr-xincludes/classes/Messages.php16
-rwxr-xr-xindex.php2
-rwxr-xr-xmessage_box.php3
-rwxr-xr-xread.php3
-rwxr-xr-xtemplates/index.php2
10 files changed, 14 insertions, 24 deletions
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index 3630605..0a2675f 100755
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -30,7 +30,7 @@ $tables = [
priority I4,
is_hidden C(1)
CONSTRAINT ', CONSTRAINT `messages_system_message_ref` FOREIGN KEY (`msg_id`) REFERENCES `" . BIT_DB_PREFIX . "messages` (`msg_id`)'
-"
+",
// CONSTRAINT ', CONSTRAINT messages_to_user_ref FOREIGN KEY (to_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id)
// , CONSTRAINT messages_from_user_ref FOREIGN KEY (from_user_id) REFERENCES `".BIT_DB_PREFIX."users_users` (user_id)'
@@ -49,7 +49,6 @@ $gBitInstaller->registerPackageInfo( MESSAGES_PKG_NAME, [
'requirements' => 'If you are using MySQL, at least version 4.1',
] );
-
// ### Default User Permissions
$gBitInstaller->registerUserPermissions( MESSAGES_PKG_NAME, [
[ 'p_messages_send', 'Can use the messaging system', 'registered', MESSAGES_PKG_NAME ],
diff --git a/broadcast.php b/broadcast.php
index 0c30dbf..cb01a88 100755
--- a/broadcast.php
+++ b/broadcast.php
@@ -25,7 +25,7 @@ $gBitSystem->verifyPermission( 'p_messages_broadcast' );
$messages = new Messages();
-$feedback = array();
+$feedback = [];
if( isset( $_REQUEST['send'] ) ) {
if( $messages->postSystemMessage( $_REQUEST ) ) {
diff --git a/compose.php b/compose.php
index 2ef3f96..a230a73 100755
--- a/compose.php
+++ b/compose.php
@@ -50,7 +50,7 @@ if (!isset($_REQUEST['priority']))
$_REQUEST['priority'] = 3;
if( !empty( $_REQUEST['action']['reply'] ) || !empty( $_REQUEST['action']['replyall'] ) ) {
- $replyToUser = $gBitUser->getUserInfo( array( 'user_id' => $_REQUEST['replyto'] ) );
+ $replyToUser = $gBitUser->getUserInfo( [ 'user_id' => $_REQUEST['replyto'] ] );
$_REQUEST['to'] = $replyToUser['login'];
if( !empty( $_REQUEST['action']['replyall'] ) ) {
$_REQUEST['cc'] = preg_replace( "/".$replyToUser['login'].",/", "", $_REQUEST['replyallto'] );
@@ -71,7 +71,7 @@ $gBitSmarty->assign('body', $_REQUEST['body']);
$gBitSmarty->assign('priority', $_REQUEST['priority']);
$gBitSmarty->assign('sent', 0);
-$feedback = array();
+$feedback = [];
$gBitSmarty->assign( 'feedback', $feedback );
if (isset($_REQUEST['replyto']) || isset($_REQUEST['replyallto'])) {
diff --git a/contact.php b/contact.php
index affaaeb..20f38cf 100755
--- a/contact.php
+++ b/contact.php
@@ -36,5 +36,5 @@ if( !empty( $_REQUEST['send'] )) {
$gBitSmarty->assign( 'feedback', $feedback );
}
-$gBitSystem->display( 'bitpackage:messages/contact.tpl', NULL, array( 'display_mode' => 'display' ));
+$gBitSystem->display( 'bitpackage:messages/contact.tpl', NULL, [ 'display_mode' => 'display' ]);
?>
diff --git a/includes/bit_setup_inc.php b/includes/bit_setup_inc.php
index 38c9e5f..e30dcf2 100755
--- a/includes/bit_setup_inc.php
+++ b/includes/bit_setup_inc.php
@@ -1,5 +1,6 @@
<?php
namespace Bitweaver\Messages;
+
global $gBitSystem, $gBitUser, $gBitSmarty;
$pRegisterHash = [
diff --git a/includes/classes/Messages.php b/includes/classes/Messages.php
index 104f02a..227d1c8 100755
--- a/includes/classes/Messages.php
+++ b/includes/classes/Messages.php
@@ -13,6 +13,7 @@
* @package messages
*/
namespace Bitweaver\Messages;
+
use Bitweaver\BitBase;
use Bitweaver\KernelTools;
use Bitweaver\Liberty\LibertyBase;
@@ -45,7 +46,7 @@ class Messages extends BitBase {
$pParamHash['userInfo']['email'],
KernelTools::tra( 'New message arrived from ' ).$gBitSystem->getConfig( 'kernel_server_name', $_SERVER["SERVER_NAME"] ),
$gBitSmarty->fetch( 'bitpackage:messages/message_notification.tpl' ),
- "From: ".$gBitSystem->getConfig( 'site_sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n"
+ "From: ".$gBitSystem->getConfig( 'site_sender_email' )."\r\nContent-type: text/plain;charset=utf-8\r\n",
);
}
}
@@ -169,9 +170,6 @@ class Messages extends BitBase {
$query = "SELECT COUNT(*) FROM `".BIT_DB_PREFIX."messages` mm WHERE mm.`to_user_id`=? $whereSql";
$cant = $this->mDb->getOne( $query, $bindVars );
-
-
-
// ====================== Broadcast Messages ======================
//array_unshift( $bindVars, $gBitUser->mUserId, ROOT_USER_ID, $gBitUser->mUserId );
$bindVars = [ $gBitUser->mUserId, ROOT_USER_ID, $gBitUser->mUserId ];
@@ -223,9 +221,6 @@ class Messages extends BitBase {
WHERE mm.`to_user_id`=? AND mm.`group_id` IN (SELECT `group_id` FROM `".BIT_DB_PREFIX."users_groups_map` WHERE `user_id` = ?) $whereSql";
$cant2 = $this->mDb->getOne($query, $bindVars);
-
-
-
// ====================== insane message mergin and sorting ======================
$sort_mode = $pListHash['sort_mode'];
$ret = [];
@@ -290,7 +285,6 @@ class Messages extends BitBase {
$ret[$key] = $msg;
}
-
$pListHash["cant"] = $cant + $cant2;
LibertyBase::postGetList( $pListHash );
return $ret;
@@ -405,8 +399,6 @@ class Messages extends BitBase {
return $normalCount + $broadcastCount + $broadcastCount2;
}
-
-
// ==================== system messages ====================
public function postSystemMessage( $pParamHash ) {
$pParamHash['to_login'] = ROOT_USER_ID;
@@ -414,10 +406,10 @@ class Messages extends BitBase {
if( @BitBase::verifyId( $pParamHash['group_id'] ) ) {
return $this->postMessage( $pParamHash );
- } else {
+ }
$this->mErrors['group_id'] = KernelTools::tra( "You need to specify a group id to broadcast the message to." );
return FALSE;
- }
+
}
public function getSystemMessageList() {
diff --git a/index.php b/index.php
index 3e305fe..c0437d0 100755
--- a/index.php
+++ b/index.php
@@ -1,4 +1,4 @@
-<?php
+<?php
// This is not a package.
header ("location: ../index.php");
diff --git a/message_box.php b/message_box.php
index 177f876..ab1c6e4 100755
--- a/message_box.php
+++ b/message_box.php
@@ -20,10 +20,9 @@ require_once( '../kernel/includes/setup_inc.php' );
use Bitweaver\Messages\Messages;
use Bitweaver\KernelTools;
-
if( !$gBitUser->isRegistered() ) {
$gBitSmarty->assign('msg', KernelTools::tra("You are not logged in"));
- $gBitSystem->display( 'error.tpl' , NULL, array( 'display_mode' => 'display' ));
+ $gBitSystem->display( 'error.tpl' , NULL, [ 'display_mode' => 'display' ]);
die;
}
diff --git a/read.php b/read.php
index bbef5aa..15a17c4 100755
--- a/read.php
+++ b/read.php
@@ -20,7 +20,6 @@ require_once( '../kernel/includes/setup_inc.php' );
use Bitweaver\Messages\Messages;
use Bitweaver\KernelTools;
-
if( !$gBitUser->isRegistered() ) {
$gBitSystem->fatalError( KernelTools::tra( "You are not logged in" ) );
}
@@ -61,4 +60,4 @@ $messages->flagMessage( $flagHash );
$msg = $messages->getMessage( $gBitUser->mUserId, $_REQUEST['msg_id']);
$gBitSmarty->assign( 'msg', $msg );
-$gBitSystem->display( 'bitpackage:messages/read.tpl', NULL, array( 'display_mode' => 'display' ));
+$gBitSystem->display( 'bitpackage:messages/read.tpl', NULL, [ 'display_mode' => 'display' ]);
diff --git a/templates/index.php b/templates/index.php
index 3e305fe..c0437d0 100755
--- a/templates/index.php
+++ b/templates/index.php
@@ -1,4 +1,4 @@
-<?php
+<?php
// This is not a package.
header ("location: ../index.php");