function forum_check_password($forum_fid) { if (!is_numeric($forum_fid)) { return; } $webtag = get_webtag(); if (!forum_check_webtag_available($webtag)) { return; } if (!($forum_passhash = forum_get_password($forum_fid))) { return; } if (isset($_SESSION["{$webtag}_PASSWORD"]) && is_md5($_SESSION["{$webtag}_PASSWORD"])) { $forum_passhash_check = $_SESSION["{$webtag}_PASSWORD"]; } else { $forum_passhash_check = null; } if (isset($_POST['forum_password']) && strlen($_POST['forum_password']) > 0) { $forum_passhash_check = md5($_POST['forum_password']); } if ($forum_passhash == $forum_passhash_check) { $_SESSION["{$webtag}_PASSWORD"] = $forum_passhash_check; return; } cache_disable(); html_draw_top(array('title' => gettext("Password Protected Forum"))); echo "<h1>", gettext("Password Protected Forum"), "</h1>\n"; if (isset($_SESSION["{$webtag}_PASSWORD"]) && is_md5($_SESSION["{$webtag}_PASSWORD"])) { html_display_error_msg(gettext("The username or password you supplied is not valid."), '550', 'center'); } if (($password_protected_message = forum_get_setting('password_protected_message')) !== false) { echo fix_html($password_protected_message); } else { html_display_warning_msg(gettext("This forum is password protected. To gain access enter the password below."), '400', 'center'); } echo "<br />\n"; echo "<div align=\"center\">\n"; echo " <form accept-charset=\"utf-8\" method=\"post\" action=\"", get_request_uri(), "\" target=\"_self\" autocomplete=\"off\">\n"; echo " ", form_csrf_token_field(), "\n"; if (isset($_POST) && is_array($_POST) && sizeof($_POST) > 0) { echo form_input_hidden_array($_POST); } echo " ", form_input_hidden('webtag', htmlentities_array($webtag)), "\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"400\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"400\">\n"; echo " <tr>\n"; echo " <td class=\"posthead\" align=\"center\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">", gettext("Enter Password"), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " <table class=\"posthead\" width=\"90%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">", gettext("Password"), ":</td>\n"; echo " <td align=\"left\">", form_input_password('forum_password', null, 40), "</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\" colspan=\"2\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">", form_submit("logon", gettext("Logon")), " ", form_submit("cancel", gettext("Cancel")), "</td>\n"; echo " </tr>\n"; echo " </table>\n"; if (session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::check_perm(USER_PERM_FORUM_TOOLS, 0)) { html_display_warning_msg(gettext("If you want to change some settings on your forum click the Admin link in the navigation bar above."), '400', 'center'); } echo " </form>\n"; echo "</div>\n"; html_draw_bottom(); exit; }
along with Beehive; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ======================================================================*/ // Bootstrap require_once 'boot.php'; // Includes required by this page. require_once BH_INCLUDE_PATH . 'cache.inc.php'; require_once BH_INCLUDE_PATH . 'constants.inc.php'; require_once BH_INCLUDE_PATH . 'header.inc.php'; require_once BH_INCLUDE_PATH . 'html.inc.php'; require_once BH_INCLUDE_PATH . 'lang.inc.php'; require_once BH_INCLUDE_PATH . 'logon.inc.php'; require_once BH_INCLUDE_PATH . 'session.inc.php'; // Don't cache this page - fixes problems with Opera. cache_disable(); // Get the user's saved left frame width. if (($left_frame_width = session::get_value('LEFT_FRAME_WIDTH')) === false) { $left_frame_width = 280; } html_draw_top('frame_set_html', 'pm_popup_disabled'); $frameset = new html_frameset_cols('start', "{$left_frame_width},*"); if (isset($_GET['left']) && $_GET['left'] == "threadlist") { $frameset->html_frame("thread_list.php?webtag={$webtag}", html_get_frame_name('left')); } else { $frameset->html_frame("start_left.php?webtag={$webtag}", html_get_frame_name('left')); } if (isset($_GET['show']) && $_GET['show'] == "visitors") { $frameset->html_frame("visitor_log.php?webtag={$webtag}", html_get_frame_name('right')); } else { $frameset->html_frame("start_main.php?webtag={$webtag}", html_get_frame_name('right'));
function bh_exception_handler(Exception $exception) { $config = server_get_config(); if (isset($config['error_report_verbose']) && $config['error_report_verbose'] == true) { $error_report_verbose = true; } else { $error_report_verbose = false; } cache_disable(); while (@ob_end_clean()) { } ob_start(); ob_implicit_flush(0); bh_error_send_email($exception); $error_msg_array = bh_error_process($exception); $error_log_message = sprintf('BEEHIVE_ERROR: %s', strip_tags(implode(". ", $error_msg_array))); @error_log($error_log_message); header_status(500, 'Internal Server Error'); if ($exception->getCode() == MYSQL_ERROR_NO_SUCH_TABLE || $exception->getCode() == MYSQL_ERROR_WRONG_COLUMN_NAME) { if (function_exists('install_incomplete') && !defined('BEEHIVE_DEVELOPER_MODE')) { install_incomplete(); } } if (preg_match('/include|include_once/u', $exception->getMessage()) > 0) { if (function_exists('install_missing_files') && !defined('BEEHIVE_DEVELOPER_MODE')) { install_missing_files(); } } $forum_path = server_get_forum_path(); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"utf-8\" lang=\"en\" dir=\"ltr\">\n"; echo "<head>\n"; echo "<title>Beehive Forum - Error Handler</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; echo "<link rel=\"icon\" href=\"images/favicon.ico\" type=\"image/ico\" />\n"; echo "<link rel=\"stylesheet\" href=\"", $forum_path, "/styles/default/style.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>Error</h1>\n"; echo "<br />\n"; if (defined('BEEHIVEMODE_LIGHT') && !defined('BEEHIVE_DEVELOPER_MODE')) { echo '<p>An error has occured. Please wait a few moments before trying again.</p>'; echo '<p>Details of the error have been saved to the default error log.</p>'; if (isset($error_report_verbose) && $error_report_verbose == true) { echo '<p>When reporting a bug in Project Beehive or when requesting support please include the details below.</p>'; echo "<table cellpadding=\"0\" cellspacing=\"0\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<p>", implode("</p><p>", $error_msg_array), "</p>\n"; } } else { echo "<div align=\"center\">\n"; echo "<form accept-charset=\"utf-8\" name=\"f_error\" method=\"post\" action=\"\" target=\"_self\">\n"; echo " ", form_input_hidden_array($_POST), "\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">An error has occured. Please wait a few moments and then click the Retry button below. Details of the error have been saved to the default error log.</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; if (isset($error_report_verbose) && $error_report_verbose == true || defined('BEEHIVE_DEVELOPER_MODE')) { echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error Details</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"95%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">When reporting a bug in Project Beehive or when requesting support please include the details below.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><img src=\"styles/default/images/warning.png\" alt=\"Warning\" title=\"Warning\" /></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>\n"; echo " <div class=\"error_handler_details\">", implode("\n", $error_msg_array), "</div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; } echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"600\">\n"; echo " <tr>\n"; echo " <td align=\"center\"><input class=\"button\" type=\"submit\" name=\"", md5(uniqid(mt_rand())), "\" value=\"Retry\" /></td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</form>\n"; echo "</div>\n"; } echo "</body>\n"; echo "</html>\n"; exit; }
function cache_check_messages() { if (!($db = db::get())) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } if (!cache_check_enabled()) { return false; } if (browser_check(BROWSER_AOL)) { return false; } if (headers_sent()) { return false; } // Disable cache on these URL queries. if (isset($_GET['delete_success'])) { return false; } if (isset($_GET['edit_success'])) { return false; } if (isset($_GET['font_resize'])) { return false; } if (isset($_GET['markasread'])) { return false; } if (isset($_GET['post_approve_success'])) { return false; } if (isset($_GET['relupdated'])) { return false; } if (isset($_GET['setinterest'])) { return false; } if (isset($_GET['setstats'])) { return false; } if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { cache_disable(); return false; } if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { list($tid) = explode('.', $_GET['msg']); $sql = "SELECT * FROM (SELECT UNIX_TIMESTAMP(MAX(POST.CREATED)) AS CREATED, "; $sql .= "UNIX_TIMESTAMP(MAX(POST.VIEWED)) AS VIEWED, UNIX_TIMESTAMP(MAX(POST.APPROVED)) AS APPROVED, "; $sql .= "UNIX_TIMESTAMP(MAX(POST.EDITED)) AS EDITED FROM `{$table_prefix}POST` POST "; $sql .= "WHERE POST.TID = '{$tid}') AS POST_DATA, (SELECT UNIX_TIMESTAMP(MAX(USER_POLL_VOTES.VOTED)) "; $sql .= "AS POLL_VOTE FROM `{$table_prefix}USER_POLL_VOTES` USER_POLL_VOTES "; $sql .= "WHERE USER_POLL_VOTES.TID = '{$tid}') AS POLL_DATA"; } else { $sql = "SELECT UNIX_TIMESTAMP(MAX(CREATED)) AS CREATED, "; $sql .= "0 AS VIEWED, 0 AS APPROVED, 0 AS EDITED, 0 AS POLL_VOTE "; $sql .= "FROM `{$table_prefix}POST`"; } if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return true; } // Get the two modified dates from the query list($created, $viewed, $approved, $edited, $voted) = $result->fetch_row(); // Work out which one is newer (higher). $local_cache_date = max($created, $viewed, $approved, $edited, $voted); // Last Modified Header for cache control $local_last_modified = gmdate("D, d M Y H:i:s", $local_cache_date) . " GMT"; $local_cache_expires = gmdate("D, d M Y H:i:s", $local_cache_date) . " GMT"; if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strlen(trim($_SERVER['HTTP_IF_MODIFIED_SINCE'])) > 0) { $remote_last_modified = $_SERVER['HTTP_IF_MODIFIED_SINCE']; if (strtotime($remote_last_modified) >= $local_cache_date) { header("Expires: {$local_cache_expires}", true); header("Last-Modified: {$remote_last_modified}", true); header('Cache-Control: private, must-revalidate', true); header_status(304, 'Not Modified'); exit; } } header("Expires: {$local_cache_expires}", true); header("Last-Modified: {$local_last_modified}", true); header('Cache-Control: private, must-revalidate', true); return true; }
function bh_exception_handler(Exception $exception) { try { $config = server_get_config(); if (isset($config['error_report_verbose']) && $config['error_report_verbose'] == true) { $error_report_verbose = true; } else { $error_report_verbose = false; } cache_disable(); while (@ob_end_clean()) { } ob_start(); ob_implicit_flush(0); bh_error_send_email($exception); $error_msg_array = bh_error_process($exception); $error_log_message = sprintf('BEEHIVE_ERROR: %s', strip_tags(implode(". ", $error_msg_array))); @error_log($error_log_message); header_status(500, 'Internal Server Error'); $forum_path = server_get_forum_path(); echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"; echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en-gb\" lang=\"en-gb\" dir=\"ltr\">\n"; echo "<head>\n"; echo "<title>Beehive Forum - Error Handler</title>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n"; echo "<link rel=\"icon\" href=\"", rtrim($forum_path, '/'), "/styles/images/favicon.ico\" type=\"image/ico\" />\n"; echo "<link rel=\"stylesheet\" href=\"", rtrim($forum_path, '/'), "/styles/default/style.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "<link rel=\"stylesheet\" href=\"", rtrim($forum_path, '/'), "/styles/default/images.css?", md5(uniqid(rand())), "\" type=\"text/css\" />\n"; echo "</head>\n"; echo "<body>\n"; echo "<h1>Error</h1>\n"; echo "<br />\n"; if (defined('BEEHIVEMODE_LIGHT') && !defined('BEEHIVE_DEVELOPER_MODE')) { echo '<p>An error has occurred. Please wait a few moments before trying again.</p>'; echo '<p>Details of the error have been saved to the default error log.</p>'; if (isset($error_report_verbose) && $error_report_verbose == true) { echo '<p>When reporting a bug in Project Beehive or when requesting support please include the details below.</p>'; echo "<table cellpadding=\"0\" cellspacing=\"0\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "<p>", implode("</p><p>", $error_msg_array), "</p>\n"; } } else { echo "<div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"98%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"postbody\">An error has occured. Please wait a few moments and then click the Retry button below. Details of the error have been saved to the default error log.</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; if (isset($error_report_verbose) && $error_report_verbose == true || defined('BEEHIVE_DEVELOPER_MODE')) { echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <table class=\"box\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"posthead\">\n"; echo " <table class=\"posthead\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" class=\"subhead\" colspan=\"2\">Error Details</td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <table class=\"posthead\" width=\"98%\">\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">When reporting a bug in Project Beehive or when requesting support please include the details below.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\">\n"; echo " <div align=\"center\">\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" class=\"warning_msg\">\n"; echo " <tr>\n"; echo " <td valign=\"top\" width=\"25\" class=\"warning_msg_icon\"><span class=\"image warning\"></span></td>\n"; echo " <td valign=\"top\" class=\"warning_msg_text\">Please note that there may be sensitive information such as passwords displayed here.</td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>\n"; echo " <div class=\"error_handler_details\">", implode("\n", $error_msg_array), "</div>\n"; echo " </td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td align=\"left\"> </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; } echo " <br />\n"; echo " <table cellpadding=\"0\" cellspacing=\"0\" width=\"800\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <button class=\"button\" type=\"button\" onclick=\"window.location.reload()\">Retry</button>\n"; echo " </td>\n"; echo " </tr>\n"; echo " </table>\n"; echo "</div>\n"; } echo "</body>\n"; echo "</html>\n"; exit; } catch (Exception $e) { printf('Exception thrown when handling an exception: %s', $exception->getMessage()); exit; } }
function cache_check_messages() { if (!($db = db::get())) { return false; } if (!($table_prefix = get_table_prefix())) { return false; } if (!cache_check_enabled()) { return false; } if (browser_check(BROWSER_AOL)) { return false; } if (headers_sent()) { return false; } if (isset($_GET['post_success'])) { return false; } if (isset($_GET['delete_success'])) { return false; } if (isset($_GET['edit_success'])) { return false; } if (isset($_GET['font_resize'])) { return false; } if (isset($_GET['markasread'])) { return false; } if (isset($_GET['post_approve_success'])) { return false; } if (isset($_GET['relupdated'])) { return false; } if (isset($_GET['setinterest'])) { return false; } if (isset($_GET['setstats'])) { return false; } if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'POST') { cache_disable(); return false; } if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { list($tid) = explode('.', $_GET['msg']); $sql = "SELECT * FROM (SELECT UNIX_TIMESTAMP(MAX(POST.CREATED)) AS CREATED, "; $sql .= "UNIX_TIMESTAMP(MAX(POST_RECIPIENT.VIEWED)) AS VIEWED, UNIX_TIMESTAMP(MAX(POST.APPROVED)) AS APPROVED, "; $sql .= "UNIX_TIMESTAMP(MAX(POST.EDITED)) AS EDITED FROM `{$table_prefix}POST` POST "; $sql .= "LEFT JOIN `{$table_prefix}POST_RECIPIENT` POST_RECIPIENT "; $sql .= "ON (POST_RECIPIENT.TID = POST.TID AND POST_RECIPIENT.PID = POST.PID) "; $sql .= "WHERE POST.TID = '{$tid}') AS POST_DATA, (SELECT UNIX_TIMESTAMP(MAX(USER_POLL_VOTES.VOTED)) "; $sql .= "AS POLL_VOTE FROM `{$table_prefix}USER_POLL_VOTES` USER_POLL_VOTES "; $sql .= "WHERE USER_POLL_VOTES.TID = '{$tid}') AS POLL_DATA"; } else { $sql = "SELECT UNIX_TIMESTAMP(MAX(CREATED)) AS CREATED, "; $sql .= "0 AS VIEWED, 0 AS APPROVED, 0 AS EDITED, 0 AS POLL_VOTE "; $sql .= "FROM `{$table_prefix}POST`"; } if (!($result = $db->query($sql))) { return false; } if ($result->num_rows == 0) { return true; } list($created, $viewed, $approved, $edited, $voted) = $result->fetch_row(); $last_modified = max($created, $viewed, $approved, $edited, $voted); $etag = md5($_SESSION['UID'] . $_SESSION['LOGON']); return cache_check_last_modified($last_modified, $etag); }