public function board() { App::import('vendor', 'model/board'); $b = isset($this->params['url']['board']) ? $this->params['url']['board'] : ""; $boards = Board::search(trim($b)); $wrapper = Wrapper::getInstance(); $data = array(); $data['board'] = $data['section'] = array(); foreach ($boards as $brd) { if ($brd->isDir()) { $data['section'][] = $brd->NAME; } else { $data['board'][] = $wrapper->board($brd, array('status' => true)); } } $this->set('data', $data); }
public function searchBoard() { $bName = ""; if (isset($this->params['url']['name'])) { $bName = trim($this->params['url']['name']); } $bName = nforum_iconv($this->encoding, $this->appEncoding, $bName); $boards = Board::search($bName); if (count($boards) == 1) { $this->redirect($this->_mbase . "/board/" . $boards[0]->NAME); } else { $ret = false; foreach ($boards as $b) { $ret[] = array("name" => $b->DESC, "desc" => $b->NAME, "url" => ($b->isDir() ? "/section/" : "/board/") . $b->NAME, "dir" => $b->isDir()); } $this->set("boards", $ret); $this->set("parent", false); $this->autoRender = false; $this->render("index", "/section/"); } }
public function board() { $this->css[] = "board.css"; $this->js[] = "forum.board.js"; $this->notice[] = array("url" => "", "text" => "ËÑË÷½á¹û"); App::import('Sanitize'); $b = isset($this->params['url']['b']) ? $this->params['url']['b'] : ""; $ret = false; $b = trim(rawurldecode($b)); $b = nforum_iconv('utf-8', $this->encoding, $b); $boards = Board::search($b); if (count($boards) == 1) { $this->redirect("/board/" . $boards[0]->NAME); } foreach ($boards as $brd) { $threads = $brd->getTypeArticles(0, 1, Board::$ORIGIN); if (!empty($threads)) { $threads = $threads[0]; $last = array("id" => $threads->ID, "title" => Sanitize::html($threads->TITLE), "owner" => $threads->isSubject() ? $threads->OWNER : "ÔÌûÒÑɾ³ý", "date" => date("Y-m-d H:i:s", $threads->POSTTIME)); } else { $last["id"] = ""; $last["title"] = $last["owner"] = $last["date"] = "ÎÞ"; } $bms = split(" ", $brd->BM); foreach ($bms as &$bm) { if (preg_match("/[^0-9a-zA-Z]/", $bm)) { $bm = array($bm, false); } else { $bm = array($bm, true); } } $ret[] = array("name" => $brd->NAME, "desc" => $brd->DESC, "type" => $brd->isDir() ? "section" : "board", "bms" => $bms, "curNum" => $brd->CURRENTUSERS, "todayNum" => $brd->getTodayNum(), "threadsNum" => $brd->getThreadsNum(), "articleNum" => $brd->ARTCNT, "last" => $last); } $this->set("sec", $ret); $this->set("noBrd", ECode::msg(ECode::$SEC_NOBOARD)); $this->render("index", "section/"); }