function light_html_draw_top(array $options = array()) { $title = null; $robots = null; $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 'robots': ${$key} = !isset(${$key}) && isset($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 light_html_draw_top argument %s to be an array of strings', $key)); } ${$key} = $value; break; default: throw new InvalidArgumentException(sprintf('Unknown light_html_draw_top argument "%s"', $key)); break; } } 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=\"", 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"; echo "<meta name=\"MobileOptimized\" content=\"0\" />\n"; echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\" />\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"; } } if (($stylesheet = html_get_style_file('mobile.css')) !== false) { echo html_include_css($stylesheet); } if (($emoticon_stylesheet = html_get_emoticon_style_sheet(true)) !== false) { echo html_include_css($emoticon_stylesheet, 'print, screen'); } if (($stylesheet = html_get_style_file('images.css')) !== false) { echo html_include_css($stylesheet); } $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")), $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")), $rss_feed_path); } } if (($user_style_path = html_get_user_style_path()) !== false) { 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=\"apple-touch-icon\" sizes=\"144x144\" href=\"%s\" />\n", 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", html_get_forum_file_path(sprintf('styles/%s/images/favicon.ico', $user_style_path))); } echo html_include_javascript(html_get_forum_file_path('js/jquery.min.js')); echo html_include_javascript(html_get_forum_file_path('js/jquery.mobile.zoom.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.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')); echo html_include_javascript(html_get_forum_file_path('js/light.js')); $message_display_pages = get_message_display_files(); if (in_array(basename($_SERVER['PHP_SELF']), $message_display_pages)) { if (isset($_SESSION['USE_MOVER_SPOILER']) && $_SESSION['USE_MOVER_SPOILER'] == 'Y') { echo html_include_javascript(html_get_forum_file_path('js/spoiler.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}")); echo "</head>\n"; echo "<body id=\"mobile\">\n"; if (forum_get_setting('show_share_links', 'Y') && isset($_SESSION['SHOW_SHARE_LINKS']) && $_SESSION['SHOW_SHARE_LINKS'] == 'Y') { echo '<div id="fb-root"></div>'; } echo "<a name=\"top\"></a>\n"; }
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>'; } }