mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-20 13:24:01 -07:00
Minor improvements (#1398)
* Minor improvements * Update viewtopic.php * Update functions.php * Update functions.php * Update usercp_register.tpl * Update register.php * Update register.php * Update CHANGELOG.md
This commit is contained in:
parent
a63b25f8ba
commit
7c703164d2
6 changed files with 35 additions and 26 deletions
|
@ -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))
|
||||
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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'];
|
||||
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 = '<span title="' . $title . '" class="' . $style . '">' . $username . '</span>';
|
||||
|
||||
if (!in_array($user_id, explode(',', EXCLUDED_USERS)) && $username) {
|
||||
if (!in_array($user_id, explode(',', EXCLUDED_USERS))) {
|
||||
$target_blank = $target_blank ? ' target="_blank" ' : '';
|
||||
$profile = '<a ' . $target_blank . ' href="' . make_url(PROFILE_URL . $user_id) . '">' . $profile . '</a>';
|
||||
|
||||
if (getBanInfo((int)$user_id)) {
|
||||
if (getBanInfo($user_id)) {
|
||||
return '<s>' . $profile . '</s>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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([
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
</tr>
|
||||
<tr>
|
||||
<td class="prof-title">{L_USERNAME}: *</td>
|
||||
<td><!-- IF CAN_EDIT_USERNAME --><input id="username" onBlur="ajax.exec({ action: 'user_register', mode: 'check_name', username: $('#username').val()}); return false;" type="text" name="username" size="35" maxlength="25" value="{USERNAME}"/><!-- ELSE --><b>{USERNAME}</b><!-- ENDIF --><span id="check_name"></span></td>
|
||||
<td><!-- IF CAN_EDIT_USERNAME --><input id="username" onBlur="ajax.exec({ action: 'user_register', mode: 'check_name', username: $('#username').val()}); return false;" type="text" name="username" size="35" maxlength="25" value="{USERNAME}"/><!-- ELSE --><b>{USERNAME}</b><!-- ENDIF --> <span id="check_name"></span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="prof-title">{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><br/><h6>{L_EMAIL_EXPLAIN}</h6><!-- ENDIF --></td>
|
||||
|
|
|
@ -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 = '<br /><br />' . sprintf($l_edit_time_total, $poster, bb_date($postrow[$i]['post_edit_time']), $postrow[$i]['post_edit_count']);
|
||||
$l_edited_by = '<br /><br />' . 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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue