protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { #region FID删除相应的版块 if (DNTRequest.GetString("istrade") == "1") { //如果是交易版块,则选清除绑定的商品 if (MallPluginProvider.GetInstance() != null) { MallPluginProvider.GetInstance().EmptyGoodsCategoryFid(DNTRequest.GetInt("fid", 0)); MallPluginProvider.GetInstance().StaticWriteJsonFile(); DNTCache.GetCacheService().RemoveObject("/Mall/MallSetting/GoodsCategories"); } } if (Forums.DeleteForum(DNTRequest.GetString("fid"))) { ForumOperator.RefreshForumCache(); AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "删除论坛版块", "删除论坛版块,fid为:" + DNTRequest.GetString("fid")); base.RegisterStartupScript("", "<script>window.location.href='forum_ForumsTree.aspx';</script>"); } else { base.RegisterStartupScript("", "<script>alert('对不起,当前节点下面还有子结点,因此不能删除!');window.location.href='forum_ForumsTree.aspx';</script>"); } #endregion } }
/// <summary> /// 获取热门或新开的店铺信息 /// </summary> /// <param name="shoptype">热门店铺(1:热门店铺, 2 :新开店铺)</param> /// <returns></returns> private void GetShopInfoJson(int shoptype) { HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetShopInfoJson(shoptype)); HttpContext.Current.Response.End(); }
/// <summary> /// 获取指定用户id的商品评价(信用) /// </summary> /// <param name="uid">用户id</param> /// <param name="uidtype">用户类型(1:卖方 2:买方)</param> /// <param name="ratetype">评价类型(1:好评 2:中评 3:差评)</param> /// <param name="filter">过滤方式(或字段)</param> private void GetGoodsRatesList(int uid, int uidtype, int ratetype, string filter) { HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetGoodsRatesJson(uid, uidtype, ratetype, filter)); HttpContext.Current.Response.End(); }
/// <summary> /// 获取热门商品信息 /// </summary> /// <param name="days">天数</param> /// <param name="categroyid">商品分类</param> /// <param name="count">返回记录条数</param> private void GetHotGoods(int days, int categroyid, int count) { HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetHotGoodsJsonData(days, categroyid, count)); HttpContext.Current.Response.End(); }
private void GetGoodsList(int categroyid, int order, int topnumber) { HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetGoodsListJsonData(categroyid, order, topnumber)); HttpContext.Current.Response.End(); }
private int GetIsTrade(string istrade) { if (istrade == "0") { return(0); } return(MallPluginProvider.GetInstance() == null ? 0 : 1); }
/// <summary> /// 通过留言id获取留言信息 /// </summary> /// <param name="leavewordid">留言id</param> private void GetGoodsLeaveWordById(int leavewordid) { HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetLeaveWordJson(leavewordid)); HttpContext.Current.Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (MallPluginProvider.GetInstance() == null) { usergroupright.Items.RemoveAt(usergroupright.Items.Count - 1); //最后一项总是为是否允许交易 } } }
protected void Page_Load(object sender, EventArgs e) { haveAlbum = AlbumPluginProvider.GetInstance() != null; haveSpace = SpacePluginProvider.GetInstance() != null; haveMall = MallPluginProvider.GetInstance() != null; if (!Page.IsPostBack) { LoadConfigInfo(); } }
/// <summary> /// 获取指定商品下的留言 /// </summary> /// <param name="goodsid">商品id</param> /// <param name="pagesize">页面大小</param> /// <param name="pageindex">当前页</param> private void GetGoodsLeaveWord(int goodsid, int pagesize, int pageindex) { pageindex = (pageindex < 0) ? 1 : pageindex; pagesize = (pagesize < 0 || pagesize > 25) ? 25 : pagesize; HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); HttpContext.Current.Response.Expires = -1; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetLeaveWordJson(goodsid, pagesize, pageindex, "id", 0).ToString()); HttpContext.Current.Response.End(); }
/// <summary> /// 获取论坛热门标签 /// </summary> private void GetMallHotTags() { string filename = Utils.GetMapPath(BaseConfigs.GetForumPath + MallPluginBase.GoodsHotTagJSONPCacheFileName); if (!File.Exists(filename)) { MallPluginProvider.GetInstance().WriteHotTagsListForGoodsJSONPCacheFile(60); } WriteFile(filename); }
protected void Page_Load(object sender, EventArgs e) { haveAlbum = AlbumPluginProvider.GetInstance() != null; haveSpace = SpacePluginProvider.GetInstance() != null; haveMall = MallPluginProvider.GetInstance() != null; if (!Page.IsPostBack) { LoadConfigInfo(); closed.Items[0].Attributes.Add("onclick", "setStatus(true)"); closed.Items[1].Attributes.Add("onclick", "setStatus(false)"); } }
/// <summary> /// 获取交易日志 /// </summary> /// <param name="goodsid">商品id</param> /// <param name="pagesize">页面大小</param> /// <param name="pageindex">当前页</param> /// <param name="orderby">排序字段</param> /// <param name="ascdesc">排序方法</param> private void GetGoodsTradeLog(int goodsid, int pagesize, int pageindex, string orderby, int ascdesc) { pageindex = (pageindex < 0) ? 1 : pageindex; pagesize = (pagesize < 0 || pagesize > 25) ? 25 : pagesize; HttpContext.Current.Response.Clear(); if (Utils.InArray(orderby, "lastupdate")) { HttpContext.Current.Response.Write(MallPluginProvider.GetInstance().GetTradeLogJson(goodsid, pagesize, pageindex, orderby, ascdesc).ToString()); } HttpContext.Current.Response.End(); }
public void GetSetting(ref UserGroupInfo usergroupinfo) { usergroupinfo.Allowsearch = Convert.ToInt32(allowsearch.SelectedValue); //usergroupinfo.Allowavatar = Convert.ToInt32(allowavatar.SelectedValue); usergroupinfo.Reasonpm = Convert.ToInt32(reasonpm.SelectedValue); usergroupinfo.Allowvisit = usergroupright.Items[0].Selected ? 1 : 0; //是否允许访问论坛 usergroupinfo.Allowpost = usergroupright.Items[1].Selected ? 1 : 0; //是否允许发帖 usergroupinfo.Allowreply = usergroupright.Items[2].Selected ? 1 : 0; //是否允许回复 usergroupinfo.Allowpostpoll = usergroupright.Items[3].Selected ? 1 : 0; //是否允许发起投票 usergroupinfo.Allowvote = usergroupright.Items[4].Selected ? 1 : 0; //是否允许参与投票 usergroupinfo.Allowpostattach = usergroupright.Items[5].Selected ? 1 : 0; //是否发布附件 usergroupinfo.Allowgetattach = usergroupright.Items[6].Selected ? 1 : 0; //是否允许下载附件 usergroupinfo.Allowsetreadperm = usergroupright.Items[7].Selected ? 1 : 0; //是否允许设置主题阅读积分权限 usergroupinfo.Allowsetattachperm = usergroupright.Items[8].Selected ? 1 : 0; //是否允许设置附件阅读积分限制 usergroupinfo.Allowhidecode = usergroupright.Items[9].Selected ? 1 : 0; //是否允许使用hide代码 usergroupinfo.Allowcusbbcode = usergroupright.Items[10].Selected ? 1 : 0; //是否允许使用Discuz!NT代码 usergroupinfo.Allowsigbbcode = usergroupright.Items[11].Selected ? 1 : 0; //签名是否支持Discuz!NT代码 usergroupinfo.Allowsigimgcode = usergroupright.Items[12].Selected ? 1 : 0; //签名是否支持图片代码 usergroupinfo.Allowviewpro = usergroupright.Items[13].Selected ? 1 : 0; //是否允许查看用户资料 usergroupinfo.Disableperiodctrl = usergroupright.Items[14].Selected ? 1 : 0; //是否不受时间段限制 usergroupinfo.Allowdebate = usergroupright.Items[15].Selected ? 1 : 0; //是否允许辩论 usergroupinfo.Allowbonus = usergroupright.Items[16].Selected ? 1 : 0; //是否允许悬赏 //如果勾选允许悬赏 if (usergroupright.Items[16].Selected) { usergroupinfo.Minbonusprice = DNTRequest.GetInt("minbonusprice", 0); usergroupinfo.Maxbonusprice = DNTRequest.GetInt("maxbonusprice", 0); } else { usergroupinfo.Minbonusprice = 0; usergroupinfo.Maxbonusprice = 0; } usergroupinfo.Allowviewstats = usergroupright.Items[17].Selected ? 1 : 0; //是否允许查看统计数据 usergroupinfo.Allowdiggs = usergroupright.Items[18].Selected ? 1 : 0; //是否允许辩论支持 usergroupinfo.Allowhtmltitle = usergroupright.Items[19].Selected ? 1 : 0; //是否允许html标题 usergroupinfo.Allowhtml = usergroupright.Items[20].Selected ? 1 : 0; //是否允许html usergroupinfo.ModNewTopics = usergroupright.Items[21].Selected ? 1 : 0; //发主题需审核 usergroupinfo.ModNewPosts = usergroupright.Items[22].Selected ? 1 : 0; //发回复需审核 usergroupinfo.Ignoreseccode = usergroupright.Items[23].Selected ? 1 : 0; //是否允许忽略检测验证码 if (MallPluginProvider.GetInstance() != null) { usergroupinfo.Allowtrade = usergroupright.Items[usergroupright.Items.Count - 1].Selected ? 1 : 0; //是否允许交易 } }
public void Execute(object state) { //SpacePluginBase instance = SpacePluginProvider.GetInstance(); //AlbumPluginBase instance2 = AlbumPluginProvider.GetInstance(); //ForumTags.WriteHotTagsListForForumCacheFile(60); //ForumTags.WriteHotTagsListForForumJSONPCacheFile(60); //if (instance != null) //{ // instance.WriteHotTagsListForSpaceJSONPCacheFile(60); //} //if (instance2 != null) //{ // instance2.WriteHotTagsListForPhotoJSONPCacheFile(60); //} MallPluginBase instance3 = MallPluginProvider.GetInstance(); if (instance3 != null) { instance3.WriteHotTagsListForGoodsJSONPCacheFile(60); } }
/// <summary> /// 是否跳转链接 /// </summary> /// <param name="forum"></param> /// <returns></returns> private bool JumpUrl(ForumInfo forumInfo) { //当版块有外部链接时,则直接跳转 if (!Utils.StrIsNullOrEmpty(forumInfo.Redirect)) { HttpContext.Current.Response.Redirect(forumInfo.Redirect); return(true); } //当允许发表交易帖时,则跳转到相应的商品列表页 if (config.Enablemall == 1 && forumInfo.Istrade == 1) { MallPluginBase mpb = MallPluginProvider.GetInstance(); int categoryid = mpb.GetGoodsCategoryIdByFid(forumInfo.Fid); if (categoryid > 0) { HttpContext.Current.Response.Redirect(BaseConfigs.GetForumPath + base.ShowGoodsListAspxRewrite(categoryid, 1)); return(true); } } return(false); }
public void Execute(object state) { SpacePluginBase spb = SpacePluginProvider.GetInstance(); AlbumPluginBase apb = AlbumPluginProvider.GetInstance(); ForumTags.WriteHotTagsListForForumCacheFile(60); ForumTags.WriteHotTagsListForForumJSONPCacheFile(60); if (spb != null) { spb.WriteHotTagsListForSpaceJSONPCacheFile(60); } if (apb != null) { apb.WriteHotTagsListForPhotoJSONPCacheFile(60); } MallPluginBase imp = MallPluginProvider.GetInstance(); if (imp != null) { imp.WriteHotTagsListForGoodsJSONPCacheFile(60); } }
private void BindItem() { switch (listtype) { case "spacepost": SpacePluginBase spb = SpacePluginProvider.GetInstance(); if (spb == null) { AddErrLine("未安装空间插件"); return; } spacepostcount = spb.GetSpacePostCountWithSameTag(tagid); SetPage(spacepostcount); if (spacepostcount > 0) { spacepostlist = spb.GetSpacePostsWithSameTag(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=spacepost&tagid=" + tagid, 8); } else { AddErrLine("该标签下暂无日志"); } break; case "photo": AlbumPluginBase apb = AlbumPluginProvider.GetInstance(); if (apb == null) { AddErrLine("未安装相册插件"); return; } photocount = apb.GetPhotoCountWithSameTag(tagid); SetPage(photocount); if (photocount > 0) { photolist = apb.GetPhotosWithSameTag(tagid, pageid, config.Tpp); foreach (PhotoInfo photo in photolist) { if (photo.Filename.IndexOf("http") < 0) //当是远程照片时 { photo.Filename = forumpath + AlbumPluginProvider.GetInstance().GetThumbnailImage(photo.Filename); } else { photo.Filename = AlbumPluginProvider.GetInstance().GetThumbnailImage(photo.Filename); } } pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=photo&tagid=" + tagid, 8); } else { AddErrLine("该标签下暂无图片"); } break; case "mall": if (MallPluginProvider.GetInstance() == null) { AddErrLine("未安装商城插件"); return; } goodscount = MallPluginProvider.GetInstance().GetGoodsCountWithSameTag(tagid); SetPage(goodscount); if (goodscount > 0) { goodslist = MallPluginProvider.GetInstance().GetGoodsWithSameTag(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=mall&tagid=" + tagid, 8); } else { AddErrLine("该标签下暂无商品"); } break; case "topic": topiccount = Topics.GetTopicCountByTagId(tagid); SetPage(topiccount); if (topiccount > 0) { topiclist = Topics.GetTopicListByTagId(tagid, pageid, config.Tpp); pagenumbers = Utils.GetPageNumbers(pageid, pagecount, "tags.aspx?t=topic&tagid=" + tagid, 8); } else { AddErrLine("该标签下暂无主题"); } break; } }
public GoodsinfoCollection GetGoodsList(string condition, string orderBy, int categoryId, int topNumber) { if (Utils.StrIsNullOrEmpty(orderBy)) { orderBy = "goodsid"; } condition = (Utils.StrIsNullOrEmpty(orderBy) ? "" : condition.ToLower().Trim()); string xpath = "/Aggregation/Goods/Goods_" + categoryId + "_" + condition + "_" + orderBy + "_List"; var cacheService = XCache.Current; GoodsinfoCollection goodsinfoCollection = cacheService.RetrieveObject(xpath) as GoodsinfoCollection; if (goodsinfoCollection == null) { string a; if ((a = condition) != null) { if (!(a == "recommend")) { if (!(a == "quality_new")) { if (a == "quality_old") { condition = MallPluginProvider.GetInstance().GetGoodsQualityCondition(4, 2); } } else { condition = MallPluginProvider.GetInstance().GetGoodsQualityCondition(4, 1); } } else { condition = MallPluginProvider.GetInstance().GetGoodsRecommendCondition(4, 1); } } string a2; if ((a2 = orderBy) != null) { if (!(a2 == "newgoods")) { if (!(a2 == "viewcount")) { if (!(a2 == "hotgoods")) { } } else { orderBy = "viewcount"; } } else { orderBy = "goodsid"; } } if (orderBy == "hotgoods") { condition = MallPluginProvider.GetInstance().GetGoodsCloseCondition(1, 0); condition += MallPluginProvider.GetInstance().GetGoodsExpirationCondition(6, 0); condition += MallPluginProvider.GetInstance().GetGoodsDateLineCondition(4, 0); condition += MallPluginProvider.GetInstance().GetGoodsRemainCondition(3, 0); condition += MallPluginProvider.GetInstance().GetGoodsDisplayCondition(4, 0); goodsinfoCollection = MallPluginProvider.GetInstance().GetHotGoods(360, categoryId, topNumber, condition); } else { if (categoryId > 0) { goodsinfoCollection = MallPluginProvider.GetInstance().GetGoodsInfoList(categoryId, topNumber, 1, condition, orderBy, 1); } else { goodsinfoCollection = MallPluginProvider.GetInstance().GetGoodsInfoList(topNumber, 1, condition, orderBy, 1); } } //cacheService.LoadCacheStrategy(new DefaultCacheStrategy //{ // TimeOut = 300 //}); XCache.Add(xpath, goodsinfoCollection); //cacheService.LoadDefaultCacheStrategy(); } return(goodsinfoCollection); }
public void GetGoodsAttachInfo(int attachmentid) { MallPluginBase mpb = MallPluginProvider.GetInstance(); if (mpb == null) { AddErrLine("未安装商城插件"); return; } goodsattachmentinfo = mpb.GetGoodsAttachmentsByAid(attachmentid); if (goodsattachmentinfo == null) { AddErrLine("不存在的附件ID"); return; } // 获取该商品的信息 goodsinfo = mpb.GetGoodsInfo(goodsattachmentinfo.Goodsid); if (goodsinfo == null) { AddErrLine("不存在的商品ID"); return; } forum = Forums.GetForumInfo(mpb.GetCategoriesFid(goodsinfo.Categoryid)); pagetitle = Utils.RemoveHtml(forum.Name); //添加判断特殊用户的代码 if (!Forums.AllowViewByUserId(forum.Permuserlist, userid) && !Forums.AllowView(forum.Viewperm, usergroupid)) { AddErrLine("您没有浏览该版块的权限"); if (userid == -1) needlogin = true; return; } //添加判断特殊用户的代码 if (!UserAuthority.CheckUsertAttachAuthority(forum, usergroupinfo, userid, ref msg)) { AddErrLine(msg); if (userid == -1) needlogin = true; return; } // 检查用户是否拥有足够的阅读权限 if (goodsattachmentinfo.Readperm > usergroupinfo.Readaccess && goodsattachmentinfo.Uid != userid && !Moderators.IsModer(useradminid, userid, forum.Fid)) { AddErrLine("您的阅读权限不够"); if (userid == -1) needlogin = true; return; } if (goodsattachmentinfo.Filename.IndexOf("http") < 0 && !File.Exists(Utils.GetMapPath(string.Format(@"{0}upload/{1}", BaseConfigs.GetForumPath, goodsattachmentinfo.Filename)))) { AddErrLine("该附件文件不存在或已被删除"); return; } if (goodsattachmentinfo.Filename.IndexOf("http") < 0) Utils.ResponseFile(Utils.GetMapPath(string.Format(@"{0}upload/{1}", BaseConfigs.GetForumPath, goodsattachmentinfo.Filename)), Path.GetFileName(goodsattachmentinfo.Attachment), goodsattachmentinfo.Filetype); else HttpContext.Current.Response.Redirect(goodsattachmentinfo.Filename.Trim()); }
protected override void ShowPage() { if (userid == -1) { AddErrLine("你尚未登录"); return; } //收藏的是主题 if (topicid != -1) { // 获取该主题的信息 TopicInfo topic = Topics.GetTopicInfo(topicid); // 如果该主题不存在 if (topic == null) { AddErrLine("不存在的主题ID"); return; } topictitle = topic.Title; forumid = topic.Fid; forum = Forums.GetForumInfo(forumid); forumname = forum.Name; pagetitle = Utils.RemoveHtml(forum.Name); forumnav = forum.Pathlist; CheckFavorite(FavoriteType.ForumTopic, topicid, "主题"); } //收藏的是相册 if (albumid != -1) { AlbumPluginBase apb = AlbumPluginProvider.GetInstance(); if (apb == null) { AddErrLine("未安装相册插件"); return; } if (apb.GetAlbumInfo(albumid) == null) { AddErrLine("不存在的相册ID"); return; } CheckFavorite(FavoriteType.Album, albumid, "相册"); } //收藏的是空间文章 if (blogid != -1) { SpacePluginBase spb = SpacePluginProvider.GetInstance(); if (spb == null) { AddErrLine("未安装空间插件"); return; } if (spb.GetSpacepostsInfo(blogid) == null) { AddErrLine("不存在的文章ID"); return; } CheckFavorite(FavoriteType.SpacePost, blogid, "文章"); } //收藏的是商品 if (goodsid != -1) { MallPluginBase mpb = MallPluginProvider.GetInstance(); if (mpb == null) { AddErrLine("未安装交易插件"); return; } if (mpb.GetGoodsInfo(goodsid) == null) { AddErrLine("不存在的商品ID"); return; } CheckFavorite(FavoriteType.Goods, goodsid, "商品"); } }
/// <summary> /// BasePage类构造函数 /// </summary> public PageBase() { if (recordPageView) { PageViewStatistic(pagename); } config = GeneralConfigs.GetConfig(); if (SpacePluginProvider.GetInstance() == null) { config.Enablespace = 0; } if (AlbumPluginProvider.GetInstance() == null) { config.Enablealbum = 0; } if (MallPluginProvider.GetInstance() == null) { config.Enablemall = 0; } LoadUrlConfig(); userid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1); //清空当前页面查询统计 #if DEBUG Discuz.Data.DbHelper.QueryCount = 0; Discuz.Data.DbHelper.QueryDetail = ""; #endif // 如果启用游客页面缓存,则对游客输出缓存页 if (userid == -1 && config.Guestcachepagetimeout > 0 && GetUserCachePage(pagename)) { return; } AddMetaInfo(config.Seokeywords, config.Seodescription, config.Seohead); if (config.Nocacheheaders == 1) { System.Web.HttpContext.Current.Response.BufferOutput = false; System.Web.HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1); System.Web.HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1)); System.Web.HttpContext.Current.Response.Expires = 0; System.Web.HttpContext.Current.Response.CacheControl = "no-cache"; System.Web.HttpContext.Current.Response.Cache.SetNoStore(); } //当为forumlist.aspx或forumindex.aspx,可能出现在线并发问题,这时系统会延时2秒 if ((pagename != "forumlist.aspx") && (pagename != "forumindex.aspx")) { oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); } else { try { oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); } catch { System.Threading.Thread.Sleep(2000); oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout); } } if (config.PostTimeStorageMedia == 1 && Utils.GetCookie("lastposttime") != "")//如果最后发帖时间cookie不为空,则在此修改用户的该属性 { oluserinfo.Lastposttime = Utils.GetCookie("lastposttime"); } userid = oluserinfo.Userid; usergroupid = oluserinfo.Groupid; username = oluserinfo.Username; password = oluserinfo.Password; userkey = password.Length > 16 ? password.Substring(4, 8).Trim() : ""; lastposttime = oluserinfo.Lastposttime; lastpostpmtime = oluserinfo.Lastpostpmtime; lastsearchtime = oluserinfo.Lastsearchtime; olid = oluserinfo.Olid; //确保头像可以取到 if (userid > 0) { useravatar = Avatars.GetAvatarUrl(userid, AvatarSize.Small); } if (Utils.InArray(DNTRequest.GetString("selectedtemplateid"), Templates.GetValidTemplateIDList())) { templateid = DNTRequest.GetInt("selectedtemplateid", 0); } else if (Utils.InArray(Utils.GetCookie(Utils.GetTemplateCookieName()), Templates.GetValidTemplateIDList())) { templateid = Utils.StrToInt(Utils.GetCookie(Utils.GetTemplateCookieName()), config.Templateid); } if (templateid == 0) { templateid = config.Templateid; } pmsound = Utils.StrToInt(ForumUtils.GetCookie("pmsound"), 0); //已登录用户检测用户组状态,如果是禁言或禁止访问状态时间到期,则自动解禁 if (usergroupid == 4 || usergroupid == 5) { //int groupExpiry = Users.GetShortUserInfo(userid).Groupexpiry; //if (groupExpiry != 0 && groupExpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0)) //{ // //先改为第一个积分组 // usergroupid = 11; // //usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid); // Users.UpdateUserGroup(userid, 11); //} ShortUserInfo userInfo = Users.GetShortUserInfo(userid); if (userInfo.Groupexpiry != 0 && userInfo.Groupexpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0)) { UserGroupInfo groupInfo = UserCredits.GetCreditsUserGroupId(userInfo.Credits); usergroupid = groupInfo.Groupid != 0 ? groupInfo.Groupid : usergroupid; Users.UpdateUserGroup(userid, usergroupid); } } usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid); // 取得用户权限id,1管理员,2超版,3版主,0普通组,-1特殊组 useradminid = usergroupinfo.Radminid; string tips = ForumUtils.GetUserCreditsCookie(userid, usergroupinfo.Grouptitle); if (tips != "") { string[] userinfotipsList = tips.Split(',');//因为考虑到应用程序做单点登录时获取不到userinfotips,封装了此方法 userinfotips = "<p><a class=\"drop\" onmouseover=\"showMenu(this.id);\" href=\"" + BaseConfigs.GetForumPath + "usercpcreditspay.aspx\" id=\"extcreditmenu\">" + userinfotipsList[0] + "</a> "; userinfotips += "<span class=\"pipe\">|</span>用户组: <a class=\"xi2\" id=\"g_upmine\" href=\"" + BaseConfigs.GetForumPath + "usercp.aspx\">" + userinfotipsList[1].Split(':')[1] + "</a></p>"; userinfotips += "<ul id=\"extcreditmenu_menu\" class=\"p_pop\" style=\"display:none;\">"; for (int i = 2; i < userinfotipsList.Length; i++) { userinfotips += string.Format("<li><a> {0}</a></li>", userinfotipsList[i]); } userinfotips += "</ul>"; } mainnavigation = Navs.GetNavigationString(userid, useradminid); subnavigation = Navs.GetSubNavigation(); mainnavigationhassub = Navs.GetMainNavigationHasSub(); // 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页 if (config.Closed == 1 && pagename != "login.aspx" && pagename != "logout.aspx" && pagename != "register.aspx" && useradminid != 1) { ShowMessage(1); return; } if (!Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗 { onlineusercount = (userid != -1) ? OnlineUsers.GetOnlineAllUserCount() : OnlineUsers.GetCacheOnlineAllUserCount(); } //校验用户是否可以访问论坛 if (!ValidateUserPermission()) { return; } //更新用户在线时长 if (userid != -1 && !Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗 { OnlineUsers.UpdateOnlineTime(config.Oltimespan, userid); } TemplateInfo templateInfo = Templates.GetTemplateItem(templateid); templatepath = templateInfo.Directory; if (templateInfo.Templateurl.ToLower().StartsWith("http://")) { imagedir = templateInfo.Templateurl.TrimEnd('/') + "/images"; cssdir = templateInfo.Templateurl.TrimEnd('/'); } else { imagedir = forumpath + "templates/" + templateInfo.Directory + "/images"; cssdir = forumpath + "templates/" + templateInfo.Directory; } if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Topicidentifydir)) { topicidentifydir = EntLibConfigs.GetConfig().Topicidentifydir.TrimEnd('/'); } else { topicidentifydir = forumpath + "images/identify"; } if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Posticondir)) { posticondir = EntLibConfigs.GetConfig().Posticondir.TrimEnd('/'); } else { posticondir = forumpath + "images/posticons"; } if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Jsdir)) { jsdir = EntLibConfigs.GetConfig().Jsdir.TrimEnd('/'); } else { jsdir = rooturl + "javascript"; } nowdate = Utils.GetDate(); nowtime = Utils.GetTime(); nowdatetime = Utils.GetDateTime(); ispost = DNTRequest.IsPost(); isget = DNTRequest.IsGet(); link = ""; script = ""; templatelistboxoptions = Caches.GetTemplateListBoxOptionsCache(); string originalTemplate = string.Format("<li><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", "", BaseConfigs.GetForumPath, templateid); string newTemplate = string.Format("<li class=\"current\"><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">", BaseConfigs.GetForumPath, templateid); templatelistboxoptions = templatelistboxoptions.Replace(originalTemplate, newTemplate); isLoginCode = config.Seccodestatus.Contains("login.aspx"); //当该页面设置了验证码检验,并且当前用户的用户组没有给予忽略验证码的权限,则isseccode=true; isseccode = Utils.InArray(pagename, config.Seccodestatus) && usergroupinfo.Ignoreseccode == 0; headerad = Advertisements.GetOneHeaderAd("", 0); footerad = Advertisements.GetOneFooterAd("", 0); //设定当前页面的显示样式 if (config.Allowchangewidth == 0) { Utils.WriteCookie("allowchangewidth", ""); } if (pagename != "website.aspx") { if (Utils.GetCookie("allowchangewidth") == "0" || (string.IsNullOrEmpty(Utils.GetCookie("allowchangewidth")) && config.Showwidthmode == 1)) { isnarrowpage = true; } } //校验验证码 if (isseccode && ispost && !ValidateVerifyCode()) { return; } newtopicminute = config.Viewnewtopicminute; m_starttick = DateTime.Now; ShowPage(); m_processtime = DateTime.Now.Subtract(m_starttick).TotalMilliseconds / 1000; querycount = Discuz.Data.DbHelper.QueryCount; Discuz.Data.DbHelper.QueryCount = 0; #if DEBUG querydetail = Discuz.Data.DbHelper.QueryDetail; Discuz.Data.DbHelper.QueryDetail = ""; #endif }
/// <summary> /// 获取聚合页面商品列表信息 /// </summary> /// <param name="type">商品类型(recommend :仅返回推荐商品[商城模式下可用] , quality_new: 仅返回全新(状态)商品, quality_old:仅返回二手(状态)商品</param> /// <param name="orderby">排序字段(viewcount:按浏览量排序, hotgoods:按商品交易量排序, newgoods:按发布商品时间排序)</param> /// <param name="categoryid">商品分类id</param> /// <param name="topnumber">获取主题数量</param> /// <returns></returns> /// <returns></returns> public GoodsinfoCollection GetGoodsList(string condition, string orderBy, int categoryId, int topNumber) { if (Utils.StrIsNullOrEmpty(orderBy)) { orderBy = "goodsid"; } condition = Utils.StrIsNullOrEmpty(orderBy) ? "" : condition.ToLower().Trim(); string cachekey = "/Aggregation/Goods/Goods_" + categoryId + "_" + condition + "_" + orderBy + "_List"; Discuz.Cache.DNTCache cache = Discuz.Cache.DNTCache.GetCacheService(); GoodsinfoCollection __goodsList = cache.RetrieveObject(cachekey) as GoodsinfoCollection; if (__goodsList == null) { switch (condition) { case "recommend": //推荐商品 { condition = MallPluginProvider.GetInstance().GetGoodsRecommendCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.MorethanOrEqual, 1); break; } case "quality_new": //全新(状态)商品 { condition = MallPluginProvider.GetInstance().GetGoodsQualityCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.MorethanOrEqual, 1); break; } case "quality_old": //二手(状态)商品 { condition = MallPluginProvider.GetInstance().GetGoodsQualityCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.MorethanOrEqual, 2); break; } } switch (orderBy) { case "newgoods": //新发布的商品 { orderBy = "goodsid"; break; } case "viewcount": //按浏览量排序 { orderBy = "viewcount"; break; } case "hotgoods": //热门商品 { break; } } if (orderBy == "hotgoods")//热门商品 { condition = MallPluginProvider.GetInstance().GetGoodsCloseCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.Equal, 0); condition += MallPluginProvider.GetInstance().GetGoodsExpirationCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.LessthanOrEqual, 0); condition += MallPluginProvider.GetInstance().GetGoodsDateLineCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.MorethanOrEqual, 0); condition += MallPluginProvider.GetInstance().GetGoodsRemainCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.Morethan, 0); condition += MallPluginProvider.GetInstance().GetGoodsDisplayCondition((int)Discuz.Plugin.Mall.MallPluginBase.OperaCode.MorethanOrEqual, 0); __goodsList = MallPluginProvider.GetInstance().GetHotGoods(360, categoryId, topNumber, condition); } else { if (categoryId > 0) { __goodsList = MallPluginProvider.GetInstance().GetGoodsInfoList(categoryId, topNumber, 1, condition, orderBy, 1); } else { __goodsList = MallPluginProvider.GetInstance().GetGoodsInfoList(topNumber, 1, condition, orderBy, 1); } } //声明新的缓存策略接口 Discuz.Cache.ICacheStrategy ics = new Discuz.Cache.DefaultCacheStrategy(); ics.TimeOut = 300; cache.LoadCacheStrategy(ics); cache.AddObject(cachekey, __goodsList); cache.LoadDefaultCacheStrategy(); } return(__goodsList); }
public void Bind(UserGroupInfo usergroupinfo) { if (usergroupinfo.Allowsearch.ToString() == "0") { allowsearch.Items[0].Selected = true; } if (usergroupinfo.Allowsearch.ToString() == "1") { allowsearch.Items[1].Selected = true; } if (usergroupinfo.Allowsearch.ToString() == "2") { allowsearch.Items[2].Selected = true; } //if (usergroupinfo.Allowavatar >= 0) allowavatar.Items[usergroupinfo.Allowavatar].Selected = true; reasonpm.Items[usergroupinfo.Reasonpm].Selected = true; if (usergroupinfo.Allowvisit == 1) { usergroupright.Items[0].Selected = true; //是否允许访问论坛 } if (usergroupinfo.Allowpost == 1) { usergroupright.Items[1].Selected = true; //是否允许发帖 } if (usergroupinfo.Allowreply == 1) { usergroupright.Items[2].Selected = true; //是否允许回复 } if (usergroupinfo.Allowpostpoll == 1) { usergroupright.Items[3].Selected = true; //是否允许发起投票 } if (usergroupinfo.Allowvote == 1) { usergroupright.Items[4].Selected = true; //是否允许参与投票 } if (usergroupinfo.Allowpostattach == 1) { usergroupright.Items[5].Selected = true; //是否发布附件 } if (usergroupinfo.Allowgetattach == 1) { usergroupright.Items[6].Selected = true; //是否允许下载附件 } if (usergroupinfo.Allowsetreadperm == 1) { usergroupright.Items[7].Selected = true; //是否允许设置主题阅读积分权限 } if (usergroupinfo.Allowsetattachperm == 1) { usergroupright.Items[8].Selected = true; //是否允许设置附件阅读积分限制 } if (usergroupinfo.Allowhidecode == 1) { usergroupright.Items[9].Selected = true; //是否允许使用hide代码 } if (usergroupinfo.Allowcusbbcode == 1) { usergroupright.Items[10].Selected = true; //是否允许使用Discuz!NT代码 } if (usergroupinfo.Allowsigbbcode == 1) { usergroupright.Items[11].Selected = true; //签名是否支持Discuz!NT代码 } if (usergroupinfo.Allowsigimgcode == 1) { usergroupright.Items[12].Selected = true; //签名是否支持图片代码 } if (usergroupinfo.Allowviewpro == 1) { usergroupright.Items[13].Selected = true; //是否允许查看用户资料 } if (usergroupinfo.Disableperiodctrl == 1) { usergroupright.Items[14].Selected = true; //是否不受时间段限制 } if (usergroupinfo.Allowdebate == 1) { usergroupright.Items[15].Selected = true; //是否允许辩论 } if (usergroupinfo.Allowbonus == 1) { usergroupright.Items[16].Selected = true; //是否允许悬赏 } if (usergroupinfo.Allowviewstats == 1) { usergroupright.Items[17].Selected = true; //是否允许查看统计数据 } if (usergroupinfo.Allowdiggs == 1) { usergroupright.Items[18].Selected = true; //是否允许辩论支持 } if (usergroupinfo.Allowhtmltitle == 1) { usergroupright.Items[19].Selected = true; //是否允许html标题 } if (usergroupinfo.Allowhtml == 1) { usergroupright.Items[20].Selected = true; //是否允许html } if (usergroupinfo.ModNewTopics == 1) { usergroupright.Items[21].Selected = true; //发主题是否需要审核 } if (usergroupinfo.ModNewPosts == 1) { usergroupright.Items[22].Selected = true; //发回复是否需要审核 } if (usergroupinfo.Ignoreseccode == 1) { usergroupright.Items[23].Selected = true; //是否允许忽略检测验证码 } if (MallPluginProvider.GetInstance() != null && usergroupinfo.Allowtrade == 1) { usergroupright.Items[usergroupright.Items.Count - 1].Selected = true; //是否允许交易 } string strScript = "<script type='text/javascript'>\r\nfunction insertBonusPrice()\r\n{\r\n\t"; strScript += "\r\n\tvar tdelement = document.getElementById('" + usergroupright.ClientID + "_16').parentNode;"; strScript += "\r\n\ttdelement.innerHTML += ' 最低悬赏价格:<input type=\"text\" name=\"minbonusprice\" id=\"minbonusprice\" class=\"FormBase\" onblur=\"this.className=\\'FormBase\\';\" onfocus=\"this.className=\\'FormFocus\\';\" size=\"4\" maxlength=\"5\" value=\"" + usergroupinfo.Minbonusprice + "\"" + (usergroupinfo.Allowbonus == 0 ? " disabled=\"disabled \"" : "") + " />'"; strScript += "\r\n\ttdelement.innerHTML += ' 最高悬赏价格:<input type=\"text\" name=\"maxbonusprice\" id=\"maxbonusprice\" class=\"FormBase\" onblur=\"this.className=\\'FormBase\\';\" onfocus=\"this.className=\\'FormFocus\\';\" size=\"4\" maxlength=\"5\" value=\"" + usergroupinfo.Maxbonusprice + "\"" + (usergroupinfo.Allowbonus == 0 ? " disabled=\"disabled \"" : "") + " />'"; strScript += "\r\n}\r\ninsertBonusPrice();\r\n</script>\r\n"; outscript.Text = strScript; usergroupright.Items[16].Attributes.Add("onclick", "bonusPriceSet(this.checked)"); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int pertask = DNTRequest.GetInt("pertask", 0); int lastnumber = DNTRequest.GetInt("lastnumber", 0); int startvalue = DNTRequest.GetInt("startvalue", 0); int endvalue = DNTRequest.GetInt("endvalue", 0); string resultmessage = ""; switch (Request.Params["opname"]) { case "UpdatePostSP": AdminForumStats.UpdatePostSP(pertask, ref lastnumber); resultmessage = lastnumber.ToString(); break; case "UpdateMyPost": AdminForumStats.UpdateMyPost(pertask, ref lastnumber); resultmessage = lastnumber.ToString(); break; case "ReSetFourmTopicAPost": //AdminForumStats.ReSetFourmTopicAPost(pertask, ref lastnumber); AdminForumStats.ReSetFourmTopicAPost(); resultmessage = "-1"; break; case "ReSetUserDigestPosts": //AdminForumStats.ReSetUserDigestPosts(pertask, ref lastnumber); //resultmessage = lastnumber.ToString(); AdminForumStats.ReSetUserDigestPosts(); resultmessage = "-1"; break; case "ReSetUserPosts": AdminForumStats.ReSetUserPosts(pertask, ref lastnumber); resultmessage = lastnumber.ToString(); break; case "ReSetTopicPosts": AdminForumStats.ReSetTopicPosts(pertask, ref lastnumber); resultmessage = lastnumber.ToString(); break; case "ReSetFourmTopicAPost_StartEnd": AdminForumStats.ReSetFourmTopicAPost(startvalue, endvalue); resultmessage = "1"; break; case "ReSetUserDigestPosts_StartEnd": AdminForumStats.ReSetUserDigestPosts(startvalue, endvalue); resultmessage = "1"; break; case "ReSetUserPosts_StartEnd": AdminForumStats.ReSetUserPosts(startvalue, endvalue); resultmessage = "1"; break; case "ReSetTopicPosts_StartEnd": AdminForumStats.ResetLastRepliesInfoOfTopics(startvalue, endvalue); resultmessage = "1"; break; case "ftptest": FTPs ftps = new FTPs(); string message = ""; bool ok = ftps.TestConnect(DNTRequest.GetString("serveraddress"), DNTRequest.GetInt("serverport", 0), DNTRequest.GetString("username"), DNTRequest.GetString("password"), DNTRequest.GetInt("timeout", 0), DNTRequest.GetString("uploadpath"), ref message); resultmessage = ok ? "ok" : "远程附件设置测试出现错误!\n描述:" + message; break; case "setapp": APIConfigInfo aci = APIConfigs.GetConfig(); aci.Enable = DNTRequest.GetString("allowpassport") == "1"; APIConfigs.SaveConfig(aci); resultmessage = "ok"; break; case "location": string city = DNTRequest.GetString("city"); resultmessage = "ok"; DataTable dt = MallPluginProvider.GetInstance().GetLocationsTable(); foreach (DataRow dr in dt.Rows) { if (dr["country"].ToString() == DNTRequest.GetString("country") && dr["state"].ToString() == DNTRequest.GetString("state") && dr["city"].ToString() == city) { resultmessage = "<img src='../images/false.gif' title='" + city + "已经存在!'>"; break; } } break; case "goodsinfo": int goodsid = DNTRequest.GetInt("goodsid", 0); Goodsinfo goodsinfo = MallPluginProvider.GetInstance().GetGoodsInfo(goodsid); if (goodsinfo == null) { resultmessage = "商品不存在!"; break; } //GoodsattachmentinfoCollection attachmentinfos = GoodsAttachments.GetGoodsAttachmentsByGoodsid(goodsinfo.Goodsid); //string img = ""; //if (attachmentinfos != null) //{ // img = attachmentinfos[0].Filename; //} PostpramsInfo param = new PostpramsInfo(); param.Allowhtml = 1; param.Showimages = 1; param.Sdetail = goodsinfo.Message; resultmessage = "<table width='100%'><tr><td>" + UBB.UBBToHTML(param) + "</td></tr></table>"; break; case "downloadword": dt = BanWords.GetBanWordList(); string words = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { words += dt.Rows[i][2].ToString() + "=" + dt.Rows[i][3].ToString() + "\r\n"; } } string filename = "words.txt"; HttpContext.Current.Response.Clear(); HttpContext.Current.Response.Buffer = false; HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.UTF8; HttpContext.Current.Response.AppendHeader("Content-Disposition", "attachment;filename=" + Server.UrlEncode(filename)); HttpContext.Current.Response.ContentType = "text/plain"; HttpContext.Current.Response.Write(words); HttpContext.Current.Response.End(); break; case "gettopicinfo": StringBuilder sb = new StringBuilder(); TopicInfo info = Topics.GetTopicInfo(DNTRequest.GetInt("tid", 0)); sb.Append("["); if (info != null) { sb.Append(string.Format("{{'tid':{0},'title':'{1}'}}", info.Tid, info.Title)); } System.Web.HttpContext.Current.Response.Clear(); System.Web.HttpContext.Current.Response.ContentType = "application/json"; System.Web.HttpContext.Current.Response.Expires = 0; System.Web.HttpContext.Current.Response.Cache.SetNoStore(); System.Web.HttpContext.Current.Response.Write(sb.Append("]").ToString()); System.Web.HttpContext.Current.Response.End(); break; } Response.Write(resultmessage); Response.ExpiresAbsolute = DateTime.Now.AddSeconds(-1); Response.Expires = -1; Response.End(); } }