This class keeps a singleton reference to the application's resource table
Пример #1
0
        protected void Page_Init(object sender, EventArgs e)
        {
            resmgr = ApplicationResourceTable.Get();

            requestPage = Page as SharedBasePage;

            if (Request.QueryString["q"] != null && Page.IsPostBack == false)
            {
                string          searchQuery = System.Web.HttpUtility.UrlDecode(Request.QueryString["q"]);
                EntryCollection entries     = SearchEntries(searchQuery);

                requestPage.WeblogEntries.AddRange(entries);

                foreach (Entry entry in requestPage.WeblogEntries)
                {
                    requestPage.ProcessItemTemplate(entry, contentPlaceHolder);
                }
            }
            else
            {
                requestPage.WeblogEntries.AddRange(new EntryCollection());
            }

            labelSearchQuery.Text = String.Format("{0}: {1}", resmgr.GetString("text_search_query_title"), Request.QueryString["q"]);

            DataBind();
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            lblTheme.Text = ApplicationResourceTable.Get().GetString("text_pick_theme");

            SharedBasePage page = Page as SharedBasePage;

            if (!page.SiteConfig.EnableStartPageCaching)
            {
                ThemeDictionary themes;

                themes = page.DataCache["Themes"] as ThemeDictionary;
                if (themes != null && themes.Count > 1)
                {
                    foreach (BlogTheme theme in themes.Values)
                    {
                        listThemes.Items.Add(new ListItem(theme.Title, theme.Name));
                    }
                }
                else
                {
                    this.Visible = false;
                }
            }
            else
            {
                this.Visible = false;
            }

            if (page.BlogTheme.Name != null && page.BlogTheme.Name.Length > 0)
            {
                listThemes.SelectedValue = page.BlogTheme.Name;
            }
        }
Пример #3
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            requestPage = Page as SharedBasePage;

            // if you are commenting on your own blog, no need for Captha
            if (SiteSecurity.IsValidContributor())
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = false;
            }
            else
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = requestPage.SiteConfig.EnableCaptcha;
            }

            resmgr = ApplicationResourceTable.Get();

            if (!IsPostBack)
            {
                if (Request.Cookies["name"] != null)
                {
                    string nameStr = HttpUtility.UrlDecode(Request.Cookies["name"].Value, Encoding.UTF8);
                    //truncate at 32 chars to avoid abuse...
                    name.Text = nameStr.Substring(0, Math.Min(32, nameStr.Length));
                }

                if (Request.Cookies["email"] != null)
                {
                    email.Text = HttpUtility.UrlDecode(Request.Cookies["email"].Value, Encoding.UTF8);
                }
            }

            DataBind();
        }
Пример #4
0
        protected override void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);

            resmgr = ApplicationResourceTable.Get();
        }
Пример #5
0
        override protected void OnInit(EventArgs e)
        {
            resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());
            SharedBasePage requestPage = Page as SharedBasePage;

            siteConfig = requestPage.SiteConfig;

            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (SiteSecurity.IsInRole("admin") == false)
            {
                Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
            }

            resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());

            if (!IsPostBack || crosspostSites == null)
            {
                LoadSites( );
            }

            BindGrid();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            SharedBasePage requestPage = this.Page as SharedBasePage;

            if (SiteSecurity.IsInRole("admin") == false)
            {
                Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
            }

            resmgr = ((ResourceManager)ApplicationResourceTable.Get());

            if (!IsPostBack || contentFilters == null)
            {
                LoadFilters();
                UpdateTestBox();
            }

            BindGrid();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (SiteSecurity.IsInRole("admin") == false)
            {
                Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
            }

            resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());

            if (!IsPostBack ||
                Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] == null)
            {
                SharedBasePage requestPage = Page as SharedBasePage;
                string         fileName    = Path.Combine(SiteConfig.GetConfigPathFromCurrentContext(), baseFileName);
                LoadList(fileName);
            }
            else
            {
                navigationRoot = Session["newtelligence.DasBlog.Web.EditNavigatorLinksBox.NavigationRoot"] as NavigationRoot;
            }
            BindGrid();
        }
Пример #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            siteConfig = SiteConfig.GetSiteConfig();

            resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());

            //set the current page <li> tag to here
            string filePath = this.Request.FilePath;

            if (filePath.EndsWith("EditCrossPostSites.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editCrossPostSites.Attributes["class"]  = "here";
                hyperLinkEditCrossPostSites.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditNavigatorLinks.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editNavigatorLinks.Attributes["class"]  = "here";
                hyperLinkEditNavigatorLinks.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditBlogRoll.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editBlogRoll.Attributes["class"]  = "here";
                hyperLinkEditBlogRoll.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditContentFilters.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editContentFilters.Attributes["class"]  = "here";
                hyperLinkEditContentFilters.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditConfig.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editConfig.Attributes["class"]  = "here";
                hyperLinkEditConfig.NavigateUrl = "";
            }
            else if (filePath.EndsWith("Referrers.aspx", StringComparison.InvariantCultureIgnoreCase) ||
                     filePath.EndsWith("Eventlog.aspx", StringComparison.InvariantCultureIgnoreCase) ||
                     filePath.EndsWith("AggBugs.aspx", StringComparison.InvariantCultureIgnoreCase) ||
                     filePath.EndsWith("ClickThroughs.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                activity.Attributes["class"]  = "here";
                hyperLinkActivity.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditEntry.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editEntry.Attributes["class"]  = "firstHere";
                hyperLinkEditEntry.NavigateUrl = "";
            }
            else if (filePath.EndsWith("EditUser.aspx", StringComparison.InvariantCultureIgnoreCase))
            {
                editUser.Attributes["class"]  = "here";
                hyperLinkEditUser.NavigateUrl = "";
            }

            // The only tab that should be visible for a contributor is the
            // "Add Entry" and "User Settings" tab
            if (SiteSecurity.IsInRole("contributor"))
            {
                this.editConfig.Visible         = false;
                this.editCrossPostSites.Visible = false;
                this.editContentFilters.Visible = false;
                this.editBlogRoll.Visible       = false;
                this.editNavigatorLinks.Visible = false;
                this.activity.Visible           = false;
            }
            DataBind();
        }
Пример #10
0
 public StatisticsListBase()
 {
     resmgr = ApplicationResourceTable.Get();
 }
 protected void EditBlogRollBox_Init(object sender, System.EventArgs e)
 {
     resmgr = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());
 }
Пример #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            resmgr = ApplicationResourceTable.Get();
            DataBind();

            if (Page.FindControl("LoginBox") == null)
            {
                this.ID = "LoginBox";

                //				string pageID = "mainForm";
                //				string parendID = this.ID+"_";

                // OmarS: form elements can no longer be accessed by name due to XHTML
                // rules. This ensures we will work on Whidbey

                /*
                 *      string usernameID = "document." + pageID + "." + parendID + "username.value";
                 *      string passwordID = "document." + pageID + "." + parendID + "password.value";
                 *      string challengeID = "document." + pageID + "." + parendID + "challenge.value";
                 */

                // PaulB: Changed the Javascript to use document.getElementById, and the WebControl.ClientID property to make
                // sure we will work on future versions.

                /*
                 *      string usernameID = String.Format("document.forms[\"{0}\"].elements[\"{1}\"].value", pageID, parendID + "username");
                 *      string passwordID = String.Format("document.forms[\"{0}\"].elements[\"{1}\"].value", pageID, parendID + "password");
                 *      string challengeID = String.Format("document.forms[\"{0}\"].elements[\"{1}\"].value", pageID, parendID + "challenge");
                 */

                // form the script that is to be registered at client side.
                String scriptString = "<script type=\"text/javascript\" language=\"JavaScript\" src=\"scripts/md5.js\"></script>\n";
                scriptString += "<script type=\"text/javascript\" language=\"javascript\">\n";
                scriptString += "	function doChallengeResponse() {\n";
                // uncomment to debug in IE.
                // IE -> Tools -> Internet Options... -> Advanced -> Browsing
                // Disable Script Debugging should be unchecked
                // scriptString += "	debugger;\n";
                scriptString += "	password = document.getElementById('"+ password.ClientID + "').value;\n";
                scriptString += "	if (password)	{\n";
                scriptString += "		password = net_md5(password);	// this makes it superchallenged!!\n";
                // get the value for the challenge
                scriptString += "		challenge = document.getElementById('"+ challenge.ClientID + "').value;\n";
                // get the value for the username
                scriptString += "		username = document.getElementById('"+ username.ClientID + "').value;\n";
                // create a challenge
                scriptString += "		str = challenge + password + username;\n";
                scriptString += "		str = net_md5(str);\n";
                // prepare the challenge and the password for the postback
                scriptString += "		document.getElementById('"+ challenge.ClientID + "').value = str;\n";
                scriptString += "		document.getElementById('"+ password.ClientID + "').value = '';\n";
                scriptString += "	}\n";
                scriptString += "}\n";
                scriptString += "</script>";

                if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "clientScript"))
                {
                    // RyanG: We shouldn't enable the password hashing function if the user has this feature
                    // disabled, otherwise the login never works if encryption is disabled.

                    /*
                     *      Page.RegisterClientScriptBlock("clientScript", scriptString);
                     *      doSignIn.Attributes.Add("onclick", "doChallengeResponse();");
                     */

                    if (SiteConfig.EncryptLoginPassword)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "clientScript", scriptString);
                        doSignIn.Attributes.Add("onclick", "doChallengeResponse();");
                    }
                }
            }

            if (!Page.IsPostBack)
            {
                FormsAuthentication.SignOut();
                challenge.Value        = Session.SessionID.ToString();
                ViewState["challenge"] = challenge.Value;
            }

            OpenIdLogin1.Visible = SiteConfig.AllowOpenIdAdmin;
        }
Пример #13
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     requestPage = this.Page as SharedBasePage;
     resmgr      = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());
     DataBind();
 }
Пример #14
0
 protected void Page_Load(object sender, System.EventArgs e)
 {
     securityLogon.Text = HttpContext.Current.User.Identity.Name;
     resmgr             = ApplicationResourceTable.Get();
     DataBind();
 }
Пример #15
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            requestPage = this.Page as SharedBasePage;

            // get lite-entries
            EntryCollection entries = requestPage.DataService.GetEntries(false);

            // sort entries
            foreach (Entry entry in entries)
            {
                if (!entry.IsPublic)
                {
                    continue;
                }

                if (entry.Categories == null || entry.Categories.Length == 0)
                {
                    EnsureCategory(NoCategory);
                    sorted[NoCategory].Add(entry);
                }
                else
                {
                    string[] catArray = entry.GetSplitCategories();
                    foreach (string cat in catArray)
                    {
                        EnsureCategory(cat);
                        sorted[cat].Add(entry);
                    }
                }
            }


            categories.Sort(StringComparer.InvariantCultureIgnoreCase);

            // Build the archive navigator
            StringBuilder catNav = new StringBuilder();

            catNav.Append("<p>");

            foreach (string cat in categories)
            {
                if (cat != NoCategory)
                {
                    catNav.AppendFormat("<a href=\"archives.aspx#{0}\">{1} ({2})</a> &#8226; ", HttpUtility.UrlEncode(cat), cat, sorted[cat].Count);
                }
            }

            // add the no-category category last
            if (categories.Contains(NoCategory))
            {
                ResourceManager resmgr         = ApplicationResourceTable.Get();;
                string          translatedNone = resmgr.GetString("text_no_category");
                catNav.AppendFormat("<a href=\"archives.aspx#{0}\">{1} ({2})</a> &#8226; ", NoCategory, translatedNone, sorted[NoCategory].Count);
            }
            catNav.Append("</p>");
            contentPlaceHolder.Controls.Add(new LiteralControl(catNav.ToString()));

            // render the categories with the post titles

            foreach (string cat in categories)
            {
                // render No Category last
                if (cat == NoCategory)
                {
                    continue;
                }

                contentPlaceHolder.Controls.Add(RenderCategoryHeader(cat));

                contentPlaceHolder.Controls.Add(RenderCategory(sorted[cat]));
            }


            // "no category" category
            if (categories.Contains(NoCategory))
            {
                ResourceManager resmgr = ApplicationResourceTable.Get();;
                string          none   = resmgr.GetString("text_no_category");

                // no link, since it's not possible to subscribe to
                contentPlaceHolder.Controls.Add(RenderCategoryHeader(NoCategory, none, false));

                contentPlaceHolder.Controls.Add(RenderCategory(sorted[NoCategory]));
            }

            DataBind();
        }
Пример #16
0
        private SendMailInfo ComposeMail(Comment c)
        {
            SharedBasePage requestPage = Page as SharedBasePage;

            MailMessage emailMessage = new MailMessage();

            if (requestPage.SiteConfig.NotificationEMailAddress != null &&
                requestPage.SiteConfig.NotificationEMailAddress.Length > 0)
            {
                emailMessage.To.Add(requestPage.SiteConfig.NotificationEMailAddress);
            }
            else
            {
                emailMessage.To.Add(requestPage.SiteConfig.Contact);
            }

            emailMessage.Sender = new MailAddress(requestPage.SiteConfig.Contact);

            emailMessage.Subject = String.Format("Weblog comment by '{0}' from '{1}' on '{2}'", c.Author, c.AuthorHomepage, c.TargetTitle);

            if (requestPage.SiteConfig.CommentsRequireApproval)
            {
                emailMessage.Body = String.Format("{0}\r\nComments page: {1}\r\n\r\nApprove comment: {2}\r\n\r\nDelete Comment: {3}",
                                                  HttpUtility.HtmlDecode(c.Content),
                                                  SiteUtilities.GetCommentViewUrl(c.TargetEntryId),
                                                  SiteUtilities.GetCommentApproveUrl(c.TargetEntryId, c.EntryId),
                                                  SiteUtilities.GetCommentDeleteUrl(c.TargetEntryId, c.EntryId));
            }
            else
            {
                emailMessage.Body = String.Format("{0}\r\nComments page: {1}\r\n\r\nDelete Comment: {2}",
                                                  HttpUtility.HtmlDecode(c.Content),
                                                  SiteUtilities.GetCommentViewUrl(c.TargetEntryId),
                                                  SiteUtilities.GetCommentDeleteUrl(c.TargetEntryId, c.EntryId));
                if (c.SpamState == SpamState.Spam)
                {
                    emailMessage.Body += "\r\nNot Spam: " + SiteUtilities.GetCommentApproveUrl(c.TargetEntryId, c.EntryId);
                }
            }

            if (requestPage.SiteConfig.EnableSpamBlockingService && (c.SpamState != SpamState.Spam))
            {
                emailMessage.Body += "\r\n\r\nReport as SPAM: "
                                     + SiteUtilities.GetCommentReportUrl(requestPage.SiteConfig, c.TargetEntryId, c.EntryId)
                                     + "\r\n  (Reporting SPAM will also delete the comment.)";
            }

            emailMessage.Body += "\r\n\r\n" + ApplicationResourceTable.GetSpamStateDescription(c.SpamState);

            emailMessage.IsBodyHtml   = false;
            emailMessage.BodyEncoding = System.Text.Encoding.UTF8;
            if (c.AuthorEmail != null && c.AuthorEmail.Length > 0)
            {
                emailMessage.From = new MailAddress(c.AuthorEmail);
            }
            else
            {
                emailMessage.From = new MailAddress(requestPage.SiteConfig.Contact);
            }

            emailMessage.Headers.Add("Sender", requestPage.SiteConfig.Contact);

            // add the X-Originating-IP header
            string      hostname    = Dns.GetHostName();
            IPHostEntry ipHostEntry = Dns.GetHostEntry(hostname);

            if (ipHostEntry.AddressList.Length > 0)
            {
                emailMessage.Headers.Add("X-Originating-IP", ipHostEntry.AddressList[0].ToString());
            }
            SendMailInfo sendMailInfo = new SendMailInfo(emailMessage, requestPage.SiteConfig.SmtpServer,
                                                         requestPage.SiteConfig.EnableSmtpAuthentication, requestPage.SiteConfig.UseSSLForSMTP, requestPage.SiteConfig.SmtpUserName,
                                                         requestPage.SiteConfig.SmtpPassword, requestPage.SiteConfig.SmtpPort);

            return(sendMailInfo);
        }
Пример #17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            SharedBasePage requestPage = this.Page as SharedBasePage;

            siteConfig = SiteConfig.GetSiteConfig();

            resmgr = ApplicationResourceTable.Get();

            imageUpload.Accept = "image/jpeg,image/gif,image/png";
            editControl.Width  = Unit.Percentage(99d);
            editControl.Height = Unit.Pixel(400);
            editControl.Text   = "<p></p>";

            // TODO: OmarS need to get rid of this
            isDHTMLEdit = true;

            editControl.SetLanguage(CultureInfo.CurrentUICulture.Name);
            editControl.SetTextDirection(requestPage.ReadingDirection);

            if (!requestPage.SiteConfig.EnableCrossposts)
            {
                gridCrossposts.Visible = false;
                labelCrosspost.Visible = false;
            }

            if (!SiteSecurity.IsValidContributor())
            {
                Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
            }

            CrosspostInfoCollection crosspostSiteInfo = new CrosspostInfoCollection();

            if (!IsPostBack)
            {
                foreach (CrosspostSite site in requestPage.SiteConfig.CrosspostSites)
                {
                    CrosspostInfo ci = new CrosspostInfo(site);
                    ci.TrackingUrlBase = SiteUtilities.GetCrosspostTrackingUrlBase(requestPage.SiteConfig);
                    crosspostSiteInfo.Add(ci);
                }

                // set up categories
                foreach (CategoryCacheEntry category in requestPage.DataService.GetCategories())
                {
                    this.categoryList.Items.Add(category.Name);
                }


                // get the cultures
                CultureInfo[] cultures = CultureInfo.GetCultures(CultureTypes.AllCultures);

                // setup temp store for listitem items, for sorting
                List <ListItem> cultureList = new List <ListItem>(cultures.Length);

                foreach (CultureInfo ci in cultures)
                {
                    string langName = (ci.NativeName != ci.EnglishName) ? ci.NativeName + " / " + ci.EnglishName : ci.NativeName;

                    if (langName.Length > 55)
                    {
                        langName = langName.Substring(0, 55) + "...";
                    }

                    cultureList.Add(new ListItem(langName, ci.Name));
                }

                // setup the sort culture
                string rssCulture = requestPage.SiteConfig.RssLanguage;

                CultureInfo sortCulture;

                try
                {
                    sortCulture = (rssCulture != null && rssCulture.Length > 0 ? new CultureInfo(rssCulture) : CultureInfo.CurrentCulture);
                }
                catch (ArgumentException)
                {
                    // default to the culture of the server
                    sortCulture = CultureInfo.CurrentCulture;
                }

                // sort the list
                cultureList.Sort(delegate(ListItem x, ListItem y)
                {
                    // actual comparison
                    return(String.Compare(x.Text, y.Text, true, sortCulture));
                });

                // add to the languages listbox
                ListItem[] cultureListItems = cultureList.ToArray();

                listLanguages.Items.AddRange(cultureListItems);

                listLanguages.SelectedValue = "";

                if (requestPage != null && requestPage.WeblogEntryId != "")
                {
                    Session["newtelligence.DasBlog.Web.EditEntryBox.OriginalReferrer"] = Request.UrlReferrer;
                    Entry entry = requestPage.DataService.GetEntryForEdit(requestPage.WeblogEntryId);

                    if (entry != null)
                    {
                        CurrentEntry       = entry;
                        entryTitle.Text    = entry.Title;
                        entryAbstract.Text = entry.Description;

                        textDate.SelectedDate = entry.CreatedLocalTime;

                        if (isDHTMLEdit)
                        {
                            editControl.Text = entry.Content;
                        }

                        foreach (string s in entry.GetSplitCategories())
                        {
                            categoryList.Items.FindByText(s).Selected = true;
                        }

                        this.checkBoxAllowComments.Checked = entry.AllowComments;
                        this.checkBoxPublish.Checked       = entry.IsPublic;
                        this.checkBoxSyndicated.Checked    = entry.Syndicated;

                        // GeoRSS.
                        this.txtLat.Text  = String.Format(CultureInfo.InvariantCulture, "{0}", entry.Latitude);
                        this.txtLong.Text = String.Format(CultureInfo.InvariantCulture, "{0}", entry.Longitude);

                        if (entry.Attachments.Count > 0)
                        {
                            foreach (Attachment enclosure in entry.Attachments)
                            {
                                enclosure.Url = SiteUtilities.GetEnclosureLinkUrl(requestPage.SiteConfig, entry.EntryId, enclosure);
                            }

                            this.enclosureUpload.Visible    = false;
                            this.buttonRemove.Visible       = true;
                            this.labelEnclosureName.Visible = true;
                            this.labelEnclosureName.Text    = entry.Attachments[0].Name;
                        }

                        listLanguages.SelectedValue = entry.Language == null ? "" : entry.Language;

                        // merge the crosspost config with the crosspost data
                        foreach (CrosspostInfo cpi in crosspostSiteInfo)
                        {
                            foreach (Crosspost cp in entry.Crossposts)
                            {
                                if (cp.ProfileName == cpi.Site.ProfileName)
                                {
                                    cpi.IsAlreadyPosted = true;
                                    cpi.TargetEntryId   = cp.TargetEntryId;
                                    cpi.Categories      = cp.Categories;
                                    break;
                                }
                            }
                        }
                        // if the entry is not public yet but opened for editing, then we can setup autosave.
                        // (If the entry was already published publically and then autosave was used, the
                        // entry's status would change to non-public and then no longer be accessible!)
                        if (requestPage.SiteConfig.EnableAutoSave && !entry.IsPublic)
                        {
                            SetupAutoSave();
                        }

                        if (requestPage.SiteConfig.EnableGoogleMaps)
                        {
                            AddGoogleMapsApi();
                        }
                    }
                }
                else // This is a brand new entry, so setup the AutoSave script if it's enabled.
                {
                    if (requestPage.SiteConfig.EnableAutoSave)
                    {
                        SetupAutoSave();
                    }

                    if (requestPage.SiteConfig.EnableGoogleMaps)
                    {
                        AddGoogleMapsApi();
                    }

                    txtLat.Text  = String.Format(CultureInfo.InvariantCulture, "{0}", siteConfig.DefaultLatitude);
                    txtLong.Text = String.Format(CultureInfo.InvariantCulture, "{0}", siteConfig.DefaultLongitude);
                }

                gridCrossposts.DataSource = crosspostSiteInfo;
                DataBind();
            }
        }
Пример #18
0
 protected void Page_Load(object sender, EventArgs e)
 {
     resmgr = ApplicationResourceTable.Get();
 }
Пример #19
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            resmgr      = ((System.Resources.ResourceManager)ApplicationResourceTable.Get());
            requestPage = Page as SharedBasePage;

            #region Setup Year Hyperlinks
            DateTime[] daysWithEntries = null;

            //Print out a list of all the years that have entries
            // with links to the Year View
            if (requestPage.SiteConfig.AdjustDisplayTimeZone)
            {
                daysWithEntries = requestPage.DataService.GetDaysWithEntries(requestPage.SiteConfig.GetConfiguredTimeZone());
            }
            else
            {
                daysWithEntries = requestPage.DataService.GetDaysWithEntries(new newtelligence.DasBlog.Util.UTCTimeZone());
            }

            var years = new SortedSet <int>();
            foreach (DateTime date in daysWithEntries)
            {
                years.Add(date.Year);
            }
            foreach (int year in years.Reverse <int>())
            {
                HyperLink h = new HyperLink();
                h.NavigateUrl = GetUrlWithYear(year);
                h.Text        = year.ToString();
                contentPlaceHolder.Controls.Add(h);

                Literal l = new Literal();
                l.Text = "&nbsp;";
                contentPlaceHolder.Controls.Add(l);
            }

            Literal l2 = new Literal();
            l2.Text = "<br /><br />";
            contentPlaceHolder.Controls.Add(l2);
            #endregion

            #region Year View
            //I know this could be cleaner and the Year viewing code could better share the Month viewing code
            // but they are sufficiently different that I chose to keep them fairly separate
            if (Request.QueryString["year"] != null)
            {
                int year         = int.Parse(Request.QueryString["year"]);
                int monthsInYear = System.Globalization.DateTimeFormatInfo.CurrentInfo.Calendar.GetMonthsInYear(year);
                for (int i = 1; i <= monthsInYear; i++)
                {
                    MonthViewCalendar c = new MonthViewCalendar();

                    ApplyCalendarStyles(c);

                    c.DayRender           += new DayRenderEventHandler(calendarMonth_DayRender);
                    c.VisibleMonthChanged += new MonthChangedEventHandler(calendarMonth_VisibleMonthChanged);
                    c.SelectionChanged    += new EventHandler(calendarMonth_SelectionChanged);
                    c.PreRender           += new EventHandler(calendarMonth_PreRender);

                    //Don't show the Next/Prev for the Year Calendar
                    c.ShowNextPrevMonth = false;

                    //Tell this Calendar to show a specific month
                    c.VisibleDate = new DateTime(year, i, 1);

                    contentPlaceHolder.Controls.Add(c);
                }
                requestPage.TitleOverride = year.ToString();
            }
            #endregion
            else             //Month View
            #region Month View
            {
                //Setup the Event Handlers for the Calendar
                calendarMonth.DayRender           += new DayRenderEventHandler(calendarMonth_DayRender);
                calendarMonth.VisibleMonthChanged += new MonthChangedEventHandler(calendarMonth_VisibleMonthChanged);
                calendarMonth.SelectionChanged    += new EventHandler(calendarMonth_SelectionChanged);
                calendarMonth.PreRender           += new EventHandler(calendarMonth_PreRender);

                ApplyCalendarStyles(calendarMonth);

                contentPlaceHolder.Controls.Add(calendarMonth);

                //Default to this month, otherwise parse out a yyyy-MM
                if (Request.QueryString["month"] == null)
                {
                    _month = DateTime.Now.Date;
                }
                else
                {
                    try
                    {
                        _month = DateTime.ParseExact(Request.QueryString["month"], "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture);
                    }
                    catch
                    {
                    }
                }

                //Set the title, and tell the calendar to show today
                requestPage.TitleOverride = _month.ToString("MMMM, yyyy");
                calendarMonth.VisibleDate = _month;
            }
            #endregion
        }
Пример #20
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            SharedBasePage requestPage = Page as SharedBasePage;

            // only allow users to login using openid when we actually allow it
            if (requestPage.SiteConfig.AllowOpenIdComments == true)
            {
                OpenIdRelyingParty      openid   = new OpenIdRelyingParty();
                IAuthenticationResponse response = openid.GetResponse();
                if (response != null)
                {
                    // Stage 3: OpenID Provider sending assertion response
                    switch (response.Status)
                    {
                    case AuthenticationStatus.Authenticated:
                        ClaimsResponse sregResponse = response.GetExtension <ClaimsResponse>();
                        FetchResponse  axResponse   = response.GetExtension <FetchResponse>();
                        string         nick         = response.FriendlyIdentifierForDisplay;
                        string         homepage     = response.ClaimedIdentifier;
                        string         email        = "*****@*****.**";
                        if (sregResponse != null)
                        {
                            nick  = string.IsNullOrEmpty(sregResponse.Nickname) ? sregResponse.FullName : sregResponse.Nickname;
                            email = sregResponse.Email;
                        }

                        if (String.IsNullOrEmpty(nick) && axResponse != null && axResponse.Attributes.Contains(WellKnownAttributes.Name.First) && axResponse.Attributes.Contains(WellKnownAttributes.Name.Last))
                        {
                            nick = axResponse.GetAttributeValue(WellKnownAttributes.Name.First) + " " +
                                   axResponse.GetAttributeValue(WellKnownAttributes.Name.Last);
                        }

                        string comment = Session["pendingComment"] as string;
                        string entryId = Session["pendingEntryId"] as string;
                        if (String.IsNullOrEmpty(comment) == false && String.IsNullOrEmpty(entryId) == false)
                        {
                            AddNewComment(nick, email, homepage, comment, entryId, /* openid */ true);
                        }

                        break;
                    }
                }
            }

            // if you are commenting on your own blog, no need for Captha
            if (SiteSecurity.IsValidContributor())
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = false;
            }
            else
            {
                CaptchaControl1.Enabled = CaptchaControl1.Visible = requestPage.SiteConfig.EnableCaptcha;
            }

            resmgr = ApplicationResourceTable.Get();

            if (!IsPostBack)
            {
                if (requestPage.WeblogEntryId.Length == 0)
                {
                    requestPage.Redirect(SiteUtilities.GetStartPageUrl(requestPage.SiteConfig));
                }
                ViewState["entryId"] = requestPage.WeblogEntryId;

                if (Request.Cookies["name"] != null)
                {
                    string nameStr = HttpUtility.UrlDecode(Request.Cookies["name"].Value, Encoding.UTF8);
                    //truncate at 32 chars to avoid abuse...
                    name.Text = nameStr.Substring(0, Math.Min(32, nameStr.Length));
                }

                if (Request.Cookies["email"] != null)
                {
                    email.Text = HttpUtility.UrlDecode(Request.Cookies["email"].Value, Encoding.UTF8);
                }

                if (Request.Cookies["homepage"] != null)
                {
                    homepage.Text = HttpUtility.UrlDecode(Request.Cookies["homepage"].Value, Encoding.UTF8);
                }

                if (Request.Cookies["openid"] != null)
                {
                    openid_identifier.Text = HttpUtility.UrlDecode(Request.Cookies["openid"].Value, Encoding.UTF8);
                }
            }

            DataBind();
        }
Пример #21
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            resmgr = ApplicationResourceTable.Get();

            if (!Page.IsPostBack)
            {
                DateTime dt = new DateTime(DateTime.Now.Year, 1, 1);

                DateTime filteredDate = DateTime.UtcNow;

                string date = null;

                if (this.Request.QueryString["date"] != null)
                {
                    date = this.Request.QueryString["date"];

                    try
                    {
                        filteredDate = DateTime.ParseExact(date, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                    }
                    catch (FormatException ex)
                    {
                        ErrorTrace.Trace(TraceLevel.Error, ex);
                    }
                }

                // move the local/non-local date logic to one place

                if (((SharedBasePage)Page).SiteConfig.AdjustDisplayTimeZone && date == null)
                {
                    newtelligence.DasBlog.Util.WindowsTimeZone tz = ((SharedBasePage)Page).SiteConfig.GetConfiguredTimeZone();
                    filteredDate = tz.ToLocalTime(filteredDate);
                }

                // someone is trying to mess with us, let's play along
                if (filteredDate.Year > dt.Year || filteredDate.Year < dt.Year - 11)
                {
                    dt = new DateTime(filteredDate.Year, 1, 1);
                }

                for (int i = 0; i > -12; i--)
                {
                    this.DropDownListYear.Items.Add(dt.AddYears(i).ToString("yyyy"));
                }

                try{
                    this.DropDownListYear.SelectedValue = filteredDate.Year.ToString();
                }catch (ArgumentOutOfRangeException) {
                    //.. tried to set a year in the future, that's not in the list.
                }

                for (int i = 0; i < 12; i++)
                {
                    this.DropDownListMonth.Items.Add(dt.AddMonths(i).ToString("MMMM"));
                }

                this.DropDownListMonth.SelectedIndex = filteredDate.Month - 1;

                int numDays = DateTime.DaysInMonth(Convert.ToInt32(this.DropDownListYear.SelectedItem.Text), this.DropDownListMonth.SelectedIndex + 1);

                for (int i = 1; i <= numDays; i++)
                {
                    this.DropDownListDay.Items.Add(i.ToString());
                }

                this.DropDownListDay.SelectedIndex = filteredDate.Day - 1;

                // set the href for for the links

                DateTime nextDate     = filteredDate.AddDays(1);
                DateTime previousDate = filteredDate.AddDays(-1);
                DateTime today        = DateTime.Now;

                string requestUrl = this.Context.Request.Path;
                string dateFormat = "{0}?date={1:yyyy-MM-dd}";

                this.linkNext.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                   dateFormat,
                                                   requestUrl,
                                                   nextDate);

                this.linkPrevious.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                       dateFormat,
                                                       requestUrl,
                                                       previousDate);

                this.linkToday.HRef = String.Format(System.Globalization.CultureInfo.InvariantCulture,
                                                    dateFormat,
                                                    requestUrl,
                                                    today);
            }

            DataBind();
        }
Пример #22
0
 protected void EditConfigBox_Init(object sender, EventArgs e)
 {
     resmgr = ApplicationResourceTable.Get();
 }
Пример #23
0
        protected void Page_PreRender(object sender, System.EventArgs e)
        {
            SharedBasePage requestPage = Page as SharedBasePage;

            Control            root  = this;
            HtmlGenericControl entry = new HtmlGenericControl("div");

            if (SiteSecurity.GetUserByEmail(comment.AuthorEmail) == null)
            {
                entry.Attributes["class"] = "commentBoxStyle";
            }
            else
            {
                entry.Attributes["class"] = "commentBoxStyle commentBoxAuthorStyle";
            }
            root.Controls.Add(entry);

            HtmlGenericControl entryTitle = new HtmlGenericControl("div");

            entryTitle.Attributes["class"] = "commentDateStyle";

            //Add the unique anchor for each comment
            HtmlAnchor anchor = new HtmlAnchor();

            anchor.Name = comment.EntryId;
            entryTitle.Controls.Add(anchor);

            if (requestPage.SiteConfig.AdjustDisplayTimeZone)
            {
                entryTitle.Controls.Add(new LiteralControl(requestPage.SiteConfig.GetConfiguredTimeZone().FormatAdjustedUniversalTime(comment.CreatedUtc)));
            }
            else
            {
                entryTitle.Controls.Add(new LiteralControl(comment.CreatedUtc.ToString("U") + " UTC"));
            }
            entry.Controls.Add(entryTitle);


            HtmlGenericControl entryBody = new HtmlGenericControl("div");

            if (SiteSecurity.GetUserByEmail(comment.AuthorEmail) == null)
            {
                entryBody.Attributes["class"] = "commentBodyStyle";
            }
            else
            {
                entryBody.Attributes["class"] = "commentBodyStyle commentBodyAuthorStyle";
            }

            if (comment.Content != null)
            {
                entryBody.Controls.Add(new LiteralControl(Regex.Replace(comment.Content, "\n", "<br />")));
            }
            if (!requestPage.HideAdminTools && SiteSecurity.IsInRole("admin"))
            {
                HtmlGenericControl spamStatus = new HtmlGenericControl("div");
                spamStatus.Attributes["class"] = "commentSpamStateStyle";
                spamStatus.InnerText           = ApplicationResourceTable.GetSpamStateDescription(comment.SpamState);
                entryBody.Controls.Add(spamStatus);
            }


            entry.Controls.Add(entryBody);

            HtmlGenericControl footer = new HtmlGenericControl("div");

            footer.Attributes["class"] = "commentBoxFooterStyle";
            entry.Controls.Add(footer);


            if (requestPage.SiteConfig.CommentsAllowGravatar && String.IsNullOrEmpty(comment.AuthorEmail) == false)
            {
                string hash = "";
                byte[] data, enc;

                data = Encoding.Default.GetBytes(comment.AuthorEmail.ToLowerInvariant());

                using (MD5 md5 = new MD5CryptoServiceProvider())
                {
                    enc = md5.TransformFinalBlock(data, 0, data.Length);
                    foreach (byte b in md5.Hash)
                    {
                        hash += Convert.ToString(b, 16).ToLower().PadLeft(2, '0');
                    }
                    md5.Clear();
                }

                string nogravpath = "";
                if (requestPage.SiteConfig.CommentsGravatarNoImgPath != null)
                {
                    if (requestPage.SiteConfig.CommentsGravatarNoImgPath != "")
                    {
                        if (requestPage.SiteConfig.CommentsGravatarNoImgPath.Substring(0, 4) == "http")
                        {
                            nogravpath = "&default=" + Server.UrlEncode(requestPage.SiteConfig.CommentsGravatarNoImgPath);
                        }
                        else
                        {
                            nogravpath = "&default=" + Server.UrlEncode(requestPage.SiteConfig.Root + requestPage.SiteConfig.CommentsGravatarNoImgPath);
                        }
                    }
                }

                if (String.IsNullOrEmpty(requestPage.SiteConfig.CommentsGravatarNoImgPath) == false)
                {
                    if (requestPage.SiteConfig.CommentsGravatarNoImgPath == "identicon" ||
                        requestPage.SiteConfig.CommentsGravatarNoImgPath == "wavatar" ||
                        requestPage.SiteConfig.CommentsGravatarNoImgPath == "monsterid" ||
                        requestPage.SiteConfig.CommentsGravatarNoImgPath.Substring(0, 4) == "http")
                    {
                        nogravpath = "&default=" + Server.UrlEncode(requestPage.SiteConfig.CommentsGravatarNoImgPath);
                    }
                    else
                    {
                        nogravpath = "&default=" + Server.UrlEncode(requestPage.SiteConfig.Root + requestPage.SiteConfig.CommentsGravatarNoImgPath);
                    }
                }

                string gravborder = "";
                if (requestPage.SiteConfig.CommentsGravatarBorder != null)
                {
                    if (requestPage.SiteConfig.CommentsGravatarBorder != "")
                    {
                        gravborder = "&border=" + requestPage.SiteConfig.CommentsGravatarBorder;
                    }
                }

                string gravsize = "";
                if (requestPage.SiteConfig.CommentsGravatarSize != null)
                {
                    if (requestPage.SiteConfig.CommentsGravatarSize != "")
                    {
                        gravsize = "&size=" + requestPage.SiteConfig.CommentsGravatarSize;
                    }
                }

                string gravrating = "";
                if (requestPage.SiteConfig.CommentsGravatarRating != null)
                {
                    if (requestPage.SiteConfig.CommentsGravatarRating != "")
                    {
                        gravrating = "&rating=" + requestPage.SiteConfig.CommentsGravatarRating;
                    }
                }



                HtmlGenericControl entryGRAVATAR = new HtmlGenericControl("span");
                entryGRAVATAR.Attributes["class"] = "commentGravatarBlock";
                entryGRAVATAR.InnerHtml           = "<img class=\"commentGravatar\" src=\"http://www.gravatar.com/avatar.php?gravatar_id=" + hash + gravrating + gravsize + nogravpath + gravborder + "\"/>";
                footer.Controls.Add(entryGRAVATAR);
            }

            string authorLink = null;

            if (comment.AuthorHomepage != null && comment.AuthorHomepage.Length > 0)
            {
                authorLink = FixUrl(comment.AuthorHomepage);
            }
            else if (comment.AuthorEmail != null && comment.AuthorEmail.Length > 0)
            {
                if (!requestPage.SiteConfig.SupressEmailAddressDisplay)
                {
                    authorLink = "mailto:" + SiteUtilities.SpamBlocker(comment.AuthorEmail);
                }
            }

            if (authorLink != null)
            {
                HyperLink link = new HyperLink();
                link.Attributes["class"] = "commentPermalinkStyle";
                link.NavigateUrl         = authorLink;
                link.Text = comment.Author;
                link.Attributes.Add("rel", "nofollow");
                footer.Controls.Add(link);

                if (comment.OpenId)
                {
                    System.Web.UI.WebControls.Image i = new System.Web.UI.WebControls.Image();
                    i.ImageUrl = "~/images/openid-icon-small.gif";
                    i.CssClass = "commentOpenId";
                    link.Controls.Add(i);
                    Literal l = new Literal();
                    l.Text = comment.Author;
                    link.Controls.Add(l);
                }
            }
            else
            {
                Label l = new Label();
                l.Attributes["class"] = "commentPermalinkStyle";
                l.Text = comment.Author;
                footer.Controls.Add(l);
            }


            if (!requestPage.SiteConfig.SupressEmailAddressDisplay)
            {
                if (comment.AuthorEmail != null && comment.AuthorEmail.Length > 0)
                {
                    footer.Controls.Add(new LiteralControl(" | "));

                    HtmlGenericControl mailto = new HtmlGenericControl("span");
                    footer.Controls.Add(mailto);

                    HyperLink link = new HyperLink();
                    link.CssClass    = "commentMailToStyle";
                    link.NavigateUrl = "mailto:" + SiteUtilities.SpamBlocker(comment.AuthorEmail);
                    link.Text        = SiteUtilities.SpamBlocker(comment.AuthorEmail);
                    mailto.Controls.Add(link);
                }
            }

            if (!requestPage.HideAdminTools && SiteSecurity.IsInRole("admin"))
            {
                if (!string.IsNullOrEmpty(comment.AuthorIPAddress))
                {
                    try
                    {
                        if (requestPage.SiteConfig.ResolveCommenterIP == true)
                        {
                            System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostEntry(comment.AuthorIPAddress);
                            footer.Controls.Add(
                                new LiteralControl(" (" + comment.AuthorIPAddress + " " + hostInfo.HostName + ") "));
                        }
                        else
                        {
                            footer.Controls.Add(new LiteralControl(" (" + comment.AuthorIPAddress + ") "));
                        }
                    }
                    catch
                    {
                        footer.Controls.Add(new LiteralControl(" (" + comment.AuthorIPAddress + ") "));
                    }
                }

                footer.Controls.Add(new LiteralControl(" "));

                // create delete hyperlink
                HyperLink deleteHl = new HyperLink();
                deleteHl.CssClass = "deleteLinkStyle";
                System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
                img.CssClass    = "deleteLinkImageStyle";
                img.ImageUrl    = new Uri(new Uri(SiteUtilities.GetBaseUrl(requestPage.SiteConfig)), requestPage.GetThemedImageUrl("deletebutton")).ToString();
                img.BorderWidth = 0;
                deleteHl.Controls.Add(img);
                deleteHl.NavigateUrl = String.Format("javascript:deleteComment(\"{0}\", \"{1}\", \"{2}\")", Comment.TargetEntryId, Comment.EntryId, Comment.Author == null ? String.Empty : Comment.Author.Replace("\"", "\\\""));

                ResourceManager resmgr = resmgr = ApplicationResourceTable.Get();

                if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "deleteCommentScript"))
                {
                    // add the javascript to allow deletion of the comment
                    string scriptString = "<script type=\"text/javascript\" language=\"JavaScript\">\n";
                    scriptString += "function deleteComment(entryId, commentId, commentFrom)\n";
                    scriptString += "{\n";
                    scriptString += String.Format("	if(confirm(\"{0} \\n\\n\" + commentFrom))\n", resmgr.GetString("text_delete_confirm"));
                    scriptString += "	{\n";
                    scriptString += "		location.href=\"deleteItem.ashx?entryid=\" +  entryId + \"&commentId=\" + commentId\n";
                    scriptString += "	}\n";
                    scriptString += "}\n";
                    scriptString += "</script>";

                    Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "deleteCommentScript", scriptString);
                }


                footer.Controls.Add(deleteHl);

                // create approve hyperlink, when a comment is not public or if its marked as spam
                if ((!Comment.IsPublic) || (Comment.SpamState == SpamState.Spam))
                {
                    HyperLink approveHl = new HyperLink();
                    approveHl.CssClass = "approveLinkStyle";
                    System.Web.UI.WebControls.Image okImg = new System.Web.UI.WebControls.Image();
                    okImg.CssClass    = "approveImageStyle";
                    okImg.ImageUrl    = new Uri(new Uri(SiteUtilities.GetBaseUrl(requestPage.SiteConfig)), requestPage.GetThemedImageUrl("okbutton-list")).ToString();
                    okImg.BorderWidth = 0;
                    approveHl.Controls.Add(okImg);
                    approveHl.NavigateUrl = String.Format("javascript:approveComment(\"{0}\", \"{1}\")", Comment.TargetEntryId, Comment.EntryId);

                    if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "approveCommentScript"))
                    {
                        string approveScript = "<script type=\"text/javascript\" language=\"JavaScript\">\n";
                        approveScript += "function approveComment(entryId, commentId)\n";
                        approveScript += "{\n";
                        approveScript += "	location.href=\"approveItem.ashx?entryid=\" +  entryId + \"&commentId=\" + commentId\n";
                        approveScript += "}\n";
                        approveScript += "</script>";

                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "approveCommentScript", approveScript);
                    }

                    footer.Controls.Add(approveHl);
                }
                ISpamBlockingService spamBlockingService = requestPage.SiteConfig.SpamBlockingService;
                if ((spamBlockingService != null) && (comment.SpamState != SpamState.Spam))
                {
                    HyperLink reportSpamLink = new HyperLink();
                    reportSpamLink.CssClass = "approveLinkStyle";
                    System.Web.UI.WebControls.Image spamImg = new System.Web.UI.WebControls.Image();
                    spamImg.CssClass    = "approveImageStyle";
                    spamImg.ImageUrl    = new Uri(new Uri(SiteUtilities.GetBaseUrl(requestPage.SiteConfig)), requestPage.GetThemedImageUrl("reportspambutton")).ToString();
                    spamImg.BorderWidth = 0;
                    reportSpamLink.Controls.Add(spamImg);
                    reportSpamLink.NavigateUrl = String.Format("javascript:reportComment(\"{0}\", \"{1}\", \"{2}\")", Comment.TargetEntryId, Comment.EntryId, Comment.Author == null ? String.Empty : Comment.Author.Replace("\"", "\\\""));

                    string reportScript = "<script type=\"text/javascript\" language=\"JavaScript\">\n";
                    reportScript += "function reportComment(entryId, commentId, commentFrom)\n";
                    reportScript += "{\n";
                    reportScript += String.Format("	if(confirm(\"{0} \\n\\n\" + commentFrom))\n", resmgr.GetString("text_reportspam_confirm"));
                    reportScript += "	{\n";
                    reportScript += "		location.href=\"deleteItem.ashx?report=true&entryid=\" +  entryId + \"&commentId=\" + commentId\n";
                    reportScript += "	}\n";
                    reportScript += "}\n";
                    reportScript += "</script>";

                    if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "reportCommentScript"))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "reportCommentScript", reportScript);
                    }

                    footer.Controls.Add(reportSpamLink);
                }
            }
        }