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";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get the 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
if (count($_POST)>0) {
@ -73,114 +74,125 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$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 = '';
if ($action == "update") {
$contact_address_uuid = check_str($_POST["contact_address_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_address_uuid = check_str($_POST["contact_address_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;
}
//check for all required data
$msg = '';
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") {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers
if ($address_primary) {
$sql = "update v_contact_addresses set address_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
//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") {
$contact_address_uuid = uuid();
$sql = "insert into v_contact_addresses ";
$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 primary, unmark other primary numbers
if ($address_primary) {
$sql = "update v_contact_addresses set address_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$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 == "add") {
$contact_address_uuid = uuid();
$sql = "insert into v_contact_addresses ";
$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") {
$sql = "update v_contact_addresses set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "address_type = '".$address_type."', ";
$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-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
$_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)
if ($action == "update") {
$sql = "update v_contact_addresses set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "address_type = '".$address_type."', ";
$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'];
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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -79,171 +79,182 @@ else {
$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 = '';
if ($action == "update") {
$contact_uuid = check_str($_POST["contact_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_uuid = check_str($_POST["contact_uuid"]);
}
//check for all required data
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; }
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; }
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; }
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; }
//if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; }
//if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; }
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; }
//if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<br>\n"; }
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;
}
//check for all required data
$msg = '';
//if (strlen($contact_type) == 0) { $msg .= $text['message-required'].$text['label-contact_type']."<br>\n"; }
//if (strlen($contact_organization) == 0) { $msg .= $text['message-required'].$text['label-contact_organization']."<br>\n"; }
//if (strlen($contact_name_prefix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_prefix']."<br>\n"; }
//if (strlen($contact_name_given) == 0) { $msg .= $text['message-required'].$text['label-contact_name_given']."<br>\n"; }
//if (strlen($contact_name_middle) == 0) { $msg .= $text['message-required'].$text['label-contact_name_middle']."<br>\n"; }
//if (strlen($contact_name_family) == 0) { $msg .= $text['message-required'].$text['label-contact_name_family']."<br>\n"; }
//if (strlen($contact_name_suffix) == 0) { $msg .= $text['message-required'].$text['label-contact_name_suffix']."<br>\n"; }
//if (strlen($contact_nickname) == 0) { $msg .= $text['message-required'].$text['label-contact_nickname']."<br>\n"; }
//if (strlen($contact_title) == 0) { $msg .= $text['message-required'].$text['label-contact_title']."<br>\n"; }
//if (strlen($contact_role) == 0) { $msg .= $text['message-required'].$text['label-contact_role']."<br>\n"; }
//if (strlen($contact_time_zone) == 0) { $msg .= $text['message-required'].$text['label-contact_time_zone']."<br>\n"; }
//if (strlen($contact_note) == 0) { $msg .= $text['message-required'].$text['label-contact_note']."<br>\n"; }
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") {
//add or update the database
if ($_POST["persistformvar"] != "true") {
if ($action == "add") {
$contact_uuid = uuid();
$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);
//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);
$_SESSION["message"] = $text['message-add'];
$location = "contact_edit.php?id=".$contact_uuid;
} //if ($action == "add")
if ($action == "add") {
$contact_uuid = uuid();
$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
if ($_POST['contact_shared'] == 'true') {
$sql = "delete from v_contact_groups ";
$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"];
}
$_SESSION["message"] = $text['message-add'];
$location = "contact_edit.php?id=".$contact_uuid;
} //if ($action == "add")
//handle insertion of contact group (or private contact, if not shared)
if ($group_uuid != '') {
$sql = "insert into v_contact_groups ";
$sql .= "( ";
$sql .= "contact_group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "group_uuid ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".uuid()."', ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$group_uuid."' ";
$sql .= ") ";
$db->exec(check_sql($sql));
unset($sql);
}
//if contact is shared, remove contact group record containing user's uuid
if ($_POST['contact_shared'] == 'true') {
$sql = "delete from v_contact_groups ";
$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"];
}
if ($action == "update") {
$sql = "update v_contacts set ";
$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 insertion of contact group (or private contact, if not shared)
if ($group_uuid != '') {
$sql = "insert into v_contact_groups ";
$sql .= "( ";
$sql .= "contact_group_uuid, ";
$sql .= "domain_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "group_uuid ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".uuid()."', ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$group_uuid."' ";
$sql .= ") ";
$db->exec(check_sql($sql));
unset($sql);
}
$_SESSION["message"] = $text['message-update'];
$location = "contact_edit.php?id=".$contact_uuid;
} //if ($action == "update")
if ($action == "update") {
$sql = "update v_contacts set ";
$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
if ($_POST['submit'] == $text['button-add']) {
$group_uuid = $_POST['group_uuid'];
//insert
$location = "contact_edit.php?id=".$contact_uuid;
}
$_SESSION["message"] = $text['message-update'];
$location = "contact_edit.php?id=".$contact_uuid;
} //if ($action == "update")
header("Location: ".$location);
return;
//handle redirect
if ($_POST['submit'] == $text['button-add']) {
$group_uuid = $_POST['group_uuid'];
//insert
$location = "contact_edit.php?id=".$contact_uuid;
}
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
header("Location: ".$location);
return;
} //if ($_POST["persistformvar"] != "true")
} //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
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;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_email_uuid = check_str($_POST["contact_email_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_email_uuid = check_str($_POST["contact_email_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;
}
//check for all required data
$msg = '';
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") {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers
if ($email_primary) {
$sql = "update v_contact_emails set email_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
//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") {
$contact_email_uuid = uuid();
$sql = "insert into v_contact_emails ";
$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 primary, unmark other primary numbers
if ($email_primary) {
$sql = "update v_contact_emails set email_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$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 == "add") {
$contact_email_uuid = uuid();
$sql = "insert into v_contact_emails ";
$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") {
$sql = "update v_contact_emails set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "email_label = '".$email_label."', ";
$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-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
$_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)
if ($action == "update") {
$sql = "update v_contact_emails set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "email_label = '".$email_label."', ";
$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'];
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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -59,75 +59,87 @@ else {
$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
$msg = '';
if ($action == "update") {
$contact_note_uuid = check_str($_POST["contact_note_uuid"]);
}
//get the primary id for the contact note
if ($action == "update") {
$contact_note_uuid = check_str($_POST["contact_note_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;
}
//check for all required data
$msg = '';
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_note_uuid = uuid();
$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);
//add or update the database
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);
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
//add the note
if ($action == "add") {
$contact_note_uuid = uuid();
$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") {
$sql = "update v_contact_notes set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$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_note_uuid = '$contact_note_uuid'";
$db->exec(check_sql($sql));
unset($sql);
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
$_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)
//update the note
if ($action == "update") {
$sql = "update v_contact_notes set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$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_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
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;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_phone_uuid = check_str($_POST["contact_phone_uuid"]);
}
//set thge uuid
if ($action == "update") {
$contact_phone_uuid = check_str($_POST["contact_phone_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;
}
//check for all required data
$msg = '';
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") {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers
if ($phone_primary) {
$sql = "update v_contact_phones set phone_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
//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") {
$contact_phone_uuid = uuid();
$sql = "insert into v_contact_phones ";
$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 primary, unmark other primary numbers
if ($phone_primary) {
$sql = "update v_contact_phones set phone_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$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 == "add") {
$contact_phone_uuid = uuid();
$sql = "insert into v_contact_phones ";
$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") {
$sql = "update v_contact_phones set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", ";
$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-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
$_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)
if ($action == "update") {
$sql = "update v_contact_phones set ";
$sql .= "contact_uuid = '$contact_uuid', ";
$sql .= "phone_type_voice = ".(($phone_type_voice) ? 1 : 'null').", ";
$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'];
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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,9 +48,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get the 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
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;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$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);
//set the uuid
if ($action == "update") {
$contact_relation_uuid = check_str($_POST["contact_relation_uuid"]);
}
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
//check for all required data
$msg = '';
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;
}
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);
//add or update the database
if ($_POST["persistformvar"] != "true") {
$_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)
//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") {
$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
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {

View File

@ -48,10 +48,13 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
$domain_uuid = $_SESSION['domain_uuid'];
//get the contact uuid
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//set the session domain uuid as a variable
$domain_uuid = $_SESSION['domain_uuid'];
//get http post variables and set them to php variables
if (count($_POST) > 0) {
@ -64,97 +67,110 @@ $domain_uuid = $_SESSION['domain_uuid'];
$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 = '';
if ($action == "update") {
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_setting_uuid = check_str($_POST["contact_setting_uuid"]);
}
//check for all required data
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
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") {
$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);
//check for all required data
$msg = '';
//if (strlen($domain_setting_category) == 0) { $msg .= $text['message-required'].$text['label-category']."<br>\n"; }
//if (strlen($domain_setting_subcategory) == 0) { $msg .= $text['message-required'].$text['label-subcategory']."<br>\n"; }
//if (strlen($domain_setting_name) == 0) { $msg .= $text['message-required'].$text['label-type']."<br>\n"; }
//if (strlen($domain_setting_value) == 0) { $msg .= $text['message-required'].$text['label-value']."<br>\n"; }
//if (strlen($domain_setting_order) == 0) { $msg .= $text['message-required'].$text['label-order']."<br>\n"; }
//if (strlen($domain_setting_enabled) == 0) { $msg .= $text['message-required'].$text['label-enabled']."<br>\n"; }
//if (strlen($domain_setting_description) == 0) { $msg .= $text['message-required'].$text['label-description']."<br>\n"; }
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;
} //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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -47,9 +47,10 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get the 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
if (count($_POST)>0) {
@ -58,81 +59,91 @@ if (strlen($_GET["contact_uuid"]) > 0) {
$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 = '';
if ($action == "update") {
$contact_time_uuid = check_str($_POST["contact_time_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_time_uuid = check_str($_POST["contact_time_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;
}
//check for all required data
$msg = '';
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") {
//add or update the database
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") {
$contact_time_uuid = uuid();
$sql = "insert into v_contact_times ";
$sql .= "( ";
$sql .= "domain_uuid, ";
$sql .= "contact_time_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid, ";
$sql .= "time_start, ";
$sql .= "time_stop, ";
$sql .= "time_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_time_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
$sql .= "'".$time_start."', ";
$sql .= "'".$time_stop."', ";
$sql .= "'".$time_description."' ";
$sql .= ")";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "add") {
$contact_time_uuid = uuid();
$sql = "insert into v_contact_times ";
$sql .= "( ";
$sql .= "domain_uuid, ";
$sql .= "contact_time_uuid, ";
$sql .= "contact_uuid, ";
$sql .= "user_uuid, ";
$sql .= "time_start, ";
$sql .= "time_stop, ";
$sql .= "time_description ";
$sql .= ") ";
$sql .= "values ";
$sql .= "( ";
$sql .= "'".$domain_uuid."', ";
$sql .= "'".$contact_time_uuid."', ";
$sql .= "'".$contact_uuid."', ";
$sql .= "'".$_SESSION["user"]["user_uuid"]."', ";
$sql .= "'".$time_start."', ";
$sql .= "'".$time_stop."', ";
$sql .= "'".$time_description."' ";
$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")
$_SESSION["message"] = $text['message-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
if ($action == "update") {
$sql = "update v_contact_times ";
$sql .= "set ";
$sql .= "time_start = '".$time_start."', ";
$sql .= "time_stop = '".$time_stop."', ";
$sql .= "time_description = '".$time_description."' ";
$sql .= "where ";
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION["user"]["user_uuid"]."' ";
$db->exec(check_sql($sql));
unset($sql);
if ($action == "update") {
$sql = "update v_contact_times ";
$sql .= "set ";
$sql .= "time_start = '".$time_start."', ";
$sql .= "time_stop = '".$time_stop."', ";
$sql .= "time_description = '".$time_description."' ";
$sql .= "where ";
$sql .= "contact_time_uuid = '".$contact_time_uuid."' ";
$sql .= "and domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$sql .= "and user_uuid = '".$_SESSION["user"]["user_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)
$_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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -48,12 +48,13 @@ else {
$action = "add";
}
if (strlen($_GET["contact_uuid"]) > 0) {
$contact_uuid = check_str($_GET["contact_uuid"]);
}
//get the 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
if (count($_POST)>0) {
if (count($_POST) > 0) {
$url_label = check_str($_POST["url_label"]);
$url_label_custom = check_str($_POST["url_label_custom"]);
$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;
}
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
//process the form data
if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) {
$msg = '';
if ($action == "update") {
$contact_url_uuid = check_str($_POST["contact_url_uuid"]);
}
//set the uuid
if ($action == "update") {
$contact_url_uuid = check_str($_POST["contact_url_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;
}
//check for all required data
$msg = '';
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") {
//add or update the database
if ($_POST["persistformvar"] != "true") {
//if primary, unmark other primary numbers
if ($url_primary) {
$sql = "update v_contact_urls set url_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$db->exec(check_sql($sql));
unset($sql);
}
//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") {
$contact_url_uuid = uuid();
$sql = "insert into v_contact_urls ";
$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 primary, unmark other primary numbers
if ($url_primary) {
$sql = "update v_contact_urls set url_primary = 0 ";
$sql .= "where domain_uuid = '".$domain_uuid."' ";
$sql .= "and contact_uuid = '".$contact_uuid."' ";
$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 == "add") {
$contact_url_uuid = uuid();
$sql = "insert into v_contact_urls ";
$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") {
$sql = "update v_contact_urls set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "url_label = '".$url_label."', ";
$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-add'];
header("Location: contact_edit.php?id=".$contact_uuid);
return;
} //if ($action == "add")
$_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)
if ($action == "update") {
$sql = "update v_contact_urls set ";
$sql .= "contact_uuid = '".$contact_uuid."', ";
$sql .= "url_label = '".$url_label."', ";
$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'];
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
if (count($_GET)>0 && $_POST["persistformvar"] != "true") {

View File

@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
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.
Contributor(s):
@ -55,7 +55,8 @@ else {
foreach ($_SESSION['groups'] as $group_data) {
$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"];
//get contact sync sources
@ -177,7 +178,7 @@ else {
$sql .= "order by ".$order_by." ".$order." ";
}
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." ";
$prep_statement = $db->prepare(check_sql($sql));