Rename Functions: flash_alert, sanitizeFilename and display_folder_options using camelCase instead to match other custom php functions

This commit is contained in:
johnnyq
2026-07-14 17:41:41 -04:00
parent f1836c70cd
commit b8873039a4
82 changed files with 603 additions and 603 deletions

View File

@@ -7,7 +7,7 @@ require_once "../includes/check_login.php";
$settings_mail_path = '/admin/settings_mail.php'; $settings_mail_path = '/admin/settings_mail.php';
if (!isset($session_is_admin) || !$session_is_admin) { if (!isset($session_is_admin) || !$session_is_admin) {
flash_alert("Admin access required.", 'error'); flashAlert("Admin access required.", 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
@@ -27,17 +27,17 @@ if (!empty($error)) {
$msg .= " ($error_description)"; $msg .= " ($error_description)";
} }
flash_alert($msg, 'error'); flashAlert($msg, 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
if (empty($state) || empty($code) || empty($session_state) || !hash_equals($session_state, $state) || time() > $session_state_expires) { if (empty($state) || empty($code) || empty($session_state) || !hash_equals($session_state, $state) || time() > $session_state_expires) {
flash_alert("Microsoft OAuth callback validation failed. Please try connecting again.", 'error'); flashAlert("Microsoft OAuth callback validation failed. Please try connecting again.", 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) { if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) {
flash_alert("Microsoft OAuth settings are incomplete. Please fill Client ID, Client Secret, and Tenant ID.", 'error'); flashAlert("Microsoft OAuth settings are incomplete. Please fill Client ID, Client Secret, and Tenant ID.", 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
@@ -71,13 +71,13 @@ curl_close($ch);
if ($raw_body === false || $http_code < 200 || $http_code >= 300) { if ($raw_body === false || $http_code < 200 || $http_code >= 300) {
$reason = !empty($curl_err) ? $curl_err : "HTTP $http_code"; $reason = !empty($curl_err) ? $curl_err : "HTTP $http_code";
flash_alert("Microsoft OAuth token exchange failed: $reason", 'error'); flashAlert("Microsoft OAuth token exchange failed: $reason", 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
$json = json_decode($raw_body, true); $json = json_decode($raw_body, true);
if (!is_array($json) || empty($json['refresh_token']) || empty($json['access_token'])) { if (!is_array($json) || empty($json['refresh_token']) || empty($json['access_token'])) {
flash_alert("Microsoft OAuth token exchange failed: refresh token or access token missing.", 'error'); flashAlert("Microsoft OAuth token exchange failed: refresh token or access token missing.", 'error');
redirect($settings_mail_path); redirect($settings_mail_path);
} }
@@ -99,5 +99,5 @@ mysqli_query($mysqli, "UPDATE settings SET
"); ");
logAudit("Settings", "Edit", "$session_name completed Microsoft OAuth connect flow for mail settings"); logAudit("Settings", "Edit", "$session_name completed Microsoft OAuth connect flow for mail settings");
flash_alert("Microsoft OAuth connected successfully. Token expires at $expires_at."); flashAlert("Microsoft OAuth connected successfully. Token expires at $expires_at.");
redirect($settings_mail_path); redirect($settings_mail_path);

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_ai_model'])) {
logAudit("AI Model", "Create", "$session_name created AI Model $model"); logAudit("AI Model", "Create", "$session_name created AI Model $model");
flash_alert("AI Model <strong>$model</strong> created"); flashAlert("AI Model <strong>$model</strong> created");
redirect(); redirect();
@@ -40,7 +40,7 @@ if (isset($_POST['edit_ai_model'])) {
logAudit("AI Model", "Edit", "$session_name edited AI Model $model"); logAudit("AI Model", "Edit", "$session_name edited AI Model $model");
flash_alert("AI Model <strong>$model</strong> edited"); flashAlert("AI Model <strong>$model</strong> edited");
redirect(); redirect();
@@ -58,7 +58,7 @@ if (isset($_GET['delete_ai_model'])) {
logAudit("AI Model", "Delete", "$session_name deleted AI Model $model_name"); logAudit("AI Model", "Delete", "$session_name deleted AI Model $model_name");
flash_alert("AI Model <strong>$model_name</strong> deleted", 'error'); flashAlert("AI Model <strong>$model_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_ai_provider'])) {
logAudit("AI Provider", "Create", "$session_name created AI Provider $provider"); logAudit("AI Provider", "Create", "$session_name created AI Provider $provider");
flash_alert("AI Model <strong>$provider</strong> created"); flashAlert("AI Model <strong>$provider</strong> created");
redirect(); redirect();
@@ -40,7 +40,7 @@ if (isset($_POST['edit_ai_provider'])) {
logAudit("AI Provider", "Edit", "$session_name edited AI Provider $provider"); logAudit("AI Provider", "Edit", "$session_name edited AI Provider $provider");
flash_alert("AI Model <strong>$provider</strong> edited"); flashAlert("AI Model <strong>$provider</strong> edited");
redirect(); redirect();
@@ -58,7 +58,7 @@ if (isset($_GET['delete_ai_provider'])) {
logAudit("AI Provider", "Delete", "$session_name deleted AI Provider $provider_name", 'error'); logAudit("AI Provider", "Delete", "$session_name deleted AI Provider $provider_name", 'error');
flash_alert("AI Provider <strong>$provider_name</strong> deleted", 'error'); flashAlert("AI Provider <strong>$provider_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -25,7 +25,7 @@ if (isset($_POST['add_api_key'])) {
logAudit("API Key", "Create", "$session_name created API key $name set to expire on $expire", $client_id, $api_key_id); logAudit("API Key", "Create", "$session_name created API key $name set to expire on $expire", $client_id, $api_key_id);
flash_alert("API Key <strong>$name</strong> created"); flashAlert("API Key <strong>$name</strong> created");
redirect(); redirect();
@@ -46,7 +46,7 @@ if (isset($_GET['revoke_api_key'])) {
logAudit("API Key", "Revoke", "$session_name revoked API key $name", $client_id); logAudit("API Key", "Revoke", "$session_name revoked API key $name", $client_id);
flash_alert("API Key <strong>$name</strong> revoked", 'error'); flashAlert("API Key <strong>$name</strong> revoked", 'error');
redirect(); redirect();
@@ -67,7 +67,7 @@ if (isset($_GET['delete_api_key'])) {
logAudit("API Key", "Delete", "$session_name deleted API key $name", $client_id); logAudit("API Key", "Delete", "$session_name deleted API key $name", $client_id);
flash_alert("API Key <strong>$name</strong> deleted", 'error'); flashAlert("API Key <strong>$name</strong> deleted", 'error');
redirect(); redirect();
@@ -99,7 +99,7 @@ if (isset($_POST['bulk_delete_api_keys'])) {
logAudit("API Key", "Bulk Delete", "$session_name deleted $count API key(s)"); logAudit("API Key", "Bulk Delete", "$session_name deleted $count API key(s)");
flash_alert("Deleted <strong>$count</strong> API keys(s)", 'error'); flashAlert("Deleted <strong>$count</strong> API keys(s)", 'error');
} }

View File

@@ -296,7 +296,7 @@ if (isset($_GET['download_backup'])) {
// Log + UX // Log + UX
logAudit("System", "Backup Download", ($session_name ?? 'Unknown User') . " downloaded full backup."); logAudit("System", "Backup Download", ($session_name ?? 'Unknown User') . " downloaded full backup.");
flash_alert("Full backup downloaded."); flashAlert("Full backup downloaded.");
exit; exit;
} }
@@ -324,7 +324,7 @@ if (isset($_POST['backup_master_key'])) {
} else { } else {
logAudit("Master Key", "Download", "$session_name attempted to retrieve the master encryption key but failed"); logAudit("Master Key", "Download", "$session_name attempted to retrieve the master encryption key but failed");
flash_alert("Incorrect password.", 'error'); flashAlert("Incorrect password.", 'error');
redirect(); redirect();
} }

View File

@@ -18,7 +18,7 @@ if (isset($_POST['add_category'])) {
logAudit("Category", "Create", "$session_name created category $type $name", 0, $category_id); logAudit("Category", "Create", "$session_name created category $type $name", 0, $category_id);
flash_alert("Category $type <strong>$name</strong> created"); flashAlert("Category $type <strong>$name</strong> created");
redirect(); redirect();
@@ -36,7 +36,7 @@ if (isset($_POST['edit_category'])) {
logAudit("Category", "Edit", "$session_name edited category $type $name", 0, $category_id); logAudit("Category", "Edit", "$session_name edited category $type $name", 0, $category_id);
flash_alert("Category $type <strong>$name</strong> edited"); flashAlert("Category $type <strong>$name</strong> edited");
redirect(); redirect();
@@ -58,7 +58,7 @@ if (isset($_GET['archive_category'])) {
logAudit("Category", "Archive", "$session_name archived category $category_type $category_name", 0, $category_id); logAudit("Category", "Archive", "$session_name archived category $category_type $category_name", 0, $category_id);
flash_alert("Category $category_type <strong>$category_name</strong> archived", 'error'); flashAlert("Category $category_type <strong>$category_name</strong> archived", 'error');
redirect(); redirect();
@@ -80,7 +80,7 @@ if (isset($_GET['restore_category'])) {
logAudit("Category", "Restore", "$session_name retored category $category_type $category_name", 0, $category_id); logAudit("Category", "Restore", "$session_name retored category $category_type $category_name", 0, $category_id);
flash_alert("Category $category_type <strong>$category_name</strong> restored"); flashAlert("Category $category_type <strong>$category_name</strong> restored");
redirect(); redirect();
@@ -102,7 +102,7 @@ if (isset($_GET['delete_category'])) {
logAudit("Category", "Delete", "$session_name deleted category $category_type $category_name"); logAudit("Category", "Delete", "$session_name deleted category $category_type $category_name");
flash_alert("Category $category_type <strong>$category_name</strong> deleted", 'error'); flashAlert("Category $category_type <strong>$category_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -53,7 +53,7 @@ if (isset($_POST['add_contract_template'])) {
logAudit("Contract Template", "Create", "$session_name created contract template $name", 0, $contract_template_id); logAudit("Contract Template", "Create", "$session_name created contract template $name", 0, $contract_template_id);
// Flash message // Flash message
flash_alert("Contract Template <strong>$name</strong> created"); flashAlert("Contract Template <strong>$name</strong> created");
// Redirect back // Redirect back
redirect(); redirect();
@@ -102,7 +102,7 @@ if (isset($_POST['edit_contract_template'])) {
logAudit("Contract Template", "Update", "$session_name updated contract template $name", 0, $contract_template_id); logAudit("Contract Template", "Update", "$session_name updated contract template $name", 0, $contract_template_id);
// Flash + redirect // Flash + redirect
flash_alert("Contract Template <strong>$name</strong> updated"); flashAlert("Contract Template <strong>$name</strong> updated");
redirect(); redirect();
} }
@@ -118,7 +118,7 @@ if (isset($_GET['archive_contract_template'])) {
"); ");
logAudit("Contract Template", "Archive", "$session_name archived contract template $name", 0, $contract_template_id); logAudit("Contract Template", "Archive", "$session_name archived contract template $name", 0, $contract_template_id);
flash_alert("Contract Template <strong>$name</strong> archived", "danger"); flashAlert("Contract Template <strong>$name</strong> archived", "danger");
redirect(); redirect();
} }
@@ -134,7 +134,7 @@ if (isset($_GET['restore_contract_template'])) {
"); ");
logAudit("Contract Template", "Restore", "$session_name restored contract template $name", 0, $contract_template_id); logAudit("Contract Template", "Restore", "$session_name restored contract template $name", 0, $contract_template_id);
flash_alert("Contract Template <strong>$name</strong> restored"); flashAlert("Contract Template <strong>$name</strong> restored");
redirect(); redirect();
} }
@@ -150,7 +150,7 @@ if (isset($_GET['delete_contract_template'])) {
"); ");
logAudit("Contract Template", "Delete", "$session_name deleted contract template $name", 0, $contract_template_id); logAudit("Contract Template", "Delete", "$session_name deleted contract template $name", 0, $contract_template_id);
flash_alert("Contract Template <strong>$name</strong> deleted", "danger"); flashAlert("Contract Template <strong>$name</strong> deleted", "danger");
redirect(); redirect();
} }

View File

@@ -18,7 +18,7 @@ if(isset($_POST['create_custom_field'])){
logAudit("Custom Field", "Create", "$session_name created custom field $label", 0, $custom_field_id); logAudit("Custom Field", "Create", "$session_name created custom field $label", 0, $custom_field_id);
flash_alert("Custom field <strong>$label</strong> created"); flashAlert("Custom field <strong>$label</strong> created");
redirect(); redirect();
@@ -34,7 +34,7 @@ if(isset($_POST['edit_custom_field'])){
logAudit("Custom Field", "Edit", "$session_name edited custom field $label", 0, $custom_field_id); logAudit("Custom Field", "Edit", "$session_name edited custom field $label", 0, $custom_field_id);
flash_alert("Custom field <strong>$label</strong> edited"); flashAlert("Custom field <strong>$label</strong> edited");
redirect(); redirect();
@@ -50,7 +50,7 @@ if(isset($_GET['delete_custom_field'])){
logAudit("Custom Field", "Delete", "$session_name deleted custom field $label"); logAudit("Custom Field", "Delete", "$session_name deleted custom field $label");
flash_alert("Custom field <strong>$label</strong> deleted", 'error'); flashAlert("Custom field <strong>$label</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -23,7 +23,7 @@ if (isset($_POST['add_custom_link'])) {
logAudit("Custom Link", "Create", "$session_name created custom link $name -> $uri", 0, $custom_link_id); logAudit("Custom Link", "Create", "$session_name created custom link $name -> $uri", 0, $custom_link_id);
flash_alert("Custom link <strong>$name</strong> created"); flashAlert("Custom link <strong>$name</strong> created");
redirect(); redirect();
@@ -45,7 +45,7 @@ if (isset($_POST['edit_custom_link'])) {
logAudit("Custom Link", "Edit", "$session_name edited custom link $name -> $uri", 0, $custom_link_id); logAudit("Custom Link", "Edit", "$session_name edited custom link $name -> $uri", 0, $custom_link_id);
flash_alert("Custom Link <strong>$name</strong> edited"); flashAlert("Custom Link <strong>$name</strong> edited");
redirect(); redirect();
@@ -67,7 +67,7 @@ if (isset($_GET['delete_custom_link'])) {
logAudit("Custom Link", "Delete", "$session_name deleted custom link $custom_link_name -> $custom_link_uri"); logAudit("Custom Link", "Delete", "$session_name deleted custom link $custom_link_name -> $custom_link_uri");
flash_alert("Custom Link <strong>$name</strong> deleted", 'error'); flashAlert("Custom Link <strong>$name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -30,7 +30,7 @@ if (isset($_POST['add_document_template'])) {
logAudit("Document Template", "Create", "$session_name created document template $name", 0, $document_template_id); logAudit("Document Template", "Create", "$session_name created document template $name", 0, $document_template_id);
flash_alert("Document template <strong>$name</strong> created"); flashAlert("Document template <strong>$name</strong> created");
redirect(); redirect();
@@ -65,7 +65,7 @@ if (isset($_POST['edit_document_template'])) {
logAudit("Document Template", "Edit", "$session_name edited document template $name", 0, $document_template_id); logAudit("Document Template", "Edit", "$session_name edited document template $name", 0, $document_template_id);
flash_alert("Document Template <strong>$name</strong> edited"); flashAlert("Document Template <strong>$name</strong> edited");
redirect(); redirect();
@@ -86,7 +86,7 @@ if (isset($_GET['delete_document_template'])) {
logAudit("Document Template", "Delete", "$session_name deleted document template $document_template_name"); logAudit("Document Template", "Delete", "$session_name deleted document template $document_template_name");
flash_alert("Document Template <strong>$document_template_name</strong> deleted", 'error'); flashAlert("Document Template <strong>$document_template_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -13,7 +13,7 @@ if (isset($_POST['edit_identity_provider'])) {
logAudit("Settings", "Edit", "$session_name edited identity provider settings"); logAudit("Settings", "Edit", "$session_name edited identity provider settings");
flash_alert("Identity Provider Settings updated"); flashAlert("Identity Provider Settings updated");
redirect(); redirect();

View File

@@ -12,7 +12,7 @@ if (isset($_GET['send_failed_mail'])) {
logAudit("Email", "Send", "$session_name attempted to force send email id: $email_id in the mail queue", 0, $email_id); logAudit("Email", "Send", "$session_name attempted to force send email id: $email_id in the mail queue", 0, $email_id);
flash_alert("Email Force Sent, give it a minute to resend"); flashAlert("Email Force Sent, give it a minute to resend");
redirect(); redirect();
@@ -28,7 +28,7 @@ if (isset($_GET['cancel_mail'])) {
logAudit("Email", "Send", "$session_name canceled send email id: $email_id in the mail queue", 0, $email_id); logAudit("Email", "Send", "$session_name canceled send email id: $email_id in the mail queue", 0, $email_id);
flash_alert("Email cancelled and marked as failed.", 'error'); flashAlert("Email cancelled and marked as failed.", 'error');
redirect(); redirect();
@@ -54,7 +54,7 @@ if (isset($_POST['bulk_cancel_emails'])) {
logAudit("Email", "Bulk Cancel", "$session_name cancelled $count email(s) in the mail queue"); logAudit("Email", "Bulk Cancel", "$session_name cancelled $count email(s) in the mail queue");
flash_alert("Cancelled <strong>$count</strong> email(s)", 'error'); flashAlert("Cancelled <strong>$count</strong> email(s)", 'error');
} }
@@ -82,7 +82,7 @@ if (isset($_POST['bulk_delete_emails'])) {
logAudit("Email", "Bulk Delete", "$session_name deleted $count email(s) from the mail queue"); logAudit("Email", "Bulk Delete", "$session_name deleted $count email(s) from the mail queue");
flash_alert("Deleted <strong>$count</strong> email(s)", 'error'); flashAlert("Deleted <strong>$count</strong> email(s)", 'error');
} }

View File

@@ -24,7 +24,7 @@ if (isset($_POST['add_payment_method'])) {
logAudit("Payment Method", "Create", "$session_name created Payment Method $name"); logAudit("Payment Method", "Create", "$session_name created Payment Method $name");
flash_alert("Payment Method <strong>$name</strong> created"); flashAlert("Payment Method <strong>$name</strong> created");
redirect(); redirect();
@@ -51,7 +51,7 @@ if (isset($_POST['edit_payment_method'])) {
logAudit("Payment Method", "Edit", "$session_name edited Payment Method $name"); logAudit("Payment Method", "Edit", "$session_name edited Payment Method $name");
flash_alert("Payment Method <strong>$name</strong> edited"); flashAlert("Payment Method <strong>$name</strong> edited");
redirect(); redirect();
@@ -69,7 +69,7 @@ if (isset($_GET['delete_payment_method'])) {
logAudit("Payment Method", "Delete", "$session_name deleted Payment Method $payment_method_name"); logAudit("Payment Method", "Delete", "$session_name deleted Payment Method $payment_method_name");
flash_alert("Payment Method <strong>$payment_method_name</strong> deleted", 'error'); flashAlert("Payment Method <strong>$payment_method_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -23,7 +23,7 @@ if (isset($_POST['add_payment_provider'])) {
// Check to ensure provider isn't added twice // Check to ensure provider isn't added twice
$sql = mysqli_query($mysqli, "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1"); $sql = mysqli_query($mysqli, "SELECT 1 FROM payment_providers WHERE payment_provider_name = '$provider' LIMIT 1");
if (mysqli_num_rows($sql) > 0) { if (mysqli_num_rows($sql) > 0) {
flash_alert("Payment Provider <strong>$provider</strong> already exists", 'error'); flashAlert("Payment Provider <strong>$provider</strong> already exists", 'error');
redirect(); redirect();
} }
@@ -33,7 +33,7 @@ if (isset($_POST['add_payment_provider'])) {
logAudit("Payment Provider", "Create", "$session_name created AI Provider $provider"); logAudit("Payment Provider", "Create", "$session_name created AI Provider $provider");
flash_alert("Payment provider <strong>$provider</strong> created"); flashAlert("Payment provider <strong>$provider</strong> created");
redirect(); redirect();
@@ -58,7 +58,7 @@ if (isset($_POST['edit_payment_provider'])) {
logAudit("Payment Provider", "Edit", "$session_name edited Payment Provider $provider"); logAudit("Payment Provider", "Edit", "$session_name edited Payment Provider $provider");
flash_alert("Payment Provider <strong>$provider</strong> edited"); flashAlert("Payment Provider <strong>$provider</strong> edited");
redirect(); redirect();
@@ -82,7 +82,7 @@ if (isset($_GET['delete_payment_provider'])) {
logAudit("Payment Provider", "Delete", "$session_name deleted Payment Provider $provider_name"); logAudit("Payment Provider", "Delete", "$session_name deleted Payment Provider $provider_name");
flash_alert("Payment Provider <strong>$provider_name</strong> deleted", 'error'); flashAlert("Payment Provider <strong>$provider_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -15,7 +15,7 @@ if (isset($_POST['add_project_template'])) {
logAudit("Project Template", "Create", "$session_name created project template $name", 0, $project_template_id); logAudit("Project Template", "Create", "$session_name created project template $name", 0, $project_template_id);
flash_alert("Project Template <strong>$name</strong> created"); flashAlert("Project Template <strong>$name</strong> created");
redirect(); redirect();
@@ -33,7 +33,7 @@ if (isset($_POST['edit_project_template'])) {
logAudit("Project Template", "Edit", "$session_name edited project template $name", 0, $project_template_id); logAudit("Project Template", "Edit", "$session_name edited project template $name", 0, $project_template_id);
flash_alert("Project Template <strong>$name</strong> edited"); flashAlert("Project Template <strong>$name</strong> edited");
redirect(); redirect();
@@ -65,7 +65,7 @@ if (isset($_POST['add_ticket_template_to_project_template'])) {
logAudit("Project Template", "Edit", "$session_name added ticket template to project_template", 0, $project_template_id); logAudit("Project Template", "Edit", "$session_name added ticket template to project_template", 0, $project_template_id);
flash_alert("Ticket template added"); flashAlert("Ticket template added");
redirect(); redirect();
@@ -82,7 +82,7 @@ if (isset($_POST['remove_ticket_template_from_project_template'])) {
logAudit("Project Template", "Edit", "$session_name removed ticket template from project template", 0, $project_template_id); logAudit("Project Template", "Edit", "$session_name removed ticket template from project template", 0, $project_template_id);
flash_alert("Ticket template removed", 'error'); flashAlert("Ticket template removed", 'error');
redirect(); redirect();
@@ -103,7 +103,7 @@ if (isset($_GET['delete_project_template'])) {
logAudit("Project Template", "Delete", "$session_name deleted project template $project_template_name and its associated ticket templates and tasks"); logAudit("Project Template", "Delete", "$session_name deleted project template $project_template_name and its associated ticket templates and tasks");
flash_alert("Project Template <strong>$project_template_name</strong> and its associated ticket templates and tasks deleted", 'error'); flashAlert("Project Template <strong>$project_template_name</strong> and its associated ticket templates and tasks deleted", 'error');
redirect(); redirect();

View File

@@ -34,7 +34,7 @@ if (isset($_POST['add_role'])) {
logAudit("User Role", "Create", "$session_name created user role $name", 0, $role_id); logAudit("User Role", "Create", "$session_name created user role $name", 0, $role_id);
flash_alert("User Role <strong>$name</strong> created"); flashAlert("User Role <strong>$name</strong> created");
redirect(); redirect();
@@ -67,7 +67,7 @@ if (isset($_POST['edit_role'])) {
logAudit("User Role", "Edit", "$session_name edited user role $name", 0, $role_id); logAudit("User Role", "Edit", "$session_name edited user role $name", 0, $role_id);
flash_alert("User Role <strong>$name</strong> edited"); flashAlert("User Role <strong>$name</strong> edited");
redirect(); redirect();
@@ -83,7 +83,7 @@ if (isset($_GET['archive_role'])) {
$sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL"); $sql_role_user_count = mysqli_query($mysqli, "SELECT COUNT(user_id) FROM users WHERE user_role_id = $role_id AND user_archived_at IS NULL");
$role_user_count = mysqli_fetch_row($sql_role_user_count)[0]; $role_user_count = mysqli_fetch_row($sql_role_user_count)[0];
if ($role_user_count != 0) { if ($role_user_count != 0) {
flash_alert("Role must not in use to archive it", 'error'); flashAlert("Role must not in use to archive it", 'error');
redirect(); redirect();
} }
@@ -94,7 +94,7 @@ if (isset($_GET['archive_role'])) {
logAudit("User Role", "Archive", "$session_name archived user role $role_name", 0, $role_id); logAudit("User Role", "Archive", "$session_name archived user role $role_name", 0, $role_id);
flash_alert("User Role <strong>$role_name</strong> archived", 'error'); flashAlert("User Role <strong>$role_name</strong> archived", 'error');
redirect(); redirect();

View File

@@ -63,7 +63,7 @@ if (isset($_GET['delete_saved_payment'])) {
logAudit("Payment Provider", "Update", "$session_name deleted saved payment method $saved_payment_description (PM: $payment_method)", $client_id); logAudit("Payment Provider", "Update", "$session_name deleted saved payment method $saved_payment_description (PM: $payment_method)", $client_id);
flash_alert("Payment method <strong>$saved_payment_description</strong> removed", 'error'); flashAlert("Payment method <strong>$saved_payment_description</strong> removed", 'error');
redirect(); redirect();

View File

@@ -20,7 +20,7 @@ if (isset($_POST['edit_ai_settings'])) {
logAudit("Settings", "Edit", "$session_name edited AI settings"); logAudit("Settings", "Edit", "$session_name edited AI settings");
flash_alert("AI Settings updated"); flashAlert("AI Settings updated");
redirect(); redirect();

View File

@@ -46,7 +46,7 @@ if (isset($_POST['edit_company'])) {
logAudit("Settings", "Edit", "$session_name edited company details"); logAudit("Settings", "Edit", "$session_name edited company details");
flash_alert("Company <strong>$name</strong> edited"); flashAlert("Company <strong>$name</strong> edited");
redirect(); redirect();
@@ -66,7 +66,7 @@ if (isset($_GET['remove_company_logo'])) {
logAudit("Settings", "Edit", "$session_name deleted company logo"); logAudit("Settings", "Edit", "$session_name deleted company logo");
flash_alert("Removed company logo", 'error'); flashAlert("Removed company logo", 'error');
redirect(); redirect();

View File

@@ -21,7 +21,7 @@ if (isset($_POST['edit_default_settings'])) {
logAudit("Settings", "Edit", "$session_name edited default settings"); logAudit("Settings", "Edit", "$session_name edited default settings");
flash_alert("Default settings edited"); flashAlert("Default settings edited");
redirect(); redirect();

View File

@@ -23,7 +23,7 @@ if (isset($_POST['edit_invoice_settings'])) {
logAudit("Settings", "Edit", "$session_name edited invoice settings"); logAudit("Settings", "Edit", "$session_name edited invoice settings");
flash_alert("Invoice Settings edited"); flashAlert("Invoice Settings edited");
redirect(); redirect();

View File

@@ -16,7 +16,7 @@ if (isset($_POST['edit_localization'])) {
logAudit("Settings", "Edit", "$session_name edited localization settings"); logAudit("Settings", "Edit", "$session_name edited localization settings");
flash_alert("Company localization updated"); flashAlert("Company localization updated");
redirect(); redirect();

View File

@@ -29,12 +29,12 @@ if (isset($_POST['oauth_connect_microsoft_mail'])) {
// Check the SAVED providers (loaded from config at bootstrap), not $_POST — // Check the SAVED providers (loaded from config at bootstrap), not $_POST —
// the provider dropdowns live in different forms and are never posted here // the provider dropdowns live in different forms and are never posted here
if ($config_imap_provider !== 'microsoft_oauth' && $config_smtp_provider !== 'microsoft_oauth') { if ($config_imap_provider !== 'microsoft_oauth' && $config_smtp_provider !== 'microsoft_oauth') {
flash_alert("Please set the SMTP or IMAP Provider to Microsoft 365 (OAuth) and save it before connecting.", 'error'); flashAlert("Please set the SMTP or IMAP Provider to Microsoft 365 (OAuth) and save it before connecting.", 'error');
redirect(); redirect();
} }
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) { if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_tenant_id)) {
flash_alert("Missing Microsoft OAuth settings. Please provide Client ID, Client Secret, and Tenant ID first.", 'error'); flashAlert("Missing Microsoft OAuth settings. Please provide Client ID, Client Secret, and Tenant ID first.", 'error');
redirect(); redirect();
} }
@@ -97,7 +97,7 @@ if (isset($_POST['edit_mail_smtp_settings'])) {
logAudit("Settings", "Edit", "$session_name edited SMTP settings"); logAudit("Settings", "Edit", "$session_name edited SMTP settings");
flash_alert("SMTP Mail Settings updated"); flashAlert("SMTP Mail Settings updated");
redirect(); redirect();
@@ -127,7 +127,7 @@ if (isset($_POST['edit_mail_imap_settings'])) {
logAudit("Settings", "Edit", "$session_name edited IMAP settings"); logAudit("Settings", "Edit", "$session_name edited IMAP settings");
flash_alert("IMAP Mail Settings updated"); flashAlert("IMAP Mail Settings updated");
redirect(); redirect();
@@ -153,7 +153,7 @@ if (isset($_POST['edit_mail_oauth_settings'])) {
"); ");
logAudit("Settings", "Edit", "$session_name edited mail OAuth settings"); logAudit("Settings", "Edit", "$session_name edited mail OAuth settings");
flash_alert("Mail OAuth Settings updated"); flashAlert("Mail OAuth Settings updated");
redirect(); redirect();
} }
@@ -177,7 +177,7 @@ if (isset($_POST['edit_mail_from_settings'])) {
logAudit("Settings", "Edit", "$session_name edited mail from settings"); logAudit("Settings", "Edit", "$session_name edited mail from settings");
flash_alert("Mail From Settings updated"); flashAlert("Mail From Settings updated");
redirect(); redirect();
@@ -221,9 +221,9 @@ if (isset($_POST['test_email_smtp'])) {
$mail = addToMailQueue($data); $mail = addToMailQueue($data);
if ($mail === true) { if ($mail === true) {
flash_alert("Test email queued! <a class='text-bold text-light' href='mail_queue.php'>Check Admin > Mail queue</a>"); flashAlert("Test email queued! <a class='text-bold text-light' href='mail_queue.php'>Check Admin > Mail queue</a>");
} else { } else {
flash_alert("Failed to add test mail to queue", 'error'); flashAlert("Failed to add test mail to queue", 'error');
} }
redirect(); redirect();
@@ -275,7 +275,7 @@ if (isset($_POST['test_email_imap'])) {
} }
if (empty($host) || empty($port) || empty($username)) { if (empty($host) || empty($port) || empty($username)) {
flash_alert("<strong>IMAP connection failed:</strong> Missing host, port, or username.", 'error'); flashAlert("<strong>IMAP connection failed:</strong> Missing host, port, or username.", 'error');
redirect(); redirect();
} }
@@ -319,7 +319,7 @@ if (isset($_POST['test_email_imap'])) {
$password = $config_mail_oauth_access_token; $password = $config_mail_oauth_access_token;
} else { } else {
if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_refresh_token)) { if (empty($config_mail_oauth_client_id) || empty($config_mail_oauth_client_secret) || empty($config_mail_oauth_refresh_token)) {
flash_alert("<strong>IMAP OAuth failed:</strong> Missing OAuth client credentials or refresh token.", 'error'); flashAlert("<strong>IMAP OAuth failed:</strong> Missing OAuth client credentials or refresh token.", 'error');
redirect(); redirect();
} }
@@ -332,7 +332,7 @@ if (isset($_POST['test_email_imap'])) {
]); ]);
} else { } else {
if (empty($config_mail_oauth_tenant_id)) { if (empty($config_mail_oauth_tenant_id)) {
flash_alert("<strong>IMAP OAuth failed:</strong> Microsoft tenant ID is required.", 'error'); flashAlert("<strong>IMAP OAuth failed:</strong> Microsoft tenant ID is required.", 'error');
redirect(); redirect();
} }
@@ -346,13 +346,13 @@ if (isset($_POST['test_email_imap'])) {
} }
if (!$response['ok']) { if (!$response['ok']) {
flash_alert("<strong>IMAP OAuth failed:</strong> Could not refresh access token.", 'error'); flashAlert("<strong>IMAP OAuth failed:</strong> Could not refresh access token.", 'error');
redirect(); redirect();
} }
$json = json_decode($response['body'], true); $json = json_decode($response['body'], true);
if (!is_array($json) || empty($json['access_token'])) { if (!is_array($json) || empty($json['access_token'])) {
flash_alert("<strong>IMAP OAuth failed:</strong> Token response did not include an access token.", 'error'); flashAlert("<strong>IMAP OAuth failed:</strong> Token response did not include an access token.", 'error');
redirect(); redirect();
} }
@@ -476,9 +476,9 @@ if (isset($_POST['test_email_imap'])) {
if ($success) { if ($success) {
if ($is_oauth) { if ($is_oauth) {
flash_alert("Connected successfully using OAuth"); flashAlert("Connected successfully using OAuth");
} else { } else {
flash_alert("Connected successfully"); flashAlert("Connected successfully");
} }
} else { } else {
if (!$error_line) { if (!$error_line) {
@@ -488,7 +488,7 @@ if (isset($_POST['test_email_imap'])) {
} }
} catch (Exception $e) { } catch (Exception $e) {
flash_alert("<strong>IMAP connection failed:</strong> " . htmlspecialchars($e->getMessage()), 'error'); flashAlert("<strong>IMAP connection failed:</strong> " . htmlspecialchars($e->getMessage()), 'error');
} }
redirect(); redirect();
@@ -502,7 +502,7 @@ if (isset($_POST['test_oauth_token_refresh'])) {
$provider = escapeSql($_POST['oauth_provider'] ?? ''); $provider = escapeSql($_POST['oauth_provider'] ?? '');
if ($provider !== 'google_oauth' && $provider !== 'microsoft_oauth') { if ($provider !== 'google_oauth' && $provider !== 'microsoft_oauth') {
flash_alert("OAuth token test failed: unsupported provider.", 'error'); flashAlert("OAuth token test failed: unsupported provider.", 'error');
redirect(); redirect();
} }
@@ -512,12 +512,12 @@ if (isset($_POST['test_oauth_token_refresh'])) {
$oauth_refresh_token = escapeSql($config_mail_oauth_refresh_token ?? ''); $oauth_refresh_token = escapeSql($config_mail_oauth_refresh_token ?? '');
if (empty($oauth_client_id) || empty($oauth_client_secret) || empty($oauth_refresh_token)) { if (empty($oauth_client_id) || empty($oauth_client_secret) || empty($oauth_refresh_token)) {
flash_alert("OAuth token test failed: missing client ID, client secret, or refresh token.", 'error'); flashAlert("OAuth token test failed: missing client ID, client secret, or refresh token.", 'error');
redirect(); redirect();
} }
if ($provider === 'microsoft_oauth' && empty($oauth_tenant_id)) { if ($provider === 'microsoft_oauth' && empty($oauth_tenant_id)) {
flash_alert("OAuth token test failed: Microsoft tenant ID is required.", 'error'); flashAlert("OAuth token test failed: Microsoft tenant ID is required.", 'error');
redirect(); redirect();
} }
@@ -546,14 +546,14 @@ if (isset($_POST['test_oauth_token_refresh'])) {
if ($raw_body === false || $http_code < 200 || $http_code >= 300) { if ($raw_body === false || $http_code < 200 || $http_code >= 300) {
$err_msg = !empty($curl_err) ? $curl_err : "HTTP $http_code"; $err_msg = !empty($curl_err) ? $curl_err : "HTTP $http_code";
flash_alert("OAuth token test failed: $err_msg", 'error'); flashAlert("OAuth token test failed: $err_msg", 'error');
redirect(); redirect();
} }
$json = json_decode($raw_body, true); $json = json_decode($raw_body, true);
if (!is_array($json) || empty($json['access_token'])) { if (!is_array($json) || empty($json['access_token'])) {
flash_alert("OAuth token test failed: access token missing in provider response.", 'error'); flashAlert("OAuth token test failed: access token missing in provider response.", 'error');
redirect(); redirect();
} }
@@ -575,6 +575,6 @@ if (isset($_POST['test_oauth_token_refresh'])) {
$provider_label = $provider === 'microsoft_oauth' ? 'Microsoft 365' : 'Google Workspace'; $provider_label = $provider === 'microsoft_oauth' ? 'Microsoft 365' : 'Google Workspace';
logAudit("Settings", "Edit", "$session_name tested OAuth token refresh for $provider_label mail settings"); logAudit("Settings", "Edit", "$session_name tested OAuth token refresh for $provider_label mail settings");
flash_alert("OAuth token refresh successful for $provider_label. Access token expires at $new_expires_at."); flashAlert("OAuth token refresh successful for $provider_label. Access token expires at $new_expires_at.");
redirect(); redirect();
} }

View File

@@ -23,7 +23,7 @@ if (isset($_POST['edit_module_settings'])) {
logAudit("Settings", "Edit", "$session_name edited module settings"); logAudit("Settings", "Edit", "$session_name edited module settings");
flash_alert("Module Settings updated"); flashAlert("Module Settings updated");
redirect(); redirect();

View File

@@ -16,7 +16,7 @@ if (isset($_POST['edit_notification_settings'])) {
logAudit("Settings", "Edit", "$session_name edited notification settings"); logAudit("Settings", "Edit", "$session_name edited notification settings");
flash_alert("Notification Settings updated"); flashAlert("Notification Settings updated");
redirect(); redirect();

View File

@@ -20,9 +20,9 @@ if (isset($_POST['edit_online_payment_settings'])) {
logAudit("Settings", "Edit", "$session_name edited online payment settings"); logAudit("Settings", "Edit", "$session_name edited online payment settings");
if ($config_stripe_enable && $config_stripe_account == 0) { if ($config_stripe_enable && $config_stripe_account == 0) {
flash_alert("Stripe payment account must be specified!", 'error'); flashAlert("Stripe payment account must be specified!", 'error');
} else { } else {
flash_alert("Online Payment Settings updated"); flashAlert("Online Payment Settings updated");
} }
redirect(); redirect();

View File

@@ -7,7 +7,7 @@ if (isset($_GET['stripe_remove_pm'])) {
validateCSRFToken($_GET['csrf_token']); validateCSRFToken($_GET['csrf_token']);
if (!$config_stripe_enable) { if (!$config_stripe_enable) {
flash_alert("Stripe not enabled", 'error'); flashAlert("Stripe not enabled", 'error');
redirect(); redirect();
} }
@@ -41,7 +41,7 @@ if (isset($_GET['stripe_remove_pm'])) {
logAudit("Stripe", "Update", "$session_name deleted saved Stripe payment method (PM: $payment_method)", $client_id); logAudit("Stripe", "Update", "$session_name deleted saved Stripe payment method (PM: $payment_method)", $client_id);
flash_alert("Payment method removed", 'error'); flashAlert("Payment method removed", 'error');
redirect(); redirect();
@@ -66,7 +66,7 @@ if (isset($_GET['stripe_reset_customer'])) {
logAudit("Stripe", "Delete", "$session_name reset Stripe settings for client", $client_id); logAudit("Stripe", "Delete", "$session_name reset Stripe settings for client", $client_id);
flash_alert("Reset client Stripe settings", 'error'); flashAlert("Reset client Stripe settings", 'error');
redirect(); redirect();

View File

@@ -13,7 +13,7 @@ if (isset($_POST['edit_project_settings'])) {
logAudit("Settings", "Edit", "$session_name edited project settings"); logAudit("Settings", "Edit", "$session_name edited project settings");
flash_alert("Project Settings updated"); flashAlert("Project Settings updated");
redirect(); redirect();

View File

@@ -18,7 +18,7 @@ if (isset($_POST['edit_quote_settings'])) {
logAudit("Settings", "Edit", "$session_name edited Quote settings"); logAudit("Settings", "Edit", "$session_name edited Quote settings");
flash_alert("Quote Settings updated"); flashAlert("Quote Settings updated");
redirect(); redirect();

View File

@@ -21,7 +21,7 @@ if (isset($_POST['edit_security_settings'])) {
logAudit("Settings", "Edit", "$session_name edited security settings"); logAudit("Settings", "Edit", "$session_name edited security settings");
flash_alert("Security settings updated"); flashAlert("Security settings updated");
redirect(); redirect();

View File

@@ -12,7 +12,7 @@ if (isset($_POST['edit_telemetry_settings'])) {
logAudit("Settings", "Edit", "$session_name edited telemetry settings"); logAudit("Settings", "Edit", "$session_name edited telemetry settings");
flash_alert("Telemetry Settings updated"); flashAlert("Telemetry Settings updated");
redirect(); redirect();

View File

@@ -12,7 +12,7 @@ if (isset($_POST['edit_theme_settings'])) {
logAudit("Settings", "Edit", "$session_name edited theme settings $dark_mode"); logAudit("Settings", "Edit", "$session_name edited theme settings $dark_mode");
flash_alert("Changed theme to <strong>$theme</strong>"); flashAlert("Changed theme to <strong>$theme</strong>");
redirect(); redirect();
@@ -44,7 +44,7 @@ if (isset($_POST['edit_favicon_settings'])) {
logAudit("Settings", "Edit", "$session_name changed the favicon"); logAudit("Settings", "Edit", "$session_name changed the favicon");
flash_alert("Favicon Updated"); flashAlert("Favicon Updated");
redirect(); redirect();
@@ -60,7 +60,7 @@ if (isset($_GET['reset_favicon'])) {
logAudit("Settings", "Edit", "$session_name reset Favicon"); logAudit("Settings", "Edit", "$session_name reset Favicon");
flash_alert("Favicon reset", 'error'); flashAlert("Favicon reset", 'error');
redirect(); redirect();

View File

@@ -25,7 +25,7 @@ if (isset($_POST['edit_ticket_settings'])) {
logAudit("Settings", "Edit", "$session_name edited ticket settings"); logAudit("Settings", "Edit", "$session_name edited ticket settings");
flash_alert("Ticket Settings updated"); flashAlert("Ticket Settings updated");
redirect(); redirect();

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_software_template'])) {
logAudit("Software Template", "Create", "$session_name created software template $name", 0, $software_template_id); logAudit("Software Template", "Create", "$session_name created software template $name", 0, $software_template_id);
flash_alert("Software template <strong>$name</strong> created"); flashAlert("Software template <strong>$name</strong> created");
redirect(); redirect();
@@ -43,7 +43,7 @@ if (isset($_POST['edit_software_template'])) {
logAudit("Software Template", "Edit", "$session_name edited software template $name", 0, $software_template_id); logAudit("Software Template", "Edit", "$session_name edited software template $name", 0, $software_template_id);
flash_alert("Software template <strong>$name</strong> edited"); flashAlert("Software template <strong>$name</strong> edited");
redirect(); redirect();
@@ -64,7 +64,7 @@ if (isset($_GET['delete_software_template'])) {
logAudit("Software Template", "Delete", "$session_name deleted software template $software_template_name"); logAudit("Software Template", "Delete", "$session_name deleted software template $software_template_name");
flash_alert("Software Template <strong>$software_template_name</strong> deleted", 'error'); flashAlert("Software Template <strong>$software_template_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -18,7 +18,7 @@ if (isset($_POST['add_tag'])) {
logAudit("Tag", "Create", "$session_name created tag $name", 0, $tag_id); logAudit("Tag", "Create", "$session_name created tag $name", 0, $tag_id);
flash_alert("Tag <strong>$name</strong> created"); flashAlert("Tag <strong>$name</strong> created");
redirect(); redirect();
@@ -36,7 +36,7 @@ if (isset($_POST['edit_tag'])) {
logAudit("Tag", "Edit", "$session_name edited tag $name", 0, $tag_id); logAudit("Tag", "Edit", "$session_name edited tag $name", 0, $tag_id);
flash_alert("Tag <strong>$name</strong> edited"); flashAlert("Tag <strong>$name</strong> edited");
redirect(); redirect();
@@ -54,7 +54,7 @@ if (isset($_GET['delete_tag'])) {
logAudit("Tag", "Delete", "$session_name deleted tag $tag_name"); logAudit("Tag", "Delete", "$session_name deleted tag $tag_name");
flash_alert("Tag <strong>$tag_name</strong> deleted", 'error'); flashAlert("Tag <strong>$tag_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -19,7 +19,7 @@ if (isset($_POST['add_tax'])) {
logAudit("Tax", "Create", "$session_name created tax $name - $percent%", 0, $tax_id); logAudit("Tax", "Create", "$session_name created tax $name - $percent%", 0, $tax_id);
flash_alert("Tax <strong>$name</strong> ($percent%) created"); flashAlert("Tax <strong>$name</strong> ($percent%) created");
redirect(); redirect();
@@ -37,7 +37,7 @@ if (isset($_POST['edit_tax'])) {
logAudit("Tax", "Edit", "$session_name edited tax $name - $percent%", 0, $tax_id); logAudit("Tax", "Edit", "$session_name edited tax $name - $percent%", 0, $tax_id);
flash_alert("Tax <strong>$name</strong> ($percent%) edited"); flashAlert("Tax <strong>$name</strong> ($percent%) edited");
redirect(); redirect();
@@ -55,7 +55,7 @@ if (isset($_GET['archive_tax'])) {
logAudit("Tax", "Archive", "$session_name archived tax $tax_name", 0, $tax_id); logAudit("Tax", "Archive", "$session_name archived tax $tax_name", 0, $tax_id);
flash_alert("Tax <strong>$tax_name</strong> Archived", 'error'); flashAlert("Tax <strong>$tax_name</strong> Archived", 'error');
redirect(); redirect();
@@ -73,7 +73,7 @@ if (isset($_GET['delete_tax'])) {
logAudit("Tax", "Delete", "$session_name deleted tax $tax_name"); logAudit("Tax", "Delete", "$session_name deleted tax $tax_name");
flash_alert("Tax <strong>$tax_name</strong> deleted", 'error'); flashAlert("Tax <strong>$tax_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -15,7 +15,7 @@ if (isset($_POST['add_ticket_status'])) {
logAudit("Ticket Status", "Create", "$session_name created custom ticket status $name", 0, $ticket_status_id); logAudit("Ticket Status", "Create", "$session_name created custom ticket status $name", 0, $ticket_status_id);
flash_alert("Custom Ticket Status <strong>$name</strong> created"); flashAlert("Custom Ticket Status <strong>$name</strong> created");
redirect(); redirect();
@@ -35,7 +35,7 @@ if (isset($_POST['edit_ticket_status'])) {
logAudit("Ticket Status", "Edit", "$session_name edited custom ticket status $name", 0, $ticket_status_id); logAudit("Ticket Status", "Edit", "$session_name edited custom ticket status $name", 0, $ticket_status_id);
flash_alert("Custom Ticket Status <strong>$name</strong> edited"); flashAlert("Custom Ticket Status <strong>$name</strong> edited");
redirect(); redirect();
@@ -57,7 +57,7 @@ if (isset($_GET['delete_ticket_status'])) {
logAudit("Ticket Status", "Delete", "$session_name deleted custom ticket status $ticket_status_name"); logAudit("Ticket Status", "Delete", "$session_name deleted custom ticket status $ticket_status_name");
flash_alert("Custom Ticket Status <strong>$ticket_status_name</strong> Deleted", 'error'); flashAlert("Custom Ticket Status <strong>$ticket_status_name</strong> Deleted", 'error');
redirect(); redirect();

View File

@@ -28,7 +28,7 @@ if (isset($_POST['add_ticket_template'])) {
logAudit("Ticket Template", "Create", "$session_name created ticket template $name", 0, $ticket_template_id); logAudit("Ticket Template", "Create", "$session_name created ticket template $name", 0, $ticket_template_id);
flash_alert("Ticket Template <strong>$name</strong> created"); flashAlert("Ticket Template <strong>$name</strong> created");
redirect(); redirect();
@@ -48,7 +48,7 @@ if (isset($_POST['edit_ticket_template'])) {
logAudit("Ticket Template", "Edit", "$session_name edited ticket template $name", 0, $ticket_template_id); logAudit("Ticket Template", "Edit", "$session_name edited ticket template $name", 0, $ticket_template_id);
flash_alert("Ticket Template <strong>$name</strong> edited"); flashAlert("Ticket Template <strong>$name</strong> edited");
redirect(); redirect();
@@ -70,7 +70,7 @@ if (isset($_GET['delete_ticket_template'])) {
logAudit("Ticket Template", "Delete", "$session_name deleted ticket template $ticket_template_name"); logAudit("Ticket Template", "Delete", "$session_name deleted ticket template $ticket_template_name");
flash_alert("Ticket Template <strong>$ticket_template_name</strong> and its associated tasks deleted", 'error'); flashAlert("Ticket Template <strong>$ticket_template_name</strong> and its associated tasks deleted", 'error');
redirect(); redirect();
@@ -89,7 +89,7 @@ if (isset($_POST['add_ticket_template_task'])) {
logAudit("Ticket Template", "Create", "$session_name created task $task_name for ticket template", 0, $ticket_template_id); logAudit("Ticket Template", "Create", "$session_name created task $task_name for ticket template", 0, $ticket_template_id);
flash_alert("Added Task <strong>$task_name</strong>"); flashAlert("Added Task <strong>$task_name</strong>");
redirect(); redirect();
@@ -107,7 +107,7 @@ if (isset($_GET['delete_task_template'])) {
logAudit("Ticket Template", "Edit", "$session_name deleted task $task_template_name from ticket template"); logAudit("Ticket Template", "Edit", "$session_name deleted task $task_template_name from ticket template");
flash_alert("Task <strong>$task_template_name</strong> deleted", 'error'); flashAlert("Task <strong>$task_template_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -274,7 +274,7 @@ if (isset($_GET['update'])) {
logAudit("App", "Update", "$session_name ran updates"); logAudit("App", "Update", "$session_name ran updates");
flash_alert("Update successful"); flashAlert("Update successful");
sleep(1); sleep(1);
@@ -292,7 +292,7 @@ if (isset($_GET['update_db'])) {
logAudit("Database", "Update", "$session_name updated the database structure"); logAudit("Database", "Update", "$session_name updated the database structure");
flash_alert("Database structure update successful"); flashAlert("Database structure update successful");
sleep(1); sleep(1);

View File

@@ -92,7 +92,7 @@ if (isset($_POST['add_user'])) {
logAudit("User", "Create", "$session_name created user $name", 0, $user_id); logAudit("User", "Create", "$session_name created user $name", 0, $user_id);
flash_alert("User <strong>$name</strong> created" . $extended_alert_description); flashAlert("User <strong>$name</strong> created" . $extended_alert_description);
redirect(); redirect();
@@ -172,7 +172,7 @@ if (isset($_POST['edit_user'])) {
logAudit("User", "Edit", "$session_name edited user $name", 0, $user_id); logAudit("User", "Edit", "$session_name edited user $name", 0, $user_id);
flash_alert("User <strong>$name</strong> updated" . $extended_alert_description); flashAlert("User <strong>$name</strong> updated" . $extended_alert_description);
redirect(); redirect();
@@ -190,7 +190,7 @@ if (isset($_GET['activate_user'])) {
logAudit("User", "Activate", "$session_name activated user $user_name", 0, $user_id); logAudit("User", "Activate", "$session_name activated user $user_name", 0, $user_id);
flash_alert("User <strong>$user_name</strong> activated"); flashAlert("User <strong>$user_name</strong> activated");
redirect(); redirect();
@@ -212,7 +212,7 @@ if (isset($_GET['disable_user'])) {
logAudit("User", "Disable", "$session_name disabled user $name", 0, $user_id); logAudit("User", "Disable", "$session_name disabled user $name", 0, $user_id);
flash_alert("User <strong>$user_name</strong> disabled", 'error'); flashAlert("User <strong>$user_name</strong> disabled", 'error');
redirect(); redirect();
@@ -230,7 +230,7 @@ if (isset($_GET['revoke_remember_me'])) {
logAudit("User", "Edit", "$session_name revoked all remember me tokens for user $user_name", 0, $user_id); logAudit("User", "Edit", "$session_name revoked all remember me tokens for user $user_name", 0, $user_id);
flash_alert("User <strong>$user_name</strong> remember me tokens revoked", 'error'); flashAlert("User <strong>$user_name</strong> remember me tokens revoked", 'error');
redirect(); redirect();
@@ -255,7 +255,7 @@ if (isset($_POST['archive_user'])) {
logAudit("User", "Archive", "$session_name archived user $user_name", 0, $user_id); logAudit("User", "Archive", "$session_name archived user $user_name", 0, $user_id);
flash_alert("User <strong>$user_name</strong> archived", 'error'); flashAlert("User <strong>$user_name</strong> archived", 'error');
redirect(); redirect();
@@ -285,7 +285,7 @@ if (isset($_POST['restore_user'])) {
logAudit("User", "Restored", "$session_name restored user $user_name", 0, $user_id); logAudit("User", "Restored", "$session_name restored user $user_name", 0, $user_id);
flash_alert("User <strong>$user_name</strong> restored"); flashAlert("User <strong>$user_name</strong> restored");
redirect(); redirect();
@@ -356,7 +356,7 @@ if (isset($_POST['ir_reset_user_password'])) {
$userRow = mysqli_fetch_assoc($sql); $userRow = mysqli_fetch_assoc($sql);
if (!password_verify($admin_password, $userRow['user_password'])) { if (!password_verify($admin_password, $userRow['user_password'])) {
flash_alert("Incorrect password.", 'error'); flashAlert("Incorrect password.", 'error');
redirect(); redirect();
} }

View File

@@ -41,7 +41,7 @@ ob_start();
<option value="0">/</option> <option value="0">/</option>
<?php <?php
// Start displaying folder options from the root (parent_folder = 0) // Start displaying folder options from the root (parent_folder = 0)
display_folder_options(0, $client_id); displayFolderOptions(0, $client_id);
?> ?>
</select> </select>
</div> </div>

View File

@@ -46,7 +46,7 @@ ob_start();
<option value="0">/</option> <option value="0">/</option>
<?php <?php
// Start displaying folder options from the root (parent_folder = 0) // Start displaying folder options from the root (parent_folder = 0)
display_folder_options(0, $client_id, 1); displayFolderOptions(0, $client_id, 1);
?> ?>
</select> </select>
</div> </div>

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_account'])) {
logAudit("Account", "Create", "$session_name created account $name"); logAudit("Account", "Create", "$session_name created account $name");
flash_alert("Account <strong>$name</strong> created"); flashAlert("Account <strong>$name</strong> created");
redirect(); redirect();
@@ -41,7 +41,7 @@ if (isset($_POST['edit_account'])) {
logAudit("Account", "Edit", "$session_name edited account $name"); logAudit("Account", "Edit", "$session_name edited account $name");
flash_alert("Account <strong>$name</strong> edited"); flashAlert("Account <strong>$name</strong> edited");
redirect(); redirect();
@@ -61,7 +61,7 @@ if (isset($_GET['archive_account'])) {
logAudit("Account", "Archive", "$session_name archived account $account_name"); logAudit("Account", "Archive", "$session_name archived account $account_name");
flash_alert("Account <strong>$account_name</strong> archived", 'error'); flashAlert("Account <strong>$account_name</strong> archived", 'error');
redirect(); redirect();
@@ -82,7 +82,7 @@ if (isset($_GET['delete_account'])) {
logAudit("Account", "Delete", "$session_name deleted account $account_name"); logAudit("Account", "Delete", "$session_name deleted account $account_name");
flash_alert("Account <strong>$account_name</strong> deleted", 'error'); flashAlert("Account <strong>$account_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -72,7 +72,7 @@ if (isset($_POST['add_asset'])) {
logAudit("Asset", "Create", "$session_name created asset $name", $client_id, $asset_id); logAudit("Asset", "Create", "$session_name created asset $name", $client_id, $asset_id);
flash_alert("Asset <strong>$name</strong> created $alert_extended"); flashAlert("Asset <strong>$name</strong> created $alert_extended");
redirect(); redirect();
@@ -141,7 +141,7 @@ if (isset($_POST['edit_asset'])) {
logAudit("Asset", "Edit", "$session_name edited asset $name", $client_id, $asset_id); logAudit("Asset", "Edit", "$session_name edited asset $name", $client_id, $asset_id);
flash_alert("Asset <strong>$name</strong> edited"); flashAlert("Asset <strong>$name</strong> edited");
redirect(); redirect();
@@ -170,7 +170,7 @@ if (isset($_GET['archive_asset'])) {
logAudit("Asset", "Archive", "$session_name archived asset $asset_name", $client_id, $asset_id); logAudit("Asset", "Archive", "$session_name archived asset $asset_name", $client_id, $asset_id);
flash_alert("Asset <strong>$asset_name</strong> archived", 'error'); flashAlert("Asset <strong>$asset_name</strong> archived", 'error');
redirect(); redirect();
@@ -199,7 +199,7 @@ if (isset($_GET['restore_asset'])) {
logAudit("Asset", "Restore", "$session_name restored asset $asset_name", $client_id, $asset_id); logAudit("Asset", "Restore", "$session_name restored asset $asset_name", $client_id, $asset_id);
flash_alert("Asset <strong>$asset_name</strong> Restored"); flashAlert("Asset <strong>$asset_name</strong> Restored");
redirect(); redirect();
@@ -225,7 +225,7 @@ if (isset($_GET['delete_asset'])) {
logAudit("Asset", "Delete", "$session_name deleted asset $asset_name", $client_id); logAudit("Asset", "Delete", "$session_name deleted asset $asset_name", $client_id);
flash_alert("Asset <strong>$asset_name</strong> deleted"); flashAlert("Asset <strong>$asset_name</strong> deleted");
redirect(); redirect();
@@ -272,7 +272,7 @@ if (isset($_POST['bulk_assign_asset_tags'])) {
logAudit("Asset", "Bulk Edit", "$session_name added tags for $asset_count assets", $client_id); logAudit("Asset", "Bulk Edit", "$session_name added tags for $asset_count assets", $client_id);
flash_alert("Assigned tags for <strong>$count</strong> assets"); flashAlert("Assigned tags for <strong>$count</strong> assets");
} }
redirect(); redirect();
@@ -320,7 +320,7 @@ if (isset($_POST['bulk_assign_asset_location'])) {
logAudit("Asset", "Bulk Edit", "$session_name assigned $asset_count assets to location $location_name", $client_id); logAudit("Asset", "Bulk Edit", "$session_name assigned $asset_count assets to location $location_name", $client_id);
flash_alert("You assigned <strong>$asset_count</strong> assets to location <strong>$location_name</strong>"); flashAlert("You assigned <strong>$asset_count</strong> assets to location <strong>$location_name</strong>");
} }
redirect(); redirect();
@@ -360,7 +360,7 @@ if (isset($_POST['bulk_assign_asset_physical_location'])) {
logAudit("Asset", "Bulk Edit", "$session_name set $asset_count assets to physical location $physical_location", $client_id); logAudit("Asset", "Bulk Edit", "$session_name set $asset_count assets to physical location $physical_location", $client_id);
flash_alert("You moved <strong>$asset_count</strong> assets to location <strong>$physical_location</strong>"); flashAlert("You moved <strong>$asset_count</strong> assets to location <strong>$physical_location</strong>");
} }
redirect(); redirect();
@@ -450,7 +450,7 @@ if (isset($_POST['bulk_transfer_client_asset'])) {
logAudit("Asset", "Bulk Transfer", "$session_name transferred $asset_count assets to $new_client_name", $new_client_id); logAudit("Asset", "Bulk Transfer", "$session_name transferred $asset_count assets to $new_client_name", $new_client_id);
flash_alert("Transferred <strong>$asset_count</strong> assets to <strong>$new_client_name</strong>."); flashAlert("Transferred <strong>$asset_count</strong> assets to <strong>$new_client_name</strong>.");
} }
redirect(); redirect();
@@ -495,7 +495,7 @@ if (isset($_POST['bulk_assign_asset_contact'])) {
logAudit("Asset", "Bulk Edit", "$session_name assigned $asset_count assets to contact $contact_name", $client_id); logAudit("Asset", "Bulk Edit", "$session_name assigned $asset_count assets to contact $contact_name", $client_id);
flash_alert("You assigned <strong>$asset_count</strong> assets to contact <strong>$contact_name</strong>"); flashAlert("You assigned <strong>$asset_count</strong> assets to contact <strong>$contact_name</strong>");
} }
redirect(); redirect();
@@ -536,7 +536,7 @@ if (isset($_POST['bulk_edit_asset_status'])) {
logAudit("Asset", "Bulk Edit", "$session_name set status to $status on $asset_count assets", $client_id); logAudit("Asset", "Bulk Edit", "$session_name set status to $status on $asset_count assets", $client_id);
flash_alert("You set the status <strong>$status</strong> on <strong>$asset_count</strong> assets."); flashAlert("You set the status <strong>$status</strong> on <strong>$asset_count</strong> assets.");
} }
redirect(); redirect();
@@ -573,7 +573,7 @@ if (isset($_POST['bulk_favorite_assets'])) {
logAudit("Asset", "Bulk Edit", "$session_name favorited $count assets", $client_id); logAudit("Asset", "Bulk Edit", "$session_name favorited $count assets", $client_id);
flash_alert("Favorited <strong>$count</strong> asset(s)"); flashAlert("Favorited <strong>$count</strong> asset(s)");
} }
@@ -611,7 +611,7 @@ if (isset($_POST['bulk_unfavorite_assets'])) {
logAudit("Asset", "Bulk Edit", "$session_name unfavorited $count assets", $client_id); logAudit("Asset", "Bulk Edit", "$session_name unfavorited $count assets", $client_id);
flash_alert("Unfavorited <strong>$count</strong> asset(s)"); flashAlert("Unfavorited <strong>$count</strong> asset(s)");
} }
@@ -652,7 +652,7 @@ if (isset($_POST['bulk_archive_assets'])) {
logAudit("Asset", "Bulk Archive", "$session_name archived $count assets", $client_id); logAudit("Asset", "Bulk Archive", "$session_name archived $count assets", $client_id);
flash_alert("Archived <strong>$count</strong> asset(s)", 'error'); flashAlert("Archived <strong>$count</strong> asset(s)", 'error');
} }
@@ -694,7 +694,7 @@ if (isset($_POST['bulk_restore_assets'])) {
logAudit("Asset", "Bulk Restore", "$session_name restored $count assets"); logAudit("Asset", "Bulk Restore", "$session_name restored $count assets");
flash_alert("Restored $count asset(s)"); flashAlert("Restored $count asset(s)");
} }
@@ -731,7 +731,7 @@ if (isset($_POST['bulk_delete_assets'])) {
logAudit("Asset", "Bulk Delete", "$session_name deleted $count assets"); logAudit("Asset", "Bulk Delete", "$session_name deleted $count assets");
flash_alert("Deleted <strong>$count</strong> asset(s)", 'error'); flashAlert("Deleted <strong>$count</strong> asset(s)", 'error');
} }
redirect(); redirect();
@@ -764,7 +764,7 @@ if (isset($_POST['link_software_to_asset'])) {
logAudit("Software", "Link", "$session_name added software license $software_name to asset $asset_name", $client_id, $software_id); logAudit("Software", "Link", "$session_name added software license $software_name to asset $asset_name", $client_id, $software_id);
flash_alert("Software <strong>$software_name</strong> licensed for asset <strong>$asset_name</strong>"); flashAlert("Software <strong>$software_name</strong> licensed for asset <strong>$asset_name</strong>");
redirect(); redirect();
@@ -794,7 +794,7 @@ if (isset($_GET['unlink_software_from_asset'])) {
logAudit("software", "Unlink", "$session_name removed software license $software_name from asset $asset_name", $client_id, $software_id); logAudit("software", "Unlink", "$session_name removed software license $software_name from asset $asset_name", $client_id, $software_id);
flash_alert("Removed Software License <strong>$software_name</strong> for Asset <strong>$asset_name</strong>", 'error'); flashAlert("Removed Software License <strong>$software_name</strong> for Asset <strong>$asset_name</strong>", 'error');
redirect(); redirect();
@@ -825,7 +825,7 @@ if (isset($_POST['link_asset_to_credential'])) {
logAudit("Credential", "Link", "$session_name linked credential $credential_name to asset $asset_name", $client_id, $credential_id); logAudit("Credential", "Link", "$session_name linked credential $credential_name to asset $asset_name", $client_id, $credential_id);
flash_alert("Asset <strong>$asset_name</strong> linked with credential <strong>$crdential_name</strong>"); flashAlert("Asset <strong>$asset_name</strong> linked with credential <strong>$crdential_name</strong>");
redirect(); redirect();
@@ -855,7 +855,7 @@ if (isset($_GET['unlink_credential_from_asset'])) {
logAudit("Credential", "Unlink", "$session_name unlinked asset $asset_name from credential $credential_name", $client_id, $credential_id); logAudit("Credential", "Unlink", "$session_name unlinked asset $asset_name from credential $credential_name", $client_id, $credential_id);
flash_alert("Credential <strong>$credential_name</strong> unlinked from Asset <strong>$asset_name</strong>", 'errpr'); flashAlert("Credential <strong>$credential_name</strong> unlinked from Asset <strong>$asset_name</strong>", 'errpr');
redirect(); redirect();
@@ -885,7 +885,7 @@ if (isset($_POST['link_service_to_asset'])) {
logAudit("Service", "Link", "$session_name linked asset $asset_name to service $service_name", $client_id, $service_id); logAudit("Service", "Link", "$session_name linked asset $asset_name to service $service_name", $client_id, $service_id);
flash_alert("Service <strong>$service_name</strong> linked with asset <strong>$asset_name</strong>"); flashAlert("Service <strong>$service_name</strong> linked with asset <strong>$asset_name</strong>");
redirect(); redirect();
@@ -915,7 +915,7 @@ if (isset($_GET['unlink_service_from_asset'])) {
logAudit("Service", "Unlink", "$session_name unlinked asset $asset_name from service $service_name", $client_id, $service_id); logAudit("Service", "Unlink", "$session_name unlinked asset $asset_name from service $service_name", $client_id, $service_id);
flash_alert("Asset <strong>$asset_name</strong> unlinked from service <strong>$service_name</strong>", 'error'); flashAlert("Asset <strong>$asset_name</strong> unlinked from service <strong>$service_name</strong>", 'error');
redirect(); redirect();
@@ -946,7 +946,7 @@ if (isset($_POST['link_asset_to_file'])) {
logAudit("File", "Link", "$session_name linked asset $asset_name to file $file_name", $client_id, $file_id); logAudit("File", "Link", "$session_name linked asset $asset_name to file $file_name", $client_id, $file_id);
flash_alert("Asset <strong>$asset_name</strong> linked with File <strong>$file_name</strong>"); flashAlert("Asset <strong>$asset_name</strong> linked with File <strong>$file_name</strong>");
redirect(); redirect();
@@ -976,7 +976,7 @@ if (isset($_GET['unlink_asset_from_file'])) {
logAudit("File", "Unlink", "$session_name unlinked asset $asset_name from file $file_name", $client_id, $file_id); logAudit("File", "Unlink", "$session_name unlinked asset $asset_name from file $file_name", $client_id, $file_id);
flash_alert("Asset <strong>$asset_name</strong> unlinked from file <strong>$file_name</strong>", 'error'); flashAlert("Asset <strong>$asset_name</strong> unlinked from file <strong>$file_name</strong>", 'error');
redirect(); redirect();
@@ -1002,7 +1002,7 @@ if (isset($_POST["import_assets_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -1011,13 +1011,13 @@ if (isset($_POST["import_assets_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if (in_array($file_extension,$allowed_file_extensions) === false) { if (in_array($file_extension,$allowed_file_extensions) === false) {
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif ($_FILES["file"]["size"] < 1) { elseif ($_FILES["file"]["size"] < 1) {
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count (name, desc, type, make, model, serial, os, purchase date, assigned to, location, notes) //(Else)Check column count (name, desc, type, make, model, serial, os, purchase date, assigned to, location, notes)
@@ -1025,7 +1025,7 @@ if (isset($_POST["import_assets_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if (!$error & count($f_columns) != 12) { if (!$error & count($f_columns) != 12) {
$error = true; $error = true;
flash_alert("Invalid column count.", 'error'); flashAlert("Invalid column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -1141,7 +1141,7 @@ if (isset($_POST["import_assets_csv"])) {
logAudit("Asset", "Import", "$session_name imported $row_count asset(s) via CSV file", $client_id); logAudit("Asset", "Import", "$session_name imported $row_count asset(s) via CSV file", $client_id);
flash_alert("$row_count Asset(s) added, $duplicate_count duplicate(s) detected"); flashAlert("$row_count Asset(s) added, $duplicate_count duplicate(s) detected");
redirect(); redirect();
@@ -1217,7 +1217,7 @@ if (isset($_POST['export_assets_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Assets-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Assets-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -1320,7 +1320,7 @@ if (isset($_POST['add_asset_interface'])) {
); );
// 7) Alert message + redirect // 7) Alert message + redirect
flash_alert("Interface <strong>$name</strong> created"); flashAlert("Interface <strong>$name</strong> created");
redirect(); redirect();
@@ -1367,7 +1367,7 @@ if (isset($_POST['add_asset_multiple_interfaces'])) {
logAudit("Asset Interface", "Bulk Create", "$session_name created $interfaces for asset $asset_name", $client_id, $asset_id); logAudit("Asset Interface", "Bulk Create", "$session_name created $interfaces for asset $asset_name", $client_id, $asset_id);
flash_alert("Created <strong>$interfaces</strong> Interface(s) for asset <strong>$asset_name</strong>"); flashAlert("Created <strong>$interfaces</strong> Interface(s) for asset <strong>$asset_name</strong>");
redirect(); redirect();
@@ -1448,7 +1448,7 @@ if (isset($_POST['edit_asset_interface'])) {
); );
// 6) Alert and redirect // 6) Alert and redirect
flash_alert("Interface <strong>$name</strong> edited"); flashAlert("Interface <strong>$name</strong> edited");
redirect(); redirect();
@@ -1493,7 +1493,7 @@ if (isset($_GET['delete_asset_interface'])) {
); );
// 4) Alert and redirect // 4) Alert and redirect
flash_alert("Interface <strong>$interface_name</strong> deleted", 'error'); flashAlert("Interface <strong>$interface_name</strong> deleted", 'error');
redirect(); redirect();
@@ -1537,7 +1537,7 @@ if (isset($_POST['bulk_edit_asset_interface_type'])) {
logAudit("Asset Interface", "Bulk Edit", "$session_name set interface type to $type on $interface_count interfaces for asset $asset_name", $client_id); logAudit("Asset Interface", "Bulk Edit", "$session_name set interface type to $type on $interface_count interfaces for asset $asset_name", $client_id);
flash_alert("Type set to <strong>$type</strong> on <strong>$interface_count</strong> interfaces."); flashAlert("Type set to <strong>$type</strong> on <strong>$interface_count</strong> interfaces.");
} }
@@ -1586,7 +1586,7 @@ if (isset($_POST['bulk_edit_asset_interface_network'])) {
logAudit("Asset Interface", "Bulk Edit", "$session_name set network to $network_name on $interface_count interfaces for asset $asset_name", $client_id); logAudit("Asset Interface", "Bulk Edit", "$session_name set network to $network_name on $interface_count interfaces for asset $asset_name", $client_id);
flash_alert("Network set to <strong>$network_name</strong> on <strong>$interface_count</strong> interfaces."); flashAlert("Network set to <strong>$network_name</strong> on <strong>$interface_count</strong> interfaces.");
} }
redirect(); redirect();
@@ -1629,7 +1629,7 @@ if (isset($_POST['bulk_edit_asset_interface_ip_dhcp'])) {
logAudit("Asset Interface", "Bulk Edit", "$session_name set interface IP to DHCP on $interface_count interfaces for asset $asset_name", $client_id); logAudit("Asset Interface", "Bulk Edit", "$session_name set interface IP to DHCP on $interface_count interfaces for asset $asset_name", $client_id);
flash_alert("Interface IP set to <strong>DHCP</strong> on <strong>$interface_count</strong> interfaces."); flashAlert("Interface IP set to <strong>DHCP</strong> on <strong>$interface_count</strong> interfaces.");
} }
@@ -1673,7 +1673,7 @@ if (isset($_POST['bulk_delete_asset_interfaces'])) {
logAudit("Asset Interface", "Bulk Delete", "$session_name deleted $interface_count interfaces for asset $asset_name", $client_id); logAudit("Asset Interface", "Bulk Delete", "$session_name deleted $interface_count interfaces for asset $asset_name", $client_id);
flash_alert("<strong>$interface_count</strong> interfaces deleted.", 'error'); flashAlert("<strong>$interface_count</strong> interfaces deleted.", 'error');
} }
redirect(); redirect();
@@ -1702,7 +1702,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -1711,13 +1711,13 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if (in_array($file_extension,$allowed_file_extensions) === false) { if (in_array($file_extension,$allowed_file_extensions) === false) {
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif ($_FILES["file"]["size"] < 1) { elseif ($_FILES["file"]["size"] < 1) {
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count (Name, Description, Type, MAC, IP, NAT IP, IPv6, Network) //(Else)Check column count (Name, Description, Type, MAC, IP, NAT IP, IPv6, Network)
@@ -1725,7 +1725,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if (!$error & count($f_columns) != 8) { if (!$error & count($f_columns) != 8) {
$error = true; $error = true;
flash_alert("Bad column count.", 'error'); flashAlert("Bad column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -1788,7 +1788,7 @@ if (isset($_POST["import_client_asset_interfaces_csv"])) {
logAudit("Asset", "Import", "$session_name imported $row_count interfaces(s) to asset $asset_name via CSV file", $client_id); logAudit("Asset", "Import", "$session_name imported $row_count interfaces(s) to asset $asset_name via CSV file", $client_id);
flash_alert("<strong>$row_count</strong> Interfaces(s) added to asset <strong>$asset_name</stong>, <strong>$duplicate_count</strong> duplicate(s) detected"); flashAlert("<strong>$row_count</strong> Interfaces(s) added to asset <strong>$asset_name</stong>, <strong>$duplicate_count</strong> duplicate(s) detected");
redirect(); redirect();

View File

@@ -18,7 +18,7 @@ if (isset($_POST['add_category'])) {
logAudit("Category", "Create", "$session_name created category $type $name", 0, $category_id); logAudit("Category", "Create", "$session_name created category $type $name", 0, $category_id);
flash_alert("Category $type <strong>$name</strong> created"); flashAlert("Category $type <strong>$name</strong> created");
redirect(); redirect();

View File

@@ -40,7 +40,7 @@ if (isset($_POST['add_certificate'])) {
logAudit("Certificate", "Create", "$session_name created certificate $name", $client_id, $certificate_id); logAudit("Certificate", "Create", "$session_name created certificate $name", $client_id, $certificate_id);
flash_alert("Certificate <strong>$name</strong> created"); flashAlert("Certificate <strong>$name</strong> created");
redirect(); redirect();
@@ -113,7 +113,7 @@ if (isset($_POST['edit_certificate'])) {
logAudit("Certificate", "Edit", "$session_name edited certificate $name", $client_id, $certificate_id); logAudit("Certificate", "Edit", "$session_name edited certificate $name", $client_id, $certificate_id);
flash_alert("Certificate <strong>$name</strong> updated"); flashAlert("Certificate <strong>$name</strong> updated");
redirect(); redirect();
@@ -139,7 +139,7 @@ if (isset($_GET['archive_certificate'])) {
logAudit("Certificate", "Archive", "$session_name archived certificate $certificate_name", $client_id, $certificate_id); logAudit("Certificate", "Archive", "$session_name archived certificate $certificate_name", $client_id, $certificate_id);
flash_alert("Certificate <strong>$certificate_name</strong> archived", 'alert'); flashAlert("Certificate <strong>$certificate_name</strong> archived", 'alert');
redirect(); redirect();
@@ -165,7 +165,7 @@ if (isset($_GET['restore_certificate'])) {
logAudit("Certificate", "Restore", "$session_name restored certificate $certificate_name", $client_id, $certificate_id); logAudit("Certificate", "Restore", "$session_name restored certificate $certificate_name", $client_id, $certificate_id);
flash_alert("Certificate <strong>$certificate_name</strong> restored"); flashAlert("Certificate <strong>$certificate_name</strong> restored");
redirect(); redirect();
@@ -191,7 +191,7 @@ if (isset($_GET['delete_certificate'])) {
logAudit("Certificate", "Delete", "$session_name deleted certificate $name", $client_id); logAudit("Certificate", "Delete", "$session_name deleted certificate $name", $client_id);
flash_alert("Certificate <strong>$certificate_name</strong> deleted"); flashAlert("Certificate <strong>$certificate_name</strong> deleted");
redirect(); redirect();
@@ -229,7 +229,7 @@ if (isset($_POST['bulk_delete_certificates'])) {
logAudit("Certificate", "Bulk Delete", "$session_name deleted $count certificates", $client_id); logAudit("Certificate", "Bulk Delete", "$session_name deleted $count certificates", $client_id);
flash_alert("Deleted <strong>$count</strong> certificate(s)", 'error'); flashAlert("Deleted <strong>$count</strong> certificate(s)", 'error');
} }
@@ -263,7 +263,7 @@ if (isset($_POST['export_certificates_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Certificates-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Certificates-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -246,7 +246,7 @@ if (isset($_POST['add_client'])) {
logAudit("Client", "Create", "$session_name created client $name$extended_log_description", $client_id, $client_id); logAudit("Client", "Create", "$session_name created client $name$extended_log_description", $client_id, $client_id);
flash_alert("Client <strong>$name</strong> created"); flashAlert("Client <strong>$name</strong> created");
redirect(); redirect();
@@ -324,7 +324,7 @@ if (isset($_POST['edit_client'])) {
logAudit("Client", "Edit", "$session_name edited client $name", $client_id, $client_id); logAudit("Client", "Edit", "$session_name edited client $name", $client_id, $client_id);
flash_alert("Client <strong>$name</strong> updated"); flashAlert("Client <strong>$name</strong> updated");
redirect(); redirect();
@@ -354,7 +354,7 @@ if (isset($_GET['archive_client'])) {
logAudit("Client", "Archive", "$session_name archived client $client_name", $client_id, $client_id); logAudit("Client", "Archive", "$session_name archived client $client_name", $client_id, $client_id);
flash_alert("Client <strong>$client_name</strong> archived", 'error'); flashAlert("Client <strong>$client_name</strong> archived", 'error');
redirect(); redirect();
@@ -375,7 +375,7 @@ if (isset($_GET['restore_client'])) {
logAudit("Client", "Restored", "$session_name restored client $client_name", $client_id); logAudit("Client", "Restored", "$session_name restored client $client_name", $client_id);
flash_alert("Client <strong>$client_name</strong> restored"); flashAlert("Client <strong>$client_name</strong> restored");
redirect(); redirect();
@@ -477,7 +477,7 @@ if (isset($_GET['delete_client'])) {
logAudit("Client", "Deleted", "$session_name deleted Client $client_name and all associated data"); logAudit("Client", "Deleted", "$session_name deleted Client $client_name and all associated data");
flash_alert("Client <strong>$client_name</strong> deleted along with all associated data", 'error'); flashAlert("Client <strong>$client_name</strong> deleted along with all associated data", 'error');
redirect('clients.php'); redirect('clients.php');
@@ -502,7 +502,7 @@ if (isset($_POST['export_clients_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($session_company_name . "-Clients-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($session_company_name . "-Clients-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -545,7 +545,7 @@ if (isset($_POST["import_clients_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -554,13 +554,13 @@ if (isset($_POST["import_clients_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if (in_array($file_extension,$allowed_file_extensions) === false) { if (in_array($file_extension,$allowed_file_extensions) === false) {
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif ($_FILES["file"]["size"] < 1) { elseif ($_FILES["file"]["size"] < 1) {
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count //(Else)Check column count
@@ -568,7 +568,7 @@ if (isset($_POST["import_clients_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if (!$error & count($f_columns) != 22) { if (!$error & count($f_columns) != 22) {
$error = true; $error = true;
flash_alert("Bad column count.", 'error'); flashAlert("Bad column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -731,7 +731,7 @@ if (isset($_POST["import_clients_csv"])) {
logAudit("Client", "Import", "$session_name imported $row_count client(s) via CSV file, $duplicate_count duplicate(s) found"); logAudit("Client", "Import", "$session_name imported $row_count client(s) via CSV file, $duplicate_count duplicate(s) found");
flash_alert("<strong>$row_count</strong> Client(s) added, <strong>$duplicate_count</strong> duplicate(s) found"); flashAlert("<strong>$row_count</strong> Client(s) added, <strong>$duplicate_count</strong> duplicate(s) found");
redirect(); redirect();
@@ -875,7 +875,7 @@ if (isset($_POST['bulk_add_client_ticket'])) {
logAudit("Ticket", "Bulk Create", "$session_name created $client_count tickets for $client_name"); logAudit("Ticket", "Bulk Create", "$session_name created $client_count tickets for $client_name");
flash_alert("<strong>$client_count</strong> tickets created for selected clients"); flashAlert("<strong>$client_count</strong> tickets created for selected clients");
} }
@@ -910,7 +910,7 @@ if (isset($_POST['bulk_edit_client_industry'])) {
logAudit("Client", "Bulk Edit", "$session_name set the department $industry for $count client(s)", $client_id); logAudit("Client", "Bulk Edit", "$session_name set the department $industry for $count client(s)", $client_id);
flash_alert("Set the Industry to <strong>$industry</strong> for <strong>$count</strong> clients"); flashAlert("Set the Industry to <strong>$industry</strong> for <strong>$count</strong> clients");
} }
redirect(); redirect();
@@ -944,7 +944,7 @@ if (isset($_POST['bulk_edit_client_referral'])) {
logAudit("Client", "Bulk Edit", "$session_name set the referral $referral for $count client(s)", $client_id); logAudit("Client", "Bulk Edit", "$session_name set the referral $referral for $count client(s)", $client_id);
flash_alert("Set the Referral to <strong>$referral</strong> for <strong>$count</strong> clients"); flashAlert("Set the Referral to <strong>$referral</strong> for <strong>$count</strong> clients");
} }
redirect(); redirect();
@@ -978,7 +978,7 @@ if (isset($_POST['bulk_edit_client_hourly_rate'])) {
logAudit("Client", "Bulk Edit", "$session_name set the hourly rate" . numfmt_format_currency($currency_format, $rate, $session_company_currency) . "for $count client(s)", $client_id); logAudit("Client", "Bulk Edit", "$session_name set the hourly rate" . numfmt_format_currency($currency_format, $rate, $session_company_currency) . "for $count client(s)", $client_id);
flash_alert("Set the Hourly Rate to <strong>" . numfmt_format_currency($currency_format, $rate, $session_company_currency) . "</strong> for <strong>$count</strong> client(s)"); flashAlert("Set the Hourly Rate to <strong>" . numfmt_format_currency($currency_format, $rate, $session_company_currency) . "</strong> for <strong>$count</strong> client(s)");
} }
redirect(); redirect();
@@ -1012,7 +1012,7 @@ if (isset($_POST['bulk_edit_client_net_terms'])) {
logAudit("Client", "Bulk Edit", "$session_name set the net terms to $net_terms days for $count client(s)", $client_id); logAudit("Client", "Bulk Edit", "$session_name set the net terms to $net_terms days for $count client(s)", $client_id);
flash_alert("Set Net Term to <strong>$net_terms days</strong> for <strong>$count</strong> client(s)"); flashAlert("Set Net Term to <strong>$net_terms days</strong> for <strong>$count</strong> client(s)");
} }
redirect(); redirect();
@@ -1057,7 +1057,7 @@ if (isset($_POST['bulk_assign_client_tags'])) {
logAudit("Client", "Bulk Edit", "$session_name added tags for $count clients", $client_id); logAudit("Client", "Bulk Edit", "$session_name added tags for $count clients", $client_id);
flash_alert("Assigned tags for <strong>$count</strong> clients"); flashAlert("Assigned tags for <strong>$count</strong> clients");
} }
redirect(); redirect();
@@ -1144,9 +1144,9 @@ if (isset($_POST['bulk_send_client_email']) && isset($_POST['client_ids'])) {
if (!empty($data)) { if (!empty($data)) {
addToMailQueue($data); addToMailQueue($data);
logAudit("Bulk Mail", "Send", "$session_name sent " . count($data) . " messages via bulk mail"); logAudit("Bulk Mail", "Send", "$session_name sent " . count($data) . " messages via bulk mail");
flash_alert("<strong>" . count($data) . "</strong> messages queued"); flashAlert("<strong>" . count($data) . "</strong> messages queued");
} else { } else {
flash_alert("No valid contacts found to queue emails.", 'error'); flashAlert("No valid contacts found to queue emails.", 'error');
} }
redirect(); redirect();
@@ -1181,7 +1181,7 @@ if (isset($_POST['bulk_archive_clients'])) {
logAudit("Client", "Bulk Archive", "$session_name archived $count clients", $client_id); logAudit("Client", "Bulk Archive", "$session_name archived $count clients", $client_id);
flash_alert("Archived $count client(s)", 'error'); flashAlert("Archived $count client(s)", 'error');
} }
@@ -1215,7 +1215,7 @@ if (isset($_POST['bulk_unarchive_clients'])) {
logAudit("Client", "Bulk Restore", "$session_name restored $count client(s)", $client_id); logAudit("Client", "Bulk Restore", "$session_name restored $count client(s)", $client_id);
flash_alert("You restored <strong>$count</strong> client(s)"); flashAlert("You restored <strong>$count</strong> client(s)");
} }

View File

@@ -76,7 +76,7 @@ if (isset($_POST['add_contact'])) {
customAction('contact_create', $contact_id); customAction('contact_create', $contact_id);
flash_alert("Contact <strong>$name</strong> created"); flashAlert("Contact <strong>$name</strong> created");
redirect(); redirect();
@@ -221,7 +221,7 @@ if (isset($_POST['edit_contact'])) {
customAction('contact_update', $contact_id); customAction('contact_update', $contact_id);
flash_alert("Contact <strong>$name</strong> updated"); flashAlert("Contact <strong>$name</strong> updated");
redirect(); redirect();
@@ -280,7 +280,7 @@ if (isset($_GET['archive_contact_note'])) {
logAudit("Contact", "Edit", "$session_name archived note $contact_note_type for $contact_name", $client_id, $contact_id); logAudit("Contact", "Edit", "$session_name archived note $contact_note_type for $contact_name", $client_id, $contact_id);
flash_alert("Note <strong>$contact_note_type</strong> archived", 'error'); flashAlert("Note <strong>$contact_note_type</strong> archived", 'error');
redirect(); redirect();
@@ -308,7 +308,7 @@ if (isset($_GET['restore_contact_note'])) {
logAudit("Contact", "Edit", "$session_name restored note $contact_note_type for $contact_name", $client_id, $contact_id); logAudit("Contact", "Edit", "$session_name restored note $contact_note_type for $contact_name", $client_id, $contact_id);
flash_alert("Note <strong>$contact_note_type</strong> restored"); flashAlert("Note <strong>$contact_note_type</strong> restored");
redirect(); redirect();
@@ -336,7 +336,7 @@ if (isset($_GET['delete_contact_note'])) {
logAudit("Contact", "Edit", "$session_name deleted $contact_note_type note for $contact_name", $client_id, $contact_id); logAudit("Contact", "Edit", "$session_name deleted $contact_note_type note for $contact_name", $client_id, $contact_id);
flash_alert("Note <strong>$contact_note_type</strong> deleted.", 'error'); flashAlert("Note <strong>$contact_note_type</strong> deleted.", 'error');
redirect(); redirect();
@@ -380,7 +380,7 @@ if (isset($_POST['bulk_assign_contact_location'])) {
logAudit("Contact", "Bulk Edit", "$session_name assigned $contact_count contacts to location $location_name", $client_id); logAudit("Contact", "Bulk Edit", "$session_name assigned $contact_count contacts to location $location_name", $client_id);
flash_alert("<b>$contact_count</b> contacts assigned to location <b>$location_name</b>"); flashAlert("<b>$contact_count</b> contacts assigned to location <b>$location_name</b>");
} }
redirect(); redirect();
@@ -420,7 +420,7 @@ if (isset($_POST['bulk_edit_contact_phone'])) {
logAudit("Contact", "Bulk Edit", "$session_name set the Phone Number $phone for $contact_count contacts", $client_id); logAudit("Contact", "Bulk Edit", "$session_name set the Phone Number $phone for $contact_count contacts", $client_id);
flash_alert("Phone Number set to <b>" . formatPhoneNumber($phone) . "</b> on $contact_count</b> contacts"); flashAlert("Phone Number set to <b>" . formatPhoneNumber($phone) . "</b> on $contact_count</b> contacts");
} }
redirect(); redirect();
@@ -460,7 +460,7 @@ if (isset($_POST['bulk_edit_contact_department'])) {
logAudit("Contact", "Bulk Edit", "$session_name set the department $department for $contact_count contacts", $client_id); logAudit("Contact", "Bulk Edit", "$session_name set the department $department for $contact_count contacts", $client_id);
flash_alert("You set the Department to <strong>$department</strong> for <strong>$contact_count</strong> contacts"); flashAlert("You set the Department to <strong>$department</strong> for <strong>$contact_count</strong> contacts");
} }
redirect(); redirect();
@@ -504,7 +504,7 @@ if (isset($_POST['bulk_edit_contact_role'])) {
logAudit("Contact", "Bulk Edit", "$session_name edited the contact role for $contact_count contacts", $client_id); logAudit("Contact", "Bulk Edit", "$session_name edited the contact role for $contact_count contacts", $client_id);
flash_alert("You updated contact roles for <b>$contact_count</b> contacts"); flashAlert("You updated contact roles for <b>$contact_count</b> contacts");
} }
redirect(); redirect();
@@ -557,7 +557,7 @@ if (isset($_POST['bulk_assign_contact_tags'])) {
logAudit("Contact", "Bulk Edit", "$session_name added tags for $contact_count contacts", $client_id); logAudit("Contact", "Bulk Edit", "$session_name added tags for $contact_count contacts", $client_id);
flash_alert("You assigned tags for <strong>$count</strong> contacts"); flashAlert("You assigned tags for <strong>$count</strong> contacts");
} }
redirect(); redirect();
@@ -607,7 +607,7 @@ if (isset($_POST['send_bulk_mail_now'])) {
logAudit("Bulk Mail", "Send", "$session_name sent $count messages via bulk mail"); logAudit("Bulk Mail", "Send", "$session_name sent $count messages via bulk mail");
flash_alert("<strong>$count</strong> messages queued"); flashAlert("<strong>$count</strong> messages queued");
} }
@@ -659,7 +659,7 @@ if (isset($_POST['bulk_archive_contacts'])) {
logAudit("Contact", "Bulk Archive", "$session_name archived $count contacts", $client_id); logAudit("Contact", "Bulk Archive", "$session_name archived $count contacts", $client_id);
flash_alert("Archived $count contact(s)", 'error'); flashAlert("Archived $count contact(s)", 'error');
} }
@@ -704,7 +704,7 @@ if (isset($_POST['bulk_restore_contacts'])) {
logAudit("Contact", "Bulk Restore", "$session_name restored $count contacts", $client_id); logAudit("Contact", "Bulk Restore", "$session_name restored $count contacts", $client_id);
flash_alert("Restored <strong>$count</strong> contact(s)"); flashAlert("Restored <strong>$count</strong> contact(s)");
} }
@@ -749,7 +749,7 @@ if (isset($_POST['bulk_delete_contacts'])) {
logAudit("Contact", "Bulk Delete", "$session_name deleted $count contacts", $client_id); logAudit("Contact", "Bulk Delete", "$session_name deleted $count contacts", $client_id);
flash_alert("You deleted <strong>$count</strong> contact(s)"); flashAlert("You deleted <strong>$count</strong> contact(s)");
} }
@@ -859,7 +859,7 @@ if (isset($_GET['anonymize_contact'])) {
logAudit("Contact", "Archive", "$session_name archived and anonymized contact", $client_id, $contact_id); logAudit("Contact", "Archive", "$session_name archived and anonymized contact", $client_id, $contact_id);
flash_alert("Contact $contact_name anonymized & archived", 'error'); flashAlert("Contact $contact_name anonymized & archived", 'error');
redirect(); redirect();
@@ -891,7 +891,7 @@ if (isset($_GET['archive_contact'])) {
logAudit("Contact", "Archive", "$session_name archived contact $contact_name", $client_id, $contact_id); logAudit("Contact", "Archive", "$session_name archived contact $contact_name", $client_id, $contact_id);
flash_alert("Contact <strong>$contact_name</strong> has been archived", 'error'); flashAlert("Contact <strong>$contact_name</strong> has been archived", 'error');
redirect(); redirect();
@@ -923,7 +923,7 @@ if (isset($_GET['restore_contact'])) {
logAudit("Contact", "Restore", "$session_name restored contact $contact_name", $client_id, $contact_id); logAudit("Contact", "Restore", "$session_name restored contact $contact_name", $client_id, $contact_id);
flash_alert("Contact <strong>$contact_name</strong> Restored"); flashAlert("Contact <strong>$contact_name</strong> Restored");
redirect(); redirect();
@@ -955,7 +955,7 @@ if (isset($_GET['delete_contact'])) {
logAudit("Contact", "Delete", "$session_name deleted contact $contact_name", $client_id); logAudit("Contact", "Delete", "$session_name deleted contact $contact_name", $client_id);
flash_alert("Contact <strong>$contact_name</strong> has been deleted.", 'error'); flashAlert("Contact <strong>$contact_name</strong> has been deleted.", 'error');
redirect(); redirect();
@@ -985,7 +985,7 @@ if (isset($_POST['link_contact_to_asset'])) {
logAudit("Asset", "Link", "$session_name linked asset $asset_name to contact $contact_name", $client_id, $asset_id); logAudit("Asset", "Link", "$session_name linked asset $asset_name to contact $contact_name", $client_id, $asset_id);
flash_alert("Contact <strong>$contact_name</strong> linked with asset <strong>$asset_name</strong>"); flashAlert("Contact <strong>$contact_name</strong> linked with asset <strong>$asset_name</strong>");
redirect(); redirect();
@@ -1015,7 +1015,7 @@ if (isset($_GET['unlink_asset_from_contact'])) {
logAudit("Asset", "Unlink", "$session_name unlinked contact $contact_name from asset $asset_name", $client_id, $asset_id); logAudit("Asset", "Unlink", "$session_name unlinked contact $contact_name from asset $asset_name", $client_id, $asset_id);
flash_alert("Asset <strong>$asset_name</strong> unlinked from Contact <strong>$contact_name</strong>", 'error'); flashAlert("Asset <strong>$asset_name</strong> unlinked from Contact <strong>$contact_name</strong>", 'error');
redirect(); redirect();
@@ -1045,7 +1045,7 @@ if (isset($_POST['link_software_to_contact'])) {
logAudit("Software", "Link", "$session_name added software license $software_name to contact $contact_name", $client_id, $software_id); logAudit("Software", "Link", "$session_name added software license $software_name to contact $contact_name", $client_id, $software_id);
flash_alert("Software <strong>$software_name</strong> licensed for contact <strong>$contact_name</strong>"); flashAlert("Software <strong>$software_name</strong> licensed for contact <strong>$contact_name</strong>");
redirect(); redirect();
@@ -1075,7 +1075,7 @@ if (isset($_GET['unlink_software_from_contact'])) {
logAudit("software", "Unlink", "$session_name removed software license $software_name from contact $contact_name", $client_id, $software_id); logAudit("software", "Unlink", "$session_name removed software license $software_name from contact $contact_name", $client_id, $software_id);
flash_alert("Removed Software License <strong>$software_name</strong> for Contact <strong>$contact_name</strong>", 'error'); flashAlert("Removed Software License <strong>$software_name</strong> for Contact <strong>$contact_name</strong>", 'error');
redirect(); redirect();
@@ -1105,7 +1105,7 @@ if (isset($_POST['link_contact_to_credential'])) {
logAudit("Asset", "Link", "$session_name linked credential $credential_name to contact $contact_name", $client_id, $credential_id); logAudit("Asset", "Link", "$session_name linked credential $credential_name to contact $contact_name", $client_id, $credential_id);
flash_alert("Contact <strong>$contact_name</strong> linked with credential <strong>$credential_name</strong>"); flashAlert("Contact <strong>$contact_name</strong> linked with credential <strong>$credential_name</strong>");
redirect(); redirect();
@@ -1135,7 +1135,7 @@ if (isset($_GET['unlink_credential_from_contact'])) {
logAudit("Credential", "Unlink", "$session_name unlinked contact $contact_name from credential $credential_name", $client_id, $credential_id); logAudit("Credential", "Unlink", "$session_name unlinked contact $contact_name from credential $credential_name", $client_id, $credential_id);
flash_alert("Credential <strong>$credential_name</strong> unlinked from Contact <strong>$contact_name</strong>", 'error'); flashAlert("Credential <strong>$credential_name</strong> unlinked from Contact <strong>$contact_name</strong>", 'error');
redirect(); redirect();
@@ -1165,7 +1165,7 @@ if (isset($_POST['link_service_to_contact'])) {
logAudit("Service", "Link", "$session_name linked contact $contact_name to service $service_name", $client_id, $service_id); logAudit("Service", "Link", "$session_name linked contact $contact_name to service $service_name", $client_id, $service_id);
flash_alert("service <strong>$service_name</strong> linked with contact <strong>$contact_name</strong>"); flashAlert("service <strong>$service_name</strong> linked with contact <strong>$contact_name</strong>");
redirect(); redirect();
@@ -1195,7 +1195,7 @@ if (isset($_GET['unlink_service_from_contact'])) {
logAudit("service", "Unlink", "$session_name unlinked contact $contact_name from service $service_name", $client_id, $service_id); logAudit("service", "Unlink", "$session_name unlinked contact $contact_name from service $service_name", $client_id, $service_id);
flash_alert("Contact <strong>$contact_name</strong> unlinked from service <strong>$service_name</strong>", 'error'); flashAlert("Contact <strong>$contact_name</strong> unlinked from service <strong>$service_name</strong>", 'error');
redirect(); redirect();
@@ -1226,7 +1226,7 @@ if (isset($_POST['link_contact_to_file'])) {
logAudit("File", "Link", "$session_name linked contact $contact_name to file $file_name", $client_id, $file_id); logAudit("File", "Link", "$session_name linked contact $contact_name to file $file_name", $client_id, $file_id);
flash_alert("Contact <strong>$contact_name</strong> linked with File <strong>$file_name</strong>"); flashAlert("Contact <strong>$contact_name</strong> linked with File <strong>$file_name</strong>");
redirect(); redirect();
@@ -1256,7 +1256,7 @@ if (isset($_GET['unlink_contact_from_file'])) {
logAudit("File", "Unlink", "$session_name unlinked contact $contact_name from file $file_name", $client_id, $file_id); logAudit("File", "Unlink", "$session_name unlinked contact $contact_name from file $file_name", $client_id, $file_id);
flash_alert("Contact <strong>$contact_name</strong> unlinked from file <strong>$file_name</strong>", 'error'); flashAlert("Contact <strong>$contact_name</strong> unlinked from file <strong>$file_name</strong>", 'error');
redirect(); redirect();
@@ -1287,7 +1287,7 @@ if (isset($_POST['export_contacts_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Contacts-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Contacts-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -1335,7 +1335,7 @@ if (isset($_POST["import_contacts_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -1344,13 +1344,13 @@ if (isset($_POST["import_contacts_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if (in_array($file_extension,$allowed_file_extensions) === false) { if (in_array($file_extension,$allowed_file_extensions) === false) {
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif ($_FILES["file"]["size"] < 1) { elseif ($_FILES["file"]["size"] < 1) {
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count //(Else)Check column count
@@ -1358,7 +1358,7 @@ if (isset($_POST["import_contacts_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if (!$error & count($f_columns) != 8) { if (!$error & count($f_columns) != 8) {
$error = true; $error = true;
flash_alert("Bad column count.", 'error'); flashAlert("Bad column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -1415,7 +1415,7 @@ if (isset($_POST["import_contacts_csv"])) {
logAudit("Contact", "Import", "$session_name imported $row_count contact(s) via CSV file", $client_id); logAudit("Contact", "Import", "$session_name imported $row_count contact(s) via CSV file", $client_id);
flash_alert("$row_count Contact(s) added, $duplicate_count duplicate(s) detected", 'warning'); flashAlert("$row_count Contact(s) added, $duplicate_count duplicate(s) detected", 'warning');
redirect(); redirect();

View File

@@ -32,7 +32,7 @@ if (isset($_POST['add_credential'])) {
logAudit("Credential", "Create", "$session_name created credential $name", $client_id, $credential_id); logAudit("Credential", "Create", "$session_name created credential $name", $client_id, $credential_id);
flash_alert("Credential <strong>$name</strong> created"); flashAlert("Credential <strong>$name</strong> created");
redirect(); redirect();
@@ -77,7 +77,7 @@ if (isset($_POST['edit_credential'])) {
logAudit("Credential", "Edit", "$session_name edited credential $name", $client_id, $credential_id); logAudit("Credential", "Edit", "$session_name edited credential $name", $client_id, $credential_id);
flash_alert("Credential <strong>$name</strong> edited"); flashAlert("Credential <strong>$name</strong> edited");
redirect(); redirect();
@@ -103,7 +103,7 @@ if(isset($_GET['archive_credential'])){
logAudit("Credential", "Archive", "$session_name archived credential $credential_name", $client_id, $credential_id); logAudit("Credential", "Archive", "$session_name archived credential $credential_name", $client_id, $credential_id);
flash_alert("Credential <strong>$credential_name</strong> archived", 'error'); flashAlert("Credential <strong>$credential_name</strong> archived", 'error');
redirect(); redirect();
@@ -129,7 +129,7 @@ if(isset($_GET['restore_credential'])){
logAudit("Credential", "Restore", "$session_name restored credential $credential_name", $client_id, $credential_id); logAudit("Credential", "Restore", "$session_name restored credential $credential_name", $client_id, $credential_id);
flash_alert("Credential <strong>$credential_name</strong> restored"); flashAlert("Credential <strong>$credential_name</strong> restored");
redirect(); redirect();
@@ -155,7 +155,7 @@ if (isset($_GET['delete_credential'])) {
logAudit("Credential", "Delete", "$session_name deleted credential $credential_name", $client_id); logAudit("Credential", "Delete", "$session_name deleted credential $credential_name", $client_id);
flash_alert("Credential <strong>$credential_name</strong> deleted", 'error'); flashAlert("Credential <strong>$credential_name</strong> deleted", 'error');
redirect(); redirect();
@@ -203,7 +203,7 @@ if (isset($_POST['bulk_assign_credential_tags'])) {
logAudit("Credential", "Edit", "$session_name added tags to $credential_name", $client_id, $credential_id); logAudit("Credential", "Edit", "$session_name added tags to $credential_name", $client_id, $credential_id);
flash_alert("Assigned tags for <strong>$count</strong> credentials"); flashAlert("Assigned tags for <strong>$count</strong> credentials");
} // End Assign Loop } // End Assign Loop
@@ -245,7 +245,7 @@ if (isset($_POST['bulk_favorite_credentials'])) {
logAudit("Credential", "Bulk Edit", "$session_name favorited $count credentials", $client_id); logAudit("Credential", "Bulk Edit", "$session_name favorited $count credentials", $client_id);
flash_alert("Favorited <strong>$count</strong> credential(s)"); flashAlert("Favorited <strong>$count</strong> credential(s)");
} }
@@ -283,7 +283,7 @@ if (isset($_POST['bulk_unfavorite_credentials'])) {
logAudit("Crednetial", "Bulk Edit", "$session_name unfavorited $count credentials", $client_id); logAudit("Crednetial", "Bulk Edit", "$session_name unfavorited $count credentials", $client_id);
flash_alert("Unfavorited <strong>$count</strong> credential(s)"); flashAlert("Unfavorited <strong>$count</strong> credential(s)");
} }
@@ -322,7 +322,7 @@ if (isset($_POST['bulk_archive_credentials'])) {
logAudit("Credential", "Bulk Archive", "$session_name archived $count credentials", $client_id); logAudit("Credential", "Bulk Archive", "$session_name archived $count credentials", $client_id);
flash_alert("Archived <strong>$count</strong> credential(s)", 'error'); flashAlert("Archived <strong>$count</strong> credential(s)", 'error');
} }
@@ -362,7 +362,7 @@ if (isset($_POST['bulk_restore_credentials'])) {
logAudit("Credential", "Bulk Restore", "$session_name restored $count credential(s)", $client_id); logAudit("Credential", "Bulk Restore", "$session_name restored $count credential(s)", $client_id);
flash_alert("Restored <strong>$count</strong> credential(s)"); flashAlert("Restored <strong>$count</strong> credential(s)");
} }
@@ -402,7 +402,7 @@ if (isset($_POST['bulk_delete_credentials'])) {
logAudit("Credential", "Bulk Delete", "$session_name deleted $count credential(s)", $client_id); logAudit("Credential", "Bulk Delete", "$session_name deleted $count credential(s)", $client_id);
flash_alert("Deleted <strong>$count</strong> credential(s)", 'error'); flashAlert("Deleted <strong>$count</strong> credential(s)", 'error');
} }
@@ -436,7 +436,7 @@ if (isset($_POST['export_credentials_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Credentials-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Credentials-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -485,7 +485,7 @@ if (isset($_POST["import_credentials_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -494,13 +494,13 @@ if (isset($_POST["import_credentials_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if (in_array($file_extension,$allowed_file_extensions) === false){ if (in_array($file_extension,$allowed_file_extensions) === false){
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif ($_FILES["file"]["size"] < 1){ elseif ($_FILES["file"]["size"] < 1){
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count //(Else)Check column count
@@ -508,7 +508,7 @@ if (isset($_POST["import_credentials_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if (!$error & count($f_columns) != 6) { if (!$error & count($f_columns) != 6) {
$error = true; $error = true;
flash_alert("Bad column count.", 'error'); flashAlert("Bad column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -560,7 +560,7 @@ if (isset($_POST["import_credentials_csv"])) {
logAudit("Credential", "Import", "$session_name imported $row_count credential(s) via CSV file. $duplicate_count duplicate(s) found and not imported", $client_id); logAudit("Credential", "Import", "$session_name imported $row_count credential(s) via CSV file. $duplicate_count duplicate(s) found and not imported", $client_id);
flash_alert("<strong>$row_count</strong> credential(s) imported, <strong>$duplicate_count</strong> duplicate(s) detected and not imported", 'warning'); flashAlert("<strong>$row_count</strong> credential(s) imported, <strong>$duplicate_count</strong> duplicate(s) detected and not imported", 'warning');
redirect(); redirect();
} }

View File

@@ -24,7 +24,7 @@ if (isset($_POST['add_credit'])) {
logAudit("Credit", "Create", "$session_name added " . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "", $client_id, $credit_id); logAudit("Credit", "Create", "$session_name added " . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "", $client_id, $credit_id);
flash_alert(numfmt_format_currency($currency_format, $amount, $session_company_currency) . " Credit Added"); flashAlert(numfmt_format_currency($currency_format, $amount, $session_company_currency) . " Credit Added");
redirect(); redirect();

View File

@@ -47,7 +47,7 @@ if (isset($_POST['add_document'])) {
logAudit("Document", "Create", "$session_name created document $name", $client_id, $document_id); logAudit("Document", "Create", "$session_name created document $name", $client_id, $document_id);
flash_alert("Document <strong>$name</strong> created"); flashAlert("Document <strong>$name</strong> created");
redirect(); redirect();
@@ -132,7 +132,7 @@ if (isset($_POST['add_document_from_template'])) {
$document_id $document_id
); );
flash_alert("Document <strong>$document_name</strong> created from template"); flashAlert("Document <strong>$document_name</strong> created from template");
redirect("document_details.php?client_id=$client_id&document_id=$document_id"); redirect("document_details.php?client_id=$client_id&document_id=$document_id");
} }
@@ -236,7 +236,7 @@ if (isset($_POST['edit_document'])) {
$document_version_id $document_version_id
); );
flash_alert("Document <strong>$name</strong> edited, previous version kept"); flashAlert("Document <strong>$name</strong> edited, previous version kept");
redirect("document_details.php?client_id=$client_id&document_id=$document_id"); redirect("document_details.php?client_id=$client_id&document_id=$document_id");
@@ -269,7 +269,7 @@ if (isset($_POST['move_document'])) {
logAudit("Document", "Move", "$session_name moved document $document_name to folder $folder_name", $client_id, $document_id); logAudit("Document", "Move", "$session_name moved document $document_name to folder $folder_name", $client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> moved to folder <strong>$folder_name</strong>"); flashAlert("Document <strong>$document_name</strong> moved to folder <strong>$folder_name</strong>");
redirect(); redirect();
@@ -299,7 +299,7 @@ if (isset($_POST['rename_document'])) {
logAudit("Document", "Edit", "$session_name renamed document $old_document_name to $name", $client_id, $document_id); logAudit("Document", "Edit", "$session_name renamed document $old_document_name to $name", $client_id, $document_id);
flash_alert("You renamed Document from <strong>$old_document_name</strong> to <strong>$name</strong>"); flashAlert("You renamed Document from <strong>$old_document_name</strong> to <strong>$name</strong>");
redirect(); redirect();
@@ -341,7 +341,7 @@ if (isset($_POST['bulk_move_document'])) {
logAudit("Document", "Bulk Move", "$session_name moved $count document(s) to folder $folder_name", $client_id); logAudit("Document", "Bulk Move", "$session_name moved $count document(s) to folder $folder_name", $client_id);
} }
flash_alert("You moved <strong>$count</strong> document(s) to the folder <strong>$folder_name</strong>"); flashAlert("You moved <strong>$count</strong> document(s) to the folder <strong>$folder_name</strong>");
redirect(); redirect();
@@ -372,7 +372,7 @@ if (isset($_POST['link_file_to_document'])) {
logAudit("Document", "Link", "$session_name linked file $file_name to document $document_name", $client_id, $document_id); logAudit("Document", "Link", "$session_name linked file $file_name to document $document_name", $client_id, $document_id);
flash_alert("File <strong>$file_name</strong> linked with Document <strong>$document_name</strong>"); flashAlert("File <strong>$file_name</strong> linked with Document <strong>$document_name</strong>");
redirect(); redirect();
@@ -402,7 +402,7 @@ if (isset($_GET['unlink_file_from_document'])) {
logAudit("Document", "Unlink", "$session_name unlinked file $file_name from document $document_name", $client_id, $document_id); logAudit("Document", "Unlink", "$session_name unlinked file $file_name from document $document_name", $client_id, $document_id);
flash_alert("File <strong>$file_name</strong> unlinked from Document <strong>$document_name</strong>", 'error'); flashAlert("File <strong>$file_name</strong> unlinked from Document <strong>$document_name</strong>", 'error');
redirect(); redirect();
@@ -433,7 +433,7 @@ if (isset($_POST['link_vendor_to_document'])) {
logAudit("Document", "Link", "$session_name linked vendor $vendor_name to document $document_name", $client_id, $document_id); logAudit("Document", "Link", "$session_name linked vendor $vendor_name to document $document_name", $client_id, $document_id);
flash_alert("Vendor <strong>$vendor_name</strong> linked with Document <strong>$document_name</strong>"); flashAlert("Vendor <strong>$vendor_name</strong> linked with Document <strong>$document_name</strong>");
redirect(); redirect();
@@ -463,7 +463,7 @@ if (isset($_GET['unlink_vendor_from_document'])) {
logAudit("Document", "Unlink", "$session_name unlinked vendor $vendor_name from document $document_name", $client_id, $document_id); logAudit("Document", "Unlink", "$session_name unlinked vendor $vendor_name from document $document_name", $client_id, $document_id);
flash_alert("Vendor <strong>$vendor_name</strong> unlinked from Document <strong>$document_name</strong>", 'error'); flashAlert("Vendor <strong>$vendor_name</strong> unlinked from Document <strong>$document_name</strong>", 'error');
redirect(); redirect();
@@ -495,7 +495,7 @@ if (isset($_POST['link_contact_to_document'])) {
logAudit("Document", "Link", "$session_name linked contact $contact_name to document $document_name", $client_id, $document_id); logAudit("Document", "Link", "$session_name linked contact $contact_name to document $document_name", $client_id, $document_id);
flash_alert("Contact <strong>$contact_name</strong> linked with Document <strong>$document_name</strong>"); flashAlert("Contact <strong>$contact_name</strong> linked with Document <strong>$document_name</strong>");
redirect(); redirect();
@@ -525,7 +525,7 @@ if (isset($_GET['unlink_contact_from_document'])) {
logAudit("Document", "Unlink", "$session_name unlinked contact $contact_name from document $document_name", $client_id, $document_id); logAudit("Document", "Unlink", "$session_name unlinked contact $contact_name from document $document_name", $client_id, $document_id);
flash_alert("Contact <strong>$contact_name</strong> unlinked from Document <strong>$document_name</strong>", 'error'); flashAlert("Contact <strong>$contact_name</strong> unlinked from Document <strong>$document_name</strong>", 'error');
redirect(); redirect();
@@ -555,7 +555,7 @@ if (isset($_POST['link_asset_to_document'])) {
logAudit("Document", "Link", "$session_name linked asset $asset_name to document $document_name", $client_id, $document_id); logAudit("Document", "Link", "$session_name linked asset $asset_name to document $document_name", $client_id, $document_id);
flash_alert("Asset <strong>$asset_name</strong> linked with Document <strong>$document_name</strong>"); flashAlert("Asset <strong>$asset_name</strong> linked with Document <strong>$document_name</strong>");
redirect(); redirect();
@@ -585,7 +585,7 @@ if (isset($_GET['unlink_asset_from_document'])) {
logAudit("Document", "Unlink", "$session_name unlinked asset $asset_name from document $document_name", $client_id, $document_id); logAudit("Document", "Unlink", "$session_name unlinked asset $asset_name from document $document_name", $client_id, $document_id);
flash_alert("Asset <strong>$asset_name</strong> unlinked from Document <strong>$document_name</strong>", 'error'); flashAlert("Asset <strong>$asset_name</strong> unlinked from Document <strong>$document_name</strong>", 'error');
redirect(); redirect();
@@ -616,7 +616,7 @@ if (isset($_POST['link_software_to_document'])) {
logAudit("Document", "Link", "$session_name linked software $software_name to document $document_name", $client_id, $document_id); logAudit("Document", "Link", "$session_name linked software $software_name to document $document_name", $client_id, $document_id);
flash_alert("Software <strong>$software_name</strong> linked with Document <strong>$document_name</strong>"); flashAlert("Software <strong>$software_name</strong> linked with Document <strong>$document_name</strong>");
redirect(); redirect();
@@ -646,7 +646,7 @@ if (isset($_GET['unlink_software_from_document'])) {
logAudit("Document", "Unlink", "$session_name unlinked software $software_name from document $document_name", $client_id, $document_id); logAudit("Document", "Unlink", "$session_name unlinked software $software_name from document $document_name", $client_id, $document_id);
flash_alert("Software <strong>$software_name</strong> unlinked from Document <strong>$document_name</strong>", 'error'); flashAlert("Software <strong>$software_name</strong> unlinked from Document <strong>$document_name</strong>", 'error');
redirect(); redirect();
@@ -679,7 +679,7 @@ if (isset($_POST['toggle_document_visibility'])) {
logAudit("Document", "Edit", "$session_name changed document $document_name visibilty to $visable_wording in the client portal", $client_id, $document_id); logAudit("Document", "Edit", "$session_name changed document $document_name visibilty to $visable_wording in the client portal", $client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> changed to <strong>$visable_wording</strong> in the client portal"); flashAlert("Document <strong>$document_name</strong> changed to <strong>$visable_wording</strong> in the client portal");
redirect(); redirect();
@@ -727,7 +727,7 @@ if (isset($_GET['export_document'])) {
// Logging // Logging
logAudit("Document", "Export", "$session_name exported document $document_name", $client_id, $document_id); logAudit("Document", "Export", "$session_name exported document $document_name", $client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> exported"); flashAlert("Document <strong>$document_name</strong> exported");
redirect(); redirect();
@@ -772,7 +772,7 @@ if (isset($_GET['archive_document'])) {
logAudit("Document", "Archive", "$session_name archived document $document_name", $client_id, $document_id); logAudit("Document", "Archive", "$session_name archived document $document_name", $client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> archived", 'error'); flashAlert("Document <strong>$document_name</strong> archived", 'error');
redirect(); redirect();
@@ -798,7 +798,7 @@ if (isset($_GET['restore_document'])) {
logAudit("Document", "Restore", "$session_name restored document $document_name", $client_id, $document_id); logAudit("Document", "Restore", "$session_name restored document $document_name", $client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> Restored"); flashAlert("Document <strong>$document_name</strong> Restored");
redirect(); redirect();
@@ -824,7 +824,7 @@ if (isset($_GET['delete_document_version'])) {
logAudit("Document Version", "Delete", "$session_name deleted document version $document_version_name", $client_id); logAudit("Document Version", "Delete", "$session_name deleted document version $document_version_name", $client_id);
flash_alert("Document $document_version_name version deleted", 'error'); flashAlert("Document $document_version_name version deleted", 'error');
redirect(); redirect();
@@ -856,7 +856,7 @@ if (isset($_GET['delete_document'])) {
logAudit("Document", "Delete", "$session_name deleted document $document_name and all versions", $client_id); logAudit("Document", "Delete", "$session_name deleted document $document_name and all versions", $client_id);
flash_alert("Document <strong>$document_name</strong> deleted and all versions", 'error'); flashAlert("Document <strong>$document_name</strong> deleted and all versions", 'error');
// Determine redirect behavior // Determine redirect behavior
// If there's a "from" parameter, we can use it to decide where to go // If there's a "from" parameter, we can use it to decide where to go

View File

@@ -58,7 +58,7 @@ if (isset($_POST['add_domain'])) {
logAudit("Domain", "Create", "$session_name created domain $name$extended_log_description", $client_id, $domain_id); logAudit("Domain", "Create", "$session_name created domain $name$extended_log_description", $client_id, $domain_id);
flash_alert("Domain <strong>$name</strong> created"); flashAlert("Domain <strong>$name</strong> created");
redirect(); redirect();
@@ -150,7 +150,7 @@ if (isset($_POST['edit_domain'])) {
logAudit("Domain", "Edit", "$session_name edited domain $name", $client_id, $domain_id); logAudit("Domain", "Edit", "$session_name edited domain $name", $client_id, $domain_id);
flash_alert("Domain <strong>$name</strong> edited"); flashAlert("Domain <strong>$name</strong> edited");
redirect(); redirect();
@@ -176,7 +176,7 @@ if (isset($_GET['archive_domain'])) {
logAudit("Domain", "Archive", "$session_name archived domain $domain_name", $client_id, $domain_id); logAudit("Domain", "Archive", "$session_name archived domain $domain_name", $client_id, $domain_id);
flash_alert("Domain <strong>$domain_name archived", 'error'); flashAlert("Domain <strong>$domain_name archived", 'error');
redirect(); redirect();
@@ -202,7 +202,7 @@ if(isset($_GET['restore_domain'])){
logAudit("Domain", "Restore", "$session_name restored domain $domain_name", $client_id, $domain_id); logAudit("Domain", "Restore", "$session_name restored domain $domain_name", $client_id, $domain_id);
flash_alert("Domain <strong>$domain_name</strong> restored"); flashAlert("Domain <strong>$domain_name</strong> restored");
redirect(); redirect();
@@ -228,7 +228,7 @@ if (isset($_GET['delete_domain'])) {
logAudit("Domain", "Delete", "$session_name deleted domain $domain_name", $client_id); logAudit("Domain", "Delete", "$session_name deleted domain $domain_name", $client_id);
flash_alert("Domain <strong>$domain_name</strong> deleted", 'error'); flashAlert("Domain <strong>$domain_name</strong> deleted", 'error');
redirect(); redirect();
@@ -265,7 +265,7 @@ if (isset($_POST['bulk_archive_domains'])) {
logAudit("Domain", "Bulk Archive", "$session_name archived $count domain(s)", $client_id); logAudit("Domain", "Bulk Archive", "$session_name archived $count domain(s)", $client_id);
flash_alert("Archived <strong>$count</strong> domain(s)", 'error'); flashAlert("Archived <strong>$count</strong> domain(s)", 'error');
} }
@@ -305,7 +305,7 @@ if (isset($_POST['bulk_restore_domains'])) {
logAudit("Domain", "Bulk Restore", "$session_name restored $count domain(s)", $client_id); logAudit("Domain", "Bulk Restore", "$session_name restored $count domain(s)", $client_id);
flash_alert("Restored <strong>$count</strong> domain(s)"); flashAlert("Restored <strong>$count</strong> domain(s)");
} }
@@ -344,7 +344,7 @@ if (isset($_POST['bulk_delete_domains'])) {
logAudit("Domain", "Bulk Delete", "$session_name deleted $count domain(s)", $client_id); logAudit("Domain", "Bulk Delete", "$session_name deleted $count domain(s)", $client_id);
flash_alert("Deleted <strong>$count</strong> domain(s)", 'error'); flashAlert("Deleted <strong>$count</strong> domain(s)", 'error');
} }
@@ -378,7 +378,7 @@ if (isset($_POST['export_domains_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Domains-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Domains-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -19,7 +19,7 @@ if (isset($_POST['add_calendar'])) {
logAudit("Calendar", "Create", "$session_name created calendar $name", 0, $calendar_id); logAudit("Calendar", "Create", "$session_name created calendar $name", 0, $calendar_id);
flash_alert("Calendar <strong>$name</strong> created"); flashAlert("Calendar <strong>$name</strong> created");
redirect(); redirect();
@@ -37,7 +37,7 @@ if (isset($_POST['edit_calendar'])) {
logAudit("Calendar", "Edit", "$session_name edited calendar $name", 0, $calendar_id); logAudit("Calendar", "Edit", "$session_name edited calendar $name", 0, $calendar_id);
flash_alert("Calendar <strong>$name</strong> edited"); flashAlert("Calendar <strong>$name</strong> edited");
redirect(); redirect();
@@ -62,7 +62,7 @@ if (isset($_GET['delete_calendar'])) {
logAudit("Calendar", "Delete", "$session_name deleted calendar $calendar_name and associated events"); logAudit("Calendar", "Delete", "$session_name deleted calendar $calendar_name and associated events");
flash_alert("Calendar <strong>$calendar_name</strong> deleted", 'error'); flashAlert("Calendar <strong>$calendar_name</strong> deleted", 'error');
redirect(); redirect();
@@ -139,7 +139,7 @@ if (isset($_POST['add_event'])) {
logAudit("Calendar Event", "Create", "$session_name created a calendar event titled $title in calendar $calendar_name", $client_id, $event_id); logAudit("Calendar Event", "Create", "$session_name created a calendar event titled $title in calendar $calendar_name", $client_id, $event_id);
flash_alert("Event <strong>$title</strong> created in calendar <strong>$calendar_name</strong>"); flashAlert("Event <strong>$title</strong> created in calendar <strong>$calendar_name</strong>");
redirect(); redirect();
@@ -213,7 +213,7 @@ if (isset($_POST['edit_event'])) {
logAudit("Calendar Event", "Edit", "$session_name edited calendar event $title", $client_id, $event_id); logAudit("Calendar Event", "Edit", "$session_name edited calendar event $title", $client_id, $event_id);
flash_alert("Calendar event titled <strong>$title</strong> edited"); flashAlert("Calendar event titled <strong>$title</strong> edited");
redirect(); redirect();
@@ -240,7 +240,7 @@ if (isset($_GET['delete_event'])) {
logAudit("Calendar Event", "Delete", "$session_name deleted calendar event $event_title", $client_id); logAudit("Calendar Event", "Delete", "$session_name deleted calendar event $event_title", $client_id);
flash_alert("Calendar event titled <strong>$event_title</strong> deleted", 'error'); flashAlert("Calendar event titled <strong>$event_title</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -43,7 +43,7 @@ if (isset($_POST['add_expense'])) {
logAudit("Expense", "Create", "$session_name created expense $description", $client_id, $expense_id); logAudit("Expense", "Create", "$session_name created expense $description", $client_id, $expense_id);
flash_alert("Expense added" . $extended_alert_description); flashAlert("Expense added" . $extended_alert_description);
redirect(); redirect();
@@ -90,7 +90,7 @@ if (isset($_POST['edit_expense'])) {
logAudit("Expense", "Edit", "$session_name edited expense $description", $client_id, $expense_id); logAudit("Expense", "Edit", "$session_name edited expense $description", $client_id, $expense_id);
flash_alert("Expense modified" . $extended_alert_description); flashAlert("Expense modified" . $extended_alert_description);
redirect(); redirect();
@@ -120,7 +120,7 @@ if (isset($_GET['delete_expense'])) {
logAudit("Expense", "Delete", "$session_name deleted expense $expense_description", $client_id); logAudit("Expense", "Delete", "$session_name deleted expense $expense_description", $client_id);
flash_alert("Expense deleted", 'error'); flashAlert("Expense deleted", 'error');
redirect(); redirect();
@@ -164,7 +164,7 @@ if (isset($_POST['bulk_edit_expense_category'])) {
logAudit("Expense", "Bulk Edit", "$session_name assigned $count expenses to category $category_name"); logAudit("Expense", "Bulk Edit", "$session_name assigned $count expenses to category $category_name");
flash_alert("You assigned expense category <strong>$category_name</strong> to <strong>$count</strong> expense(s)"); flashAlert("You assigned expense category <strong>$category_name</strong> to <strong>$count</strong> expense(s)");
} }
redirect(); redirect();
@@ -209,7 +209,7 @@ if (isset($_POST['bulk_edit_expense_account'])) {
logAudit("Expense", "Bulk Edit", "$session_name assigned $count expense(s) to account $account_name"); logAudit("Expense", "Bulk Edit", "$session_name assigned $count expense(s) to account $account_name");
flash_alert("You assigned account <strong>$account_name</strong> to <strong>$count</strong> expense(s)"); flashAlert("You assigned account <strong>$account_name</strong> to <strong>$count</strong> expense(s)");
} }
redirect(); redirect();
@@ -247,7 +247,7 @@ if (isset($_POST['bulk_edit_expense_client'])) {
} // End Assign Loop } // End Assign Loop
flash_alert("You assigned Client <b>$client_name</b> to <b>$expense_count</b> expenses"); flashAlert("You assigned Client <b>$client_name</b> to <b>$expense_count</b> expenses");
} }
redirect(); redirect();
@@ -290,7 +290,7 @@ if (isset($_POST['bulk_delete_expenses'])) {
logAudit("Expense", "Bulk Delete", "$session_name deleted $count expense(s)"); logAudit("Expense", "Bulk Delete", "$session_name deleted $count expense(s)");
flash_alert("Deleted <strong>$count</strong> expense(s)", 'error'); flashAlert("Deleted <strong>$count</strong> expense(s)", 'error');
} }
@@ -361,7 +361,7 @@ if (isset($_POST['export_expenses_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename("$session_company_name-Expenses-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename("$session_company_name-Expenses-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -63,7 +63,7 @@ if (isset($_POST['upload_files'])) {
$dest_path = $upload_file_dir . $file_reference_name; $dest_path = $upload_file_dir . $file_reference_name;
if (!move_uploaded_file($file_tmp_path, $dest_path)) { if (!move_uploaded_file($file_tmp_path, $dest_path)) {
flash_alert('Error moving file to upload directory. Please ensure the directory is writable.', 'error'); flashAlert('Error moving file to upload directory. Please ensure the directory is writable.', 'error');
continue; // Skip processing this file continue; // Skip processing this file
} }
@@ -94,7 +94,7 @@ if (isset($_POST['upload_files'])) {
logAudit("File", "Upload", "$session_name uploaded file $file_name", $client_id, $file_id); logAudit("File", "Upload", "$session_name uploaded file $file_name", $client_id, $file_id);
flash_alert("Uploaded file <strong>$file_name</strong>"); flashAlert("Uploaded file <strong>$file_name</strong>");
} }
} }
@@ -126,7 +126,7 @@ if (isset($_POST['rename_file'])) {
logAudit("File", "Rename", "$session_name renamed file $old_file_name to $file_name", $client_id, $file_id); logAudit("File", "Rename", "$session_name renamed file $old_file_name to $file_name", $client_id, $file_id);
flash_alert("Renamed file <strong>$old_file_name</strong> to <strong>$file_name</strong>"); flashAlert("Renamed file <strong>$old_file_name</strong> to <strong>$file_name</strong>");
redirect(); redirect();
@@ -156,7 +156,7 @@ if (isset($_POST['move_file'])) {
logAudit("File", "Move", "$session_name moved file $file_name to $folder_name", $client_id, $file_id); logAudit("File", "Move", "$session_name moved file $file_name to $folder_name", $client_id, $file_id);
flash_alert("File <strong>$file_name</strong> moved to <strong>$folder_name</strong>"); flashAlert("File <strong>$file_name</strong> moved to <strong>$folder_name</strong>");
redirect(); redirect();
@@ -182,7 +182,7 @@ if (isset($_GET['archive_file'])) {
logAudit("File", "Archive", "$session_name archived file $file_name", $client_id, $file_id); logAudit("File", "Archive", "$session_name archived file $file_name", $client_id, $file_id);
flash_alert("File <strong>$file_name</strong> archived", 'error'); flashAlert("File <strong>$file_name</strong> archived", 'error');
redirect(); redirect();
@@ -208,7 +208,7 @@ if (isset($_GET['restore_file'])) {
logAudit("File", "Restore", "$session_name restored file $file_name", $client_id, $file_id); logAudit("File", "Restore", "$session_name restored file $file_name", $client_id, $file_id);
flash_alert("File <strong>$file_name</strong> Restored"); flashAlert("File <strong>$file_name</strong> Restored");
redirect(); redirect();
@@ -245,7 +245,7 @@ if (isset($_POST['delete_file'])) {
logAudit("File", "Delete", "$session_name deleted file $file_name", $client_id); logAudit("File", "Delete", "$session_name deleted file $file_name", $client_id);
flash_alert("File <strong>$file_name</strong> deleted", 'alert'); flashAlert("File <strong>$file_name</strong> deleted", 'alert');
redirect(); redirect();
@@ -308,7 +308,7 @@ if (isset($_POST['bulk_archive_files'])) {
logAudit("File", "Bulk Archive", "$session_name archived $document_count document(s) and $file_count file(s)", $client_id); logAudit("File", "Bulk Archive", "$session_name archived $document_count document(s) and $file_count file(s)", $client_id);
flash_alert("Archived <strong>$document_count</strong> Documents and <strong>$file_count</strong> files", 'error'); flashAlert("Archived <strong>$document_count</strong> Documents and <strong>$file_count</strong> files", 'error');
redirect(); redirect();
@@ -389,7 +389,7 @@ if (isset($_POST['bulk_delete_files'])) {
logAudit("File", "Bulk Delete", "$session_name deleted $document_count document(s) and $file_count file(s)", $client_id); logAudit("File", "Bulk Delete", "$session_name deleted $document_count document(s) and $file_count file(s)", $client_id);
flash_alert("Deleted <strong>$document_count</strong> Documents and <strong>$file_count</strong> files", 'error'); flashAlert("Deleted <strong>$document_count</strong> Documents and <strong>$file_count</strong> files", 'error');
redirect(); redirect();
@@ -452,7 +452,7 @@ if (isset($_POST['bulk_restore_files'])) {
logAudit("File", "Bulk Restore", "$session_name restored $document_count document(s) and $file_count file(s)", $client_id); logAudit("File", "Bulk Restore", "$session_name restored $document_count document(s) and $file_count file(s)", $client_id);
flash_alert("Restored <strong>$document_count</strong> Documents and <strong>$file_count</strong> files"); flashAlert("Restored <strong>$document_count</strong> Documents and <strong>$file_count</strong> files");
redirect(); redirect();
@@ -563,13 +563,13 @@ if (isset($_POST['bulk_move_files'])) {
// Flash message // Flash message
// ------------------------- // -------------------------
if ($file_count && $document_count) { if ($file_count && $document_count) {
flash_alert("Moved <strong>$file_count</strong> file(s) and <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>"); flashAlert("Moved <strong>$file_count</strong> file(s) and <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>");
} elseif ($file_count) { } elseif ($file_count) {
flash_alert("Moved <strong>$file_count</strong> file(s) to the folder <strong>$folder_name</strong>"); flashAlert("Moved <strong>$file_count</strong> file(s) to the folder <strong>$folder_name</strong>");
} elseif ($document_count) { } elseif ($document_count) {
flash_alert("Moved <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>"); flashAlert("Moved <strong>$document_count</strong> document(s) to the folder <strong>$folder_name</strong>");
} else { } else {
flash_alert("No items were moved."); flashAlert("No items were moved.");
} }
redirect(); redirect();
@@ -601,7 +601,7 @@ if (isset($_POST['link_asset_to_file'])) {
logAudit("File", "Link", "$session_name linked asset $asset_name to file $file_name", $client_id, $file_id); logAudit("File", "Link", "$session_name linked asset $asset_name to file $file_name", $client_id, $file_id);
flash_alert("Asset <strong>$asset_name</strong> linked to File <strong>$file_name</strong>"); flashAlert("Asset <strong>$asset_name</strong> linked to File <strong>$file_name</strong>");
redirect(); redirect();
@@ -631,7 +631,7 @@ if (isset($_GET['unlink_asset_from_file'])) {
logAudit("File", "Link", "$session_name unlinked asset $asset_name from file $file_name", $client_id, $file_id); logAudit("File", "Link", "$session_name unlinked asset $asset_name from file $file_name", $client_id, $file_id);
flash_alert("Asset <strong>$asset_name</strong> unlinked from File <strong>$file_name</strong>"); flashAlert("Asset <strong>$asset_name</strong> unlinked from File <strong>$file_name</strong>");
redirect(); redirect();

View File

@@ -25,7 +25,7 @@ if (isset($_POST['create_folder'])) {
logAudit("Folder", "Create", "$session_name created folder $folder_name", $client_id, $folder_id); logAudit("Folder", "Create", "$session_name created folder $folder_name", $client_id, $folder_id);
flash_alert("Folder <strong>$folder_name</strong> created"); flashAlert("Folder <strong>$folder_name</strong> created");
redirect(); redirect();
@@ -53,7 +53,7 @@ if (isset($_POST['rename_folder'])) {
logAudit("Folder", "Rename", "$session_name renamed folder $old_folder_name to $folder_name", $client_id, $folder_id); logAudit("Folder", "Rename", "$session_name renamed folder $old_folder_name to $folder_name", $client_id, $folder_id);
flash_alert("Folder <strong>$old_folder_name</strong> renamed to <strong>$folder_name</strong>"); flashAlert("Folder <strong>$old_folder_name</strong> renamed to <strong>$folder_name</strong>");
redirect(); redirect();
@@ -87,7 +87,7 @@ if (isset($_GET['delete_folder'])) {
logAudit("Folder", "Delete", "$session_name deleted folder $folder_name", $client_id); logAudit("Folder", "Delete", "$session_name deleted folder $folder_name", $client_id);
flash_alert("Folder <strong>$folder_name</strong> deleted", 'error'); flashAlert("Folder <strong>$folder_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -47,7 +47,7 @@ if (isset($_POST['add_invoice'])) {
customAction('invoice_create', $invoice_id); customAction('invoice_create', $invoice_id);
flash_alert("Invoice <strong>$config_invoice_prefix$invoice_number</strong> created"); flashAlert("Invoice <strong>$config_invoice_prefix$invoice_number</strong> created");
redirect("invoice.php?invoice_id=$invoice_id"); redirect("invoice.php?invoice_id=$invoice_id");
@@ -87,7 +87,7 @@ if (isset($_POST['edit_invoice'])) {
logAudit("Invoice", "Edit", "$session_name edited Invoice $invoice_prefix$invoice_number - $scope", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name edited Invoice $invoice_prefix$invoice_number - $scope", $client_id, $invoice_id);
flash_alert("Invoice <strong>$invoice_prefix$invoice_number</strong> edited"); flashAlert("Invoice <strong>$invoice_prefix$invoice_number</strong> edited");
redirect(); redirect();
@@ -158,7 +158,7 @@ if (isset($_POST['add_invoice_copy'])) {
customAction('invoice_create', $new_invoice_id); customAction('invoice_create', $new_invoice_id);
flash_alert("Created new Invoice <strong>$config_invoice_prefix$new_invoice_number</strong> from <strong>$old_invoice_prefix$old_invoice_prefix</strong>"); flashAlert("Created new Invoice <strong>$config_invoice_prefix$new_invoice_number</strong> from <strong>$old_invoice_prefix$old_invoice_prefix</strong>");
redirect("invoice.php?invoice_id=$new_invoice_id"); redirect("invoice.php?invoice_id=$new_invoice_id");
@@ -187,7 +187,7 @@ if (isset($_GET['mark_invoice_sent'])) {
logAudit("Invoice", "Edit", "$session_name marked invoice $invoice_prefix$invoice_number sent", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name marked invoice $invoice_prefix$invoice_number sent", $client_id, $invoice_id);
flash_alert("Invoice marked sent"); flashAlert("Invoice marked sent");
redirect(); redirect();
@@ -216,7 +216,7 @@ if (isset($_GET['mark_invoice_non-billable'])) {
logAudit("Invoice", "Edit", "$session_name marked invoice $invoice_prefix$invoice_number Non-Billable", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name marked invoice $invoice_prefix$invoice_number Non-Billable", $client_id, $invoice_id);
flash_alert("Invoice marked Non-Billable"); flashAlert("Invoice marked Non-Billable");
redirect(); redirect();
@@ -245,7 +245,7 @@ if (isset($_GET['cancel_invoice'])) {
logAudit("Invoice", "Edit", "$session_name cancelled invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name cancelled invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Invoice <strong>$invoice_prefix$invoice_number</strong> cancelled", 'error'); flashAlert("Invoice <strong>$invoice_prefix$invoice_number</strong> cancelled", 'error');
redirect(); redirect();
@@ -296,7 +296,7 @@ if (isset($_GET['delete_invoice'])) {
logAudit("Invoice", "Delete", "$session_name deleted invoice $invoice_prefix$invoice_number", $client_id); logAudit("Invoice", "Delete", "$session_name deleted invoice $invoice_prefix$invoice_number", $client_id);
flash_alert("Invoice <strong>$invoice_prefix$invoice_number</strong> deleted", 'error'); flashAlert("Invoice <strong>$invoice_prefix$invoice_number</strong> deleted", 'error');
redirect(); redirect();
@@ -344,7 +344,7 @@ if (isset($_POST['add_invoice_item'])) {
mysqli_query($mysqli,"INSERT INTO product_stock SET stock_qty = -$qty, stock_note = 'QTY $qty - Invoice $invoice_id', stock_product_id = $product_id"); mysqli_query($mysqli,"INSERT INTO product_stock SET stock_qty = -$qty, stock_note = 'QTY $qty - Invoice $invoice_id', stock_product_id = $product_id");
} else { } else {
// Not enough in stock: stop and notify // Not enough in stock: stop and notify
flash_alert("Not Enough <strong>$name</strong> in stock", 'error'); flashAlert("Not Enough <strong>$name</strong> in stock", 'error');
redirect(); redirect();
} }
} }
@@ -384,7 +384,7 @@ if (isset($_POST['add_invoice_item'])) {
logAudit("Invoice", "Edit", "$session_name added item $name to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name added item $name to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Item <strong>$name</strong> added to invoice"); flashAlert("Item <strong>$name</strong> added to invoice");
redirect(); redirect();
@@ -412,7 +412,7 @@ if (isset($_POST['invoice_note'])) {
logAudit("Invoice", "Edit", "$session_name added note to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name added note to invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Notes added"); flashAlert("Notes added");
redirect(); redirect();
@@ -471,7 +471,7 @@ if (isset($_POST['edit_invoice_item'])) {
logAudit("Invoice", "Edit", "$session_name edited item $name on invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name edited item $name on invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Item <strong>$name</strong> updated"); flashAlert("Item <strong>$name</strong> updated");
redirect(); redirect();
@@ -516,7 +516,7 @@ if (isset($_GET['delete_invoice_item'])) {
logAudit("Invoice", "Delete", "$session_name removed item $item_name from invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Delete", "$session_name removed item $item_name from invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Item <strong>$item_name</strong> removed from invoice", 'error'); flashAlert("Item <strong>$item_name</strong> removed from invoice", 'error');
redirect(); redirect();
@@ -604,7 +604,7 @@ if (isset($_GET['email_invoice'])) {
// Get Email ID for reference // Get Email ID for reference
$email_id = mysqli_insert_id($mysqli); $email_id = mysqli_insert_id($mysqli);
flash_alert("Invoice sent!"); flashAlert("Invoice sent!");
mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Invoice sent by $session_name (mail queue ID: $email_id)', history_invoice_id = $invoice_id"); mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Sent', history_description = 'Invoice sent by $session_name (mail queue ID: $email_id)', history_invoice_id = $invoice_id");
@@ -686,7 +686,7 @@ if (isset($_POST['export_invoices_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Invoices-$file_name_date.csv"); $filename = sanitizeFilename($file_name_prepend . "Invoices-$file_name_date.csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -733,7 +733,7 @@ if (isset($_POST['link_invoice_to_ticket'])) {
mysqli_query($mysqli,"UPDATE invoices SET invoice_ticket_id = $ticket_id WHERE invoice_id = $invoice_id"); mysqli_query($mysqli,"UPDATE invoices SET invoice_ticket_id = $ticket_id WHERE invoice_id = $invoice_id");
flash_alert("Invoice linked to ticket"); flashAlert("Invoice linked to ticket");
redirect(); redirect();
@@ -754,7 +754,7 @@ if (isset($_POST['add_ticket_to_invoice'])) {
mysqli_query($mysqli,"UPDATE tickets SET ticket_invoice_id = $invoice_id WHERE ticket_id = $ticket_id"); mysqli_query($mysqli,"UPDATE tickets SET ticket_invoice_id = $invoice_id WHERE ticket_id = $ticket_id");
flash_alert("Ticket linked to invoice"); flashAlert("Ticket linked to invoice");
redirect("post.php?add_ticket_to_invoice=$invoice_id"); redirect("post.php?add_ticket_to_invoice=$invoice_id");
@@ -1174,7 +1174,7 @@ if (isset($_POST['bulk_edit_invoice_category'])) {
logAudit("Invoice", "Bulk Edit", "$session_name assigned $count invoices to category $category_name"); logAudit("Invoice", "Bulk Edit", "$session_name assigned $count invoices to category $category_name");
flash_alert("Assigned income category <strong>$category_name</strong> to <strong>$count</strong> invoice(s)"); flashAlert("Assigned income category <strong>$category_name</strong> to <strong>$count</strong> invoice(s)");
} }
redirect(); redirect();

View File

@@ -58,7 +58,7 @@ if(isset($_POST['add_location'])){
logAudit("Location", "Create", "$session_name created location $name", $client_id, $location_id); logAudit("Location", "Create", "$session_name created location $name", $client_id, $location_id);
flash_alert("Location <strong>$name</strong> created."); flashAlert("Location <strong>$name</strong> created.");
redirect(); redirect();
@@ -125,7 +125,7 @@ if(isset($_POST['edit_location'])){
logAudit("Location", "Edit", "$session_name edited location $name", $client_id, $location_id); logAudit("Location", "Edit", "$session_name edited location $name", $client_id, $location_id);
flash_alert("Location <strong>$name</strong> updated"); flashAlert("Location <strong>$name</strong> updated");
redirect(); redirect();
@@ -151,7 +151,7 @@ if(isset($_GET['archive_location'])){
logAudit("Location", "Archive", "$session_name archived location $location_name", $client_id, $location_id); logAudit("Location", "Archive", "$session_name archived location $location_name", $client_id, $location_id);
flash_alert("Location <strong>$location_name</strong> archived", 'error'); flashAlert("Location <strong>$location_name</strong> archived", 'error');
redirect(); redirect();
@@ -177,7 +177,7 @@ if(isset($_GET['restore_location'])){
logAudit("Location", "Restore", "$session_name restored location $location_name", $client_id, $location_id); logAudit("Location", "Restore", "$session_name restored location $location_name", $client_id, $location_id);
flash_alert("Location <strong>$location_name</strong> restored"); flashAlert("Location <strong>$location_name</strong> restored");
redirect(); redirect();
@@ -203,7 +203,7 @@ if(isset($_GET['delete_location'])){
logAudit("Location", "Delete", "$session_name deleted location $location_name", $client_id); logAudit("Location", "Delete", "$session_name deleted location $location_name", $client_id);
flash_alert("Location <strong>$location_name</strong> deleted", 'error'); flashAlert("Location <strong>$location_name</strong> deleted", 'error');
redirect(); redirect();
@@ -255,7 +255,7 @@ if (isset($_POST['bulk_assign_location_tags'])) {
logAudit("Location", "Bulk Edit", "$session_name assigned tags to $count location(s)", $client_id); logAudit("Location", "Bulk Edit", "$session_name assigned tags to $count location(s)", $client_id);
flash_alert("Assigned tags for <strong>$count</strong> locations"); flashAlert("Assigned tags for <strong>$count</strong> locations");
} }
@@ -300,7 +300,7 @@ if (isset($_POST['bulk_archive_locations'])) {
logAudit("Location", "Bulk Archive", "$session_name archived $count location(s)"); logAudit("Location", "Bulk Archive", "$session_name archived $count location(s)");
flash_alert("Archived <strong>$count</strong> location(s)", 'error'); flashAlert("Archived <strong>$count</strong> location(s)", 'error');
} }
@@ -340,7 +340,7 @@ if (isset($_POST['bulk_restore_locations'])) {
logAudit("Location", "Bulk Restore", "$session_name restored $count location(s)", $client_id); logAudit("Location", "Bulk Restore", "$session_name restored $count location(s)", $client_id);
flash_alert("Restored <strong>$count</strong> location(s)"); flashAlert("Restored <strong>$count</strong> location(s)");
} }
@@ -380,7 +380,7 @@ if (isset($_POST['bulk_delete_locations'])) {
logAudit("Location", "Bulk Delete", "$session_name deleted $count location(s)", $client_id); logAudit("Location", "Bulk Delete", "$session_name deleted $count location(s)", $client_id);
flash_alert("Deleted <strong>$count</strong> location(s)", 'error'); flashAlert("Deleted <strong>$count</strong> location(s)", 'error');
} }
@@ -414,7 +414,7 @@ if(isset($_POST['export_locations_csv'])){
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Locations-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Locations-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -461,7 +461,7 @@ if (isset($_POST["import_locations_csv"])) {
if (!empty($_FILES["file"]["tmp_name"])) { if (!empty($_FILES["file"]["tmp_name"])) {
$file_name = $_FILES["file"]["tmp_name"]; $file_name = $_FILES["file"]["tmp_name"];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -470,13 +470,13 @@ if (isset($_POST["import_locations_csv"])) {
$allowed_file_extensions = array('csv'); $allowed_file_extensions = array('csv');
if(in_array($file_extension,$allowed_file_extensions) === false){ if(in_array($file_extension,$allowed_file_extensions) === false){
$error = true; $error = true;
flash_alert("Bad file extension", 'error'); flashAlert("Bad file extension", 'error');
} }
//Check file isn't empty //Check file isn't empty
elseif($_FILES["file"]["size"] < 1){ elseif($_FILES["file"]["size"] < 1){
$error = true; $error = true;
flash_alert("Bad file size (empty?)", 'error'); flashAlert("Bad file size (empty?)", 'error');
} }
//(Else)Check column count //(Else)Check column count
@@ -484,7 +484,7 @@ if (isset($_POST["import_locations_csv"])) {
$f_columns = fgetcsv($f, 1000, ","); $f_columns = fgetcsv($f, 1000, ",");
if(!$error & count($f_columns) != 8) { if(!$error & count($f_columns) != 8) {
$error = true; $error = true;
flash_alert("Bad column count.", 'error'); flashAlert("Bad column count.", 'error');
} }
//Else, parse the file //Else, parse the file
@@ -536,7 +536,7 @@ if (isset($_POST["import_locations_csv"])) {
logAudit("Location", "Import", "$session_name imported $row_count location(s). $duplicate_count duplicate(s) found and not imported", $client_id); logAudit("Location", "Import", "$session_name imported $row_count location(s). $duplicate_count duplicate(s) found and not imported", $client_id);
flash_alert("$row_count Location(s) imported, $duplicate_count duplicate(s) detected and not imported"); flashAlert("$row_count Location(s) imported, $duplicate_count duplicate(s) detected and not imported");
redirect(); redirect();
} }

View File

@@ -24,7 +24,7 @@ if (isset($_POST['add_network'])) {
logAudit("Network", "Create", "$session_name created network $name", $client_id, $network_id); logAudit("Network", "Create", "$session_name created network $name", $client_id, $network_id);
flash_alert("Network <strong>$name</strong> created"); flashAlert("Network <strong>$name</strong> created");
redirect(); redirect();
@@ -48,7 +48,7 @@ if (isset($_POST['edit_network'])) {
logAudit("Network", "Edit", "$session_name edited network $name", $client_id, $network_id); logAudit("Network", "Edit", "$session_name edited network $name", $client_id, $network_id);
flash_alert("Network <strong>$name</strong> updated"); flashAlert("Network <strong>$name</strong> updated");
redirect(); redirect();
@@ -74,7 +74,7 @@ if (isset($_GET['archive_network'])) {
logAudit("Network", "Archive", "$session_name archived network $network_name", $client_id, $network_id); logAudit("Network", "Archive", "$session_name archived network $network_name", $client_id, $network_id);
flash_alert("Network <strong>$network_name</strong> archived", 'error'); flashAlert("Network <strong>$network_name</strong> archived", 'error');
redirect(); redirect();
@@ -100,7 +100,7 @@ if (isset($_GET['restore_network'])) {
logAudit("Network", "Restore", "$session_name restored contact $contact_name", $client_id, $network_id); logAudit("Network", "Restore", "$session_name restored contact $contact_name", $client_id, $network_id);
flash_alert("Network <strong>$network_name</strong> restored"); flashAlert("Network <strong>$network_name</strong> restored");
redirect(); redirect();
@@ -126,7 +126,7 @@ if (isset($_GET['delete_network'])) {
logAudit("Network", "Delete", "$session_name deleted network $network_name", $client_id); logAudit("Network", "Delete", "$session_name deleted network $network_name", $client_id);
flash_alert("Network <strong>$network_name</strong> deleted", 'error'); flashAlert("Network <strong>$network_name</strong> deleted", 'error');
redirect(); redirect();
@@ -164,7 +164,7 @@ if (isset($_POST['bulk_delete_networks'])) {
logAudit("Network", "Bulk Delete", "$session_name deleted $count network(s)", $client_id); logAudit("Network", "Bulk Delete", "$session_name deleted $count network(s)", $client_id);
flash_alert("Deleted <strong>$count</strong> network(s)", 'error'); flashAlert("Deleted <strong>$count</strong> network(s)", 'error');
} }
@@ -196,7 +196,7 @@ if (isset($_POST['export_networks_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Networks-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Networks-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -283,7 +283,7 @@ if (isset($_POST['import_networks_csv'])) {
if (!empty($_FILES['file']['tmp_name'])) { if (!empty($_FILES['file']['tmp_name'])) {
$file_name = $_FILES['file']['tmp_name']; $file_name = $_FILES['file']['tmp_name'];
} else { } else {
flash_alert("Please select a file to upload.", 'error'); flashAlert("Please select a file to upload.", 'error');
redirect(); redirect();
} }
@@ -291,13 +291,13 @@ if (isset($_POST['import_networks_csv'])) {
$file_extension = strtolower(end(explode('.', $_FILES['file']['name']))); $file_extension = strtolower(end(explode('.', $_FILES['file']['name'])));
if ($file_extension !== 'csv') { if ($file_extension !== 'csv') {
$error = true; $error = true;
flash_alert("Bad file extension — only .csv files are accepted.", 'error'); flashAlert("Bad file extension — only .csv files are accepted.", 'error');
} }
// Check not empty // Check not empty
elseif ($_FILES['file']['size'] < 1) { elseif ($_FILES['file']['size'] < 1) {
$error = true; $error = true;
flash_alert("Bad file size (empty file?).", 'error'); flashAlert("Bad file size (empty file?).", 'error');
} }
// Check column count matches the 8-column export/template format // Check column count matches the 8-column export/template format
@@ -308,7 +308,7 @@ if (isset($_POST['import_networks_csv'])) {
if (count($f_columns) !== 8) { if (count($f_columns) !== 8) {
$error = true; $error = true;
flash_alert("Bad column count — expected 8 columns: Name, Description, VLAN, Network (CIDR), Gateway, IP Range, Primary DNS, Secondary DNS.", 'error'); flashAlert("Bad column count — expected 8 columns: Name, Description, VLAN, Network (CIDR), Gateway, IP Range, Primary DNS, Secondary DNS.", 'error');
} }
} }
@@ -375,7 +375,7 @@ if (isset($_POST['import_networks_csv'])) {
logAudit("Network", "Import", "$session_name imported $row_count network(s). $duplicate_count duplicate(s) found and not imported", $client_id); logAudit("Network", "Import", "$session_name imported $row_count network(s). $duplicate_count duplicate(s) found and not imported", $client_id);
flash_alert("$row_count Network(s) imported, $duplicate_count duplicate(s) detected and not imported"); flashAlert("$row_count Network(s) imported, $duplicate_count duplicate(s) detected and not imported");
redirect(); redirect();
} }

View File

@@ -29,7 +29,7 @@ if (isset($_POST['add_payment'])) {
//Check to see if amount entered is greater than the balance of the invoice //Check to see if amount entered is greater than the balance of the invoice
if ($amount > $balance) { if ($amount > $balance) {
flash_alert("Payment can not be more than the balance", 'error'); flashAlert("Payment can not be more than the balance", 'error');
redirect(); redirect();
} else { } 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"); 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");
@@ -168,7 +168,7 @@ if (isset($_POST['add_payment'])) {
customAction('invoice_pay', $invoice_id); customAction('invoice_pay', $invoice_id);
flash_alert("Payment amount <strong>" . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "</strong> added"); flashAlert("Payment amount <strong>" . numfmt_format_currency($currency_format, $amount, $invoice_currency_code) . "</strong> added");
redirect(); redirect();
@@ -198,7 +198,7 @@ if (isset($_POST['edit_payment'])) {
logAudit("Payment", "Edit", "Payment edited amount of " . numfmt_format_currency($currency_format, $amount, $session_company_currency)); logAudit("Payment", "Edit", "Payment edited amount of " . numfmt_format_currency($currency_format, $amount, $session_company_currency));
flash_alert("Payment edited to amount <strong>" . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "</strong> added"); flashAlert("Payment edited to amount <strong>" . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "</strong> added");
redirect(); redirect();
@@ -250,13 +250,13 @@ if (isset($_POST['apply_credit'])) {
// Check to see if amount entered is greater than the balance of the invoice // Check to see if amount entered is greater than the balance of the invoice
if ($credit_amount_applied > $invoice_balance) { if ($credit_amount_applied > $invoice_balance) {
flash_alert("Credit can not be more than the balance", 'alert'); flashAlert("Credit can not be more than the balance", 'alert');
redirect(); redirect();
} }
// Check to see if amount entered is greater than the credit balance // Check to see if amount entered is greater than the credit balance
if ($credit_amount_applied > $credit_balance) { if ($credit_amount_applied > $credit_balance) {
flash_alert("Credit can not be more than the available credit", 'alert'); flashAlert("Credit can not be more than the available credit", 'alert');
redirect(); redirect();
} }
@@ -309,7 +309,7 @@ if (isset($_POST['apply_credit'])) {
customAction('invoice_pay', $invoice_id); customAction('invoice_pay', $invoice_id);
flash_alert("Credit amount <strong>" . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "</strong> applied"); flashAlert("Credit amount <strong>" . numfmt_format_currency($currency_format, $amount, $session_company_currency) . "</strong> applied");
redirect(); redirect();
@@ -385,13 +385,13 @@ if (isset($_POST['add_payment_stripe'])) {
// Sanity checks // Sanity checks
if (!$payment_provider_client || !$saved_payment_method) { if (!$payment_provider_client || !$saved_payment_method) {
flash_alert("Stripe not enabled or no client card saved", 'error'); flashAlert("Stripe not enabled or no client card saved", 'error');
redirect(); redirect();
} elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') { } elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') {
flash_alert("Invalid invoice state (draft/partial/paid/not billable)", 'error'); flashAlert("Invalid invoice state (draft/partial/paid/not billable)", 'error');
redirect(); redirect();
} elseif ($invoice_amount == 0) { } elseif ($invoice_amount == 0) {
flash_alert("Invalid invoice amount", 'error'); flashAlert("Invalid invoice amount", 'error');
redirect(); redirect();
} }
@@ -499,7 +499,7 @@ if (isset($_POST['add_payment_stripe'])) {
logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id);
customAction('invoice_pay', $invoice_id); customAction('invoice_pay', $invoice_id);
flash_alert("Payment amount <strong>" . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "</strong> added"); flashAlert("Payment amount <strong>" . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "</strong> added");
redirect(); redirect();
@@ -507,7 +507,7 @@ if (isset($_POST['add_payment_stripe'])) {
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"); 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");
logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id); logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id);
flash_alert("Payment failed", 'error'); flashAlert("Payment failed", 'error');
redirect(); redirect();
} }
@@ -570,13 +570,13 @@ if (isset($_GET['add_payment_stripe'])) {
// Sanity checks // Sanity checks
if (!$config_stripe_enable || !$stripe_id || !$stripe_pm) { if (!$config_stripe_enable || !$stripe_id || !$stripe_pm) {
flash_alert("Stripe not enabled or no client card saved", 'error'); flashAlert("Stripe not enabled or no client card saved", 'error');
redirect(); redirect();
} elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') { } elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') {
flash_alert("Invalid invoice state (draft/partial/paid/not billable)", 'error'); flashAlert("Invalid invoice state (draft/partial/paid/not billable)", 'error');
redirect(); redirect();
} elseif ($invoice_amount == 0) { } elseif ($invoice_amount == 0) {
flash_alert("Invalid invoice amount", 'error'); flashAlert("Invalid invoice amount", 'error');
redirect(); redirect();
} }
@@ -684,7 +684,7 @@ if (isset($_GET['add_payment_stripe'])) {
logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id);
customAction('invoice_pay', $invoice_id); customAction('invoice_pay', $invoice_id);
flash_alert("Payment amount <strong>" . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "</strong> added"); flashAlert("Payment amount <strong>" . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . "</strong> added");
redirect(); redirect();
@@ -692,7 +692,7 @@ if (isset($_GET['add_payment_stripe'])) {
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"); 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");
logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id); logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id);
flash_alert("Payment failed", 'error'); flashAlert("Payment failed", 'error');
redirect(); redirect();
} }
@@ -722,7 +722,7 @@ if (isset($_POST['add_bulk_payment'])) {
// Check if bulk_payment_amount exceeds total_account_balance // Check if bulk_payment_amount exceeds total_account_balance
if ($bulk_payment_amount > $total_account_balance) { if ($bulk_payment_amount > $total_account_balance) {
flash_alert("Payment exceeds Client Balance.", 'error'); flashAlert("Payment exceeds Client Balance.", 'error');
redirect(); redirect();
} }
@@ -830,7 +830,7 @@ if (isset($_POST['add_bulk_payment'])) {
logAudit("Invoice", "Payment", "Bulk Payment amount of " . numfmt_format_currency($currency_format, $bulk_payment_amount_static, $currency_code) . " applied to multiple invoices", $client_id); logAudit("Invoice", "Payment", "Bulk Payment amount of " . numfmt_format_currency($currency_format, $bulk_payment_amount_static, $currency_code) . " applied to multiple invoices", $client_id);
flash_alert("$alert_message Bulk Payment added"); flashAlert("$alert_message Bulk Payment added");
redirect(); redirect();
@@ -885,9 +885,9 @@ if (isset($_GET['delete_payment'])) {
logAudit("Invoice", "Edit", "$session_name deleted Payment on Invoice $invoice_prefix$invoice_number", $client_id, $invoice_id); logAudit("Invoice", "Edit", "$session_name deleted Payment on Invoice $invoice_prefix$invoice_number", $client_id, $invoice_id);
flash_alert("Payment deleted", 'error'); flashAlert("Payment deleted", 'error');
if ($config_stripe_enable) { if ($config_stripe_enable) {
flash_alert("Payment deleted - Stripe payments must be manually refunded in Stripe", 'error'); flashAlert("Payment deleted - Stripe payments must be manually refunded in Stripe", 'error');
} }
redirect(); redirect();
@@ -920,7 +920,7 @@ if (isset($_POST['export_payments_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Payments-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Payments-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -21,7 +21,7 @@ if (isset($_POST['add_product'])) {
logAudit("Product", "Create", "$session_name created product $name", 0, $product_id); logAudit("Product", "Create", "$session_name created product $name", 0, $product_id);
flash_alert("Product <strong>$name</strong> created"); flashAlert("Product <strong>$name</strong> created");
redirect(); redirect();
@@ -41,7 +41,7 @@ if (isset($_POST['edit_product'])) {
logAudit("Product", "Edit", "$session_name edited product $name", 0, $product_id); logAudit("Product", "Edit", "$session_name edited product $name", 0, $product_id);
flash_alert("Product <strong>$name</strong> edited"); flashAlert("Product <strong>$name</strong> edited");
redirect(); redirect();
@@ -61,7 +61,7 @@ if (isset($_GET['archive_product'])) {
logAudit("Product", "Archive", "$session_name archived product $product_name", 0, $product_id); logAudit("Product", "Archive", "$session_name archived product $product_name", 0, $product_id);
flash_alert("Product <strong>$product_name</strong> archived", 'error'); flashAlert("Product <strong>$product_name</strong> archived", 'error');
redirect(); redirect();
@@ -81,7 +81,7 @@ if (isset($_GET['restore_product'])) {
logAudit("Product", "Restore", "$session_name restored product $product_name", 0, $product_id); logAudit("Product", "Restore", "$session_name restored product $product_name", 0, $product_id);
flash_alert("Product <strong>$product_name</strong> restored"); flashAlert("Product <strong>$product_name</strong> restored");
redirect(); redirect();
@@ -102,7 +102,7 @@ if (isset($_GET['delete_product'])) {
logAudit("Product", "Delete", "$session_name deleted product $product_name"); logAudit("Product", "Delete", "$session_name deleted product $product_name");
flash_alert("Product <strong>$product_name</strong> deleted", 'error'); flashAlert("Product <strong>$product_name</strong> deleted", 'error');
redirect(); redirect();
@@ -139,7 +139,7 @@ if (isset($_POST['bulk_edit_product_category'])) {
logAudit("Product", "Edit", "$session_name assigned category $category_name to $count product(s)"); logAudit("Product", "Edit", "$session_name assigned category $category_name to $count product(s)");
flash_alert("Assigned category <strong>$category_name</strong> to <strong>$count</strong> product(s)"); flashAlert("Assigned category <strong>$category_name</strong> to <strong>$count</strong> product(s)");
} }
redirect(); redirect();
@@ -170,7 +170,7 @@ if (isset($_POST['bulk_archive_products'])) {
logAudit("Product", "Bulk Archive", "$session_name archived $count product(s)"); logAudit("Product", "Bulk Archive", "$session_name archived $count product(s)");
flash_alert("Archived <strong>$count</strong> product(s)", 'error'); flashAlert("Archived <strong>$count</strong> product(s)", 'error');
} }
@@ -203,7 +203,7 @@ if (isset($_POST['bulk_restore_products'])) {
logAudit("Product", "Bulk Restore", "$session_name restored $count product(s)"); logAudit("Product", "Bulk Restore", "$session_name restored $count product(s)");
flash_alert("Restored <strong>$count</strong> product(s)"); flashAlert("Restored <strong>$count</strong> product(s)");
} }
@@ -236,7 +236,7 @@ if (isset($_POST['bulk_delete_products'])) {
logAudit("Product", "Bulk Delete", "$session_name deleted $count product(s)"); logAudit("Product", "Bulk Delete", "$session_name deleted $count product(s)");
flash_alert("Deleted <strong>$count</strong> product(s)", 'error'); flashAlert("Deleted <strong>$count</strong> product(s)", 'error');
} }
@@ -260,7 +260,7 @@ if (isset($_POST['export_products_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename("$session_company_name-Products-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename("$session_company_name-Products-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -307,7 +307,7 @@ if (isset($_POST['add_product_stock'])) {
logAudit("Product", "Stock", "$session_name added $qty units to stock for product $product_name", 0, $product_id); logAudit("Product", "Stock", "$session_name added $qty units to stock for product $product_name", 0, $product_id);
flash_alert("Added $qty units to <strong>$product_name</strong> stock"); flashAlert("Added $qty units to <strong>$product_name</strong> stock");
redirect(); redirect();

View File

@@ -88,7 +88,7 @@ if (isset($_POST['add_project'])) {
logAudit("Project", "Create", "$session_name created project $project_name", $client_id, $project_id); logAudit("Project", "Create", "$session_name created project $project_name", $client_id, $project_id);
flash_alert("You created Project <strong>$project_name</strong>"); flashAlert("You created Project <strong>$project_name</strong>");
redirect(); redirect();
@@ -116,7 +116,7 @@ if (isset($_POST['edit_project'])) {
logAudit("Project", "Edit", "$session_name edited project $project_name", $client_id, $project_id); logAudit("Project", "Edit", "$session_name edited project $project_name", $client_id, $project_id);
flash_alert("Project <strong>$project_name</strong> edited"); flashAlert("Project <strong>$project_name</strong> edited");
redirect(); redirect();
@@ -145,7 +145,7 @@ if (isset($_GET['close_project'])) {
logAudit("Project", "Close", "$session_name closed project $project_name", $client_id, $project_id); logAudit("Project", "Close", "$session_name closed project $project_name", $client_id, $project_id);
flash_alert("Project <strong>$project_name</strong> closed"); flashAlert("Project <strong>$project_name</strong> closed");
redirect(); redirect();
@@ -174,7 +174,7 @@ if (isset($_GET['archive_project'])) {
logAudit("Project", "Archive", "$session_name archived project $project_name", $client_id, $project_id); logAudit("Project", "Archive", "$session_name archived project $project_name", $client_id, $project_id);
flash_alert("Project <strong>$project_name</strong> archived", 'error'); flashAlert("Project <strong>$project_name</strong> archived", 'error');
redirect(); redirect();
@@ -203,7 +203,7 @@ if (isset($_GET['restore_project'])) {
logAudit("Project", "Restore", "$session_name restored project $project_name", $client_id, $project_id); logAudit("Project", "Restore", "$session_name restored project $project_name", $client_id, $project_id);
flash_alert("Project <strong>$project_name</strong> restored"); flashAlert("Project <strong>$project_name</strong> restored");
redirect(); redirect();
@@ -232,7 +232,7 @@ if (isset($_GET['delete_project'])) {
logAudit("Project", "Delete", "$session_name deleted project $project_name", $client_id, $project_id); logAudit("Project", "Delete", "$session_name deleted project $project_name", $client_id, $project_id);
flash_alert("Project <strong>$project_name</strong> Deleted", 'error'); flashAlert("Project <strong>$project_name</strong> Deleted", 'error');
redirect(); redirect();
@@ -281,7 +281,7 @@ if (isset($_POST['link_ticket_to_project'])) {
logAudit("Project", "Bulk Edit", "$session_name added $count ticket(s) to project $project_name", $client_id, $project_id); logAudit("Project", "Bulk Edit", "$session_name added $count ticket(s) to project $project_name", $client_id, $project_id);
flash_alert("<strong>$count</strong> Ticket(s) added to <strong>$project_name</strong>"); flashAlert("<strong>$count</strong> Ticket(s) added to <strong>$project_name</strong>");
} }
redirect(); redirect();
@@ -311,7 +311,7 @@ if (isset($_POST['link_closed_ticket_to_project'])) {
// Get ticket details // Get ticket details
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_prefix, ticket_number, ticket_subject, ticket_updated_at FROM tickets WHERE ticket_number = $ticket_number"); $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) { if (mysqli_num_rows($sql) == 0) {
flash_alert("Cannot merge into that ticket.", 'error'); flashAlert("Cannot merge into that ticket.", 'error');
redirect(); redirect();
} }
$row = mysqli_fetch_assoc($sql); $row = mysqli_fetch_assoc($sql);
@@ -325,7 +325,7 @@ if (isset($_POST['link_closed_ticket_to_project'])) {
logAudit("Project", "Edit", "$session_name added ticket $ticket_prefix$ticket_number - $ticket_subject to project $project_name", $client_id, $project_id); logAudit("Project", "Edit", "$session_name added ticket $ticket_prefix$ticket_number - $ticket_subject to project $project_name", $client_id, $project_id);
flash_alert("Ticket added to <strong>$project_name</strong>"); flashAlert("Ticket added to <strong>$project_name</strong>");
redirect(); redirect();

View File

@@ -42,7 +42,7 @@ if (isset($_POST['add_quote'])) {
customAction('quote_create', $quote_id); customAction('quote_create', $quote_id);
flash_alert("Quote <strong>$config_quote_prefix$quote_number</strong> created"); flashAlert("Quote <strong>$config_quote_prefix$quote_number</strong> created");
redirect("quote.php?quote_id=$quote_id"); redirect("quote.php?quote_id=$quote_id");
@@ -114,7 +114,7 @@ if (isset($_POST['add_quote_copy'])) {
customAction('quote_create', $new_quote_id); customAction('quote_create', $new_quote_id);
flash_alert("Quote copied"); flashAlert("Quote copied");
redirect("quote.php?quote_id=$new_quote_id"); redirect("quote.php?quote_id=$new_quote_id");
@@ -207,7 +207,7 @@ if (isset($_POST['add_quote_to_invoice'])) {
customAction('invoice_create', $new_invoice_id); customAction('invoice_create', $new_invoice_id);
flash_alert("Invoice created from quote <strong>$quote_prefix$quote_number</strong>"); flashAlert("Invoice created from quote <strong>$quote_prefix$quote_number</strong>");
redirect("invoice.php?invoice_id=$new_invoice_id"); redirect("invoice.php?invoice_id=$new_invoice_id");
@@ -267,7 +267,7 @@ if (isset($_POST['add_quote_item'])) {
logAudit("Quote", "Edit", "$session_name added item $name to quote $quote_prefix$quote_number", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name added item $name to quote $quote_prefix$quote_number", $client_id, $quote_id);
flash_alert("Item <strong>$name</strong> added"); flashAlert("Item <strong>$name</strong> added");
redirect(); redirect();
@@ -326,7 +326,7 @@ if (isset($_POST['edit_quote_item'])) {
logAudit("Quote", "Edit", "$session_name edited item $name on quote $quote_prefix$quote_number", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name edited item $name on quote $quote_prefix$quote_number", $client_id, $quote_id);
flash_alert("Item <strong>$name</strong> updated"); flashAlert("Item <strong>$name</strong> updated");
redirect(); redirect();
@@ -354,7 +354,7 @@ if (isset($_POST['quote_note'])) {
logAudit("Quote", "Edit", "$session_name added notes to quote $quote_prefix$quote_number", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name added notes to quote $quote_prefix$quote_number", $client_id, $quote_id);
flash_alert("Notes added"); flashAlert("Notes added");
redirect(); redirect();
@@ -392,7 +392,7 @@ if (isset($_POST['edit_quote'])) {
logAudit("Quote", "Edit", "$session_name edited quote $quote_prefix$quote_number", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name edited quote $quote_prefix$quote_number", $client_id, $quote_id);
flash_alert("Quote edited"); flashAlert("Quote edited");
redirect(); redirect();
@@ -433,7 +433,7 @@ if (isset($_GET['delete_quote'])) {
logAudit("Quote", "Delete", "$session_name deleted quote $quote_prefix$quote_number", $client_id); logAudit("Quote", "Delete", "$session_name deleted quote $quote_prefix$quote_number", $client_id);
flash_alert("Quote <strong>$quote_prefix$quote_number</strong> deleted", 'error'); flashAlert("Quote <strong>$quote_prefix$quote_number</strong> deleted", 'error');
if (isset($_GET['client_id'])) { if (isset($_GET['client_id'])) {
$client_id = intval($_GET['client_id']); $client_id = intval($_GET['client_id']);
@@ -476,7 +476,7 @@ if (isset($_GET['delete_quote_item'])) {
logAudit("Quote", "Edit", "$session_name removed item $item_name from $quote_prefix$quote_number", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name removed item $item_name from $quote_prefix$quote_number", $client_id, $quote_id);
flash_alert("Item <strong>$item_name</strong> removed", 'error'); flashAlert("Item <strong>$item_name</strong> removed", 'error');
redirect(); redirect();
@@ -504,7 +504,7 @@ if (isset($_GET['mark_quote_sent'])) {
logAudit("Quote", "Sent", "$session_name marked quote $quote_prefix$quote_number as sent", $client_id, $quote_id); logAudit("Quote", "Sent", "$session_name marked quote $quote_prefix$quote_number as sent", $client_id, $quote_id);
flash_alert("Quote marked sent"); flashAlert("Quote marked sent");
redirect(); redirect();
@@ -534,7 +534,7 @@ if (isset($_GET['accept_quote'])) {
customAction('quote_accept', $quote_id); customAction('quote_accept', $quote_id);
flash_alert("Quote accepted"); flashAlert("Quote accepted");
redirect(); redirect();
@@ -564,7 +564,7 @@ if (isset($_GET['decline_quote'])) {
logAudit("Quote", "Edit", "$session_name marked quote $quote_prefix$quote_number as declined", $client_id, $quote_id); logAudit("Quote", "Edit", "$session_name marked quote $quote_prefix$quote_number as declined", $client_id, $quote_id);
flash_alert("Quote declined", 'error'); flashAlert("Quote declined", 'error');
redirect(); redirect();
@@ -641,7 +641,7 @@ if (isset($_GET['email_quote'])) {
logAudit("Quote", "Email", "$session_name emailed quote $quote_prefix$quote_number to $contact_email", $client_id, $quote_id); logAudit("Quote", "Email", "$session_name emailed quote $quote_prefix$quote_number to $contact_email", $client_id, $quote_id);
flash_alert("Quote sent!"); flashAlert("Quote sent!");
//Don't change the status to sent if the status is anything but draft //Don't change the status to sent if the status is anything but draft
if ($quote_status == 'Draft') { if ($quote_status == 'Draft') {
@@ -674,7 +674,7 @@ if (isset($_GET['mark_quote_invoiced'])) {
logAudit("Quote", "Sent", "$session_name marked quote $quote_prefix$quote_number as invoiced", $client_id, $quote_id); logAudit("Quote", "Sent", "$session_name marked quote $quote_prefix$quote_number as invoiced", $client_id, $quote_id);
flash_alert("Quote marked invoiced"); flashAlert("Quote marked invoiced");
redirect(); redirect();
@@ -707,7 +707,7 @@ if(isset($_POST['export_quotes_csv'])){
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Quotes-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Quotes-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -735,7 +735,7 @@ if(isset($_POST['export_quotes_csv'])){
logAudit("Quote", "Export", "$session_name exported $num_rows quote(s) to a CSV file"); logAudit("Quote", "Export", "$session_name exported $num_rows quote(s) to a CSV file");
flash_alert("Exported <strong>$num_rows</strong> quote(s)"); flashAlert("Exported <strong>$num_rows</strong> quote(s)");
exit; exit;

View File

@@ -47,7 +47,7 @@ if (isset($_POST['add_rack'])) {
logAudit("Rack", "Create", "$session_name created rack $name", $client_id, $rack_id); logAudit("Rack", "Create", "$session_name created rack $name", $client_id, $rack_id);
flash_alert("Rack <strong>$name</strong> created"); flashAlert("Rack <strong>$name</strong> created");
redirect(); redirect();
@@ -94,7 +94,7 @@ if (isset($_POST['edit_rack'])) {
logAudit("Rack", "Edit", "$session_name edited rack $name", $client_id, $rack_id); logAudit("Rack", "Edit", "$session_name edited rack $name", $client_id, $rack_id);
flash_alert("Rack <strong>$name</strong> edited"); flashAlert("Rack <strong>$name</strong> edited");
redirect(); redirect();
@@ -120,7 +120,7 @@ if (isset($_GET['archive_rack'])) {
logAudit("Rack", "Archive", "$session_name archived rack $rack_name", $client_id, $rack_id); logAudit("Rack", "Archive", "$session_name archived rack $rack_name", $client_id, $rack_id);
flash_alert("Rack <strong>$rack_name</strong> archived", 'error'); flashAlert("Rack <strong>$rack_name</strong> archived", 'error');
redirect(); redirect();
@@ -146,7 +146,7 @@ if (isset($_GET['restore_rack'])) {
logAudit("Rack", "Restore", "$session_name restored rack $rack_name", $client_id, $rack_id); logAudit("Rack", "Restore", "$session_name restored rack $rack_name", $client_id, $rack_id);
flash_alert("Rack <strong>$rack_name</strong> Restored"); flashAlert("Rack <strong>$rack_name</strong> Restored");
redirect(); redirect();
@@ -178,7 +178,7 @@ if (isset($_GET['delete_rack'])) {
logAudit("Rack", "Delete", "$session_name deleted rack $rack_name", $client_id); logAudit("Rack", "Delete", "$session_name deleted rack $rack_name", $client_id);
flash_alert("Rack <strong>$rack_name</strong> deleted", 'error'); flashAlert("Rack <strong>$rack_name</strong> deleted", 'error');
redirect(); redirect();
@@ -206,7 +206,7 @@ if (isset($_POST['add_rack_unit'])) {
// **New Validation Check** // **New Validation Check**
if ($unit_start > $unit_end) { if ($unit_start > $unit_end) {
flash_alert("Unit Start number cannot be higher than Unit End number.", 'error'); flashAlert("Unit Start number cannot be higher than Unit End number.", 'error');
redirect(); redirect();
} }
@@ -215,7 +215,7 @@ if (isset($_POST['add_rack_unit'])) {
if (mysqli_num_rows($check_sql) > 0) { if (mysqli_num_rows($check_sql) > 0) {
// If there is an overlap, return an error message; // If there is an overlap, return an error message;
flash_alert("Units $unit_start to $unit_end are already in use by another device.", 'error'); flashAlert("Units $unit_start to $unit_end are already in use by another device.", 'error');
redirect(); redirect();
} }
@@ -226,7 +226,7 @@ if (isset($_POST['add_rack_unit'])) {
logAudit("Rack", "Edit", "$session_name added device $name to units $unit_start - $unit_end in rack $rack_name", $client_id, $rack_id); logAudit("Rack", "Edit", "$session_name added device $name to units $unit_start - $unit_end in rack $rack_name", $client_id, $rack_id);
flash_alert("Device <strong>$name</strong> added to units $unit_start - $unit_end in rack."); flashAlert("Device <strong>$name</strong> added to units $unit_start - $unit_end in rack.");
redirect(); redirect();
@@ -257,7 +257,7 @@ if (isset($_POST['edit_rack_unit'])) {
logAudit("Rack", "Edit", "$session_name edited device $name in rack $rack_name", $client_id, $rack_id); logAudit("Rack", "Edit", "$session_name edited device $name in rack $rack_name", $client_id, $rack_id);
flash_alert("Device $name edited on the rack"); flashAlert("Device $name edited on the rack");
redirect(); redirect();
@@ -285,7 +285,7 @@ if (isset($_GET['remove_rack_unit'])) {
logAudit("Rack", "Edit", "$session_name removed device $device_name from rack $rack_name", $client_id, $rack_id); logAudit("Rack", "Edit", "$session_name removed device $device_name from rack $rack_name", $client_id, $rack_id);
flash_alert("Device <strong>$device_name</strong> removed from rack", 'error'); flashAlert("Device <strong>$device_name</strong> removed from rack", 'error');
redirect(); redirect();

View File

@@ -35,7 +35,7 @@ if (isset($_POST['create_recurring_expense'])) {
logAudit("Recurring Expense", "Create", "$session_name created recurring expense $description", $client_id, $recurring_expense_id); logAudit("Recurring Expense", "Create", "$session_name created recurring expense $description", $client_id, $recurring_expense_id);
flash_alert("Recurring Expense created"); flashAlert("Recurring Expense created");
redirect(); redirect();
@@ -69,7 +69,7 @@ if (isset($_POST['edit_recurring_expense'])) {
logAudit("Recurring Expense", "Edit", "$session_name edited recurring expense $description", $client_id, $recurring_expense_id); logAudit("Recurring Expense", "Edit", "$session_name edited recurring expense $description", $client_id, $recurring_expense_id);
flash_alert("Recurring Expense edited"); flashAlert("Recurring Expense edited");
redirect(); redirect();
@@ -93,7 +93,7 @@ if (isset($_GET['delete_recurring_expense'])) {
logAudit("Recurring Expense", "Delete", "$session_name deleted recurring expense $recurring_expense_description", $client_id); logAudit("Recurring Expense", "Delete", "$session_name deleted recurring expense $recurring_expense_description", $client_id);
flash_alert("Recurring Expense deleted", 'error'); flashAlert("Recurring Expense deleted", 'error');
redirect(); redirect();

View File

@@ -64,7 +64,7 @@ if (isset($_POST['add_invoice_recurring'])) {
logAudit("Recurring Invoice", "Create", "$session_name created recurring Invoice from Invoice $invoice_prefix$invoice_number", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Create", "$session_name created recurring Invoice from Invoice $invoice_prefix$invoice_number", $client_id, $recurring_invoice_id);
flash_alert("Created recurring Invoice from Invoice <strong>$invoice_prefix$invoice_number</strong>"); flashAlert("Created recurring Invoice from Invoice <strong>$invoice_prefix$invoice_number</strong>");
redirect("recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id"); redirect("recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id");
@@ -103,7 +103,7 @@ if (isset($_POST['add_recurring_invoice'])) {
logAudit("Recurring Invoice", "Create", "$session_name created recurring invoice $config_recurring_invoice_prefix$recurring_invoice_number - $scope", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Create", "$session_name created recurring invoice $config_recurring_invoice_prefix$recurring_invoice_number - $scope", $client_id, $recurring_invoice_id);
flash_alert("Recurring Invoice <strong>$config_recurring_invoice_prefix$recurring_invoice_number</strong> created"); flashAlert("Recurring Invoice <strong>$config_recurring_invoice_prefix$recurring_invoice_number</strong> created");
redirect("recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id"); redirect("recurring_invoice.php?recurring_invoice_id=$recurring_invoice_id");
@@ -147,7 +147,7 @@ if (isset($_POST['edit_recurring_invoice'])) {
logAudit("Recurring Invoice", "Edit", "$session_name edited recurring invoice $recurring_invoice_prefix$recurring_invoice_number - $scope", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Edit", "$session_name edited recurring invoice $recurring_invoice_prefix$recurring_invoice_number - $scope", $client_id, $recurring_invoice_id);
flash_alert("Recurring Invoice <strong>$recurring_invoice_prefix$recurring_invoice_number</strong> edited"); flashAlert("Recurring Invoice <strong>$recurring_invoice_prefix$recurring_invoice_number</strong> edited");
redirect(); redirect();
@@ -189,7 +189,7 @@ if (isset($_GET['delete_recurring_invoice'])) {
logAudit("Recurring Invoice", "Delete", "$session_name deleted recurring invoice $recurring_invoice_prefix$recurring_invoice_number - $recurring_invoice_scope", $client_id); logAudit("Recurring Invoice", "Delete", "$session_name deleted recurring invoice $recurring_invoice_prefix$recurring_invoice_number - $recurring_invoice_scope", $client_id);
flash_alert("Recurring Invoice <strong>$recurring_invoice_prefix$recurring_invoice_number</strong> deleted", 'error'); flashAlert("Recurring Invoice <strong>$recurring_invoice_prefix$recurring_invoice_number</strong> deleted", 'error');
redirect(); redirect();
@@ -249,7 +249,7 @@ if (isset($_POST['add_recurring_invoice_item'])) {
logAudit("Recurring Invoice", "Edit", "$session_name added item $name to recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Edit", "$session_name added item $name to recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id);
flash_alert("Item <srrong>$name</strong> added to Recurring Invoice"); flashAlert("Item <srrong>$name</strong> added to Recurring Invoice");
redirect(); redirect();
@@ -309,7 +309,7 @@ if (isset($_POST['edit_recurring_invoice_item'])) {
// Logging // Logging
logAudit("Recurring Invoice", "Edit", "$session_name edited item $name on recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Edit", "$session_name edited item $name on recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id);
flash_alert("Item <strong>$name</strong> updated"); flashAlert("Item <strong>$name</strong> updated");
redirect(); redirect();
@@ -337,7 +337,7 @@ if (isset($_POST['recurring_invoice_note'])) {
logAudit("Recurring Invoice", "Edit", "$session_name added note to recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Edit", "$session_name added note to recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id);
flash_alert("Notes added"); flashAlert("Notes added");
redirect(); redirect();
@@ -375,7 +375,7 @@ if (isset($_GET['delete_recurring_invoice_item'])) {
logAudit("Recurring Invoice", "Edit", "$session_name removed item $item_name from recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id); logAudit("Recurring Invoice", "Edit", "$session_name removed item $item_name from recurring invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id);
flash_alert("Item <strong>$item_name</strong> removed", 'error'); flashAlert("Item <strong>$item_name</strong> removed", 'error');
redirect(); redirect();
@@ -542,7 +542,7 @@ if (isset($_GET['force_recurring'])) {
customAction('invoice_create', $new_invoice_id); customAction('invoice_create', $new_invoice_id);
flash_alert("Recurring Invoice Forced"); flashAlert("Recurring Invoice Forced");
redirect(); redirect();
@@ -591,14 +591,14 @@ if (isset($_POST['set_recurring_payment'])) {
logAudit("Recurring Invoice", "Auto Payment", "$session_name created Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Auto Payment", "$session_name created Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $client_id, $recurring_invoice_id);
flash_alert("Automatic Payment <strong>$saved_payment_description</strong> enabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"); flashAlert("Automatic Payment <strong>$saved_payment_description</strong> enabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number");
} else { } else {
// Delete // Delete
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_recurring_invoice_id = $recurring_invoice_id"); mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_recurring_invoice_id = $recurring_invoice_id");
logAudit("Recurring Invoice", "Auto Payment", "$session_name removed Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Auto Payment", "$session_name removed Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $client_id, $recurring_invoice_id);
flash_alert("Automatic Payment <strong>Disabled</strong> for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number", 'error'); flashAlert("Automatic Payment <strong>Disabled</strong> for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number", 'error');
} }
redirect(); redirect();
@@ -687,7 +687,7 @@ if (isset($_GET['recurring_invoice_email_notify'])) {
logAudit("Recurring Invoice", "Edit", "$session_name turned $notify_wording Email Notifications for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Edit", "$session_name turned $notify_wording Email Notifications for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number", $client_id, $recurring_invoice_id);
flash_alert("Email Notifications <strong>$notify_wording</strong>", 'error'); flashAlert("Email Notifications <strong>$notify_wording</strong>", 'error');
redirect(); redirect();

View File

@@ -34,7 +34,7 @@ if (isset($_POST['add_recurring_ticket'])) {
logAudit("Recurring Ticket", "Create", "$session_name created recurring ticket for $subject - $frequency", $client_id, $recurring_ticket_id); logAudit("Recurring Ticket", "Create", "$session_name created recurring ticket for $subject - $frequency", $client_id, $recurring_ticket_id);
flash_alert("Recurring ticket <strong>$subject - $frequency</strong> created"); flashAlert("Recurring ticket <strong>$subject - $frequency</strong> created");
redirect(); redirect();
@@ -68,7 +68,7 @@ if (isset($_POST['edit_recurring_ticket'])) {
logAudit("Recurring Ticket", "Edit", "$session_name edited recurring ticket $subject", $client_id, $recurring_ticket_id); logAudit("Recurring Ticket", "Edit", "$session_name edited recurring ticket $subject", $client_id, $recurring_ticket_id);
flash_alert("Recurring ticket <strong>$subject - $frequency</strong> updated"); flashAlert("Recurring ticket <strong>$subject - $frequency</strong> updated");
redirect(); redirect();
@@ -211,7 +211,7 @@ if (isset($_POST['bulk_force_recurring_tickets'])) {
} }
flash_alert("$count Recurring Tickets Forced"); flashAlert("$count Recurring Tickets Forced");
} }
redirect(); redirect();
@@ -347,12 +347,12 @@ if (isset($_GET['force_recurring_ticket'])) {
logAudit("Ticket", "Create", "$session_name force created recurring scheduled $frequency ticket - $config_ticket_prefix$ticket_number - $subject", $client_id, $id); logAudit("Ticket", "Create", "$session_name force created recurring scheduled $frequency ticket - $config_ticket_prefix$ticket_number - $subject", $client_id, $id);
flash_alert("Recurring Ticket Forced"); flashAlert("Recurring Ticket Forced");
redirect(); redirect();
} else { } else {
flash_alert("Recurring Ticket Force failed", 'error'); flashAlert("Recurring Ticket Force failed", 'error');
redirect(); redirect();
} }
@@ -380,7 +380,7 @@ if (isset($_GET['delete_recurring_ticket'])) {
logAudit("Recurring Ticket", "Delete", "$session_name deleted recurring ticket $subject", $client_id, $recurring_ticket_id); logAudit("Recurring Ticket", "Delete", "$session_name deleted recurring ticket $subject", $client_id, $recurring_ticket_id);
flash_alert("Recurring ticket <strong>$subject - $frequency</strong> deleted", 'error'); flashAlert("Recurring ticket <strong>$subject - $frequency</strong> deleted", 'error');
redirect(); redirect();
@@ -418,7 +418,7 @@ if (isset($_POST['bulk_delete_recurring_tickets'])) {
logAudit("Recurring Ticket", "Bulk Delete", "$session_name deleted $count recurring ticket(s)"); logAudit("Recurring Ticket", "Bulk Delete", "$session_name deleted $count recurring ticket(s)");
flash_alert("Deleted <strong>$count</strong> recurring ticket(s)", 'error'); flashAlert("Deleted <strong>$count</strong> recurring ticket(s)", 'error');
} }
redirect(); redirect();
@@ -464,7 +464,7 @@ if (isset($_POST['bulk_assign_recurring_ticket'])) {
$agent_email = escapeSql($agent_details['user_email']); $agent_email = escapeSql($agent_details['user_email']);
if (!$agent_name) { if (!$agent_name) {
flash_alert("Invalid agent!", 'error'); flashAlert("Invalid agent!", 'error');
redirect(); redirect();
} }
} }
@@ -511,7 +511,7 @@ if (isset($_POST['bulk_assign_recurring_ticket'])) {
} }
} }
flash_alert("Assigned <strong>$recurring_ticket_count</strong> Recurring Tickets to <strong>$agent_name</strong>"); flashAlert("Assigned <strong>$recurring_ticket_count</strong> Recurring Tickets to <strong>$agent_name</strong>");
redirect(); redirect();
@@ -553,7 +553,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_priority'])) {
logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the priority to $priority on $recurring_ticket_count Recurring Tickets"); logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the priority to $priority on $recurring_ticket_count Recurring Tickets");
flash_alert("Priority updated to <strong>$priority</strong> for <strong>$recurring_ticket_count</strong> Recurring Tickets"); flashAlert("Priority updated to <strong>$priority</strong> for <strong>$recurring_ticket_count</strong> Recurring Tickets");
} }
redirect(); redirect();
@@ -595,7 +595,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_category'])) {
logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the category to $category_name for $recurring_ticket_count Recurring Tickets"); logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the category to $category_name for $recurring_ticket_count Recurring Tickets");
flash_alert("Category set to $category_name for <strong>$recurring_ticket_count</strong> Recurring Tickets"); flashAlert("Category set to $category_name for <strong>$recurring_ticket_count</strong> Recurring Tickets");
} }
redirect(); redirect();
@@ -646,7 +646,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_billable'])) {
logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the billable status to $billable_status for $recurring_ticket_count Recurring Tickets"); logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the billable status to $billable_status for $recurring_ticket_count Recurring Tickets");
flash_alert("Billable status set to $billable_status for <strong>$recurring_ticket_count</strong> Recurring Tickets"); flashAlert("Billable status set to $billable_status for <strong>$recurring_ticket_count</strong> Recurring Tickets");
} }
redirect(); redirect();
@@ -686,7 +686,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_next_run_date'])) {
logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the Next run date to $next_run_date for $recurring_ticket_count Recurring Tickets"); logAudit("Recurring Ticket", " Bulk Edit", "$session_name updated the Next run date to $next_run_date for $recurring_ticket_count Recurring Tickets");
flash_alert("Next run date set to <strong>$next_run_date</strong> for <strong>$recurring_ticket_count</strong> Recurring Tickets"); flashAlert("Next run date set to <strong>$next_run_date</strong> for <strong>$recurring_ticket_count</strong> Recurring Tickets");
} }
redirect(); redirect();

View File

@@ -26,7 +26,7 @@ if (isset($_POST['add_revenue'])) {
logAudit("Revenue", "Create", "$session_name added revenue $description", 0, $revenue_id); logAudit("Revenue", "Create", "$session_name added revenue $description", 0, $revenue_id);
flash_alert("Revenue added"); flashAlert("Revenue added");
redirect(); redirect();
@@ -51,7 +51,7 @@ if (isset($_POST['edit_revenue'])) {
logAudit("Revenue", "Edit", "$session_name edited revenue $description", 0, $revenue_id); logAudit("Revenue", "Edit", "$session_name edited revenue $description", 0, $revenue_id);
flash_alert("Revenue edited"); flashAlert("Revenue edited");
redirect(); redirect();
@@ -72,7 +72,7 @@ if (isset($_GET['delete_revenue'])) {
logAudit("Revenue", "Delete", "$session_name deleted revenue $revenue_description"); logAudit("Revenue", "Delete", "$session_name deleted revenue $revenue_description");
flash_alert("Revenue removed", 'error'); flashAlert("Revenue removed", 'error');
redirect(); redirect();

View File

@@ -80,7 +80,7 @@ if (isset($_POST['add_service'])) {
logAudit("Service", "Create", "$session_name created service $service_name", $client_id, $service_id); logAudit("Service", "Create", "$session_name created service $service_name", $client_id, $service_id);
flash_alert("Service <strong>$service_name</strong> created"); flashAlert("Service <strong>$service_name</strong> created");
redirect(); redirect();
@@ -168,7 +168,7 @@ if (isset($_POST['edit_service'])) {
logAudit("Service", "Edit", "$session_name edited service $service_name", $client_id, $service_id); logAudit("Service", "Edit", "$session_name edited service $service_name", $client_id, $service_id);
flash_alert("Service <strong>$service_name</strong> edited"); flashAlert("Service <strong>$service_name</strong> edited");
redirect(); redirect();
@@ -195,7 +195,7 @@ if (isset($_GET['delete_service'])) {
logAudit("Service", "Delete", "$session_name deleted service $service_name", $client_id); logAudit("Service", "Delete", "$session_name deleted service $service_name", $client_id);
flash_alert("Service <strong>$service_name</strong> deleted", 'error'); flashAlert("Service <strong>$service_name</strong> deleted", 'error');
redirect(); redirect();

View File

@@ -36,7 +36,7 @@ if (isset($_POST['add_software_from_template'])) {
logAudit("Software", "Create", "$session_name created software $name using template", $client_id, $software_id); logAudit("Software", "Create", "$session_name created software $name using template", $client_id, $software_id);
flash_alert("Software <strong>$name</strong> created from template"); flashAlert("Software <strong>$name</strong> created from template");
redirect(); redirect();
@@ -99,7 +99,7 @@ if (isset($_POST['add_software'])) {
logAudit("Software", "Create", "$session_name created software $name", $client_id, $software_id); logAudit("Software", "Create", "$session_name created software $name", $client_id, $software_id);
flash_alert("Software <strong>$name</strong> created $alert_extended"); flashAlert("Software <strong>$name</strong> created $alert_extended");
redirect(); redirect();
@@ -163,7 +163,7 @@ if (isset($_POST['edit_software'])) {
logAudit("Software", "Edit", "$session_name edited software $name", $client_id, $software_id); logAudit("Software", "Edit", "$session_name edited software $name", $client_id, $software_id);
flash_alert("Software <strong>$name</strong> updated"); flashAlert("Software <strong>$name</strong> updated");
redirect(); redirect();
@@ -193,7 +193,7 @@ if (isset($_GET['archive_software'])) {
logAudit("Software", "Archive", "$session_name archived software $software_name and removed all device/user license associations", $client_id, $software_id); logAudit("Software", "Archive", "$session_name archived software $software_name and removed all device/user license associations", $client_id, $software_id);
flash_alert("Software <strong>$software_name</strong> archived and removed all device/user license associations", 'error'); flashAlert("Software <strong>$software_name</strong> archived and removed all device/user license associations", 'error');
redirect(); redirect();
@@ -219,7 +219,7 @@ if (isset($_GET['delete_software'])) {
logAudit("Software", "Delete", "$session_name deleted software $software_name and removed all device/user license associations", $client_id); logAudit("Software", "Delete", "$session_name deleted software $software_name and removed all device/user license associations", $client_id);
flash_alert("Software <strong>$software_name</strong> deleted and removed all device/user license associations", 'error'); flashAlert("Software <strong>$software_name</strong> deleted and removed all device/user license associations", 'error');
redirect(); redirect();
@@ -250,7 +250,7 @@ if (isset($_POST['export_software_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Software-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Software-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -16,7 +16,7 @@ if (isset($_POST['add_tag'])) {
logAudit("Tag", "Create", "$session_name created tag $name", 0, $tag_id); logAudit("Tag", "Create", "$session_name created tag $name", 0, $tag_id);
flash_alert("Tag <strong>$name</strong> created"); flashAlert("Tag <strong>$name</strong> created");
redirect(); redirect();

View File

@@ -24,7 +24,7 @@ if (isset($_POST['add_task'])) {
logAudit("Task", "Create", "$session_name created task $task_name", $client_id, $task_id); logAudit("Task", "Create", "$session_name created task $task_name", $client_id, $task_id);
flash_alert("You created Task <strong>$task_name</strong>"); flashAlert("You created Task <strong>$task_name</strong>");
redirect(); redirect();
@@ -50,7 +50,7 @@ if (isset($_POST['edit_ticket_task'])) {
logAudit("Task", "Edit", "$session_name edited task $task_name", $client_id, $task_id); logAudit("Task", "Edit", "$session_name edited task $task_name", $client_id, $task_id);
flash_alert("Task <strong>$task_name</strong> edited"); flashAlert("Task <strong>$task_name</strong> edited");
redirect(); redirect();
@@ -71,7 +71,7 @@ if (isset($_POST['edit_ticket_template_task'])) {
logAudit("Task", "Edit", "$session_name edited task $task_name", 0, $task_template_id); logAudit("Task", "Edit", "$session_name edited task $task_name", 0, $task_template_id);
flash_alert("Task <strong>$task_name</strong> edited"); flashAlert("Task <strong>$task_name</strong> edited");
redirect(); redirect();
@@ -95,7 +95,7 @@ if (isset($_GET['delete_task'])) {
logAudit("Task", "Delete", "$session_name deleted task $task_name", $client_id, $task_id); logAudit("Task", "Delete", "$session_name deleted task $task_name", $client_id, $task_id);
flash_alert("Task <strong>$task_name</strong> deleted", 'error'); flashAlert("Task <strong>$task_name</strong> deleted", 'error');
redirect(); redirect();
@@ -129,7 +129,7 @@ if (isset($_GET['complete_task'])) {
logAudit("Task", "Edit", "$session_name completed task $task_name", $client_id, $task_id); logAudit("Task", "Edit", "$session_name completed task $task_name", $client_id, $task_id);
flash_alert("Task <strong>$task_name</strong> Completed"); flashAlert("Task <strong>$task_name</strong> Completed");
redirect(); redirect();
@@ -159,7 +159,7 @@ if (isset($_GET['undo_complete_task'])) {
logAudit("Task", "Edit", "$session_name marked task $task_name as incomplete", $client_id, $task_id); logAudit("Task", "Edit", "$session_name marked task $task_name as incomplete", $client_id, $task_id);
flash_alert("Task <strong>$task_name</strong> marked as incomplete", 'error'); flashAlert("Task <strong>$task_name</strong> marked as incomplete", 'error');
redirect(); redirect();
@@ -335,7 +335,7 @@ if (isset($_POST['add_ticket_task_approver'])) {
// Logging // Logging
logAudit("Task", "Edit", "$session_name added task approver for $task_name", $client_id, $task_id); logAudit("Task", "Edit", "$session_name added task approver for $task_name", $client_id, $task_id);
flash_alert("Added approver"); flashAlert("Added approver");
redirect(); redirect();
} }
@@ -358,19 +358,19 @@ if (isset($_GET['approve_ticket_task'])) {
$ticket_id = intval($approval_row['task_ticket_id']); $ticket_id = intval($approval_row['task_ticket_id']);
if (!$approval_row) { if (!$approval_row) {
flash_alert("Cannot find/approve that task", 'error'); flashAlert("Cannot find/approve that task", 'error');
redirect(); redirect();
exit; exit;
} }
// Validate approver (deny) // Validate approver (deny)
if ($required_user > 0 && $required_user !== $session_user_id) { if ($required_user > 0 && $required_user !== $session_user_id) {
flash_alert("You cannot approve that task", 'error'); flashAlert("You cannot approve that task", 'error');
redirect(); redirect();
exit; exit;
} }
if ($required_user == 0 && $type == 'any' && $created_by == $session_user_id) { if ($required_user == 0 && $type == 'any' && $created_by == $session_user_id) {
flash_alert("You cannot approve your own task", 'error'); flashAlert("You cannot approve your own task", 'error');
redirect(); redirect();
exit; exit;
} }
@@ -385,7 +385,7 @@ if (isset($_GET['approve_ticket_task'])) {
// Logging // Logging
logAudit("Task", "Edit", "$session_name approved task $task_name (approval $approval_id)", 0, $task_id); logAudit("Task", "Edit", "$session_name approved task $task_name (approval $approval_id)", 0, $task_id);
flash_alert("Approved"); flashAlert("Approved");
redirect(); redirect();
} }
@@ -402,7 +402,7 @@ if (isset($_GET['delete_ticket_task_approver'])) {
logAudit("Task", "Delete", "$session_name deleted task approval request ($approval_id)", 0, 0); logAudit("Task", "Delete", "$session_name deleted task approval request ($approval_id)", 0, 0);
flash_alert("Approval request deleted", 'error'); flashAlert("Approval request deleted", 'error');
redirect(); redirect();
@@ -428,7 +428,7 @@ if (isset($_GET['complete_all_tasks'])) {
logAudit("Ticket", "Edit", "$session_name marked all tasks complete for ticket", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name marked all tasks complete for ticket", $client_id, $ticket_id);
flash_alert("Marked all tasks Complete"); flashAlert("Marked all tasks Complete");
redirect(); redirect();
@@ -454,7 +454,7 @@ if (isset($_GET['undo_complete_all_tasks'])) {
logAudit("Ticket", "Edit", "$session_name marked all tasks as incomplete for ticket", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name marked all tasks as incomplete for ticket", $client_id, $ticket_id);
flash_alert("Marked all tasks Incomplete", 'error'); flashAlert("Marked all tasks Incomplete", 'error');
redirect(); redirect();

View File

@@ -190,7 +190,7 @@ if (isset($_POST['add_ticket'])) {
logAudit("Ticket", "Create", "$session_name created ticket $config_ticket_prefix$ticket_number - $ticket_subject", $client_id, $ticket_id); logAudit("Ticket", "Create", "$session_name created ticket $config_ticket_prefix$ticket_number - $ticket_subject", $client_id, $ticket_id);
flash_alert("Ticket <strong>$config_ticket_prefix$ticket_number</strong> created"); flashAlert("Ticket <strong>$config_ticket_prefix$ticket_number</strong> created");
redirect("ticket.php?client_id=$client_id&ticket_id=$ticket_id"); redirect("ticket.php?client_id=$client_id&ticket_id=$ticket_id");
@@ -308,7 +308,7 @@ if (isset($_POST['edit_ticket'])) {
logAudit("Ticket", "Edit", "$session_name edited ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name edited ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Ticket <strong>$ticket_prefix$ticket_number</strong> updated"); flashAlert("Ticket <strong>$ticket_prefix$ticket_number</strong> updated");
redirect(); redirect();
@@ -352,7 +352,7 @@ if (isset($_POST['edit_ticket_priority'])) {
customAction('ticket_update', $ticket_id); customAction('ticket_update', $ticket_id);
flash_alert("Priority updated from <strong>$original_priority</strong> to <strong>$priority</strong>"); flashAlert("Priority updated from <strong>$original_priority</strong> to <strong>$priority</strong>");
redirect(); redirect();
@@ -443,7 +443,7 @@ if (isset($_POST['edit_ticket_contact'])) {
logAudit("Ticket", "Edit", "$session_name changed the contact from $original_contact_name to $contact_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name changed the contact from $original_contact_name to $contact_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Contact changed from <strong>$original_contact_name</strong> to <strong>$contact_name</strong>"); flashAlert("Contact changed from <strong>$original_contact_name</strong> to <strong>$contact_name</strong>");
redirect(); redirect();
@@ -472,7 +472,7 @@ if (isset($_POST['edit_ticket_project'])) {
logAudit("Ticket", "Edit", "$session_name set ticket $ticket_prefix$ticket_number project to $project_name", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name set ticket $ticket_prefix$ticket_number project to $project_name", $client_id, $ticket_id);
flash_alert("Project changed to <strong>$project_name</strong> for Ticket <strong>$ticket_prefix$ticket_number</strong>"); flashAlert("Project changed to <strong>$project_name</strong> for Ticket <strong>$ticket_prefix$ticket_number</strong>");
redirect(); redirect();
@@ -557,7 +557,7 @@ if (isset($_POST['add_ticket_watcher'])) {
} }
flash_alert("Added watcher(s)"); flashAlert("Added watcher(s)");
redirect(); redirect();
@@ -598,7 +598,7 @@ if (isset($_GET['delete_ticket_watcher'])) {
logAudit("Ticket", "Edit", "$session_name removed $watcher_email as a watcher for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name removed $watcher_email as a watcher for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Removed ticket watcher <strong>$watcher_email</strong>", 'error'); flashAlert("Removed ticket watcher <strong>$watcher_email</strong>", 'error');
redirect(); redirect();
@@ -639,7 +639,7 @@ if (isset($_GET['delete_ticket_additional_asset'])) {
logAudit("Ticket", "Edit", "$session_name removed asset $asset_name from ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name removed asset $asset_name from ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Removed asset <strong>$asset_name</strong> from ticket.", 'error'); flashAlert("Removed asset <strong>$asset_name</strong> from ticket.", 'error');
redirect(); redirect();
@@ -692,7 +692,7 @@ if (isset($_POST['edit_ticket_asset'])) {
logAudit("Ticket", "Edit", "$session_name changed asset to $asset_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name changed asset to $asset_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Ticket <strong>$ticket_prefix$ticket_number</strong> asset updated to <strong>$asset_name</strong>"); flashAlert("Ticket <strong>$ticket_prefix$ticket_number</strong> asset updated to <strong>$asset_name</strong>");
redirect(); redirect();
@@ -732,7 +732,7 @@ if (isset($_POST['edit_ticket_vendor'])) {
logAudit("Ticket", "Edit", "$session_name set vendor to $vendor_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name set vendor to $vendor_name for ticket $ticket_prefix$ticket_number", $client_id, $ticket_id);
flash_alert("Set vendor to <strong>$vendor_name</strong> for ticket <strong>$ticket_prefix$ticket_number</strong>"); flashAlert("Set vendor to <strong>$vendor_name</strong> for ticket <strong>$ticket_prefix$ticket_number</strong>");
redirect(); redirect();
@@ -768,7 +768,7 @@ if (isset($_POST['assign_ticket'])) {
$ticket_reply = "Ticket re-assigned to $agent_name."; $ticket_reply = "Ticket re-assigned to $agent_name.";
if (!$agent_name) { if (!$agent_name) {
flash_alert("Invalid agent!", 'error'); flashAlert("Invalid agent!", 'error');
redirect(); redirect();
} }
} }
@@ -789,7 +789,7 @@ if (isset($_POST['assign_ticket'])) {
} }
if (!$ticket_subject) { if (!$ticket_subject) {
flash_alert("Invalid ticket!", 'error'); flashAlert("Invalid ticket!", 'error');
redirect(); redirect();
} }
@@ -841,7 +841,7 @@ if (isset($_POST['assign_ticket'])) {
customAction('ticket_assign', $ticket_id); customAction('ticket_assign', $ticket_id);
flash_alert("Ticket <strong>$ticket_prefix$ticket_number</strong> assigned to <strong>$agent_name</strong>"); flashAlert("Ticket <strong>$ticket_prefix$ticket_number</strong> assigned to <strong>$agent_name</strong>");
redirect(); redirect();
@@ -890,7 +890,7 @@ if (isset($_GET['delete_ticket'])) {
logAudit("Ticket", "Delete", "$session_name deleted $ticket_prefix$ticket_number along with all replies", $client_id); logAudit("Ticket", "Delete", "$session_name deleted $ticket_prefix$ticket_number along with all replies", $client_id);
flash_alert("Ticket <strong>$ticket_prefix$ticket_number</strong> along with all replies deleted", 'error'); flashAlert("Ticket <strong>$ticket_prefix$ticket_number</strong> along with all replies deleted", 'error');
customAction('ticket_delete', $ticket_id); customAction('ticket_delete', $ticket_id);
@@ -944,7 +944,7 @@ if (isset($_POST['bulk_delete_tickets'])) {
logAudit("Ticket", "Bulk Delete", "$session_name deleted $count ticket(s)"); logAudit("Ticket", "Bulk Delete", "$session_name deleted $count ticket(s)");
flash_alert("Deleted <strong>$count</strong> ticket(s)", 'error'); flashAlert("Deleted <strong>$count</strong> ticket(s)", 'error');
} }
redirect(); redirect();
@@ -1001,7 +1001,7 @@ if (isset($_POST['bulk_assign_ticket'])) {
$ticket_reply = "Ticket re-assigned to $agent_name."; $ticket_reply = "Ticket re-assigned to $agent_name.";
if (!$agent_name) { if (!$agent_name) {
flash_alert("Invalid agent!", 'error'); flashAlert("Invalid agent!", 'error');
redirect(); redirect();
} }
} }
@@ -1052,7 +1052,7 @@ if (isset($_POST['bulk_assign_ticket'])) {
} }
} }
flash_alert("You assigned <b>$ticket_count</b> Tickets to <b>$agent_name</b>"); flashAlert("You assigned <b>$ticket_count</b> Tickets to <b>$agent_name</b>");
redirect(); redirect();
@@ -1102,7 +1102,7 @@ if (isset($_POST['bulk_edit_ticket_priority'])) {
logAudit("Ticket", " Bulk Edit", "$session_name updated the priority on $ticket_count"); logAudit("Ticket", " Bulk Edit", "$session_name updated the priority on $ticket_count");
flash_alert("You updated the priority for <strong>$ticket_count</strong> Tickets to <strong>$priority</strong>"); flashAlert("You updated the priority for <strong>$ticket_count</strong> Tickets to <strong>$priority</strong>");
} }
redirect(); redirect();
@@ -1154,7 +1154,7 @@ if (isset($_POST['bulk_edit_ticket_category'])) {
logAudit("Ticket", " Bulk Edit", "$session_name updated the category to $category_name on $ticket_count"); logAudit("Ticket", " Bulk Edit", "$session_name updated the category to $category_name on $ticket_count");
flash_alert("Category set to $category_name for <strong>$ticket_count</strong> Tickets"); flashAlert("Category set to $category_name for <strong>$ticket_count</strong> Tickets");
} }
redirect(); redirect();
@@ -1175,7 +1175,7 @@ if (isset($_POST['bulk_merge_tickets'])) {
// Get merge into ticket id (as it may differ from the number) // Get merge into ticket id (as it may differ from the number)
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number FROM tickets WHERE ticket_id = $merge_into_ticket_id"); $sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number FROM tickets WHERE ticket_id = $merge_into_ticket_id");
if (mysqli_num_rows($sql) == 0) { if (mysqli_num_rows($sql) == 0) {
flash_alert("Cannot merge into that ticket.", 'error'); flashAlert("Cannot merge into that ticket.", 'error');
redirect(); redirect();
} }
$merge_row = mysqli_fetch_assoc($sql); $merge_row = mysqli_fetch_assoc($sql);
@@ -1227,7 +1227,7 @@ if (isset($_POST['bulk_merge_tickets'])) {
mysqli_query($mysqli, "UPDATE tickets SET ticket_updated_at = NOW() WHERE ticket_id = $merge_into_ticket_id"); mysqli_query($mysqli, "UPDATE tickets SET ticket_updated_at = NOW() WHERE ticket_id = $merge_into_ticket_id");
flash_alert("<strong>$ticket_count</strong> tickets merged into <strong>$ticket_prefix$merge_into_ticket_number</strong>"); flashAlert("<strong>$ticket_count</strong> tickets merged into <strong>$ticket_prefix$merge_into_ticket_number</strong>");
} }
@@ -1369,10 +1369,10 @@ if (isset($_POST['bulk_resolve_tickets'])) {
} // End Loop } // End Loop
} // End Array Empty Check } // End Array Empty Check
flash_alert("Resolved <strong>$ticket_count</strong> Tickets"); flashAlert("Resolved <strong>$ticket_count</strong> Tickets");
if ($skipped_count > 0) { if ($skipped_count > 0) {
flash_alert("Resolved <strong>$ticket_count</strong> Tickets <strong>$skipped_count</strong> ticket(s) could not be resolved because they have open tasks.", 'info'); flashAlert("Resolved <strong>$ticket_count</strong> Tickets <strong>$skipped_count</strong> ticket(s) could not be resolved because they have open tasks.", 'info');
} }
redirect(); redirect();
@@ -1542,7 +1542,7 @@ if (isset($_POST['bulk_ticket_reply'])) {
} }
flash_alert("Updated <strong>$ticket_count</strong> tickets"); flashAlert("Updated <strong>$ticket_count</strong> tickets");
redirect(); redirect();
@@ -1595,7 +1595,7 @@ if (isset($_POST['bulk_add_ticket_project'])) {
} // End For Each Ticket ID Loop } // End For Each Ticket ID Loop
flash_alert("<strong>$ticket_count</strong> Tickets added to Project <strong>$project_name</strong>"); flashAlert("<strong>$ticket_count</strong> Tickets added to Project <strong>$project_name</strong>");
} }
@@ -1715,7 +1715,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) {
logAudit("Ticket", "Bulk Create", "$session_name created $asset_count tickets for $asset_count"); logAudit("Ticket", "Bulk Create", "$session_name created $asset_count tickets for $asset_count");
flash_alert("You created <b>$asset_count</b> tickets for the selected assets"); flashAlert("You created <b>$asset_count</b> tickets for the selected assets");
} }
@@ -1895,10 +1895,10 @@ if (isset($_POST['add_ticket_reply'])) {
customAction('reply_reply_agent_public', $ticket_id); customAction('reply_reply_agent_public', $ticket_id);
} }
flash_alert("Ticket <strong>$ticket_prefix$ticket_number</strong> has been updated with your reply and was <strong>$ticket_reply_type</strong>"); flashAlert("Ticket <strong>$ticket_prefix$ticket_number</strong> has been updated with your reply and was <strong>$ticket_reply_type</strong>");
} else { } else {
flash_alert("Ticket updated"); flashAlert("Ticket updated");
} }
logAudit("Ticket", "Reply", "$session_name replied to ticket $ticket_prefix$ticket_number - $ticket_subject and was a $ticket_reply_type reply", $client_id, $ticket_id); logAudit("Ticket", "Reply", "$session_name replied to ticket $ticket_prefix$ticket_number - $ticket_subject and was a $ticket_reply_type reply", $client_id, $ticket_id);
@@ -1929,7 +1929,7 @@ if (isset($_POST['edit_ticket_reply'])) {
logAudit("Ticket", "Reply", "$session_name edited ticket_reply", $client_id, $ticket_reply_id); logAudit("Ticket", "Reply", "$session_name edited ticket_reply", $client_id, $ticket_reply_id);
flash_alert("Ticket reply updated"); flashAlert("Ticket reply updated");
redirect(); redirect();
@@ -1955,7 +1955,7 @@ if (isset($_POST['redact_ticket_reply'])) {
logAudit("Ticket", "Reply", "$session_name redacted ticket_reply", $client_id, $ticket_reply_id); logAudit("Ticket", "Reply", "$session_name redacted ticket_reply", $client_id, $ticket_reply_id);
flash_alert("Ticket reply redacted"); flashAlert("Ticket reply redacted");
redirect(); redirect();
@@ -1981,7 +1981,7 @@ if (isset($_GET['archive_ticket_reply'])) {
logAudit("Ticket Reply", "Archive", "$session_name archived ticket_reply", $client_id, $ticket_reply_id); logAudit("Ticket Reply", "Archive", "$session_name archived ticket_reply", $client_id, $ticket_reply_id);
flash_alert("Ticket reply archived", 'error'); flashAlert("Ticket reply archived", 'error');
redirect(); redirect();
@@ -2002,7 +2002,7 @@ if (isset($_POST['merge_ticket'])) {
// Get current ticket details // Get current ticket details
$sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_details FROM tickets WHERE ticket_id = $ticket_id"); $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) { if (mysqli_num_rows($sql) == 0) {
flash_alert("No ticket with that ID found.", 'error'); flashAlert("No ticket with that ID found.", 'error');
redirect(); redirect();
} }
// CURRENT ticket details // CURRENT ticket details
@@ -2017,7 +2017,7 @@ if (isset($_POST['merge_ticket'])) {
// Get merge into ticket id (as it may differ from the number) // Get merge into ticket id (as it may differ from the number)
$sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number, ticket_client_id FROM tickets WHERE ticket_id = $merge_into_ticket_id"); $sql = mysqli_query($mysqli, "SELECT ticket_id, ticket_number, ticket_client_id FROM tickets WHERE ticket_id = $merge_into_ticket_id");
if (mysqli_num_rows($sql) == 0) { if (mysqli_num_rows($sql) == 0) {
flash_alert("Cannot merge into that ticket.", 'error'); flashAlert("Cannot merge into that ticket.", 'error');
redirect(); redirect();
} }
$merge_row = mysqli_fetch_assoc($sql); $merge_row = mysqli_fetch_assoc($sql);
@@ -2034,7 +2034,7 @@ if (isset($_POST['merge_ticket'])) {
} }
// Sanity check // Sanity check
if ($ticket_id == $merge_into_ticket_id) { if ($ticket_id == $merge_into_ticket_id) {
flash_alert("Cannot merge into the same ticket.", 'error'); flashAlert("Cannot merge into the same ticket.", 'error');
redirect(); redirect();
} }
@@ -2061,7 +2061,7 @@ if (isset($_POST['merge_ticket'])) {
customAction('ticket_merge', $ticket_id); customAction('ticket_merge', $ticket_id);
flash_alert("Ticket merged into $ticket_prefix$merge_into_ticket_number"); flashAlert("Ticket merged into $ticket_prefix$merge_into_ticket_number");
redirect("ticket.php?ticket_id=$merge_into_ticket_id$has_client"); redirect("ticket.php?ticket_id=$merge_into_ticket_id$has_client");
@@ -2092,7 +2092,7 @@ if (isset($_POST['change_client_ticket'])) {
customAction('ticket_update', $ticket_id); customAction('ticket_update', $ticket_id);
flash_alert("Ticket client updated"); flashAlert("Ticket client updated");
redirect(); redirect();
@@ -2204,7 +2204,7 @@ if (isset($_GET['resolve_ticket'])) {
} }
//End Mail IF //End Mail IF
flash_alert("Ticket resolved"); flashAlert("Ticket resolved");
redirect(); redirect();
@@ -2303,7 +2303,7 @@ if (isset($_GET['close_ticket'])) {
} }
//End Mail IF //End Mail IF
flash_alert("Ticket Closed, this cannot not be reopened but you may start another one"); flashAlert("Ticket Closed, this cannot not be reopened but you may start another one");
redirect(); redirect();
@@ -2330,7 +2330,7 @@ if (isset($_GET['reopen_ticket'])) {
customAction('ticket_update', $ticket_id); customAction('ticket_update', $ticket_id);
flash_alert("Ticket re-opened"); flashAlert("Ticket re-opened");
redirect(); redirect();
@@ -2451,7 +2451,7 @@ if (isset($_POST['add_invoice_from_ticket'])) {
logAudit("Invoice", "Create", "$session_name created invoice $invoice_prefix$invoice_number from Ticket $ticket_prefix$ticket_number", $client_id, $invoice_id); logAudit("Invoice", "Create", "$session_name created invoice $invoice_prefix$invoice_number from Ticket $ticket_prefix$ticket_number", $client_id, $invoice_id);
flash_alert("Invoice $invoice_prefix$invoice_number created from ticket"); flashAlert("Invoice $invoice_prefix$invoice_number created from ticket");
redirect("invoice.php?invoice_id=$invoice_id"); redirect("invoice.php?invoice_id=$invoice_id");
@@ -2527,7 +2527,7 @@ if (isset($_POST['add_quote_from_ticket'])) {
customAction('quote_create', $quote_id); customAction('quote_create', $quote_id);
flash_alert("Quote <strong>$config_quote_prefix$quote_number</strong> created"); flashAlert("Quote <strong>$config_quote_prefix$quote_number</strong> created");
redirect("quote.php?quote_id=$quote_id"); redirect("quote.php?quote_id=$quote_id");
} }
@@ -2560,7 +2560,7 @@ if (isset($_POST['export_tickets_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Tickets-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Tickets-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');
@@ -2618,7 +2618,7 @@ if (isset($_POST['edit_ticket_billable_status'])) {
logAudit("Ticket", "Edit", "$session_name marked ticket $ticket_prefix$ticket_number as $billable_wording Billable", $client_id, $ticket_id); logAudit("Ticket", "Edit", "$session_name marked ticket $ticket_prefix$ticket_number as $billable_wording Billable", $client_id, $ticket_id);
flash_alert("Ticket marked <strong>$billable_wording Billable</strong>"); flashAlert("Ticket marked <strong>$billable_wording Billable</strong>");
redirect(); redirect();
@@ -2792,11 +2792,11 @@ if (isset($_POST['edit_ticket_schedule'])) {
customAction('ticket_schedule', $ticket_id); customAction('ticket_schedule', $ticket_id);
if (empty($conflicting_tickets)) { if (empty($conflicting_tickets)) {
flash_alert("Ticket scheduled for $email_datetime"); flashAlert("Ticket scheduled for $email_datetime");
redirect(); redirect();
} else { } else {
$_SESSION['alert_type'] = "error"; $_SESSION['alert_type'] = "error";
flash_alert("Ticket scheduled for $email_datetime. Yet there are conflicting tickets scheduled for the same time: <br>" . implode(", <br>", $conflicting_tickets), 'error'); flashAlert("Ticket scheduled for $email_datetime. Yet there are conflicting tickets scheduled for the same time: <br>" . implode(", <br>", $conflicting_tickets), 'error');
redirect("calendar.php"); redirect("calendar.php");
} }
@@ -2955,7 +2955,7 @@ if (isset($_GET['cancel_ticket_schedule'])) {
customAction('ticket_unschedule', $ticket_id); customAction('ticket_unschedule', $ticket_id);
flash_alert("Ticket schedule cancelled", 'error'); flashAlert("Ticket schedule cancelled", 'error');
redirect(); redirect();

View File

@@ -37,7 +37,7 @@ if (isset($_POST['add_transfer'])) {
logAudit("Account Transfer", "Create", "$session_name transferred " . numfmt_format_currency($currency_format, $amount, $account_currency_code) . " from account $source_account_name to $destination_account_name", 0, $transfer_id); logAudit("Account Transfer", "Create", "$session_name transferred " . numfmt_format_currency($currency_format, $amount, $account_currency_code) . " from account $source_account_name to $destination_account_name", 0, $transfer_id);
flash_alert("Transferred <strong>" . numfmt_format_currency($currency_format, $amount, $account_currency_code) . "</strong> from <strong>$source_account_name</strong> to <strong>$destination_account_name</strong>"); flashAlert("Transferred <strong>" . numfmt_format_currency($currency_format, $amount, $account_currency_code) . "</strong> from <strong>$source_account_name</strong> to <strong>$destination_account_name</strong>");
redirect(); redirect();
@@ -63,7 +63,7 @@ if (isset($_POST['edit_transfer'])) {
logAudit("Account Transfer", "Edit", "$session_name edited transfer", 0, $transfer_id); logAudit("Account Transfer", "Edit", "$session_name edited transfer", 0, $transfer_id);
flash_alert("Transfer edited"); flashAlert("Transfer edited");
redirect(); redirect();
@@ -90,7 +90,7 @@ if (isset($_GET['delete_transfer'])) {
logAudit("Account Transfer", "Delete", "$session_name deleted transfer"); logAudit("Account Transfer", "Delete", "$session_name deleted transfer");
flash_alert("Transfer deleted", 'error'); flashAlert("Transfer deleted", 'error');
redirect(); redirect();

View File

@@ -26,7 +26,7 @@ if (isset($_POST['add_trip'])) {
logAudit("Trip", "Create", "$session_name logged trip from $source to $destination", $client_id , $trip_id); logAudit("Trip", "Create", "$session_name logged trip from $source to $destination", $client_id , $trip_id);
flash_alert("Trip from <strong>$source</strong> to <strong>$destination</strong> logged"); flashAlert("Trip from <strong>$source</strong> to <strong>$destination</strong> logged");
redirect(); redirect();
@@ -50,7 +50,7 @@ if (isset($_POST['edit_trip'])) {
logAudit("Trip", "Edit", "$session_name edited trip", $client_id , $trip_id); logAudit("Trip", "Edit", "$session_name edited trip", $client_id , $trip_id);
flash_alert("Trip edited"); flashAlert("Trip edited");
redirect(); redirect();
@@ -78,7 +78,7 @@ if (isset($_GET['delete_trip'])) {
logAudit("Trip", "Delete", "$session_name deleted trip ($trip_source - $trip_destination)", $client_id); logAudit("Trip", "Delete", "$session_name deleted trip ($trip_source - $trip_destination)", $client_id);
flash_alert("Trip ($trip_source - $trip_destination) deleted", 'error'); flashAlert("Trip ($trip_source - $trip_destination) deleted", 'error');
redirect(); redirect();
@@ -127,7 +127,7 @@ if (isset($_POST['export_trips_csv'])) {
$delimiter = ","; $delimiter = ",";
$enclosure = '"'; $enclosure = '"';
$escape = '\\'; // backslash $escape = '\\'; // backslash
$filename = sanitize_filename($file_name_prepend . "Trips-" . date('Y-m-d_H-i-s') . ".csv"); $filename = sanitizeFilename($file_name_prepend . "Trips-" . date('Y-m-d_H-i-s') . ".csv");
//create a file pointer //create a file pointer
$f = fopen('php://memory', 'w'); $f = fopen('php://memory', 'w');

View File

@@ -82,7 +82,7 @@ if (isset($_POST['edit_your_user_details'])) {
logAudit("User Account", "Edit", "$session_name edited their account $extended_log_description"); logAudit("User Account", "Edit", "$session_name edited their account $extended_log_description");
flash_alert("User details updated"); flashAlert("User details updated");
if ($logout) { if ($logout) {
redirect('post.php?logout'); redirect('post.php?logout');
@@ -104,7 +104,7 @@ if (isset($_GET['clear_your_user_avatar'])) {
logAudit("User Account", "Edit", "$session_name cleared their avatar"); logAudit("User Account", "Edit", "$session_name cleared their avatar");
flash_alert("Avatar cleared", 'error'); flashAlert("Avatar cleared", 'error');
redirect(); redirect();
@@ -156,7 +156,7 @@ if (isset($_POST['edit_your_user_password'])) {
logAudit("User Account", "Edit", "$session_name changed their password"); logAudit("User Account", "Edit", "$session_name changed their password");
flash_alert("Your password was updated"); flashAlert("Your password was updated");
redirect('post.php?logout'); redirect('post.php?logout');
} }
@@ -192,7 +192,7 @@ if (isset($_POST['edit_your_user_preferences'])) {
logAudit("User Account", "Edit", "$session_name $extended_log_description"); logAudit("User Account", "Edit", "$session_name $extended_log_description");
flash_alert("User preferences updated"); flashAlert("User preferences updated");
redirect(); redirect();
@@ -225,7 +225,7 @@ if (isset($_POST['enable_mfa'])) {
logAudit("User Account", "Edit", "$session_name enabled MFA on their account"); logAudit("User Account", "Edit", "$session_name enabled MFA on their account");
flash_alert("Multi-Factor authentication enabled"); flashAlert("Multi-Factor authentication enabled");
// Clear the mfa_token from the session to avoid re-use. // Clear the mfa_token from the session to avoid re-use.
unset($_SESSION['mfa_token']); unset($_SESSION['mfa_token']);
@@ -242,7 +242,7 @@ if (isset($_POST['enable_mfa'])) {
} else { } else {
// FAILURE // FAILURE
flash_alert("Verification code invalid, please try again.", 'error'); flashAlert("Verification code invalid, please try again.", 'error');
// Set a flag to automatically open the MFA modal again // Set a flag to automatically open the MFA modal again
$_SESSION['show_mfa_modal'] = true; $_SESSION['show_mfa_modal'] = true;
@@ -264,7 +264,7 @@ if (isset($_POST['enable_mfa'])) {
if (isset($_GET['disable_mfa'])){ if (isset($_GET['disable_mfa'])){
if ($session_user_config_force_mfa) { if ($session_user_config_force_mfa) {
flash_alert("Multi-Factor authentication cannot be disabled for your account", 'error'); flashAlert("Multi-Factor authentication cannot be disabled for your account", 'error');
redirect(); redirect();
} }
@@ -300,7 +300,7 @@ if (isset($_GET['disable_mfa'])){
logAudit("User Account", "Edit", "$session_name disabled MFA on their account"); logAudit("User Account", "Edit", "$session_name disabled MFA on their account");
flash_alert("Multi-Factor authentication disabled", 'error'); flashAlert("Multi-Factor authentication disabled", 'error');
redirect(); redirect();
@@ -315,7 +315,7 @@ if (isset($_POST['revoke_your_2fa_remember_tokens'])) {
logAudit("User Account", "Edit", "$session_name revoked all their remember-me tokens"); logAudit("User Account", "Edit", "$session_name revoked all their remember-me tokens");
flash_alert("Remember me tokens revoked", 'error'); flashAlert("Remember me tokens revoked", 'error');
redirect(); redirect();

View File

@@ -91,7 +91,7 @@ if (isset($_POST['add_ticket_comment'])) {
// After stripping bad HTML, check the comment isn't just empty // After stripping bad HTML, check the comment isn't just empty
if (empty($comment)) { if (empty($comment)) {
flash_alert("You must enter a comment", 'danger'); flashAlert("You must enter a comment", 'danger');
redirect(); redirect();
} }
@@ -207,7 +207,7 @@ if (isset($_GET['approve_ticket_task'])) {
$ticket_id = intval($approval_row['task_ticket_id']); $ticket_id = intval($approval_row['task_ticket_id']);
if (!$approval_row) { if (!$approval_row) {
flash_alert("Cannot find/approve that task", 'warning'); flashAlert("Cannot find/approve that task", 'warning');
redirect(); redirect();
exit; exit;
} }
@@ -223,7 +223,7 @@ if (isset($_GET['approve_ticket_task'])) {
// Logging // Logging
logAudit("Task", "Edit", "Contact $session_contact_email approved task $task_name (approval $approval_id)", $session_client_id, $task_id); logAudit("Task", "Edit", "Contact $session_contact_email approved task $task_name (approval $approval_id)", $session_client_id, $task_id);
flash_alert("Task Approved"); flashAlert("Task Approved");
redirect(); redirect();
} }
@@ -411,7 +411,7 @@ if (isset($_POST['add_contact'])) {
// Check the email isn't already in use // Check the email isn't already in use
$sql = mysqli_query($mysqli, "SELECT user_id FROM users WHERE user_email = '$contact_email'"); $sql = mysqli_query($mysqli, "SELECT user_id FROM users WHERE user_email = '$contact_email'");
if ($sql && mysqli_num_rows($sql) > 0) { if ($sql && mysqli_num_rows($sql) > 0) {
flash_alert("Cannot add contact as that email address is already in use", 'danger'); flashAlert("Cannot add contact as that email address is already in use", 'danger');
redirect('contact_add.php'); redirect('contact_add.php');
} }
@@ -437,7 +437,7 @@ if (isset($_POST['add_contact'])) {
customAction('contact_create', $contact_id); customAction('contact_create', $contact_id);
flash_alert("Contact $contact_name created"); flashAlert("Contact $contact_name created");
redirect('contacts.php'); redirect('contacts.php');
@@ -466,7 +466,7 @@ if (isset($_POST['edit_contact'])) {
// Check the email isn't already in use // Check the email isn't already in use
$sql = mysqli_query($mysqli, "SELECT user_id FROM users WHERE user_email = '$contact_email' AND user_id != $contact_user_id"); $sql = mysqli_query($mysqli, "SELECT user_id FROM users WHERE user_email = '$contact_email' AND user_id != $contact_user_id");
if ($sql && mysqli_num_rows($sql) > 0) { if ($sql && mysqli_num_rows($sql) > 0) {
flash_alert("Cannot update contact as that email address is already in use", 'danger'); flashAlert("Cannot update contact as that email address is already in use", 'danger');
redirect('contact_edit.php?id=' . $contact_id); redirect('contact_edit.php?id=' . $contact_id);
} }
@@ -487,7 +487,7 @@ if (isset($_POST['edit_contact'])) {
logAudit("Contact", "Edit", "Client contact $session_contact_name edited contact $contact_name in the client portal", $session_client_id, $contact_id); logAudit("Contact", "Edit", "Client contact $session_contact_name edited contact $contact_name in the client portal", $session_client_id, $contact_id);
flash_alert("Contact $contact_name updated"); flashAlert("Contact $contact_name updated");
redirect('contacts.php'); redirect('contacts.php');
@@ -560,19 +560,19 @@ if (isset($_GET['add_payment_by_provider'])) {
// Sanity checks // Sanity checks
// Check to make invoice belongs to logged in client // Check to make invoice belongs to logged in client
if ($client_id !== $session_client_id) { if ($client_id !== $session_client_id) {
flash_alert("Invoice does not belong to you!", 'danger'); flashAlert("Invoice does not belong to you!", 'danger');
redirect(); redirect();
} elseif ($payment_client_id !== $session_client_id) { } elseif ($payment_client_id !== $session_client_id) {
flash_alert("Saved Payment method does not belong to you!", 'danger'); flashAlert("Saved Payment method does not belong to you!", 'danger');
redirect(); redirect();
} elseif (!$payment_provider_client || !$saved_payment_method) { } elseif (!$payment_provider_client || !$saved_payment_method) {
flash_alert("Stripe not enabled or no client card saved", 'error'); flashAlert("Stripe not enabled or no client card saved", 'error');
redirect(); redirect();
} elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') { } elseif ($invoice_status !== 'Sent' && $invoice_status !== 'Viewed') {
flash_alert("Invalid invoice state (draft/partial/paid/not billable)", 'error'); flashAlert("Invalid invoice state (draft/partial/paid/not billable)", 'error');
redirect(); redirect();
} elseif ($invoice_amount == 0) { } elseif ($invoice_amount == 0) {
flash_alert("Invalid invoice amount", 'error'); flashAlert("Invalid invoice amount", 'error');
redirect(); redirect();
} }
@@ -680,7 +680,7 @@ if (isset($_GET['add_payment_by_provider'])) {
logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id); logAudit("Invoice", "Payment", "$session_name initiated Stripe payment amount of " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " added to invoice $invoice_prefix$invoice_number - $pi_id $extended_log_desc", $client_id, $invoice_id);
customAction('invoice_pay', $invoice_id); customAction('invoice_pay', $invoice_id);
flash_alert("The amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " paid Invoice $invoice_prefix$invoice_number"); flashAlert("The amount " . numfmt_format_currency($currency_format, $invoice_amount, $invoice_currency_code) . " paid Invoice $invoice_prefix$invoice_number");
redirect(); redirect();
@@ -688,7 +688,7 @@ if (isset($_GET['add_payment_by_provider'])) {
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"); 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");
logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id); logAudit("Invoice", "Payment", "Failed online payment amount of invoice $invoice_prefix$invoice_number due to Stripe payment error", $client_id, $invoice_id);
flash_alert("Payment failed", 'error'); flashAlert("Payment failed", 'error');
redirect(); redirect();
} }
@@ -713,7 +713,7 @@ if (isset($_POST['create_stripe_customer'])) {
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result); $stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
if (!$stripe_provider) { if (!$stripe_provider) {
flash_alert("Stripe provider is not configured in the system.", 'danger'); flashAlert("Stripe provider is not configured in the system.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -721,7 +721,7 @@ if (isset($_POST['create_stripe_customer'])) {
$stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']); $stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']);
if (empty($stripe_secret_key)) { if (empty($stripe_secret_key)) {
flash_alert("Stripe credentials missing. Please contact support.", 'danger'); flashAlert("Stripe credentials missing. Please contact support.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -763,7 +763,7 @@ if (isset($_POST['create_stripe_customer'])) {
logAudit("Stripe", "Create", "$session_contact_name created Stripe customer for $session_client_name as $stripe_customer_id and authorized future automatic payments", $session_client_id, $session_client_id); logAudit("Stripe", "Create", "$session_contact_name created Stripe customer for $session_client_name as $stripe_customer_id and authorized future automatic payments", $session_client_id, $session_client_id);
flash_alert("Stripe customer created. Thank you for your consent."); flashAlert("Stripe customer created. Thank you for your consent.");
} catch (Exception $e) { } catch (Exception $e) {
$error = $e->getMessage(); $error = $e->getMessage();
@@ -772,12 +772,12 @@ if (isset($_POST['create_stripe_customer'])) {
logApp("Stripe", "error", "Failed to create Stripe customer for $session_client_name: $error"); logApp("Stripe", "error", "Failed to create Stripe customer for $session_client_name: $error");
flash_alert("An error occurred while creating your Stripe customer. Please try again.", 'danger'); flashAlert("An error occurred while creating your Stripe customer. Please try again.", 'danger');
} }
} else { } else {
flash_alert("Stripe customer already exists for your account.", 'danger'); flashAlert("Stripe customer already exists for your account.", 'danger');
} }
redirect('saved_payment_methods.php'); redirect('saved_payment_methods.php');
@@ -873,7 +873,7 @@ if (isset($_GET['stripe_save_card'])) {
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result); $stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
if (!$stripe_provider) { if (!$stripe_provider) {
flash_alert("Stripe provider not configured.", 'danger'); flashAlert("Stripe provider not configured.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -881,7 +881,7 @@ if (isset($_GET['stripe_save_card'])) {
$stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']); $stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']);
if (empty($stripe_secret_key)) { if (empty($stripe_secret_key)) {
flash_alert("Stripe credentials missing.", 'danger'); flashAlert("Stripe credentials missing.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -897,7 +897,7 @@ if (isset($_GET['stripe_save_card'])) {
$stripe_customer_id = escapeSql($client_provider['payment_provider_client'] ?? ''); $stripe_customer_id = escapeSql($client_provider['payment_provider_client'] ?? '');
if (empty($stripe_customer_id)) { if (empty($stripe_customer_id)) {
flash_alert("Stripe customer ID not found for client.", 'danger'); flashAlert("Stripe customer ID not found for client.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -942,7 +942,7 @@ if (isset($_GET['stripe_save_card'])) {
error_log("Stripe error while saving payment method: $error"); error_log("Stripe error while saving payment method: $error");
logApp("Stripe", "error", "Exception saving payment method: $error"); logApp("Stripe", "error", "Exception saving payment method: $error");
flash_alert("An error occurred while saving your payment method.", 'danger'); flashAlert("An error occurred while saving your payment method.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -982,7 +982,7 @@ if (isset($_GET['stripe_save_card'])) {
logAudit("Stripe", "Update", "$session_contact_name saved payment method ($saved_payment_description) (PM: $payment_method_id)", $session_client_id); logAudit("Stripe", "Update", "$session_contact_name saved payment method ($saved_payment_description) (PM: $payment_method_id)", $session_client_id);
flash_alert("Payment method saved thank you."); flashAlert("Payment method saved thank you.");
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -1006,7 +1006,7 @@ if (isset($_GET['delete_saved_payment'])) {
$stripe_provider = mysqli_fetch_assoc($stripe_provider_result); $stripe_provider = mysqli_fetch_assoc($stripe_provider_result);
if (!$stripe_provider) { if (!$stripe_provider) {
flash_alert("Stripe provider is not configured.", 'danger'); flashAlert("Stripe provider is not configured.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -1014,7 +1014,7 @@ if (isset($_GET['delete_saved_payment'])) {
$stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']); $stripe_secret_key = escapeHtml($stripe_provider['payment_provider_private_key']);
if (empty($stripe_secret_key)) { if (empty($stripe_secret_key)) {
flash_alert("Stripe credentials are missing.", 'danger'); flashAlert("Stripe credentials are missing.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -1030,7 +1030,7 @@ if (isset($_GET['delete_saved_payment'])) {
$saved_payment = mysqli_fetch_assoc($saved_payment_result); $saved_payment = mysqli_fetch_assoc($saved_payment_result);
if (!$saved_payment) { if (!$saved_payment) {
flash_alert("Payment method not found or does not belong to you.", 'danger'); flashAlert("Payment method not found or does not belong to you.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -1054,7 +1054,7 @@ if (isset($_GET['delete_saved_payment'])) {
logApp("Stripe", "error", "Exception removing payment method $payment_method_id: $error"); logApp("Stripe", "error", "Exception removing payment method $payment_method_id: $error");
flash_alert("An error occurred while removing your payment method.", 'danger'); flashAlert("An error occurred while removing your payment method.", 'danger');
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
@@ -1085,7 +1085,7 @@ if (isset($_GET['delete_saved_payment'])) {
logAudit("Stripe", "Update", "$session_contact_name deleted Stripe payment method $saved_payment_description (PM: $payment_method_id)", $session_client_id); logAudit("Stripe", "Update", "$session_contact_name deleted Stripe payment method $saved_payment_description (PM: $payment_method_id)", $session_client_id);
flash_alert("Payment method $saved_payment_description removed."); flashAlert("Payment method $saved_payment_description removed.");
redirect("saved_payment_methods.php"); redirect("saved_payment_methods.php");
} }
@@ -1130,14 +1130,14 @@ if (isset($_POST['set_recurring_payment'])) {
logAudit("Recurring Invoice", "Auto Payment", "$session_name created Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $session_client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Auto Payment", "$session_name created Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $session_client_id, $recurring_invoice_id);
flash_alert("Automatic Payment $saved_payment_description enabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"); flashAlert("Automatic Payment $saved_payment_description enabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number");
} else { } else {
// Delete // Delete
mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_recurring_invoice_id = $recurring_invoice_id"); mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_recurring_invoice_id = $recurring_invoice_id");
logAudit("Recurring Invoice", "Auto Payment", "$session_name removed Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $session_client_id, $recurring_invoice_id); logAudit("Recurring Invoice", "Auto Payment", "$session_name removed Auto Pay for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number in the amount of " . numfmt_format_currency($currency_format, $recurring_invoice_amount, $recurring_invoice_currency_code), $session_client_id, $recurring_invoice_id);
flash_alert("Automatic Payment Disabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number"); flashAlert("Automatic Payment Disabled for Recurring Invoice $recurring_invoice_prefix$recurring_invoice_number");
} }
redirect(); redirect();
@@ -1184,7 +1184,7 @@ if (isset($_POST['client_add_document'])) {
logAudit("Document", "Create", "Client contact $session_contact_name created document $document_name", $session_client_id, $document_id); logAudit("Document", "Create", "Client contact $session_contact_name created document $document_name", $session_client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> created successfully"); flashAlert("Document <strong>$document_name</strong> created successfully");
redirect('documents.php'); redirect('documents.php');
@@ -1262,18 +1262,18 @@ if (isset($_POST['client_upload_document'])) {
logAudit("Document", "Upload", "Client contact $session_contact_name uploaded document $document_name with file $file_name", $session_client_id, $document_id); logAudit("Document", "Upload", "Client contact $session_contact_name uploaded document $document_name with file $file_name", $session_client_id, $document_id);
flash_alert("Document <strong>$document_name</strong> uploaded successfully"); flashAlert("Document <strong>$document_name</strong> uploaded successfully");
} else { } else {
flash_alert('Error uploading file. Please try again.', 'error'); flashAlert('Error uploading file. Please try again.', 'error');
} }
} else { } else {
flash_alert('Invalid file type. Please upload PDF, Word documents, or text files only.', 'error'); flashAlert('Invalid file type. Please upload PDF, Word documents, or text files only.', 'error');
} }
} else { } else {
flash_alert('Please select a file to upload.', 'error'); flashAlert('Please select a file to upload.', 'error');
} }
redirect('documents.php'); redirect('documents.php');

View File

@@ -169,7 +169,7 @@ function getFieldById($table, $id, $field, $escape_method = 'sql') {
} }
// Recursive function to display folder options - Used in folders files and documents // Recursive function to display folder options - Used in folders files and documents
function display_folder_options($parent_folder_id, $client_id, $indent = 0) { function displayFolderOptions($parent_folder_id, $client_id, $indent = 0) {
global $mysqli; global $mysqli;
$sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_client_id = $client_id ORDER BY folder_name ASC"); $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_client_id = $client_id ORDER BY folder_name ASC");
@@ -190,7 +190,7 @@ function display_folder_options($parent_folder_id, $client_id, $indent = 0) {
echo "<option value=\"$folder_id\" $selected>$indentation$folder_name</option>"; echo "<option value=\"$folder_id\" $selected>$indentation$folder_name</option>";
// Recursively display subfolders // Recursively display subfolders
display_folder_options($folder_id, $client_id, $indent + 1); displayFolderOptions($folder_id, $client_id, $indent + 1);
} }
} }

View File

@@ -78,7 +78,7 @@ function enforceClientAccess($client_id = null) {
$session_user_id = (int) $session_user_id; $session_user_id = (int) $session_user_id;
if (empty($client_id) || empty($session_user_id)) { if (empty($client_id) || empty($session_user_id)) {
flash_alert('Access Denied.', 'error'); flashAlert('Access Denied.', 'error');
redirect('clients.php'); redirect('clients.php');
} }
@@ -116,6 +116,6 @@ function enforceClientAccess($client_id = null) {
$client_id $client_id
); );
flash_alert('Access Denied - You do not have permission to access that client!', 'error'); flashAlert('Access Denied - You do not have permission to access that client!', 'error');
redirect('clients.php'); redirect('clients.php');
} }

View File

@@ -94,7 +94,7 @@ function redirect($url = null, $permanent = false) {
} }
//Flash Alert Function //Flash Alert Function
function flash_alert(string $message, string $type = 'success'): void { function flashAlert(string $message, string $type = 'success'): void {
$_SESSION['alert_type'] = $type; $_SESSION['alert_type'] = $type;
$_SESSION['alert_message'] = $message; $_SESSION['alert_message'] = $message;
} }

View File

@@ -77,7 +77,7 @@ function sanitize_url($url) {
} }
// Sanitize File Names // Sanitize File Names
function sanitize_filename($filename, $strict = false) { function sanitizeFilename($filename, $strict = false) {
// Remove path information and dots around the filename // Remove path information and dots around the filename
$filename = basename($filename); $filename = basename($filename);

View File

@@ -63,7 +63,7 @@ if (isset($_GET['accept_quote'], $_GET['url_key'])) {
$mail = addToMailQueue($data); $mail = addToMailQueue($data);
} }
flash_alert("Quote Accepted"); flashAlert("Quote Accepted");
redirect(); redirect();
@@ -127,7 +127,7 @@ if (isset($_GET['decline_quote'], $_GET['url_key'])) {
$mail = addToMailQueue($data); $mail = addToMailQueue($data);
} }
flash_alert("Quote Declined", 'danger'); flashAlert("Quote Declined", 'danger');
redirect(); redirect();
@@ -154,7 +154,7 @@ if (isset($_GET['reopen_ticket'], $_GET['url_key'])) {
customAction('ticket_update', $ticket_id); customAction('ticket_update', $ticket_id);
flash_alert("Ticket reopened"); flashAlert("Ticket reopened");
redirect(); redirect();
@@ -182,7 +182,7 @@ if (isset($_GET['close_ticket'], $_GET['url_key'])) {
customAction('ticket_close', $ticket_id); customAction('ticket_close', $ticket_id);
flash_alert("Ticket closed"); flashAlert("Ticket closed");
redirect(); redirect();
@@ -213,7 +213,7 @@ if (isset($_GET['add_ticket_feedback'], $_GET['url_key'])) {
appNotify("Feedback", "Guest rated ticket number $ticket_prefix$ticket_number (ID: $ticket_id) as bad", "/agent/ticket.php?ticket_id=$ticket_id"); appNotify("Feedback", "Guest rated ticket number $ticket_prefix$ticket_number (ID: $ticket_id) as bad", "/agent/ticket.php?ticket_id=$ticket_id");
} }
flash_alert("Feedback recorded - thank you"); flashAlert("Feedback recorded - thank you");
redirect(); redirect();
@@ -253,7 +253,7 @@ if (isset($_GET['approve_ticket_task'])) {
// Logging // Logging
logAudit("Task", "Edit", "Guest user approved task $task_name via link (approval $approval_id)", 0, $task_id); logAudit("Task", "Edit", "Guest user approved task $task_name via link (approval $approval_id)", 0, $task_id);
flash_alert("Task Approved"); flashAlert("Task Approved");
redirect(); redirect();
} }
@@ -758,7 +758,7 @@ if (isset($_POST['guest_quote_upload_file'])) {
mysqli_query($mysqli, "INSERT INTO quote_files SET quote_id = $quote_id, file_id = $file_id"); mysqli_query($mysqli, "INSERT INTO quote_files SET quote_id = $quote_id, file_id = $file_id");
// Logging & feedback // Logging & feedback
flash_alert('File uploaded!'); flashAlert('File uploaded!');
appNotify("Quote File", "$file_name was uploaded to quote $quote_prefix$quote_number", "/agent/quote.php?quote_id=$quote_id", $client_id); appNotify("Quote File", "$file_name was uploaded to quote $quote_prefix$quote_number", "/agent/quote.php?quote_id=$quote_id", $client_id);
@@ -767,7 +767,7 @@ if (isset($_POST['guest_quote_upload_file'])) {
logAudit("File", "Upload", "Guest uploaded file $file_name to quote $quote_prefix$quote_number", $client_id); logAudit("File", "Upload", "Guest uploaded file $file_name to quote $quote_prefix$quote_number", $client_id);
} else { } else {
flash_alert('Something went wrong uploading the file - please let the support team know.', 'error'); flashAlert('Something went wrong uploading the file - please let the support team know.', 'error');
logApp("Guest", "error", "Error uploading file to invoice"); logApp("Guest", "error", "Error uploading file to invoice");
} }