Exemple #1
0
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}&amp;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}&amp;msg={$tid}.1"), "\" />\n";
                echo "<link rel=\"last\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;msg={$tid}.{$next_page}"), "\" />\n";
                }
                if ($pid > 1) {
                    echo "<link rel=\"prev\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;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";
}
Exemple #2
0
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}&amp;msg={$tid}.1"), "\" />\n";
            echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n";
            echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$next_page}"), "\" />\n";
            echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;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}&amp;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&amp;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 light_html_draw_top()
{
    static $called = false;
    if ($called) {
        return;
    }
    $called = true;
    $arg_array = func_get_args();
    $title = null;
    $robots = null;
    $webtag = get_webtag();
    $link_array = array();
    $func_matches = array();
    $forum_name = forum_get_setting('forum_name', null, 'A Beehive Forum');
    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('/^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('/^link=([^:]+):(.+)$/Disu', $func_args, $func_matches) > 0) {
            $link_array[] = array('rel' => $func_matches[1], 'href' => $func_matches[2]);
            unset($arg_array[$key]);
        }
    }
    // Default Meta keywords and description.
    $meta_keywords = html_get_forum_keywords();
    $meta_description = html_get_forum_description();
    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\" lang=\"en\" dir=\"", gettext("ltr"), "\">\n";
    echo "<head>\n";
    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}&amp;msg={$tid}.1"), "\" />\n";
            echo "<link rel=\"previous\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$thread_data['LENGTH']}"), "\" />\n";
            echo "<link rel=\"next\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;msg={$tid}.{$next_page}"), "\" />\n";
            echo "<link rel=\"last\" href=\"", html_get_forum_file_path("index.php?webtag={$webtag}&amp;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";
        }
    }
    echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n";
    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=\"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')) {
        echo "<meta name=\"robots\" content=\"noindex,nofollow\" />\n";
    } else {
        if (isset($robots)) {
            echo "<meta name=\"robots\" content=\"{$robots}\" />\n";
        }
    }
    if ($stylesheet = html_get_style_sheet('mobile.css')) {
        echo "<link rel=\"stylesheet\" href=\"{$stylesheet}\" type=\"text/css\" media=\"screen\" />\n";
    }
    if ($emoticon_stylesheet = html_get_emoticon_style_sheet(true)) {
        echo "<link rel=\"stylesheet\" href=\"{$emoticon_stylesheet}\" type=\"text/css\" media=\"screen\" />\n";
    }
    $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()) {
        foreach ($folders_array as $folder) {
            $rss_feed_path = html_get_forum_file_path("threads_rss.php?webtag={$webtag}&amp;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()) {
        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)));
    }
    echo "<script type=\"text/javascript\" src=\"js/jquery-1.7.1.min.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"js/jquery.sprintf.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"js/general.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"js/light.js\"></script>\n";
    $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)) {
        if (session::get_value('USE_MOVER_SPOILER') == "Y") {
            echo "<script type=\"text/javascript\" src=\"js/spoiler.js\"></script>\n";
        }
    }
    echo "<script type=\"text/javascript\" src=\"ckeditor/ckeditor.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"ckeditor/adapters/jquery.js\"></script>\n";
    echo "<script type=\"text/javascript\" src=\"json.php?webtag={$webtag}\"></script>\n";
    echo "</head>\n";
    echo "<body id=\"mobile\">\n";
    echo "<a name=\"top\"></a>\n";
    echo "<div id=\"header\">\n";
    echo "  <img src=\"", html_style_image('mobile_logo.png'), "\" alt=\"", gettext("Beehive Forum Logo"), "\" />\n";
    echo "  <div id=\"nav\">", gettext("Menu"), "</div>\n";
    echo "</div>\n";
    echo "<div id=\"menu\">\n";
    echo "  <ul>\n";
    if (forums_get_available_count() > 1 || !forum_check_webtag_available($webtag)) {
        echo "    <li class=\"menu_item\"><a href=\"lforums.php?webtag={$webtag}\">", gettext("My Forums"), "</a></li>\n";
    }
    echo "    <li class=\"menu_item\"><a href=\"lthread_list.php?webtag={$webtag}\">", gettext("Messages"), "</a></li>\n";
    echo "    <li class=\"menu_item\"><a href=\"lpm.php?webtag={$webtag}\">", gettext("Inbox"), "</a></li>\n";
    if (!session::logged_in()) {
        echo "    <li class=\"menu_item\"><a href=\"llogon.php?webtag={$webtag}\">", gettext("Login"), "</a></li>\n";
    } else {
        echo "    <li class=\"menu_item\"><a href=\"llogout.php?webtag={$webtag}\">", gettext("Logout"), "</a></li>\n";
    }
    echo "  </ul>\n";
    echo "</div>\n";
    echo "<div id=\"content\">\n";
    light_pm_check_messages();
    if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) {
        adsense_output_html();
    }
}
Exemple #4
0
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}&amp;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}&amp;msg={$tid}.1"), "\" />\n";
                echo "<link rel=\"last\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;msg={$tid}.{$next_page}"), "\" />\n";
                }
                if ($pid > 1) {
                    echo "<link rel=\"prev\" href=\"", html_get_forum_uri("index.php?webtag={$webtag}&amp;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}&amp;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>';
    }
}
function search_output_opensearch_xml()
{
    $webtag = get_webtag();
    forum_check_webtag_available($webtag);
    $forum_title = forum_get_setting('forum_name', null, 'A Beehive Forum');
    $forum_description = html_get_forum_description();
    $forum_opensearch_uri = html_get_forum_uri("search.php?webtag={$webtag}&search_string={searchTerms}");
    header('Content-type: text/xml; charset=UTF-8', true);
    echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n";
    echo "<OpenSearchDescription xmlns=\"http://a9.com/-/spec/opensearch/1.1/\" xmlns:moz=\"http://www.mozilla.org/2006/browser/search/\">\n";
    echo "    <ShortName>", htmlentities_array($forum_title), "</ShortName>\n";
    echo "    <Description>", htmlentities_array($forum_description), "</Description>\n";
    echo "    <InputEncoding>UTF-8</InputEncoding>\n";
    if (($user_style_path = html_get_user_style_path()) !== false) {
        printf("    <Image height=\"16\" width=\"16\" type=\"image/x-icon\">%s</Image>\n", html_get_forum_uri(sprintf('styles/%s/images/favicon.ico', $user_style_path)));
    }
    echo "    <Url type=\"text/html\" method=\"get\" template=\"", htmlentities_array($forum_opensearch_uri), "\"></Url>\n";
    echo "</OpenSearchDescription>\n";
    exit;
}