echo "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\">\n"; echo " <tr>\n"; echo " <td align=\"left\" width=\"2%\" valign=\"top\"> </td>\n"; echo " <td align=\"center\">\n"; if ($thread_data['POLL_FLAG'] == 'Y') { if ($message['PID'] == 1) { poll_display($tid, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], false, $show_sigs, true); } else { message_display($tid, $message, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], false, true, $show_sigs, true); } } else { message_display($tid, $message, $thread_data['LENGTH'], $first_msg, $thread_data['FID'], true, $thread_data['CLOSED'], false, false, $show_sigs, true); } echo " </td>\n"; echo " <td width=\"2%\"> </td>\n"; echo " </tr>\n"; echo "</table>\n"; if (adsense_check_user() && adsense_check_page($message['PID'], 1, $thread_data['LENGTH'])) { adsense_output_html(); echo "<br />\n"; } } echo "<table width=\"96%\" border=\"0\">\n"; echo " <tr>\n"; echo " <td align=\"center\">\n"; echo " <a href=\"messages.php?webtag={$webtag}&msg={$tid}.{$pid}\" target=\"_self\" class=\"button\"><span>", gettext("Back"), "</span></a>\n"; echo " ", form_button("print", gettext("Print")), "\n"; echo " </td>\n"; echo " </tr>\n"; echo "</table>\n"; html_draw_bottom();
function light_draw_messages($tid, $pid, array $thread_data, array $messages) { $webtag = get_webtag(); forum_check_webtag_available($webtag); $msg_count = count($messages); $last_pid = null; light_messages_top($tid, $pid, $thread_data['TITLE'], $thread_data['INTEREST'], $thread_data['STICKY'], $thread_data['CLOSED'], $thread_data['ADMIN_LOCK'], $thread_data['DELETED'] == 'Y'); if (isset($_GET['post_success']) && validate_msg($_GET['post_success'])) { list($return_tid, $return_pid) = explode(".", $_GET['post_success']); if ($return_tid != $tid || $return_pid > $pid + 10) { light_html_display_success_msg(sprintf(gettext("Successfully created post %s"), $_GET['post_success'])); } } else { if (isset($_GET['edit_success']) && validate_msg($_GET['edit_success'])) { light_html_display_success_msg(sprintf(gettext("Successfully edited post %s"), $_GET['edit_success'])); } else { if (isset($_GET['delete_success']) && validate_msg($_GET['delete_success'])) { light_html_display_success_msg(sprintf(gettext("Successfully deleted post %s"), $_GET['delete_success'])); } else { if (isset($_GET['delete_success']) && validate_msg($_GET['delete_success'])) { light_html_display_success_msg(sprintf(gettext("Successfully deleted post %s"), $_GET['delete_success'])); } else { if (isset($_GET['post_approve_success']) && validate_msg($_GET['post_approve_success'])) { light_html_display_success_msg(sprintf(gettext("Successfully approved post %s"), $_GET['post_approve_success'])); } } } } } if (($tracking_data_array = thread_get_tracking_data($tid)) !== false) { foreach ($tracking_data_array as $tracking_data) { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_MERGE) { // Thread merged if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread has moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread was merged from %s"), $thread_link)); } } else { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_SPLIT) { // Thread Split if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread have been moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread were moved from %s"), $thread_link)); } } } } } echo "<div id=\"messages\" data-navigation=\"{$tid}_{$pid}_{$thread_data['LENGTH']}_10\">\n"; if ($msg_count > 0) { foreach ($messages as $message_number => $message) { if (isset($message['RELATIONSHIP']) && ($message['RELATIONSHIP'] & USER_IGNORED || $message['RELATIONSHIP'] & USER_IGNORED_COMPLETELY)) { $message['CONTENT'] = gettext("Ignored"); } else { $message['CONTENT'] = message_get_content($tid, $message['PID']); } if ($thread_data['POLL_FLAG'] == 'Y') { if ($message['PID'] == 1) { light_poll_display($tid, $thread_data['LENGTH'], $thread_data['FID'], true, $thread_data['CLOSED'], false, false); $last_pid = $message['PID']; } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, true, false); $last_pid = $message['PID']; } } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, false, false); $last_pid = $message['PID']; } if (adsense_check_user() && adsense_check_page($message_number, 10, $thread_data['LENGTH'])) { adsense_output_html(); } } } unset($messages, $message); echo "</div>\n"; if ($last_pid < $thread_data['LENGTH']) { echo "<div class=\"message_page_footer\">\n"; echo "<ul>\n"; echo "<li class=\"right_col\">", light_form_quick_button("lmessages.php", gettext("Keep reading…"), array('msg' => $tid . '.' . ($last_pid + 1)), '_self', 'keep_reading'), "</li>\n"; echo "</ul>\n"; echo "</div>\n"; } if ($msg_count > 0 && session::logged_in()) { messages_update_read($tid, $last_pid, $thread_data['LAST_READ'], $thread_data['LENGTH'], $thread_data['MODIFIED']); } }
function html_draw_top() { $arg_array = func_get_args(); $title = null; $body_class = null; $base_target = null; $stylesheet_array = array(); $meta_refresh = array('delay' => null, 'url' => null); $robots = null; $frame_set_html = false; $pm_popup_disabled = false; $inline_css = null; $emoticons = null; $webtag = get_webtag(); $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum'); $func_matches = array(); foreach ($arg_array as $key => $func_args) { if (preg_match('/^title=(.+)?$/Disu', $func_args, $func_matches) > 0) { $title = !isset($title) && isset($func_matches[1]) ? $func_matches[1] : $title; unset($arg_array[$key]); } if (preg_match('/^class=(.+)?$/Disu', $func_args, $func_matches) > 0) { $body_class = !isset($body_class) && isset($func_matches[1]) ? $func_matches[1] : $body_class; unset($arg_array[$key]); } if (preg_match('/^basetarget=(.+)?$/Disu', $func_args, $func_matches) > 0) { $base_target = !isset($base_target) && isset($func_matches[1]) ? $func_matches[1] : $base_target; unset($arg_array[$key]); } if (preg_match('/^stylesheet=([^:]+)(:(.+))?$/Disu', $func_args, $func_matches) > 0) { $stylesheet_array[] = array('filename' => $func_matches[1], 'media' => isset($func_matches[3]) ? $func_matches[3] : 'screen'); unset($arg_array[$key]); } if (preg_match('/^refresh=([^:]+):(.+)$/Disu', $func_args, $func_matches) > 0) { $meta_refresh['delay'] = isset($func_matches[1]) ? $func_matches[1] : null; $meta_refresh['url'] = isset($func_matches[2]) ? $func_matches[2] : null; unset($arg_array[$key]); } if (preg_match('/^robots=(.+)?$/Disu', $func_args, $func_matches) > 0) { $robots = !isset($robots) && isset($func_matches[1]) ? $func_matches[1] : $robots; unset($arg_array[$key]); } if (preg_match('/^frame_set_html$/Disu', $func_args, $func_matches) > 0) { $frame_set_html = true; unset($arg_array[$key]); } if (preg_match('/^pm_popup_disabled$/Disu', $func_args, $func_matches) > 0) { $pm_popup_disabled = true; unset($arg_array[$key]); } if (preg_match('/^inline_css=(.+)/Disu', $func_args, $func_matches) > 0) { $inline_css = !isset($inline_css) && isset($func_matches[1]) ? $func_matches[1] : $inline_css; unset($arg_array[$key]); } if (preg_match('/^emoticons=(.+)?$/Disu', $func_args, $func_matches) > 0) { $emoticons = !isset($emoticons) && isset($func_matches[1]) ? $func_matches[1] : $emoticons; unset($arg_array[$key]); } } echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; if ($frame_set_html === false) { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n"; } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.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 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; // Default Meta keywords and description. $meta_keywords = html_get_forum_keywords(); $meta_description = html_get_forum_description(); if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { message_get_meta_content($_GET['msg'], $meta_keywords, $meta_description); list($tid, $pid) = explode('.', $_GET['msg']); if ($thread_data = thread_get($tid)) { $prev_page = $pid - 10 > 0 ? $pid - 10 : 1; $next_page = $pid + 10 < $thread_data['LENGTH'] ? $pid + 10 : $thread_data['LENGTH']; echo "<link rel=\"first\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n"; echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$next_page}"), "\" />\n"; echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&msg={$tid}.{$prev_page}"), "\" />\n"; echo "<title>", word_filter_add_ob_tags($thread_data['TITLE'], true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { echo "<title>", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", htmlentities_array($forum_name), "</title>\n"; } else { echo "<title>", htmlentities_array($forum_name), "</title>\n"; } } $forum_content_rating = html_get_forum_content_rating(); echo "<meta name=\"generator\" content=\"Beehive Forum ", BEEHIVE_VERSION, "\" />\n"; echo "<meta name=\"keywords\" content=\"", word_filter_add_ob_tags($meta_keywords, true), "\" />\n"; echo "<meta name=\"description\" content=\"", word_filter_add_ob_tags($meta_description, true), "\" />\n"; echo "<meta name=\"rating\" content=\"{$forum_content_rating}\" />\n"; if (forum_get_setting('allow_search_spidering', 'N')) { echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"; } else { if (isset($robots)) { echo "<meta name=\"robots\" content=\"{$robots}\" />\n"; } } if (isset($meta_refresh['url'], $meta_refresh['delay'])) { echo "<meta http-equiv=\"refresh\" content=\"{$meta_refresh['delay']}; url={$meta_refresh['url']}\" />\n"; } printf("<meta name=\"application-name\" content=\"%s\" />\n", word_filter_add_ob_tags($forum_name, true)); printf("<meta name=\"msapplication-tooltip\" content=\"%s\" />\n", word_filter_add_ob_tags($meta_description, true)); if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Messages'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=discussion.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/unread_thread.ico', true, true)); if (forum_get_setting('show_links', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Links'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=links.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/link.ico', true, true)); } } if (forum_get_setting('show_pms', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Inbox'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=pm.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/pmunread.ico', true, true)); } if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('My Controls'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=user.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/user_controls.ico', true, true)); } if (session::logged_in() && (session::check_perm(USER_PERM_FORUM_TOOLS, 0) || session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE))) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", _('Admin'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=admin.php%3Fwebtag%3D{$webtag}")), html_style_image('msie/admintool.ico', true, true)); } printf("<meta name=\"msapplication-starturl\" content=\"%s\" />\n", html_get_forum_file_path("index.php?webtag={$webtag}")); $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(_('RSS Feed')), $rss_feed_path); if ($folders_array = folder_get_available_details()) { foreach ($folders_array as $folder) { $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&fid={$folder['FID']}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($folder['TITLE']), htmlentities_array(_('RSS Feed')), $rss_feed_path); } } if ($user_style_path = html_get_user_style_path()) { printf("<link rel=\"apple-touch-icon\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-57x57.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-72x72.png', $user_style_path))); printf("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-114x114.png', $user_style_path))); printf("<link rel=\"shortcut icon\" type=\"image/ico\" href=\"%s\" />\n", html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path))); } $opensearch_path = html_get_forum_file_path(sprintf('search.php?webtag=%s&opensearch', $webtag)); printf("<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"%s\" href=\"%s\" />\n", $forum_name, $opensearch_path); if ($style_sheet = html_get_style_sheet()) { html_include_css($style_sheet); } if ($script_style_sheet = html_get_script_style_sheet()) { html_include_css($script_style_sheet); } if ($emoticon_style_sheet = html_get_emoticon_style_sheet($emoticons)) { html_include_css($emoticon_style_sheet, 'print, screen'); } if (isset($stylesheet_array) && is_array($stylesheet_array)) { foreach ($stylesheet_array as $stylesheet) { if (isset($stylesheet['filename']) && isset($stylesheet['media'])) { html_include_css($stylesheet['filename'], $stylesheet['media']); } } } if ($style_path_ie6 = html_get_style_sheet('style_ie6.css')) { echo "<!--[if IE 6]>\n"; html_include_css($style_path_ie6); echo "<![endif]-->\n"; } if (isset($inline_css)) { echo "<style type=\"text/css\">\n"; echo "<!--\n\n", $inline_css, "\n\n//-->\n"; echo "</style>\n"; } // Font size (not for Guests) if (session::logged_in()) { html_include_css(html_get_forum_file_path(sprintf('font_size.php?webtag=%s', $webtag)), 'screen', 'user_font'); } if ($base_target) { echo "<base target=\"{$base_target}\" />\n"; } html_include_javascript(html_get_forum_file_path('js/jquery-1.7.1.min.js')); html_include_javascript(html_get_forum_file_path('js/jquery-ui-1.8.22.autocomplete.min.js')); html_include_javascript(html_get_forum_file_path('js/jquery.parsequery.js')); html_include_javascript(html_get_forum_file_path('js/jquery.sprintf.js')); html_include_javascript(html_get_forum_file_path('js/jquery.url.js')); html_include_javascript(html_get_forum_file_path('js/general.js')); if ($frame_set_html === false) { // Check for any new PMs. if (session::logged_in()) { // Check to see if the PM popup is disabled on the current page. if ($pm_popup_disabled === false) { // Pages we don't want the popup to appear on $pm_popup_disabled_pages = array('admin.php', 'attachments.php', 'change_pw.php', 'confirm_email.php', 'dictionary.php', 'discussion.php', 'display_emoticons.php', 'edit_attachments.php', 'email.php', 'font_size.php', 'forgot_pw.php', 'get_attachment.php', 'index.php', 'mods_list.php', 'nav.php', 'pm.php', 'pm_edit.php', 'pm_folders.php', 'pm_messages.php', 'pm_options.php', 'poll_results.php', 'start.php', 'search_popup.php', 'threads_rss.php', 'user.php', 'user_font.php', 'user_profile.php', 'user_stats.php'); // Check that we're not on one of the pages. if (!in_array(basename($_SERVER['PHP_SELF']), $pm_popup_disabled_pages)) { html_include_javascript(html_get_forum_file_path('js/pm.js')); } } // Overflow auto-resize functionality. $resize_images_page = array('admin_post_approve.php', 'create_poll.php', 'delete.php', 'display.php', 'edit.php', 'edit_poll.php', 'edit_signature.php', 'messages.php', 'post.php', 'pm_write.php', 'pm_edit.php', 'pm_messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $resize_images_page)) { if (session::get_value('USE_OVERFLOW_RESIZE') == 'Y') { html_include_javascript(html_get_forum_file_path('js/overflow.js')); } } // Mouseover spoiler pages $message_display_pages = array('admin_post_approve.php', 'create_poll.php', 'delete.php', 'display.php', 'edit.php', 'edit_poll.php', 'edit_signature.php', 'ldisplay.php', 'lmessages.php', 'lpost.php', 'messages.php', 'post.php'); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { html_include_javascript(html_get_forum_file_path('js/spoiler.js')); } } // Stats Display pages $stats_display_pages = array('messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $stats_display_pages)) { html_include_javascript(html_get_forum_file_path('js/stats.js')); } } reset($arg_array); foreach ($arg_array as $func_args) { html_include_javascript(html_get_forum_file_path("js/{$func_args}")); } html_include_javascript(html_get_forum_file_path("ckeditor/ckeditor.js")); html_include_javascript(html_get_forum_file_path("ckeditor/adapters/jquery.js")); html_include_javascript(html_get_forum_file_path("json.php?webtag={$webtag}")); if ($frame_set_html === true && ($google_analytics_code = html_get_google_analytics_code())) { echo "<script type=\"text/javascript\">\n\n"; echo " var _gaq = _gaq || [];\n"; echo " _gaq.push(['_setAccount', '{$google_analytics_code}']);\n"; echo " _gaq.push(['_trackPageview']);\n\n"; echo " (function() {\n"; echo " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; echo " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; echo " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; echo " })();\n\n"; echo "</script>\n"; } if ($frame_set_html === false && forum_get_setting('show_share_links', 'Y') && session::get_value('SHOW_SHARE_LINKS') == 'Y') { echo "<script type=\"text/javascript\" src=\"https://apis.google.com/js/plusone.js\">\n"; echo "{lang: 'en-GB'}\n"; echo "</script>\n"; echo "<script type=\"text/javascript\" src=\"http://platform.twitter.com/widgets.js\"></script>\n"; echo "<script type=\"text/javascript\" src=\"http://connect.facebook.net/en_US/all.js#xfbml=1\"></script>\n"; } echo "</head>\n\n"; if ($frame_set_html === false) { echo "<body", $body_class ? " class=\"{$body_class}\">\n" : ">\n"; if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) { adsense_output_html(); echo "<br />\n"; } if (forum_get_setting('show_share_links', 'Y') && session::get_value('SHOW_SHARE_LINKS') == 'Y') { echo '<div id="fb-root"></div>'; } } }
function html_draw_top(array $options = array()) { $title = null; $class = null; $base_target = null; $robots = null; $main_css = null; $images_css = null; $inline_css = null; $emoticons = null; $frame_set_html = false; $pm_popup_disabled = false; $js = array(); $css = array(); $webtag = get_webtag(); forum_check_webtag_available($webtag); $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum'); foreach ($options as $key => $value) { switch ($key) { case 'title': case 'class': case 'base_target': case 'robots': case 'main_css': case 'images_css': case 'inline_css': case 'emoticons': ${$key} = !isset(${$key}) && isset($value) ? $value : ${$key}; break; case 'frame_set_html': case 'pm_popup_disabled': ${$key} = is_bool($value) ? $value : ${$key}; break; case 'js': case 'css': if (!is_array($value) || count(array_filter($value, 'is_string')) != count($value)) { throw new InvalidArgumentException(sprintf('Expecting html_draw_top argument %s to be an array of strings', $key)); } ${$key} = $value; break; default: throw new InvalidArgumentException(sprintf('Unknown html_draw_top argument "%s"', $key)); break; } } if (!isset($main_css)) { $main_css = 'style.css'; } if (!isset($images_css)) { $images_css = 'images.css'; } if ($frame_set_html === false) { 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"; } else { echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Frameset//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd\">\n"; } echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"", gettext('en-gb'), "\" lang=\"", gettext('en-gb'), "\" dir=\"", gettext('ltr'), "\">\n"; echo "<head>\n"; echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n"; // Default Meta keywords and description. $meta_keywords = html_get_forum_keywords(); $meta_description = html_get_forum_description(); if (isset($_GET['msg']) && validate_msg($_GET['msg'])) { list($tid, $pid) = explode('.', $_GET['msg']); message_get_meta_content($_GET['msg'], $meta_keywords, $meta_description); if (isset($_SESSION['POSTS_PER_PAGE']) && is_numeric($_SESSION['POSTS_PER_PAGE'])) { $posts_per_page = max(min($_SESSION['POSTS_PER_PAGE'], 30), 10); } else { $posts_per_page = 20; } if (($thread_data = thread_get($tid)) !== false) { echo "<title>", word_filter_add_ob_tags($thread_data['TITLE'], true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; echo "<link rel=\"canonical\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; if ($thread_data['LENGTH'] > $posts_per_page) { $prev_page = $pid - $posts_per_page > 0 ? $pid - $posts_per_page : 1; $next_page = $pid + $posts_per_page < $thread_data['LENGTH'] ? $pid + $posts_per_page : $thread_data['LENGTH']; $last_page = floor($thread_data['LENGTH'] / $posts_per_page) * $posts_per_page + 1; echo "<link rel=\"first\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.1"), "\" />\n"; echo "<link rel=\"last\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$last_page}"), "\" />\n"; if ($pid + $posts_per_page < $thread_data['LENGTH']) { echo "<link rel=\"next\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$next_page}"), "\" />\n"; } if ($pid > 1) { echo "<link rel=\"prev\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&msg={$tid}.{$prev_page}"), "\" />\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } else { echo "<title>", word_filter_add_ob_tags($forum_name, true), "</title>\n"; } } } else { if (isset($title)) { echo "<title>", word_filter_add_ob_tags($title, true), " - ", htmlentities_array($forum_name), "</title>\n"; } else { echo "<title>", htmlentities_array($forum_name), "</title>\n"; } } $forum_content_rating = html_get_forum_content_rating(); echo "<meta name=\"generator\" content=\"Beehive Forum ", BEEHIVE_VERSION, "\" />\n"; echo "<meta name=\"keywords\" content=\"", word_filter_add_ob_tags($meta_keywords, true), "\" />\n"; echo "<meta name=\"description\" content=\"", word_filter_add_ob_tags($meta_description, true), "\" />\n"; echo "<meta name=\"rating\" content=\"{$forum_content_rating}\" />\n"; if (forum_get_setting('allow_search_spidering', 'N') || isset($pid) && $pid > 1) { echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n"; } else { if (isset($robots)) { echo "<meta name=\"robots\" content=\"", htmlentities_array($robots), "\" />\n"; } } printf("<meta name=\"application-name\" content=\"%s\" />\n", htmlentities_array(word_filter_add_ob_tags($forum_name, true))); printf("<meta name=\"msapplication-tooltip\" content=\"%s\" />\n", htmlentities_array(word_filter_add_ob_tags($meta_description, true))); if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Messages'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=discussion.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/unread_thread.ico', true)); if (forum_get_setting('show_links', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Links'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=links.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/link.ico', true)); } } if (forum_get_setting('show_pms', 'Y')) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Inbox'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=pm.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/pm_unread.ico', true)); } if (forum_check_webtag_available($webtag)) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('My Controls'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=user.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/user_controls.ico', true)); } if (session::logged_in() && (session::check_perm(USER_PERM_FORUM_TOOLS, 0) || session::check_perm(USER_PERM_ADMIN_TOOLS, 0) || session::get_folders_by_perm(USER_PERM_FOLDER_MODERATE))) { printf("<meta name=\"msapplication-task\" content=\"name=%s;action-uri=%s;icon-uri=%s\" />\n", gettext('Admin'), htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}&final_uri=admin.php%3Fwebtag%3D{$webtag}")), html_get_style_file('images/msie/admin_tool.ico', true)); } printf("<meta name=\"msapplication-starturl\" content=\"%s\" />\n", htmlentities_array(html_get_forum_file_path("index.php?webtag={$webtag}"))); $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array(gettext('RSS Feed')), htmlentities_array($rss_feed_path)); if (($folders_array = folder_get_available_details()) !== false) { foreach ($folders_array as $folder) { $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&fid={$folder['FID']}"); printf("<link rel=\"alternate\" type=\"application/rss+xml\" title=\"%s - %s - %s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($folder['TITLE']), htmlentities_array(gettext('RSS Feed')), htmlentities_array($rss_feed_path)); } } if (($user_style_path = html_get_user_style_path()) !== false) { printf("<link rel=\"apple-touch-icon\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-57x57.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"72x72\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-72x72.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"114x114\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-114x114.png', $user_style_path)))); printf("<link rel=\"apple-touch-icon\" sizes=\"144x144\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/apple-touch-icon-144x144.png', $user_style_path)))); printf("<link rel=\"shortcut icon\" type=\"image/ico\" href=\"%s\" />\n", htmlentities_array(html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path)))); } $opensearch_path = html_get_forum_uri(sprintf('search.php?webtag=%s&opensearch', $webtag)); printf("<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"%s\" href=\"%s\" />\n", htmlentities_array($forum_name), htmlentities_array($opensearch_path)); if (($style_sheet = html_get_style_file($main_css)) !== false) { echo html_include_css($style_sheet); } if (($emoticon_style_sheet = html_get_emoticon_style_sheet($emoticons)) !== false) { echo html_include_css($emoticon_style_sheet, 'print, screen'); } if (($images_style_sheet = html_get_style_file($images_css)) !== false) { echo html_include_css($images_style_sheet); } if (isset($inline_css)) { echo "<style type=\"text/css\">\n"; echo "<!--\n\n", $inline_css, "\n\n//-->\n"; echo "</style>\n"; } // Font size (not for Guests) if (session::logged_in()) { echo html_include_css(html_get_forum_file_path(sprintf('font_size.php?webtag=%s', $webtag)), 'screen', 'user_font'); } if ($base_target) { echo "<base target=\"", htmlentities_array($base_target), "\" />\n"; } echo html_include_javascript(html_get_forum_file_path('js/jquery.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.placeholder.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.ui.autocomplete.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.parsequery.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.sprintf.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.url.min.js')); echo html_include_javascript(html_get_forum_file_path('js/general.js')); if ($frame_set_html === false) { // Check for any new PMs. if (session::logged_in()) { // Check to see if the PM popup is disabled on the current page. if ($pm_popup_disabled === false) { // Pages we don't want the popup to appear on $pm_popup_disabled_pages = get_pm_popup_disabled_files(); // Check that we're not on one of the pages. if (!in_array(basename($_SERVER['PHP_SELF']), $pm_popup_disabled_pages)) { echo html_include_javascript(html_get_forum_file_path('js/pm.js')); } } // Overflow auto-resize functionality. $resize_images_page = get_image_resize_files(); if (in_array(basename($_SERVER['PHP_SELF']), $resize_images_page)) { if (isset($_SESSION['USE_OVERFLOW_RESIZE']) && $_SESSION['USE_OVERFLOW_RESIZE'] == 'Y') { echo html_include_javascript(html_get_forum_file_path('js/overflow.js')); } } // Mouseover spoiler pages $message_display_pages = get_message_display_files(); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { echo html_include_javascript(html_get_forum_file_path('js/spoiler.js')); } } // Stats Display pages $stats_display_pages = array('messages.php'); if (in_array(basename($_SERVER['PHP_SELF']), $stats_display_pages)) { echo html_include_javascript(html_get_forum_file_path('js/stats.js')); } } foreach ($css as $css_file) { echo html_include_css(html_get_forum_file_path($css_file)); } foreach ($js as $js_file) { echo html_include_javascript(html_get_forum_file_path($js_file)); } echo html_include_javascript(html_get_forum_file_path("json.php?webtag={$webtag}")); if ($frame_set_html === true && ($google_analytics_code = html_get_google_analytics_code())) { echo "<script type=\"text/javascript\">\n\n"; echo " var _gaq = _gaq || [];\n"; echo " _gaq.push(['_setAccount', '{$google_analytics_code}']);\n"; echo " _gaq.push(['_trackPageview']);\n\n"; echo " (function() {\n"; echo " var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n"; echo " ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n"; echo " var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n"; echo " })();\n\n"; echo "</script>\n"; } echo "</head>\n\n"; if ($frame_set_html === false) { $classes = array(basename($_SERVER['PHP_SELF'], '.php')); if ($class) { $classes[] = $class; } printf("<body class=\"%s\">\n", implode(' ', htmlentities_array($classes))); if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) { adsense_output_html(); echo "<br />\n"; } echo '<div id="fb-root"></div>'; } }
} else { $message['CONTENT'] = message_get_content($tid, $message['PID']); } if ($thread_data['POLL_FLAG'] == 'Y') { if ($message['PID'] == 1) { poll_display($tid, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], $show_sigs, false, $highlight_array); $last_pid = $message['PID']; } else { message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, $show_sigs, false, $highlight_array); $last_pid = $message['PID']; } } else { message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], false, $show_sigs, false, $highlight_array); $last_pid = $message['PID']; } if (adsense_check_user() && adsense_check_page($message_number, $posts_per_page, $thread_data['LENGTH'])) { adsense_output_html(); echo "<br />\n"; } } } if ($msg_count > 0 && session::logged_in() && !isset($_GET['markasread'])) { messages_update_read($tid, $last_pid, $thread_data['LAST_READ'], $thread_data['LENGTH'], $thread_data['MODIFIED']); } echo "</div>\n"; echo "<div align=\"center\">\n"; echo "<table width=\"96%\" border=\"0\">\n"; echo " <tr>\n"; if ($thread_data['CLOSED'] == 0 && session::check_perm(USER_PERM_POST_CREATE, $thread_data['FID']) || session::check_perm(USER_PERM_FOLDER_MODERATE, $thread_data['FID'])) { echo " <td width=\"33%\" align=\"left\" style=\"white-space: nowrap\" class=\"postbody\">"; echo " ", html_style_image('reply_all', gettext("Reply to All")), " ";
function light_draw_messages($tid, $pid) { $webtag = get_webtag(); if (!($thread_data = thread_get($tid, session::check_perm(USER_PERM_ADMIN_TOOLS, 0)))) { light_html_display_error_msg(gettext("The requested thread could not be found or access was denied.")); return; } if (!folder_get($thread_data['FID'])) { light_html_display_error_msg(gettext("The requested folder could not be found or access was denied.")); return; } if (!($messages = messages_get($tid, $pid, 10))) { light_html_display_error_msg(gettext("That post does not exist in this thread!")); return; } $msg_count = count($messages); light_messages_top($tid, $pid, $thread_data['TITLE'], $thread_data['INTEREST'], $thread_data['STICKY'], $thread_data['CLOSED'], $thread_data['ADMIN_LOCK'], $thread_data['DELETED'] == 'Y'); if ($tracking_data_array = thread_get_tracking_data($tid)) { foreach ($tracking_data_array as $tracking_data) { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_MERGE) { // Thread merged if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread has moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Threads Merged:</b> This thread was merged from %s"), $thread_link)); } } else { if ($tracking_data['TRACK_TYPE'] == THREAD_TYPE_SPLIT) { // Thread Split if ($tracking_data['TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['NEW_TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread have been moved %s"), $thread_link)); } if ($tracking_data['NEW_TID'] == $tid) { $thread_link = "<a href=\"lmessages.php?webtag={$webtag}&msg=%s.1\" target=\"_self\">%s</a>"; $thread_link = sprintf($thread_link, $tracking_data['TID'], gettext("here")); light_html_display_warning_msg(sprintf(gettext("<b>Thread Split:</b> Some posts in this thread were moved from %s"), $thread_link)); } } } } } if ($msg_count > 0) { foreach ($messages as $message_number => $message) { if (isset($message['RELATIONSHIP'])) { if ($message['RELATIONSHIP'] >= 0) { // if we're not ignoring this user $message['CONTENT'] = message_get_content($tid, $message['PID']); } else { $message['CONTENT'] = gettext("Ignored"); // must be set to something or will show as deleted } } else { $message['CONTENT'] = message_get_content($tid, $message['PID']); } if ($thread_data['POLL_FLAG'] == 'Y') { if ($message['PID'] == 1) { light_poll_display($tid, $thread_data['LENGTH'], $thread_data['FID'], true, $thread_data['CLOSED'], false, false); $last_pid = $message['PID']; } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, true, false); $last_pid = $message['PID']; } } else { light_message_display($tid, $message, $thread_data['LENGTH'], $pid, $thread_data['FID'], true, $thread_data['CLOSED'], true, false, false); $last_pid = $message['PID']; } if (adsense_check_user() && adsense_check_page($message_number, 10, $thread_data['LENGTH'])) { adsense_output_html(); } } } unset($messages, $message); echo "<div class=\"message_page_footer\">\n"; echo "<ul>\n"; if ($thread_data['CLOSED'] == 0 && session::check_perm(USER_PERM_POST_CREATE, $thread_data['FID']) || session::check_perm(USER_PERM_FOLDER_MODERATE, $thread_data['FID'])) { echo "<li><a href=\"lpost.php?webtag={$webtag}&replyto={$tid}.0\" class=\"reply_all\">", gettext("Reply to All"), "</a></li>\n"; } if ($last_pid < $thread_data['LENGTH']) { $npid = $last_pid + 1; echo "<li class=\"right_col\">", light_form_quick_button("lmessages.php", gettext("Keep reading…"), array('msg' => "{$tid}.{$npid}")), "</li>\n"; } echo "</ul>\n"; echo "</div>\n"; echo "<a href=\"lthread_list.php?webtag={$webtag}\" class=\"thread_list_link\">", gettext("Back to thread list"), "</a>"; light_messages_nav_strip($tid, $pid, $thread_data['LENGTH'], 10); if ($msg_count > 0 && session::logged_in()) { messages_update_read($tid, $last_pid, $thread_data['LAST_READ'], $thread_data['LENGTH'], $thread_data['MODIFIED']); } }