From 1ba5576ad5a7e4a1e2f8b800b5e03372285542e6 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sun, 21 Jan 2024 14:13:32 +0700 Subject: [PATCH] Use `target="_blank"` in admin for profile_url() redirects (#1330) * Use target="_blank" in admin for profile_url() redirects * Update CHANGELOG.md --- CHANGELOG.md | 1 + admin/admin_log.php | 4 ++-- admin/admin_ug_auth.php | 2 +- admin/admin_user_search.php | 2 +- admin/index.php | 2 +- library/includes/functions.php | 5 +++-- 6 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42c621098..027d0ee82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Release 2.4.1 🦉 ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky)) - Added support for fastly cdn [\#1327](https://github.com/torrentpier/torrentpier/pull/1327) ([belomaxorka](https://github.com/belomaxorka), [kovalensky](https://github.com/kovalensky)) +- Use `target="_blank"` in admin for profile_url() redirects [\#1330](https://github.com/torrentpier/torrentpier/pull/1330) ([belomaxorka](https://github.com/belomaxorka)) - Used declensions for days in some cases [\#1310](https://github.com/torrentpier/torrentpier/pull/1310) ([belomaxorka](https://github.com/belomaxorka)) - Used datastore to show statistic for more performance [\#1309](https://github.com/torrentpier/torrentpier/pull/1309) ([belomaxorka](https://github.com/belomaxorka)) - Used `humn_size()` to count average of releases in tr_stats.php [\#1313](https://github.com/torrentpier/torrentpier/pull/1313) ([belomaxorka](https://github.com/belomaxorka)) diff --git a/admin/admin_log.php b/admin/admin_log.php index dfd39f903..2f51d1350 100644 --- a/admin/admin_log.php +++ b/admin/admin_log.php @@ -262,7 +262,7 @@ if ($log_rowset) { 'ACTION_HREF_S' => url_arg($url, $type_key, $row['log_type_id']), 'USER_ID' => $row['log_user_id'], - 'USERNAME' => profile_url($row), + 'USERNAME' => profile_url($row, true), 'USER_HREF_S' => url_arg($url, $user_key, $row['log_user_id']), 'USER_IP' => \TorrentPier\Helpers\IPHelper::isValid($row['log_user_ip']) ? \TorrentPier\Helpers\IPHelper::long2ip_extended($row['log_user_ip']) : '127.0.0.1', @@ -310,7 +310,7 @@ if ($log_rowset) { // Users if ($user_csv && empty($filter['users'])) { $template->assign_block_vars('users', array( - 'USERNAME' => profile_url($row), + 'USERNAME' => profile_url($row, true), )); $filter['users'] = true; } diff --git a/admin/admin_ug_auth.php b/admin/admin_ug_auth.php index af4896672..06c8286b1 100644 --- a/admin/admin_ug_auth.php +++ b/admin/admin_ug_auth.php @@ -280,7 +280,7 @@ if ($mode == 'user' && (!empty($_POST['username']) || $user_id)) { $template->assign_vars(array( 'TPL_AUTH_UG_MAIN' => true, - 'USER_OR_GROUPNAME' => profile_url($this_userdata), + 'USER_OR_GROUPNAME' => profile_url($this_userdata, true), 'USER_LEVEL' => $lang['USER_LEVEL'] . ' : ' . $s_user_type, 'T_USER_OR_GROUPNAME' => $lang['USERNAME'], 'T_AUTH_TITLE' => $lang['AUTH_CONTROL_USER'], diff --git a/admin/admin_user_search.php b/admin/admin_user_search.php index 7bd2b1ec8..810276e09 100644 --- a/admin/admin_user_search.php +++ b/admin/admin_user_search.php @@ -922,7 +922,7 @@ if (!isset($_REQUEST['dosearch'])) { $template->assign_block_vars('userrow', [ 'ROW_CLASS' => $row_class, - 'USER' => profile_url($rowset[$i]), + 'USER' => profile_url($rowset[$i], true), 'EMAIL' => $rowset[$i]['user_email'], 'JOINDATE' => bb_date($rowset[$i]['user_regdate']), 'LASTVISIT' => $rowset[$i]['user_lastvisit'] ? bb_date($rowset[$i]['user_lastvisit']) : $lang['NEVER'], diff --git a/admin/index.php b/admin/index.php index 844336e9c..015568166 100644 --- a/admin/index.php +++ b/admin/index.php @@ -165,7 +165,7 @@ if (isset($_GET['pane']) && $_GET['pane'] == 'left') { $template->assign_block_vars('reg_user_row', [ 'ROW_CLASS' => $row_class, - 'USER' => profile_url($onlinerow_reg[$i]), + 'USER' => profile_url($onlinerow_reg[$i], true), 'STARTED' => bb_date($onlinerow_reg[$i]['session_start'], 'H:i', false), 'LASTUPDATE' => bb_date($onlinerow_reg[$i]['user_session_time'], 'H:i', false), 'IP_ADDRESS' => $reg_ip, diff --git a/library/includes/functions.php b/library/includes/functions.php index 8de7c2e99..1ed58ffad 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2202,7 +2202,7 @@ function send_pm($user_id, $subject, $message, $poster_id = BOT_UID) DB()->query("UPDATE " . BB_USERS . " SET user_new_privmsg = user_new_privmsg + 1, user_last_privmsg = " . TIMENOW . ", user_newest_pm_id = $pm_id WHERE user_id = $user_id"); } -function profile_url($data) +function profile_url($data, $target_blank = false) { global $bb_cfg, $lang, $datastore; @@ -2234,7 +2234,8 @@ function profile_url($data) $profile = '' . $username . ''; if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) { - $profile = '' . $profile . ''; + $target_blank = $target_blank ? ' target="_blank" ' : ''; + $profile = '' . $profile . ''; if (getBanInfo((int)$user_id)) { return '' . $profile . '';