From f2c71627d8bb3daa41338a7deb1b5b7507c609b5 Mon Sep 17 00:00:00 2001 From: Terranom674 Date: Sun, 16 Aug 2026 23:11:58 +0200 Subject: [PATCH] Preserve current user access when albums become private --- include/album_shares.inc.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/include/album_shares.inc.php b/include/album_shares.inc.php index 66d64d7..3cbc883 100644 --- a/include/album_shares.inc.php +++ b/include/album_shares.inc.php @@ -243,6 +243,31 @@ function bratonien_tools_ensure_private_album_access($category_id, $user_id = nu bratonien_tools_grant_album_access($uid, (int)$category_id); } +function bratonien_tools_preserve_private_album_access() +{ + if (!defined('IN_ADMIN') || $_SERVER['REQUEST_METHOD'] !== 'POST') + { + return; + } + if ((string)($_GET['page'] ?? '') !== 'cat_options' || (string)($_GET['section'] ?? '') !== 'status') + { + return; + } + if (!isset($_POST['falsify']) || empty($_POST['cat_true']) || !is_array($_POST['cat_true'])) + { + return; + } + + check_pwg_token(); + foreach ($_POST['cat_true'] as $category_id) + { + if (preg_match('/^\d+$/', (string)$category_id)) + { + bratonien_tools_ensure_private_album_access((int)$category_id); + } + } +} + function bratonien_tools_album_shares_on_delete_categories($category_ids) { foreach ((array)$category_ids as $category_id)