diff --git a/CHANGELOG.md b/CHANGELOG.md index b86b42a18..2bc5c0059 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,6 +26,7 @@ - Some enhancements in default template [\#1312](https://github.com/torrentpier/torrentpier/pull/1312) ([belomaxorka](https://github.com/belomaxorka)) - Some enhancements in default template (Part 2) [\#1322](https://github.com/torrentpier/torrentpier/pull/1322) ([belomaxorka](https://github.com/belomaxorka)) - Set response code in some cases [\#1319](https://github.com/torrentpier/torrentpier/pull/1319) ([belomaxorka](https://github.com/belomaxorka)) +- Fixed `admin_terms.php` textarea reset in preview mode [\#1371](https://github.com/torrentpier/torrentpier/pull/1371) ([belomaxorka](https://github.com/belomaxorka)) - Fixed broken user dl status [\#1351](https://github.com/torrentpier/torrentpier/pull/1351) ([belomaxorka](https://github.com/belomaxorka)) - Fixed auth(): empty $f_access [\#1329](https://github.com/torrentpier/torrentpier/pull/1329) ([belomaxorka](https://github.com/belomaxorka)) - Fixed download counter for torrents [\#1346](https://github.com/torrentpier/torrentpier/pull/1346) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/admin/admin_terms.php b/admin/admin_terms.php index b48138d6b..7f0c92e39 100644 --- a/admin/admin_terms.php +++ b/admin/admin_terms.php @@ -15,7 +15,9 @@ if (!empty($setmodules)) { require __DIR__ . '/pagestart.php'; require INC_DIR . '/bbcode.php'; -if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) { +$preview = isset($_POST['preview']); + +if (isset($_POST['post']) && ($bb_cfg['terms'] !== $_POST['message'])) { bb_update_config(['terms' => $_POST['message']]); bb_die($lang['CONFIG_UPDATED']); } @@ -23,8 +25,8 @@ if (isset($_POST['post']) && $bb_cfg['terms'] != $_POST['message']) { $template->assign_vars([ 'S_ACTION' => 'admin_terms.php', 'EXT_LINK_NW' => $bb_cfg['ext_link_new_win'], - 'MESSAGE' => $bb_cfg['terms'] ?: '', - 'PREVIEW_HTML' => isset($_REQUEST['preview']) ? bbcode2html($_POST['message']) : '', + 'MESSAGE' => $preview ? $_POST['message'] : $bb_cfg['terms'], + 'PREVIEW_HTML' => $preview ? bbcode2html($_POST['message']) : '', ]); print_page('admin_terms.tpl', 'admin');