'.$lang_common['Login'].' '.$lang_common['or'].' '.$lang_common['register'].'.'); } if ($cookie['is_guest']) { $disp_posts = $options['disp_posts_default']; } else { $disp_posts = $cur_user['disp_posts']; } if (isset($_GET['id'])) { $id = filter_var($_GET['id'], FILTER_VALIDATE_INT); } else { $id = 0; // or some other default value } if (isset($_GET['pid'])) { $pid = filter_var($_GET['pid'], FILTER_VALIDATE_INT); } else { $pid = 0; // or some other default value } if ($id < 0 && $pid < 0) { message($lang_common['Bad request']); } // Load the viewtopic.php language file require 'lang/'.$language.'/'.$language.'_topic.php'; // If a pid (post ID) is specified we find out the topic ID and page in that topic // so we can redirect to the correct message if (isset($_GET['pid'])) { $pid = $_GET['pid']; $result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); $id = $db->result($result, 0); // Determine on what page the post is located (depending on $disp_posts) $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); $num_posts = $db->num_rows($result); for ($i = 0; $i < $num_posts; $i++) { $curid = $db->result($result, $i); if ($curid == $pid) break; } $i++; // we started at 0 $_GET['p'] = ceil($i / $disp_posts); } // Fetch some info from the topic $result = $db->query('SELECT subject, closed, sticky, subscribers, num_replies, forum_id FROM '.$db->prefix.'topics WHERE id='.$id.' AND moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error()); if (!$db->num_rows($result)) message($lang_common['Bad request']); list($subject, $closed, $sticky, $subscribers, $num_replies, $forum_id) = $db->fetch_row($result); $result = $db->query('SELECT forum_name, moderators, closed, admmod_only FROM '.$db->prefix.'forums WHERE id='.$forum_id) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error()); list($forum_name, $moderators, $forum_closed, $admmod_only) = $db->fetch_row($result); $mods_array = array(); if ($moderators != '') { $mods_array = unserialize($moderators); while (list($mod_username, $mod_id) = @each($mods_array)) $temp_array[] = ''.htmlspecialchars($mod_username).''; $mods_string = implode(', ', $temp_array); } if (isset($cur_user['status']) == 2 || (isset($cur_user['status']) == 1 && array_key_exists($cur_user['username'], $mods_array))) $is_admmod = true; else $is_admmod = false; if ($admmod_only == '1' && $cur_user['status'] < 1) message($lang_common['Bad request']); if ($closed != '1' && $forum_closed != '1') { if ($permissions['guests_post'] == '0' && $cookie['is_guest'] || $permissions['users_post'] == '0' && $cur_user['status'] < 1) $post_link = ' '; else $post_link = ''.$lang_topic['Post reply'].''; } else { if ($is_admmod) $post_link = $lang_topic['Topic closed'].' / '.$lang_topic['Post reply'].''; else $post_link = $lang_topic['Topic closed']; } $num_pages = ceil(($num_replies + 1) / $disp_posts); if (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) { $p = 1; $start_from = 0; } else { $p = $_GET['p']; $start_from = $disp_posts * ($p - 1); } $pages = paginate($num_pages, $p, 'viewtopic.php?id='.$id); if ($options['censoring'] == '1') $subject = censor_words($subject); $page_title = htmlspecialchars($options['board_title']).' / '.$subject; $validate_form = ($options['quickpost'] == '1') ? true : false; require 'header.php'; ?>
/ /
query('SELECT user_id FROM '.$db->prefix.'online WHERE user_id>0') or error('Unable to fetch online list', __FILE__, __LINE__, $db->error()); $num_online = $db->num_rows($result); for ($i = 0; $i < $num_online; $i++) $online_list[] = $db->result($result, $i); require 'include/parser.php'; // Used for switching background color in posts $bg_switch = true; // Retrieve the topic posts (and their respective poster) $result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.hide_email, u.num_posts, u.status, u.registered, u.admin_note, p.id, p.poster, p.poster_id, p.poster_ip, p.poster_email, p.message, p.smilies, p.posted, p.edited, p.edited_by FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id WHERE p.topic_id='.$id.' ORDER BY p.posted LIMIT '.$start_from.','.$disp_posts) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); while ($cur_post = $db->fetch_assoc($result)) { // If the poster is a registered user. if ($cur_post['poster_id'] > 1) { $registered = date($options['date_format'], $cur_post['registered']); if (isset($online_list) && in_array($cur_post['poster_id'], $online_list)) $info = ''.htmlspecialchars($cur_post['poster']).''; else $info = ''.htmlspecialchars($cur_post['poster']).''; // getTitle() requires that an element 'username' be present in the array $cur_post['username'] = $cur_post['poster']; $user_title = get_title($cur_post); if ($options['censoring'] == '1') $user_title = censor_words($user_title); $info .= '
'."\n\t\t\t\t\t\t".$user_title.'
'; if ($options['avatars'] == '1' && $cur_post['use_avatar'] == '1') { if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.gif')) $info .= "\n\t\t\t\t\t\t".'
'; else if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.jpg')) $info .= "\n\t\t\t\t\t\t".'
'; else if ($img_size = @getimagesize($options['avatars_dir'].'/'.$cur_post['poster_id'].'.png')) $info .= "\n\t\t\t\t\t\t".'
'; else $info .= '
'."\n\t\t\t\t\t\t"; } else $info .= '
'."\n\t\t\t\t\t\t"; if ($cur_post['location'] != '') { if ($options['censoring'] == '1') $cur_post['location'] = censor_words($cur_post['location']); $info .= $lang_topic['From'].': '.htmlspecialchars($cur_post['location']).'
'."\n\t\t\t\t\t\t"; } $info .= $lang_common['Registered'].': '.$registered.'
'; if ($options['show_post_count'] == '1') $info .= "\n\t\t\t\t\t\t".$lang_common['Posts'].': '.$cur_post['num_posts']; if (isset($cur_user['status']) > 0) { $info .= '
'."\n\t\t\t\t\t\t".'IP: '.$cur_post['poster_ip'].''; if ($cur_post['admin_note'] != '') $info .= '

'."\n\t\t\t\t\t\t".$lang_topic['Note'].': '.$cur_post['admin_note'].''; } // Generate the string for the links that appear at the bottom of every message. $links = array(); if ($cur_post['hide_email'] == '0') $links[] = ''.$lang_common['E-mail'].''; if ($cur_post['url'] != '') { if ($cur_user['link_to_new_win'] == '0') $links[] = ''.$lang_topic['Website'].''; else $links[] = ''.$lang_topic['Website'].''; } } // If the poster is a guest (or a user that has been deleted) else { $info = ''.htmlspecialchars($cur_post['poster']).'
'."\n\t\t\t\t\t\t".$lang_topic['Guest']; if (isset($cur_user['status']) > 0) $info .= '

'."\n\t\t\t\t\t\t".'IP: '.$cur_post['poster_ip'].'

'; else $info .= '



'; if ($cur_post['poster_email'] != '') $links = array(''.$lang_common['E-mail'].''); else $links = array(); } if ($cur_post['edited']) $edited = $lang_topic['Last edit'].' '.htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')'; else $edited = ' '; $actions = array(); if (!$is_admmod) { if (!$cookie['is_guest']) { $actions[] = ''.$lang_topic['Report'].''; if ($closed != '1' && $forum_closed != '1') { if ($permissions['users_edit_post'] == '1' && $cur_post['poster_id'] == $cur_user['id']) { if ($permissions['users_del_post'] == '1') $actions[] = ''.$lang_topic['Delete'].''; $actions[] = ''.$lang_topic['Edit'].''; } $actions[] = ''.$lang_topic['Quote'].''; } } else { if ($permissions['guests_post'] == '1' && $closed != '1' && $forum_closed != '1') $actions[] = ''.$lang_topic['Quote'].''; } } else $actions[] = ''.$lang_topic['Report'].' | '.$lang_topic['Delete'].' | '.$lang_topic['Edit'].' | '.$lang_topic['Quote'].''; // Switch the background color for every message. $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true; // Perform the main parsing of the message (BBCode, smilies, censor words etc) $cur_post['message'] = parse_message($cur_post['message'], $cur_post['smilies']); if ($cur_post['signature'] != '' && $cur_user['show_sig'] != '0') $signature = '

_______________________________________
'.parse_signature($cur_post['signature']).'

'; else $signature = NULL; ?>
'.$signature.''."\n" : '

'."\n"; ?>
0) ? implode(' | ', $links) : ' '; ?> 0) ? implode(' | ', $actions) : ' '; ?>
'.$lang_topic['Unsubscribe'].''; else $subscraction = ''.$lang_topic['Subscribe'].''; } else $subscraction = ' '; ?>
  

HTML:   
BBCode:   
[img] tag:   
Smilies:   
 
  
  

 
query('UPDATE '.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error()); $footer_style = 'topic'; require 'footer.php';