From 139bb6fd73476cf596aad7816bddb17ee2a0e74b Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 26 Mar 2022 11:10:27 -0400 Subject: [PATCH] Set item_view to 0 when sharing a link --- client_assets.php | 8 ++++++-- post.php | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client_assets.php b/client_assets.php index 6a92c4e3..87992935 100644 --- a/client_assets.php +++ b/client_assets.php @@ -84,11 +84,15 @@ if(isset($_GET['type']) && ($_GET['type']) == 'workstation'){ //Rebuild URL $url_query_strings_sb = http_build_query(array_merge($_GET,array('sb' => $sb, 'o' => $o))); -$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM assets LEFT JOIN contacts ON asset_contact_id = contact_id LEFT JOIN locations ON asset_location_id = location_id LEFT JOIN logins ON login_asset_id = asset_id +$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM assets + LEFT JOIN contacts ON asset_contact_id = contact_id + LEFT JOIN locations ON asset_location_id = location_id + LEFT JOIN logins ON login_asset_id = asset_id WHERE asset_client_id = $client_id AND (asset_name 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 $sb $o LIMIT $record_from, $record_to" +); $num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); diff --git a/post.php b/post.php index c2f776e5..597d01e4 100644 --- a/post.php +++ b/post.php @@ -1340,7 +1340,7 @@ if(isset($_GET['share_generate_link'])){ } // Insert entry into DB - $sql = mysqli_query($mysqli, "INSERT INTO shared_items SET item_active = '1', item_key = '$item_key', item_type = '$item_type', item_related_id = '$item_id', item_encrypted_credential = '$item_encrypted_credential', item_note = '$item_note', item_view_limit = '$item_view_limit', item_created_at = NOW(), item_expire_at = '$item_expires', item_client_id = '$client_id'"); + $sql = mysqli_query($mysqli, "INSERT INTO shared_items SET item_active = '1', item_key = '$item_key', item_type = '$item_type', item_related_id = '$item_id', item_encrypted_credential = '$item_encrypted_credential', item_note = '$item_note', item_views = 0, item_view_limit = '$item_view_limit', item_created_at = NOW(), item_expire_at = '$item_expires', item_client_id = '$client_id'"); $share_id = $mysqli->insert_id; // Return URL