ob_start();
$title = "Forum"; require('../header.php');
/* Grab the time the page started loading */
$start_time = microtime();
/* Define the generic error message */
define("ERROR", "There was a error.
The administrator has been notified, and the problem will be resolved as soon as he/she feels like it!\n");
/* Load the include file, and quit if it messes up */
if (!@include("./include/include.php"))
exit(ERROR);
/* Check the current state, and proceed to the installer is appropriate */
/* Check to see if config.php is present */
if ( !@include("config.php") )
{
/* No config? then call the installer! */
require("install.php");
exit;
}
/* If config.php is there, then check the installation status */
else if (INSTALLED != "yes")
{
/* Not installed? then call the installer! */
require("install.php");
exit;
}
/* Enable output buffering, so we can tweak the headers anytime */
ob_start();
/* Check the super globals and pull the values */
$destination = GetVars("destination");
$message = GetVars("message");
$password = GetVars("password");
$title = GetVars("title");
$username = GetVars("username");
$mod_action = GetVars("mod_action");
$admin_action = GetVars("admin_action");
$logout = GetVars("logout");
$pid = GetVars("pid");
$HTTP_HOST = GetVars("HTTP_HOST");
$REQUEST_METHOD = GetVars("REQUEST_METHOD");
$QUERY_STRING = GetVars("QUERY_STRING");
$forum_id = GetVars("forum_id");
$thread_id = GetVars("thread_id");
$reply_id = GetVars("reply_id");
$preview_scheme = GetVars("preview_scheme");
$user_name = GetVars("user_name");
/* Assign null values to these variables */
$logged_in = 0;
$login = "";
$user_id = "";
$is_moderator = 0;
$is_admin = 0;
$hack_attempt = "";
$mod_feedback = "";
$admin_feedback = "";
$show_thread = "";
$show_forum = "";
$scheme_error = "";
$scheme_feedback = "";
/* Parse the variables and trim them to a specified length */
CheckVars(&$pid, 16);
/* Connect to the MySQL database */
define("CONNECTION", @mysql_connect(DB_HOST, DB_USER, DB_PASS));
if (!CONNECTION)
{
if (ADMIN_ERRORS != "yes")
{
NotifyAdmin("mysql_connect");
exit(ERROR);
}
else
exit("There was an error.
MySQL Error: " . mysql_error() . "\n");
}
/* Pull the general properties from the database */
$SQL = "SELECT * FROM " . TABLE_PREFIX . "properties;";
$results = ExeSQL($SQL);
/* Grab the data and assign the values to constants */
while ($row = mysql_fetch_array($results))
{
define("BOARD_NAME", $row["board_name"]);
define("TITLE_IMAGE", $row["title_image"]);
}
/* Attempt to log the user in, if requested */
AttemptLogin(&$pid, &$logged_in, &$login, $username, &$password, &$is_moderator, &$is_admin );
/* Verify their identity, if they are logged in */
VerifyLogin( &$logged_in, &$user_id, &$is_moderator, &$is_admin );
/* Attempt to perform a moderator action, if requested */
ModAction( &$is_moderator, &$mod_action, $forum_id, $thread_id, $reply_id, $user_id, &$hack_attempt, &$mod_feedback, &$show_thread, &$show_forum );
/* Attempt to perform an admin action, if requested */
AdminAction( &$is_admin, &$admin_action, $forum_id, $thread_id, $reply_id, $user_id, &$hack_attempt, &$mod_feedback, &$show_thread, &$show_forum );
/* Determine if we pull the default scheme, or preview another */
if ($is_admin != 1)
$SQL = "SELECT * FROM " . TABLE_PREFIX . "schemes WHERE active_scheme='1';";
else
{
if ($preview_scheme == "")
$SQL = "SELECT * FROM " . TABLE_PREFIX . "schemes WHERE active_scheme='1';";
else
{
/* Pull the scheme that was requested */
$SQL = "SELECT COUNT(*) AS scheme_exists FROM " . TABLE_PREFIX . "schemes WHERE scheme_id='$preview_scheme';";
$results = ExeSQL($SQL);
/* Grab data and load it in a variable */
while ($row = mysql_fetch_array($results))
$scheme_exists = $row["scheme_exists"];
/* If the scheme doesn't exist then ... */
if ($scheme_exists == 0)
{
/* Pull the active scheme anyway! */
$SQL = "SELECT * FROM " . TABLE_PREFIX . "schemes WHERE active_scheme='1';";
$scheme_error = "The scheme you requested to preview is unknown.";
}
else
{
/* Pull the name of the requested scheme */
$SQL = "SELECT scheme_name FROM " . TABLE_PREFIX . "schemes WHERE scheme_id='$preview_scheme';";
$results = ExeSQL($SQL);
/* Grab the name of the scheme and load it in a variable */
while ($row = mysql_fetch_array($results))
$scheme_name = $row["scheme_name"];
/* Pull the request scheme's properties */
$SQL = "SELECT * FROM " . TABLE_PREFIX . "schemes WHERE scheme_id='$preview_scheme';";
$scheme_feedback = "You are currently previewing the '$scheme_name' scheme.";
}
}
}
/* Executed the winning scheme query */
$results = ExeSQL($SQL);
/* Grab the data and load it into constants */
while ($row = mysql_fetch_array($results))
{
define("BACKGROUND_COLOR", $row["background_color"]);
define("TABLE_BORDER_COLOR", $row["table_border_color"]);
define("TABLE_BORDER_SIZE", $row["table_border_size"]);
define("HEADER_BACKGROUND", $row["header_background"]);
define("MENU_BACKGROUND", $row["menu_background"]);
define("TEXT_COLOR", $row["text_color"]);
define("TEXT_FONT", $row["text_font"]);
define("TEXT_SMALL", $row["text_small"]);
define("TEXT_REGULAR", $row["text_regular"]);
define("LINK_COLOR", $row["link_color"]);
define("TABLE_HEADER_BACKGROUND", $row["table_header_background"]);
define("TABLE_HEADER_TEXT_COLOR", $row["table_header_text_color"]);
define("TABLE_COLOR_1", $row["table_color_1"]);
define("TABLE_COLOR_2", $row["table_color_2"]);
define("ERROR_MESSAGE", $row["error_message"]);
}
/* Attempt to redefine the colors with the defaults (success = there is nothing in the schemes table) */
define("BACKGROUND_COLOR", "#FFFFFF");
define("TABLE_BORDER_COLOR", "#000000");
define("TABLE_BORDER_SIZE", "1");
define("HEADER_BACKGROUND", "#FFFFFF");
define("MENU_BACKGROUND", "#EEEEEE");
define("TEXT_COLOR", "#000000");
define("TEXT_FONT", "Verdana");
define("TEXT_SMALL", "10");
define("TEXT_REGULAR", "12");
define("LINK_COLOR", "#000000");
define("TABLE_HEADER_BACKGROUND", "#000000");
define("TABLE_HEADER_TEXT_COLOR", "#FFFFFF");
define("TABLE_COLOR_1", "#EEEEEE");
define("TABLE_COLOR_2", "#CCCCCC");
define("ERROR_MESSAGE", "#FF0000");
/* Log the user out if requested */
if ($logout == "now")
{
/* Blow out the cookie */
SetCookie("user_name", "", time() - 3600, ''); //, $HTTP_HOST);
SetCookie("user_pass", "", time() - 3600, ''); //, $HTTP_HOST);
unset($_COOKIE);
/* Blow out the variables */
$logged_in = 0;
$is_admin = 0;
$is_moderator = 0;
}
/* If the destination is specified, then assign it to the $pid */
if ($destination != "")
$pid = $destination;
/* If there's no specified $pid, then default to 'view_forums' */
if ($pid == "")
$pid = "view_forums";
/* If $show_thread isn't 0, then set the $pid and $thread_id */
if ($show_thread != 0)
{
$pid = "view_replies";
$thread_id = $show_thread;
}
/* Same deal as before, except it happens if $show_forum isn't 0 */
if ($show_forum != 0)
{
$pid = "view_threads";
$thread_id = $show_forum;
}
/* Determine which page to load based on the querystring */
switch ($pid)
{
/* The default page is the 'view forums' page */
default:
case "view_forums":
$page_title = "View Forums";
$pid = "view_forums";
break;
/* Nothing special */
case "view_threads":
$page_title = "View Threads";
break;
/* Nadda */
case "view_replies":
$page_title = "View Replies";
break;
/* Zippo */
case "register":
$page_title = "Register";
break;
/* Zilch */
case "login":
$page_title = "Login";
break;
/* If the user is trying to post a thread, check if they are logged in */
case "post_thread":
$page_title = "Post Thread";
/* If not, then direct them to the login page */
if ($logged_in == 0)
{
$destination = $pid;
$pid = "login";
}
break;
/* If the user is trying to post a reply, check if they are logged in */
case "post_reply":
$page_title = "Post Reply";
/* If not, then direct them to the login page */
if ($logged_in == 0)
{
$destination = $pid;
$pid = "login";
}
break;
/* If the user is trying to edit a profile, check if they are logged in */
case "edit_profile":
$page_title = "Edit Profile";
/* If not, then direct them to the login page */
if ($logged_in == 0)
{
$destination = $pid;
$pid = "login";
}
break;
/* Do the normal thang */
case "view_profile":
$page_title = "View Profile";
break;
/* These are the admin sections */
case "forum_admin":
case "user_admin":
case "scheme_admin":
case "general_admin":
/* If th user isn't logged in, send them there */
if ($logged_in == 0)
{
$destination = $pid;
$pid = "login";
}
/* If the user isn't an admin, assume it's a hack attempt */
if ($is_admin == 0)
{
$hack_attempt = "outside";
$pid = "view_forums";
}
break;
/* Show the FAQ for the board */
case "faq":
$page_title = "Frequently Asked Questions";
$message = $pid;
$pid = "view_message";
break;
}
/* Conver the $pid to lower case, and pull that filename */
$page_file = "./content/" . strtolower($pid) . ".php";
/* Display the page header, including CSS stuff */
echo "
\n"
. "
| \n"
. " ||||||
| \n"
. " \n";
/* If there is a scheme error, then show it! */
if ($scheme_error != "")
echo " \n"; /* If there's scheme feedback, then show it */ if ($scheme_feedback != "") echo " \n"; /* If there's a malformed request to the moderator tools, then error out */ if ($hack_attempt == "outside") echo " \n"; else if ($hack_attempt == "inside") echo " \n"; /* If a moderator tool have been executed, give feedback on it, positive or negative */ if ($mod_feedback != "") echo " \n"; /* Load the content for the page that was requested */ require($page_file); /* It's all downhill from here ... */ echo " \n" . " | \n"
. " ||||||
| \n"; /* Grab the current time, and figure the difference */ $load_time = round((microtime() - $start_time), 5); /* If it's negative, then strip off the '-' */ if (substr($load_time, 0, 1) == "-") $load_time = substr($load_time, 1); echo " | \n" . "