예제 #1
0
        private void SendNotification(HttpContext context)
        {
            //log.Info("theadId = " + threadId);
            //log.Info("postId = " + postId);
            //log.Info("pageId = " + pageId);
            //log.Info("mid = " + moduleId);

            bool      notifyModeratorOnly = false;
            ModResult result = new ModResult();

            if (LoadAndValidateForumObjects())
            {
                thread.NotificationSent = true;
                thread.UpdatePost();

                ForumNotification.NotifySubscribers(
                    forum,
                    thread,
                    module,
                    postUser,
                    siteSettings,
                    config,
                    SiteUtils.GetNavigationSiteRoot(),
                    pageId,
                    pageNumber,
                    SiteUtils.GetDefaultCulture(),
                    ForumConfiguration.GetSmtpSettings(),
                    notifyModeratorOnly
                    );

                result.Msg = "success";
            }
            else
            {
                log.Info("Send forum notification request rejected due to invalid params");

                result.Msg = "rejected";
            }

            context.Response.ContentType = "application/json";
            JavaScriptSerializer s = new JavaScriptSerializer();

            context.Response.Write(s.Serialize(result));
        }
예제 #2
0
        private bool IsAllowed(ModerationRequest modReq)
        {
            siteSettings = CacheHelper.GetCurrentSiteSettings();
            if (siteSettings == null)
            {
                //log.Info("SiteSettings was null");
                return(false);
            }
            currentPage = CacheHelper.GetPage(modReq.PageId);
            if (
                (currentPage.PageId != modReq.PageId) ||
                (currentPage.SiteId != siteSettings.SiteId)
                )
            {
                log.Info("request rejected - pageid did not match");
                return(false);
            }

            thread = new ForumThread(modReq.ThreadId, modReq.PostId);

            if (thread.ModuleId != modReq.ModuleId)
            {
                log.Info("thread module id did not match");
                return(false);
            }
            forum = new Forum(thread.ForumId);

            module = GetModule(currentPage, thread.ModuleId);
            if (module == null)
            {
                log.Info("module not found in page modules");
                return(false);
            }

            config = new ForumConfiguration(ModuleSettings.GetModuleSettings(module.ModuleId));
            if (thread.PostUserId > -1)
            {
                postUser = new SiteUser(siteSettings, thread.PostUserId);
            }

            return(UserCanModerate(currentPage, module, forum));
        }
예제 #3
0
		public ForumConfiguration Update(ForumConfiguration config) {
			if (config == null) {
				throw new ArgumentNullException("config");
			}
			return this.forumConfigRepo.Update(config);
		}
 public ForumConfiguration Update(ForumConfiguration config)
 {
     // TODO: ???
     this.context.SaveChanges();
     return(config);
 }