public virtual void UpdateQ(long id) { ForumTopic topic = topicService.GetById(id, ctx.owner.obj); ForumBoard board = getTree().GetById(topic.ForumBoard.Id); topic = ForumValidator.ValidateTopicEdit(topic, ctx); if (topic.Replies == 0) { topic.Reward = ctx.PostInt("Reward"); topic.RewardAvailable = topic.Reward; } if (ctx.HasErrors) { run(EditQ, id); } else { if (ctx.PostIsCheck("saveContentPic") == 1) { topic.Content = wojilu.Net.PageLoader.ProcessPic(topic.Content, null); } topicService.Update(topic, (User)ctx.viewer.obj, ctx.owner.obj); echoRedirect(lang("opok"), alink.ToAppData(topic)); } }
public void Update(int id) { ForumTopic topic = topicService.GetById(id, ctx.owner.obj); if (topic == null) { echoRedirect(alang("exTopicNotFound")); return; } ForumBoard board = boardService.GetById(topic.ForumBoard.Id, ctx.owner.obj); if (PermissionUtil.IsSelfEdit(ctx, topic) == false) { if (!PermissionUtil.Check(this, board)) { return; } } topic = ForumValidator.ValidateTopicEdit(topic, ctx); if (ctx.HasErrors) { run(Edit, id); } else { topicService.Update(topic, (User)ctx.viewer.obj, ctx.owner.obj); new ForumCacheRemove(boardService, topicService, this).UpdateTopic(topic); echoRedirect(lang("opok"), alink.ToAppData(topic)); } }
public void Update(int id) { ForumTopic topic = topicService.GetById(id, ctx.owner.obj); ForumBoard board = getTree().GetById(topic.ForumBoard.Id); topic = ForumValidator.ValidateTopicEdit(topic, ctx); if (ctx.HasErrors) { run(Edit, id); } else { if (ctx.PostIsCheck("saveContentPic") == 1) { topic.Content = wojilu.Net.PageLoader.ProcessPic(topic.Content, null); } topicService.Update(topic, (User)ctx.viewer.obj, ctx.owner.obj); new ForumCacheRemove(boardService, topicService, this).UpdateTopic(topic); echoRedirect(lang("opok"), alink.ToAppData(topic)); } }