Пример #1
0
function atomic_get_board($checkpost = false)
{
    global $currentuser, $atomic_board, $atomic_brdarr, $atomic_brdnum, $atomic_ftype, $dir_modes;
    if (isset($_GET["board"])) {
        $atomic_board = $_GET["board"];
    } else {
        atomic_error("错误的讨论区");
    }
    $brdarr = array();
    $atomic_brdnum = bbs_getboard($atomic_board, $brdarr);
    $atomic_brdarr = $brdarr;
    if ($atomic_brdnum == 0) {
        $boards = array();
        if (bbs_searchboard($atomic_board, 0, $boards)) {
            if (sizeof($boards) == 1) {
                cache_header("nocache");
                header("Location: atomic.php?act=board&board=" . urlencode($boards[0]['NAME']));
                exit;
            }
            if (sizeof($boards) > 1) {
                atomic_header();
                $html = "多个匹配的讨论区: ";
                foreach ($boards as $board) {
                    if (!$board['NAME']) {
                        continue;
                    }
                    $html .= '<a href="?act=board&board=' . $board['NAME'] . '">' . $board['NAME'] . '</a> ';
                }
                echo $html;
                atomic_footer();
                exit;
            }
        }
        atomic_error("错误的讨论区");
    }
    $atomic_board = $atomic_brdarr["NAME"];
    $usernum = $currentuser["index"];
    if (bbs_checkreadperm($usernum, $atomic_brdnum) == 0) {
        atomic_error("错误的讨论区");
    }
    if ($atomic_brdarr["FLAG"] & BBS_BOARD_GROUP) {
        atomic_error("不支持版面组");
    }
    bbs_set_onboard($atomic_brdnum, 1);
    if ($checkpost) {
        if (bbs_checkpostperm($usernum, $atomic_brdnum) == 0) {
            atomic_error("错误的讨论区或者您无权在此讨论区发表文章");
        }
        if (bbs_is_readonly_board($atomic_brdarr)) {
            atomic_error("不能在只读讨论区发表文章");
        }
    }
    if (isset($_GET["ftype"])) {
        $atomic_ftype = @intval($_GET["ftype"]);
        switch ($atomic_ftype) {
            case $dir_modes["DIGEST"]:
            case $dir_modes["MARK"]:
            case $dir_modes["NORMAL"]:
                break;
            default:
                atomic_error("错误的模式");
        }
    } else {
        $atomic_ftype = $dir_modes["NORMAL"];
    }
}
Пример #2
0
<?php

require 'www2-funcs.php';
login_init();
bbs_session_modify_user_mode(BBS_MODE_SELECT);
if (isset($_GET['board'])) {
    $keyword = trim(ltrim($_GET['board']));
} elseif (isset($_POST['board'])) {
    $keyword = trim(ltrim($_POST['board']));
} else {
    $keyword = "";
}
$exact = !isset($_GET['exact']) && !isset($_POST['exact']) ? 0 : 1;
$boards = array();
if ($keyword) {
    if (bbs_searchboard(trim($keyword), $exact, $boards)) {
        if (sizeof($boards) == 1) {
            cache_header("nocache");
            header("Location: bbsdoc.php?board=" . urlencode($boards[0]['NAME']));
            exit;
        } else {
            if (sizeof($boards) == 0) {
                $boards = false;
            }
        }
    } else {
        $boards = false;
    }
}
page_header("搜索讨论区");
if ($boards) {
Пример #3
0
 /**
  * function search match with board name
  *
  * @param $name
  * @return array
  * @static
  * @access public
  */
 public static function search($name)
 {
     $boards = array();
     if (!bbs_searchboard(trim($name), 0, $boards)) {
         return array();
     }
     $ret = array();
     foreach ($boards as $v) {
         try {
             $ret[] = Board::getInstance($v['NAME']);
         } catch (BoardNullException $e) {
         }
     }
     return $ret;
 }