diff --git a/CHANGELOG.md b/CHANGELOG.md index eecc32916..5db2d09c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ - Fixed issue with poll_users cleaning at every cron job startup [\#1390](https://github.com/torrentpier/torrentpier/pull/1390) ([belomaxorka](https://github.com/belomaxorka)) - Improved word censor 🤐 [\#1393](https://github.com/torrentpier/torrentpier/pull/1393) ([belomaxorka](https://github.com/belomaxorka)) - Used hashing for filenames generation [\#1385](https://github.com/torrentpier/torrentpier/pull/1385) ([belomaxorka](https://github.com/belomaxorka)) -- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391) ([belomaxorka](https://github.com/belomaxorka)) +- Minor improvements [\#1382](https://github.com/torrentpier/torrentpier/pull/1382), [\#1383](https://github.com/torrentpier/torrentpier/pull/1383), [\#1391](https://github.com/torrentpier/torrentpier/pull/1391), [\#1398](https://github.com/torrentpier/torrentpier/pull/1398) ([belomaxorka](https://github.com/belomaxorka)) - Some bugfixes [\#1380](https://github.com/torrentpier/torrentpier/pull/1380) ([belomaxorka](https://github.com/belomaxorka)) - New Crowdin updates [\#1384](https://github.com/torrentpier/torrentpier/pull/1384), [\#1389](https://github.com/torrentpier/torrentpier/pull/1389), [\#1392](https://github.com/torrentpier/torrentpier/pull/1392) ([Exileum](https://github.com/Exileum)) diff --git a/install/sql/mysql.sql b/install/sql/mysql.sql index b79dd72e0..5f98cebda 100644 --- a/install/sql/mysql.sql +++ b/install/sql/mysql.sql @@ -548,9 +548,9 @@ VALUES ('allow_autologin', '1'), ('seed_bonus_points', ''), ('seed_bonus_tor_size', '0'), ('seed_bonus_user_regdate', '0'), - ('site_desc', 'A little text to describe your forum'), + ('site_desc', 'Bull-powered BitTorrent tracker engine'), ('sitemap_time', ''), - ('sitename', 'TorrentPier - Bull-powered BitTorrent tracker engine'), + ('sitename', 'TorrentPier'), ('smilies_path', 'styles/images/smiles'), ('static_sitemap', ''), ('topics_per_page', '50'), diff --git a/library/includes/functions.php b/library/includes/functions.php index 927bbd0f0..78f1e1de7 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -2172,7 +2172,14 @@ 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, $target_blank = false) +/** + * Generates link to profile + * + * @param array $data + * @param bool $target_blank + * @return string + */ +function profile_url(array $data, bool $target_blank = false): string { global $bb_cfg, $lang, $datastore; @@ -2181,33 +2188,33 @@ function profile_url($data, $target_blank = false) $ranks = $datastore->get('ranks'); } + $username = !empty($data['username']) ? $data['username'] : $lang['GUEST']; + $user_id = !empty($data['user_id']) ? (int)$data['user_id'] : GUEST_UID; $user_rank = !empty($data['user_rank']) ? $data['user_rank'] : 0; + $title = ''; + $style = 'colorUser'; if (isset($ranks[$user_rank])) { $title = $ranks[$user_rank]['rank_title']; - $style = $ranks[$user_rank]['rank_style']; + if ($bb_cfg['color_nick']) { + $style = $ranks[$user_rank]['rank_style']; + } } + if (empty($title)) { - $title = $lang['USER']; + $title = match ($user_id) { + GUEST_UID => $lang['GUEST'], + BOT_UID => $username, + default => $lang['USER'], + }; } - if (empty($style)) { - $style = 'colorUser'; - } - - if (!$bb_cfg['color_nick']) { - $style = ''; - } - - $username = !empty($data['username']) ? $data['username'] : $lang['GUEST']; - $user_id = (!empty($data['user_id']) && $username != $lang['GUEST']) ? $data['user_id'] : GUEST_UID; $profile = '' . $username . ''; - - if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) { + if (!in_array($user_id, explode(',', EXCLUDED_USERS))) { $target_blank = $target_blank ? ' target="_blank" ' : ''; $profile = '' . $profile . ''; - if (getBanInfo((int)$user_id)) { + if (getBanInfo($user_id)) { return '' . $profile . ''; } } diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index 709e8146f..6d87539d9 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -159,10 +159,12 @@ if ($submit) { // Валидация данных $cur_pass_valid = $adm_edit; +$can_edit_tpl = []; foreach ($profile_fields as $field => $can_edit) { - // Проверка на возможность редактирования - if ((bool)$can_edit === false) { + $can_edit = (bool)$can_edit; + $can_edit_tpl['CAN_EDIT_' . strtoupper($field)] = $can_edit; + if ($can_edit === false) { // TODO: При continue; не устанавливаются переменные ($tp_data) шаблона прописанные в case // continue; } @@ -195,7 +197,6 @@ foreach ($profile_fields as $field => $can_edit) { $db_data['username'] = $username; } } - $tp_data['CAN_EDIT_USERNAME'] = $can_edit; $tp_data['USERNAME'] = $pr_data['username']; break; @@ -669,6 +670,7 @@ if ($submit && !$errors) { } } +$template->assign_vars($can_edit_tpl); $template->assign_vars($tp_data); $template->assign_vars([ diff --git a/styles/templates/default/usercp_register.tpl b/styles/templates/default/usercp_register.tpl index 5fc461994..cd2fb0c26 100644 --- a/styles/templates/default/usercp_register.tpl +++ b/styles/templates/default/usercp_register.tpl @@ -70,7 +70,7 @@ {L_USERNAME}: * - {USERNAME} + {USERNAME}  {L_EMAIL}: *
{L_EMAIL_EXPLAIN}
diff --git a/viewtopic.php b/viewtopic.php index b02d87bd1..e55a145ef 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -578,7 +578,7 @@ for ($i = 0; $i < $total_posts; $i++) { $rg_signature = $postrow[$i]['group_signature'] ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : ''; $poster_avatar = ''; - if (!$user->opt_js['h_av'] && !$poster_guest) { + if ((!$user->opt_js['h_av'] || $poster_bot) && !$poster_guest) { $poster_avatar = get_avatar($poster_id, $postrow[$i]['avatar_ext_id'], !bf($postrow[$i]['user_opt'], 'user_opt', 'dis_avatar')); } @@ -649,7 +649,7 @@ for ($i = 0; $i < $total_posts; $i++) { // Editing information if ($postrow[$i]['post_edit_count']) { $l_edit_time_total = ($postrow[$i]['post_edit_count'] == 1) ? $lang['EDITED_TIME_TOTAL'] : $lang['EDITED_TIMES_TOTAL']; - $l_edited_by = '

' . sprintf($l_edit_time_total, $poster, bb_date($postrow[$i]['post_edit_time']), $postrow[$i]['post_edit_count']); + $l_edited_by = '

' . sprintf($l_edit_time_total, profile_url(['username' => $poster, 'user_id' => $poster_id, 'user_rank' => $user_rank]), bb_date($postrow[$i]['post_edit_time']), $postrow[$i]['post_edit_count']); } else { $l_edited_by = ''; } @@ -676,7 +676,7 @@ for ($i = 0; $i < $total_posts; $i++) { 'ROW_CLASS' => !($i % 2) ? 'row1' : 'row2', 'POST_ID' => $post_id, 'IS_NEWEST' => ($post_id == $newest), - 'POSTER_NAME' => profile_url(['username' => $poster, 'user_rank' => $user_rank]), + 'POSTER_NAME' => profile_url(['username' => $poster, 'user_id' => $poster_id, 'user_rank' => $user_rank]), 'POSTER_NAME_JS' => addslashes($poster), 'POSTER_RANK' => $poster_rank, 'RANK_IMAGE' => $rank_image,