Ejemplo n.º 1
0
        public static string GetForumRssXml(int ttl, int fid)
        {
            var    cacheService = XCache.Current;
            string text         = cacheService.RetrieveObject("/Forum/RSS/Forum" + fid) as string;

            if (text == null)
            {
                var forumInfo = Forums.GetForumInfo(fid);
                if (forumInfo == null)
                {
                    return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Specified forum not found</Rss>\r\n");
                }
                if (!forumInfo.AllowView(7))
                {
                    return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Guest Denied</Rss>\r\n");
                }
                if (!UserGroup.Guest.AllowVisit)
                {
                    return("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<Rss>Guest Denied</Rss>\r\n");
                }
                text = BuildRssOutput(ttl, new Int32[] { fid }, forumInfo.Name);
                XCache.Add("/Forum/RSS/Forum" + fid, text, ttl * 60);
            }
            return(text);
        }
Ejemplo n.º 2
0
 private static int GetAllowGetAttachValue(PostpramsInfo postpramsInfo)
 {
     if (Forums.AllowGetAttachByUserID(Forums.GetForumInfo(postpramsInfo.Fid).Permuserlist, postpramsInfo.CurrentUserid))
     {
         return 1;
     }
     int result = 0;
     if (postpramsInfo.Getattachperm.IsNullOrWhiteSpace() || postpramsInfo.Getattachperm == null)
     {
         result = postpramsInfo.CurrentUserGroup.AllowGetattach ? 1 : 0;
     }
     else
     {
         if (Forums.AllowGetAttach(postpramsInfo.Getattachperm, postpramsInfo.Usergroupid))
         {
             result = 1;
         }
     }
     return result;
 }
Ejemplo n.º 3
0
 private static void LoadTopTopicListExtraInfo(Int32 topicTypePrefix, Int32 newMinutes, Int32 hotReplyNumber, List <Topic> list)
 {
     //var topicTypeArray = TopicType.GetTopicTypeArray();
     //var stringBuilder = new StringBuilder();
     foreach (var tp in list)
     {
         var forumInfo = Forums.GetForumInfo(tp.Fid);
         if (tp.Closed == 0 && forumInfo.AutoClose > 0 && tp.PostDateTime.AddHours(forumInfo.AutoClose * 24) < DateTime.Now)
         {
             //stringBuilder.Append(tp.ID.ToString());
             //stringBuilder.Append(",");
             tp.Closed = 1;
             tp.Update();
         }
         LoadTopicFolder(forumInfo.AutoClose, newMinutes, hotReplyNumber, tp);
         //LoadTopicHighlightTitle(tp);
         //LoadTopicType(topicTypePrefix, topicTypeArray, tp);
     }
     //if (stringBuilder.Length > 0)
     //{
     //    TopicAdmins.SetClose(stringBuilder.ToString().TrimEnd(','), 1);
     //}
 }
Ejemplo n.º 4
0
        public Template SelectTemplate(Template tmp, String pagename, String newUrl)
        {
            var pages   = "showforum,showtopic,showdebate,showbonus,posttopic,postreply,showtree,editpost,delpost,topicadmin";
            var forumid = 0;
            var num2    = pagename.LastIndexOf("/") + 1;
            var num3    = pagename.LastIndexOf(".") - num2;

            if (num3 > 0 && Utils.InArray(pagename.Substring(num2, num3), pages))
            {
                var config = GeneralConfigInfo.Current;
                var cookie = Utils.GetCookie(Utils.GetTemplateCookieName());
                var deftid = 0;
                //if (Utils.InArray(cookie, Templates.GetValidTemplateIDList()))
                if (Template.Has(cookie))
                {
                    deftid = cookie.ToInt(config.Templateid);
                }

                var array = newUrl.Split('&');
                for (int i = 0; i < array.Length; i++)
                {
                    var item  = array[i];
                    var value = item.Split('=')[1];
                    if (item.IndexOf("forumid=") >= 0 && value != "")
                    {
                        forumid = value.ToInt(0);
                    }
                    else
                    {
                        if (item.IndexOf("topicid=") >= 0 && value != "")
                        {
                            var topicInfo = Topic.FindByID(value.ToInt(0));
                            if (topicInfo != null)
                            {
                                forumid = topicInfo.Fid;
                            }
                        }
                        else
                        {
                            forumid = DNTRequest.GetInt("forumid", 0);
                        }
                    }
                    if (forumid > 0)
                    {
                        var forumInfo = Forums.GetForumInfo(forumid);
                        var tid       = (forumInfo == null) ? 0 : forumInfo.TemplateID;
                        if (tid <= 0)
                        {
                            tid = deftid;
                            if (tid == 0)
                            {
                                tid = config.Templateid;
                            }
                        }
                        if (tid > 0 && tmp.ID != tid)
                        {
                            tmp = Template.FindByID(tid);
                        }
                        break;
                    }
                }
            }
            return(tmp);
        }