/// <summary> /// 更新用户积分 /// </summary> /// <param name="tidlist">审核主题id</param> /// <param name="pidlist">通过审核帖子的Pid列表</param> private void UpdateUserCredits(string tidlist, string pidlist) { string[] tidarray = tidlist.Split(','); string[] pidarray = pidlist.Split(','); //float[] values = null; //ForumInfo forum = null; PostInfo post = null; //int fid = -1; for (int i = 0; i < pidarray.Length; i++) { //Topics.get post = Discuz.Forum.Posts.GetPostInfo(int.Parse(tidarray[i]), int.Parse(pidarray[i])); //获取帖子信息 CreditsFacade.PostReply(post.Posterid, Forums.GetForumInfo(post.Fid)); //if (fid != post.Fid) //当上一个和当前主题不在一个版块内时,重新读取版块的积分设置 //{ // fid = post.Fid; // forum = Discuz.Forum.Forums.GetForumInfo(fid); // if (!forum.Replycredits.Equals("")) // { // int index = 0; // float tempval = 0; // values = new float[8]; // foreach (string ext in Utils.SplitString(forum.Replycredits, ",")) // { // if (index == 0) // { // if (!ext.Equals("True")) // { // values = null; // break; // } // index++; // continue; // } // tempval = Utils.StrToFloat(ext, 0.0f); // values[index - 1] = tempval; // index++; // if (index > 8) // { // break; // } // } // } //} //if (values != null) //{ // ///使用版块内积分 // Discuz.Forum.UserCredits.UpdateUserExtCredits(post.Posterid, values, false); // Discuz.Forum.UserCredits.UpdateUserCredits(post.Posterid); //} //else //{ // ///使用默认积分 // Discuz.Forum.UserCredits.UpdateUserCreditsByPosts(post.Posterid); //} } }
private void SaveForum_Click(object sender, EventArgs e) { #region 保存版块修改信息 int row = -1; bool error = false; foreach (object o in DataGrid1.GetKeyIDArray()) { int fid = int.Parse(o.ToString()); string name = DataGrid1.GetControlValue(row, "name").Trim(); string subforumcount = DataGrid1.GetControlValue(row, "subforumcount").Trim(); string displayorder = DataGrid1.GetControlValue(row, "displayorder").Trim(); if (name == "" || !Utils.IsNumeric(subforumcount) || !Utils.IsNumeric(displayorder)) { error = true; continue; } ForumInfo forumInfo = Forums.GetForumInfo(fid); forumInfo.Name = name; forumInfo.Subforumcount = int.Parse(subforumcount); forumInfo.Displayorder = int.Parse(displayorder); AdminForums.UpdateForumInfo(forumInfo); row++; } Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/UI/ForumListBoxOptions"); Discuz.Cache.DNTCache.GetCacheService().RemoveObject("/Forum/ForumList"); if (error) { base.RegisterStartupScript("PAGE", "alert('某些记录取值不正确,未能被更新!');window.location.href='forum_forumsgrid.aspx';"); } else { base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsgrid.aspx';"); } #endregion }
public HttpResponseMessage GetForumById(int id) { try { Forums forum = this._forumManagement.GetForumById(id); if (forum != null) { ForumDTO dto = new ForumDTO { ForumId = forum.ForumId, Category = forum.Category, OwnerId = forum.OwnerId }; return(Request.CreateResponse <ForumDTO>(HttpStatusCode.OK, dto)); } else { return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Resource Not Found")); } } catch (Exception) { // Log exception code goes here return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while executing method.")); } }
protected void Page_Load(object sender, EventArgs e) { if (DNTRequest.GetString("currentfid") != "") { if (!AdminForums.MovingForumsPos(DNTRequest.GetString("currentfid"), DNTRequest.GetString("targetfid"), DNTRequest.GetString("isaschildnode") == "1" ? true : false)) { base.RegisterStartupScript("", "<script>alert('当前版块下面有子版块,因此无法移动!');window.location.href='forum_forumsTree.aspx';</script>"); } AdminVistLogs.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "移动论坛版块", "移动论坛版块ID:" + DNTRequest.GetString("currentfid") + "到ID:" + DNTRequest.GetString("targetfid")); } if (!Page.IsPostBack) { DataTable dt = Forums.GetForumListForDataTable(); ViewState["dt"] = dt; if (dt.Rows.Count == 0) { Server.Transfer("forum_AddFirstForum.aspx"); //如果版块表中没有任何版块, 则跳转到"添加第一个版块"页面. } else { AddTree(0, dt.Select("layer=0 AND [parentid]=0"), ""); str = "<script type=\"text/javascript\">\r\n var obj = [" + str; str = str.Substring(0, str.Length - 3); str += "];\r\n var newtree = new tree(\"newtree\",obj,\"reSetTree\");"; str += "</script>"; } ShowTreeLabel.Text = str; } }
private void SaveCombinationInfo_Click(object sender, EventArgs e) { if (base.CheckCookie()) { if (this.sourceforumid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('请选择相应的源论坛!');</script>"); return; } if (this.targetforumid.SelectedValue == "0") { base.RegisterStartupScript("", "<script>alert('请选择相应的目标论坛!');</script>"); return; } var forumInfo = Forums.GetForumInfo(this.targetforumid.SelectedValue.ToInt(0)); if (forumInfo != null && forumInfo.ParentID == 0 && forumInfo.Layer == 0) { base.RegisterStartupScript("", "<script>alert('您所选择的目标论坛是\"论坛分类\"而不是\"论坛版块\",因此合并无效!');</script>"); return; } if (!XForum.Combination(this.sourceforumid.SelectedValue.ToInt(), this.targetforumid.SelectedValue.ToInt())) { string scriptstr = "<script>alert('当前节点下面有子结点,因此合并无效!');window.location.href='forum_forumcombination.aspx';</script>"; base.RegisterStartupScript("", scriptstr); return; } AdminVisitLog.InsertLog(this.userid, this.username, this.usergroupid, this.grouptitle, this.ip, "合并论坛版块", "合并论坛版块" + this.sourceforumid.SelectedValue + "到" + this.targetforumid.SelectedValue); base.RegisterStartupScript("PAGE", "window.location.href='forum_forumstree.aspx';"); } }
private void GetForumTopicTypeList() { int fid = DNTRequest.GetInt("fid", 0); if (fid <= 0) { this.ResponseText("[]"); } var forumInfo = Forums.GetForumInfo(fid); if (forumInfo == null) { this.ResponseText("[]"); } if (string.IsNullOrEmpty(forumInfo.TopicTypes)) { this.ResponseText("[]"); } var sb = new StringBuilder("[{'typeid':'0','typename':'分类'}"); string[] array = forumInfo.TopicTypes.Split('|'); for (int i = 0; i < array.Length; i++) { string text = array[i]; if (!Utils.StrIsNullOrEmpty(text.Trim())) { sb.Append(",{"); sb.AppendFormat("'typeid':'{0}','typename':'{1}'", text.Split(',')[0], text.Split(',')[1]); sb.Append("}"); } } sb.Append("]"); this.ResponseText(sb); }
/// <summary> /// 获得已选取的论坛列表 /// </summary> /// <returns>列表内容的html</returns> public string GetForumCheckBoxListCache() { StringBuilder sb = new StringBuilder(); forums = "," + forums + ","; List <ForumInfo> forumList = Forums.GetForumList(GetAllowviewForums(GetForums())); int count = 1; foreach (ForumInfo forumInfo in forumList) { if (forums == ",all," || forums.IndexOf("," + forumInfo.Fid + ",") >= 0) { sb.AppendFormat("<td><input id=\"fidlist\" onclick=\"javascript:SH_SelectOne(this)\" type=\"checkbox\" value=\"{0}\" name=\"fidlist\" checked/> {1}</td>\r\n", forumInfo.Fid, forumInfo.Name); } else { sb.AppendFormat("<td><input id=\"fidlist\" onclick=\"javascript:SH_SelectOne(this)\" type=\"checkbox\" value=\"{0}\" name=\"fidlist\" /> {1}</td>\r\n", forumInfo.Fid, forumInfo.Name); } if (count > 3) { sb.Append(" </tr>\r\n"); sb.Append(" <tr>\r\n"); count = 0; } count++; } return(sb.ToString()); }
private void SaveForum_Click(object sender, EventArgs e) { int num = -1; bool flag = false; foreach (object current in this.DataGrid1.GetKeyIDArray()) { int fid = int.Parse(current.ToString()); string text = this.DataGrid1.GetControlValue(num, "name").Trim(); //string text2 = this.DataGrid1.GetControlValue(num, "subforumcount").Trim(); string text3 = this.DataGrid1.GetControlValue(num, "displayorder").Trim(); if (String.IsNullOrEmpty(text) || !Utils.IsNumeric(text3)) { flag = true; } else { var forumInfo = Forums.GetForumInfo(fid); forumInfo.Name = text; //forumInfo.SubforumCount = int.Parse(text2); forumInfo.DisplayOrder = int.Parse(text3); AdminForums.UpdateForumInfo(forumInfo); num++; } } XCache.Remove(CacheKeys.FORUM_UI_FORUM_LIST_BOX_OPTIONS); XCache.Remove(CacheKeys.FORUM_FORUM_LIST); if (flag) { base.RegisterStartupScript("PAGE", "alert('某些记录取值不正确,未能被更新!');window.location.href='forum_forumsgrid.aspx';"); return; } base.RegisterStartupScript("PAGE", "window.location.href='forum_forumsgrid.aspx';"); }
/// <summary> /// 前台绑定“关联论坛”的方法 /// </summary> /// <param name="id">主题分类的ID</param> /// <returns>返回关联论坛的链接字符串</returns> public string LinkForum(string id) { #region 返回主题分类绑定的论坛名称 return(Forums.GetForumLinkOfAssociatedTopicType(Convert.ToInt32(id))); #endregion }
protected void Page_Load(object sender, EventArgs e) { if (!this.Page.IsPostBack && Forums.GetForumList().Count == 0) { base.Server.Transfer("forum_AddFirstForum.aspx"); } }
protected void Page_Load(object sender, EventArgs e) { ThisPage = (PageBase)Page; blogYears.DataSource = Forums.GetUserBlogTopics(ForumId, MemberId); blogYears.Comparer = new YearComparer(); blogYears.DataBind(); }
public string TargetsType(string targets) { string text = ""; if (targets.IndexOf("全部") >= 0) { return("全部"); } if (targets.IndexOf("首页") >= 0) { text = "首页,"; targets = targets.Replace("首页,", ""); } if (targets.Trim() != "首页") { foreach (IXForum current in Forums.GetForumList(targets)) { text = text + current.Name + ","; } } if (text.Length <= 0) { return(""); } return(text.Substring(0, text.Length - 1)); }
// ********************************************************************* // // BindData // /// <summary> /// This function binds the posts to show to the DataList. Note that only /// those posts that fall within the first "page" of posts are displayed for /// the forum. No means to navigate backward or forward is present. This is /// a bit restrictive, since it limits the administrator to being able to only /// edit or delete posts in a forum that fall within the default timespan for /// the forum. /// </summary> // // ********************************************************************/ private void BindData() { PostCollection posts; // Make sure all of our child controls have been created this.EnsureChildControls(); // Get info about the forum Forum forum = Forums.GetForumInfo(ForumID); int iUserTimeZone = Globals.DBTimezone; // Read in user information, if applicable and set iUserTimeZone if (Context.User.Identity.Name.Length > 0) { iUserTimeZone = ((User)Users.GetUserInfo(Context.User.Identity.Name, true)).Timezone; } // Get all of the messages for the forum if (ViewMode == ViewOptions.NotSet) { posts = Posts.GetAllMessages(ForumID, ViewOptions.Threaded, 0); } else { posts = Posts.GetAllMessages(ForumID, ViewMode, 0); } // Bind the data dlForumView.DataSource = posts; dlForumView.DataBind(); }
/// <summary> /// 取得当前用户有权访问的版块列表 /// </summary> /// <param name="forums">原始版块列表(用逗号分隔的fid)</param> /// <returns>有权访问的版块列表(用逗号分隔的fid)</returns> private string GetAllowviewForums(string forums) { //验证版块id列表是否合法的数字列表 if (!Utils.IsNumericList(forums)) { return(""); } string allowviewforums = ""; foreach (string strfid in forums.Split(',')) { int fid = Utils.StrToInt(strfid, 0); ForumInfo forumInfo = Forums.GetForumInfo(fid); if (forumInfo == null || forumInfo.Layer == 0 || forumInfo.Status == 0) { continue; } if (!Forums.AllowView(forumInfo.Viewperm, usergroupid)) { continue; } if ((Utils.StrIsNullOrEmpty(forumInfo.Password) || Utils.MD5(forumInfo.Password.Trim()) == ForumUtils.GetCookie("forum" + strfid.Trim() + "password"))) { allowviewforums += string.Format(",{0}", fid); } } return(allowviewforums.Trim(',')); }
public string TargetsType(string targets) { #region 将广告投放范围的标识串转换为文字 string result = ""; //广告投放范围的标识串 if (targets.IndexOf("全部") >= 0) { return("全部"); } else { if (targets.IndexOf("首页") >= 0) { result = "首页,"; targets = targets.Replace("首页,", ""); } } if (targets.Trim() != "首页") { foreach (ForumInfo info in Forums.GetForumList(targets)) { result += info.Name + ","; } } return(result.Length > 0 ? result.Substring(0, result.Length - 1) : ""); #endregion }
private void LoadInfo() { string fids = ""; XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); XmlNode fidlist = doc.SelectSingleNode("/Aggregationinfo/Aggregationpage/Website/Website_forumrecomend/fidlist"); if (fidlist == null) { return; } fids = fidlist.InnerText; string strJson = ""; ForumInfo[] lists = Forums.GetForumList(); foreach (string fid in fids.Split(',')) { foreach (ForumInfo foruminfo in lists) { if (foruminfo.Fid.ToString() == fid) { strJson += "{'fid':'" + foruminfo.Fid + "','forumtitle':'" + foruminfo.Name + "'},"; break; } } } if (strJson != "") { strJson = strJson.TrimEnd(','); } strJson = "<script type='text/javascript'>\r\nvar fidlist = [" + strJson + "];\r\nfor(var i = 0 ; i < fidlist.length ; i++)\r\n{\r\nvar no = new Option();\r\nno.value = fidlist[i]['fid'];\r\nno.text = fidlist[i]['forumtitle'];\r\nForm1.list2.options[Form1.list2.options.length] = no;\r\n}\r\n</script>"; base.RegisterStartupScript("", strJson); }
async Task ExecuteLoadForumsCommand() { if (IsBusy) { return; } IsBusy = true; try { Forums.Clear(); var forums = await DataStore.GetForumsAsync(true); foreach (var forum in forums) { Forums.Add(forum); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
public int Commit(Forums model, int mode) { int identity = 0; // Only persist if any tickets to add or modify. if (model == null) { return(identity); } // Persist any new or modified tickets. if (mode == 0) { model.created = model.modified = DateTime.Now; _context.Forums.Add(model); _context.SaveChanges(); identity = model.ID; } //Update the existing entity else if (mode == 1) { model.created = model.modified = DateTime.Now; _context.Forums.Attach(model); _context.Entry(model).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); identity = model.ID;; } //Remove the existing entity else if (mode == 2) { _context.Forums.Attach(model); _context.Entry(model).State = Microsoft.EntityFrameworkCore.EntityState.Deleted; _context.SaveChanges(); } return(identity); }
/// <summary> /// Constructor that takes 3 params. /// </summary> /// <param name="yourZendeskUrl">Will be formated to "https://yoursite.zendesk.com/api/v2"</param> /// <param name="user"></param> /// <param name="password">LEAVE BLANK IF USING TOKEN</param> /// <param name="apiToken">Optional Param which is used if specified instead of the password</param> public ZendeskApi(string yourZendeskUrl, string user, string password = "", string apiToken = "") { var formattedUrl = GetFormattedZendeskUrl(yourZendeskUrl).AbsoluteUri; Tickets = new Tickets(formattedUrl, user, password, apiToken); Attachments = new Attachments(formattedUrl, user, password, apiToken); Views = new Views(formattedUrl, user, password, apiToken); Users = new Users(formattedUrl, user, password, apiToken); Requests = new Requests.Requests(formattedUrl, user, password, apiToken); Groups = new Groups(formattedUrl, user, password, apiToken); CustomAgentRoles = new CustomAgentRoles(formattedUrl, user, password, apiToken); Organizations = new Organizations(formattedUrl, user, password, apiToken); Search = new Search(formattedUrl, user, password, apiToken); Tags = new Tags(formattedUrl, user, password, apiToken); Forums = new Forums(formattedUrl, user, password, apiToken); Categories = new Categories(formattedUrl, user, password, apiToken); Topics = new Topics(formattedUrl, user, password, apiToken); AccountsAndActivity = new AccountsAndActivity(formattedUrl, user, password, apiToken); JobStatuses = new JobStatuses(formattedUrl, user, password, apiToken); Locales = new Locales(formattedUrl, user, password, apiToken); Macros = new Macros(formattedUrl, user, password, apiToken); SatisfactionRatings = new SatisfactionRatings(formattedUrl, user, password, apiToken); SharingAgreements = new SharingAgreements(formattedUrl, user, password, apiToken); Triggers = new Triggers(formattedUrl, user, password, apiToken); ZendeskUrl = formattedUrl; }
public ZendeskApi(string yourZendeskUrl, string user, string password) { Tickets = new Tickets(yourZendeskUrl, user, password); Attachments = new Attachments(yourZendeskUrl, user, password); Views = new Views(yourZendeskUrl, user, password); Users = new Users(yourZendeskUrl, user, password); Requests = new Requests.Requests(yourZendeskUrl, user, password); Groups = new Groups(yourZendeskUrl, user, password); CustomAgentRoles = new CustomAgentRoles(yourZendeskUrl, user, password); Organizations = new Organizations(yourZendeskUrl, user, password); Search = new Search(yourZendeskUrl, user, password); Tags = new Tags(yourZendeskUrl, user, password); Forums = new Forums(yourZendeskUrl, user, password); Categories = new Categories(yourZendeskUrl, user, password); Topics = new Topics(yourZendeskUrl, user, password); AccountsAndActivity = new AccountsAndActivity(yourZendeskUrl, user, password); JobStatuses = new JobStatuses(yourZendeskUrl, user, password); Locales = new Locales(yourZendeskUrl, user, password); Macros = new Macros(yourZendeskUrl, user, password); SatisfactionRatings = new SatisfactionRatings(yourZendeskUrl, user, password); SharingAgreements = new SharingAgreements(yourZendeskUrl, user, password); Triggers = new Triggers(yourZendeskUrl, user, password); ZendeskUrl = yourZendeskUrl; }
public RssPage() { System.Web.HttpContext.Current.Response.ContentType = "application/xml"; if (config.Rssstatus == 1) { int forumid = DNTRequest.GetInt("forumid", -1); if (forumid == -1) { System.Web.HttpContext.Current.Response.Write(Feeds.GetRssXml(config.Rssttl)); System.Web.HttpContext.Current.Response.End(); return; } else { ForumInfo forum = Forums.GetForumInfo(forumid); if (forum != null) { if (forum.Allowrss == 1) { System.Web.HttpContext.Current.Response.Write(Feeds.GetForumRssXml(config.Rssttl, forumid)); System.Web.HttpContext.Current.Response.End(); return; } } } } System.Web.HttpContext.Current.Response.Write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"); System.Web.HttpContext.Current.Response.Write("<Rss>Error</Rss>\r\n"); System.Web.HttpContext.Current.Response.End(); }
private void GetForumTopicTypeList() { int fid = DNTRequest.GetInt("fid", 0); if (fid <= 0) { ResponseText("[]"); } ForumInfo forumInfo = Forums.GetForumInfo(fid); if (forumInfo == null) { ResponseText("[]"); } if (string.IsNullOrEmpty(forumInfo.Topictypes)) { ResponseText("[]"); } StringBuilder sb = new StringBuilder("[{'typeid':'0','typename':'分类'}"); foreach (string topictype in forumInfo.Topictypes.Split('|')) { if (!Utils.StrIsNullOrEmpty(topictype.Trim())) { sb.Append(",{"); sb.AppendFormat("'typeid':'{0}','typename':'{1}'", topictype.Split(',')[0], topictype.Split(',')[1]); sb.Append("}"); } } sb.Append("]"); ResponseText(sb); }
private void InitializeComponent() { this.SaveSearchCondition.Click += new EventHandler(this.SaveSearchCondition_Click); forumid.BuildTree(Forums.GetForumListForDataTable(), "name", "fid"); forumid.TypeID.Items.RemoveAt(0); forumid.TypeID.Items.Insert(0, new ListItem("全部", "0")); }
public ShikimoriClient(ILogger logger, ClientSettings settings) { Client = new ApiClient(logger, settings); Achievements = new Achievements(Client); Animes = new Animes(Client); Bans = new Bans(Client); Calendars = new Calendars(Client); Characters = new Characters(Client); Clubs = new Clubs(Client); Comments = new Comments(Client); Constants = new Constants(Client); Dialogs = new Dialogs(Client); Favorites = new Favorites(Client); Forums = new Forums(Client); Friends = new Friends(Client); Genres = new Genres(Client); Mangas = new Mangas(Client); Messages = new Messages(Client); People = new People(Client); Publishers = new Publishers(Client); Ranobe = new Ranobe(Client); Stats = new Stats(Client); Studios = new Studios(Client); Styles = new Styles(Client); TopicIgnores = new TopicIgnores(Client); Topics = new Topics(Client); UserImages = new UserImages(Client); UserRates = new UserRates(Client); Users = new Users(Client); Videos = new Videos(Client); }
// ********************************************************************* // InitializeSkin // /// <summary> /// Initializes the user control loaded in CreateChildControls. Initialization /// consists of finding well known control names and wiring up any necessary events. /// </summary> /// // ********************************************************************/ override protected void InitializeSkin(Control skin) { // Ensure we have a valid forum try { forum = Forums.GetForumInfo(ForumID); } catch (Components.ForumNotFoundException) { Page.Response.Redirect(Globals.UrlMessage + Convert.ToInt32(Messages.UnknownForum)); Page.Response.End(); } // Find the forum name forumName = (HyperLink)skin.FindControl("ForumName"); if (forumName != null) { forumName.Text = forum.Name; forumName.NavigateUrl = Globals.UrlShowForum + ForumID; } // Find the forum Description forumDescription = (Label)skin.FindControl("ForumDescription"); if (forumDescription != null) { forumDescription.Text = forum.Description; } // Find the thread list threadList = (ThreadList)skin.FindControl("ThreadList"); }
public string GetForumCheckBoxListCache() { var sb = new StringBuilder(); forums = "," + forums + ","; var forumList = Forums.GetForumList(GetAllowviewForums(GetForums())); int num = 1; foreach (var item in forumList) { if (forums == ",all," || forums.IndexOf("," + item.Fid + ",") >= 0) { sb.AppendFormat("<td><input id=\"fidlist\" onclick=\"javascript:SH_SelectOne(this)\" type=\"checkbox\" value=\"{0}\"\tname=\"fidlist\" checked/> {1}</td>\r\n", item.Fid, item.Name); } else { sb.AppendFormat("<td><input id=\"fidlist\" onclick=\"javascript:SH_SelectOne(this)\" type=\"checkbox\" value=\"{0}\"\tname=\"fidlist\" /> {1}</td>\r\n", item.Fid, item.Name); } if (num > 3) { sb.Append("\t\t\t </tr>\r\n"); sb.Append("\t\t\t <tr>\r\n"); num = 0; } num++; } return(sb.ToString()); }
public bool CreateForum(string name, string description, int categoryID, int orderID = 0) { result = true; try { if (orderID == 0) { orderID = _context.Forums.LastOrDefault().OrderID + 1; } Forums forum = new Forums(); forum.CategoryID = categoryID; forum.Description = description; forum.Name = name; forum.UniqueName = _unique.GetName(_stringSanitizer.MakeUrlFriendly(name), "Forums"); forum.OrderID = orderID; _context.Forums.Add(forum); _context.SaveChanges(); } catch { result = false; } return result; }
// ********************************************************************* // Locations // /// <summary> /// Populates the locations dropdown with various location options /// </summary> /// // ********************************************************************/ private ListItemCollection Locations() { Forums forums = new Forums(); ListItemCollection options = new ListItemCollection(); options.Add(new ListItem("Please select")); options.Add(new ListItem("---------------------")); options.Add(new ListItem("Forums Home", Globals.UrlHome)); options.Add(new ListItem("Search Forums", Globals.UrlSearch)); options.Add(new ListItem("Member List", Globals.UrlShowAllUsers)); if (user != null) { options.Add(new ListItem("Edit My Profile", Globals.UrlEditUserProfile)); } options.Add(new ListItem("---------------------")); if (user != null) { forums.ForumListItemCollection(user.Username, Forums.ForumListStyle.Nested, options); } else { forums.ForumListItemCollection(null, Forums.ForumListStyle.Nested, options); } return(options); }
private void AddDefaultData() { UpdateProgress(0, "Adding default data<br/>"); //Add Admin Account string aUsername = adminUsername.Value ?? "Admin"; string adminpassword = adminPassword.Value ?? "P@ssword01!!"; string adminemail = adminEmail.Value ?? "*****@*****.**"; MembershipCreateStatus status; MembershipUser admin = Membership.GetUser(aUsername); if (admin == null || admin.UserName != aUsername) { admin = Membership.CreateUser(aUsername, adminpassword, adminemail, ".", ".", true, out status); } Membership.UpdateUser(admin); Roles.AddUserToRoles(admin.UserName, new string[] { "Administrator", "Member" }); var newadmin = "UPDATE FORUM_MEMBERS SET M_TITLE='Forum Administrator', M_SUBSCRIPTION=1,M_LEVEL=3,M_STATUS=1,M_HIDE_EMAIL = 1,M_RECEIVE_EMAIL = 1,M_VOTED = 0 WHERE M_NAME='" + aUsername + "'"; Snitz.BLL.Admin.ExecuteScript(newadmin); Snitz.BLL.Admin.ExecuteScript("INSERT INTO FORUM_TOTALS (P_COUNT,P_A_COUNT,T_COUNT,T_A_COUNT,U_COUNT) VALUES (0,0,0,0,1)"); CategoryInfo cat = new CategoryInfo(); ForumInfo forum = new ForumInfo(); TopicInfo topic = new TopicInfo(); cat.Id = -1; cat.Name = "Snitz .Net Forums"; cat.Order = 0; cat.Status = (int)Enumerators.PostStatus.Open; cat.SubscriptionLevel = 0; cat.ModerationLevel = 0; int catid = Categories.AddCategory(cat); forum.CatId = catid; forum.Id = -1; forum.Status = (int)Enumerators.PostStatus.Open; forum.AllowPolls = false; forum.Description = "This forum gives you a chance to become more familiar with how this product responds to different features and keeps testing in one place instead of posting tests all over. Happy Posting! [:)]"; forum.Subject = "Testing Forum"; forum.SubscriptionLevel = 0; forum.ModerationLevel = 0; forum.Order = 0; forum.PostCount = 0; forum.UpdatePostCount = true; int forumid = Forums.SaveForum(forum); topic.CatId = catid; topic.ForumId = forumid; topic.Status = 1; topic.Message = "Thank you for downloading Snitz Forums 2000. We hope you enjoy this great tool to support your organization!" + 0x13 + 0x10 + 0x13 + 0x10 + "Many thanks go out to John Penfold <[email protected]> and Tim Teal <[email protected]> for the original source code and to all the people of Snitz Forums 2000 at http://forum.snitz.com for continued support of this product."; topic.Subject = "Welcome to Snitz .Net Forums"; topic.AuthorId = (int)admin.ProviderUserKey; topic.Date = DateTime.UtcNow; topic.PosterIp = "0.0.0.0"; Topics.Add(topic); }
protected void Page_Load(object sender, EventArgs e) { bool isShowUpgradeInfo = false; string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config"); if (File.Exists(configPath)) { XmlDocumentExtender doc = new XmlDocumentExtender(); doc.Load(configPath); isShowUpgradeInfo = doc.SelectSingleNode("/UserConfig/ShowUpgrade") != null?doc.SelectSingleNode("/UserConfig/ShowUpgrade").InnerText == "1" : false; } else { isShowUpgradeInfo = true; } if (isShowUpgradeInfo) { LoadUpgradeInfo(); } LoadTemplateInfo(); GetStatInfo(); //加载论坛版块信息 forumid.BuildTree(Forums.GetForumListForDataTable(), "name", "fid"); LinkDiscuzVersionPage(); }
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 } }
protected void Page_Load(object sender, EventArgs e) { forum = new Forums(); if (Request["ID"] != null) //check if we have a post to load { loadForumPost(); } else { loadAllTopics(); } }
//click event for adding a comment to a post protected void btnComment_Click(object sender, EventArgs e) { Forums forums = new Forums(); bool success = forums.addComment(Convert.ToInt32(Request["ID"]), Security.getUserName(), txtComment.Text); if (!success) { lblComment.Text = "Sorry, there was an error, please try again!"; } else { topicsPlaceHolder.Controls.Clear(); txtComment.Text = ""; loadForumPost(); } }
//method to add a new forum topic protected void btnNewPost_Click(object sender, EventArgs e) { Forums forums = new Forums(); bool success = forums.addPost(txtNewPost.Text, txtFirstComment.Text, Security.getUserName()); if (success) { topicsPlaceHolder.Controls.Clear(); loadAllTopics(); txtFirstComment.Text = ""; txtNewPost.Text = ""; } else { lblNewPost.Text = "Sorry there was an error. Please try again."; } }
// ********************************************************************* // InitializeSkin // /// <summary> /// Initialize the control template and populate the control with values /// </summary> /// <param name="skin">Control instance of the skin</param> /// // ***********************************************************************/ protected override void InitializeSkin(Control skin) { // Get the post we want to move Post postToMove = Posts.GetPost(PostID, ForumUser.Username); // Display subject subject = (Label)skin.FindControl("Subject"); if (null != subject) { subject.Text = postToMove.Subject; } // Has Replies? hasReplies = (Label)skin.FindControl("HasReplies"); if (null != hasReplies) { if (postToMove.Replies > 0) { hasReplies.Text = "true (" + postToMove.Replies + ") "; } else { hasReplies.Text = "false "; } } // POsted By postedBy = (Label)skin.FindControl("PostedBy"); if (null != postedBy) { postedBy.Text = Users.GetUserInfo(postToMove.Username).DisplayName + " "; } // Body body = (Label)skin.FindControl("Body"); if (null != body) { body.Text = Globals.FormatPostBody(postToMove.Body) + " "; } // Display the move to drop down list moveTo = (DropDownList)skin.FindControl("MoveTo"); if (null != moveTo) { Forums forums = new Forums(); string username = base.ForumUser.Username; moveTo.DataValueField = "Value"; moveTo.DataTextField = "Text"; moveTo.DataSource = forums.ForumListItemCollection(username); moveTo.DataBind(); moveTo.Items.FindByValue("f-" + postToMove.ForumID).Selected = true; } // Cancel cancelMove = (HyperLink)skin.FindControl("CancelMove"); if (null != cancelMove) { cancelMove.NavigateUrl = base.ReturnURL; } // Move Post move = (LinkButton)skin.FindControl("MovePost"); if (null != move) { move.Click += new System.EventHandler(MovePost_Click); } }
public void UpdateForum(Forums f) { throw new NotImplementedException(); }