示例#1
0
//                                                                            //
//   You should have received a copy of the Phorum License                    //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////
if (!defined("PHORUM")) {
    return;
}
$forums = phorum_db_get_forums(0, $parent_id);
$PHORUM["DATA"]["FORUMS"] = array();
$forums_shown = false;
$new_checks = array();
if ($PHORUM["DATA"]["LOGGEDIN"] && !empty($forums)) {
    if ($PHORUM["show_new_on_index"] == 2) {
        $new_checks = phorum_db_newflag_check(array_keys($forums));
    } elseif ($PHORUM["show_new_on_index"] == 1) {
        $new_counts = phorum_db_newflag_count(array_keys($forums));
    }
}
foreach ($forums as $forum) {
    if ($forum["folder_flag"]) {
        $forum["URL"]["LIST"] = phorum_get_url(PHORUM_INDEX_URL, $forum["forum_id"]);
    } else {
        if ($PHORUM["hide_forums"] && !phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, $forum["forum_id"])) {
            continue;
        }
        $forum["url"] = phorum_get_url(PHORUM_LIST_URL, $forum["forum_id"]);
        // if there is only one forum in Phorum, redirect to it.
        if ($parent_id == 0 && count($forums) < 2) {
            phorum_redirect_by_url($forum['url']);
            exit;
        }
示例#2
0
        }
        foreach ($sub_forums as $sub_forum) {
            if (!$sub_forum["folder_flag"] || $sub_forum["folder_flag"] && $sub_forum["parent_id"] != $PHORUM['vroot']) {
                $folder_forums[$sub_forum["parent_id"]][] = $sub_forum;
                if ($PHORUM["show_new_on_index"] != 0 && $sub_forum["folder_flag"] == 0) {
                    $forums_to_check[] = $sub_forum["forum_id"];
                }
            }
        }
    }
}
if ($PHORUM["DATA"]["LOGGEDIN"] && !empty($forums_to_check)) {
    if ($PHORUM["show_new_on_index"] == 2) {
        $new_checks = phorum_db_newflag_check($forums_to_check);
    } elseif ($PHORUM["show_new_on_index"] == 1) {
        $new_counts = phorum_db_newflag_count($forums_to_check);
    }
}
foreach ($folders as $folder_key => $folder_id) {
    if (!isset($folder_forums[$folder_id])) {
        continue;
    }
    $shown_sub_forums = array();
    foreach ($folder_forums[$folder_id] as $key => $forum) {
        if ($forum["folder_flag"]) {
            $forum["URL"]["INDEX"] = phorum_get_url(PHORUM_INDEX_URL, $forum["forum_id"]);
        } else {
            if ($PHORUM["hide_forums"] && !phorum_api_user_check_access(PHORUM_USER_ALLOW_READ, $forum["forum_id"])) {
                unset($folder_forums[$folder_id][$key]);
                continue;
            }