diff --git a/post/user/asset.php b/post/user/asset.php index b9ee2c4b..b7134e23 100644 --- a/post/user/asset.php +++ b/post/user/asset.php @@ -273,7 +273,7 @@ if (isset($_POST['bulk_assign_asset_location'])) { $client_id = intval($row['location_client_id']); // Assign Location to Selected Contacts - if ($_POST['asset_ids']) { + if (isset($_POST['asset_ids'])) { // Get Selected Contacts Count $asset_count = count($_POST['asset_ids']); @@ -318,7 +318,7 @@ if (isset($_POST['bulk_assign_asset_contact'])) { $client_id = intval($row['contact_client_id']); // Assign Contact to Selected Assets - if ($_POST['asset_ids']) { + if (isset($_POST['asset_ids'])) { // Get Selected Contacts Count $asset_count = count($_POST['asset_ids']); @@ -357,7 +357,7 @@ if (isset($_POST['bulk_edit_asset_status'])) { $status = sanitizeInput($_POST['bulk_status']); // Assign Status to Selected Assets - if ($_POST['asset_ids']) { + if (isset($_POST['asset_ids'])) { // Get Count $asset_count = count($_POST['asset_ids']); @@ -394,7 +394,7 @@ if (isset($_POST['bulk_archive_assets'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['asset_ids']) { + if (isset($_POST['asset_ids'])) { // Get Count $count = count($_POST['asset_ids']); @@ -433,7 +433,7 @@ if (isset($_POST['bulk_unarchive_assets'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['asset_ids']) { + if (isset($_POST['asset_ids'])) { // Get Count $count = count($_POST['asset_ids']); diff --git a/post/user/certificate.php b/post/user/certificate.php index a9bf26dd..fc61918d 100644 --- a/post/user/certificate.php +++ b/post/user/certificate.php @@ -125,7 +125,7 @@ if (isset($_POST['bulk_delete_certificates'])) { enforceUserPermission('module_support', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['certificate_ids']) { + if (isset($_POST['certificate_ids'])) { // Get selected count $count = count($_POST['certificate_ids']); diff --git a/post/user/client.php b/post/user/client.php index 60f839ac..446d31ad 100644 --- a/post/user/client.php +++ b/post/user/client.php @@ -62,7 +62,7 @@ if (isset($_POST['add_client'])) { } // Add Tags - if ($_POST['tags']) { + if (isset($_POST['tags'])) { foreach ($_POST['tags'] as $tag) { $tag = intval($tag); mysqli_query($mysqli, "INSERT INTO client_tags SET client_id = $client_id, tag_id = $tag"); @@ -139,9 +139,11 @@ if (isset($_POST['edit_client'])) { mysqli_query($mysqli, "DELETE FROM client_tags WHERE client_id = $client_id"); // Add new tags - foreach($_POST['tags'] as $tag) { - $tag = intval($tag); - mysqli_query($mysqli, "INSERT INTO client_tags SET client_id = $client_id, tag_id = $tag"); + if(isset($_POST['tags'])) { + foreach($_POST['tags'] as $tag) { + $tag = intval($tag); + mysqli_query($mysqli, "INSERT INTO client_tags SET client_id = $client_id, tag_id = $tag"); + } } // Logging diff --git a/post/user/contact.php b/post/user/contact.php index d5fbe7fc..0068f449 100644 --- a/post/user/contact.php +++ b/post/user/contact.php @@ -32,7 +32,7 @@ if (isset($_POST['add_contact'])) { $contact_id = mysqli_insert_id($mysqli); // Add Tags - if ($_POST['tags']) { + if (isset($_POST['tags'])) { foreach($_POST['tags'] as $tag) { $tag = intval($tag); mysqli_query($mysqli, "INSERT INTO contact_tags SET contact_id = $contact_id, tag_id = $tag"); @@ -144,9 +144,11 @@ if (isset($_POST['edit_contact'])) { mysqli_query($mysqli, "DELETE FROM contact_tags WHERE contact_id = $contact_id"); // Add new tags - foreach($_POST['tags'] as $tag) { - $tag = intval($tag); - mysqli_query($mysqli, "INSERT INTO contact_tags SET contact_id = $contact_id, tag_id = $tag"); + if (isset($_POST['tags'])) { + foreach($_POST['tags'] as $tag) { + $tag = intval($tag); + mysqli_query($mysqli, "INSERT INTO contact_tags SET contact_id = $contact_id, tag_id = $tag"); + } } // Update Primary contact in clients if primary contact is checked @@ -225,7 +227,7 @@ if (isset($_POST['bulk_assign_contact_location'])) { $client_id = intval($row['location_client_id']); // Assign Location to Selected Contacts - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $contact_count = count($_POST['contact_ids']); @@ -262,7 +264,7 @@ if (isset($_POST['bulk_edit_contact_phone'])) { $phone = preg_replace("/[^0-9]/", '', $_POST['bulk_phone']); // Assign Location to Selected Contacts - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $contact_count = count($_POST['contact_ids']); @@ -299,7 +301,7 @@ if (isset($_POST['bulk_edit_contact_department'])) { $department = sanitizeInput($_POST['bulk_department']); // Assign Location to Selected Contacts - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $contact_count = count($_POST['contact_ids']); @@ -339,7 +341,7 @@ if (isset($_POST['bulk_edit_contact_role'])) { $contact_technical = intval($_POST['bulk_contact_technical']); // Assign Location to Selected Contacts - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $contact_count = count($_POST['contact_ids']); @@ -377,7 +379,7 @@ if (isset($_POST['bulk_assign_contact_tags'])) { enforceUserPermission('module_client', 2); // Assign Location to Selected Contacts - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $count = count($_POST['contact_ids']); @@ -397,12 +399,14 @@ if (isset($_POST['bulk_assign_contact_tags'])) { } // Add new tags - foreach($_POST['bulk_tags'] as $tag) { - $tag = intval($tag); + if (isset($_POST['bulk_tags'])) { + foreach($_POST['bulk_tags'] as $tag) { + $tag = intval($tag); - $sql = mysqli_query($mysqli,"SELECT * FROM contact_tags WHERE contact_id = $contact_id AND tag_id = $tag"); - if (mysqli_num_rows($sql) == 0) { - mysqli_query($mysqli, "INSERT INTO contact_tags SET contact_id = $contact_id, tag_id = $tag"); + $sql = mysqli_query($mysqli,"SELECT * FROM contact_tags WHERE contact_id = $contact_id AND tag_id = $tag"); + if (mysqli_num_rows($sql) == 0) { + mysqli_query($mysqli, "INSERT INTO contact_tags SET contact_id = $contact_id, tag_id = $tag"); + } } } @@ -427,7 +431,7 @@ if (isset($_POST['bulk_archive_contacts'])) { //validateCSRFToken($_POST['csrf_token']); - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { $count = 0; // Default 0 @@ -477,7 +481,7 @@ if (isset($_POST['bulk_unarchive_contacts'])) { enforceUserPermission('module_client', 2); //validateCSRFToken($_POST['csrf_token']); - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $count = count($_POST['contact_ids']); @@ -521,7 +525,7 @@ if (isset($_POST['bulk_delete_contacts'])) { enforceUserPermission('module_client', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['contact_ids']) { + if (isset($_POST['contact_ids'])) { // Get Selected Contacts Count $count = count($_POST['contact_ids']); diff --git a/post/user/credential.php b/post/user/credential.php index cce38199..8290bf42 100644 --- a/post/user/credential.php +++ b/post/user/credential.php @@ -153,7 +153,7 @@ if (isset($_POST['bulk_assign_login_tags'])) { enforceUserPermission('module_credential', 2); // Assign tags to Selected Credentials - if ($_POST['login_ids']) { + if (isset($_POST['login_ids'])) { // Get Selected Credential Count $count = count($_POST['login_ids']); @@ -173,7 +173,7 @@ if (isset($_POST['bulk_assign_login_tags'])) { } // Add new tags - if(isset($_POST['bulk_tags'])) { + if (isset($_POST['bulk_tags'])) { foreach($_POST['bulk_tags'] as $tag) { $tag = intval($tag); @@ -204,7 +204,7 @@ if (isset($_POST['bulk_archive_logins'])) { enforceUserPermission('module_credential', 2); validateCSRFToken($_POST['csrf_token']); - if ($_POST['login_ids']) { + if (isset($_POST['login_ids'])) { // Get Selected Credential Count $count = count($_POST['login_ids']); @@ -243,7 +243,7 @@ if (isset($_POST['bulk_unarchive_logins'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['login_ids']) { + if (isset($_POST['login_ids'])) { // Get Selected Credential Count $count = count($_POST['login_ids']); @@ -282,7 +282,7 @@ if (isset($_POST['bulk_delete_logins'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['login_ids']) { + if (isset($_POST['login_ids'])) { // Get Selected Credential Count $count = count($_POST['login_ids']); diff --git a/post/user/document.php b/post/user/document.php index e3c0711a..7459a0ce 100644 --- a/post/user/document.php +++ b/post/user/document.php @@ -180,7 +180,7 @@ if (isset($_POST['bulk_move_document'])) { $client_id = intval($row['folder_client_id']); // Move Documents to Folder Loop - if ($_POST['document_ids']) { + if (isset($_POST['document_ids'])) { // Get Selected Count $count = count($_POST['document_ids']); @@ -701,7 +701,7 @@ if (isset($_POST['bulk_delete_documents'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['document_ids']) { + if (isset($_POST['document_ids'])) { // Get selected document count $count = count($_POST['document_ids']); diff --git a/post/user/domain.php b/post/user/domain.php index 68f395ad..8dd6aa50 100644 --- a/post/user/domain.php +++ b/post/user/domain.php @@ -179,7 +179,7 @@ if (isset($_POST['bulk_archive_domains'])) { enforceUserPermission('module_support', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['domain_ids']) { + if (isset($_POST['domain_ids'])) { // Get Selected Count $count = count($_POST['domain_ids']); @@ -216,7 +216,7 @@ if (isset($_POST['bulk_unarchive_domains'])) { enforceUserPermission('module_support', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['domain_ids']) { + if (isset($_POST['domain_ids'])) { // Get Selected Count $count = count($_POST['domain_ids']); @@ -253,7 +253,7 @@ if (isset($_POST['bulk_delete_domains'])) { enforceUserPermission('module_support', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['domain_ids']) { + if (isset($_POST['domain_ids'])) { // Get Selected Count $count = count($_POST['domain_ids']); diff --git a/post/user/expense.php b/post/user/expense.php index cc5faed2..4f70f689 100644 --- a/post/user/expense.php +++ b/post/user/expense.php @@ -119,7 +119,7 @@ if (isset($_POST['bulk_edit_expense_category'])) { $category_name = sanitizeInput($row['category_name']); // Assign category to Selected Expenses - if ($_POST['expense_ids']) { + if (isset($_POST['expense_ids'])) { // Get Selected Count $count = count($_POST['expense_ids']); @@ -159,7 +159,7 @@ if (isset($_POST['bulk_edit_expense_account'])) { $account_name = sanitizeInput($row['account_name']); // Assign account to Selected Expenses - if ($_POST['expense_ids']) { + if (isset($_POST['expense_ids'])) { // Get Selected Contacts Count $count = count($_POST['expense_ids']); @@ -199,7 +199,7 @@ if (isset($_POST['bulk_edit_expense_client'])) { $client_name = sanitizeInput($row['client_name']); // Assign Client to Selected Expenses - if ($_POST['expense_ids']) { + if (isset($_POST['expense_ids'])) { // Get Selected Count $count = count($_POST['expense_ids']); @@ -229,7 +229,7 @@ if (isset($_POST['bulk_delete_expenses'])) { validateAdminRole(); validateCSRFToken($_POST['csrf_token']); - if ($_POST['expense_ids']) { + if (isset($_POST['expense_ids'])) { // Get Selected Count $count = count($_POST['expense_ids']); diff --git a/post/user/file.php b/post/user/file.php index 17af1030..6a209160 100644 --- a/post/user/file.php +++ b/post/user/file.php @@ -176,7 +176,7 @@ if (isset($_POST['bulk_delete_files'])) { validateCSRFToken($_POST['csrf_token']); // Delete file loop - if ($_POST['file_ids']) { + if (isset($_POST['file_ids'])) { // Get selected file Count $file_count = count($_POST['file_ids']); @@ -224,7 +224,7 @@ if (isset($_POST['bulk_move_files'])) { $client_id = intval($row['folder_client_id']); // Check array for data - if ($_POST['file_ids']) { + if (isset($_POST['file_ids'])) { // Get Selected file Count $file_count = count($_POST['file_ids']); diff --git a/post/user/location.php b/post/user/location.php index 6df8c008..03baef26 100644 --- a/post/user/location.php +++ b/post/user/location.php @@ -95,9 +95,11 @@ if(isset($_POST['edit_location'])){ mysqli_query($mysqli, "DELETE FROM location_tags WHERE location_id = $location_id"); // Add new tags - foreach($_POST['tags'] as $tag) { - $tag = intval($tag); - mysqli_query($mysqli, "INSERT INTO location_tags SET location_id = $location_id, tag_id = $tag"); + if (isset($_POST['tags'])) { + foreach($_POST['tags'] as $tag) { + $tag = intval($tag); + mysqli_query($mysqli, "INSERT INTO location_tags SET location_id = $location_id, tag_id = $tag"); + } } //Check to see if a file is attached @@ -214,7 +216,7 @@ if (isset($_POST['bulk_assign_location_tags'])) { enforceUserPermission('module_client', 2); // Assign Tags to Selected - if ($_POST['location_ids']) { + if (isset($_POST['location_ids'])) { // Get Selected Count $count = count($_POST['location_ids']); @@ -234,12 +236,14 @@ if (isset($_POST['bulk_assign_location_tags'])) { } // Add new tags - foreach($_POST['bulk_tags'] as $tag) { - $tag = intval($tag); + if (isset($_POST['bulk_tags'])) { + foreach($_POST['bulk_tags'] as $tag) { + $tag = intval($tag); - $sql = mysqli_query($mysqli,"SELECT * FROM location_tags WHERE location_id = $location_id AND tag_id = $tag"); - if (mysqli_num_rows($sql) == 0) { - mysqli_query($mysqli, "INSERT INTO location_tags SET location_id = $location_id, tag_id = $tag"); + $sql = mysqli_query($mysqli,"SELECT * FROM location_tags WHERE location_id = $location_id AND tag_id = $tag"); + if (mysqli_num_rows($sql) == 0) { + mysqli_query($mysqli, "INSERT INTO location_tags SET location_id = $location_id, tag_id = $tag"); + } } } @@ -262,7 +266,7 @@ if (isset($_POST['bulk_archive_locations'])) { enforceUserPermission('module_client', 2); validateCSRFToken($_POST['csrf_token']); - if ($_POST['location_ids']) { + if (isset($_POST['location_ids'])) { $count = 0; // Default 0 @@ -304,7 +308,7 @@ if (isset($_POST['bulk_unarchive_locations'])) { enforceUserPermission('module_client', 2); validateCSRFToken($_POST['csrf_token']); - if ($_POST['location_ids']) { + if (isset($_POST['location_ids'])) { // Get Selected Count $count = count($_POST['location_ids']); @@ -341,7 +345,7 @@ if (isset($_POST['bulk_delete_locations'])) { enforceUserPermission('module_client', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['location_ids']) { + if (isset($_POST['location_ids'])) { // Get Selected Count $count = count($_POST['location_ids']); diff --git a/post/user/network.php b/post/user/network.php index da2cfa09..f10c3b36 100644 --- a/post/user/network.php +++ b/post/user/network.php @@ -92,7 +92,7 @@ if (isset($_POST['bulk_delete_networks'])) { enforceUserPermission('module_support', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['network_ids']) { + if (isset($_POST['network_ids'])) { // Get Selected Count $count = count($_POST['network_ids']); diff --git a/post/user/product.php b/post/user/product.php index b63b20d2..a29506f4 100644 --- a/post/user/product.php +++ b/post/user/product.php @@ -123,7 +123,7 @@ if (isset($_POST['bulk_edit_product_category'])) { $category_name = sanitizeInput($row['category_name']); // Assign category to Selected Products - if ($_POST['product_ids']) { + if (isset($_POST['product_ids'])) { // Get Count $count = count($_POST['product_ids']); @@ -158,7 +158,7 @@ if (isset($_POST['bulk_archive_products'])) { validateCSRFToken($_POST['csrf_token']); - if ($_POST['product_ids']) { + if (isset($_POST['product_ids'])) { $count = count($_POST['product_ids']); @@ -193,7 +193,7 @@ if (isset($_POST['bulk_unarchive_products'])) { enforceUserPermission('module_sales', 2); validateCSRFToken($_POST['csrf_token']); - if ($_POST['product_ids']) { + if (isset($_POST['product_ids'])) { $count = count($_POST['product_ids']); @@ -228,7 +228,7 @@ if (isset($_POST['bulk_delete_products'])) { enforceUserPermission('module_sales', 3); validateCSRFToken($_POST['csrf_token']); - if ($_POST['product_ids']) { + if (isset($_POST['product_ids'])) { $count = count($_POST['product_ids']); diff --git a/post/user/project.php b/post/user/project.php index 13e6d1b1..96521dc5 100644 --- a/post/user/project.php +++ b/post/user/project.php @@ -199,7 +199,7 @@ if (isset($_POST['add_project_ticket'])) { $project_name = sanitizeInput($row['project_name']); // Add Tickets - if ($_POST['tickets']) { + if (isset($_POST['tickets'])) { // Get Selected Count $count = count($_POST['tickets']); diff --git a/post/user/vendor.php b/post/user/vendor.php index 3dff7002..bdcee359 100644 --- a/post/user/vendor.php +++ b/post/user/vendor.php @@ -163,7 +163,7 @@ if (isset($_POST['bulk_archive_vendors'])) { validateAdminRole(); validateCSRFToken($_POST['csrf_token']); - if (isset($vendor_ids)) { + if (isset($_POST['vendor_ids'])) { // Get Selected Count $count = count($_POST['vendor_ids']); @@ -200,7 +200,7 @@ if (isset($_POST['bulk_unarchive_vendors'])) { validateAdminRole(); validateCSRFToken($_POST['csrf_token']); - if (isset($vendor_ids)) { + if (isset($_POST['vendor_ids'])) { // Get Selected Count $count = count($_POST['vendor_ids']); @@ -237,7 +237,7 @@ if (isset($_POST['bulk_delete_vendors'])) { validateAdminRole(); validateCSRFToken($_POST['csrf_token']); - if (isset($vendor_ids)) { + if (isset($_POST['vendor_ids'])) { // Get Selected Count $count = count($_POST['vendor_ids']);