protected override void ShowPage() { pagetitle = "搜索"; GetSearchType(); //判断当前操作是否是用户打开的页面 if (searchsubmit == 0 && !ispost) { //用户权限校验 if (!UserAuthority.Search(usergroupinfo, ref msg)) { AddErrLine(msg); return; } //读取分表信息 if (searchid <= 0) { tablelist = Posts.GetAllPostTableName(); } else { if (searchType == SearchType.Error) { AddErrLine("非法的参数信息"); return; } switch (searchType) { case SearchType.SpacePostTitle: spacepostlist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType); break; case SearchType.AlbumTitle: albumlist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType); break; case SearchType.ByPoster: topiclist = Searches.GetSearchCacheList(posttableid, searchid, 16, topicpageid, out topiccount, SearchType.TopicTitle); topicpageid = CalculateCurrentPage(topiccount, topicpageid, out topicpagecount); topicpagenumbers = topicpagecount > 1 ? Utils.GetPageNumbers(topicpageid, topicpagecount, "search.aspx?type=" + type + "&searchid=" + searchid.ToString() + "&keyword=" + keyword + "&poster=" + poster, 8, "topicpage", "#1") : ""; return; case SearchType.PostContent: default: topiclist = Searches.GetSearchCacheList(posttableid, searchid, 16, pageid, out topiccount, searchType); break; } if (topiccount == 0) { AddErrLine("不存在的searchid"); return; } CalculateCurrentPage(); //得到页码链接 pagenumbers = pagecount > 1 ? Utils.GetPageNumbers(pageid, pagecount, "search.aspx?type=" + type + "&searchid=" + searchid.ToString() + "&keyword=" + keyword + "&poster=" + poster, 8) : ""; } } else { //检查用户的搜索权限,包括搜索时间间隔的限制 if (!UserAuthority.Search(userid, lastsearchtime, useradminid, usergroupinfo, ref msg)) { AddErrLine(msg); return; } if (searchType == SearchType.Error) { AddErrLine("非法的参数信息"); return; } searchpost = true; string searchforumid = DNTRequest.GetString("searchforumid").Trim(); int posterid = CheckSearchInfo(searchforumid); if (IsErr()) { return; } //if (Utils.StrIsNullOrEmpty(keyword) && posterid > 0 && Utils.StrIsNullOrEmpty(type)) //{ // type = "author"; // searchType = SearchType.ByPoster; //} searchid = Searches.Search(posttableid, userid, usergroupid, keyword, posterid, searchType, searchforumid, DNTRequest.GetInt("searchtime", 0), DNTRequest.GetInt("searchtimetype", 0), DNTRequest.GetInt("resultorder", 0), DNTRequest.GetInt("resultordertype", 0)); if (searchid > 0) { System.Web.HttpContext.Current.Response.Redirect(forumpath + "search.aspx?type=" + type + "&searchid=" + searchid + "&keyword=" + keyword + "&poster=" + poster + "&posttableid=" + posttableid, false); } else { AddErrLine("抱歉, 没有搜索到符合要求的记录"); return; } } }