public function path() { $this->js[] = "forum.board.js"; $this->js[] = "forum.elite.js"; $this->css[] = "board.css"; $path = $boardName = $path_tmp = ""; $articles = array(); if (isset($this->params['url']['v'])) { $path = trim($this->params['url']['v']); } $u = User::getInstance(); $ret = bbs_read_ann_dir($path, $boardName, $path_tmp, $articles); switch ($ret) { case -1: if (!$this->ByrSession->isLogin) { $this->requestLogin(); } $this->error(ECode::$ELITE_NODIR); case -2: $this->error(ECode::$ELITE_DIRERROR); case -3: //on article break; case -9: //SYS_ERROR $this->error(); default: } $path = $path_tmp; $parent = ''; $up_dirs = array(); $up_cnt = $this->_getUpdir($path, $boardName, $up_dirs); $start = 0; if ($up_cnt >= 2) { $parent = $up_dirs[$up_cnt - 2]; } elseif ($up_cnt == 1) { $this->set("parent", ""); $start = 1; } if ($boardName) { try { $brd = Board::getInstance($boardName); } catch (BoardNullException $e) { $this->error(ECode::$ELITE_NODIR); } if (!$brd->hasReadPerm($u)) { if (!$this->ByrSession->isLogin) { $this->requestLogin(); } $this->error(ECode::$ELITE_NODIR); } $brd->setOnBoard(); if ($brd->isNormal()) { $this->cache(true, @filemtime($path)); } $secs = Configure::read("section"); $this->notice[] = array("url" => "/section/{$brd->SECNUM}", "text" => $secs[$brd->SECNUM][0]); $this->notice[] = array("url" => "/board/{$brd->NAME}", "text" => $brd->DESC); } if (count($articles) == 0) { $info = false; } else { App::import('Sanitize'); foreach ($articles as $v) { $info[] = array("dir" => $v['FLAG'] == 1 ? "path" : "file", "title" => Sanitize::html($v['TITLE']), "path" => urlencode($v['PATH']), "bm" => $v['BM'], "time" => date("Y-m-d", $v['TIME'])); } } if ($parent != "") { $this->set("parent", urlencode($parent)); $start = 1; } $this->set("start", $start); $this->set("info", $info); $this->notice[] = array("url" => "", "text" => "精华区列表"); }
} $path = substr($path, 10, strlen($path) - 9); } else { if (isset($_GET['path'])) { $path = trim($_GET['path']); } else { $path = ""; } } if (strstr($path, '.Names') || strstr($path, '..') || strstr($path, 'SYSHome')) { html_error_quit('不存在该目录'); } $board = ''; $articles = array(); $path_tmp = ''; $ret = bbs_read_ann_dir($path, $board, $path_tmp, $articles); $show_none = 0; switch ($ret) { case -1: html_error_quit('精华区目录不存在'); break; case -2: html_error_quit('无法加载目录文件'); break; case -3: $show_none = 1; break; case -9: html_error_quit('系统错误'); break; default:
function atomic_ann() { global $currentuser; $file = false; $path = @trim($_GET['path']); if (isset($_GET['file'])) { $path = trim($_GET['file']); if ($path[0] == '/') { $path = "0Announce" . $path; } else { $path = "0Announce/" . $path; } $file = $path; $modfile = $file; } else { if ($path[0] == '/') { $path1 = "0Announce" . $path; } else { $path1 = "0Announce/" . $path; } $modfile = $path1 . "/.Names"; } if (strstr($path, '.Names') || strstr($path, '..') || strstr($path, 'SYSHome')) { atomic_error('不存在该目录'); } $boardName = ''; $articles = array(); $path_tmp = ''; if ($file === false) { $ret = bbs_read_ann_dir($path, $boardName, $path_tmp, $articles); switch ($ret) { case -1: atomic_error('精华区目录不存在'); case -2: atomic_error('无法加载目录文件'); case -3: break; case -9: atomic_error('系统错误'); default: } $path = $path_tmp; } else { if (bbs_ann_traverse_check($path, $currentuser["userid"]) < 0) { atomic_error("错误的目录"); } } $parent = ''; $up_dirs = array(); $up_cnt = bbs_ann_updirs($path, $boardName, $up_dirs); $cacheit = true; if ($up_cnt >= 2) { $parent = $up_dirs[$up_cnt - 2]; } if ($boardName) { $brdArr = array(); $boardID = bbs_getboard($boardName, $brdArr); $boardArr = $brdArr; if ($boardID) { $boardName = $boardArr['NAME']; $usernum = $currentuser['index']; if (bbs_checkreadperm($usernum, $boardID) == 0) { foundErr('不存在该目录'); } bbs_set_onboard($boardID, 1); if (!bbs_normalboard($boardName)) { $cacheit = false; } } else { $boardName = ''; } } else { $boardID = 0; } if ($cacheit) { if (cache_header('public', @filemtime($modfile), 300)) { return; } } atomic_header(); $html = "<p>"; if ($boardID) { $html .= "<a href='?act=board&board=" . $boardName . "'>回 " . $boardName . " 版面</a> "; } if ($parent) { $html .= "<a href='?act=ann&path=" . $parent . "'>回上级目录</a> "; } $html .= "<a href='?'>回首页</a></p>"; if ($file !== false) { echo $html; echo bbs2_readfile_text($file, MAXCHAR, 2); } else { $html .= "<pre> 编号 [类别] 标 题 整 理 编辑日期\n"; if (count($articles) >= 0) { $i = 1; foreach ($articles as $article) { switch ($article['FLAG']) { case 0: continue 2; case 1: $alt = '目录'; $url = '?act=ann&path=' . urlencode($article['PATH']); break; case 2: case 3: default: $alt = '文件'; $url = '?act=ann&file=' . urlencode($article['PATH']); } $html .= sprintf("%5d ", $i) . "[" . $alt . "]"; $html .= $article['FLAG'] == 3 ? "@" : " "; $title = sprintf("%-37.37s", trim($article['TITLE'])); $html .= '<a href="' . $url . '">' . htmlspecialchars($title) . ' </a>'; $bm = explode(' ', trim($article['BM'])); $html .= sprintf(" %-12.12s ", $bm[0]); $html .= date('Y-m-d', $article['TIME']) . "\n"; $i++; } } $html .= "</pre>"; echo $html; } atomic_footer(); }