diff --git a/portal/contact_edit.php b/portal/contact_edit.php
new file mode 100644
index 00000000..777337f7
--- /dev/null
+++ b/portal/contact_edit.php
@@ -0,0 +1,124 @@
+
+
+
+ -
+ Home
+
+ -
+ Contacts
+
+ - Edit Contact
+
+
+
+
+
+
- |
+ |
|
|
diff --git a/portal/document.php b/portal/document.php
index d007e9de..16b39ac0 100644
--- a/portal/document.php
+++ b/portal/document.php
@@ -27,16 +27,31 @@ if (!isset($_GET['id']) && !intval($_GET['id'])) {
}
$document_id = intval($_GET['id']);
-$sql_document = mysqli_query($mysqli, "SELECT document_id, document_name, document_content FROM documents WHERE document_id = $document_id AND document_client_id = $session_client_id AND document_template = 0 LIMIT 1");
+$sql_document = mysqli_query($mysqli, "SELECT document_id, document_name, document_content FROM documents WHERE document_id = $document_id AND document_client_id = $session_client_id AND document_template = 0 AND document_archived_at IS NULL LIMIT 1");
$row = mysqli_fetch_array($sql_document);
-$document_id = intval($row['document_id']);
-$document_name = nullable_htmlentities($row['document_name']);
-$document_content = $purifier->purify($row['document_content']);
+if ($row) {
+ $document_id = intval($row['document_id']);
+ $document_name = nullable_htmlentities($row['document_name']);
+ $document_content = $purifier->purify($row['document_content']);
+} else {
+ header("Location: portal_post.php?logout");
+ exit();
+}
?>
+
+ -
+ Home
+
+ -
+ Documents
+
+ - Document
+
+
diff --git a/portal/portal_header.php b/portal/portal_header.php
index 524e2108..b141dc4a 100644
--- a/portal/portal_header.php
+++ b/portal/portal_header.php
@@ -112,3 +112,22 @@ header("X-Frame-Options: DENY"); // Legacy
+
+
+
+
+
+
+
diff --git a/portal/portal_post.php b/portal/portal_post.php
index 2fb50ae0..eff15096 100644
--- a/portal/portal_post.php
+++ b/portal/portal_post.php
@@ -287,3 +287,21 @@ if (isset($_POST['edit_profile'])) {
}
header('Location: index.php');
}
+
+if (isset($_POST['edit_contact'])) {
+ $contact_id = intval($_POST['contact_id']);
+ $contact_name = sanitizeInput($_POST['contact_name']);
+ $contact_email = sanitizeInput($_POST['contact_email']);
+ $contact_technical = intval($_POST['contact_technical']);
+ $contact_billing = intval($_POST['contact_billing']);
+ $contact_auth_method = sanitizeInput($_POST['contact_auth_method']);
+
+ mysqli_query($mysqli, "UPDATE contacts SET contact_name = '$contact_name', contact_email = '$contact_email', contact_billing = $contact_billing, contact_technical = $contact_technical, contact_auth_method = '$contact_auth_method' WHERE contact_id = $contact_id AND contact_client_id = $session_client_id AND contact_archived_at IS NULL AND contact_primary = 0");
+
+ // Logging
+ mysqli_query($mysqli, "INSERT INTO logs SET log_type = 'Contact', log_action = 'Modify', log_description = 'Client $session_contact_name modified contact $contact_name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_client_id = $session_client_id, log_entity_id = $contact_id");
+
+ $_SESSION['alert_message'] = "Contact updated";
+ header('Location: contacts.php');
+
+}
diff --git a/portal/ticket_add.php b/portal/ticket_add.php
index b2022df4..8993a6a3 100644
--- a/portal/ticket_add.php
+++ b/portal/ticket_add.php
@@ -18,7 +18,7 @@ require_once 'inc_portal.php';
New Ticket
- Raise a new ticket
+ Raise a new ticket