From 494d99598d3753d471892e5e9ed0c6e5460ef8a3 Mon Sep 17 00:00:00 2001 From: plegall Date: Tue, 22 Sep 2020 16:18:54 +0200 Subject: [PATCH] fixes #1223 clean variables to manage lock/unlock --- admin/cat_modify.php | 13 +++++++------ admin/themes/default/template/cat_modify.tpl | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/admin/cat_modify.php b/admin/cat_modify.php index c75f2e47a..e3daa0def 100644 --- a/admin/cat_modify.php +++ b/admin/cat_modify.php @@ -99,7 +99,6 @@ if ( !isset( $_GET['cat_id'] ) || !is_numeric( $_GET['cat_id'] ) ) //--------------------------------------------------------- form criteria check if (isset($_POST['submit'])) { - $data = array( 'id' => $_GET['cat_id'], 'name' => @$_POST['name'], @@ -132,13 +131,15 @@ UPDATE '.CATEGORIES_TABLE.' // retrieve cat infos before continuing (following updates are expensive) $cat_info = get_cat_info($_GET['cat_id']); - if (isset($_POST['visible'])) + $visible = false; + if (!isset($_POST['locked'])) { - set_cat_visible(array($_GET['cat_id']), true, true); + $visible = true; } - elseif ($cat_info['visible'] != isset($_POST['visible'])) + + if ($visible !== $cat_info['visible']) { - set_cat_visible(array($_GET['cat_id']), $_POST['visible']); + set_cat_visible(array($_GET['cat_id']), $visible); } // in case the use moves his album to the gallery root, we force @@ -276,7 +277,7 @@ $template->assign( 'CAT_ID' => $category['id'], 'CAT_NAME' => @htmlspecialchars($category['name']), 'CAT_COMMENT' => @htmlspecialchars($category['comment']), - 'CAT_VISIBLE' => boolean_to_string($category['visible']), + 'IS_LOCKED' => !get_boolean($category['visible']), 'U_JUMPTO' => make_index_url( array( diff --git a/admin/themes/default/template/cat_modify.tpl b/admin/themes/default/template/cat_modify.tpl index 8e2022222..c0c02cee9 100644 --- a/admin/themes/default/template/cat_modify.tpl +++ b/admin/themes/default/template/cat_modify.tpl @@ -278,7 +278,7 @@ function cropImage() {
{'Unlocked'|@translate} {'Locked'|@translate}