diff --git a/admin_custom_link_add_modal.php b/admin_custom_link_add_modal.php new file mode 100644 index 00000000..5a662587 --- /dev/null +++ b/admin_custom_link_add_modal.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/admin_custom_link_edit_modal.php b/admin_custom_link_edit_modal.php new file mode 100644 index 00000000..472cbe60 --- /dev/null +++ b/admin_custom_link_edit_modal.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/admin_custom_links.php b/admin_custom_links.php new file mode 100644 index 00000000..e5daf063 --- /dev/null +++ b/admin_custom_links.php @@ -0,0 +1,115 @@ + + +
+
+

Custom Links

+
+ +
+
+ +
+
+
+
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+ + "> + + + + + + + + + + + + + + + + + +
NameURIAction
+ + + + + + +
+
+ +
+
+ + - + diff --git a/post/admin.php b/post/admin.php index 1661533f..afd759ff 100644 --- a/post/admin.php +++ b/post/admin.php @@ -293,3 +293,53 @@ if (isset($_GET['delete_ticket_status'])) { header("Location: " . $_SERVER["HTTP_REFERER"]); } + +if (isset($_POST['add_custom_link'])) { + + $name = sanitizeInput($_POST['name']); + $uri = sanitizeInput($_POST['uri']); + $icon = preg_replace("/[^0-9a-zA-Z-]/", "", sanitizeInput($_POST['icon'])); + + mysqli_query($mysqli,"INSERT INTO custom_links SET custom_link_name = '$name', custom_link_uri = '$uri', custom_link_icon = '$icon'"); + + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Create', log_description = '$session_name created custom link $name --> $uri', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + + $_SESSION['alert_message'] = "Custom link successfully created!"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + +if (isset($_POST['edit_custom_link'])) { + + $custom_link_id = intval($_POST['custom_link_id']); + $name = sanitizeInput($_POST['name']); + $uri = sanitizeInput($_POST['uri']); + $icon = preg_replace("/[^0-9a-zA-Z-]/", "", sanitizeInput($_POST['icon'])); + + mysqli_query($mysqli,"UPDATE custom_links SET custom_link_name = '$name', custom_link_uri = '$uri', custom_link_icon = '$icon' WHERE custom_link_id = $custom_link_id"); + + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Custom Link', log_action = 'Modify', log_description = '$session_name edited the custom link $name', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + + $_SESSION['alert_message'] = "Custom Link modified"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} + +if (isset($_GET['delete_custom_link'])) { + $custom_link_id = intval($_GET['delete_custom_link']); + + mysqli_query($mysqli,"DELETE FROM custom_links WHERE custom_link_id = $custom_link_id"); + + //Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Tag', log_action = '$session_name Deleted custom link', log_description = '$tag_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_user_id = $session_user_id"); + + $_SESSION['alert_message'] = "Cusatom Link deleted!"; + $_SESSION['alert_type'] = "error"; + + header("Location: " . $_SERVER["HTTP_REFERER"]); + +} \ No newline at end of file diff --git a/side_nav.php b/side_nav.php index 684c5644..def27aa4 100644 --- a/side_nav.php +++ b/side_nav.php @@ -182,6 +182,29 @@ + + + + + + +