diff --git a/client_routes.php b/client_routes.php index 0a2e87a2..c3c4d505 100644 --- a/client_routes.php +++ b/client_routes.php @@ -102,6 +102,11 @@ if(isset($_GET['tab'])){ elseif($_GET['tab'] == "logs"){ include("client_logs.php"); } + elseif($_GET['tab'] == "shared-items"){ + if($session_user_role > 1){ + include("client_shared_items.php"); + } + } } else{ include("client_overview.php"); diff --git a/client_shared_items.php b/client_shared_items.php new file mode 100644 index 00000000..ee1c5fa6 --- /dev/null +++ b/client_shared_items.php @@ -0,0 +1,152 @@ + $sb, 'o' => $o))); + +$sql = mysqli_query($mysqli,"SELECT SQL_CALC_FOUND_ROWS * FROM shared_items + WHERE item_client_id = $client_id + 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"); + +$num_rows = mysqli_fetch_row(mysqli_query($mysqli,"SELECT FOUND_ROWS()")); + +?> + +
+
+

Shared Items (Links)

+
+
+
+ + +
+ +
+
+ +
+ +
+
+
+ +
+
+
+
+ + "> + + + + + + + + + + + + + + + + + + + + + + + +
Item NameItem TypeShare NoteViewsExpiresAction
+ + + +
+
+ +
+
\ No newline at end of file diff --git a/client_side_nav.php b/client_side_nav.php index e77b0fc4..523e29af 100644 --- a/client_side_nav.php +++ b/client_side_nav.php @@ -306,6 +306,13 @@ + + diff --git a/post.php b/post.php index 8b25dc1e..c6d230ce 100644 --- a/post.php +++ b/post.php @@ -6974,6 +6974,33 @@ if (isset($_POST['rename_document_tag'])) { } +if(isset($_GET['deactivate_shared_item'])){ + if($session_user_role != 3){ + $_SESSION['alert_type'] = "danger"; + $_SESSION['alert_message'] = "You are not permitted to do that!"; + header("Location: " . $_SERVER["HTTP_REFERER"]); + exit(); + } + + $item_id = intval($_GET['deactivate_shared_item']); + + // Get details of the shared link + $sql = mysqli_query($mysqli, "SELECT item_type, item_related_id, item_client_id FROM shared_items WHERE item_id = '$item_id'"); + $row = mysqli_fetch_array($sql); + $item_type = $row['item_type']; + $item_related_id = $row['item_related_id']; + $item_client_id = $row['item_client_id']; + + // Deactivate item id + mysqli_query($mysqli, "UPDATE shared_items SET item_active = '0' WHERE item_id = '$item_id'"); + + // Logging + mysqli_query($mysqli,"INSERT INTO logs SET log_type = 'Sharing', log_action = 'Delete', log_description = '$session_name deactivated shared $item_type link. Item ID: $item_related_id. Share ID $item_id', log_ip = '$session_ip', log_user_agent = '$session_user_agent', log_created_at = NOW(), log_client_id = '$item_client_id', log_user_id = $session_user_id, company_id = $session_company_id"); + + $_SESSION['alert_message'] = "Link deactivated"; + header("Location: " . $_SERVER["HTTP_REFERER"]); +} + if(isset($_GET['force_recurring'])){ $recurring_id = intval($_GET['force_recurring']);