replace_tags(array( "TITLE" => "$title", "PAGETITLE" => "$menu[im]", "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(); } } //display im. switch ( $_get['action'] ) { case 'write': $user = $_GET['user']; $bbcode = bbcode_form(); $smile = form_smiles(); $page = new template($template_path ."/im-postim.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "LANG-POSTIM" => "$im[PostIM]", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "BBCODE" => "$bbcode", "SMILES" => "$smile", "LANG-USERNAME" => "$txt[username]", "USERNAME" => "$logged_user", "LANG-TO" => "$im[send]", "TO" => "$user", "LANG-SUBJECT" => "$im[subject]", "LANG-SENDIM" => "$im[sendim]")); $page->output(); break; case 'write_process': //get the values from the form. $send = $_POST['send']; $subject = $_POST['subject']; $message = $_POST['message']; if ($send == ""){ $error = $im['nosend']; echo error($error, "error"); } if ($subject == ""){ $error = $im['nosubject']; echo error($error, "error"); } if ($message == ""){ $error = $im['nomessage']; echo error($error, "error"); } //check to see if the from user's inbox is full. $db->run = "SELECT * FROM ebb_im WHERE Reciever='$send'"; $check_inbox = $db->num_results(); $notify = $db->result(); $db->close(); if ($check_inbox == $im_rule){ $error = $im['overquota']; echo error($error, "error"); } //check to see if this user is on the ban list. $db->run = "SELECT * FROM ebb_im_banlist WHERE Banned_User='$logged_user' and Ban_Creator='$send'"; $check_ban_r = $db->num_results(); $db->close(); if ($check_ban_r == 1){ $error = $im['blocked']; echo error($error, "general"); }else{ $time = time(); //process query $db->run = "insert into ebb_im (Sender, Reciever, Subject, Message, Date) values ('$logged_user', '$send', '$subject', '$message', '$time')"; $db->query(); $db->close(); //email user if they have decided if ($notify['IM_Notify'] == "Yes"){ //grab values from IM message. $db->run = "select * from ebb_im where Reciever='$send'"; $im_data = $db->result(); $db->close(); //pull-up language mail file. require "lang/".$lang.".email.php"; //get ready to send mail. $headers = "From: $title <$board_email>\n"; @mail($email_r['Email'], $im_subject, $im_message, $headers); } //bring user back header("Location: IM.php"); } break; case 'read': $id = $_GET['id']; $replybutton = "\"$im[replyalt]\"

"; $db->run = "select * from ebb_im WHERE id = '$id'"; $im_r = $db->result(); $db->close(); //mark as read if ($im_r['Read_status'] == "new"){ $db->run = "update ebb_im SET Read_Status='old' where id='$id'"; $db->query(); $db->close(); } //bbcode & other formating processes. $string = $im_r['Message']; $string = smiles($string); $string = BBCode($string); $string = language_filter($string); $string = nl2br($string); //get the date $gmttime = gmdate ($time_format, $im_r['Date']); $readim_date = date($time_format,strtotime("$gmt hours",strtotime($gmttime))); $db->run = "select * from ebb_users WHERE Username = '$im_r[Sender]'"; $user = $db->result(); $db->close(); //get sig. if($user['Sig'] == ""){ $sig = ""; } else{ $imsig = nl2br($user['Sig']); $sig = "-----------
$imsig"; } $page = new template($template_path ."/im-read.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "LANG-READIM" => "$im[readim]", "REPLYBUTTON" => "$replybutton", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "LANG-FROM" => "$im[from]", "FROM" => "$im_r[Reciever]", "LANG-BANUSER" => "$im[banuser]", "LANG-TO" => "$im[to]", "TO" => "$im_r[Sender]", "LANG-DATE" => "$im[date]", "DATE" => "$readim_date", "LANG-SUBJECT" => "$im[subject]", "SUBJECT" => "$im_r[Subject]", "IM-MESSAGE" => "$string", "SIGNATURE" => "$sig")); $page->output(); echo ""; break; case 'reply': $id = $_GET['id']; $db->run = "Select * From ebb_im WHERE id='$id'"; $reply = $db->result(); $db->close(); $reply_subject = "RE: ".$reply['Subject']; $bbcode = bbcode_form(); $smile = form_smiles(); $page = new template($template_path ."/im-replyim.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "LANG-REPLYIM" => "$im[replyim]", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "BBCODE" => "$bbcode", "SMILES" => "$smile", "LANG-USERNAME" => "$txt[username]", "USERNAME" => "$logged_user", "LANG-TO" => "$im[send]", "TO" => "$reply[Sender]", "LANG-SUBJECT" => "$im[subject]", "SUBJECT" => "$reply_subject", "LANG-SENDIM" => "$im[reply]")); $page->output(); break; case 'reply_process': //get the value from the form. $reply_send = $_POST['reply_send']; $reply_message = $_POST['reply_message']; //error-check if ($reply_send == ""){ $error = $im['nosend']; echo error($error, "error"); } if ($reply_message == ""){ $error = $im['nomessage']; echo error($error, "error"); } $reply_subject = "RE:" . $im['$subject']; $time = time(); //process query $db->run = "insert into ebb_im (Sender, Reciever, Subject, Message, Date) values ('$logged_user', '$reply_send', '$subject', '$reply_message', '$time')"; $db->query(); $db->close(); //bring user back header("Location: IM.php"); break; case 'delete': $id = $_GET['id']; $page = new template($template_path ."/im-deleteim.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$mod[title]", "LANG-DELETEIM" => "$im[delim]", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "LANG-DELSURE" => "$im[confirmdelete]", "ID" => "$id", "LANG-YES" => "$txt[yes]", "LANG-NO" => "$txt[no]")); $page->output(); break; case 'delete_process': $id = $_GET['id']; //process query $db->run = "DELETE FROM ebb_im Where id='$id'"; $db->query(); $db->close(); //bring user back header("Location: IM.php"); break; case 'ban': $page = new template($template_path ."/im-banuser.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "LANG-BANUSER" => "$im[banusertitle]", "TEXT" => "$im[text]", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "LANG-USERNAME" => "$txt[username]", "USERNAME" => "$logged_user", "LANG-BAN" => "$im[usertoban]", "BAN" => "$ban_user", "LANG-SUBMIT" => "$im[banuser]")); $page->output(); break; case 'ban_process': $banned_user = $_POST['banned_user']; if ($banned_user == ""){ $error = $im['blankfield']; echo error($error, "error"); } //process query $db->run = "insert into ebb_im_banlist (Banned_User, Ban_Creator) values('$banned_user', '$logged_user')"; $db->query(); $db->close(); //bring user back header("Location: IM.php?action=banlist"); break; case 'banlist': $banlist = view_banlist(); $page = new template($template_path ."/im-viewbanlist.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "LANG-BANLIST" => "$im[banlisttitle]", "TEXT" => "$im[text2]", "BANLIST" => "$banlist")); $page->output(); break; case 'del_ban': $id = $_GET['id']; $page = new template($template_path ."/im-deletebanlist.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$mod[title]", "LANG-DELETEBANLIST" => "$im[delbanuser]", "BORDER" => "$border", "TABLE1" => "$table1", "TABLE2" => "$table2", "LANG-DELSURE" => "$im[banlistconfirm]", "ID" => "$id", "LANG-YES" => "$txt[yes]", "LANG-NO" => "$txt[no]")); $page->output(); break; case 'process_del_ban': $id = $_GET['id']; //process query $db->run = "DELETE FROM ebb_im_banlist WHERE id='$id'"; $db->query(); $db->close(); //bring user back header("Location: IM.php?action=banlist"); break; default: $pg = $_REQUEST['pg']; $query = $_POST['query']; //pagination if(!isset($_GET['pg'])){ $pg = 1; } else { $pg = $_GET['pg']; } // 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_im WHERE Reciever='$logged_user' LIMIT $from, $max_results"; $query = $db->query(); $db->close(); $db->run = "select * from ebb_im WHERE Reciever='$logged_user'"; $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($pg < $total_pages){ $next = ($pg + 1); $pagenation .= "$txt[next]"; } $pagenation .= "
"; //output im inbox. $imbox = im_inbox(); $page = new template($template_path ."/im-inbox.htm"); $page->replace_tags(array( "TITLE" => "$title", "LANG-TITLE" => "$menu[im]", "PAGENATION" => "$pagenation", "LANG-VIEWBANLIST" => "$im[banlist]", "LANG-POSTIM" => "$im[postimalt]", "LANG-IMRULE" => "$im[imquota]", "IMRULE" => "$im_rule", "LANG-CURRENTAMOUNT" => "$im[curquota]", "CURRENTAMOUNT" => "$num", "IM-INBOX" => "$imbox")); $page->output(); } //display footer $page = new template($template_path ."/footer.htm"); $page->replace_tags(array( "LANG-POWERED" => "$index[poweredby]")); $page->output(); ob_end_flush(); ?>