protected void Page_Load(object sender, EventArgs e)
    {
        // Ensure modal dialog opening
        ScriptHelper.RegisterDialogScript(this);

        int reportID = QueryHelper.GetInteger("reportid", 0);

        ucAbuseEdit.ReportID = reportID;

        AbuseReportInfo ar = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);

        // Set edited object
        EditedObject = ar;

        if (ar != null)
        {
            // Set breadcrumb
            PageBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
            {
                Text = ar.ReportTitle
            });

            // Ensure that object belongs to current site or user is global admin
            if (!MembershipContext.AuthenticatedUser.CheckPrivilegeLevel(UserPrivilegeLevelEnum.Admin) && (ar.ReportSiteID != SiteContext.CurrentSiteID))
            {
                RedirectToInformation(GetString("general.notassigned"));
            }
        }

        ucAbuseEdit.OnCheckPermissions += ucAbuseEdit_OnCheckPermissions;
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set the page title
        CurrentMaster.Title.TitleText     = GetString("abuse.properties");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/CMS_AbuseReport/object.png");
        CurrentMaster.Title.HelpTopicName = "abusereport";

        int reportID = QueryHelper.GetInteger("reportid", 0);

        ucAbuseEdit.ReportID = reportID;

        // Initializes page breadcrumbs
        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("abuse.reports");
        breadcrumbs[0, 1]     = "~/CMSModules/AbuseReport/AbuseReport_List.aspx";

        AbuseReportInfo ar = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);

        // Set edited object
        EditedObject = ar;

        if (ar != null)
        {
            // Set breadcrumbs
            breadcrumbs[1, 0] = HTMLHelper.HTMLEncode(ar.ReportTitle);
        }

        CurrentMaster.Title.Breadcrumbs = breadcrumbs;
        ucAbuseEdit.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(ucAbuseEdit_OnCheckPermissions);
    }
Example #3
0
    /// <summary>
    /// Gets and bulk updates abuse reports. Called when the "Get and bulk update reports" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateAbuseReports()
    {
        // Prepare the parameters
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the data
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Loop through the individual items
            foreach (DataRow reportDr in reports.Tables[0].Rows)
            {
                // Create object from DataRow
                AbuseReportInfo modifyReport = new AbuseReportInfo(reportDr);

                // Update the properties
                modifyReport.ReportStatus = AbuseReportStatusEnum.Rejected;

                // Save the changes
                AbuseReportInfoProvider.SetAbuseReportInfo(modifyReport);
            }

            return(true);
        }

        return(false);
    }
Example #4
0
    /// <summary>
    /// Initializes and updates breadcrumbs items.
    /// </summary>
    private void SetupBreadcrumbs()
    {
        ucBreadcrumbs.Items.Clear();

        ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
        {
            Text          = GetString("abuse.reports"),
            OnClientClick = ControlsHelper.GetPostBackEventReference(lnkBackHidden) + "; return false;"
        });

        int reportID = ValidationHelper.GetInteger(ucAbuseEdit.ReportID, 0);

        if (!String.IsNullOrEmpty(hfEditReport.Value))
        {
            reportID = ValidationHelper.GetInteger(hfEditReport.Value, 0);
        }

        AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);

        if (ari != null)
        {
            ucBreadcrumbs.AddBreadcrumb(new BreadcrumbItem
            {
                Text = ari.ReportTitle,
            });
        }
    }
Example #5
0
 /// <summary>
 /// Unigrid event handler.
 /// </summary>
 /// <param name="actionName">Name of action</param>
 /// <param name="actionArgument">ID (value of Primary key) of corresponding data row</param>
 protected void UniGrid_OnAction(string actionName, object actionArgument)
 {
     // Edit report
     if (actionName == "edit")
     {
         if (!UseEditOnPostback)
         {
             URLHelper.Redirect(UrlResolver.ResolveUrl("AbuseReport_Edit.aspx?reportid=" + actionArgument));
         }
         else
         {
             EditReportID = ValidationHelper.GetInteger(actionArgument, 0);
         }
     }
     // Delete report
     else if (actionName == "delete")
     {
         // Check permissions
         if (CheckPermissions("CMS.AbuseReport", "Manage"))
         {
             AbuseReportInfoProvider.DeleteAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0));
         }
     }
     // Solve report
     else if (actionName == "solve")
     {
         // Check permissions
         if (CheckPermissions("CMS.AbuseReport", "Manage"))
         {
             AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0));
             if (ari != null)
             {
                 ari.ReportStatus = AbuseReportStatusEnum.Solved;
                 AbuseReportInfoProvider.SetAbuseReportInfo(ari);
             }
         }
     }
     // Reject report
     else if (actionName == "reject")
     {
         // Check permissions
         if (CheckPermissions("CMS.AbuseReport", "Manage"))
         {
             AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(ValidationHelper.GetInteger(actionArgument, 0));
             if (ari != null)
             {
                 ari.ReportStatus = AbuseReportStatusEnum.Rejected;
                 AbuseReportInfoProvider.SetAbuseReportInfo(ari);
             }
         }
     }
 }
Example #6
0
    /// <summary>
    /// Deletes abuse report. Called when the "Delete report" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool DeleteAbuseReport()
    {
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the report
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Create the object from DataRow
            AbuseReportInfo deleteReport = new AbuseReportInfo(reports.Tables[0].Rows[0]);

            // Delete the abuse report
            AbuseReportInfoProvider.DeleteAbuseReportInfo(deleteReport);

            return(true);
        }

        return(false);
    }
Example #7
0
    public override bool LoadData(ActivityInfo ai)
    {
        if ((ai == null) || ai.ActivityType != PredefinedActivityType.ABUSE_REPORT)
        {
            return(false);
        }

        int nodeId = ai.ActivityNodeID;

        lblDocIDVal.Text = GetLinkForDocument(nodeId, ai.ActivityCulture);

        AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(ai.ActivityItemID);

        if (ari != null)
        {
            txtComment.Text = ari.ReportComment;
        }

        return(true);
    }
Example #8
0
    /// <summary>
    /// Deletes abuse report. Called when the "Delete report" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool DeleteAbuseReport()
    {
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the report
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Create the object from DataRow
            AbuseReportInfo deleteReport = new AbuseReportInfo(reports.Tables[0].Rows[0]);

            // Delete the abuse report
            AbuseReportInfoProvider.DeleteAbuseReportInfo(deleteReport);

            return true;
        }

        return false;
    }
Example #9
0
    protected override void OnPreRender(EventArgs e)
    {
        if ((ucAbuseReportList.EditReportID != 0) || (!String.IsNullOrEmpty(hfEditReport.Value)))
        {
            ucAbuseEdit.Visible              = true;
            ucAbuseReportList.Visible        = false;
            ucAbuseReportList.StopProcessing = true;
            ucAbuseEdit.StopProcessing       = false;

            int reportID = 0;

            ucAbuseEdit.ReportID = ucAbuseReportList.EditReportID;

            bool editForceLoad = false;
            if (ucAbuseEdit.ReportID != 0)
            {
                hfEditReport.Value = ucAbuseEdit.ReportID.ToString();
                reportID           = ucAbuseEdit.ReportID;
                editForceLoad      = true;
            }

            ucAbuseEdit.ReloadData(editForceLoad);

            //Breadcrumbs
            lblEditBack.Text = " <span class=\"TitleBreadCrumbSeparator\">&nbsp;</span> ";
            lnkEditBack.Text = GetString("abuse.reports");

            if (!String.IsNullOrEmpty(hfEditReport.Value))
            {
                reportID = ValidationHelper.GetInteger(hfEditReport.Value, 0);
            }

            AbuseReportInfo ari = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);
            if (ari != null)
            {
                lblEditNew.Text = HTMLHelper.HTMLEncode(ari.ReportTitle);
            }
            pnlHeader.Visible = true;
        }
        base.OnPreRender(e);
    }
Example #10
0
    /// <summary>
    /// Creates abuse report. Called when the "Create report" button is pressed.
    /// </summary>
    private bool CreateAbuseReport()
    {
        // Create new abuse report object
        AbuseReportInfo newReport = new AbuseReportInfo();

        // Set the properties
        newReport.ReportTitle   = "MyNewReport";
        newReport.ReportComment = "This is an example abuse report.";

        newReport.ReportURL     = URLHelper.GetAbsoluteUrl(RequestContext.CurrentURL);
        newReport.ReportCulture = LocalizationContext.PreferredCultureCode;
        newReport.ReportSiteID  = SiteContext.CurrentSiteID;
        newReport.ReportUserID  = MembershipContext.AuthenticatedUser.UserID;
        newReport.ReportWhen    = DateTime.Now;
        newReport.ReportStatus  = AbuseReportStatusEnum.New;

        // Save the abuse report
        AbuseReportInfoProvider.SetAbuseReportInfo(newReport);

        return(true);
    }
    /// <summary>
    /// Creates abuse report. Called when the "Create report" button is pressed.
    /// </summary>
    private bool CreateAbuseReport()
    {
        // Create new abuse report object
        AbuseReportInfo newReport = new AbuseReportInfo();

        // Set the properties
        newReport.ReportTitle = "MyNewReport";
        newReport.ReportComment = "This is an example abuse report.";

        newReport.ReportURL = URLHelper.GetAbsoluteUrl(RequestContext.CurrentURL);
        newReport.ReportCulture = LocalizationContext.PreferredCultureCode;
        newReport.ReportSiteID = SiteContext.CurrentSiteID;
        newReport.ReportUserID = MembershipContext.AuthenticatedUser.UserID;
        newReport.ReportWhen = DateTime.Now;
        newReport.ReportStatus = AbuseReportStatusEnum.New;

        // Save the abuse report
        AbuseReportInfoProvider.SetAbuseReportInfo(newReport);

        return true;
    }
Example #12
0
    /// <summary>
    /// Log activity
    /// </summary>
    /// <param name="ari">Report info</param>
    private void LogActivity(AbuseReportInfo ari)
    {
        var activityContext = AnalyticsContext.ActivityEnvironmentVariables;

        // Backup referrer and current URL from AnalyticsContext
        string originalReferrer = activityContext.CurrentURLReferrer;
        Uri    originalURL      = activityContext.CurrentURL;

        // Set it to the values from AbuseReportInfo so correct ones are used to create Activity
        activityContext.CurrentURLReferrer = "";
        if (ari.ReportURL != null)
        {
            activityContext.CurrentURL = new Uri(ari.ReportURL);
        }

        Activity activity = new ActivityAbuseReport(ari, activityContext);

        activity.Log();

        // Set old values back to AnalyticsContext
        activityContext.CurrentURLReferrer = originalReferrer;
        activityContext.CurrentURL         = originalURL;
    }
Example #13
0
    /// <summary>
    /// Log activity
    /// </summary>
    /// <param name="ari">Report info</param>
    private void LogActivity(AbuseReportInfo ari)
    {
        if ((CMSContext.ViewMode != ViewModeEnum.LiveSite) ||
            (ari == null) ||
            !ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser) ||
            !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(ari.ReportSiteID) ||
            !ActivitySettingsHelper.AbuseReportEnabled(ari.ReportSiteID))
        {
            return;
        }
        var data = new ActivityData()
        {
            ContactID = ModuleCommands.OnlineMarketingGetCurrentContactID(),
            SiteID    = ari.ReportSiteID,
            Type      = PredefinedActivityType.ABUSE_REPORT,
            TitleData = ari.ReportTitle,
            ItemID    = ari.ReportID,
            URL       = URLHelper.CurrentRelativePath,
            Campaign  = CMSContext.Campaign
        };

        ActivityLogProvider.LogActivity(data);
    }
Example #14
0
    /// <summary>
    /// Gets and updates abuse report. Called when the "Get and update report" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool GetAndUpdateAbuseReport()
    {
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the report
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Create the object from DataRow
            AbuseReportInfo updateReport = new AbuseReportInfo(reports.Tables[0].Rows[0]);

            // Update the properties
            updateReport.ReportStatus = AbuseReportStatusEnum.Solved;

            // Save the changes
            AbuseReportInfoProvider.SetAbuseReportInfo(updateReport);

            return(true);
        }

        return(false);
    }
Example #15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Set the page title
        CurrentMaster.Title.TitleText     = GetString("abuse.properties");
        CurrentMaster.Title.TitleImage    = GetImageUrl("Objects/CMS_AbuseReport/object.png");
        CurrentMaster.Title.HelpTopicName = "abusereport";

        int reportID = QueryHelper.GetInteger("reportid", 0);

        ucAbuseEdit.ReportID = reportID;

        // Initializes page breadcrumbs
        string[,] breadcrumbs = new string[2, 3];
        breadcrumbs[0, 0]     = GetString("abuse.reports");
        breadcrumbs[0, 1]     = "~/CMSModules/AbuseReport/AbuseReport_List.aspx";

        AbuseReportInfo ar = AbuseReportInfoProvider.GetAbuseReportInfo(reportID);

        // Set edited object
        EditedObject = ar;

        if (ar != null)
        {
            // Set breadcrumbs
            breadcrumbs[1, 0] = HTMLHelper.HTMLEncode(ar.ReportTitle);

            // Ensure that object belongs to current site or user is global admin
            if (!CMSContext.CurrentUser.IsGlobalAdministrator && (ar.ReportSiteID != CMSContext.CurrentSiteID))
            {
                RedirectToInformation(GetString("general.notassigned"));
            }
        }

        CurrentMaster.Title.Breadcrumbs = breadcrumbs;
        ucAbuseEdit.OnCheckPermissions += new CMSAdminControl.CheckPermissionsEventHandler(ucAbuseEdit_OnCheckPermissions);
    }
    /// <summary>
    /// Gets and updates abuse report. Called when the "Get and update report" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool GetAndUpdateAbuseReport()
    {
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the report
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);

        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Create the object from DataRow
            AbuseReportInfo updateReport = new AbuseReportInfo(reports.Tables[0].Rows[0]);

            // Update the properties
            updateReport.ReportStatus = AbuseReportStatusEnum.Solved;

            // Save the changes
            AbuseReportInfoProvider.SetAbuseReportInfo(updateReport);

            return true;
        }

        return false;
    }
    /// <summary>
    /// Gets and bulk updates abuse reports. Called when the "Get and bulk update reports" button is pressed.
    /// Expects the CreateAbuseReport method to be run first.
    /// </summary>
    private bool GetAndBulkUpdateAbuseReports()
    {
        // Prepare the parameters
        string where = "ReportTitle LIKE N'MyNewReport%'";

        // Get the data
        DataSet reports = AbuseReportInfoProvider.GetAbuseReports(where, null);
        if (!DataHelper.DataSourceIsEmpty(reports))
        {
            // Loop through the individual items
            foreach (DataRow reportDr in reports.Tables[0].Rows)
            {
                // Create object from DataRow
                AbuseReportInfo modifyReport = new AbuseReportInfo(reportDr);

                // Update the properties
                modifyReport.ReportStatus = AbuseReportStatusEnum.Rejected;

                // Save the changes
                AbuseReportInfoProvider.SetAbuseReportInfo(modifyReport);
            }

            return true;
        }

        return false;
    }
 /// <summary>
 /// Log activity
 /// </summary>
 /// <param name="ari">Report info</param>
 private void LogActivity(AbuseReportInfo ari)
 {
     Activity activity = new ActivityAbuseReport(ari, CMSContext.ActivityEnvironmentVariables);
     activity.Log();
 }
    /// <summary>
    /// Performs reporting of abuse.
    /// </summary>
    public void PerformAction()
    {
        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(SiteContext.CurrentSiteName, BanControlEnum.AllNonComplete))
        {
            ShowError(GetString("General.BannedIP"));
            return;
        }

        string report = txtText.Text;

        // Check that text area is not empty or too long
        report = report.Trim();
        report = TextHelper.LimitLength(report, 1000);

        if (report.Length > 0)
        {
            // Create new AbuseReport
            AbuseReportInfo abuseReport = new AbuseReportInfo();
            if (ReportTitle != "")
            {
                // Set AbuseReport properties
                // Decode first, from forums it can be encoded
                ReportTitle = Server.HtmlDecode(ReportTitle);
                // Remove BBCode tags
                ReportTitle = DiscussionMacroResolver.RemoveTags(ReportTitle);
                abuseReport.ReportTitle = TextHelper.LimitLength(ReportTitle, 100);
                abuseReport.ReportURL = URLHelper.GetAbsoluteUrl(ReportURL);
                abuseReport.ReportCulture = LocalizationContext.PreferredCultureCode;
                if (ReportObjectID > 0)
                {
                    abuseReport.ReportObjectID = ReportObjectID;
                }

                if (ReportObjectType != "")
                {
                    abuseReport.ReportObjectType = ReportObjectType;
                }

                abuseReport.ReportComment = report;

                if (MembershipContext.AuthenticatedUser.UserID > 0)
                {
                    abuseReport.ReportUserID = MembershipContext.AuthenticatedUser.UserID;
                }

                abuseReport.ReportWhen = DateTime.Now;
                abuseReport.ReportStatus = AbuseReportStatusEnum.New;
                abuseReport.ReportSiteID = SiteContext.CurrentSite.SiteID;

                // Save AbuseReport
                AbuseReportInfoProvider.SetAbuseReportInfo(abuseReport);

                LogActivity(abuseReport);

                ShowConfirmation(GetString(ConfirmationText), true);
                txtText.Visible = false;
                ReportButton.Visible = false;
            }
            else
            {
                ShowError(GetString("abuse.errors.reporttitle"));
            }
        }
        else
        {
            ShowError(GetString("abuse.errors.reportcomment"));
        }

        // Additional form modification
        ReportButton.Visible = false;
    }
    /// <summary>
    /// Log activity
    /// </summary>
    /// <param name="ari">Report info</param>
    private void LogActivity(AbuseReportInfo ari)
    {
        var activityContext = AnalyticsContext.ActivityEnvironmentVariables;

        // Backup referrer and current URL from AnalyticsContext
        string originalReferrer = activityContext.CurrentURLReferrer;
        Uri originalURL = activityContext.CurrentURL;

        // Set it to the values from AbuseReportInfo so correct ones are used to create Activity
        activityContext.CurrentURLReferrer = "";
        if (ari.ReportURL != null)
        {
            activityContext.CurrentURL = new Uri(ari.ReportURL);
        }

        Activity activity = new ActivityAbuseReport(ari, activityContext);
        activity.Log();

        // Set old values back to AnalyticsContext
        activityContext.CurrentURLReferrer = originalReferrer;
        activityContext.CurrentURL = originalURL;
    }
    /// <summary>
    /// Log activity
    /// </summary>
    /// <param name="ari">Report info</param>
    private void LogActivity(AbuseReportInfo ari)
    {
        Activity activity = new ActivityAbuseReport(ari, CMSContext.ActivityEnvironmentVariables);

        activity.Log();
    }
    /// <summary>
    /// Performs reporting of abuse.
    /// </summary>
    public void PerformAction()
    {
        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(SiteContext.CurrentSiteName, BanControlEnum.AllNonComplete))
        {
            ShowError(GetString("General.BannedIP"));
            return;
        }

        string report = txtText.Text;

        // Check that text area is not empty or too long
        report = report.Trim();
        report = TextHelper.LimitLength(report, txtText.MaxLength);

        if (report.Length > 0)
        {
            // Create new AbuseReport
            AbuseReportInfo abuseReport = new AbuseReportInfo();
            if (ReportTitle != "")
            {
                // Set AbuseReport properties
                // Decode first, from forums it can be encoded
                ReportTitle = Server.HtmlDecode(ReportTitle);
                // Remove BBCode tags
                ReportTitle               = DiscussionMacroResolver.RemoveTags(ReportTitle);
                abuseReport.ReportTitle   = TextHelper.LimitLength(ReportTitle, 100);
                abuseReport.ReportURL     = URLHelper.GetAbsoluteUrl(ReportURL);
                abuseReport.ReportCulture = LocalizationContext.PreferredCultureCode;
                if (ReportObjectID > 0)
                {
                    abuseReport.ReportObjectID = ReportObjectID;
                }

                if (ReportObjectType != "")
                {
                    abuseReport.ReportObjectType = ReportObjectType;
                }

                abuseReport.ReportComment = report;

                if (MembershipContext.AuthenticatedUser.UserID > 0)
                {
                    abuseReport.ReportUserID = MembershipContext.AuthenticatedUser.UserID;
                }

                abuseReport.ReportWhen   = DateTime.Now;
                abuseReport.ReportStatus = AbuseReportStatusEnum.New;
                abuseReport.ReportSiteID = SiteContext.CurrentSite.SiteID;

                // Save AbuseReport
                AbuseReportInfoProvider.SetAbuseReportInfo(abuseReport);

                ShowConfirmation(GetString(ConfirmationText), true);
                txtText.Visible      = false;
                ReportButton.Visible = false;
            }
            else
            {
                ShowError(GetString("abuse.errors.reporttitle"));
            }
        }
        else
        {
            ShowError(GetString("abuse.errors.reportcomment"));
        }

        // Additional form modification
        ReportButton.Visible = false;
    }
    /// <summary>
    /// Performes reporting of abuse.
    /// </summary>
    public void PerformAction()
    {
        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(CMSContext.CurrentSiteName, BanControlEnum.AllNonComplete))
        {
            lblSaved.CssClass = "ErrorLabel";
            lblSaved.Text = GetString("General.BannedIP");
            return;
        }

        string report = txtText.Text;

        // Check that text area is not empty or too long
        report = report.Trim();
        report = TextHelper.LimitLength(report, 1000);

        if (report.Length > 0)
        {
            // Create new AbuseReport
            AbuseReportInfo abuseReport = new AbuseReportInfo();
            if (ReportTitle != "")
            {
                // Set AbuseReport properties
                // Decode first, from forums it can be encoded
                ReportTitle = Server.HtmlDecode(ReportTitle);
                // Remove BBCode tags
                ReportTitle = DiscussionMacroHelper.RemoveTags(ReportTitle);
                abuseReport.ReportTitle = TextHelper.LimitLength(ReportTitle, 100);
                abuseReport.ReportURL = ReportURL;
                abuseReport.ReportCulture = CMSContext.PreferredCultureCode;
                if (ReportObjectID > 0)
                {
                    abuseReport.ReportObjectID = ReportObjectID;
                }

                if (ReportObjectType != "")
                {
                    abuseReport.ReportObjectType = ReportObjectType;
                }

                abuseReport.ReportComment = report;

                if (CMSContext.CurrentUser.UserID > 0)
                {
                    abuseReport.ReportUserID = CMSContext.CurrentUser.UserID;
                }

                abuseReport.ReportWhen = DateTime.Now;
                abuseReport.ReportStatus = AbuseReportStatusEnum.New;
                abuseReport.ReportSiteID = CMSContext.CurrentSite.SiteID;

                // Save AbuseReport
                AbuseReportInfoProvider.SetAbuseReportInfo(abuseReport);

                LogActivity(abuseReport);

                lblSaved.ResourceString = ConfirmationText;
                lblSaved.Visible = true;
                txtText.Visible = false;
                ReportButton.Visible = false;
            }
            else
            {
                lblSaved.ResourceString = "abuse.errors.reporttitle";
                lblSaved.CssClass = "ErrorLabel";
                lblSaved.Visible = true;
            }
        }
        else
        {
            lblSaved.ResourceString = "abuse.errors.reportcomment";
            lblSaved.CssClass = "ErrorLabel";
            lblSaved.Visible = true;
        }

        // Additional form modification
        ReportButton.Visible = false;
        CancelButton.ResourceString = "general.close";
    }
 /// <summary>
 /// Log activity
 /// </summary>
 /// <param name="ari">Report info</param>
 private void LogActivity(AbuseReportInfo ari)
 {
     if ((CMSContext.ViewMode != ViewModeEnum.LiveSite) ||
         (ari == null) ||
         !ActivitySettingsHelper.ActivitiesEnabledForThisUser(CMSContext.CurrentUser) ||
         !ActivitySettingsHelper.ActivitiesEnabledAndModuleLoaded(ari.ReportSiteID) ||
         !ActivitySettingsHelper.AbuseReportEnabled(ari.ReportSiteID))
     {
         return;
     }
     var data = new ActivityData()
     {
         ContactID = ModuleCommands.OnlineMarketingGetCurrentContactID(),
         SiteID = ari.ReportSiteID,
         Type = PredefinedActivityType.ABUSE_REPORT,
         TitleData = ari.ReportTitle,
         ItemID = ari.ReportID,
         URL = URLHelper.CurrentRelativePath,
         Campaign = CMSContext.Campaign
     };
     ActivityLogProvider.LogActivity(data);
 }
Example #25
0
    /// <summary>
    /// Performes reporting of abuse.
    /// </summary>
    public void PerformAction()
    {
        // Check banned ip
        if (!BannedIPInfoProvider.IsAllowed(CMSContext.CurrentSiteName, BanControlEnum.AllNonComplete))
        {
            lblSaved.CssClass = "ErrorLabel";
            lblSaved.Text     = GetString("General.BannedIP");
            return;
        }

        string report = txtText.Text;

        // Check that text area is not empty or too long
        report = report.Trim();
        report = TextHelper.LimitLength(report, 1000);

        if (report.Length > 0)
        {
            // Create new AbuseReport
            AbuseReportInfo abuseReport = new AbuseReportInfo();
            if (ReportTitle != "")
            {
                // Set AbuseReport properties
                // Decode first, from forums it can be encoded
                ReportTitle = Server.HtmlDecode(ReportTitle);
                // Remove BBCode tags
                ReportTitle               = DiscussionMacroHelper.RemoveTags(ReportTitle);
                abuseReport.ReportTitle   = TextHelper.LimitLength(ReportTitle, 100);
                abuseReport.ReportURL     = ReportURL;
                abuseReport.ReportCulture = CMSContext.PreferredCultureCode;
                if (ReportObjectID > 0)
                {
                    abuseReport.ReportObjectID = ReportObjectID;
                }

                if (ReportObjectType != "")
                {
                    abuseReport.ReportObjectType = ReportObjectType;
                }

                abuseReport.ReportComment = report;

                if (CMSContext.CurrentUser.UserID > 0)
                {
                    abuseReport.ReportUserID = CMSContext.CurrentUser.UserID;
                }

                abuseReport.ReportWhen   = DateTime.Now;
                abuseReport.ReportStatus = AbuseReportStatusEnum.New;
                abuseReport.ReportSiteID = CMSContext.CurrentSite.SiteID;

                // Save AbuseReport
                AbuseReportInfoProvider.SetAbuseReportInfo(abuseReport);

                LogActivity(abuseReport);

                lblSaved.ResourceString = ConfirmationText;
                lblSaved.Visible        = true;
                txtText.Visible         = false;
                ReportButton.Visible    = false;
            }
            else
            {
                lblSaved.ResourceString = "abuse.errors.reporttitle";
                lblSaved.CssClass       = "ErrorLabel";
                lblSaved.Visible        = true;
            }
        }
        else
        {
            lblSaved.ResourceString = "abuse.errors.reportcomment";
            lblSaved.CssClass       = "ErrorLabel";
            lblSaved.Visible        = true;
        }

        // Additional form modification
        ReportButton.Visible        = false;
        CancelButton.ResourceString = "general.close";
    }