replace_tags(array( "TITLE" => "$title", "PAGETITLE" => "$viewtopic[title]", "BGCOLOR" => "$bg_color", "TEXTCOLOR" => "$text_color", "LINKCOLOR" => "$link", "VLINKCOLOR" => "$vlink", "FONTFACE" => "$font")); $page->output(); //check to see if the install file is stil on the user's server. if (file_exists("install.php")){ if ($stat == "Admin"){ $error = $txt['installadmin']; echo error($error, "error"); } else{ $error = $txt['install']; echo error($error, "general"); } } //check to see if this user is able to access this board. echo check_ban(); //check to see if the board is on or off. if ($board_status == "Off"){ $error = $off_msg; echo error($error, "general"); if ($stat == "Admin"){ echo "

$menu[cp]"; } } //output top if ($stat == "Admin"){ $page = new template($template_path ."/top-admin.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-WELCOME" => "$txt[welcome]", "LOGGEDUSER" => "$logged_user", "LANG-LOGOUT" => "$txt[logout]", "LANG-IM" => "$menu[launchim]", "LANG-CP" => "$menu[cp]", "TABLE1" => "$table1", "ADDRESS" => "$address", "LANG-HOME" => "$menu[home]", "LANG-SEARCH" => "$menu[search]", "LANG-FAQ" => "$menu[faq]", "LANG-MEMBERLIST" => "$menu[members]", "LANG-PROFILE" => "$menu[profile]")); $page->output(); //check to see if user is marked as online, if not mark them as online. $time = time(); $db->run = "select * from ebb_online where Username='$logged_user'"; $count_member = $db->num_results(); $db->close(); if ($count_member == 0){ //user seems to be just getting on. $db->run = "insert into ebb_online (Username, time, location) values('$logged_user', '$time', '$_SERVER[PHP_SELF]')"; $db->query(); $db->close(); } else{ //user is still here so lets up their time to let the script know the user is still around. $db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where Username='$logged_user'"; $db->query(); $db->close(); } } if (($stat == "Member") OR ($stat == "Moderator")){ $page = new template($template_path ."/top-logged.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-WELCOME" => "$txt[welcome]", "LOGGEDUSER" => "$logged_user", "LANG-LOGOUT" => "$txt[logout]", "LANG-IM" => "$menu[launchim]", "TABLE1" => "$table1", "ADDRESS" => "$address", "LANG-HOME" => "$menu[home]", "LANG-SEARCH" => "$menu[search]", "LANG-FAQ" => "$menu[faq]", "LANG-MEMBERLIST" => "$menu[members]", "LANG-PROFILE" => "$menu[profile]")); $page->output(); //check to see if user is marked as online, if not mark them as online. $time = time(); $db->run = "select * from ebb_online where Username='$logged_user'"; $count_member = $db->num_results(); $db->close(); if ($count_member == 0){ //user seems to be just getting on. $db->run = "insert into ebb_online (Username, time, location) values('$logged_user', '$time', '$_SERVER[PHP_SELF]')"; $db->query(); $db->close(); } else{ //user is still here so lets up their time to let the script know the user is still around. $db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where Username='$logged_user'"; $db->query(); $db->close(); } } if ($stat == "guest"){ $page = new template($template_path ."/top-guest.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-WELCOME" => "$txt[welcomeguest]", "LANG-LOGIN" => "$txt[login]", "LANG-REGISTER" => "$txt[register]", "TABLE1" => "$table1", "ADDRESS" => "$address", "LANG-HOME" => "$menu[home]", "LANG-SEARCH" => "$menu[search]", "LANG-FAQ" => "$menu[faq]", "LANG-MEMBERLIST" => "$menu[members]")); $page->output(); //check to see if guest is marked as online, if not mark them as online. $time = time(); $ip = $_SERVER["REMOTE_ADDR"]; $db->run = "select * from ebb_online where ip='$ip'"; $count_guest = $db->num_results(); $db->close(); if ($count_guest == 0){ $db->run = "insert into ebb_online (ip, time, location) values('$ip', '$time', '$_SERVER[PHP_SELF]')"; $db->query(); $db->close(); } else{ //user is still here so lets up their time to let the script know the user is still around. $db->run = "update ebb_online Set time='$time', location='$_SERVER[PHP_SELF]' where ip='$ip'"; $db->query(); $db->close(); } } //record user comming in here $db->run = "select * from ebb_read WHERE Topic='$tid' and user='$logged_user'"; $read_ct = $db->num_results(); $db->close(); if (($read_ct == 0) AND ($stat !== "guest")){ $db->run = "insert into ebb_read (Topic, user) values('$tid', '$logged_user')"; $db->query(); $db->close(); } //check to see if topic exists or not and if it doesn't kill the program $db->run = "select * FROM ebb_topics WHERE tid='$tid'"; $checkboard = $db->num_results(); $t_name = $db->result(); $db->close(); $db->run = "select * FROM ebb_boards WHERE id='$bid'"; $checktopic = $db->num_results(); $b_name = $db->result(); $db->close(); if (($checkboard == 0) or ($checktopic == 0)){ $error = $viewtopic['doesntexist']; echo error($error, "error"); } //increment the total view of the topic by one. $addone = $t_name['Views'] + 1; $db->run = "update ebb_topics SET Views='$addone' where tid='$tid'"; $db->query(); $db->close(); //update the status of the topic watch. $db->run = "select * from ebb_topic_watch where username='$logged_user' and tid='$tid'"; $t_watch = $db->result(); $db->close(); if ($t_watch['status'] == "Unread"){ $db->run = "update ebb_topic_watch SET status='Read' where username='$logged_user' and tid='$tid'"; $db->query(); $db->close(); } //see fi the user can access this spot. if (($b_name['B_Read'] == "Admins") AND ($stat !== "Admin")){ $error = $viewboard['noread']; echo error($error, "error"); }elseif (($b_name['B_Read'] == "Admins & Moderators") AND ($stat == "Member")){ $error = $viewboard['noread']; echo error($error, "error"); }elseif ($b_name['B_Read'] == "None"){ $error = $viewboard['noread']; echo error($error, "error"); }else{ //user can read the topics. } //set some board vars. $allowsmile = $b_name['Smiles']; $allowbbcode = $b_name['BBcode']; $allowimg = $b_name['Images']; //begin pagenation $pg = $_REQUEST['pg']; $query = $_POST['query']; if(!isset($_GET['pg'])){ $pg = 1; } else { $pg = $_GET['pg']; } //check to see if the user can post a reply. if ($stat == "guest"){ $replylink = ''; }else{ if (($b_name['B_Write'] == "Admins") AND ($stat !== "Admin")){ $replylink = "

"; }elseif (($b_name['B_Write'] == "Admins & Moderators") AND ($stat == "Member")){ $replylink = "

"; }elseif ($b_name['B_Write'] == "None"){ $replylink = "

"; }else{ if ($t_name['Locked'] == 0){ $replylink = "\"$viewtopic[replytopicalt]\"

"; }else{ $replylink = "

"; } } } // Define the number of results per page $max_results = 10; // Figure out the limit for the query based // on the current page number. $from = (($pg * $max_results) - $max_results); // Figure out the total number of results in DB: $db->run = "select * from ebb_posts WHERE tid='$tid' LIMIT $from, $max_results"; $query = $db->query(); $db->close(); $db->run = "select * from ebb_posts WHERE tid='$tid'"; $num = $db->num_results(); $db->close(); // Figure out the total number of pages. Always round up using ceil() $total_pages = ceil($num / $max_results); $pagenation = "
$txt[pages] "; // Build page number if($pg > 1){ $prev = ($pg - 1); $pagenation .= "$txt[prev] "; } if ($pg == 1){ $pagenation .= "1 "; } else{ for($i = 1; $i <= $total_pages; $i++){ if(($pg) == $i){ $pagenation .= "$i "; } else { $pagenation .= "$i "; } } } // Build Next Link if($page < $total_pages){ $next = ($pg + 1); $pagenation .= "$txt[next]"; } $pagenation .= "
"; //end pagenation, get info. $db->run = "select * from ebb_users WHERE Username='$t_name[author]'"; $user = $db->result(); $db->close(); $gmttime = gmdate ($time_format, $t_name['Original_Date']); $topic_date = date($time_format,strtotime("$gmt hours",strtotime($gmttime))); $total = $user['Post_Count']; $db->run = "SELECT * FROM ebb_ranks WHERE Post_req <= $total ORDER BY Post_req DESC"; $rank = $db->result(); $db->close(); //rank star info. if ($user['Status'] == "Admin"){ $rankicon = ""; $rank = "Admin"; } elseif ($user['Status'] == "Moderator"){ $rankicon = ""; $rank = "Moderator"; }elseif($user['Status'] == "Banned"){ $rankicon = ""; $rank = "Banned"; }else{ $rankicon = ""; $rank = $rank[Name]; } //avatar and sig info. if($user['Avatar'] == ""){ $avatar = "images/avatar/noavatar.gif"; }else{ $avatar = $user['Avatar']; } if($user['Sig'] == ""){ $sig = ""; }else{ $tsig = nl2br($user['Sig']); $sig = "-----------
$tsig"; } //end info $string = $t_name['Body']; $msg = $string; if ($allowsmile == "On"){ $msg = smiles($msg); } if ($allowbbcode == "On"){ $msg = BBCode($msg); } if ($allowimg == "On"){ $msg = BBCode($msg, true); } //censor convert. $msg = language_filter($msg); $msg = nl2br($msg); //display post if (($stat == "Admin") or ($stat == "Moderator")){ $menu = "$viewtopic[iplogged] "; } elseif ($ebbuser == $topic['author']){ $menu = ""; } else{ $menu = ''; } //show replys, if any $reply = reply_listing(); //admin & moderator options if (($stat == "Moderator") OR ($stat == "Admin")){ if ($topic['Lock'] == 1){ $modtool = "\"\" \"\"&nbps;\"\"
"; } else{ $modtool = "\"\" \"\" \"\"
"; } } else{ $modtool = '
'; } if ($t_name['Type'] == "Poll"){ //check to see if a user already voted. $db->run = "SELECT * FROM ebb_votes WHERE Username='$logged_user' AND tid='$tid'"; $count = $db->num_results(); $db->close(); if (($count == 1) OR ($stat == "guest")){ //display results $poll = view_results(); }else{ //display poll $poll = view_poll(); } }else{ //no poll exists so lets just make this equal nothing. $poll = ''; } //output viewtopic $page = new template($template_path ."/viewtopic.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$b_name[Board]", "BID" => "$bid", "LANG-TOPIC" => "$t_name[Topic]", "REPLYLINK" => "$replylink", "PAGENATION" => "$pagenation", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "MENU" => "$menu", "POLL" => "$poll", "SUBJECT" => "$t_name[Topic]", "LANG-POSTED" => "$viewtopic[postedon]", "TOPIC-DATE" => "$topic_date", "AUTHOR" => "$t_name[author]", "RANK" => "$rank", "RANKICON" => "$rankicon", "AVATAR" => "$avatar", "LANG-POSTCOUNT" => "$viewtopic[posts]", "POSTCOUNT" => "$total", "TOPIC" => "$msg", "SIGNATURE" => "$sig", "REPLY" => "$reply", "MODERATORTOOL" => "$modtool")); $page->output(); //see if the user can post a reply in this topic. if (($b_name['B_Write'] == "Admins") AND ($stat !== "Admin")){ $can_post = 0; }elseif (($b_name['B_Write'] == "Admins & Moderators") AND ($stat == "Member")){ $can_post = 0; }elseif ($b_name['B_Write'] == "None"){ $can_post = 0; }else{ $can_post = 1; } if (($stat == "guest") OR ($t_name['Locked'] == 1) OR ($can_post == 0)){ //display nothing. } else{ //bbcode buttons $bbcode = bbcode_form(); $smile = form_smiles(); //output it if ($spell_check == "On"){ $page = new template($template_path ."/instantreply-spell.htm"); $page->replace_tags(array( "LANG-INSTANTREPLY" => "$viewtopic[instantreply]", "BID" => "$bid", "TID" => "$tid", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "BBCODE" => "$bbcode", "SMILES" => "$smile", "LANG-OPTIONS" => "$post[options]", "NOTIFY" => "$post[notify]", "LANG-REPLY" => "$post[reply]", "PAGE" => "$pg")); $page->output(); }else{ $page = new template($template_path ."/instantreply.htm"); $page->replace_tags(array( "LANG-INSTANTREPLY" => "$viewtopic[instantreply]", "BID" => "$bid", "TID" => "$tid", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "BBCODE" => "$bbcode", "SMILES" => "$smile", "LANG-OPTIONS" => "$post[options]", "NOTIFY" => "$post[notify]", "LANG-REPLY" => "$post[reply]", "PAGE" => "$pg")); $page->output(); } } //display footer $page = new template($template_path ."/footer.htm"); $page->replace_tags(array( "LANG-POWERED" => "$index[poweredby]")); $page->output(); ob_end_flush(); ?>