/// <summary>
        ///     Adds a new abuse report to the database
        /// </summary>
        /// <param name="report"></param>
        public void AddAbuseReport(AbuseReport report)
        {
            List<object> InsertValues = new List<object>
                                            {
                                                report.Category.ToString(),
                                                report.ReporterName,
                                                report.ObjectName,
                                                report.ObjectUUID,
                                                report.AbuserName,
                                                report.AbuseLocation,
                                                report.AbuseDetails,
                                                report.ObjectPosition,
                                                report.RegionName,
                                                report.ScreenshotID,
                                                report.AbuseSummary
                                            };

            Dictionary<string, bool> sort = new Dictionary<string, bool>(1);
            sort["Number"] = false;

            //We do not trust the number sent by the region. Always find it ourselves
            List<string> values = GD.Query(new string[1] {"Number"}, m_abuseReportsTable, null, sort, null, null);
            report.Number = values.Count == 0 ? 0 : int.Parse(values[0]);

            report.Number++;

            InsertValues.Add(report.Number);

            InsertValues.Add(report.AssignedTo);
            InsertValues.Add(report.Active ? 1 : 0);
            InsertValues.Add(report.Checked ? 1 : 0);
            InsertValues.Add(report.Notes);

            GD.Insert(m_abuseReportsTable, InsertValues.ToArray());
        }
        public void AddAbuseReport(AbuseReport abuse_report)
        {
            object remoteValue = DoRemote(abuse_report);
            if (remoteValue != null || m_doRemoteOnly)
                return;

            IAbuseReportsConnector conn = Framework.Utilities.DataManager.RequestPlugin<IAbuseReportsConnector>();
            if (conn != null)
                conn.AddAbuseReport(abuse_report);
        }
        /// <summary>
        ///     This deals with saving the report into the database.
        /// </summary>
        /// <param name="client"></param>
        /// <param name="regionName"></param>
        /// <param name="abuserID"></param>
        /// <param name="catagory"></param>
        /// <param name="checkflags"></param>
        /// <param name="details"></param>
        /// <param name="objectID"></param>
        /// <param name="position"></param>
        /// <param name="reportType"></param>
        /// <param name="screenshotID"></param>
        /// <param name="summery"></param>
        /// <param name="reporter"></param>
        private void UserReport(IClientAPI client, string regionName, UUID abuserID, byte catagory, byte checkflags,
            string details, UUID objectID, Vector3 position, byte reportType, UUID screenshotID,
            string summery, UUID reporter)
        {
            AbuseReport report = new AbuseReport
                                     {
                                         ObjectUUID = objectID,
                                         ObjectPosition = position.ToString(),
                                         Active = true,
                                         Checked = false,
                                         Notes = "",
                                         AssignedTo = "No One",
                                         ScreenshotID = screenshotID
                                     };

            if (objectID != UUID.Zero)
            {
                ISceneChildEntity Object = client.Scene.GetSceneObjectPart(objectID);
                report.ObjectName = Object.Name;
            }
            else
                report.ObjectName = "";

            string[] detailssplit = details.Split('\n');

            string AbuseDetails = detailssplit[detailssplit.Length - 1];

            report.AbuseDetails = AbuseDetails;

            report.ReporterName = client.Name;

            string[] findRegion = summery.Split('|');
            report.RegionName = findRegion[1];

            string[] findLocation = summery.Split('(');
            string[] findLocationend = findLocation[1].Split(')');
            report.AbuseLocation = findLocationend[0];

            string[] findCategory = summery.Split('[');
            string[] findCategoryend = findCategory[1].Split(']');
            report.Category = findCategoryend[0];

            string[] findAbuserName = summery.Split('{');
            string[] findAbuserNameend = findAbuserName[1].Split('}');
            report.AbuserName = findAbuserNameend[0];

            string[] findSummary = summery.Split('\"');

            string abuseSummary = findSummary[1];
            if (findSummary.Length != 0)
            {
                abuseSummary = findSummary[1];
            }

            report.AbuseSummary = abuseSummary;

            report.Number = (-1);

            EstateSettings ES = client.Scene.RegionInfo.EstateSettings;
            //If the abuse email is set up and the email module is available, send the email
            if (ES.AbuseEmailToEstateOwner && ES.AbuseEmail != "")
            {
                IEmailModule Email = m_Scene.RequestModuleInterface<IEmailModule>();
                if (Email != null)
                    Email.SendEmail(UUID.Zero, ES.AbuseEmail, "Abuse Report", "This abuse report was submitted by " +
                                                                              report.ReporterName + " against " +
                                                                              report.AbuserName + " at " +
                                                                              report.AbuseLocation + " in your region " +
                                                                              report.RegionName +
                                                                              ". Summary: " + report.AbuseSummary +
                                                                              ". Details: " + report.AbuseDetails + ".",
                                    client.Scene);
            }
            //Tell the DB about it
            IAbuseReports conn = m_Scene.RequestModuleInterface<IAbuseReports>();
            if (conn != null)
                conn.AddAbuseReport(report);
        }
        /// <summary>
        ///     Updates an abuse reprot without authentication
        /// </summary>
        /// <param name="report"></param>
        public void UpdateAbuseReport(AbuseReport report)
        {
            Dictionary<string, object> row = new Dictionary<string, object>(16);
            //This is update, so we trust the number as it should know the number it's updating now.
            row["Category"] = report.Category.ToString();
            row["ReporterName"] = report.ReporterName;
            row["ObjectName"] = report.ObjectName;
            row["ObjectUUID"] = report.ObjectUUID;
            row["AbuserName"] = report.AbuserName;
            row["AbuseLocation"] = report.AbuseLocation;
            row["AbuseDetails"] = report.AbuseDetails;
            row["ObjectPosition"] = report.ObjectPosition;
            row["RegionName"] = report.RegionName;
            row["ScreenshotID"] = report.ScreenshotID;
            row["AbuseSummary"] = report.AbuseSummary;
            row["Number"] = report.Number;
            row["AssignedTo"] = report.AssignedTo;
            row["Active"] = report.Active ? 1 : 0;
            row["Checked"] = report.Checked ? 1 : 0;
            row["Notes"] = report.Notes;

            GD.Replace(m_abuseReportsTable, row);
        }
 /// <summary>
 ///     Updates an abuse report and authenticates with the password.
 /// </summary>
 /// <param name="report"></param>
 /// <param name="Password"></param>
 public void UpdateAbuseReport(AbuseReport report, string Password)
 {
     UpdateAbuseReport(report);
 }
 public List<AbuseReport> GetAbuseReports(int start, int count, bool active)
 {
     List<AbuseReport> rv = new List<AbuseReport>();
     QueryFilter filter = new QueryFilter();
     filter.andGreaterThanEqFilters["CAST(number AS UNSIGNED)"] = start;
     filter.andFilters["Active"] = active ? 1 : 0;
     List<string> query = GD.Query(new string[1] {"*"}, m_abuseReportsTable, filter, null, null, null);
     if (query.Count%16 != 0)
     {
         return rv;
     }
     try
     {
         for (int i = 0; i < query.Count; i += 16)
         {
             AbuseReport report = new AbuseReport
                                      {
                                          Category = query[i + 0],
                                          ReporterName = query[i + 1],
                                          ObjectName = query[i + 2],
                                          ObjectUUID = new UUID(query[i + 3]),
                                          AbuserName = query[i + 4],
                                          AbuseLocation = query[i + 5],
                                          AbuseDetails = query[i + 6],
                                          ObjectPosition = query[i + 7],
                                          RegionName = query[i + 8],
                                          ScreenshotID = new UUID(query[i + 9]),
                                          AbuseSummary = query[i + 10],
                                          Number = int.Parse(query[i + 11]),
                                          AssignedTo = query[i + 12],
                                          Active = int.Parse(query[i + 13]) == 1,
                                          Checked = int.Parse(query[i + 14]) == 1,
                                          Notes = query[i + 15]
                                      };
             rv.Add(report);
         }
     }
     catch
     {
     }
     return rv;
 }
예제 #7
0
 public void SetGUI(AbuseReport AR)
 {
     if (AR != null)
     {
         CurrentReport = AR;
         Category.Text = AR.Category.ToString();
         ReporterName.Text = AR.ReporterName;
         ObjectName.Text = AR.ObjectName;
         ObjectPos.Text = AR.ObjectPosition;
         Abusername.Text = AR.AbuserName;
         AbuseLocation.Text = AR.AbuseLocation;
         Summary.Text = AR.AbuseSummary;
         Details.Text = AR.AbuseDetails;
         AssignedTo.Text = AR.AssignedTo;
         Active.Text = AR.Active.ToString();
         Checked.Text = AR.Checked.ToString();
         Notes.Text = AR.Notes;
         CardNumber.Text = formNumber.ToString();
         SnapshotUUID.Image = GetTexture(AR.ScreenshotID);
     }
     else
     {
         Category.Text = "";
         ReporterName.Text = "";
         ObjectName.Text = "";
         ObjectPos.Text = "";
         Abusername.Text = "";
         AbuseLocation.Text = "";
         Summary.Text = "";
         Details.Text = "";
         AssignedTo.Text = "";
         Active.Text = "";
         Checked.Text = "";
         Notes.Text = "";
         CardNumber.Text = formNumber.ToString();
         SnapshotUUID.Image = GetTexture(UUID.Zero);
     }
 }
 public void UpdateAbuseReport(AbuseReport report)
 {
     IAbuseReportsConnector conn = Framework.Utilities.DataManager.RequestPlugin<IAbuseReportsConnector>();
     if (conn != null)
         conn.UpdateAbuseReport(report);
 }
        //[CanBeReflected(ThreatLevel = ThreatLevel.Full)]
        public void UpdateAbuseReport(AbuseReport report, string Password)
        {
            /*object remoteValue = DoRemote(report, Password);
            if (remoteValue != null || m_doRemoteOnly)
                return;*/

            IAbuseReportsConnector conn = Framework.Utilities.DataManager.RequestPlugin<IAbuseReportsConnector>();
            if (conn != null)
                conn.UpdateAbuseReport(report, Password);
        }