Order contacts by last modified date by default.

This commit is contained in:
markjcrane 2015-10-20 01:39:54 -06:00
parent d11f0e6c5c
commit 6ee9b8f6cc
10 changed files with 916 additions and 807 deletions

View File

@ -48,9 +48,10 @@ else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["contact_uuid"]) > 0) { //get the contact uuid
$contact_uuid = check_str($_GET["contact_uuid"]); if (strlen($_GET["contact_uuid"]) > 0) {
} $contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST)>0) { if (count($_POST)>0) {
@ -73,114 +74,125 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$address_label = ($address_label_custom != '') ? $address_label_custom : $address_label; $address_label = ($address_label_custom != '') ? $address_label_custom : $address_label;
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_address_uuid = check_str($_POST["contact_address_uuid"]); $contact_address_uuid = check_str($_POST["contact_address_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers //update last modified
if ($address_primary) { $sql = "update v_contacts set ";
$sql = "update v_contact_addresses set address_primary = 0 "; $sql .= "last_mod_date = now(), ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql)); $sql .= "and contact_uuid = '".$contact_uuid."' ";
unset($sql); $db->exec(check_sql($sql));
} unset($sql);
if ($action == "add") { //if primary, unmark other primary numbers
$contact_address_uuid = uuid(); if ($address_primary) {
$sql = "insert into v_contact_addresses "; $sql = "update v_contact_addresses set address_primary = 0 ";
$sql .= "("; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "domain_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_uuid, "; $db->exec(check_sql($sql));
$sql .= "contact_address_uuid, "; unset($sql);
$sql .= "address_type, "; }
$sql .= "address_label, ";
$sql .= "address_street, ";
$sql .= "address_extended, ";
$sql .= "address_community, ";
$sql .= "address_locality, ";
$sql .= "address_region, ";
$sql .= "address_postal_code, ";
$sql .= "address_country, ";
$sql .= "address_latitude, ";
$sql .= "address_longitude, ";
$sql .= "address_primary, ";
$sql .= "address_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_address_uuid."', ";
$sql .= "'".$address_type."', ";
$sql .= "'".$address_label."', ";
$sql .= "'".$address_street."', ";
$sql .= "'".$address_extended."', ";
$sql .= "'".$address_community."', ";
$sql .= "'".$address_locality."', ";
$sql .= "'".$address_region."', ";
$sql .= "'".$address_postal_code."', ";
$sql .= "'".$address_country."', ";
$sql .= "'".$address_latitude."', ";
$sql .= "'".$address_longitude."', ";
$sql .= (($address_primary) ? 1 : 0).", ";
$sql .= "'".$address_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; if ($action == "add") {
header("Location: contact_edit.php?id=".$contact_uuid); $contact_address_uuid = uuid();
return; $sql = "insert into v_contact_addresses ";
} //if ($action == "add") $sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_address_uuid, ";
$sql .= "address_type, ";
$sql .= "address_label, ";
$sql .= "address_street, ";
$sql .= "address_extended, ";
$sql .= "address_community, ";
$sql .= "address_locality, ";
$sql .= "address_region, ";
$sql .= "address_postal_code, ";
$sql .= "address_country, ";
$sql .= "address_latitude, ";
$sql .= "address_longitude, ";
$sql .= "address_primary, ";
$sql .= "address_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_address_uuid."', ";
$sql .= "'".$address_type."', ";
$sql .= "'".$address_label."', ";
$sql .= "'".$address_street."', ";
$sql .= "'".$address_extended."', ";
$sql .= "'".$address_community."', ";
$sql .= "'".$address_locality."', ";
$sql .= "'".$address_region."', ";
$sql .= "'".$address_postal_code."', ";
$sql .= "'".$address_country."', ";
$sql .= "'".$address_latitude."', ";
$sql .= "'".$address_longitude."', ";
$sql .= (($address_primary) ? 1 : 0).", ";
$sql .= "'".$address_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") { $_SESSION["message"] = $text['message-add'];
$sql = "update v_contact_addresses set "; header("Location: contact_edit.php?id=".$contact_uuid);
$sql .= "contact_uuid = '".$contact_uuid."', "; return;
$sql .= "address_type = '".$address_type."', "; } //if ($action == "add")
$sql .= "address_label = '".$address_label."', ";
$sql .= "address_street = '".$address_street."', ";
$sql .= "address_extended = '".$address_extended."', ";
$sql .= "address_community = '".$address_community."', ";
$sql .= "address_locality = '".$address_locality."', ";
$sql .= "address_region = '".$address_region."', ";
$sql .= "address_postal_code = '".$address_postal_code."', ";
$sql .= "address_country = '".$address_country."', ";
$sql .= "address_latitude = '".$address_latitude."', ";
$sql .= "address_longitude = '".$address_longitude."', ";
$sql .= "address_primary = ".(($address_primary) ? 1 : 0).", ";
$sql .= "address_description = '".$address_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_address_uuid = '".$contact_address_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; if ($action == "update") {
header("Location: contact_edit.php?id=".$contact_uuid); $sql = "update v_contact_addresses set ";
return; $sql .= "contact_uuid = '".$contact_uuid."', ";
} //if ($action == "update") $sql .= "address_type = '".$address_type."', ";
} //if ($_POST["persistformvar"] != "true") $sql .= "address_label = '".$address_label."', ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "address_street = '".$address_street."', ";
$sql .= "address_extended = '".$address_extended."', ";
$sql .= "address_community = '".$address_community."', ";
$sql .= "address_locality = '".$address_locality."', ";
$sql .= "address_region = '".$address_region."', ";
$sql .= "address_postal_code = '".$address_postal_code."', ";
$sql .= "address_country = '".$address_country."', ";
$sql .= "address_latitude = '".$address_latitude."', ";
$sql .= "address_longitude = '".$address_longitude."', ";
$sql .= "address_primary = ".(($address_primary) ? 1 : 0).", ";
$sql .= "address_description = '".$address_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_address_uuid = '".$contact_address_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -79,171 +79,182 @@ else {
$contact_note = check_str($_POST["contact_note"]); $contact_note = check_str($_POST["contact_note"]);
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_uuid = check_str($_POST["contact_uuid"]); $contact_uuid = check_str($_POST["contact_uuid"]);
} }
//check for all required data //check for all required data
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; } $msg = '';
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; } //if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; } //if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; } //if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; } //if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; } //if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; }
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; } //if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; }
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; } //if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; }
//if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; } //if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; }
//if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; } //if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; }
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; } //if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; }
//if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<br>\n"; } //if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { //if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<br>\n"; }
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add") { //update last modified
$contact_uuid = uuid(); $sql = "update v_contacts set ";
$sql = "insert into v_contacts "; $sql .= "last_mod_date = now(), ";
$sql .= "( "; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "domain_uuid, "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "contact_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_type, "; $db->exec(check_sql($sql));
$sql .= "contact_organization, "; unset($sql);
$sql .= "contact_name_prefix, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_middle, ";
$sql .= "contact_name_family, ";
$sql .= "contact_name_suffix, ";
$sql .= "contact_nickname, ";
$sql .= "contact_title, ";
$sql .= "contact_category, ";
$sql .= "contact_role, ";
$sql .= "contact_time_zone, ";
$sql .= "contact_note, ";
$sql .= "last_mod_date, ";
$sql .= "last_mod_user ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_type."', ";
$sql .= "'".$contact_organization."', ";
$sql .= "'".$contact_name_prefix."', ";
$sql .= "'".$contact_name_given."', ";
$sql .= "'".$contact_name_middle."', ";
$sql .= "'".$contact_name_family."', ";
$sql .= "'".$contact_name_suffix."', ";
$sql .= "'".$contact_nickname."', ";
$sql .= "'".$contact_title."', ";
$sql .= "'".$contact_category."', ";
$sql .= "'".$contact_role."', ";
$sql .= "'".$contact_time_zone."', ";
$sql .= "'".$contact_note."', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION['username']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; if ($action == "add") {
$location = "contact_edit.php?id=".$contact_uuid; $contact_uuid = uuid();
} //if ($action == "add") $sql = "insert into v_contacts ";
$sql .= "( ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_type, ";
$sql .= "contact_organization, ";
$sql .= "contact_name_prefix, ";
$sql .= "contact_name_given, ";
$sql .= "contact_name_middle, ";
$sql .= "contact_name_family, ";
$sql .= "contact_name_suffix, ";
$sql .= "contact_nickname, ";
$sql .= "contact_title, ";
$sql .= "contact_category, ";
$sql .= "contact_role, ";
$sql .= "contact_time_zone, ";
$sql .= "contact_note, ";
$sql .= "last_mod_date, ";
$sql .= "last_mod_user ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_type."', ";
$sql .= "'".$contact_organization."', ";
$sql .= "'".$contact_name_prefix."', ";
$sql .= "'".$contact_name_given."', ";
$sql .= "'".$contact_name_middle."', ";
$sql .= "'".$contact_name_family."', ";
$sql .= "'".$contact_name_suffix."', ";
$sql .= "'".$contact_nickname."', ";
$sql .= "'".$contact_title."', ";
$sql .= "'".$contact_category."', ";
$sql .= "'".$contact_role."', ";
$sql .= "'".$contact_time_zone."', ";
$sql .= "'".$contact_note."', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION['username']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
//if contact is shared, remove contact group record containing user's uuid $_SESSION["message"] = $text['message-add'];
if ($_POST['contact_shared'] == 'true') { $location = "contact_edit.php?id=".$contact_uuid;
$sql = "delete from v_contact_groups "; } //if ($action == "add")
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
$group_uuid = $_POST['group_uuid'];
}
//if private contact, delete any groups currently assigned, set group uuid to user's uuid
else {
$sql = "delete from v_contact_groups ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement, $sql);
$group_uuid = $_SESSION["user_uuid"];
}
//handle insertion of contact group (or private contact, if not shared) //if contact is shared, remove contact group record containing user's uuid
if ($group_uuid != '') { if ($_POST['contact_shared'] == 'true') {
$sql = "insert into v_contact_groups "; $sql = "delete from v_contact_groups ";
$sql .= "( "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "contact_group_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "domain_uuid, "; $sql .= "and group_uuid = '".$_SESSION["user_uuid"]."' ";
$sql .= "contact_uuid, "; $prep_statement = $db->prepare(check_sql($sql));
$sql .= "group_uuid "; $prep_statement->execute();
$sql .= ") "; unset($prep_statement, $sql);
$sql .= "values "; $group_uuid = $_POST['group_uuid'];
$sql .= "( "; }
$sql .= "'".uuid()."', "; //if private contact, delete any groups currently assigned, set group uuid to user's uuid
$sql .= "'".$domain_uuid."', "; else {
$sql .= "'".$contact_uuid."', "; $sql = "delete from v_contact_groups ";
$sql .= "'".$group_uuid."' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= ") "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));
unset($sql); $prep_statement->execute();
} unset($prep_statement, $sql);
$group_uuid = $_SESSION["user_uuid"];
}
if ($action == "update") { //handle insertion of contact group (or private contact, if not shared)
$sql = "update v_contacts set "; if ($group_uuid != '') {
$sql .= "contact_type = '".$contact_type."', "; $sql = "insert into v_contact_groups ";
$sql .= "contact_organization = '".$contact_organization."', "; $sql .= "( ";
$sql .= "contact_name_prefix = '".$contact_name_prefix."', "; $sql .= "contact_group_uuid, ";
$sql .= "contact_name_given = '".$contact_name_given."', "; $sql .= "domain_uuid, ";
$sql .= "contact_name_middle = '".$contact_name_middle."', "; $sql .= "contact_uuid, ";
$sql .= "contact_name_family = '".$contact_name_family."', "; $sql .= "group_uuid ";
$sql .= "contact_name_suffix = '".$contact_name_suffix."', "; $sql .= ") ";
$sql .= "contact_nickname = '".$contact_nickname."', "; $sql .= "values ";
$sql .= "contact_title = '".$contact_title."', "; $sql .= "( ";
$sql .= "contact_category = '".$contact_category."', "; $sql .= "'".uuid()."', ";
$sql .= "contact_role = '".$contact_role."', "; $sql .= "'".$domain_uuid."', ";
$sql .= "contact_time_zone = '".$contact_time_zone."', "; $sql .= "'".$contact_uuid."', ";
$sql .= "contact_note = '".$contact_note."', "; $sql .= "'".$group_uuid."' ";
$sql .= "last_mod_date = now(), "; $sql .= ") ";
$sql .= "last_mod_user = '".$_SESSION['username']."' "; $db->exec(check_sql($sql));
$sql .= "where domain_uuid = '".$domain_uuid."' "; unset($sql);
$sql .= "and contact_uuid = '".$contact_uuid."' "; }
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; if ($action == "update") {
$location = "contact_edit.php?id=".$contact_uuid; $sql = "update v_contacts set ";
} //if ($action == "update") $sql .= "contact_type = '".$contact_type."', ";
$sql .= "contact_organization = '".$contact_organization."', ";
$sql .= "contact_name_prefix = '".$contact_name_prefix."', ";
$sql .= "contact_name_given = '".$contact_name_given."', ";
$sql .= "contact_name_middle = '".$contact_name_middle."', ";
$sql .= "contact_name_family = '".$contact_name_family."', ";
$sql .= "contact_name_suffix = '".$contact_name_suffix."', ";
$sql .= "contact_nickname = '".$contact_nickname."', ";
$sql .= "contact_title = '".$contact_title."', ";
$sql .= "contact_category = '".$contact_category."', ";
$sql .= "contact_role = '".$contact_role."', ";
$sql .= "contact_time_zone = '".$contact_time_zone."', ";
$sql .= "contact_note = '".$contact_note."', ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//handle redirect $_SESSION["message"] = $text['message-update'];
if ($_POST['submit'] == $text['button-add']) { $location = "contact_edit.php?id=".$contact_uuid;
$group_uuid = $_POST['group_uuid']; } //if ($action == "update")
//insert
$location = "contact_edit.php?id=".$contact_uuid;
}
header("Location: ".$location); //handle redirect
return; if ($_POST['submit'] == $text['button-add']) {
$group_uuid = $_POST['group_uuid'];
//insert
$location = "contact_edit.php?id=".$contact_uuid;
}
} //if ($_POST["persistformvar"] != "true") header("Location: ".$location);
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {

View File

@ -64,87 +64,98 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$email_label = ($email_label_custom != '') ? $email_label_custom : $email_label; $email_label = ($email_label_custom != '') ? $email_label_custom : $email_label;
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_email_uuid = check_str($_POST["contact_email_uuid"]); $contact_email_uuid = check_str($_POST["contact_email_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers //update last modified
if ($email_primary) { $sql = "update v_contacts set ";
$sql = "update v_contact_emails set email_primary = 0 "; $sql .= "last_mod_date = now(), ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql)); $sql .= "and contact_uuid = '".$contact_uuid."' ";
unset($sql); $db->exec(check_sql($sql));
} unset($sql);
if ($action == "add") { //if primary, unmark other primary numbers
$contact_email_uuid = uuid(); if ($email_primary) {
$sql = "insert into v_contact_emails "; $sql = "update v_contact_emails set email_primary = 0 ";
$sql .= "("; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "domain_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_uuid, "; $db->exec(check_sql($sql));
$sql .= "contact_email_uuid, "; unset($sql);
$sql .= "email_label, "; }
$sql .= "email_address, ";
$sql .= "email_primary, ";
$sql .= "email_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_email_uuid."', ";
$sql .= "'".$email_label."', ";
$sql .= "'".$email_address."', ";
$sql .= (($email_primary) ? 1 : 0).", ";
$sql .= "'".$email_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; if ($action == "add") {
header("Location: contact_edit.php?id=".$contact_uuid); $contact_email_uuid = uuid();
return; $sql = "insert into v_contact_emails ";
} //if ($action == "add") $sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_email_uuid, ";
$sql .= "email_label, ";
$sql .= "email_address, ";
$sql .= "email_primary, ";
$sql .= "email_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_email_uuid."', ";
$sql .= "'".$email_label."', ";
$sql .= "'".$email_address."', ";
$sql .= (($email_primary) ? 1 : 0).", ";
$sql .= "'".$email_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") { $_SESSION["message"] = $text['message-add'];
$sql = "update v_contact_emails set "; header("Location: contact_edit.php?id=".$contact_uuid);
$sql .= "contact_uuid = '".$contact_uuid."', "; return;
$sql .= "email_label = '".$email_label."', "; } //if ($action == "add")
$sql .= "email_address = '".$email_address."', ";
$sql .= "email_primary = ".(($email_primary) ? 1 : 0).", ";
$sql .= "email_description = '".$email_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_email_uuid = '".$contact_email_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; if ($action == "update") {
header("Location: contact_edit.php?id=".$contact_uuid); $sql = "update v_contact_emails set ";
return; $sql .= "contact_uuid = '".$contact_uuid."', ";
} //if ($action == "update") $sql .= "email_label = '".$email_label."', ";
} //if ($_POST["persistformvar"] != "true") $sql .= "email_address = '".$email_address."', ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "email_primary = ".(($email_primary) ? 1 : 0).", ";
$sql .= "email_description = '".$email_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_email_uuid = '".$contact_email_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -59,75 +59,87 @@ else {
$last_mod_user = check_str($_POST["last_mod_user"]); $last_mod_user = check_str($_POST["last_mod_user"]);
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//get the primary id for the contact note //get the primary id for the contact note
$msg = ''; if ($action == "update") {
if ($action == "update") { $contact_note_uuid = check_str($_POST["contact_note_uuid"]);
$contact_note_uuid = check_str($_POST["contact_note_uuid"]); }
}
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
if ($action == "add") { //update last modified
$contact_note_uuid = uuid(); $sql = "update v_contacts set ";
$sql = "insert into v_contact_notes "; $sql .= "last_mod_date = now(), ";
$sql .= "("; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "contact_note_uuid, "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "contact_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_note, "; $db->exec(check_sql($sql));
$sql .= "domain_uuid, "; unset($sql);
$sql .= "last_mod_date, ";
$sql .= "last_mod_user ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$contact_note_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_note', ";
$sql .= "'$domain_uuid', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION['username']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; //add the note
header("Location: contact_edit.php?id=".$contact_uuid); if ($action == "add") {
return; $contact_note_uuid = uuid();
} //if ($action == "add") $sql = "insert into v_contact_notes ";
$sql .= "(";
$sql .= "contact_note_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_note, ";
$sql .= "domain_uuid, ";
$sql .= "last_mod_date, ";
$sql .= "last_mod_user ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'$contact_note_uuid', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$contact_note', ";
$sql .= "'$domain_uuid', ";
$sql .= "now(), ";
$sql .= "'".$_SESSION['username']."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") { $_SESSION["message"] = $text['message-add'];
$sql = "update v_contact_notes set "; header("Location: contact_edit.php?id=".$contact_uuid);
$sql .= "contact_uuid = '$contact_uuid', "; return;
$sql .= "contact_note = '$contact_note', "; } //if ($action == "add")
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; //update the note
header("Location: contact_edit.php?id=".$contact_uuid); if ($action == "update") {
return; $sql = "update v_contact_notes set ";
} //if ($action == "update") $sql .= "contact_uuid = '$contact_uuid', ";
} //if ($_POST["persistformvar"] != "true") $sql .= "contact_note = '$contact_note', ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '$domain_uuid' ";
$sql .= "and contact_note_uuid = '$contact_note_uuid'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -72,102 +72,113 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label; $phone_label = ($phone_label_custom != '') ? $phone_label_custom : $phone_label;
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set thge uuid
if ($action == "update") { if ($action == "update") {
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]); $contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers //update last modified
if ($phone_primary) { $sql = "update v_contacts set ";
$sql = "update v_contact_phones set phone_primary = 0 "; $sql .= "last_mod_date = now(), ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql)); $sql .= "and contact_uuid = '".$contact_uuid."' ";
unset($sql); $db->exec(check_sql($sql));
} unset($sql);
if ($action == "add") { //if primary, unmark other primary numbers
$contact_phone_uuid = uuid(); if ($phone_primary) {
$sql = "insert into v_contact_phones "; $sql = "update v_contact_phones set phone_primary = 0 ";
$sql .= "("; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "domain_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_uuid, "; $db->exec(check_sql($sql));
$sql .= "contact_phone_uuid, "; unset($sql);
$sql .= "phone_type_voice, "; }
$sql .= "phone_type_fax, ";
$sql .= "phone_type_video, ";
$sql .= "phone_type_text, ";
$sql .= "phone_label, ";
$sql .= "phone_number, ";
$sql .= "phone_extension, ";
$sql .= "phone_primary, ";
$sql .= "phone_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_phone_uuid."', ";
$sql .= (($phone_type_voice) ? 1 : 'null').", ";
$sql .= (($phone_type_fax) ? 1 : 'null').", ";
$sql .= (($phone_type_video) ? 1 : 'null').", ";
$sql .= (($phone_type_text) ? 1 : 'null').", ";
$sql .= "'".$phone_label."', ";
$sql .= "'".$phone_number."', ";
$sql .= "'".$phone_extension."', ";
$sql .= (($phone_primary) ? 1 : 0).", ";
$sql .= "'".$phone_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; if ($action == "add") {
header("Location: contact_edit.php?id=".$contact_uuid); $contact_phone_uuid = uuid();
return; $sql = "insert into v_contact_phones ";
} //if ($action == "add") $sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_phone_uuid, ";
$sql .= "phone_type_voice, ";
$sql .= "phone_type_fax, ";
$sql .= "phone_type_video, ";
$sql .= "phone_type_text, ";
$sql .= "phone_label, ";
$sql .= "phone_number, ";
$sql .= "phone_extension, ";
$sql .= "phone_primary, ";
$sql .= "phone_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_phone_uuid."', ";
$sql .= (($phone_type_voice) ? 1 : 'null').", ";
$sql .= (($phone_type_fax) ? 1 : 'null').", ";
$sql .= (($phone_type_video) ? 1 : 'null').", ";
$sql .= (($phone_type_text) ? 1 : 'null').", ";
$sql .= "'".$phone_label."', ";
$sql .= "'".$phone_number."', ";
$sql .= "'".$phone_extension."', ";
$sql .= (($phone_primary) ? 1 : 0).", ";
$sql .= "'".$phone_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") { $_SESSION["message"] = $text['message-add'];
$sql = "update v_contact_phones set "; header("Location: contact_edit.php?id=".$contact_uuid);
$sql .= "contact_uuid = '$contact_uuid', "; return;
$sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", "; } //if ($action == "add")
$sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", ";
$sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", ";
$sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", ";
$sql .= "phone_label = '".$phone_label."', ";
$sql .= "phone_number = '".$phone_number."', ";
$sql .= "phone_extension = '".$phone_extension."', ";
$sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", ";
$sql .= "phone_description = '".$phone_description."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; if ($action == "update") {
header("Location: contact_edit.php?id=".$contact_uuid); $sql = "update v_contact_phones set ";
return; $sql .= "contact_uuid = '$contact_uuid', ";
} //if ($action == "update") $sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", ";
} //if ($_POST["persistformvar"] != "true") $sql .= "phone_type_fax = ".(($phone_type_fax) ? 1 : 'null').", ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "phone_type_video = ".(($phone_type_video) ? 1 : 'null').", ";
$sql .= "phone_type_text = ".(($phone_type_text) ? 1 : 'null').", ";
$sql .= "phone_label = '".$phone_label."', ";
$sql .= "phone_number = '".$phone_number."', ";
$sql .= "phone_extension = '".$phone_extension."', ";
$sql .= "phone_primary = ".(($phone_primary) ? 1 : 0).", ";
$sql .= "phone_description = '".$phone_description."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_phone_uuid = '".$contact_phone_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,9 +48,10 @@ else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["contact_uuid"]) > 0) { //get the contact uuid
$contact_uuid = check_str($_GET["contact_uuid"]); if (strlen($_GET["contact_uuid"]) > 0) {
} $contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST)>0) { if (count($_POST)>0) {
@ -66,93 +67,104 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label; $relation_reciprocal_label = ($relation_reciprocal_label_custom != '') ? $relation_reciprocal_label_custom : $relation_reciprocal_label;
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]); $contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
}
//check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$relation_label."', ";
$sql .= "'".$relation_contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($relation_reciprocal) {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$relation_contact_uuid."', ";
$sql .= "'".$relation_reciprocal_label."', ";
$sql .= "'".$contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} }
$_SESSION["message"] = $text['message-add']; //check for all required data
header("Location: contact_edit.php?id=".$contact_uuid); $msg = '';
return; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
} //if ($action == "add") require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
if ($action == "update") { //add or update the database
$sql = "update v_contact_relations set "; if ($_POST["persistformvar"] != "true") {
$sql .= "relation_label = '".$relation_label."', ";
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; //update last modified
header("Location: contact_edit.php?id=".$contact_uuid); $sql = "update v_contacts set ";
return; $sql .= "last_mod_date = now(), ";
} //if ($action == "update") $sql .= "last_mod_user = '".$_SESSION['username']."' ";
} //if ($_POST["persistformvar"] != "true") $sql .= "where domain_uuid = '".$domain_uuid."' ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$relation_label."', ";
$sql .= "'".$relation_contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($relation_reciprocal) {
$contact_relation_uuid = uuid();
$sql = "insert into v_contact_relations ";
$sql .= "(";
$sql .= "contact_relation_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "relation_label, ";
$sql .= "relation_contact_uuid ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$contact_relation_uuid."', ";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$relation_contact_uuid."', ";
$sql .= "'".$relation_reciprocal_label."', ";
$sql .= "'".$contact_uuid."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
}
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_relations set ";
$sql .= "relation_label = '".$relation_label."', ";
$sql .= "relation_contact_uuid = '".$relation_contact_uuid."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_relation_uuid = '".$contact_relation_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {

View File

@ -48,10 +48,13 @@ else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["contact_uuid"]) > 0) { //get the contact uuid
$contact_uuid = check_str($_GET["contact_uuid"]); if (strlen($_GET["contact_uuid"]) > 0) {
} $contact_uuid = check_str($_GET["contact_uuid"]);
$domain_uuid = $_SESSION['domain_uuid']; }
//set the session domain uuid as a variable
$domain_uuid = $_SESSION['domain_uuid'];
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST) > 0) { if (count($_POST) > 0) {
@ -64,97 +67,110 @@ $domain_uuid = $_SESSION['domain_uuid'];
$contact_setting_description = check_str($_POST["contact_setting_description"]); $contact_setting_description = check_str($_POST["contact_setting_description"]);
} }
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]); $contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
} }
//check for all required data //check for all required data
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; } $msg = '';
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; } //if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; } //if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; } //if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; } //if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; } //if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; } //if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { //if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
}
//add or update the database
if ($_POST["persistformvar"] != "true") {
$contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null';
//add the domain
if ($action == "add" && permission_exists('domain_setting_add')) {
$sql = "insert into v_contact_settings ";
$sql .= "(";
$sql .= "contact_setting_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_setting_category, ";
$sql .= "contact_setting_subcategory, ";
$sql .= "contact_setting_name, ";
$sql .= "contact_setting_value, ";
$sql .= "contact_setting_order, ";
$sql .= "contact_setting_enabled, ";
$sql .= "contact_setting_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$contact_setting_category', ";
$sql .= "'$contact_setting_subcategory', ";
$sql .= "'$contact_setting_name', ";
$sql .= "'$contact_setting_value', ";
$sql .= "$contact_setting_order, ";
$sql .= "'$contact_setting_enabled', ";
$sql .= "'$contact_setting_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
//update the domain
if ($action == "update") {
$sql = "update v_contact_settings set ";
$sql .= "contact_setting_category = '$contact_setting_category', ";
$sql .= "contact_setting_subcategory = '$contact_setting_subcategory', ";
$sql .= "contact_setting_name = '$contact_setting_name', ";
$sql .= "contact_setting_value = '$contact_setting_value', ";
$sql .= "contact_setting_order = $contact_setting_order, ";
$sql .= "contact_setting_enabled = '$contact_setting_enabled', ";
$sql .= "contact_setting_description = '$contact_setting_description' ";
$sql .= "where contact_uuid = '$contact_uuid' ";
$sql .= "and contact_setting_uuid = '$contact_setting_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
//redirect the browser
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
header("Location: contact_edit.php?id=".$contact_uuid);
return; return;
} //if ($_POST["persistformvar"] != "true") }
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//add or update the database
if ($_POST["persistformvar"] != "true") {
//set the order
$contact_setting_order = ($contact_setting_order != '') ? $contact_setting_order : 'null';
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
//add the domain
if ($action == "add" && permission_exists('domain_setting_add')) {
$sql = "insert into v_contact_settings ";
$sql .= "(";
$sql .= "contact_setting_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_setting_category, ";
$sql .= "contact_setting_subcategory, ";
$sql .= "contact_setting_name, ";
$sql .= "contact_setting_value, ";
$sql .= "contact_setting_order, ";
$sql .= "contact_setting_enabled, ";
$sql .= "contact_setting_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".uuid()."', ";
$sql .= "'$contact_uuid', ";
$sql .= "'$domain_uuid', ";
$sql .= "'$contact_setting_category', ";
$sql .= "'$contact_setting_subcategory', ";
$sql .= "'$contact_setting_name', ";
$sql .= "'$contact_setting_value', ";
$sql .= "$contact_setting_order, ";
$sql .= "'$contact_setting_enabled', ";
$sql .= "'$contact_setting_description' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "add")
//update the domain
if ($action == "update") {
$sql = "update v_contact_settings set ";
$sql .= "contact_setting_category = '$contact_setting_category', ";
$sql .= "contact_setting_subcategory = '$contact_setting_subcategory', ";
$sql .= "contact_setting_name = '$contact_setting_name', ";
$sql .= "contact_setting_value = '$contact_setting_value', ";
$sql .= "contact_setting_order = $contact_setting_order, ";
$sql .= "contact_setting_enabled = '$contact_setting_enabled', ";
$sql .= "contact_setting_description = '$contact_setting_description' ";
$sql .= "where contact_uuid = '$contact_uuid' ";
$sql .= "and contact_setting_uuid = '$contact_setting_uuid'";
$db->exec(check_sql($sql));
unset($sql);
} //if ($action == "update")
//redirect the browser
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -47,9 +47,10 @@ else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["contact_uuid"]) > 0) { //get the contact uuid
$contact_uuid = check_str($_GET["contact_uuid"]); if (strlen($_GET["contact_uuid"]) > 0) {
} $contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST)>0) { if (count($_POST)>0) {
@ -58,81 +59,91 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$time_description = check_str($_POST["time_description"]); $time_description = check_str($_POST["time_description"]);
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_time_uuid = check_str($_POST["contact_time_uuid"]); $contact_time_uuid = check_str($_POST["contact_time_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//update last modified
$sql = "update v_contacts set ";
$sql .= "last_mod_date = now(), ";
$sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") { if ($action == "add") {
$contact_time_uuid = uuid(); $contact_time_uuid = uuid();
$sql = "insert into v_contact_times "; $sql = "insert into v_contact_times ";
$sql .= "( "; $sql .= "( ";
$sql .= "domain_uuid, "; $sql .= "domain_uuid, ";
$sql .= "contact_time_uuid, "; $sql .= "contact_time_uuid, ";
$sql .= "contact_uuid, "; $sql .= "contact_uuid, ";
$sql .= "user_uuid, "; $sql .= "user_uuid, ";
$sql .= "time_start, "; $sql .= "time_start, ";
$sql .= "time_stop, "; $sql .= "time_stop, ";
$sql .= "time_description "; $sql .= "time_description ";
$sql .= ") "; $sql .= ") ";
$sql .= "values "; $sql .= "values ";
$sql .= "( "; $sql .= "( ";
$sql .= "'".$domain_uuid."', "; $sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_time_uuid."', "; $sql .= "'".$contact_time_uuid."', ";
$sql .= "'".$contact_uuid."', "; $sql .= "'".$contact_uuid."', ";
$sql .= "'".$_SESSION["user"]["user_uuid"]."', "; $sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
$sql .= "'".$time_start."', "; $sql .= "'".$time_start."', ";
$sql .= "'".$time_stop."', "; $sql .= "'".$time_stop."', ";
$sql .= "'".$time_description."' "; $sql .= "'".$time_description."' ";
$sql .= ")"; $sql .= ")";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
$_SESSION["message"] = $text['message-add']; $_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid); header("Location: contact_edit.php?id=".$contact_uuid);
return; return;
} //if ($action == "add") } //if ($action == "add")
if ($action == "update") { if ($action == "update") {
$sql = "update v_contact_times "; $sql = "update v_contact_times ";
$sql .= "set "; $sql .= "set ";
$sql .= "time_start = '".$time_start."', "; $sql .= "time_start = '".$time_start."', ";
$sql .= "time_stop = '".$time_stop."', "; $sql .= "time_stop = '".$time_stop."', ";
$sql .= "time_description = '".$time_description."' "; $sql .= "time_description = '".$time_description."' ";
$sql .= "where "; $sql .= "where ";
$sql .= "contact_time_uuid = '".$contact_time_uuid."' "; $sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' "; $sql .= "and domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' "; $sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
$db->exec(check_sql($sql)); $db->exec(check_sql($sql));
unset($sql); unset($sql);
$_SESSION["message"] = $text['message-update']; $_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid); header("Location: contact_edit.php?id=".$contact_uuid);
return; return;
} //if ($action == "update") } //if ($action == "update")
} //if ($_POST["persistformvar"] != "true") } //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,12 +48,13 @@ else {
$action = "add"; $action = "add";
} }
if (strlen($_GET["contact_uuid"]) > 0) { //get the contact uuid
$contact_uuid = check_str($_GET["contact_uuid"]); if (strlen($_GET["contact_uuid"]) > 0) {
} $contact_uuid = check_str($_GET["contact_uuid"]);
}
//get http post variables and set them to php variables //get http post variables and set them to php variables
if (count($_POST)>0) { if (count($_POST) > 0) {
$url_label = check_str($_POST["url_label"]); $url_label = check_str($_POST["url_label"]);
$url_label_custom = check_str($_POST["url_label_custom"]); $url_label_custom = check_str($_POST["url_label_custom"]);
$url_address = check_str($_POST["url_address"]); $url_address = check_str($_POST["url_address"]);
@ -64,87 +65,98 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$url_label = ($url_label_custom != '') ? $url_label_custom : $url_label; $url_label = ($url_label_custom != '') ? $url_label_custom : $url_label;
} }
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //process the form data
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = ''; //set the uuid
if ($action == "update") { if ($action == "update") {
$contact_url_uuid = check_str($_POST["contact_url_uuid"]); $contact_url_uuid = check_str($_POST["contact_url_uuid"]);
} }
//check for all required data //check for all required data
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { $msg = '';
require_once "resources/header.php"; if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/persist_form_var.php"; require_once "resources/header.php";
echo "<div align='center'>\n"; require_once "resources/persist_form_var.php";
echo "<table><tr><td>\n"; echo "<div align='center'>\n";
echo $msg."<br />"; echo "<table><tr><td>\n";
echo "</td></tr></table>\n"; echo $msg."<br />";
persistformvar($_POST); echo "</td></tr></table>\n";
echo "</div>\n"; persistformvar($_POST);
require_once "resources/footer.php"; echo "</div>\n";
return; require_once "resources/footer.php";
} return;
}
//add or update the database //add or update the database
if ($_POST["persistformvar"] != "true") { if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers //update last modified
if ($url_primary) { $sql = "update v_contacts set ";
$sql = "update v_contact_urls set url_primary = 0 "; $sql .= "last_mod_date = now(), ";
$sql .= "where domain_uuid = '".$domain_uuid."' "; $sql .= "last_mod_user = '".$_SESSION['username']."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' "; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$db->exec(check_sql($sql)); $sql .= "and contact_uuid = '".$contact_uuid."' ";
unset($sql); $db->exec(check_sql($sql));
} unset($sql);
if ($action == "add") { //if primary, unmark other primary numbers
$contact_url_uuid = uuid(); if ($url_primary) {
$sql = "insert into v_contact_urls "; $sql = "update v_contact_urls set url_primary = 0 ";
$sql .= "("; $sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "domain_uuid, "; $sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "contact_uuid, "; $db->exec(check_sql($sql));
$sql .= "contact_url_uuid, "; unset($sql);
$sql .= "url_label, "; }
$sql .= "url_address, ";
$sql .= "url_primary, ";
$sql .= "url_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_url_uuid."', ";
$sql .= "'".$url_label."', ";
$sql .= "'".$url_address."', ";
$sql .= (($url_primary) ? 1 : 0).", ";
$sql .= "'".$url_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add']; if ($action == "add") {
header("Location: contact_edit.php?id=".$contact_uuid); $contact_url_uuid = uuid();
return; $sql = "insert into v_contact_urls ";
} //if ($action == "add") $sql .= "(";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "contact_url_uuid, ";
$sql .= "url_label, ";
$sql .= "url_address, ";
$sql .= "url_primary, ";
$sql .= "url_description ";
$sql .= ")";
$sql .= "values ";
$sql .= "(";
$sql .= "'".$_SESSION['domain_uuid']."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$contact_url_uuid."', ";
$sql .= "'".$url_label."', ";
$sql .= "'".$url_address."', ";
$sql .= (($url_primary) ? 1 : 0).", ";
$sql .= "'".$url_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") { $_SESSION["message"] = $text['message-add'];
$sql = "update v_contact_urls set "; header("Location: contact_edit.php?id=".$contact_uuid);
$sql .= "contact_uuid = '".$contact_uuid."', "; return;
$sql .= "url_label = '".$url_label."', "; } //if ($action == "add")
$sql .= "url_address = '".$url_address."', ";
$sql .= "url_primary = ".(($url_primary) ? 1 : 0).", ";
$sql .= "url_description = '".$url_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_url_uuid = '".$contact_url_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update']; if ($action == "update") {
header("Location: contact_edit.php?id=".$contact_uuid); $sql = "update v_contact_urls set ";
return; $sql .= "contact_uuid = '".$contact_uuid."', ";
} //if ($action == "update") $sql .= "url_label = '".$url_label."', ";
} //if ($_POST["persistformvar"] != "true") $sql .= "url_address = '".$url_address."', ";
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) $sql .= "url_primary = ".(($url_primary) ? 1 : 0).", ";
$sql .= "url_description = '".$url_description."' ";
$sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' ";
$sql .= "and contact_url_uuid = '".$contact_url_uuid."'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-update'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "update")
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form //pre-populate the form
if (count($_GET)>0 && $_POST["persistformvar"] != "true") { if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2013 Portions created by the Initial Developer are Copyright (C) 2008-2015
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@ -55,7 +55,8 @@ else {
foreach ($_SESSION['groups'] as $group_data) { foreach ($_SESSION['groups'] as $group_data) {
$user_group_uuids[] = $group_data['group_uuid']; $user_group_uuids[] = $group_data['group_uuid'];
} }
//add user's uuid to group uuid list to include private (non-shared) contacts
//add user's uuid to group uuid list to include private (non-shared) contacts
$user_group_uuids[] = $_SESSION["user_uuid"]; $user_group_uuids[] = $_SESSION["user_uuid"];
//get contact sync sources //get contact sync sources
@ -177,7 +178,7 @@ else {
$sql .= "order by ".$order_by." ".$order." "; $sql .= "order by ".$order_by." ".$order." ";
} }
else { else {
$sql .= "order by contact_organization desc, contact_name_given asc, contact_name_family asc "; $sql .= "order by last_mod_date desc ";
} }
$sql .= "limit ".$rows_per_page." offset ".$offset." "; $sql .= "limit ".$rows_per_page." offset ".$offset." ";
$prep_statement = $db->prepare(check_sql($sql)); $prep_statement = $db->prepare(check_sql($sql));