예제 #1
0
        /// <summary>
        /// 解除用户QQ绑定
        /// </summary>
        /// <param name="openId"></param>
        /// <returns></returns>
        public static int UnbindUserConnectInfo(string openId)
        {
            DiscuzCloudConfigInfo config          = DiscuzCloudConfigs.GetConfig();
            UserConnectInfo       userConnectInfo = DiscuzCloud.GetUserConnectInfo(openId);

            if (userConnectInfo == null)
            {
                return(-1);
            }

            List <DiscuzOAuthParameter> paramList = new List <DiscuzOAuthParameter>();

            paramList.Add(new DiscuzOAuthParameter("client_ip", DNTRequest.GetIP()));

            DiscuzOAuth oauth     = new DiscuzOAuth();
            string      queryStr  = "";
            string      unbindUrl = oauth.GetOAuthUrl(UNBIND_URL, "POST", config.Connectappid, config.Connectappkey, userConnectInfo.Token, userConnectInfo.Secret,
                                                      "", "", paramList, out queryStr);

            string response = Utils.GetHttpWebResponse(unbindUrl, queryStr);

            DeleteUserConnectInfo(openId);
            Utils.WriteCookie("bindconnect", "");
            return(1);
        }
예제 #2
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        private static BaseCloudResponse <T> GetCloudResponse <T>(string method, DiscuzCloudMethodParameter mParams)
        {
            string text = mParams.Find("sTimestamp");

            text = (string.IsNullOrEmpty(text) ? Utils.ConvertToUnixTimestamp(DateTime.Now).ToString() : text);
            string postData = string.Format("format={0}&method={1}&sId={2}&sig={3}&ts={4}{5}", new object[]
            {
                FORMAT,
                method,
                DiscuzCloudConfigInfo.Current.Cloudsiteid,
                DiscuzCloud.GetCloudMethodSignature(method, text, mParams),
                text,
                mParams.GetPostData()
            });
            string httpWebResponse = Utils.GetHttpWebResponse(CLOUD_URL, postData);
            BaseCloudResponse <T> result;

            try
            {
                result = JavaScriptConvert.DeserializeObject <BaseCloudResponse <T> >(httpWebResponse);
            }
            catch
            {
                BaseCloudResponse <string> baseCloudResponse = JavaScriptConvert.DeserializeObject <BaseCloudResponse <string> >(httpWebResponse);
                result = new BaseCloudResponse <T>
                {
                    ErrCode    = baseCloudResponse.ErrCode,
                    ErrMessage = baseCloudResponse.ErrMessage
                };
            }
            return(result);
        }
예제 #3
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string RegisterSite()
        {
            DiscuzCloudConfigInfo      config = DiscuzCloudConfigInfo.Current;
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter();

            discuzCloudMethodParameter.Add("sName", GeneralConfigInfo.Current.Forumtitle);
            discuzCloudMethodParameter.Add("sSiteKey", config.Sitekey);
            discuzCloudMethodParameter.Add("sCharset", CHARSET);
            discuzCloudMethodParameter.Add("sTimeZone", "8");
            discuzCloudMethodParameter.Add("sLanguage", "zh_CN");
            discuzCloudMethodParameter.Add("sProductType", DiscuzCloud.productType);
            discuzCloudMethodParameter.Add("sProductVersion", DiscuzCloud.productVersion);
            discuzCloudMethodParameter.Add("sTimestamp", Utils.ConvertToUnixTimestamp(DateTime.Now).ToString());
            discuzCloudMethodParameter.Add("sApiVersion", "0.4");
            discuzCloudMethodParameter.Add("sSiteUid", BaseConfigs.GetFounderUid.ToString());
            discuzCloudMethodParameter.Add("sProductRelease", PRODUCT_RELEASE);
            discuzCloudMethodParameter.Add("sUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath));
            discuzCloudMethodParameter.Add("sUCenterUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath));
            BaseCloudResponse <RegisterCloud> cloudResponse = DiscuzCloud.GetCloudResponse <RegisterCloud>("site.register", discuzCloudMethodParameter);

            if (cloudResponse.ErrCode == 0)
            {
                config.Cloudsiteid  = cloudResponse.Result.CloudSiteId;
                config.Cloudsitekey = cloudResponse.Result.CloudSiteKey;

                //DiscuzCloudConfigs.SaveConfig(config);
                //DiscuzCloudConfigs.ResetConfig();
                config.Save();
                DiscuzCloudConfigInfo.Current = null;
            }
            return(cloudResponse.ErrMessage);
        }
예제 #4
0
        private bool PushFeedToDiscuzCloud(TopicInfo topic, PostInfo post, AttachmentInfo[] attachments, int feedStatus)
        {
            //如果传入数据不合法,以及主题需要审核或者是回复可见的,需要付费的,就不推送到云平台
            if (topic == null || post == null || topic.Tid < 0 || topic.Posterid < 0 || post.Tid != topic.Tid || post.Pid < 0 ||
                topic.Displayorder < 0 || topic.Hide == 1 || topic.Price > 0 || post.Invisible != 0 || feedStatus < 0 || feedStatus > 3)
            {
                return(false);
            }

            UserConnectInfo userConnectInfo = DiscuzCloud.GetUserConnectInfo(topic.Posterid);

            if (userConnectInfo == null || feedStatus == 0)
            {
                return(false);
            }
            //设置用户自选的操作状态
            userConnectInfo.AllowPushFeed = feedStatus;

            if (DiscuzCloud.PushFeedToDiscuzCloud(topic, post, attachments, userConnectInfo, ip, rootUrl))
            {
                TopicPushFeedInfo feedInfo = new TopicPushFeedInfo();
                feedInfo.TopicId      = topic.Tid;
                feedInfo.Uid          = topic.Posterid;
                feedInfo.AuthorToken  = userConnectInfo.Token;
                feedInfo.AuthorSecret = userConnectInfo.Secret;
                DiscuzCloud.CreateTopicPushFeedLog(feedInfo);
                return(true);
            }
            return(false);
        }
예제 #5
0
파일: PushFeed.cs 프로젝트: xiongeee/BBX
        private bool PushFeedToDiscuzCloud(TopicInfo topic, PostInfo post, AttachmentInfo[] attachments, bool feedStatus)
        {
            if (topic == null || post == null || topic.Tid < 0 || topic.Posterid < 0 || post.Tid != topic.Tid || post.Pid < 0 || topic.Displayorder < 0 || topic.Hide == 1 || topic.Price > 0 || post.Invisible != 0 || !feedStatus)
            {
                return(false);
            }
            var userConnectInfo = DiscuzCloud.GetUserConnectInfo(topic.Posterid);

            if (userConnectInfo == null || !feedStatus)
            {
                return(false);
            }
            userConnectInfo.AllowPushFeed = feedStatus;
            if (DiscuzCloud.PushFeedToDiscuzCloud(topic, post, attachments, userConnectInfo, this.ip, this.rootUrl))
            {
                DiscuzCloud.CreateTopicPushFeedLog(new PushfeedLog
                {
                    ID           = topic.Tid,
                    Uid          = topic.Posterid,
                    AuthorToken  = userConnectInfo.Token,
                    AuthorSecret = userConnectInfo.Secret
                });
                return(true);
            }
            return(false);
        }
예제 #6
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string GetBindUserNotifyUrl(UserConnect connectInfo, string userName, string birthday, int gender, string email, int isPublicEmail, int isUsedQQAvatar, string type)
        {
            DiscuzCloudConfigInfo       config = DiscuzCloudConfigInfo.Current;
            List <DiscuzOAuthParameter> list   = new List <DiscuzOAuthParameter>();

            list.Add(new DiscuzOAuthParameter("s_id", string.Empty));
            list.Add(new DiscuzOAuthParameter("openid", connectInfo.OpenId));
            list.Add(new DiscuzOAuthParameter("oauth_consumer_key", config.Connectappid));
            list.Add(new DiscuzOAuthParameter("u_id", connectInfo.Uid.ToString()));
            list.Add(new DiscuzOAuthParameter("username", userName));
            list.Add(new DiscuzOAuthParameter("birthday", birthday));
            string text = "unknown";

            text = ((gender == 1) ? "male" : text);
            text = ((gender == 2) ? "female" : text);
            list.Add(new DiscuzOAuthParameter("sex", text));
            list.Add(new DiscuzOAuthParameter("email", email));
            list.Add(new DiscuzOAuthParameter("is_public_email", isPublicEmail.ToString()));
            list.Add(new DiscuzOAuthParameter("is_use_qq_avatar", isUsedQQAvatar.ToString()));
            list.Add(new DiscuzOAuthParameter("statreferer", "forum"));
            list.Add(new DiscuzOAuthParameter("avatar_input", "234"));
            list.Add(new DiscuzOAuthParameter("avatar_agent", "23432"));
            list.Add(new DiscuzOAuthParameter("type", type));
            list.Add(new DiscuzOAuthParameter("site_ucenter_id", config.Sitekey));
            string str  = "";
            string str2 = DiscuzCloud.GenerateNotifySignature(list, config.Connectappid + "|" + config.Connectappkey, out str);

            return(CONNECT_URL + "notify/user/bind?" + str + "sig=" + str2);
        }
예제 #7
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string GetCloudBindUrl(int userId)
        {
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter(false);

            discuzCloudMethodParameter.Add("s_id", DiscuzCloudConfigInfo.Current.Cloudsiteid);
            discuzCloudMethodParameter.Add("s_site_uid", userId.ToString());
            return(DiscuzCloud.GetCloudCpUrl("bind/index", discuzCloudMethodParameter));
        }
예제 #8
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string GetCloudAppListIFrame(int userId)
        {
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter(false);

            discuzCloudMethodParameter.Add("refer", Utils.GetRootUrl(BaseConfigs.GetForumPath));
            discuzCloudMethodParameter.Add("s_id", DiscuzCloudConfigInfo.Current.Cloudsiteid);
            discuzCloudMethodParameter.Add("s_site_uid", userId.ToString());
            return(DiscuzCloud.GetCloudCpUrl("cloud/appList/", discuzCloudMethodParameter));
        }
예제 #9
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string GetCloudUploadLogoIFrame(int userId)
        {
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter(false);

            discuzCloudMethodParameter.Add("s_id", DiscuzCloudConfigInfo.Current.Cloudsiteid);
            discuzCloudMethodParameter.Add("s_site_uid", userId.ToString());
            discuzCloudMethodParameter.Add("link_url", "admin/global/global_connectset.aspx");
            discuzCloudMethodParameter.Add("self_url", "admin/global/global_connectset.aspx?upload=1");
            return(DiscuzCloud.GetCloudCpUrl("connect/service", discuzCloudMethodParameter));
        }
예제 #10
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static bool OnlineUserIsBindConnect(int userId)
        {
            var flag = TypeConverter.IntStringToBoolean(Utils.GetCookie("bindconnect"));

            if (flag && userId > 0)
            {
                flag = DiscuzCloud.IsBindConnect(userId);
                Utils.WriteCookie("bindconnect", TypeConverter.BooleanToIntString(flag));
            }
            if (userId < 1 && flag)
            {
                Utils.WriteCookie("bindconnect", "");
            }
            return(flag);
        }
예제 #11
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string ResetSiteKey()
        {
            DiscuzCloudConfigInfo      config = DiscuzCloudConfigInfo.Current;
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter();

            discuzCloudMethodParameter.Add("sId", config.Cloudsiteid);
            BaseCloudResponse <RegisterCloud> cloudResponse = DiscuzCloud.GetCloudResponse <RegisterCloud>("site.resetKey", discuzCloudMethodParameter);

            if (cloudResponse.ErrCode == 0)
            {
                config.Cloudsitekey = cloudResponse.Result.CloudSiteKey;

                //DiscuzCloudConfigs.SaveConfig(config);
                //DiscuzCloudConfigs.ResetConfig();
                config.Save();
                DiscuzCloudConfigInfo.Current = null;
            }
            return(cloudResponse.ErrMessage);
        }
예제 #12
0
        private bool DeletePushedFeedInCloud(int tid)
        {
            if (tid < 0)
            {
                return(false);
            }
            PushfeedLog topicPushFeedLog = DiscuzCloud.GetTopicPushFeedLog(tid);

            if (topicPushFeedLog == null)
            {
                return(false);
            }
            bool flag = DiscuzCloud.DeletePushedFeedInDiscuzCloud(topicPushFeedLog, this.ip);

            if (flag)
            {
                DiscuzCloud.DeleteTopicPushFeedLog(tid);
            }
            return(true);
        }
예제 #13
0
        /// <summary>
        /// 获取当前用户发送feed到云平台的设置(0不发送,1发送到Qzone,2发送到微博,3都发送)
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public static int GetOnlineUserCloudFeedStatus(int userId)
        {
            string status = Utils.GetCookie("cloud_feed_status");

            if (!string.IsNullOrEmpty(status))
            {
                string[] statusArray = status.Split('|');
                if (statusArray.Length == 2 && userId == Utils.StrToInt(statusArray[0], -1))
                {
                    return(Utils.StrToInt(statusArray[1], 0));
                }
            }
            UserConnectInfo connectInfo = DiscuzCloud.GetUserConnectInfo(userId);

            if (connectInfo != null)
            {
                Utils.WriteCookie("cloud_feed_status", string.Format("{0}|{1}", userId, connectInfo.AllowPushFeed));
                return(connectInfo.AllowPushFeed);
            }
            return(0);
        }
예제 #14
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static int UnbindUserConnectInfo(string openId)
        {
            DiscuzCloudConfigInfo config          = DiscuzCloudConfigInfo.Current;
            UserConnect           userConnectInfo = DiscuzCloud.GetUserConnectInfo(openId);

            if (userConnectInfo == null)
            {
                return(-1);
            }
            List <DiscuzOAuthParameter> list = new List <DiscuzOAuthParameter>();

            list.Add(new DiscuzOAuthParameter("client_ip", DNTRequest.GetIP()));
            DiscuzOAuth discuzOAuth = new DiscuzOAuth();
            string      postData    = "";
            string      oAuthUrl    = discuzOAuth.GetOAuthUrl(UNBIND_URL, "POST", config.Connectappid, config.Connectappkey, userConnectInfo.Token, userConnectInfo.Secret, "", "", list, out postData);

            Utils.GetHttpWebResponse(oAuthUrl, postData);
            DiscuzCloud.DeleteUserConnectInfo(openId);
            Utils.WriteCookie("bindconnect", "");
            return(1);
        }
예제 #15
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static bool GetOnlineUserCloudFeedStatus(int userId)
        {
            string cookie = Utils.GetCookie("cloud_feed_status");

            if (!string.IsNullOrEmpty(cookie))
            {
                string[] array = cookie.Split('|');
                if (array.Length == 2 && userId == TypeConverter.StrToInt(array[0], -1))
                {
                    return(TypeConverter.IntStringToBoolean(array[1]));
                }
            }
            var userConnectInfo = DiscuzCloud.GetUserConnectInfo(userId);

            if (userConnectInfo != null)
            {
                Utils.WriteCookie("cloud_feed_status", string.Format("{0}|{1}", userId, Convert.ToInt32(userConnectInfo.AllowPushFeed)));
                return(userConnectInfo.AllowPushFeed);
            }
            return(false);
        }
예제 #16
0
        private bool DeletePushedFeedInCloud(int tid)
        {
            if (tid < 0)
            {
                return(false);
            }

            TopicPushFeedInfo feedInfo = DiscuzCloud.GetTopicPushFeedLog(tid);

            if (feedInfo == null)
            {
                return(false);
            }

            bool result = DiscuzCloud.DeletePushedFeedInDiscuzCloud(feedInfo, ip);

            if (result)
            {
                DiscuzCloud.DeleteTopicPushFeedLog(tid);
            }
            return(true);
        }
예제 #17
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        public static string SyncSite()
        {
            DiscuzCloudConfigInfo      config = DiscuzCloudConfigInfo.Current;
            DiscuzCloudMethodParameter discuzCloudMethodParameter = new DiscuzCloudMethodParameter();

            discuzCloudMethodParameter.Add("sId", config.Cloudsiteid);
            discuzCloudMethodParameter.Add("sName", GeneralConfigInfo.Current.Forumtitle);
            discuzCloudMethodParameter.Add("sSiteKey", config.Sitekey);
            discuzCloudMethodParameter.Add("sCharset", CHARSET);
            discuzCloudMethodParameter.Add("sTimeZone", "8");
            discuzCloudMethodParameter.Add("sLanguage", "zh_CN");
            discuzCloudMethodParameter.Add("sProductType", DiscuzCloud.productType);
            discuzCloudMethodParameter.Add("sProductVersion", DiscuzCloud.productVersion);
            discuzCloudMethodParameter.Add("sApiVersion", "0.4");
            discuzCloudMethodParameter.Add("sSiteUid", BaseConfigs.GetFounderUid.ToString());
            discuzCloudMethodParameter.Add("sProductRelease", PRODUCT_RELEASE);
            discuzCloudMethodParameter.Add("sTimestamp", Utils.ConvertToUnixTimestamp(DateTime.Now).ToString());
            discuzCloudMethodParameter.Add("sUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath));
            discuzCloudMethodParameter.Add("sUCenterUrl", Utils.GetRootUrl(BaseConfigs.GetForumPath));
            BaseCloudResponse <bool> cloudResponse = DiscuzCloud.GetCloudResponse <bool>("site.sync", discuzCloudMethodParameter);

            return(cloudResponse.ErrMessage);
        }
예제 #18
0
        /// <summary>
        /// BasePage类构造函数
        /// </summary>
        public PageBase()
        {
            if (recordPageView)
            {
                PageViewStatistic(pagename);
            }

            config = GeneralConfigs.GetConfig();
            if (SpacePluginProvider.GetInstance() == null)
            {
                config.Enablespace = 0;
            }
            if (AlbumPluginProvider.GetInstance() == null)
            {
                config.Enablealbum = 0;
            }
            if (MallPluginProvider.GetInstance() == null)
            {
                config.Enablemall = 0;
            }

            LoadUrlConfig();
            userid = Utils.StrToInt(ForumUtils.GetCookie("userid"), -1);

            //清空当前页面查询统计
#if DEBUG
            Discuz.Data.DbHelper.QueryCount  = 0;
            Discuz.Data.DbHelper.QueryDetail = "";
#endif
            // 如果启用游客页面缓存,则对游客输出缓存页
            if (userid == -1 && config.Guestcachepagetimeout > 0 && GetUserCachePage(pagename))
            {
                return;
            }

            AddMetaInfo(config.Seokeywords, config.Seodescription, config.Seohead);

            if (config.Nocacheheaders == 1)
            {
                System.Web.HttpContext.Current.Response.BufferOutput    = false;
                System.Web.HttpContext.Current.Response.ExpiresAbsolute = DateTime.Now.AddDays(-1);
                System.Web.HttpContext.Current.Response.Cache.SetExpires(DateTime.Now.AddDays(-1));
                System.Web.HttpContext.Current.Response.Expires      = 0;
                System.Web.HttpContext.Current.Response.CacheControl = "no-cache";
                System.Web.HttpContext.Current.Response.Cache.SetNoStore();
            }

            //当为forumlist.aspx或forumindex.aspx,可能出现在线并发问题,这时系统会延时2秒
            if ((pagename != "forumlist.aspx") && (pagename != "forumindex.aspx"))
            {
                oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
            }
            else
            {
                try
                {
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }
                catch
                {
                    System.Threading.Thread.Sleep(2000);
                    oluserinfo = OnlineUsers.UpdateInfo(config.Passwordkey, config.Onlinetimeout);
                }
            }

            if (config.PostTimeStorageMedia == 1 && Utils.GetCookie("lastposttime") != "")//如果最后发帖时间cookie不为空,则在此修改用户的该属性
            {
                oluserinfo.Lastposttime = Utils.GetCookie("lastposttime");
            }

            userid         = oluserinfo.Userid;
            usergroupid    = oluserinfo.Groupid;
            username       = oluserinfo.Username;
            password       = oluserinfo.Password;
            userkey        = password.Length > 16 ? password.Substring(4, 8).Trim() : "";
            lastposttime   = oluserinfo.Lastposttime;
            lastpostpmtime = oluserinfo.Lastpostpmtime;
            lastsearchtime = oluserinfo.Lastsearchtime;
            olid           = oluserinfo.Olid;

            isopenconnect = DiscuzCloud.GetCloudServiceEnableStatus("connect");
            isbindconnect = isopenconnect ? DiscuzCloud.OnlineUserIsBindConnect(userid) : false;

            //确保头像可以取到
            if (userid > 0)
            {
                useravatar = Avatars.GetAvatarUrl(userid, AvatarSize.Small);
            }

            if (Utils.InArray(DNTRequest.GetString("selectedtemplateid"), Templates.GetValidTemplateIDList()))
            {
                templateid = DNTRequest.GetInt("selectedtemplateid", 0);
            }
            else if (Utils.InArray(Utils.GetCookie(Utils.GetTemplateCookieName()), Templates.GetValidTemplateIDList()))
            {
                templateid = Utils.StrToInt(Utils.GetCookie(Utils.GetTemplateCookieName()), config.Templateid);
            }

            if (templateid == 0)
            {
                templateid = config.Templateid;
            }

            pmsound = Utils.StrToInt(ForumUtils.GetCookie("pmsound"), 0);

            //已登录用户检测用户组状态,如果是禁言或禁止访问状态时间到期,则自动解禁
            if (usergroupid == 4 || usergroupid == 5)
            {
                //int groupExpiry = Users.GetShortUserInfo(userid).Groupexpiry;
                //if (groupExpiry != 0 && groupExpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0))
                //{
                //    //先改为第一个积分组
                //    usergroupid = 11;
                //    //usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);
                //    Users.UpdateUserGroup(userid, 11);
                //}

                ShortUserInfo userInfo = Users.GetShortUserInfo(userid);
                if (userInfo.Groupexpiry != 0 && userInfo.Groupexpiry <= Utils.StrToInt(DateTime.Now.ToString("yyyyMMdd"), 0))
                {
                    UserGroupInfo groupInfo = CreditsFacade.GetCreditsUserGroupId(userInfo.Credits);
                    usergroupid = groupInfo.Groupid != 0 ? groupInfo.Groupid : usergroupid;
                    Users.UpdateUserGroup(userid, usergroupid);
                }
            }

            usergroupinfo = UserGroups.GetUserGroupInfo(usergroupid);

            // 取得用户权限id,1管理员,2超版,3版主,0普通组,-1特殊组
            useradminid = usergroupinfo.Radminid;
            string tips = ForumUtils.GetUserCreditsCookie(userid, usergroupinfo.Grouptitle);
            if (tips != "")
            {
                string[] userinfotipsList = tips.Split(',');//因为考虑到应用程序做单点登录时获取不到userinfotips,封装了此方法
                userinfotips  = "<p><a class=\"drop\" onmouseover=\"showMenu(this.id);\" href=\"" + BaseConfigs.GetForumPath + "usercpcreditspay.aspx\" id=\"extcreditmenu\">" + userinfotipsList[0] + "</a> ";
                userinfotips += "<span class=\"pipe\">|</span>用户组: <a class=\"xi2\" id=\"g_upmine\" href=\"" + BaseConfigs.GetForumPath + "usercp.aspx\">" + userinfotipsList[1].Split(':')[1] + "</a></p>";
                userinfotips += "<ul id=\"extcreditmenu_menu\" class=\"p_pop\" style=\"display:none;\">";
                for (int i = 2; i < userinfotipsList.Length; i++)
                {
                    userinfotips += string.Format("<li><a> {0}</a></li>", userinfotipsList[i]);
                }
                userinfotips += "</ul>";
            }

            mainnavigation       = Navs.GetNavigationString(userid, useradminid);
            subnavigation        = Navs.GetSubNavigation();
            mainnavigationhassub = Navs.GetMainNavigationHasSub();
            // 如果论坛关闭且当前用户请求页面不是登录页面且用户非管理员, 则跳转至论坛关闭信息页
            if (config.Closed == 1 && pagename != "login.aspx" && pagename != "logout.aspx" && pagename != "register.aspx" && useradminid != 1)
            {
                ShowMessage(1);
                return;
            }

            if (!Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗
            {
                onlineusercount = (userid != -1) ? OnlineUsers.GetOnlineAllUserCount() : OnlineUsers.GetCacheOnlineAllUserCount();
            }

            //校验用户是否可以访问论坛
            if (!ValidateUserPermission())
            {
                return;
            }

            //更新用户在线时长
            if (userid != -1 && !Utils.InArray(pagename, "attachment.aspx"))//加入附件页面判断减少性能消耗
            {
                OnlineUsers.UpdateOnlineTime(config.Oltimespan, userid);
            }
            TemplateInfo templateInfo = Templates.GetTemplateItem(templateid);
            templatepath = templateInfo.Directory;
            if (templateInfo.Templateurl.ToLower().StartsWith("http://"))
            {
                imagedir = templateInfo.Templateurl.TrimEnd('/') + "/images";
                cssdir   = templateInfo.Templateurl.TrimEnd('/');
            }
            else
            {
                imagedir = forumpath + "templates/" + templateInfo.Directory + "/images";
                cssdir   = forumpath + "templates/" + templateInfo.Directory;
            }
            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Topicidentifydir))
            {
                topicidentifydir = EntLibConfigs.GetConfig().Topicidentifydir.TrimEnd('/');
            }
            else
            {
                topicidentifydir = forumpath + "images/identify";
            }

            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Posticondir))
            {
                posticondir = EntLibConfigs.GetConfig().Posticondir.TrimEnd('/');
            }
            else
            {
                posticondir = forumpath + "images/posticons";
            }



            if (EntLibConfigs.GetConfig() != null && !Utils.StrIsNullOrEmpty(EntLibConfigs.GetConfig().Jsdir))
            {
                jsdir = EntLibConfigs.GetConfig().Jsdir.TrimEnd('/');
            }
            else
            {
                jsdir = rooturl + "javascript";
            }

            nowdate     = Utils.GetDate();
            nowtime     = Utils.GetTime();
            nowdatetime = Utils.GetDateTime();
            ispost      = DNTRequest.IsPost();
            isget       = DNTRequest.IsGet();
            link        = "";
            script      = "";

            templatelistboxoptions = Caches.GetTemplateListBoxOptionsCache();

            string originalTemplate = string.Format("<li><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">",
                                                    "", BaseConfigs.GetForumPath, templateid);
            string newTemplate = string.Format("<li class=\"current\"><a href=\"###\" onclick=\"window.location.href='{0}showtemplate.aspx?templateid={1}'\">",
                                               BaseConfigs.GetForumPath, templateid);
            templatelistboxoptions = templatelistboxoptions.Replace(originalTemplate, newTemplate);

            isLoginCode = config.Seccodestatus.Contains("login.aspx");
            //当该页面设置了验证码检验,并且当前用户的用户组没有给予忽略验证码的权限,则isseccode=true;
            isseccode = Utils.InArray(pagename, config.Seccodestatus) && usergroupinfo.Ignoreseccode == 0;


            headerad = Advertisements.GetOneHeaderAd("", 0);
            footerad = Advertisements.GetOneFooterAd("", 0);

            //设定当前页面的显示样式
            if (config.Allowchangewidth == 0)
            {
                Utils.WriteCookie("allowchangewidth", "");
            }

            if (pagename != "website.aspx")
            {
                if (Utils.GetCookie("allowchangewidth") == "0" || (string.IsNullOrEmpty(Utils.GetCookie("allowchangewidth")) && config.Showwidthmode == 1))
                {
                    isnarrowpage = true;
                }
            }

            //校验验证码
            if (isseccode && ispost && !ValidateVerifyCode())
            {
                return;
            }

            newtopicminute = config.Viewnewtopicminute;
            m_starttick    = DateTime.Now;

            ShowPage();

            m_processtime = DateTime.Now.Subtract(m_starttick).TotalMilliseconds / 1000;

            querycount = Discuz.Data.DbHelper.QueryCount;
            Discuz.Data.DbHelper.QueryCount = 0;

#if DEBUG
            querydetail = Discuz.Data.DbHelper.QueryDetail;
            Discuz.Data.DbHelper.QueryDetail = "";
#endif
        }
예제 #19
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
 public static bool IsBindConnect(int userId)
 {
     return(DiscuzCloudConfigInfo.Current.Connectenabled != 0 && userId >= 1 && DiscuzCloud.GetUserConnectInfo(userId) != null);
 }
예제 #20
0
파일: DiscuzCloud.cs 프로젝트: xiongeee/BBX
        private static string GetCloudCpUrl(string target, DiscuzCloudMethodParameter mParams)
        {
            string text = Utils.ConvertToUnixTimestamp(DateTime.Now).ToString();

            return(CLOUD_CP_URL + target + "?ts=" + text + mParams.GetPostData() + "&sig=" + DiscuzCloud.GetCloudIframeSignature(mParams, text));
        }