function bbs_userfile_getrootfid($uid) { $query = 'SELECT fid FROM userfiles WHERE uid = ' . intval($uid) . ' AND type = 1 AND pid = 0 LIMIT 1;'; $result = mysql_query($query); if ($rows = mysql_fetch_array($result)) { mysql_free_result($result); return $rows[fid]; } if (!UserFile::add_file('', 1, '', '', 0, '', 0, $uid)) { return false; } return bbs_userfile_getrootfid($uid); }
html_nologin(); } elseif (!strcmp($currentuser["userid"], "guest")) { html_init("gb2312"); html_error_quit("guest 没有Blog!"); } else { $link = pc_db_connect(); $pc = pc_load_infor($link, $_GET["userid"]); if (!$pc) { pc_db_close($link); html_error_quit("对不起,您要查看的Blog不存在"); } if (!pc_is_admin($currentuser, $pc)) { pc_db_close($link); html_error_quit("对不起,您要查看的Blog不存在"); } $root_pid = bbs_userfile_getrootfid($pc["UID"]); $pid = intval($_GET['pid']) ? $_GET['pid'] : $root_pid; pc_get_userfiles($link, $pc, $used, $total); if (!($c_dir = new UserFile($pid, $pc["UID"]))) { pc_db_close($link); html_error_quit("对不起,您要查看的目录不存在"); } if ($_GET['act'] == 'edit' || $_GET['act'] == 'edit2' || $_GET['act'] == 'rm' || $_GET['act'] == 'cp' || $_GET['act'] == 'mv' || $_GET['act'] == 'pt') { $fid = intval($_GET['fid']); if (!$fid) { html_error_quit("错误的参数"); } if (!($f = new UserFile($fid, $pc['UID']))) { html_error_quit("文件/目录不存在"); } }