Example #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();
    }
}
Example #2
0
                    } else {
                        if ($_REQUEST['mark_read_type'] == THREAD_MARK_READ_FOLDER && (isset($folder) && is_numeric($folder))) {
                            if (threads_mark_folder_read($folder)) {
                                header_redirect("lthread_list.php?webtag={$webtag}&mode={$mode}&folder={$folder}&mark_read_success=true");
                                exit;
                            } else {
                                $error_msg_array[] = gettext("Failed to mark selected threads as read");
                                $valid = false;
                            }
                        }
                    }
                }
            }
        } else {
            unset($_REQUEST['mark_read_submit'], $_REQUEST['mark_read_confirm']);
            light_html_draw_top();
            light_navigation_bar();
            light_html_display_msg(gettext("Confirm"), gettext("Are you sure you want to mark the selected threads as read?"), 'lthread_list.php', 'post', array('mark_read_submit' => gettext("Confirm"), 'cancel' => gettext("Cancel")), array_merge($_REQUEST, array('mark_read_confirm' => 'Y')));
            light_html_draw_bottom();
            exit;
        }
    }
}
light_html_draw_top(array('js' => array('js/thread_list.js')));
if (forums_get_available_count() > 1 || !forum_get_default()) {
    light_navigation_bar(array('back' => "lforums.php?webtag={$webtag}", 'nav_links' => array(array('text' => gettext('New Discussion'), 'url' => "lpost.php?webtag={$webtag}", 'class' => 'post_new', 'image' => 'mobile_post'))));
} else {
    light_navigation_bar(array('nav_links' => array(array('text' => gettext('New Discussion'), 'url' => "lpost.php?webtag={$webtag}", 'class' => 'post_new', 'image' => 'mobile_post'))));
}
light_draw_thread_list($mode, $folder, $page);
light_html_draw_bottom();