From e9fad73bca9b3f0284a5d098ec7e7958513f2e7e Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Mon, 18 Nov 2024 23:05:41 +0700 Subject: [PATCH] Minor improvements (#1679) * Minor improvements * Update viewtopic.php * Revert "Update viewtopic.php" This reverts commit 9cff1d775830ff1f0668c26cd7ed39e5502b0004. * Update viewtopic.php * Update CHANGELOG.md --- CHANGELOG.md | 2 +- viewtopic.php | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d64cbf97..8d32ce7bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,7 +24,7 @@ - Fixed `md5()` deprecated in PHP 8.4 [\#1561](https://github.com/torrentpier/torrentpier/pull/1561) ([belomaxorka](https://github.com/belomaxorka)) - Increased `USEREMAIL_MAX_LENGTH` [\#1566](https://github.com/torrentpier/torrentpier/pull/1566) ([belomaxorka](https://github.com/belomaxorka)) - Disabled resizing for textarea tag [\#1638](https://github.com/torrentpier/torrentpier/pull/1638) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611), [\#1612](https://github.com/torrentpier/torrentpier/pull/1612), [\#1615](https://github.com/torrentpier/torrentpier/pull/1615), [\#1627](https://github.com/torrentpier/torrentpier/pull/1627), [\#1633](https://github.com/torrentpier/torrentpier/pull/1633), [\#1641](https://github.com/torrentpier/torrentpier/pull/1641), [\#1651](https://github.com/torrentpier/torrentpier/pull/1651), [\#1658](https://github.com/torrentpier/torrentpier/pull/1658), [\#1674](https://github.com/torrentpier/torrentpier/pull/1674), [\#1675](https://github.com/torrentpier/torrentpier/pull/1675), [\#1676](https://github.com/torrentpier/torrentpier/pull/1676) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1570](https://github.com/torrentpier/torrentpier/pull/1570), [\#1571](https://github.com/torrentpier/torrentpier/pull/1571), [\#1575](https://github.com/torrentpier/torrentpier/pull/1575), [\#1589](https://github.com/torrentpier/torrentpier/pull/1589), [\#1592](https://github.com/torrentpier/torrentpier/pull/1592), [\#1605](https://github.com/torrentpier/torrentpier/pull/1605), [\#1611](https://github.com/torrentpier/torrentpier/pull/1611), [\#1612](https://github.com/torrentpier/torrentpier/pull/1612), [\#1615](https://github.com/torrentpier/torrentpier/pull/1615), [\#1627](https://github.com/torrentpier/torrentpier/pull/1627), [\#1633](https://github.com/torrentpier/torrentpier/pull/1633), [\#1641](https://github.com/torrentpier/torrentpier/pull/1641), [\#1651](https://github.com/torrentpier/torrentpier/pull/1651), [\#1658](https://github.com/torrentpier/torrentpier/pull/1658), [\#1674](https://github.com/torrentpier/torrentpier/pull/1674), [\#1675](https://github.com/torrentpier/torrentpier/pull/1675), [\#1676](https://github.com/torrentpier/torrentpier/pull/1676), [\#1679](https://github.com/torrentpier/torrentpier/pull/1679) ([belomaxorka](https://github.com/belomaxorka)) - Updated `modern-normalize` to `v3.0.1` [\#1669](https://github.com/torrentpier/torrentpier/pull/1669) ([belomaxorka](https://github.com/belomaxorka)) - Updated deps [\#1563](https://github.com/torrentpier/torrentpier/pull/1563), [\#1564](https://github.com/torrentpier/torrentpier/pull/1564), [\#1608](https://github.com/torrentpier/torrentpier/pull/1608), [\#1609](https://github.com/torrentpier/torrentpier/pull/1609), [\#1610](https://github.com/torrentpier/torrentpier/pull/1610), [\#1637](https://github.com/torrentpier/torrentpier/pull/1637), [\#1646](https://github.com/torrentpier/torrentpier/pull/1646), [\#1647](https://github.com/torrentpier/torrentpier/pull/1647), [\#1650](https://github.com/torrentpier/torrentpier/pull/1650), [\#1656](https://github.com/torrentpier/torrentpier/pull/1656), [\#1677](https://github.com/torrentpier/torrentpier/pull/1677) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1569](https://github.com/torrentpier/torrentpier/pull/1569), [\#1572](https://github.com/torrentpier/torrentpier/pull/1572), [\#1573](https://github.com/torrentpier/torrentpier/pull/1573), [\#1574](https://github.com/torrentpier/torrentpier/pull/1574), [\#1588](https://github.com/torrentpier/torrentpier/pull/1588), [\#1590](https://github.com/torrentpier/torrentpier/pull/1590), [\#1600](https://github.com/torrentpier/torrentpier/pull/1600), [\#1601](https://github.com/torrentpier/torrentpier/pull/1601), [\#1606](https://github.com/torrentpier/torrentpier/pull/1606), [\#1607](https://github.com/torrentpier/torrentpier/pull/1607), [\#1625](https://github.com/torrentpier/torrentpier/pull/1625), [\#1626](https://github.com/torrentpier/torrentpier/pull/1626), [\#1629](https://github.com/torrentpier/torrentpier/pull/1629), [\#1630](https://github.com/torrentpier/torrentpier/pull/1630), [\#1631](https://github.com/torrentpier/torrentpier/pull/1631), [\#1632](https://github.com/torrentpier/torrentpier/pull/1632), [\#1639](https://github.com/torrentpier/torrentpier/pull/1639), [\#1640](https://github.com/torrentpier/torrentpier/pull/1640), [\#1654](https://github.com/torrentpier/torrentpier/pull/1654), [\#1655](https://github.com/torrentpier/torrentpier/pull/1655) ([Exileum](https://github.com/Exileum)) diff --git a/viewtopic.php b/viewtopic.php index a9d674905..9aa4bf3cf 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -177,9 +177,11 @@ if (!$is_auth['auth_read']) { } $forum_name = $t_data['forum_name']; +$parent_id = (is_numeric($t_data['forum_parent']) && $t_data['forum_parent'] > 0) ? $t_data['forum_parent'] : false; $topic_title = $t_data['topic_title']; $topic_id = $t_data['topic_id']; $topic_time = $t_data['topic_time']; +$locked = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED); $moderation = (!empty($_REQUEST['mod']) && $is_auth['auth_mod']); @@ -218,8 +220,8 @@ if (!$forums = $datastore->get('cat_forums') and !$datastore->has('cat_forums')) $template->assign_vars([ 'CAT_TITLE' => $forums['cat_title_html'][$t_data['cat_id']], 'U_VIEWCAT' => CAT_URL . $t_data['cat_id'], - 'PARENT_FORUM_HREF' => ($parent_id = $t_data['forum_parent']) ? FORUM_URL . $parent_id : '', - 'PARENT_FORUM_NAME' => ($parent_id = $t_data['forum_parent']) ? htmlCHR($forums['f'][$parent_id]['forum_name']) : '', + 'PARENT_FORUM_HREF' => $parent_id ? FORUM_URL . $parent_id : '', + 'PARENT_FORUM_NAME' => $parent_id ? htmlCHR($forums['f'][$parent_id]['forum_name']) : '', ]); unset($forums); $datastore->rm('cat_forums'); @@ -371,8 +373,8 @@ $view_forum_url = FORUM_URL . $forum_id; $view_prev_topic_url = TOPIC_URL . $topic_id . "&view=previous#newest"; $view_next_topic_url = TOPIC_URL . $topic_id . "&view=next#newest"; -$reply_img = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED) ? $images['reply_locked'] : $images['reply_new']; -$reply_alt = ($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED) ? $lang['TOPIC_LOCKED_SHORT'] : $lang['REPLY_TO_TOPIC']; +$reply_img = $locked ? $images['reply_locked'] : $images['reply_new']; +$reply_alt = $locked ? $lang['TOPIC_LOCKED_SHORT'] : $lang['REPLY_TO_TOPIC']; // Set 'body' template for attach_mod $template->set_filenames(['body' => 'viewtopic.tpl']); @@ -600,7 +602,7 @@ for ($i = 0; $i < $total_posts; $i++) { } if (!$poster_bot) { - $quote_btn = ($is_auth['auth_reply'] && !($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED)); + $quote_btn = ($is_auth['auth_reply'] && !$locked); $edit_btn = (($userdata['user_id'] == $poster_id && $is_auth['auth_edit']) || $is_auth['auth_mod']); $ip_btn = ($is_auth['auth_mod'] || IS_MOD); } @@ -756,7 +758,7 @@ if (defined('SPLIT_FORM_START')) { // Quick Reply if ($bb_cfg['show_quick_reply']) { - if ($is_auth['auth_reply'] && !($t_data['forum_status'] == FORUM_LOCKED || $t_data['topic_status'] == TOPIC_LOCKED)) { + if ($is_auth['auth_reply'] && !$locked) { $template->assign_vars([ 'QUICK_REPLY' => true, 'QR_POST_ACTION' => POSTING_URL,