예제 #1
0
        public void Page_Init(object sender, EventArgs e)
        {
            AddCommonIncludes();

            var currentVirtualPath = URIHelper.GetCurrentVirtualPath();

            if (URIHelper.IsSame(FormsAuthentication.LoginUrl, currentVirtualPath))
            {
                return;
            }

            if (FrameworkSettings.Current.CurrentMediaDetail == null)
            {
                Response.Redirect("~/");
            }

            /*if (!IsPostBack)
             * {
             *  if ((!URIHelper.IsSpecialRequest(currentVirtualPath)) && !CurrentMediaDetail.IsCacheDataStale(UserSelectedVersion) && CurrentMediaDetail.EnableCaching && AppSettings.EnableOutputCaching && !CurrentMediaDetail.VirtualPath.Contains("/admin/") && !CurrentMediaDetail.VirtualPath.Contains("/login/") && !CurrentMediaDetail.VirtualPath.Contains("/search/"))
             *  {
             *      switch (UserSelectedVersion)
             *      {
             *          case RenderVersion.Mobile:
             *              {
             *                  BaseService.WriteRaw(CurrentMediaDetail.MobileCacheData + "<!--Loaded From Cache-->");
             *                  break;
             *              }
             *          case RenderVersion.HTML:
             *              {
             *                  BaseService.WriteRaw(CurrentMediaDetail.HtmlCacheData + "<!--Loaded From Cache-->");
             *                  break;
             *              }
             *      }
             *  }
             * }*/

            string id = CurrentMediaDetail.VirtualPath.Trim().Replace("~/", "").Replace("/", "-");

            if (id.EndsWith("-"))
            {
                id = id.Substring(0, id.Length - 1);
            }

            this.TemplateVars["BodyClass"] = id;
        }
예제 #2
0
        protected void Create_OnClick(object sender, EventArgs e)
        {
            var newUser = UsersMapper.CreateObject();

            newUser.UserName           = EmailAddress.Text;
            newUser.EmailAddress       = EmailAddress.Text;
            newUser.Password           = Password.Text;
            newUser.AuthenticationType = AuthType.Forms.ToString();
            newUser.IsActive           = true;

            /*var role = RoleEnum.FrontEndUser;
             * RoleEnum.TryParse(Category.Text, out role);
             *
             * newUser.Roles.Add(BaseMapper.GetObjectFromContext(RolesMapper.GetByEnum(role)));*/

            var returnObj  = newUser.Validate();
            var userExists = UsersMapper.GetByEmailAddress(newUser.EmailAddress);

            if (userExists != null)
            {
                returnObj.Error = ErrorHelper.CreateError("Validation Error", "An account with the same email address already exists, <a href=" + URIHelper.BaseUrl + "login>Click Here</a> to login or retrieve your password");
            }

            if (!returnObj.IsError)
            {
                returnObj = UsersMapper.Insert(newUser);
            }

            if (returnObj.IsError)
            {
                Message.Text = returnObj.Error.Exception.Message;

                if ((returnObj.Error.Exception.InnerException.Message != null) && (returnObj.Error.Exception.InnerException.Message != ""))
                {
                    Message.Text = returnObj.Error.Exception.InnerException.Message;
                }
            }
            else
            {
                var returnObjAutoResponder = SendAutoResponderEmail(newUser);
                var returnObjNotification  = SendNotificationEmails(newUser);
                Response.Redirect(URIHelper.GetCurrentVirtualPath() + "thank-you/");
            }
        }
예제 #3
0
        public static void RenderRss(IEnumerable <RssItem> rssItems = null, string rssTitle = "", string rssDescription = "", string rssLink = "")
        {
            if (rssItems == null)
            {
                rssItems = MediaDetailsMapper.GetRssItems(MediaDetailsMapper.GetAllChildMediaDetails(FrameworkSettings.Current.CurrentMedia.ID, FrameworkSettings.Current.CurrentLanguage.ID).Where(i => i.CanRender && i.MediaType.ShowInSiteTree).OrderByDescending(i => i.PublishDate));
            }

            if (rssLink == "")
            {
                if (FrameworkSettings.Current.CurrentMediaDetail != null)
                {
                    rssLink = URIHelper.ConvertToAbsUrl(FrameworkSettings.Current.CurrentMediaDetail.VirtualPath);
                }
                else
                {
                    rssLink = URIHelper.ConvertToAbsUrl(URIHelper.GetCurrentVirtualPath());
                }
            }

            if (rssTitle == "")
            {
                rssTitle = FrameworkSettings.Current.CurrentMediaDetail.Title;
            }

            if (rssDescription == "")
            {
                rssDescription = FrameworkSettings.Current.CurrentMediaDetail.GetMetaDescription();
            }

            Rss rss = new Rss(rssTitle, rssLink, rssDescription);

            rss.Items = rssItems;

            var Response = HttpContext.Current.Response;

            Response.ContentEncoding = System.Text.Encoding.UTF8;
            Response.ContentType     = "text/xml";

            RssHelper.WriteRss(rss, Response.OutputStream);

            Response.Flush();
            Response.End();
        }
예제 #4
0
        protected void Submit_OnClick(object sender, EventArgs e)
        {
            EmailLog obj = new EmailLog();

            obj.SenderName         = Name.Text;
            obj.SenderEmailAddress = Email.Text;
            obj.Message            = Message.Text;
            obj.ToEmailAddresses   = ToEmailAddresses;
            obj.Subject            = subject;
            obj.VisitorIP          = HttpContext.Current.Request.UserHostAddress;
            obj.RequestUrl         = URIHelper.GetCurrentVirtualPath(true);

            Return returnObj = EmailHelper.SendTemplate(EmailHelper.GetMailAddressesFromString(obj.ToEmailAddresses), obj.Subject, obj.SenderName, obj.SenderEmailAddress, emailTemplatePath, obj);

            if (returnObj.IsError)
            {
                this.BasePage.DisplayErrorMessage("Error sending email", returnObj.Error);
            }
            else
            {
                Response.Redirect(thankYouPage);
            }
        }
예제 #5
0
        public void Page_PreInit(object sender, EventArgs e)
        {
            var httpRuntimeSection = new System.Web.Configuration.HttpRuntimeSection();
            var settings           = GetSettings();

            if (settings.MaxRequestLength > 0)
            {
                httpRuntimeSection.MaxRequestLength = settings.MaxRequestLength;
            }

            WebFormHelper.ClearIncludesList();
            PreloadHelper.PreloadList.Clear();

            if (AppSettings.UseLoadFileServiceUrl)
            {
                WebFormHelper.LoadFileServiceUrl = AppSettings.FileServiceHandlerUrl + AppSettings.LoadFileUriSegment;
            }
            else
            {
                WebFormHelper.LoadFileServiceUrl = "";
            }

            WebFormHelper.CombineCssAndJsIncludes = AppSettings.CombineCssAndJsIncludes;

            if (Request["action"] != null)
            {
                switch (Request["action"].ToLower())
                {
                case "clearcache":
                    ContextHelper.ClearAllMemoryCache();
                    break;

                case "logout":
                    FormsAuthentication.SignOut();
                    break;
                }
            }

            if (this.MasterPageFile != null)
            {
                var masterFilePath = GetMasterPageFilePath();

                if (File.Exists(URIHelper.ConvertToAbsPath(masterFilePath)))
                {
                    MasterPageFile = masterFilePath;
                }
                else
                {
                    MasterPageFile = "";
                }
            }

            if (currentPageVirtualPath == "")
            {
                currentPageVirtualPath = URIHelper.GetCurrentVirtualPath();
            }

            if (FrameworkSettings.Current?.CurrentMediaDetail == null)
            {
                return;
            }

            if (currentPageVirtualPath == "")
            {
                currentPageVirtualPath = URIHelper.GetCurrentVirtualPath();
            }

            if (!CanAccessSection())
            {
                FormsAuthentication.RedirectToLoginPage();
                return;
            }
        }
예제 #6
0
        public IHttpHandler GetHttpHandler(RequestContext requestContext)
        {
            RedisCacheHelper.SetRedisCacheConnectionString(AppSettings.RedisCacheConnectionString);
            FileCacheHelper.SetFileSystemCacheDirPath(AppSettings.FileSystemCacheDirPath);

            virtualPath = URIHelper.GetCurrentVirtualPath().ToLower();

            var queryString = HttpContext.Current.Request.QueryString.ToString();

            queryString = System.Web.HttpUtility.UrlDecode(queryString);


            if (!Request.Path.EndsWith("/") || ((virtualPath != "~/") && (!virtualPath.EndsWith("/"))))
            {
                var path = Request.Path + "/";

                if (!string.IsNullOrEmpty(queryString))
                {
                    path = path + "?" + queryString;
                }

                HttpContext.Current.Response.RedirectPermanent(path);
            }

            Settings cmsSettings            = null;
            bool     isAttemptingAdminLogin = false;

            if ((virtualPath != "~/login/") && (virtualPath != "~/admin/") && string.IsNullOrEmpty(Request.QueryString["format"]))
            {
                cmsSettings = SettingsMapper.GetSettings();

                if (cmsSettings != null)
                {
                    var isSiteOnline = cmsSettings.IsSiteOnline();

                    if (isSiteOnline)
                    {
                        if (virtualPath.Contains(cmsSettings.SiteOfflineUrl))
                        {
                            Response.Redirect("~/");
                        }

                        AttemptToLoadFromCache();
                    }
                    else
                    {
                        if (!virtualPath.Contains(cmsSettings.SiteOfflineUrl))
                        {
                            Response.Redirect(cmsSettings.SiteOfflineUrl);
                        }
                    }
                }
                else
                {
                    AttemptToLoadFromCache();
                }
            }
            else
            {
                isAttemptingAdminLogin = true;
            }

            var languageSegment = FrameworkSettings.GetCurrentLanguage().UriSegment;

            if (LanguagesMapper.GetAllActive().Count() > 1 && !Request.Url.PathAndQuery.Contains($"/{languageSegment}/"))
            {
                var url = URIHelper.ConvertToAbsUrl("/" + languageSegment + Request.Url.PathAndQuery);
                Response.RedirectPermanent(url, true);
            }

            var segments = URIHelper.GetUriSegments(virtualPath).ToList();

            string firstSegment = "";

            if (segments.Count > 0)
            {
                firstSegment = segments[0];

                var language = LanguagesMapper.GetAllActive().SingleOrDefault(i => i.UriSegment == firstSegment);

                if (language != null)
                {
                    FrameworkSettings.SetCurrentLanguage(language);
                }
            }

            if (!isAttemptingAdminLogin && AppSettings.EnableUrlRedirectRules)
            {
                var path = virtualPath;

                if (!string.IsNullOrEmpty(queryString))
                {
                    path = path + "?" + queryString;
                }

                var redirectRule = UrlRedirectRulesMapper.GetRuleForUrl(path);

                if (redirectRule != null)
                {
                    var newUrl = redirectRule.RedirectToUrl;

                    if (newUrl.Contains("{"))
                    {
                        newUrl = MediaDetailsMapper.ParseSpecialTags(redirectRule, newUrl);
                    }

                    newUrl = URIHelper.ConvertToAbsUrl(newUrl);

                    var possibleLoopRules      = UrlRedirectRulesMapper.GetRulesFromUrl(URIHelper.ConvertAbsUrlToTilda(newUrl));
                    var foundActiveVirtualPath = MediaDetailsMapper.GetByVirtualPath(path);

                    if (possibleLoopRules.Any())
                    {
                        foreach (var rule in possibleLoopRules)
                        {
                            var returnObj = MediaDetailsMapper.DeletePermanently(rule);
                        }
                    }

                    if (foundActiveVirtualPath != null)
                    {
                        var returnObj = MediaDetailsMapper.DeletePermanently(redirectRule);
                    }

                    if (Request.QueryString.Count > 0)
                    {
                        newUrl += "?" + Request.QueryString;
                    }

                    if (redirectRule.Is301Redirect)
                    {
                        Response.RedirectPermanent(newUrl);
                    }
                    else
                    {
                        Response.Redirect(newUrl);
                    }
                }
            }

            if (!File.Exists(HttpContext.Current.Server.MapPath(virtualPath)) && !virtualPath.Contains(ParserHelper.OpenToken) && !virtualPath.Contains(ParserHelper.CloseToken))
            {
                string viewPath = "";

                long mediaDetailId = 0;
                long.TryParse(requestContext.HttpContext.Request["MediaDetailID"], out mediaDetailId);

                long mediaId = 0;
                long.TryParse(requestContext.HttpContext.Request["MediaID"], out mediaId);

                MediaDetail detail = null;

                if (mediaDetailId == 0 && mediaId == 0)
                {
                    FrameworkSettings.Current = FrameworkBaseMedia.GetInstanceByVirtualPath(virtualPath, true);
                    detail = (MediaDetail)FrameworkSettings.Current.CurrentMediaDetail;
                }
                else if (mediaDetailId != 0)
                {
                    var mediaDetail = MediaDetailsMapper.GetByID(mediaDetailId);

                    FrameworkSettings.Current = FrameworkBaseMedia.GetInstanceByMediaDetail(mediaDetail);
                    detail = (MediaDetail)FrameworkSettings.Current.CurrentMediaDetail;
                }
                else if (mediaId != 0)
                {
                    var media = MediasMapper.GetByID(mediaId);

                    FrameworkSettings.Current = FrameworkBaseMedia.GetInstanceByMedia(media);
                    detail = (MediaDetail)FrameworkSettings.Current.CurrentMediaDetail;
                }

                /*if (detail != null && !detail.CanUserAccessSection(FrameworkSettings.CurrentUser))
                 * {
                 *  FormsAuthentication.RedirectToLoginPage();
                 * }*/

                /*if (detail != null)
                 * {
                 *  var absUrlBase = URIHelper.ConvertAbsUrlToTilda(detail.AbsoluteUrl).Replace("~", "");
                 *  var absPathBase = URIHelper.ConvertAbsUrlToTilda(Request.Url.AbsolutePath).Replace("~", "");
                 *
                 *  if (absUrlBase != absPathBase)
                 *  {
                 *      Response.Redirect(detail.AbsoluteUrl + Request.Url.Query);
                 *  }
                 * }*/

                if (detail != null)
                {
                    if (detail.ForceSSL || AppSettings.ForceSSL)
                    {
                        URIHelper.ForceSSL();
                    }
                }
                else
                {
                    var currentLanguageId = FrameworkSettings.GetCurrentLanguage().ID;

                    var historyVersion = BaseMapper.GetDataModel().MediaDetails.FirstOrDefault(i => i.LanguageID == currentLanguageId && i.CachedVirtualPath == virtualPath && i.MediaType.ShowInSiteTree && i.HistoryVersionNumber != 0 && i.HistoryForMediaDetail != null);

                    if (historyVersion != null && historyVersion.VirtualPath != historyVersion.HistoryForMediaDetail.VirtualPath)
                    {
                        var foundRedirectUrl = UrlRedirectRulesMapper.GetRuleForUrl(virtualPath);

                        if (foundRedirectUrl == null)
                        {
                            var urlRedirectRule = UrlRedirectRulesMapper.CreateUrlRedirect(virtualPath, historyVersion.HistoryForMediaDetail.Media);

                            if (urlRedirectRule != null)
                            {
                                var returnObj = UrlRedirectRulesMapper.Insert(urlRedirectRule);
                                HttpContext.Current.Response.RedirectPermanent(historyVersion.HistoryForMediaDetail.CachedVirtualPath);
                            }
                            else
                            {
                                HttpContext.Current.Response.RedirectPermanent("/");
                            }
                        }
                    }
                    else
                    {
                        HttpContext.Current.Response.RedirectPermanent("/");
                    }
                }

                if ((detail == null) || (!IsValidRequest(detail)))
                {
                    detail = null;
                    if (cmsSettings != null)
                    {
                        if (!string.IsNullOrEmpty(cmsSettings.PageNotFoundUrl))
                        {
                            ErrorHelper.LogException(new Exception($"Page Not Found: {virtualPath}"));

                            Response.Redirect(cmsSettings.PageNotFoundUrl);

                            /*FrameworkSettings.CurrentFrameworkBaseMedia = null;
                             *
                             * FrameworkSettings.CurrentFrameworkBaseMedia = FrameworkBaseMedia.GetInstanceByVirtualPath(cmsSettings.PageNotFoundUrl, true);
                             * detail = (MediaDetail)FrameworkSettings.CurrentFrameworkBaseMedia.CurrentMediaDetail;
                             *
                             * ErrorHelper.LogException(new Exception($"Page Not Found: {virtualPath}"));*/

                            //Response.StatusCode = 301;
                        }
                    }
                }

                if (detail != null)
                {
                    var draft = detail.GetLatestDraft();

                    if (draft != null && (draft.PublishDate - detail.PublishDate) > TimeSpan.FromSeconds(10) && draft.CanRender)
                    {
                        var returnObj = draft.PublishLive();

                        if (!returnObj.IsError)
                        {
                            detail.RemoveFromCache();
                            draft.RemoveFromCache();

                            FrameworkSettings.Current = FrameworkBaseMedia.GetInstanceByMediaDetail(draft);
                            detail = (MediaDetail)FrameworkSettings.Current.CurrentMediaDetail;
                        }
                    }

                    if (detail.RedirectToFirstChild)
                    {
                        var child = detail.ChildMediaDetails.FirstOrDefault();

                        if (child != null)
                        {
                            var redirectPath = child.AutoCalculatedVirtualPath;

                            if (!string.IsNullOrEmpty(queryString))
                            {
                                redirectPath = redirectPath + "?" + queryString;
                            }

                            HttpContext.Current.Response.Redirect(redirectPath);
                        }
                    }

                    viewPath = FrameworkSettings.Current.CurrentMediaDetail.Handler;

                    if ((viewPath == null) || (viewPath.Trim() == ""))
                    {
                        viewPath = MediaTypesMapper.GetByID(FrameworkSettings.Current.CurrentMediaDetail.MediaTypeID).MediaTypeHandler;
                    }

                    viewPath = URIHelper.ConvertAbsUrlToTilda(viewPath);

                    if (!string.IsNullOrEmpty(Request.QueryString["format"]))
                    {
                        FrontEndBasePage.HandleFormatQueryString(detail, Request.QueryString["format"], Request.QueryString["depth"]);
                    }

                    return(CreateInstanceFromVirtualPath(viewPath, typeof(BasePage)));
                }
            }

            return(new DefaultHttpHandler());
        }
        protected void ItemsList_OnItemDataBound(object sender, ListViewItemEventArgs e)
        {
            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                HyperLink Link      = (HyperLink)e.Item.FindControl("Link");
                ListView  ChildList = (ListView)e.Item.FindControl("ChildList");

                IMediaDetail detail = (IMediaDetail)e.Item.DataItem;

                if (!displayProtectedSections && detail.IsProtected)
                {
                    if (BasePage.CurrentUser == null)
                    {
                        e.Item.Visible = false;
                    }
                }

                Link.Text = detail.LinkTitle;

                string virtualPath = detail.AutoCalculatedVirtualPath;

                if (detail.UseDirectLink)
                {
                    virtualPath = detail.DirectLink;
                }

                if (currentDepth == 1)
                {
                    if (Link.CssClass == "")
                    {
                        Link.CssClass = TopLevelAnchorClasses;
                    }
                    else
                    {
                        Link.CssClass = Link.CssClass + " " + TopLevelAnchorClasses;
                    }
                }
                else
                {
                    if (Link.CssClass == "")
                    {
                        Link.CssClass = SubAnchorClasses;
                    }
                    else
                    {
                        Link.CssClass = Link.CssClass + " " + SubAnchorClasses;
                    }
                }

                if (detail.OpenInNewWindow)
                {
                    Link.Target = "_blank";
                }

                if (!virtualPath.StartsWith("{") && !virtualPath.EndsWith("/"))
                {
                    if (!virtualPath.Contains("."))
                    {
                        virtualPath += "/";
                    }
                }

                var path = virtualPath;

                if (!virtualPath.StartsWith("{"))
                {
                    path = URIHelper.ConvertToAbsUrl(virtualPath);

                    if (path.Contains("#") && path.EndsWith("/"))
                    {
                        path = path.Remove(path.Length - 1);
                    }
                }

                if (detail.RedirectToFirstChild)
                {
                    path = detail.ChildMediaDetails.Where(i => i.ShowInMenu).ElementAt(0).AbsoluteUrl;
                }

                Link.NavigateUrl = path;

                if (IsBreadCrumbMenu)
                {
                    if (URIHelper.GetCurrentVirtualPath() == virtualPath)
                    {
                        Link.NavigateUrl = "javascript:void(0);";
                    }
                }

                HtmlContainerControl li = (HtmlContainerControl)e.Item.FindControl("li");

                if (li.Attributes["class"] == null)
                {
                    li.Attributes.Add("class", "index-" + e.Item.DataItemIndex.ToString());
                }

                if (virtualPath == currentVirtualPath || detail.VirtualPath == currentVirtualPath)
                {
                    li.Attributes["class"] += " current";
                }
                else if (currentVirtualPath.Contains(virtualPath) || currentVirtualPath.Contains(detail.VirtualPath))
                {
                    li.Attributes["class"] += " currentParent";

                    if ((rootMedia != null) && (detail.MediaID == rootMedia.ID))
                    {
                        li.Attributes["class"] += " rootParent";
                    }
                }

                li.Attributes["class"] += $" MediaID-{detail.MediaID}";

                if (li.Attributes["class"].EndsWith("-"))
                {
                    li.Attributes["class"] = li.Attributes["class"].Substring(0, li.Attributes["class"].Length - 1);
                }

                if (!string.IsNullOrEmpty(detail.CssClasses))
                {
                    li.Attributes["class"] += " " + detail.CssClasses;
                }

                if (!string.IsNullOrEmpty(SubLIClasses))
                {
                    li.Attributes["class"] += " " + SubLIClasses;
                }

                li.Attributes["class"] = li.Attributes["class"].Trim();

                IEnumerable <IMediaDetail> childItems = new List <IMediaDetail>();

                if ((rootMedia != null) && (detail.MediaID != rootMedia.ID))
                {
                    //childItems = new List<IMediaDetail>();
                    //childItems = detail.ChildMediaDetails.Where(i=>i.ShowInMenu);

                    //childItems = details.Media.ChildMedias.SelectMany(i => i.MediaDetails.Where(j => j.HistoryVersionNumber == 0 && !j.IsDeleted && j.PostPublishDate <= DateTime.Now && j.LanguageID == details.LanguageID));
                    //childItems = MediaDetailsMapper.FilterOutDeletedAndArchived(MediaDetailsMapper.GetAllChildMediaDetails(details.Media, details.Language));

                    if (!renderHiddenMediaTypes)
                    {
                        childItems = MediaDetailsMapper.GetDataModel().MediaDetails.Where(i => i.ShowInMenu && i.Media.ParentMediaID == detail.Media.ID && i.HistoryVersionNumber == 0 && i.LanguageID == detail.LanguageID && !i.IsDeleted && i.PublishDate <= DateTime.Now && (i.ExpiryDate == null || i.ExpiryDate > DateTime.Now)).OrderBy(i => i.Media.OrderIndex).ToList();
                    }
                    else
                    {
                        childItems = MediaDetailsMapper.GetDataModel().MediaDetails.Where(i => i.Media.ParentMediaID == detail.Media.ID && i.HistoryVersionNumber == 0 && i.LanguageID == detail.LanguageID && !i.IsDeleted && i.PublishDate <= DateTime.Now && (i.ExpiryDate == null || i.ExpiryDate > DateTime.Now)).OrderBy(i => i.Media.OrderIndex).ToList();
                    }
                }

                if (!detail.CssClasses.Contains("NoChildren") && childItems.Any())
                {
                    if ((currentDepth < renderDepth) || (renderDepth == -1))
                    {
                        //ChildList.LayoutTemplate = ItemsList.LayoutTemplate;
                        ChildList.ItemTemplate   = ItemsList.ItemTemplate;
                        ChildList.ItemDataBound += new EventHandler <ListViewItemEventArgs>(ItemsList_OnItemDataBound);
                        ChildList.LayoutCreated += new EventHandler(ItemsList_OnLayoutCreated);

                        if ((childItems != null) && (IsFooterMenu))
                        {
                            childItems = childItems.Where(i => i.RenderInFooter);
                        }
                        else if (childItems != null)
                        {
                            childItems = childItems.Where(i => i.ShowInMenu);
                        }

                        if (!displayProtectedSections)
                        {
                            var list = childItems.OrderBy(i => i.Media.OrderIndex).ToList();

                            if (list.Count > 0)
                            {
                                li.Attributes["class"] += " has-children";
                            }

                            if ((currentDepth > 0) && (RenderParentItemInChildNav))
                            {
                                /*var parentDetails = new List<IMediaDetail>();
                                 * detail.CssClasses = "NoChildren";
                                 * parentDetails.Add(detail);*/

                                list = list.ToList();
                                detail.CssClasses = "NoChildren";
                                ((List <IMediaDetail>)list).Insert(0, detail);

                                //list = list.Concat(parentDetails);
                            }

                            ChildList.DataSource = list;
                            ChildList.DataBind();
                        }

                        currentDepth = currentDepth - 1;
                    }
                }
            }
        }
예제 #8
0
 public static string GetCurrentFlashUrl()
 {
     return(URIHelper.BaseUrl + URIHelper.GetCurrentVirtualPath().Replace("~", "#"));
 }
예제 #9
0
 protected void ToggleViewOptions_OnSelectedIndexChanged(object sender, EventArgs e)
 {
     Response.Redirect(URIHelper.GetCurrentVirtualPath() + "?userSelectedVersion=" + this.ToggleViewOptions.SelectedValue);
 }
예제 #10
0
        protected void ForgotPasswordSend_Click(object sender, EventArgs e)
        {
            Mode = ViewMode.Forgot;

            if (string.IsNullOrEmpty(EmailAddress.Text))
            {
                return;
            }

            var user = UsersMapper.GetByEmailAddress(EmailAddress.Text);

            if (user != null)
            {
                user.ResetCode          = System.Web.Security.Membership.GeneratePassword(5, 0);
                user.ResetCodeIssueDate = DateTime.Now;

                var returnObj = UsersMapper.Update(user);

                if (!returnObj.IsError)
                {
                    returnObj = EmailHelper.Send(AppSettings.SystemEmailAddress, EmailHelper.GetMailAddressesFromString(user.EmailAddress), "Password reset", $"We just recieved a password reset request, please click the following link to reset your password: {URIHelper.GetCurrentVirtualPath(true)}?mode=reset&email={user.EmailAddress}, please use the reset code: {user.ResetCode}");

                    if (!returnObj.IsError)
                    {
                        ServerMessage.Text = $"<div class='alert alert-success' role='alert'>An email has been sent to: {user.EmailAddress}</div>";
                    }
                    else
                    {
                        ServerMessage.Text = $"<div class='alert alert-danger' role='alert'>Error sending email{returnObj.Error.Message}</div>";
                    }
                }
                else
                {
                    ServerMessage.Text = $"<div class='alert alert-danger' role='alert'>Error sending email{returnObj.Error.Message}</div>";
                }
            }
            else
            {
                ServerMessage.Text = $"<div class='alert alert-danger' role='alert'>Cannot find an account with the email address: {EmailAddress.Text}</div>";
            }
        }