diff --git a/app/messages/app_languages.php b/app/messages/app_languages.php
index cbaa04e31f..ebee1c547a 100644
--- a/app/messages/app_languages.php
+++ b/app/messages/app_languages.php
@@ -869,4 +869,44 @@
$text['button-close']['sv-se'] = '';
$text['button-close']['uk-ua'] = '';
+ $text['label-view_contact']['en-us'] = 'View Contact';
+ $text['label-view_contact']['ar-eg'] = '';
+ $text['label-view_contact']['de-at'] = '';
+ $text['label-view_contact']['de-ch'] = '';
+ $text['label-view_contact']['de-de'] = '';
+ $text['label-view_contact']['es-cl'] = '';
+ $text['label-view_contact']['es-mx'] = '';
+ $text['label-view_contact']['fr-ca'] = '';
+ $text['label-view_contact']['fr-fr'] = '';
+ $text['label-view_contact']['he-il'] = '';
+ $text['label-view_contact']['it-it'] = '';
+ $text['label-view_contact']['nl-nl'] = '';
+ $text['label-view_contact']['pl-pl'] = '';
+ $text['label-view_contact']['pt-br'] = '';
+ $text['label-view_contact']['pt-pt'] = '';
+ $text['label-view_contact']['ro-ro'] = '';
+ $text['label-view_contact']['ru-ru'] = '';
+ $text['label-view_contact']['sv-se'] = '';
+ $text['label-view_contact']['uk-ua'] = '';
+
+ $text['label-send_email']['en-us'] = 'Send Email';
+ $text['label-send_email']['ar-eg'] = '';
+ $text['label-send_email']['de-at'] = '';
+ $text['label-send_email']['de-ch'] = '';
+ $text['label-send_email']['de-de'] = '';
+ $text['label-send_email']['es-cl'] = '';
+ $text['label-send_email']['es-mx'] = '';
+ $text['label-send_email']['fr-ca'] = '';
+ $text['label-send_email']['fr-fr'] = '';
+ $text['label-send_email']['he-il'] = '';
+ $text['label-send_email']['it-it'] = '';
+ $text['label-send_email']['nl-nl'] = '';
+ $text['label-send_email']['pl-pl'] = '';
+ $text['label-send_email']['pt-br'] = '';
+ $text['label-send_email']['pt-pt'] = '';
+ $text['label-send_email']['ro-ro'] = '';
+ $text['label-send_email']['ru-ru'] = '';
+ $text['label-send_email']['sv-se'] = '';
+ $text['label-send_email']['uk-ua'] = '';
+
?>
diff --git a/app/messages/messages.php b/app/messages/messages.php
index 7b2e3985c4..c90e5e9f84 100644
--- a/app/messages/messages.php
+++ b/app/messages/messages.php
@@ -56,15 +56,14 @@
}
unset ($prep_statement, $sql, $row, $record);
-//get self (primary contact attachment) image, if any
+//get self (primary contact attachment) image
if (!is_array($_SESSION['tmp']['messages']['contact_me'])) {
$sql = "select attachment_filename as filename, attachment_content as image from v_contact_attachments ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and contact_uuid = :contact_uuid ";
+ $sql .= "and contact_uuid = '".$_SESSION['user']['contact_uuid']."' ";
$sql .= "and attachment_primary = 1 ";
- $bind[':contact_uuid'] = $_SESSION['user']['contact_uuid'];
$prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute(is_array($bind) ? $bind : null);
+ $prep_statement->execute();
$_SESSION['tmp']['messages']['contact_me'] = $prep_statement->fetch(PDO::FETCH_NAMED);
unset ($sql, $bind, $prep_statement);
}
@@ -93,7 +92,7 @@
echo " bottom: 0px;\n";
echo " text-align: center;\n";
echo " vertical-align: middle;\n";
- echo " }\n";
+ echo " }\n";
echo " #message_new_container {\n";
echo " display: block;\n";
@@ -109,7 +108,7 @@
echo " -webkit-box-shadow: 0px 1px 20px #888;\n";
echo " -moz-box-shadow: 0px 1px 20px #888;\n";
echo " box-shadow: 0px 1px 20px #888;\n";
- echo " }\n";
+ echo " }\n";
echo " #message_media_layer {\n";
echo " z-index: 999999;\n";
@@ -120,14 +119,32 @@
echo " bottom: 0px;\n";
echo " text-align: center;\n";
echo " vertical-align: middle;\n";
- echo " }\n";
+ echo " }\n";
echo " td.contact_selected {\n";
echo " border-right: 5px solid ".($SESSION['theme']['table_row_border_color']['text'] != '' ? $SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
- echo " }\n";
+ echo " }\n";
+
+ echo " .contact_list_image {\n";
+ echo " float: left;\n";
+ echo " width: 75px;\n";
+ echo " height: 75px;\n";
+ echo " margin: 3px 8px 3px 2px;\n";
+ echo " border: 1px solid ".($SESSION['theme']['table_row_border_color']['text'] != '' ? $SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
+ echo " background-repeat: no-repeat;\n";
+ echo " background-size: cover;\n";
+ echo " background-position: center center;\n";
+ echo " border-radius: 11px;\n";
+ echo " }\n";
echo "\n";
+//cache self (primary contact attachment) image
+ if (is_array($_SESSION['tmp']['messages']['contact_me']) && sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
+ $attachment_type = strtolower(pathinfo($_SESSION['tmp']['messages']['contact_me']['filename'], PATHINFO_EXTENSION));
+ echo "
\n";
+ }
+
//new message layer
if (permission_exists('message_add')) {
echo "
\n";
@@ -205,9 +222,9 @@
echo "
\n";
echo " \n";
- echo " | ".$text['label-contacts']." | \n";
+ echo " ".$text['label-contacts']." | \n";
echo " ".$text['label-messages']." | \n";
- echo " | \n";
+ echo " | \n";
echo "
\n";
echo " \n";
echo " | ··· | \n";
diff --git a/app/messages/messages_contacts.php b/app/messages/messages_contacts.php
index 46d94d8d5f..8b3ada5221 100644
--- a/app/messages/messages_contacts.php
+++ b/app/messages/messages_contacts.php
@@ -90,9 +90,11 @@
if (is_array($contact) && sizeof($contact) != 0) {
foreach ($contact as $number => $field) {
if (is_uuid($field['contact_uuid'])) {
- $sql = "select contact_name_given, contact_name_family from v_contacts ";
- $sql .= "where contact_uuid = '".$field['contact_uuid']."' ";
- $sql .= "and (domain_uuid = '".$domain_uuid."' or domain_uuid is null) ";
+ $sql = "select c.contact_name_given, c.contact_name_family, ";
+ $sql .= "(select ce.email_address from v_contact_emails as ce where ce.contact_uuid = c.contact_uuid and ce.email_primary = 1) as contact_email ";
+ $sql .= "from v_contacts as c ";
+ $sql .= "where c.contact_uuid = '".$field['contact_uuid']."' ";
+ $sql .= "and (c.domain_uuid = '".$domain_uuid."' or c.domain_uuid is null) ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
@@ -100,6 +102,7 @@
$contact[$number]['contact_uuid'] = $field['contact_uuid'];
$contact[$number]['contact_name_given'] = $row['contact_name_given'];
$contact[$number]['contact_name_family'] = $row['contact_name_family'];
+ $contact[$number]['contact_email'] = $row['contact_email'];
}
unset($prep_statement, $sql);
}
@@ -117,7 +120,6 @@
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$rows = $prep_statement->fetchAll(PDO::FETCH_NAMED);
- //view_array($rows);
if (is_array($rows) && sizeof($rows)) {
foreach ($rows as $row) {
$destinations[] = $row['destination_number'];
@@ -126,45 +128,87 @@
unset ($prep_statement, $sql, $row, $record);
$numbers = array_diff($numbers, $destinations);
-//alternate the row style
- $c = 0;
- $row_style["0"] = "row_style0";
- $row_style["1"] = "row_style1";
+//get contact (primary attachment) images and cache them
+ if (is_array($numbers) && sizeof($numbers) != 0) {
+ foreach ($numbers as $number) {
+ $contact_uuids[] = $contact[$number]['contact_uuid'];
+ }
+ if (is_array($contact_uuids) && sizeof($contact_uuids) != 0) {
+ $sql = "select contact_uuid as uuid, attachment_filename as filename, attachment_content as image from v_contact_attachments ";
+ $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
+ $sql .= "and ( 0 = 1 ";
+ foreach ($contact_uuids as $contact_uuid) {
+ $sql .= "or contact_uuid = '".$contact_uuid."' ";
+ }
+ $sql .= ") ";
+ $sql .= "and attachment_primary = 1 ";
+ $prep_statement = $db->prepare(check_sql($sql));
+ $prep_statement->execute();
+ $contact_ems = $prep_statement->fetchAll(PDO::FETCH_NAMED);
+
+ if (is_array($contact_ems) && sizeof($contact_ems) != 0) {
+ foreach ($contact_ems as $contact_em) {
+ $_SESSION['tmp']['messages']['contact_em'][$contact_em['uuid']]['filename'] = $contact_em['filename'];
+ $_SESSION['tmp']['messages']['contact_em'][$contact_em['uuid']]['image'] = $contact_em['image'];
+ }
+ }
+
+ }
+ unset($sql, $prep_statement, $contact_uuids, $contact_ems, $contact_em);
+ }
//contacts list
if (is_array($numbers) && sizeof($numbers) != 0) {
echo "\n";
foreach($numbers as $number) {
if ($current_contact != '' && $number == $current_contact) {
- echo "| \n";
+ echo " |
| \n";
$selected = true;
}
else {
- echo " |
| \n";
+ echo " |
\n";
$selected = false;
}
- if ($contact[$number]['contact_name_given'] != '' || $contact[$number]['contact_name_family'] != '') {
- echo "".escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']).'';
- echo "".escape(format_phone($number)).'';
- if ($selected) {
- $contact_name = escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']);
- $contact_html = (permission_exists('contact_view') ? "".$contact_name."" : $contact_name)." : ".escape(format_phone($number))."";
- echo "\n";
+ //contact image
+ if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact[$number]['contact_uuid']]) && sizeof($_SESSION['tmp']['messages']['contact_em'][$contact[$number]['contact_uuid']]) != 0) {
+ $attachment_type = strtolower(pathinfo($_SESSION['tmp']['messages']['contact_em'][$contact[$number]['contact_uuid']]['filename'], PATHINFO_EXTENSION));
+ echo " \n";
+ echo " \n";
}
- }
- else {
- echo escape(format_phone($number));
- if ($selected) {
- echo "\n";
+ //contact name/number
+ if ($contact[$number]['contact_name_given'] != '' || $contact[$number]['contact_name_family'] != '') {
+ echo "\n";
+ echo "".escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']).' ';
+ echo "".escape(format_phone($number)).' ';
+ if (valid_email($contact[$number]['contact_email'])) {
+ echo "".$text['label-send_email']." ";
+ }
+ if ($selected) {
+ $contact_name = escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']);
+ $contact_html = (permission_exists('contact_view') ? "".$contact_name."" : $contact_name)." : ".escape(format_phone($number))."";
+ echo "\n";
+ }
+ }
+ else {
+ echo escape(format_phone($number));
+ if ($selected) {
+ echo "\n";
+ }
}
- }
echo " |
\n";
- $c = $c == 0 ? 1 : 0;
}
echo "
\n";
echo "\n";
echo "
";
echo "\n";
+
+ echo "\n";
}
?>
\ No newline at end of file
diff --git a/app/messages/messages_thread.php b/app/messages/messages_thread.php
index 12a7d8d5c3..085842901b 100644
--- a/app/messages/messages_thread.php
+++ b/app/messages/messages_thread.php
@@ -46,19 +46,6 @@
//set refresh flag
$refresh = $_GET['refresh'] == 'true' ? true : false;
-//get contact (primary attachment) image, if any
- if (is_uuid($contact_uuid) && (!is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) || $_SESSION['tmp']['messages']['contact_em'][$contact_uuid] != $contact_uuid)) {
- $sql = "select attachment_filename as filename, attachment_content as image from v_contact_attachments ";
- $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
- $sql .= "and contact_uuid = :contact_uuid ";
- $sql .= "and attachment_primary = 1 ";
- $bind[':contact_uuid'] = $contact_uuid;
- $prep_statement = $db->prepare(check_sql($sql));
- $prep_statement->execute(is_array($bind) ? $bind : null);
- $_SESSION['tmp']['messages']['contact_em'][$contact_uuid] = $prep_statement->fetch(PDO::FETCH_NAMED);
- unset ($sql, $bind, $prep_statement);
- }
-
//get messages
if (isset($_SESSION['message']['display_last']['text']) && $_SESSION['message']['display_last']['text'] != '') {
$array = explode(' ',$_SESSION['message']['display_last']['text']);
@@ -223,22 +210,24 @@
//message bubble
echo "";
- //contact image
- if ($message['message_direction'] == 'inbound') { //em
- if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) {
- $attachment_type = strtolower(pathinfo($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]['filename'], PATHINFO_EXTENSION));
- echo "\n";
- echo "

\n";
- echo "
\n";
- }
+ //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";
}
- else { //me
- if (is_array($_SESSION['tmp']['messages']['contact_me']) && sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
- $attachment_type = strtolower(pathinfo($_SESSION['tmp']['messages']['contact_me']['filename'], PATHINFO_EXTENSION));
- 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";
}
echo "\n";