Bläddra i källkod

Update to fix PHP 8.1 warnings

markjcrane 2 år sedan
förälder
incheckning
f65623a712
8 ändrade filer med 80 tillägg och 57 borttagningar
  1. 21 0
      app_languages.php
  2. 27 25
      message_edit.php
  3. 8 8
      message_logs.php
  4. 9 9
      message_queue.php
  5. 1 1
      message_send.php
  6. 2 2
      messages.php
  7. 6 6
      messages_contacts.php
  8. 6 6
      messages_thread.php

+ 21 - 0
app_languages.php

@@ -246,6 +246,27 @@
 		$text['label-messages']['sv-se'] = 'Messages';
 		$text['label-messages']['uk-ua'] = 'Messages';
 
+		$text['description-username']['en-us'] = '';
+		$text['description-username']['en-gb'] = '';
+		$text['description-username']['ar-eg'] = '';
+		$text['description-username']['de-at'] = '';
+		$text['description-username']['de-ch'] = '';
+		$text['description-username']['de-de'] = '';
+		$text['description-username']['es-cl'] = '';
+		$text['description-username']['es-mx'] = '';
+		$text['description-username']['fr-ca'] = '';
+		$text['description-username']['fr-fr'] = '';
+		$text['description-username']['he-il'] = '';
+		$text['description-username']['it-it'] = '';
+		$text['description-username']['nl-nl'] = '';
+		$text['description-username']['pl-pl'] = '';
+		$text['description-username']['pt-br'] = '';
+		$text['description-username']['pt-pt'] = '';
+		$text['description-username']['ro-ro'] = '';
+		$text['description-username']['ru-ru'] = '';
+		$text['description-username']['sv-se'] = '';
+		$text['description-username']['uk-ua'] = '';
+
 		$text['label-message_direction']['en-us'] = 'Direction';
 		$text['label-message_direction']['en-gb'] = 'Direction';
 		$text['label-message_direction']['ar-eg'] = 'Direction';

+ 27 - 25
message_edit.php

@@ -42,7 +42,7 @@
 	$text = $language->get();
 
 //action add or update
-	if (is_uuid($_REQUEST["id"])) {
+	if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
 		$action = "update";
 		$message_uuid = $_REQUEST["id"];
 	}
@@ -51,7 +51,7 @@
 	}
 
 //get http post variables and set them to php variables
-	if (is_array($_POST)) {
+	if (!empty($_POST)) {
 		$message_uuid = $_POST["message_uuid"];
 		$user_uuid = $_POST["user_uuid"];
 		$message_type = $_POST["message_type"];
@@ -67,7 +67,7 @@
 	}
 
 //process the user data and save it to the database
-	if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
+	if (!empty($_POST) && empty($_POST["persistformvar"])) {
 
 		//get the uuid from the POST
 			if ($action == "update") {
@@ -75,7 +75,7 @@
 			}
 
 		//process the http post data by submitted action
-			if ($_POST['action'] != '' && is_uuid($message_uuid)) {
+			if (!empty($_POST['action']) && isset($message_uuid) && is_uuid($message_uuid)) {
 				$array[0]['checked'] = 'true';
 				$array[0]['uuid'] = $message_uuid;
 
@@ -102,17 +102,17 @@
 
 		//check for all required data
 			$msg = '';
-			if (strlen($message_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_type']."<br>\n"; }
-			if (strlen($message_direction) == 0) { $msg .= $text['message-required']." ".$text['label-message_direction']."<br>\n"; }
-			if (strlen($message_date) == 0) { $msg .= $text['message-required']." ".$text['label-message_date']."<br>\n"; }
-			if (strlen($message_from) == 0) { $msg .= $text['message-required']." ".$text['label-message_from']."<br>\n"; }
-			if (strlen($message_to) == 0) { $msg .= $text['message-required']." ".$text['label-message_to']."<br>\n"; }
-			//if (strlen($message_text) == 0) { $msg .= $text['message-required']." ".$text['label-message_text']."<br>\n"; }
-			//if (strlen($message_media_type) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_type']."<br>\n"; }
-			//if (strlen($message_media_url) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_url']."<br>\n"; }
-			//if (strlen($message_media_content) == 0) { $msg .= $text['message-required']." ".$text['label-message_media_content']."<br>\n"; }
-			//if (strlen($message_json) == 0) { $msg .= $text['message-required']." ".$text['label-message_json']."<br>\n"; }
-			if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
+			if (empty($message_type)) { $msg .= $text['message-required']." ".$text['label-message_type']."<br>\n"; }
+			if (empty($message_direction)) { $msg .= $text['message-required']." ".$text['label-message_direction']."<br>\n"; }
+			if (empty($message_date)) { $msg .= $text['message-required']." ".$text['label-message_date']."<br>\n"; }
+			if (empty($message_from)) { $msg .= $text['message-required']." ".$text['label-message_from']."<br>\n"; }
+			if (empty($message_to)) { $msg .= $text['message-required']." ".$text['label-message_to']."<br>\n"; }
+			//if (empty($message_text)) { $msg .= $text['message-required']." ".$text['label-message_text']."<br>\n"; }
+			//if (empty($message_media_type)) { $msg .= $text['message-required']." ".$text['label-message_media_type']."<br>\n"; }
+			//if (empty($message_media_url)) { $msg .= $text['message-required']." ".$text['label-message_media_url']."<br>\n"; }
+			//if (empty($message_media_content)) { $msg .= $text['message-required']." ".$text['label-message_media_content']."<br>\n"; }
+			//if (empty($message_json)) { $msg .= $text['message-required']." ".$text['label-message_json']."<br>\n"; }
+			if (!empty($msg) && empty($_POST["persistformvar"])) {
 				require_once "resources/header.php";
 				require_once "resources/persist_form_var.php";
 				echo "<div align='center'>\n";
@@ -126,7 +126,7 @@
 			}
 
 		//add the message_uuid
-			if (!is_uuid($_POST["message_uuid"])) {
+			if (empty($_POST["message_uuid"]) || !is_uuid($_POST["message_uuid"])) {
 				$message_uuid = uuid();
 			}
 
@@ -162,14 +162,14 @@
 	}
 
 //pre-populate the form
-	if (is_array($_GET) && $_POST["persistformvar"] != "true") {
+	if (!empty($_GET["id"]) && empty($_POST["persistformvar"])) {
 		$message_uuid = $_GET["id"];
 		$sql = "select * from v_messages ";
 		$sql .= "where message_uuid = :message_uuid ";
 		$parameters['message_uuid'] = $message_uuid;
 		$database = new database;
 		$row = $database->select($sql, $parameters, 'row');
-		if (is_array($row) && @sizeof($row) != 0) {
+		if (!empty($row) && @sizeof($row) != 0) {
 			$user_uuid = $row["user_uuid"];
 			$message_type = $row["message_type"];
 			$message_direction = $row["message_direction"];
@@ -177,9 +177,9 @@
 			$message_from = $row["message_from"];
 			$message_to = $row["message_to"];
 			$message_text = $row["message_text"];
-			$message_media_type = $row["message_media_type"];
-			$message_media_url = $row["message_media_url"];
-			$message_media_content = $row["message_media_content"];
+			$message_media_type = $row["message_media_type"] ?? '';
+			$message_media_url = $row["message_media_url"] ?? '';
+			$message_media_content = $row["message_media_content"] ?? '';
 			$message_json = $row["message_json"];
 		}
 		unset($sql, $parameters);
@@ -231,8 +231,10 @@
 	echo "<td width='70%' class='vtable' style='position: relative;' align='left'>\n";
 	echo "	<select class='formfld' name='user_uuid'>\n";
 	echo "		<option value=''></option>\n";
-	foreach($users as $row) {
-		echo "		<option value='".escape($row['user_uuid'])."' ".($row['user_uuid'] == $user_uuid ? "selected='selected'" : null).">".escape($row['username'])."</option>\n";
+	if (!empty($users)) {
+		foreach($users as $row) {
+			echo "		<option value='".escape($row['user_uuid'])."' ".($row['user_uuid'] == $user_uuid ? "selected='selected'" : null).">".escape($row['username'])."</option>\n";
+		}
 	}
 	echo "	</select>\n";
 	echo "<br />\n";
@@ -313,7 +315,7 @@
 	echo "</td>\n";
 	echo "</tr>\n";
 
-	if (strlen($message_media_type) > 0) {
+	if (!empty($message_media_type)) {
 		echo "<tr>\n";
 		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
 		echo "	&nbsp;\n";
@@ -326,7 +328,7 @@
 		echo "</tr>\n";
 	}
 
-	if ($_GET['debug'] == 'true') {
+	if (!empty($_GET['debug']) && $_GET['debug'] == 'true') {
 		echo "<tr>\n";
 		echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
 		echo "	".$text['label-message_media_type']."\n";

+ 8 - 8
message_logs.php

@@ -60,7 +60,7 @@
 				break;
 		}
 
-		header('Location: message_logs.php'.($search != '' ? '?search='.urlencode($search) : null));
+		header('Location: message_logs.php'.(!empty($search) ? '?search='.urlencode($search) : null));
 		exit;
 	}
 
@@ -101,13 +101,13 @@
 	$num_rows = $database->select($sql, $parameters ?? null, 'column');
 
 //prepare to page the results
-	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
 	$param = "&search=".$search;
 	if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('message_all')) {
 		$param .= "&show=all";
 	}
 	if (isset($_GET['page'])) {
-		$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
+		$page = (!empty($_GET['page']) && is_numeric($_GET['page'])) ? $_GET['page'] : 0;
 		list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
 		list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
 		$offset = $rows_per_page * $page;
@@ -164,7 +164,7 @@
 		}
 	}
 	echo 		"<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
-	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
+	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]);
 	echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'message_logs.php','style'=>($search == '' ? 'display: none;' : null)]);
 	if (!empty($paging_controls_mini)) {
 		echo 	"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
@@ -174,7 +174,7 @@
 	echo "	<div style='clear: both;'></div>\n";
 	echo "</div>\n";
 
-	if (permission_exists('message_delete') && $messages) {
+	if (permission_exists('message_delete') && !empty($messages)) {
 		echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
 	}
 
@@ -186,7 +186,7 @@
 	echo "<tr class='list-header'>\n";
 	if (permission_exists('message_delete')) {
 		echo "	<th class='checkbox'>\n";
-		echo "		<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".($messages ?: "style='visibility: hidden;'").">\n";
+		echo "		<input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle();' ".(!empty($messages) ?: "style='visibility: hidden;'").">\n";
 		echo "	</th>\n";
 	}
 	echo th_order_by('message_type', $text['label-message_type'], $order_by, $order);
@@ -200,7 +200,7 @@
 	}
 	echo "</tr>\n";
 
-	if (is_array($messages) && @sizeof($messages) != 0) {
+	if (!empty($messages) && @sizeof($messages) != 0) {
 		$x = 0;
 		foreach ($messages as $row) {
 			if (permission_exists('message_edit')) {
@@ -239,7 +239,7 @@
 			echo "	<td>".escape(format_phone($row['message_from']))."&nbsp;</td>\n";
 			echo "	<td>".escape(format_phone($row['message_to']))."&nbsp;</td>\n";
 			echo "	<td class='description overflow hide-xs'>".escape($row['message_text'])."&nbsp;</td>\n";
-			if (permission_exists('message_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
+			if (permission_exists('message_edit') && !empty($_SESSION['theme']['list_row_edit_button']['boolean']) && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
 				echo "	<td class='action-button'>\n";
 				echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
 				echo "	</td>\n";

+ 9 - 9
message_queue.php

@@ -43,14 +43,14 @@
 	$text = $language->get();
 
 //get the http post data
-	if (is_array($_POST['messages'])) {
+	if (!empty($_POST['messages'])) {
 		$action = $_POST['action'];
 		$search = $_POST['search'];
 		$messages = $_POST['messages'];
 	}
 
 //process the http post data by action
-	if ($action != '' && is_array($messages) && @sizeof($messages) != 0) {
+	if (!empty($action) && !empty($messages) && @sizeof($messages) != 0) {
 		switch ($action) {
 			case 'delete':
 				if (permission_exists('message_delete')) {
@@ -70,7 +70,7 @@
 
 //add the search term
 	$search = strtolower($_GET["search"]);
-	if (strlen($search) > 0) {
+	if (!empty($search)) {
 		$sql_search = " (";
 		$sql_search .= "lower(message_type) like :search ";
 		$sql_search .= "or lower(message_direction) like :search ";
@@ -83,7 +83,7 @@
 
 //prepare to page the results
 	$sql = "select count(*) from v_messages ";
-	if ($_GET['show'] == "all" && permission_exists('message_all')) {
+	if (!empty($_GET['show']) && $_GET['show'] == "all" && permission_exists('message_all')) {
 		if (isset($sql_search)) {
 			$sql .= "where ".$sql_search;
 		}
@@ -101,7 +101,7 @@
 	$num_rows = $database->select($sql, $parameters, 'column');
 
 //prepare to page the results
-	$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
+	$rows_per_page = (!empty($_SESSION['domain']['paging']['numeric'])) ? $_SESSION['domain']['paging']['numeric'] : 50;
 	$param = "&search=".$search;
 	if ($_GET['show'] == "all" && permission_exists('message_all')) {
 		$param .= "&show=all";
@@ -164,9 +164,9 @@
 		}
 	}
 	echo 		"<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
-	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
-	echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'messages_log.php','style'=>($search == '' ? 'display: none;' : null)]);
-	if ($paging_controls_mini != '') {
+	echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>(!empty($search) ? 'display: none;' : null)]);
+	echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'messages_log.php','style'=>(empty($search) ? 'display: none;' : null)]);
+	if (!empty($paging_controls_mini)) {
 		echo 	"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
 	}
 	echo "		</form>\n";
@@ -200,7 +200,7 @@
 	}
 	echo "</tr>\n";
 
-	if (is_array($messages) && @sizeof($messages) != 0) {
+	if (!empty($messages) && @sizeof($messages) != 0) {
 		$x = 0;
 		foreach ($messages as $row) {
 			if (permission_exists('message_edit')) {

+ 1 - 1
message_send.php

@@ -39,7 +39,7 @@
 	$text = $language->get();
 
 //get http post variables and set them to php variables
-	if (is_array($_REQUEST)) {
+	if (!empty($_REQUEST) && is_array($_REQUEST)) {
 		//$message_from = $_REQUEST["message_from"];
 		//$message_to = $_REQUEST["message_to"];
 		$message_from = urldecode($_REQUEST["message_from"]);

+ 2 - 2
messages.php

@@ -86,7 +86,7 @@
 	//view_array($destinations);
 
 //get the message to
-	if (isset($_SESSION['user']['contact_number']) && strlen($_SESSION['user']['contact_number']) > 0) {
+	if (isset($_SESSION['user']['contact_number']) && !empty($_SESSION['user']['contact_number'])) {
 		$message_to = $_SESSION['user']['contact_number'];
 	}
 
@@ -315,7 +315,7 @@
 		echo "						<tr>\n";
 		echo "							<td class='vncell'>".$text['label-message_from']."</td>\n";
 		echo "							<td class='vtable'>\n";
-		if (!empty($destinations) && is_array($destinations) && sizeof($destinations) != 0) {
+		if (!empty($destinations) && is_array($destinations)) {
 			echo "							<select class='formfld' name='message_from' id='message_new_from' onchange=\"$('#message_new_to').focus();\">\n";
 			foreach ($destinations as $destination) {
 				echo "							<option value='".$destination."'>".format_phone($destination)."</option>\n";

+ 6 - 6
messages_contacts.php

@@ -39,7 +39,7 @@
 	$text = $language->get();
 
 //get selected number/contact
-	if (isset($_GET['number']) && strlen($_GET['number']) > 0) {
+	if (isset($_GET['number']) && !empty($_GET['number'])) {
 		$_SESSION['user']['contact_number'] = $_GET['number'];
 	}
 
@@ -277,7 +277,7 @@
 	echo "<body onload=''>\n";
 
 //contacts list
-	if (is_array($contacts) && @sizeof($contacts) != 0) {
+	if (!empty($contacts) && @sizeof($contacts) != 0) {
 		echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 		foreach($contacts as $row) {
 			$number = $row['number'];
@@ -290,7 +290,7 @@
 			// $row['contact_uuid'];
 
 			//get the image file extension
-			if (strlen($row['contact_image_filename']) > 0) {
+			if (!empty($row['contact_image_filename'])) {
 				$contact_image_extension = pathinfo($row['contact_image_filename'], PATHINFO_EXTENSION);
 			}
 
@@ -304,7 +304,7 @@
 
 			//$contact_name = format_phone($row['number']);
 			$contact_name = $row['number'];
-			if (strlen($row['name']) > 0) {
+			if (!empty($row['name'])) {
 				$contact_name = escape($row['name']);
 			}
 			if ($_SESSION['user']['contact_number'] != '' && $_SESSION['user']['contact_number'] == $number) {
@@ -316,7 +316,7 @@
 				$selected = false;
 			}
 
-			if (strlen($row['contact_image_filename']) > 0) {
+			if (!empty($row['contact_image_filename'])) {
 				//echo "<img id='src_message-bubble-image-em_".$row['contact_uuid']."' style='display: none;' src='data:image/".$contact_image_extension.";base64,".$row['contact_image_content']."'>\n";
 				echo "<div class='contact_image' style='width: 50px; height: 50px; float: left; padding-right: 3px;'>\n";
 				echo "	<img id='src_message-bubble-image-em_".$row['contact_uuid']."' src=\"data:image/png;base64,".$row['contact_image_content']."\" style=\"width: 50px;\">\n";
@@ -324,7 +324,7 @@
 				//echo "<img id='contact_image_".$row['contact_uuid']."' class='contact_list_image' src='data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7'>\n";
 			}
 			else {
-				if (is_numeric($contact_name)) {
+				if (!empty($contact_name) && is_numeric($contact_name)) {
 					//echo "<div style='width: 80px; height: 80px; border: 2px solid #c4cddd; border-radius: 50%; float: left; text-align: center; vertical-align: middle;'><span style='font-size: 150%; font-weight: 600; color: #c4cddd;'>".substr($contact_name, -1)."</span></div><span style='padding-left: 3px;'/>\n";
 					echo "<div class='contact_image' style='width: 50px; height: 50px; float: left; padding-right: 3px;'>\n";
 					echo "	<img src='resources/images/status_logged_out.png' style=\"width: 50px;\"/>\n";

+ 6 - 6
messages_thread.php

@@ -76,7 +76,7 @@
 	$sql .= "contact_uuid, ";
 	$sql .= "message_type, ";
 	$sql .= "message_direction, ";
-	if ($_SESSION['domain']['time_zone']['name'] != '') {
+	if (!empty($_SESSION['domain']['time_zone']['name'])) {
 		$sql .= "message_date at time zone :time_zone as message_date, ";
 	}
 	else {
@@ -97,7 +97,7 @@
 	$sql .= "and (message_from = :message_number or message_to = :message_number) ";
 	$sql .= "order by message_date desc ";
 	$sql .= "limit :message_limit ";
-	if ($_SESSION['domain']['time_zone']['name'] != '') {
+	if (!empty($_SESSION['domain']['time_zone']['name'])) {
 		$parameters['time_zone'] = $_SESSION['domain']['time_zone']['name'];
 	}
 	$parameters['user_uuid'] = $_SESSION['user_uuid'];
@@ -274,7 +274,7 @@
 					echo "<span class='message-bubble message-bubble-".($message['message_direction'] == 'inbound' ? 'em' : 'me')."'>";
 						//contact image em
 							if ($message['message_direction'] == 'inbound') {
-								if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) {
+								if (!empty($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) {
 									echo "<div class='message-bubble-image-em'>\n";
 									echo "	<img class='message-bubble-image-em'><br />\n";
 									echo "</div>\n";
@@ -282,7 +282,7 @@
 							}
 						//contact image me
 							else {
-								if (is_array($_SESSION['tmp']['messages']['contact_me']) && @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
+								if (!empty($_SESSION['tmp']['messages']['contact_me']) && @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
 									echo "<div class='message-bubble-image-me'>\n";
 									echo "	<img class='message-bubble-image-me'><br />\n";
 									echo "</div>\n";
@@ -290,7 +290,7 @@
 							}
 						echo "<div style='display: table;'>\n";
 						//message
-							if ($message['message_text'] != '') {
+							if (!empty($message['message_text'])) {
 								$allowed = ['http', 'https'];
 								$scheme = parse_url($message['message_text'], PHP_URL_SCHEME);
 								if ($scheme === false) {
@@ -313,7 +313,7 @@
 								}
 							}
 						//attachments
-							if (is_array($message_media[$message['message_uuid']]) && @sizeof($message_media[$message['message_uuid']]) != 0) {
+							if (!empty($message_media[$message['message_uuid']]) && @sizeof($message_media[$message['message_uuid']]) != 0) {
 								foreach ($message_media[$message['message_uuid']] as $media) {
 									if ($media['type'] != 'txt') {
 										if ($media['type'] == 'jpg' || $media['type'] == 'jpeg' || $media['type'] == 'gif' || $media['type'] == 'png') {