Esempio n. 1
0
        private bool IsUserTagEditor()
        {
            string _roles       = "ContentAdministrator";
            bool   isAuthorized = false;

            if (SueetieContext.Current.ContentPage != null)
            {
                SueetieContentPage _sueetieContentPage = SueetieContext.Current.ContentPage;
                if (!string.IsNullOrEmpty(_sueetieContentPage.EditorRoles))
                {
                    _roles = _sueetieContentPage.EditorRoles;
                }
            }
            if (TagSueetieForumTopic != null && TagSueetieForumTopic.SueetieUserIDs != null)
            {
                var _userIDs = TagSueetieForumTopic.SueetieUserIDs.Split('|')
                               .Where(n => !string.IsNullOrEmpty(n)).Select(n => int.Parse(n)).ToList();
                foreach (int _userID in _userIDs)
                {
                    if (CurrentSueetieUserID.Equals(_userID))
                    {
                        isAuthorized = true;
                    }
                }
            }
            if (!string.IsNullOrEmpty(Roles))
            {
                _roles = Roles;
            }
            if (SueetieUIHelper.IsUserAuthorized(_roles) || SueetieUIHelper.IsUserAuthorized("ContentAdministrator"))
            {
                isAuthorized = true;
            }
            return(isAuthorized);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string path = this.ViewName.ControlPath();

            List <SueetieContentPage> sueetieContentPages = (from _page in SueetieContentParts.GetSueetieContentPageList(ContentGroupID)
                                                             orderby _page.DisplayOrder ascending
                                                             select _page).ToList();

            if (SortBy == SueetieSortBy.ItemTitle)
            {
                sueetieContentPages = sueetieContentPages.OrderBy(p => p.PageTitle).ToList();
            }

            if (SortBy == SueetieSortBy.ChronologicalOrder)
            {
                sueetieContentPages = sueetieContentPages.OrderBy(p => p.LastUpdateDateTime).ToList();
            }

            foreach (SueetieContentPage sueetieContentPage in sueetieContentPages)
            {
                Sueetie.Controls.ContentPageView control = (Sueetie.Controls.ContentPageView)LoadControl(path);
                control.ContentPage = sueetieContentPage;
                bool userAuthorized = SueetieUIHelper.IsUserAuthorized(sueetieContentPage.ReaderRoles) && sueetieContentPage.IsPublished;
                bool userIsEditor   = SueetieUIHelper.IsUserAuthorized(sueetieContentPage.EditorRoles);
                if (userAuthorized || userIsEditor)
                {
                    phContentPages.Controls.Add(control);
                }
            }
        }
Esempio n. 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         SueetieUIHelper.PopulateTimeZoneList(ddTimeZones);
         SetActiveButtonAttributes(CreateUserButton);
         lblResults.Visible = false;
     }
 }
Esempio n. 4
0
        private void Page_Load()
        {
            // check if username exists in the query string
            username            = Request.QueryString["username"];
            sueetieUser         = SueetieUsers.GetUser(username);
            lblDisplayName.Text = sueetieUser.DisplayName;

            SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());

            if (username == null || username == "")
            {
                Response.Redirect("users.aspx");
            }

            // get membership user account based on username sent in query string
            _user            = Membership.GetUser(username, false);
            lastActivitydate = _user.LastActivityDate;

            UserUpdateMessage.Text = "";

            if (_user.IsLockedOut)
            {
                ActionMessage.Visible = true;
                ActionMessage.Text    = "User is locked out.  Use the \"Unlock User\" button to unlock";
            }
            else
            {
                string bannedIntro   = "This user's IP mask (" + SueetieIPHelper.GetIPMask(sueetieUser.IP) + ") is recorded as banned. Click 'Lift Ban on this User' to permit the user to login or create a new account.";
                string unbannedIntro = "User is not banned. Click 'Ban User' to record user's IP mask as banned to thwart attempts to create new site accounts.";
                if (!Page.IsPostBack)
                {
                    if (sueetieUser.IsBanned)
                    {
                        trBan.Visible       = false;
                        lblBannedIntro.Text = bannedIntro;
                    }
                    else
                    {
                        trUnBan.Visible     = false;
                        lblBannedIntro.Text = unbannedIntro;
                    }


                    SueetieUserProfile profile = SueetieUsers.GetSueetieUserProfile(sueetieUser.UserID);

                    txtDisplayName.Text   = profile.DisplayName;
                    chkNewsletter.Checked = profile.Newsletter;
                }

                _user.LastActivityDate = lastActivitydate;
                Membership.UpdateUser(_user);
                _user = Membership.GetUser(username, false);
            }
        }
Esempio n. 5
0
 protected void Submit_Click(object sender, EventArgs e)
 {
     lblResults.Visible = true;
     if (SueetieUIHelper.GetCurrentTrustLevel() >= AspNetHostingPermissionLevel.High)
     {
         HttpRuntime.UnloadAppDomain();
         lblResults.Text = "Sueetie restarted.  The cache is clear.  Surface!  Surface!";
     }
     else
     {
         SueetieLogs.LogException("Unable to restart Sueetie. Must have High/Unrestricted Trust to Unload Application.");
         lblResults.Text = "Unable to restart Sueetie. Must have High/Unrestricted Trust to Unload Application.";
     }
 }
Esempio n. 6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SueetieContentPage _currentPage = SueetieContext.Current.ContentPage;
            bool userAuthorized             = SueetieUIHelper.IsUserAuthorized(_currentPage.ReaderRoles) && _currentPage.IsPublished;
            bool userIsEditor = SueetieUIHelper.IsUserAuthorized(_currentPage.EditorRoles);

            if (userAuthorized || userIsEditor)
            {
                // page displays normally
            }
            else
            {
                Response.Redirect("/members/message.aspx?msgid=10");
            }
        }
Esempio n. 7
0
        private bool IsUserEditor()
        {
            string _roles       = "ContentAdministrator";
            bool   isAuthorized = false;

            if (!string.IsNullOrEmpty(Roles))
            {
                _roles = Roles;
            }
            if (SueetieUIHelper.IsUserAuthorized(_roles) || SueetieUIHelper.IsUserAuthorized("ContentAdministrator"))
            {
                isAuthorized = true;
            }
            return(isAuthorized);
        }
Esempio n. 8
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            string _theme       = txtTheme.Text.ToLower().Trim();
            string _mobileTheme = txtMobileTheme.Text.ToLower().Trim();

            // Update Application and Group Themes
            // Each theme has to have an associated blog theme

            foreach (SueetieApplication _sueetieApplication in SueetieApplications.Get().All)
            {
                if (_sueetieApplication.ApplicationTypeID == (int)SueetieApplicationType.Blog && _sueetieApplication.GroupID == 0)
                {
                    try
                    {
                        SueetieBlogUtils.UpdateBlogTheme(_sueetieApplication.ApplicationKey, _theme);
                    }
                    catch (Exception ex)
                    {
                        SueetieLogs.LogException("Blog Theme Update Error: " + ex.Message + " Stacktrace: " + ex.StackTrace);
                    }
                }
            }
            SueetieForums.UpdateForumTheme(_theme);
            WikiThemes.UpdateWikiTheme(SueetieApplications.Get().Wiki.ApplicationKey, _theme);

            //// Update BlogEngine Group Themes - Will add to SueetieApplications logic
            // SueetieBlogUtils.UpdateBlogTheme("groups/demo/blog", _theme);
            // WikiThemes.UpdateWikiTheme("groups/demo/wiki", _theme);

            SueetieCommon.UpdateSiteSetting(new SiteSetting("Theme", _theme));
            SueetieCommon.UpdateSiteSetting(new SiteSetting("MobileTheme", _mobileTheme));

            if (SueetieUIHelper.GetCurrentTrustLevel() >= AspNetHostingPermissionLevel.High)
            {
                HttpRuntime.UnloadAppDomain();
            }
            else
            {
                SueetieLogs.LogException("Unable to restart Sueetie. Must have High/Unrestricted Trust to Unload Application.");
            }

            lblResults.Visible        = true;
            lblResults.Text           = "Current Themes updated!";
            lblResultsDetails.Visible = true;
            lblResultsDetails.Text    = "New application themes may not appear right away. Touch web.configs to restart the app if this is the case.";
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SetActiveButtonAttributes(CreateUserButton);
                if (Request.IsAuthenticated)
                {
                    Response.Redirect("/default.aspx");
                }
                else if (SueetieContext.Current.SiteSettings.RegistrationType == (int)SueetieRegistrationType.Closed)
                {
                    // temporary redirect to enable during site updates or when you do not want new users to register
                    Response.Redirect("/members/message.aspx?msgid=4");
                }

                SueetieUIHelper.PopulateTimeZoneList(ddTimeZones);
                registrationType = (SueetieRegistrationType)SueetieContext.Current.SiteSettings.RegistrationType;
                InitializeCaptcha();

                CreateUserButton.Text = SueetieLocalizer.GetString("register_createuserbutton_text");
                RegularExpressionDisplayNameValidator.Text = SueetieLocalizer.GetString("register_validator_displayname");
                if (string.IsNullOrWhiteSpace(RegularExpressionDisplayNameValidator.Text))
                {
                    RegularExpressionDisplayNameValidator.Text = "Erreur";
                }

                RegularExpressionUsernameValidator.Text = SueetieLocalizer.GetString("register_validator_username");
                if (string.IsNullOrWhiteSpace(RegularExpressionUsernameValidator.Text))
                {
                    RegularExpressionUsernameValidator.Text = "Erreur";
                }

                RegularExpressionEmailValidator.Text = SueetieLocalizer.GetString("register_validator_email");
                if (string.IsNullOrWhiteSpace(RegularExpressionEmailValidator.Text))
                {
                    RegularExpressionEmailValidator.Text = "Erreur";
                }

                RegularExpressionPasswordValidator.Text = SueetieLocalizer.GetString("register_validator_password");
                if (string.IsNullOrWhiteSpace(RegularExpressionPasswordValidator.Text))
                {
                    RegularExpressionPasswordValidator.Text = "Erreur";
                }
            }
        }
Esempio n. 10
0
        private bool IsUserCalendarEditor()
        {
            string _roles       = "ContentAdministrator";
            bool   isAuthorized = false;

            if (SueetieContext.Current.ContentPage != null)
            {
                SueetieContentPage _sueetieContentPage = SueetieContext.Current.ContentPage;
                if (!string.IsNullOrEmpty(_sueetieContentPage.EditorRoles))
                {
                    _roles = _sueetieContentPage.EditorRoles;
                }
            }
            if (!string.IsNullOrEmpty(Roles))
            {
                _roles = Roles;
            }
            if (SueetieUIHelper.IsUserAuthorized(_roles) || SueetieUIHelper.IsUserAuthorized("ContentAdministrator"))
            {
                isAuthorized = true;
            }
            return(isAuthorized);
        }
Esempio n. 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtSiteName.Text             = SiteSettings.Instance.SiteName;
                chkCreateWikiAccount.Checked = SiteSettings.Instance.CreateWikiUserAccount;
                chkRecordAnalytics.Checked   = SiteSettings.Instance.RecordAnalytics;
                txtGroupsFolderName.Text     = SiteSettings.Instance.GroupsFolderName;
                txtIpGeoLookupUrl.Text       = SiteSettings.Instance.IpGeoLookupUrl;

                rblRegistrationType.Items.Add(new ListItem("Automatic", "0"));
                rblRegistrationType.Items.Add(new ListItem("Email Verification", "1"));
                rblRegistrationType.Items.Add(new ListItem("Administrative Approval", "2"));
                rblRegistrationType.Items.Add(new ListItem("Closed", "3"));

                rblRegistrationType.Items.FindByValue(SiteSettings.Instance.RegistrationType.ToString()).Selected = true;
                lblVersion.Text         = SiteStatistics.Instance.SueetieVersion;
                txtDefaultLanguage.Text = SiteSettings.Instance.DefaultLanguage;

                rblWwwSubdomain.SelectedValue = SiteSettings.Instance.HandleWwwSubdomain;

                SueetieUIHelper.PopulateTimeZoneList(ddTimeZones);
            }
        }
Esempio n. 12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            ScriptManager1.RegisterPostBackControl(UpdateUpload);
            ScriptManager1.RegisterPostBackControl(DeleteAvatarButton);
            ScriptManager1.RegisterPostBackControl(btnUpdateBio);
            ScriptManager1.RegisterPostBackControl(ChangePasswordButton);

            if (Request.QueryString["dv"] == "1" || Request.QueryString["av"] == "1" || Request.QueryString["iv"] == "1")
            {
                TabContainer1.ActiveTabIndex = 2;
            }
            else if (Request.QueryString["bio"] == "1")
            {
                TabContainer1.ActiveTabIndex = 2;
            }
            else if (Request.QueryString["pr"] == "1")
            {
                TabContainer1.ActiveTabIndex = 0;
            }
            else
            {
                TabContainer1.ActiveTabIndex = 0;
            }

            if (!Page.IsPostBack)
            {
                if (Page.User.Identity.IsAuthenticated)
                {
                    SueetieUser sueetieUser = SueetieUsers.GetUser(CurrentUserID, false);
                    SetActiveButtonAttributes(CancelButton);
                    SetActiveButtonAttributes(ChangePasswordButton);
                    SetActiveButtonAttributes(btnUpdateProfile);
                    SetActiveButtonAttributes(btnUpdateBio);


                    SueetieUIHelper.PopulateTimeZoneList(ddTimeZones, sueetieUser.TimeZone.ToString());
                    SueetieUserProfile profile = CurrentSueetieUser.Profile;

                    txtCurrentPassword.Text = string.Empty;
                    txtDisplayName.Text     = sueetieUser.DisplayName;
                    txtEmail.Text           = sueetieUser.Email;

                    #region Optional Profile Property Assignments


                    if (chkNewsletter != null)
                    {
                        HasNewsletterCheckBox = true;
                        chkNewsletter.Checked = profile.Newsletter;
                    }

                    #endregion

                    // When using ProfileBase...
                    //ProfileBase profile = HttpContext.Current.Profile;
                    //txtDisplayName.Text = profile["DisplayName"] as string;
                    //ddlGenders.SelectedValue = profile["Gender"] as string;
                    //ddlOccupations.SelectedValue = profile["Occupation"] as string;
                    //txtWebsite.Text = profile["Website"] as string;
                    //txtTwitterName.Text = profile["TwitterName"] as string;
                    //ddlCountries.SelectedValue = profile["Country"] as string;

                    txtBio.Text = sueetieUser.Bio;
                }
            }

            BindData();
        }
Esempio n. 13
0
        protected override void OnLoad(EventArgs e)
        {
            HyperLink _sueetieLink = new HyperLink();

            string _languageFile = "sueetie.xml";

            if (!string.IsNullOrEmpty(this.LanguageFile))
            {
                _languageFile = this.LanguageFile;
            }


            SueetieUrl _sueetieUrl = GetSueetieUrl();

            if (_sueetieUrl == null)
            {
                _sueetieUrl = SueetieUrls.Instance.GetSueetieUrl(this.UrlName);
            }

            if (_sueetieUrl.Url != null)
            {
                if (!string.IsNullOrEmpty(_sueetieUrl.Roles))
                {
                    if (!SueetieUIHelper.IsUserAuthorized(_sueetieUrl.Roles))
                    {
                        return;
                    }
                }

                if (!string.IsNullOrEmpty(this.ArgUrl1))
                {
                    string[] _urlArgs = new string[] { this.ArgUrl1, this.ArgUrl2, this.ArgUrl3, this.ArgUrl4, this.ArgUrl5 };
                    _sueetieLink.NavigateUrl = SueetieUrls.Instance.FormatUrl(_sueetieUrl.Url, _urlArgs);
                }
                else
                {
                    _sueetieLink.NavigateUrl = _sueetieUrl.Url;
                }

                if (!string.IsNullOrEmpty(this.ArgText1))
                {
                    string[] _textArgs = new string[] { this.ArgText1, this.ArgText2, this.ArgText3, this.ArgText4, this.ArgText5 };
                    _sueetieLink.Text = SueetieLocalizer.GetString(this.TextKey, _languageFile, _textArgs);
                }
                else if (!string.IsNullOrEmpty(this.Text))
                {
                    _sueetieLink.Text = SueetieLocalizer.GetString(this.Text, _languageFile);
                }
                else
                {
                    _sueetieLink.Text = SueetieLocalizer.GetString(this.TextKey, _languageFile);
                }


                if (!string.IsNullOrEmpty(this.TitleKey))
                {
                    _sueetieLink.ToolTip = SueetieLocalizer.GetString(this.TitleKey, _languageFile);
                }

                if (!string.IsNullOrEmpty(this.LinkCssClass))
                {
                    _sueetieLink.CssClass = this.LinkCssClass;
                }
                Controls.Add(_sueetieLink);
            }
            else
            {
                SueetieLogs.LogException("SUEETIE URL NOT FOUND. UrlName: " + this.UrlName ?? this.SueetieUrlLinkTo.ToString());
            }
        }