public void Action_Click(object o, System.EventArgs e) { if (Mode.Equals(Modes.Abuse)) { if (Page.IsValid) { if (CurrentAbuse.Status.Equals(Abuse.StatusEnum.Done)) throw new DsiUserFriendlyException("Oops - this abuse report has already been resolved - maybe someone beat you to it..."); if (!(OverturnRadio.Checked || NoAbuseRadio.Checked || NoAbuseDeleteRadio.Checked || AbuseDeleteRadio.Checked || AbuseDeleteWatchRadio.Checked || AbuseDeleteBanRadio.Checked || AbuseDeleteBanModerateRadio.Checked)) { throw new DsiUserFriendlyException("You must choose an option!"); } if (OverturnRadio.Checked) { CurrentAbuse.ResolveDateTime = DateTime.Now; CurrentAbuse.Status = Abuse.StatusEnum.Done; CurrentAbuse.ResolveStatus = Abuse.ResolveStatusEnum.Overturned; CurrentAbuse.ResolveDescription = ResolveDescriptionTextBox.Text; CurrentAbuse.ResolveUsrK = Usr.Current.K; CurrentAbuse.Update(); Photo p = null; try { p = new Photo(CurrentAbuse.ObjectK); } catch { } Mailer m = new Mailer(); m.Subject = "Your abuse report has been resolved"; m.Body = "<p>You recently filed an abuse report about a photo</p>"; m.Body += "<p>Our moderators have reviewed the photo, and found no abuse. Please only report photos when there is a clear abuse of the photo rules. If you mis-use this abuse report service, you will not be able to make further reports.</p>"; m.Body += "<p>Our moderator included the following note:</p>"; m.Body += "<p><i>" + CurrentAbuse.ResolveDescription + "</i></p>"; if (p != null) m.RedirectUrl = p.Url(); m.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; m.UsrRecipient = CurrentAbuse.ReportUsr; m.Send(); CurrentAbuse.ReportUsr.UpdateAbuseTrackers(); CurrentAbuse.AbuseUsr.UpdateAbuseTrackers(); Bobs.Global.UpdatePhotoAbuseReports(); } else if (NoAbuseRadio.Checked || NoAbuseDeleteRadio.Checked) { CurrentAbuse.ResolveDateTime = DateTime.Now; CurrentAbuse.Status = Abuse.StatusEnum.Done; CurrentAbuse.ResolveStatus = Abuse.ResolveStatusEnum.NoAbuse; CurrentAbuse.ResolveDescription = ResolveDescriptionTextBox.Text; CurrentAbuse.ResolveUsrK = Usr.Current.K; CurrentAbuse.Update(); Photo p = null; try { p = new Photo(CurrentAbuse.ObjectK); if (NoAbuseDeleteRadio.Checked) p.DeleteAll(null); } catch { } Mailer m = new Mailer(); m.Subject = "Your abuse report has been resolved"; m.Body = "<p>You recently filed an abuse report about a photo</p>"; m.Body += "<p>Our moderators have reviewed the photo, and found no abuse. Your report was helpful however.</p>"; m.Body += "<p>Our moderator included the following note:</p>"; m.Body += "<p><i>" + CurrentAbuse.ResolveDescription + "</i></p>"; if (p != null) m.RedirectUrl = p.Url(); m.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; m.UsrRecipient = CurrentAbuse.ReportUsr; m.Send(); CurrentAbuse.ReportUsr.UpdateAbuseTrackers(); CurrentAbuse.AbuseUsr.UpdateAbuseTrackers(); Bobs.Global.UpdatePhotoAbuseReports(); } else if (AbuseDeleteRadio.Checked || AbuseDeleteWatchRadio.Checked || AbuseDeleteBanRadio.Checked || AbuseDeleteBanModerateRadio.Checked) { try { Photo ph = new Photo(CurrentAbuse.ObjectK); ph.DeleteAll(null); } catch { } if (AbuseDeleteWatchRadio.Checked) { try { CurrentAbuse.AbuseUsr.ModeratePhotos = true; CurrentAbuse.AbuseUsr.Update(); } catch { } } if (AbuseDeleteBanRadio.Checked) { try { CurrentAbuse.AbuseUsr.Banned = true; CurrentAbuse.AbuseUsr.BannedByUsrK = Usr.Current.K; CurrentAbuse.AbuseUsr.BannedDateTime = DateTime.Now; CurrentAbuse.AbuseUsr.BannedReason = ResolveDescriptionTextBox.Text; CurrentAbuse.AbuseUsr.Update(); Mailer sm = new Mailer(); sm.Body = "<p>Banned user: <a href=\"[LOGIN(" + CurrentAbuse.AbuseUsr.Url() + ")]\">" + CurrentAbuse.AbuseUsr.NickName + "</a> (" + CurrentAbuse.AbuseUsr.K + " - " + CurrentAbuse.AbuseUsr.Email + ")</p>"; sm.Body += "<p>They were banned by: <a href=\"[LOGIN(" + Usr.Current.Url() + ")]\">" + Usr.Current.NickName + "</a> (" + Usr.Current.K + " - " + Usr.Current.Email + ")</p>"; sm.Body += "<p>DateTime: " + DateTime.Now.ToString() + "</p>"; sm.Body += "<p>Reason: " + ResolveDescriptionTextBox.Text + "</p>"; sm.TemplateType = Mailer.TemplateTypes.AdminNote; sm.Subject = "New banned user - " + CurrentAbuse.AbuseUsr.NickName + " was banned by " + Usr.Current.NickName; sm.To = "*****@*****.**"; sm.Send(); } catch { } } if (AbuseDeleteBanModerateRadio.Checked) { Query q = new Query(); q.QueryCondition = new Q(Gallery.Columns.OwnerUsrK, CurrentAbuse.AbuseUsrK); GallerySet gs = new GallerySet(q); foreach (Gallery g in gs) { Query qP = new Query(); qP.QueryCondition = new Q(Photo.Columns.GalleryK, g.K); PhotoSet ps = new PhotoSet(qP); foreach (Photo ph in ps) { ph.Status = Photo.StatusEnum.Moderate; ph.Update(); } g.UpdateStats(null, true); g.UpdatePhotoOrder(null); if (g.Event != null) g.Event.UpdateTotalPhotos(null); } } CurrentAbuse.ResolveDateTime = DateTime.Now; CurrentAbuse.Status = Abuse.StatusEnum.Done; CurrentAbuse.ResolveStatus = Abuse.ResolveStatusEnum.Abuse; CurrentAbuse.ResolveDescription = ResolveDescriptionTextBox.Text; CurrentAbuse.ResolveUsrK = Usr.Current.K; CurrentAbuse.Update(); Mailer m = new Mailer(); m.Subject = "Your abuse report has been resolved"; m.Body = "<p>You recently filed an abuse report about a photo</p>"; m.Body += "<p>Our moderators have reviewed the photo, and found it breaks our rules. It has been deleted.</p>"; m.Body += "<p>Our moderator included the following note:</p>"; m.Body += "<p><i>" + CurrentAbuse.ResolveDescription + "</i></p>"; m.TemplateType = Mailer.TemplateTypes.AnotherSiteUser; m.UsrRecipient = CurrentAbuse.ReportUsr; m.Send(); CurrentAbuse.ReportUsr.UpdateAbuseTrackers(); CurrentAbuse.AbuseUsr.UpdateAbuseTrackers(); Bobs.Global.UpdatePhotoAbuseReports(); } PanelAbuse_Load(null, null); } } }