Esempio n. 1
0
function light_navigation_bar(array $options = array())
{
    $nav_links = array();
    $back = null;
    $webtag = get_webtag();
    forum_check_webtag_available($webtag);
    $available_back_button_files = implode("|^", array_map('preg_quote_callback', get_light_back_button_files()));
    foreach ($options as $key => $value) {
        switch ($key) {
            case 'nav_links':
                if (!is_array($value) || count(array_filter($value, 'light_validate_nav_link')) != count($value)) {
                    throw new InvalidArgumentException(sprintf('Expecting light_navigation_bar argument %s to be an array of arrays, each with class, url, text and image keys', $key));
                }
                ${$key} = $value;
                break;
            case 'back':
                if (preg_match("/^{$available_back_button_files}/u", basename($back))) {
                    throw new InvalidArgumentException('Expecting light_navigation_bar argument back to be in permitted light back button files');
                }
                $back = !isset($back) && isset($value) ? $value : $back;
                break;
            default:
                throw new InvalidArgumentException(sprintf('Unknown light_navigation_bar argument "%s"', $key));
                break;
        }
    }
    echo "<div id=\"header\">\n";
    echo "  <span class=\"left\">\n";
    if (isset($back)) {
        echo "    <span class=\"back\"><a href=\"{$back}\">", html_style_image('mobile_back', gettext("Back")), "</a></span>\n";
    } else {
        echo "    <span class=\"icon\">", html_style_image('mobile_icon', gettext("Beehive Forum")), "</span>\n";
    }
    echo "    ", html_style_image('mobile_logo', gettext("Beehive Forum Logo")), "\n";
    echo "  </span>\n";
    echo "  <ul>\n";
    foreach ($nav_links as $nav_link) {
        echo "    <li>\n";
        echo "      <a class=\"{$nav_link['class']}\" href=\"", htmlentities_array($nav_link['url']), "\">\n";
        echo "        ", html_style_image($nav_link['image']), "<span class=\"text\">", $nav_link['text'], "</span>\n";
        echo "      </a>\n";
        echo "    </li>\n";
    }
    echo "    <li>\n";
    echo "      <a class=\"main\" href=\"#\">", html_style_image('mobile_menu', gettext("Menu"));
    $pm_unread_count = pm_get_unread_count();
    if ($pm_unread_count > 0) {
        echo "        <span class=\"mobile_notification\">", max(min($pm_unread_count, 99), 0), "</span>";
    }
    echo "      </a>";
    echo "    </li>\n";
    echo "  </ul>\n";
    echo "</div>\n";
    echo "<div class=\"menu main\">\n";
    echo "  <ul>\n";
    if (forums_get_available_count() > 1 || !forum_get_default()) {
        echo "    <li><a href=\"lforums.php?webtag={$webtag}\">", gettext("My Forums"), "</a></li>\n";
    }
    if (forum_check_webtag_available($webtag, false)) {
        echo "    <li><a href=\"lthread_list.php?webtag={$webtag}\">", gettext("Messages"), "</a></li>\n";
    }
    if ($pm_unread_count > 0) {
        echo "    <li><a href=\"lpm.php?webtag={$webtag}\">", gettext("Inbox"), "<span class=\"mobile_notification\">", max(min($pm_unread_count, 99), 0), "</span></a></li>";
    } else {
        echo "    <li><a href=\"lpm.php?webtag={$webtag}\">", gettext("Inbox"), "</a></li>\n";
    }
    if (forum_check_webtag_available($webtag, false)) {
        echo "    <li><a href=\"lsearch.php?webtag={$webtag}\">", gettext("Search"), "</a></li>\n";
    }
    if (!session::logged_in()) {
        echo "    <li><a href=\"llogon.php?webtag={$webtag}\">", gettext("Login"), "</a></li>\n";
    } else {
        echo "    <li><a href=\"llogout.php?webtag={$webtag}\">", gettext("Logout"), "</a></li>\n";
    }
    echo "  </ul>\n";
    echo "</div>\n";
    foreach ($nav_links as $nav_link) {
        if (isset($nav_link['html'])) {
            echo "    <div class=\"menu {$nav_link['class']}\">{$nav_link['html']}</div>\n";
        }
    }
    echo "<div id=\"page_content\">\n";
    light_pm_check_messages();
    if (html_output_adsense_settings() && adsense_check_user() && adsense_check_page()) {
        adsense_output_html();
    }
}
Esempio n. 2
0
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();
    }
}