From 0a30300bde226a39818998b8ddba5dd28c4f0fc3 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 14 Jan 2026 17:30:23 -0500 Subject: [PATCH] replace all instances of mysqli_fetch_array with mysqli_fetch_assoc for better performance and memory usage --- admin/ai_model.php | 2 +- admin/ai_provider.php | 2 +- admin/api_keys.php | 3 +- admin/app_log.php | 6 +- admin/audit_log.php | 13 +- admin/category.php | 2 +- admin/contract_template.php | 2 +- admin/custom_link.php | 2 +- admin/database_updates.php | 42 +++--- admin/document_template.php | 2 +- admin/document_template_details.php | 2 +- admin/includes/side_nav.php | 2 +- admin/mail_queue.php | 2 +- admin/modals/ai/ai_model_add.php | 2 +- admin/modals/ai/ai_model_edit.php | 4 +- admin/modals/ai/ai_provider_edit.php | 2 +- admin/modals/api/api_key_add.php | 2 +- admin/modals/category/category_edit.php | 2 +- .../contract_template_edit.php | 2 +- admin/modals/custom_link/custom_link_edit.php | 6 +- .../document_template_edit.php | 2 +- .../mail_queue/mail_queue_message_view.php | 2 +- .../payment_method/payment_method_edit.php | 2 +- .../payment_provider/payment_provider_add.php | 6 +- .../payment_provider_edit.php | 8 +- .../project_template_edit.php | 4 +- .../project_template_ticket_template_add.php | 2 +- admin/modals/role/role_edit.php | 6 +- .../software_template_edit.php | 2 +- admin/modals/tag/tag_edit.php | 2 +- admin/modals/tax/tax_edit.php | 2 +- .../ticket_status/ticket_status_edit.php | 2 +- .../ticket_template/ticket_template_add.php | 2 +- .../ticket_template_task_edit.php | 6 +- admin/modals/user/user_add.php | 4 +- admin/modals/user/user_archive.php | 4 +- admin/modals/user/user_edit.php | 8 +- admin/modals/user/user_restore.php | 4 +- .../vendor_template/vendor_template_edit.php | 4 +- admin/modules.php | 2 +- admin/payment_method.php | 2 +- admin/payment_provider.php | 2 +- admin/post/api_keys.php | 6 +- admin/post/backup.php | 9 +- admin/post/category.php | 12 +- admin/post/custom_link.php | 4 +- admin/post/saved_payment_method.php | 10 +- admin/post/settings_company.php | 4 +- .../post/settings_online_payment_clients.php | 14 +- admin/post/software_template.php | 2 +- admin/post/update.php | 2 +- admin/post/users.php | 12 +- admin/project_template.php | 4 +- admin/project_template_details.php | 6 +- admin/roles.php | 2 +- admin/saved_payment_method.php | 2 +- admin/settings_company.php | 2 +- admin/settings_custom_fields.php | 5 +- admin/settings_default.php | 14 +- admin/settings_localization.php | 3 +- admin/software_template.php | 4 +- admin/tag.php | 2 +- admin/tax.php | 2 +- admin/ticket_status.php | 4 +- admin/ticket_template.php | 6 +- admin/ticket_template_details.php | 4 +- admin/users.php | 4 +- admin/vendor_template.php | 2 +- agent/accounts.php | 8 +- agent/ajax.php | 42 +++--- agent/asset_details.php | 26 ++-- agent/assets.php | 10 +- agent/calendar.php | 30 ++--- agent/certificates.php | 4 +- agent/client_autopay.php | 4 +- agent/client_overview.php | 36 +++--- agent/contact_details.php | 30 ++--- agent/contacts.php | 10 +- agent/credentials.php | 12 +- agent/dashboard.php | 84 ++++++------ agent/document_details.php | 16 +-- agent/domains.php | 4 +- agent/expenses.php | 8 +- agent/files_legacy.php | 8 +- agent/global_search.php | 30 ++--- agent/includes/inc_all_client.php | 14 +- agent/includes/side_nav.php | 6 +- agent/invoice.php | 20 +-- agent/invoices.php | 18 +-- agent/locations.php | 8 +- agent/modals/account/account_edit.php | 6 +- agent/modals/asset/asset_add.php | 18 +-- agent/modals/asset/asset_bulk_add_ticket.php | 6 +- .../asset/asset_bulk_assign_contact.php | 2 +- .../asset/asset_bulk_assign_location.php | 2 +- agent/modals/asset/asset_bulk_assign_tags.php | 2 +- .../asset/asset_bulk_transfer_client.php | 2 +- agent/modals/asset/asset_copy.php | 14 +- agent/modals/asset/asset_details.php | 58 ++++----- agent/modals/asset/asset_documents.php | 2 +- agent/modals/asset/asset_edit.php | 22 ++-- agent/modals/asset/asset_interface_add.php | 4 +- .../asset_interface_bulk_edit_network.php | 2 +- agent/modals/asset/asset_interface_edit.php | 70 +++++----- .../asset/asset_interface_multiple_add.php | 2 +- agent/modals/asset/asset_link_credential.php | 4 +- agent/modals/asset/asset_link_document.php | 4 +- agent/modals/asset/asset_link_file.php | 4 +- agent/modals/asset/asset_link_service.php | 4 +- agent/modals/asset/asset_link_software.php | 6 +- agent/modals/calendar/calendar_edit.php | 4 +- agent/modals/calendar/calendar_event_add.php | 4 +- agent/modals/calendar/calendar_event_edit.php | 8 +- agent/modals/certificate/certificate_add.php | 8 +- agent/modals/certificate/certificate_edit.php | 6 +- agent/modals/contact/contact_add.php | 12 +- .../contact/contact_bulk_assign_location.php | 2 +- .../contact/contact_bulk_assign_tags.php | 2 +- agent/modals/contact/contact_details.php | 50 +++---- agent/modals/contact/contact_edit.php | 11 +- agent/modals/contact/contact_link_asset.php | 4 +- .../contact/contact_link_credential.php | 4 +- .../modals/contact/contact_link_document.php | 4 +- agent/modals/contact/contact_link_file.php | 4 +- agent/modals/contact/contact_link_service.php | 4 +- .../modals/contact/contact_link_software.php | 4 +- agent/modals/contact/contact_note_add.php | 2 +- agent/modals/credential/credential_add.php | 10 +- .../credential_bulk_assign_tags.php | 2 +- agent/modals/credential/credential_edit.php | 10 +- agent/modals/credential/credential_view.php | 4 +- .../document/document_add_file_relation.php | 4 +- .../document/document_add_from_template.php | 4 +- agent/modals/document/document_edit.php | 4 +- .../document/document_edit_visibility.php | 2 +- agent/modals/document/document_link_asset.php | 4 +- .../modals/document/document_link_contact.php | 4 +- agent/modals/document/document_link_file.php | 4 +- .../document/document_link_software.php | 4 +- .../modals/document/document_link_vendor.php | 4 +- agent/modals/document/document_move.php | 4 +- agent/modals/document/document_rename.php | 4 +- .../modals/document/document_version_view.php | 4 +- agent/modals/document/document_view.php | 4 +- agent/modals/domain/domain_add.php | 14 +- agent/modals/domain/domain_edit.php | 24 ++-- agent/modals/expense/expense_add.php | 14 +- .../expense/expense_bulk_edit_account.php | 8 +- .../expense/expense_bulk_edit_category.php | 2 +- .../expense/expense_bulk_edit_client.php | 2 +- agent/modals/expense/expense_copy.php | 16 +-- agent/modals/expense/expense_edit.php | 16 +-- agent/modals/expense/expense_export.php | 6 +- agent/modals/expense/expense_refund.php | 2 +- agent/modals/file/file_link_asset.php | 6 +- agent/modals/file/file_move.php | 4 +- agent/modals/file/file_rename.php | 2 +- agent/modals/folder/folder_rename.php | 4 +- agent/modals/invoice/invoice_add.php | 4 +- agent/modals/invoice/invoice_add_ticket.php | 5 +- .../invoice/invoice_bulk_edit_category.php | 2 +- agent/modals/invoice/invoice_copy.php | 6 +- agent/modals/invoice/invoice_edit.php | 4 +- .../modals/invoice/invoice_recurring_add.php | 2 +- agent/modals/invoice/item_edit.php | 4 +- agent/modals/location/location_add.php | 14 +- .../location/location_bulk_assign_tags.php | 2 +- agent/modals/location/location_edit.php | 10 +- agent/modals/network/network_add.php | 6 +- agent/modals/network/network_edit.php | 8 +- agent/modals/payment/invoice_apply_credit.php | 4 +- agent/modals/payment/payment_add.php | 14 +- agent/modals/payment/payment_bulk_add.php | 16 +-- agent/modals/payment/payment_edit.php | 8 +- .../payment/payment_saved_method_add.php | 4 +- agent/modals/product/product_add.php | 4 +- .../product/product_bulk_edit_category.php | 2 +- agent/modals/product/product_edit.php | 6 +- agent/modals/product/product_stock_add.php | 8 +- agent/modals/project/project_add.php | 6 +- agent/modals/project/project_edit.php | 6 +- .../project/project_link_closed_ticket.php | 4 +- agent/modals/project/project_link_ticket.php | 4 +- agent/modals/quote/quote_add.php | 4 +- agent/modals/quote/quote_copy.php | 4 +- agent/modals/quote/quote_edit.php | 4 +- agent/modals/quote/quote_to_invoice.php | 2 +- agent/modals/rack/rack_add.php | 2 +- agent/modals/rack/rack_device_add.php | 4 +- agent/modals/rack/rack_edit.php | 4 +- .../recurring_expense_add.php | 14 +- .../recurring_expense_edit.php | 16 +-- .../recurring_invoice_add.php | 4 +- .../recurring_invoice_edit.php | 4 +- .../recurring_ticket/recurring_ticket_add.php | 46 +++---- .../recurring_ticket_bulk_agent_edit.php | 2 +- .../recurring_ticket_bulk_category_edit.php | 2 +- .../recurring_ticket_edit.php | 20 +-- agent/modals/revenue/revenue_add.php | 12 +- agent/modals/revenue/revenue_edit.php | 14 +- agent/modals/service/service_add.php | 22 ++-- agent/modals/service/service_details.php | 27 ++-- agent/modals/service/service_edit.php | 16 +-- agent/modals/share_modal.php | 5 +- agent/modals/software/software_add.php | 8 +- .../software/software_add_from_template.php | 4 +- agent/modals/software/software_edit.php | 14 +- agent/modals/ticket/ticket_add.php | 22 ++-- agent/modals/ticket/ticket_add_v2.php | 8 +- agent/modals/ticket/ticket_add_watcher.php | 2 +- agent/modals/ticket/ticket_assign.php | 4 +- agent/modals/ticket/ticket_billable.php | 2 +- .../modals/ticket/ticket_bulk_add_project.php | 2 +- agent/modals/ticket/ticket_bulk_assign.php | 2 +- .../ticket/ticket_bulk_edit_category.php | 2 +- agent/modals/ticket/ticket_bulk_reply.php | 2 +- agent/modals/ticket/ticket_change_client.php | 4 +- agent/modals/ticket/ticket_contact.php | 6 +- agent/modals/ticket/ticket_edit.php | 28 ++-- agent/modals/ticket/ticket_edit_asset.php | 10 +- agent/modals/ticket/ticket_edit_project.php | 6 +- agent/modals/ticket/ticket_edit_schedule.php | 2 +- agent/modals/ticket/ticket_edit_vendor.php | 4 +- agent/modals/ticket/ticket_invoice_add.php | 10 +- agent/modals/ticket/ticket_merge.php | 2 +- agent/modals/ticket/ticket_priority.php | 4 +- agent/modals/ticket/ticket_reply_edit.php | 2 +- agent/modals/ticket/ticket_reply_redact.php | 2 +- .../ticket/ticket_task_approver_add.php | 2 +- agent/modals/ticket/ticket_task_edit.php | 4 +- agent/modals/transfer/transfer_add.php | 20 +-- agent/modals/transfer/transfer_edit.php | 20 +-- agent/modals/trip/trip_add.php | 6 +- agent/modals/trip/trip_copy.php | 8 +- agent/modals/trip/trip_edit.php | 8 +- .../vendor/vendor_add_from_template.php | 2 +- agent/modals/vendor/vendor_details.php | 4 +- agent/modals/vendor/vendor_edit.php | 4 +- agent/networks.php | 6 +- agent/notifications.php | 10 +- agent/payments.php | 6 +- agent/post/asset.php | 76 +++++------ agent/post/certificate.php | 8 +- agent/post/client.php | 64 ++++----- agent/post/contact.php | 66 +++++----- agent/post/credential.php | 14 +- agent/post/document.php | 42 +++--- agent/post/domain.php | 12 +- agent/post/event.php | 12 +- agent/post/expense.php | 16 +-- agent/post/file.php | 26 ++-- agent/post/folder.php | 6 +- agent/post/invoice.php | 70 +++++----- agent/post/location.php | 16 +-- agent/post/network.php | 8 +- agent/post/payment.php | 40 +++--- agent/post/project.php | 20 +-- agent/post/quote.php | 48 +++---- agent/post/rack.php | 12 +- agent/post/recurring_expense.php | 2 +- agent/post/recurring_invoice.php | 46 +++---- agent/post/recurring_ticket.php | 22 ++-- agent/post/service.php | 16 +-- agent/post/software.php | 10 +- agent/post/task.php | 22 ++-- agent/post/ticket.php | 122 +++++++++--------- agent/post/transfer.php | 6 +- agent/post/vendor.php | 14 +- agent/post/vendor_contact.php | 28 ++-- agent/products.php | 4 +- agent/project_details.php | 26 ++-- agent/projects.php | 2 +- agent/quote.php | 16 +-- agent/quotes.php | 2 +- agent/racks.php | 36 +++--- agent/recurring_expenses.php | 2 +- agent/recurring_invoice.php | 16 +-- agent/recurring_invoices.php | 4 +- agent/recurring_tickets.php | 6 +- agent/reports/budget.php | 6 +- agent/reports/clients_with_balance.php | 27 ++-- agent/reports/credential_rotation.php | 3 +- agent/reports/expense_by_vendor.php | 22 ++-- agent/reports/expense_summary.php | 10 +- agent/reports/includes/reports_side_nav.php | 4 +- agent/reports/income_by_client.php | 11 +- agent/reports/income_summary.php | 18 +-- agent/reports/profit_loss.php | 55 ++++---- agent/reports/recurring_by_client.php | 2 +- agent/reports/tax_summary.php | 7 +- agent/reports/ticket_by_client.php | 39 +++--- agent/reports/ticket_summary.php | 6 +- agent/reports/tickets_unbilled.php | 11 +- agent/reports/time_by_tech.php | 33 +++-- agent/revenues.php | 2 +- agent/services.php | 10 +- agent/software.php | 8 +- agent/ticket.php | 44 +++---- agent/ticket_kanban.php | 20 +-- agent/ticket_list.php | 4 +- agent/tickets.php | 16 +-- agent/transfers.php | 12 +- agent/trips.php | 2 +- agent/user/mfa_enforcement.php | 14 +- agent/user/user_activity.php | 4 +- agent/user/user_preferences.php | 2 +- agent/user/user_security.php | 4 +- agent/vendor_details.php | 8 +- agent/vendors.php | 2 +- api/v1/clients/archive.php | 4 +- api/v1/credentials/read.php | 2 +- api/v1/read_output.php | 2 +- api/v1/tickets/create.php | 4 +- api/v1/validate_api_key.php | 2 +- client/assets.php | 2 +- client/certificates.php | 2 +- client/contact_edit.php | 2 +- client/contacts.php | 2 +- client/document.php | 10 +- client/documents.php | 4 +- client/domains.php | 2 +- client/functions.php | 8 +- client/includes/check_login.php | 6 +- client/includes/header.php | 2 +- client/index.php | 12 +- client/invoices.php | 3 +- client/login_microsoft.php | 4 +- client/login_reset.php | 6 +- client/post.php | 44 +++---- client/quotes.php | 2 +- client/recurring_invoices.php | 10 +- client/saved_payment_methods.php | 10 +- client/ticket.php | 12 +- client/ticket_add.php | 5 +- client/ticket_view_all.php | 3 +- client/tickets.php | 8 +- client/unpaid_invoices.php | 25 ++-- cron/certificate_refresher.php | 4 +- cron/cron.php | 40 +++--- cron/domain_refresher.php | 4 +- cron/mail_queue.php | 6 +- cron/ticket_email_parser.php | 16 +-- functions.php | 8 +- guest/guest_ajax.php | 6 +- guest/guest_approve_ticket_task.php | 3 +- guest/guest_download_file.php | 4 +- guest/guest_pay_invoice_stripe.php | 18 +-- guest/guest_post.php | 88 ++++++------- guest/guest_view_invoice.php | 28 ++-- guest/guest_view_item.php | 10 +- guest/guest_view_quote.php | 6 +- guest/guest_view_ticket.php | 14 +- guest/includes/inc_all_guest.php | 2 +- includes/inc_set_timezone.php | 2 +- includes/load_company_settings.php | 2 +- includes/load_global_settings.php | 2 +- includes/load_user_session.php | 2 +- includes/top_nav.php | 2 +- post/misc.php | 4 +- scripts/setup_cli.php | 2 +- setup/index.php | 4 +- 361 files changed, 1880 insertions(+), 1904 deletions(-) diff --git a/admin/ai_model.php b/admin/ai_model.php index 88c3b78b..2eab6bda 100644 --- a/admin/ai_model.php +++ b/admin/ai_model.php @@ -58,7 +58,7 @@ $num_rows = mysqli_num_rows($sql); @@ -85,7 +85,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -141,7 +141,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - +
- + - +
- + - +
- +
diff --git a/admin/modules.php b/admin/modules.php index 9a7c0165..9993602f 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -57,7 +57,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Master encryption key:
"; echo "$site_encryption_master_key"; echo "
=============================="; - + } else { logAction("Master Key", "Download", "$session_name attempted to retrieve the master encryption key but failed"); flash_alert("Incorrect password.", 'error'); - + redirect(); } } - diff --git a/admin/post/category.php b/admin/post/category.php index 070744dc..569c8552 100644 --- a/admin/post/category.php +++ b/admin/post/category.php @@ -39,12 +39,12 @@ if (isset($_POST['edit_category'])) { } if (isset($_GET['archive_category'])) { - + $category_id = intval($_GET['archive_category']); // Get Category Name and Type for logging $sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $category_name = sanitizeInput($row['category_name']); $category_type = sanitizeInput($row['category_type']); @@ -59,12 +59,12 @@ if (isset($_GET['archive_category'])) { } if (isset($_GET['unarchive_category'])) { - + $category_id = intval($_GET['unarchive_category']); // Get Category Name and Type for logging $sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $category_name = sanitizeInput($row['category_name']); $category_type = sanitizeInput($row['category_type']); @@ -79,12 +79,12 @@ if (isset($_GET['unarchive_category'])) { } if (isset($_GET['delete_category'])) { - + $category_id = intval($_GET['delete_category']); // Get Category Name and Type for logging $sql = mysqli_query($mysqli,"SELECT category_name, category_type FROM categories WHERE category_id = $category_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $category_name = sanitizeInput($row['category_name']); $category_type = sanitizeInput($row['category_type']); diff --git a/admin/post/custom_link.php b/admin/post/custom_link.php index 5ecf4710..0a3c6e66 100644 --- a/admin/post/custom_link.php +++ b/admin/post/custom_link.php @@ -48,12 +48,12 @@ if (isset($_POST['edit_custom_link'])) { } if (isset($_GET['delete_custom_link'])) { - + $custom_link_id = intval($_GET['delete_custom_link']); // Get Custom Link name and uri for logging $sql = mysqli_query($mysqli,"SELECT custom_link_name, custom_link_uri FROM custom_links WHERE custom_link_id = $custom_link_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $custom_link_name = sanitizeInput($row['custom_link_name']); $custom_link_uri = sanitizeInput($row['custom_link_uri']); diff --git a/admin/post/saved_payment_method.php b/admin/post/saved_payment_method.php index c4d0bfd6..7f2b7896 100644 --- a/admin/post/saved_payment_method.php +++ b/admin/post/saved_payment_method.php @@ -3,13 +3,13 @@ defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); if (isset($_GET['delete_saved_payment'])) { - + validateCSRFToken($_GET['csrf_token']); $saved_payment_id = intval($_GET['delete_saved_payment']); $sql = mysqli_query($mysqli, " - SELECT + SELECT client_saved_payment_methods.saved_payment_id, client_saved_payment_methods.saved_payment_client_id, client_saved_payment_methods.saved_payment_provider_id, @@ -27,7 +27,7 @@ if (isset($_GET['delete_saved_payment'])) { WHERE client_saved_payment_methods.saved_payment_id = $saved_payment_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['saved_payment_client_id']); $provider_id = intval($row['saved_payment_provider_id']); $payment_provider_name = nullable_htmlentities($row['payment_provider_name']); @@ -62,9 +62,9 @@ if (isset($_GET['delete_saved_payment'])) { // SQL Cascade delete will Remove All Associated Auto Payment Methods on recurring invoices in the recurring payments table. logAction("Payment Provider", "Update", "$session_name deleted saved payment method $saved_payment_description (PM: $payment_method)", $client_id); - + flash_alert("Payment method $saved_payment_description removed", 'error'); - + redirect(); } diff --git a/admin/post/settings_company.php b/admin/post/settings_company.php index 160055a9..72fd531a 100644 --- a/admin/post/settings_company.php +++ b/admin/post/settings_company.php @@ -19,7 +19,7 @@ if (isset($_POST['edit_company'])) { $tax_id = sanitizeInput($_POST['tax_id']); $sql = mysqli_query($mysqli,"SELECT company_logo FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $existing_file_name = sanitizeInput($row['company_logo']); // Company logo @@ -55,7 +55,7 @@ if (isset($_POST['edit_company'])) { if (isset($_GET['remove_company_logo'])) { $sql = mysqli_query($mysqli,"SELECT company_logo FROM companies"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_logo = $row['company_logo']; // FileSystem Operation Logo is already sanitized unlink("../uploads/settings/$company_logo"); diff --git a/admin/post/settings_online_payment_clients.php b/admin/post/settings_online_payment_clients.php index a77a3b61..4350b07a 100644 --- a/admin/post/settings_online_payment_clients.php +++ b/admin/post/settings_online_payment_clients.php @@ -3,7 +3,7 @@ defined('FROM_POST_HANDLER') || die("Direct file access is not allowed"); if (isset($_GET['stripe_remove_pm'])) { - + validateCSRFToken($_GET['csrf_token']); if (!$config_stripe_enable) { @@ -34,21 +34,21 @@ if (isset($_GET['stripe_remove_pm'])) { // Remove Auto Pay on recurring invoices that are stripe $sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id"); - while ($row = mysqli_fetch_array($sql_recurring_invoices)) { + while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) { $recurring_invoice_id = intval($row['recurring_invoice_id']); mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id"); } logAction("Stripe", "Update", "$session_name deleted saved Stripe payment method (PM: $payment_method)", $client_id); - + flash_alert("Payment method removed", 'error'); - + redirect(); } if (isset($_GET['stripe_reset_customer'])) { - + validateCSRFToken($_GET['csrf_token']); $client_id = intval($_GET['client_id']); @@ -59,7 +59,7 @@ if (isset($_GET['stripe_reset_customer'])) { // Remove Auto Pay on recurring invoices that are stripe $sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id FROM recurring_invoices WHERE recurring_invoice_client_id = $client_id"); - while ($row = mysqli_fetch_array($sql_recurring_invoices)) { + while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) { $recurring_invoice_id = intval($row['recurring_invoice_id']); mysqli_query($mysqli, "DELETE FROM recurring_payments WHERE recurring_payment_method = 'Stripe' AND recurring_payment_recurring_invoice_id = $recurring_invoice_id"); } @@ -67,7 +67,7 @@ if (isset($_GET['stripe_reset_customer'])) { logAction("Stripe", "Delete", "$session_name reset Stripe settings for client", $client_id); flash_alert("Reset client Stripe settings", 'error'); - + redirect(); } diff --git a/admin/post/software_template.php b/admin/post/software_template.php index 9cc86371..1ef95894 100644 --- a/admin/post/software_template.php +++ b/admin/post/software_template.php @@ -51,7 +51,7 @@ if (isset($_GET['delete_software_template'])) { // Get Software Template Name for logging and alert message $sql = mysqli_query($mysqli,"SELECT software_template_name FROM software_templates WHERE software_template_id = $software_template_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $software_template_name = sanitizeInput($row['software_template_name']); mysqli_query($mysqli,"DELETE FROM software_templates WHERE software_template_id = $software_template_id"); diff --git a/admin/post/update.php b/admin/post/update.php index b618bc4a..37ef8021 100644 --- a/admin/post/update.php +++ b/admin/post/update.php @@ -21,7 +21,7 @@ if (isset($_GET['update'])) { if ($config_telemetry > 0 OR $config_telemetry = 2) { $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $website = sanitizeInput($row['company_website']); diff --git a/admin/post/users.php b/admin/post/users.php index 2217a22b..3c77c1ff 100644 --- a/admin/post/users.php +++ b/admin/post/users.php @@ -53,7 +53,7 @@ if (isset($_POST['add_user'])) { mysqli_query($mysqli, "INSERT INTO user_settings SET user_id = $user_id, user_config_force_mfa = $force_mfa"); $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); // Sanitize Config vars from load_global_settings.php @@ -118,7 +118,7 @@ if (isset($_POST['edit_user'])) { // Get current Avatar $sql = mysqli_query($mysqli, "SELECT user_avatar FROM users WHERE user_id = $user_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $existing_file_name = sanitizeInput($row['user_avatar']); $extended_log_description = ''; @@ -148,7 +148,7 @@ if (isset($_POST['edit_user'])) { // Set Avatar mysqli_query($mysqli, "UPDATE users SET user_avatar = '$new_file_name' WHERE user_id = $user_id"); $extended_alert_description = '. File successfully uploaded.'; - + } } @@ -353,8 +353,8 @@ if (isset($_POST['ir_reset_user_password'])) { // Confirm logged-in user password, for security $admin_password = $_POST['admin_password']; $sql = mysqli_query($mysqli, "SELECT * FROM users WHERE user_id = $session_user_id"); - $userRow = mysqli_fetch_array($sql); - + $userRow = mysqli_fetch_assoc($sql); + if (!password_verify($admin_password, $userRow['user_password'])) { flash_alert("Incorrect password.", 'error'); redirect(); @@ -364,7 +364,7 @@ if (isset($_POST['ir_reset_user_password'])) { $sql_users = mysqli_query($mysqli, "SELECT * FROM users WHERE (user_archived_at IS NULL AND user_id != $session_user_id)"); // Reset passwords - while ($row = mysqli_fetch_array($sql_users)) { + while ($row = mysqli_fetch_assoc($sql_users)) { $user_id = intval($row['user_id']); $user_email = sanitizeInput($row['user_email']); $new_password = randomString(); diff --git a/admin/project_template.php b/admin/project_template.php index 999a7075..f0131d27 100644 --- a/admin/project_template.php +++ b/admin/project_template.php @@ -61,7 +61,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/admin/project_template_details.php b/admin/project_template_details.php index 57cf2c20..6039d8f4 100644 --- a/admin/project_template_details.php +++ b/admin/project_template_details.php @@ -19,7 +19,7 @@ if (isset($_GET['project_template_id'])) { exit; } - $row = mysqli_fetch_array($sql_project_templates); + $row = mysqli_fetch_assoc($sql_project_templates); $project_template_name = nullable_htmlentities($row['project_template_name']); $project_template_description = nullable_htmlentities($row['project_template_description']); @@ -143,7 +143,7 @@ if (isset($_GET['project_template_id'])) { Project Task Templates diff --git a/admin/roles.php b/admin/roles.php index 2d937240..7661a7d5 100644 --- a/admin/roles.php +++ b/admin/roles.php @@ -65,7 +65,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -118,4 +118,3 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); require_once "custom_field_create_modal.php"; require_once "../includes/footer.php"; - diff --git a/admin/settings_default.php b/admin/settings_default.php index 9348925f..4b7b942c 100644 --- a/admin/settings_default.php +++ b/admin/settings_default.php @@ -42,7 +42,7 @@ require_once "includes/inc_all_admin.php";
- 5 ) { ?> class="ajax-modal" data-modal-url="modals/ticket_status/ticket_status_edit.php?id=" diff --git a/admin/ticket_template.php b/admin/ticket_template.php index b1b214e9..44ba4c9d 100644 --- a/admin/ticket_template.php +++ b/admin/ticket_template.php @@ -8,14 +8,14 @@ require_once "includes/inc_all_admin.php"; $sql = mysqli_query( $mysqli, - "SELECT SQL_CALC_FOUND_ROWS *, + "SELECT SQL_CALC_FOUND_ROWS *, COUNT(task_template_id) AS task_count FROM ticket_templates LEFT JOIN task_templates ON task_template_ticket_template_id = ticket_template_id WHERE (ticket_template_name LIKE '%$q%' OR ticket_template_description LIKE '%$q%') AND ticket_template_archived_at IS NULL GROUP BY ticket_template_id - ORDER BY $sort $order + ORDER BY $sort $order LIMIT $record_from, $record_to" ); @@ -69,7 +69,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Never logged in"; } else { - $row = mysqli_fetch_array($sql_last_login); + $row = mysqli_fetch_assoc($sql_last_login); $log_created_at = nullable_htmlentities($row['log_created_at']); $log_ip = nullable_htmlentities($row['log_ip']); $log_user_agent = nullable_htmlentities($row['log_user_agent']); diff --git a/admin/vendor_template.php b/admin/vendor_template.php index b201d0df..168b3b12 100644 --- a/admin/vendor_template.php +++ b/admin/vendor_template.php @@ -64,7 +64,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); DATE_SUB(NOW(), INTERVAL 2 MINUTE)"); - while ($row = mysqli_fetch_array($query)) { + while ($row = mysqli_fetch_assoc($query)) { $users[] = $row['user_name']; } @@ -198,18 +198,18 @@ if (isset($_GET['share_generate_link'])) { $item_key = randomString(32); if ($item_type == "Document") { - $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT document_name FROM documents WHERE document_id = $item_id AND document_client_id = $client_id LIMIT 1")); $item_name = sanitizeInput($row['document_name']); } if ($item_type == "File") { - $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_id AND file_client_id = $client_id LIMIT 1")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT file_name FROM files WHERE file_id = $item_id AND file_client_id = $client_id LIMIT 1")); $item_name = sanitizeInput($row['file_name']); } if ($item_type == "Credential") { $credential = mysqli_query($mysqli, "SELECT credential_name, credential_username, credential_password FROM credentials WHERE credential_id = $item_id AND credential_client_id = $client_id LIMIT 1"); - $row = mysqli_fetch_array($credential); + $row = mysqli_fetch_assoc($credential); $item_name = sanitizeInput($row['credential_name']); @@ -240,7 +240,7 @@ if (isset($_GET['share_generate_link'])) { } $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -298,7 +298,7 @@ if (isset($_GET['get_active_clients'])) { ORDER BY client_accessed_at DESC" ); - while ($row = mysqli_fetch_array($client_sql)) { + while ($row = mysqli_fetch_assoc($client_sql)) { $response['clients'][] = $row; } @@ -322,7 +322,7 @@ if (isset($_GET['get_client_contacts'])) { ORDER BY contact_primary DESC, contact_technical DESC, contact_important DESC, contact_name" ); - while ($row = mysqli_fetch_array($contact_sql)) { + while ($row = mysqli_fetch_assoc($contact_sql)) { $response['contacts'][] = $row; } @@ -347,7 +347,7 @@ if (isset($_GET['get_client_assets'])) { ORDER BY asset_important DESC, asset_name" ); - while ($row = mysqli_fetch_array($asset_sql)) { + while ($row = mysqli_fetch_assoc($asset_sql)) { $response['assets'][] = $row; } @@ -371,7 +371,7 @@ if (isset($_GET['get_client_locations'])) { ORDER BY location_primary DESC, location_name ASC" ); - while ($row = mysqli_fetch_array($locations_sql)) { + while ($row = mysqli_fetch_assoc($locations_sql)) { $response['locations'][] = $row; } @@ -395,7 +395,7 @@ if (isset($_GET['get_client_vendors'])) { ORDER BY vendor_name ASC" ); - while ($row = mysqli_fetch_array($vendors_sql)) { + while ($row = mysqli_fetch_assoc($vendors_sql)) { $response['vendors'][] = $row; } @@ -502,7 +502,7 @@ if (isset($_POST['update_kanban_ticket'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($ticket_sql); + $row = mysqli_fetch_assoc($ticket_sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -521,7 +521,7 @@ if (isset($_POST['update_kanban_ticket'])) { // Get Company Info $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -550,7 +550,7 @@ if (isset($_POST['update_kanban_ticket'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -691,7 +691,7 @@ if (isset($_GET['client_duplicate_check'])) { ); if (mysqli_num_rows($sql_clients) > 0) { - while ($row = mysqli_fetch_array($sql_clients)) { + while ($row = mysqli_fetch_assoc($sql_clients)) { $response['message'] = " Potential duplicate: " . nullable_htmlentities($row['client_name']) . " already exists."; } } @@ -713,7 +713,7 @@ if (isset($_GET['contact_email_check'])) { // 1. Duplicate check $sql_contacts = mysqli_query($mysqli, "SELECT contact_email FROM contacts WHERE contact_email = '$email' LIMIT 1"); if (mysqli_num_rows($sql_contacts) > 0) { - while ($row = mysqli_fetch_array($sql_contacts)) { + while ($row = mysqli_fetch_assoc($sql_contacts)) { $response['message'] = " Potential duplicate: " . nullable_htmlentities($row['contact_email']) . " already exists."; } } @@ -734,7 +734,7 @@ if (isset($_GET['ai_reword'])) { $sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $model_name = $row['ai_model_name']; $promptText = $row['ai_model_prompt']; $url = $row['ai_provider_api_url']; @@ -805,7 +805,7 @@ if (isset($_GET['ai_create_document_template'])) { $sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $model_name = $row['ai_model_name']; $url = $row['ai_provider_api_url']; $key = $row['ai_provider_api_key']; @@ -861,7 +861,7 @@ if (isset($_GET['ai_ticket_summary'])) { $sql = mysqli_query($mysqli, "SELECT * FROM ai_models LEFT JOIN ai_providers ON ai_model_ai_provider_id = ai_provider_id WHERE ai_model_use_case = 'General' LIMIT 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $model_name = $row['ai_model_name']; $url = $row['ai_provider_api_url']; $key = $row['ai_provider_api_key']; diff --git a/agent/asset_details.php b/agent/asset_details.php index f5d8deeb..14085ed4 100644 --- a/agent/asset_details.php +++ b/agent/asset_details.php @@ -29,7 +29,7 @@ if (isset($_GET['asset_id'])) { } else { - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); $asset_id = intval($row['asset_id']); @@ -122,7 +122,7 @@ if (isset($_GET['asset_id'])) { $asset_tag_name_display_array = array(); $asset_tag_id_array = array(); $sql_asset_tags = mysqli_query($mysqli, "SELECT * FROM asset_tags LEFT JOIN tags ON asset_tag_tag_id = tag_id WHERE asset_tag_asset_id = $asset_id ORDER BY tag_name ASC"); - while ($row = mysqli_fetch_array($sql_asset_tags)) { + while ($row = mysqli_fetch_assoc($sql_asset_tags)) { $asset_tag_id = intval($row['tag_id']); $asset_tag_name = nullable_htmlentities($row['tag_name']); @@ -517,7 +517,7 @@ if (isset($_GET['asset_id'])) { - + @@ -275,7 +275,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -303,7 +303,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); GROUP BY tag_id HAVING COUNT(asset_tag_asset_id) > 0 OR tag_id IN ($tag_filter) "); - while ($row = mysqli_fetch_array($sql_tags_filter)) { + while ($row = mysqli_fetch_assoc($sql_tags_filter)) { $tag_id = intval($row['tag_id']); $tag_name = nullable_htmlentities($row['tag_name']); ?> @@ -524,7 +524,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- +
@@ -37,11 +37,11 @@ if (isset($_GET['calendar_id'])) {
- +
- +
@@ -85,7 +85,7 @@ require_once "modals/calendar/calendar_event_add.php"; //loop through IDs and create a modal for each $sql = mysqli_query($mysqli, "SELECT * FROM calendar_events LEFT JOIN calendars ON event_calendar_id = calendar_id $client_event_query"); -while ($row = mysqli_fetch_array($sql)) { +while ($row = mysqli_fetch_assoc($sql)) { $event_id = intval($row['event_id']); $event_title = nullable_htmlentities($row['event_title']); $event_description = nullable_htmlentities($row['event_description']); @@ -166,7 +166,7 @@ while ($row = mysqli_fetch_array($sql)) { events: [ firstDay: , diff --git a/agent/certificates.php b/agent/certificates.php index dbf25a4d..408ad3c0 100644 --- a/agent/certificates.php +++ b/agent/certificates.php @@ -111,7 +111,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -194,7 +194,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
0 OR tags.tag_id IN ($tag_filter) "); - while ($row = mysqli_fetch_array($sql_tags_filter)) { + while ($row = mysqli_fetch_assoc($sql_tags_filter)) { $tag_id = intval($row['tag_id']); $tag_name = nullable_htmlentities($row['tag_name']); ?> @@ -169,7 +169,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); AND ( EXISTS (SELECT 1 FROM contacts WHERE contact_location_id = location_id AND $archive_query) OR location_id = $location_filter) ORDER BY location_name ASC "); - while ($row = mysqli_fetch_array($sql_locations_filter)) { + while ($row = mysqli_fetch_assoc($sql_locations_filter)) { $location_id = intval($row['location_id']); $location_name = nullable_htmlentities($row['location_name']); ?> @@ -196,7 +196,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -327,7 +327,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); 0 OR tags.tag_id IN ($tag_filter) "); - while ($row = mysqli_fetch_array($sql_tags_filter)) { + while ($row = mysqli_fetch_assoc($sql_tags_filter)) { $tag_id = intval($row['tag_id']); $tag_name = nullable_htmlentities($row['tag_name']); ?> @@ -180,7 +180,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -207,7 +207,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -301,7 +301,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); 0) { - $row = mysqli_fetch_array($sql_shared); + $row = mysqli_fetch_assoc($sql_shared); $item_id = intval($row['item_id']); $item_active = nullable_htmlentities($row['item_active']); $item_key = nullable_htmlentities($row['item_key']); diff --git a/agent/dashboard.php b/agent/dashboard.php index 9a8da89c..49f317cd 100644 --- a/agent/dashboard.php +++ b/agent/dashboard.php @@ -17,7 +17,7 @@ if (isset($_GET['enable_technical'])) { // Fetch User Dashboard Settings $sql_user_dashboard_settings = mysqli_query($mysqli, "SELECT * FROM user_settings WHERE user_id = $session_user_id"); -$row = mysqli_fetch_array($sql_user_dashboard_settings); +$row = mysqli_fetch_assoc($sql_user_dashboard_settings); $user_config_dashboard_financial_enable = intval($row['user_config_dashboard_financial_enable']); $user_config_dashboard_technical_enable = intval($row['user_config_dashboard_technical_enable']); @@ -52,7 +52,7 @@ $sql_years_select = mysqli_query($mysqli, "
- - - - @@ -795,11 +795,11 @@ if ($user_config_dashboard_technical_enable == 1) { 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month"); - $row = mysqli_fetch_array($sql_revenues); + $row = mysqli_fetch_assoc($sql_revenues); $revenues_for_month = floatval($row['revenue_amount_for_month']); $income_for_month = $payments_for_month + $revenues_for_month; @@ -825,11 +825,11 @@ if ($user_config_dashboard_technical_enable == 1) { 0 AND YEAR(revenue_date) = $year-1 AND MONTH(revenue_date) = $month"); - $row = mysqli_fetch_array($sql_revenues); + $row = mysqli_fetch_assoc($sql_revenues); $revenues_for_month = floatval($row['revenue_amount_for_month']); $income_for_month = $payments_for_month + $revenues_for_month; @@ -856,7 +856,7 @@ if ($user_config_dashboard_technical_enable == 1) { $largest_invoice_month = 0; for ($month = 1; $month <= 12; $month++) { $sql_projected = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amount_for_month FROM invoices WHERE YEAR(invoice_due) = $year AND MONTH(invoice_due) = $month AND invoice_status != 'Cancelled' AND invoice_status != 'Draft' AND invoice_status != 'Non-Billable'"); - $row = mysqli_fetch_array($sql_projected); + $row = mysqli_fetch_assoc($sql_projected); $invoice_for_month = floatval($row['invoice_amount_for_month']); if ($invoice_for_month > 0 && $invoice_for_month > $largest_invoice_month) { @@ -882,7 +882,7 @@ if ($user_config_dashboard_technical_enable == 1) { $largest_expense_month = 0; for ($month = 1; $month <= 12; $month++) { $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS expense_amount_for_month FROM expenses WHERE YEAR(expense_date) = $year AND MONTH(expense_date) = $month AND expense_vendor_id > 0"); - $row = mysqli_fetch_array($sql_expenses); + $row = mysqli_fetch_assoc($sql_expenses); $expenses_for_month = floatval($row['expense_amount_for_month']); if ($expenses_for_month > 0 && $expenses_for_month > $largest_expense_month) { @@ -944,7 +944,7 @@ if ($user_config_dashboard_technical_enable == 1) { $largest_trip_miles_month = 0; for ($month = 1; $month <= 12; $month++) { $sql_trips = mysqli_query($mysqli, "SELECT SUM(trip_miles) AS trip_miles_for_month FROM trips WHERE YEAR(trip_date) = $year AND MONTH(trip_date) = $month"); - $row = mysqli_fetch_array($sql_trips); + $row = mysqli_fetch_assoc($sql_trips); $trip_miles_for_month = floatval($row['trip_miles_for_month']); if ($trip_miles_for_month > 0 && $trip_miles_for_month > $largest_trip_miles_month) { @@ -991,13 +991,13 @@ if ($user_config_dashboard_technical_enable == 1) { 0) { echo "'Others',"; @@ -1008,7 +1008,7 @@ if ($user_config_dashboard_technical_enable == 1) { data: [ 0 AND YEAR(expense_date) = $year GROUP BY category_name, category_id ORDER BY total_expense DESC LIMIT 5"); $sql_categories = mysqli_query($mysqli, "SELECT category_name FROM TopExpenseCategories"); - while ($row = mysqli_fetch_array($sql_categories)) { + while ($row = mysqli_fetch_assoc($sql_categories)) { $category_name = json_encode($row['category_name']); echo "$category_name,"; } $sql_other_categories = mysqli_query($mysqli, "SELECT SUM(expenses.expense_amount) AS other_expense FROM categories LEFT JOIN TopExpenseCategories ON categories.category_id = TopExpenseCategories.category_id INNER JOIN expenses ON categories.category_id = expenses.expense_category_id WHERE TopExpenseCategories.category_id IS NULL AND expense_vendor_id > 0 AND YEAR(expense_date) = $year"); - $row = mysqli_fetch_array($sql_other_categories); + $row = mysqli_fetch_assoc($sql_other_categories); $other_expense = floatval($row['other_expense']); if ($other_expense > 0) { echo "'Others',"; @@ -1073,7 +1073,7 @@ if ($user_config_dashboard_technical_enable == 1) { data: [ 0) { echo "'Others',"; @@ -1138,7 +1138,7 @@ if ($user_config_dashboard_technical_enable == 1) { data: [ @@ -230,7 +230,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -165,7 +165,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -185,7 +185,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -251,7 +251,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); 0) { global $mysqli, $get_folder_id, $session_user_role; $sql_folders = mysqli_query($mysqli, "SELECT * FROM folders WHERE parent_folder = $parent_folder_id AND folder_location = 1 AND folder_client_id = $client_id ORDER BY folder_name ASC"); - while ($row = mysqli_fetch_array($sql_folders)) { + while ($row = mysqli_fetch_assoc($sql_folders)) { $folder_id = intval($row['folder_id']); $folder_name = nullable_htmlentities($row['folder_name']); @@ -309,7 +309,7 @@ while ($folder_id > 0) { 0) { 0) { ); $file_shared = (mysqli_num_rows($sql_shared) > 0) ? true : false; if ($file_shared) { - $row = mysqli_fetch_array($sql_shared); + $row = mysqli_fetch_assoc($sql_shared); $item_id = intval($row['item_id']); $item_active = nullable_htmlentities($row['item_active']); $item_key = nullable_htmlentities($row['item_key']); diff --git a/agent/global_search.php b/agent/global_search.php index 8a3f0f42..08ef0bb7 100644 --- a/agent/global_search.php +++ b/agent/global_search.php @@ -28,7 +28,7 @@ if (isset($_GET['query'])) { ORDER BY client_id DESC LIMIT 5" ); - $sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts + $sql_contacts = mysqli_query($mysqli, "SELECT * FROM contacts LEFT JOIN clients ON client_id = contact_client_id WHERE contact_archived_at IS NULL AND (contact_name LIKE '%$query%' @@ -179,7 +179,7 @@ if (isset($_GET['query'])) { @@ -411,7 +411,7 @@ if (isset($_GET['query'])) { - +

@@ -195,13 +195,13 @@ - + 0) { - while ($row = mysqli_fetch_array($products_sql)) { + while ($row = mysqli_fetch_assoc($products_sql)) { $products[] = $row; } $json_products = json_encode($products); @@ -394,7 +394,7 @@ if (isset($_GET['invoice_id'])) { $total_tax = 0.00; $sub_total = 0.00; - while ($row = mysqli_fetch_array($sql_invoice_items)) { + while ($row = mysqli_fetch_assoc($sql_invoice_items)) { $item_id = intval($row['item_id']); $item_name = nullable_htmlentities($row['item_name']); $item_description = nullable_htmlentities($row['item_description']); @@ -467,7 +467,7 @@ if (isset($_GET['invoice_id'])) { @@ -313,7 +313,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); 0 OR tags.tag_id IN ($tag_filter) "); - while ($row = mysqli_fetch_array($sql_tags_filter)) { + while ($row = mysqli_fetch_assoc($sql_tags_filter)) { $tag_id = intval($row['tag_id']); $tag_name = nullable_htmlentities($row['tag_name']); ?> @@ -157,7 +157,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -258,7 +258,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); " required> - +
- + @@ -406,7 +406,7 @@ ob_start(); - + $network_name" + $network_name_display = $network_name + ? "$network_name" : '-'; // Connected interface details @@ -482,7 +482,7 @@ ob_start(); - + diff --git a/agent/modals/asset/asset_documents.php b/agent/modals/asset/asset_documents.php index 42303534..8ec33df9 100644 --- a/agent/modals/asset/asset_documents.php +++ b/agent/modals/asset/asset_documents.php @@ -10,7 +10,7 @@ - Select Client - @@ -127,7 +127,7 @@ ob_start(); - +
@@ -166,7 +166,7 @@ ob_start(); @@ -235,7 +235,7 @@ ob_start();
- +
@@ -286,7 +286,7 @@ ob_start();
- + @@ -896,7 +896,7 @@ ob_start(); More Details - Edit diff --git a/agent/modals/contact/contact_edit.php b/agent/modals/contact/contact_edit.php index d258ace5..18ad5e0a 100644 --- a/agent/modals/contact/contact_edit.php +++ b/agent/modals/contact/contact_edit.php @@ -10,7 +10,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1" ); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $client_id = intval($row['contact_client_id']); $contact_name = nullable_htmlentities($row['contact_name']); $contact_title = nullable_htmlentities($row['contact_title']); @@ -38,7 +38,7 @@ $contact_user_id = intval($row['contact_user_id']); // Tags $contact_tag_id_array = array(); $sql_contact_tags = mysqli_query($mysqli, "SELECT tag_id FROM contact_tags WHERE contact_id = $contact_id"); -while ($row = mysqli_fetch_array($sql_contact_tags)) { +while ($row = mysqli_fetch_assoc($sql_contact_tags)) { $contact_tag_id = intval($row['tag_id']); $contact_tag_id_array[] = $contact_tag_id; } @@ -133,7 +133,7 @@ ob_start(); - +
@@ -169,7 +169,7 @@ ob_start(); @@ -377,4 +377,3 @@ $(document).ready(function() { require_once '../../../includes/modal_footer.php'; ?> - diff --git a/agent/modals/contact/contact_link_asset.php b/agent/modals/contact/contact_link_asset.php index 1db6dbe8..0443126e 100644 --- a/agent/modals/contact/contact_link_asset.php +++ b/agent/modals/contact/contact_link_asset.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -44,7 +44,7 @@ ob_start(); AND asset_archived_at IS NULL ORDER BY asset_name ASC "); - while ($row = mysqli_fetch_array($sql_assets_select)) { + while ($row = mysqli_fetch_assoc($sql_assets_select)) { $asset_id = intval($row['asset_id']); $asset_name = nullable_htmlentities($row['asset_name']); ?> diff --git a/agent/modals/contact/contact_link_credential.php b/agent/modals/contact/contact_link_credential.php index a4a8a4d4..5fffa77c 100644 --- a/agent/modals/contact/contact_link_credential.php +++ b/agent/modals/contact/contact_link_credential.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -44,7 +44,7 @@ ob_start(); AND credential_archived_at IS NULL ORDER BY credential_name ASC "); - while ($row = mysqli_fetch_array($sql_credentials_select)) { + while ($row = mysqli_fetch_assoc($sql_credentials_select)) { $credential_id = intval($row['credential_id']); $credential_name = nullable_htmlentities($row['credential_name']); ?> diff --git a/agent/modals/contact/contact_link_document.php b/agent/modals/contact/contact_link_document.php index ac5f54c7..946f8ecb 100644 --- a/agent/modals/contact/contact_link_document.php +++ b/agent/modals/contact/contact_link_document.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -47,7 +47,7 @@ ob_start(); AND contact_documents.contact_id IS NULL ORDER BY documents.document_name ASC "); - while ($row = mysqli_fetch_array($sql_documents_select)) { + while ($row = mysqli_fetch_assoc($sql_documents_select)) { $document_id = intval($row['document_id']); $document_name = nullable_htmlentities($row['document_name']); ?> diff --git a/agent/modals/contact/contact_link_file.php b/agent/modals/contact/contact_link_file.php index 2cb882c2..a12d2e3a 100644 --- a/agent/modals/contact/contact_link_file.php +++ b/agent/modals/contact/contact_link_file.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -49,7 +49,7 @@ ob_start(); ORDER BY folders.folder_name ASC, files.file_name ASC "); - while ($row = mysqli_fetch_array($sql_files_select)) { + while ($row = mysqli_fetch_assoc($sql_files_select)) { $file_id = intval($row['file_id']); $file_name = nullable_htmlentities($row['file_name']); $folder_name = nullable_htmlentities($row['folder_name']); diff --git a/agent/modals/contact/contact_link_service.php b/agent/modals/contact/contact_link_service.php index 124dd53e..e8d8e447 100644 --- a/agent/modals/contact/contact_link_service.php +++ b/agent/modals/contact/contact_link_service.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -46,7 +46,7 @@ ob_start(); AND service_contacts.contact_id IS NULL ORDER BY services.service_name ASC "); - while ($row = mysqli_fetch_array($sql_services_select)) { + while ($row = mysqli_fetch_assoc($sql_services_select)) { $service_id = intval($row['service_id']); $service_name = nullable_htmlentities($row['service_name']); ?> diff --git a/agent/modals/contact/contact_link_software.php b/agent/modals/contact/contact_link_software.php index c08ef77e..f53cac9f 100644 --- a/agent/modals/contact/contact_link_software.php +++ b/agent/modals/contact/contact_link_software.php @@ -9,7 +9,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM contacts LIMIT 1 "); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -48,7 +48,7 @@ ob_start(); AND software_contacts.contact_id IS NULL ORDER BY software.software_name ASC "); - while ($row = mysqli_fetch_array($sql_software_select)) { + while ($row = mysqli_fetch_assoc($sql_software_select)) { $software_id = intval($row['software_id']); $software_name = nullable_htmlentities($row['software_name']); ?> diff --git a/agent/modals/contact/contact_note_add.php b/agent/modals/contact/contact_note_add.php index 1b38d210..fefaf7df 100644 --- a/agent/modals/contact/contact_note_add.php +++ b/agent/modals/contact/contact_note_add.php @@ -5,7 +5,7 @@ require_once '../../../includes/modal_header.php'; $contact_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT contact_name FROM contacts WHERE contact_id = $contact_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $contact_name = nullable_htmlentities($row['contact_name']); // Generate the HTML form content using output buffering. diff --git a/agent/modals/credential/credential_add.php b/agent/modals/credential/credential_add.php index 3392bdf5..9815ba0f 100644 --- a/agent/modals/credential/credential_add.php +++ b/agent/modals/credential/credential_add.php @@ -16,7 +16,7 @@ ob_start();
- +
- @@ -135,7 +135,7 @@ ob_start(); @@ -169,7 +169,7 @@ ob_start(); diff --git a/agent/modals/expense/expense_bulk_edit_account.php b/agent/modals/expense/expense_bulk_edit_account.php index ca85880c..642ccaba 100644 --- a/agent/modals/expense/expense_bulk_edit_account.php +++ b/agent/modals/expense/expense_bulk_edit_account.php @@ -32,21 +32,21 @@ ob_start(); diff --git a/agent/modals/expense/expense_bulk_edit_client.php b/agent/modals/expense/expense_bulk_edit_client.php index 53578782..b65ff79d 100644 --- a/agent/modals/expense/expense_bulk_edit_client.php +++ b/agent/modals/expense/expense_bulk_edit_client.php @@ -37,7 +37,7 @@ ob_start(); diff --git a/agent/modals/expense/expense_copy.php b/agent/modals/expense/expense_copy.php index 099251df..cff64d16 100644 --- a/agent/modals/expense/expense_copy.php +++ b/agent/modals/expense/expense_copy.php @@ -6,7 +6,7 @@ $expense_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $expense_date = nullable_htmlentities($row['expense_date']); $expense_amount = floatval($row['expense_amount']); $expense_currency_code = nullable_htmlentities($row['expense_currency_code']); @@ -68,21 +68,21 @@ ob_start(); @@ -148,7 +148,7 @@ ob_start(); @@ -176,7 +176,7 @@ ob_start(); diff --git a/agent/modals/expense/expense_edit.php b/agent/modals/expense/expense_edit.php index 1fb3aeac..7d980cae 100644 --- a/agent/modals/expense/expense_edit.php +++ b/agent/modals/expense/expense_edit.php @@ -10,7 +10,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1" ); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $expense_date = nullable_htmlentities($row['expense_date']); $expense_amount = floatval($row['expense_amount']); $expense_currency_code = nullable_htmlentities($row['expense_currency_code']); @@ -76,7 +76,7 @@ ob_start(); '$expense_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC"); - while ($row = mysqli_fetch_array($sql_accounts)) { + while ($row = mysqli_fetch_assoc($sql_accounts)) { $account_id_select = intval($row['account_id']); $account_name_select = nullable_htmlentities($row['account_name']); $opening_balance = floatval($row['opening_balance']); @@ -88,15 +88,15 @@ ob_start(); } $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_payments); + $row = mysqli_fetch_assoc($sql_payments); $total_payments = floatval($row['total_payments']); $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_revenues); + $row = mysqli_fetch_assoc($sql_revenues); $total_revenues = floatval($row['total_revenues']); $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_expenses); + $row = mysqli_fetch_assoc($sql_expenses); $total_expenses = floatval($row['total_expenses']); $balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; @@ -121,7 +121,7 @@ ob_start(); '$expense_created_at' OR vendor_archived_at IS NULL) ORDER BY vendor_name ASC"); - while ($row = mysqli_fetch_array($sql_select)) { + while ($row = mysqli_fetch_assoc($sql_select)) { $vendor_id_select = intval($row['vendor_id']); $vendor_name_select = nullable_htmlentities($row['vendor_name']); ?> @@ -166,7 +166,7 @@ ob_start(); '$expense_created_at' OR category_archived_at IS NULL) ORDER BY category_name ASC"); - while ($row = mysqli_fetch_array($sql_select)) { + while ($row = mysqli_fetch_assoc($sql_select)) { $category_id_select = intval($row['category_id']); $category_name_select = nullable_htmlentities($row['category_name']); ?> @@ -200,7 +200,7 @@ ob_start(); diff --git a/agent/modals/expense/expense_export.php b/agent/modals/expense/expense_export.php index ce9bb705..e932f517 100644 --- a/agent/modals/expense/expense_export.php +++ b/agent/modals/expense/expense_export.php @@ -27,7 +27,7 @@ ob_start(); @@ -51,7 +51,7 @@ ob_start(); @@ -75,7 +75,7 @@ ob_start(); diff --git a/agent/modals/expense/expense_refund.php b/agent/modals/expense/expense_refund.php index ee8677d0..f1c4e6b5 100644 --- a/agent/modals/expense/expense_refund.php +++ b/agent/modals/expense/expense_refund.php @@ -6,7 +6,7 @@ $expense_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM expenses WHERE expense_id = $expense_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $expense_date = nullable_htmlentities($row['expense_date']); $expense_amount = floatval($row['expense_amount']); $expense_currency_code = nullable_htmlentities($row['expense_currency_code']); diff --git a/agent/modals/file/file_link_asset.php b/agent/modals/file/file_link_asset.php index 2483a207..75d825b9 100644 --- a/agent/modals/file/file_link_asset.php +++ b/agent/modals/file/file_link_asset.php @@ -21,11 +21,11 @@ @@ -68,7 +68,7 @@ ob_start(); diff --git a/agent/modals/invoice/invoice_add_ticket.php b/agent/modals/invoice/invoice_add_ticket.php index 44516543..5d4f93fb 100644 --- a/agent/modals/invoice/invoice_add_ticket.php +++ b/agent/modals/invoice/invoice_add_ticket.php @@ -18,7 +18,7 @@ - "> - + @@ -56,4 +56,3 @@ - diff --git a/agent/modals/invoice/invoice_bulk_edit_category.php b/agent/modals/invoice/invoice_bulk_edit_category.php index 93ab1d5d..edc05142 100644 --- a/agent/modals/invoice/invoice_bulk_edit_category.php +++ b/agent/modals/invoice/invoice_bulk_edit_category.php @@ -33,7 +33,7 @@ ob_start(); diff --git a/agent/modals/invoice/invoice_copy.php b/agent/modals/invoice/invoice_copy.php index 76e938fb..0b286df3 100644 --- a/agent/modals/invoice/invoice_copy.php +++ b/agent/modals/invoice/invoice_copy.php @@ -6,7 +6,7 @@ $invoice_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $invoice_prefix = nullable_htmlentities($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_name = nullable_htmlentities($row['client_name']); @@ -23,7 +23,7 @@ ob_start(); - + - + - +
@@ -90,4 +90,3 @@
- diff --git a/agent/modals/software/software_add.php b/agent/modals/software/software_add.php index 23026366..6199fbb0 100644 --- a/agent/modals/software/software_add.php +++ b/agent/modals/software/software_add.php @@ -57,7 +57,7 @@ ob_start(); @@ -111,7 +111,7 @@ ob_start(); @@ -225,7 +225,7 @@ ob_start(); @@ -54,7 +54,7 @@ ob_start(); - Select Vendor - - @@ -233,7 +233,7 @@ ob_start(); '$software_created_at' OR asset_archived_at IS NULL) AND asset_client_id = $client_id ORDER BY asset_archived_at ASC, asset_name ASC"); - while ($row = mysqli_fetch_array($sql_assets_select)) { + while ($row = mysqli_fetch_assoc($sql_assets_select)) { $asset_id_select = intval($row['asset_id']); $asset_name_select = nullable_htmlentities($row['asset_name']); $asset_type_select = nullable_htmlentities($row['asset_type']); @@ -273,7 +273,7 @@ ob_start(); '$software_created_at' OR contact_archived_at IS NULL) AND contact_client_id = $client_id ORDER BY contact_archived_at ASC, contact_name ASC"); - while ($row = mysqli_fetch_array($sql_contacts_select)) { + while ($row = mysqli_fetch_assoc($sql_contacts_select)) { $contact_id_select = intval($row['contact_id']); $contact_name_select = nullable_htmlentities($row['contact_name']); $contact_email_select = nullable_htmlentities($row['contact_email']); diff --git a/agent/modals/ticket/ticket_add.php b/agent/modals/ticket/ticket_add.php index 3986be59..8e7cebf0 100644 --- a/agent/modals/ticket/ticket_add.php +++ b/agent/modals/ticket/ticket_add.php @@ -60,7 +60,7 @@ ob_start(); @@ -100,7 +100,7 @@ ob_start(); ORDER BY tt.ticket_template_name ASC "); - while ($row = mysqli_fetch_array($sql_ticket_templates)) { + while ($row = mysqli_fetch_assoc($sql_ticket_templates)) { $ticket_template_id_select = intval($row['ticket_template_id']); $ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']); $ticket_template_subject_select = nullable_htmlentities($row['ticket_template_subject']); @@ -160,7 +160,7 @@ ob_start(); @@ -250,7 +250,7 @@ ob_start(); @@ -325,7 +325,7 @@ ob_start(); @@ -401,7 +401,7 @@ ob_start(); @@ -440,7 +440,7 @@ ob_start(); diff --git a/agent/modals/ticket/ticket_add_v2.php b/agent/modals/ticket/ticket_add_v2.php index a7d3961f..6ee2e843 100644 --- a/agent/modals/ticket/ticket_add_v2.php +++ b/agent/modals/ticket/ticket_add_v2.php @@ -71,7 +71,7 @@ ob_start(); ORDER BY tt.ticket_template_name ASC "); - while ($row = mysqli_fetch_array($sql_ticket_templates)) { + while ($row = mysqli_fetch_assoc($sql_ticket_templates)) { $ticket_template_id_select = intval($row['ticket_template_id']); $ticket_template_name_select = nullable_htmlentities($row['ticket_template_name']); $ticket_template_subject_select = nullable_htmlentities($row['ticket_template_subject']); @@ -131,7 +131,7 @@ ob_start(); @@ -166,7 +166,7 @@ ob_start(); "SELECT user_id, user_name FROM users WHERE user_type = 1 AND user_status = 1 AND user_archived_at IS NULL ORDER BY user_name ASC" ); - while ($row = mysqli_fetch_array($sql)) { + while ($row = mysqli_fetch_assoc($sql)) { $user_id = intval($row['user_id']); $user_name = nullable_htmlentities($row['user_name']); ?> @@ -203,7 +203,7 @@ ob_start(); diff --git a/agent/modals/ticket/ticket_add_watcher.php b/agent/modals/ticket/ticket_add_watcher.php index 29b32491..ecfc783b 100644 --- a/agent/modals/ticket/ticket_add_watcher.php +++ b/agent/modals/ticket/ticket_add_watcher.php @@ -29,7 +29,7 @@ ob_start(); '' ORDER BY contact_name ASC"); - while ($row = mysqli_fetch_array($sql_client_contacts_select)) { + while ($row = mysqli_fetch_assoc($sql_client_contacts_select)) { $contact_id_select = intval($row['contact_id']); $contact_name_select = nullable_htmlentities($row['contact_name']); $contact_email_select = nullable_htmlentities($row['contact_email']); diff --git a/agent/modals/ticket/ticket_assign.php b/agent/modals/ticket/ticket_assign.php index 40492fa0..e5663c4e 100644 --- a/agent/modals/ticket/ticket_assign.php +++ b/agent/modals/ticket/ticket_assign.php @@ -10,7 +10,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM tickets LIMIT 1" ); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_assigned_to = intval($row['ticket_assigned_to']); @@ -49,7 +49,7 @@ ob_start(); AND user_archived_at IS NULL ORDER BY user_name ASC" ); - while ($row = mysqli_fetch_array($sql_users_select)) { + while ($row = mysqli_fetch_assoc($sql_users_select)) { $user_id_select = intval($row['user_id']); $user_name_select = nullable_htmlentities($row['user_name']); diff --git a/agent/modals/ticket/ticket_billable.php b/agent/modals/ticket/ticket_billable.php index 2a259aa6..5dd70063 100644 --- a/agent/modals/ticket/ticket_billable.php +++ b/agent/modals/ticket/ticket_billable.php @@ -6,7 +6,7 @@ $ticket_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_billable = intval($row['ticket_billable']); diff --git a/agent/modals/ticket/ticket_bulk_add_project.php b/agent/modals/ticket/ticket_bulk_add_project.php index e2b0c69f..ab4f40fb 100644 --- a/agent/modals/ticket/ticket_bulk_add_project.php +++ b/agent/modals/ticket/ticket_bulk_add_project.php @@ -37,7 +37,7 @@ ob_start(); AND project_completed_at IS NULL ORDER BY project_name DESC" ); - while ($row = mysqli_fetch_array($sql_projects_select)) { + while ($row = mysqli_fetch_assoc($sql_projects_select)) { $project_id_select = intval($row['project_id']); $project_prefix_select = nullable_htmlentities($row['project_prefix']); $project_number_select = intval($row['project_number']); diff --git a/agent/modals/ticket/ticket_bulk_assign.php b/agent/modals/ticket/ticket_bulk_assign.php index 081e29a5..72d0fbe3 100644 --- a/agent/modals/ticket/ticket_bulk_assign.php +++ b/agent/modals/ticket/ticket_bulk_assign.php @@ -38,7 +38,7 @@ ob_start(); AND user_archived_at IS NULL ORDER BY user_name ASC" ); - while ($row = mysqli_fetch_array($sql_users_select)) { + while ($row = mysqli_fetch_assoc($sql_users_select)) { $user_id_select = intval($row['user_id']); $user_name_select = nullable_htmlentities($row['user_name']); diff --git a/agent/modals/ticket/ticket_bulk_edit_category.php b/agent/modals/ticket/ticket_bulk_edit_category.php index 70a2cb8d..9c03d66b 100644 --- a/agent/modals/ticket/ticket_bulk_edit_category.php +++ b/agent/modals/ticket/ticket_bulk_edit_category.php @@ -35,7 +35,7 @@ ob_start(); diff --git a/agent/modals/ticket/ticket_change_client.php b/agent/modals/ticket/ticket_change_client.php index 1d013525..09c12653 100644 --- a/agent/modals/ticket/ticket_change_client.php +++ b/agent/modals/ticket/ticket_change_client.php @@ -5,7 +5,7 @@ $ticket_id = intval($_GET['ticket_id']); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $client_id = intval($row['ticket_client_id']); @@ -36,7 +36,7 @@ ob_start(); - diff --git a/agent/modals/ticket/ticket_edit_schedule.php b/agent/modals/ticket/ticket_edit_schedule.php index 877ac3e9..1a2148bc 100644 --- a/agent/modals/ticket/ticket_edit_schedule.php +++ b/agent/modals/ticket/ticket_edit_schedule.php @@ -10,7 +10,7 @@ $sql = mysqli_query($mysqli, "SELECT * FROM tickets LIMIT 1" ); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_scheduled_for = nullable_htmlentities($row['ticket_schedule']); diff --git a/agent/modals/ticket/ticket_edit_vendor.php b/agent/modals/ticket/ticket_edit_vendor.php index ada9836c..85b048fa 100644 --- a/agent/modals/ticket/ticket_edit_vendor.php +++ b/agent/modals/ticket/ticket_edit_vendor.php @@ -5,7 +5,7 @@ $ticket_id = intval($_GET['ticket_id']); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $vendor_id = intval($row['ticket_vendor_id']); @@ -37,7 +37,7 @@ ob_start(); diff --git a/agent/modals/ticket/ticket_invoice_add.php b/agent/modals/ticket/ticket_invoice_add.php index 4cba203b..f5af09d8 100644 --- a/agent/modals/ticket/ticket_invoice_add.php +++ b/agent/modals/ticket/ticket_invoice_add.php @@ -19,7 +19,7 @@ $ticket_sql = mysqli_query( LIMIT 1" ); -$row = mysqli_fetch_array($ticket_sql); +$row = mysqli_fetch_assoc($ticket_sql); $client_id = intval($row['client_id']); $client_rate = floatval($row['client_rate']); $ticket_prefix = nullable_htmlentities($row['ticket_prefix']); @@ -71,7 +71,7 @@ $location_phone = formatPhoneNumber($row['location_phone']); //Get Total Ticket Time $ticket_total_reply_time = mysqli_query($mysqli, "SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(ticket_reply_time_worked))) AS ticket_total_reply_time FROM ticket_replies WHERE ticket_reply_archived_at IS NULL AND ticket_reply_ticket_id = $ticket_id"); -$row = mysqli_fetch_array($ticket_total_reply_time); +$row = mysqli_fetch_assoc($ticket_total_reply_time); $ticket_total_reply_time = nullable_htmlentities($row['ticket_total_reply_time']); $sql_invoices = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_status LIKE 'Draft' AND invoice_client_id = $client_id ORDER BY invoice_number ASC"); @@ -122,7 +122,7 @@ ob_start(); @@ -299,7 +299,7 @@ ob_start(); - + - diff --git a/agent/modals/transfer/transfer_edit.php b/agent/modals/transfer/transfer_edit.php index 9d4689b7..4305496e 100644 --- a/agent/modals/transfer/transfer_edit.php +++ b/agent/modals/transfer/transfer_edit.php @@ -11,7 +11,7 @@ $sql = mysqli_query($mysqli, "SELECT transfer_created_at, expense_date AS transf LIMIT 1" ); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $transfer_date = nullable_htmlentities($row['transfer_date']); $transfer_account_from = intval($row['transfer_account_from']); $transfer_account_to = intval($row['transfer_account_to']); @@ -73,7 +73,7 @@ ob_start(); '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC"); - while ($row = mysqli_fetch_array($sql_accounts)) { + while ($row = mysqli_fetch_assoc($sql_accounts)) { $account_id_select = intval($row['account_id']); $account_name_select = nullable_htmlentities($row['account_name']); $opening_balance = floatval($row['opening_balance']); @@ -85,15 +85,15 @@ ob_start(); } $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_payments); + $row = mysqli_fetch_assoc($sql_payments); $total_payments = floatval($row['total_payments']); $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_revenues); + $row = mysqli_fetch_assoc($sql_revenues); $total_revenues = floatval($row['total_revenues']); $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id_select"); - $row = mysqli_fetch_array($sql_expenses); + $row = mysqli_fetch_assoc($sql_expenses); $total_expenses = floatval($row['total_expenses']); $balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; @@ -117,7 +117,7 @@ ob_start(); '$transfer_created_at' OR account_archived_at IS NULL) ORDER BY account_archived_at ASC, account_name ASC"); - while ($row = mysqli_fetch_array($sql2)) { + while ($row = mysqli_fetch_assoc($sql2)) { $account_id2 = intval($row['account_id']); $account_name = nullable_htmlentities($row['account_name']); $opening_balance = floatval($row['opening_balance']); @@ -129,15 +129,15 @@ ob_start(); } $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id2"); - $row = mysqli_fetch_array($sql_payments); + $row = mysqli_fetch_assoc($sql_payments); $total_payments = floatval($row['total_payments']); $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS total_revenues FROM revenues WHERE revenue_account_id = $account_id2"); - $row = mysqli_fetch_array($sql_revenues); + $row = mysqli_fetch_assoc($sql_revenues); $total_revenues = floatval($row['total_revenues']); $sql_expenses = mysqli_query($mysqli, "SELECT SUM(expense_amount) AS total_expenses FROM expenses WHERE expense_account_id = $account_id2"); - $row = mysqli_fetch_array($sql_expenses); + $row = mysqli_fetch_assoc($sql_expenses); $total_expenses = floatval($row['total_expenses']); $balance = $opening_balance + $total_payments + $total_revenues - $total_expenses; @@ -167,7 +167,7 @@ ob_start(); diff --git a/agent/modals/trip/trip_add.php b/agent/modals/trip/trip_add.php index 8cd4e84a..4a57ed27 100644 --- a/agent/modals/trip/trip_add.php +++ b/agent/modals/trip/trip_add.php @@ -64,7 +64,7 @@ ob_start(); @@ -125,7 +125,7 @@ ob_start(); diff --git a/agent/modals/trip/trip_copy.php b/agent/modals/trip/trip_copy.php index d8791a1a..19373aa2 100644 --- a/agent/modals/trip/trip_copy.php +++ b/agent/modals/trip/trip_copy.php @@ -6,7 +6,7 @@ $trip_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $trip_date = nullable_htmlentities($row['trip_date']); $trip_purpose = nullable_htmlentities($row['trip_purpose']); $trip_source = nullable_htmlentities($row['trip_source']); @@ -80,7 +80,7 @@ ob_start(); 1 AND user_archived_at IS NULL ORDER BY user_name ASC" ); - while ($row = mysqli_fetch_array($sql_users)) { + while ($row = mysqli_fetch_assoc($sql_users)) { $user_id_select = intval($row['user_id']); $user_name_select = nullable_htmlentities($row['user_name']); ?> @@ -143,7 +143,7 @@ ob_start(); diff --git a/agent/modals/trip/trip_edit.php b/agent/modals/trip/trip_edit.php index 549b47e7..34fbfd20 100644 --- a/agent/modals/trip/trip_edit.php +++ b/agent/modals/trip/trip_edit.php @@ -6,7 +6,7 @@ $trip_id = intval($_GET['id']); $sql = mysqli_query($mysqli, "SELECT * FROM trips WHERE trip_id = $trip_id LIMIT 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $trip_date = nullable_htmlentities($row['trip_date']); $trip_purpose = nullable_htmlentities($row['trip_purpose']); $trip_source = nullable_htmlentities($row['trip_source']); @@ -81,7 +81,7 @@ ob_start(); @@ -145,7 +145,7 @@ ob_start(); '$trip_created_at' OR client_archived_at IS NULL ORDER BY client_archived_at ASC, client_name ASC"); - while ($row = mysqli_fetch_array($sql_clients)) { + while ($row = mysqli_fetch_assoc($sql_clients)) { $client_id_select = intval($row['client_id']); $client_name_select = nullable_htmlentities($row['client_name']); $client_archived_at = nullable_htmlentities($row['client_archived_at']); diff --git a/agent/modals/vendor/vendor_add_from_template.php b/agent/modals/vendor/vendor_add_from_template.php index 27af3dd7..69d51c34 100644 --- a/agent/modals/vendor/vendor_add_from_template.php +++ b/agent/modals/vendor/vendor_add_from_template.php @@ -30,7 +30,7 @@ ob_start(); diff --git a/agent/networks.php b/agent/networks.php index b4c344b5..143bd49e 100644 --- a/agent/networks.php +++ b/agent/networks.php @@ -123,7 +123,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); AND ( EXISTS (SELECT 1 FROM networks WHERE network_location_id = location_id AND $archive_query) OR location_id = $location_filter) ORDER BY location_name ASC "); - while ($row = mysqli_fetch_array($sql_locations_filter)) { + while ($row = mysqli_fetch_assoc($sql_locations_filter)) { $location_id = intval($row['location_id']); $location_name = nullable_htmlentities($row['location_name']); ?> @@ -150,7 +150,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $access_permission_query ORDER BY client_name ASC "); - while ($row = mysqli_fetch_array($sql_clients_filter)) { + while ($row = mysqli_fetch_assoc($sql_clients_filter)) { $client_id = intval($row['client_id']); $client_name = nullable_htmlentities($row['client_name']); ?> @@ -248,7 +248,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- - + +
" id="advancedFilter"> @@ -111,7 +111,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- + diff --git a/agent/payments.php b/agent/payments.php index 8679ff90..551a3c3c 100644 --- a/agent/payments.php +++ b/agent/payments.php @@ -91,7 +91,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -111,7 +111,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -195,7 +195,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); 0) { - while ($row = mysqli_fetch_array($sql_task_templates)) { + while ($row = mysqli_fetch_assoc($sql_task_templates)) { $task_order = intval($row['task_template_order']); $task_name = sanitizeInput($row['task_template_name']); @@ -853,7 +853,7 @@ if (isset($_POST['bulk_edit_client_industry'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); mysqli_query($mysqli,"UPDATE clients SET client_type = '$industry' WHERE client_id = $client_id"); @@ -887,7 +887,7 @@ if (isset($_POST['bulk_edit_client_referral'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); mysqli_query($mysqli,"UPDATE clients SET client_referral = '$referral' WHERE client_id = $client_id"); @@ -921,7 +921,7 @@ if (isset($_POST['bulk_edit_client_hourly_rate'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); mysqli_query($mysqli,"UPDATE clients SET client_rate = '$rate' WHERE client_id = $client_id"); @@ -953,7 +953,7 @@ if (isset($_POST['bulk_assign_client_tags'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); if ($_POST['bulk_remove_tags']) { @@ -1030,7 +1030,7 @@ if (isset($_POST['bulk_send_client_email']) && isset($_POST['client_ids'])) { $data = []; $unique_contacts = []; - while ($row = mysqli_fetch_array($result)) { + while ($row = mysqli_fetch_assoc($result)) { $contact_email = sanitizeInput($row['contact_email']); // Skip if email is missing or invalid @@ -1084,7 +1084,7 @@ if (isset($_POST['bulk_archive_clients'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); mysqli_query($mysqli,"UPDATE clients SET client_archived_at = NOW() WHERE client_id = $client_id"); @@ -1120,7 +1120,7 @@ if (isset($_POST['bulk_unarchive_clients'])) { $client_id = intval($client_id); $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = sanitizeInput($row['client_name']); mysqli_query($mysqli,"UPDATE clients SET client_archived_at = NULL WHERE client_id = $client_id"); @@ -1148,7 +1148,7 @@ if (isset($_POST["export_client_pdf"])) { enforceUserPermission("module_financial", 1); $sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = nullable_htmlentities($row['company_name']); $company_phone_country_code = nullable_htmlentities($row['company_phone_country_code']); $company_phone = nullable_htmlentities(formatPhoneNumber($row['company_phone'], $company_phone_country_code)); @@ -1186,7 +1186,7 @@ if (isset($_POST["export_client_pdf"])) { LEFT JOIN locations ON clients.client_id = locations.location_client_id AND location_primary = 1 WHERE client_id = $client_id "); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); // Immediately sanitize retrieved values $client_name = nullable_htmlentities($row["client_name"]); @@ -1404,7 +1404,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_contacts)) { + while ($row = mysqli_fetch_assoc($sql_contacts)) { $contact_name = nullable_htmlentities(getFallBack($row["contact_name"])); $contact_title = nullable_htmlentities(getFallBack($row["contact_title"])); $contact_department = nullable_htmlentities($row["contact_department"]); @@ -1446,7 +1446,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_locations)) { + while ($row = mysqli_fetch_assoc($sql_locations)) { $location_name = nullable_htmlentities($row["location_name"]); $location_address = nullable_htmlentities($row["location_address"]); $location_city = nullable_htmlentities($row["location_city"]); @@ -1482,7 +1482,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_vendors)) { + while ($row = mysqli_fetch_assoc($sql_vendors)) { $vendor_name = nullable_htmlentities($row["vendor_name"]); $vendor_description = nullable_htmlentities($row["vendor_description"]); $vendor_account_number = nullable_htmlentities($row["vendor_account_number"]); @@ -1520,7 +1520,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_credentials)) { + while ($row = mysqli_fetch_assoc($sql_credentials)) { $credential_name = nullable_htmlentities($row["credential_name"]); $credential_description = getFallback(nullable_htmlentities($row["credential_description"])); $credential_username = nullable_htmlentities(decryptCredentialEntry($row["credential_username"])); @@ -1570,7 +1570,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_workstations)) { + while ($row = mysqli_fetch_assoc($sql_asset_workstations)) { $asset_name = nullable_htmlentities($row["asset_name"]); $asset_type = nullable_htmlentities($row["asset_type"]); $asset_make = nullable_htmlentities($row["asset_make"]); @@ -1621,7 +1621,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_servers)) { + while ($row = mysqli_fetch_assoc($sql_asset_servers)) { $asset_name = nullable_htmlentities($row["asset_name"]); $asset_make = nullable_htmlentities($row["asset_make"]); $asset_model = nullable_htmlentities($row["asset_model"]); @@ -1665,7 +1665,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_vms)) { + while ($row = mysqli_fetch_assoc($sql_asset_vms)) { $asset_name = nullable_htmlentities($row["asset_name"]); $asset_os = nullable_htmlentities($row["asset_os"]); $asset_ip = nullable_htmlentities($row["interface_ip"]); @@ -1703,7 +1703,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_network)) { + while ($row = mysqli_fetch_assoc($sql_asset_network)) { $asset_name = nullable_htmlentities($row["asset_name"]); $asset_type = nullable_htmlentities($row["asset_type"]); $asset_make = nullable_htmlentities($row["asset_make"]); @@ -1752,7 +1752,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_other)) { + while ($row = mysqli_fetch_assoc($sql_asset_other)) { $asset_name = nullable_htmlentities($row["asset_name"]); $asset_type = nullable_htmlentities($row["asset_type"]); $asset_make = nullable_htmlentities($row["asset_make"]); @@ -1799,7 +1799,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_software)) { + while ($row = mysqli_fetch_assoc($sql_software)) { $software_name = nullable_htmlentities($row["software_name"]); $software_type = nullable_htmlentities($row["software_type"]); $software_license_type = nullable_htmlentities($row["software_license_type"]); @@ -1836,7 +1836,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_user_licenses)) { + while ($row = mysqli_fetch_assoc($sql_user_licenses)) { $contact_name = nullable_htmlentities($row["contact_name"]); $software_name = nullable_htmlentities($row["software_name"]); $html .= " @@ -1863,7 +1863,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_asset_licenses)) { + while ($row = mysqli_fetch_assoc($sql_asset_licenses)) { $asset_name = nullable_htmlentities($row["asset_name"]); $software_name = nullable_htmlentities($row["software_name"]); $html .= " @@ -1893,7 +1893,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_networks)) { + while ($row = mysqli_fetch_assoc($sql_networks)) { $network_name = nullable_htmlentities($row["network_name"]); $network_vlan = nullable_htmlentities($row["network_vlan"]); $network = nullable_htmlentities($row["network"]); @@ -1926,7 +1926,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_domains)) { + while ($row = mysqli_fetch_assoc($sql_domains)) { $domain_name = nullable_htmlentities($row["domain_name"]); $domain_expire = nullable_htmlentities($row["domain_expire"]); $html .= " @@ -1955,7 +1955,7 @@ if (isset($_POST["export_client_pdf"])) { "; - while ($row = mysqli_fetch_array($sql_certficates)) { + while ($row = mysqli_fetch_assoc($sql_certficates)) { $certificate_name = nullable_htmlentities($row["certificate_name"]); $certificate_domain = nullable_htmlentities($row["certificate_domain"]); $certificate_issued_by = nullable_htmlentities($row["certificate_issued_by"]); diff --git a/agent/post/contact.php b/agent/post/contact.php index fe85d44a..d1ad06c8 100644 --- a/agent/post/contact.php +++ b/agent/post/contact.php @@ -87,7 +87,7 @@ if (isset($_POST['edit_contact'])) { // Get Exisiting Contact Photo and contact_user_id $sql = mysqli_query($mysqli,"SELECT contact_photo, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $existing_file_name = sanitizeInput($row['contact_photo']); $contact_user_id = intval($row['contact_user_id']); @@ -172,7 +172,7 @@ if (isset($_POST['edit_contact'])) { // Get Company Phone Number $sql = mysqli_query($mysqli,"SELECT company_name, company_phone FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); @@ -226,7 +226,7 @@ if (isset($_POST['add_contact_note'])) { // Get Contact details for logging and alerting $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -251,7 +251,7 @@ if (isset($_GET['archive_contact_note'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_note_type, contact_id, contact_name, contact_client_id FROM contact_notes LEFT JOIN contacts ON contact_id = contact_note_contact_id WHERE contact_note_id = $contact_note_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_note_type = sanitizeInput($row['contact_note_type']); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -275,7 +275,7 @@ if (isset($_GET['unarchive_contact_note'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_note_type, contact_id, contact_name, contact_client_id FROM contact_notes LEFT JOIN contacts ON contact_id = contact_note_contact_id WHERE contact_note_id = $contact_note_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_note_type = sanitizeInput($row['contact_note_type']); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -299,7 +299,7 @@ if (isset($_GET['delete_contact_note'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_note_type, contact_id, contact_name, contact_client_id FROM contact_notes LEFT JOIN contacts ON contact_id = contact_note_contact_id WHERE contact_note_id = $contact_note_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_note_type = sanitizeInput($row['contact_note_type']); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -323,7 +323,7 @@ if (isset($_POST['bulk_assign_contact_location'])) { // Get Location name for logging and Notification $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -338,7 +338,7 @@ if (isset($_POST['bulk_assign_contact_location'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT contact_name FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); mysqli_query($mysqli,"UPDATE contacts SET contact_location_id = $location_id WHERE contact_id = $contact_id"); @@ -373,7 +373,7 @@ if (isset($_POST['bulk_edit_contact_phone'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -409,7 +409,7 @@ if (isset($_POST['bulk_edit_contact_department'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -447,7 +447,7 @@ if (isset($_POST['bulk_edit_contact_role'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -483,7 +483,7 @@ if (isset($_POST['bulk_assign_contact_tags'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); @@ -534,7 +534,7 @@ if (isset($_POST['send_bulk_mail_now'])) { $contact_id = intval($contact_id); $sql = mysqli_query($mysqli,"SELECT * FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); $client_id = intval($row['contact_client_id']); @@ -579,7 +579,7 @@ if (isset($_POST['bulk_archive_contacts'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_primary, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_primary = intval($row['contact_primary']); $client_id = intval($row['contact_client_id']); @@ -628,7 +628,7 @@ if (isset($_POST['bulk_unarchive_contacts'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -671,7 +671,7 @@ if (isset($_POST['bulk_delete_contacts'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -705,7 +705,7 @@ if (isset($_GET['anonymize_contact'])) { // Get contact & client info $sql = mysqli_query($mysqli,"SELECT contact_name, contact_email, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_first_name = explode(" ", $contact_name)[0]; @@ -745,7 +745,7 @@ if (isset($_GET['anonymize_contact'])) { // Redact audit logs $log_sql = mysqli_query($mysqli, "SELECT * FROM logs WHERE log_client_id = $client_id"); - while ($log = mysqli_fetch_array($log_sql)) { + while ($log = mysqli_fetch_assoc($log_sql)) { $log_id = intval($log['log_id']); $description = $log['log_description']; $description = str_ireplace($info_to_redact, "*****", $description); @@ -757,7 +757,7 @@ if (isset($_GET['anonymize_contact'])) { // Get all tickets this contact raised $contact_tickets_sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_client_id = $client_id AND ticket_contact_id = $contact_id"); - while ($ticket = mysqli_fetch_array($contact_tickets_sql)) { + while ($ticket = mysqli_fetch_assoc($contact_tickets_sql)) { $ticket_id = intval($ticket['ticket_id']); @@ -777,7 +777,7 @@ if (isset($_GET['anonymize_contact'])) { // Redact contact name or email in the replies of all tickets they raised $ticket_replies_sql = mysqli_query($mysqli, "SELECT * FROM ticket_replies WHERE ticket_reply_ticket_id = $ticket_id"); - while($ticket_reply = mysqli_fetch_array($ticket_replies_sql)) { + while($ticket_reply = mysqli_fetch_assoc($ticket_replies_sql)) { $ticket_reply_id = intval($ticket_reply['ticket_reply_id']); $ticket_reply_details = $ticket_reply['ticket_reply']; $ticket_reply_details = str_ireplace($info_to_redact, "*****", $ticket_reply_details); @@ -809,7 +809,7 @@ if (isset($_GET['archive_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -837,7 +837,7 @@ if (isset($_GET['unarchive_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -865,7 +865,7 @@ if (isset($_GET['delete_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -894,7 +894,7 @@ if (isset($_POST['link_contact_to_asset'])) { // Get Asset Name and Client ID for logging $sql_asset = mysqli_query($mysqli,"SELECT asset_name, asset_client_id FROM assets WHERE asset_id = $asset_id"); - $row = mysqli_fetch_array($sql_asset); + $row = mysqli_fetch_assoc($sql_asset); $asset_name = sanitizeInput($row['asset_name']); $client_id = intval($row['asset_client_id']); @@ -920,7 +920,7 @@ if (isset($_GET['unlink_asset_from_contact'])) { // Get asset Name and Client ID for logging $sql_asset = mysqli_query($mysqli,"SELECT asset_name, asset_client_id FROM assets WHERE asset_id = $asset_id"); - $row = mysqli_fetch_array($sql_asset); + $row = mysqli_fetch_assoc($sql_asset); $asset_name = sanitizeInput($row['asset_name']); $client_id = intval($row['asset_client_id']); @@ -946,7 +946,7 @@ if (isset($_POST['link_software_to_contact'])) { // Get software Name and Client ID for logging $sql_software = mysqli_query($mysqli,"SELECT software_name, software_client_id FROM software WHERE software_id = $software_id"); - $row = mysqli_fetch_array($sql_software); + $row = mysqli_fetch_assoc($sql_software); $software_name = sanitizeInput($row['software_name']); $client_id = intval($row['software_client_id']); @@ -972,7 +972,7 @@ if (isset($_GET['unlink_software_from_contact'])) { // Get software Name and Client ID for logging $sql_software = mysqli_query($mysqli,"SELECT software_name, software_client_id FROM software WHERE software_id = $software_id"); - $row = mysqli_fetch_array($sql_software); + $row = mysqli_fetch_assoc($sql_software); $software_name = sanitizeInput($row['software_name']); $client_id = intval($row['software_client_id']); @@ -998,7 +998,7 @@ if (isset($_POST['link_contact_to_credential'])) { // Get credential Name and Client ID for logging $sql_credential = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql_credential); + $row = mysqli_fetch_assoc($sql_credential); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -1024,7 +1024,7 @@ if (isset($_GET['unlink_credential_from_contact'])) { // Get credential Name and Client ID for logging $sql_credential = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql_credential); + $row = mysqli_fetch_assoc($sql_credential); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -1050,7 +1050,7 @@ if (isset($_POST['link_service_to_contact'])) { // Get service Name and Client ID for logging $sql_service = mysqli_query($mysqli,"SELECT service_name, service_client_id FROM services WHERE service_id = $service_id"); - $row = mysqli_fetch_array($sql_service); + $row = mysqli_fetch_assoc($sql_service); $service_name = sanitizeInput($row['service_name']); $client_id = intval($row['service_client_id']); @@ -1076,7 +1076,7 @@ if (isset($_GET['unlink_service_from_contact'])) { // Get service Name and Client ID for logging $sql_service = mysqli_query($mysqli,"SELECT service_name, service_client_id FROM services WHERE service_id = $service_id"); - $row = mysqli_fetch_array($sql_service); + $row = mysqli_fetch_assoc($sql_service); $service_name = sanitizeInput($row['service_name']); $client_id = intval($row['service_client_id']); @@ -1102,7 +1102,7 @@ if (isset($_POST['link_contact_to_file'])) { // Get file Name and Client ID for logging $sql_file = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); @@ -1129,7 +1129,7 @@ if (isset($_GET['unlink_contact_from_file'])) { // Get file Name and Client ID for logging $sql_file = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); diff --git a/agent/post/credential.php b/agent/post/credential.php index 0ee96a44..723566f9 100644 --- a/agent/post/credential.php +++ b/agent/post/credential.php @@ -79,7 +79,7 @@ if(isset($_GET['archive_credential'])){ // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -101,7 +101,7 @@ if(isset($_GET['unarchive_credential'])){ // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -123,7 +123,7 @@ if (isset($_GET['delete_credential'])) { // Get Credential Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -152,7 +152,7 @@ if (isset($_POST['bulk_assign_credential_tags'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -205,7 +205,7 @@ if (isset($_POST['bulk_archive_credentials'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -242,7 +242,7 @@ if (isset($_POST['bulk_unarchive_credentials'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); @@ -280,7 +280,7 @@ if (isset($_POST['bulk_delete_credentials'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT credential_name, credential_client_id FROM credentials WHERE credential_id = $credential_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $credential_name = sanitizeInput($row['credential_name']); $client_id = intval($row['credential_client_id']); diff --git a/agent/post/document.php b/agent/post/document.php index de467358..fb7204d4 100644 --- a/agent/post/document.php +++ b/agent/post/document.php @@ -66,7 +66,7 @@ if (isset($_POST['add_document_from_template'])) { WHERE document_template_id = $document_template_id" ); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_template_name = sanitizeInput($row['document_template_name']); $template_content_html = $row['document_template_content']; // raw HTML from template @@ -145,7 +145,7 @@ if (isset($_POST['edit_document'])) { AND document_id = $document_id" ); - $row = mysqli_fetch_array($sql_original_document); + $row = mysqli_fetch_assoc($sql_original_document); $original_document_name = sanitizeInput($row['document_name']); $original_document_description = sanitizeInput($row['document_description']); @@ -238,13 +238,13 @@ if (isset($_POST['move_document'])) { // Get Document Name Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); // Get Folder Name for logging $sql_folder = mysqli_query($mysqli,"SELECT folder_name FROM folders WHERE folder_id = $folder_id"); - $row = mysqli_fetch_array($sql_folder); + $row = mysqli_fetch_assoc($sql_folder); $folder_name = sanitizeInput($row['folder_name']); // Document edit query @@ -268,7 +268,7 @@ if (isset($_POST['rename_document'])) { // Get Document Name before renaming for logging $sql_document = mysqli_query($mysqli,"SELECT document_name FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $old_document_name = sanitizeInput($row['document_name']); // Document edit query @@ -291,7 +291,7 @@ if (isset($_POST['bulk_move_document'])) { // Get folder name for logging and Notification $sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $folder_name = sanitizeInput($row['folder_name']); $client_id = intval($row['folder_client_id']); @@ -330,7 +330,7 @@ if (isset($_POST['link_file_to_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -357,7 +357,7 @@ if (isset($_GET['unlink_file_from_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -383,7 +383,7 @@ if (isset($_POST['link_vendor_to_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -410,7 +410,7 @@ if (isset($_GET['unlink_vendor_from_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -437,7 +437,7 @@ if (isset($_POST['link_contact_to_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -464,7 +464,7 @@ if (isset($_GET['unlink_contact_from_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -490,7 +490,7 @@ if (isset($_POST['link_asset_to_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -516,7 +516,7 @@ if (isset($_GET['unlink_asset_from_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -542,7 +542,7 @@ if (isset($_POST['link_software_to_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -569,7 +569,7 @@ if (isset($_GET['unlink_software_from_document'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -601,7 +601,7 @@ if (isset($_POST['toggle_document_visibility'])) { // Get Document Name and Client ID for logging $sql_document = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql_document); + $row = mysqli_fetch_assoc($sql_document); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -623,7 +623,7 @@ if (isset($_GET['export_document'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT document_name, document_content, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $document_name = sanitizeInput($row['document_name']); $document_content = $row['document_content']; $client_id = intval($row['document_client_id']); @@ -667,7 +667,7 @@ if (isset($_GET['archive_document'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -730,7 +730,7 @@ if (isset($_GET['delete_document_version'])) { // Get Document $sql = mysqli_query($mysqli,"SELECT document_version_name, document_client_id FROM documents, document_versions WHERE document_version_document_id = document_id AND document_version_id = $document_version_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['document_client_id']); $document_version_name = sanitizeInput($row['document_version_name']); @@ -752,7 +752,7 @@ if (isset($_GET['delete_document'])) { // Get Document Name and Client ID for logging $sql = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['document_client_id']); $document_name = sanitizeInput($row['document_name']); diff --git a/agent/post/domain.php b/agent/post/domain.php index 6bef18f3..9bfc6ebb 100644 --- a/agent/post/domain.php +++ b/agent/post/domain.php @@ -153,7 +153,7 @@ if (isset($_GET['archive_domain'])) { //Get domain Name $sql = mysqli_query($mysqli,"SELECT * FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); @@ -175,7 +175,7 @@ if(isset($_GET['unarchive_domain'])){ // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT domain_name, domain_client_id FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); @@ -197,7 +197,7 @@ if (isset($_GET['delete_domain'])) { // Get Domain Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT domain_name, domain_client_id FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); @@ -229,7 +229,7 @@ if (isset($_POST['bulk_archive_domains'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT domain_name, domain_client_id FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); @@ -266,7 +266,7 @@ if (isset($_POST['bulk_unarchive_domains'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT domain_name, domain_client_id FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); @@ -304,7 +304,7 @@ if (isset($_POST['bulk_delete_domains'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT domain_name, domain_client_id FROM domains WHERE domain_id = $domain_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $domain_name = sanitizeInput($row['domain_name']); $client_id = intval($row['domain_client_id']); diff --git a/agent/post/event.php b/agent/post/event.php index 0a1f8111..93cd4eae 100644 --- a/agent/post/event.php +++ b/agent/post/event.php @@ -54,13 +54,13 @@ if (isset($_POST['add_event'])) { if ($email_event == 1) { $sql_client = mysqli_query($mysqli,"SELECT * FROM clients JOIN contacts ON contact_client_id = client_id WHERE contact_primary = 1 AND client_id = $client"); - $row = mysqli_fetch_array($sql_client); + $row = mysqli_fetch_assoc($sql_client); $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); $sql_company = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql_company); + $row = mysqli_fetch_assoc($sql_company); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); $company_address = sanitizeInput($row['company_address']); @@ -121,13 +121,13 @@ if (isset($_POST['edit_event'])) { if ($email_event == 1) { $sql_client = mysqli_query($mysqli,"SELECT * FROM clients JOIN contacts ON contact_client_id = client_id WHERE contact_primary = 1 AND client_id = $client"); - $row = mysqli_fetch_array($sql_client); + $row = mysqli_fetch_assoc($sql_client); $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); $sql_company = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql_company); + $row = mysqli_fetch_assoc($sql_company); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); $company_address = sanitizeInput($row['company_address']); @@ -177,12 +177,12 @@ if (isset($_POST['edit_event'])) { } if (isset($_GET['delete_event'])) { - + $event_id = intval($_GET['delete_event']); // Get Event Title $sql = mysqli_query($mysqli,"SELECT * FROM calendar_events WHERE event_id = $event_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $event_title = sanitizeInput($row['event_title']); $client_id = intval($row['event_client_id']); diff --git a/agent/post/expense.php b/agent/post/expense.php index 5e6ad19a..99a4f648 100644 --- a/agent/post/expense.php +++ b/agent/post/expense.php @@ -16,7 +16,7 @@ if (isset($_POST['add_expense'])) { // Check for and process attachment $extended_alert_description = ''; - + if (isset($_FILES['file']['tmp_name'])) { if ($new_file_name = checkFileUpload($_FILES['file'], array('jpg', 'jpeg', 'gif', 'png', 'webp', 'pdf'))) { @@ -81,11 +81,11 @@ if (isset($_POST['edit_expense'])) { } if (isset($_GET['delete_expense'])) { - + $expense_id = intval($_GET['delete_expense']); $sql = mysqli_query($mysqli,"SELECT * FROM expenses WHERE expense_id = $expense_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $expense_receipt = sanitizeInput($row['expense_receipt']); $expense_description = sanitizeInput($row['expense_description']); $client_id = intval($row['expense_client_id']); @@ -120,7 +120,7 @@ if (isset($_POST['bulk_edit_expense_category'])) { // Get Expense Details for Logging $sql = mysqli_query($mysqli,"SELECT expense_description, expense_client_id FROM expenses WHERE expense_id = $expense_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $expense_description = sanitizeInput($row['expense_description']); $client_id = intval($row['expense_client_id']); @@ -157,7 +157,7 @@ if (isset($_POST['bulk_edit_expense_account'])) { // Get Expense Details for Logging $sql = mysqli_query($mysqli,"SELECT expense_description, expense_client_id FROM expenses WHERE expense_id = $expense_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $expense_description = sanitizeInput($row['expense_description']); $client_id = intval($row['expense_client_id']); @@ -209,7 +209,7 @@ if (isset($_POST['bulk_edit_expense_client'])) { } if (isset($_POST['bulk_delete_expenses'])) { - + validateCSRFToken($_POST['csrf_token']); validateAdminRole(); @@ -225,7 +225,7 @@ if (isset($_POST['bulk_delete_expenses'])) { $expense_id = intval($expense_id); $sql = mysqli_query($mysqli,"SELECT * FROM expenses WHERE expense_id = $expense_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $expense_description = sanitizeInput($row['expense_description']); $expense_receipt = sanitizeInput($row['expense_receipt']); $client_id = intval($row['expense_client_id']); @@ -249,7 +249,7 @@ if (isset($_POST['bulk_delete_expenses'])) { } if (isset($_POST['export_expenses_csv'])) { - + $date_from = sanitizeInput($_POST['date_from']); $date_to = sanitizeInput($_POST['date_to']); $account = intval($_POST['account']); diff --git a/agent/post/file.php b/agent/post/file.php index 59aafaa5..5c098b78 100644 --- a/agent/post/file.php +++ b/agent/post/file.php @@ -110,7 +110,7 @@ if (isset($_POST['rename_file'])) { // Get File Details Client ID for Logging $sql = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $old_file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); @@ -134,7 +134,7 @@ if (isset($_POST['move_file'])) { // Get File Name and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); @@ -159,7 +159,7 @@ if (isset($_GET['archive_file'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); @@ -204,7 +204,7 @@ if (isset($_POST['delete_file'])) { $file_id = intval($_POST['file_id']); $sql_file = mysqli_query($mysqli,"SELECT * FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $client_id = intval($row['file_client_id']); $file_name = sanitizeInput($row['file_name']); $file_reference_name = sanitizeInput($row['file_reference_name']); @@ -247,7 +247,7 @@ if (isset($_POST['bulk_archive_files'])) { $file_id = intval($file_id); $sql_file = mysqli_query($mysqli,"SELECT * FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $client_id = intval($row['file_client_id']); $file_name = sanitizeInput($row['file_name']); @@ -269,7 +269,7 @@ if (isset($_POST['bulk_archive_files'])) { $document_id = intval($document_id); // Get document name for logging $sql = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -306,7 +306,7 @@ if (isset($_POST['bulk_delete_files'])) { $file_id = intval($file_id); $sql_file = mysqli_query($mysqli,"SELECT * FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $client_id = intval($row['file_client_id']); $file_name = sanitizeInput($row['file_name']); $file_reference_name = sanitizeInput($row['file_reference_name']); @@ -340,7 +340,7 @@ if (isset($_POST['bulk_delete_files'])) { $document_id = intval($document_id); // Get Document Name and Client ID for logging $sql = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['document_client_id']); $document_name = sanitizeInput($row['document_name']); @@ -383,7 +383,7 @@ if (isset($_POST['bulk_restore_files'])) { $file_id = intval($file_id); $sql_file = mysqli_query($mysqli,"SELECT * FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql_file); + $row = mysqli_fetch_assoc($sql_file); $client_id = intval($row['file_client_id']); $file_name = sanitizeInput($row['file_name']); @@ -405,7 +405,7 @@ if (isset($_POST['bulk_restore_files'])) { $document_id = intval($document_id); // Get document name for logging $sql = mysqli_query($mysqli,"SELECT document_name, document_client_id FROM documents WHERE document_id = $document_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $document_name = sanitizeInput($row['document_name']); $client_id = intval($row['document_client_id']); @@ -440,7 +440,7 @@ if (isset($_POST['bulk_move_files'])) { // If moving into a real folder, get folder name + client for logging if ($folder_id > 0) { $sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id"); - if ($row = mysqli_fetch_array($sql)) { + if ($row = mysqli_fetch_assoc($sql)) { $folder_name = sanitizeInput($row['folder_name']); $log_client_id = intval($row['folder_client_id']); } @@ -545,7 +545,7 @@ if (isset($_POST['link_asset_to_file'])) { // Get File Name and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); @@ -572,7 +572,7 @@ if (isset($_GET['unlink_asset_from_file'])) { // Get File Name and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT file_name, file_client_id FROM files WHERE file_id = $file_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $file_name = sanitizeInput($row['file_name']); $client_id = intval($row['file_client_id']); diff --git a/agent/post/folder.php b/agent/post/folder.php index b0d25b91..08e7e531 100644 --- a/agent/post/folder.php +++ b/agent/post/folder.php @@ -36,7 +36,7 @@ if (isset($_POST['rename_folder'])) { // Get old Folder Name Client ID for Logging $sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $old_folder_name = sanitizeInput($row['folder_name']); $client_id = intval($row['folder_client_id']); @@ -59,7 +59,7 @@ if (isset($_GET['delete_folder'])) { // Get Folder Name Client ID for Logging $sql = mysqli_query($mysqli,"SELECT folder_name, folder_client_id FROM folders WHERE folder_id = $folder_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $folder_name = sanitizeInput($row['folder_name']); $client_id = intval($row['folder_client_id']); @@ -67,7 +67,7 @@ if (isset($_GET['delete_folder'])) { // Move files in deleted folder back to the root folder / $sql_documents = mysqli_query($mysqli,"SELECT * FROM documents WHERE document_folder_id = $folder_id"); - while($row = mysqli_fetch_array($sql_documents)) { + while($row = mysqli_fetch_assoc($sql_documents)) { $document_id = intval($row['document_id']); mysqli_query($mysqli,"UPDATE documents SET document_folder_id = 0 WHERE document_id = $document_id"); diff --git a/agent/post/invoice.php b/agent/post/invoice.php index b0283e32..cea45b0e 100644 --- a/agent/post/invoice.php +++ b/agent/post/invoice.php @@ -56,7 +56,7 @@ if (isset($_POST['edit_invoice'])) { // Get Invoice Number and Prefix and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT invoice_prefix, invoice_number, invoice_client_id FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -64,7 +64,7 @@ if (isset($_POST['edit_invoice'])) { // Calculate new total $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); $invoice_amount = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $invoice_amount = $invoice_amount + $item_total; } @@ -88,7 +88,7 @@ if (isset($_POST['add_invoice_copy'])) { //Get Net Terms $sql = mysqli_query($mysqli,"SELECT * FROM clients, invoices WHERE client_id = invoice_client_id AND invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_net_terms = intval($row['client_net_terms']); $invoice_scope = sanitizeInput($row['invoice_scope']); $invoice_discount_amount = floatval($row['invoice_discount_amount']); @@ -121,7 +121,7 @@ if (isset($_POST['add_invoice_copy'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Copied INVOICE!', history_invoice_id = $new_invoice_id"); $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); - while($row = mysqli_fetch_array($sql_items)) { + while($row = mysqli_fetch_assoc($sql_items)) { $item_id = intval($row['item_id']); $item_name = sanitizeInput($row['item_name']); $item_description = sanitizeInput($row['item_description']); @@ -152,7 +152,7 @@ if (isset($_GET['mark_invoice_sent'])) { // Get Invoice Number and Prefix and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT invoice_prefix, invoice_number, invoice_client_id FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -175,7 +175,7 @@ if (isset($_GET['mark_invoice_non-billable'])) { // Get Invoice Number and Prefix and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT invoice_prefix, invoice_number, invoice_client_id FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -198,7 +198,7 @@ if (isset($_GET['cancel_invoice'])) { // Get Invoice Number and Prefix and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT invoice_prefix, invoice_number, invoice_client_id FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -221,7 +221,7 @@ if (isset($_GET['delete_invoice'])) { // Get Invoice Number and Prefix and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT invoice_prefix, invoice_number, invoice_client_id FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -230,21 +230,21 @@ if (isset($_GET['delete_invoice'])) { //Delete Items Associated with the Invoice $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_id = intval($row['item_id']); mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id"); } //Delete History Associated with the Invoice $sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id"); - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $history_id = intval($row['history_id']); mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id"); } //Delete Payments Associated with the Invoice $sql = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id"); - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $payment_id = intval($row['payment_id']); mysqli_query($mysqli,"DELETE FROM payments WHERE payment_id = $payment_id"); } @@ -288,7 +288,7 @@ if (isset($_POST['add_invoice_item'])) { FROM product_stock WHERE stock_product_id = $product_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $available_stock = floatval($row['available_stock']); // Enough in stock? @@ -305,7 +305,7 @@ if (isset($_POST['add_invoice_item'])) { // Tax if ($tax_id > 0) { $sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $tax_amount = $subtotal * $tax_percent / 100; } else { @@ -318,7 +318,7 @@ if (isset($_POST['add_invoice_item'])) { // Get Discount and Invoice Details $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -327,7 +327,7 @@ if (isset($_POST['add_invoice_item'])) { //add up all line items $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); $invoice_total = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $invoice_total = $invoice_total + $item_total; } @@ -352,7 +352,7 @@ if (isset($_POST['invoice_note'])) { // Get Invoice Details for logging $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -383,7 +383,7 @@ if (isset($_POST['edit_item'])) { if ($tax_id > 0) { $sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $tax_amount = $subtotal * $tax_percent / 100; } else { @@ -396,7 +396,7 @@ if (isset($_POST['edit_item'])) { // Determine what type of line item $sql = mysqli_query($mysqli,"SELECT item_invoice_id, item_quote_id, item_recurring_invoice_id FROM invoice_items WHERE item_id = $item_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_id = intval($row['item_invoice_id']); $quote_id = intval($row['item_quote_id']); $recurring_invoice_id = intval($row['item_recurring_invoice_id']); @@ -404,7 +404,7 @@ if (isset($_POST['edit_item'])) { if ($invoice_id > 0) { //Get Discount Amount $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -412,7 +412,7 @@ if (isset($_POST['edit_item'])) { //Update Invoice Balances by tallying up invoice items $sql_invoice_total = mysqli_query($mysqli,"SELECT SUM(item_total) AS invoice_total FROM invoice_items WHERE item_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_invoice_total); + $row = mysqli_fetch_assoc($sql_invoice_total); $new_invoice_amount = floatval($row['invoice_total']) - $invoice_discount; @@ -425,7 +425,7 @@ if (isset($_POST['edit_item'])) { } elseif ($quote_id > 0) { //Get Discount Amount $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = intval($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -433,7 +433,7 @@ if (isset($_POST['edit_item'])) { //Update Quote Balances by tallying up items $sql_quote_total = mysqli_query($mysqli,"SELECT SUM(item_total) AS quote_total FROM invoice_items WHERE item_quote_id = $quote_id"); - $row = mysqli_fetch_array($sql_quote_total); + $row = mysqli_fetch_assoc($sql_quote_total); $new_quote_amount = floatval($row['quote_total']) - $quote_discount; mysqli_query($mysqli,"UPDATE quotes SET quote_amount = $new_quote_amount WHERE quote_id = $quote_id"); @@ -443,7 +443,7 @@ if (isset($_POST['edit_item'])) { } else { //Get Discount Amount $sql = mysqli_query($mysqli,"SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $client_id = intval($row['recurring_invoice_client_id']); @@ -451,7 +451,7 @@ if (isset($_POST['edit_item'])) { //Update Invoice Balances by tallying up invoice items $sql_recurring_invoice_total = mysqli_query($mysqli,"SELECT SUM(item_total) AS recurring_invoice_total FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql_recurring_invoice_total); + $row = mysqli_fetch_assoc($sql_recurring_invoice_total); $new_recurring_invoice_amount = floatval($row['recurring_invoice_total']) - $recurring_invoice_discount; mysqli_query($mysqli,"UPDATE recurring_invoices SET recurring_invoice_amount = $new_recurring_invoice_amount WHERE recurring_invoice_id = $recurring_invoice_id"); @@ -474,7 +474,7 @@ if (isset($_GET['delete_invoice_item'])) { $item_id = intval($_GET['delete_invoice_item']); $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_id = $item_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_id = intval($row['item_invoice_id']); $item_name = sanitizeInput($row['item_name']); $item_quantity = floatval($row['item_quantity']); @@ -484,7 +484,7 @@ if (isset($_GET['delete_invoice_item'])) { $item_total = floatval($row['item_total']); $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); @@ -517,7 +517,7 @@ if (isset($_GET['email_invoice'])) { LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1 WHERE invoice_id = $invoice_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_id = intval($row['invoice_id']); $invoice_prefix = sanitizeInput($row['invoice_prefix']); @@ -535,7 +535,7 @@ if (isset($_GET['email_invoice'])) { $contact_email = sanitizeInput($row['contact_email']); $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); @@ -556,7 +556,7 @@ if (isset($_GET['email_invoice'])) { // Add up all the payments for the invoice and get the total amount paid to the invoice $sql_amount_paid = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_amount_paid); + $row = mysqli_fetch_assoc($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); $balance = $invoice_amount - $amount_paid; @@ -607,7 +607,7 @@ if (isset($_GET['email_invoice'])) { $data = []; - while ($billing_contact = mysqli_fetch_array($sql_billing_contacts)) { + while ($billing_contact = mysqli_fetch_assoc($sql_billing_contacts)) { $billing_contact_name = sanitizeInput($billing_contact['contact_name']); $billing_contact_email = sanitizeInput($billing_contact['contact_email']); @@ -736,7 +736,7 @@ if (isset($_GET['export_invoice_pdf'])) { LIMIT 1" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_id = intval($row['invoice_id']); $invoice_prefix = nullable_htmlentities($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); @@ -772,7 +772,7 @@ if (isset($_GET['export_invoice_pdf'])) { } $sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_id = intval($row['company_id']); $company_name = nullable_htmlentities($row['company_name']); $company_country = nullable_htmlentities($row['company_country']); @@ -796,7 +796,7 @@ if (isset($_GET['export_invoice_pdf'])) { //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_amount_paid); + $row = mysqli_fetch_assoc($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); $balance = $invoice_amount - $amount_paid; @@ -882,7 +882,7 @@ if (isset($_GET['export_invoice_pdf'])) { $total_tax = 0; $sql_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id ORDER BY item_order ASC"); - while ($item = mysqli_fetch_array($sql_items)) { + while ($item = mysqli_fetch_assoc($sql_items)) { $name = $item['item_name']; $desc = $item['item_description']; $qty = $item['item_quantity']; @@ -962,7 +962,7 @@ if (isset($_POST['bulk_edit_invoice_category'])) { // Get Invoice Details for Logging $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $invoice_scope = sanitizeInput($row['invoice_scope']); diff --git a/agent/post/location.php b/agent/post/location.php index 0c3da171..4d23be57 100644 --- a/agent/post/location.php +++ b/agent/post/location.php @@ -68,7 +68,7 @@ if(isset($_POST['edit_location'])){ // Get old location photo $sql = mysqli_query($mysqli,"SELECT location_photo FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $existing_file_name = sanitizeInput($row['location_photo']); if(!file_exists("../uploads/clients/$client_id")) { @@ -128,7 +128,7 @@ if(isset($_GET['archive_location'])){ // Get Location Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -150,7 +150,7 @@ if(isset($_GET['unarchive_location'])){ // Get Location Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -172,7 +172,7 @@ if(isset($_GET['delete_location'])){ // Get Location Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -201,7 +201,7 @@ if (isset($_POST['bulk_assign_location_tags'])) { // Get Contact Details for Logging $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -252,7 +252,7 @@ if (isset($_POST['bulk_archive_locations'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id, location_primary FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $location_primary = intval($row['location_primary']); $client_id = intval($row['location_client_id']); @@ -296,7 +296,7 @@ if (isset($_POST['bulk_unarchive_locations'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); @@ -334,7 +334,7 @@ if (isset($_POST['bulk_delete_locations'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT location_name, location_client_id FROM locations WHERE location_id = $location_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $location_name = sanitizeInput($row['location_name']); $client_id = intval($row['location_client_id']); diff --git a/agent/post/network.php b/agent/post/network.php index 6791a633..f6b2b88c 100644 --- a/agent/post/network.php +++ b/agent/post/network.php @@ -49,7 +49,7 @@ if (isset($_GET['archive_network'])) { // Get Network Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT network_name, network_client_id FROM networks WHERE network_id = $network_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $network_name = sanitizeInput($row['network_name']); $client_id = intval($row['network_client_id']); @@ -71,7 +71,7 @@ if (isset($_GET['unarchive_network'])) { // Get Network Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT network_name, network_client_id FROM networks WHERE network_id = $network_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $network_name = sanitizeInput($row['network_name']); $client_id = intval($row['network_client_id']); @@ -93,7 +93,7 @@ if (isset($_GET['delete_network'])) { // Get Network Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT network_name, network_client_id FROM networks WHERE network_id = $network_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $network_name = sanitizeInput($row['network_name']); $client_id = intval($row['network_client_id']); @@ -125,7 +125,7 @@ if (isset($_POST['bulk_delete_networks'])) { // Get Network Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT network_name, network_client_id FROM networks WHERE network_id = $network_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $network_name = sanitizeInput($row['network_name']); $client_id = intval($row['network_client_id']); diff --git a/agent/post/payment.php b/agent/post/payment.php index c20e99ee..9060b9a5 100644 --- a/agent/post/payment.php +++ b/agent/post/payment.php @@ -33,7 +33,7 @@ if (isset($_POST['add_payment'])) { //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_total_payments_amount = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS payments_amount FROM payments WHERE payment_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_total_payments_amount); + $row = mysqli_fetch_assoc($sql_total_payments_amount); $total_payments_amount = floatval($row['payments_amount']); //Get the invoice total @@ -43,7 +43,7 @@ if (isset($_POST['add_payment'])) { WHERE invoice_id = $invoice_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_amount = floatval($row['invoice_amount']); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); @@ -58,7 +58,7 @@ if (isset($_POST['add_payment'])) { $contact_mobile = sanitizeInput(formatPhoneNumber($row['contact_mobile'], $row['contact_mobile_country_code'])); $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); @@ -205,7 +205,7 @@ if (isset($_POST['apply_credit'])) { $credit_amount_applied = floatval($_POST['credit_amount_applied']); $sql = mysqli_query($mysqli, "SELECT * FROM invoices LEFT JOIN clients ON invoice_client_id = client_id WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); @@ -216,20 +216,20 @@ if (isset($_POST['apply_credit'])) { // Get Credit Balance $sql_credit_balance = mysqli_query($mysqli, "SELECT SUM(credit_amount) AS credit_balance FROM credits WHERE credit_client_id = $client_id"); - $row = mysqli_fetch_array($sql_credit_balance); + $row = mysqli_fetch_assoc($sql_credit_balance); $credit_balance = floatval($row['credit_balance']); // Get Invoice Balance $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_amount_paid); + $row = mysqli_fetch_assoc($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); $invoice_balance = $invoice_amount - $amount_paid; // Get Credit Tally applied to invoice $sql_credit_tally = mysqli_query($mysqli, "SELECT SUM(credit_tally) AS credit_balance FROM credits WHERE credit_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_credit_tally); + $row = mysqli_fetch_assoc($sql_credit_tally); $credit_tally = floatval($row['credit_tally']); @@ -318,7 +318,7 @@ if (isset($_POST['add_payment_stripe'])) { LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1 WHERE invoice_id = $invoice_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_number = intval($row['invoice_number']); $invoice_status = sanitizeInput($row['invoice_status']); $invoice_amount = floatval($row['invoice_amount']); @@ -336,7 +336,7 @@ if (isset($_POST['add_payment_stripe'])) { // Get ITFlow company details $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); $company_address = sanitizeInput($row['company_address']); @@ -353,7 +353,7 @@ if (isset($_POST['add_payment_stripe'])) { // Get Client Payment Details $sql = mysqli_query($mysqli, "SELECT * FROM client_saved_payment_methods LEFT JOIN payment_providers ON saved_payment_provider_id = payment_provider_id LEFT JOIN client_payment_provider ON saved_payment_client_id = client_id WHERE saved_payment_id = $saved_payment_id LIMIT 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $public_key = sanitizeInput($row['payment_provider_public_key']); $private_key = sanitizeInput($row['payment_provider_private_key']); @@ -513,7 +513,7 @@ if (isset($_GET['add_payment_stripe'])) { LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1 WHERE invoice_id = $invoice_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_number = intval($row['invoice_number']); $invoice_status = sanitizeInput($row['invoice_status']); $invoice_amount = floatval($row['invoice_amount']); @@ -531,7 +531,7 @@ if (isset($_GET['add_payment_stripe'])) { // Get ITFlow company details $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); $company_address = sanitizeInput($row['company_address']); @@ -547,7 +547,7 @@ if (isset($_GET['add_payment_stripe'])) { $config_invoice_from_email = sanitizeInput($config_invoice_from_email); // Get Client Stripe details - $stripe_client_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1")); + $stripe_client_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM client_stripe WHERE client_id = $client_id LIMIT 1")); $stripe_id = sanitizeInput($stripe_client_details['stripe_id']); $stripe_pm = sanitizeInput($stripe_client_details['stripe_pm']); @@ -715,7 +715,7 @@ if (isset($_POST['add_bulk_payment'])) { $result_invoices = mysqli_query($mysqli, $sql_invoices); // Loop Through Each Invoice - while ($row = mysqli_fetch_array($result_invoices)) { + while ($row = mysqli_fetch_assoc($result_invoices)) { $invoice_id = intval($row['invoice_id']); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); @@ -723,7 +723,7 @@ if (isset($_POST['add_bulk_payment'])) { $invoice_url_key = sanitizeInput($row['invoice_url_key']); $invoice_balance_query = "SELECT SUM(payment_amount) AS amount_paid FROM payments WHERE payment_invoice_id = $invoice_id"; $result_amount_paid = mysqli_query($mysqli, $invoice_balance_query); - $row_amount_paid = mysqli_fetch_array($result_amount_paid); + $row_amount_paid = mysqli_fetch_assoc($result_amount_paid); $amount_paid = floatval($row_amount_paid['amount_paid']); $invoice_balance = $invoice_amount - $amount_paid; @@ -776,13 +776,13 @@ if (isset($_POST['add_bulk_payment'])) { WHERE client_id = $client_id" ); - $row = mysqli_fetch_array($sql_client); + $row = mysqli_fetch_assoc($sql_client); $client_name = sanitizeInput($row['client_name']); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); $sql_company = mysqli_query($mysqli,"SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql_company); + $row = mysqli_fetch_assoc($sql_company); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -823,18 +823,18 @@ if (isset($_GET['delete_payment'])) { $payment_id = intval($_GET['delete_payment']); $sql = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_id = $payment_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_id = intval($row['payment_invoice_id']); $deleted_payment_amount = floatval($row['payment_amount']); //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_total_payments_amount = mysqli_query($mysqli,"SELECT SUM(payment_amount) AS total_payments_amount FROM payments WHERE payment_invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_total_payments_amount); + $row = mysqli_fetch_assoc($sql_total_payments_amount); $total_payments_amount = floatval($row['total_payments_amount']); // Get the invoice total and details $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $client_id = intval($row['invoice_client_id']); diff --git a/agent/post/project.php b/agent/post/project.php index 80ad0dbe..9ceecbc6 100644 --- a/agent/post/project.php +++ b/agent/post/project.php @@ -43,7 +43,7 @@ if (isset($_POST['add_project'])) { AND project_template_ticket_templates.project_template_id = $project_template_id"); $ticket_template_count = mysqli_num_rows($sql_ticket_templates); - while ($row = mysqli_fetch_array($sql_ticket_templates)) { + while ($row = mysqli_fetch_assoc($sql_ticket_templates)) { $ticket_template_id = intval($row['ticket_template_id']); $ticket_template_order = intval($row['ticket_template_order']); $ticket_template_subject = sanitizeInput($row['ticket_template_subject']); @@ -69,7 +69,7 @@ if (isset($_POST['add_project'])) { "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id"); $task_template_count = mysqli_num_rows($sql_task_templates); - while ($row = mysqli_fetch_array($sql_task_templates)) { + while ($row = mysqli_fetch_assoc($sql_task_templates)) { $task_template_id = intval($row['task_template_id']); $task_template_order = intval($row['task_template_order']); $task_template_name = sanitizeInput($row['task_template_name']); @@ -116,7 +116,7 @@ if (isset($_GET['close_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_name, project_client_id FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $project_name = sanitizeInput($row['project_name']); $client_id = intval($row['project_client_id']); @@ -138,7 +138,7 @@ if (isset($_GET['archive_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_name, project_client_id FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $project_name = sanitizeInput($row['project_name']); $client_id = intval($row['project_client_id']); @@ -160,7 +160,7 @@ if (isset($_GET['unarchive_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_name, project_client_id FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $project_name = sanitizeInput($row['project_name']); $client_id = sanitizeInput($row['project_client_id']); @@ -184,7 +184,7 @@ if (isset($_GET['delete_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_name, project_client_id FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $project_name = sanitizeInput($row['project_name']); $client_id = intval($row['project_client_id']); @@ -206,7 +206,7 @@ if (isset($_POST['link_ticket_to_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_client_id, project_name FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['project_client_id']); $project_name = sanitizeInput($row['project_name']); @@ -221,7 +221,7 @@ if (isset($_POST['link_ticket_to_project'])) { // Get Ticket Info $sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_subject = sanitizeInput($row['ticket_subject']); @@ -250,7 +250,7 @@ if (isset($_POST['link_closed_ticket_to_project'])) { // Get Project Name and Client ID for logging $sql = mysqli_query($mysqli, "SELECT project_client_id, project_name FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['project_client_id']); $project_name = sanitizeInput($row['project_name']); @@ -260,7 +260,7 @@ if (isset($_POST['link_closed_ticket_to_project'])) { flash_alert("Cannot merge into that ticket.", 'error'); redirect(); } - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_id = intval($row['ticket_id']); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); diff --git a/agent/post/quote.php b/agent/post/quote.php index ebbb1197..6a650d60 100644 --- a/agent/post/quote.php +++ b/agent/post/quote.php @@ -67,7 +67,7 @@ if (isset($_POST['add_quote_copy'])) { $quote_number = mysqli_insert_id($mysqli); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $original_quote_prefix = sanitizeInput($row['quote_prefix']); $original_quote_number = sanitizeInput($row['quote_number']); $quote_discount_amount = floatval($row['quote_discount_amount']); @@ -87,7 +87,7 @@ if (isset($_POST['add_quote_copy'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Quote copied!', history_quote_id = $new_quote_id"); $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id"); - while($row = mysqli_fetch_array($sql_items)) { + while($row = mysqli_fetch_assoc($sql_items)) { $item_id = intval($row['item_id']); $item_name = sanitizeInput($row['item_name']); $item_description = sanitizeInput($row['item_description']); @@ -120,7 +120,7 @@ if (isset($_POST['add_quote_to_invoice'])) { $date = sanitizeInput($_POST['date']); $sql = mysqli_query($mysqli,"SELECT * FROM clients, quotes WHERE client_id = quote_client_id AND quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_net_terms = intval($row['client_net_terms']); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); @@ -156,7 +156,7 @@ if (isset($_POST['add_quote_to_invoice'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Invoice created from quote $quote_prefix$quote_number', history_invoice_id = $new_invoice_id"); $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id"); - while($row = mysqli_fetch_array($sql_items)) { + while($row = mysqli_fetch_assoc($sql_items)) { $item_id = intval($row['item_id']); $item_name = sanitizeInput($row['item_name']); $item_description = sanitizeInput($row['item_description']); @@ -201,7 +201,7 @@ if (isset($_POST['add_quote_item'])) { if ($tax_id > 0) { $sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $tax_amount = $subtotal * $tax_percent / 100; }else{ @@ -214,7 +214,7 @@ if (isset($_POST['add_quote_item'])) { // Get Quote Details $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $quote_discount_amount = floatval($row['quote_discount_amount']); @@ -223,7 +223,7 @@ if (isset($_POST['add_quote_item'])) { //add up the total of all items $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id"); $quote_amount = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $quote_amount = $quote_amount + $item_total; } @@ -248,7 +248,7 @@ if (isset($_POST['quote_note'])) { // Get Quote Details $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -273,7 +273,7 @@ if (isset($_POST['edit_quote'])) { // Get Quote Details for logging $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -281,7 +281,7 @@ if (isset($_POST['edit_quote'])) { //Calculate the new quote amount $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id"); $quote_amount = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $quote_amount = $quote_amount + $item_total; } @@ -305,7 +305,7 @@ if (isset($_GET['delete_quote'])) { // Get Quote Details for logging $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -314,14 +314,14 @@ if (isset($_GET['delete_quote'])) { //Delete Items Associated with the Quote $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_quote_id = $quote_id"); - while($row = mysqli_fetch_array($sql)) {; + while($row = mysqli_fetch_assoc($sql)) {; $item_id = intval($row['item_id']); mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id"); } //Delete History Associated with the Quote $sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_quote_id = $quote_id"); - while($row = mysqli_fetch_array($sql)) {; + while($row = mysqli_fetch_assoc($sql)) {; $history_id = intval($row['history_id']); mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id"); } @@ -346,7 +346,7 @@ if (isset($_GET['delete_quote_item'])) { $item_id = intval($_GET['delete_quote_item']); $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_id = $item_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $item_name = sanitizeInput($row['item_name']); $quote_id = intval($row['item_quote_id']); $item_subtotal = floatval($row['item_subtotal']); @@ -354,7 +354,7 @@ if (isset($_GET['delete_quote_item'])) { $item_total = floatval($row['item_total']); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -380,7 +380,7 @@ if (isset($_GET['mark_quote_sent'])) { $quote_id = intval($_GET['mark_quote_sent']); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -404,7 +404,7 @@ if (isset($_GET['accept_quote'])) { $quote_id = intval($_GET['accept_quote']); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -430,7 +430,7 @@ if (isset($_GET['decline_quote'])) { $quote_id = intval($_GET['decline_quote']); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -461,7 +461,7 @@ if (isset($_GET['email_quote'])) { WHERE quote_id = $quote_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = intval($row['quote_number']); $quote_scope = sanitizeInput($row['quote_scope']); @@ -477,7 +477,7 @@ if (isset($_GET['email_quote'])) { $contact_email = sanitizeInput($row['contact_email']); $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); @@ -534,7 +534,7 @@ if (isset($_GET['mark_quote_invoiced'])) { $quote_id = intval($_GET['mark_quote_invoiced']); $sql = mysqli_query($mysqli,"SELECT * FROM quotes WHERE quote_id = $quote_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_prefix = sanitizeInput($row['quote_prefix']); $quote_number = sanitizeInput($row['quote_number']); $client_id = intval($row['quote_client_id']); @@ -624,7 +624,7 @@ if (isset($_GET['export_quote_pdf'])) { LIMIT 1" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $quote_id = intval($row['quote_id']); $quote_prefix = nullable_htmlentities($row['quote_prefix']); $quote_number = intval($row['quote_number']); @@ -660,7 +660,7 @@ if (isset($_GET['export_quote_pdf'])) { } $sql = mysqli_query($mysqli, "SELECT * FROM companies, settings WHERE companies.company_id = settings.company_id AND companies.company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_id = intval($row['company_id']); $company_name = nullable_htmlentities($row['company_name']); @@ -763,7 +763,7 @@ if (isset($_GET['export_quote_pdf'])) { $total_tax = 0; $sql_items = mysqli_query($mysqli, "SELECT * FROM invoice_items WHERE item_quote_id = $quote_id ORDER BY item_order ASC"); - while ($item = mysqli_fetch_array($sql_items)) { + while ($item = mysqli_fetch_assoc($sql_items)) { $name = $item['item_name']; $desc = $item['item_description']; $qty = $item['item_quantity']; diff --git a/agent/post/rack.php b/agent/post/rack.php index 524a32ce..65d28b2f 100644 --- a/agent/post/rack.php +++ b/agent/post/rack.php @@ -99,7 +99,7 @@ if (isset($_GET['archive_rack'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_client_id FROM racks WHERE rack_id = $rack_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $client_id = intval($row['rack_client_id']); @@ -121,7 +121,7 @@ if (isset($_GET['unarchive_rack'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_client_id FROM racks WHERE rack_id = $rack_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $client_id = intval($row['rack_client_id']); @@ -143,7 +143,7 @@ if (isset($_GET['delete_rack'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_client_id, rack_photo FROM racks WHERE rack_id = $rack_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $rack_photo = sanitizeInput($row['rack_photo']); $client_id = intval($row['rack_client_id']); @@ -176,7 +176,7 @@ if (isset($_POST['add_rack_unit'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_client_id FROM racks WHERE rack_id = $rack_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $client_id = intval($row['rack_client_id']); @@ -222,7 +222,7 @@ if (isset($_POST['edit_rack_unit'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_client_id FROM racks WHERE rack_id = $rack_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $client_id = intval($row['rack_client_id']); @@ -244,7 +244,7 @@ if (isset($_GET['remove_rack_unit'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT rack_name, rack_id, rack_client_id FROM racks LEFT JOIN rack_units ON unit_rack_id = rack_id WHERE unit_id = $unit_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $rack_name = sanitizeInput($row['rack_name']); $unit_device = sanitizeInput($row['unit_device']); $client_id = intval($row['rack_client_id']); diff --git a/agent/post/recurring_expense.php b/agent/post/recurring_expense.php index ac76b294..f1256de5 100644 --- a/agent/post/recurring_expense.php +++ b/agent/post/recurring_expense.php @@ -72,7 +72,7 @@ if (isset($_GET['delete_recurring_expense'])) { // Get Recurring Expense Details for Logging $sql = mysqli_query($mysqli,"SELECT recurring_expense_description, recurring_expense_client_id FROM recurring_expenses WHERE recurring_expense_id = $recurring_expense_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_expense_description = sanitizeInput($row['recurring_expense_description']); $client_id = intval($row['recurring_expense_client_id']); diff --git a/agent/post/recurring_invoice.php b/agent/post/recurring_invoice.php index 3cc25a82..01f18dee 100644 --- a/agent/post/recurring_invoice.php +++ b/agent/post/recurring_invoice.php @@ -12,7 +12,7 @@ if (isset($_POST['add_invoice_recurring'])) { $recurring_invoice_frequency = sanitizeInput($_POST['frequency']); $sql = mysqli_query($mysqli,"SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); $invoice_date = sanitizeInput($row['invoice_date']); @@ -41,7 +41,7 @@ if (isset($_POST['add_invoice_recurring'])) { mysqli_query($mysqli,"INSERT INTO history SET history_status = 'Draft', history_description = 'Recurring Invoice Created from INVOICE!', history_recurring_invoice_id = $recurring_invoice_id"); $sql_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); - while($row = mysqli_fetch_array($sql_items)) { + while($row = mysqli_fetch_assoc($sql_items)) { $item_id = intval($row['item_id']); $item_name = sanitizeInput($row['item_name']); $item_description = sanitizeInput($row['item_description']); @@ -109,7 +109,7 @@ if (isset($_POST['edit_recurring_invoice'])) { // Get Recurring Invoice Details and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT recurring_invoice_prefix, recurring_invoice_number, recurring_invoice_client_id FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $client_id = intval($row['recurring_invoice_client_id']); @@ -117,7 +117,7 @@ if (isset($_POST['edit_recurring_invoice'])) { //Calculate new total $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id"); $recurring_invoice_amount = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $recurring_invoice_amount = $recurring_invoice_amount + $item_total; } @@ -141,7 +141,7 @@ if (isset($_GET['delete_recurring_invoice'])) { // Get Recurring Invoice Details and Client ID for Logging $sql = mysqli_query($mysqli,"SELECT recurring_invoice_prefix, recurring_invoice_number, recurring_invoice_scope, recurring_invoice_client_id FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $recurring_invoice_scope = sanitizeInput($row['recurring_invoice_scope']); @@ -151,14 +151,14 @@ if (isset($_GET['delete_recurring_invoice'])) { //Delete Items Associated with the Recurring $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id"); - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_id = intval($row['item_id']); mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id"); } //Delete History Associated with the Invoice $sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_recurring_invoice_id = $recurring_invoice_id"); - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $history_id = intval($row['history_id']); mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id"); } @@ -185,7 +185,7 @@ if (isset($_POST['add_recurring_invoice_item'])) { if ($tax_id > 0) { $sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $tax_amount = $subtotal * $tax_percent / 100; } else { @@ -198,7 +198,7 @@ if (isset($_POST['add_recurring_invoice_item'])) { $sql = mysqli_query($mysqli,"SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_discount = floatval($row['recurring_invoice_discount_amount']); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); @@ -207,7 +207,7 @@ if (isset($_POST['add_recurring_invoice_item'])) { //add up all the items $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id"); $recurring_invoice_amount = 0; - while($row = mysqli_fetch_array($sql)) { + while($row = mysqli_fetch_assoc($sql)) { $item_total = floatval($row['item_total']); $recurring_invoice_amount = $recurring_invoice_amount + $item_total; } @@ -230,7 +230,7 @@ if (isset($_POST['recurring_invoice_note'])) { // Get Recurring details for logging $sql = mysqli_query($mysqli,"SELECT recurring_invoice_prefix, recurring_invoice_number, recurring_invoice_client_id FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $client_id = intval($row['recurring_invoice_client_id']); @@ -250,7 +250,7 @@ if (isset($_GET['delete_recurring_invoice_item'])) { $item_id = intval($_GET['delete_recurring_invoice_item']); $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_id = $item_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_id = intval($row['item_recurring_invoice_id']); $item_name = sanitizeInput($row['item_name']); $item_subtotal = floatval($row['item_subtotal']); @@ -258,7 +258,7 @@ if (isset($_GET['delete_recurring_invoice_item'])) { $item_total = floatval($row['item_total']); $sql = mysqli_query($mysqli,"SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $client_id = intval($row['recurring_invoice_client_id']); @@ -283,7 +283,7 @@ if (isset($_GET['force_recurring'])) { $sql_recurring_invoices = mysqli_query($mysqli,"SELECT * FROM recurring_invoices, clients WHERE client_id = recurring_invoice_client_id AND recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql_recurring_invoices); + $row = mysqli_fetch_assoc($sql_recurring_invoices); $recurring_invoice_id = intval($row['recurring_invoice_id']); $recurring_invoice_scope = sanitizeInput($row['recurring_invoice_scope']); $recurring_invoice_frequency = sanitizeInput($row['recurring_invoice_frequency']); @@ -319,7 +319,7 @@ if (isset($_GET['force_recurring'])) { //Copy Items from original invoice to new invoice $sql_invoice_items = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id ORDER BY item_id ASC"); - while($row = mysqli_fetch_array($sql_invoice_items)) { + while($row = mysqli_fetch_assoc($sql_invoice_items)) { $item_id = intval($row['item_id']); $item_name = sanitizeInput($row['item_name']); $item_description = sanitizeInput($row['item_description']); @@ -332,7 +332,7 @@ if (isset($_GET['force_recurring'])) { //Recalculate Item Tax since Tax percents can change. if ($tax_id > 0) { $sql = mysqli_query($mysqli,"SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $item_tax_amount = $item_subtotal * $tax_percent / 100; } else { @@ -351,7 +351,7 @@ if (isset($_GET['force_recurring'])) { //Update Recurring Balances by tallying up recurring items also update recurring dates $sql_recurring_invoice_total = mysqli_query($mysqli,"SELECT SUM(item_total) AS recurring_invoice_total FROM invoice_items WHERE item_recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql_recurring_invoice_total); + $row = mysqli_fetch_assoc($sql_recurring_invoice_total); $new_recurring_invoice_amount = floatval($row['recurring_invoice_total']) - $recurring_invoice_discount_amount; mysqli_query($mysqli,"UPDATE recurring_invoices SET recurring_invoice_amount = $new_recurring_invoice_amount, recurring_invoice_last_sent = CURDATE(), recurring_invoice_next_date = DATE_ADD(CURDATE(), INTERVAL 1 $recurring_invoice_frequency) WHERE recurring_invoice_id = $recurring_invoice_id"); @@ -365,7 +365,7 @@ if (isset($_GET['force_recurring'])) { LEFT JOIN contacts ON clients.client_id = contacts.contact_client_id AND contact_primary = 1 WHERE invoice_id = $new_invoice_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); @@ -383,7 +383,7 @@ if (isset($_GET['force_recurring'])) { $contact_mobile = sanitizeInput(formatPhoneNumber($row['contact_mobile'], $row['contact_mobile_country_code'])); $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); $company_email = sanitizeInput($row['company_email']); @@ -445,7 +445,7 @@ if (isset($_POST['set_recurring_payment'])) { // Get Recurring Invoice Info for logging and alerting $sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['recurring_invoice_client_id']); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); @@ -461,7 +461,7 @@ if (isset($_POST['set_recurring_payment'])) { WHERE saved_payment_id = $saved_payment_id "); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $provider_id = intval($row['payment_provider_id']); $provider_name = sanitizeInput($row['payment_provider_name']); @@ -495,7 +495,7 @@ if (isset($_POST['export_client_recurring_invoice_csv'])) { //get records from database $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = $row['client_name']; @@ -543,7 +543,7 @@ if (isset($_GET['recurring_invoice_email_notify'])) { $recurring_invoice_id = intval($_GET['recurring_invoice_id']); $sql = mysqli_query($mysqli,"SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $client_id = intval($row['recurring_invoice_client_id']); diff --git a/agent/post/recurring_ticket.php b/agent/post/recurring_ticket.php index 46006a88..61748347 100644 --- a/agent/post/recurring_ticket.php +++ b/agent/post/recurring_ticket.php @@ -77,7 +77,7 @@ if (isset($_POST['bulk_force_recurring_tickets'])) { $sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); if (mysqli_num_rows($sql) > 0) { - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $subject = sanitizeInput($row['recurring_ticket_subject']); $details = mysqli_real_escape_string($mysqli, $row['recurring_ticket_details']); $priority = sanitizeInput($row['recurring_ticket_priority']); @@ -136,7 +136,7 @@ if (isset($_POST['bulk_force_recurring_tickets'])) { LEFT JOIN contacts ON ticket_contact_id = contact_id WHERE ticket_id = $id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -215,7 +215,7 @@ if (isset($_GET['force_recurring_ticket'])) { $sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); if (mysqli_num_rows($sql) > 0) { - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $subject = sanitizeInput($row['recurring_ticket_subject']); $details = mysqli_real_escape_string($mysqli, $row['recurring_ticket_details']); $priority = sanitizeInput($row['recurring_ticket_priority']); @@ -274,7 +274,7 @@ if (isset($_GET['force_recurring_ticket'])) { LEFT JOIN contacts ON ticket_contact_id = contact_id WHERE ticket_id = $id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -352,7 +352,7 @@ if (isset($_GET['delete_recurring_ticket'])) { // Get Scheduled Ticket Subject Ticket Prefix, Number and Client ID for logging and alert message $sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $subject = sanitizeInput($row['recurring_ticket_subject']); $frequency = sanitizeInput($row['recurring_ticket_frequency']); @@ -414,7 +414,7 @@ if (isset($_POST['bulk_assign_recurring_ticket'])) { $recurring_ticket_id = intval($recurring_ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_ticket_name = sanitizeInput($row['recurring_ticket_name']); $recurring_ticket_subject = sanitizeInput($row['recurring_ticket_subject']); @@ -427,7 +427,7 @@ if (isset($_POST['bulk_assign_recurring_ticket'])) { } else { // Get & verify assigned agent details $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assign_to"); - $agent_details = mysqli_fetch_array($agent_details_sql); + $agent_details = mysqli_fetch_assoc($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); $agent_email = sanitizeInput($agent_details['user_email']); @@ -502,7 +502,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_priority'])) { $recurring_ticket_id = intval($recurring_ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_ticket_subject = sanitizeInput($row['recurring_ticket_subject']); $original_recurring_ticket_priority = sanitizeInput($row['recurring_ticket_priority']); @@ -539,7 +539,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_category'])) { $recurring_ticket_id = intval($recurring_ticket_id); $sql = mysqli_query($mysqli, "SELECT recurring_ticket_subject, category_name, recurring_ticket_client_id FROM recurring_tickets LEFT JOIN categories ON recurring_ticket_category = category_id WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_ticket_subject = sanitizeInput($row['recurring_ticket_subject']); $previous_recurring_ticket_category_name = sanitizeInput($row['category_name']); @@ -583,7 +583,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_billable'])) { $recurring_ticket_id = intval($recurring_ticket_id); $sql = mysqli_query($mysqli, "SELECT recurring_ticket_subject, recurring_ticket_client_id FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_ticket_subject = sanitizeInput($row['recurring_ticket_subject']); $previous_recurring_ticket_billable = intval($row['recurring_ticket_billable']); @@ -624,7 +624,7 @@ if (isset($_POST['bulk_edit_recurring_ticket_next_run_date'])) { $recurring_ticket_id = intval($recurring_ticket_id); $sql = mysqli_query($mysqli, "SELECT recurring_ticket_subject, recurring_ticket_client_id FROM recurring_tickets WHERE recurring_ticket_id = $recurring_ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_ticket_subject = sanitizeInput($row['recurring_ticket_subject']); $previous_recurring_ticket_next_run_date = sanitizeInput($row['recurring_ticket_next_run']); diff --git a/agent/post/service.php b/agent/post/service.php index f9371df1..b3523286 100644 --- a/agent/post/service.php +++ b/agent/post/service.php @@ -22,12 +22,12 @@ if (isset($_POST['add_service'])) { mysqli_query($mysqli, "INSERT INTO services SET service_name = '$service_name', service_description = '$service_description', service_category = '$service_category', service_importance = '$service_importance', service_backup = '$service_backup', service_notes = '$service_notes', service_client_id = $client_id"); // Create links to assets - + $service_id = mysqli_insert_id($mysqli); if (isset($_POST['contacts'])) { foreach($_POST['contacts'] as $contact_id) { - $contact_id = intval($contact_id); + $contact_id = intval($contact_id); mysqli_query($mysqli, "INSERT INTO service_contacts SET service_id = $service_id, contact_id = $contact_id"); } } @@ -77,7 +77,7 @@ if (isset($_POST['add_service'])) { logAction("Service", "Create", "$session_name created service $service_name", $client_id, $service_id); flash_alert("Service $service_name created"); - + redirect(); } @@ -160,7 +160,7 @@ if (isset($_POST['edit_service'])) { logAction("Service", "Edit", "$session_name edited service $service_name", $client_id, $service_id); flash_alert("Service $service_name edited"); - + redirect(); } @@ -170,12 +170,12 @@ if (isset($_GET['delete_service'])) { validateCSRFToken($_GET['csrf_token']); enforceUserPermission('module_support', 3); - + $service_id = intval($_GET['delete_service']); // Get Service Details $sql = mysqli_query($mysqli,"SELECT service_name, service_client_id FROM services WHERE service_id = $service_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $service_name = sanitizeInput($row['service_name']); $client_id = intval($row['service_client_id']); @@ -183,9 +183,9 @@ if (isset($_GET['delete_service'])) { mysqli_query($mysqli, "DELETE FROM services WHERE service_id = $service_id"); logAction("Service", "Delete", "$session_name deleted service $service_name", $client_id); - + flash_alert("Service $service_name deleted", 'error'); - + redirect(); } diff --git a/agent/post/software.php b/agent/post/software.php index fdabb21e..7ea5a2ee 100644 --- a/agent/post/software.php +++ b/agent/post/software.php @@ -16,7 +16,7 @@ if (isset($_POST['add_software_from_template'])) { // GET Software Template Info $sql_software_templates = mysqli_query($mysqli,"SELECT * FROM software_templates WHERE software_template_id = $software_template_id"); - $row = mysqli_fetch_array($sql_software_templates); + $row = mysqli_fetch_assoc($sql_software_templates); $name = sanitizeInput($row['software_template_name']); $version = sanitizeInput($row['software_template_version']); $description = sanitizeInput($row['software_template_description']); @@ -164,7 +164,7 @@ if (isset($_GET['archive_software'])) { // Get Software Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT software_name, software_client_id FROM software WHERE software_id = $software_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $software_name = sanitizeInput($row['software_name']); $client_id = intval($row['software_client_id']); @@ -190,7 +190,7 @@ if (isset($_GET['delete_software'])) { // Get Software Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT software_name, software_client_id FROM software WHERE software_id = $software_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $software_name = sanitizeInput($row['software_name']); $client_id = intval($row['software_client_id']); @@ -249,7 +249,7 @@ if (isset($_POST['export_software_csv'])) { ON software_assets.asset_id = assets.asset_id WHERE software_id = $row[software_id]" ); - while($asset_row = mysqli_fetch_array($asset_licenses_sql)) { + while($asset_row = mysqli_fetch_assoc($asset_licenses_sql)) { $assigned_to_assets .= $asset_row['asset_name'] . ", "; } @@ -262,7 +262,7 @@ if (isset($_POST['export_software_csv'])) { WHERE software_id = $row[software_id]" ); - while($contact_row = mysqli_fetch_array($contact_licenses_sql)) { + while($contact_row = mysqli_fetch_assoc($contact_licenses_sql)) { $assigned_to_contacts .= $contact_row['contact_name'] . ", "; } diff --git a/agent/post/task.php b/agent/post/task.php index f59a955d..aac1b68a 100644 --- a/agent/post/task.php +++ b/agent/post/task.php @@ -15,7 +15,7 @@ if (isset($_POST['add_task'])) { // Get Client ID from tickets using the ticket_id $client_id = intval(getFieldById('tickets', $ticket_id, 'ticket_client_id')); - + mysqli_query($mysqli, "INSERT INTO tasks SET task_name = '$task_name', task_ticket_id = $ticket_id"); $task_id = mysqli_insert_id($mysqli); @@ -39,9 +39,9 @@ if (isset($_POST['edit_ticket_task'])) { // Get Client ID $sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); - + mysqli_query($mysqli, "UPDATE tasks SET task_name = '$task_name', task_order = $task_order, task_completion_estimate = $task_completion_estimate WHERE task_id = $task_id"); logAction("Task", "Edit", "$session_name edited task $task_name", $client_id, $task_id); @@ -81,7 +81,7 @@ if (isset($_GET['delete_task'])) { // Get Client ID, task name from tasks and tickets using the task_id $sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $task_name = sanitizeInput($row['task_name']); @@ -103,7 +103,7 @@ if (isset($_GET['complete_task'])) { // Get Client ID $sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $task_name = sanitizeInput($row['task_name']); $task_completion_estimate = intval($row['task_completion_estimate']); @@ -135,7 +135,7 @@ if (isset($_GET['undo_complete_task'])) { // Get Client ID $sql = mysqli_query($mysqli, "SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id WHERE task_id = $task_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $task_name = sanitizeInput($row['task_name']); $ticket_id = intval($row['ticket_id']); @@ -175,7 +175,7 @@ if (isset($_POST['add_ticket_task_approver'])) { $approval_id = mysqli_insert_id($mysqli); // Task/Ticket Info - $tt_row = mysqli_fetch_array(mysqli_query($mysqli, " + $tt_row = mysqli_fetch_assoc(mysqli_query($mysqli, " SELECT * FROM tasks LEFT JOIN tickets ON ticket_id = task_ticket_id LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id @@ -200,7 +200,7 @@ if (isset($_POST['add_ticket_task_approver'])) { $config_base_url = sanitizeInput($config_base_url); // Get Company Info - $crow = mysqli_fetch_array(mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1")); + $crow = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1")); $company_name = sanitizeInput($crow['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($crow['company_phone'], $crow['company_phone_country_code'])); @@ -267,7 +267,7 @@ if (isset($_POST['add_ticket_task_approver'])) { $data = []; - while ($technical_contact = mysqli_fetch_array($sql_technical_contacts)) { + while ($technical_contact = mysqli_fetch_assoc($sql_technical_contacts)) { $technical_contact_name = sanitizeInput($technical_contact['contact_name']); $technical_contact_email = sanitizeInput($technical_contact['contact_email']); @@ -300,7 +300,7 @@ if (isset($_POST['add_ticket_task_approver'])) { $data = []; - while ($billing_contact = mysqli_fetch_array($sql_billing_contacts)) { + while ($billing_contact = mysqli_fetch_assoc($sql_billing_contacts)) { $billing_contact_name = sanitizeInput($billing_contact['contact_name']); $billing_contact_email = sanitizeInput($billing_contact['contact_email']); @@ -336,7 +336,7 @@ if (isset($_GET['approve_ticket_task'])) { $task_id = intval($_GET['approve_task']); $approval_id = intval($_GET['approval_id']); - $approval_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_scope = 'internal'")); + $approval_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_scope = 'internal'")); $task_name = nullable_htmlentities($approval_row['task_name']); $scope = nullable_htmlentities($approval_row['approval_scope']); diff --git a/agent/post/ticket.php b/agent/post/ticket.php index f0b63526..2f7749ed 100644 --- a/agent/post/ticket.php +++ b/agent/post/ticket.php @@ -46,7 +46,7 @@ if (isset($_POST['add_ticket'])) { // Add the primary contact as the ticket contact if "Use primary contact" is checked if ($use_primary_contact == 1) { $sql = mysqli_query($mysqli, "SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_primary = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact = intval($row['contact_id']); } @@ -80,7 +80,7 @@ if (isset($_POST['add_ticket'])) { $sql_task_templates = mysqli_query($mysqli, "SELECT * FROM task_templates WHERE task_template_ticket_template_id = $ticket_template_id"); if (mysqli_num_rows($sql_task_templates) > 0) { - while ($row = mysqli_fetch_array($sql_task_templates)) { + while ($row = mysqli_fetch_assoc($sql_task_templates)) { $task_order = intval($row['task_template_order']); $task_name = sanitizeInput($row['task_template_name']); $task_completion_estimate = intval($row['task_template_completion_estimate']); @@ -114,7 +114,7 @@ if (isset($_POST['add_ticket'])) { LEFT JOIN clients ON ticket_client_id = client_id LEFT JOIN contacts ON ticket_contact_id = contact_id WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -132,7 +132,7 @@ if (isset($_POST['add_ticket'])) { // Get Company Phone Number $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -162,7 +162,7 @@ if (isset($_POST['add_ticket'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU HAVE BEEN ADDED AS A COLLABORATOR FOR THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -244,7 +244,7 @@ if (isset($_POST['edit_ticket'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id AND ticket_closed_at IS NULL"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -263,7 +263,7 @@ if (isset($_POST['edit_ticket'])) { // Get Company Name Phone Number and Sanitize for Email Sending $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -315,7 +315,7 @@ if (isset($_POST['edit_ticket_priority'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $original_priority = sanitizeInput($row['ticket_priority']); @@ -353,7 +353,7 @@ if (isset($_POST['edit_ticket_contact'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); // Original contact $original_contact_name = !empty($row['contact_name']) ? sanitizeInput($row['contact_name']) : 'No one'; @@ -372,7 +372,7 @@ if (isset($_POST['edit_ticket_contact'])) { // Get New contact details $sql = mysqli_query($mysqli, "SELECT contact_name, contact_email FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = !empty($row['contact_name']) ? sanitizeInput($row['contact_name']) : 'No one'; $contact_email = sanitizeInput($row['contact_email']); @@ -382,7 +382,7 @@ if (isset($_POST['edit_ticket_contact'])) { // Get Company Phone Number $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -458,7 +458,7 @@ if (isset($_POST['add_ticket_watcher'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id AND ticket_closed_at IS NULL"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -474,7 +474,7 @@ if (isset($_POST['add_ticket_watcher'])) { // Get Company Phone Number $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -533,7 +533,7 @@ if (isset($_GET['delete_ticket_watcher'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE watcher_id = $watcher_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -568,7 +568,7 @@ if (isset($_GET['delete_ticket_additional_asset'])) { JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE asset_id = $asset_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -617,7 +617,7 @@ if (isset($_POST['edit_ticket_asset'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -648,7 +648,7 @@ if (isset($_POST['edit_ticket_vendor'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -685,7 +685,7 @@ if (isset($_POST['assign_ticket'])) { } else { // Get & verify assigned agent details $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users WHERE users.user_id = $assigned_to"); - $agent_details = mysqli_fetch_array($agent_details_sql); + $agent_details = mysqli_fetch_assoc($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); $agent_email = sanitizeInput($agent_details['user_email']); @@ -699,7 +699,7 @@ if (isset($_POST['assign_ticket'])) { // Get & verify ticket details $ticket_details_sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_client_id, client_name FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = '$ticket_id' AND ticket_status != 5"); - $ticket_details = mysqli_fetch_array($ticket_details_sql); + $ticket_details = mysqli_fetch_assoc($ticket_details_sql); $ticket_prefix = sanitizeInput($ticket_details['ticket_prefix']); $ticket_number = intval($ticket_details['ticket_number']); @@ -771,7 +771,7 @@ if (isset($_GET['delete_ticket'])) { // Get Ticket and Client ID for logging and alert message $sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, ticket_status, ticket_closed_at, ticket_client_id FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = sanitizeInput($row['ticket_number']); $ticket_subject = sanitizeInput($row['ticket_subject']); @@ -868,7 +868,7 @@ if (isset($_POST['bulk_assign_ticket'])) { $ticket_id = intval($ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -888,7 +888,7 @@ if (isset($_POST['bulk_assign_ticket'])) { } else { // Get & verify assigned agent details $agent_details_sql = mysqli_query($mysqli, "SELECT user_name, user_email FROM users LEFT JOIN user_settings ON users.user_id = user_settings.user_id WHERE users.user_id = $assign_to"); - $agent_details = mysqli_fetch_array($agent_details_sql); + $agent_details = mysqli_fetch_assoc($agent_details_sql); $agent_name = sanitizeInput($agent_details['user_name']); $agent_email = sanitizeInput($agent_details['user_email']); @@ -969,7 +969,7 @@ if (isset($_POST['bulk_edit_ticket_priority'])) { $ticket_id = intval($ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1013,7 +1013,7 @@ if (isset($_POST['bulk_edit_ticket_category'])) { $ticket_id = intval($ticket_id); $sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_subject, category_name, ticket_client_id FROM tickets LEFT JOIN categories ON ticket_category = category_id WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1056,7 +1056,7 @@ if (isset($_POST['bulk_merge_tickets'])) { flash_alert("Cannot merge into that ticket.", 'error'); redirect(); } - $merge_row = mysqli_fetch_array($sql); + $merge_row = mysqli_fetch_assoc($sql); $merge_into_ticket_id = intval($merge_row['ticket_id']); // Parent ticket ID // Update & Close the selected tickets @@ -1070,7 +1070,7 @@ if (isset($_POST['bulk_merge_tickets'])) { if ($ticket_id !== $merge_into_ticket_id) { $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1141,7 +1141,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { $ticket_count++; $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1173,7 +1173,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { LEFT JOIN contacts ON ticket_contact_id = contact_id WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($ticket_sql); + $row = mysqli_fetch_assoc($ticket_sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -1185,7 +1185,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { // Get Company Info $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -1214,7 +1214,7 @@ if (isset($_POST['bulk_resolve_tickets'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -1270,7 +1270,7 @@ if (isset($_POST['bulk_ticket_reply'])) { $ticket_id = intval($ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1321,7 +1321,7 @@ if (isset($_POST['bulk_ticket_reply'])) { WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -1334,7 +1334,7 @@ if (isset($_POST['bulk_ticket_reply'])) { $base_url = sanitizeInput($config_base_url); $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -1364,7 +1364,7 @@ if (isset($_POST['bulk_ticket_reply'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -1412,7 +1412,7 @@ if (isset($_POST['bulk_add_ticket_project'])) { // Get Project Name $sql = mysqli_query($mysqli, "SELECT project_name FROM projects WHERE project_id = $project_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $project_name = sanitizeInput($row['project_name']); // Assign Project to Selected Tickets @@ -1425,7 +1425,7 @@ if (isset($_POST['bulk_add_ticket_project'])) { $ticket_id = intval($ticket_id); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -1473,7 +1473,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { // Check to see if adding a ticket by template if($ticket_template_id) { $sql = mysqli_query($mysqli, "SELECT * FROM ticket_templates WHERE ticket_template_id = $ticket_template_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); // Override Template Subject if(empty($subject)) { @@ -1496,7 +1496,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { $asset_id = intval($asset_id); $sql = mysqli_query($mysqli, "SELECT * FROM assets WHERE asset_id = $asset_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $asset_name = sanitizeInput($row['asset_name']); $client_id = intval($row['asset_client_id']); @@ -1541,7 +1541,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { // Add Tasks from Template if Template was selected if($ticket_template_id) { if (mysqli_num_rows($sql_task_templates) > 0) { - while ($row = mysqli_fetch_array($sql_task_templates)) { + while ($row = mysqli_fetch_assoc($sql_task_templates)) { $task_order = intval($row['task_template_order']); $task_name = sanitizeInput($row['task_template_name']); @@ -1624,7 +1624,7 @@ if (isset($_POST['add_ticket_reply'])) { WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($ticket_sql); + $row = mysqli_fetch_assoc($ticket_sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -1645,7 +1645,7 @@ if (isset($_POST['add_ticket_reply'])) { $config_base_url = sanitizeInput($config_base_url); $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -1683,7 +1683,7 @@ if (isset($_POST['add_ticket_reply'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -1808,7 +1808,7 @@ if (isset($_POST['merge_ticket'])) { redirect(); } // CURRENT ticket details - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_subject = sanitizeInput($row['ticket_subject']); @@ -1822,7 +1822,7 @@ if (isset($_POST['merge_ticket'])) { flash_alert("Cannot merge into that ticket.", 'error'); redirect(); } - $merge_row = mysqli_fetch_array($sql); + $merge_row = mysqli_fetch_assoc($sql); $merge_into_ticket_id = intval($merge_row['ticket_id']); $client_id = intval($merge_row['ticket_client_id']); if ($client_id) { @@ -1898,7 +1898,7 @@ if (isset($_GET['resolve_ticket'])) { $ticket_id = intval($_GET['resolve_ticket']); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $ticket_first_response_at = sanitizeInput($row['ticket_first_response_at']); @@ -1925,7 +1925,7 @@ if (isset($_GET['resolve_ticket'])) { LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($ticket_sql); + $row = mysqli_fetch_assoc($ticket_sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -1944,7 +1944,7 @@ if (isset($_GET['resolve_ticket'])) { // Get Company Info $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -1973,7 +1973,7 @@ if (isset($_GET['resolve_ticket'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -2021,7 +2021,7 @@ if (isset($_GET['close_ticket'])) { LEFT JOIN contacts ON ticket_contact_id = contact_id WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($ticket_sql); + $row = mysqli_fetch_assoc($ticket_sql); $contact_name = sanitizeInput($row['contact_name']); $contact_email = sanitizeInput($row['contact_email']); @@ -2037,7 +2037,7 @@ if (isset($_GET['close_ticket'])) { // Get Company Info $sql = mysqli_query($mysqli, "SELECT company_name, company_phone, company_phone_country_code FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -2066,7 +2066,7 @@ if (isset($_GET['close_ticket'])) { // Also Email all the watchers $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); $body .= "

----------------------------------------
YOU ARE A COLLABORATOR ON THIS TICKET"; - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); // Queue Mail @@ -2128,7 +2128,7 @@ if (isset($_POST['add_invoice_from_ticket'])) { WHERE ticket_id = $ticket_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['client_id']); $client_net_terms = intval($row['client_net_terms']); if ($client_net_terms == 0) { @@ -2173,7 +2173,7 @@ if (isset($_POST['add_invoice_from_ticket'])) { $invoice_id = mysqli_insert_id($mysqli); } else { $sql_invoice = mysqli_query($mysqli, "SELECT invoice_prefix, invoice_number FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql_invoice); + $row = mysqli_fetch_assoc($sql_invoice); $invoice_prefix = sanitizeInput($row['invoice_prefix']); $invoice_number = intval($row['invoice_number']); } @@ -2189,7 +2189,7 @@ if (isset($_POST['add_invoice_from_ticket'])) { if ($tax_id > 0) { $sql = mysqli_query($mysqli, "SELECT * FROM taxes WHERE tax_id = $tax_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $tax_percent = floatval($row['tax_percent']); $tax_amount = $subtotal * $tax_percent / 100; } else { @@ -2203,7 +2203,7 @@ if (isset($_POST['add_invoice_from_ticket'])) { //Update Invoice Balances $sql = mysqli_query($mysqli, "SELECT * FROM invoices WHERE invoice_id = $invoice_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $new_invoice_amount = floatval($row['invoice_amount']) + $total; @@ -2292,7 +2292,7 @@ if (isset($_POST['edit_ticket_billable_status'])) { // Get ticket details for logging $sql = mysqli_query($mysqli, "SELECT ticket_prefix, ticket_number, ticket_client_id FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); $client_id = intval($row['ticket_client_id']); @@ -2331,7 +2331,7 @@ if (isset($_POST['edit_ticket_schedule'])) { $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_schedule BETWEEN '$start' AND '$end' AND ticket_id != $ticket_id"); if (mysqli_num_rows($sql) > 0) { $conflicting_tickets = []; - while ($row = mysqli_fetch_array($sql)) { + while ($row = mysqli_fetch_assoc($sql)) { $conflicting_tickets[] = $row['ticket_id'] . " - " . $row['ticket_subject'] . " @ " . $row['ticket_schedule']; } } @@ -2343,7 +2343,7 @@ if (isset($_POST['edit_ticket_schedule'])) { WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $client_name = sanitizeInput($row['client_name']); @@ -2416,7 +2416,7 @@ if (isset($_POST['edit_ticket_schedule'])) { // Notify the watchers of the scheduled work $sql_watchers = mysqli_query($mysqli, "SELECT watcher_email FROM ticket_watchers WHERE watcher_ticket_id = $ticket_id"); - while ($row = mysqli_fetch_array($sql_watchers)) { + while ($row = mysqli_fetch_assoc($sql_watchers)) { $watcher_email = sanitizeInput($row['watcher_email']); $data[] = [ 'from' => $config_ticket_from_email, @@ -2480,7 +2480,7 @@ if (isset($_GET['cancel_ticket_schedule'])) { $ticket_id = intval($_GET['cancel_ticket_schedule']); $sql = mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $ticket_prefix = sanitizeInput($row['ticket_prefix']); @@ -2508,7 +2508,7 @@ if (isset($_GET['cancel_ticket_schedule'])) { LEFT JOIN users ON ticket_assigned_to = user_id WHERE ticket_id = $ticket_id "); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_id = intval($row['ticket_client_id']); $client_name = sanitizeInput($row['client_name']); diff --git a/agent/post/transfer.php b/agent/post/transfer.php index 21a27dcf..2915f543 100644 --- a/agent/post/transfer.php +++ b/agent/post/transfer.php @@ -14,13 +14,13 @@ if (isset($_POST['add_transfer'])) { // Get Source Account Name for logging $sql = mysqli_query($mysqli,"SELECT account_name, account_currency_code FROM accounts WHERE account_id = $account_from"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $source_account_name = sanitizeInput($row['account_name']); $account_currency_code = sanitizeInput($row['account_currency_code']); // Get Destination Account Name for logging $sql = mysqli_query($mysqli,"SELECT account_name FROM accounts WHERE account_id = $account_to"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $destination_account_name = sanitizeInput($row['account_name']); mysqli_query($mysqli,"INSERT INTO expenses SET expense_date = '$date', expense_amount = $amount, expense_currency_code = '$session_company_currency', expense_vendor_id = 0, expense_category_id = 0, expense_account_id = $account_from"); @@ -72,7 +72,7 @@ if (isset($_GET['delete_transfer'])) { $transfer_id = intval($_GET['delete_transfer']); // Query the transfer ID to get the Payment and Expense IDs, so we can delete those as well - $row = mysqli_fetch_array(mysqli_query($mysqli,"SELECT * FROM transfers WHERE transfer_id = $transfer_id")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli,"SELECT * FROM transfers WHERE transfer_id = $transfer_id")); $expense_id = intval($row['transfer_expense_id']); $revenue_id = intval($row['transfer_revenue_id']); diff --git a/agent/post/vendor.php b/agent/post/vendor.php index fde7f224..4792cf84 100644 --- a/agent/post/vendor.php +++ b/agent/post/vendor.php @@ -15,7 +15,7 @@ if (isset($_POST['add_vendor_from_template'])) { //GET Vendor Info $sql_vendor_templates = mysqli_query($mysqli,"SELECT * FROM vendor_templates WHERE vendor_template_id = $vendor_template_id"); - $row = mysqli_fetch_array($sql_vendor_templates); + $row = mysqli_fetch_assoc($sql_vendor_templates); $name = sanitizeInput($row['vendor_template_name']); $description = sanitizeInput($row['vendor_template_description']); @@ -90,7 +90,7 @@ if (isset($_GET['archive_vendor'])) { //Get Vendor Name $sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); @@ -110,7 +110,7 @@ if(isset($_GET['unarchive_vendor'])){ // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT vendor_name, vendor_client_id FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); @@ -130,7 +130,7 @@ if (isset($_GET['delete_vendor'])) { //Get Vendor Name $sql = mysqli_query($mysqli,"SELECT * FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); $vendor_template_id = intval($row['vendor_template_id']); @@ -168,7 +168,7 @@ if (isset($_POST['bulk_archive_vendors'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT vendor_name, vendor_client_id FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); @@ -205,7 +205,7 @@ if (isset($_POST['bulk_unarchive_vendors'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT vendor_name, vendor_client_id FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); @@ -243,7 +243,7 @@ if (isset($_POST['bulk_delete_vendors'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT vendor_name, vendor_client_id, vendor_template_id FROM vendors WHERE vendor_id = $vendor_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_name = sanitizeInput($row['vendor_name']); $client_id = intval($row['vendor_client_id']); $vendor_template_id = intval($row['vendor_template_id']); diff --git a/agent/post/vendor_contact.php b/agent/post/vendor_contact.php index 2d2b6d1a..c580c65f 100644 --- a/agent/post/vendor_contact.php +++ b/agent/post/vendor_contact.php @@ -50,7 +50,7 @@ if (isset($_POST['bulk_archive_vendor_contacts'])) { //validateCSRFToken($_POST['csrf_token']); - enforceUserPermission('module_client', 2); + enforceUserPermission('module_client', 2); if (isset($_POST['vendor_contact_ids'])) { @@ -63,7 +63,7 @@ if (isset($_POST['bulk_archive_vendor_contacts'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT vendor_contact_name, vendor_contact_client_id FROM vendor_contacts WHERE vendor_contact_id = $vendor_contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $vendor_contact_name = sanitizeInput($row['vendor_contact_name']); $client_id = intval($row['contact_client_id']); @@ -84,7 +84,7 @@ if (isset($_POST['bulk_unarchive_vendor_contacts'])) { //validateCSRFToken($_POST['csrf_token']); enforceUserPermission('module_client', 2); - + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count @@ -97,7 +97,7 @@ if (isset($_POST['bulk_unarchive_vendor_contacts'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -128,7 +128,7 @@ if (isset($_POST['bulk_delete_vendor_contacts'])) { validateCSRFToken($_POST['csrf_token']); enforceUserPermission('module_client', 3); - + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count @@ -141,7 +141,7 @@ if (isset($_POST['bulk_delete_vendor_contacts'])) { // Get Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -184,7 +184,7 @@ if (isset($_GET['archive_vendor_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -195,7 +195,7 @@ if (isset($_GET['archive_vendor_contact'])) { } mysqli_query($mysqli,"UPDATE contacts SET contact_important = 0, contact_billing = 0, contact_technical = 0, contact_archived_at = NOW() WHERE contact_id = $contact_id"); - + logAction("Contact", "Archive", "$session_name archived contact $contact_name", $client_id, $contact_id); flash_alert("Contact $contact_name has been archived", 'alert'); @@ -212,7 +212,7 @@ if (isset($_GET['unarchive_vendor_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id, contact_user_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -240,7 +240,7 @@ if (isset($_GET['delete_vendor_contact'])) { // Get Contact Name and Client ID for logging and alert message $sql = mysqli_query($mysqli,"SELECT contact_name, contact_client_id FROM contacts WHERE contact_id = $contact_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_name = sanitizeInput($row['contact_name']); $client_id = intval($row['contact_client_id']); $contact_user_id = intval($row['contact_user_id']); @@ -276,7 +276,7 @@ if (isset($_POST['export_vendor_contacts_csv'])) { //get records from database $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = $row['client_name']; @@ -409,7 +409,7 @@ if (isset($_POST["import_vendor_contacts_csv"])) { logAction("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'); - + redirect(); } //Check for any errors, if there are notify user and redirect @@ -420,12 +420,12 @@ if (isset($_POST["import_vendor_contacts_csv"])) { } if (isset($_GET['download_vendor_contacts_csv_template'])) { - + $client_id = intval($_GET['download_client_contacts_csv_template']); //get records from database $sql = mysqli_query($mysqli,"SELECT client_name FROM clients WHERE client_id = $client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $client_name = $row['client_name']; diff --git a/agent/products.php b/agent/products.php index f9dae1d8..eb131867 100644 --- a/agent/products.php +++ b/agent/products.php @@ -93,7 +93,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -220,7 +220,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); Bulk Action (0)
- "> + "> ">
Add to Invoice
0) { ?> - " + " class="btn btn-sm btn-dark mb-2" title="Dismiss All"> @@ -123,7 +123,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
0) { - while ($row = mysqli_fetch_array($products_sql)) { + while ($row = mysqli_fetch_assoc($products_sql)) { $products[] = $row; } $json_products = json_encode($products); @@ -309,7 +309,7 @@ if (isset($_GET['quote_id'])) { $total_tax = 0.00; $sub_total = 0.00; - while ($row = mysqli_fetch_array($sql_items)) { + while ($row = mysqli_fetch_assoc($sql_items)) { $item_id = intval($row['item_id']); $item_name = nullable_htmlentities($row['item_name']); $item_description = nullable_htmlentities($row['item_description']); @@ -371,7 +371,7 @@ if (isset($_GET['quote_id'])) { "> @@ -394,7 +394,7 @@ if (isset($_GET['quote_id'])) {
- "> Archived @@ -61,9 +61,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- +

U

- +
- = 1; $i--) { - + // Find all devices that occupy the current unit $i $unit_devices = []; foreach ($rack_units_data as $unit_data) { $start = (int) $unit_data['unit_start_number']; $end = (int) $unit_data['unit_end_number']; - + // If $i is between start and end, device occupies this unit if ($i >= $start && $i <= $end) { $unit_devices[] = [ @@ -246,13 +246,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?> - + - + 0) { - while ($row = mysqli_fetch_array($products_sql)) { + while ($row = mysqli_fetch_assoc($products_sql)) { $products[] = $row; } $json_products = json_encode($products); @@ -158,7 +158,7 @@ if (isset($_GET['recurring_invoice_id'])) { "; echo ""; } - + // Displaying the monthly totals row echo ""; $grandTotal = 0; @@ -104,4 +104,4 @@ $monthlyTotals = array_fill(1, 12, 0); // Initialize monthly totals for each mo \ No newline at end of file + ?> diff --git a/agent/reports/clients_with_balance.php b/agent/reports/clients_with_balance.php index 29ac13f8..b605c126 100644 --- a/agent/reports/clients_with_balance.php +++ b/agent/reports/clients_with_balance.php @@ -17,38 +17,38 @@ enforceUserPermission('module_financial'); 0 ORDER BY balance DESC "); ?> - +
- - @@ -261,7 +261,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); } ?> @@ -293,7 +293,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - + - + diff --git a/agent/recurring_expenses.php b/agent/recurring_expenses.php index ef867adb..3568ccd5 100644 --- a/agent/recurring_expenses.php +++ b/agent/recurring_expenses.php @@ -117,7 +117,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
" . $categoryTotal . "
Total
@@ -59,7 +59,7 @@ enforceUserPermission('module_financial');
@@ -82,4 +82,3 @@ enforceUserPermission('module_financial'); 599 - ORDER BY + ORDER BY amount_paid DESC "); @@ -52,7 +52,7 @@ $sql_vendor_expenses = mysqli_query($mysqli, " @@ -74,7 +74,7 @@ $sql_vendor_expenses = mysqli_query($mysqli, " @@ -85,7 +85,7 @@ $sql_vendor_expenses = mysqli_query($mysqli, " diff --git a/agent/reports/expense_summary.php b/agent/reports/expense_summary.php index a127eb64..85adc08b 100644 --- a/agent/reports/expense_summary.php +++ b/agent/reports/expense_summary.php @@ -35,7 +35,7 @@ $largest_expense_month = 0;
- @@ -71,7 +71,7 @@ $largest_income_month = 0; - @@ -81,12 +81,12 @@ $largest_income_month = 0; for ($month = 1; $month <= 12; $month++) { // Payments to Invoices $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_category_id = $category_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month"); - $row2 = mysqli_fetch_array($sql_payments); + $row2 = mysqli_fetch_assoc($sql_payments); $payment_amount_for_month = floatval($row2['payment_amount_for_month']); // Revenues $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id = $category_id AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month"); - $row3 = mysqli_fetch_array($sql_revenues); + $row3 = mysqli_fetch_assoc($sql_revenues); $revenues_amount_for_month = floatval($row3['revenue_amount_for_month']); $payment_amount_for_month = $payment_amount_for_month + $revenues_amount_for_month; @@ -104,11 +104,11 @@ $largest_income_month = 0; $grand_total_all_months = 0; for ($month = 1; $month <= 12; $month++) { $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_total_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month"); - $row4 = mysqli_fetch_array($sql_payments); + $row4 = mysqli_fetch_assoc($sql_payments); $payment_total_amount_for_month = floatval($row4['payment_total_amount_for_month']); $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month"); - $row5 = mysqli_fetch_array($sql_revenues); + $row5 = mysqli_fetch_assoc($sql_revenues); $revenues_total_amount_for_month = floatval($row5['revenue_amount_for_month']); $payment_total_amount_for_month += $revenues_total_amount_for_month; @@ -154,11 +154,11 @@ $largest_income_month = 0; // Build series and track the largest month for axis max for ($month = 1; $month <= 12; $month++) { $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS payment_amount_for_month FROM payments, invoices WHERE payment_invoice_id = invoice_id AND YEAR(payment_date) = $year AND MONTH(payment_date) = $month"); - $r1 = mysqli_fetch_array($sql_payments); + $r1 = mysqli_fetch_assoc($sql_payments); $payments_for_month = floatval($r1['payment_amount_for_month']); $sql_revenues = mysqli_query($mysqli, "SELECT SUM(revenue_amount) AS revenue_amount_for_month FROM revenues WHERE revenue_category_id > 0 AND YEAR(revenue_date) = $year AND MONTH(revenue_date) = $month"); - $r2 = mysqli_fetch_array($sql_revenues); + $r2 = mysqli_fetch_assoc($sql_revenues); $revenues_for_month = floatval($r2['revenue_amount_for_month']); $income_for_month = $payments_for_month + $revenues_for_month; diff --git a/agent/reports/profit_loss.php b/agent/reports/profit_loss.php index f250614f..f04817cf 100644 --- a/agent/reports/profit_loss.php +++ b/agent/reports/profit_loss.php @@ -36,7 +36,7 @@ $sql_categories_expense = mysqli_query($mysqli, "SELECT * FROM categories WHERE @@ -116,33 +116,33 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients 0 || $ticket_resolved_count > 0) { @@ -162,7 +162,7 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients $avg_time_to_respond = '-'; $count = 0; $total = 0; - while ($row = mysqli_fetch_array($sql_tickets_respond)) { + while ($row = mysqli_fetch_assoc($sql_tickets_respond)) { if (!empty($row['ticket_first_response_at'])) { $openedTime = new DateTime($row['ticket_created_at']); $respondTime = new DateTime($row['ticket_first_response_at']); @@ -179,7 +179,7 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients if ($ticket_resolved_count > 0) { $count = 0; $total = 0; - while ($row = mysqli_fetch_array($sql_tickets_resolved)) { + while ($row = mysqli_fetch_assoc($sql_tickets_resolved)) { $openedTime = new DateTime($row['ticket_created_at']); $resolvedTime = new DateTime($row['ticket_resolved_at']); @@ -238,33 +238,33 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients 0 || $ticket_resolved_count > 0) { @@ -284,7 +284,7 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients $avg_time_to_respond = '-'; $count = 0; $total = 0; - while ($row = mysqli_fetch_array($sql_tickets_respond)) { + while ($row = mysqli_fetch_assoc($sql_tickets_respond)) { if (!empty($row['ticket_first_response_at'])) { $openedTime = new DateTime($row['ticket_created_at']); $respondTime = new DateTime($row['ticket_first_response_at']); @@ -301,7 +301,7 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients if ($ticket_resolved_count > 0) { $count = 0; $total = 0; - while ($row = mysqli_fetch_array($sql_tickets_resolved)) { + while ($row = mysqli_fetch_assoc($sql_tickets_resolved)) { $openedTime = new DateTime($row['ticket_created_at']); $resolvedTime = new DateTime($row['ticket_resolved_at']); @@ -340,4 +340,3 @@ $sql_clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients @@ -87,7 +87,7 @@ $rows = 0; 0) { @@ -179,4 +179,3 @@ $rows = 0; @@ -378,7 +378,7 @@ $sql_categories_filter = mysqli_query( @@ -398,7 +398,7 @@ $sql_categories_filter = mysqli_query( @@ -104,7 +104,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -160,7 +160,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); MFA Enforcement | - - + @@ -66,14 +66,14 @@ $data = "otpauth://totp/ITFlow:$session_email?secret=$token";
@@ -181,7 +181,7 @@ if (isset($_GET['vendor_id'])) { 0) { $return_arr['count'] = mysqli_num_rows($sql); $row = array(); - while ($row = mysqli_fetch_array($sql)) { + while ($row = mysqli_fetch_assoc($sql)) { $row['credential_username'] = apiDecryptCredentialEntry($row['credential_username'], $api_key_decrypt_hash, $api_key_decrypt_password); $row['credential_password'] = apiDecryptCredentialEntry($row['credential_password'], $api_key_decrypt_hash, $api_key_decrypt_password); $return_arr['data'][] = $row; diff --git a/api/v1/read_output.php b/api/v1/read_output.php index 97162ace..b3dcaa64 100644 --- a/api/v1/read_output.php +++ b/api/v1/read_output.php @@ -11,7 +11,7 @@ if ($sql && mysqli_num_rows($sql) > 0) { $return_arr['count'] = mysqli_num_rows($sql); $row = array(); - while ($row = mysqli_fetch_array($sql)) { + while ($row = mysqli_fetch_assoc($sql)) { $return_arr['data'][] = $row; } diff --git a/api/v1/tickets/create.php b/api/v1/tickets/create.php index 9339003b..a2e32a0e 100644 --- a/api/v1/tickets/create.php +++ b/api/v1/tickets/create.php @@ -8,7 +8,7 @@ require_once '../require_post_method.php'; require_once "../../../includes/load_global_settings.php"; $sql = mysqli_query($mysqli, "SELECT company_name, company_phone FROM companies WHERE company_id = 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $company_name = $row['company_name']; $company_phone = formatPhoneNumber($row['company_phone']); @@ -28,7 +28,7 @@ if (!empty($subject)) { // If no contact is selected automatically choose the primary contact for the client (if client set) if ($contact == 0 && $client_id != 0) { $sql = mysqli_query($mysqli,"SELECT contact_id FROM contacts WHERE contact_client_id = $client_id AND contact_primary = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact = intval($row['contact_id']); } diff --git a/api/v1/validate_api_key.php b/api/v1/validate_api_key.php index b37821ab..80b52e71 100644 --- a/api/v1/validate_api_key.php +++ b/api/v1/validate_api_key.php @@ -91,7 +91,7 @@ if (isset($api_key)) { // SUCCESS // Set client ID, company ID & key name - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $api_key_name = htmlentities($row['api_key_name']); $api_key_decrypt_hash = $row['api_key_decrypt_hash']; // No sanitization $client_id = intval($row['api_key_client_id']); diff --git a/client/assets.php b/client/assets.php index e67b09b2..5f38ec64 100644 --- a/client/assets.php +++ b/client/assets.php @@ -43,7 +43,7 @@ $assets_sql = mysqli_query($mysqli, "SELECT * FROM assets LEFT JOIN contacts ON 0) { - $file_row = mysqli_fetch_array($sql_files); + $file_row = mysqli_fetch_assoc($sql_files); $file_id = intval($file_row['file_id']); $file_name = nullable_htmlentities($file_row['file_name']); $file_reference_name = nullable_htmlentities($file_row['file_reference_name']); @@ -81,9 +81,9 @@ if (mysqli_num_rows($sql_files) > 0) { $file_size = intval($file_row['file_size']); $file_mime_type = nullable_htmlentities($file_row['file_mime_type']); $file_size_formatted = formatBytes($file_size); - + $file_path = "../uploads/clients/$session_client_id/$file_reference_name"; - + // For PDF files, display them inline if ($file_ext == 'pdf') { ?> @@ -185,7 +185,7 @@ if (mysqli_num_rows($sql_files) > 0) {
diff --git a/client/documents.php b/client/documents.php index e98ae29d..1ab42840 100644 --- a/client/documents.php +++ b/client/documents.php @@ -45,7 +45,7 @@ $documents_sql = mysqli_query($mysqli, "SELECT document_id, document_name, docum - Supported formats: PDF, Word documents, text files
diff --git a/client/domains.php b/client/domains.php index 3beac65f..15417732 100644 --- a/client/domains.php +++ b/client/domains.php @@ -31,7 +31,7 @@ $domains_sql = mysqli_query($mysqli, "SELECT domain_id, domain_name, domain_expi 1024 && $i < count($units) - 1; $i++) { $bytes /= 1024; } - + return round($bytes, $precision) . ' ' . $units[$i]; } diff --git a/client/includes/check_login.php b/client/includes/check_login.php index 3e5adb94..5d73e4e8 100644 --- a/client/includes/check_login.php +++ b/client/includes/check_login.php @@ -42,7 +42,7 @@ $session_user_id = intval($_SESSION['user_id']); // Get company info from database $sql = mysqli_query($mysqli, "SELECT * FROM companies WHERE company_id = 1"); -$row = mysqli_fetch_array($sql); +$row = mysqli_fetch_assoc($sql); $session_company_name = $row['company_name']; $session_company_country = $row['company_country']; @@ -53,7 +53,7 @@ $session_company_logo = $row['company_logo']; // Get contact info $contact_sql = mysqli_query($mysqli, "SELECT * FROM contacts WHERE contact_id = $session_contact_id AND contact_client_id = $session_client_id"); -$contact = mysqli_fetch_array($contact_sql); +$contact = mysqli_fetch_assoc($contact_sql); $session_contact_name = sanitizeInput($contact['contact_name']); $session_contact_initials = initials($session_contact_name); @@ -74,6 +74,6 @@ if ($contact['contact_billing'] == 1) { // Get client info $client_sql = mysqli_query($mysqli, "SELECT * FROM clients WHERE client_id = $session_client_id"); -$client = mysqli_fetch_array($client_sql); +$client = mysqli_fetch_assoc($client_sql); $session_client_name = $client['client_name']; diff --git a/client/includes/header.php b/client/includes/header.php index 6b8ff41c..05a841ce 100644 --- a/client/includes/header.php +++ b/client/includes/header.php @@ -84,7 +84,7 @@ header("X-Frame-Options: DENY"); // Legacy ORDER BY custom_link_order ASC, custom_link_name ASC" ); - while ($row = mysqli_fetch_array($sql_custom_links)) { + while ($row = mysqli_fetch_assoc($sql_custom_links)) { $custom_link_name = nullable_htmlentities($row['custom_link_name']); $custom_link_uri = nullable_htmlentities($row['custom_link_uri']); $custom_link_new_tab = intval($row['custom_link_new_tab']); diff --git a/client/index.php b/client/index.php index 36a27407..576d34e1 100644 --- a/client/index.php +++ b/client/index.php @@ -11,12 +11,12 @@ require_once "includes/inc_all.php"; // Billing Card Queries //Add up all the payments for the invoice and get the total amount paid to the invoice $sql_invoice_amounts = mysqli_query($mysqli, "SELECT SUM(invoice_amount) AS invoice_amounts FROM invoices WHERE invoice_client_id = $session_client_id AND invoice_status != 'Draft' AND invoice_status != 'Cancelled' AND invoice_status != 'Non-Billable'"); -$row = mysqli_fetch_array($sql_invoice_amounts); +$row = mysqli_fetch_assoc($sql_invoice_amounts); $invoice_amounts = floatval($row['invoice_amounts']); $sql_amount_paid = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS amount_paid FROM payments, invoices WHERE payment_invoice_id = invoice_id AND invoice_client_id = $session_client_id"); -$row = mysqli_fetch_array($sql_amount_paid); +$row = mysqli_fetch_assoc($sql_amount_paid); $amount_paid = floatval($row['amount_paid']); @@ -24,13 +24,13 @@ $balance = $invoice_amounts - $amount_paid; //Get Monthly Recurring Total $sql_recurring_monthly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_monthly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'month' AND recurring_invoice_client_id = $session_client_id"); -$row = mysqli_fetch_array($sql_recurring_monthly_total); +$row = mysqli_fetch_assoc($sql_recurring_monthly_total); $recurring_monthly_total = floatval($row['recurring_monthly_total']); //Get Yearly Recurring Total $sql_recurring_yearly_total = mysqli_query($mysqli, "SELECT SUM(recurring_invoice_amount) AS recurring_yearly_total FROM recurring_invoices WHERE recurring_invoice_status = 1 AND recurring_invoice_frequency = 'year' AND recurring_invoice_client_id = $session_client_id"); -$row = mysqli_fetch_array($sql_recurring_yearly_total); +$row = mysqli_fetch_assoc($sql_recurring_yearly_total); $recurring_yearly_total = floatval($row['recurring_yearly_total']) / 12; @@ -226,7 +226,7 @@ if ($session_contact_primary == 1 || $session_contact_is_technical_contact) {
diff --git a/client/post.php b/client/post.php index 1a315915..23eb4723 100644 --- a/client/post.php +++ b/client/post.php @@ -104,7 +104,7 @@ if (isset($_POST['add_ticket_comment'])) { // Get ticket details & Notify the assigned tech (if any) - $ticket_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = $ticket_id LIMIT 1")); + $ticket_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets LEFT JOIN clients ON ticket_client_id = client_id WHERE ticket_id = $ticket_id LIMIT 1")); $ticket_number = intval($ticket_details['ticket_number']); $ticket_assigned_to = intval($ticket_details['ticket_assigned_to']); @@ -114,7 +114,7 @@ if (isset($_POST['add_ticket_comment'])) { if ($ticket_details && $ticket_assigned_to !== 0) { // Get tech details - $tech_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT user_email, user_name FROM users WHERE user_id = $ticket_assigned_to LIMIT 1")); + $tech_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT user_email, user_name FROM users WHERE user_id = $ticket_assigned_to LIMIT 1")); $tech_email = sanitizeInput($tech_details['user_email']); $tech_name = sanitizeInput($tech_details['user_name']); @@ -191,7 +191,7 @@ if (isset($_GET['approve_ticket_task'])) { $approval_id = intval($_GET['approval_id']); $url_key = sanitizeInput($_GET['approval_url_key']); - $approval_row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_url_key = '$url_key' AND approval_status = 'pending' AND approval_scope = 'client'")); + $approval_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM task_approvals LEFT JOIN tasks on task_id = approval_task_id WHERE approval_id = $approval_id AND approval_task_id = $task_id AND approval_url_key = '$url_key' AND approval_status = 'pending' AND approval_scope = 'client'")); $task_name = nullable_htmlentities($approval_row['task_name']); $scope = nullable_htmlentities($approval_row['approval_scope']); @@ -235,7 +235,7 @@ if (isset($_POST['add_ticket_feedback'])) { // Notify on bad feedback if ($feedback == "Bad") { - $ticket_details = mysqli_fetch_array(mysqli_query($mysqli, "SELECT ticket_number FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); + $ticket_details = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_number FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); $ticket_number = intval($ticket_details['ticket_number']); appNotify("Feedback", "$session_contact_name rated ticket $config_ticket_prefix$ticket_number as bad (ID: $ticket_id)", "/agent/ticket.php?ticket_id=$ticket_id", $session_client_id, $ticket_id); } @@ -257,7 +257,7 @@ if (isset($_GET['resolve_ticket'])) { $ticket_id = intval($_GET['resolve_ticket']); // Get ticket details for logging - $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -289,7 +289,7 @@ if (isset($_GET['reopen_ticket'])) { $ticket_id = intval($_GET['reopen_ticket']); // Get ticket details for logging - $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -322,7 +322,7 @@ if (isset($_GET['close_ticket'])) { $ticket_id = intval($_GET['close_ticket']); // Get ticket details for logging - $row = mysqli_fetch_array(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); + $row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); $ticket_prefix = sanitizeInput($row['ticket_prefix']); $ticket_number = intval($row['ticket_number']); @@ -439,7 +439,7 @@ if (isset($_POST['edit_contact'])) { // Get the existing contact_user_id - we look it up ourselves so the user can't just overwrite random users $sql = mysqli_query($mysqli,"SELECT contact_user_id FROM contacts WHERE contact_id = $contact_id AND contact_client_id = $session_client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $contact_user_id = intval($row['contact_user_id']); // Check the email isn't already in use @@ -485,7 +485,7 @@ if (isset($_GET['add_payment_by_provider'])) { LEFT JOIN contacts ON client_id = contact_client_id AND contact_primary = 1 WHERE invoice_id = $invoice_id AND client_id = $session_client_id" ); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $invoice_number = intval($row['invoice_number']); $invoice_status = sanitizeInput($row['invoice_status']); $invoice_amount = floatval($row['invoice_amount']); @@ -509,7 +509,7 @@ if (isset($_GET['add_payment_by_provider'])) { // Get ITFlow company details $sql = mysqli_query($mysqli,"SELECT * FROM companies WHERE company_id = 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $company_name = sanitizeInput($row['company_name']); $company_country = sanitizeInput($row['company_country']); $company_address = sanitizeInput($row['company_address']); @@ -526,7 +526,7 @@ if (isset($_GET['add_payment_by_provider'])) { // Get Client Payment Details $sql = mysqli_query($mysqli, "SELECT * FROM client_saved_payment_methods LEFT JOIN payment_providers ON saved_payment_provider_id = payment_provider_id LEFT JOIN client_payment_provider ON saved_payment_client_id = client_id WHERE saved_payment_id = $saved_payment_id LIMIT 1"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $public_key = sanitizeInput($row['payment_provider_public_key']); $private_key = sanitizeInput($row['payment_provider_private_key']); @@ -684,7 +684,7 @@ if (isset($_POST['create_stripe_customer'])) { LIMIT 1 "); - $stripe_provider = mysqli_fetch_array($stripe_provider_result); + $stripe_provider = mysqli_fetch_assoc($stripe_provider_result); if (!$stripe_provider) { flash_alert("Stripe provider is not configured in the system.", 'danger'); redirect("saved_payment_methods.php"); @@ -699,7 +699,7 @@ if (isset($_POST['create_stripe_customer'])) { } // Check if client already has a Stripe customer - $existing_customer = mysqli_fetch_array(mysqli_query($mysqli, " + $existing_customer = mysqli_fetch_assoc(mysqli_query($mysqli, " SELECT payment_provider_client FROM client_payment_provider WHERE client_id = $session_client_id @@ -772,7 +772,7 @@ if (isset($_GET['create_stripe_checkout'])) { LIMIT 1 "); - $stripe_provider = mysqli_fetch_array($stripe_provider_result); + $stripe_provider = mysqli_fetch_assoc($stripe_provider_result); if (!$stripe_provider) { http_response_code(400); echo json_encode(['error' => 'Stripe provider not configured']); @@ -840,7 +840,7 @@ if (isset($_GET['stripe_save_card'])) { LIMIT 1 "); - $stripe_provider = mysqli_fetch_array($stripe_provider_result); + $stripe_provider = mysqli_fetch_assoc($stripe_provider_result); if (!$stripe_provider) { flash_alert("Stripe provider not configured.", 'danger'); redirect("saved_payment_methods.php"); @@ -862,7 +862,7 @@ if (isset($_GET['stripe_save_card'])) { AND payment_provider_id = $stripe_provider_id LIMIT 1 "); - $client_provider = mysqli_fetch_array($client_provider_query); + $client_provider = mysqli_fetch_assoc($client_provider_query); $stripe_customer_id = sanitizeInput($client_provider['payment_provider_client'] ?? ''); if (empty($stripe_customer_id)) { @@ -921,7 +921,7 @@ if (isset($_GET['stripe_save_card'])) { WHERE companies.company_id = settings.company_id AND companies.company_id = 1 "); - $row = mysqli_fetch_array($sql_settings); + $row = mysqli_fetch_assoc($sql_settings); $company_name = sanitizeInput($row['company_name']); $company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'], $row['company_phone_country_code'])); @@ -970,7 +970,7 @@ if (isset($_GET['delete_saved_payment'])) { AND payment_provider_active = 1 LIMIT 1 "); - $stripe_provider = mysqli_fetch_array($stripe_provider_result); + $stripe_provider = mysqli_fetch_assoc($stripe_provider_result); if (!$stripe_provider) { flash_alert("Stripe provider is not configured.", 'danger'); @@ -994,7 +994,7 @@ if (isset($_GET['delete_saved_payment'])) { LIMIT 1 "); - $saved_payment = mysqli_fetch_array($saved_payment_result); + $saved_payment = mysqli_fetch_assoc($saved_payment_result); if (!$saved_payment) { flash_alert("Payment method not found or does not belong to you.", 'danger'); @@ -1040,7 +1040,7 @@ if (isset($_GET['delete_saved_payment'])) { WHERE recurring_invoice_client_id = $session_client_id "); - while ($row = mysqli_fetch_array($recurring_invoices)) { + while ($row = mysqli_fetch_assoc($recurring_invoices)) { $recurring_invoice_id = intval($row['recurring_invoice_id']); mysqli_query($mysqli, " @@ -1064,7 +1064,7 @@ if (isset($_POST['set_recurring_payment'])) { // Get Recurring Invoice Info for logging and alerting $sql = mysqli_query($mysqli, "SELECT * FROM recurring_invoices WHERE recurring_invoice_id = $recurring_invoice_id AND recurring_invoice_client_id = $session_client_id"); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $recurring_invoice_prefix = sanitizeInput($row['recurring_invoice_prefix']); $recurring_invoice_number = intval($row['recurring_invoice_number']); $recurring_invoice_currency_code = sanitizeInput($row['recurring_invoice_currency_code']); @@ -1081,7 +1081,7 @@ if (isset($_POST['set_recurring_payment'])) { AND payment_provider_active = 1 "); - $row = mysqli_fetch_array($sql); + $row = mysqli_fetch_assoc($sql); $provider_id = intval($row['payment_provider_id']); $provider_name = sanitizeInput($row['payment_provider_name']); diff --git a/client/quotes.php b/client/quotes.php index 1c96c523..59a7bff5 100644 --- a/client/quotes.php +++ b/client/quotes.php @@ -34,7 +34,7 @@ $quotes_sql = mysqli_query($mysqli, "SELECT * FROM quotes WHERE quote_client_id
- +
- + Manage saved payment methods

diff --git a/client/ticket.php b/client/ticket.php index 6e85fe6e..35009da0 100644 --- a/client/ticket.php +++ b/client/ticket.php @@ -34,7 +34,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) { $ticket_contact_snippet" ); - $ticket_row = mysqli_fetch_array($ticket_sql); + $ticket_row = mysqli_fetch_assoc($ticket_sql); if ($ticket_row) { @@ -128,7 +128,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) { $name | Download | View"; @@ -147,7 +147,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) {
    purify($row['ticket_reply']); $ticket_reply_created_at = nullable_htmlentities($row['ticket_reply_created_at']); @@ -318,7 +318,7 @@ if (isset($_GET['id']) && intval($_GET['id'])) { $name | Download | View"; @@ -345,5 +345,3 @@ if (isset($_GET['id']) && intval($_GET['id'])) { } require_once "includes/footer.php"; - - diff --git a/client/ticket_add.php b/client/ticket_add.php index 6037f5b1..90e6e24f 100644 --- a/client/ticket_add.php +++ b/client/ticket_add.php @@ -64,7 +64,7 @@ $sql_assets = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type FRO - None - Pay Balance ()