public List <AbuseReport> GetAbuseReports(int start, int count, string filter) { System.Data.IDataReader dr = GD.QueryDataFull("where CONVERT(number, UNSIGNED) >= " + start.ToString() + " and " + filter + " LIMIT 0, 10", "abusereports", "*"); List <AbuseReport> rv = new List <AbuseReport>(); while (dr.Read()) { AbuseReport report = new AbuseReport(); report.Category = dr[0].ToString(); report.ReporterName = dr[1].ToString(); report.ObjectName = dr[2].ToString(); report.ObjectUUID = new UUID(dr[3].ToString()); report.AbuserName = dr[4].ToString(); report.AbuseLocation = dr[5].ToString(); report.AbuseDetails = dr[6].ToString(); report.ObjectPosition = dr[7].ToString(); report.RegionName = dr[8].ToString(); report.ScreenshotID = new UUID(dr[9].ToString()); report.AbuseSummary = dr[10].ToString(); report.Number = int.Parse(dr[11].ToString()); report.AssignedTo = dr[12].ToString(); report.Active = int.Parse(dr[13].ToString()) == 1; report.Checked = int.Parse(dr[14].ToString()) == 1; report.Notes = dr[15].ToString(); rv.Add(report); } return(rv); }
public IActionResult AddAbuse([FromBody] AddAbuseModel model) { // TODO: IMPLEMENT SERVICES THEN END-CODE THIS ACTION Claim idClaim = User.FindFirst("sub"); if (!ModelState.IsValid) { return(BadRequest()); } AbuseReport report = new AbuseReport() { DateUtcAdd = DateTime.UtcNow, DateUtcModified = DateTime.UtcNow, Details = model.Details, IsSoftDeleted = false, AbuseType = model.ReportType, ReporterId = idClaim.Value, }; var result = _abuseService.AddAbuseReport(report); if (result != 0) { return(Ok()); } return(BadRequest()); }
public AbuseReport GetAbuseReport(int Number, string Password) { try { Dictionary <string, object> send = new Dictionary <string, object> { { "Password", Password }, { "METHOD", "GetAbuseReport" } }; List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("AbuseReportsServerURI"); AbuseReport ar = new AbuseReport(); ar.FromKVP(WebUtils.ParseXmlResponse(SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[ 0], WebUtils. BuildQueryString (send)))); return(ar); } catch (Exception e) { MainConsole.Instance.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); return(null); } }
/// <summary> /// Gets the abuse report associated with the number and uses the pass to authenticate. /// </summary> /// <param name="Number"></param> /// <param name="Password"></param> /// <returns></returns> public AbuseReport GetAbuseReport(int Number, string Password) { if (!CheckPassword(Password)) { return(null); } AbuseReport report = new AbuseReport(); List <string> Reports = GD.Query("Number", Number, "abusereports", "*"); if (Reports.Count == 0) { return(null); } report.Category = Reports[0]; report.ReporterName = Reports[1]; report.ObjectName = Reports[2]; report.ObjectUUID = new UUID(Reports[3]); report.AbuserName = Reports[4]; report.AbuseLocation = Reports[5]; report.AbuseDetails = Reports[6]; report.ObjectPosition = Reports[7]; report.RegionName = Reports[8]; report.ScreenshotID = new UUID(Reports[9]); report.AbuseSummary = Reports[10]; report.Number = int.Parse(Reports[11]); report.AssignedTo = Reports[12]; report.Active = int.Parse(Reports[13]) == 1; report.Checked = int.Parse(Reports[14]) == 1; report.Notes = Reports[15]; return(report); }
/// <summary> /// Gets the abuse report associated with the number and uses the pass to authenticate. /// </summary> /// <param name="Number"></param> /// <param name="Password"></param> /// <returns></returns> public AbuseReport GetAbuseReport(int Number, string Password) { if (!CheckPassword(Password)) return null; AbuseReport report = new AbuseReport(); List<string> Reports = GD.Query("Number", Number, "abusereports", "*"); if (Reports.Count == 0) return null; report.Category = Reports[0]; report.ReporterName = Reports[1]; report.ObjectName = Reports[2]; report.ObjectUUID = new UUID(Reports[3]); report.AbuserName = Reports[4]; report.AbuseLocation = Reports[5]; report.AbuseDetails = Reports[6]; report.ObjectPosition = Reports[7]; report.RegionName = Reports[8]; report.ScreenshotID = new UUID(Reports[9]); report.AbuseSummary = Reports[10]; report.Number = int.Parse(Reports[11]); report.AssignedTo = Reports[12]; report.Active = int.Parse(Reports[13]) == 1; report.Checked = int.Parse(Reports[14]) == 1; report.Notes = Reports[15]; return report; }
/// <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()); }
/// <summary> /// Register that the requesting person considers the specified comment as abusive. /// </summary> /// <param name="commentID">ID of the comment to be marked as abusive</param> /// <param name="abuse_report">AbuseReport object containing the abuse report information</param> /// <returns>AbuseReport object containing the newly created abuse report</returns> public AbuseReport CreateAbuseReport(int commentID, AbuseReport abuse_report) { string url = commentUrl + "/" + commentID.ToString() + "/abuseReports"; string json = JsonConvert.SerializeObject(abuse_report, new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }); string result = ""; try { result = PostAbsolute(url, json); //makes the HTTP request } catch (HttpException e) { switch (e.GetHttpCode()) { case 400: throw new HttpException(e.WebEventCode, "An input field is missing or malformed", e); case 403: throw new HttpException(e.WebEventCode, "You are not allowed to access or mark this content as abusive", e); case 404: throw new HttpException(e.WebEventCode, "The specified content does not exist", e); default: throw; } } JObject Json = JObject.Parse(result); return(Json.ToObject <AbuseReport>()); }
/// <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) { if (!CheckPassword(Password)) { return; } UpdateAbuseReport(report); }
public void AddAbuseReport(AbuseReport abuse_report) { IAbuseReportsConnector conn = Aurora.DataManager.DataManager.RequestPlugin <IAbuseReportsConnector>(); if (conn != null) { conn.AddAbuseReport(abuse_report); } }
public async Task <ActionResult> action() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <List <AbuseEntity> >(json); await AbuseReport.ProcessAction(_context, data); return(Ok(new { status = "success", message = "Operationperformedsuccessfully" })); }
public static void ListsAbuseReports_FillRow(object resultObj, out SqlDateTime date, out SqlString email, out SqlString campaignId, out SqlString type) { AbuseReport abuseReport = (AbuseReport)resultObj; date = DateTime.Parse(abuseReport.Date); email = abuseReport.Email; campaignId = abuseReport.CampaignId; type = abuseReport.Type; }
byte[] UpdateAbuseReport(Dictionary <string, object> request) { AbuseReport ar = new AbuseReport(request); m_AbuseReportsService.UpdateAbuseReport(ar, request["Password"].ToString()); //m_log.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return(SuccessResult()); }
public void UpdateAbuseReport(AbuseReport report, string Password) { IAbuseReportsConnector conn = Framework.Utilities.DataManager.RequestPlugin <IAbuseReportsConnector>(); if (conn != null) { conn.UpdateAbuseReport(report, Password); } }
public async Task <ActionResult> action() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <List <AbuseEntity> >(json); await AbuseReport.ProcessAction(_context, data); return(Ok(new { status = "success", message = SiteConfig.generalLocalizer["_records_processed"].Value })); }
public void UpdateAbuseReport(AbuseReport report) { IAbuseReportsConnector conn = DataManager.RequestPlugin <IAbuseReportsConnector>(); if (conn != null) { conn.UpdateAbuseReport(report); } }
private byte[] AddAbuseReport(Dictionary <string, object> request) { AbuseReport ar = new AbuseReport(); ar.FromKVP(request); m_AbuseReportsService.AddAbuseReport(ar); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return(SuccessResult()); }
public void UpdateAbuseReport(AbuseReport report, string Password) { object remoteValue = DoRemote(report, Password); if (remoteValue != null || m_doRemoteOnly) return; IAbuseReportsConnector conn = DataManager.RequestPlugin<IAbuseReportsConnector>(); if (conn != null) conn.UpdateAbuseReport(report, Password); }
public void AddAbuseReport(AbuseReport abuse_report) { object remoteValue = DoRemote(abuse_report); if (remoteValue != null || m_doRemoteOnly) return; IAbuseReportsConnector conn = DataManager.RequestPlugin<IAbuseReportsConnector>(); if (conn != null) conn.AddAbuseReport(abuse_report); }
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> /// The get async. /// </summary> /// <param name="listId"> /// The list Id. /// </param> /// <param name="reportId"> /// The report Id. /// </param> /// <param name="request"> /// The request. /// </param> /// <exception cref="ArgumentNullException"> /// The <paramref> /// <name>requestUri</name> /// </paramref> /// was null. /// </exception> /// <returns> /// The <see cref="Task"/>. /// </returns> /// <exception cref="UriFormatException">In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, <see cref="T:System.FormatException" />, instead.<paramref name="uriString" /> is empty.-or- The scheme specified in <paramref name="uriString" /> is not correctly formed. See <see cref="M:System.Uri.CheckSchemeName(System.String)" />.-or- <paramref name="uriString" /> contains too many slashes.-or- The password specified in <paramref name="uriString" /> is not valid.-or- The host name specified in <paramref name="uriString" /> is not valid.-or- The file name specified in <paramref name="uriString" /> is not valid. -or- The user name specified in <paramref name="uriString" /> is not valid.-or- The host or authority name specified in <paramref name="uriString" /> cannot be terminated by backslashes.-or- The port number specified in <paramref name="uriString" /> is not valid or cannot be parsed.-or- The length of <paramref name="uriString" /> exceeds 65519 characters.-or- The length of the scheme specified in <paramref name="uriString" /> exceeds 1023 characters.-or- There is an invalid character sequence in <paramref name="uriString" />.-or- The MS-DOS path specified in <paramref name="uriString" /> must start with c:\\.</exception> /// <exception cref="ArgumentOutOfRangeException">Enlarging the value of this instance would exceed <see cref="P:System.Text.StringBuilder.MaxCapacity" />. </exception> /// <exception cref="MailChimpException"> /// Custom Mail Chimp Exception /// </exception> public async Task <AbuseReport> GetAsync(string listId, string reportId, QueryableBaseRequest request = null) { using (var client = this.CreateMailClient("lists/")) { var response = await client.GetAsync($"{listId}/abuse-reports{reportId}{request?.ToQueryString()}").ConfigureAwait(false); await response.EnsureSuccessMailChimpAsync().ConfigureAwait(false); AbuseReport data = await response.Content.ReadAsAsync <AbuseReport>().ConfigureAwait(false); return(data); } }
//[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); } }
byte[] AbuseReportSaveNotes(OSDMap map) { OSDMap resp = new OSDMap(); IAbuseReports ar = m_registry.RequestModuleInterface <IAbuseReports>(); AbuseReport tar = ar.GetAbuseReport(map["Number"].AsInteger(), map["WebPassword"].AsString()); tar.Notes = map["Notes"].ToString(); ar.UpdateAbuseReport(tar, map["WebPassword"].AsString()); resp["Finished"] = OSD.FromBoolean(true); string xmlString = OSDParser.SerializeJsonString(resp); UTF8Encoding encoding = new UTF8Encoding(); return(encoding.GetBytes(xmlString)); }
private async Task <string> Process_V3(string content_username, long contentid, string reason, int type, int mediatype) { if (HttpContext.User.Identity.IsAuthenticated) { string sign_in = "<a href=\"" + Config.GetUrl() + "Login.aspx\" class=\"bold\">Sign In</a>"; string sign_up = "<a href=\"" + Config.GetUrl() + "Register.aspx\" class=\"bold\">Sign Up</a>"; return(sign_in + " or " + sign_up + " to post report!"); } var info = SiteConfig.userManager.GetUserAsync(User).Result; var userName = info.UserName; if (content_username == userName) { return(SiteConfig.generalLocalizer["_abuse_msg_01"].Value); // You can't post abuse / spam report on your own content. } if (await AbuseReport.Check_UserName(_context, userName, contentid, type)) { return(SiteConfig.generalLocalizer["_abuse_msg_02"].Value); // "You already post abuse / spam report on this content."; } //*********************************** // ENABLE comment if you want to validate report based on ip address //*********************************** string ipaddress = Request.HttpContext.Connection.RemoteIpAddress.ToString(); if (await AbuseReport.Check_IPAddress(_context, ipaddress, contentid, type)) { return(SiteConfig.generalLocalizer["_abuse_msg_03"].Value); // Report already posted from this IP address. } await AbuseReport.Add(_context, contentid, userName, ipaddress, reason, type); int count_reports = await AbuseReport.Count(_context, contentid, type); if (count_reports > Jugnoon.Settings.Configs.GeneralSettings.spam_count) { int OldValue = 0; switch (type) { case 0: // disable video VideoBLL.Update_Field_V3(_context, contentid, (byte)0, "isenabled"); OldValue = Convert.ToInt32(VideoBLL.Get_Field_Value(_context, contentid, "isenabled")); break; } } return(SiteConfig.generalLocalizer["_abuse_msg_04"].Value); }
/// <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) { if (!CheckPassword(Password)) { return; } //This is update, so we trust the number as it should know the number it's updating now. List <object> InsertValues = new List <object> { report.Category.ToString().MySqlEscape(100), report.ReporterName.MySqlEscape(100), report.ObjectName.MySqlEscape(100), report.ObjectUUID, report.AbuserName.MySqlEscape(100), report.AbuseLocation.MySqlEscape(100), report.AbuseDetails.MySqlEscape(512), report.ObjectPosition.MySqlEscape(100), report.RegionName.MySqlEscape(100), report.ScreenshotID, report.AbuseSummary.MySqlEscape(100), report.Number, report.AssignedTo.MySqlEscape(100), report.Active ? 1 : 0, report.Checked ? 1 : 0, report.Notes.MySqlEscape(1024) }; List <string> InsertKeys = new List <string> { "Category", "ReporterName", "ObjectName", "ObjectUUID", "AbuserName", "AbuseLocation", "AbuseDetails", "ObjectPosition", "RegionName", "ScreenshotID", "AbuseSummary", "Number", "AssignedTo", "Active", "Checked", "Notes" }; GD.Replace("abusereports", InsertKeys.ToArray(), InsertValues.ToArray()); }
public async Task <ActionResult> load() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <AbuseEntity>(json); var _posts = await AbuseReport.LoadItems(_context, data); var _records = 0; if (data.id == 0) { _records = await AbuseReport.Count(_context, data); } return(Ok(new { posts = _posts, records = _records })); }
public void AddAbuseReport(AbuseReport abuse_report) { if (m_doRemoteOnly) { DoRemote(abuse_report); return; } IAbuseReportsConnector conn = Framework.Utilities.DataManager.RequestPlugin <IAbuseReportsConnector> (); if (conn != null) { conn.AddAbuseReport(abuse_report); } }
/// <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) { if (!CheckPassword(Password)) { return; } //This is update, so we trust the number as it should know the number it's updating now. List <object> InsertValues = new List <object>(); InsertValues.Add(report.Category); InsertValues.Add(report.ReporterName); InsertValues.Add(report.ObjectName); InsertValues.Add(report.ObjectUUID); InsertValues.Add(report.AbuserName); InsertValues.Add(report.AbuseLocation); InsertValues.Add(report.AbuseDetails); InsertValues.Add(report.ObjectPosition); InsertValues.Add(report.RegionName); InsertValues.Add(report.ScreenshotID); InsertValues.Add(report.AbuseSummary); InsertValues.Add(report.Number); InsertValues.Add(report.AssignedTo); InsertValues.Add(report.Active ? 1 : 0); InsertValues.Add(report.Checked ? 1 : 0); InsertValues.Add(report.Notes); List <string> InsertKeys = new List <string>(); InsertKeys.Add("Category"); InsertKeys.Add("ReporterName"); InsertKeys.Add("ObjectName"); InsertKeys.Add("ObjectUUID"); InsertKeys.Add("AbuserName"); InsertKeys.Add("AbuseLocation"); InsertKeys.Add("AbuseDetails"); InsertKeys.Add("ObjectPosition"); InsertKeys.Add("RegionName"); InsertKeys.Add("ScreenshotID"); InsertKeys.Add("AbuseSummary"); InsertKeys.Add("Number"); InsertKeys.Add("AssignedTo"); InsertKeys.Add("Active"); InsertKeys.Add("Checked"); InsertKeys.Add("Notes"); GD.Replace("abusereports", InsertKeys.ToArray(), InsertValues.ToArray()); }
public void UpdateAbuseReport(AbuseReport report, string Password) { object remoteValue = DoRemote(report, Password); if (remoteValue != null || m_doRemoteOnly) { return; } IAbuseReportsConnector conn = DataManager.RequestPlugin <IAbuseReportsConnector>(); if (conn != null) { conn.UpdateAbuseReport(report, Password); } }
public void AddAbuseReport(AbuseReport abuse_report) { object remoteValue = DoRemote(abuse_report); if (remoteValue != null || m_doRemoteOnly) { return; } IAbuseReportsConnector conn = DataManager.RequestPlugin <IAbuseReportsConnector>(); if (conn != null) { conn.AddAbuseReport(abuse_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 { } GD.CloseDatabase(); return(rv); }
public async Task <ActionResult> proc() { var json = new StreamReader(Request.Body).ReadToEnd(); var data = JsonConvert.DeserializeObject <JGN_AbuseReports>(json); if (data.id > 0) { // Update Operation await AbuseReport.Update(_context, data); return(Ok(new { status = "success", id = 0, message = "Record Processed" })); } else { return(Ok(new { status = "success", id = 0, message = "Record Processed" })); } }
public void UpdateAbuseReport(AbuseReport report, string Password) { try { Dictionary <string, object> send = report.ToKeyValuePairs(); send.Add("Password", Password); send.Add("METHOD", "AddAbuseReport"); List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[0] + "/abusereport", WebUtils.BuildQueryString(send)); } catch (Exception e) { m_log.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } }
public List <AbuseReport> GetAbuseReports(int start, int count, string filter) { List <AbuseReport> rv = new List <AbuseReport>(); IDataReader dr = GD.QueryData( "where CAST(number AS UNSIGNED) >= " + start.ToString() + " and " + filter + " LIMIT 0, 10", "abusereports", "*"); try { while (dr.Read()) { AbuseReport report = new AbuseReport { Category = dr[0].ToString(), ReporterName = dr[1].ToString(), ObjectName = dr[2].ToString(), ObjectUUID = new UUID(dr[3].ToString()), AbuserName = dr[4].ToString(), AbuseLocation = dr[5].ToString(), AbuseDetails = dr[6].ToString(), ObjectPosition = dr[7].ToString(), RegionName = dr[8].ToString(), ScreenshotID = new UUID(dr[9].ToString()), AbuseSummary = dr[10].ToString(), Number = int.Parse(dr[11].ToString()), AssignedTo = dr[12].ToString(), Active = int.Parse(dr[13].ToString()) == 1, Checked = int.Parse(dr[14].ToString()) == 1, Notes = dr[15].ToString() }; rv.Add(report); } dr.Close(); dr.Dispose(); } catch { } GD.CloseDatabase(); return(rv); }
public void AddAbuseReport(AbuseReport abuse_report) { try { List <string> m_ServerURIs = m_registry.RequestModuleInterface <IConfigurationService>().FindValueOf("RemoteServerURI"); foreach (string m_ServerURI in m_ServerURIs) { Dictionary <string, object> ar = abuse_report.ToKeyValuePairs(); ar.Add("METHOD", "AddAbuseReport"); SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI + "/abusereport", WebUtils.BuildQueryString(ar)); } } catch (Exception e) { m_log.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } }
public void AddAbuseReport(AbuseReport abuse_report) { try { List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AbuseReportsServerURI"); foreach (string m_ServerURI in m_ServerURIs) { Dictionary<string, object> ar = abuse_report.ToKVP(); ar.Add("METHOD", "AddAbuseReport"); SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURI, WebUtils.BuildQueryString(ar)); } } catch (Exception e) { MainConsole.Instance.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } }
public AbuseReport GetAbuseReport(int Number, string Password) { try { Dictionary<string, object> send = new Dictionary<string, object> {{"Password", Password}, {"METHOD", "GetAbuseReport"}}; List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AbuseReportsServerURI"); AbuseReport ar = new AbuseReport(); ar.FromKVP(WebUtils.ParseXmlResponse(SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[ 0], WebUtils. BuildQueryString (send)))); return ar; } catch (Exception e) { MainConsole.Instance.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); return null; } }
/// <summary> /// Adds a new abuse report to the database /// </summary> /// <param name = "report"></param> /// <param name = "Password"></param> public void AddAbuseReport(AbuseReport report) { List<object> InsertValues = new List<object> { report.Category.ToString().MySqlEscape(100), report.ReporterName.MySqlEscape(100), report.ObjectName.MySqlEscape(100), report.ObjectUUID, report.AbuserName.MySqlEscape(100), report.AbuseLocation.MySqlEscape(100), report.AbuseDetails.MySqlEscape(512), report.ObjectPosition.MySqlEscape(100), report.RegionName.MySqlEscape(100), report.ScreenshotID, report.AbuseSummary.MySqlEscape(100) }; //We do not trust the number sent by the region. Always find it ourselves List<string> values = GD.Query("", "", "abusereports", "Number", " ORDER BY Number DESC"); report.Number = values.Count == 0 ? 0 : int.Parse(values[0]); report.Number++; InsertValues.Add(report.Number); InsertValues.Add(report.AssignedTo.MySqlEscape(100)); InsertValues.Add(report.Active ? 1 : 0); InsertValues.Add(report.Checked ? 1 : 0); InsertValues.Add(report.Notes.MySqlEscape(1024)); GD.Insert("abusereports", InsertValues.ToArray()); }
/// <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) { if (!CheckPassword(Password)) return; //This is update, so we trust the number as it should know the number it's updating now. List<object> InsertValues = new List<object> { report.Category.ToString().MySqlEscape(100), report.ReporterName.MySqlEscape(100), report.ObjectName.MySqlEscape(100), report.ObjectUUID, report.AbuserName.MySqlEscape(100), report.AbuseLocation.MySqlEscape(100), report.AbuseDetails.MySqlEscape(512), report.ObjectPosition.MySqlEscape(100), report.RegionName.MySqlEscape(100), report.ScreenshotID, report.AbuseSummary.MySqlEscape(100), report.Number, report.AssignedTo.MySqlEscape(100), report.Active ? 1 : 0, report.Checked ? 1 : 0, report.Notes.MySqlEscape(1024) }; List<string> InsertKeys = new List<string> { "Category", "ReporterName", "ObjectName", "ObjectUUID", "AbuserName", "AbuseLocation", "AbuseDetails", "ObjectPosition", "RegionName", "ScreenshotID", "AbuseSummary", "Number", "AssignedTo", "Active", "Checked", "Notes" }; GD.Replace("abusereports", InsertKeys.ToArray(), InsertValues.ToArray()); }
/// <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); }
public List<AbuseReport> GetAbuseReports(int start, int count, string filter) { List<AbuseReport> rv = new List<AbuseReport>(); IDataReader dr = GD.QueryData( "where CAST(number AS UNSIGNED) >= " + start.ToString() + " and " + filter + " LIMIT 0, 10", "abusereports", "*"); try { while (dr.Read()) { AbuseReport report = new AbuseReport { Category = dr[0].ToString(), ReporterName = dr[1].ToString(), ObjectName = dr[2].ToString(), ObjectUUID = new UUID(dr[3].ToString()), AbuserName = dr[4].ToString(), AbuseLocation = dr[5].ToString(), AbuseDetails = dr[6].ToString(), ObjectPosition = dr[7].ToString(), RegionName = dr[8].ToString(), ScreenshotID = new UUID(dr[9].ToString()), AbuseSummary = dr[10].ToString(), Number = int.Parse(dr[11].ToString()), AssignedTo = dr[12].ToString(), Active = int.Parse(dr[13].ToString()) == 1, Checked = int.Parse(dr[14].ToString()) == 1, Notes = dr[15].ToString() }; rv.Add(report); } dr.Close(); dr.Dispose(); } catch { } GD.CloseDatabase(); return rv; }
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; }
private byte[] UpdateAbuseReport(Dictionary<string, object> request) { AbuseReport ar = new AbuseReport(); ar.FromKVP(request); m_AbuseReportsService.UpdateAbuseReport(ar, request["Password"].ToString()); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return SuccessResult(); }
/// <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) { if (!CheckPassword(Password)) { return; } 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().MySqlEscape(100); row["ReporterName"] = report.ReporterName.MySqlEscape(100); row["ObjectName"] = report.ObjectName.MySqlEscape(100); row["ObjectUUID"] = report.ObjectUUID; row["AbuserName"] = report.AbuserName.MySqlEscape(100); row["AbuseLocation"] = report.AbuseLocation.MySqlEscape(100); row["AbuseDetails"] = report.AbuseDetails.MySqlEscape(512); row["ObjectPosition"] = report.ObjectPosition.MySqlEscape(100); row["RegionName"] = report.RegionName.MySqlEscape(100); row["ScreenshotID"] = report.ScreenshotID; row["AbuseSummary"] = report.AbuseSummary.MySqlEscape(100); row["Number"] = report.Number; row["AssignedTo"] = report.AssignedTo.MySqlEscape(100); row["Active"] = report.Active ? 1 : 0; row["Checked"] = report.Checked ? 1 : 0; row["Notes"] = report.Notes.MySqlEscape(1024); GD.Replace("abusereports", 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 byte[] UpdateAbuseReport(Dictionary<string, object> request) { AbuseReport ar = new AbuseReport(request); IAbuseReportsConnector m_AbuseReportsService = DataManager.RequestPlugin<IAbuseReportsConnector>("IAbuseReportsConnectorLocal"); m_AbuseReportsService.UpdateAbuseReport(ar, request["Password"].ToString()); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return SuccessResult(); }
public byte[] AddAbuseReport(Dictionary<string, object> request) { IAbuseReportsConnector m_AbuseReportsService = DataManager.RequestPlugin<IAbuseReportsConnector>("IAbuseReportsConnectorLocal"); AbuseReport ar = new AbuseReport(); ar.FromKVP(request); m_AbuseReportsService.AddAbuseReport(ar); //MainConsole.Instance.DebugFormat("[ABUSEREPORTS HANDLER]: neighbours for region {0}: {1}", regionID, rinfos.Count); return SuccessResult(); }
protected void btnSend_Click(object sender, EventArgs e) { Visible = false; if (txtReport.Text.Length > 0) { if (CurrentUserSession != null) { AbuseReport report = new AbuseReport(CurrentUserSession.Username, ReportedUser, ReportType); report.Report = txtReport.Text; report.TargetID = TargetID; report.DateReported = DateTime.Now; report.Save(); if (ReportType == AbuseReport.ReportType.Photo) { int reports = AbuseReport.Search(null, ReportedUser, AbuseReport.ReportType.Photo, TargetID.Value, false, null, null, String.Empty, false).Length; if (reports > Config.CommunityModeratedSystem.MaxPhotoAbuseReportsToDeletePhoto) { Photo.Delete(TargetID.Value); } else if (reports > Config.CommunityModeratedSystem.MaxPhotoAbuseReportsForManualApproval) { Photo photo = null; try { photo = Photo.Fetch(TargetID.Value); } catch (NotFoundException) { return; } photo.ManualApproval = true; photo.Save(false); } } OnSendClick(new EventArgs()); ((PageBase)Page).StatusPageMessage = Lang.Trans("Your report has been sent successufuly!"); Response.Redirect("ShowStatus.aspx"); } } else { Visible = true; lblError.Text = Lang.Trans("Please fill in your report in the text field!"); lblError.Visible = true; return; } }
private void MarkRelatedReportsAsReviewed(AbuseReport.ReportType? type, string reportedUser, int? targetId) { int[] reportIds = AbuseReport.Search(null, reportedUser, type, targetId, false, null, null, null, true); foreach (int id in reportIds) { AbuseReport abuseReport = AbuseReport.Fetch(id); abuseReport.Reviewed = true; abuseReport.Save(); } }
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.ToString(); Abusername.Text = AR.AbuserName; Location.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 = ""; Location.Text = ""; Summary.Text = ""; Details.Text = ""; AssignedTo.Text = ""; Active.Text = ""; Checked.Text = ""; Notes.Text = ""; CardNumber.Text = formNumber.ToString(); SnapshotUUID.Image = GetTexture(UUID.Zero); } }
/// <summary> /// Adds a new abuse report to the database /// </summary> /// <param name="report"></param> /// <param name="Password"></param> public void AddAbuseReport(AbuseReport report) { List<object> InsertValues = new List<object>(); InsertValues.Add(report.Category); InsertValues.Add(report.ReporterName); InsertValues.Add(report.ObjectName); InsertValues.Add(report.ObjectUUID); InsertValues.Add(report.AbuserName); InsertValues.Add(report.AbuseLocation); InsertValues.Add(report.AbuseDetails); InsertValues.Add(report.ObjectPosition); InsertValues.Add(report.RegionName); InsertValues.Add(report.ScreenshotID); InsertValues.Add(report.AbuseSummary); //We do not trust the number sent by the region. Always find it ourselves List<string> values = GD.Query("", "", "abusereports", "Number", " ORDER BY Number DESC"); if (values.Count == 0) report.Number = 0; else report.Number = 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("abusereports", InsertValues.ToArray()); }
public void UpdateAbuseReport(AbuseReport report) { IAbuseReportsConnector conn = DataManager.RequestPlugin<IAbuseReportsConnector>(); if (conn != null) conn.UpdateAbuseReport(report); }
public void AddAbuseReport(AbuseReport abuse_report) { IAbuseReportsConnector conn = Aurora.DataManager.DataManager.RequestPlugin<IAbuseReportsConnector>(); if (conn != null) conn.AddAbuseReport(abuse_report); }
/// <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) { if (!CheckPassword(Password)) return; //This is update, so we trust the number as it should know the number it's updating now. List<object> InsertValues = new List<object>(); InsertValues.Add(report.Category); InsertValues.Add(report.ReporterName); InsertValues.Add(report.ObjectName); InsertValues.Add(report.ObjectUUID); InsertValues.Add(report.AbuserName); InsertValues.Add(report.AbuseLocation); InsertValues.Add(report.AbuseDetails); InsertValues.Add(report.ObjectPosition); InsertValues.Add(report.RegionName); InsertValues.Add(report.ScreenshotID); InsertValues.Add(report.AbuseSummary); InsertValues.Add(report.Number); InsertValues.Add(report.AssignedTo); InsertValues.Add(report.Active ? 1 : 0); InsertValues.Add(report.Checked ? 1 : 0); InsertValues.Add(report.Notes); List<string> InsertKeys = new List<string>(); InsertKeys.Add("Category"); InsertKeys.Add("ReporterName"); InsertKeys.Add("ObjectName"); InsertKeys.Add("ObjectUUID"); InsertKeys.Add("AbuserName"); InsertKeys.Add("AbuseLocation"); InsertKeys.Add("AbuseDetails"); InsertKeys.Add("ObjectPosition"); InsertKeys.Add("RegionName"); InsertKeys.Add("ScreenshotID"); InsertKeys.Add("AbuseSummary"); InsertKeys.Add("Number"); InsertKeys.Add("AssignedTo"); InsertKeys.Add("Active"); InsertKeys.Add("Checked"); InsertKeys.Add("Notes"); GD.Replace("abusereports", InsertKeys.ToArray(),InsertValues.ToArray()); }
public void UpdateAbuseReport(AbuseReport report, string Password) { IAbuseReportsConnector conn = Aurora.DataManager.DataManager.RequestPlugin<IAbuseReportsConnector>(); if (conn != null) conn.UpdateAbuseReport(report, Password); }
/// <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(); report.ObjectUUID = objectID; report.ObjectPosition = position.ToString(); report.Active = true; report.Checked = false; report.Notes = ""; report.AssignedTo = "No One"; report.ScreenshotID = screenshotID; if (objectID != UUID.Zero) { SceneObjectPart Object = ((Scene)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_SceneList[0].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 + "."); } //Tell the DB about it IAbuseReportsConnector conn = Aurora.DataManager.DataManager.RequestPlugin<IAbuseReportsConnector>(); if(conn != null) conn.AddAbuseReport(report); }
public void UpdateAbuseReport(AbuseReport report, string Password) { try { Dictionary<string, object> send = report.ToKVP(); send.Add("Password", Password); send.Add("METHOD", "AddAbuseReport"); List<string> m_ServerURIs = m_registry.RequestModuleInterface<IConfigurationService>().FindValueOf("AbuseReportsServerURI"); SynchronousRestFormsRequester.MakeRequest("POST", m_ServerURIs[0], WebUtils.BuildQueryString(send)); } catch (Exception e) { MainConsole.Instance.DebugFormat("[ABUSEREPORT CONNECTOR]: Exception when contacting friends server: {0}", e.Message); } }