Minor improvements (#1125)

* Minor improvements

* Updated

* Updated

* Updated

* Update viewtopic.php

* Update viewtopic.php

* Update viewtopic.php

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-11-19 14:37:25 +07:00 committed by GitHub
commit 9ebe3a4d5c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 58 additions and 59 deletions

View file

@ -26,7 +26,7 @@
- Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky)) - Translations for config.php, raised scrape interval [\#1100](https://github.com/torrentpier/torrentpier/pull/1100) ([kovalensky](https://github.com/kovalensky))
- Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky)) - Don't re-announce for hybrids if the event is "stopped" [\#1099](https://github.com/torrentpier/torrentpier/pull/1099) ([kovalensky](https://github.com/kovalensky))
- Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka)) - Security measures [\#1098](https://github.com/torrentpier/torrentpier/pull/1098), [\#1113](https://github.com/torrentpier/torrentpier/pull/1113) ([kovalensky](https://github.com/kovalensky), [belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122), [\#1123](https://github.com/torrentpier/torrentpier/pull/1123) ([belomaxorka](https://github.com/belomaxorka)) - Minor improvements [\#1121](https://github.com/torrentpier/torrentpier/pull/1121), [\#1122](https://github.com/torrentpier/torrentpier/pull/1122), [\#1123](https://github.com/torrentpier/torrentpier/pull/1123), [\#1125](https://github.com/torrentpier/torrentpier/pull/1125) ([belomaxorka](https://github.com/belomaxorka))
- New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101) ([Exileum](https://github.com/Exileum)) - New Crowdin updates [\#1097](https://github.com/torrentpier/torrentpier/pull/1097), [\#1101](https://github.com/torrentpier/torrentpier/pull/1101) ([Exileum](https://github.com/Exileum))
## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14) ## [v2.4.0-beta4](https://github.com/torrentpier/torrentpier/tree/v2.4.0-beta4) (2023-11-14)

View file

@ -44,7 +44,7 @@ if ($is_moderator) {
bb_die(implode($upload->errors)); bb_die(implode($upload->errors));
} }
DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id"); DB()->query("UPDATE " . BB_GROUPS . " SET avatar_ext_id = $avatar_ext_id WHERE group_id = $group_id LIMIT 1");
} }
} }

View file

@ -36,7 +36,7 @@ switch ($mode) {
$this->ajax_die('Invalid mode'); $this->ajax_die('Invalid mode');
} }
DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id"); DB()->query("UPDATE " . BB_USERS . " SET avatar_ext_id = $new_ext_id WHERE user_id = $user_id LIMIT 1");
\TorrentPier\Sessions::cache_rm_user_sessions($user_id); \TorrentPier\Sessions::cache_rm_user_sessions($user_id);

View file

@ -65,7 +65,7 @@ if ($user_list) {
send_pm($t_data['poster_id'], $subject, $message, BOT_UID); send_pm($t_data['poster_id'], $subject, $message, BOT_UID);
} }
DB()->query("UPDATE " . BB_BT_TORRENTS . " SET call_seed_time = " . TIMENOW . " WHERE topic_id = $topic_id"); DB()->query("UPDATE " . BB_BT_TORRENTS . " SET call_seed_time = " . TIMENOW . " WHERE topic_id = $topic_id LIMIT 1");
function topic_info($topic_id) function topic_info($topic_id)
{ {

View file

@ -30,7 +30,7 @@ foreach ($bf['user_opt'] as $opt_name => $opt_bit) {
} }
} }
DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id"); DB()->query("UPDATE " . BB_USERS . " SET user_opt = {$u_data['user_opt']} WHERE user_id = $user_id LIMIT 1");
// Удаляем данные из кеша // Удаляем данные из кеша
\TorrentPier\Sessions::cache_rm_user_sessions($user_id); \TorrentPier\Sessions::cache_rm_user_sessions($user_id);

View file

@ -55,7 +55,7 @@ switch ($mode) {
$topic_title_sql = DB()->escape($new_title); $topic_title_sql = DB()->escape($new_title);
DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id"); DB()->query("UPDATE " . BB_TOPICS . " SET topic_title = '$topic_title_sql' WHERE topic_id = $topic_id LIMIT 1");
// Обновление кеша новостей на главной // Обновление кеша новостей на главной
$news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id'])); $news_forums = array_flip(explode(',', $bb_cfg['latest_news_forum_id']));

View file

@ -135,9 +135,9 @@ switch ($this->request['type']) {
$this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies'])); $this->ajax_die(sprintf($lang['MAX_SMILIES_PER_POST'], $bb_cfg['max_smilies']));
} }
} }
DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id"); DB()->query("UPDATE " . BB_POSTS_TEXT . " SET post_text = '" . DB()->escape($text) . "' WHERE post_id = $post_id LIMIT 1");
if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id']) { if ($post['topic_last_post_id'] != $post['post_id'] && $userdata['user_id'] == $post['poster_id']) {
DB()->query("UPDATE " . BB_POSTS . " SET post_edit_time = '" . TIMENOW . "', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id"); DB()->query("UPDATE " . BB_POSTS . " SET post_edit_time = '" . TIMENOW . "', post_edit_count = post_edit_count + 1 WHERE post_id = $post_id LIMIT 1");
} }
$s_text = str_replace('\n', "\n", $text); $s_text = str_replace('\n', "\n", $text);
$s_topic_title = str_replace('\n', "\n", $post['topic_title']); $s_topic_title = str_replace('\n', "\n", $post['topic_title']);
@ -229,7 +229,7 @@ switch ($this->request['type']) {
$message = prepare_message($message); $message = prepare_message($message);
// Flood control // Flood control
$where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}"; $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql"; $sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";
if ($row = DB()->fetch_row($sql) and $row['last_post_time']) { if ($row = DB()->fetch_row($sql) and $row['last_post_time']) {

View file

@ -42,7 +42,7 @@ switch ($mode) {
if ($err = \TorrentPier\Validate::password($pass, $pass_confirm)) { if ($err = \TorrentPier\Validate::password($pass, $pass_confirm)) {
$html = '<img src="./styles/images/bad.gif"> <span class="leechmed bold">' . $err . '</span>'; $html = '<img src="./styles/images/bad.gif"> <span class="leechmed bold">' . $err . '</span>';
} else { } else {
$text = (IS_GUEST) ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK']; $text = IS_GUEST ? $lang['CHOOSE_PASS_REG_OK'] : $lang['CHOOSE_PASS_OK'];
$html = '<img src="./styles/images/good.gif"> <span class="seedmed bold">' . $text . '</span>'; $html = '<img src="./styles/images/good.gif"> <span class="seedmed bold">' . $text . '</span>';
} }
break; break;

View file

@ -1025,7 +1025,7 @@ function make_jumpbox()
$jumpbox = $datastore->get('jumpbox'); $jumpbox = $datastore->get('jumpbox');
} }
$template->assign_vars(['JUMPBOX' => (IS_GUEST) ? DB()->escape($jumpbox['guest']) : DB()->escape($jumpbox['user'])]); $template->assign_vars(['JUMPBOX' => IS_GUEST ? DB()->escape($jumpbox['guest']) : DB()->escape($jumpbox['user'])]);
} }
// $mode: array(not_auth_forum1,not_auth_forum2,..) or (string) 'mode' // $mode: array(not_auth_forum1,not_auth_forum2,..) or (string) 'mode'

View file

@ -119,7 +119,7 @@ $template->assign_vars([
'USER_LANG' => $userdata['user_lang'], 'USER_LANG' => $userdata['user_lang'],
'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']), 'INCLUDE_BBCODE_JS' => !empty($page_cfg['include_bbcode_js']),
'USER_OPTIONS_JS' => (IS_GUEST) ? '{}' : json_encode($user->opt_js, JSON_THROW_ON_ERROR), 'USER_OPTIONS_JS' => IS_GUEST ? '{}' : json_encode($user->opt_js, JSON_THROW_ON_ERROR),
'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']), 'USE_TABLESORTER' => !empty($page_cfg['use_tablesorter']),

View file

@ -90,7 +90,7 @@ $url = basename(__FILE__);
$anon_id = GUEST_UID; $anon_id = GUEST_UID;
$user_id = $userdata['user_id']; $user_id = $userdata['user_id'];
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
$search_id = (isset($_GET['id']) && verify_id($_GET['id'], SEARCH_ID_LENGTH)) ? $_GET['id'] : ''; $search_id = (isset($_GET['id']) && verify_id($_GET['id'], SEARCH_ID_LENGTH)) ? $_GET['id'] : '';
$session_id = $userdata['session_id']; $session_id = $userdata['session_id'];
@ -800,11 +800,11 @@ else {
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'FORUM_NAME' => $forum_name_html[$forum_id], 'FORUM_NAME' => $forum_name_html[$forum_id],
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'], 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPIC_TITLE' => wbr($topic['topic_title']),
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $topic['topic_replies'], $bb_cfg['posts_per_page']),
'REPLIES' => $topic['topic_replies'], 'REPLIES' => $topic['topic_replies'],
'ATTACH' => $topic['topic_attachment'], 'ATTACH' => $topic['topic_attachment'],
'STATUS' => $topic['topic_status'], 'STATUS' => $topic['topic_status'],

View file

@ -101,7 +101,7 @@ class Post
// Flood control // Flood control
$row = null; $row = null;
$where_sql = (IS_GUEST) ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}"; $where_sql = IS_GUEST ? "p.poster_ip = '" . USER_IP . "'" : "p.poster_id = {$userdata['user_id']}";
if ($mode == 'newtopic' || $mode == 'reply') { if ($mode == 'newtopic' || $mode == 'reply') {
$sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql"; $sql = "SELECT MAX(p.post_time) AS last_post_time FROM " . BB_POSTS . " p WHERE $where_sql";

View file

@ -645,7 +645,7 @@ class Torrent
} }
} else { } else {
// Update exists passkey // Update exists passkey
DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id"); DB()->query("UPDATE IGNORE " . BB_BT_USERS . " SET auth_key = '$passkey_val' WHERE user_id = $user_id LIMIT 1");
if (DB()->affected_rows() == 1) { if (DB()->affected_rows() == 1) {
// Ocelot // Ocelot
if ($bb_cfg['ocelot']['enabled']) { if ($bb_cfg['ocelot']['enabled']) {

View file

@ -246,20 +246,15 @@ ajax.callback.index_data = function(data) {
<tr> <tr>
<th>{L_ICQ}:</th> <th>{L_ICQ}:</th>
<td class="tLeft med" id="user_icq"> <td class="tLeft med" id="user_icq">
<span class="editable">{ICQ} <span class="editable">{ICQ}</span>
<a href="http://www.icq.com/people/{ICQ}"><img align="middle" src="http://web.icq.com/whitepages/online?icq={ICQ}&img=5"></a>
</span>
</td> </td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->
<!-- IF SKYPE --> <!-- IF SKYPE -->
<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
<tr> <tr>
<th>{L_SKYPE}:</th> <th>{L_SKYPE}:</th>
<td class="tLeft med" id="user_skype"> <td class="tLeft med" id="user_skype">
<span class="editable">{SKYPE} <span class="editable">{SKYPE}</span>
<a href="skype:{SKYPE}"><img align="middle" src="http://mystatus.skype.com/smallicon/{SKYPE}" width="16" height="16"></a>
</span>
</td> </td>
</tr> </tr>
<!-- ENDIF --> <!-- ENDIF -->

View file

@ -704,8 +704,8 @@ if ($allowed_forums) {
$size = $tor['size']; $size = $tor['size'];
$tor_magnet = create_magnet($tor['info_hash'], $tor['info_hash_v2'], \TorrentPier\Legacy\Torrent::getPasskey($user_id), html_ent_decode($tor['topic_title'])); $tor_magnet = create_magnet($tor['info_hash'], $tor['info_hash_v2'], \TorrentPier\Legacy\Torrent::getPasskey($user_id), html_ent_decode($tor['topic_title']));
$compl = $tor['complete_count']; $compl = $tor['complete_count'];
$dl_sp = ($dl) ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s'; $dl_sp = $dl ? humn_size($dl, 0, 'KB') . '/s' : '0 KB/s';
$ul_sp = ($ul) ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s'; $ul_sp = $ul ? humn_size($ul, 0, 'KB') . '/s' : '0 KB/s';
$dl_class = isset($tor['dl_status']) ? $dl_link_css[$tor['dl_status']] : 'genmed'; $dl_class = isset($tor['dl_status']) ? $dl_link_css[$tor['dl_status']] : 'genmed';
$row_class = !($row_num & 1) ? $row_class_1 : $row_class_2; $row_class = !($row_num & 1) ? $row_class_1 : $row_class_2;
@ -717,15 +717,15 @@ if ($allowed_forums) {
$template->assign_block_vars('tor', array( $template->assign_block_vars('tor', array(
'CAT_ID' => $cat_id, 'CAT_ID' => $cat_id,
'CAT_TITLE' => ($cat_id) ? $cat_title_html[$cat_id] : '', 'CAT_TITLE' => $cat_id ? $cat_title_html[$cat_id] : '',
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'FORUM_NAME' => ($forum_id) ? $forum_name_html[$forum_id] : '', 'FORUM_NAME' => $forum_id ? $forum_name_html[$forum_id] : '',
'TOPIC_ID' => $tor['topic_id'], 'TOPIC_ID' => $tor['topic_id'],
'TOPIC_TITLE' => wbr($tor['topic_title']), 'TOPIC_TITLE' => wbr($tor['topic_title']),
'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']), 'TOPIC_TIME' => bb_date($tor['topic_time'], 'd-M-y') . ' <b>&middot;</b> ' . delta_time($tor['topic_time']),
'POST_ID' => $tor['post_id'], 'POST_ID' => $tor['post_id'],
'POSTER_ID' => $poster_id, 'POSTER_ID' => $poster_id,
'USERNAME' => ($hide_author) ? '' : profile_url(array('username' => $tor['username'], 'user_rank' => $tor['user_rank'])), 'USERNAME' => $hide_author ? '' : profile_url(array('username' => $tor['username'], 'user_rank' => $tor['user_rank'])),
'ROW_CLASS' => $row_class, 'ROW_CLASS' => $row_class,
'ROW_NUM' => $row_num, 'ROW_NUM' => $row_num,
@ -737,7 +737,7 @@ if ($allowed_forums) {
'MAGNET' => $tor_magnet, 'MAGNET' => $tor_magnet,
'TOR_TYPE' => is_gold($tor['tor_type']), 'TOR_TYPE' => is_gold($tor['tor_type']),
'TOR_FROZEN' => (!IS_AM) ? isset($bb_cfg['tor_frozen'][$tor['tor_status']]) : '', 'TOR_FROZEN' => !IS_AM ? isset($bb_cfg['tor_frozen'][$tor['tor_status']]) : '',
'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor['tor_status']], 'TOR_STATUS_ICON' => $bb_cfg['tor_icons'][$tor['tor_status']],
'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor['tor_status']], 'TOR_STATUS_TEXT' => $lang['TOR_STATUS_NAME'][$tor['tor_status']],
@ -746,7 +746,7 @@ if ($allowed_forums) {
'UL_SPEED' => $ul_sp, 'UL_SPEED' => $ul_sp,
'DL_SPEED' => $dl_sp, 'DL_SPEED' => $dl_sp,
'SEEDS' => $seeds ?: 0, 'SEEDS' => $seeds ?: 0,
'SEEDS_TITLE' => ($seeds) ? $lang['SEEDERS'] : ($lang['SEED_NOT_SEEN'] . ":\n " . (($s_last) ? bb_date($s_last, $date_format) : $lang['NEVER'])), 'SEEDS_TITLE' => $seeds ? $lang['SEEDERS'] : ($lang['SEED_NOT_SEEN'] . ":\n " . (($s_last) ? bb_date($s_last, $date_format) : $lang['NEVER'])),
'LEECHS' => $leechs ?: 0, 'LEECHS' => $leechs ?: 0,
'COMPLETED' => $compl ?: 0, 'COMPLETED' => $compl ?: 0,
'REPLIES' => $tor['topic_replies'], 'REPLIES' => $tor['topic_replies'],

View file

@ -33,7 +33,7 @@ $anon = GUEST_UID;
// Start session // Start session
$user->session_start(); $user->session_start();
$lastvisit = (IS_GUEST) ? TIMENOW : $userdata['user_lastvisit']; $lastvisit = IS_GUEST ? TIMENOW : $userdata['user_lastvisit'];
// Caching output // Caching output
$req_page = "forum_f{$forum_id}"; $req_page = "forum_f{$forum_id}";
@ -440,12 +440,12 @@ foreach ($topic_rowset as $topic) {
$template->assign_block_vars('t', [ $template->assign_block_vars('t', [
'FORUM_ID' => $forum_id, 'FORUM_ID' => $forum_id,
'TOPIC_ID' => $topic_id, 'TOPIC_ID' => $topic_id,
'HREF_TOPIC_ID' => ($moved) ? $topic['topic_moved_id'] : $topic['topic_id'], 'HREF_TOPIC_ID' => $moved ? $topic['topic_moved_id'] : $topic['topic_id'],
'TOPIC_TITLE' => wbr($topic['topic_title']), 'TOPIC_TITLE' => wbr($topic['topic_title']),
'TOPICS_SEPARATOR' => $separator, 'TOPICS_SEPARATOR' => $separator,
'IS_UNREAD' => $is_unread, 'IS_UNREAD' => $is_unread,
'TOPIC_ICON' => get_topic_icon($topic, $is_unread), 'TOPIC_ICON' => get_topic_icon($topic, $is_unread),
'PAGINATION' => ($moved) ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']), 'PAGINATION' => $moved ? '' : build_topic_pagination(TOPIC_URL . $topic_id, $replies, $bb_cfg['posts_per_page']),
'REPLIES' => $replies, 'REPLIES' => $replies,
'VIEWS' => $topic['topic_views'], 'VIEWS' => $topic['topic_views'],
'TOR_STALED' => ($forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size'])), 'TOR_STALED' => ($forum_data['allow_reg_tracker'] && !($t_type == POST_ANNOUNCE || $t_type == POST_STICKY || $topic['tor_size'])),
@ -485,14 +485,14 @@ foreach ($topic_rowset as $topic) {
unset($topic_rowset); unset($topic_rowset);
$pg_url = FORUM_URL . $forum_id; $pg_url = FORUM_URL . $forum_id;
$pg_url .= ($sort_value) ? "&sort=$sort_value" : ''; $pg_url .= $sort_value ? "&sort=$sort_value" : '';
$pg_url .= ($order_value) ? "&order=$order_value" : ''; $pg_url .= $order_value ? "&order=$order_value" : '';
$template->assign_var('MOD_URL', $pg_url); $template->assign_var('MOD_URL', $pg_url);
$pg_url = FORUM_URL . $forum_id; $pg_url = FORUM_URL . $forum_id;
$pg_url .= ($topic_days) ? "&amp;topicdays=$topic_days" : ''; $pg_url .= $topic_days ? "&amp;topicdays=$topic_days" : '';
$pg_url .= ($sort_value) ? "&amp;sort=$sort_value" : ''; $pg_url .= $sort_value ? "&amp;sort=$sort_value" : '';
$pg_url .= ($order_value) ? "&amp;order=$order_value" : ''; $pg_url .= $order_value ? "&amp;order=$order_value" : '';
$pg_url .= ($moderation) ? "&amp;mod=1" : ''; $pg_url .= $moderation ? "&amp;mod=1" : '';
$pg_url .= ($topics_per_page != $bb_cfg['topics_per_page']) ? "&amp;tpp=$topics_per_page" : ''; $pg_url .= ($topics_per_page != $bb_cfg['topics_per_page']) ? "&amp;tpp=$topics_per_page" : '';
if ($found_topics) { if ($found_topics) {

View file

@ -427,7 +427,7 @@ if ($can_watch_topic) {
$s_watching_topic_img = (isset($images['topic_un_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : ''; $s_watching_topic_img = (isset($images['topic_un_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;unwatch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['topic_un_watch'] . '" alt="' . $lang['STOP_WATCHING_TOPIC'] . '" title="' . $lang['STOP_WATCHING_TOPIC'] . '" border="0"></a>' : '';
} else { } else {
$s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>'; $s_watching_topic = "<a href=\"" . TOPIC_URL . $topic_id . "&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '">' . $lang['START_WATCHING_TOPIC'] . '</a>';
$s_watching_topic_img = (isset($images['Topic_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : ''; $s_watching_topic_img = (isset($images['topic_watch'])) ? "<a href=\"" . TOPIC_URL . "$topic_id&amp;watch=topic&amp;start=$start&amp;sid=" . $userdata['session_id'] . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['START_WATCHING_TOPIC'] . '" title="' . $lang['START_WATCHING_TOPIC'] . '" border="0"></a>' : '';
} }
} }
@ -565,13 +565,16 @@ $prev_post_time = $max_post_time = 0;
for ($i = 0; $i < $total_posts; $i++) { for ($i = 0; $i < $total_posts; $i++) {
$poster_id = $postrow[$i]['user_id']; $poster_id = $postrow[$i]['user_id'];
$poster = ($poster_id == GUEST_UID) ? $lang['GUEST'] : $postrow[$i]['username']; $poster_guest = ($poster_id == GUEST_UID);
$poster_bot = ($poster_id == BOT_UID);
$poster = $poster_guest ? $lang['GUEST'] : $postrow[$i]['username'];
$post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']); $post_date = bb_date($postrow[$i]['post_time'], $bb_cfg['post_date_format']);
$max_post_time = max($max_post_time, $postrow[$i]['post_time']); $max_post_time = max($max_post_time, $postrow[$i]['post_time']);
$poster_posts = ($poster_id != GUEST_UID) ? $postrow[$i]['user_posts'] : ''; $poster_posts = !$poster_guest ? $postrow[$i]['user_posts'] : '';
$poster_from = ($postrow[$i]['user_from'] && $poster_id != GUEST_UID) ? $postrow[$i]['user_from'] : ''; $poster_from = ($postrow[$i]['user_from'] && !$poster_guest) ? $postrow[$i]['user_from'] : '';
$poster_joined = ($poster_id != GUEST_UID) ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], 'Y-m-d H:i') : ''; $poster_joined = !$poster_guest ? $lang['JOINED'] . ': ' . bb_date($postrow[$i]['user_regdate'], 'Y-m-d H:i') : '';
$poster_longevity = ($poster_id != GUEST_UID) ? delta_time($postrow[$i]['user_regdate']) : ''; $poster_longevity = !$poster_guest ? delta_time($postrow[$i]['user_regdate']) : '';
$post_id = $postrow[$i]['post_id']; $post_id = $postrow[$i]['post_id'];
$mc_type = $postrow[$i]['mc_type']; $mc_type = $postrow[$i]['mc_type'];
$mc_comment = $postrow[$i]['mc_comment']; $mc_comment = $postrow[$i]['mc_comment'];
@ -584,7 +587,7 @@ for ($i = 0; $i < $total_posts; $i++) {
$rg_signature = $postrow[$i]['group_signature'] ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : ''; $rg_signature = $postrow[$i]['group_signature'] ? bbcode2html(htmlCHR($postrow[$i]['group_signature'])) : '';
$poster_avatar = ''; $poster_avatar = '';
if (!$user->opt_js['h_av'] && $poster_id != GUEST_UID) { if (!$user->opt_js['h_av'] && !$poster_guest) {
$poster_avatar = get_avatar($poster_id, $postrow[$i]['avatar_ext_id'], !bf($postrow[$i]['user_opt'], 'user_opt', 'dis_avatar')); $poster_avatar = get_avatar($poster_id, $postrow[$i]['avatar_ext_id'], !bf($postrow[$i]['user_opt'], 'user_opt', 'dis_avatar'));
} }
@ -596,19 +599,19 @@ for ($i = 0; $i < $total_posts; $i++) {
} }
// Handle anon users posting with usernames // Handle anon users posting with usernames
if ($poster_id == GUEST_UID && $postrow[$i]['post_username'] != '') { if ($poster_guest && !empty($postrow[$i]['post_username'])) {
$poster = $postrow[$i]['post_username']; $poster = $postrow[$i]['post_username'];
} }
// Buttons // Buttons
$pm_btn = $profile_btn = $delpost_btn = $edit_btn = $ip_btn = $quote_btn = ''; $pm_btn = $profile_btn = $delpost_btn = $edit_btn = $ip_btn = $quote_btn = '';
if ($poster_id != GUEST_UID) { if (!$poster_guest) {
$profile_btn = true; $profile_btn = true;
$pm_btn = true; $pm_btn = true;
} }
if ($poster_id != BOT_UID) { if (!$poster_bot) {
$quote_btn = true; $quote_btn = true;
$edit_btn = (($userdata['user_id'] == $poster_id && $is_auth['auth_edit']) || $is_auth['auth_mod']); $edit_btn = (($userdata['user_id'] == $poster_id && $is_auth['auth_edit']) || $is_auth['auth_mod']);
$ip_btn = ($is_auth['auth_mod'] || IS_MOD); $ip_btn = ($is_auth['auth_mod'] || IS_MOD);
@ -698,16 +701,17 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_NAME_JS' => addslashes($poster), 'POSTER_NAME_JS' => addslashes($poster),
'POSTER_RANK' => $poster_rank, 'POSTER_RANK' => $poster_rank,
'RANK_IMAGE' => $rank_image, 'RANK_IMAGE' => $rank_image,
'POSTER_JOINED' => ($bb_cfg['show_poster_joined']) ? $poster_longevity : '', 'POSTER_JOINED' => $bb_cfg['show_poster_joined'] ? $poster_longevity : '',
'POSTER_JOINED_DATE' => $poster_joined, 'POSTER_JOINED_DATE' => $poster_joined,
'POSTER_POSTS' => ($bb_cfg['show_poster_posts']) ? '<a href="search.php?search_author=1&amp;uid=' . $poster_id . '" target="_blank">' . $poster_posts . '</a>' : '', 'POSTER_POSTS' => $bb_cfg['show_poster_posts'] ? '<a href="search.php?search_author=1&amp;uid=' . $poster_id . '" target="_blank">' . $poster_posts . '</a>' : '',
'POSTER_FROM' => ($bb_cfg['show_poster_from']) ? wbr($poster_from) : '', 'POSTER_FROM' => $bb_cfg['show_poster_from'] ? wbr($poster_from) : '',
'POSTER_BOT' => ($poster_id == BOT_UID), 'POSTER_BOT' => $poster_bot,
'POSTER_GUEST' => $poster_guest,
'POSTER_ID' => $poster_id, 'POSTER_ID' => $poster_id,
'POSTER_AUTHOR' => ($poster_id == $t_data['topic_poster']), 'POSTER_AUTHOR' => ($poster_id == $t_data['topic_poster']),
'POSTER_GENDER' => ($bb_cfg['gender']) ? gender_image($postrow[$i]['user_gender']) : '', 'POSTER_GENDER' => $bb_cfg['gender'] ? gender_image($postrow[$i]['user_gender']) : '',
'POSTED_AFTER' => ($prev_post_time) ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '', 'POSTED_AFTER' => $prev_post_time ? delta_time($postrow[$i]['post_time'], $prev_post_time) : '',
'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id), 'IS_UNREAD' => is_unread($postrow[$i]['post_time'], $topic_id, $forum_id),
'IS_FIRST_POST' => (!$start && $is_first_post), 'IS_FIRST_POST' => (!$start && $is_first_post),
'MOD_CHECKBOX' => ($moderation && ($start || defined('SPLIT_FORM_START'))), 'MOD_CHECKBOX' => ($moderation && ($start || defined('SPLIT_FORM_START'))),
@ -728,8 +732,8 @@ for ($i = 0; $i < $total_posts; $i++) {
'POSTER_BIRTHDAY' => user_birthday_icon($postrow[$i]['user_birthday'], $postrow[$i]['user_id']), 'POSTER_BIRTHDAY' => user_birthday_icon($postrow[$i]['user_birthday'], $postrow[$i]['user_id']),
'MC_COMMENT' => ($mc_type) ? bbcode2html($mc_comment) : '', 'MC_COMMENT' => $mc_type ? bbcode2html($mc_comment) : '',
'MC_BBCODE' => ($mc_type) ? $mc_comment : '', 'MC_BBCODE' => $mc_type ? $mc_comment : '',
'MC_CLASS' => $mc_class, 'MC_CLASS' => $mc_class,
'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id), 'MC_TITLE' => sprintf($lang['MC_COMMENT'][$mc_type]['title'], $mc_user_id),
'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type), 'MC_SELECT_TYPE' => build_select("mc_type_$post_id", array_flip($mc_select_type), $mc_type),
@ -751,7 +755,7 @@ for ($i = 0; $i < $total_posts; $i++) {
define('SPLIT_FORM_START', true); define('SPLIT_FORM_START', true);
} }
if ($poster_id != BOT_UID) { if (!$poster_bot) {
$prev_post_time = $postrow[$i]['post_time']; $prev_post_time = $postrow[$i]['post_time'];
} }
} }