From e0883fce153cc367c4541aeadadcd93130c6fd97 Mon Sep 17 00:00:00 2001 From: Nate Date: Mon, 23 Sep 2019 08:38:25 -0600 Subject: [PATCH] Fix contact image bug in Messages. --- app/messages/messages.php | 22 ++++++++++----------- app/messages/messages_contacts.php | 4 ++-- app/messages/messages_thread.php | 31 ++++++++++++++---------------- 3 files changed, 27 insertions(+), 30 deletions(-) diff --git a/app/messages/messages.php b/app/messages/messages.php index a1b0a8b639..472e2cf14e 100644 --- a/app/messages/messages.php +++ b/app/messages/messages.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2016-2018 + Portions created by the Initial Developer are Copyright (C) 2016-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -88,10 +88,10 @@ echo " #message_new_layer {\n"; echo " z-index: 999999;\n"; echo " position: absolute;\n"; - echo " left: 0px;\n"; - echo " top: 0px;\n"; - echo " right: 0px;\n"; - echo " bottom: 0px;\n"; + echo " left: 0;\n"; + echo " top: 0;\n"; + echo " right: 0;\n"; + echo " bottom: 0;\n"; echo " text-align: center;\n"; echo " vertical-align: middle;\n"; echo " }\n"; @@ -115,10 +115,10 @@ echo " #message_media_layer {\n"; echo " z-index: 999999;\n"; echo " position: absolute;\n"; - echo " left: 0px;\n"; - echo " top: 0px;\n"; - echo " right: 0px;\n"; - echo " bottom: 0px;\n"; + echo " left: 0;\n"; + echo " top: 0;\n"; + echo " right: 0;\n"; + echo " bottom: 0;\n"; echo " text-align: center;\n"; echo " vertical-align: middle;\n"; echo " }\n"; @@ -255,7 +255,7 @@ echo " function load_thread(number, contact_uuid) {\n"; echo " clearTimeout(timer_thread);\n"; echo " $('#thread').load('messages_thread.php?number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n"; - echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 450 }, 200, function() {\n"; + echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n"; echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others //note: the order of the above two lines matters! @@ -280,7 +280,7 @@ echo " function refresh_thread(number, contact_uuid, onsent) {\n"; echo " $('#thread_messages').load('messages_thread.php?refresh=true&number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n"; - echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 450 }, 200, function() {\n"; + echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n"; echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others //note: the order of the above two lines matters! diff --git a/app/messages/messages_contacts.php b/app/messages/messages_contacts.php index 23a1c7b67a..061a3b1709 100644 --- a/app/messages/messages_contacts.php +++ b/app/messages/messages_contacts.php @@ -133,7 +133,7 @@ unset($sql, $parameters, $rows, $row); if (!is_null(array_diff($numbers, $destinations))) { - $numbers = array_diff($numbers, $destinations); + $numbers = array_diff($numbers, $destinations); } //get contact (primary attachment) images and cache them @@ -222,4 +222,4 @@ echo "\n"; } -?> +?> \ No newline at end of file diff --git a/app/messages/messages_thread.php b/app/messages/messages_thread.php index 488fd406a6..39b8455925 100644 --- a/app/messages/messages_thread.php +++ b/app/messages/messages_thread.php @@ -17,7 +17,7 @@ The Initial Developer of the Original Code is Mark J Crane - Portions created by the Initial Developer are Copyright (C) 2016-2018 + Portions created by the Initial Developer are Copyright (C) 2016-2019 the Initial Developer. All Rights Reserved. Contributor(s): @@ -220,23 +220,20 @@ //message bubble echo ""; //contact image em - if ( - $message['message_direction'] == 'inbound' && - is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && - @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0 - ) { - echo "
\n"; - echo "
\n"; - echo "
\n"; + if ($message['message_direction'] == 'inbound') { + if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) { + echo "
\n"; + echo "
\n"; + echo "
\n"; + } } //contact image me - else if ( - is_array($_SESSION['tmp']['messages']['contact_me']) && - @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0 - ) { - echo "
\n"; - echo "
\n"; - echo "
\n"; + else { + if (is_array($_SESSION['tmp']['messages']['contact_me']) && @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) { + echo "
\n"; + echo "
\n"; + echo "
\n"; + } } echo "
\n"; //message @@ -335,4 +332,4 @@ } } -?> +?> \ No newline at end of file