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:
@@ -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";
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user