From d2dac1915d8bdbfb7c03822a9ffc11a1cc66faaa Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 1 Aug 2025 15:25:52 -0400 Subject: [PATCH] Update admin, user, guest and client post to use new redirect function --- admin/post/ai_model.php | 6 +- admin/post/ai_provider.php | 6 +- admin/post/api_keys.php | 6 +- admin/post/backup.php | 2 +- admin/post/category.php | 10 +-- admin/post/custom_field.php | 6 +- admin/post/custom_link.php | 6 +- admin/post/document_template.php | 6 +- admin/post/identity_provider.php | 2 +- admin/post/mail_queue.php | 8 +- admin/post/payment_method.php | 6 +- admin/post/payment_provider.php | 6 +- admin/post/project_template.php | 12 +-- admin/post/roles.php | 8 +- admin/post/saved_payment_method.php | 2 +- admin/post/settings_ai.php | 2 +- admin/post/settings_company.php | 4 +- admin/post/settings_default.php | 2 +- admin/post/settings_invoice.php | 2 +- admin/post/settings_localization.php | 2 +- admin/post/settings_mail.php | 10 +-- admin/post/settings_module.php | 2 +- admin/post/settings_notification.php | 2 +- admin/post/settings_online_payment.php | 2 +- .../post/settings_online_payment_clients.php | 6 +- admin/post/settings_project.php | 2 +- admin/post/settings_quote.php | 2 +- admin/post/settings_security.php | 2 +- admin/post/settings_telemetry.php | 2 +- admin/post/settings_theme.php | 4 +- admin/post/settings_ticket.php | 2 +- admin/post/software_template.php | 6 +- admin/post/tag.php | 6 +- admin/post/tax.php | 8 +- admin/post/ticket_status.php | 6 +- admin/post/ticket_template.php | 10 +-- admin/post/update.php | 4 +- admin/post/users.php | 14 +-- admin/post/vendor_template.php | 6 +- client/post.php | 8 +- guest/guest_post.php | 12 +-- post/misc.php | 8 +- user/post/account.php | 8 +- user/post/asset.php | 68 +++++++-------- user/post/budget.php | 4 +- user/post/category.php | 2 +- user/post/certificate.php | 12 +-- user/post/client.php | 26 +++--- user/post/contact.php | 64 +++++++------- user/post/credential.php | 24 +++--- user/post/credit.php | 2 +- user/post/document.php | 40 ++++----- user/post/domain.php | 16 ++-- user/post/event.php | 10 +-- user/post/expense.php | 20 ++--- user/post/file.php | 18 ++-- user/post/folder.php | 6 +- user/post/invoice.php | 64 +++++++------- user/post/location.php | 24 +++--- user/post/network.php | 12 +-- user/post/product.php | 18 ++-- user/post/profile.php | 12 +-- user/post/project.php | 18 ++-- user/post/quote.php | 20 ++--- user/post/rack.php | 20 ++--- user/post/revenue.php | 6 +- user/post/service.php | 6 +- user/post/software.php | 10 +-- user/post/tag.php | 2 +- user/post/task.php | 16 ++-- user/post/ticket.php | 86 +++++++++---------- user/post/transfer.php | 6 +- user/post/trip.php | 6 +- user/post/vendor.php | 18 ++-- user/post/vendor_contact.php | 22 ++--- 75 files changed, 457 insertions(+), 457 deletions(-) diff --git a/admin/post/ai_model.php b/admin/post/ai_model.php index e2237a0b..1057023b 100644 --- a/admin/post/ai_model.php +++ b/admin/post/ai_model.php @@ -24,7 +24,7 @@ if (isset($_POST['add_ai_model'])) { $_SESSION['alert_message'] = "AI Model $model created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -44,7 +44,7 @@ if (isset($_POST['edit_ai_model'])) { $_SESSION['alert_message'] = "AI Model $model edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -66,6 +66,6 @@ if (isset($_GET['delete_ai_model'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "AI Model $model_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/ai_provider.php b/admin/post/ai_provider.php index b10d730a..252209c0 100644 --- a/admin/post/ai_provider.php +++ b/admin/post/ai_provider.php @@ -25,7 +25,7 @@ if (isset($_POST['add_ai_provider'])) { $_SESSION['alert_message'] = "AI Model $provider created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -45,7 +45,7 @@ if (isset($_POST['edit_ai_provider'])) { $_SESSION['alert_message'] = "AI Model $provider edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -67,6 +67,6 @@ if (isset($_GET['delete_ai_provider'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "AI Provider $provider_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/api_keys.php b/admin/post/api_keys.php index 073f2afd..9e15ff61 100644 --- a/admin/post/api_keys.php +++ b/admin/post/api_keys.php @@ -28,7 +28,7 @@ if (isset($_POST['add_api_key'])) { $_SESSION['alert_message'] = "API Key $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -51,7 +51,7 @@ if (isset($_GET['delete_api_key'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "API Key $name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -88,5 +88,5 @@ if (isset($_POST['bulk_delete_api_keys'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/backup.php b/admin/post/backup.php index 70f26f5c..e2315ec1 100644 --- a/admin/post/backup.php +++ b/admin/post/backup.php @@ -210,7 +210,7 @@ if (isset($_POST['backup_master_key'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Incorrect password."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } diff --git a/admin/post/category.php b/admin/post/category.php index 87d80868..4a99de16 100644 --- a/admin/post/category.php +++ b/admin/post/category.php @@ -19,7 +19,7 @@ if (isset($_POST['add_category'])) { $_SESSION['alert_message'] = "Category $type $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -36,7 +36,7 @@ if (isset($_POST['edit_category'])) { $_SESSION['alert_message'] = "Category $type $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -58,7 +58,7 @@ if (isset($_GET['archive_category'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Category $category_type $category_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -79,7 +79,7 @@ if (isset($_GET['unarchive_category'])) { $_SESSION['alert_message'] = "Category $category_type $category_name unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -101,6 +101,6 @@ if (isset($_GET['delete_category'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Category $category_type $category_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/custom_field.php b/admin/post/custom_field.php index c4b843ed..22d77d33 100644 --- a/admin/post/custom_field.php +++ b/admin/post/custom_field.php @@ -21,7 +21,7 @@ if(isset($_POST['create_custom_field'])){ $_SESSION['alert_message'] = "Custom field $label created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -38,7 +38,7 @@ if(isset($_POST['edit_custom_field'])){ $_SESSION['alert_message'] = "Custom field $label edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -58,6 +58,6 @@ if(isset($_GET['delete_custom_field'])){ $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Custom field $label deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/custom_link.php b/admin/post/custom_link.php index 144b509c..146c5bd5 100644 --- a/admin/post/custom_link.php +++ b/admin/post/custom_link.php @@ -24,7 +24,7 @@ if (isset($_POST['add_custom_link'])) { $_SESSION['alert_message'] = "Custom link $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -45,7 +45,7 @@ if (isset($_POST['edit_custom_link'])) { $_SESSION['alert_message'] = "Custom Link $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -66,6 +66,6 @@ if (isset($_GET['delete_custom_link'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Custom Link $name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/document_template.php b/admin/post/document_template.php index 71e69e4b..a1432dd8 100644 --- a/admin/post/document_template.php +++ b/admin/post/document_template.php @@ -20,7 +20,7 @@ if (isset($_POST['add_document_template'])) { $_SESSION['alert_message'] = "Document template $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -39,7 +39,7 @@ if (isset($_POST['edit_document_template'])) { $_SESSION['alert_message'] = "Document Template $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -60,6 +60,6 @@ if (isset($_GET['delete_document_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Document Template $document_template_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/identity_provider.php b/admin/post/identity_provider.php index 331754a4..09ce4c4e 100644 --- a/admin/post/identity_provider.php +++ b/admin/post/identity_provider.php @@ -16,6 +16,6 @@ if (isset($_POST['edit_identity_provider'])) { $_SESSION['alert_message'] = "Identity Provider Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/mail_queue.php b/admin/post/mail_queue.php index 81eaecf7..cfa9ceba 100644 --- a/admin/post/mail_queue.php +++ b/admin/post/mail_queue.php @@ -13,7 +13,7 @@ if (isset($_GET['send_failed_mail'])) { $_SESSION['alert_message'] = "Email Force Sent, give it a minute to resend"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -29,7 +29,7 @@ if (isset($_GET['cancel_mail'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Email cancelled and marked as failed."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -59,7 +59,7 @@ if (isset($_POST['bulk_cancel_emails'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_emails'])) { @@ -89,5 +89,5 @@ if (isset($_POST['bulk_delete_emails'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/payment_method.php b/admin/post/payment_method.php index a70fb948..5fbf0b35 100644 --- a/admin/post/payment_method.php +++ b/admin/post/payment_method.php @@ -20,7 +20,7 @@ if (isset($_POST['add_payment_method'])) { $_SESSION['alert_message'] = "Payment Method $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -39,7 +39,7 @@ if (isset($_POST['edit_payment_method'])) { $_SESSION['alert_message'] = "Payment Method $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -59,6 +59,6 @@ if (isset($_GET['delete_payment_method'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Payment Method $payment_method_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/payment_provider.php b/admin/post/payment_provider.php index 0f13af2f..09ec07b6 100644 --- a/admin/post/payment_provider.php +++ b/admin/post/payment_provider.php @@ -57,7 +57,7 @@ if (isset($_POST['add_payment_provider'])) { $_SESSION['alert_message'] = "AI Model $provider created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -81,7 +81,7 @@ if (isset($_POST['edit_payment_provider'])) { $_SESSION['alert_message'] = "Payment Provider $provider edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -101,6 +101,6 @@ if (isset($_GET['delete_payment_provider'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Payment Provider $provider_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/project_template.php b/admin/post/project_template.php index 32d68a4e..78a6e4d8 100644 --- a/admin/post/project_template.php +++ b/admin/post/project_template.php @@ -16,7 +16,7 @@ if (isset($_POST['add_project_template'])) { $_SESSION['alert_message'] = "Project Template $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -33,7 +33,7 @@ if (isset($_POST['edit_project_template'])) { $_SESSION['alert_message'] = "Project Template $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_template_order'])) { @@ -44,7 +44,7 @@ if (isset($_POST['edit_ticket_template_order'])) { mysqli_query($mysqli, "UPDATE project_template_ticket_templates SET ticket_template_order = $order WHERE ticket_template_id = $ticket_template_id AND project_template_id = $project_template_id"); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['add_ticket_template_to_project_template'])) { @@ -60,7 +60,7 @@ if (isset($_POST['add_ticket_template_to_project_template'])) { $_SESSION['alert_message'] = "Ticket template added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['remove_ticket_template_from_project_template'])) { @@ -77,7 +77,7 @@ if (isset($_POST['remove_ticket_template_from_project_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Ticket template removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_project_template'])) { @@ -100,5 +100,5 @@ if (isset($_GET['delete_project_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Project Template $project_template_name and its associated ticket templates and tasks deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/roles.php b/admin/post/roles.php index af659e70..356ce30f 100644 --- a/admin/post/roles.php +++ b/admin/post/roles.php @@ -23,7 +23,7 @@ if (isset($_POST['add_role'])) { $_SESSION['alert_message'] = "User Role created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -58,7 +58,7 @@ if (isset($_POST['edit_role'])) { $_SESSION['alert_message'] = "User Role $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_role'])) { @@ -73,7 +73,7 @@ if (isset($_GET['archive_role'])) { if ($role_user_count != 0) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Role must not in use to archive it"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -85,5 +85,5 @@ if (isset($_GET['archive_role'])) { logAction("User Role", "Archive", "$session_name archived user role $role_name", 0, $role_id); $_SESSION['alert_message'] = "User Role archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/admin/post/saved_payment_method.php b/admin/post/saved_payment_method.php index 90e8047b..23839f16 100644 --- a/admin/post/saved_payment_method.php +++ b/admin/post/saved_payment_method.php @@ -63,6 +63,6 @@ if (isset($_GET['delete_saved_payment'])) { // Logging & Redirect logAction("Payment Provider", "Update", "$session_name deleted saved payment method $saved_payment_description (PM: $payment_method)", $client_id); $_SESSION['alert_message'] = "Payment method $saved_payment_description removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_ai.php b/admin/post/settings_ai.php index cbb5d00f..ac33f5b0 100644 --- a/admin/post/settings_ai.php +++ b/admin/post/settings_ai.php @@ -23,6 +23,6 @@ if (isset($_POST['edit_ai_settings'])) { $_SESSION['alert_message'] = "AI Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_company.php b/admin/post/settings_company.php index d19587eb..e058e9e5 100644 --- a/admin/post/settings_company.php +++ b/admin/post/settings_company.php @@ -49,7 +49,7 @@ if (isset($_POST['edit_company'])) { $_SESSION['alert_message'] = "Company $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -69,6 +69,6 @@ if (isset($_GET['remove_company_logo'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Removed company logo"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_default.php b/admin/post/settings_default.php index 3303aa2e..87dfef34 100644 --- a/admin/post/settings_default.php +++ b/admin/post/settings_default.php @@ -24,5 +24,5 @@ if (isset($_POST['edit_default_settings'])) { $_SESSION['alert_message'] = "Default settings edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_invoice.php b/admin/post/settings_invoice.php index 08262d02..36c42fd8 100644 --- a/admin/post/settings_invoice.php +++ b/admin/post/settings_invoice.php @@ -26,6 +26,6 @@ if (isset($_POST['edit_invoice_settings'])) { $_SESSION['alert_message'] = "Invoice Settings edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_localization.php b/admin/post/settings_localization.php index 25ebce95..9e8d831a 100644 --- a/admin/post/settings_localization.php +++ b/admin/post/settings_localization.php @@ -19,6 +19,6 @@ if (isset($_POST['edit_localization'])) { $_SESSION['alert_message'] = "Company localization updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_mail.php b/admin/post/settings_mail.php index 005c72dd..ee4c68f9 100644 --- a/admin/post/settings_mail.php +++ b/admin/post/settings_mail.php @@ -19,7 +19,7 @@ if (isset($_POST['edit_mail_smtp_settings'])) { $_SESSION['alert_message'] = "SMTP Mail Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -41,7 +41,7 @@ if (isset($_POST['edit_mail_imap_settings'])) { $_SESSION['alert_message'] = "IMAP Mail Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -68,7 +68,7 @@ if (isset($_POST['edit_mail_from_settings'])) { $_SESSION['alert_message'] = "Mail From Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -114,7 +114,7 @@ if (isset($_POST['test_email_smtp'])) { $_SESSION['alert_message'] = "Failed to add test mail to queue"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['test_email_imap'])) { @@ -139,5 +139,5 @@ if (isset($_POST['test_email_imap'])) { $_SESSION['alert_message'] = "Test IMAP connection failed: " . $e->getMessage(); } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_module.php b/admin/post/settings_module.php index e98a3ce0..67aa48b1 100644 --- a/admin/post/settings_module.php +++ b/admin/post/settings_module.php @@ -24,6 +24,6 @@ if (isset($_POST['edit_module_settings'])) { $_SESSION['alert_message'] = "Module Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_notification.php b/admin/post/settings_notification.php index cf025793..8d5891cc 100644 --- a/admin/post/settings_notification.php +++ b/admin/post/settings_notification.php @@ -19,6 +19,6 @@ if (isset($_POST['edit_notification_settings'])) { $_SESSION['alert_message'] = "Notification Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_online_payment.php b/admin/post/settings_online_payment.php index 87a44345..3c31bb69 100644 --- a/admin/post/settings_online_payment.php +++ b/admin/post/settings_online_payment.php @@ -27,5 +27,5 @@ if (isset($_POST['edit_online_payment_settings'])) { $_SESSION['alert_message'] = "Online Payment Settings updated"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_online_payment_clients.php b/admin/post/settings_online_payment_clients.php index acc9ce51..8f7ab22a 100644 --- a/admin/post/settings_online_payment_clients.php +++ b/admin/post/settings_online_payment_clients.php @@ -7,7 +7,7 @@ if (isset($_GET['stripe_remove_pm'])) { if (!$config_stripe_enable) { $_SESSION['alert_message'] = "Stripe not enabled"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -42,7 +42,7 @@ if (isset($_GET['stripe_remove_pm'])) { // Logging & Redirect logAction("Stripe", "Update", "$session_name deleted saved Stripe payment method (PM: $payment_method)", $client_id); $_SESSION['alert_message'] = "Payment method removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -66,5 +66,5 @@ if (isset($_GET['stripe_reset_customer'])) { logAction("Stripe", "Delete", "$session_name reset Stripe settings for client", $client_id); $_SESSION['alert_message'] = "Reset client Stripe settings"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/admin/post/settings_project.php b/admin/post/settings_project.php index 15e746b7..b6bcf759 100644 --- a/admin/post/settings_project.php +++ b/admin/post/settings_project.php @@ -16,6 +16,6 @@ if (isset($_POST['edit_project_settings'])) { $_SESSION['alert_message'] = "Project Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_quote.php b/admin/post/settings_quote.php index afef08a3..2c39a13b 100644 --- a/admin/post/settings_quote.php +++ b/admin/post/settings_quote.php @@ -21,6 +21,6 @@ if (isset($_POST['edit_quote_settings'])) { $_SESSION['alert_message'] = "Quote Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_security.php b/admin/post/settings_security.php index 7d60c52f..08691b77 100644 --- a/admin/post/settings_security.php +++ b/admin/post/settings_security.php @@ -24,5 +24,5 @@ if (isset($_POST['edit_security_settings'])) { $_SESSION['alert_message'] = "Security settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_telemetry.php b/admin/post/settings_telemetry.php index 46b74866..e388b508 100644 --- a/admin/post/settings_telemetry.php +++ b/admin/post/settings_telemetry.php @@ -15,6 +15,6 @@ if (isset($_POST['edit_telemetry_settings'])) { $_SESSION['alert_message'] = "Telemetry Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_theme.php b/admin/post/settings_theme.php index 5a64c628..c8920c4b 100644 --- a/admin/post/settings_theme.php +++ b/admin/post/settings_theme.php @@ -17,7 +17,7 @@ if (isset($_POST['edit_theme_settings'])) { $_SESSION['alert_message'] = "Changed theme to $theme"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_favicon_settings'])) { @@ -49,6 +49,6 @@ if (isset($_POST['edit_favicon_settings'])) { $_SESSION['alert_message'] = "Favicon Updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/settings_ticket.php b/admin/post/settings_ticket.php index 918a703c..0e571fa4 100644 --- a/admin/post/settings_ticket.php +++ b/admin/post/settings_ticket.php @@ -26,6 +26,6 @@ if (isset($_POST['edit_ticket_settings'])) { $_SESSION['alert_message'] = "Ticket Settings updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/admin/post/software_template.php b/admin/post/software_template.php index 78794444..288bbdab 100644 --- a/admin/post/software_template.php +++ b/admin/post/software_template.php @@ -22,7 +22,7 @@ if (isset($_POST['add_software_template'])) { $_SESSION['alert_message'] = "Software template $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -43,7 +43,7 @@ if (isset($_POST['edit_software_template'])) { $_SESSION['alert_message'] = "Software template $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -64,6 +64,6 @@ if (isset($_GET['delete_software_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Software Template $software_template_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/tag.php b/admin/post/tag.php index f2c5debb..7f93f366 100644 --- a/admin/post/tag.php +++ b/admin/post/tag.php @@ -19,7 +19,7 @@ if (isset($_POST['add_tag'])) { $_SESSION['alert_message'] = "Tag $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -36,7 +36,7 @@ if (isset($_POST['edit_tag'])) { $_SESSION['alert_message'] = "Tag $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -56,6 +56,6 @@ if (isset($_GET['delete_tag'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Tag $tag_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/tax.php b/admin/post/tax.php index 82b3825b..be9ab4bf 100644 --- a/admin/post/tax.php +++ b/admin/post/tax.php @@ -21,7 +21,7 @@ if (isset($_POST['add_tax'])) { $_SESSION['alert_message'] = "Tax $name ($percent%) created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -39,7 +39,7 @@ if (isset($_POST['edit_tax'])) { $_SESSION['alert_message'] = "Tax $name ($percent%) edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -60,7 +60,7 @@ if (isset($_GET['archive_tax'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Tax $tax_name Archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -80,6 +80,6 @@ if (isset($_GET['delete_tax'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Tax $tax_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/ticket_status.php b/admin/post/ticket_status.php index 861a8940..c2b099ee 100644 --- a/admin/post/ticket_status.php +++ b/admin/post/ticket_status.php @@ -16,7 +16,7 @@ if (isset($_POST['add_ticket_status'])) { $_SESSION['alert_message'] = "Custom Ticket Status $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -35,7 +35,7 @@ if (isset($_POST['edit_ticket_status'])) { $_SESSION['alert_message'] = "Custom Ticket Status $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -62,5 +62,5 @@ if (isset($_GET['delete_ticket_status'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Custom Ticket Status $ticket_status_name Deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/ticket_template.php b/admin/post/ticket_template.php index deae39e3..30934990 100644 --- a/admin/post/ticket_template.php +++ b/admin/post/ticket_template.php @@ -29,7 +29,7 @@ if (isset($_POST['add_ticket_template'])) { $_SESSION['alert_message'] = "Ticket Template $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -48,7 +48,7 @@ if (isset($_POST['edit_ticket_template'])) { $_SESSION['alert_message'] = "Ticket Template $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_ticket_template'])) { @@ -74,7 +74,7 @@ if (isset($_GET['delete_ticket_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Ticket Template $ticket_template_name and its associated tasks deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['add_ticket_template_task'])) { @@ -94,7 +94,7 @@ if (isset($_POST['add_ticket_template_task'])) { $_SESSION['alert_message'] = "Added Task $task_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -115,5 +115,5 @@ if (isset($_GET['delete_task_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Task $task_template_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/update.php b/admin/post/update.php index 79297839..9a3ec163 100644 --- a/admin/post/update.php +++ b/admin/post/update.php @@ -279,7 +279,7 @@ if (isset($_GET['update'])) { sleep(1); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -300,5 +300,5 @@ if (isset($_GET['update_db'])) { sleep(1); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/admin/post/users.php b/admin/post/users.php index 104d2dd8..5c2d2c3b 100644 --- a/admin/post/users.php +++ b/admin/post/users.php @@ -95,7 +95,7 @@ if (isset($_POST['add_user'])) { $_SESSION['alert_message'] = "User $name created" . $extended_alert_description; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -176,7 +176,7 @@ if (isset($_POST['edit_user'])) { $_SESSION['alert_message'] = "User $name updated" . $extended_alert_description; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -198,7 +198,7 @@ if (isset($_GET['activate_user'])) { $_SESSION['alert_message'] = "User $user_name activated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -225,7 +225,7 @@ if (isset($_GET['disable_user'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "User $user_name disabled"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -247,7 +247,7 @@ if (isset($_GET['revoke_remember_me'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "User $user_name remember me tokens revoked"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -273,7 +273,7 @@ if (isset($_GET['archive_user'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "User $name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -341,7 +341,7 @@ if (isset($_POST['ir_reset_user_password'])) { if (!password_verify($admin_password, $userRow['user_password'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Incorrect password."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } diff --git a/admin/post/vendor_template.php b/admin/post/vendor_template.php index 35ee840f..9a2697fe 100644 --- a/admin/post/vendor_template.php +++ b/admin/post/vendor_template.php @@ -32,7 +32,7 @@ if (isset($_POST['add_vendor_template'])) { $_SESSION['alert_message'] = "Vendor template $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_vendor_template'])) { @@ -136,7 +136,7 @@ if (isset($_POST['edit_vendor_template'])) { $_SESSION['alert_message'] = "Vendor template $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_vendor_template'])) { @@ -158,5 +158,5 @@ if (isset($_GET['delete_vendor_template'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Vendor Template $vendor_template_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/client/post.php b/client/post.php index 4fc5f841..00514b6e 100644 --- a/client/post.php +++ b/client/post.php @@ -82,7 +82,7 @@ if (isset($_POST['add_ticket_comment'])) { // After stripping bad HTML, check the comment isn't just empty if (empty($comment)) { - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -172,7 +172,7 @@ if (isset($_POST['add_ticket_comment'])) { customAction('ticket_reply_client', $ticket_id); // Redirect back to original page - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { // The client does not have access to this ticket @@ -202,7 +202,7 @@ if (isset($_POST['add_ticket_feedback'])) { customAction('ticket_feedback', $ticket_id); // Redirect - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { // The client does not have access to this ticket header("Location: post.php?logout"); @@ -891,7 +891,7 @@ if (isset($_POST['set_recurring_payment'])) { $_SESSION['alert_message'] = "Automatic Payment Disabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['client_add_document'])) { diff --git a/guest/guest_post.php b/guest/guest_post.php index 1daebfdd..47289fed 100644 --- a/guest/guest_post.php +++ b/guest/guest_post.php @@ -63,7 +63,7 @@ if (isset($_GET['accept_quote'], $_GET['url_key'])) { } $_SESSION['alert_message'] = "Quote Accepted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { echo "Invalid!!"; } @@ -125,7 +125,7 @@ if (isset($_GET['decline_quote'], $_GET['url_key'])) { $_SESSION['alert_type'] = "danger"; $_SESSION['alert_message'] = "Quote Declined"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { echo "Invalid!!"; } @@ -146,7 +146,7 @@ if (isset($_GET['reopen_ticket'], $_GET['url_key'])) { // Logging customAction('ticket_update', $ticket_id); $_SESSION['alert_message'] = "Ticket reopened"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { echo "Invalid!!"; } @@ -167,7 +167,7 @@ if (isset($_GET['close_ticket'], $_GET['url_key'])) { // Logging customAction('ticket_close', $ticket_id); $_SESSION['alert_message'] = "Ticket closed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { echo "Invalid!!"; } @@ -195,7 +195,7 @@ if (isset($_GET['add_ticket_feedback'], $_GET['url_key'])) { } $_SESSION['alert_message'] = "Feedback recorded - thank you"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); customAction('ticket_feedback', $ticket_id); } else { echo "Invalid!!"; @@ -708,7 +708,7 @@ if (isset($_POST['guest_quote_upload_file'])) { } } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { echo "Invalid!!"; diff --git a/post/misc.php b/post/misc.php index 17f7b73c..e90adab1 100644 --- a/post/misc.php +++ b/post/misc.php @@ -12,7 +12,7 @@ if(isset($_POST['change_records_per_page'])){ mysqli_query($mysqli,"UPDATE user_settings SET user_config_records_per_page = $records_per_page WHERE user_id = $session_user_id"); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -29,7 +29,7 @@ if (isset($_GET['dismiss_notification'])) { $_SESSION['alert_message'] = "Notification Dismissed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -54,7 +54,7 @@ if (isset($_GET['dismiss_all_notifications'])) { $_SESSION['alert_message'] = "$num_notifications Notifications Dismissed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -78,5 +78,5 @@ if (isset($_GET['deactivate_shared_item'])) { $_SESSION['alert_message'] = "Share Link deactivated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/account.php b/user/post/account.php index f507c4d7..dfdd894b 100644 --- a/user/post/account.php +++ b/user/post/account.php @@ -22,7 +22,7 @@ if (isset($_POST['add_account'])) { $_SESSION['alert_message'] = "Account $name created "; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -41,7 +41,7 @@ if (isset($_POST['edit_account'])) { $_SESSION['alert_message'] = "Account $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -63,7 +63,7 @@ if (isset($_GET['archive_account'])) { $_SESSION['alert_message'] = "Account $account_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -85,6 +85,6 @@ if (isset($_GET['delete_account'])) { $_SESSION['alert_message'] = "Account $account_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/asset.php b/user/post/asset.php index 6fba2985..baaefcf1 100644 --- a/user/post/asset.php +++ b/user/post/asset.php @@ -65,7 +65,7 @@ if (isset($_POST['add_asset'])) { $_SESSION['alert_message'] = "Asset $name created $alert_extended"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -116,7 +116,7 @@ if (isset($_POST['edit_asset'])) { $_SESSION['alert_message'] = "Asset $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -142,7 +142,7 @@ if (isset($_GET['archive_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -167,7 +167,7 @@ if (isset($_GET['unarchive_asset'])) { $_SESSION['alert_message'] = "Asset $asset_name Unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -193,7 +193,7 @@ if (isset($_GET['delete_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -238,7 +238,7 @@ if (isset($_POST['bulk_assign_asset_location'])) { $_SESSION['alert_message'] = "You assigned $asset_count assets to location $location_name"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -278,7 +278,7 @@ if (isset($_POST['bulk_assign_asset_physical_location'])) { $_SESSION['alert_message'] = "You moved $asset_count assets to location $physical_location"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_transfer_client_asset'])) { @@ -363,7 +363,7 @@ if (isset($_POST['bulk_transfer_client_asset'])) { $_SESSION['alert_message'] = "Transferred $asset_count assets to $new_client_name."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_assign_asset_contact'])) { @@ -407,7 +407,7 @@ if (isset($_POST['bulk_assign_asset_contact'])) { $_SESSION['alert_message'] = "You assigned $asset_count assets to contact $contact_name"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -447,7 +447,7 @@ if (isset($_POST['bulk_edit_asset_status'])) { $_SESSION['alert_message'] = "You set the status $status on $asset_count assets."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -487,7 +487,7 @@ if (isset($_POST['bulk_archive_assets'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_assets'])) { @@ -525,7 +525,7 @@ if (isset($_POST['bulk_unarchive_assets'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_assets'])) { @@ -562,7 +562,7 @@ if (isset($_POST['bulk_delete_assets'])) { $_SESSION['alert_message'] = "Deleted $count asset(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -593,7 +593,7 @@ if (isset($_POST['link_software_to_asset'])) { $_SESSION['alert_message'] = "Software $software_name licensed for asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -623,7 +623,7 @@ if (isset($_GET['unlink_software_from_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Removed Software License $software_name for Asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } // Right now 1 login and have many assets but not many to many @@ -652,7 +652,7 @@ if (isset($_POST['link_asset_to_credential'])) { $_SESSION['alert_message'] = "Asset $asset_name linked with credential $crdential_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -682,7 +682,7 @@ if (isset($_GET['unlink_credential_from_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Credential $credential_name unlinked from Asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -711,7 +711,7 @@ if (isset($_POST['link_service_to_asset'])) { $_SESSION['alert_message'] = "Service $service_name linked with asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -741,7 +741,7 @@ if (isset($_GET['unlink_service_from_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name unlinked from service $service_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -771,7 +771,7 @@ if (isset($_POST['link_asset_to_file'])) { $_SESSION['alert_message'] = "Asset $asset_name linked with File $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -801,7 +801,7 @@ if (isset($_GET['unlink_asset_from_file'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name unlinked from file $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -823,7 +823,7 @@ if (isset($_POST["import_assets_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -959,12 +959,12 @@ if (isset($_POST["import_assets_csv"])) { logAction("Asset", "Import", "$session_name imported $row_count asset(s) via CSV file", $client_id); $_SESSION['alert_message'] = "$row_count Asset(s) added, $duplicate_count duplicate(s) detected"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } @@ -1125,7 +1125,7 @@ if (isset($_POST['add_asset_interface'])) { // 7) Alert message + redirect $_SESSION['alert_message'] = "Interface $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1167,7 +1167,7 @@ if (isset($_POST['add_asset_multiple_interfaces'])) { logAction("Asset Interface", "Bulk Create", "$session_name created $interfaces for asset $asset_name", $client_id, $asset_id); $_SESSION['alert_message'] = "Created $interfaces Interface(s) for asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1244,7 +1244,7 @@ if (isset($_POST['edit_asset_interface'])) { // 6) Alert and redirect $_SESSION['alert_message'] = "Interface $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1328,7 +1328,7 @@ if (isset($_POST['bulk_edit_asset_interface_type'])) { logAction("Asset Interface", "Bulk Edit", "$session_name set interface type to $type on $interface_count interfaces for asset $asset_name", $client_id); $_SESSION['alert_message'] = "Type set to $type on $interface_count interfaces."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1374,7 +1374,7 @@ if (isset($_POST['bulk_edit_asset_interface_network'])) { logAction("Asset Interface", "Bulk Edit", "$session_name set network to $network_name on $interface_count interfaces for asset $asset_name", $client_id); $_SESSION['alert_message'] = "Network set to $network_name on $interface_count interfaces."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1413,7 +1413,7 @@ if (isset($_POST['bulk_edit_asset_interface_ip_dhcp'])) { logAction("Asset Interface", "Bulk Edit", "$session_name set interface IP to DHCP on $interface_count interfaces for asset $asset_name", $client_id); $_SESSION['alert_message'] = "Interface IP set to DHCP on $interface_count interfaces."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1453,7 +1453,7 @@ if (isset($_POST['bulk_delete_asset_interfaces'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "$interface_count interfaces deleted."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1478,7 +1478,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -1566,12 +1566,12 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) { logAction("Asset", "Import", "$session_name imported $row_count interfaces(s) to asset $asset_name via CSV file", $client_id); $_SESSION['alert_message'] = "$row_count Interfaces(s) added to asset $asset_name, $duplicate_count duplicate(s) detected"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } diff --git a/user/post/budget.php b/user/post/budget.php index 59d77c68..6a005925 100644 --- a/user/post/budget.php +++ b/user/post/budget.php @@ -39,7 +39,7 @@ if (isset($_POST['save_budget'])) { $_SESSION['alert_message'] = "Budget Updated for $year"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -60,6 +60,6 @@ if (isset($_POST['delete_budget'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Budget deleted for $year"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/category.php b/user/post/category.php index 773fd6fd..8d2bb55f 100644 --- a/user/post/category.php +++ b/user/post/category.php @@ -19,6 +19,6 @@ if (isset($_POST['add_category'])) { $_SESSION['alert_message'] = "Category $type $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/certificate.php b/user/post/certificate.php index 779ff5a0..647c7091 100644 --- a/user/post/certificate.php +++ b/user/post/certificate.php @@ -37,7 +37,7 @@ if (isset($_POST['add_certificate'])) { $_SESSION['alert_message'] = "Certificate $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -104,7 +104,7 @@ if (isset($_POST['edit_certificate'])) { $_SESSION['alert_message'] = "Certificate $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -128,7 +128,7 @@ if (isset($_GET['archive_certificate'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Certificate $certificate_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -151,7 +151,7 @@ if (isset($_GET['unarchive_certificate'])) { $_SESSION['alert_message'] = "Certificate $certificate_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -175,7 +175,7 @@ if (isset($_GET['delete_certificate'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Certificate $certificate_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -213,7 +213,7 @@ if (isset($_POST['bulk_delete_certificates'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_certificates_csv'])) { diff --git a/user/post/client.php b/user/post/client.php index 8c387ee4..ebbb5991 100644 --- a/user/post/client.php +++ b/user/post/client.php @@ -158,7 +158,7 @@ if (isset($_POST['edit_client'])) { $_SESSION['alert_message'] = "Client $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_client'])) { @@ -181,7 +181,7 @@ if (isset($_GET['archive_client'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Client $client_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['restore_client'])) { @@ -203,7 +203,7 @@ if (isset($_GET['restore_client'])) { $_SESSION['alert_message'] = "Client $client_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_client'])) { @@ -366,7 +366,7 @@ if (isset($_POST["import_clients_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -554,14 +554,14 @@ if (isset($_POST["import_clients_csv"])) { logAction("Client", "Import", "$session_name imported $row_count client(s) via CSV file, $duplicate_count duplicate(s) found"); $_SESSION['alert_message'] = "$row_count Client(s) added, $duplicate_count duplicate(s) found"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } @@ -622,7 +622,7 @@ if (isset($_POST['bulk_edit_client_industry'])) { $_SESSION['alert_message'] = "Set the Industry to $industry for $count clients"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -658,7 +658,7 @@ if (isset($_POST['bulk_edit_client_referral'])) { $_SESSION['alert_message'] = "Set the Referral to $referral for $count clients"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -694,7 +694,7 @@ if (isset($_POST['bulk_edit_client_hourly_rate'])) { $_SESSION['alert_message'] = "Set the Hourly Rate to " . numfmt_format_currency($currency_format, $rate, $session_company_currency) . " for $count client(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -739,7 +739,7 @@ if (isset($_POST['bulk_assign_client_tags'])) { $_SESSION['alert_message'] = "Assigned tags for $count clients"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -825,7 +825,7 @@ if (isset($_POST['bulk_send_client_email']) && isset($_POST['client_ids'])) { } // Redirect back - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -863,7 +863,7 @@ if (isset($_POST['bulk_archive_clients'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_clients'])) { @@ -898,7 +898,7 @@ if (isset($_POST['bulk_unarchive_clients'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST["export_client_pdf"])) { diff --git a/user/post/contact.php b/user/post/contact.php index ff231609..9c518fd6 100644 --- a/user/post/contact.php +++ b/user/post/contact.php @@ -73,7 +73,7 @@ if (isset($_POST['add_contact'])) { $_SESSION['alert_message'] = "Contact $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -214,7 +214,7 @@ if (isset($_POST['edit_contact'])) { $_SESSION['alert_message'] = "Contact $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -241,7 +241,7 @@ if (isset($_POST['add_contact_note'])) { $_SESSION['alert_message'] = "Note $type created for $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -268,7 +268,7 @@ if (isset($_GET['archive_contact_note'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Note $contact_note_type archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -293,7 +293,7 @@ if (isset($_GET['unarchive_contact_note'])) { $_SESSION['alert_message'] = "Note $contact_note_type restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -319,7 +319,7 @@ if (isset($_GET['delete_contact_note'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Note $contact_note_type deleted."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -362,7 +362,7 @@ if (isset($_POST['bulk_assign_contact_location'])) { $_SESSION['alert_message'] = "You assigned $contact_count contacts to location $location_name"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -399,7 +399,7 @@ if (isset($_POST['bulk_edit_contact_phone'])) { $_SESSION['alert_message'] = "You set Phone Number " . formatPhoneNumber($phone) . " on $contact_count contacts"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -437,7 +437,7 @@ if (isset($_POST['bulk_edit_contact_department'])) { $_SESSION['alert_message'] = "You set the Department to $department for $contact_count contacts"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -479,7 +479,7 @@ if (isset($_POST['bulk_edit_contact_role'])) { $_SESSION['alert_message'] = "You updated contact roles for $contact_count contacts"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -530,7 +530,7 @@ if (isset($_POST['bulk_assign_contact_tags'])) { $_SESSION['alert_message'] = "You assigned tags for $count contacts"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -576,7 +576,7 @@ if (isset($_POST['send_bulk_mail_now'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -628,7 +628,7 @@ if (isset($_POST['bulk_archive_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_contacts'])) { @@ -672,7 +672,7 @@ if (isset($_POST['bulk_unarchive_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_contacts'])) { @@ -716,7 +716,7 @@ if (isset($_POST['bulk_delete_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['anonymize_contact'])) { @@ -818,7 +818,7 @@ if (isset($_GET['anonymize_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name anonymized & archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_contact'])) { @@ -848,7 +848,7 @@ if (isset($_GET['archive_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name has been archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -877,7 +877,7 @@ if (isset($_GET['unarchive_contact'])) { $_SESSION['alert_message'] = "Contact $contact_name has been Unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -907,7 +907,7 @@ if (isset($_GET['delete_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name has been deleted."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -936,7 +936,7 @@ if (isset($_POST['link_contact_to_asset'])) { $_SESSION['alert_message'] = "Contact $contact_name linked with asset $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -966,7 +966,7 @@ if (isset($_GET['unlink_asset_from_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name unlinked from Contact $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -995,7 +995,7 @@ if (isset($_POST['link_software_to_contact'])) { $_SESSION['alert_message'] = "Software $software_name licensed for contact $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1025,7 +1025,7 @@ if (isset($_GET['unlink_software_from_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Removed Software License $software_name for Contact $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1054,7 +1054,7 @@ if (isset($_POST['link_contact_to_credential'])) { $_SESSION['alert_message'] = "Contact $contact_name linked with credential $credential_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1084,7 +1084,7 @@ if (isset($_GET['unlink_credential_from_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Credential $credential_name unlinked from Contact $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1113,7 +1113,7 @@ if (isset($_POST['link_service_to_contact'])) { $_SESSION['alert_message'] = "service $service_name linked with contact $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1143,7 +1143,7 @@ if (isset($_GET['unlink_service_from_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name unlinked from service $service_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1173,7 +1173,7 @@ if (isset($_POST['link_contact_to_file'])) { $_SESSION['alert_message'] = "Contact $contact_name linked with File $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1203,7 +1203,7 @@ if (isset($_GET['unlink_contact_from_file'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name unlinked from file $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1271,7 +1271,7 @@ if (isset($_POST["import_contacts_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -1353,12 +1353,12 @@ if (isset($_POST["import_contacts_csv"])) { logAction("Contact", "Import", "$session_name imported $row_count contact(s) via CSV file", $client_id); $_SESSION['alert_message'] = "$row_count Contact(s) added, $duplicate_count duplicate(s) detected"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } diff --git a/user/post/credential.php b/user/post/credential.php index 8795b51a..46779dc4 100644 --- a/user/post/credential.php +++ b/user/post/credential.php @@ -29,7 +29,7 @@ if (isset($_POST['add_credential'])) { $_SESSION['alert_message'] = "Credential $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -69,7 +69,7 @@ if (isset($_POST['edit_credential'])) { $_SESSION['alert_message'] = "Credential $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -94,7 +94,7 @@ if(isset($_GET['archive_credential'])){ $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Credential $credential_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -117,7 +117,7 @@ if(isset($_GET['unarchive_credential'])){ $_SESSION['alert_message'] = "Credential $credential_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_credential'])) { @@ -140,7 +140,7 @@ if (isset($_GET['delete_credential'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Credential $credential_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -191,7 +191,7 @@ if (isset($_POST['bulk_assign_credential_tags'])) { logAction("Credential", "Bulk Edit", "$session_name added tags to $count credentials", $client_id); } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -230,7 +230,7 @@ if (isset($_POST['bulk_archive_credentials'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_credentials'])) { @@ -269,7 +269,7 @@ if (isset($_POST['bulk_unarchive_credentials'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_credentials'])) { @@ -309,7 +309,7 @@ if (isset($_POST['bulk_delete_credentials'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_credentials_csv'])) { @@ -379,7 +379,7 @@ if (isset($_POST["import_credentials_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -447,12 +447,12 @@ if (isset($_POST["import_credentials_csv"])) { logAction("Credential", "Import", "$session_name imported $row_count credential(s) via CSV file. $duplicate_count duplicate(s) found and not imported", $client_id); $_SESSION['alert_message'] = "$row_count credential(s) imported, $duplicate_count duplicate(s) detected and not imported"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } diff --git a/user/post/credit.php b/user/post/credit.php index 4acdbb97..76f47018 100644 --- a/user/post/credit.php +++ b/user/post/credit.php @@ -25,5 +25,5 @@ if (isset($_POST['add_credit'])) { $_SESSION['alert_message'] = "" . numfmt_format_currency($currency_format, $amount, $session_company_currency) . " Credit Added "; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/document.php b/user/post/document.php index 9330114c..8b802761 100644 --- a/user/post/document.php +++ b/user/post/document.php @@ -33,7 +33,7 @@ if (isset($_POST['add_document'])) { $_SESSION['alert_message'] = "Document $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -148,7 +148,7 @@ if (isset($_POST['move_document'])) { $_SESSION['alert_message'] = "Document $document_name moved to folder $folder_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -174,7 +174,7 @@ if (isset($_POST['rename_document'])) { $_SESSION['alert_message'] = "You renamed Document from $old_document_name to $name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -215,7 +215,7 @@ if (isset($_POST['bulk_move_document'])) { $_SESSION['alert_message'] = "You moved $count document(s) to the folder $folder_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -245,7 +245,7 @@ if (isset($_POST['link_file_to_document'])) { $_SESSION['alert_message'] = "File $file_name linked with Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -275,7 +275,7 @@ if (isset($_GET['unlink_file_from_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "File $file_name unlinked from Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -305,7 +305,7 @@ if (isset($_POST['link_vendor_to_document'])) { $_SESSION['alert_message'] = "Vendor $vendor_name linked with Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -335,7 +335,7 @@ if (isset($_GET['unlink_vendor_from_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Vendor $vendor_name unlinked from Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -366,7 +366,7 @@ if (isset($_POST['link_contact_to_document'])) { $_SESSION['alert_message'] = "Contact $contact_name linked with Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -396,7 +396,7 @@ if (isset($_GET['unlink_contact_from_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name unlinked from Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -426,7 +426,7 @@ if (isset($_POST['link_asset_to_document'])) { $_SESSION['alert_message'] = "Asset $asset_name linked with Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -456,7 +456,7 @@ if (isset($_GET['unlink_asset_from_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Asset $asset_name unlinked from Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -486,7 +486,7 @@ if (isset($_POST['link_software_to_document'])) { $_SESSION['alert_message'] = "Software $software_name linked with Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -516,7 +516,7 @@ if (isset($_GET['unlink_software_from_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Software $software_name unlinked from Document $document_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -546,7 +546,7 @@ if (isset($_POST['toggle_document_visibility'])) { $_SESSION['alert_message'] = "Document $document_name changed to $visable_wording in the client portal"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -590,7 +590,7 @@ if (isset($_GET['export_document'])) { $_SESSION['alert_message'] = "Document $document_name exported"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -633,7 +633,7 @@ if (isset($_GET['archive_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Document $document_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -657,7 +657,7 @@ if (isset($_GET['delete_document_version'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Document $document_version_name version deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -684,7 +684,7 @@ if (isset($_GET['delete_document'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Document $document_name deleted and all versions"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -725,6 +725,6 @@ if (isset($_POST['bulk_delete_documents'])) { $_SESSION['alert_message'] = "Deleted $count Documents and associated document versions"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/domain.php b/user/post/domain.php index df741c41..bee61253 100644 --- a/user/post/domain.php +++ b/user/post/domain.php @@ -57,7 +57,7 @@ if (isset($_POST['add_domain'])) { $_SESSION['alert_message'] = "Domain $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -143,7 +143,7 @@ if (isset($_POST['edit_domain'])) { $_SESSION['alert_message'] = "Domain $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -167,7 +167,7 @@ if (isset($_GET['archive_domain'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Domain $domain_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if(isset($_GET['unarchive_domain'])){ @@ -189,7 +189,7 @@ if(isset($_GET['unarchive_domain'])){ $_SESSION['alert_message'] = "Domain $domain_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_domain'])) { @@ -212,7 +212,7 @@ if (isset($_GET['delete_domain'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Domain $domain_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -250,7 +250,7 @@ if (isset($_POST['bulk_archive_domains'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_domains'])) { @@ -287,7 +287,7 @@ if (isset($_POST['bulk_unarchive_domains'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_domains'])) { @@ -324,7 +324,7 @@ if (isset($_POST['bulk_delete_domains'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_domains_csv'])) { diff --git a/user/post/event.php b/user/post/event.php index e1724d52..8961fbf6 100644 --- a/user/post/event.php +++ b/user/post/event.php @@ -20,7 +20,7 @@ if (isset($_POST['add_calendar'])) { $_SESSION['alert_message'] = "Calendar $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -37,7 +37,7 @@ if (isset($_POST['edit_calendar'])) { $_SESSION['alert_message'] = "Calendar $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -111,7 +111,7 @@ if (isset($_POST['add_event'])) { $_SESSION['alert_message'] = "Event $title created in calendar $calendar_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -179,7 +179,7 @@ if (isset($_POST['edit_event'])) { $_SESSION['alert_message'] = "Calendar event titled $title edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -200,6 +200,6 @@ if (isset($_GET['delete_event'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Calendar event titled $event_title deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/expense.php b/user/post/expense.php index 7f4f7014..61cea58a 100644 --- a/user/post/expense.php +++ b/user/post/expense.php @@ -38,7 +38,7 @@ if (isset($_POST['add_expense'])) { $_SESSION['alert_message'] = "Expense added" . $extended_alert_description; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -81,7 +81,7 @@ if (isset($_POST['edit_expense'])) { $_SESSION['alert_message'] = "Expense modified" . $extended_alert_description; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -103,7 +103,7 @@ if (isset($_GET['delete_expense'])) { $_SESSION['alert_message'] = "Expense deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -144,7 +144,7 @@ if (isset($_POST['bulk_edit_expense_category'])) { $_SESSION['alert_message'] = "You assigned expense category $category_name to $count expense(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_edit_expense_account'])) { @@ -184,7 +184,7 @@ if (isset($_POST['bulk_edit_expense_account'])) { $_SESSION['alert_message'] = "You assigned account $account_name to $count expense(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_edit_expense_client'])) { @@ -220,7 +220,7 @@ if (isset($_POST['bulk_edit_expense_client'])) { $_SESSION['alert_message'] = "You assigned Client $client_name to $expense_count expenses"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_expenses'])) { @@ -260,7 +260,7 @@ if (isset($_POST['bulk_delete_expenses'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_expenses_csv'])) { @@ -377,7 +377,7 @@ if (isset($_POST['create_recurring_expense'])) { $_SESSION['alert_message'] = "Recurring Expense created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -408,7 +408,7 @@ if (isset($_POST['edit_recurring_expense'])) { $_SESSION['alert_message'] = "Recurring Expense edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -429,6 +429,6 @@ if (isset($_GET['delete_recurring_expense'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Recurring Expense deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/file.php b/user/post/file.php index 110f4ea1..fb1441c3 100644 --- a/user/post/file.php +++ b/user/post/file.php @@ -196,7 +196,7 @@ if (isset($_POST['upload_files'])) { } // Redirect after processing - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -223,7 +223,7 @@ if (isset($_POST['rename_file'])) { $_SESSION['alert_message'] = "Renamed file $old_file_name to $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -252,7 +252,7 @@ if (isset($_POST['move_file'])) { $_SESSION['alert_message'] = "File $file_name moved to $folder_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -276,7 +276,7 @@ if (isset($_GET['archive_file'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "File $file_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -312,7 +312,7 @@ if (isset($_POST['delete_file'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "File $file_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -361,7 +361,7 @@ if (isset($_POST['bulk_delete_files'])) { $_SESSION['alert_message'] = "You deleted $file_count files"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -404,7 +404,7 @@ if (isset($_POST['bulk_move_files'])) { $_SESSION['alert_message'] = "Moved $file_count files to the folder $folder_name"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -434,7 +434,7 @@ if (isset($_POST['link_asset_to_file'])) { $_SESSION['alert_message'] = "Asset $asset_name linked to File $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -463,6 +463,6 @@ if (isset($_GET['unlink_asset_from_file'])) { $_SESSION['alert_message'] = "Asset $asset_name unlinked from File $file_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/folder.php b/user/post/folder.php index ee43e1b2..639034f1 100644 --- a/user/post/folder.php +++ b/user/post/folder.php @@ -24,7 +24,7 @@ if (isset($_POST['create_folder'])) { $_SESSION['alert_message'] = "Folder $folder_name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -49,7 +49,7 @@ if (isset($_POST['rename_folder'])) { $_SESSION['alert_message'] = "Folder $old_folder_name renamed to $folder_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -81,6 +81,6 @@ if (isset($_GET['delete_folder'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Folder $folder_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/invoice.php b/user/post/invoice.php index efcd206d..f48e4ecd 100644 --- a/user/post/invoice.php +++ b/user/post/invoice.php @@ -72,7 +72,7 @@ if (isset($_POST['edit_invoice'])) { $_SESSION['alert_message'] = "Invoice $invoice_prefix$invoice_number edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -254,7 +254,7 @@ if (isset($_POST['edit_recurring_invoice'])) { $_SESSION['alert_message'] = "Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -291,7 +291,7 @@ if (isset($_GET['delete_recurring_invoice'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -344,7 +344,7 @@ if (isset($_POST['add_recurring_invoice_item'])) { $_SESSION['alert_message'] = "Item $name added to Recurring Invoice"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -367,7 +367,7 @@ if (isset($_POST['recurring_invoice_note'])) { $_SESSION['alert_message'] = "Notes added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -400,7 +400,7 @@ if (isset($_GET['delete_recurring_invoice_item'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Item $item_name removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -424,7 +424,7 @@ if (isset($_GET['mark_invoice_sent'])) { $_SESSION['alert_message'] = "Invoice marked sent"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['mark_invoice_non-billable'])) { @@ -447,7 +447,7 @@ if (isset($_GET['mark_invoice_non-billable'])) { $_SESSION['alert_message'] = "Invoice marked Non-Billable"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -472,7 +472,7 @@ if (isset($_GET['cancel_invoice'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invoice $invoice_prefix$invoice_number cancelled"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -518,7 +518,7 @@ if (isset($_GET['delete_invoice'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invoice $invoice_prefix$invoice_number deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -572,7 +572,7 @@ if (isset($_POST['add_invoice_item'])) { $_SESSION['alert_message'] = "Item $name added to invoice"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -595,7 +595,7 @@ if (isset($_POST['invoice_note'])) { $_SESSION['alert_message'] = "Notes added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -692,7 +692,7 @@ if (isset($_POST['edit_item'])) { $_SESSION['alert_message'] = "Item $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -727,7 +727,7 @@ if (isset($_GET['delete_invoice_item'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Item $item_name removed from invoice"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -748,7 +748,7 @@ if (isset($_POST['add_payment'])) { //Check to see if amount entered is greater than the balance of the invoice if ($amount > $balance) { $_SESSION['alert_message'] = "Payment is more than the balance"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { mysqli_query($mysqli,"INSERT INTO payments SET payment_date = '$date', payment_amount = $amount, payment_currency_code = '$currency_code', payment_account_id = $account, payment_method = '$payment_method', payment_reference = '$reference', payment_invoice_id = $invoice_id"); @@ -890,7 +890,7 @@ if (isset($_POST['add_payment'])) { $_SESSION['alert_message'] .= "Payment amount " . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . " added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } @@ -1018,17 +1018,17 @@ if (isset($_GET['add_payment_stripe'])) { if (!$config_stripe_enable || !$stripe_id || !$stripe_pm) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Stripe not enabled or no client card saved"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invalid invoice state (draft/partial/paid/not billable)"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } elseif ($invoice_amount == 0) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invalid invoice amount"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -1137,14 +1137,14 @@ if (isset($_GET['add_payment_stripe'])) { customAction('invoice_pay', $invoice_id); $_SESSION['alert_message'] .= "Payment amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { mysqli_query($mysqli, "INSERT INTO history SET history_status = 'Payment failed', history_description = 'Stripe pay failed due to payment error', history_invoice_id = $invoice_id"); logAction("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id); $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Payment failed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -1169,7 +1169,7 @@ if (isset($_POST['add_bulk_payment'])) { if ($bulk_payment_amount > $total_account_balance) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Payment exceeds Client Balance."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; } @@ -1281,7 +1281,7 @@ if (isset($_POST['add_bulk_payment'])) { $_SESSION['alert_message'] .= "Bulk Payment added"; // Redirect Back - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_payment'])) { @@ -1335,7 +1335,7 @@ if (isset($_GET['delete_payment'])) { $_SESSION['alert_message'] = "Payment deleted - Stripe payments must be manually refunded in Stripe"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1461,7 +1461,7 @@ if (isset($_GET['email_invoice'])) { addToMailQueue($data); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1491,7 +1491,7 @@ if (isset($_POST['add_recurring_payment'])) { $_SESSION['alert_message'] = "Automatic Payment created for $recurring_invoice_prefix$recurring_invoice_number"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_recurring_payment'])) { @@ -1516,7 +1516,7 @@ if (isset($_GET['delete_recurring_payment'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Auto Payment Removed for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1671,7 +1671,7 @@ if (isset($_GET['force_recurring'])) { $_SESSION['alert_message'] = "Recurring Invoice Forced"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1725,7 +1725,7 @@ if (isset($_POST['set_recurring_payment'])) { $_SESSION['alert_message'] = "Automatic Payment Disabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_invoices_csv'])) { @@ -1908,7 +1908,7 @@ if (isset($_GET['recurring_invoice_email_notify'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Email Notifications $notify_wording"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['link_invoice_to_ticket'])) { @@ -1919,7 +1919,7 @@ if (isset($_POST['link_invoice_to_ticket'])) { $_SESSION['alert_message'] = "Invoice linked to ticket"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['add_ticket_to_invoice'])) { @@ -2191,5 +2191,5 @@ if (isset($_POST['bulk_edit_invoice_category'])) { $_SESSION['alert_message'] = "Assigned income category $category_name to $count invoice(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/user/post/location.php b/user/post/location.php index b5642773..06d07706 100644 --- a/user/post/location.php +++ b/user/post/location.php @@ -56,7 +56,7 @@ if(isset($_POST['add_location'])){ $_SESSION['alert_message'] = "Location $name created."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -121,7 +121,7 @@ if(isset($_POST['edit_location'])){ $_SESSION['alert_message'] = "Location $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -145,7 +145,7 @@ if(isset($_GET['archive_location'])){ $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Location $location_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -168,7 +168,7 @@ if(isset($_GET['unarchive_location'])){ $_SESSION['alert_message'] = "Location $location_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if(isset($_GET['delete_location'])){ @@ -192,7 +192,7 @@ if(isset($_GET['delete_location'])){ $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Location $location_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -243,7 +243,7 @@ if (isset($_POST['bulk_assign_location_tags'])) { $_SESSION['alert_message'] = "Assigned tags for $count locations"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -286,7 +286,7 @@ if (isset($_POST['bulk_archive_locations'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_locations'])) { @@ -323,7 +323,7 @@ if (isset($_POST['bulk_unarchive_locations'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_locations'])) { @@ -361,7 +361,7 @@ if (isset($_POST['bulk_delete_locations'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if(isset($_POST['export_locations_csv'])){ @@ -425,7 +425,7 @@ if (isset($_POST["import_locations_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -502,12 +502,12 @@ if (isset($_POST["import_locations_csv"])) { logAction("Location", "Import", "$session_name imported $row_count location(s). $duplicate_count duplicate(s) found and not imported", $client_id); $_SESSION['alert_message'] = "$row_count Location(s) imported, $duplicate_count duplicate(s) detected and not imported"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } diff --git a/user/post/network.php b/user/post/network.php index 1043067c..45e12493 100644 --- a/user/post/network.php +++ b/user/post/network.php @@ -21,7 +21,7 @@ if (isset($_POST['add_network'])) { $_SESSION['alert_message'] = "Network $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -39,7 +39,7 @@ if (isset($_POST['edit_network'])) { $_SESSION['alert_message'] = "Network $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -63,7 +63,7 @@ if (isset($_GET['archive_network'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Network $network_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -86,7 +86,7 @@ if (isset($_GET['unarchive_network'])) { $_SESSION['alert_message'] = "Network $network_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -109,7 +109,7 @@ if (isset($_GET['delete_network'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Network $network_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -148,7 +148,7 @@ if (isset($_POST['bulk_delete_networks'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_networks_csv'])) { diff --git a/user/post/product.php b/user/post/product.php index fa681d4a..58d8aa84 100644 --- a/user/post/product.php +++ b/user/post/product.php @@ -22,7 +22,7 @@ if (isset($_POST['add_product'])) { $_SESSION['alert_message'] = "Product $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -41,7 +41,7 @@ if (isset($_POST['edit_product'])) { $_SESSION['alert_message'] = "Product $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -64,7 +64,7 @@ if (isset($_GET['archive_product'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Product $product_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -86,7 +86,7 @@ if (isset($_GET['unarchive_product'])) { $_SESSION['alert_message'] = "Product $product_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -109,7 +109,7 @@ if (isset($_GET['delete_product'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Product $product_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -151,7 +151,7 @@ if (isset($_POST['bulk_edit_product_category'])) { $_SESSION['alert_message'] = "Assigned category $category_name to $count product(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_archive_products'])) { @@ -188,7 +188,7 @@ if (isset($_POST['bulk_archive_products'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_products'])) { @@ -223,7 +223,7 @@ if (isset($_POST['bulk_unarchive_products'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_products'])) { @@ -258,7 +258,7 @@ if (isset($_POST['bulk_delete_products'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } diff --git a/user/post/profile.php b/user/post/profile.php index 9920ec7d..758875de 100644 --- a/user/post/profile.php +++ b/user/post/profile.php @@ -87,7 +87,7 @@ if (isset($_POST['edit_your_user_details'])) { header('Location: post.php?logout'); } else{ - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } @@ -99,7 +99,7 @@ if (isset($_GET['clear_your_user_avatar'])) { logAction("User Account", "Edit", "$session_name cleared their avatar"); $_SESSION['alert_message'] = "Avatar cleared"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_your_user_password'])) { @@ -190,7 +190,7 @@ if (isset($_POST['edit_your_user_preferences'])) { $_SESSION['alert_message'] = "User preferences updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['enable_mfa'])) { @@ -267,7 +267,7 @@ if (isset($_GET['disable_mfa'])){ if ($session_user_config_force_mfa) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Multi-Factor authentication cannot be disabled for your account"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -308,7 +308,7 @@ if (isset($_GET['disable_mfa'])){ $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Multi-Factor authentication disabled"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -326,6 +326,6 @@ if (isset($_POST['revoke_your_2fa_remember_tokens'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Remember me tokens revoked"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/project.php b/user/post/project.php index bf02acde..0bddd472 100644 --- a/user/post/project.php +++ b/user/post/project.php @@ -75,7 +75,7 @@ if (isset($_POST['add_project'])) { $_SESSION['alert_message'] = "You created Project $project_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_project'])) { @@ -96,7 +96,7 @@ if (isset($_POST['edit_project'])) { $_SESSION['alert_message'] = "Project $project_name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['close_project'])) { @@ -118,7 +118,7 @@ if (isset($_GET['close_project'])) { $_SESSION['alert_message'] = "Project $project_name closed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_project'])) { @@ -141,7 +141,7 @@ if (isset($_GET['archive_project'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Project $project_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['unarchive_project'])) { @@ -163,7 +163,7 @@ if (isset($_GET['unarchive_project'])) { $_SESSION['alert_message'] = "Project $project_name unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_project'])) { @@ -189,7 +189,7 @@ if (isset($_GET['delete_project'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Project $project_name Deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['link_ticket_to_project'])) { @@ -232,7 +232,7 @@ if (isset($_POST['link_ticket_to_project'])) { $_SESSION['alert_message'] = "$count Ticket(s) added to $project_name"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['link_closed_ticket_to_project'])) { @@ -251,7 +251,7 @@ if (isset($_POST['link_closed_ticket_to_project'])) { $sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_updated_at FROM tickets WHERE ticket_number = $ticket_number"); if (mysqli_num_rows($sql) == 0) { $_SESSION['alert_message'] = "Cannot merge into that ticket."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } $row = mysqli_fetch_array($sql); @@ -267,5 +267,5 @@ if (isset($_POST['link_closed_ticket_to_project'])) { logAction("Project", "Edit", "$session_name added ticket $ticket_prefix$ticket_number - $ticket_subject to project $project_name", $client_id, $project_id); $_SESSION['alert_message'] = "Ticket added to $project_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/user/post/quote.php b/user/post/quote.php index 5d3983e3..534dfb91 100644 --- a/user/post/quote.php +++ b/user/post/quote.php @@ -219,7 +219,7 @@ if (isset($_POST['add_quote_item'])) { $_SESSION['alert_message'] = "Item $name added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -244,7 +244,7 @@ if (isset($_POST['quote_note'])) { $_SESSION['alert_message'] = "Notes added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -279,7 +279,7 @@ if (isset($_POST['edit_quote'])) { $_SESSION['alert_message'] = "Quote edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -359,7 +359,7 @@ if (isset($_GET['delete_quote_item'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Item $item_name removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -384,7 +384,7 @@ if (isset($_GET['mark_quote_sent'])) { $_SESSION['alert_message'] = "Quote marked sent"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -411,7 +411,7 @@ if (isset($_GET['accept_quote'])) { $_SESSION['alert_message'] = "Quote accepted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -439,7 +439,7 @@ if (isset($_GET['decline_quote'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Quote declined"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -518,7 +518,7 @@ if (isset($_GET['email_quote'])) { mysqli_query($mysqli,"UPDATE quotes SET quote_status = 'Sent' WHERE quote_id = $quote_id"); } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -543,7 +543,7 @@ if (isset($_GET['mark_quote_invoiced'])) { $_SESSION['alert_message'] = "Quote marked invoiced"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -596,7 +596,7 @@ if(isset($_POST['export_quotes_csv'])){ $_SESSION['alert_message'] = "Exported $num_rows quote(s)"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit; diff --git a/user/post/rack.php b/user/post/rack.php index 33784909..b0fecbf9 100644 --- a/user/post/rack.php +++ b/user/post/rack.php @@ -46,7 +46,7 @@ if (isset($_POST['add_rack'])) { $_SESSION['alert_message'] = "Rack $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -89,7 +89,7 @@ if (isset($_POST['edit_rack'])) { $_SESSION['alert_message'] = "Rack $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -113,7 +113,7 @@ if (isset($_GET['archive_rack'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Rack $rack_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -136,7 +136,7 @@ if (isset($_GET['unarchive_rack'])) { $_SESSION['alert_message'] = "Rack $rack_name Unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -166,7 +166,7 @@ if (isset($_GET['delete_rack'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Rack $rack_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -191,7 +191,7 @@ if (isset($_POST['add_rack_unit'])) { if ($unit_start > $unit_end) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Unit Start number cannot be higher than Unit End number."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -202,7 +202,7 @@ if (isset($_POST['add_rack_unit'])) { // If there is an overlap, return an error message $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Units $unit_start to $unit_end are already in use by another device."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -216,7 +216,7 @@ if (isset($_POST['add_rack_unit'])) { $_SESSION['alert_message'] = "Device $name added to units $unit_start - $unit_end in rack."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_rack_unit'])) { @@ -244,7 +244,7 @@ if (isset($_POST['edit_rack_unit'])) { $_SESSION['alert_message'] = "Device $name edited on the rack"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -270,6 +270,6 @@ if (isset($_GET['remove_rack_unit'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Device $device_name removed from rack"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/user/post/revenue.php b/user/post/revenue.php index bdc82adb..363bc727 100644 --- a/user/post/revenue.php +++ b/user/post/revenue.php @@ -27,7 +27,7 @@ if (isset($_POST['add_revenue'])) { $_SESSION['alert_message'] = "Revenue added"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -51,7 +51,7 @@ if (isset($_POST['edit_revenue'])) { $_SESSION['alert_message'] = "Revenue edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -74,6 +74,6 @@ if (isset($_GET['delete_revenue'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Revenue removed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/service.php b/user/post/service.php index e314593a..9a1a1aa7 100644 --- a/user/post/service.php +++ b/user/post/service.php @@ -79,7 +79,7 @@ if (isset($_POST['add_service'])) { $_SESSION['alert_message'] = "Service $service_name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -163,7 +163,7 @@ if (isset($_POST['edit_service'])) { $_SESSION['alert_message'] = "Service $service_name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -189,6 +189,6 @@ if (isset($_GET['delete_service'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Service $service_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/software.php b/user/post/software.php index 589861a3..40f67af0 100644 --- a/user/post/software.php +++ b/user/post/software.php @@ -35,7 +35,7 @@ if (isset($_POST['add_software_from_template'])) { $_SESSION['alert_message'] = "Software $name created from template"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -95,7 +95,7 @@ if (isset($_POST['add_software'])) { $_SESSION['alert_message'] = "Software $name created $alert_extended"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -155,7 +155,7 @@ if (isset($_POST['edit_software'])) { $_SESSION['alert_message'] = "Software $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -183,7 +183,7 @@ if (isset($_GET['archive_software'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Software $software_name archived and removed all device/user license associations"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -207,7 +207,7 @@ if (isset($_GET['delete_software'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Software $software_name deleted and removed all device/user license associations"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/tag.php b/user/post/tag.php index f74ac15d..abce81ea 100644 --- a/user/post/tag.php +++ b/user/post/tag.php @@ -19,6 +19,6 @@ if (isset($_POST['add_tag'])) { $_SESSION['alert_message'] = "Tag $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/task.php b/user/post/task.php index 373d99f2..6e72081d 100644 --- a/user/post/task.php +++ b/user/post/task.php @@ -27,7 +27,7 @@ if (isset($_POST['add_task'])) { $_SESSION['alert_message'] = "You created Task $task_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_task'])) { @@ -50,7 +50,7 @@ if (isset($_POST['edit_ticket_task'])) { $_SESSION['alert_message'] = "Task $task_name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_template_task'])) { @@ -69,7 +69,7 @@ if (isset($_POST['edit_ticket_template_task'])) { $_SESSION['alert_message'] = "Task $task_name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -96,7 +96,7 @@ if (isset($_GET['delete_task'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Task $task_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['complete_task'])) { @@ -128,7 +128,7 @@ if (isset($_GET['complete_task'])) { $_SESSION['alert_message'] = "Task $task_name Completed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['undo_complete_task'])) { @@ -157,7 +157,7 @@ if (isset($_GET['undo_complete_task'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Task $task_name marked as incomplete"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -184,7 +184,7 @@ if (isset($_GET['complete_all_tasks'])) { $_SESSION['alert_message'] = "Marked all tasks Complete"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['undo_complete_all_tasks'])) { @@ -210,5 +210,5 @@ if (isset($_GET['undo_complete_all_tasks'])) { $_SESSION['alert_message'] = "Marked all tasks Incomplete"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } \ No newline at end of file diff --git a/user/post/ticket.php b/user/post/ticket.php index b3c558e6..0e228ded 100644 --- a/user/post/ticket.php +++ b/user/post/ticket.php @@ -292,7 +292,7 @@ if (isset($_POST['edit_ticket'])) { $_SESSION['alert_message'] = "Ticket $ticket_prefix$ticket_number updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_priority'])) { @@ -329,7 +329,7 @@ if (isset($_POST['edit_ticket_priority'])) { $_SESSION['alert_message'] = "Priority updated from $original_priority to $priority"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_contact'])) { @@ -413,7 +413,7 @@ if (isset($_POST['edit_ticket_contact'])) { $_SESSION['alert_message'] = "Contact changed from $original_contact_name to $contact_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['add_ticket_watcher'])) { @@ -491,7 +491,7 @@ if (isset($_POST['add_ticket_watcher'])) { $_SESSION['alert_message'] = "Added watcher(s)"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_ticket_watcher'])) { @@ -526,7 +526,7 @@ if (isset($_GET['delete_ticket_watcher'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Removed ticket watcher $watcher_email"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_ticket_additional_asset'])) { @@ -561,7 +561,7 @@ if (isset($_GET['delete_ticket_additional_asset'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Removed asset $asset_name from ticket."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_asset'])) { @@ -592,7 +592,7 @@ if (isset($_POST['edit_ticket_asset'])) { $_SESSION['alert_message'] = "Ticket $ticket_prefix$ticket_number asset updated to $asset_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_vendor'])) { @@ -623,7 +623,7 @@ if (isset($_POST['edit_ticket_vendor'])) { $_SESSION['alert_message'] = "Set vendor to $vendor_name for ticket $ticket_prefix$ticket_number"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['assign_ticket'])) { @@ -656,7 +656,7 @@ if (isset($_POST['assign_ticket'])) { if (!$agent_name) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invalid agent!"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } } @@ -674,7 +674,7 @@ if (isset($_POST['assign_ticket'])) { if (!$ticket_subject) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invalid ticket!"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -724,7 +724,7 @@ if (isset($_POST['assign_ticket'])) { $_SESSION['alert_message'] = "Ticket $ticket_prefix$ticket_number assigned to $agent_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_ticket'])) { @@ -817,7 +817,7 @@ if (isset($_POST['bulk_delete_tickets'])) { $_SESSION['alert_message'] = "Deleted $count ticket(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_assign_ticket'])) { @@ -865,7 +865,7 @@ if (isset($_POST['bulk_assign_ticket'])) { if (!$agent_name) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Invalid agent!"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } } @@ -919,7 +919,7 @@ if (isset($_POST['bulk_assign_ticket'])) { $_SESSION['alert_message'] = "You assigned $ticket_count Tickets to $agent_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_edit_ticket_priority'])) { @@ -964,7 +964,7 @@ if (isset($_POST['bulk_edit_ticket_priority'])) { $_SESSION['alert_message'] = "You updated the priority for $ticket_count Tickets to $priority"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_edit_ticket_category'])) { @@ -1012,7 +1012,7 @@ if (isset($_POST['bulk_edit_ticket_category'])) { $_SESSION['alert_message'] = "Category set to $category_name for $ticket_count Tickets"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_merge_tickets'])) { @@ -1028,7 +1028,7 @@ if (isset($_POST['bulk_merge_tickets'])) { $sql = mysqli_query($mysqli, "SELECT ticket_id FROM tickets WHERE ticket_number = $merge_into_ticket_number"); if (mysqli_num_rows($sql) == 0) { $_SESSION['alert_message'] = "Cannot merge into that ticket."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } $merge_row = mysqli_fetch_array($sql); @@ -1076,7 +1076,7 @@ if (isset($_POST['bulk_merge_tickets'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1212,7 +1212,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { $_SESSION['alert_message'] .= " $skipped_count ticket(s) could not be resolved because they have open tasks."; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_ticket_reply'])) { @@ -1362,7 +1362,7 @@ if (isset($_POST['bulk_ticket_reply'])) { $_SESSION['alert_message'] = "Updated $ticket_count tickets"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1410,7 +1410,7 @@ if (isset($_POST['bulk_add_ticket_project'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_add_asset_ticket'])) { @@ -1528,7 +1528,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -1689,7 +1689,7 @@ if (isset($_POST['add_ticket_reply'])) { // Logging logAction("Ticket", "Reply", "$session_name replied to ticket $ticket_prefix$ticket_number - $ticket_subject and was a $ticket_reply_type reply", $client_id, $ticket_id); - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_reply'])) { @@ -1710,7 +1710,7 @@ if (isset($_POST['edit_ticket_reply'])) { $_SESSION['alert_message'] = "Ticket reply updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['redact_ticket_reply'])) { @@ -1729,7 +1729,7 @@ if (isset($_POST['redact_ticket_reply'])) { $_SESSION['alert_message'] = "Ticket reply redacted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_ticket_reply'])) { @@ -1746,7 +1746,7 @@ if (isset($_GET['archive_ticket_reply'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Ticket reply archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['merge_ticket'])) { @@ -1763,7 +1763,7 @@ if (isset($_POST['merge_ticket'])) { $sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_details FROM tickets WHERE ticket_id = $ticket_id"); if (mysqli_num_rows($sql) == 0) { $_SESSION['alert_message'] = "No ticket with that ID found."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } // CURRENT ticket details @@ -1778,7 +1778,7 @@ if (isset($_POST['merge_ticket'])) { $sql = mysqli_query($mysqli, "SELECT ticket_id FROM tickets WHERE ticket_number = $merge_into_ticket_number"); if (mysqli_num_rows($sql) == 0) { $_SESSION['alert_message'] = "Cannot merge into that ticket."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } $merge_row = mysqli_fetch_array($sql); @@ -1787,7 +1787,7 @@ if (isset($_POST['merge_ticket'])) { // Sanity check if ($ticket_number == $merge_into_ticket_number) { $_SESSION['alert_message'] = "Cannot merge into the same ticket."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -1811,7 +1811,7 @@ if (isset($_POST['merge_ticket'])) { $_SESSION['alert_message'] = "Ticket merged into $ticket_prefix$merge_into_ticket_number"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['change_client_ticket'])) { @@ -1835,7 +1835,7 @@ if (isset($_POST['change_client_ticket'])) { $_SESSION['alert_message'] = "Ticket client updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['resolve_ticket'])) { @@ -1930,7 +1930,7 @@ if (isset($_GET['resolve_ticket'])) { //End Mail IF $_SESSION['alert_message'] = "Ticket resolved"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['close_ticket'])) { @@ -2023,7 +2023,7 @@ if (isset($_GET['close_ticket'])) { //End Mail IF $_SESSION['alert_message'] = "Ticket Closed, this cannot not be reopened but you may start another one"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['reopen_ticket'])) { @@ -2040,7 +2040,7 @@ if (isset($_GET['reopen_ticket'])) { customAction('ticket_update', $ticket_id); $_SESSION['alert_message'] = "Ticket re-opened"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['add_invoice_from_ticket'])) { @@ -2220,7 +2220,7 @@ if (isset($_POST['add_recurring_ticket'])) { $_SESSION['alert_message'] = "Recurring ticket $subject - $frequency created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_recurring_ticket'])) { @@ -2248,7 +2248,7 @@ if (isset($_POST['edit_recurring_ticket'])) { $_SESSION['alert_message'] = "Recurring ticket $subject - $frequency updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['force_recurring_ticket'])) { @@ -2374,12 +2374,12 @@ if (isset($_GET['force_recurring_ticket'])) { $_SESSION['alert_message'] = "Recurring Ticket Forced"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Recurring Ticket Force failed"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } } @@ -2408,7 +2408,7 @@ if (isset($_GET['delete_recurring_ticket'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Recurring ticket $subject - $frequency deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_recurring_tickets'])) { @@ -2437,7 +2437,7 @@ if (isset($_POST['bulk_delete_recurring_tickets'])) { $_SESSION['alert_message'] = "Deleted $count recurring ticket(s)"; } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_billable_status'])) { @@ -2465,7 +2465,7 @@ if (isset($_POST['edit_ticket_billable_status'])) { $_SESSION['alert_message'] = "Ticket marked $billable_wording Billable"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_ticket_schedule'])) { @@ -2626,7 +2626,7 @@ if (isset($_POST['edit_ticket_schedule'])) { if (empty($conflicting_tickets)) { $_SESSION['alert_message'] = "Ticket scheduled for $email_datetime"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } else { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Ticket scheduled for $email_datetime. Yet there are conflicting tickets scheduled for the same time:
" . implode(",
", $conflicting_tickets); @@ -2778,5 +2778,5 @@ if (isset($_GET['cancel_ticket_schedule'])) { $_SESSION['alert_message'] = "Ticket schedule cancelled"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/transfer.php b/user/post/transfer.php index 5138f240..606d6ed7 100644 --- a/user/post/transfer.php +++ b/user/post/transfer.php @@ -38,7 +38,7 @@ if (isset($_POST['add_transfer'])) { $_SESSION['alert_message'] = "Transferred " . numfmt_format_currency($currency_format, $amount, $account_currency_code) . " from $source_account_name to $destination_account_name"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -64,7 +64,7 @@ if (isset($_POST['edit_transfer'])) { $_SESSION['alert_message'] = "Transfer edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -91,6 +91,6 @@ if (isset($_GET['delete_transfer'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Transfer deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/trip.php b/user/post/trip.php index ad78083e..87a549e8 100644 --- a/user/post/trip.php +++ b/user/post/trip.php @@ -20,7 +20,7 @@ if (isset($_POST['add_trip'])) { $_SESSION['alert_message'] = "Trip from $source to $destination logged"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -37,7 +37,7 @@ if (isset($_POST['edit_trip'])) { $_SESSION['alert_message'] = "Trip edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -59,7 +59,7 @@ if (isset($_GET['delete_trip'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Trip ($trip_source - $trip_destination) deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } diff --git a/user/post/vendor.php b/user/post/vendor.php index 64163f26..c943e4ec 100644 --- a/user/post/vendor.php +++ b/user/post/vendor.php @@ -41,7 +41,7 @@ if (isset($_POST['add_vendor_from_template'])) { $_SESSION['alert_message'] = "Vendor $name created from template"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -62,7 +62,7 @@ if (isset($_POST['add_vendor'])) { $_SESSION['alert_message'] = "Vendor $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['edit_vendor'])) { @@ -84,7 +84,7 @@ if (isset($_POST['edit_vendor'])) { $_SESSION['alert_message'] = "Vendor $name edited"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['archive_vendor'])) { @@ -104,7 +104,7 @@ if (isset($_GET['archive_vendor'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Vendor $vendor_name archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if(isset($_GET['unarchive_vendor'])){ @@ -124,7 +124,7 @@ if(isset($_GET['unarchive_vendor'])){ $_SESSION['alert_message'] = "Vendor $vendor_name restored"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_GET['delete_vendor'])) { @@ -150,7 +150,7 @@ if (isset($_GET['delete_vendor'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Vendor $vendor_name deleted"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_archive_vendors'])) { @@ -187,7 +187,7 @@ if (isset($_POST['bulk_archive_vendors'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_vendors'])) { @@ -224,7 +224,7 @@ if (isset($_POST['bulk_unarchive_vendors'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_vendors'])) { @@ -268,7 +268,7 @@ if (isset($_POST['bulk_delete_vendors'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['export_vendors_csv'])) { diff --git a/user/post/vendor_contact.php b/user/post/vendor_contact.php index 63dd75ec..d386b945 100644 --- a/user/post/vendor_contact.php +++ b/user/post/vendor_contact.php @@ -23,7 +23,7 @@ if (isset($_POST['add_vendor_contact'])) { $_SESSION['alert_message'] = "Vendor Contact $name created"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -44,7 +44,7 @@ if (isset($_POST['edit_vendor_contact'])) { $_SESSION['alert_message'] = "Vendor Contact $name updated"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -79,7 +79,7 @@ if (isset($_POST['bulk_archive_vendor_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_unarchive_vendor_contacts'])) { @@ -123,7 +123,7 @@ if (isset($_POST['bulk_unarchive_vendor_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } if (isset($_POST['bulk_delete_vendor_contacts'])) { @@ -175,7 +175,7 @@ if (isset($_POST['bulk_delete_vendor_contacts'])) { } - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -206,7 +206,7 @@ if (isset($_GET['archive_vendor_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name has been archived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -235,7 +235,7 @@ if (isset($_GET['unarchive_vendor_contact'])) { $_SESSION['alert_message'] = "Contact $contact_name has been Unarchived"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -273,7 +273,7 @@ if (isset($_GET['delete_vendor_contact'])) { $_SESSION['alert_type'] = "error"; $_SESSION['alert_message'] = "Contact $contact_name has been deleted."; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } @@ -342,7 +342,7 @@ if (isset($_POST["import_vendor_contacts_csv"])) { } else { $_SESSION['alert_message'] = "Please select a file to upload."; $_SESSION['alert_type'] = "error"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); exit(); } @@ -424,12 +424,12 @@ if (isset($_POST["import_vendor_contacts_csv"])) { logAction("Contact", "Import", "$session_name imported $row_count contact(s) via CSV file", $client_id); $_SESSION['alert_message'] = "$row_count Contact(s) added, $duplicate_count duplicate(s) detected"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } //Check for any errors, if there are notify user and redirect if ($error) { $_SESSION['alert_type'] = "warning"; - header("Location: " . $_SERVER["HTTP_REFERER"]); + redirect(); } }