From e7572c9e8f4e4105e3f741bc230f39ba2116bd7e Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 8 Jul 2023 12:34:28 -0400 Subject: [PATCH] Rename vars sb to sort, o to order, p to page. This makes the code easier to understand and brings consistency --- accounts.php | 12 +++++----- categories.php | 10 ++++---- client_assets.php | 42 ++++++++++++++++----------------- client_certificates.php | 16 ++++++------- client_contacts.php | 14 +++++------ client_document_templates.php | 14 +++++------ client_documents.php | 14 +++++------ client_domains.php | 14 +++++------ client_invoices.php | 22 ++++++++--------- client_locations.php | 16 ++++++------- client_logins.php | 14 +++++------ client_logs.php | 24 +++++++++---------- client_networks.php | 20 ++++++++-------- client_payments.php | 24 +++++++++---------- client_quotes.php | 20 ++++++++-------- client_recurring_invoices.php | 24 +++++++++---------- client_scheduled_tickets.php | 8 +++---- client_services.php | 8 +++---- client_shared_items.php | 8 +++---- client_software.php | 16 ++++++------- client_tickets.php | 24 +++++++++---------- client_trips.php | 20 ++++++++-------- client_vendors.php | 12 +++++----- clients.php | 14 +++++------ expenses.php | 22 ++++++++--------- invoices.php | 32 ++++++++++++------------- logs.php | 26 ++++++++++---------- notifications_dismissed.php | 32 ++++++++++++------------- pagination.php | 26 ++++++++++---------- pagination_head.php | 24 +++++++++---------- payments.php | 24 +++++++++---------- products.php | 16 ++++++------- quotes.php | 22 ++++++++--------- recurring_invoices.php | 26 ++++++++++---------- revenues.php | 20 ++++++++-------- scheduled_tickets.php | 8 +++---- settings_api.php | 20 ++++++++-------- settings_custom_fields.php | 12 +++++----- settings_mail_queue.php | 20 ++++++++-------- settings_software_templates.php | 16 ++++++------- settings_tags.php | 12 +++++----- settings_taxes.php | 12 +++++----- settings_vendor_templates.php | 12 +++++----- tickets.php | 24 +++++++++---------- transfers.php | 18 +++++++------- trips.php | 22 ++++++++--------- users.php | 16 ++++++------- vendors.php | 14 +++++------ 48 files changed, 443 insertions(+), 443 deletions(-) diff --git a/accounts.php b/accounts.php index 95cbe117..a201a792 100644 --- a/accounts.php +++ b/accounts.php @@ -1,19 +1,19 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM accounts WHERE account_name LIKE '%$q%' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -41,8 +41,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); "> - - + + diff --git a/categories.php b/categories.php index d0c2851a..a76f5827 100644 --- a/categories.php +++ b/categories.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -21,7 +21,7 @@ $sql = mysqli_query( WHERE category_name LIKE '%$q%' AND category_type = '$category' AND category_archived_at IS NULL - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -78,7 +78,7 @@ $colors_diff = array_diff($colors_array, $colors_used_array);
NameCurrencyNameCurrency Balance Action
"> - + diff --git a/client_assets.php b/client_assets.php index 46e4af37..9c3917ce 100644 --- a/client_assets.php +++ b/client_assets.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -64,7 +64,7 @@ $sql = mysqli_query( AND asset_archived_at IS NULL AND (asset_name LIKE '%$q%' OR asset_description LIKE '%$q%' OR asset_type LIKE '%$q%' OR asset_ip LIKE '%$q%' OR asset_make LIKE '%$q%' OR asset_model LIKE '%$q%' OR asset_serial LIKE '%$q%' OR asset_os LIKE '%$q%' OR contact_name LIKE '%$q%' OR location_name LIKE '%$q%') AND ($type_query) - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -94,26 +94,26 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
@@ -133,27 +133,27 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NameName Color Action
"> - - + + - + - + - + - + - - + + - + - - + + diff --git a/client_certificates.php b/client_certificates.php index 5b420ea1..c6302611 100644 --- a/client_certificates.php +++ b/client_certificates.php @@ -1,17 +1,17 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM certificates WHERE certificate_client_id = $client_id AND (certificate_name LIKE '%$q%' OR certificate_domain LIKE '%$q%' OR certificate_issued_by LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -74,10 +74,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - - - + + + + diff --git a/client_contacts.php b/client_contacts.php index 5e774ee8..d3ee3b41 100644 --- a/client_contacts.php +++ b/client_contacts.php @@ -1,20 +1,20 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM contacts LEFT JOIN locations ON location_id = contact_location_id WHERE contact_archived_at IS NULL AND (contact_name LIKE '%$q%' OR contact_title LIKE '%$q%' OR location_name LIKE '%$q%' OR contact_email LIKE '%$q%' OR contact_department LIKE '%$q%' OR contact_phone LIKE '%$phone_query%' OR contact_extension LIKE '%$q%' OR contact_mobile LIKE '%$phone_query%') AND contact_client_id = $client_id - ORDER BY contact_primary DESC, contact_important DESC, $sb $o LIMIT $record_from, $record_to" + ORDER BY contact_primary DESC, contact_important DESC, $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -64,10 +64,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NameDescriptionNameDescription TypeType Make/ModelMake/Model Serial NumberSerial Number Operating SystemOperating System IPInstall DateIPInstall Date Assigned ToAssigned To LocationStatusLocationStatus Action
NameDomainIssued ByExpireNameDomainIssued ByExpire Action
"> - - + + - + diff --git a/client_document_templates.php b/client_document_templates.php index 9506e746..07b7af95 100644 --- a/client_document_templates.php +++ b/client_document_templates.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM documents WHERE document_template = 1 $query_snippet - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -59,13 +59,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); "> ">
NameDepartmentNameDepartment ContactLocationLocation Action
- Template Name + Template Name - Created + Created - Updated + Updated Action diff --git a/client_documents.php b/client_documents.php index 9fee3805..04f20684 100644 --- a/client_documents.php +++ b/client_documents.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); // Folder ID $get_folder_id = 0; @@ -36,7 +36,7 @@ $sql = mysqli_query( AND document_template = 0 AND document_folder_id = $folder $query_snippet - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -154,13 +154,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- Name + Name - Created + Created - Last Update + Last Update Action diff --git a/client_domains.php b/client_domains.php index 848b792b..f112c449 100644 --- a/client_domains.php +++ b/client_domains.php @@ -1,17 +1,17 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM domains LEFT JOIN vendors ON domain_registrar = vendor_id WHERE domain_client_id = $client_id AND (domain_name LIKE '%$q%' OR vendor_name LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -52,10 +52,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); "> - - + + - + diff --git a/client_invoices.php b/client_invoices.php index 713a3f25..4b2efcfb 100644 --- a/client_invoices.php +++ b/client_invoices.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN categories ON invoice_category_id = category_id WHERE invoice_client_id = $client_id AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR invoice_status LIKE '%$q%' OR invoice_amount LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -56,13 +56,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
DomainRegistrarDomainRegistrar Web HostExpiresExpires Action
"> - - - - - - - + + + + + + + diff --git a/client_locations.php b/client_locations.php index c4ec8d88..47cabb9c 100644 --- a/client_locations.php +++ b/client_locations.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( WHERE location_client_id = $client_id AND location_archived_at IS NULL AND (location_name LIKE '%$q%' OR location_address LIKE '%$q%' OR location_phone LIKE '%$phone_query%') - ORDER BY location_primary DESC, $sb $o LIMIT $record_from, $record_to" + ORDER BY location_primary DESC, $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -57,10 +57,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NumberScopeAmountDateDueCategoryStatusNumberScopeAmountDateDueCategoryStatus Action
"> - - - - + + + + diff --git a/client_logins.php b/client_logins.php index f70cfdea..d6999c11 100644 --- a/client_logins.php +++ b/client_logins.php @@ -1,20 +1,20 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM logins WHERE login_client_id = $client_id AND (login_name LIKE '%$q%' OR login_description LIKE '%$q%' OR login_uri LIKE '%$q%') - ORDER BY login_important DESC, $sb $o LIMIT $record_from, $record_to" + ORDER BY login_important DESC, $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -56,12 +56,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NameAddressPhoneHoursNameAddressPhoneHours Action
"> - - + + - + diff --git a/client_logs.php b/client_logs.php index 66f48508..f6c6fb8c 100644 --- a/client_logs.php +++ b/client_logs.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN users ON log_user_id = user_id WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%' OR log_ip LIKE '%$q%' OR log_user_agent LIKE '%$q%' OR user_name LIKE '%$q%') AND log_client_id = $client_id - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -51,14 +51,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NameDescriptionNameDescription Username Password OTPURIURI Action
"> - - - - - - - - + + + + + + + + diff --git a/client_networks.php b/client_networks.php index 3d546cdc..492f0a55 100644 --- a/client_networks.php +++ b/client_networks.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sb = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN locations ON location_id = network_location_id WHERE network_client_id = $client_id AND (network_name LIKE '%$q%' OR network_vlan LIKE '%$q%' OR network LIKE '%$q%' OR network_gateway LIKE '%$q%' OR network_dhcp_range LIKE '%$q%' OR location_name LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -56,12 +56,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
TimestampUserTypeActionDescriptionIP AddressUser AgentEntity IDTimestampUserTypeActionDescriptionIP AddressUser AgentEntity ID
"> - - - - - - + + + + + + diff --git a/client_payments.php b/client_payments.php index ceb9760f..b4241623 100644 --- a/client_payments.php +++ b/client_payments.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN accounts ON payment_account_id = account_id WHERE invoice_client_id = $client_id AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR account_name LIKE '%$q%' OR payment_method LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -54,14 +54,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NamevLANNetworkGatewayDHCP RangeLocationNamevLANNetworkGatewayDHCP RangeLocation Action
"> - - - - - - - - + + + + + + + + diff --git a/client_quotes.php b/client_quotes.php index 2e3b5c27..7d1fd722 100644 --- a/client_quotes.php +++ b/client_quotes.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN categories ON category_id = quote_category_id WHERE quote_client_id = $client_id AND (CONCAT(quote_prefix,quote_number) LIKE '%$q%' OR quote_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR quote_status LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -56,12 +56,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
Payment DateInvoice DateInvoiceInvoice AmountPayment AmountMethodReferenceAccountPayment DateInvoice DateInvoiceInvoice AmountPayment AmountMethodReferenceAccount
"> - - - - - - + + + + + + diff --git a/client_recurring_invoices.php b/client_recurring_invoices.php index 399ec595..344d4212 100644 --- a/client_recurring_invoices.php +++ b/client_recurring_invoices.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN categories ON recurring_category_id = category_id WHERE recurring_client_id = $client_id AND (CONCAT(recurring_prefix,recurring_number) LIKE '%$q%' OR recurring_frequency LIKE '%$q%' OR recurring_scope LIKE '%$q%' OR category_name LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -55,14 +55,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NumberScopeAmountDateCategoryStatusNumberScopeAmountDateCategoryStatus Action
"> - - - - - - - - + + + + + + + + diff --git a/client_scheduled_tickets.php b/client_scheduled_tickets.php index 22bd0b22..c02b9553 100644 --- a/client_scheduled_tickets.php +++ b/client_scheduled_tickets.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); // SQL $sql = mysqli_query( @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN clients on scheduled_ticket_client_id = client_id WHERE scheduled_ticket_client_id = $client_id AND scheduled_tickets.scheduled_ticket_subject LIKE '%$q%' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/client_services.php b/client_services.php index 4ad61ac1..6faf3685 100644 --- a/client_services.php +++ b/client_services.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); // Overview SQL query $sql = mysqli_query( @@ -15,7 +15,7 @@ $sql = mysqli_query( "SELECT SQL_CALC_FOUND_ROWS * FROM services WHERE service_client_id = '$client_id' AND (service_name LIKE '%$q%' OR service_description LIKE '%$q%' OR service_category LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/client_shared_items.php b/client_shared_items.php index 888166cc..8c91678c 100644 --- a/client_shared_items.php +++ b/client_shared_items.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( AND item_active = '1' AND item_views != item_view_limit AND item_expire_at > NOW() - AND (item_note LIKE '%$q%') ORDER BY $sb $o LIMIT $record_from, $record_to" + AND (item_note LIKE '%$q%') ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/client_software.php b/client_software.php index fb3d8644..6cd3b2b5 100644 --- a/client_software.php +++ b/client_software.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( WHERE software_client_id = $client_id AND software_template = 0 AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -64,10 +64,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NumberScopeFrequencyAmountLast SentNext DateCategoryStatusNumberScopeFrequencyAmountLast SentNext DateCategoryStatus Action
"> - - - - + + + + diff --git a/client_tickets.php b/client_tickets.php index fa9377e9..5f0bed51 100644 --- a/client_tickets.php +++ b/client_tickets.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -19,7 +19,7 @@ $sql = mysqli_query( LEFT JOIN vendors ON ticket_vendor_id = vendor_id WHERE ticket_client_id = $client_id AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR ticket_status LIKE '%$q%' OR ticket_priority LIKE '%$q%' OR user_name LIKE '%$q%' OR ticket_vendor_ticket_number LIKE '%q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -62,14 +62,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
SoftwareTypeLicense TypeSeatsSoftwareTypeLicense TypeSeats Action
"> - - - - - - - - + + + + + + + + diff --git a/client_trips.php b/client_trips.php index 4f31a037..7390c7bf 100644 --- a/client_trips.php +++ b/client_trips.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%' OR user_name LIKE '%$q%') AND DATE(trip_date) BETWEEN '$dtf' AND '$dtt' AND trip_client_id = $client_id - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -56,12 +56,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NumberSubjectContactPriorityStatusAssignedLast ResponseCreatedNumberSubjectContactPriorityStatusAssignedLast ResponseCreated Action
"> - - - - - - + + + + + + diff --git a/client_vendors.php b/client_vendors.php index d2a972ac..405eb713 100644 --- a/client_vendors.php +++ b/client_vendors.php @@ -1,20 +1,20 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM vendors WHERE vendor_client_id = $client_id AND vendor_template = 0 - AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') ORDER BY $sb $o LIMIT $record_from, $record_to"); + AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -64,8 +64,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
DateDriverPurposeFromToMilesDateDriverPurposeFromToMiles Action
"> - - + + diff --git a/clients.php b/clients.php index c4f4439e..73ea1efe 100644 --- a/clients.php +++ b/clients.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -26,7 +26,7 @@ $sql = mysqli_query( AND clients.client_archived_at IS NULL AND DATE(clients.client_created_at) BETWEEN '$dtf' AND '$dtt' GROUP BY clients.client_id - ORDER BY $sb $o + ORDER BY $sort $order LIMIT $record_from, $record_to "); @@ -100,9 +100,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
VendorDescriptionVendorDescription Contact Action
"> - - - + + + diff --git a/expenses.php b/expenses.php index fb7afef1..f5445d67 100644 --- a/expenses.php +++ b/expenses.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -19,7 +19,7 @@ $sql = mysqli_query( WHERE expense_vendor_id > 0 AND DATE(expense_date) BETWEEN '$dtf' AND '$dtt' AND (vendor_name LIKE '%$q%' OR client_name LIKE '%$q%' OR category_name LIKE '%$q%' OR account_name LIKE '%$q%' OR expense_description LIKE '%$q%' OR expense_amount LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -90,13 +90,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NamePrimary address Primary contactNamePrimary address Primary contact Billing Action
"> - - - - - - - + + + + + + + diff --git a/invoices.php b/invoices.php index f245a29d..a33fbd28 100644 --- a/invoices.php +++ b/invoices.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -79,7 +79,7 @@ $sql = mysqli_query( WHERE (invoice_status LIKE '$status_query') AND DATE(invoice_date) BETWEEN '$dtf' AND '$dtt' AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR invoice_scope LIKE '%$q%' OR client_name LIKE '%$q%' OR invoice_status LIKE '%$q%' OR invoice_amount LIKE '%$q%' OR category_name LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -89,7 +89,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
DateVendorCategoryDescriptionAmountAccountClientDateVendorCategoryDescriptionAmountAccountClient Action
"> - - - - - - - - + + + + + + + + diff --git a/logs.php b/logs.php index b9c0622f..46c52c2f 100644 --- a/logs.php +++ b/logs.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN clients ON log_client_id = client_id WHERE (log_type LIKE '%$q%' OR log_action LIKE '%$q%' OR log_description LIKE '%$q%' OR log_ip LIKE '%$q%' OR log_user_agent LIKE '%$q%' OR user_name LIKE '%$q%' OR client_name LIKE '%$q%') AND DATE(log_created_at) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -78,15 +78,15 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
NumberScopeClientAmountDateDueCategoryStatusNumberScopeClientAmountDateDueCategoryStatus Action
"> - - - - - - - - - + + + + + + + + + diff --git a/notifications_dismissed.php b/notifications_dismissed.php index b6a1dded..c385cecf 100644 --- a/notifications_dismissed.php +++ b/notifications_dismissed.php @@ -1,14 +1,14 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -19,7 +19,7 @@ $sql = mysqli_query( AND DATE(notification_timestamp) BETWEEN '$dtf' AND '$dtt' AND (notification_user_id = $session_user_id OR notification_user_id = 0) AND notification_dismissed_at IS NOT NULL - ORDER BY $sb $o + ORDER BY $sort $order LIMIT $record_from, $record_to "); @@ -68,49 +68,49 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ">
TimestampUserClientTypeActionDescriptionIP AddressUser AgentEntity IDTimestampUserClientTypeActionDescriptionIP AddressUser AgentEntity ID
- + Timestamp - + "> - + Type - + "> - + Notification - + "> - + Client - + "> - + Dismissed At - + "> - + Dismissed By - + "> diff --git a/pagination.php b/pagination.php index e3a08f98..b27d29b2 100644 --- a/pagination.php +++ b/pagination.php @@ -11,7 +11,7 @@ $total_found_rows = $num_rows[0]; $total_pages = ceil($total_found_rows / $_SESSION['records_per_page']); if ($total_found_rows > 10) { - $i=0; + $i = 0; ?> @@ -48,38 +48,38 @@ if ($total_found_rows > 10) { if (($total_pages <= 10000) && ($total_pages > 1000)) { $pages_split = 1000; } - if ($p > 1) { + if ($page > 1) { $prev_class = ""; } else { $prev_class = "disabled"; } - if ($p <> $total_pages) { + if ($page <> $total_pages) { $next_class = ""; } else { $next_class = "disabled"; } - $url_query_strings = http_build_query(array_merge($_GET, array('p' => $i))); - $prev_page = $p - 1; - $next_page = $p + 1; + $url_query_strings = http_build_query(array_merge($_GET, array('page' => $i))); + $prev_page = $page - 1; + $next_page = $page + 1; - if ($p > 1) { - echo "
  • Prev
  • "; + if ($page > 1) { + echo "
  • Prev
  • "; } while ($i < $total_pages) { $i++; - if (($i == 1) || (($p <= 3) && ($i <= 6)) || (($i > $total_pages - 6) && ($p > $total_pages - 3)) || (is_int($i / $pages_split)) || (($p > 3) && ($i >= $p - 2) && ($i <= $p + 3)) || ($i == $total_pages)) { - if ($p == $i) { + if (($i == 1) || (($page <= 3) && ($i <= 6)) || (($i > $total_pages - 6) && ($page > $total_pages - 3)) || (is_int($i / $pages_split)) || (($page > 3) && ($i >= $page - 2) && ($i <= $page + 3)) || ($i == $total_pages)) { + if ($page == $i) { $page_class = "active"; } else { $page_class = ""; } - echo "
  • $i
  • "; + echo "
  • $i
  • "; } } - if ($p <> $total_pages) { - echo "
  • Next
  • "; + if ($page <> $total_pages) { + echo "
  • Next
  • "; } ?> diff --git a/pagination_head.php b/pagination_head.php index 9406c238..717d4a8b 100644 --- a/pagination_head.php +++ b/pagination_head.php @@ -8,27 +8,27 @@ */ // Paging -if (isset($_GET['p'])) { - $p = intval($_GET['p']); - $record_from = (($p)-1)*$_SESSION['records_per_page']; +if (isset($_GET['page'])) { + $page = intval($_GET['page']); + $record_from = (($page)-1)*$_SESSION['records_per_page']; $record_to = $_SESSION['records_per_page']; } else { $record_from = 0; $record_to = $_SESSION['records_per_page']; - $p = 1; + $page = 1; } // Order -if (isset($_GET['o'])) { - if ($_GET['o'] == 'ASC') { - $o = "ASC"; +if (isset($_GET['order'])) { + if ($_GET['order'] == 'ASC') { + $order = "ASC"; $disp = "DESC"; } else { - $o = "DESC"; + $order = "DESC"; $disp = "ASC"; } -} elseif(isset($o)) { - if ($o == "ASC") { +} elseif(isset($order)) { + if ($order == "ASC") { $disp = "DESC"; } else { $disp = "ASC"; @@ -49,8 +49,8 @@ if (isset($_GET['q'])) { } // Sortby -if (!empty($_GET['sb'])) { - $sb = sanitizeInput(preg_replace('/[^a-z_]/', '', $_GET['sb'])); // JQ 2023-05-09 - See issue #673 on GitHub to see the reasoning why we used preg_replace technically sanitizeInput() should have been enough to escape SQL Commands +if (!empty($_GET['sort'])) { + $sort = sanitizeInput(preg_replace('/[^a-z_]/', '', $_GET['sort'])); // JQ 2023-05-09 - See issue #673 on GitHub to see the reasoning why we used preg_replace technically sanitizeInput() should have been enough to escape SQL Commands } // Date Handling diff --git a/payments.php b/payments.php index 38de9cd8..36233c9b 100644 --- a/payments.php +++ b/payments.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -17,7 +17,7 @@ $sql = mysqli_query( LEFT JOIN accounts ON payment_account_id = account_id WHERE DATE(payment_date) BETWEEN '$dtf' AND '$dtt' AND (CONCAT(invoice_prefix,invoice_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR account_name LIKE '%$q%' OR payment_method LIKE '%$q%' OR payment_reference LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -80,14 +80,14 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); "> - - - - - - - - + + + + + + + + diff --git a/products.php b/products.php index 0afab36c..ca7233e4 100644 --- a/products.php +++ b/products.php @@ -1,19 +1,19 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'o' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM products LEFT JOIN categories ON product_category_id = category_id WHERE (product_name LIKE '%$q%' OR product_description LIKE '%$q%' OR category_name LIKE '%$q%' OR product_price LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -46,10 +46,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    Payment DateInvoice DateInvoiceClientAmountPayment MethodReferenceAccountPayment DateInvoice DateInvoiceClientAmountPayment MethodReferenceAccount
    "> - - - - + + + + diff --git a/quotes.php b/quotes.php index 56dc9769..249f2592 100644 --- a/quotes.php +++ b/quotes.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN categories ON quote_category_id = category_id WHERE (CONCAT(quote_prefix,quote_number) LIKE '%$q%' OR quote_scope LIKE '%$q%' OR category_name LIKE '%$q%' OR quote_status LIKE '%$q%' OR quote_amount LIKE '%$q%' OR client_name LIKE '%$q%') AND DATE(quote_date) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -81,13 +81,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    NameCategoryDescriptionPriceNameCategoryDescriptionPrice Action
    "> - - - - - - - + + + + + + + diff --git a/recurring_invoices.php b/recurring_invoices.php index af09485f..5cde8d64 100644 --- a/recurring_invoices.php +++ b/recurring_invoices.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN categories ON recurring_category_id = category_id WHERE (CONCAT(recurring_prefix,recurring_number) LIKE '%$q%' OR recurring_frequency LIKE '%$q%' OR recurring_scope LIKE '%$q%' OR client_name LIKE '%$q%' OR category_name LIKE '%$q%') AND DATE(recurring_last_sent) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -81,16 +81,16 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    NumberScopeClientAmountDateCategoryStatusNumberScopeClientAmountDateCategoryStatus Action
    "> - - - - - - - + + + + + + + - - + + diff --git a/revenues.php b/revenues.php index 015b7498..0210925f 100644 --- a/revenues.php +++ b/revenues.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN accounts ON revenue_account_id = account_id WHERE (account_name LIKE '%$q%' OR revenue_payment_method LIKE '%$q%' OR category_name LIKE '%$q%' OR revenue_reference LIKE '%$q%' OR revenue_amount LIKE '%$q%') AND DATE(revenue_date) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to"); + ORDER BY $sort $order LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -81,12 +81,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    NumberNext DateScopeFrequencyClientAmountLast SentNumberNext DateScopeFrequencyClientAmountLast SentCategoryStatusCategoryStatus Action
    "> - - - - - - + + + + + + diff --git a/scheduled_tickets.php b/scheduled_tickets.php index 64c06820..ab6ccd91 100644 --- a/scheduled_tickets.php +++ b/scheduled_tickets.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); // SQL $sql = mysqli_query( @@ -15,7 +15,7 @@ $sql = mysqli_query( "SELECT SQL_CALC_FOUND_ROWS * FROM scheduled_tickets LEFT JOIN clients on scheduled_ticket_client_id = client_id WHERE scheduled_tickets.scheduled_ticket_subject LIKE '%$q%' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); diff --git a/settings_api.php b/settings_api.php index e38f3043..6193f736 100644 --- a/settings_api.php +++ b/settings_api.php @@ -1,20 +1,20 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM api_keys LEFT JOIN clients on api_keys.api_key_client_id = clients.client_id WHERE (api_key_name LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -25,7 +25,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));

    API Keys

    - +
    @@ -75,11 +75,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - - - - + + + + + diff --git a/settings_custom_fields.php b/settings_custom_fields.php index 353e76a8..f3a6d8f4 100644 --- a/settings_custom_fields.php +++ b/settings_custom_fields.php @@ -1,8 +1,8 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM custom_fields WHERE custom_field_label LIKE '%$q%' AND custom_field_table = '$table' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -60,8 +60,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    DateCategoryAmountMethodReferenceAccountDateCategoryAmountMethodReferenceAccount Action
    NameClientSecretCreatedExpiresNameClientSecretCreatedExpires Action
    "> - - + + diff --git a/settings_mail_queue.php b/settings_mail_queue.php index 3e329b46..6aecb657 100644 --- a/settings_mail_queue.php +++ b/settings_mail_queue.php @@ -1,8 +1,8 @@ set('URI.AllowedSchemes', ['data' => true, 'src' => true, 'htt $purifier = new HTMLPurifier($purifier_config); //Rebuild URL -$url_query_strings_sb = http_build_query(array_merge($_GET, array('sb' => $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM email_queue WHERE (email_from LIKE '%$q%' OR email_from_name LIKE '%$q%' OR email_recipient LIKE '%$q%' OR email_recipient_name LIKE '%$q%' OR email_subject LIKE '%$q%') AND DATE(email_queued_at) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -82,12 +82,12 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    LabelTypeLabelType Action
    "> - - - - - - + + + + + + diff --git a/settings_software_templates.php b/settings_software_templates.php index fe046458..1e7626f4 100644 --- a/settings_software_templates.php +++ b/settings_software_templates.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( LEFT JOIN logins ON login_software_id = software_id WHERE software_template = 1 AND (software_name LIKE '%$q%' OR software_type LIKE '%$q%' OR software_key LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -52,10 +52,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    QueuedFromToSubjectStatusAttemptsQueuedFromToSubjectStatusAttempts Action
    "> - - - - + + + + diff --git a/settings_tags.php b/settings_tags.php index af4459d5..3933a232 100644 --- a/settings_tags.php +++ b/settings_tags.php @@ -1,19 +1,19 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM tags WHERE tag_name LIKE '%$q%' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -69,8 +69,8 @@ if ($num_rows > 0) {
    TemplateTypeLicense TypeSeatsTemplateTypeLicense TypeSeats Action
    "> - - + + diff --git a/settings_taxes.php b/settings_taxes.php index 06082966..a17c0d8a 100644 --- a/settings_taxes.php +++ b/settings_taxes.php @@ -1,19 +1,19 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT * FROM taxes WHERE tax_archived_at IS NULL - ORDER BY $sb $o" + ORDER BY $sort $order" ); $num_rows = mysqli_num_rows($sql); @@ -32,8 +32,8 @@ $num_rows = mysqli_num_rows($sql);
    NameTypeNameType Color Action
    "> - - + + diff --git a/settings_vendor_templates.php b/settings_vendor_templates.php index 18c57f50..9094b4fb 100644 --- a/settings_vendor_templates.php +++ b/settings_vendor_templates.php @@ -1,19 +1,19 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, "SELECT SQL_CALC_FOUND_ROWS * FROM vendors WHERE vendor_template = 1 - AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') ORDER BY $sb $o LIMIT $record_from, $record_to" + AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -51,8 +51,8 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    NamePercentNamePercent Action
    "> - - + + diff --git a/tickets.php b/tickets.php index 618709b3..f20a9023 100644 --- a/tickets.php +++ b/tickets.php @@ -1,8 +1,8 @@ $sb, 'o' => $o, 'status' => $status, 'assigned' => $ticket_assigned_filter))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order, 'status' => $status, 'assigned' => $ticket_assigned_filter))); // Main ticket query: $sql = mysqli_query( @@ -51,7 +51,7 @@ $sql = mysqli_query( AND $ticket_status_snippet AND DATE(ticket_created_at) BETWEEN '$dtf' AND '$dtt' AND (CONCAT(ticket_prefix,ticket_number) LIKE '%$q%' OR client_name LIKE '%$q%' OR ticket_subject LIKE '%$q%' OR user_name LIKE '%$q%' OR ticket_vendor_ticket_number LIKE '%q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -227,27 +227,27 @@ $user_active_assigned_tickets = intval($row['total_tickets_assigned']); } ?>"> diff --git a/transfers.php b/transfers.php index b14291d8..dfed0c5a 100644 --- a/transfers.php +++ b/transfers.php @@ -1,12 +1,12 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( AND transfer_revenue_id = revenue_id AND DATE(expense_date) BETWEEN '$dtf' AND '$dtt' AND (transfer_notes LIKE '%$q%') - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -81,11 +81,11 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    VendorDescriptionVendorDescription Contact Action
    Number + href="?&sort=ticket_number&order=">Number Subject + href="?&sort=ticket_subject&order=">Subject Client / Contact + href="?&sort=client_name&order=">Client / Contact Priority + href="?&sort=ticket_priority&order=">Priority Status + href="?&sort=ticket_status&order=">Status Assigned + href="?&sort=user_name&order=">Assigned Last Response + href="?&sort=ticket_updated_at&order=">Last Response Created + href="?&sort=ticket_created_at&order=">Created Action
    "> - - - - - + + + + + diff --git a/trips.php b/trips.php index b9a3c591..97f1068d 100644 --- a/trips.php +++ b/trips.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -16,7 +16,7 @@ $sql = mysqli_query( LEFT JOIN users ON trip_user_id = user_id WHERE (trip_purpose LIKE '%$q%' OR trip_source LIKE '%$q%' OR trip_destination LIKE '%$q%' OR trip_miles LIKE '%$q%' OR client_name LIKE '%$q%' OR user_name LIKE '%$q%') AND DATE(trip_date) BETWEEN '$dtf' AND '$dtt' - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -87,13 +87,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    DateFrom AccountTo AccountNotesAmountDateFrom AccountTo AccountNotesAmount Action
    "> - - - - - - - + + + + + + + diff --git a/users.php b/users.php index a06aeb4e..6b8f0ba4 100644 --- a/users.php +++ b/users.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -15,7 +15,7 @@ $sql = mysqli_query( WHERE users.user_id = user_settings.user_id AND (user_name LIKE '%$q%' OR user_email LIKE '%$q%') AND user_archived_at IS NULL - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -60,10 +60,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    DateClientDriverPurposeSourceDestinationMilesDateClientDriverPurposeSourceDestinationMiles Action
    "> - - - - + + + + diff --git a/vendors.php b/vendors.php index dc51e702..f876d697 100644 --- a/vendors.php +++ b/vendors.php @@ -1,13 +1,13 @@ $sb, 'o' => $o))); +$url_query_strings_sort = http_build_query(array_merge($_GET, array('sort' => $sort, 'order' => $order))); $sql = mysqli_query( $mysqli, @@ -17,7 +17,7 @@ $sql = mysqli_query( AND DATE(vendor_created_at) BETWEEN '$dtf' AND '$dtt' AND (vendor_name LIKE '%$q%' OR vendor_description LIKE '%$q%' OR vendor_account_number LIKE '%$q%' OR vendor_website LIKE '%$q%' OR vendor_contact_name LIKE '%$q%' OR vendor_email LIKE '%$q%' OR vendor_phone LIKE '%$phone_query%') AND vendor_archived_at IS NULL - ORDER BY $sb $o LIMIT $record_from, $record_to" + ORDER BY $sort $order LIMIT $record_from, $record_to" ); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); @@ -83,9 +83,9 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
    NameEmailRoleStatusNameEmailRoleStatus Last Login Action
    "> - - - + + +
    VendorDescriptionContactVendorDescriptionContact Action