Use target="_blank" in admin for profile_url() redirects (#1330)

* Use target="_blank" in admin for profile_url() redirects

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2024-01-21 14:13:32 +07:00 committed by GitHub
commit 1ba5576ad5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 9 additions and 7 deletions

View file

@ -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))

View file

@ -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;
}

View file

@ -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'],

View file

@ -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'],

View file

@ -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,

View file

@ -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 = '<span title="' . $title . '" class="' . $style . '">' . $username . '</span>';
if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) {
$profile = '<a href="' . make_url(PROFILE_URL . $user_id) . '">' . $profile . '</a>';
$target_blank = $target_blank ? ' target="_blank" ' : '';
$profile = '<a ' . $target_blank . ' href="' . make_url(PROFILE_URL . $user_id) . '">' . $profile . '</a>';
if (getBanInfo((int)$user_id)) {
return '<s>' . $profile . '</s>';