public ajaxspaceconfigstatic()
		{
			if(Discuz.Common.DNTRequest.GetString("load") =="true")
			{
                __spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(spaceconfiginfo.UserID);
			}
		}
Exemplo n.º 2
0
		public moregadgets()
		{
			if (this.userid < 1)
			{
				HttpContext.Current.Response.Redirect(forumurlnopage + "/login.aspx?reurl=space");
				return;
			}
			GetOnlineUserInfo();

#if NET1			
            TabInfoCollection tc = Spaces.GetTabInfoCollectionByUserID(this.userid);
#else
            Discuz.Common.Generic.List<TabInfo> tc = Spaces.GetTabInfoCollectionByUserID(this.userid);
#endif
			
            currentUserSpaceConfig = Spaces.GetSpaceConfigByUserId(this.userid);
			int defaultTabId = Spaces.GetDefaultTabId(currentUserSpaceConfig, tc);
			string html = StaticFileProvider.GetContent(templatePath + "moregadgets.htm");
			TemplateEngine te = new TemplateEngine();
			te.Init(html, templatePath);
			te.Put("tabid", defaultTabId);
			te.Put("forumpath", BaseConfigs.GetForumPath);
			te.Put("config", currentUserSpaceConfig);
			te.Put("username", this.olusername);
			te.Put("userid", this.oluserid);
			te.Put("userkey", oluserkey);
            te.Put("forumurlnopage", forumurlnopage);
			double processtime = new TimeSpan(DateTime.Now.Ticks).Subtract(begints).Duration().TotalSeconds;
			te.Put("processtime", processtime);
			html = te.MergeTemplate();
			HttpContext.Current.Response.Clear();
			HttpContext.Current.Response.Write(html);
			HttpContext.Current.Response.End();
		}
Exemplo n.º 3
0
		/// <summary>
		/// 通过数据读取获得当前用户的个性化设置
		/// </summary>
		/// <param name="datareader">数据读取</param>
		/// <returns></returns>
		public static SpaceConfigInfo GetSpaceConfigInfo(int userid)
		{
            IDataReader idatareader = DbProvider.GetInstance().GetSpaceConfigDataByUserID(userid);
		
			if(idatareader.Read())
			{
				SpaceConfigInfo spaceconfiginfo = new SpaceConfigInfo();
				spaceconfiginfo.SpaceID = TypeConverter.ObjectToInt(idatareader["spaceid"]);
				spaceconfiginfo.UserID = TypeConverter.ObjectToInt(idatareader["userid"]);
				spaceconfiginfo.Spacetitle = idatareader["spacetitle"].ToString().Trim();
				spaceconfiginfo.Description = idatareader["description"].ToString().Trim();
				spaceconfiginfo.BlogDispMode = TypeConverter.ObjectToInt(idatareader["blogdispmode"]);
				spaceconfiginfo.Bpp = TypeConverter.ObjectToInt(idatareader["bpp"]);
				spaceconfiginfo.Commentpref = TypeConverter.ObjectToInt(idatareader["commentpref"]);
				spaceconfiginfo.MessagePref = TypeConverter.ObjectToInt(idatareader["messagepref"]);
				spaceconfiginfo.Rewritename = idatareader["rewritename"].ToString();
				spaceconfiginfo.ThemeID = TypeConverter.ObjectToInt(idatareader["themeid"]);
				spaceconfiginfo.ThemePath = idatareader["themepath"].ToString().Trim();
				spaceconfiginfo.PostCount = TypeConverter.ObjectToInt(idatareader["postcount"]);
				spaceconfiginfo.CommentCount = TypeConverter.ObjectToInt(idatareader["commentcount"]);
				spaceconfiginfo.VisitedTimes = TypeConverter.ObjectToInt(idatareader["visitedtimes"]);
				spaceconfiginfo.CreateDateTime = Convert.ToDateTime(idatareader["createdatetime"]);
				spaceconfiginfo.UpdateDateTime = Convert.ToDateTime(idatareader["updatedatetime"]);
				spaceconfiginfo.DefaultTab = TypeConverter.ObjectToInt(idatareader["defaulttab"]);
				spaceconfiginfo.Status = (SpaceStatusType) TypeConverter.ObjectToInt(idatareader["status"]);
				idatareader.Close();
				return spaceconfiginfo;
			}
			else
			{
                idatareader.Close();
				return null;
			}
		}
Exemplo n.º 4
0
		public static SpaceConfigInfo[] GetSpaceConfigInfoArray(DataTable dt)
		{
			if(dt == null || dt.Rows.Count == 0)
				return null;

			SpaceConfigInfo[] spaceconfiginfoarray = new SpaceConfigInfo[dt.Rows.Count];
			for(int i = 0 ; i < dt.Rows.Count ; i++)
			{
				spaceconfiginfoarray[i] = new SpaceConfigInfo();
				spaceconfiginfoarray[i].SpaceID = TypeConverter.ObjectToInt(dt.Rows[i]["spaceid"]);
				spaceconfiginfoarray[i].UserID = TypeConverter.ObjectToInt(dt.Rows[i]["userid"]);
				spaceconfiginfoarray[i].Spacetitle = dt.Rows[i]["spacetitle"].ToString();
				spaceconfiginfoarray[i].Description = dt.Rows[i]["description"].ToString();
				spaceconfiginfoarray[i].BlogDispMode = TypeConverter.ObjectToInt(dt.Rows[i]["blogdispmode"]);
				spaceconfiginfoarray[i].Bpp = TypeConverter.ObjectToInt(dt.Rows[i]["bpp"]);
				spaceconfiginfoarray[i].Commentpref = TypeConverter.ObjectToInt(dt.Rows[i]["commentpref"]);
				spaceconfiginfoarray[i].MessagePref = TypeConverter.ObjectToInt(dt.Rows[i]["messagepref"]);
				spaceconfiginfoarray[i].Rewritename = dt.Rows[i]["rewritename"].ToString();
				spaceconfiginfoarray[i].ThemeID = TypeConverter.ObjectToInt(dt.Rows[i]["themeid"]);
				spaceconfiginfoarray[i].ThemePath = dt.Rows[i]["themepath"].ToString();
				spaceconfiginfoarray[i].PostCount = TypeConverter.ObjectToInt(dt.Rows[i]["postcount"]);
				spaceconfiginfoarray[i].CommentCount = TypeConverter.ObjectToInt(dt.Rows[i]["commentcount"]);
				spaceconfiginfoarray[i].VisitedTimes = TypeConverter.ObjectToInt(dt.Rows[i]["visitedtimes"]);
				spaceconfiginfoarray[i].CreateDateTime = Convert.ToDateTime(dt.Rows[i]["createdatetime"]);
				spaceconfiginfoarray[i].UpdateDateTime = Convert.ToDateTime(dt.Rows[i]["updatedatetime"]);
				spaceconfiginfoarray[i].Status = (SpaceStatusType) TypeConverter.ObjectToInt(dt.Rows[i]["status"]);
			}

			dt.Dispose();
			return spaceconfiginfoarray;
		}
Exemplo n.º 5
0
		public SpaceBasePage()
		{ 
			OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
			olid = oluserinfo.Olid;
			userid = oluserinfo.Userid;	
			username = oluserinfo.Username;            
		
			if(DNTRequest.GetInt("postid",0) > 0)
			{
				SpacePostInfo spacePostInfo =  BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(DNTRequest.GetInt("postid",0)));
				spaceuid = spacePostInfo != null? spacePostInfo.Uid:0;
			}			
			
			if(spaceuid > 0)
			{
				spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(spaceuid);
				spaceid = spaceconfiginfo.SpaceID;
			}
			else
			{
				if(spaceid > 0)
				{
                    spaceuid = BlogProvider.GetUidBySpaceid(spaceid.ToString());
                    spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(spaceuid);
				}
			}

			if(spaceconfiginfo == null)
			{
				spaceconfiginfo = new SpaceConfigInfo();
				spaceconfiginfo.Status = SpaceStatusType.AdminClose;
			}

			if(spaceconfiginfo.Status != SpaceStatusType.Natural)
				Context.Response.Redirect("index.aspx");

            spaceurl = Utils.GetRootUrl(BaseConfigs.GetForumPath) + "space/";

            if (SpaceActiveConfigs.GetConfig().Enablespacerewrite > 0 && spaceconfiginfo.Rewritename != string.Empty)
                spaceurl += spaceconfiginfo.Rewritename;
            else
                spaceurl += "?uid=" + spaceconfiginfo.UserID;

            //去掉http地址中的文件名称
            if (forumurl.ToLower().IndexOf("http://") == 0)
                forumurlnopage = forumurl.Substring(0, forumurl.LastIndexOf('/')) + "/";
            else
                forumurl = "../" + config.Forumurl;
		}
Exemplo n.º 6
0
		public DiscuzSpaceUCBase()
		{
			OnlineUserInfo oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
			olid = oluserinfo.Olid;         
            userid = oluserinfo.Userid;
			username = oluserinfo.Username;
			_userinfo = Users.GetUserInfo(userid);
			
			if(DNTRequest.GetInt("postid",0) > 0)
			{
				SpacePostInfo __spacepostinfo =  BlogProvider.GetSpacepostsInfo(Space.Data.DbProvider.GetInstance().GetSpacePost(DNTRequest.GetInt("postid",0)));
				spaceuid = __spacepostinfo != null? __spacepostinfo.Uid:0;
			}			
			
			if(spaceuid > 0)
			{
                spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(spaceuid);
				spaceid = spaceconfiginfo.SpaceID;
			}
			else
			{
				if(spaceid > 0)
				{
                    spaceuid=BlogProvider.GetUidBySpaceid(spaceid.ToString());
                    spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(spaceuid);
				}
			}

			if(spaceconfiginfo == null)
				spaceconfiginfo = new SpaceConfigInfo();

			pagesize = spaceconfiginfo.Bpp;
            //去掉http地址中的文件名称
            if (forumurl.ToLower().IndexOf("http://") == 0)
                forumurlnopage = forumurl.Substring(0, forumurl.LastIndexOf('/')) + "/";
            else
                forumurl = "../" + forumurl;

            if (configspaceurlnopage.ToLower().IndexOf("http://") < 0)
                configspaceurlnopage = forumurlnopage;
            else
                configspaceurlnopage = configspaceurlnopage.ToLower().Substring(0, configspaceurlnopage.LastIndexOf('/')) + "/" ;
		}
Exemplo n.º 7
0
		/// <summary>
		/// 建议用户space信息
		/// </summary>
		/// <param name="spaceconfiginfo"></param>
		/// 
		/// <returns></returns>
		public int AddSpaceConfigData(SpaceConfigInfo spaceconfiginfo)
		{
			//try
			//{
			IDataParameter[] prams = 
				{
					DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4,spaceconfiginfo.UserID),
					DbHelper.MakeInParam("@spacetitle", (DbType)SqlDbType.NChar, 100,spaceconfiginfo.Spacetitle),
					DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceconfiginfo.Description),
					DbHelper.MakeInParam("@blogdispmode", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.BlogDispMode),
					DbHelper.MakeInParam("@bpp", (DbType)SqlDbType.Int, 4,spaceconfiginfo.Bpp),
					DbHelper.MakeInParam("@commentpref", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.Commentpref),
					DbHelper.MakeInParam("@messagepref", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.MessagePref),
					DbHelper.MakeInParam("@rewritename", (DbType)SqlDbType.Char, 100,spaceconfiginfo.Rewritename),
					DbHelper.MakeInParam("@themeid", (DbType)SqlDbType.Int, 4,spaceconfiginfo.ThemeID),
					DbHelper.MakeInParam("@themepath", (DbType)SqlDbType.NChar, 50,spaceconfiginfo.ThemePath),
					DbHelper.MakeInParam("@postcount", (DbType)SqlDbType.Int, 4,spaceconfiginfo.PostCount),
					DbHelper.MakeInParam("@commentcount", (DbType)SqlDbType.Int, 4,spaceconfiginfo.CommentCount),
					DbHelper.MakeInParam("@visitedtimes", (DbType)SqlDbType.Int, 4,spaceconfiginfo.VisitedTimes),
					DbHelper.MakeInParam("@createdatetime", (DbType)SqlDbType.SmallDateTime, 4,spaceconfiginfo.CreateDateTime),
					DbHelper.MakeInParam("@updatedatetime", (DbType)SqlDbType.SmallDateTime, 4,spaceconfiginfo.UpdateDateTime),
					DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Status),
			};
			string sqlstring = String.Format("INSERT INTO [" + BaseConfigs.GetTablePrefix + "spaceconfigs] ([userid], [spacetitle], [description], [blogdispmode], [bpp], [commentpref], [messagepref], [rewritename], [themeid], [themepath], [postcount], [commentcount], [visitedtimes], [createdatetime], [updatedatetime]) VALUES (@userid, @spacetitle, @description, @blogdispmode, @bpp, @commentpref, @messagepref, @rewritename, @themeid, @themepath, @postcount, @commentcount, @visitedtimes, @createdatetime, @updatedatetime);SELECT SCOPE_IDENTITY()");

			return Utils.StrToInt(DbHelper.ExecuteScalar(CommandType.Text, sqlstring, prams), 0);
			//}
			//catch (Exception ex)
			//{
			//    errormsg = Globals.TransferSqlErrorInfo(ex.Message);
			//    return 0;
			//}
		}
Exemplo n.º 8
0
		/// <summary>
		/// 保存用户space配置信息
		/// </summary>
		/// <param name="spaceconfiginfo"></param>
		/// 
		/// <returns></returns>
		public bool SaveSpaceConfigData(SpaceConfigInfo spaceconfiginfo)
		{
			//try
			//{
			IDataParameter[] prams = {
									  DbHelper.MakeInParam("@spacetitle", (DbType)SqlDbType.NVarChar, 100, spaceconfiginfo.Spacetitle),
									  DbHelper.MakeInParam("@description", (DbType)SqlDbType.NVarChar, 200, spaceconfiginfo.Description),
									  DbHelper.MakeInParam("@blogdispmode", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.BlogDispMode),
									  DbHelper.MakeInParam("@bpp", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Bpp),
									  DbHelper.MakeInParam("@commentpref", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.Commentpref),
									  DbHelper.MakeInParam("@messagepref", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.MessagePref),
									  //DbHelper.MakeInParam("@rewritename", (DbType)SqlDbType.VarChar, 100, spaceconfiginfo.Rewritename),
									  DbHelper.MakeInParam("@themeid", (DbType)SqlDbType.Int, 4, spaceconfiginfo.ThemeID),
									  DbHelper.MakeInParam("@themepath", (DbType)SqlDbType.NChar, 50, spaceconfiginfo.ThemePath),
									  DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Status),
									  DbHelper.MakeInParam("@updatedatetime", (DbType)SqlDbType.SmallDateTime, 4, DateTime.Now),
										   
									  //DbHelper.MakeInParam("@defaulttab", (DbType)SqlDbType.Int, 4, DateTime.Now),
										   
									  DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4, spaceconfiginfo.UserID)
								  };
			string sqlstring = "UPDATE [" + BaseConfigs.GetTablePrefix + "spaceconfigs] SET [spacetitle] = @spacetitle ,[description] = @description,[blogdispmode] = @blogdispmode,[bpp] = @bpp, [commentpref] = @commentpref, [messagepref] = @messagepref, [themeid]=@themeid,[themepath] = @themepath, [updatedatetime] = @updatedatetime WHERE [userid] = @userid";
			DbHelper.ExecuteNonQuery(CommandType.Text, sqlstring, prams);
			return true;
			//}
			//catch (Exception ex)
			//{
			//    errormsg = Globals.TransferSqlErrorInfo(ex.Message);
			//    return false;
			//}
		}
Exemplo n.º 9
0
        protected override void ShowPage()
        {
            pagetitle = "用户控制面板";

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }
            user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }
            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

            enabletag = config.Enabletag == 1;
            categoryslist = Space.Data.DbProvider.GetInstance().GetSpaceCategoryListByUserId(userid);
            spaceconfig = Spaces.GetSpaceConfigByUserId(userid);
            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (!Utils.IsNumeric(DNTRequest.GetString("poststatus")) || !Utils.IsNumeric(DNTRequest.GetString("commentstatus")))
                {
                    AddErrLine("请您确保 发布类型,评论类型,数据项有效!");
                    return;
                }
                if (DNTRequest.GetString("title") == "")
                {
                    AddErrLine("请您输入文章标题");
                    return;
                }
                if (DNTRequest.GetString("title").Length > 150)
                {
                    AddErrLine("请将文章标题保持在150字以内");
                    return;
                }
                if (blogcontent == "")
                {
                    AddErrLine("请您输入文章内容");
                    return;
                }

                SpacePostInfo spacepostsinfo = new SpacePostInfo();
                spacepostsinfo.Title = Utils.HtmlEncode(ForumUtils.BanWordFilter(DNTRequest.GetString("title")));
                spacepostsinfo.Content = Utils.HtmlEncode(ForumUtils.BanWordFilter(blogcontent));
                spacepostsinfo.Category = DNTRequest.GetString("category");
                spacepostsinfo.PostStatus = DNTRequest.GetFormInt("poststatus", 0);
                spacepostsinfo.CommentStatus = DNTRequest.GetFormInt("commentstatus", 0);
                spacepostsinfo.Postdatetime = DateTime.Now;
                spacepostsinfo.Author = username;
                spacepostsinfo.Uid = userid;
                spacepostsinfo.PostUpDateTime = DateTime.Now;
                spacepostsinfo.Commentcount = 0;

                int postid = Space.Data.DbProvider.GetInstance().AddSpacePost(spacepostsinfo);

                //启用了标签功能
                if (enabletag)
                {
                    string tags = DNTRequest.GetString("tags").Trim();
                    string[] tagsArray = null;
                    if (!Utils.StrIsNullOrEmpty(tags))
                    {
                        tagsArray = Utils.SplitString(tags, " ", true, 10);
                        if (tagsArray != null && tagsArray.Length > 0)
                        {
                            Space.Data.DbProvider.GetInstance().CreateSpacePostTags(string.Join(" ", tagsArray), postid, userid, Utils.GetDateTime());
                            SpaceTags.WriteSpacePostTagsCacheFile(postid);
                        }
                    }
                }
                DNTCache.GetCacheService().RemoveObject("/Space/RecentUpdateSpaceAggregationList");
                SetUrl("usercpspacemanageblog.aspx");
                SetMetaRefresh();
                SetShowBackLink(true);
                AddMsgLine("文章增加成功");
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 获得用户的默认TabID
        /// </summary>
        /// <param name="spaceConfig">用户的空间设置</param>
        /// <param name="tc">Tab集合</param>
        /// <returns>TabID</returns>
        public static int GetDefaultTabId(SpaceConfigInfo spaceConfig, Discuz.Common.Generic.List<TabInfo> tc)
		{
			if (tc == null)
				return 0;

			int defaulttabid = 0;
			if (tc.Count > 0)
				defaulttabid = tc[tc.Count - 1].TabID;

			foreach (TabInfo tab in tc)
			{
				if (tab.TabID == spaceConfig.DefaultTab)
				{
					defaulttabid = tab.TabID;
					break;
				}
			}
			return defaulttabid;
		}
Exemplo n.º 11
0
		/// <summary>
		/// 输出页面
		/// </summary>
		private void OutputSpacePage()
		{
			string root = BaseConfigs.GetForumPath;    
            string user = DNTRequest.GetQueryString("user");   
			int currentuid = DNTRequest.GetQueryInt("uid", -1);
			if (currentuid < 1)
			{
                if (user != string.Empty)
                    currentuid = Users.GetUserIdByRewriteName(user);

                if (currentuid < 1)
                    currentuid = this.userid;
			}

			if (userid > 0)
			{
				isLogged = true;
				if (userid == currentuid)
					spaceEditable = true;
			}

            if (currentuid < 1 && this.userid < 1)
                HttpContext.Current.Response.Redirect(forumurlnopage + "login.aspx?reurl=space");
            else//对用户空间访问量加1
                Data.DbProvider.GetInstance().CountUserSpaceVisitedTimesByUserID(currentuid);

			int currenttabid = DNTRequest.GetQueryInt("tab", 0);
			spaceConfig = Spaces.GetSpaceConfigByUserId(currentuid);
            ShortUserInfo sui = Users.GetShortUserInfo(currentuid);

            if (spaceConfig == null || sui == null || spaceConfig.Status != SpaceStatusType.Natural || sui.Spaceid <= 0)
			{
                if (userid == currentuid && userid > 0)
                    HttpContext.Current.Response.Redirect(forumurlnopage + "spaceregister.aspx");
                else
                {
                    HttpContext.Current.Response.Clear();
                    HttpContext.Current.Response.Write("<script>alert('当前用户未开通" + spacename + "!');document.location = '" + forumurl + "';</script>");
                    HttpContext.Current.Response.End();
                }
				return;
			}
            
            Discuz.Common.Generic.List<TabInfo> tc = Spaces.GetTabInfoCollectionByUserID(currentuid);
			if (tc == null)
                tc = new Discuz.Common.Generic.List<TabInfo>();

			int defaulttabid = 0;
			if (tc.Count > 0)
			{
                //此处修改为始终显示第一个tab
				//defaulttabid = tc[tc.Count - 1].TabID;
                defaulttabid = tc[0].TabID;
                spaceConfig.DefaultTab = defaulttabid;
			}

			StringBuilder tabsHtml = new StringBuilder();
            TabInfo currentTab = null;

            foreach (TabInfo tab in tc)
            {
                if (tab.TabID == (currenttabid == 0 ? spaceConfig.DefaultTab : currenttabid))
                {
                    defaulttabid = tab.TabID;
                    break;
                }
            }            

			foreach (TabInfo tab in tc)
			{
				tabsHtml.Append("<li class=\"tab unselectedtab_l\">&nbsp;</li>");
				if (tab.TabID == defaulttabid)
				{
					currentTab = tab;
					string tabformat = "";
					if (spaceEditable)
					{
						tabformat += @"<li id=""tab{0}_edit"" class=""tab edittab selectedtab"" style=""display:none"" onclick=""_gel('tab{0}_title').focus();"" onmouseover=""_disable_onblur=true;"" onmouseout=""_disable_onblur=false;""><script>_disable_onblur = false;</script><form id=""tab{0}_rename_form"" name=""tab{0}_rename_form"" onsubmit=""return _renameTab();""><span><input id=""tab{0}_title"" name=""tab_title"" value=""{1}"" onblur=""_disable_onblur ? void(0) : _renameTab();"">";
						if (tc.Count > 1)
							tabformat += @"<a href=""#"" onclick=""if (confirm('您确定要删除 &quot;TAB_NAME&quot; 页面及其所有内容吗?'.replace('TAB_NAME', _editedTabName()))) {{_dlsetp('dt={0}');}}return false;""><img src=""" + BaseConfigs.GetForumPath + "space/images/clear.gif\" border=\"0\" /></a>";

                        tabformat += "</span></form></li>";
					}
					tabformat += @"<li id=""tab{0}_view"" class=""tab selectedtab"" style=""display:block"" ";
					if (spaceEditable)
						tabformat += @"onclick=""_editTab('{0}')"" title=""单击修改页面名称""";

                    tabformat += @"><span id=""tab{0}_view_title"">{1}</span></li>";
					tabsHtml.AppendFormat(tabformat, tab.TabID, tab.TabName);
				}
				else
				{
					string tabformat = "<li id=\"tab{0}_view\" class=\"tab unselectedtab\" style=\"display:block\" onclick=\"";
					tabformat += "document.location=ds_i()+'tab={0}'";
					tabformat += "\"><span id=\"tab{0}_view_title\">{1}</span></li>";
					tabsHtml.AppendFormat(/*"<li id=\"tab{0}_view\" class=\"tab unselectedtab\" style=\"display:block\" onclick=\"_dlsetp('ct={0}')\"><span id=\"tab{0}_view_title\">{1}</span></li>"*/tabformat, tab.TabID, tab.TabName);
				}
				tabsHtml.Append("<li class=\"tab unselectedtab_r\">&nbsp;</li>");
			}

			// for test use the specific template
			string template = "";
			string tempPath = "";
			if (currentTab != null && currentTab.Template != string.Empty)
				tempPath = Utils.GetMapPath(root + "/space/skins/templates/" + currentTab.Template + "");

            if (currentTab == null || currentTab.Template == string.Empty || !File.Exists(tempPath))
				template = "<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" align=\"center\" id=\"t_1\"><tr><td style=\"width: 67%;\" id=\"col_1\" class=\"col\">{pane1}</td></tr></table><script>alert('您选择的板式不存在或者已经被删除,请重新选择板式。');</script>";
			else
				template = StaticFileProvider.GetContent(tempPath);

            Discuz.Common.Generic.List<ModuleInfo> mc = Spaces.GetModuleCollectionByTabId(defaulttabid, currentuid);

			template = ParseModules(mc, template);

			Hashtable ht = new Hashtable();
			ht.Add("modules", template);
			ht.Add("islogged", isLogged);
			ht.Add("editable", spaceEditable);
			ht.Add("userkey", this.userkey);
			ht.Add("username", this.username);
			ht.Add("userid", this.userid);
			ht.Add("config", spaceConfig);
			ht.Add("tabs", tabsHtml.ToString());
			if (currentTab != null)
				ht.Add("currenttab", currentTab);

            ht.Add("tabid", defaulttabid);
			ht.Add("tabcount", tc.Count);
			ht.Add("can_be_added", tc.Count < 5 && spaceEditable);
            ht.Add("footer", SpaceActiveConfigs.GetConfig().SpaceFooterInfo);
            ht.Add("forumpath", BaseConfigs.GetForumPath);
       
            //在模板中设置相册名称变量
            ht.Add("spacename", spacename);

            ht.Add("albumname", albumname);


            if (configspaceurl.ToLower().IndexOf("http://") < 0)
            {
                configspaceurl = forumurlnopage + configspaceurl;
            }
            ht.Add("configspaceurl", configspaceurl);

            if (configspaceurl.ToLower().IndexOf("http://") < 0)
                configspaceurlnopage = forumurlnopage;
            else
                configspaceurlnopage = configspaceurl.Substring(0, configspaceurl.LastIndexOf('/')) + "/";

            ht.Add("configspaceurlnopage", configspaceurlnopage);
          
            //获取配置文件中的space空间路径
            string spaceurl = GeneralConfigs.GetConfig().Spaceurl;
            if (spaceurl.ToLower().IndexOf("http://") == 0)
                spaceurl = spaceurl.Substring(0, spaceurl.LastIndexOf('/')) + "/space/" ;
            else
            {
                //从当前的URL请求中获取相关站点及(虚拟)路径信息
                spaceurl = HttpContext.Current.Request.Url.ToString();
                spaceurl = spaceurl.Substring(0, spaceurl.LastIndexOf('/')) + "/";
            }
            if (config.Enablespacerewrite > 0 && spaceConfig.Rewritename != string.Empty)
                spaceurl += spaceConfig.Rewritename;
            else
                spaceurl += "?uid=" + spaceConfig.UserID;

            ht.Add("spaceurl", spaceurl);

            if (configalbumurl.ToLower().IndexOf("http://") < 0)
                configalbumurl = forumurlnopage + configalbumurl;

            ht.Add("configalbumurl", configalbumurl);
            ht.Add("forumurl", forumurl);
            ht.Add("forumurlnopage", forumurlnopage);
            ht.Add("editbar", EditbarTemplate.Instance.GetHtml(ht));

            string content = MainTemplate.Instance.GetHtml(ht);
			HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.Write(content.Replace("IG_", "DS_").Replace("ig_", "dnt_"));
			HttpContext.Current.Response.End();

		}
Exemplo n.º 12
0
        protected override void ShowPage()
        {
            pagetitle = string.Format("激活{0}", config.Spacename);

            if (userid == -1)
            {
                AddErrLine("你尚未登录");
                return;
            }

            UserInfo user = Users.GetUserInfo(userid);

            if (config.Enablespace != 1)
            {
                AddErrLine(string.Format("{0}功能已被关闭", config.Spacename));
                return;
            }

            bool isactivespace = false;
            bool isallowapply = true;
            if (user.Spaceid > 0)
                isactivespace = true;
            else
            {
                if (user.Spaceid < 0)
                    isallowapply = false;
                else
                {
                    if (spaceactiveconfig.AllowPostcount == "1" || spaceactiveconfig.AllowDigestcount == "1" ||
                        spaceactiveconfig.AllowScore == "1" || spaceactiveconfig.AllowUsergroups == "1")
                    {
                        if (spaceactiveconfig.AllowPostcount == "1")
                            isallowapply = isallowapply && (Convert.ToInt32(spaceactiveconfig.Postcount) <= user.Posts);
                        if (spaceactiveconfig.AllowDigestcount == "1")
                            isallowapply = isallowapply &&
                                           (Convert.ToInt32(spaceactiveconfig.Digestcount) <= user.Digestposts);
                        if (spaceactiveconfig.AllowScore == "1")
                            isallowapply = isallowapply && (Convert.ToInt32(spaceactiveconfig.Score) <= user.Credits);
                        if (spaceactiveconfig.AllowUsergroups == "1")
                            isallowapply = isallowapply &&
                                           (("," + spaceactiveconfig.Usergroups + ",").IndexOf("," + user.Groupid + ",") !=
                                            -1);
                    }
                    else
                        isallowapply = false;
                }
            }

            if (isactivespace)
            {
                AddErrLine("您已经申请过个人空间!");
                return;
            }
            if (!isallowapply)
            {
                AddErrLine("您未被允许申请个人空间!");
                return;
            }

            if (DNTRequest.IsPost())
            {
                if (ForumUtils.IsCrossSitePost())
                {
                    AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
                    return;
                }
                if (DNTRequest.GetString("spacetitle").Length > 100)
                {
                    AddErrLine("个人空间标题不得超过100个字符");
                    return;
                }
                if (DNTRequest.GetString("description").Length > 200)
                {
                    AddErrLine("个人空间描述不得超过200个字符");
                    return;
                }
                if (DNTRequest.GetInt("bpp", 0) == 0)
                {
                    AddErrLine("显示日志篇数必需是一个大于0的数字");
                    return;
                }

                if (page_err == 0)
                {
                    DataRow dr = DbProvider.GetInstance().GetThemes();
                    spaceconfiginfo = new SpaceConfigInfo();
                    spaceconfiginfo.UserID = userid;
                    spaceconfiginfo.Spacetitle = DNTRequest.GetHtmlEncodeString("spacetitle");
                    spaceconfiginfo.Description = DNTRequest.GetHtmlEncodeString("description");
                    spaceconfiginfo.BlogDispMode = DNTRequest.GetInt("blogdispmode", 0);
                    spaceconfiginfo.Bpp = DNTRequest.GetInt("bpp", 0);
                    spaceconfiginfo.Commentpref = DNTRequest.GetInt("commentpref", 0);
                    spaceconfiginfo.MessagePref = DNTRequest.GetInt("messagepref", 0);
                    spaceconfiginfo.UpdateDateTime = spaceconfiginfo.CreateDateTime = DateTime.Now;
                    string rewritename = DNTRequest.GetFormString("rewritename").Trim();
                    if (rewritename != string.Empty)
                    {
                        if (Globals.CheckSpaceRewriteNameAvailable(rewritename) == 0)
                            spaceconfiginfo.Rewritename = rewritename;
                        else
                        {
                            AddErrLine("您输入的 个性域名 不可用或含有非法字符");
                            return;
                        }
                    }
                    else
                        spaceconfiginfo.Rewritename = "";

                    spaceconfiginfo.ThemeID = int.Parse(dr["themeid"].ToString());
                    spaceconfiginfo.ThemePath = dr["directory"].ToString();
                    spaceconfiginfo.PostCount = 0;
                    spaceconfiginfo.CommentCount = 0;
                    spaceconfiginfo.VisitedTimes = 0;
                    spaceconfiginfo.DefaultTab = 0;

                    string errorinfo = "";
                    int blogid = DbProvider.GetInstance().AddSpaceConfigData(spaceconfiginfo);
                    Users.UpdateUserSpaceId(-blogid, userid);

                    SpaceActiveConfigInfo _spaceconfiginfo = SpaceActiveConfigs.GetConfig();
                    if (_spaceconfiginfo.ActiveType == "0")
                    {
                        if (errorinfo == "")
                        {
                            SetUrl("index.aspx");
                            SetMetaRefresh();
                            SetShowBackLink(true);
                            AddMsgLine("您的申请已经提交,请等待管理员开通您的个人空间");
                        }
                        else
                        {
                            AddErrLine(errorinfo);
                            return;
                        }
                    }
                    else
                    {
                        Discuz.Data.DatabaseProvider.GetInstance().UpdateUserSpaceId(userid);
                        int tabid = Spaces.GetNewTabId(userid);
                        TabInfo tab = new TabInfo();
                        tab.TabID = tabid;
                        tab.UserID = userid;
                        tab.DisplayOrder = 0;
                        tab.TabName = "首页";
                        tab.IconFile = "";
                        tab.Template = "template_25_75.htm";
                        Spaces.AddTab(tab);
                        Spaces.AddLocalModule("builtin_calendarmodule.xml", userid, tabid, 1);
                        Spaces.AddLocalModule("builtin_statisticmodule.xml", userid, tabid, 1);
                        Spaces.AddLocalModule("builtin_postlistmodule.xml", userid, tabid, 2);
                        if (SpaceActiveConfigs.GetConfig().Spacegreeting != string.Empty)
                        {
                            SpacePostInfo spacepostsinfo = new SpacePostInfo();
                            spacepostsinfo.Title = string.Format("欢迎使用 {0} 个人空间", config.Forumtitle);
                            spacepostsinfo.Content = SpaceActiveConfigs.GetConfig().Spacegreeting;
                            spacepostsinfo.Category = string.Empty;
                            spacepostsinfo.PostStatus = 1;
                            spacepostsinfo.CommentStatus = 0;
                            spacepostsinfo.Postdatetime = DateTime.Now;
                            spacepostsinfo.Author = username;
                            spacepostsinfo.Uid = userid;
                            spacepostsinfo.PostUpDateTime = DateTime.Now;
                            spacepostsinfo.Commentcount = 0;
                            DbProvider.GetInstance().AddSpacePost(spacepostsinfo);
                        }
                        
                        ///添加最新主题到日志
                        List<TopicInfo> list = Topics.GetTopicsByUserId(userid, 1, config.Topictoblog, 0, 0);
                        foreach (TopicInfo mytopic in list)
                        {
                            int pid = Posts.GetFirstPostId(mytopic.Tid);
                            PostInfo post = Posts.GetPostInfo(mytopic.Tid, pid);
                            if (post != null && post.Message.Trim() != string.Empty)
                            {
                                SpacePostInfo spacepost = new SpacePostInfo();
                                spacepost.Author = username;
                                string content = Posts.GetPostMessageHTML(post, new AttachmentInfo[0]);
                                spacepost.Category = "";
                                spacepost.Content = content;
                                spacepost.Postdatetime = DateTime.Now;
                                spacepost.PostStatus = 1;
                                spacepost.PostUpDateTime = DateTime.Now;
                                spacepost.Title = post.Title;
                                spacepost.Uid = userid;
                                DbProvider.GetInstance().AddSpacePost(spacepost);
                            }
                        }
						SetUrl("space/");
						SetMetaRefresh();
						SetShowBackLink(true);
						AddMsgLine("恭喜您,您的个人空间已经被开通");
					}
				}
			}
			else
				spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);
		}	
Exemplo n.º 13
0
        protected override void ShowPage()
		{
			pagetitle = "用户控制面板";			
			if (userid == -1)
			{
				AddErrLine("你尚未登录");				
				return;
			}

			user = Users.GetUserInfo(userid);
            if (config.Enablespace != 1)
            {
                AddErrLine("个人空间功能已被关闭");
                return;
            }
            if (user.Spaceid <= 0)
            {
                AddErrLine("您尚未开通个人空间");
                return;
            }

			if(DNTRequest.IsPost())
			{
				if (ForumUtils.IsCrossSitePost())
				{
					AddErrLine("您的请求来路不正确,无法提交。如果您安装了某种默认屏蔽来路信息的个人防火墙软件(如 Norton Internet Security),请设置其不要禁止来路信息后再试。");
					return;
				}
				if (DNTRequest.GetString("spacetitle").Length > 100)		
				{
					AddErrLine("BLOG标题不得超过100个字符");
					return;
				}
				if (DNTRequest.GetString("_description").Length > 200)		
				{
					AddErrLine("空间描述不得超过200个字符");
					return;
				}	

				if (page_err == 0)
				{
					spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);
					spaceconfiginfo.UserID = userid;
					spaceconfiginfo.Spacetitle = Utils.HtmlEncode(DNTRequest.GetString("spacetitle"));
					spaceconfiginfo.Description = Utils.HtmlEncode(DNTRequest.GetString("_description"));
					spaceconfiginfo.BlogDispMode = DNTRequest.GetInt("blogdispmode",0);
					spaceconfiginfo.Bpp = DNTRequest.GetInt("bpp",0);
					spaceconfiginfo.Commentpref = DNTRequest.GetInt("commentpref",0);
					spaceconfiginfo.MessagePref =DNTRequest.GetInt("messagepref", 0);

                    if (spaceactiveconfig.Enablespacerewrite == 1)
                    {
                        string rewritename = DNTRequest.GetFormString("rewritename").Trim();

                        if (!Utils.StrIsNullOrEmpty(rewritename))
                        {
                            if (Globals.CheckSpaceRewriteNameAvailable(rewritename) == 0)
                                Space.Data.DbProvider.GetInstance().UpdateUserSpaceRewriteName(userid, rewritename);
                            else
                            {
                                AddErrLine("您输入的 个性域名 不可用或含有非法字符");
                                return;
                            }
                        }
                    }
			
					string errorinfo = "";
					Space.Data.DbProvider.GetInstance().SaveSpaceConfigData(spaceconfiginfo);		
					if(errorinfo=="")
					{
						SetShowBackLink(true);
						AddMsgLine("个人空间基本设置完毕");
					}
					else
					{
						AddErrLine(errorinfo);
						return;
					}
				}
			}
			else
			{
                spaceconfiginfo = BlogProvider.GetSpaceConfigInfo(userid);	
			}
		}	
Exemplo n.º 14
0
        /// <summary>
        /// 建议用户space信息
        /// </summary>
        /// <param name="spaceconfiginfo"></param>
        /// 
        /// <returns></returns>
        public int AddSpaceConfigData(SpaceConfigInfo spaceconfiginfo)
        {
            DbParameter[] parms = 
				{
					DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4,spaceconfiginfo.UserID),
					DbHelper.MakeInParam("@spacetitle", (DbType)SqlDbType.NChar, 100,spaceconfiginfo.Spacetitle),
					DbHelper.MakeInParam("@description", (DbType)SqlDbType.NChar, 200,spaceconfiginfo.Description),
					DbHelper.MakeInParam("@blogdispmode", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.BlogDispMode),
					DbHelper.MakeInParam("@bpp", (DbType)SqlDbType.Int, 4,spaceconfiginfo.Bpp),
					DbHelper.MakeInParam("@commentpref", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.Commentpref),
					DbHelper.MakeInParam("@messagepref", (DbType)SqlDbType.TinyInt, 1,spaceconfiginfo.MessagePref),
					DbHelper.MakeInParam("@rewritename", (DbType)SqlDbType.Char, 100,spaceconfiginfo.Rewritename),
					DbHelper.MakeInParam("@themeid", (DbType)SqlDbType.Int, 4,spaceconfiginfo.ThemeID),
					DbHelper.MakeInParam("@themepath", (DbType)SqlDbType.NChar, 50,spaceconfiginfo.ThemePath),
					DbHelper.MakeInParam("@postcount", (DbType)SqlDbType.Int, 4,spaceconfiginfo.PostCount),
					DbHelper.MakeInParam("@commentcount", (DbType)SqlDbType.Int, 4,spaceconfiginfo.CommentCount),
					DbHelper.MakeInParam("@visitedtimes", (DbType)SqlDbType.Int, 4,spaceconfiginfo.VisitedTimes),
					DbHelper.MakeInParam("@createdatetime", (DbType)SqlDbType.SmallDateTime, 4,spaceconfiginfo.CreateDateTime),
					DbHelper.MakeInParam("@updatedatetime", (DbType)SqlDbType.SmallDateTime, 4,spaceconfiginfo.UpdateDateTime),
					DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Status),
				};
            string commandText = string.Format("INSERT INTO [{0}spaceconfigs] ([userid], [spacetitle], [description], [blogdispmode], [bpp], [commentpref], [messagepref], [rewritename], [themeid], [themepath], [postcount], [commentcount], [visitedtimes], [createdatetime], [updatedatetime]) VALUES (@userid, @spacetitle, @description, @blogdispmode, @bpp, @commentpref, @messagepref, @rewritename, @themeid, @themepath, @postcount, @commentcount, @visitedtimes, @createdatetime, @updatedatetime);SELECT SCOPE_IDENTITY()", BaseConfigs.GetTablePrefix);

            return TypeConverter.ObjectToInt(DbHelper.ExecuteScalar(CommandType.Text, commandText, parms));
        }
Exemplo n.º 15
0
        /// <summary>
        /// 保存用户space配置信息
        /// </summary>
        /// <param name="spaceconfiginfo"></param>
        /// <returns></returns>
        public bool SaveSpaceConfigData(SpaceConfigInfo spaceconfiginfo)
        {
            DbParameter[] parms = {
										   DbHelper.MakeInParam("@spacetitle", (DbType)SqlDbType.NVarChar, 100, spaceconfiginfo.Spacetitle),
										   DbHelper.MakeInParam("@description", (DbType)SqlDbType.NVarChar, 200, spaceconfiginfo.Description),
										   DbHelper.MakeInParam("@blogdispmode", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.BlogDispMode),
										   DbHelper.MakeInParam("@bpp", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Bpp),
										   DbHelper.MakeInParam("@commentpref", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.Commentpref),
										   DbHelper.MakeInParam("@messagepref", (DbType)SqlDbType.TinyInt, 1, spaceconfiginfo.MessagePref),
										   DbHelper.MakeInParam("@themeid", (DbType)SqlDbType.Int, 4, spaceconfiginfo.ThemeID),
										   DbHelper.MakeInParam("@themepath", (DbType)SqlDbType.NChar, 50, spaceconfiginfo.ThemePath),
										   DbHelper.MakeInParam("@status", (DbType)SqlDbType.Int, 4, spaceconfiginfo.Status),
										   DbHelper.MakeInParam("@updatedatetime", (DbType)SqlDbType.SmallDateTime, 4, DateTime.Now),
										   DbHelper.MakeInParam("@userid", (DbType)SqlDbType.Int, 4, spaceconfiginfo.UserID)
									   };
            string commandText = string.Format("UPDATE [{0}spaceconfigs] SET [spacetitle] = @spacetitle ,[description] = @description,[blogdispmode] = @blogdispmode,[bpp] = @bpp, [commentpref] = @commentpref, [messagepref] = @messagepref, [themeid]=@themeid,[themepath] = @themepath, [updatedatetime] = @updatedatetime WHERE [userid] = @userid", BaseConfigs.GetTablePrefix);
            DbHelper.ExecuteNonQuery(CommandType.Text, commandText, parms);
            return true;
        }