contacts php 8.1 changes (#6730)
* Update contacts_vcard.php * Update vcard.php * Update contact_edit.php * Update contact_view.php * Update contact_phone_edit.php * Update contact_address_edit.php * Update contact_addresses.php * Update contact_addresses_view.php * Update contact_attachment.php * Update contact_attachment_edit.php * Update contact_attachments.php * Update contact_attachments_view.php * Update contact_email_edit.php * Update contact_emails.php * Update contact_emails_view.php * Update contact_extensions.php * Update contact_extensions_view.php * Update contact_import.php * Update contact_import_google.php * Update contact_json.php * Update contact_note_edit.php * Update contact_notes.php * Update contact_notes_view.php * Update contact_phones.php * Update contact_phones_view.php * Update contact_relation_edit.php * Update contact_emails_view.php * Update contact_addresses_view.php * Update contact_relations.php * Update contact_relations_view.php * Update contact_setting_edit.php * Update contact_settings.php * Update contact_time_edit.php * Update contact_timer.php * Update contact_timer_inc.php * Update contact_times.php * Update contact_url_edit.php * Update contact_urls.php * Update contact_urls_view.php * Update contact_import.php * Update contact_import.php * Update contact_email_edit.php * Update contact_url_edit.php * Update contact_relation_edit.php * Update contact_note_edit.php * Update contact_setting_edit.php * Update contact_attachment_edit.php * Update contact_edit.php * Update contact_phones_view.php * Update contact_note_edit.php * Update contact_attachment_edit.php * Update contact_phones_view.php * Update contact_edit.php * Update contacts.php * Update contact_edit.php * Update contact_edit.php * Update contact_edit.php * Update contact_edit.php * Update contact_edit.php * Update contact_phone_edit.php * Update contact_addresses.php * Update contact_addresses_view.php * Update contact_attachment_edit.php * Update contact_attachments.php * Update contact_attachments_view.php * Update contact_edit.php * Update contact_email_edit.php * Update contact_emails.php * Update contact_emails_view.php * Update contact_extensions.php * Update contact_extensions_view.php * Update contact_import.php * Update contact_import_google.php * Update contact_json.php * Update contact_note_edit.php * Update contact_notes.php * Update contact_notes_view.php * Update contact_phone_edit.php * Update contact_phones.php * Update contact_phones_view.php * Update contact_relations.php * Update contact_relations_view.php * Update contact_setting_edit.php * Update contact_settings.php * Update contact_time_edit.php * Update contact_timer.php * Update contact_timer_inc.php * Update contact_times.php * Update contact_url_edit.php * Update contact_urls.php * Update contact_urls_view.php * Update contact_view.php * Update contacts.php * Update contacts_vcard.php
This commit is contained in:
parent
7b25e81a8d
commit
9df57e679d
|
|
@ -46,8 +46,22 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$address_label = '';
|
||||
$address_label_custom = '';
|
||||
$address_street = '';
|
||||
$address_extended = '';
|
||||
$address_community = '';
|
||||
$address_locality = '';
|
||||
$address_region = '';
|
||||
$address_postal_code = '';
|
||||
$address_country = '';
|
||||
$address_latitude = '';
|
||||
$address_longitude = '';
|
||||
$address_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_address_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -56,12 +70,12 @@
|
|||
}
|
||||
|
||||
//get the contact uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (!empty($_POST)) {
|
||||
$address_type = $_POST["address_type"];
|
||||
$address_label = $_POST["address_label"];
|
||||
$address_label_custom = $_POST["address_label_custom"];
|
||||
|
|
@ -78,11 +92,11 @@
|
|||
$address_description = $_POST["address_description"];
|
||||
|
||||
//use custom label if set
|
||||
$address_label = $address_label_custom != '' ? $address_label_custom : $address_label;
|
||||
$address_label = !empty($address_label_custom) ? $address_label_custom : $address_label;
|
||||
}
|
||||
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -113,7 +127,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -140,7 +154,7 @@
|
|||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$database->execute($sql, $parameters);
|
||||
$database->execute($sql, $parameters ?? null);
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +171,7 @@
|
|||
message::add($text['message-update']);
|
||||
}
|
||||
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_addresses'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contact_addresses'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_addresses'][0]['address_type'] = $address_type;
|
||||
|
|
@ -188,7 +202,7 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
if (!empty($_GET) && !empty($_POST["persistformvar"])) {
|
||||
$contact_address_uuid = $_GET["id"];
|
||||
$sql = "select * from v_contact_addresses ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
|
|
@ -196,8 +210,8 @@
|
|||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_address_uuid'] = $contact_address_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$row = $database->select($sql, $parameters ?? null, 'row');
|
||||
if (!empty($row)) {
|
||||
$address_type = $row["address_type"];
|
||||
$address_label = $row["address_label"];
|
||||
$address_street = $row["address_street"];
|
||||
|
|
@ -273,7 +287,7 @@
|
|||
echo " ".$text['label-address_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["address_label"])) {
|
||||
if (!empty($_SESSION["contact"]["address_label"])) {
|
||||
sort($_SESSION["contact"]["address_label"]);
|
||||
foreach($_SESSION["contact"]["address_label"] as $row) {
|
||||
$address_label_options[] = "<option value='".$row."' ".(($row == $address_label) ? "selected='selected'" : null).">".$row."</option>";
|
||||
|
|
@ -290,15 +304,15 @@
|
|||
$default_labels[] = $text['option-billing'];
|
||||
$default_labels[] = $text['option-other'];
|
||||
foreach ($default_labels as $default_label) {
|
||||
$address_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
|
||||
$address_label_options[] = "<option value='".$default_label."' ".!empty($selected[$default_label]).">".$default_label."</option>";
|
||||
}
|
||||
$address_label_found = (in_array($address_label, $default_labels)) ? true : false;
|
||||
}
|
||||
echo " <select class='formfld' ".((!$address_label_found && $address_label != '') ? "style='display: none;'" : null)." name='address_label' id='address_label' onchange=\"getElementById('address_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($address_label) && !$address_label_found) ? "style='display: none;'" : null)." name='address_label' id='address_label' onchange=\"getElementById('address_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($address_label_options)) ? implode("\n", $address_label_options) : null;
|
||||
echo (!empty($address_label_options)) ? implode("\n", $address_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($address_label_found || $address_label == '') ? "style='display: none;'" : null)." name='address_label_custom' id='address_label_custom' value=\"".((!$address_label_found) ? htmlentities($address_label) : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($address_label) || $address_label_found) ? "style='display: none;'" : null)." name='address_label_custom' id='address_label_custom' value=\"".((!$address_label_found) ? htmlentities($address_label) : null)."\">\n";
|
||||
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('address_label');\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-address_label']."\n";
|
||||
|
|
@ -458,4 +472,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,11 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//set the uuid
|
||||
if (is_uuid($_GET['id'])) {
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
$contact_uuid = $_GET['id'];
|
||||
}
|
||||
|
||||
|
|
@ -52,17 +55,17 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by address_primary desc, address_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_addresses = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
|
||||
if (!empty($contact_addresses)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
echo " <div class='heading'><b>".$text['label-addresses']."</b></div>\n";
|
||||
echo " <div class='heading'><b>".!empty($text['label-addresses'])."</b></div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
echo "</div>\n";
|
||||
|
||||
|
|
@ -70,21 +73,21 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_address_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"edit_all_toggle('addresses');\" ".($contact_addresses ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_addresses' name='checkbox_all' onclick=\"edit_all_toggle('addresses');\" ".(!empty($contact_addresses) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-address_label']."</th>\n";
|
||||
echo "<th>".$text['label-address_address']."</th>\n";
|
||||
echo "<th>".$text['label-address_locality'].", ".$text['label-address_region']."</th>\n";
|
||||
echo "<th class='center'>".$text['label-address_country']."</th>\n";
|
||||
echo "<th class='pct-15'>".!empty($text['label-address_label'])."</th>\n";
|
||||
echo "<th>".!empty($text['label-address_address'])."</th>\n";
|
||||
echo "<th>".!empty($text['label-address_locality']).", ".!empty($text['label-address_region'])."</th>\n";
|
||||
echo "<th class='center'>".!empty($text['label-address_country'])."</th>\n";
|
||||
echo "<th class='shrink'> </th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-address_description']."</th>\n";
|
||||
if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo "<th class='hide-md-dn'>".!empty($text['label-address_description'])."</th>\n";
|
||||
if (permission_exists('contact_address_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
|
||||
if (!empty($contact_addresses)) {
|
||||
$x = 0;
|
||||
foreach ($contact_addresses as $row) {
|
||||
$map_query = $row['address_street']." ".$row['address_extended'].", ".$row['address_locality'].", ".$row['address_region'].", ".$row['address_region'].", ".$row['address_postal_code'];
|
||||
|
|
@ -99,13 +102,13 @@
|
|||
echo " </td>\n";
|
||||
}
|
||||
echo " <td>".escape($row['address_label'])." ".($row['address_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
$address = escape($row['address_street']).($row['address_extended'] != '' ? " ".escape($row['address_extended']) : null);
|
||||
$address = escape($row['address_street']).(!empty($row['address_extended']) ? " ".escape($row['address_extended']) : null);
|
||||
echo " <td class='pct-25 overflow no-wrap'><a href='".$list_row_url."'>".$address."</a> </td>\n";
|
||||
echo " <td class='no-wrap'>".escape($row['address_locality']).(($row['address_locality'] != '' && $row['address_region'] != '') ? ", " : null).escape($row['address_region'])." </td>\n";
|
||||
echo " <td class='no-wrap'>".escape($row['address_locality']).((!empty($row['address_locality']) && !empty($row['address_region'])) ? ", " : null).escape($row['address_region'])." </td>\n";
|
||||
echo " <td class='center'>".escape($row['address_country'])." </td>\n";
|
||||
echo " <td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".$text['label-google_map']."' title='".$text['label-google_map']."'></a></td>\n";
|
||||
echo " <td class='button no-link'><a href=\"http://maps.google.com/maps?q=".urlencode($map_query)."&hl=en\" target=\"_blank\"><img src='resources/images/icon_gmaps.png' style='width: 21px; height: 21px; alt='".!empty($text['label-google_map'])."' title='".!empty($text['label-google_map'])."'></a></td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['address_description'])." </td>\n";
|
||||
if (permission_exists('contact_address_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_address_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -121,4 +124,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by address_primary desc, address_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_addresses = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_addresses) && @sizeof($contact_addresses) != 0) {
|
||||
if (!empty($contact_addresses)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='grid' style='grid-template-columns: 70px auto 30px;'>\n";
|
||||
|
|
@ -99,4 +99,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -36,11 +36,11 @@
|
|||
$text = $language->get();
|
||||
|
||||
//get attachment uuid
|
||||
$contact_attachment_uuid = $_GET['id'];
|
||||
$action = $_GET['action'];
|
||||
$contact_attachment_uuid = $_GET['id'] ?? '';
|
||||
$action = $_GET['action'] ?? '';
|
||||
|
||||
//get media
|
||||
if (is_uuid($contact_attachment_uuid)) {
|
||||
if (!empty($contact_attachment_uuid) && is_uuid($contact_attachment_uuid)) {
|
||||
|
||||
$sql = "select attachment_filename, attachment_content from v_contact_attachments ";
|
||||
$sql .= "where contact_attachment_uuid = :contact_attachment_uuid ";
|
||||
|
|
@ -48,15 +48,15 @@
|
|||
$parameters['contact_attachment_uuid'] = $contact_attachment_uuid;
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$database = new database;
|
||||
$attachment = $database->select($sql, $parameters, 'row');
|
||||
$attachment = $database->select($sql, $parameters ?? null, 'row');
|
||||
unset($sql, $parameters);
|
||||
|
||||
$attachment_type = strtolower(pathinfo($attachment['attachment_filename'], PATHINFO_EXTENSION));
|
||||
$attachment_type = strtolower(pathinfo($attachment['attachment_filename'] ?? '', PATHINFO_EXTENSION));
|
||||
|
||||
//determine mime type
|
||||
$content_type = 'application/octet-stream'; //set default
|
||||
$allowed_attachment_types = json_decode($_SESSION['contacts']['allowed_attachment_types']['text'], true);
|
||||
if (is_array($allowed_attachment_types) && sizeof($allowed_attachment_types) != 0) {
|
||||
$allowed_attachment_types = json_decode($_SESSION['contacts']['allowed_attachment_types']['text'] ?? '', true);
|
||||
if (!empty($allowed_attachment_types)) {
|
||||
if ($allowed_attachment_types[$attachment_type] != '') {
|
||||
$content_type = $allowed_attachment_types[$attachment_type];
|
||||
}
|
||||
|
|
@ -82,4 +82,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -43,13 +43,13 @@
|
|||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
$contact_attachment_uuid = $_REQUEST['id'];
|
||||
$contact_uuid = $_REQUEST['contact_uuid'];
|
||||
$contact_attachment_uuid = $_REQUEST['id'] ?? '';
|
||||
$contact_uuid = $_REQUEST['contact_uuid'] ?? '';
|
||||
|
||||
if (is_uuid($contact_attachment_uuid) && is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_attachment_uuid) && !empty($contact_uuid) && is_uuid($contact_attachment_uuid) && is_uuid($contact_uuid)) {
|
||||
$action = 'update';
|
||||
}
|
||||
else if (is_uuid($contact_uuid)) {
|
||||
else if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$action = 'add';
|
||||
}
|
||||
else {
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST) && sizeof($_POST) != 0) {
|
||||
if (!empty($_POST)) {
|
||||
|
||||
$attachment = $_FILES['attachment'];
|
||||
$attachment_primary = $_POST['attachment_primary'];
|
||||
|
|
@ -71,7 +71,7 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
if (!is_array($attachment) || sizeof($attachment) == 0) {
|
||||
if (empty($attachment) || sizeof($attachment) == 0) {
|
||||
$attachment_type = strtolower(pathinfo($_POST['attachment_filename'], PATHINFO_EXTENSION));
|
||||
}
|
||||
else {
|
||||
|
|
@ -87,7 +87,7 @@
|
|||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$database->execute($sql, $parameters);
|
||||
$database->execute($sql, $parameters ?? null);
|
||||
unset($sql, $parameters);
|
||||
|
||||
$allowed_primary_attachment = true;
|
||||
|
|
@ -96,7 +96,7 @@
|
|||
//format array
|
||||
$allowed_extensions = array_keys(json_decode($_SESSION['contact']['allowed_attachment_types']['text'], true));
|
||||
$array['contact_attachments'][$index]['contact_attachment_uuid'] = $action == 'update' ? $contact_attachment_uuid : uuid();
|
||||
$array['contact_attachments'][$index]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contact_attachments'][$index]['domain_uuid'] = $_SESSION['domain_uuid'] ?? '';
|
||||
$array['contact_attachments'][$index]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_attachments'][$index]['attachment_primary'] = $allowed_primary_attachment ? 1 : 0;
|
||||
if ($attachment['error'] == '0' && in_array(strtolower(pathinfo($attachment['name'], PATHINFO_EXTENSION)), $allowed_extensions)) {
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
}
|
||||
|
||||
//get form data
|
||||
if (is_array($_GET) && sizeof($_GET) != 0) {
|
||||
if (!empty($_GET)) {
|
||||
$sql = "select * from v_contact_attachments ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_attachment_uuid = :contact_attachment_uuid ";
|
||||
|
|
@ -132,7 +132,7 @@
|
|||
$parameters['contact_attachment_uuid'] = $contact_attachment_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$attachment_primary = $row["attachment_primary"];
|
||||
$attachment_filename = $row["attachment_filename"];
|
||||
$attachment_content = $row["attachment_content"];
|
||||
|
|
@ -180,7 +180,7 @@
|
|||
echo " ".$text['label-attachment']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
$attachment_type = strtolower(pathinfo($attachment_filename, PATHINFO_EXTENSION));
|
||||
$attachment_type = strtolower(pathinfo($attachment_filename ?? '', PATHINFO_EXTENSION));
|
||||
if ($action == 'update') {
|
||||
echo "<input type='hidden' name='attachment_filename' value=\"".escape($attachment_filename)."\">\n";
|
||||
if ($attachment_type == 'jpg' || $attachment_type == 'jpeg' || $attachment_type == 'gif' || $attachment_type == 'png') {
|
||||
|
|
@ -226,7 +226,7 @@
|
|||
echo " ".$text['label-attachment_description']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='attachment_description' maxlength='255' value=\"".escape($attachment_description)."\">\n";
|
||||
echo " <input class='formfld' type='text' name='attachment_description' maxlength='255' value=\"".escape($attachment_description ?? '')."\">\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -244,4 +244,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,19 +41,22 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the contact attachment list
|
||||
$sql = "select *, length(decode(attachment_content,'base64')) as attachment_size from v_contact_attachments ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by attachment_primary desc, attachment_filename asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_attachments = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
|
||||
if (!empty($contact_attachments)) {
|
||||
|
||||
//styles and attachment layer
|
||||
echo "<style>\n";
|
||||
|
|
@ -89,7 +92,7 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_attachment_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"edit_all_toggle('attachments');\" ".($contact_attachments ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_attachments' name='checkbox_all' onclick=\"edit_all_toggle('attachments');\" ".(!empty($contact_attachments) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-type']."</th>\n";
|
||||
|
|
@ -97,12 +100,12 @@
|
|||
echo "<th>".$text['label-attachment_size']."</th>\n";
|
||||
echo "<th>".$text['label-tools']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-attachment_description']."</th>\n";
|
||||
if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_attachment_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
|
||||
if (!empty($contact_attachments)) {
|
||||
$x = 0;
|
||||
foreach ($contact_attachments as $row) {
|
||||
$attachment_type = strtolower(pathinfo($row['attachment_filename'], PATHINFO_EXTENSION));
|
||||
|
|
@ -129,7 +132,7 @@
|
|||
}
|
||||
echo " </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['attachment_description'])."</td>\n";
|
||||
if (permission_exists('contact_attachment_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_attachment_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -145,4 +148,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by attachment_primary desc, attachment_filename asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_attachments = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_attachments) && @sizeof($contact_attachments) != 0) {
|
||||
if (!empty($contact_attachments)) {
|
||||
|
||||
//styles and attachment layer
|
||||
echo "<style>\n";
|
||||
|
|
@ -103,4 +103,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,8 +42,27 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$contact_organization = '';
|
||||
$contact_name_prefix = '';
|
||||
$contact_name_given = '';
|
||||
$contact_name_middle = '';
|
||||
$contact_name_family = '';
|
||||
$contact_name_suffix = '';
|
||||
$contact_nickname = '';
|
||||
$contact_title = '';
|
||||
$contact_role = '';
|
||||
$contact_category = '';
|
||||
$contact_note = '';
|
||||
$url_label = '';
|
||||
$relation_label = '';
|
||||
$contact_attachments = [];
|
||||
|
||||
//set from session variables
|
||||
$body_text_color = !empty($_SESSION['theme']['body_text_color']) ? $_SESSION['theme']['body_text_color'] : 'false';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_uuid = $_REQUEST["id"];
|
||||
$id = $_REQUEST["id"];
|
||||
|
|
@ -53,7 +72,7 @@
|
|||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST) && count($_POST) > 0) {
|
||||
if (!empty($_POST)) {
|
||||
$contact_organization = $_POST["contact_organization"];
|
||||
$contact_name_prefix = $_POST["contact_name_prefix"];
|
||||
$contact_name_given = $_POST["contact_name_given"];
|
||||
|
|
@ -89,7 +108,7 @@
|
|||
}
|
||||
|
||||
//process the user data and save it to the database
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//debug info
|
||||
//view_array($_POST, true);
|
||||
|
|
@ -103,12 +122,12 @@
|
|||
}
|
||||
|
||||
//process the http post data by submitted action
|
||||
if ($_POST['action'] != '' && !empty($_POST['action'])) {
|
||||
if (!empty($_POST['action'])) {
|
||||
|
||||
//prepare the array(s)
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_users'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_users'][]['contact_user_uuid'] = $row['contact_user_uuid'];
|
||||
$x++;
|
||||
|
|
@ -117,7 +136,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_groups'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_groups'][]['contact_group_uuid'] = $row['contact_group_uuid'];
|
||||
$x++;
|
||||
|
|
@ -126,7 +145,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_phones'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_phones'][]['contact_phone_uuid'] = $row['contact_phone_uuid'];
|
||||
$x++;
|
||||
|
|
@ -135,7 +154,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_addresses'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_addresses'][]['contact_address_uuid'] = $row['contact_address_uuid'];
|
||||
$x++;
|
||||
|
|
@ -144,7 +163,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_emails'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_emails'][]['contact_email_uuid'] = $row['contact_email_uuid'];
|
||||
$x++;
|
||||
|
|
@ -153,7 +172,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_urls'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_urls'][]['contact_url_uuid'] = $row['contact_url_uuid'];
|
||||
$x++;
|
||||
|
|
@ -162,7 +181,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_relations'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_relations'][]['contact_relation_uuid'] = $row['contact_relation_uuid'];
|
||||
$x++;
|
||||
|
|
@ -171,7 +190,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_settings'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_settings'][]['contact_setting_uuid'] = $row['contact_setting_uuid'];
|
||||
$x++;
|
||||
|
|
@ -180,7 +199,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_attachments'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_attachments'][]['contact_attachment_uuid'] = $row['contact_attachment_uuid'];
|
||||
$x++;
|
||||
|
|
@ -189,7 +208,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_times'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_times'][]['contact_time_uuid'] = $row['contact_time_uuid'];
|
||||
$x++;
|
||||
|
|
@ -198,7 +217,7 @@
|
|||
|
||||
$x = 0;
|
||||
foreach ($_POST['contact_notes'] as $row) {
|
||||
if (is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
if (!empty($row['contact_uuid']) && is_uuid($row['contact_uuid']) && $row['checked'] === 'true') {
|
||||
$array['contacts'][$x]['checked'] = $row['checked'];
|
||||
$array['contacts'][$x]['contact_notes'][]['contact_note_uuid'] = $row['contact_note_uuid'];
|
||||
$x++;
|
||||
|
|
@ -272,7 +291,7 @@
|
|||
}
|
||||
|
||||
//add the contact_uuid
|
||||
if (!is_uuid($_POST["contact_uuid"])) {
|
||||
if (empty($_POST["contact_uuid"])) {
|
||||
$contact_uuid = uuid();
|
||||
}
|
||||
|
||||
|
|
@ -314,7 +333,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_phones)) {
|
||||
if (!empty($contact_phones)) {
|
||||
foreach ($contact_phones as $row) {
|
||||
if (!empty($row['phone_number'])) {
|
||||
//add the speed dial
|
||||
|
|
@ -322,9 +341,9 @@
|
|||
$array['contacts'][0]['contact_phones'][$y]['contact_uuid'] = $contact_uuid;
|
||||
$array['contacts'][0]['contact_phones'][$y]['contact_phone_uuid'] = $row["contact_phone_uuid"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_label'] = $row["phone_label"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_voice'] = $row["phone_type_voice"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_voice'] = $row["phone_type_voice"] ?? '';
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_fax'] = $row["phone_type_fax"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_video'] = $row["phone_type_video"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_video'] = $row["phone_type_video"] ?? '';
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_type_text'] = $row["phone_type_text"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_speed_dial'] = $row["phone_speed_dial"];
|
||||
$array['contacts'][0]['contact_phones'][$y]['phone_country_code'] = $row["phone_country_code"];
|
||||
|
|
@ -334,7 +353,7 @@
|
|||
$array['contacts'][0]['contact_phones'][$y]['phone_description'] = $row["phone_description"];
|
||||
|
||||
//clear the cache
|
||||
if ($row["phone_speed_dial"] != '') {
|
||||
if (!empty($row["phone_speed_dial"])) {
|
||||
$cache = new cache;
|
||||
$cache->delete("app.dialplan.speed_dial.".$row["phone_speed_dial"]."@".$_SESSION['domain_name']);
|
||||
}
|
||||
|
|
@ -346,7 +365,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_addresses)) {
|
||||
if (!empty($contact_addresses)) {
|
||||
foreach ($contact_addresses as $row) {
|
||||
if (!empty($row['address_street'])) {
|
||||
$array['contacts'][0]['contact_addresses'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -377,7 +396,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_emails)) {
|
||||
if (!empty($contact_emails)) {
|
||||
foreach ($contact_emails as $row) {
|
||||
if (!empty($row['email_address'])) {
|
||||
$array['contacts'][0]['contact_emails'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -394,13 +413,13 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_urls)) {
|
||||
if (!empty($contact_urls)) {
|
||||
foreach ($contact_urls as $row) {
|
||||
if (!empty($row['url_address'])) {
|
||||
$array['contacts'][0]['contact_urls'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contacts'][0]['contact_urls'][$y]['contact_uuid'] = $contact_uuid;
|
||||
$array['contacts'][0]['contact_urls'][$y]['contact_url_uuid'] = $row["contact_url_uuid"];
|
||||
$array['contacts'][0]['contact_urls'][$y]['url_type'] = $row["url_type"];
|
||||
$array['contacts'][0]['contact_urls'][$y]['url_type'] = $row["url_type"] ?? '';
|
||||
$array['contacts'][0]['contact_urls'][$y]['url_label'] = $row["url_label"];
|
||||
$array['contacts'][0]['contact_urls'][$y]['url_address'] = $row["url_address"];
|
||||
$array['contacts'][0]['contact_urls'][$y]['url_primary'] = $row["url_primary"];
|
||||
|
|
@ -411,7 +430,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_relations)) {
|
||||
if (!empty($contact_relations)) {
|
||||
foreach ($contact_relations as $row) {
|
||||
if (!empty($row['contact_relation_uuid'])) {
|
||||
$array['contacts'][0]['contact_relations'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -425,7 +444,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_settings)) {
|
||||
if (!empty($contact_settings)) {
|
||||
foreach ($contact_settings as $row) {
|
||||
if (strlen($row['contact_setting_category']) > 0 && strlen($row['contact_setting_subcategory']) > 0 && !empty($row['contact_setting_name'])) {
|
||||
$array['contacts'][0]['contact_settings'][$y]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -444,7 +463,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_attachments)) {
|
||||
if (!empty($contact_attachments)) {
|
||||
foreach ($contact_attachments as $row) {
|
||||
if (!empty($row['attachment_description'])) {
|
||||
$array['contacts'][0]['contact_attachments'][$y]['contact_attachment_uuid'] = $row["contact_attachment_uuid"];
|
||||
|
|
@ -463,7 +482,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_times)) {
|
||||
if (!empty($contact_times)) {
|
||||
foreach ($contact_times as $row) {
|
||||
if (!empty($row['time_start'])) {
|
||||
$array['contacts'][0]['contact_times'][$y]['contact_time_uuid'] = $row["contact_time_uuid"];
|
||||
|
|
@ -478,7 +497,7 @@
|
|||
}
|
||||
|
||||
$y = 0;
|
||||
if (is_array($contact_notes)) {
|
||||
if (!empty($contact_notes)) {
|
||||
foreach ($contact_notes as $row) {
|
||||
if (!empty($row['contact_note'])) {
|
||||
$array['contacts'][0]['contact_notes'][$y]['contact_note_uuid'] = $row["contact_note_uuid"];
|
||||
|
|
@ -493,7 +512,7 @@
|
|||
}
|
||||
|
||||
//save the data
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
//add the permission object
|
||||
$p = new permissions;
|
||||
$p->add('contact_add', 'temp');
|
||||
|
|
@ -529,21 +548,21 @@
|
|||
$_SESSION["message"] = $text['message-update'];
|
||||
}
|
||||
//header('Location: contacts.php');
|
||||
header('Location: contact_edit.php?id='.urlencode($contact_uuid ?? ''));
|
||||
header('Location: contact_edit.php?id='.urlencode($contact_uuid ?? null));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$sql = "select * from v_contacts ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = :domain_uuid ";
|
||||
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
$row = $database->select($sql, $parameters ?? null, 'row');
|
||||
if (!empty($row)) {
|
||||
$contact_organization = $row["contact_organization"];
|
||||
$contact_name_prefix = $row["contact_name_prefix"];
|
||||
$contact_name_given = $row["contact_name_given"];
|
||||
|
|
@ -569,8 +588,8 @@
|
|||
//$contact_settings = $row["contact_settings"];
|
||||
//$contact_user_uuid = $row["contact_user_uuid"];
|
||||
|
||||
$contact_user_uuid = $row["contact_user_uuid"];
|
||||
$contact_group_uuid = $row["contact_group_uuid"];
|
||||
$contact_user_uuid = $row["contact_user_uuid"] ?? '';
|
||||
$contact_group_uuid = $row["contact_group_uuid"] ?? '';
|
||||
|
||||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
|
@ -586,9 +605,9 @@
|
|||
unset($sql, $parameters);
|
||||
|
||||
//determine if contact assigned to a user
|
||||
if (is_array($users) && sizeof($users) != 0) {
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
if ($user['contact_uuid'] == $contact_uuid) {
|
||||
if (!empty($contact_uuid) && $user['contact_uuid'] == $contact_uuid) {
|
||||
$contact_user_uuid = $user['user_uuid'];
|
||||
break;
|
||||
}
|
||||
|
|
@ -596,7 +615,7 @@
|
|||
}
|
||||
|
||||
//get the users assigned to this contact
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select c.domain_uuid, c.contact_uuid, u.username, u.user_uuid, a.contact_user_uuid ";
|
||||
$sql .= "from v_contacts as c, v_users as u, v_contact_users as a ";
|
||||
$sql .= "where c.contact_uuid = :contact_uuid ";
|
||||
|
|
@ -612,7 +631,7 @@
|
|||
}
|
||||
|
||||
//get the assigned groups of this contact
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select g.*, cg.contact_group_uuid ";
|
||||
$sql .= "from v_groups as g, v_contact_groups as cg ";
|
||||
$sql .= "where cg.group_uuid = g.group_uuid ";
|
||||
|
|
@ -625,7 +644,7 @@
|
|||
$parameters['group_uuid'] = $_SESSION["user_uuid"];
|
||||
$database = new database;
|
||||
$contact_groups_assigned = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
if (!empty($contact_groups_assigned)) {
|
||||
foreach ($contact_groups_assigned as $field) {
|
||||
$contact_groups[] = "'".$field['group_uuid']."'";
|
||||
}
|
||||
|
|
@ -636,7 +655,7 @@
|
|||
//get the available groups to this contact
|
||||
$sql = "select group_uuid, group_name from v_groups ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
if (is_array($contact_groups) && @sizeof($contact_groups) != 0) {
|
||||
if (!empty($contact_groups)) {
|
||||
$sql .= "and group_uuid not in (".implode(',', $contact_groups).") ";
|
||||
}
|
||||
$sql .= "order by group_name asc ";
|
||||
|
|
@ -646,7 +665,7 @@
|
|||
unset($sql, $parameters, $contact_groups);
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_phones ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -658,15 +677,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_phone_uuid
|
||||
if (!is_uuid($contact_phone_uuid)) {
|
||||
if (empty($contact_phone_uuid)) {
|
||||
$contact_phone_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_phones) || count($contact_phones) == 0) {
|
||||
$x = is_array($contact_phones) ? count($contact_phones) : 0;
|
||||
if (empty($contact_phones) || count($contact_phones) == 0) {
|
||||
$x = !empty($contact_phones) ? count($contact_phones) : 0;
|
||||
$contact_phones[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_phones[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_phones[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_phones[$x]['contact_phone_uuid'] = uuid();
|
||||
$contact_phones[$x]['phone_label'] = '';
|
||||
$contact_phones[$x]['phone_type_voice'] = '';
|
||||
|
|
@ -682,7 +701,7 @@
|
|||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_addresses ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -695,15 +714,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_address_uuid
|
||||
if (!is_uuid($contact_address_uuid)) {
|
||||
if (empty($contact_address_uuid)) {
|
||||
$contact_address_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_addresses) || count($contact_addresses) == 0) {
|
||||
$x = is_array($contact_addresses) ? count($contact_addresses) : 0;
|
||||
if (empty($contact_addresses) || count($contact_addresses) == 0) {
|
||||
$x = !empty($contact_addresses) ? count($contact_addresses) : 0;
|
||||
$contact_addresses[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_addresses[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_addresses[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_addresses[$x]['contact_address_uuid'] = uuid();
|
||||
$contact_addresses[$x]['address_label'] = '';
|
||||
$contact_addresses[$x]['address_type'] = '';
|
||||
|
|
@ -721,7 +740,7 @@
|
|||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_emails ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -733,15 +752,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_email_uuid
|
||||
if (!is_uuid($contact_email_uuid)) {
|
||||
if (empty($contact_email_uuid)) {
|
||||
$contact_email_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_emails) || count($contact_emails) == 0) {
|
||||
$x = is_array($contact_emails) ? count($contact_emails) : 0;
|
||||
if (empty($contact_emails) || count($contact_emails) == 0) {
|
||||
$x = !empty($contact_emails) ? count($contact_emails) : 0;
|
||||
$contact_emails[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_emails[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_emails[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_emails[$x]['contact_email_uuid'] = uuid();
|
||||
$contact_emails[$x]['email_label'] = '';
|
||||
$contact_emails[$x]['email_address'] = '';
|
||||
|
|
@ -750,7 +769,7 @@
|
|||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_urls ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -763,15 +782,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_url_uuid
|
||||
if (!is_uuid($contact_url_uuid)) {
|
||||
if (empty($contact_url_uuid)) {
|
||||
$contact_url_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_urls) || count($contact_urls) == 0) {
|
||||
$x = is_array($contact_urls) ? count($contact_urls) : 0;
|
||||
if (empty($contact_urls) || count($contact_urls) == 0) {
|
||||
$x = !empty($contact_urls) ? count($contact_urls) : 0;
|
||||
$contact_urls[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_urls[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_urls[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_urls[$x]['contact_url_uuid'] = uuid();
|
||||
$contact_urls[$x]['url_type'] = '';
|
||||
$contact_urls[$x]['url_label'] = '';
|
||||
|
|
@ -781,34 +800,34 @@
|
|||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_relations ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? null;
|
||||
$database = new database;
|
||||
$contact_relations = $database->select($sql, $parameters, 'all');
|
||||
unset ($sql, $parameters);
|
||||
}
|
||||
|
||||
//add the $contact_setting_uuid
|
||||
if (!is_uuid($contact_relation_uuid)) {
|
||||
if (empty($contact_relation_uuid)) {
|
||||
$contact_relation_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_relations) || count($contact_relations) == 0) {
|
||||
$x = is_array($contact_relations) ? count($contact_relations) : 0;
|
||||
if (empty($contact_relations) || count($contact_relations) == 0) {
|
||||
$x = !empty($contact_relations) ? count($contact_relations) : 0;
|
||||
$contact_relations[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_relations[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_relations[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_relations[$x]['contact_relation_uuid'] = uuid();
|
||||
$contact_relations[$x]['relation_label'] = '';
|
||||
$contact_relations[$x]['relation_contact_uuid'] = '';
|
||||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_settings ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -820,15 +839,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_setting_uuid
|
||||
if (!is_uuid($contact_setting_uuid)) {
|
||||
if (empty($contact_setting_uuid)) {
|
||||
$contact_setting_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_settings) || count($contact_settings) == 0) {
|
||||
$x = is_array($contact_settings) ? count($contact_settings) : 0;
|
||||
if (empty($contact_settings) || count($contact_settings) == 0) {
|
||||
$x = !empty($contact_settings) ? count($contact_settings) : 0;
|
||||
$contact_settings[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_settings[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_settings[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_settings[$x]['contact_setting_uuid'] = uuid();
|
||||
$contact_settings[$x]['contact_setting_category'] = '';
|
||||
$contact_settings[$x]['contact_setting_subcategory'] = '';
|
||||
|
|
@ -840,7 +859,7 @@
|
|||
}
|
||||
|
||||
//get the contact attachments
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select *, length(decode(attachment_content,'base64')) as attachment_size from v_contact_attachments ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
|
|
@ -853,7 +872,7 @@
|
|||
}
|
||||
|
||||
//get the child data
|
||||
if (is_uuid($contact_uuid)) {
|
||||
if (!empty($contact_uuid) && is_uuid($contact_uuid)) {
|
||||
$sql = "select * from v_contact_times ";
|
||||
$sql .= "where contact_uuid = :contact_uuid ";
|
||||
//$sql .= "and domain_uuid = '".$domain_uuid."' ";
|
||||
|
|
@ -865,15 +884,15 @@
|
|||
}
|
||||
|
||||
//add the $contact_time_uuid
|
||||
if (!is_uuid($contact_time_uuid)) {
|
||||
if (empty($contact_time_uuid)) {
|
||||
$contact_time_uuid = uuid();
|
||||
}
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_times)) {
|
||||
$x = is_array($contact_times) ? count($contact_times) : 0;
|
||||
if (empty($contact_times)) {
|
||||
$x = !empty($contact_times) ? count($contact_times) : 0;
|
||||
$contact_times[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_times[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_times[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_times[$x]['contact_time_uuid'] = uuid();
|
||||
}
|
||||
|
||||
|
|
@ -883,16 +902,16 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by last_mod_date desc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? null;
|
||||
$database = new database;
|
||||
$contact_notes = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//add an empty row
|
||||
if (!is_array($contact_times)) {
|
||||
$x = is_array($contact_times) ? count($contact_times) : 0;
|
||||
if (empty($contact_times)) {
|
||||
$x = !empty($contact_times) ? count($contact_times) : 0;
|
||||
$contact_times[$x]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$contact_times[$x]['contact_uuid'] = $contact_uuid;
|
||||
$contact_times[$x]['contact_uuid'] = $contact_uuid ?? null;
|
||||
$contact_times[$x]['contact_time_uuid'] = uuid();
|
||||
}
|
||||
|
||||
|
|
@ -942,23 +961,23 @@
|
|||
<?php
|
||||
|
||||
//determine qr branding
|
||||
if ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] != '') {
|
||||
if (!empty($_SESSION['theme']['qr_brand_image']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'image') {
|
||||
echo "<img id='img-buffer' style='display: none;' src='".$_SESSION["theme"]["qr_brand_image"]["text"]."'>";
|
||||
$qr_option = "image: $('#img-buffer')[0],";
|
||||
$qr_mode = '4';
|
||||
$qr_size = '0.2';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] == '') {
|
||||
elseif (empty($_SESSION['theme']['qr_brand_image']['text']) && !empty($_SESSION['theme']['qr_brand_type']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'image') {
|
||||
$qr_option = '';
|
||||
$qr_mode = '3';
|
||||
$qr_size = '0';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'text' && $_SESSION['theme']['qr_brand_text']['text'] != '') {
|
||||
elseif (!empty($_SESSION['theme']['qr_brand_image']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'text') {
|
||||
$qr_option = 'label: "'.$_SESSION['theme']['qr_brand_text']['text'].'"';
|
||||
$qr_mode = '2';
|
||||
$qr_size = '0.05';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'none') {
|
||||
elseif (!empty($_SESSION['theme']['qr_brand_image']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'none') {
|
||||
$qr_option = '';
|
||||
$qr_mode = '3';
|
||||
$qr_size = '0';
|
||||
|
|
@ -1057,7 +1076,7 @@
|
|||
}
|
||||
|
||||
echo button::create(['type'=>'button','label'=>$text['button-qr_code'],'icon'=>'qrcode','collapse'=>'hide-sm-dn','onclick'=>"$('#qr_code_container').fadeIn(400);"]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid ?? '').'&type=download']);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-vcard'],'icon'=>'address-card','collapse'=>'hide-sm-dn','link'=>'contacts_vcard.php?id='.urlencode($contact_uuid ?? null).'&type=download']);
|
||||
}
|
||||
//add edit
|
||||
//if (isset($id)) {
|
||||
|
|
@ -1080,7 +1099,7 @@
|
|||
permission_exists('contact_setting_add') ||
|
||||
permission_exists('contact_attachment_add')
|
||||
)) {
|
||||
echo "<select class='formfld' style='width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid ?? '')."';\">\n";
|
||||
echo "<select class='formfld' style='width: auto; margin-left: 15px;' id='select_add' onchange=\"document.location.href='contact_' + (this.options[this.selectedIndex].value) + '_edit.php?contact_uuid=".urlencode($contact_uuid ?? null)."';\">\n";
|
||||
echo " <option value=''>".$text['button-add']."...</option>\n";
|
||||
if (permission_exists('contact_phone_add')) { echo "<option value='phone'>".$text['label-phone_number']."</option>\n"; }
|
||||
if (permission_exists('contact_address_add')) { echo "<option value='address'>".$text['label-address_address']."</option>\n"; }
|
||||
|
|
@ -1286,7 +1305,7 @@ echo " <div class='label'>\n";
|
|||
echo " ".$text['label-contact_type']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
if (is_array($_SESSION["contact"]["type"])) {
|
||||
if (!empty($_SESSION["contact"]["type"])) {
|
||||
sort($_SESSION["contact"]["type"]);
|
||||
echo " <select class='formfld' name='contact_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
|
@ -1317,7 +1336,7 @@ echo " <div class='label'>\n";
|
|||
echo " ".$text['label-contact_title']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
if (is_array($_SESSION['contact']['contact_title'])) {
|
||||
if (!empty($_SESSION['contact']['contact_title'])) {
|
||||
echo " <select class='formfld' name='contact_title'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
sort($_SESSION['contact']['contact_title']);
|
||||
|
|
@ -1335,7 +1354,7 @@ echo " <div class='label'>\n";
|
|||
echo " ".$text['label-contact_role']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
if (is_array($_SESSION['contact']['contact_role'])) {
|
||||
if (!empty($_SESSION['contact']['contact_role'])) {
|
||||
echo " <select class='formfld' name='contact_role'>\n";
|
||||
echo " <option value=''>".$text['label-contact_category']."</option>\n";
|
||||
sort($_SESSION['contact']['contact_role']);
|
||||
|
|
@ -1353,7 +1372,7 @@ echo " <div class='label'>\n";
|
|||
echo " ".$text['label-contact_category']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
if (is_array($_SESSION['contact']['contact_category'])) {
|
||||
if (!empty($_SESSION['contact']['contact_category'])) {
|
||||
echo " <select class='formfld' name='contact_category'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
sort($_SESSION['contact']['contact_category']);
|
||||
|
|
@ -1439,7 +1458,7 @@ if ($_SESSION['contact']['permissions']['boolean'] == "true") {
|
|||
if (permission_exists('contact_user_edit')) {
|
||||
echo " <div class='label' valign='top'>".$text['label-users']."</div>\n";
|
||||
echo " <div class='field no-wrap' align='left'>";
|
||||
if ($action == "update" && is_array($contact_users_assigned) && @sizeof($contact_users_assigned) != 0) {
|
||||
if ($action == "update" && !empty($contact_users_assigned)) {
|
||||
echo " <div class='vtable'>".$text['label-username']."\n";
|
||||
if ($contact_users_assigned && permission_exists('contact_user_delete')) {
|
||||
//echo " <div class='edit_delete_checkbox_all' onmouseover=\"swap_display('delete_label_users', 'delete_toggle_users');\" onmouseout=\"swap_display('delete_label_users', 'delete_toggle_users');\">\n";
|
||||
|
|
@ -1493,7 +1512,7 @@ if ($_SESSION['contact']['permissions']['boolean'] == "true") {
|
|||
if (permission_exists('contact_group_view')) {
|
||||
echo " <div class='label'>".$text['label-groups']."</div>";
|
||||
echo " <div class='field no-wrap'>";
|
||||
if (is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
if (!empty($contact_groups_assigned)) {
|
||||
echo " <div class='vtable'>".$text['label-group']."\n";
|
||||
if ($contact_groups_assigned && permission_exists('contact_group_delete')) {
|
||||
//echo " <div class='edit_delete_checkbox_all' style='float: right;' onmouseover=\"swap_display('delete_label_groups', 'delete_toggle_groups');\" onmouseout=\"swap_display('delete_label_groups', 'delete_toggle_groups');\">\n";
|
||||
|
|
@ -1529,7 +1548,7 @@ if ($_SESSION['contact']['permissions']['boolean'] == "true") {
|
|||
}
|
||||
|
||||
if (permission_exists('contact_group_add')) {
|
||||
if (is_array($contact_groups_available) && @sizeof($contact_groups_available) != 0) {
|
||||
if (!empty($contact_groups_available)) {
|
||||
echo " <div class='vtable' style='border-bottom: none;'>\n";
|
||||
echo " <select name='contact_group_uuid' class='formfld' style='width: auto; margin-right: 3px;'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
|
@ -1581,7 +1600,7 @@ if (permission_exists('contact_phone_view')) {
|
|||
echo " <div class='heading' style='position: absolute;'>\n";
|
||||
echo " <b style='float: left;'>".$text['label-phone_numbers']."</b>\n";
|
||||
if ($row['phone_primary'] == "1") {
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
}
|
||||
if (permission_exists('contact_phone_delete')) {
|
||||
echo " <div class='checkbox' style='float: left; margin-top: 3px; margin-left: 8px;'>\n";
|
||||
|
|
@ -1591,7 +1610,7 @@ if (permission_exists('contact_phone_view')) {
|
|||
}
|
||||
echo " <div class='button no-link' style='float: left; margin-top: 1px; margin-left: 8px;'>\n";
|
||||
echo " <a href='../xml_cdr/xml_cdr.php?caller_id_number=".urlencode($row['phone_number'])."'>\n";
|
||||
echo " <i class='fas fa-search fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 3px; margin-right: 3px;' title=\"".$text['button-cdr']."\"></i>\n";
|
||||
echo " <i class='fas fa-search fa-fw' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 3px; margin-right: 3px;' title=\"".$text['button-cdr']."\"></i>\n";
|
||||
echo " </a>\n";
|
||||
|
||||
$call = "send_cmd('";
|
||||
|
|
@ -1607,7 +1626,7 @@ if (permission_exists('contact_phone_view')) {
|
|||
$call .= "&auto_answer=true";
|
||||
$call .= "');";
|
||||
echo " <a href='' onclick=\"".$call."\">\n";
|
||||
echo " <i class='fas fa-phone fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 7px;' title=\"".urlencode($row['phone_number'] ?? '')."\"></i>\n";
|
||||
echo " <i class='fas fa-phone fa-fw' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 7px;' title=\"".urlencode($row['phone_number'] ?? '')."\"></i>\n";
|
||||
echo " </a>\n";
|
||||
|
||||
echo " </div>\n";
|
||||
|
|
@ -1764,7 +1783,7 @@ if (permission_exists('contact_phone_view')) {
|
|||
echo " <div class='field empty_row' style='grid-row: 9 / span 99;'>\n";
|
||||
echo " </div>\n";
|
||||
|
||||
//if (is_array($contact_phones) && @sizeof($contact_phones) > 1 && permission_exists('contact_phone_delete')) {
|
||||
//if (!empty($contact_phones) && @sizeof($contact_phones) > 1 && permission_exists('contact_phone_delete')) {
|
||||
// echo " <div class='label'>\n";
|
||||
// echo " ".$text['label-action']."\n";
|
||||
// echo " </div>\n";
|
||||
|
|
@ -1788,7 +1807,7 @@ if (permission_exists('contact_address_view')) {
|
|||
echo " <div class='heading'>\n";
|
||||
echo " <b style='float: left;'>".$text['label-addresses']."</b>\n";
|
||||
if ($row['address_primary'] == "1") {
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
}
|
||||
if (permission_exists('contact_address_delete')) {
|
||||
echo " <div class='checkbox' style='float: left; margin-top: 3px; margin-left: 8px;'>\n";
|
||||
|
|
@ -1992,7 +2011,7 @@ if (permission_exists('contact_address_view')) {
|
|||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <select class='formfld' name='contact_addresses[$x][address_primary]' style='width: auto;'>\n";
|
||||
echo " <option value=''>".escape($text['label-address_primary'])."</option>\n";
|
||||
echo " <option value=''>".escape($text['label-address_primary'] ?? '')."</option>\n";
|
||||
if ($row['address_primary'] == "1") {
|
||||
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
|
|
@ -2015,7 +2034,7 @@ if (permission_exists('contact_address_view')) {
|
|||
echo " <input class='formfld' type='text' name='contact_addresses[$x][address_description]' placeholder='' maxlength='255' value=\"".escape($row["address_description"])."\">\n";
|
||||
echo " </div>\n";
|
||||
|
||||
//if (is_array($contact_addresses) && @sizeof($contact_addresses) > 1 && permission_exists('contact_address_delete')) {
|
||||
//if (!empty($contact_addresses) && @sizeof($contact_addresses) > 1 && permission_exists('contact_address_delete')) {
|
||||
// if (is_uuid($row['contact_address_uuid'])) {
|
||||
// echo " <div class='label'>\n";
|
||||
// echo " ".$text['label-action']."\n";
|
||||
|
|
@ -2036,9 +2055,9 @@ if (permission_exists('contact_email_view')) {
|
|||
foreach($contact_emails as $row) {
|
||||
echo " <div class='form_set'>\n";
|
||||
echo " <div class='heading'>\n";
|
||||
echo " <b style='float: left;'>".$text['label-emails']."</b>\n";
|
||||
echo " <b style='float: left;'>".!empty($text['label-emails'])."</b>\n";
|
||||
if ($row['email_primary'] == "1") {
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
}
|
||||
if (permission_exists('contact_email_delete')) {
|
||||
echo " <div class='checkbox' style='float: left; margin-top: 3px; margin-left: 8px;'>\n";
|
||||
|
|
@ -2048,7 +2067,7 @@ if (permission_exists('contact_email_view')) {
|
|||
}
|
||||
echo " <div class='button no-link' style='float: left; margin-top: 1px; margin-left: 8px;'>\n";
|
||||
echo " <a href='mailto:".escape($row['email_address'])."'>\n";
|
||||
echo " <i class='fas fa-envelope fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 5px; margin-left: 3px;' title=\"".escape($row["email_label"])."\"></i>\n";
|
||||
echo " <i class='fas fa-envelope fa-fw' style='color: ".$body_text_color."; float: left; margin-top: 5px; margin-left: 3px;' title=\"".escape($row["email_label"])."\"></i>\n";
|
||||
echo " </a>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
|
|
@ -2077,7 +2096,7 @@ if (permission_exists('contact_email_view')) {
|
|||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <select class='formfld' name='contact_emails[$x][email_primary]' style='width: auto;'>\n";
|
||||
echo " <option value=''>".escape($text['label-contact_emails'])."</option>\n";
|
||||
echo " <option value=''>".escape($text['label-contact_emails'] ?? '')."</option>\n";
|
||||
if ($row['email_primary'] == "1") {
|
||||
echo " <option value='1' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
|
|
@ -2108,7 +2127,7 @@ if (permission_exists('contact_email_view')) {
|
|||
echo " <div class='field empty_row' style='grid-row: 6 / span 99;'>\n";
|
||||
echo " </div>\n";
|
||||
|
||||
//if (is_array($contact_emails) && @sizeof($contact_emails) > 1 && permission_exists('contact_email_delete')) {
|
||||
//if (!empty($contact_emails) && @sizeof($contact_emails) > 1 && permission_exists('contact_email_delete')) {
|
||||
// if (is_uuid($row['contact_email_uuid'])) {
|
||||
// echo " <div class='label'>\n";
|
||||
// echo " ".$text['label-action']."\n";
|
||||
|
|
@ -2130,7 +2149,7 @@ if (permission_exists('contact_url_view')) {
|
|||
echo " <div class='heading'>\n";
|
||||
echo " <b style='float: left;'>".$text['label-contact_url']."</b>\n";
|
||||
if ($row['url_primary'] == "1") {
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
}
|
||||
if (permission_exists('contact_url_delete')) {
|
||||
echo " <div class='checkbox' style='float: left; margin-top: 3px; margin-left: 8px;'>\n";
|
||||
|
|
@ -2140,7 +2159,7 @@ if (permission_exists('contact_url_view')) {
|
|||
}
|
||||
echo " <div class='button no-link' style='float: left; margin-top: 1px; margin-left: 8px;'>\n";
|
||||
echo " <a href='".escape($row['url_address'])."' target='_blank'>\n";
|
||||
echo " <span class='fas fa-link fa-fw' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 3px;' title=\"".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."\"></span>\n";
|
||||
echo " <span class='fas fa-link fa-fw' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 3px;' title=\"".str_replace("http://", "", str_replace("https://", "", escape($row['url_address'])))."\"></span>\n";
|
||||
echo " </a>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
|
|
@ -2161,7 +2180,7 @@ if (permission_exists('contact_url_view')) {
|
|||
echo " <div class='field no-wrap'>\n";;
|
||||
|
||||
//if there are no custom labels add defaults
|
||||
if (is_array($_SESSION["contact"]["url_label"])) {
|
||||
if (!empty($_SESSION["contact"]["url_label"])) {
|
||||
$contact_url_labels = $_SESSION["contact"]["url_label"];
|
||||
}
|
||||
else {
|
||||
|
|
@ -2175,12 +2194,12 @@ if (permission_exists('contact_url_view')) {
|
|||
}
|
||||
$url_label_found = (in_array($url_label, $contact_url_labels)) ? true : false;
|
||||
|
||||
echo " <select class='formfld' ".((!$url_label_found && $url_label != '') ? "style='display: none;'" : "style='width: auto;'")." name='contact_urls[$x][url_label]' id='url_label' onchange=\"getElementById('url_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($url_label) && !$url_label_found) ? "style='display: none;'" : "style='width: auto;'")." name='contact_urls[$x][url_label]' id='url_label' onchange=\"getElementById('url_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
||||
echo (is_array($url_label_options)) ? implode("\n", $url_label_options) : null;
|
||||
echo (!empty($url_label_options)) ? implode("\n", $url_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($url_label_found || $url_label == '') ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label ?? '') : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($url_label) || $url_label_found) ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label ?? '') : null)."\">\n";
|
||||
//echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('url_label');\">\n";
|
||||
echo " </div>\n";
|
||||
|
||||
|
|
@ -2219,7 +2238,7 @@ if (permission_exists('contact_url_view')) {
|
|||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <input class='formfld' type='text' name='contact_urls[$x][url_description]' placeholder='' maxlength='255' value=\"".escape($row["url_description"])."\">\n";
|
||||
echo " </div>\n";
|
||||
if (is_array($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
|
||||
if (!empty($contact_urls) && @sizeof($contact_urls) > 1 && permission_exists('contact_url_delete')) {
|
||||
if (is_uuid($row['contact_url_uuid'])) {
|
||||
echo " <input type='checkbox' name='contact_urls[".$x."][checked]' value='true' class='chk_delete checkbox_details' onclick=\"checkbox_on_change(this);\">\n";
|
||||
}
|
||||
|
|
@ -2237,7 +2256,7 @@ if (permission_exists('contact_url_view')) {
|
|||
}
|
||||
|
||||
if (permission_exists('contact_relation_view')) {
|
||||
if (is_array($contact_relations)) {
|
||||
if (!empty($contact_relations)) {
|
||||
|
||||
$x = 0;
|
||||
foreach($contact_relations as $row) {
|
||||
|
|
@ -2252,14 +2271,14 @@ if (permission_exists('contact_relation_view')) {
|
|||
$parameters['contact_uuid'] = $row['contact_uuid'];
|
||||
$database = new database;
|
||||
$contacts = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($contacts) && is_uuid($row['relation_contact_uuid'])) {
|
||||
if (!empty($contacts) && is_uuid($row['relation_contact_uuid'])) {
|
||||
foreach($contacts as $field) {
|
||||
if ($field['contact_uuid'] == $row['relation_contact_uuid']) {
|
||||
$name = array();
|
||||
if ($field['contact_organization'] != '') { $name[] = $field['contact_organization']; }
|
||||
if ($field['contact_name_family'] != '') { $name[] = $field['contact_name_family']; }
|
||||
if ($field['contact_name_given'] != '') { $name[] = $field['contact_name_given']; }
|
||||
if ($field['contact_name_family'] == '' && $field['contact_name_given'] == '' && $field['contact_nickname'] != '') { $name[] = $field['contact_nickname']; }
|
||||
if (!empty($field['contact_organization'])) { $name[] = $field['contact_organization']; }
|
||||
if (!empty($field['contact_name_family'])) { $name[] = $field['contact_name_family']; }
|
||||
if (!empty($field['contact_name_given'])) { $name[] = $field['contact_name_given']; }
|
||||
if (empty($field['contact_name_family']) && empty($field['contact_name_given']) && !empty($field['contact_nickname'])) { $name[] = $field['contact_nickname']; }
|
||||
$contact_name = implode(', ', $name);
|
||||
break;
|
||||
}
|
||||
|
|
@ -2279,7 +2298,7 @@ if (permission_exists('contact_relation_view')) {
|
|||
}
|
||||
echo " <div class='button no-link' style='float: left; margin-top: 1px; margin-left: 8px;'>\n";
|
||||
echo " <a href='contact_edit.php?id=".escape($row['relation_contact_uuid'])."' target='_blank'>\n";
|
||||
echo " <span class='fas fa-user-friends' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 3px;'></span>\n";
|
||||
echo " <span class='fas fa-user-friends' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 3px;'></span>\n";
|
||||
echo " </a>\n";
|
||||
echo " </div>\n";
|
||||
echo " </div>\n";
|
||||
|
|
@ -2292,7 +2311,7 @@ if (permission_exists('contact_relation_view')) {
|
|||
|
||||
|
||||
//if there are no custom labels add defaults
|
||||
if (is_array($_SESSION["contact"]["relation_label"])) {
|
||||
if (!empty($_SESSION["contact"]["relation_label"])) {
|
||||
$relation_labels = $_SESSION["contact"]["url_label"];
|
||||
}
|
||||
else {
|
||||
|
|
@ -2308,11 +2327,11 @@ if (permission_exists('contact_relation_view')) {
|
|||
$relation_label_options[] = "<option value='".escape($label)."' ".(($label == $row['relation_label']) ? "selected='selected'" : null).">".escape($label)."</option>";
|
||||
}
|
||||
$relation_label_found = (in_array($relation_label, $relation_labels)) ? true : false;
|
||||
echo " <select class='formfld' ".((!$relation_label_found && $relation_label != '') ? "style='display: none;'" : "style='auto;'")." name='contact_relations[$x][relation_label]' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($relation_label) && !$relation_label_found) ? "style='display: none;'" : "style='auto;'")." name='contact_relations[$x][relation_label]' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
|
||||
echo (!empty($relation_label_options)) ? implode("\n", $relation_label_options) : null;
|
||||
echo " </select>\n";
|
||||
//echo " <input type='text' class='formfld' ".(($relation_label_found || $relation_label == '') ? "style='display: none;'" : null)." name='contact_relations[$x][relation_label_custom]' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label) : null)."\">\n";
|
||||
//echo " <input type='text' class='formfld' ".((empty($relation_label) || $relation_label_found) ? "style='display: none;'" : null)." name='contact_relations[$x][relation_label_custom]' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label ?? '') : null)."\">\n";
|
||||
//echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('relation_label');\">\n";
|
||||
//echo " <br />\n";
|
||||
//echo $text['description-relation_label']."\n";
|
||||
|
|
@ -2394,7 +2413,7 @@ if (permission_exists('contact_setting_view')) {
|
|||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <select name='contact_settings[$x][contact_setting_order]' class='formfld'>\n";
|
||||
echo " <option value='$i' ".$selected.">".escape($text['label-contact_setting_order'])."</option>\n";
|
||||
echo " <option value='$i' ".!empty($selected).">".escape($text['label-contact_setting_order'] ?? '')."</option>\n";
|
||||
$i=0;
|
||||
while ($i<=999) {
|
||||
$selected = ($i == $row["contact_setting_order"]) ? "selected" : null;
|
||||
|
|
@ -2417,7 +2436,7 @@ if (permission_exists('contact_setting_view')) {
|
|||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <select class='formfld' name='contact_settings[$x][contact_setting_enabled]' style='width: 5em;'>\n";
|
||||
echo " <option value=''><b>".escape($text['label-contact_setting_enabled'])."</b></option>\n";
|
||||
echo " <option value=''><b>".escape($text['label-contact_setting_enabled'] ?? '')."</b></option>\n";
|
||||
if ($row['contact_setting_enabled'] == "true") {
|
||||
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
|
||||
}
|
||||
|
|
@ -2437,11 +2456,11 @@ if (permission_exists('contact_setting_view')) {
|
|||
echo " ".$text['label-description']."\n";
|
||||
echo " </div>\n";
|
||||
echo " <div class='field no-wrap'>\n";
|
||||
echo " <input class='formfld' type='text' name='contact_settings[$x][contact_setting_description]' placeholder='".escape($text['label-contact_setting_description'])."' maxlength='255' value=\"".escape($row["contact_setting_description"])."\">\n";
|
||||
echo " <input class='formfld' type='text' name='contact_settings[$x][contact_setting_description]' placeholder='".escape($text['label-contact_setting_description'] ?? '')."' maxlength='255' value=\"".escape($row["contact_setting_description"])."\">\n";
|
||||
echo " </div>\n";
|
||||
|
||||
if (is_array($contact_settings) && @sizeof($contact_settings) > 1 && permission_exists('contact_setting_delete')) {
|
||||
if (is_uuid($row['contact_setting_uuid'])) {
|
||||
if (!empty($contact_settings) && @sizeof($contact_settings) > 1 && permission_exists('contact_setting_delete')) {
|
||||
if (!empty($row['contact_setting_uuid']) && is_uuid($row['contact_setting_uuid'])) {
|
||||
echo " <div class='label'>\n";
|
||||
echo " ".$text['label-enabled']."\n";
|
||||
echo " </div>\n";
|
||||
|
|
@ -2471,7 +2490,7 @@ if (permission_exists('contact_attachment_view')) {
|
|||
echo " <div class='heading'>\n";
|
||||
echo " <b style='float: left;'>".$text['label-attachments']."</b>\n";
|
||||
if ($row['attachment_primary'] == "1") {
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$_SESSION['theme']['body_text_color']."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
echo " <i class='fas fa-star fa-xs' style='color: ".$body_text_color."; float: left; margin-top: 7px; margin-left: 8px;' title=\"".$text['label-primary']."\"></i>\n";
|
||||
}
|
||||
if (permission_exists('contact_attachment_delete')) {
|
||||
echo " <div class='checkbox' style='float: left; margin-top: 3px; margin-left: 8px;'>\n";
|
||||
|
|
|
|||
|
|
@ -46,8 +46,13 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$email_label = '';
|
||||
$email_address = '';
|
||||
$email_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_email_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -55,12 +60,12 @@
|
|||
$action = "add";
|
||||
}
|
||||
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (!empty($_POST)) {
|
||||
$email_label = $_POST["email_label"];
|
||||
$email_label_custom = $_POST["email_label_custom"];
|
||||
$email_address = $_POST["email_address"];
|
||||
|
|
@ -68,11 +73,11 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
$email_description = $_POST["email_description"];
|
||||
|
||||
//use custom label if set
|
||||
$email_label = $email_label_custom != '' ? $email_label_custom : $email_label;
|
||||
$email_label = !empty($email_label_custom) ? $email_label_custom : $email_label;
|
||||
}
|
||||
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -103,7 +108,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -147,7 +152,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
message::add($text['message-update']);
|
||||
}
|
||||
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_emails'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contact_emails'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_emails'][0]['email_label'] = $email_label;
|
||||
|
|
@ -169,8 +174,8 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_email_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_email_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_emails ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_email_uuid = :contact_email_uuid ";
|
||||
|
|
@ -178,7 +183,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
$parameters['contact_email_uuid'] = $contact_email_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');;
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$email_label = $row["email_label"];
|
||||
$email_address = $row["email_address"];
|
||||
$email_primary = $row["email_primary"];
|
||||
|
|
@ -224,7 +229,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
}
|
||||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid ?? '')]);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
|
@ -245,7 +250,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
echo " ".$text['label-email_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["email_label"])) {
|
||||
if (!empty($_SESSION["contact"]["email_label"])) {
|
||||
sort($_SESSION["contact"]["email_label"]);
|
||||
foreach($_SESSION["contact"]["email_label"] as $row) {
|
||||
$email_label_options[] = "<option value='".$row."' ".(($row == $email_label) ? "selected='selected'" : null).">".$row."</option>";
|
||||
|
|
@ -258,18 +263,18 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
$default_labels[] = $text['option-home'];
|
||||
$default_labels[] = $text['option-other'];
|
||||
foreach ($default_labels as $default_label) {
|
||||
$email_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
|
||||
$email_label_options[] = "<option value='".$default_label."' ".!empty($selected[$default_label]).">".$default_label."</option>";
|
||||
}
|
||||
$email_label_found = (in_array($email_label, $default_labels)) ? true : false;
|
||||
}
|
||||
echo " <select class='formfld' ".((!$email_label_found && $email_label != '') ? "style='display: none;'" : null)." name='email_label' id='email_label' onchange=\"getElementById('email_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($email_label) && !$email_label_found) ? "style='display: none;'" : null)." name='email_label' id='email_label' onchange=\"getElementById('email_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($email_label_options)) ? implode("\n", $email_label_options) : null;
|
||||
echo (!empty($email_label_options)) ? implode("\n", $email_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($email_label_found || $email_label == '') ? "style='display: none;'" : null)." name='email_label_custom' id='email_label_custom' value=\"".((!$email_label_found) ? htmlentities($email_label) : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($email_label) || $email_label_found) ? "style='display: none;'" : null)." name='email_label_custom' id='email_label_custom' value=\"".((!$email_label_found) ? htmlentities($email_label ?? '') : null)."\">\n";
|
||||
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('email_label');\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-email_label']."\n";
|
||||
echo !empty($text['description-email_label'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -280,7 +285,7 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='email_address' maxlength='255' value=\"".escape($email_address)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-email_address']."\n";
|
||||
echo !empty($text['description-email_address'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -305,14 +310,14 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='email_description' maxlength='255' value=\"".escape($email_description)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-email_description']."\n";
|
||||
echo !empty($text['description-email_description'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid ?? '')."'>\n";
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='contact_email_uuid' value='".escape($contact_email_uuid)."'>\n";
|
||||
}
|
||||
|
|
@ -323,4 +328,4 @@ if (is_uuid($_GET["contact_uuid"])) {
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,19 +41,22 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the contact list
|
||||
$sql = "select * from v_contact_emails ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by email_primary desc, email_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_emails = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
|
||||
if (!empty($contact_emails)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -65,18 +68,18 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_email_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"edit_all_toggle('emails');\" ".($contact_emails ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_emails' name='checkbox_all' onclick=\"edit_all_toggle('emails');\" ".(!empty($contact_emails) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th class='pct-15'>".$text['label-email_label']."</th>\n";
|
||||
echo "<th>".$text['label-email_address']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-email_description']."</th>\n";
|
||||
if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
|
||||
if (!empty($contact_emails)) {
|
||||
$x = 0;
|
||||
foreach ($contact_emails as $row) {
|
||||
if (permission_exists('contact_email_edit')) {
|
||||
|
|
@ -92,7 +95,7 @@
|
|||
echo " <td>".escape($row['email_label'])." ".($row['email_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
echo " <td class='no-link'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a> </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['email_description'])." </td>\n";
|
||||
if (permission_exists('contact_email_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_email_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -108,4 +111,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,19 +47,19 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by email_primary desc, email_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_emails = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_emails) && @sizeof($contact_emails) != 0) {
|
||||
if (!empty($contact_emails)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='grid' style='grid-template-columns: 70px auto;'>\n";
|
||||
$x = 0;
|
||||
foreach ($contact_emails as $row) {
|
||||
echo "<div class='box contact-details-label'>".($row['email_label'] == strtolower($row['email_label']) ? ucwords($row['email_label']) : $row['email_label'])."</div>\n";
|
||||
echo "<div class='box contact-details-label'>".($row['email_label'] == strtolower($row['email_label'] ?? '') ? ucwords($row['email_label'] ?? '') : $row['email_label'])."</div>\n";
|
||||
// ($row['email_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
echo "<div class='box'><a href='mailto:".escape($row['email_address'])."'>".escape($row['email_address'])."</a></div>\n";
|
||||
$x++;
|
||||
|
|
@ -69,4 +69,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the extension list
|
||||
$sql = "select e.extension_uuid, e.extension, e.enabled, e.description ";
|
||||
$sql .= "from v_extensions e, v_extension_users eu, v_users u ";
|
||||
|
|
@ -50,13 +53,13 @@
|
|||
$sql .= "and u.contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by e.extension asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_extensions = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
|
||||
if (!empty($contact_extensions)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -69,12 +72,12 @@
|
|||
echo "<th>".$text['label-extension']."</th>\n";
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>\n";
|
||||
echo "<th class='hide-md-dn'>".$text['label-description']."</th>\n";
|
||||
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
|
||||
if (!empty($contact_extensions)) {
|
||||
$x = 0;
|
||||
foreach ($contact_extensions as $row) {
|
||||
if (permission_exists('extension_edit')) {
|
||||
|
|
@ -91,7 +94,7 @@
|
|||
echo " </td>\n";
|
||||
echo " <td class='center'>".$text['label-'.escape($row['enabled'])]." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".$row['description']." </td>\n";
|
||||
if (permission_exists('extension_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('extension_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -107,4 +110,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -50,13 +50,13 @@
|
|||
$sql .= "and u.contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by e.extension asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_extensions = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_extensions) && @sizeof($contact_extensions) != 0) {
|
||||
if (!empty($contact_extensions)) {
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type='text/javascript'>\n";
|
||||
|
|
@ -91,4 +91,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -61,10 +61,10 @@
|
|||
ini_set('max_execution_time', 7200);
|
||||
|
||||
//get the http get values and set them as php variables
|
||||
$action = $_POST["action"];
|
||||
$from_row = $_POST["from_row"];
|
||||
$delimiter = $_POST["data_delimiter"];
|
||||
$enclosure = $_POST["data_enclosure"];
|
||||
$action = $_POST["action"] ?? '';
|
||||
$from_row = $_POST["from_row"] ?? '';
|
||||
$delimiter = $_POST["data_delimiter"] ?? '';
|
||||
$enclosure = $_POST["data_enclosure"] ?? '';
|
||||
|
||||
//save the data to the csv file
|
||||
if (isset($_POST['data'])) {
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
|
||||
//copy the csv file
|
||||
//$_POST['submit'] == "Upload" &&
|
||||
if ( is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('contact_upload')) {
|
||||
if (!empty($_FILES['ulfile']['tmp_name']) && is_uploaded_file($_FILES['ulfile']['tmp_name']) && permission_exists('contact_upload')) {
|
||||
if ($_POST['type'] == 'csv') {
|
||||
move_uploaded_file($_FILES['ulfile']['tmp_name'], $_SESSION['server']['temp']['dir'].'/'.$_FILES['ulfile']['name']);
|
||||
$save_msg = "Uploaded file to ".$_SESSION['server']['temp']['dir']."/". htmlentities($_FILES['ulfile']['name']);
|
||||
|
|
@ -116,8 +116,8 @@
|
|||
$schema[$i]['table'] = $table_name;
|
||||
$schema[$i]['parent'] = $parent_name;
|
||||
foreach ($table['fields'] as $row) {
|
||||
if ($row['deprecated'] !== 'true') {
|
||||
if (is_array($row['name'])) {
|
||||
if (!empty($row['deprecated']) && $row['deprecated'] !== 'true') {
|
||||
if (!empty($row['name'])) {
|
||||
$field_name = $row['name']['text'];
|
||||
}
|
||||
else {
|
||||
|
|
@ -175,7 +175,7 @@
|
|||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
|
||||
//define phone label options
|
||||
if (is_array($_SESSION["contact"]["phone_label"]) && @sizeof($_SESSION["contact"]["phone_label"]) != 0) {
|
||||
if (!empty($_SESSION["contact"]["phone_label"])) {
|
||||
sort($_SESSION["contact"]["phone_label"]);
|
||||
foreach($_SESSION["contact"]["phone_label"] as $row) {
|
||||
$label_options[] = "<option value='".$row.">".$row."</option>";
|
||||
|
|
@ -267,7 +267,7 @@
|
|||
}
|
||||
|
||||
//upload the csv
|
||||
if (file_exists($_SESSION['file']) && $action == 'import') {
|
||||
if (!empty($_SESSION['file']) && file_exists($_SESSION['file']) && $action == 'import') {
|
||||
|
||||
//validate the token
|
||||
$token = new token;
|
||||
|
|
@ -378,7 +378,7 @@
|
|||
}
|
||||
}
|
||||
}
|
||||
if (is_array($array[$parent][$row_id])) { $y++; }
|
||||
if (!empty($array[$parent][$row_id])) { $y++; }
|
||||
}
|
||||
|
||||
//debug information
|
||||
|
|
@ -410,7 +410,7 @@
|
|||
//view_array($array);
|
||||
|
||||
//save to the data
|
||||
if (is_array($array)) {
|
||||
if (!empty($array)) {
|
||||
$database = new database;
|
||||
$database->app_name = 'contacts';
|
||||
$database->app_uuid = '04481e0e-a478-c559-adad-52bd4174574c';
|
||||
|
|
@ -454,7 +454,7 @@
|
|||
echo " ".$text['label-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'>$data</textarea>\n";
|
||||
echo " <textarea name='data' id='data' class='formfld' style='width: 100%; min-height: 150px;' wrap='off'></textarea>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-import_data']."\n";
|
||||
echo "</td>\n";
|
||||
|
|
@ -519,7 +519,7 @@
|
|||
echo "</table>\n";
|
||||
echo "<br />\n";
|
||||
|
||||
if (function_exists('curl_version') && $_SESSION['contact']['google_oauth_client_id']['text'] != '' && $_SESSION['contact']['google_oauth_client_secret']['text'] != '') {
|
||||
if (function_exists('curl_version') && !empty($_SESSION['contact']['google_oauth_client_id']['text']) && !empty($_SESSION['contact']['google_oauth_client_secret']['text'])) {
|
||||
echo "<a href='contact_import_google.php'><img src='resources/images/icon_gcontacts.png' style='width: 21px; height: 21px; border: none; text-decoration: none; margin-right: 5px;' align='absmiddle'>".$text['header-contacts_import_google']."</a>\n";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ if ($_POST['a'] == 'import') {
|
|||
}
|
||||
|
||||
//insert emails
|
||||
if ($_POST['import_fields']['email'] && is_array($contact['emails']) && @sizeof($contact['emails']) != 0) {
|
||||
if (!empty($contact['emails']) && $_POST['import_fields']['email']) {
|
||||
foreach ($contact['emails'] as $index_2 => $contact_email) {
|
||||
$contact_email_uuid = uuid();
|
||||
$array['contact_emails'][$index_2]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -168,7 +168,7 @@ if ($_POST['a'] == 'import') {
|
|||
}
|
||||
|
||||
//insert numbers
|
||||
if ($_POST['import_fields']['number'] && is_array($contact['numbers']) && @sizeof($contact['numbers']) != 0) {
|
||||
if (!empty($contact['numbers']) && $_POST['import_fields']['number']) {
|
||||
foreach ($contact['numbers'] as $index_3 => $contact_number) {
|
||||
$contact_phone_uuid = uuid();
|
||||
$array['contact_phones'][$index_3]['domain_uuid'] = $domain_uuid;
|
||||
|
|
@ -183,7 +183,7 @@ if ($_POST['a'] == 'import') {
|
|||
}
|
||||
|
||||
//insert urls
|
||||
if ($_POST['import_fields']['url'] && is_array($contact['urls']) && @sizeof($contact['urls']) != 0) {
|
||||
if (!empty($contact['urls']) && $_POST['import_fields']['url']) {
|
||||
foreach ($contact['urls'] as $index_4 => $contact_url) {
|
||||
$contact_url_uuid = uuid();
|
||||
$array['contact_urls'][$index_4]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -196,7 +196,7 @@ if ($_POST['a'] == 'import') {
|
|||
}
|
||||
|
||||
//insert addresses
|
||||
if ($_POST['import_fields']['address'] && is_array($contact['addresses']) && @sizeof($contact['addresses']) != 0) {
|
||||
if (!empty($contact['addresses']) && $_POST['import_fields']['address']) {
|
||||
foreach ($contact['addresses'] as $index_5 => $contact_address) {
|
||||
$contact_address_uuid = uuid();
|
||||
$array['contact_addresses'][$index_5]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
|
|
@ -275,7 +275,7 @@ if ($_POST['a'] == 'import') {
|
|||
//*******************************************************************************************
|
||||
|
||||
//check if authenticated
|
||||
if ($_SESSION['contact_auth']['token'] == '') {
|
||||
if (empty($_SESSION['contact_auth']['token'])) {
|
||||
$_SESSION['contact_auth']['referer'] = substr($_SERVER["HTTP_REFERER"], strrpos($_SERVER["HTTP_REFERER"],'/')+1);
|
||||
header("Location: contact_auth.php?source=google&target=".substr($_SERVER["PHP_SELF"], strrpos($_SERVER["PHP_SELF"],'/')+1));
|
||||
exit;
|
||||
|
|
@ -340,7 +340,7 @@ echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\
|
|||
echo " ".$text['label-contact_type']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["type"])) {
|
||||
if (!empty($_SESSION["contact"]["type"])) {
|
||||
sort($_SESSION["contact"]["type"]);
|
||||
echo " <select class='formfld' name='import_type'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
|
@ -375,7 +375,7 @@ echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
|
|||
echo " ".$text['label-contact_category']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["category"])) {
|
||||
if (!empty($_SESSION["contact"]["category"])) {
|
||||
sort($_SESSION["contact"]["category"]);
|
||||
echo " <select class='formfld' name='import_category'>\n";
|
||||
echo " <option value=''></option>\n";
|
||||
|
|
|
|||
|
|
@ -41,8 +41,11 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set additional variables
|
||||
$show = $_GET["show"] ?? '';
|
||||
|
||||
//get posted data
|
||||
if (is_array($_POST['contacts'])) {
|
||||
if (!empty($_POST['contacts'])) {
|
||||
$action = $_POST['action'];
|
||||
$search = $_POST['search'];
|
||||
$name = $_POST['name'];
|
||||
|
|
@ -57,7 +60,7 @@
|
|||
$user_group_uuids[] = $_SESSION["user_uuid"];
|
||||
|
||||
//add the search term
|
||||
if (isset($_GET["search"])) {
|
||||
if (isset($search)) {
|
||||
$search = strtolower($_GET["search"]);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +72,7 @@
|
|||
$sql .= ") as contact_attachment_uuid ";
|
||||
$sql .= "from v_contacts as c ";
|
||||
$sql .= "where true ";
|
||||
if ($_GET['show'] != "all" || !permission_exists('contact_all')) {
|
||||
if ($show != "all" || !permission_exists('contact_all')) {
|
||||
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
}
|
||||
|
|
@ -78,14 +81,14 @@
|
|||
$sql .= " contact_uuid in ( ";
|
||||
$sql .= " select contact_uuid from v_contact_groups ";
|
||||
$sql .= " where ";
|
||||
if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) {
|
||||
if (!empty($user_group_uuids)) {
|
||||
foreach ($user_group_uuids as $index => $user_group_uuid) {
|
||||
if (is_uuid($user_group_uuid)) {
|
||||
$sql_where_or[] = "group_uuid = :group_uuid_".$index;
|
||||
$parameters['group_uuid_'.$index] = $user_group_uuid;
|
||||
}
|
||||
}
|
||||
if (is_array($sql_where_or) && @sizeof($sql_where_or) != 0) {
|
||||
if (!empty($sql_where_or)) {
|
||||
$sql .= " ( ".implode(' or ', $sql_where_or)." ) ";
|
||||
}
|
||||
unset($sql_where_or, $index, $user_group_uuid);
|
||||
|
|
@ -156,18 +159,18 @@
|
|||
$sql .= "order by contact_organization asc ";
|
||||
$sql .= "limit 300 ";
|
||||
$database = new database;
|
||||
$contact_array = $database->select($sql, $parameters, 'all');
|
||||
$contact_array = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//return the contacts as json
|
||||
$i = 0;
|
||||
if (is_array($contact_array)) {
|
||||
if (!empty($contact_array)) {
|
||||
foreach($contact_array as $row) {
|
||||
$contact_name = array();
|
||||
if ($row['contact_organization'] != '') { $contact_name[] = $row['contact_organization']; }
|
||||
if ($row['contact_name_family'] != '') { $contact_name[] = $row['contact_name_family']; }
|
||||
if ($row['contact_name_given'] != '') { $contact_name[] = $row['contact_name_given']; }
|
||||
if ($row['contact_name_family'] == '' && $row['contact_name_given'] == '' && $row['contact_nickname'] != '') { $contact_name[] = $row['contact_nickname']; }
|
||||
if (!empty($row['contact_organization'])) { $contact_name[] = $row['contact_organization']; }
|
||||
if (!empty($row['contact_name_family'])) { $contact_name[] = $row['contact_name_family']; }
|
||||
if (!empty($row['contact_name_given'])) { $contact_name[] = $row['contact_name_given']; }
|
||||
if (empty($row['contact_name_family']) && empty($row['contact_name_given']) && !empty($row['contact_nickname'])) { $contact_name[] = $row['contact_nickname']; }
|
||||
$contacts[$i]['id'] = $row['contact_uuid'];
|
||||
$contacts[$i]['name'] = implode(', ', $contact_name);
|
||||
$i++;
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_note_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -55,19 +55,19 @@
|
|||
}
|
||||
|
||||
//get the primary id for the contact
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST)>0) {
|
||||
if (!empty($_POST)) {
|
||||
$contact_note = $_POST["contact_note"];
|
||||
$last_mod_date = $_POST["last_mod_date"];
|
||||
$last_mod_user = $_POST["last_mod_user"];
|
||||
$last_mod_user = $_POST["last_mod_user"] ?? '';
|
||||
}
|
||||
|
||||
//process the form data
|
||||
if (count($_POST) > 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//get the primary id for the contact note
|
||||
if ($action == "update") {
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -133,7 +133,7 @@
|
|||
}
|
||||
|
||||
//execute
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_notes'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_notes'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['contact_notes'][0]['contact_note'] = $contact_note;
|
||||
|
|
@ -155,8 +155,8 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_note_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_note_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_notes ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_note_uuid = :contact_note_uuid ";
|
||||
|
|
@ -164,7 +164,7 @@
|
|||
$parameters['contact_note_uuid'] = $contact_note_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_note = $row["contact_note"];
|
||||
$last_mod_date = $row["last_mod_date"];
|
||||
$last_mod_user = $row["last_mod_user"];
|
||||
|
|
@ -211,7 +211,7 @@
|
|||
echo " ".$text['label-contact_note']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <textarea class='formfld' name='contact_note' style='min-width: 100%; height: 400px;'>".$contact_note."</textarea>\n";
|
||||
echo " <textarea class='formfld' name='contact_note' style='min-width: 100%; height: 400px;'>".escape($contact_note ?? '')."</textarea>\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -229,4 +229,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
}
|
||||
|
||||
//set the uuid
|
||||
if (is_uuid($_GET['id'])) {
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
$contact_uuid = $_GET['id'];
|
||||
}
|
||||
|
||||
|
|
@ -52,13 +52,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by last_mod_date desc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_notes = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
|
||||
if (!empty($contact_notes)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -70,17 +70,17 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_note_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"edit_all_toggle('notes');\" ".($contact_notes ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_notes' name='checkbox_all' onclick=\"edit_all_toggle('notes');\" ".(!empty($contact_notes) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th>".$text['label-note_content']."</th>\n";
|
||||
echo "<th class='shrink'>".$text['label-note_user']."</th>\n";
|
||||
if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_note_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
|
||||
if (!empty($contact_notes)) {
|
||||
foreach ($contact_notes as $row) {
|
||||
$contact_note = $row['contact_note'];
|
||||
$contact_note = escape($contact_note);
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
echo " <td class='overflow'>".$contact_note."</td>\n";
|
||||
echo " <td class='description no-wrap'><strong>".escape($row['last_mod_user'])."</strong>: ".date("j M Y @ H:i:s", strtotime($row['last_mod_date']))."</td>\n";
|
||||
if (permission_exists('contact_note_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_note_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -113,4 +113,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by last_mod_date desc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_notes = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_notes) && @sizeof($contact_notes) != 0) {
|
||||
if (!empty($contact_notes)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='grid' style='grid-template-columns: auto 190px;'>\n";
|
||||
|
|
@ -69,4 +69,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,22 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$phone_label = '';
|
||||
$phone_label_custom = '';
|
||||
$phone_type_voice = '';
|
||||
$phone_type_fax = '';
|
||||
$phone_type_video = '';
|
||||
$phone_type_text = '';
|
||||
$phone_speed_dial = '';
|
||||
$phone_country_code = '';
|
||||
$phone_number = '';
|
||||
$phone_extension = '';
|
||||
$phone_primary = '';
|
||||
$phone_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_phone_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -56,12 +70,12 @@
|
|||
}
|
||||
|
||||
//get the uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0) {
|
||||
if (!empty($_POST)) {
|
||||
$phone_label = $_POST["phone_label"];
|
||||
$phone_label_custom = $_POST["phone_label_custom"];
|
||||
$phone_type_voice = $_POST["phone_type_voice"];
|
||||
|
|
@ -83,7 +97,7 @@
|
|||
}
|
||||
|
||||
//process the form data
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set thge uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -114,7 +128,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -161,7 +175,7 @@
|
|||
}
|
||||
|
||||
//execute
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_phones'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_phones'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['contact_phones'][0]['phone_label'] = $phone_label;
|
||||
|
|
@ -191,8 +205,8 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_phone_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_phone_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_phones ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_phone_uuid = :contact_phone_uuid ";
|
||||
|
|
@ -200,7 +214,7 @@
|
|||
$parameters['contact_phone_uuid'] = $contact_phone_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$phone_label = $row["phone_label"];
|
||||
$phone_type_voice = $row["phone_type_voice"];
|
||||
$phone_type_fax = $row["phone_type_fax"];
|
||||
|
|
@ -266,7 +280,7 @@
|
|||
echo " ".$text['label-phone_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["phone_label"])) {
|
||||
if (!empty($_SESSION["contact"]["phone_label"])) {
|
||||
sort($_SESSION["contact"]["phone_label"]);
|
||||
foreach($_SESSION["contact"]["phone_label"] as $row) {
|
||||
$phone_label_options[] = "<option value='".$row."' ".(($row == $phone_label) ? "selected='selected'" : null).">".$row."</option>";
|
||||
|
|
@ -285,15 +299,15 @@
|
|||
$default_labels[] = $text['option-text'];
|
||||
$default_labels[] = $text['option-other'];
|
||||
foreach ($default_labels as $default_label) {
|
||||
$phone_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
|
||||
$phone_label_options[] = "<option value='".$default_label."' ".!empty($selected[$default_label]).">".$default_label."</option>";
|
||||
}
|
||||
$phone_label_found = (in_array($phone_label, $default_labels)) ? true : false;
|
||||
$phone_label_found = (in_array(!empty($phone_label), $default_labels)) ? true : false;
|
||||
}
|
||||
echo " <select class='formfld' ".((!$phone_label_found && $phone_label != '') ? "style='display: none;'" : null)." name='phone_label' id='phone_label' onchange=\"getElementById('phone_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($phone_label) && !$phone_label_found) ? "style='display: none;'" : null)." name='phone_label' id='phone_label' onchange=\"getElementById('phone_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($phone_label_options)) ? implode("\n", $phone_label_options) : null;
|
||||
echo (!empty($phone_label_options)) ? implode("\n", $phone_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($phone_label_found || $phone_label == '') ? "style='display: none;'" : null)." name='phone_label_custom' id='phone_label_custom' value=\"".((!$phone_label_found) ? htmlentities($phone_label) : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($phone_label) || $phone_label_found) ? "style='display: none;'" : null)." name='phone_label_custom' id='phone_label_custom' value=\"".((!$phone_label_found) ? htmlentities($phone_label ?? '') : null)."\">\n";
|
||||
echo " <input type='button' id='btn_toggle_type' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('phone_label');\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-phone_label']."\n";
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by phone_primary desc, phone_label asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_phones = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
|
||||
if (!empty($contact_phones)) {
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type=\"text/javascript\">\n";
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
|
||||
if (!empty($contact_phones)) {
|
||||
$x = 0;
|
||||
foreach ($contact_phones as $row) {
|
||||
if (permission_exists('contact_phone_edit')) {
|
||||
|
|
@ -145,4 +145,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by phone_primary desc, phone_label asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_phones = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_phones) && @sizeof($contact_phones) != 0) {
|
||||
if (!empty($contact_phones)) {
|
||||
|
||||
//javascript function: send_cmd
|
||||
echo "<script type='text/javascript'>\n";
|
||||
|
|
@ -77,14 +77,14 @@
|
|||
echo "<div class='box contact-details-label'>".($row['phone_label'] == strtolower($row['phone_label']) ? ucwords($row['phone_label']) : $row['phone_label'])."</div>\n";
|
||||
// ($row['phone_primary'] ? " <i class='fas fa-star fa-xs' style='float: right; margin-top: 0.5em; margin-right: -0.5em;' title=\"".$text['label-primary']."\"></i>" : null)."</td>\n";
|
||||
echo "<div class='box'>";
|
||||
echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'])),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'])."&src_cid_number=".urlencode($row['phone_number'])."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'])."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'])."&src=".urlencode($_SESSION['user']['extension'][0]['user'])."&dest=".urlencode($row['phone_number'])."&rec=false&ringback=us-ring&auto_answer=true');"]);
|
||||
echo button::create(['type'=>'button','class'=>'link','label'=>escape(format_phone($row['phone_number'] ?? '')),'title'=>$text['label-click_to_call'],'onclick'=>"send_cmd('".PROJECT_PATH."/app/click_to_call/click_to_call.php?src_cid_name=".urlencode($row['phone_number'] ?? '')."&src_cid_number=".urlencode($row['phone_number'] ?? '')."&dest_cid_name=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_name'] ?? '')."&dest_cid_number=".urlencode($_SESSION['user']['extension'][0]['outbound_caller_id_number'] ?? '')."&src=".urlencode($_SESSION['user']['extension'][0]['user'] ?? '')."&dest=".urlencode($row['phone_number'] ?? '')."&rec=false&ringback=us-ring&auto_answer=true');"]);
|
||||
echo "</div>\n";
|
||||
echo "<div class='box no-wrap'>";
|
||||
if ($row['phone_type_voice']) { $phone_types[] = "<i class='fas fa-phone fa-fw' style='margin-right: 3px;' title=\"".$text['label-voice']."\"></i>"; }
|
||||
if ($row['phone_type_fax']) { $phone_types[] = "<i class='fas fa-fax fa-fw' style='margin-right: 3px;' title=\"".$text['label-fax']."\"></i>"; }
|
||||
if ($row['phone_type_video']) { $phone_types[] = "<i class='fas fa-video fa-fw' style='margin-right: 3px;' title=\"".$text['label-video']."\"></i>"; }
|
||||
if ($row['phone_type_text']) { $phone_types[] = "<i class='fas fa-sms fa-fw' style='margin-right: 3px;' title=\"".$text['label-text']."\"></i>"; }
|
||||
if (is_array($phone_types)) {
|
||||
if (!empty($phone_types)) {
|
||||
echo " ".implode(" ", $phone_types)."\n";
|
||||
}
|
||||
unset($phone_types);
|
||||
|
|
@ -96,4 +96,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_relation_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -56,12 +56,12 @@
|
|||
}
|
||||
|
||||
//get the contact uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0) {
|
||||
if (!empty($_POST)) {
|
||||
$relation_label = $_POST["relation_label"];
|
||||
$relation_label_custom = $_POST["relation_label_custom"];
|
||||
$relation_contact_uuid = $_POST["relation_contact_uuid"];
|
||||
|
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
|
||||
//process the form data
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -150,7 +150,7 @@
|
|||
}
|
||||
|
||||
//execute
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_relations'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_relations'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contact_relations'][0]['relation_label'] = $relation_label;
|
||||
|
|
@ -171,8 +171,8 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && @sizeof($_GET) != 0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_relation_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_relation_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_relations ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_relation_uuid = :contact_relation_uuid ";
|
||||
|
|
@ -197,14 +197,14 @@
|
|||
$parameters['contact_uuid'] = $contact_relation_uuid;
|
||||
$database = new database;
|
||||
$contacts = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($contacts) && is_uuid($row['relation_contact_uuid'])) {
|
||||
if (!empty($contacts) && is_uuid($row['relation_contact_uuid'])) {
|
||||
foreach($contacts as $field) {
|
||||
if ($field['contact_uuid'] == $row['relation_contact_uuid']) {
|
||||
$name = array();
|
||||
if ($field['contact_organization'] != '') { $name[] = $field['contact_organization']; }
|
||||
if ($field['contact_name_family'] != '') { $name[] = $field['contact_name_family']; }
|
||||
if ($field['contact_name_given'] != '') { $name[] = $field['contact_name_given']; }
|
||||
if ($field['contact_name_family'] == '' && $field['contact_name_given'] == '' && $field['contact_nickname'] != '') { $name[] = $field['contact_nickname']; }
|
||||
if (!empty($field['contact_organization'])) { $name[] = $field['contact_organization']; }
|
||||
if (!empty($field['contact_name_family'])) { $name[] = $field['contact_name_family']; }
|
||||
if (!empty($field['contact_name_given'])) { $name[] = $field['contact_name_given']; }
|
||||
if (empty($field['contact_name_family']) && empty($field['contact_name_given']) && !empty($field['contact_nickname'])) { $name[] = $field['contact_nickname']; }
|
||||
$contact_name = implode(', ', $name);
|
||||
break;
|
||||
}
|
||||
|
|
@ -286,7 +286,7 @@
|
|||
echo " ".$text['label-contact_relation_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["relation_label"])) {
|
||||
if (!empty($_SESSION["contact"]["relation_label"])) {
|
||||
sort($_SESSION["contact"]["relation_label"]);
|
||||
foreach($_SESSION["contact"]["relation_label"] as $row) {
|
||||
$relation_label_options[] = "<option value='".$row."' ".(($row == $relation_label) ? "selected='selected'" : null).">".$row."</option>";
|
||||
|
|
@ -294,7 +294,7 @@
|
|||
$relation_label_found = (in_array($relation_label, $_SESSION["contact"]["relation_label"])) ? true : false;
|
||||
}
|
||||
else {
|
||||
$selected[$relation_label] = "selected";
|
||||
$selected[!empty($relation_label)] = "selected";
|
||||
$default_labels[] = $text['label-contact_relation_option_parent'];
|
||||
$default_labels[] = $text['label-contact_relation_option_child'];
|
||||
$default_labels[] = $text['label-contact_relation_option_employee'];
|
||||
|
|
@ -302,18 +302,18 @@
|
|||
$default_labels[] = $text['label-contact_relation_option_associate'];
|
||||
$default_labels[] = $text['label-contact_relation_option_other'];
|
||||
foreach ($default_labels as $default_label) {
|
||||
$relation_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
|
||||
$relation_label_options[] = "<option value='".$default_label."' ".!empty($selected[$default_label]).">".$default_label."</option>";
|
||||
}
|
||||
$relation_label_found = (in_array($relation_label, $default_labels)) ? true : false;
|
||||
$relation_label_found = (in_array(!empty($relation_label), $default_labels)) ? true : false;
|
||||
}
|
||||
echo " <select class='formfld' ".((!$relation_label_found && $relation_label != '') ? "style='display: none;'" : null)." name='relation_label' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($relation_label) && !$relation_label_found) ? "style='display: none;'" : null)." name='relation_label' id='relation_label' onchange=\"getElementById('relation_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($relation_label_found || $relation_label == '') ? "style='display: none;'" : null)." name='relation_label_custom' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label) : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($relation_label) || $relation_label_found) ? "style='display: none;'" : null)." name='relation_label_custom' id='relation_label_custom' value=\"".((!$relation_label_found) ? htmlentities($relation_label ?? '') : null)."\">\n";
|
||||
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('relation_label');\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-relation_label']."\n";
|
||||
echo !empty($text['description-relation_label'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -354,7 +354,7 @@
|
|||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
echo " <select class='formfld' name='relation_reciprocal_label' id='relation_reciprocal_label' onchange=\"getElementById('relation_reciprocal_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($relation_label_options)) ? implode("\n", $relation_label_options) : null;
|
||||
echo (!empty($relation_label_options)) ? implode("\n", $relation_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' style='display: none;' name='relation_reciprocal_label_custom' id='relation_reciprocal_label_custom' value=''>\n";
|
||||
echo " <input type='button' id='btn_toggle_reciprocal_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('relation_reciprocal_label');\">\n";
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the related contacts
|
||||
$sql = "select ";
|
||||
$sql .= "cr.contact_relation_uuid, ";
|
||||
|
|
@ -61,13 +64,13 @@
|
|||
$sql .= "c.contact_name_given asc, ";
|
||||
$sql .= "c.contact_name_family asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_relations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
|
||||
if (!empty($contact_relations)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -79,18 +82,18 @@
|
|||
echo "<tr class='list-header'>\n";
|
||||
if (permission_exists('contact_relation_delete')) {
|
||||
echo " <th class='checkbox'>\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"edit_all_toggle('relations');\" ".($contact_relations ?: "style='visibility: hidden;'").">\n";
|
||||
echo " <input type='checkbox' id='checkbox_all_relations' name='checkbox_all' onclick=\"edit_all_toggle('relations');\" ".(!empty($contact_relations) ?: "style='visibility: hidden;'").">\n";
|
||||
echo " </th>\n";
|
||||
}
|
||||
echo "<th>".$text['label-contact_relation_label']."</th>\n";
|
||||
echo "<th>".$text['label-contact_relation_organization']."</th>\n";
|
||||
echo "<th>".$text['label-contact_relation_name']."</th>\n";
|
||||
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
|
||||
if (!empty($contact_relations)) {
|
||||
$x = 0;
|
||||
foreach ($contact_relations as $row) {
|
||||
if (permission_exists('contact_relation_edit')) {
|
||||
|
|
@ -105,8 +108,8 @@
|
|||
}
|
||||
echo " <td>".escape($row['relation_label'])." </td>\n";
|
||||
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_organization'])."</a> </td>\n";
|
||||
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).(($row['contact_name_given'] != '' && $row['contact_name_family'] != '') ? ' ' : null).escape($row['contact_name_family'])."</a> </td>\n";
|
||||
if (permission_exists('contact_relation_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
echo " <td class='no-link'><a href='contact_edit.php?id=".urlencode($row['contact_uuid'])."'>".escape($row['contact_name_given']).((!empty($row['contact_name_given']) && !empty($row['contact_name_family'])) ? ' ' : null).escape($row['contact_name_family'])."</a> </td>\n";
|
||||
if (permission_exists('contact_relation_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -122,4 +125,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -61,13 +61,13 @@
|
|||
$sql .= "c.contact_name_given asc, ";
|
||||
$sql .= "c.contact_name_family asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_relations = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_relations) && @sizeof($contact_relations) != 0) {
|
||||
if (!empty($contact_relations)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='grid' style='grid-template-columns: 70px auto auto;'>\n";
|
||||
|
|
@ -83,4 +83,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,17 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$contact_setting_category = '';
|
||||
$contact_setting_subcategory = '';
|
||||
$contact_setting_name = '';
|
||||
$contact_setting_value = '';
|
||||
$contact_setting_order = '';
|
||||
$contact_setting_enabled = '';
|
||||
$contact_setting_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_setting_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -56,7 +65,7 @@
|
|||
}
|
||||
|
||||
//get the contact uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
|
|
@ -64,7 +73,7 @@
|
|||
$domain_uuid = $_SESSION['domain_uuid'];
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
if (!empty($_POST)) {
|
||||
$contact_setting_category = strtolower($_POST["contact_setting_category"]);
|
||||
$contact_setting_subcategory = strtolower($_POST["contact_setting_subcategory"]);
|
||||
$contact_setting_name = strtolower($_POST["contact_setting_name"]);
|
||||
|
|
@ -75,7 +84,7 @@
|
|||
}
|
||||
|
||||
//process the form data
|
||||
if (is_array($_POST) && sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -113,7 +122,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the order
|
||||
$contact_setting_order = $contact_setting_order != '' ? $contact_setting_order : null;
|
||||
|
|
@ -151,7 +160,7 @@
|
|||
}
|
||||
|
||||
//execute
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_settings'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_settings'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['contact_settings'][0]['contact_setting_category'] = $contact_setting_category;
|
||||
|
|
@ -176,8 +185,8 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && sizeof($_GET) != 0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_setting_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_setting_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_settings ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_setting_uuid = :contact_setting_uuid ";
|
||||
|
|
@ -185,7 +194,7 @@
|
|||
$parameters['contact_setting_uuid'] = $contact_setting_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_setting_category = escape($row["contact_setting_category"]);
|
||||
$contact_setting_subcategory = escape($row["contact_setting_subcategory"]);
|
||||
$contact_setting_name = escape($row["contact_setting_name"]);
|
||||
|
|
@ -223,7 +232,7 @@
|
|||
}
|
||||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid ?? '')]);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
|
@ -349,7 +358,7 @@
|
|||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input type='hidden' name='contact_uuid' value='".$contact_uuid."'>\n";
|
||||
echo "<input type='hidden' name='contact_uuid' value='".!empty($contact_uuid)."'>\n";
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='contact_setting_uuid' value='".$contact_setting_uuid."'>\n";
|
||||
}
|
||||
|
|
@ -360,4 +369,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,6 +42,9 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//get the list
|
||||
$sql = "select * from v_contact_settings ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
|
|
@ -51,13 +54,13 @@
|
|||
$sql .= ", contact_setting_subcategory asc ";
|
||||
$sql .= ", contact_setting_order asc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_settings = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
|
||||
if (!empty($contact_settings)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -78,12 +81,12 @@
|
|||
echo "<th>".$text['label-contact_setting_value']."</th>";
|
||||
echo "<th class='center'>".$text['label-enabled']."</th>";
|
||||
echo "<th class='hide-md-dn'>".$text['label-description']."</th>";
|
||||
if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_settings) && @sizeof($contact_settings) != 0) {
|
||||
if (!empty($contact_settings)) {
|
||||
$x = 0;
|
||||
foreach ($contact_settings as $row) {
|
||||
if (permission_exists('contact_setting_edit')) {
|
||||
|
|
@ -115,7 +118,7 @@
|
|||
echo " </td>\n";
|
||||
echo " <td class='center'>".$text['label-'.escape($row['contact_setting_enabled'])]." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".$row['contact_setting_description']." </td>\n";
|
||||
if (permission_exists('contact_setting_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_setting_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -131,4 +134,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@
|
|||
$text = $language->get();
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_time_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -55,19 +55,19 @@
|
|||
}
|
||||
|
||||
//get the contact uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0) {
|
||||
if (!empty($_POST)) {
|
||||
$time_start = $_POST["time_start"];
|
||||
$time_stop = $_POST["time_stop"];
|
||||
$time_description = $_POST["time_description"];
|
||||
}
|
||||
|
||||
//process the form data
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -130,7 +130,7 @@
|
|||
message::add($text['message-update']);
|
||||
}
|
||||
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_times'][0]['domain_uuid'] = $domain_uuid;
|
||||
$array['contact_times'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_times'][0]['user_uuid'] = $_SESSION["user"]["user_uuid"];
|
||||
|
|
@ -152,7 +152,7 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && @sizeof($_GET) != 0 && $_POST["persistformvar"] != "true") {
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_time_uuid = $_GET["id"];
|
||||
$sql = "select ct.*, u.username ";
|
||||
$sql .= "from v_contact_times as ct, v_users as u ";
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
$sql .= "and ct.user_uuid = :user_uuid ";
|
||||
$sql .= "and contact_time_uuid = :contact_time_uuid ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$parameters['user_uuid'] = $_SESSION["user"]["user_uuid"];
|
||||
$parameters['contact_time_uuid'] = $contact_time_uuid;
|
||||
$database = new database;
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
}
|
||||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid ?? '')]);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
|
@ -248,4 +248,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@
|
|||
$contact_uuid = $_REQUEST['contact_uuid'];
|
||||
|
||||
//get posted variables & set time status
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0) {
|
||||
if (!empty($_POST)) {
|
||||
$contact_time_uuid = $_POST['contact_time_uuid'];
|
||||
$contact_uuid = $_POST['contact_uuid'];
|
||||
$time_action = $_POST['time_action'];
|
||||
|
|
@ -64,7 +64,7 @@
|
|||
$array['contact_times'][0]['time_description'] = $time_description;
|
||||
}
|
||||
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$database = new database;
|
||||
$database->app_name = 'contacts';
|
||||
$database->app_uuid = '04481e0e-a478-c559-adad-52bd4174574c';
|
||||
|
|
@ -88,7 +88,7 @@
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_organization = $row["contact_organization"];
|
||||
$contact_name_given = $row["contact_name_given"];
|
||||
$contact_name_family = $row["contact_name_family"];
|
||||
|
|
@ -111,10 +111,10 @@
|
|||
$sql .= "and time_stop is null ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_time_uuid = $row["contact_time_uuid"];
|
||||
$time_description = $row["time_description"];
|
||||
}
|
||||
|
|
@ -124,17 +124,17 @@
|
|||
$timer_action = $timer_state == 'running' ? 'stop' : 'start';
|
||||
|
||||
//determine contact name to display
|
||||
if ($contact_nickname != '') {
|
||||
if (!empty($contact_nickname)) {
|
||||
$contact = $contact_nickname;
|
||||
}
|
||||
else if ($contact_name_given != '') {
|
||||
else if (!empty($contact_name_given)) {
|
||||
$contact = $contact_name_given;
|
||||
}
|
||||
if ($contact_name_family != '') {
|
||||
$contact .= ($contact != '') ? ' '.$contact_name_family : $contact_name_family;
|
||||
if (!empty($contact_name_family)) {
|
||||
$contact .= (!empty($contact)) ? ' '.$contact_name_family : $contact_name_family;
|
||||
}
|
||||
if ($contact_organization != '') {
|
||||
$contact .= ($contact != '') ? ', '.$contact_organization : $contact_organization;
|
||||
if (!empty($contact_organization)) {
|
||||
$contact .= (!empty($contact)) ? ', '.$contact_organization : $contact_organization;
|
||||
}
|
||||
|
||||
//get the browser version
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
//get contact and time uuids
|
||||
$domain_uuid = $_REQUEST['domain_uuid'];
|
||||
$contact_uuid = $_REQUEST['contact_uuid'];
|
||||
$contact_uuid = $_REQUEST['contact_uuid'] ?? '';
|
||||
$contact_time_uuid = $_REQUEST['contact_time_uuid'];
|
||||
|
||||
//get time quantity
|
||||
|
|
@ -53,7 +53,7 @@
|
|||
$parameters['contact_time_uuid'] = $contact_time_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$time_start = strtotime($row["time_start"]);
|
||||
$time_now = strtotime(date("Y-m-d H:i:s"));
|
||||
$time_diff = gmdate("H:i:s", ($time_now - $time_start));
|
||||
|
|
@ -61,4 +61,4 @@
|
|||
echo "<script id='title_script'>set_title('".$time_diff."');</script>";
|
||||
}
|
||||
unset ($sql, $parameters, $row);
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -41,8 +41,11 @@
|
|||
exit;
|
||||
}
|
||||
|
||||
//set from session variables
|
||||
$list_row_edit_button = !empty($_SESSION['theme']['list_row_edit_button']['boolean']) ? $_SESSION['theme']['list_row_edit_button']['boolean'] : 'false';
|
||||
|
||||
//set the uuid
|
||||
if (is_uuid($_GET['id'])) {
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
$contact_uuid = $_GET['id'];
|
||||
}
|
||||
|
||||
|
|
@ -54,13 +57,13 @@
|
|||
$sql .= "and ct.contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by ct.time_start desc ";
|
||||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_times = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_times) && @sizeof($contact_times) != 0) {
|
||||
if (!empty($contact_times)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -79,15 +82,15 @@
|
|||
echo "<th class='pct-20'>".$text['label-time_start']."</th>\n";
|
||||
echo "<th class='pct-20'>".$text['label-time_duration']."</th>\n";
|
||||
echo "<th class='pct-40 hide-md-dn'>".$text['label-time_description']."</th>\n";
|
||||
if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button == 'true') {
|
||||
echo " <td class='action-button'> </td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_times) && @sizeof($contact_times) != 0) {
|
||||
if (!empty($contact_times)) {
|
||||
$x = 0;
|
||||
foreach ($contact_times as $row) {
|
||||
if ($row["time_start"] != '' && $row['time_stop'] != '') {
|
||||
if (!empty($row["time_start"]) && !empty($row['time_stop'])) {
|
||||
$time_start = strtotime($row["time_start"]);
|
||||
$time_stop = strtotime($row['time_stop']);
|
||||
$time = gmdate("H:i:s", ($time_stop - $time_start));
|
||||
|
|
@ -111,7 +114,7 @@
|
|||
echo " <td>".$time_start." </td>\n";
|
||||
echo " <td>".$time." </td>\n";
|
||||
echo " <td class='description overflow hide-md-dn'>".escape($row['time_description'])." </td>\n";
|
||||
if (permission_exists('contact_time_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
|
||||
if (permission_exists('contact_time_edit') && $list_row_edit_button == '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";
|
||||
|
|
@ -127,4 +130,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -46,8 +46,15 @@
|
|||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//set the defaults
|
||||
$url_label = '';
|
||||
$url_label_custom = '';
|
||||
$url_address = '';
|
||||
$url_primary = '';
|
||||
$url_description = '';
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$action = "update";
|
||||
$contact_url_uuid = $_REQUEST["id"];
|
||||
}
|
||||
|
|
@ -56,12 +63,12 @@
|
|||
}
|
||||
|
||||
//get the contact uuid
|
||||
if (is_uuid($_GET["contact_uuid"])) {
|
||||
if (!empty($_GET["contact_uuid"]) && is_uuid($_GET["contact_uuid"])) {
|
||||
$contact_uuid = $_GET["contact_uuid"];
|
||||
}
|
||||
|
||||
//get http post variables and set them to php variables
|
||||
if (count($_POST) > 0) {
|
||||
if (!empty($_POST)) {
|
||||
$url_label = $_POST["url_label"];
|
||||
$url_label_custom = $_POST["url_label_custom"];
|
||||
$url_address = $_POST["url_address"];
|
||||
|
|
@ -69,11 +76,11 @@
|
|||
$url_description = $_POST["url_description"];
|
||||
|
||||
//use custom label if set
|
||||
$url_label = $url_label_custom != '' ? $url_label_custom : $url_label;
|
||||
$url_label = !empty($url_label_custom) ? $url_label_custom : $url_label;
|
||||
}
|
||||
|
||||
//process the form data
|
||||
if (is_array($_POST) && @sizeof($_POST) != 0 && empty($_POST["persistformvar"])) {
|
||||
if (!empty($_POST) && empty($_POST["persistformvar"])) {
|
||||
|
||||
//set the uuid
|
||||
if ($action == "update") {
|
||||
|
|
@ -104,7 +111,7 @@
|
|||
}
|
||||
|
||||
//add or update the database
|
||||
if ($_POST["persistformvar"] != "true") {
|
||||
if (empty($_POST["persistformvar"])) {
|
||||
|
||||
//update last modified
|
||||
$array['contacts'][0]['contact_uuid'] = $contact_uuid;
|
||||
|
|
@ -131,7 +138,7 @@
|
|||
$parameters['domain_uuid'] = $domain_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$database->execute($sql, $parameters);
|
||||
$database->execute($sql, $parameters ?? null);
|
||||
unset($sql, $parameters);
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +155,7 @@
|
|||
message::add($text['message-update']);
|
||||
}
|
||||
|
||||
if (is_array($array) && @sizeof($array) != 0) {
|
||||
if (!empty($array)) {
|
||||
$array['contact_urls'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$array['contact_urls'][0]['contact_uuid'] = $contact_uuid;
|
||||
$array['contact_urls'][0]['url_label'] = $url_label;
|
||||
|
|
@ -170,8 +177,8 @@
|
|||
}
|
||||
|
||||
//pre-populate the form
|
||||
if (is_array($_GET) && @sizeof($_GET) != 0 && $_POST["persistformvar"] != "true") {
|
||||
$contact_url_uuid = $_GET["id"];
|
||||
if (!empty($_GET) && empty($_POST["persistformvar"])) {
|
||||
$contact_url_uuid = $_GET["id"] ?? '';
|
||||
$sql = "select * from v_contact_urls ";
|
||||
$sql .= "where domain_uuid = :domain_uuid ";
|
||||
$sql .= "and contact_url_uuid = :contact_url_uuid ";
|
||||
|
|
@ -179,7 +186,7 @@
|
|||
$parameters['contact_url_uuid'] = $contact_url_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$url_label = $row["url_label"];
|
||||
$url_address = $row["url_address"];
|
||||
$url_primary = $row["url_primary"];
|
||||
|
|
@ -225,7 +232,7 @@
|
|||
}
|
||||
echo " </div>\n";
|
||||
echo " <div class='actions'>\n";
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid)]);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','style'=>'margin-right: 15px;','link'=>'contact_edit.php?id='.urlencode($contact_uuid ?? '')]);
|
||||
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save']);
|
||||
echo " </div>\n";
|
||||
echo " <div style='clear: both;'></div>\n";
|
||||
|
|
@ -246,7 +253,7 @@
|
|||
echo " ".$text['label-url_label']."\n";
|
||||
echo "</td>\n";
|
||||
echo "<td width='70%' class='vtable' align='left'>\n";
|
||||
if (is_array($_SESSION["contact"]["url_label"])) {
|
||||
if (!empty($_SESSION["contact"]["url_label"])) {
|
||||
sort($_SESSION["contact"]["url_label"]);
|
||||
foreach($_SESSION["contact"]["url_label"] as $row) {
|
||||
$url_label_options[] = "<option value='".$row."' ".(($row == $url_label) ? "selected='selected'" : null).">".$row."</option>";
|
||||
|
|
@ -259,18 +266,18 @@
|
|||
$default_labels[] = $text['option-personal'];
|
||||
$default_labels[] = $text['option-other'];
|
||||
foreach ($default_labels as $default_label) {
|
||||
$url_label_options[] = "<option value='".$default_label."' ".$selected[$default_label].">".$default_label."</option>";
|
||||
$url_label_options[] = "<option value='".$default_label."' ".!empty($selected[$default_label]).">".$default_label."</option>";
|
||||
}
|
||||
$url_label_found = (in_array($url_label, $default_labels)) ? true : false;
|
||||
}
|
||||
echo " <select class='formfld' ".((!$url_label_found && $url_label != '') ? "style='display: none;'" : null)." name='url_label' id='url_label' onchange=\"getElementById('url_label_custom').value='';\">\n";
|
||||
echo " <select class='formfld' ".((!empty($url_label) && !$url_label_found) ? "style='display: none;'" : null)." name='url_label' id='url_label' onchange=\"getElementById('url_label_custom').value='';\">\n";
|
||||
echo " <option value=''></option>\n";
|
||||
echo (is_array($url_label_options)) ? implode("\n", $url_label_options) : null;
|
||||
echo (!empty($url_label_options)) ? implode("\n", $url_label_options) : null;
|
||||
echo " </select>\n";
|
||||
echo " <input type='text' class='formfld' ".(($url_label_found || $url_label == '') ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label) : null)."\">\n";
|
||||
echo " <input type='text' class='formfld' ".((empty($url_label) || $url_label_found) ? "style='display: none;'" : null)." name='url_label_custom' id='url_label_custom' value=\"".((!$url_label_found) ? htmlentities($url_label ?? '') : null)."\">\n";
|
||||
echo " <input type='button' id='btn_toggle_label' class='btn' alt='".$text['button-back']."' value='◁' onclick=\"toggle_custom('url_label');\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-url_label']."\n";
|
||||
echo !empty($text['description-url_label'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -281,7 +288,7 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='url' name='url_address' maxlength='255' value=\"".escape($url_address)."\" placeholder='http://...'>\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-url_address']."\n";
|
||||
echo !empty($text['description-url_address'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
|
|
@ -306,14 +313,14 @@
|
|||
echo "<td class='vtable' align='left'>\n";
|
||||
echo " <input class='formfld' type='text' name='url_description' maxlength='255' value=\"".escape($url_description)."\">\n";
|
||||
echo "<br />\n";
|
||||
echo $text['description-url_description']."\n";
|
||||
echo !empty($text['description-url_description'])."\n";
|
||||
echo "</td>\n";
|
||||
echo "</tr>\n";
|
||||
|
||||
echo "</table>";
|
||||
echo "<br><br>";
|
||||
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid)."'>\n";
|
||||
echo "<input type='hidden' name='contact_uuid' value='".escape($contact_uuid ?? '')."'>\n";
|
||||
if ($action == "update") {
|
||||
echo "<input type='hidden' name='contact_url_uuid' value='".escape($contact_url_uuid)."'>\n";
|
||||
}
|
||||
|
|
@ -324,4 +331,4 @@
|
|||
//include the footer
|
||||
require_once "resources/footer.php";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@
|
|||
}
|
||||
|
||||
//set the uuid
|
||||
if (is_uuid($_GET['id'])) {
|
||||
if (!empty($_GET['id']) && is_uuid($_GET['id'])) {
|
||||
$contact_uuid = $_GET['id'];
|
||||
}
|
||||
|
||||
|
|
@ -52,13 +52,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by url_primary desc, url_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_urls = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
|
||||
if (!empty($contact_urls)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='action_bar sub shrink'>\n";
|
||||
|
|
@ -81,7 +81,7 @@
|
|||
}
|
||||
echo "</tr>\n";
|
||||
|
||||
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
|
||||
if (!empty($contact_urls)) {
|
||||
$x = 0;
|
||||
foreach ($contact_urls as $row) {
|
||||
if (permission_exists('contact_url_edit')) {
|
||||
|
|
@ -113,4 +113,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,13 +47,13 @@
|
|||
$sql .= "and contact_uuid = :contact_uuid ";
|
||||
$sql .= "order by url_primary desc, url_label asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$parameters['contact_uuid'] = $contact_uuid ?? '';
|
||||
$database = new database;
|
||||
$contact_urls = $database->select($sql, $parameters, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//show if exists
|
||||
if (is_array($contact_urls) && @sizeof($contact_urls) != 0) {
|
||||
if (!empty($contact_urls)) {
|
||||
|
||||
//show the content
|
||||
echo "<div class='grid' style='grid-template-columns: 70px auto;'>\n";
|
||||
|
|
@ -69,4 +69,4 @@
|
|||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
|
||||
//action add or update
|
||||
if (is_uuid($_REQUEST["id"])) {
|
||||
if (!empty($_REQUEST["id"]) && is_uuid($_REQUEST["id"])) {
|
||||
$contact_uuid = $_REQUEST["id"];
|
||||
}
|
||||
else {
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_type = $row["contact_type"];
|
||||
$contact_organization = $row["contact_organization"];
|
||||
$contact_name_prefix = $row["contact_name_prefix"];
|
||||
|
|
@ -85,11 +85,11 @@
|
|||
$sql .= "order by username asc ";
|
||||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$database = new database;
|
||||
$users = $database->select($sql, $parameters, 'all');
|
||||
$users = $database->select($sql, $parameters ?? null, 'all');
|
||||
unset($sql, $parameters);
|
||||
|
||||
//determine if contact assigned to a user
|
||||
if (is_array($users) && sizeof($users) != 0) {
|
||||
if (!empty($users)) {
|
||||
foreach ($users as $user) {
|
||||
if ($user['contact_uuid'] == $contact_uuid) {
|
||||
$contact_user_uuid = $user['user_uuid'];
|
||||
|
|
@ -124,7 +124,7 @@
|
|||
$parameters['group_uuid'] = $_SESSION["user_uuid"];
|
||||
$database = new database;
|
||||
$contact_groups_assigned = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
if (!empty($contact_groups_assigned)) {
|
||||
foreach ($contact_groups_assigned as $field) {
|
||||
$contact_groups[] = "'".$field['group_uuid']."'";
|
||||
}
|
||||
|
|
@ -134,7 +134,7 @@
|
|||
//get the available groups for this contact
|
||||
$sql = "select group_uuid, group_name from v_groups ";
|
||||
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
|
||||
if (is_array($contact_groups) && @sizeof($contact_groups) != 0) {
|
||||
if (!empty($contact_groups)) {
|
||||
$sql .= "and group_uuid not in (".implode(',', $contact_groups).") ";
|
||||
}
|
||||
$sql .= "order by group_name asc ";
|
||||
|
|
@ -160,23 +160,23 @@
|
|||
require_once "resources/header.php";
|
||||
|
||||
//determine qr branding
|
||||
if ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] != '') {
|
||||
if (!empty($_SESSION['theme']['qr_brand_type']['text']) && !empty($_SESSION['theme']['qr_brand_image']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'image') {
|
||||
echo "<img id='img-buffer' style='display: none;' src='".$_SESSION["theme"]["qr_brand_image"]["text"]."'>";
|
||||
$qr_option = "image: $('#img-buffer')[0],";
|
||||
$qr_mode = '4';
|
||||
$qr_size = '0.2';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'image' && $_SESSION['theme']['qr_brand_image']['text'] == '') {
|
||||
elseif (!empty($_SESSION['theme']['qr_brand_type']['text']) && empty($_SESSION['theme']['qr_brand_image']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'image') {
|
||||
$qr_option = '';
|
||||
$qr_mode = '3';
|
||||
$qr_size = '0';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'text' && $_SESSION['theme']['qr_brand_text']['text'] != '') {
|
||||
elseif (!empty($_SESSION['theme']['qr_brand_type']['text']) && !empty($_SESSION['theme']['qr_brand_text']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'text') {
|
||||
$qr_option = 'label: "'.$_SESSION['theme']['qr_brand_text']['text'].'"';
|
||||
$qr_mode = '2';
|
||||
$qr_size = '0.05';
|
||||
}
|
||||
elseif ($_SESSION['theme']['qr_brand_type']['text'] == 'none') {
|
||||
elseif (!empty($_SESSION['theme']['qr_brand_type']['text']) && $_SESSION['theme']['qr_brand_type']['text'] == 'none') {
|
||||
$qr_option = '';
|
||||
$qr_mode = '3';
|
||||
$qr_size = '0';
|
||||
|
|
@ -254,7 +254,7 @@
|
|||
$parameters['user_uuid'] = $_SESSION['user']['user_uuid'];
|
||||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$time_start = $database->select($sql, $parameters, 'column');
|
||||
$time_start = $database->select($sql, $parameters ?? null, 'column');
|
||||
$btn_style = $time_start ? 'color: #fff; background-color: #3693df; background-image: none;' : null;
|
||||
unset($sql, $parameters);
|
||||
echo button::create(['type'=>'button','label'=>$text['button-timer'],'icon'=>'clock','style'=>$btn_style,'title'=>$time_start,'collapse'=>'hide-sm-dn','onclick'=>"window.open('contact_timer.php?domain_uuid=".urlencode($domain_uuid)."&contact_uuid=".urlencode($contact_uuid)."','contact_time_".escape($contact_uuid)."','width=300, height=375, top=30, left='+(screen.width - 350)+', menubar=no, scrollbars=no, status=no, toolbar=no, resizable=no');"]);
|
||||
|
|
@ -267,7 +267,7 @@
|
|||
if (is_dir($_SERVER["DOCUMENT_ROOT"].PROJECT_PATH.'/app/certificates')) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-certificate'],'icon'=>'certificate','collapse'=>'hide-sm-dn','link'=>'../certificates/index.php?name='.urlencode($contact_name_given." ".$contact_name_family)]);
|
||||
}
|
||||
if (permission_exists('user_edit') && is_uuid($contact_user_uuid)) {
|
||||
if (!empty($contact_user_uuid) && permission_exists('user_edit') && is_uuid($contact_user_uuid)) {
|
||||
echo button::create(['type'=>'button','label'=>$text['button-user'],'icon'=>'user','collapse'=>'hide-sm-dn','link'=>'../../core/users/user_edit.php?id='.urlencode($contact_user_uuid)]);
|
||||
}
|
||||
if (
|
||||
|
|
@ -302,6 +302,7 @@
|
|||
echo "</div>\n";
|
||||
|
||||
if (
|
||||
!empty($action) &&
|
||||
$action == "update" && (
|
||||
permission_exists('contact_delete') ||
|
||||
permission_exists('contact_user_delete') ||
|
||||
|
|
@ -344,7 +345,7 @@
|
|||
if ($contact_type) {
|
||||
echo "<div class='box contact-details-label'>".$text['label-contact_type']."</div>\n";
|
||||
echo "<div class='box'>";
|
||||
if (is_array($_SESSION["contact"]["type"])) {
|
||||
if (!empty($_SESSION["contact"]["type"])) {
|
||||
sort($_SESSION["contact"]["type"]);
|
||||
foreach ($_SESSION["contact"]["type"] as $type) {
|
||||
if ($contact_type == $type) {
|
||||
|
|
@ -364,7 +365,7 @@
|
|||
if ($contact_category) {
|
||||
echo "<div class='box contact-details-label'>".$text['label-contact_category']."</div>\n";
|
||||
echo "<div class='box'>";
|
||||
if (is_array($_SESSION["contact"]["category"])) {
|
||||
if (!empty($_SESSION["contact"]["category"])) {
|
||||
sort($_SESSION["contact"]["category"]);
|
||||
foreach ($_SESSION["contact"]["category"] as $category) {
|
||||
if ($contact_category == $category) {
|
||||
|
|
@ -382,7 +383,7 @@
|
|||
if ($contact_role) {
|
||||
echo "<div class='box contact-details-label'>".$text['label-contact_role']."</div>\n";
|
||||
echo "<div class='box'>";
|
||||
if (is_array($_SESSION["contact"]["role"])) {
|
||||
if (!empty($_SESSION["contact"]["role"])) {
|
||||
sort($_SESSION["contact"]["role"]);
|
||||
foreach ($_SESSION["contact"]["role"] as $role) {
|
||||
if ($contact_role == $role) {
|
||||
|
|
@ -404,7 +405,7 @@
|
|||
echo "</div>\n";
|
||||
}
|
||||
//users (viewing contact)
|
||||
if (permission_exists('contact_user_view') && is_array($contact_users_assigned) && @sizeof($contact_users_assigned) != 0) {
|
||||
if (permission_exists('contact_user_view') && !empty($contact_users_assigned)) {
|
||||
echo "<div class='box contact-details-label'>".$text['label-users']."</div>\n";
|
||||
echo "<div class='box'>";
|
||||
foreach ($contact_users_assigned as $field) {
|
||||
|
|
@ -413,7 +414,7 @@
|
|||
echo "</div>\n";
|
||||
}
|
||||
//groups (viewing contact)
|
||||
if (permission_exists('contact_group_view') && is_array($contact_groups_assigned) && @sizeof($contact_groups_assigned) != 0) {
|
||||
if (permission_exists('contact_group_view') && !empty($contact_groups_assigned)) {
|
||||
echo "<div class='box contact-details-label'>".$text['label-groups']."</div>\n";
|
||||
echo "<div class='box'>";
|
||||
foreach ($contact_groups_assigned as $field) {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
|
||||
$parameters['group_uuid'] = $_SESSION['group_uuid'] ?? '';
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters ?? null, 'all');
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (!empty($result)) {
|
||||
foreach($result as $row) {
|
||||
$contact_sync_sources[$row['contact_uuid']][] = $row['contact_setting_value'];
|
||||
|
|
@ -136,7 +136,7 @@
|
|||
//add the search term
|
||||
$search = strtolower($_GET["search"] ?? '');
|
||||
if (!empty($search)) {
|
||||
if (is_numeric($search)) {
|
||||
if (isset($search)) {
|
||||
$sql_search .= "and contact_uuid in ( ";
|
||||
$sql_search .= " select contact_uuid from v_contact_phones ";
|
||||
$sql_search .= " where phone_number like :search ";
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ else {
|
|||
exit;
|
||||
}
|
||||
|
||||
if (is_array($_GET) && @sizeof($_GET) != 0) {
|
||||
if (!empty($_GET)) {
|
||||
|
||||
//add multi-lingual support
|
||||
$language = new text;
|
||||
|
|
@ -50,7 +50,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
$vcard = new vcard();
|
||||
|
||||
//get the contact id
|
||||
$contact_uuid = $_GET["id"];
|
||||
$contact_uuid = $_GET["id"] ?? '';
|
||||
|
||||
//get the contact's information
|
||||
$sql = "select * from v_contacts ";
|
||||
|
|
@ -60,7 +60,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$row = $database->select($sql, $parameters, 'row');
|
||||
if (is_array($row) && @sizeof($row) != 0) {
|
||||
if (!empty($row)) {
|
||||
$contact_type = $row["contact_type"];
|
||||
$contact_organization = $row["contact_organization"];
|
||||
$contact_name_given = $row["contact_name_given"];
|
||||
|
|
@ -73,9 +73,9 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
}
|
||||
unset($sql, $parameters, $row);
|
||||
|
||||
$vcard->data['company'] = $contact_organization;
|
||||
$vcard->data['first_name'] = $contact_name_given;
|
||||
$vcard->data['last_name'] = $contact_name_family;
|
||||
$vcard->data['company'] = $contact_organization ?? '';
|
||||
$vcard->data['first_name'] = $contact_name_given ?? '';
|
||||
$vcard->data['last_name'] = $contact_name_family ?? '';
|
||||
|
||||
//get the contact's primary (and a secondary, if available) email
|
||||
$sql = "select email_address from v_contact_emails ";
|
||||
|
|
@ -86,7 +86,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
if (!empty($result)) {
|
||||
$e = 1;
|
||||
foreach ($result as &$row) {
|
||||
$vcard->data['email'.$e] = $row["email_address"];
|
||||
|
|
@ -112,12 +112,12 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
//don't add this to the QR code at this time
|
||||
}
|
||||
else {
|
||||
$vcard->data['display_name'] = $contact_name_given." ".$contact_name_family;
|
||||
$vcard->data['contact_nickname'] = $contact_nickname;
|
||||
$vcard->data['contact_title'] = $contact_title;
|
||||
$vcard->data['contact_role'] = $contact_role;
|
||||
$vcard->data['timezone'] = $contact_time_zone;
|
||||
$vcard->data['contact_note'] = $contact_note;
|
||||
$vcard->data['display_name'] = !empty($contact_name_given)." ".!empty($contact_name_family);
|
||||
$vcard->data['contact_nickname'] = !empty($contact_nickname);
|
||||
$vcard->data['contact_title'] = !empty($contact_title);
|
||||
$vcard->data['contact_role'] = !empty($contact_role);
|
||||
$vcard->data['timezone'] = !empty($contact_time_zone);
|
||||
$vcard->data['contact_note'] = !empty($contact_note);
|
||||
}
|
||||
|
||||
//get the contact's telephone numbers
|
||||
|
|
@ -128,7 +128,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
$phone_label = $row["phone_label"];
|
||||
$phone_number = $row["phone_number"];
|
||||
|
|
@ -157,7 +157,7 @@ if (is_array($_GET) && @sizeof($_GET) != 0) {
|
|||
$parameters['contact_uuid'] = $contact_uuid;
|
||||
$database = new database;
|
||||
$result = $database->select($sql, $parameters, 'all');
|
||||
if (is_array($result) && @sizeof($result) != 0) {
|
||||
if (!empty($result)) {
|
||||
foreach ($result as &$row) {
|
||||
$address_type = $row["address_type"];
|
||||
$address_street = $row["address_street"];
|
||||
|
|
|
|||
|
|
@ -108,13 +108,13 @@ class vcard {
|
|||
|
||||
$vcard_address_type_values = array('work','home','dom','intl','postal','parcel','pref');
|
||||
foreach ($vcard_address_type_values as $vcard_address_type_value) {
|
||||
if ($this->data[$vcard_address_type_value.'_po_box']
|
||||
|| $this->data[$vcard_address_type_value.'_extended_address']
|
||||
|| $this->data[$vcard_address_type_value.'_address']
|
||||
|| $this->data[$vcard_address_type_value.'_city']
|
||||
|| $this->data[$vcard_address_type_value.'_state']
|
||||
|| $this->data[$vcard_address_type_value.'_postal_code']
|
||||
|| $this->data[$vcard_address_type_value.'_country']) {
|
||||
if (!empty($this->data[$vcard_address_type_value.'_po_box'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_extended_address'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_address'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_city'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_state'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_postal_code'])
|
||||
|| !empty($this->data[$vcard_address_type_value.'_country'])) {
|
||||
$this->card .= "ADR;TYPE=".$vcard_address_type_value.":";
|
||||
if (!empty($this->data[$vcard_address_type_value.'_po_box'])) {
|
||||
$this->card .= $this->data[$vcard_address_type_value.'_po_box'].";";
|
||||
|
|
|
|||
Loading…
Reference in New Issue