From 4b9b518593837162d84c60ff7088ce3fad6f73c2 Mon Sep 17 00:00:00 2001 From: Yannick Date: Sun, 21 Sep 2014 21:26:43 +0200 Subject: [PATCH] #912 Fix some interface doubles --- include/version.php | 2 +- style/Sunrise/thread.php | 136 ++++++++++++++++++++++++++++++++++++++- viewtopic.php | 133 +------------------------------------- 3 files changed, 137 insertions(+), 134 deletions(-) diff --git a/include/version.php b/include/version.php index 7d7976f15..4cdbfbde9 100644 --- a/include/version.php +++ b/include/version.php @@ -11,7 +11,7 @@ class Version { const FORUM_VERSION = '0.0-dev'; // The Luna Core version - const FORUM_CORE_VERSION = '0.0.40.3039'; + const FORUM_CORE_VERSION = '0.0.40.3040'; // The database version number, every change in the database requires this number to go one up const FORUM_DB_VERSION = 84.12; diff --git a/style/Sunrise/thread.php b/style/Sunrise/thread.php index 9f679bede..34cf6c511 100644 --- a/style/Sunrise/thread.php +++ b/style/Sunrise/thread.php @@ -17,7 +17,141 @@ - +query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, p.marked, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); +while ($cur_post = $db->fetch_assoc($result)) { + $post_count++; + $user_avatar = ''; + $user_info = array(); + $user_actions = array(); + $post_actions = array(); + $is_online = ''; + $signature = ''; + + // If the poster is a registered user + if ($cur_post['poster_id'] > 1) { + if ($luna_user['g_view_users'] == '1') + $username = ''.luna_htmlspecialchars($cur_post['username']).''; + else + $username = luna_htmlspecialchars($cur_post['username']); + + $user_title = get_title($cur_post); + + if ($luna_config['o_censoring'] == '1') + $user_title = censor_words($user_title); + + // Format the online indicator, those are ment as CSS classes + $is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? 'is-online' : 'is-offline'; + + // We only show location, register date, post count and the contact links if "Show user info" is enabled + if ($luna_config['o_show_user_info'] == '1') { + if ($cur_post['location'] != '') { + if ($luna_config['o_censoring'] == '1') + $cur_post['location'] = censor_words($cur_post['location']); + + $user_info[] = '
'.$lang['From'].' '.luna_htmlspecialchars($cur_post['location']).'
'; + } + + if ($luna_config['o_show_post_count'] == '1' || $luna_user['is_admmod']) + $user_info[] = '
'.$lang['Posts'].' '.forum_number_format($cur_post['num_posts']).'
'; + + // Now let's deal with the contact links (Email and URL) + if ((($cur_post['email_setting'] == '0' && !$luna_user['is_guest']) || $luna_user['is_admmod']) && $luna_user['g_send_email'] == '1') + $user_actions[] = ''.$lang['Email'].''; + else if ($cur_post['email_setting'] == '1' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') + $user_actions[] = ''.$lang['Email'].''; + + if ($cur_post['url'] != '') { + if ($luna_config['o_censoring'] == '1') + $cur_post['url'] = censor_words($cur_post['url']); + + $user_actions[] = ''.$lang['Website'].''; + } + + + if ($luna_user['is_admmod']) { + $user_actions[] = ''.$lang['IP address logged'].''; + } + } + + + if ($luna_user['is_admmod']) { + if ($cur_post['admin_note'] != '') + $user_info[] = '
'.$lang['Note'].' '.luna_htmlspecialchars($cur_post['admin_note']).'
'; + } + } + // If the poster is a guest (or a user that has been deleted) + else { + $username = luna_htmlspecialchars($cur_post['username']); + $user_title = get_title($cur_post); + + if ($luna_user['is_admmod']) + $user_info[] = '
'.$lang['IP address logged'].'
'; + + if ($luna_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') + $user_actions[] = ''.$lang['Email'].''; + } + + // Get us the avatar + if ($luna_config['o_avatars'] == '1' && $luna_user['show_avatars'] != '0') { + if (isset($user_avatar_cache[$cur_post['poster_id']])) + $user_avatar = $user_avatar_cache[$cur_post['poster_id']]; + else + $user_avatar = generate_avatar_markup($cur_post['poster_id']); + } + + // Generation post action array (quote, edit, delete etc.) + if (!$is_admmod) { + if (!$luna_user['is_guest']) { + if ($cur_post['marked'] == false) { + $post_actions[] = ''.$lang['Report'].''; + } else { + $post_actions[] = ''.$lang['Report'].''; + } + } + + if ($cur_topic['closed'] == '0') { + if ($cur_post['poster_id'] == $luna_user['id']) { + if ((($start_from + $post_count) == 1 && $luna_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $luna_user['g_delete_posts'] == '1')) + $post_actions[] = ''.$lang['Delete'].''; + if ($luna_user['g_edit_posts'] == '1') + $post_actions[] = ''.$lang['Edit'].''; + } + + if (($cur_topic['post_replies'] == '' && $luna_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1') + $post_actions[] = ''.$lang['Quote'].''; + } + } else { + if ($cur_post['marked'] == false) { + $post_actions[] = ''.$lang['Report'].''; + } else { + $post_actions[] = ''.$lang['Report'].''; + } + if ($luna_user['g_id'] == FORUM_ADMIN || !in_array($cur_post['poster_id'], $admin_ids)) { + $post_actions[] = ''.$lang['Delete'].''; + $post_actions[] = ''.$lang['Edit'].''; + } + $post_actions[] = ''.$lang['Quote'].''; + } + + // Perform the main parsing of the message (BBCode, smilies, censor words etc) + $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); + + // Do signature parsing/caching + if ($luna_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $luna_user['show_sig'] != '0') { + if (isset($signature_cache[$cur_post['poster_id']])) + $signature = $signature_cache[$cur_post['poster_id']]; + else { + $signature = parse_signature($cur_post['signature']); + $signature_cache[$cur_post['poster_id']] = $signature; + } + } + + require get_view_path('comment.php'); +} +?>
diff --git a/viewtopic.php b/viewtopic.php index 89899b509..e7d9b4703 100644 --- a/viewtopic.php +++ b/viewtopic.php @@ -173,138 +173,7 @@ if (empty($post_ids)) error('The post table and topic table seem to be out of sync!', __FILE__, __LINE__); -// Retrieve the posts (and their respective poster/online status) -$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, p.marked, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); -while ($cur_post = $db->fetch_assoc($result)) { - $post_count++; - $user_avatar = ''; - $user_info = array(); - $user_actions = array(); - $post_actions = array(); - $is_online = ''; - $signature = ''; - - // If the poster is a registered user - if ($cur_post['poster_id'] > 1) { - if ($luna_user['g_view_users'] == '1') - $username = ''.luna_htmlspecialchars($cur_post['username']).''; - else - $username = luna_htmlspecialchars($cur_post['username']); - - $user_title = get_title($cur_post); - - if ($luna_config['o_censoring'] == '1') - $user_title = censor_words($user_title); - - // Format the online indicator, those are ment as CSS classes - $is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? 'is-online' : 'is-offline'; - - // We only show location, register date, post count and the contact links if "Show user info" is enabled - if ($luna_config['o_show_user_info'] == '1') { - if ($cur_post['location'] != '') { - if ($luna_config['o_censoring'] == '1') - $cur_post['location'] = censor_words($cur_post['location']); - - $user_info[] = '
'.$lang['From'].' '.luna_htmlspecialchars($cur_post['location']).'
'; - } - - if ($luna_config['o_show_post_count'] == '1' || $luna_user['is_admmod']) - $user_info[] = '
'.$lang['Posts'].' '.forum_number_format($cur_post['num_posts']).'
'; - - // Now let's deal with the contact links (Email and URL) - if ((($cur_post['email_setting'] == '0' && !$luna_user['is_guest']) || $luna_user['is_admmod']) && $luna_user['g_send_email'] == '1') - $user_actions[] = ''.$lang['Email'].''; - else if ($cur_post['email_setting'] == '1' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') - $user_actions[] = ''.$lang['Email'].''; - - if ($cur_post['url'] != '') { - if ($luna_config['o_censoring'] == '1') - $cur_post['url'] = censor_words($cur_post['url']); - - $user_actions[] = ''.$lang['Website'].''; - } - - - if ($luna_user['is_admmod']) { - $user_actions[] = ''.$lang['IP address logged'].''; - } - } - - - if ($luna_user['is_admmod']) { - if ($cur_post['admin_note'] != '') - $user_info[] = '
'.$lang['Note'].' '.luna_htmlspecialchars($cur_post['admin_note']).'
'; - } - } - // If the poster is a guest (or a user that has been deleted) - else { - $username = luna_htmlspecialchars($cur_post['username']); - $user_title = get_title($cur_post); - - if ($luna_user['is_admmod']) - $user_info[] = '
'.$lang['IP address logged'].'
'; - - if ($luna_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$luna_user['is_guest'] && $luna_user['g_send_email'] == '1') - $user_actions[] = ''; - } - - // Get us the avatar - if ($luna_config['o_avatars'] == '1' && $luna_user['show_avatars'] != '0') { - if (isset($user_avatar_cache[$cur_post['poster_id']])) - $user_avatar = $user_avatar_cache[$cur_post['poster_id']]; - else - $user_avatar = generate_avatar_markup($cur_post['poster_id']); - } - - // Generation post action array (quote, edit, delete etc.) - if (!$is_admmod) { - if (!$luna_user['is_guest']) { - if ($cur_post['marked'] == false) { - $post_actions[] = ''.$lang['Report'].''; - } else { - $post_actions[] = ''.$lang['Report'].''; - } - } - - if ($cur_topic['closed'] == '0') { - if ($cur_post['poster_id'] == $luna_user['id']) { - if ((($start_from + $post_count) == 1 && $luna_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $luna_user['g_delete_posts'] == '1')) - $post_actions[] = ''.$lang['Delete'].''; - if ($luna_user['g_edit_posts'] == '1') - $post_actions[] = ''.$lang['Edit'].''; - } - - if (($cur_topic['post_replies'] == '' && $luna_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1') - $post_actions[] = ''.$lang['Quote'].''; - } - } else { - if ($cur_post['marked'] == false) { - $post_actions[] = ''.$lang['Report'].''; - } else { - $post_actions[] = ''.$lang['Report'].''; - } - if ($luna_user['g_id'] == FORUM_ADMIN || !in_array($cur_post['poster_id'], $admin_ids)) { - $post_actions[] = ''.$lang['Delete'].''; - $post_actions[] = ''.$lang['Edit'].''; - } - $post_actions[] = ''.$lang['Quote'].''; - } - - // Perform the main parsing of the message (BBCode, smilies, censor words etc) - $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']); - - // Do signature parsing/caching - if ($luna_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $luna_user['show_sig'] != '0') { - if (isset($signature_cache[$cur_post['poster_id']])) - $signature = $signature_cache[$cur_post['poster_id']]; - else { - $signature = parse_signature($cur_post['signature']); - $signature_cache[$cur_post['poster_id']] = $signature; - } - } - - require load_page('thread.php'); -} +require load_page('thread.php'); // Display quick post if enabled if ($quickpost) {