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(); }
html_error_quit('精华区目录不存在'); break; case -2: html_error_quit('无法加载目录文件'); break; case -3: $show_none = 1; break; case -9: html_error_quit('系统错误'); break; default: } $path = $path_tmp; $isBoard = false; $up_cnt = bbs_ann_updirs($path, $board, $up_dirs); $title = bbs_ann_get_title($path); if ($board) { $brdarr = array(); $bid = bbs_getboard($board, $brdarr); if ($bid) { $board = $brdarr['NAME']; $usernum = $currentuser['index']; if (bbs_checkreadperm($usernum, $bid) == 0) { html_error_quit('不存在该目录'); } bbs_set_onboard($bid, 1); if (bbs_normalboard($board)) { $dotnames = BBS_HOME . '/' . $path . '/.Names'; if (cache_header('public', filemtime($dotnames), 300)) { return;
html_error_quit("╢МнС╣дндуб"); } if ($path[0] == '/') { $filename = "0Announce" . $path; } else { $filename = "0Announce/" . $path; } if (bbs_ann_traverse_check($filename, $currentuser["userid"]) < 0) { html_error_quit("╢МнС╣дд©б╪"); } if (!file_exists($filename)) { html_error_quit("╢МнС╣дндуб╨е..."); } $board = ''; $up_dirs = array(); $up_cnt = bbs_ann_updirs($filename, $board, $up_dirs); if ($board) { $brdarr = array(); $bid = bbs_getboard($board, $brdarr); if ($bid) { $board = $brdarr['NAME']; $usernum = $currentuser['index']; if (bbs_checkreadperm($usernum, $bid) == 0) { html_error_quit('╡╩╢Фтз╦цд©б╪'); } bbs_set_onboard($bid, 1); if (bbs_normalboard($board)) { if (cache_header('public', filemtime($filename), 300)) { return; } }