mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-04-01 03:50 am

[dw-free] Remove ability to flag other people's content as adult

[commit: http://hg.dwscoalition.org/dw-free/rev/9fbd871d8aeb]

http://bugs.dwscoalition.org/show_bug.cgi?id=599

Remove ability for users to flag other users content as adult content.

Patch by [personal profile] janinedog.

Files modified:
  • bin/upgrading/base-data.sql
  • bin/upgrading/en.dat
  • bin/upgrading/proplists.dat
  • bin/upgrading/s2layers/core1.s2
  • bin/upgrading/s2layers/core2.s2
  • bin/upgrading/update-db-general.pl
  • cgi-bin/Apache/LiveJournal.pm
  • cgi-bin/DW/Logic/AdultContent.pm
  • cgi-bin/DW/Setting/AdultContentReason.pm
  • cgi-bin/LJ/Console/Command/SetFlag.pm
  • cgi-bin/LJ/ContentFlag.pm
  • cgi-bin/LJ/Entry.pm
  • cgi-bin/LJ/M/ProfilePage.pm
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/DayPage.pm
  • cgi-bin/LJ/S2/FriendsPage.pm
  • cgi-bin/LJ/S2/RecentPage.pm
  • cgi-bin/LJ/Setting/AdultContent.pm
  • cgi-bin/LJ/Setting/SafeSearch.pm
  • cgi-bin/LJ/Setting/ViewingAdultContent.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/LJ/Widget/ContentFlagReport.pm
  • cgi-bin/LJ/Widget/ContentFlagSummary.pm
  • cgi-bin/LJ/Widget/IPPU/ContentFlagReporters.pm
  • cgi-bin/LJ/Widget/IPPU/EntrySummary.pm
  • cgi-bin/imageconf.pl
  • cgi-bin/supportlib.pl
  • cgi-bin/talklib.pl
  • cgi-bin/weblib.pl
  • etc/config.pl
  • htdocs/admin/contentflag.bml
  • htdocs/admin/contentflag_home.bml
  • htdocs/admin/entryprops.bml
  • htdocs/allpics.bml
  • htdocs/community/create.bml
  • htdocs/community/settings.bml
  • htdocs/js/widget_ippu/contentflagreporters.js
  • htdocs/js/widget_ippu/entrysummary.js
  • htdocs/misc/adult_concepts.bml
  • htdocs/misc/adult_concepts_blocked.bml
  • htdocs/misc/adult_explicit.bml
  • htdocs/misc/adult_explicit_blocked.bml
  • htdocs/stc/contentflag.css
  • htdocs/stc/widgets/contentflagreport.css
  • htdocs/talkpost.bml
  • htdocs/talkread.bml
  • htdocs/tools/content_flag.bml
  • htdocs/tools/content_flag_reported.bml
  • htdocs/tools/content_flag_spam.bml
  • htdocs/tools/content_flag_spam.bml.text
  • htdocs/tools/memories.bml
  • htdocs/view/index.bml
  • t/content_flag.t
--------------------------------------------------------------------------------
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/base-data.sql
--- a/bin/upgrading/base-data.sql	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/base-data.sql	Wed Apr 01 03:50:07 2009 +0000
@@ -570,8 +570,6 @@ UPDATE priv_list SET des='Allows a user 
 UPDATE priv_list SET des='Allows a user to edit site text in a given language. arg=Unique language code, optionally appended by |domainid.domaincode',is_public='1',privname='Translate/Update Text',scope='general' WHERE privcode='translate';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when a user adds someone to their Friends list', 'addfriend');
 UPDATE ratelist SET des='Logged when a user adds someone to their Friends list' WHERE name='addfriend';
-INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when user flags content', 'ctflag');
-UPDATE ratelist SET des='Logged when user flags content' WHERE name='ctflag';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when wrong username/password is used.', 'failed_login');
 UPDATE ratelist SET des='Logged when wrong username/password is used.' WHERE name='failed_login';
 INSERT IGNORE INTO ratelist (des, name) VALUES ('Logged when a user sends a free VGift', 'freevgifts');
@@ -917,7 +915,6 @@ REPLACE INTO schematables (des, public_b
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores database connection and replication info, instead of in the %LJ::DBINFO hash, for easier (web-based) management of LiveJournal installations with many databases.', '0', 'off', NULL, 'dbinfo');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores each database\'s roles and weights. The [dbtable[dbinfo]] table keeps track of which databases exist.', '0', 'off', NULL, 'dbweights');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores external user mappings. Note: extuser/extuserid are expected to sometimes be NULL, even though they are keyed. (Null values are not taken into account when using indexes).', '0', 'off', NULL, 'extuser');
-REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores flagged content metadata. Content can be flagged as adult content, etc.', '0', 'off', NULL, 'content_flag');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores information on syndicated accounts like feed URI, readership, polling, etc.', '0', 'off', NULL, 'syndicated');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores list of ESN notification class types.', '0', 'off', NULL, 'notifytypelist');
 REPLACE INTO schematables (des, public_browsable, redist_mode, redist_where, tablename) VALUES ('Global. Stores list of different admin privileges that users can have.', '1', 'replace', NULL, 'priv_list');
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/en.dat	Wed Apr 01 03:50:07 2009 +0000
@@ -2005,8 +2005,6 @@ img.editentry=Edit Entry
 
 img.edittags=Edit Tags
 
-img.flag_btn=Flag
-
 img.ins_obj=Insert Image/Object
 
 img.memadd=Add to memories!
@@ -3251,8 +3249,6 @@ web.controlstrip.links.editcommprofile=E
 
 web.controlstrip.links.explore=Explore [[sitenameabbrev]]
 
-web.controlstrip.links.flag=Flag Journal
-
 web.controlstrip.links.home=Home
 
 web.controlstrip.links.inbox=Inbox
@@ -3418,28 +3414,6 @@ widget.commsofuser.viewfriendspage=View 
 widget.commsofuser.viewfriendspage=View [[user]]'s Friends page
 
 widget.commsofuser.viewprofile=View [[user]]'s profile
-
-widget.contentflagreport.btn.returnentry=Return to Entry
-
-widget.contentflagreport.btn.returnjournal=Return to Journal
-
-widget.contentflagreport.btn.submit=Submit Report
-
-widget.contentflagreport.confirm=I feel that this content meets the description of <a [[aopts]]>Explicit Adult Content</a>.
-
-widget.contentflagreport.description=Go <a [[confirmaopts]]>here</a> to flag this content as explicitly adult.
-
-widget.contentflagreport.done=Thank you for your report. We will process it as soon as possible and take the appropriate action. Unfortunately, we can't respond individually to each report we receive.
-
-widget.contentflagreport.error.invalidentry=Invalid entry.
-
-widget.contentflagreport.error.invalidurl=Invalid URL.
-
-widget.contentflagreport.error.invalidusername=Invalid username.
-
-widget.contentflagreport.explore=Explore [[sitenameabbrev]]
-
-widget.contentflagreport.note=<span class='note-header'>Note:</span> <span class='note-text'>You have not yet flagged this content. Please review the following options and select the one that best fits your concerns.</span>
 
 widget.createaccount.alt_layout.error.tos=You must agree to the Terms of Service.
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/proplists.dat
--- a/bin/upgrading/proplists.dat	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/proplists.dat	Wed Apr 01 03:50:07 2009 +0000
@@ -13,14 +13,6 @@ userproplist.ad_visibility:
   indexed: 0
   multihomed: 0
   prettyname: Ad Visibility
-
-userproplist.admin_content_flag:
-  cldversion: 4
-  datatype: char
-  des: Internal flag describing the nature of this journal, set by an admin
-  indexed: 0
-  multihomed: 0
-  prettyname: Admin Content Flag
 
 userproplist.adult_content:
   cldversion: 4
@@ -1215,13 +1207,6 @@ talkproplist.unknown8bit:
   des: True if text has 8-bit data that's not in UTF-8
   prettyname: Unknown 8-bit text
 
-logproplist.admin_content_flag:
-  datatype: char
-  des: Internal flag describing the nature of this entry, set by an admin
-  prettyname: Admin Content Flag
-  sortorder: 106
-  ownership: system
-
 logproplist.adult_content:
   datatype: char
   des: Sets the entry as containing adult content (none, explicit, concepts)
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/s2layers/core1.s2
--- a/bin/upgrading/s2layers/core1.s2	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/s2layers/core1.s2	Wed Apr 01 03:50:07 2009 +0000
@@ -1346,11 +1346,6 @@ property string text_unwatch_comments {
 }
 set text_unwatch_comments = "Untrack This";
 
-property string text_flag {
-    des = "Text to flag an entry";
-}
-set text_flag = "Flag";
-
 property string text_month_screened_comments {
     des = "Text to indicate there are screened comments";
 }
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/s2layers/core2.s2	Wed Apr 01 03:50:07 2009 +0000
@@ -1747,9 +1747,6 @@ set text_watch_comments = "Track This";
 
 property string text_unwatch_comments { des = "Text to stop tracking events on an entry"; }
 set text_unwatch_comments = "Untrack This";
-
-property string text_flag { des = "Text to flag an entry"; }
-set text_flag = "Flag";
 
 property string text_permalink {
     des = "Text for an entry's permanent link";
diff -r 1138cfcfec8f -r 9fbd871d8aeb bin/upgrading/update-db-general.pl
--- a/bin/upgrading/update-db-general.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/bin/upgrading/update-db-general.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -2860,27 +2860,6 @@ CREATE TABLE uniqmap (
 )
 EOC
 
-register_tablecreate("content_flag", <<'EOC');
-CREATE TABLE content_flag (
-    flagid INT UNSIGNED NOT NULL AUTO_INCREMENT,
-    journalid INT UNSIGNED NOT NULL,
-    typeid TINYINT UNSIGNED NOT NULL,
-    itemid INT UNSIGNED,
-    catid TINYINT UNSIGNED NOT NULL,
-    reporterid INT UNSIGNED NOT NULL,
-    reporteruniq VARCHAR(15),
-    instime INT UNSIGNED NOT NULL,
-    modtime INT UNSIGNED NOT NULL,
-    status CHAR(1),
-
-    PRIMARY KEY (flagid),
-    INDEX (journalid, typeid, itemid),
-    INDEX (instime),
-    INDEX (reporterid),
-    INDEX (status)
-)
-EOC
-
 # clustered
 register_tablecreate("usermsg", <<'EOC');
 CREATE TABLE usermsg (
@@ -3195,11 +3174,6 @@ register_alter(sub {
 
     my $dbh = shift;
     my $runsql = shift;
-
-    if (column_type("content_flag", "reporteruniq") eq "") {
-        do_alter("content_flag",
-                 "ALTER TABLE content_flag ADD reporteruniq VARCHAR(15) AFTER reporterid");
-    }
 
     if (column_type("supportcat", "is_selectable") eq "") {
         do_alter("supportcat",
@@ -3807,12 +3781,6 @@ register_alter(sub {
                  "AFTER hide_helpers");
     }
 
-    unless (column_type("content_flag", "supportid")) {
-        do_alter("content_flag",
-                 "ALTER TABLE content_flag " .
-                 "ADD supportid INT(10) UNSIGNED NOT NULL DEFAULT '0'");
-    }
-
     # add a status column to polls
     unless (column_type("poll", "status")) {
         do_alter("poll",
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/Apache/LiveJournal.pm
--- a/cgi-bin/Apache/LiveJournal.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/Apache/LiveJournal.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -441,7 +441,7 @@ sub trans
         }
 
         # check if this entry or journal contains adult content
-        if (LJ::is_enabled('content_flag')) {
+        if ( LJ::is_enabled( 'adult_content' ) ) {
             # force remote to be checked
             my $burl = LJ::remote_bounce_url();
             return remote_domsess_bounce() if LJ::remote_bounce_url();
@@ -477,14 +477,14 @@ sub trans
             if ($adult_content ne "none" && $is_journal_page && !$should_show_page) {
                 my $returl = "http://$host" . $r->uri . "$args_wq";
 
-                LJ::ContentFlag->check_adult_cookie($returl, \%BMLCodeBlock::POST, "concepts");
-                LJ::ContentFlag->check_adult_cookie($returl, \%BMLCodeBlock::POST, "explicit");
+                DW::Logic::AdultContent->check_adult_cookie( $returl, \%BMLCodeBlock::POST, "concepts" );
+                DW::Logic::AdultContent->check_adult_cookie( $returl, \%BMLCodeBlock::POST, "explicit" );
 
-                my $cookie = $BML::COOKIE{LJ::ContentFlag->cookie_name($adult_content)};
+                my $cookie = $BML::COOKIE{DW::Logic::AdultContent->cookie_name( $adult_content )};
 
                 # if they've confirmed that they're over 18, then they're over 14 too
                 if ($adult_content eq "concepts" && !$cookie) {
-                    $cookie = 1 if $BML::COOKIE{LJ::ContentFlag->cookie_name("explicit")};
+                    $cookie = 1 if $BML::COOKIE{DW::Logic::AdultContent->cookie_name( "explicit" )};
                 }
 
                 LJ::set_active_journal( $u );
@@ -495,12 +495,12 @@ sub trans
                 # logged in users without defined ages and logged out users are given confirmation pages (unless they have already confirmed)
                 if ($remote) {
                     if ($adult_content eq "explicit" && $remote->is_minor) {
-                        return $bml_handler->(LJ::ContentFlag->adult_interstitial_path(type => "${adult_content}_blocked"));
+                        return $bml_handler->( DW::Logic::AdultContent->adult_interstitial_path( type => "${adult_content}_blocked" ) );
                     } elsif (!$remote->best_guess_age && !$cookie) {
-                        return $bml_handler->(LJ::ContentFlag->adult_interstitial_path(type => $adult_content));
+                        return $bml_handler->( DW::Logic::AdultContent->adult_interstitial_path( type => $adult_content ) );
                     }
                 } elsif (!$remote && !$cookie) {
-                    return $bml_handler->(LJ::ContentFlag->adult_interstitial_path(type => $adult_content));
+                    return $bml_handler->( DW::Logic::AdultContent->adult_interstitial_path( type => $adult_content ) );
                 }
             }
         }
@@ -1224,7 +1224,7 @@ sub journal_content
         my $u = LJ::load_user($RQ{'user'});
         return 404 unless $u;
 
-        $u->preload_props("opt_blockrobots", "adult_content", "admin_content_flag");
+        $u->preload_props("opt_blockrobots", "adult_content");
         $r->content_type("text/plain");
 #        $r->send_http_header();
         my @extra = LJ::run_hook("robots_txt_extra", $u), ();
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/DW/Logic/AdultContent.pm
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/cgi-bin/DW/Logic/AdultContent.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -0,0 +1,167 @@
+#!/usr/bin/perl
+#
+# DW::Logic::AdultContent
+#
+# This module provides logic for various adult content related functions.
+#
+# Authors:
+#      Janine Costanzo <janine@netrophic.com>
+#
+# Copyright (c) 2009 by Dreamwidth Studios, LLC.
+#
+# This program is free software; you may redistribute it and/or modify it under
+# the same terms as Perl itself.  For a copy of the license, please reference
+# 'perldoc perlartistic' or 'perldoc perlgpl'.
+#
+
+package DW::Logic::AdultContent;
+
+use strict;
+
+# changes an adult post into a fake LJ-cut if this journal/entry is marked as adult content
+# and the viewer doesn't want to see such entries
+sub transform_post {
+    my ( $class, %opts ) = @_;
+
+    my $post = delete $opts{post} or return '';
+    return $post unless LJ::is_enabled( 'adult_content' );
+
+    my $entry = $opts{entry} or return $post;
+    my $journal = $opts{journal} or return $post;
+    my $remote = delete $opts{remote} || LJ::get_remote();
+
+    # we should show the entry expanded if:
+    # the remote user owns the journal that the entry is posted in OR
+    # the remote user posted the entry
+    my $poster = $entry->poster;
+    return $post if LJ::isu( $remote ) && ( $remote->can_manage( $journal ) || $remote->equals( $poster ) );
+
+    my $adult_content = $entry->adult_content_calculated || $journal->adult_content_calculated;
+    return $post if $adult_content eq 'none';
+
+    my $view_adult = LJ::isu( $remote ) ? $remote->hide_adult_content : 'concepts';
+    if ( !$view_adult || $view_adult eq 'none' || ( $view_adult eq 'explicit' && $adult_content eq 'concepts' ) ) {
+        return $post;
+    }
+
+    # return a fake LJ-cut going to an adult content warning interstitial page
+    my $adult_interstitial = sub {
+        return $class->adult_interstitial_link( type => shift(), %opts ) || $post;
+    };
+
+    if ( $adult_content eq 'concepts' ) {
+        return $adult_interstitial->( 'concepts' );
+    } elsif ( $adult_content eq 'explicit' ) {
+        return $adult_interstitial->( 'explicit' );
+    }
+
+    return $post;
+}
+
+# returns an link to an adult content warning page
+sub adult_interstitial_link {
+    my ( $class, %opts ) = @_;
+
+    my $entry = $opts{entry};
+    my $type = $opts{type};
+    return '' unless $entry && $type;
+
+    my $url = $entry->url;
+    my $msg;
+
+    my $markedby = $entry->adult_content_marker;
+
+    if ( $type eq 'explicit' ) {
+        $msg = LJ::Lang::ml( 'contentflag.viewingexplicit.by' . $markedby );
+    } else {
+        $msg = LJ::Lang::ml( 'contentflag.viewingconcepts.by' . $markedby );
+    }
+
+    return '' unless $msg;
+
+    my $fake_cut = qq{<b>( <a href="$url">$msg</a> )</b>};
+    return $fake_cut;
+}
+
+# returns path for adult content warning page
+sub adult_interstitial_path {
+    my ( $class, %opts ) = @_;
+
+    my $type = $opts{type};
+    return '' unless $type;
+
+    my $path = "$LJ::HOME/htdocs/misc/adult_${type}.bml";
+    return $path;
+}
+
+sub interstitial_reason {
+    my ( $class, $journal, $entry ) = @_;
+    my $poster = defined $entry ? $entry->poster : $journal;
+    my $ret = "";
+    my $reason_exists = 0;
+
+    if ( $journal->adult_content ne 'none' && $journal->adult_content_reason ) {
+        my $what = $journal->is_community ? 'community' : 'journal';
+        my $reason = LJ::ehtml( $journal->adult_content_reason );
+
+        if ( $journal->adult_content_calculated eq 'concepts' ) {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.concepts.' . $what . 'reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        } else {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.explicit.' . $what . 'reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        }
+
+        $reason_exists = 1;
+    }
+
+    if ( defined $entry && $entry->adult_content && $entry->adult_content ne 'none' && $entry->adult_content_reason ) {
+        $ret .= "<br />" if $reason_exists;
+        my $reason = LJ::ehtml( $entry->adult_content_reason );
+
+        if ( $entry->adult_content eq 'concepts' ) {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.concepts.byposter.reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        } else {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.explicit.byposter.reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        }
+        $reason_exists = 1;
+    }
+
+    if ( defined $entry && $entry->adult_content_maintainer && $entry->adult_content_maintainer ne 'none' && $entry->adult_content_maintainer_reason ) {
+        $ret .= "<br />" if $reason_exists;
+        my $reason = LJ::ehtml( $entry->adult_content_maintainer_reason );
+
+        if ( $entry->adult_content_maintainer eq 'concepts' ) {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.concepts.byjournal.reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        } else {
+            $ret .= LJ::Lang::ml( '/misc/adult_content.bml.message.explicit.byjournal.reason', { journal => $journal->ljuser_display, poster => $poster->ljuser_display, reason => $reason } );
+        }
+        $reason_exists = 1;
+    }
+
+    if ( $reason_exists ) {
+        $ret = "<tr><td colspan=\"2\">\n$ret\n</td></tr>\n";
+    }
+
+    return $ret;
+}
+
+sub check_adult_cookie {
+    my ( $class, $returl, $postref, $type ) = @_;
+
+    my $cookiename = __PACKAGE__->cookie_name( $type );
+    return undef unless $cookiename;
+
+    my $has_seen = $BML::COOKIE{$cookiename};
+    my $adult_check = $postref->{adult_check};
+
+    BML::set_cookie( $cookiename => '1', 0 ) if $adult_check;
+    return $has_seen || $adult_check ? $returl : undef;
+}
+
+sub cookie_name {
+    my ( $class, $type ) = @_;
+
+    return "" unless $type eq "concepts" || $type eq "explicit";
+    return "adult_$type";
+}
+
+1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/DW/Setting/AdultContentReason.pm
--- a/cgi-bin/DW/Setting/AdultContentReason.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/DW/Setting/AdultContentReason.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -7,7 +7,7 @@ sub should_render {
 sub should_render {
     my ( $class, $u ) = @_;
 
-    return !LJ::is_enabled( "content_flag" ) || !$u || $u->is_identity ? 0 : 1;
+    return !LJ::is_enabled( 'adult_content' ) || !$u || $u->is_identity ? 0 : 1;
 }
 
 sub label {
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Console/Command/SetFlag.pm
--- a/cgi-bin/LJ/Console/Command/SetFlag.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-package LJ::Console::Command::SetFlag;
-
-use strict;
-use base qw(LJ::Console::Command);
-use Carp qw(croak);
-
-sub cmd { "set_flag" }
-
-sub desc { "Set a content flag for an account or an entry." }
-
-sub args_desc { [
-                 'content' => "The username of the account or the URL of the entry",
-                 'state' => "Options are: 'explicit_adult', 'hate_speech', 'illegal_activity', 'child_porn', 'self_harm', 'sexual_content', 'other', or 'none' (which unsets the flag)",
-                 'reason' => "Reason why the action is being done",
-                 ] }
-
-sub usage { '<content> <state> <reason>' }
-
-sub can_execute {
-    my $remote = LJ::get_remote();
-    return $remote && $remote->can_admin_content_flagging ? 1 : 0;
-}
-
-sub execute {
-    my ($self, $content, $state, $reason, @args) = @_;
-
-    return $self->error("This command takes three arguments. Consult the reference.")
-        unless $content && $state && $reason && scalar(@args) == 0;
-
-    # check to see if it's a user or an entry
-    my $u = LJ::load_user($content);
-    my $entry = LJ::Entry->new_from_url($content);
-    my ($type, $content_obj, $for_u);
-    if ($u && !$entry) {
-        $type = "Journal";
-        $content_obj = $u;
-        $for_u = $u;
-    } elsif (!$u && $entry) {
-        $type = "Entry";
-        $content_obj = $entry;
-        $for_u = $entry->journal;
-    } else {
-        return $self->error("First argument must be either a username or the URL to an entry.");
-    }
-
-    return $self->error("Second argument must be one of: 'explicit_adult', 'hate_speech', 'illegal_activity', 'child_porn', 'self_harm', 'sexual_content', 'other', or 'none'.")
-        unless $state =~ /^(?:explicit_adult|hate_speech|illegal_activity|child_porn|self_harm|sexual_content|other|none)$/;
-
-    if ($content_obj->admin_content_flag eq $state) {
-        return $self->error("$type is already flagged as: $state");
-    } elsif (!$content_obj->admin_content_flag && $state eq "none") {
-        return $self->error("$type already doesn't have a content flag set.");
-    }
-
-    if ($state eq "none") {
-        $content_obj->set_prop("admin_content_flag", undef);
-        $self->print("${type}'s content flag has been unset.");
-    } else {
-        $content_obj->set_prop("admin_content_flag", $state);
-        $self->print("$type has been flagged as: $state");
-    }
-
-    my $remote = LJ::get_remote();
-    if ($type eq "Journal") {
-        LJ::statushistory_add($for_u, $remote, "set_flag", "journal flagged as $state: " . $reason);
-    } else { # entry
-        LJ::statushistory_add($for_u, $remote, "set_flag", "$content flagged as $state: " . $reason);
-    }
-
-    return 1;
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/ContentFlag.pm
--- a/cgi-bin/LJ/ContentFlag.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,799 +0,0 @@
-use strict;
-package LJ::ContentFlag;
-use Carp qw (croak);
-use Digest::MD5;
-
-use constant {
-    # status
-    NEW             => 'N',
-    CLOSED          => 'C',
-
-    FLAG_EXPLICIT_ADULT => 'E',
-    FLAG_HATRED         => 'H',
-    FLAG_ILLEGAL        => 'I',
-    FLAG_CHILD_PORN     => 'P',
-    FLAG_SELF_HARM      => 'X',
-    FLAG_SEXUAL         => 'L',
-    FLAG_OTHER          => 'R',
-
-    # these are not used
-    ABUSE_WARN      => 'W',
-    ABUSE_DELETE    => 'D',
-    ABUSE_SUSPEND   => 'S',
-    ABUSE_TERMINATE => 'T',
-    ABUSE_FLAG_ADULT=> 'E',
-    REPORTER_BANNED => 'B',
-    PERM_OK         => 'O',
-
-    # category
-    CHILD_PORN       => 1,
-    ILLEGAL_ACTIVITY => 2,
-    ILLEGAL_CONTENT  => 3, # not used
-    EXPLICIT_ADULT_CONTENT => 4,
-    OFFENSIVE_CONTENT => 5,
-    HATRED_SITE => 6,
-    SPAM => 7,
-
-    # type
-    ENTRY   => 1,
-    COMMENT => 2,
-    JOURNAL => 3,
-    PROFILE => 4,
-};
-
-# constants to English
-our %CAT_NAMES = (
-    LJ::ContentFlag::CHILD_PORN             => "Nude Images of Minors",
-    LJ::ContentFlag::ILLEGAL_ACTIVITY       => "Illegal Activity",
-    LJ::ContentFlag::EXPLICIT_ADULT_CONTENT => "Age 18 and Over Only",
-    LJ::ContentFlag::OFFENSIVE_CONTENT      => "Offensive Content",
-    LJ::ContentFlag::HATRED_SITE            => "Hate Speech",
-    LJ::ContentFlag::SPAM                   => "Spam",
-);
-
-our @CAT_ORDER = (
-    LJ::ContentFlag::SPAM,
-    LJ::ContentFlag::EXPLICIT_ADULT_CONTENT,
-    LJ::ContentFlag::OFFENSIVE_CONTENT,
-    LJ::ContentFlag::HATRED_SITE,
-    LJ::ContentFlag::ILLEGAL_ACTIVITY,
-    LJ::ContentFlag::CHILD_PORN,
-);
-
-# categories that, when selected by the user, will bring them to an Abuse report form
-# value is the key name of the section of the abuse form that the user should start at
-our %CATS_TO_ABUSE = (
-    LJ::ContentFlag::HATRED_SITE => "hatespeech",
-    LJ::ContentFlag::ILLEGAL_ACTIVITY => "illegal",
-    LJ::ContentFlag::CHILD_PORN => "childporn",
-);
-
-# categories that, when selected by the user, should handle the reported content as spam
-our @CATS_TO_SPAMREPORTS = (
-    LJ::ContentFlag::SPAM,
-);
-
-our %STATUS_NAMES = (
-    LJ::ContentFlag::NEW                 => 'New',
-    LJ::ContentFlag::CLOSED              => 'Marked as Bogus Report (No Action)',
-    LJ::ContentFlag::FLAG_EXPLICIT_ADULT => 'Flagged as Age 18 and Over Only',
-    LJ::ContentFlag::FLAG_HATRED         => 'Flagged as Hate Speech',
-    LJ::ContentFlag::FLAG_ILLEGAL        => 'Flagged as Illegal Activity',
-    LJ::ContentFlag::FLAG_CHILD_PORN     => 'Flagged as Nude Images of Minors',
-    LJ::ContentFlag::FLAG_SELF_HARM      => 'Flagged as Self Harm',
-    LJ::ContentFlag::FLAG_SEXUAL         => 'Flagged as Sexual Content',
-    LJ::ContentFlag::FLAG_OTHER          => 'Flagged as Other',
-);
-
-sub category_names { \%CAT_NAMES }
-sub category_order { \@CAT_ORDER }
-sub categories_to_abuse { \%CATS_TO_ABUSE }
-sub categories_to_spamreports { \@CATS_TO_SPAMREPORTS }
-sub status_names   { \%STATUS_NAMES }
-
-our @fields;
-
-# there has got to be a better way to use fields with a list
-BEGIN {
-    @fields = qw (flagid journalid typeid itemid catid reporterid reporteruniq instime modtime status);
-    eval "use fields qw(" . join (' ', @fields) . " _count); 1;" or die $@;
-};
-
-
-####### Class methods
-
-
-# create a flag for an item
-#  opts:
-#   $item or $type + $itemid - need to pass $item (entry, comment, etc...) or $type constant with $itemid
-#   $journal - journal the $item is in (not needed if $item passed)
-#   $reporter - person flagging this item
-#   $cat - category constant (why is the reporter flagging this?)
-sub create {
-    my ($class, %opts) = @_;
-
-    my $journal = delete $opts{journal} || LJ::load_userid(delete $opts{journalid});
-    my $type = delete $opts{type} || delete $opts{typeid};
-    my $item = delete $opts{item};
-    my $itemid = delete $opts{itemid};
-    my $reporter = (delete $opts{reporter} || LJ::get_remote()) or croak 'no reporter';
-    my $cat = delete $opts{cat} || delete $opts{catid} or croak 'no category';
-
-    croak "need item or type" unless $item || $type;
-    croak "need journal" unless $journal;
-
-    croak "unknown options: " . join(', ', keys %opts) if %opts;
-
-    # if $item passed, get itemid and type from it
-    if ($item) {
-        if ($item->isa("LJ::Entry")) {
-            $itemid = $item->ditemid;
-            $type = ENTRY;
-        } else {
-            croak "unknown item type: $item";
-        }
-    }
-
-    my $uniq = LJ::UniqCookie->current_uniq;
-
-    my %flag = (
-                journalid    => $journal->id,
-                itemid       => $itemid,
-                typeid       => $type,
-                catid        => $cat,
-                reporterid   => $reporter->id,
-                status       => LJ::ContentFlag::NEW,
-                instime      => time(),
-                reporteruniq => $uniq,
-                );
-
-    my $dbh = LJ::get_db_writer() or die "could not get db writer";
-    my @params = keys %flag;
-    my $bind = LJ::bindstr(@params);
-    $dbh->do("INSERT INTO content_flag (" . join(',', @params) . ") VALUES ($bind)",
-             undef, map { $flag{$_} } @params);
-    die $dbh->errstr if $dbh->err;
-
-    my $flagid = $dbh->{mysql_insertid};
-    die "did not get an insertid" unless defined $flagid;
-
-    # log this rating
-    LJ::rate_log($reporter, 'ctflag', 1);
-
-    $flag{flagid} = $flagid;
-    my ($dbflag) = $class->absorb_row(\%flag);
-    return $dbflag;
-}
-# alias flag() to create()
-*flag = \&create;
-
-*load_by_flagid = \&load_by_id;
-sub load_by_id {
-    my ($class, $flagid, %opts) = @_;
-    return undef unless $flagid;
-    return $class->load(flagid => $flagid+0, %opts);
-}
-
-sub load_by_flagids {
-    my ($class, $flagidsref, %opts) = @_;
-    croak "not passed a flagids arrayref" unless ref $flagidsref && ref $flagidsref eq 'ARRAY';
-    return () unless @$flagidsref;
-    return $class->load(flagids => $flagidsref, %opts);
-}
-
-sub load_by_journal {
-    my ($class, $journal, %opts) = @_;
-    return $class->load(journalid => LJ::want_userid($journal), %opts);
-}
-
-sub load_by_status {
-    my ($class, $status, %opts) = @_;
-    return $class->load(status => $status, %opts);
-}
-
-# load flags marked NEW
-sub load_outstanding {
-    my ($class, %opts) = @_;
-    return $class->load(status => LJ::ContentFlag::NEW, %opts);
-}
-
-# given a flag, find other flags that have the same journalid, typeid, itemid, catid
-sub find_similar_flags {
-    my ($self, %opts) = @_;
-    return $self->load(
-                       journalid => $self->journalid,
-                       itemid => $self->itemid,
-                       typeid => $self->typeid,
-                       catid => $self->catid,
-                       %opts,
-                       );
-}
-
-sub find_similar_flagids {
-    my ($self, %opts) = @_;
-    my $dbr = LJ::get_db_reader();
-    my $flagids = $dbr->selectcol_arrayref("SELECT flagid FROM content_flag WHERE " .
-                                           "journalid=? AND typeid=? AND itemid=? AND catid=? AND flagid != ? LIMIT 1000",
-                                           undef, $self->journalid, $self->typeid, $self->itemid, $self->catid, $self->flagid);
-    die $dbr->errstr if $dbr->err;
-    return @$flagids;
-}
-
-# load rows from DB
-# if $opts{lock}, this will lock the result set for a while so that
-# other people won't get the same set of flags to work on
-#
-# other opts:
-#  limit, catid, status, flagid, flagids (arrayref), sort
-sub load {
-    my ($class, %opts) = @_;
-
-    my $instime = $opts{from};
-
-    # default to showing everything in the past month
-    $instime = time() - 86400*30 unless defined $instime;
-    $opts{instime} ||= $instime;
-
-    my $limit = $opts{limit}+0 || 1000;
-
-    my $catid = $opts{catid};
-    my $status = $opts{status};
-    my $flagid = $opts{flagid};
-    my $flagidsref = $opts{flagids};
-
-    croak "cannot pass flagid and flagids" if $flagid && $flagidsref;
-
-    my $sort = $opts{sort};
-
-    my $fields = join(',', @fields);
-
-    my $dbr = LJ::get_db_reader() or die "Could not get db reader";
-
-    my @vals = ();
-    my $constraints = "";
-
-    # add other constraints
-    foreach my $c (qw( journalid typeid itemid catid status flagid modtime instime reporterid )) {
-        my $val = delete $opts{$c} or next;
-
-        my $cmp = '=';
-
-        # use > for selecting by time, = for everything else
-        if ($c eq 'modtime' || $c eq 'instime') {
-            $cmp = '>';
-        }
-
-        # build sql
-        $constraints .= ($constraints ? " AND " : " ") . "$c $cmp ?";
-        push @vals, $val;
-    }
-
-    if ($flagidsref) {
-        my @flagids = @$flagidsref;
-        my $bind = LJ::bindstr(@flagids);
-        $constraints .= ($constraints ? " AND " : " ") . "flagid IN ($bind)";
-        push @vals, @flagids;
-    }
-
-    croak "no constraints specified" unless $constraints;
-
-    my @locked;
-
-    if ($opts{lock}) {
-        if (my @locked = $class->locked_flags) {
-            my $lockedbind = LJ::bindstr(@locked);
-            $constraints .= " AND flagid NOT IN ($lockedbind)";
-            push @vals, @locked;
-        }
-    }
-
-    my $groupby = '';
-
-    $sort =~ s/\W//g if $sort;
-
-    if ($opts{group}) {
-        $groupby = ' GROUP BY journalid,typeid,itemid';
-        $fields .= ',COUNT(flagid) as count';
-        $sort ||= 'count';
-    }
-
-    $sort ||= 'instime';
-
-    my $sql = "SELECT $fields FROM content_flag WHERE $constraints $groupby ORDER BY $sort DESC LIMIT $limit";
-    print STDERR $sql if $opts{debug};
-
-    my $rows = $dbr->selectall_arrayref($sql, undef, @vals);
-    die $dbr->errstr if $dbr->err;
-
-    if ($opts{lock}) {
-        # lock flagids for a few minutes
-        my @flagids = map { $_->[0] } @$rows;
-
-        # lock flags on the same items as well
-        my @items = $class->load_by_flagids(\@flagids);
-        my @related_flagids = map { $_->find_similar_flagids } @items;
-
-        push @flagids, (@related_flagids, @locked);
-
-        $class->lock(@flagids);
-    }
-
-    return map { $class->absorb_row($_) } @$rows;
-}
-
-sub locked_flags {
-    my $class = shift;
-    my %locked = $class->_locked_values;
-    return keys %locked;
-}
-
-sub _locked_values {
-    my $class = shift;
-    my %locked = %{ LJ::MemCache::get($class->memcache_key) || {} };
-
-    # delete out flags that were locked >5 minutes ago
-    foreach (keys %locked) {
-        delete $locked{$_} if $locked{$_} < time() - 5*60;
-    }
-
-    return %locked;
-}
-
-
-# append these flagids to the locked set
-sub lock {
-    my ($class, @flagids) = @_;
-    my %locked = $class->_locked_values;
-
-    # add in the new flags
-    $locked{$_} = time() foreach @flagids;
-
-    LJ::MemCache::set($class->memcache_key, \%locked, 5 * 60);
-}
-
-# remove these flagids from the locked set
-sub unlock {
-    my ($class, @flagids) = @_;
-
-    # if there's nothing memcached, there's nothing to unlock!
-    my %locked = $class->_locked_values
-        or return;
-
-    delete $locked{$_} foreach @flagids;
-
-    LJ::MemCache::set($class->memcache_key, \%locked, 5 * 60);
-}
-
-sub memcache_key { 'ct_flag_locked' }
-
-sub absorb_row {
-    my ($class, $row) = @_;
-
-    my $self = fields::new($class);
-
-    if (ref $row eq 'ARRAY') {
-        $self->{$_} = (shift @$row) foreach @fields;
-        $self->{_count} = (shift @$row) if @$row;
-    } elsif (ref $row eq 'HASH') {
-        $self->{$_} = $row->{$_} foreach @fields;
-
-        if ($row->{'count'}) {
-            $self->{_count} = $row->{'count'};
-        }
-    } else {
-        croak "unknown row type";
-    }
-
-    return $self;
-}
-
-# given journalid, typeid, and itemid returns user objects of all the reporters of this item, along with the support requests they opened
-sub get_reporters {
-    my ($class, %opts) = @_;
-
-    croak "invalid params" unless $opts{journalid} && $opts{typeid};
-    $opts{itemid} += 0;
-
-    my $dbr = LJ::get_db_reader();
-    my $sth = $dbr->prepare('SELECT reporterid, supportid FROM content_flag WHERE ' .
-                             'journalid=? AND typeid=? AND itemid=? ORDER BY instime DESC LIMIT 1000');
-    $sth->execute($opts{journalid}, $opts{typeid}, $opts{itemid});
-    die $dbr->errstr if $dbr->err;
-
-    my @rows = ();
-    while (my $row = $sth->fetchrow_hashref) {
-        push @rows, $row;
-    }
-
-    return @rows;
-}
-
-sub requests_exist_for_flag {
-    my ($class, $flag) = @_;
-
-    my @reporters = $class->get_reporters( journalid => $flag->journalid, typeid => $flag->typeid, itemid => $flag->itemid );
-    foreach my $reporter (@reporters) {
-        return 1 if $reporter->{supportid};
-    }
-
-    return 0;
-}
-
-# returns a hash of catid => count
-sub flag_count_by_category {
-    my ($class, %opts) = @_;
-
-    # this query is unpleasant, so memcache it
-    my $countref = LJ::MemCache::get('ct_flag_cat_count');
-    return %$countref if $countref;
-
-    my $dbr = LJ::get_db_reader();
-    my $rows = $dbr->selectall_hashref("SELECT catid, COUNT(*) as cat_count FROM content_flag " .
-                                       "WHERE status = 'N' GROUP BY catid", 'catid');
-    die $dbr->errstr if $dbr->err;
-
-    my %count = map { $_, $rows->{$_}->{cat_count} } keys %$rows;
-
-    LJ::MemCache::set('ct_flag_cat_count', \%count, 5);
-
-    return %count;
-}
-
-sub get_most_common_cat_for_flag {
-    my ($class, %opts) = @_;
-
-    my $dbr = LJ::get_db_reader();
-    my $sth = $dbr->prepare("SELECT catid, COUNT(catid) as cat_count FROM content_flag " .
-                            "WHERE journalid = ? AND typeid = ? AND itemid = ? GROUP BY catid");
-    $sth->execute($opts{journalid}, $opts{typeid}, $opts{itemid});
-    die $dbr->errstr if $dbr->err;
-
-    my $cat_max = 0;
-    my $catid_with_max;
-    while (my $row = $sth->fetchrow_hashref) {
-        if ($row->{cat_count} > $cat_max) {
-            $cat_max = $row->{cat_count};
-            $catid_with_max = $row->{catid};
-        }
-    }
-
-    return $catid_with_max;
-}
-
-# returns a url for flagging this item
-# pass in LJ::User, LJ::Entry or LJ::Comment
-sub flag_url {
-    my ($class, $item, %opts) = @_;
-
-    return unless $item && ref $item;
-
-    my $type = $opts{type} || '';
-    my $base_url = "$LJ::SITEROOT/tools/content_flag.bml";
-
-    if ($item->isa('LJ::User')) {
-        return "$base_url?user=" . $item->user;
-    } elsif ($item->isa('LJ::Entry')) {
-        my $ditemid = $item->valid ? $item->ditemid : 0;
-        return "$base_url?user=" . $item->journal->user . "&itemid=$ditemid";
-    }
-
-    croak "Unknown item $item passed to flag_url";
-}
-
-sub adult_flag_url {
-    my ($class, $item) = @_;
-
-    return $class->flag_url($item, type => 'adult');
-}
-
-# changes an adult post into a fake LJ-cut if this journal/entry is marked as adult content
-# and the viewer doesn't want to see such entries
-sub transform_post {
-    my ($class, %opts) = @_;
-
-    my $post = delete $opts{post} or return '';
-    return $post if LJ::conf_test($LJ::DISABLED{content_flag});
-
-    my $entry = $opts{entry} or return $post;
-    my $journal = $opts{journal} or return $post;
-    my $remote = delete $opts{remote} || LJ::get_remote();
-
-    # we should show the entry expanded if:
-    # the remote user owns the journal that the entry is posted in OR
-    # the remote user posted the entry
-    my $poster = $entry->poster;
-    return $post if LJ::isu($remote) && ($remote->can_manage($journal) || $remote->equals($poster));
-
-    my $adult_content = $entry->adult_content_calculated || $journal->adult_content_calculated;
-    return $post if $adult_content eq 'none';
-
-    my $view_adult = LJ::isu($remote) ? $remote->hide_adult_content : 'concepts';
-    if (!$view_adult || $view_adult eq 'none' || ($view_adult eq 'explicit' && $adult_content eq 'concepts')) {
-        return $post;
-    }
-
-    # return a fake LJ-cut going to an adult content warning interstitial page
-    my $adult_interstitial = sub {
-        return $class->adult_interstitial_link(type => shift(), %opts) || $post;
-    };
-
-    if ($adult_content eq 'concepts') {
-        return $adult_interstitial->('concepts');
-    } elsif ($adult_content eq 'explicit') {
-        return $adult_interstitial->('explicit');
-    }
-
-    return $post;
-}
-
-# returns url for adult content warning page
-sub adult_interstitial_url {
-    my ($class, %opts) = @_;
-
-    my $type = $opts{type};
-    my $entry = $opts{entry};
-    return '' unless $type;
-
-    my $ret = $opts{ret};
-    $ret ||= $entry->url if $entry;
-
-    my $url = "$LJ::SITEROOT/misc/adult_${type}.bml";
-    $url .= "?ret=$ret" if $ret;
-
-    return $url;
-}
-
-# returns path for adult content warning page
-sub adult_interstitial_path {
-    my ($class, %opts) = @_;
-
-    my $type = $opts{type};
-    return '' unless $type;
-
-    my $path = "$LJ::HOME/htdocs/misc/adult_${type}.bml";
-    return $path;
-}
-
-# returns an link to an adult content warning page
-sub adult_interstitial_link {
-    my ($class, %opts) = @_;
-
-    my $entry = $opts{entry};
-    my $type = $opts{type};
-    return '' unless $entry && $type;
-
-    my $url = $entry->url;
-    my $msg;
-
-    my $markedby = $entry->adult_content_marker;
-
-    if ($type eq 'explicit') {
-        $msg = LJ::Lang::ml('contentflag.viewingexplicit.by' . $markedby);
-    } else {
-        $msg = LJ::Lang::ml('contentflag.viewingconcepts.by' . $markedby);
-    }
-
-    return '' unless $msg;
-
-    my $fake_cut = qq {<b>( <a href="$url">$msg</a> )</b>};
-    return $fake_cut;
-}
-
-sub check_adult_cookie {
-    my ($class, $returl, $postref, $type) = @_;
-
-    my $cookiename = __PACKAGE__->cookie_name($type);
-    return undef unless $cookiename;
-
-    my $has_seen = $BML::COOKIE{$cookiename};
-    my $adult_check = $postref->{adult_check};
-
-    BML::set_cookie($cookiename => '1', 0) if $adult_check;
-    return ($has_seen || $adult_check) ? $returl : undef;
-}
-
-sub cookie_name {
-    my ($class, $type) = @_;
-
-    return "" unless $type eq "concepts" || $type eq "explicit";
-    return "adult_$type";
-}
-
-sub interstitial_reason {
-    my ( $journal, $entry ) = @_;
-    my $poster = defined( $entry ) ? $entry->poster : $journal;
-    my $ret = "";
-    my $reason_exists = 0;
-
-    if ($journal->adult_content ne 'none' && $journal->adult_content_reason) {
-        my $what = $journal->is_community ? 'community' : 'journal';
-        my $reason = LJ::ehtml($journal->adult_content_reason);
-
-        if ($journal->adult_content_calculated eq 'concepts') {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.concepts.' . $what . 'reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        } else {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.explicit.' . $what . 'reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        }
-
-        $reason_exists = 1;
-    }
-
-    if (defined($entry) && $entry->adult_content && $entry->adult_content ne 'none' && $entry->adult_content_reason) {
-        $ret .= "<br/>" if ($reason_exists);
-        my $reason = LJ::ehtml($entry->adult_content_reason);
-
-        if ($entry->adult_content eq 'concepts') {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.concepts.byposter.reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        } else {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.explicit.byposter.reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        }
-        $reason_exists = 1;
-    }
-
-    if (defined($entry) && $entry->adult_content_maintainer && $entry->adult_content_maintainer ne 'none' && $entry->adult_content_maintainer_reason) {
-        $ret .= "<br/>" if ($reason_exists);
-        my $reason = LJ::ehtml($entry->adult_content_maintainer_reason);
-
-        if ($entry->adult_content_maintainer eq 'concepts') {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.concepts.byjournal.reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        } else {
-            $ret .= LJ::Lang::ml('/misc/adult_content.bml.message.explicit.byjournal.reason',{'journal' => $journal->ljuser_display, 'poster' => $poster->ljuser_display, 'reason' => $reason});
-        }
-        $reason_exists = 1;
-    }
-
-    if ($reason_exists) {
-        $ret = "<tr><td colspan=\"2\">\n$ret\n</td></tr>\n";
-    }
-
-    return $ret;
-}
-
-######## instance methods
-
-sub u { LJ::load_userid($_[0]->journalid) }
-sub flagid { $_[0]->{flagid} }
-sub status { $_[0]->{status} }
-sub catid { $_[0]->{catid} }
-sub modtime { $_[0]->{modtime} }
-sub typeid { $_[0]->{typeid} }
-sub itemid { $_[0]->{itemid} }
-sub count { $_[0]->{_count} }
-sub journalid { $_[0]->{journalid} }
-sub reporter { LJ::load_userid($_[0]->{reporterid}) }
-
-sub set_field {
-    my ($self, $field, $val) = @_;
-    my $dbh = LJ::get_db_writer() or die;
-
-    my $modtime = time();
-
-    $dbh->do("UPDATE content_flag SET $field = ?, modtime = UNIX_TIMESTAMP() WHERE flagid = ?", undef,
-             $val, $self->flagid);
-    die $dbh->errstr if $dbh->err;
-
-    $self->{$field} = $val;
-    $self->{modtime} = $modtime;
-
-    return 1;
-}
-
-sub set_status {
-    my ($self, $status) = @_;
-    return $self->set_field('status', $status);
-}
-
-# returns flagged item (entry, comment, etc...)
-sub item {
-    my ($self, $status) = @_;
-
-    my $typeid = $self->typeid;
-    if ($typeid == LJ::ContentFlag::ENTRY) {
-        return LJ::Entry->new($self->u, ditemid => $self->itemid);
-    } elsif ($typeid == LJ::ContentFlag::COMMENT) {
-        return LJ::Comment->new($self->u, dtalkid => $self->itemid);
-    }
-
-    return undef;
-}
-
-sub url {
-    my $self = shift;
-
-    if ($self->item) {
-        return $self->item->url;
-    } elsif ($self->typeid == LJ::ContentFlag::JOURNAL) {
-        return $self->u->journal_base;
-    } elsif ($self->typeid == LJ::ContentFlag::PROFILE) {
-        return $self->u->profile_url('full' => 1);
-    } else {
-        return undef;
-    }
-
-}
-
-sub summary {
-
-}
-
-sub close { $_[0]->set_status(LJ::ContentFlag::CLOSED) }
-
-sub delete {
-    my ($self) = @_;
-    my $dbh = LJ::get_db_writer() or die;
-
-    $dbh->do("DELETE FROM content_flag WHERE flagid = ?", undef, $self->flagid);
-    die $dbh->errstr if $dbh->err;
-
-    return 1;
-}
-
-
-sub move_to_abuse {
-    my ($class, $action, @flags) = @_;
-
-    return unless $action;
-    return unless @flags;
-
-    my %req;
-    $req{reqtype}      = "email";
-    $req{reqemail}     = $LJ::CONTENTFLAG_EMAIL;
-    $req{no_autoreply} = 1;
-
-    if ($action eq LJ::ContentFlag::FLAG_CHILD_PORN) {
-        $req{spcatid} = $LJ::CONTENTFLAG_PRIORITY;
-    } else {
-        $req{spcatid} = $LJ::CONTENTFLAG_ABUSE;
-    }
-
-    return unless $req{spcatid};
-
-    # take one flag, should be representative of all
-    my $flag = $flags[0];
-    $req{subject} = "$action: " . $flag->u->user;
-
-    $req{body}  = "Username: " . $flag->u->user . "\n";
-    $req{body} .= "URL: " . $flag->url . "\n";
-    $req{body} .= "\n" . "=" x 25 . "\n\n";
-
-    foreach (@flags) {
-        $req{body} .= "Reporter: " . $_->reporter->user;
-        $req{body} .= " (" . $CAT_NAMES{$_->catid} . ")\n";
-    }
-
-    $req{flagid} = $flag->flagid;
-
-    my @errors;
-    # returns support request id
-    return LJ::Support::file_request(\@errors, \%req);
-}
-
-sub set_supportid {
-    my ($class, $flagid, $supportid) = @_;
-
-    return 0 unless $flagid && $supportid;
-
-    my $dbh = LJ::get_db_writer();
-    $dbh->do("UPDATE content_flag SET supportid = ? WHERE flagid = ?", undef, $supportid, $flagid);
-    die $dbh->errstr if $dbh->err;
-
-    return 1;
-}
-
-sub get_admin_flag_from_status {
-    my ($class, $status) = @_;
-
-    my %flags = (
-        E => 'explicit_adult',
-        H => 'hate_speech',
-        I => 'illegal_activity',
-        P => 'child_porn',
-        X => 'self_harm',
-        L => 'sexual_content',
-        R => 'other',
-    );
-
-    return $flags{$status} || undef;
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/Entry.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -1006,18 +1006,10 @@ sub adult_content_reason {
     return $self->prop('adult_content_reason');
 }
 
-# defined by an admin
-sub admin_content_flag {
-    my $self = shift;
-
-    return $self->prop('admin_content_flag');
-}
-
-# uses both poster- and admin-defined props to figure out the adult content level
+# uses both poster- and maintainer-defined props to figure out the adult content level
 sub adult_content_calculated {
     my $self = shift;
 
-    return "explicit" if $self->admin_content_flag eq "explicit_adult";
     return $self->adult_content_maintainer if $self->adult_content_maintainer;
     return $self->adult_content;
 }
@@ -1026,7 +1018,6 @@ sub adult_content_marker {
 sub adult_content_marker {
     my $self = shift;
 
-    return "admin" if $self->admin_content_flag eq "explicit_adult";
     return "community" if $self->adult_content_maintainer;
     return "poster" if $self->adult_content;
     return $self->journal->adult_content_marker;
@@ -1055,16 +1046,12 @@ sub qct_value_for_ads {
 sub qct_value_for_ads {
     my $self = shift;
 
-    return 0 unless LJ::is_enabled("content_flag");
+    return 0 unless LJ::is_enabled( 'adult_content' );
 
     my $adult_content = $self->adult_content_calculated;
-    my $admin_flag = $self->admin_content_flag;
 
     if ($LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{qct_value_for_ads}) {
         return $LJ::CONTENT_FLAGS{$adult_content}->{qct_value_for_ads};
-    }
-    if ($LJ::CONTENT_FLAGS{$admin_flag} && $LJ::CONTENT_FLAGS{$admin_flag}->{qct_value_for_ads}) {
-        return $LJ::CONTENT_FLAGS{$admin_flag}->{qct_value_for_ads};
     }
 
     return 0;
@@ -1075,13 +1062,11 @@ sub should_block_robots {
 
     return 1 if $self->journal->prop('opt_blockrobots');
 
-    return 0 unless LJ::is_enabled("content_flag");
+    return 0 unless LJ::is_enabled( 'adult_content' );
 
     my $adult_content = $self->adult_content_calculated;
-    my $admin_flag = $self->admin_content_flag;
 
     return 1 if $LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{block_robots};
-    return 1 if $LJ::CONTENT_FLAGS{$admin_flag} && $LJ::CONTENT_FLAGS{$admin_flag}->{block_robots};
     return 0;
 }
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/M/ProfilePage.pm
--- a/cgi-bin/LJ/M/ProfilePage.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/M/ProfilePage.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -35,7 +35,7 @@ sub _init {
         my @props = qw(country state city zip renamedto
                        journaltitle journalsubtitle public_key
                        url urlname opt_hidefriendofs dont_load_members
-                       opt_blockrobots adult_content admin_content_flag
+                       opt_blockrobots adult_content
                        opt_showmutualfriends fb_num_pubpics opt_showschools);
         if ($u->is_community) {
             push @props, qw(moderated comm_theme);
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -1860,7 +1860,6 @@ sub Entry
     push @$link_keyseq, 'tell_friend' unless $LJ::DISABLED{'tellafriend'};
     push @$link_keyseq, 'watch_comments' unless $LJ::DISABLED{'esn'};
     push @$link_keyseq, 'unwatch_comments' unless $LJ::DISABLED{'esn'};
-    push @$link_keyseq, 'flag' unless LJ::conf_test($LJ::DISABLED{content_flag});
 
     # Note: nav_prev and nav_next are not included in the keyseq anticipating
     #      that their placement relative to the others will vary depending on
@@ -3655,15 +3654,6 @@ sub _Entry__get_link
                             $ctx->[S2::PROPS]->{"text_entry_next"},
                             LJ::S2::Image("$LJ::IMGPREFIX/btn_next.gif", 22, 20));
     }
-    if ($key eq "flag") {
-        return $null_link unless LJ::is_enabled("content_flag");
-
-        my $entry = LJ::Entry->new($journalu, ditemid => $this->{itemid});
-        return $null_link unless $remote && $remote->can_see_content_flag_button( content => $entry );
-        return LJ::S2::Link(LJ::ContentFlag->adult_flag_url($entry),
-                            $ctx->[S2::PROPS]->{"text_flag"},
-                            LJ::S2::Image("$LJ::IMGPREFIX/button-flag.gif", 22, 20));
-    }
 
     my $etypeid          = 'LJ::Event::JournalNewComment'->etypeid;
     my $newentry_etypeid = 'LJ::Event::JournalNewEntry'->etypeid;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/S2/DayPage.pm
--- a/cgi-bin/LJ/S2/DayPage.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/S2/DayPage.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -155,8 +155,8 @@ sub DayPage
                                              'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0, });
         LJ::expand_embedded($u, $ditemid, $remote, \$text);
 
-        $text = LJ::ContentFlag->transform_post(post => $text, journal => $u,
-                                                remote => $remote, entry => $entry_obj);
+        $text = DW::Logic::AdultContent->transform_post( post => $text, journal => $u,
+                                                         remote => $remote, entry => $entry_obj );
 
         my $nc = "";
         $nc .= "nc=$replycount" if $replycount && $remote && $remote->{'opt_nctalklinks'};
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/S2/FriendsPage.pm
--- a/cgi-bin/LJ/S2/FriendsPage.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/S2/FriendsPage.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -3,7 +3,7 @@
 
 use strict;
 package LJ::S2;
-use Class::Autouse qw/LJ::ContentFlag/;
+use Class::Autouse qw/ DW::Logic::AdultContent /;
 
 sub FriendsPage
 {
@@ -236,8 +236,8 @@ sub FriendsPage
                                              'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0, });
         LJ::expand_embedded($friends{$friendid}, $ditemid, $remote, \$text);
 
-        $text = LJ::ContentFlag->transform_post(post => $text, journal => $friends{$friendid},
-                                                remote => $remote, entry => $entry_obj);
+        $text = DW::Logic::AdultContent->transform_post( post => $text, journal => $friends{$friendid},
+                                                         remote => $remote, entry => $entry_obj );
 
         my $userlite_poster = $get_lite->($posterid);
         my $userlite_journal = $get_lite->($friendid);
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/S2/RecentPage.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -175,8 +175,8 @@ sub RecentPage
                                               'unsuspend_supportid' => $suspend_msg ? $entry_obj->prop("unsuspend_supportid") : 0, });
         LJ::expand_embedded($u, $ditemid, $remote, \$text);
 
-        $text = LJ::ContentFlag->transform_post(post => $text, journal => $u,
-                                                remote => $remote, entry => $entry_obj);
+        $text = DW::Logic::AdultContent->transform_post( post => $text, journal => $u,
+                                                         remote => $remote, entry => $entry_obj );
 
         my @taglist;
         while (my ($kwid, $kw) = each %{$tags->{"$u->{userid} $itemid"} || {}}) {
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Setting/AdultContent.pm
--- a/cgi-bin/LJ/Setting/AdultContent.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/Setting/AdultContent.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -6,7 +6,7 @@ sub should_render {
 sub should_render {
     my ($class, $u) = @_;
 
-    return !LJ::is_enabled("content_flag") || !$u || $u->is_identity ? 0 : 1;
+    return !LJ::is_enabled( 'adult_content' ) || !$u || $u->is_identity ? 0 : 1;
 }
 
 sub helpurl {
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Setting/SafeSearch.pm
--- a/cgi-bin/LJ/Setting/SafeSearch.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/Setting/SafeSearch.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -6,7 +6,7 @@ sub should_render {
 sub should_render {
     my ($class, $u) = @_;
 
-    return !LJ::is_enabled("content_flag") || !LJ::is_enabled("safe_search") || !$u || $u->is_community ? 0 : 1;
+    return !LJ::is_enabled( 'adult_content' ) || !LJ::is_enabled( 'safe_search' ) || !$u || $u->is_community ? 0 : 1;
 }
 
 sub helpurl {
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Setting/ViewingAdultContent.pm
--- a/cgi-bin/LJ/Setting/ViewingAdultContent.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/Setting/ViewingAdultContent.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -6,7 +6,7 @@ sub should_render {
 sub should_render {
     my ($class, $u) = @_;
 
-    return !LJ::is_enabled("content_flag") || !$u || $u->is_community ? 0 : 1;
+    return !LJ::is_enabled( 'adult_content' ) || !$u || $u->is_community ? 0 : 1;
 }
 
 sub helpurl {
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Wed Apr 01 03:50:07 2009 +0000
@@ -59,7 +59,7 @@ use Class::Autouse qw(
 ###  11. Birthdays and Age-Related Functions
 ###  12. Comment-Related Functions
 ###  13. Community-Related Functions and Authas
-###  14. Content Flagging and Adult Content Functions
+###  14. Adult Content Functions
 ###  15. Email-Related Functions
 ###  16. Entry-Related Functions
 ###  17. Interest-Related Functions
@@ -187,7 +187,7 @@ sub create_community {
 
     $u->set_prop("nonmember_posting", $opts{nonmember_posting}+0);
     $u->set_prop("moderated", $opts{moderated}+0);
-    $u->set_prop("adult_content", $opts{journal_adult_settings}) if LJ::is_enabled("content_flag");
+    $u->set_prop("adult_content", $opts{journal_adult_settings}) if LJ::is_enabled( 'adult_content' );
 
     my $remote = LJ::get_remote();
     LJ::set_rel($u, $remote, "A");  # maintainer
@@ -309,7 +309,6 @@ sub delete_and_purge_completely {
         if $u->is_community;
     $dbh->do("DELETE FROM syndicated WHERE userid=?", undef, $u->id)
         if $u->is_syndicated;
-    $dbh->do("DELETE FROM content_flag WHERE journalid=? OR reporterid=?", undef, $u->id, $u->id);
 
     return 1;
 }
@@ -2080,13 +2079,11 @@ sub should_block_robots {
 
     return 1 if $u->prop('opt_blockrobots');
 
-    return 0 unless LJ::is_enabled("content_flag");
+    return 0 unless LJ::is_enabled( 'adult_content' );
 
     my $adult_content = $u->adult_content_calculated;
-    my $admin_flag = $u->admin_content_flag;
 
     return 1 if $LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{block_robots};
-    return 1 if $LJ::CONTENT_FLAGS{$admin_flag} && $LJ::CONTENT_FLAGS{$admin_flag}->{block_robots};
     return 0;
 }
 
@@ -2578,7 +2575,7 @@ sub can_join_adult_comm {
 sub can_join_adult_comm {
     my ($u, %opts) = @_;
 
-    return 1 unless LJ::is_enabled('content_flag');
+    return 1 unless LJ::is_enabled( 'adult_content' );
 
     my $adultref = $opts{adultref};
     my $comm = $opts{comm} or croak "No community passed";
@@ -3210,9 +3207,7 @@ sub trusts_or_has_member {
 
 
 ########################################################################
-### 14. Content Flagging and Adult Content Functions
-###  FIXME: Determine which are by-user and which are admin flagging
-###  (and remove admin flagging as an option)
+### 14. Adult Content Functions
 
 
 # defined by the user
@@ -3226,20 +3221,11 @@ sub adult_content {
 }
 
 
-# uses both user- and admin-defined props to figure out the adult content level
+# uses user-defined prop to figure out the adult content level
 sub adult_content_calculated {
     my $u = shift;
 
-    return "explicit" if $u->admin_content_flag eq "explicit_adult";
     return $u->adult_content;
-}
-
-
-# defined by an admin
-sub admin_content_flag {
-    my $u = shift;
-
-    return $u->prop('admin_content_flag');
 }
 
 
@@ -3247,7 +3233,6 @@ sub adult_content_marker {
 sub adult_content_marker {
     my $u = shift;
 
-    return "admin" if $u->admin_content_flag eq "explicit_adult";
     return "journal";
 }
 
@@ -3257,51 +3242,6 @@ sub adult_content_reason {
     my $u = shift;
 
     return $u->prop('adult_content_reason');
-}
-
-
-sub can_admin_content_flagging {
-    my $u = shift;
-
-    return 0 unless LJ::is_enabled("content_flag");
-    return 1 if $LJ::IS_DEV_SERVER;
-    return LJ::check_priv($u, "siteadmin", "contentflag");
-}
-
-
-sub can_flag_content {
-    my $u = shift;
-    my %opts = @_;
-
-    return 0 unless $u->can_see_content_flag_button(%opts);
-    return 0 if LJ::sysban_check("contentflag", $u->user);
-    return 0 unless $u->rate_check("ctflag", 1);
-    return 1;
-}
-
-
-sub can_see_content_flag_button {
-    my $u = shift;
-    my %opts = @_;
-
-    return 0 unless LJ::is_enabled("content_flag");
-
-    my $content = $opts{content};
-
-    # user can't flag any journal they manage nor any entry they posted
-    # user also can't flag non-public entries
-    if (LJ::isu($content)) {
-        return 0 if $u->can_manage($content);
-    } elsif ($content->isa("LJ::Entry")) {
-        return 0 if $u->equals($content->poster);
-        return 0 unless $content->security eq "public";
-    }
-
-    # user can't flag anything if their account isn't at least one month old
-    my $one_month = 60*60*24*30;
-    return 0 unless time() - $u->timecreate >= $one_month;
-
-    return 1;
 }
 
 
@@ -3346,24 +3286,21 @@ sub should_show_in_search_results {
     my $u = shift;
     my %opts = @_;
 
-    return 1 unless LJ::is_enabled("content_flag") && LJ::is_enabled("safe_search");
+    return 1 unless LJ::is_enabled( 'adult_content' ) && LJ::is_enabled( 'safe_search' );
 
     my $adult_content = $u->adult_content_calculated;
-    my $admin_flag = $u->admin_content_flag;
 
     my $for_u = $opts{for};
     unless (LJ::isu($for_u)) {
-        return $adult_content ne "none" || $admin_flag ? 0 : 1;
+        return $adult_content eq "none" ? 1 : 0;
     }
 
     my $safe_search = $for_u->safe_search;
     return 1 if $safe_search == 0;
 
     my $adult_content_flag_level = $LJ::CONTENT_FLAGS{$adult_content} ? $LJ::CONTENT_FLAGS{$adult_content}->{safe_search_level} : 0;
-    my $admin_flag_level = $LJ::CONTENT_FLAGS{$admin_flag} ? $LJ::CONTENT_FLAGS{$admin_flag}->{safe_search_level} : 0;
 
     return 0 if $adult_content_flag_level && ($safe_search >= $adult_content_flag_level);
-    return 0 if $admin_flag_level && ($safe_search >= $admin_flag_level);
     return 1;
 }
 
@@ -5221,16 +5158,12 @@ sub qct_value_for_ads {
 sub qct_value_for_ads {
     my $u = shift;
 
-    return 0 unless LJ::is_enabled("content_flag");
+    return 0 unless LJ::is_enabled( 'adult_content' );
 
     my $adult_content = $u->adult_content_calculated;
-    my $admin_flag = $u->admin_content_flag;
 
     if ($LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{qct_value_for_ads}) {
         return $LJ::CONTENT_FLAGS{$adult_content}->{qct_value_for_ads};
-    }
-    if ($LJ::CONTENT_FLAGS{$admin_flag} && $LJ::CONTENT_FLAGS{$admin_flag}->{qct_value_for_ads}) {
-        return $LJ::CONTENT_FLAGS{$admin_flag}->{qct_value_for_ads};
     }
 
     return 0;
@@ -8322,7 +8255,7 @@ sub make_journal
     my @needed_props = ("stylesys", "s2_style", "url", "urlname", "opt_nctalklinks",
                         "renamedto",  "opt_blockrobots", "opt_usesharedpic", "icbm",
                         "journaltitle", "journalsubtitle", "external_foaf_url",
-                        "adult_content", "admin_content_flag");
+                        "adult_content");
 
     # S2 is more fully featured than S1, so sometimes we get here and $eff_view
     # is reply/month/entry/res and that means it *has* to be S2--S1 defaults to a
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Widget/ContentFlagReport.pm
--- a/cgi-bin/LJ/Widget/ContentFlagReport.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +0,0 @@
-package LJ::Widget::ContentFlagReport;
-
-use strict;
-use base qw(LJ::Widget);
-use Carp qw(croak);
-use LJ::ContentFlag;
-
-sub need_res { qw( stc/widgets/contentflagreport.css ) }
-
-sub render_body {
-    my $class = shift;
-    my %opts = @_;
-    my $ret;
-
-    my $remote = LJ::get_remote() or die "<?needlogin?>";
-
-    if ($opts{flag}) {
-        my $url = $opts{flag}->url;
-
-        my $itemtype = $opts{itemid} ? "entry" : "journal";
-        my $return_text = $itemtype eq "entry" ? $class->ml('widget.contentflagreport.btn.returnentry') : $class->ml('widget.contentflagreport.btn.returnjournal');
-
-        $ret .= "<p>" . $class->ml('widget.contentflagreport.done') . "</p>";
-        $ret .= "<ul><li><a href='$url'>$return_text</a></li>";
-        $ret .= "<li><a href='$LJ::SITEROOT/explore/'>" . $class->ml('widget.contentflagreport.explore', { sitenameabbrev => $LJ::SITENAMEABBREV }) . "</a></li></ul>";
-
-        return $ret;
-    } else {
-        my $ditemid = $opts{itemid};
-        my $user = $opts{user};
-        my $journal = LJ::load_user($user) or return $class->ml('widget.contentflagreport.error.invalidusername');
-
-        my $url = $journal->journal_base;
-        if ($ditemid) {
-            my $entry = LJ::Entry->new($journal, ditemid => $ditemid);
-            return $class->ml('widget.contentflagreport.error.invalidentry') unless $entry && $entry->valid;
-            $url = $entry->url;
-        }
-
-        my $itemtype = $ditemid ? "entry" : "journal";
-        my $btn_text = $itemtype eq "entry" ? $class->ml('widget.contentflagreport.btn.returnentry') : $class->ml('widget.contentflagreport.btn.returnjournal');
-
-        if ($opts{confirm}) {
-            my $back_url = $itemtype eq "entry" ? "$LJ::SITEROOT/tools/content_flag.bml?user=$user&itemid=$ditemid" : "$LJ::SITEROOT/tools/content_flag.bml?user=$user";
-
-            $ret .= $class->ml('widget.contentflagreport.confirm', { aopts => "href='$back_url'" });
-
-            $ret .= $class->start_form;
-            $ret .= $class->html_hidden( user => $user, itemid => $ditemid );
-            $ret .= "<p>" . $class->html_submit($class->ml('widget.contentflagreport.btn.submit')) . " <a href='$url'>$btn_text</a></p>";
-            $ret .= $class->end_form;
-        } else {
-            my $spam_url = $itemtype eq "entry" ? "$LJ::SITEROOT/tools/content_flag_spam.bml?user=$user&itemid=$ditemid" : "$LJ::SITEROOT/tools/content_flag_spam.bml?user=$user";
-            my $confirm_url = $itemtype eq "entry" ? "$LJ::SITEROOT/tools/content_flag.bml?user=$user&itemid=$ditemid&confirm=1" : "$LJ::SITEROOT/tools/content_flag.bml?user=$user&confirm=1";
-
-            $ret .= "<p>" . $class->ml('widget.contentflagreport.note') . "</p>";
-            $ret .= $class->ml('widget.contentflagreport.description', {
-                sitename => $LJ::SITENAMESHORT,
-                spamaopts => "href='$spam_url'",
-                confirmaopts => "href='$confirm_url'",
-            });
-
-            $ret .= $class->start_form;
-            $ret .= $class->html_hidden( url => $url );
-            $ret .= "<p>" . $class->html_submit( return => $btn_text ) . "</p>";
-            $ret .= $class->end_form;
-        }
-    }
-
-    return $ret;
-}
-
-sub handle_post {
-    my ($class, $post, %opts) = @_;
-
-    my $remote = LJ::get_remote() or die "<?needlogin?>";
-
-    if ($post->{return}) {
-        my $url = LJ::CleanHTML::canonical_url($post->{url});
-
-        die $class->ml('widget.contentflagreport.error.invalidurl') unless $url;
-        return BML::redirect($url);
-    }
-
-    my $journal = LJ::load_user($post->{user}) or die $class->ml('widget.contentflagreport.error.invalidusername');
-    my %params = (
-        catid => LJ::ContentFlag::EXPLICIT_ADULT_CONTENT,
-        journal => $journal,
-        itemid => $post->{itemid},
-        type => $post->{itemid} ? LJ::ContentFlag::ENTRY : LJ::ContentFlag::JOURNAL,
-    );
-
-    my $cats_to_spamreports = LJ::ContentFlag->categories_to_spamreports;
-    foreach my $cat (@$cats_to_spamreports) {
-        if ($cat eq $params{catid}) {
-            if ($params{itemid}) { # entry
-                return BML::redirect("$LJ::SITEROOT/tools/content_flag_spam.bml?user=$post->{user}&itemid=$params{itemid}");
-            } else { # journal
-                return BML::redirect("$LJ::SITEROOT/tools/content_flag_spam.bml?user=$post->{user}");
-            }
-        }
-    }
-
-    # create flag
-    $params{flag} = LJ::ContentFlag->flag(%params, reporter => $remote);
-
-    my $cats_to_abuse = LJ::ContentFlag->categories_to_abuse;
-    foreach my $cat (keys %$cats_to_abuse) {
-        if ($cat eq $params{catid}) {
-            if ($params{itemid}) {
-                my $entry = LJ::Entry->new($journal, ditemid => $params{itemid});
-                return $class->ml('widget.contentflagreport.error.invalidentry') unless $entry && $entry->valid;
-                $journal = $entry->poster;
-            }
-            return BML::redirect("$LJ::SITEROOT/abuse/report.bml?flagid=" . $params{flag}->flagid . "&stage=$cats_to_abuse->{$cat}");
-        }
-    }
-
-    return %params;
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Widget/ContentFlagSummary.pm
--- a/cgi-bin/LJ/Widget/ContentFlagSummary.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,386 +0,0 @@
-package LJ::Widget::ContentFlagSummary;
-
-use strict;
-use base qw(LJ::Widget);
-use Carp qw(croak);
-use LJ::ContentFlag;
-
-sub need_res {
-    return qw(
-              js/ippu.js
-              js/lj_ippu.js
-              js/httpreq.js
-              stc/contentflag.css
-              js/ljwidget_ippu.js
-              js/widget_ippu/contentflagreporters.js
-              js/widget_ippu/entrysummary.js
-              );
-}
-
-sub ajax { 1 }
-
-sub should_render {
-    my $remote = LJ::get_remote();
-    return $remote && $remote->can_admin_content_flagging ? 1 : 0;
-}
-
-
-my %catnames    = (%LJ::ContentFlag::CAT_NAMES);
-my %statusnames = (%LJ::ContentFlag::STATUS_NAMES);
-
-my @actions = (
-               LJ::ContentFlag::NEW             => 'New',
-               LJ::ContentFlag::CLOSED          => 'Bogus Report (No Action)',
-               '', '',
-               LJ::ContentFlag::FLAG_EXPLICIT_ADULT => 'Flag > 18 and Over Only',
-               LJ::ContentFlag::FLAG_HATRED         => 'Flag > Hate Speech',
-               LJ::ContentFlag::FLAG_ILLEGAL        => 'Flag > Illegal Activity',
-               LJ::ContentFlag::FLAG_CHILD_PORN     => 'Flag > Nude Images of Minors',
-               LJ::ContentFlag::FLAG_SELF_HARM      => 'Flag > Self Harm',
-               LJ::ContentFlag::FLAG_SEXUAL         => 'Flag > Sexual Content',
-               LJ::ContentFlag::FLAG_OTHER          => 'Flag > Other',
-               );
-
-my %fieldnames = (
-                  instime    => 'Reported',
-                  journalid  => 'Reported User',
-                  catid      => 'Most Frequent Type',
-                  reporterid => 'Reporters',
-                  status     => 'Status',
-                  modtime    => 'Touched Time',
-                  itemid     => 'Report Type',
-                  action     => 'Resolve',
-                  open_request => 'Open Abuse Request?',
-                  _count     => 'Freq',
-                  );
-
-my %sortopts = (
-                count   => "Frequency",
-                instime => "Time",
-                );
-
-# creates the form that allows the user to filter to various states
-sub filter_switcher {
-    my $class = shift;
-    my %opts = @_;
-
-    my $ret;
-    $ret .= '<p><form action="">';
-    $ret .= "<b>Type</b>: ";
-    $ret .= LJ::html_select({ name => 'catid', selected => $opts{catid} },
-                            ( "" => "All Types", %catnames));
-
-    $ret .= " <b>Status</b>: ";
-    $ret .= LJ::html_select({ name => 'status', selected => $opts{status} }, %statusnames);
-
-    $ret .= " <b>Sort by</b>: ";
-    $ret .= LJ::html_select({ name => 'sort', selected => $opts{sort} }, %sortopts);
-
-    $ret .= LJ::html_submit();
-
-    my $num = LJ::ContentFlag->locked_flags;
-    $ret .= " <small>($num reports locked)</small>";
-    $ret .= '</form></p>';
-
-    return $ret;
-};
-
-sub render_body {
-    my $class = shift;
-    my %opts = @_;
-
-    my $ret = $class->filter_switcher(%opts);
-
-    my $sort = $opts{sort} || 'count';
-    $sort =~ s/\W//g;
-    my @flags = LJ::ContentFlag->load(status => $opts{status}, catid => $opts{catid}, group => 1, sort => $sort, lock => 1, limit => 25);
-
-    unless (@flags) {
-        $ret .= "<?standout No matches! :) standout?>";
-        return $ret;
-    }
-
-    $ret .= $class->start_form;
-    $ret .= "<div>";
-    $ret .= $class->html_hidden('status' => $opts{status}, catid => $opts{catid});
-
-    # format fields for display
-    my $remote = LJ::get_remote();
-    my %fields = (
-                  instime => sub {
-                      LJ::ago_text(time() - shift());
-                    },
-                  modtime => sub {
-                      my $time = shift;
-                      return $time ? LJ::ago_text(time() - $time) : "Never";
-                    },
-                  journalid => sub {
-                      LJ::ljuser(LJ::load_userid(shift()));
-                    },
-                  itemid => sub {
-                      my ($id, $flag) = @_;
-                      my $typeid = $flag->{typeid};
-
-                      my ($popup, $text, $jsclass);
-
-                      if ($typeid == LJ::ContentFlag::ENTRY) {
-                          my $entry = $flag->item;
-                          return "Deleted" unless $entry && $entry->valid;
-                          $jsclass = "ctflag_item";
-                          $text = "Entry [" . ($entry->subject_text || 'no subject') . "]";
-                          $popup = $entry->visible_to($remote) ? $entry->event_text : "[Private entry]";
-                      }
-
-                      if ($typeid == LJ::ContentFlag::COMMENT) {
-                          my $cmt = $flag->item;
-                          return "Deleted" unless $cmt && $cmt->valid;
-                          $text = "Comment [" . ($cmt->subject_text || 'no subject') . "]";
-                          $popup = $cmt->visible_to($remote) ? $cmt->body_text : "[Private comment]";
-                      }
-
-                      if ($typeid == LJ::ContentFlag::PROFILE) {
-                          $text = "Profile";
-                      }
-
-                      if ($typeid == LJ::ContentFlag::JOURNAL) {
-                          $text = "Journal";
-                      }
-
-                      my $url = $flag->url;
-                      my $journalid = $flag->journalid;
-
-                      return qq {
-                          <div class="standout-border standout-background $jsclass" style="cursor: pointer;"
-                            lj_itemid="$id" lj_journalid="$journalid">
-                                <a href="$url"><img src="$LJ::IMGPREFIX/link.png" /></a>
-                                $text
-                          </div>
-                      };
-                  },
-                  reporterid => sub {
-                      my ($reporter, $flag) = @_;
-
-                      my $journalid = $flag->journalid;
-                      my $typeid = $flag->typeid;
-                      my $itemid = $flag->itemid;
-                      my $catid = $flag->catid;
-
-                      return "<div class='standout-border standout-background ctflag_reporterlist' style='cursor: pointer;' " .
-                          "lj_itemid='$itemid' lj_catid='$catid' lj_journalid='$journalid' lj_typeid='$typeid'>View reporters and requests...</div>";
-                    },
-                  catid => sub {
-                      my ($cat, $flag) = @_;
-
-                      my $journalid = $flag->journalid;
-                      my $typeid = $flag->typeid;
-                      my $itemid = $flag->itemid;
-
-                      my $catid = LJ::ContentFlag->get_most_common_cat_for_flag( journalid => $journalid, typeid => $typeid, itemid => $itemid );
-                      return $catnames{$catid} || "??";
-                    },
-                  status => sub {
-                      my $stat = shift;
-                      return $statusnames{$stat} || "??";
-                    },
-                  action => sub {
-                      my (undef, $flag) = @_;
-                      my $flagid = $flag->flagid;
-                      my $actions = $class->html_select(class => "ctflag_action",
-                                                        name => "action_$flagid",
-                                                        id => "action_$flagid",
-                                                        selected => $flag->status,
-                                                        lj_itemid => $flagid,
-                                                        list => [@actions]);
-                      return $actions;
-                  },
-                  _count => sub {
-                      my (undef, $flag) = @_;
-                      return $flag->count;
-                  },
-                  open_request => sub {
-                      my (undef, $flag) = @_;
-                      my $flagid = $flag->flagid;
-
-                      if (LJ::ContentFlag->requests_exist_for_flag($flag)) {
-                          return "<em>(one or more requests exist)</em>";
-                      } else {
-                          return $class->html_check(
-                              name => "openreq_$flagid",
-                              id => "openreq_$flagid",
-                          );
-                      }
-                  },
-                  );
-
-    my @fields = qw (_count itemid journalid instime reporterid catid);
-    my @cols = (@fields, qw(action open_request));
-    my $fieldheaders = (join '', (map { "<th>$fieldnames{$_}</th>" } @cols));
-
-    $ret .= qq {
-        <table class="alternating-rows ctflag">
-            <tr>
-            $fieldheaders
-            </tr>
-    };
-
-    my $i = 1;
-    foreach my $flag (@flags) {
-        my $n = $i++ % 2 + 1;
-        $ret .= "<tr class='altrow$n'>";
-        foreach my $field (@cols) {
-            my $field_val = (grep { $_ eq $field } @fields) ? $flag->{$field} : '';
-            $ret .= "<td>" . $fields{$field}->($field_val, $flag) . '</td>';
-        }
-        $ret .= '</tr>';
-    }
-
-    $ret .= '</table>';
-    $ret .= '</div>';
-
-    $ret .= $class->html_hidden('flagids', join(',', map { $_->flagid } @flags));
-    $ret .= $class->html_hidden('mode', 'admin');
-    $ret .= '<?standout ' . $class->html_submit('Submit Resolutions') . ' standout?>';
-    $ret .= $class->end_form;
-
-    return $ret;
-}
-
-sub handle_post {
-    my ($class, $post, %opts) = @_;
-
-    die "This feature is disabled"
-        if LJ::conf_test($LJ::DISABLED{content_flag});
-
-    my $remote = LJ::get_remote()
-        or die "You must be logged in to use this";
-
-    my $getopt = sub {
-        my $field = shift;
-        my $val = $post->{$field} or die "Required field $field missing";
-        return $val;
-    };
-
-    my $mode = $getopt->('mode');
-    die "Unknown mode: $mode"
-        unless $mode eq 'flag' || $mode eq 'admin';
-
-    my $success = 0;
-    my %ret = ();
-
-    if ($mode eq 'flag') {
-        my @fields = qw (itemid type cat journalid);
-        my %opts;
-        foreach my $field (@fields) {
-            my $val = $getopt->($field);
-        }
-
-        $opts{reporter} = $remote;
-        my $flag = LJ::ContentFlag->create(%opts);
-
-        $success = $flag ? 1 : 0;
-    } elsif ($mode eq 'admin') {
-        die "You are not authorized to do this"
-            unless $remote->can_admin_content_flagging;
-
-        my $flagids = $getopt->('flagids');
-        my @flagids = split(',', $flagids);
-
-        foreach my $flagid (@flagids) {
-            die "invalid flagid" unless $flagid+0;
-
-            my $action = $post->{"action_$flagid"} or next;
-
-            my ($flag) = LJ::ContentFlag->load_by_flagid($flagid)
-                or die "Could not load flag $flagid";
-
-            # get the other flags for this item
-            my @flags = $flag->find_similar_flags(catid => $post->{catid}, status => $post->{status});
-
-            # set the status of the flags
-            $_->set_status($action) foreach @flags;
-
-            # mark the journal or entry with the appropriate admin flag (including undef if un-flagging)
-            my $admin_flag = LJ::ContentFlag->get_admin_flag_from_status($action);
-            my $u = LJ::load_userid($flag->journalid);
-            if ($flag->typeid == 3) { # journal
-                $u->set_prop( admin_content_flag => $admin_flag );
-            } elsif ($flag->typeid == 1) { # entry
-                my $entry = LJ::Entry->new($u, ditemid => $flag->itemid);
-                $entry->set_prop( admin_content_flag => $admin_flag );
-            }
-
-            # open an abuse request if the admin requested one
-            if ($post->{"openreq_$flagid"}) {
-                LJ::ContentFlag->move_to_abuse($action, @flags);
-            }
-        }
-
-        LJ::ContentFlag->unlock(@flagids);
-    }
-}
-
-sub js {
-
-    qq[
-
-    initWidget: function () {
-         LiveJournal.addClickHandlerToElementsWithClassName(this.contentFlagItemClicked.bindEventListener(this), "ctflag_item");
-         LiveJournal.addClickHandlerToElementsWithClassName(this.reporterListClicked.bindEventListener(this), "ctflag_reporterlist");
-    },
-    reporterListClicked: function (evt) {
-        var target = evt.target;
-        if (! target) return true;
-        var item = target;
-
-        var itemid = item.getAttribute("lj_itemid");
-        var journalid = item.getAttribute("lj_journalid");
-        var typeid = item.getAttribute("lj_typeid");
-        var catid = item.getAttribute("lj_catid");
-
-        if (! itemid || ! journalid || ! typeid || ! catid) return true;
-
-        var reporterList = new LJWidgetIPPU_ContentFlagReporters({
-          title: "Reporters",
-          nearElement: target
-        }, {
-          journalid: journalid,
-          typeid: typeid,
-          catid : catid,
-          itemid: itemid
-        });
-    },
-    contentFlagItemClicked: function (evt) {
-         var target = evt.target;
-         if (! target) return true;
-
-         if (target.tagName.toLowerCase() == "img") return true; // don't capture events on the link img '
-
-         var item = target;
-         var itemid = item.getAttribute("lj_itemid");
-         var journalid = item.getAttribute("lj_journalid");
-         if (! itemid || ! journalid) return true;
-
-         var reporterList = new LJWidgetIPPU_EntrySummary({
-           title: "Entry Summary",
-           nearElement: target
-           }, {
-             journalid: journalid,
-             ditemid: itemid
-           });
-
-         Event.stop(evt);
-         return false;
-     },
-     onData: function (data) {
-
-     },
-     onError: function (err) {
-
-     },
-     onRefresh: function (data) {
-         this.initWidget();
-     }
-    ];
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Widget/IPPU/ContentFlagReporters.pm
--- a/cgi-bin/LJ/Widget/IPPU/ContentFlagReporters.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-use strict;
-
-package LJ::Widget::IPPU::ContentFlagReporters;
-use base "LJ::Widget::IPPU";
-
-sub render_body {
-    my ($class, %opts) = @_;
-
-    my $remote = LJ::get_remote();
-
-    return "Unauthorized" unless $remote && $remote->can_admin_content_flagging;
-    return "invalid params" unless $opts{journalid} && $opts{typeid} && $opts{catid};
-
-    my $ret = '';
-
-    my @reporters = LJ::ContentFlag->get_reporters(journalid => $opts{journalid},
-                                                   typeid    => $opts{typeid},
-                                                   itemid    => $opts{itemid});
-    my $usernames = '';
-
-    my @userids = map { $_->{reporterid} } @reporters;
-    my $users = LJ::load_userids(@userids);
-
-    my %support_requests_for_uid;
-    foreach my $uid (keys %$users) {
-        foreach my $reporter (@reporters) {
-            if ($reporter->{reporterid} eq $uid) {
-                next unless $reporter->{supportid};
-                push @{$support_requests_for_uid{$uid}}, $reporter->{supportid};
-            }
-        }
-    }
-
-    $ret .= $class->start_form(id => 'banreporters_form');
-    $ret .= $class->html_hidden("journalids", join(',', keys %$users));
-
-    $usernames .= '<table class="alternating-rows" width="100%">';
-    $usernames .= "<tr><th>Ban?</th><th>User</th><th>Name</th><th>Requests</th></tr>";
-
-    my $i = 0;
-    foreach my $u (values %$users) {
-        my $row = $i++ % 2 == 0 ? 1 : 2;
-
-        $usernames .= "<tr class='altrow$row'>";
-        $usernames .= '<td>' . $class->html_check(name => "ban_" . $u->id) . '</td>';
-        $usernames .= '<td>' . $u->ljuser_display . '</td>';
-        $usernames .= '<td>' . $u->name_html . '</td>';
-        if ($support_requests_for_uid{$u->id}) {
-            $usernames .= "<td>";
-            foreach my $spid (@{$support_requests_for_uid{$u->id}}) {
-                $usernames .= "<a href='$LJ::SITEROOT/support/see_request.bml?id=$spid'>$spid</a> ";
-            }
-            $usernames .= "</td>";
-        } else {
-            $usernames .= "<td>(no request)</td>";
-        }
-    }
-
-    $usernames .= '</table>';
-
-    $ret .= qq {
-        <div class="su_username_list" style="overflow-y: scroll; max-height: 20em; margin: 4px; border: 1px solid #EEEEEE;">
-            $usernames
-        </div>
-    };
-
-    $ret .= '<p>' . $class->html_check(name => "ban", id => 'banreporters', label => 'Ban selected users') . '</p>';
-
-    $ret .= '<input type="button" name="doban" value="Ban" disabled="1" id="banreporters_do" />';
-    $ret .= '<input type="button" name="cancel" value="Cancel" id="banreporters_cancel" />';
-
-    $ret .= $class->end_form;
-
-    return $ret;
-}
-
-sub handle_post {
-    my ($class, $post) = @_;
-
-    my $remote = LJ::get_remote();
-    die "Unauthorized" unless $remote && $remote->can_admin_content_flagging;
-
-    return unless $post->{ban};
-
-    my $journalids = $post->{journalids} or return;
-    my @jids = split(',', $journalids) or return;
-
-    my @to_ban;
-
-    foreach my $journalid (@jids) {
-        next unless $post->{"ban_$journalid"};
-        push @to_ban, $journalid;
-    }
-
-    my $to_ban_users = LJ::load_userids(@to_ban);
-    my @banned;
-
-    foreach my $u (values %$to_ban_users) {
-        push @banned, $u;
-        LJ::sysban_create(
-                          'what'    => "contentflag",
-                          'value'   => $u->user,
-                          'bandays' => $LJ::CONTENT_FLAG_BAN_LENGTH || 7,
-                          'note'    => "contentflag ban by " . $remote->user,
-                          );
-    }
-
-    return (banned => [map { $_->user } @banned]);
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/LJ/Widget/IPPU/EntrySummary.pm
--- a/cgi-bin/LJ/Widget/IPPU/EntrySummary.pm	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-use strict;
-
-package LJ::Widget::IPPU::EntrySummary;
-use base "LJ::Widget::IPPU";
-
-sub render_body {
-    my ($class, %opts) = @_;
-
-    my $remote = LJ::get_remote();
-
-    my $u = LJ::load_userid($opts{journalid});
-    my $ditemid = $opts{ditemid};
-    my $jitemid = $opts{jitemid};
-
-    return "No entry specified" unless $u && ($ditemid xor $jitemid);
-
-    my $entry = LJ::Entry->new($u, jitemid => $jitemid, ditemid => $ditemid);
-
-    return "Invalid entry" unless $entry->valid;
-    return "You do not have permission to view this entry" unless $entry->visible_to($remote);
-
-    my $poster = $entry->poster;
-    my $ljuser = $poster->ljuser_display;
-    my $name = $poster->name_html;
-
-    my $journaltext = ! LJ::u_equals($poster, $entry->journal) ? " in " . $entry->journal->ljuser_display : '';
-
-    my $time = LJ::ago_text(time() - $entry->logtime_unix);
-    my $entrytext = LJ::ehtml($entry->event_text);
-    my $subject = $entry->subject_html;
-
-    my $ret = qq {
-        <div style="width: 95%; margin-left: auto; margin-right: auto; padding: 3px;">
-          <div style="font-weight: bold; font-size: 1.1em;">$subject</div>
-          <div style="margin: 3px;">$ljuser ($name)$journaltext @ $time</div>
-          <div>
-            <textarea readOnly="true" style="width: 95%; height: 10em; margin-left: auto; margin-right: auto;">$entrytext</textarea>
-          </div>
-          <div style="padding: 5px;">
-            <input type="button" id="entrysummary_cancel" value="Close" />
-          </div>
-        </div>
-    };
-
-    return $ret;
-}
-
-1;
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/imageconf.pl
--- a/cgi-bin/imageconf.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/imageconf.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -138,13 +138,6 @@ use vars qw(%img);
     'alt' => 'img.track_thread_active',
 };
 
-$img{'flag'} = {
-    'src' => '/button-flag.gif',
-    'width' => 22,
-    'height' => 20,
-    'alt' => 'img.flag_btn',
-};
-
 $img{'editcomment'} = {
     'src' => '/btn_edit.gif',
     'width' => 22,
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/supportlib.pl
--- a/cgi-bin/supportlib.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/supportlib.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -599,12 +599,6 @@ sub file_request
     $dbh->do("INSERT INTO supportlog (splid, spid, timelogged, type, faqid, userid, message) ".
              "VALUES (NULL, $spid, UNIX_TIMESTAMP(), 'req', 0, $qrequserid, $qbody)");
 
-    # set the flag on the support request and the support request on the flag
-    if ($o->{flagid}) {
-        LJ::Support::set_prop($spid, "contentflagid", $o->{flagid});
-        LJ::ContentFlag->set_supportid($o->{flagid}, $spid);
-    }
-
     my $body;
     my $miniauth = mini_auth({ 'authcode' => $authcode });
     $url = "$LJ::SITEROOT/support/see_request.bml?id=$spid";
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/talklib.pl
--- a/cgi-bin/talklib.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/talklib.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -159,11 +159,6 @@ sub link_bar
         my $img_key = $remote->has_subscription(journal => $u, event => "JournalNewComment", arg1 => $itemid, require_active => 1) ?
             "track_active" : "track";
         push @linkele, $mlink->("$LJ::SITEROOT/manage/subscriptions/entry.bml?${jargent}itemid=$itemid", $img_key);
-    }
-
-    if ($remote && $remote->can_see_content_flag_button( content => $entry )) {
-        my $flag_url = LJ::ContentFlag->adult_flag_url($entry);
-        push @linkele, $mlink->($flag_url, 'flag');
     }
 
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/cgi-bin/weblib.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -1498,7 +1498,7 @@ MOODS
             $out .= "<span class='inputgroup-right'>";
 
             # Content Flag
-            if (LJ::is_enabled("content_flag")) {
+            if ( LJ::is_enabled( 'adult_content' ) ) {
                 my @adult_content_menu = (
                     "" => BML::ml('entryform.adultcontent.default'),
                     none => BML::ml('entryform.adultcontent.none'),
@@ -1519,7 +1519,7 @@ MOODS
             $out .= "</span>\n";
             $out .= "</p>\n";
 
-            if (LJ::is_enabled("content_flag")) {
+            if ( LJ::is_enabled( 'adult_content' ) ) {
                  $out .= "<p class='pkg'>";
                  $out .= "<label for='prop_adult_content_reason' class='left options'>" . BML::ml('entryform.adultcontentreason') . "</label>";
                  $out .= LJ::html_text(
@@ -1578,7 +1578,7 @@ PREVIEW
         $out .= "<em>" . BML::ml('entryform.maintainer') . "</em>\n";
         $out .= "</p>\n";
 
-        if (LJ::is_enabled("content_flag")) {
+        if ( LJ::is_enabled( 'adult_content' ) ) {
             $out .= "<p class='pkg'>\n";
             my %poster_adult_content_menu = (
                 "" => BML::ml('entryform.adultcontent.default'),
@@ -1927,7 +1927,7 @@ sub entry_form_decode
     $req->{"prop_opt_noemail"}      ||= $POST->{'comment_settings'} eq "noemail" ? 1 : 0;
     $req->{'prop_opt_backdated'}      = $POST->{'prop_opt_backdated'} ? 1 : 0;
 
-    if (LJ::is_enabled("content_flag")) {
+    if ( LJ::is_enabled( 'adult_content' ) ) {
         $req->{prop_adult_content} = $POST->{prop_adult_content};
         $req->{prop_adult_content} = ""
             unless $req->{prop_adult_content} eq "none" || $req->{prop_adult_content} eq "concepts" || $req->{prop_adult_content} eq "explicit";
diff -r 1138cfcfec8f -r 9fbd871d8aeb etc/config.pl
--- a/etc/config.pl	Wed Apr 01 03:43:15 2009 +0000
+++ b/etc/config.pl	Wed Apr 01 03:50:07 2009 +0000
@@ -179,8 +179,8 @@
     # turns these from 0 to 1 to disable parts of the site that are
     # CPU & database intensive or that you simply don't want to use
     %DISABLED = (
+                 adult_content => 0,
                  blockwatch => 1,
-                 content_flag => 0,
                  'community-logins' => 0,
                  directory => 0,
                  eventlogrecord => 1,
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/admin/contentflag.bml
--- a/htdocs/admin/contentflag.bml	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?page
-title=>Content Flag Admin
-body<=
-<?_code
-{
-    use strict;
-    use vars qw(%GET %POST $ret $headextra @errors @warnings);
-
-    my $remote = LJ::get_remote();
-    return BML::redirect("$LJ::SITEROOT/support/")
-        unless $remote && $remote->can_admin_content_flagging;
-
-    LJ::Widget->handle_post(\%POST, qw(ContentFlagSummary));
-
-    my $widget = LJ::Widget::ContentFlagSummary->new;
-    $headextra .= $widget->wrapped_js;
-
-    my %opts;
-    $opts{status} = $POST{status} || $GET{status} || "N";
-    $opts{catid}  = $POST{catid}  || $GET{catid};
-    $opts{sort}   = $POST{sort}   || $GET{sort}   || "count";
-
-    $ret .= $widget->render(%opts);
-
-    return $ret;
-}
-_code?>
-<=body
-head=><?_code return $headextra; _code?>
-page?>
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/admin/contentflag_home.bml
--- a/htdocs/admin/contentflag_home.bml	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<?page
-body<=
-<?_code
-{
-    use strict;
-    use vars qw(%GET %POST $title $headextra @errors @warnings);
-    use LJ::ContentFlag;
-
-    $title = 'Content Flag Admin Home';
-
-    my $remote = LJ::get_remote();
-    return BML::redirect("$LJ::SITEROOT/support/")
-        unless $remote && $remote->can_admin_content_flagging;
-
-    my %flagcounts = LJ::ContentFlag->flag_count_by_category;
-
-    my $total = 0;
-    $total += $_ foreach values %flagcounts;
-    my $row = 0;
-
-    my $ret = qq {
-        <p><b>View Flaggings:</b></p>
-
-        <table class="alternating-rows">
-          <tr class="altrow1">
-            <td>All Categories</td>
-            <td>$total</td>
-          </tr>
-      };
-
-    while (my ($catid, $count) = each %flagcounts) {
-        my $rowname = ++$row % 2 + 1;
-        my $catname = LJ::ContentFlag->category_names->{$catid};
-
-        $ret .= qq {
-          <tr class="altrow$rowname">
-            <td><a href="$LJ::SITEROOT/admin/contentflag.bml?catid=$catid">$catname</a></td>
-            <td>$count</td>
-          </tr>
-      };
-    }
-
-    $ret .= q {
-        </table>
-        };
-
-    # manual button to clear locked flags in case we want to override the 5-minute lock
-    $ret .= "<form method='post'>";
-    $ret .= LJ::html_submit("Reset Locked Flags?");
-    $ret .= "</form>";
-
-    LJ::MemCache::delete(LJ::ContentFlag->memcache_key) if LJ::did_post();
-
-    return $ret;
-}
-_code?>
-<=body
-title=><?_code return $title; _code?>
-head<=
-<?_code return $headextra; _code?>
-<=head
-page?>
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/admin/entryprops.bml
--- a/htdocs/admin/entryprops.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/admin/entryprops.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -49,8 +49,7 @@ body<=
     $ret .= "(journal wide minsecurity: " . ($entry->journal->prop("newpost_minsecurity") || "public") . ")<br />";
     $ret .= "<strong>User Date/Time</strong>: " . $entry->eventtime_mysql . "<br />";
     $ret .= "<strong>Server Date/Time</strong>: " . $entry->logtime_mysql . "<br />";
-    $ret .= "<strong>Journal Adult Content</strong>: " . ($entry->journal->adult_content || "none")
-        . " (admin setting: " . ($entry->journal->admin_content_flag || "none") . ")<br />";
+    $ret .= "<strong>Journal Adult Content</strong>: " . ( $entry->journal->adult_content || "none" ) . "<br />";
 
     $ret .= "<br />";
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/allpics.bml
--- a/htdocs/allpics.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/allpics.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -19,7 +19,7 @@
         return;
     }
 
-    $u->preload_props("opt_blockrobots", "adult_content", "admin_content_flag") if $u->is_visible;
+    $u->preload_props("opt_blockrobots", "adult_content") if $u->is_visible;
     if (!$u->is_visible || $u->should_block_robots) {
         $head .= LJ::robot_meta_tags();
     }
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/community/create.bml
--- a/htdocs/community/create.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/community/create.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -208,7 +208,7 @@ SUBMIT:
         $ret .= "</div></div></li>";
 
         # adult content options
-        if (LJ::is_enabled("content_flag")) {
+        if ( LJ::is_enabled( 'adult_content' ) ) {
             $ret .= "<li><div class='formitem'><div class='formitemName'>$ML{'/community/settings.bml.label.adultcontentheader'} ";
             $ret .= LJ::help_icon("adult_content_flag");
             $ret .= "</div><div class='formitemDesc'>$ML{'/community/settings.bml.label.adultcontenttext'}</div><div><p>";
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/community/settings.bml
--- a/htdocs/community/settings.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/community/settings.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -146,7 +146,7 @@ body<=
             LJ::set_userprop($cu, 'nonmember_posting', $nonmember_posting);
             LJ::set_userprop($cu, 'moderated', $moderated);
 
-            if (LJ::is_enabled("content_flag")) {
+            if ( LJ::is_enabled( 'adult_content' ) ) {
                 my $adult_content = $POST{'adult_content'};
                 $adult_content eq "none"
                     unless $adult_content eq "explicit" || $adult_content eq "concepts";
@@ -253,7 +253,7 @@ body<=
     $ret .= "</div></fieldset>";
 
     # adult content
-    if (LJ::is_enabled('content_flag')) {
+    if ( LJ::is_enabled( 'adult_content' ) ) {
         my $adult_content = $c ? $c->adult_content : "none";
 
         $ret .= "<fieldset id='adult-content'>";
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/js/widget_ippu/contentflagreporters.js
--- a/htdocs/js/widget_ippu/contentflagreporters.js	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-LJWidgetIPPU_ContentFlagReporters = new Class(LJWidgetIPPU, {
-  init: function (opts, params) {
-    opts.widgetClass = "IPPU::ContentFlagReporters";
-    LJWidgetIPPU_ContentFlagReporters.superClass.init.apply(this, arguments);
-  },
-
-  onRefresh: function () {
-    var banbtn = $('banreporters');
-    if (! banbtn ) return;
-
-    DOM.addEventListener(banbtn, 'click', this.banChecked.bindEventListener(this));
-    DOM.addEventListener($('banreporters_cancel'), 'click', this.cancel.bindEventListener(this));
-    DOM.addEventListener($('banreporters_do'), 'click', this.ban.bindEventListener(this));
-  },
-
-  cancel: function (e) {
-    this.close();
-  },
-
-  ban: function (e) {
-    this.postForm($('banreporters_form'));
-  },
-
-  banChecked: function (e) {
-    $('banreporters_do').disabled = ! $('banreporters').checked;
-  },
-
-  // post finished
-  onData: function (data) {
-    if (! data.res || ! data.res.banned) return;
-    var banned = data.res.banned;
-    
-    LJ_IPPU.showNote("Banned users: " + banned.join(', '));
-    this.close();
-  }
-});
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/js/widget_ippu/entrysummary.js
--- a/htdocs/js/widget_ippu/entrysummary.js	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-LJWidgetIPPU_EntrySummary = new Class(LJWidgetIPPU, {
-  init: function (opts, params) {
-    opts.widgetClass = "IPPU::EntrySummary";
-    LJWidgetIPPU_ContentFlagReporters.superClass.init.apply(this, arguments);
-  },
-
-  onRefresh: function () {
-    var cancelBtn = $('entrysummary_cancel');
-    if (! cancelBtn) return;
-
-    DOM.addEventListener(cancelBtn, 'click', this.cancel.bindEventListener(this));
-  },
-
-  cancel: function (e) {
-    this.close();
-  }
-});
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/misc/adult_concepts.bml
--- a/htdocs/misc/adult_concepts.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/misc/adult_concepts.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -18,7 +18,7 @@ body<=
     return BML::redirect( $returl ) if $remote && $remote->best_guess_age;
 
     if ( $returl ) {
-        my $redir = LJ::ContentFlag->check_adult_cookie( $returl, \%POST, "concepts" );
+        my $redir = DW::Logic::AdultContent->check_adult_cookie( $returl, \%POST, "concepts" );
         return BML::redirect( $redir ) if $redir;
     }
 
@@ -60,7 +60,7 @@ body<=
                 </td>
             </tr>
     };
-    $ret .= LJ::ContentFlag::interstitial_reason( $journal, $entry );
+    $ret .= DW::Logic::AdultContent->interstitial_reason( $journal, $entry );
     $ret .= qq {
         </table>
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/misc/adult_concepts_blocked.bml
--- a/htdocs/misc/adult_concepts_blocked.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/misc/adult_concepts_blocked.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -44,7 +44,7 @@ body<=
                 </td>
             </tr>
     };
-    $ret .= LJ::ContentFlag::interstitial_reason( $journal, $entry );
+    $ret .= DW::Logic::AdultContent->interstitial_reason( $journal, $entry );
     $ret .= qq {
         </table>
     };
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/misc/adult_explicit.bml
--- a/htdocs/misc/adult_explicit.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/misc/adult_explicit.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -18,7 +18,7 @@ body<=
     return BML::redirect($returl) if $remote && $remote->best_guess_age;
 
     if ($returl) {
-        my $redir = LJ::ContentFlag->check_adult_cookie( $returl, \%POST, "explicit" );
+        my $redir = DW::Logic::AdultContent->check_adult_cookie( $returl, \%POST, "explicit" );
         return BML::redirect( $redir ) if $redir;
     }
 
@@ -59,7 +59,7 @@ body<=
                 </td>
             </tr>
     };
-    $ret .= LJ::ContentFlag::interstitial_reason( $journal, $entry );
+    $ret .= DW::Logic::AdultContent->interstitial_reason( $journal, $entry );
     $ret .= qq {
         </table>
 
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/misc/adult_explicit_blocked.bml
--- a/htdocs/misc/adult_explicit_blocked.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/misc/adult_explicit_blocked.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -44,7 +44,7 @@ body<=
                 </td>
             </tr>
     };
-    $ret .= LJ::ContentFlag::interstitial_reason( $journal, $entry );
+    $ret .= DW::Logic::AdultContent->interstitial_reason( $journal, $entry );
     $ret .= qq {
         </table>
     };
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/stc/contentflag.css
--- a/htdocs/stc/contentflag.css	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-.ctflag_popup {
-  max-width: 700px;
-  max-height: 300px;
-  overflow: auto;
-}
-
-.ctflag_item img {
-  border: 0;
-}
-
-table.ctflag {
-  width: 90%;
-  margin: 8px auto 8px auto;
-}
\ No newline at end of file
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/stc/widgets/contentflagreport.css
--- a/htdocs/stc/widgets/contentflagreport.css	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-.note-header {
-    color: #f00;
-    font-weight: bold;
-}
-
-.note-text {
-    font-style: italic;
-}
-
-.confirm-box {
-    background-color: #ededed;
-    padding: 5px;
-}
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/talkpost.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -145,7 +145,7 @@ body<=
     return if LJ::bad_password_redirect();
 
     my @user_props = ("opt_whoscreened");
-    push @user_props, qw( opt_blockrobots adult_content admin_content_flag ) if $u->is_visible;
+    push @user_props, qw( opt_blockrobots adult_content ) if $u->is_visible;
     $u->preload_props(@user_props);
     if (!$u->is_visible || $u->should_block_robots || ($entry && $entry->should_block_robots)) {
         $head = LJ::robot_meta_tags();
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/talkread.bml
--- a/htdocs/talkread.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/talkread.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -111,7 +111,7 @@ my $old_url = 0;
 
     my $entry = LJ::Entry->new($u, ditemid => $ditemid);
 
-    $u->preload_props("opt_blockrobots", "adult_content", "admin_content_flag") if $u->is_visible;
+    $u->preload_props("opt_blockrobots", "adult_content") if $u->is_visible;
     if (!$u->is_visible || $u->should_block_robots || ($entry && $entry->should_block_robots)) {
         $$head .= LJ::robot_meta_tags();
     }
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/tools/content_flag.bml
--- a/htdocs/tools/content_flag.bml	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<?page
-body<=
-<?_code
-{
-    use strict;
-    use vars qw(%GET %POST $title $headextra @errors @warnings);
-
-    $title = $ML{'.title'};
-
-    my $remote = LJ::get_remote()
-        or return "<?needlogin?>";
-
-    return $ML{'.error.disabled'}
-        unless LJ::is_enabled("content_flag");
-
-    my $ditemid = $GET{itemid};
-    my $user = $GET{user};
-    my $journal = LJ::load_user($user) or return $ML{'.error.invalidusername'};
-    my $content = $ditemid ? LJ::Entry->new($journal, ditemid => $ditemid) : $journal;
-
-    return $ML{'.error.cantflag'}
-        unless $remote->can_flag_content( content => $content );
-
-    my %opts = ();
-    return LJ::Widget->handle_post_and_render(\%POST, 'ContentFlagReport',
-                                               user => $user,
-                                               itemid => $ditemid,
-                                               confirm => $GET{confirm} ? 1 : 0,
-                                               %opts);
-}
-_code?>
-<=body
-title=><?_code return $title; _code?>
-head<=
-<?_code return $headextra; _code?>
-<=head
-page?>
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/tools/content_flag_reported.bml
--- a/htdocs/tools/content_flag_reported.bml	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-<?page
-body<=
-<?_code
-{
-    use strict;
-    use vars qw(%GET %POST $title $headextra @errors @warnings);
-
-    $title = 'Your report has been filed';
-
-    my $flag = LJ::ContentFlag->load_by_id($GET{flagid}) or return "Invalid report";
-
-    my $url = $flag->url;
-
-    return qq {
-        <p>Thank you for your report. We will process it as soon as possible and take
-            any appropriate actions, though unfortunately, we can't provide a personal response.</p>
-
-        <p><a href="$url">Return to Journal</a> <a href="$LJ::SITEROOT/site/search.bml">Explore $LJ::SITENAME</a></p>
-    };
-}
-_code?>
-<=body
-title=><?_code return $title; _code?>
-head<=
-<?_code return $headextra; _code?>
-<=head
-page?>
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/tools/content_flag_spam.bml
--- a/htdocs/tools/content_flag_spam.bml	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-<?page
-body<=
-<?_code
-{
-    use strict;
-    use vars qw(%GET %POST $title $headextra @errors @warnings);
-
-    $title = "Reporting Spam";
-
-    my $remote = LJ::get_remote()
-        or return "<?needlogin?>";
-
-    return "Content flagging is disabled"
-        if LJ::conf_test($LJ::DISABLED{content_flag});
-
-    my $ditemid = $GET{itemid};
-    my $user = $GET{user};
-    my $journal = LJ::load_user($user) or return "Invalid username";
-    my $content = $ditemid ? LJ::Entry->new($journal, ditemid => $ditemid) : $journal;
-
-    return "You are not allowed to flag this."
-        unless $remote->can_flag_content( content => $content );
-
-    my $ret;
-
-    if ($ditemid) { # entry
-        if ($journal->is_comm) {
-            if ($remote->can_manage($journal)) {
-                $ret .= BML::ml('.maint_communityspam', { aopts => "href='$LJ::SITEROOT/editjournal.bml?journal=$user&itemid=$ditemid'" });
-            } else {
-                $ret .= $ML{'.nonmaint_communityspam'};
-
-                my $maintainers = LJ::load_rel_user($journal->id, 'A') || [];
-                if (@$maintainers) {
-                    my $maints = LJ::load_userids(@$maintainers);
-                    my @maint_list = sort { $a->user cmp $b->user } values %$maints;
-
-                    $ret .= "<ul>";
-                    foreach my $maintu (@maint_list) {
-                        $ret .= "<li>" . $maintu->ljuser_display . "</li>";
-                    }
-                    $ret .= "</ul>";
-                }
-            }
-        } else {
-            $ret .= $ML{'.entryspam'};
-        }
-    } else { # journal
-        $ret .= $ML{'.journalspam'};
-    }
-
-    my $url = $journal->journal_base;
-    if ($ditemid) {
-        my $entry = LJ::Entry->new($journal, ditemid => $ditemid);
-        return "Invalid entry" unless $entry && $entry->valid;
-        $url = $entry->url;
-    }
-
-    my $itemtype = $ditemid ? 'entry' : 'journal';
-    $ret .= "<p><a href='$url'>Return to " . ucfirst $itemtype . "</a></p>";
-
-    return $ret;
-}
-_code?>
-<=body
-title=><?_code return $title; _code?>
-head<=
-<?_code return $headextra; _code?>
-<=head
-page?>
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/tools/content_flag_spam.bml.text
--- a/htdocs/tools/content_flag_spam.bml.text	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-;; -*- coding: utf-8 -*-
-
-.entryspam=Please report this through the spam reports system.
-
-.journalspam=Please report this through the spam reports system.
-
-.maint_communityspam=To report this entry as spam, go <a [[aopts]]>here</a> and click "Delete and Mark as Spam".
-
-.nonmaint_communityspam=Please report this through the spam reports system.
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/tools/memories.bml
--- a/htdocs/tools/memories.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/tools/memories.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -84,7 +84,7 @@
     return BML::redirect("/tools/memories.bml?user=$u->{'renamedto'}$authasarg");
  }
 
- $u->preload_props("opt_blockrobots", "adult_content", "admin_content_flag") if $u->is_visible;
+ $u->preload_props("opt_blockrobots", "adult_content") if $u->is_visible;
  unless ($u->is_visible && ! $u->should_block_robots) {
      $head = LJ::robot_meta_tags();
  }
diff -r 1138cfcfec8f -r 9fbd871d8aeb htdocs/view/index.bml
--- a/htdocs/view/index.bml	Wed Apr 01 03:43:15 2009 +0000
+++ b/htdocs/view/index.bml	Wed Apr 01 03:50:07 2009 +0000
@@ -78,7 +78,7 @@
         }
     }
 
-    $u->preload_props("opt_blockrobots", "adult_content", "admin_content_flag") if $u->is_visible;
+    $u->preload_props("opt_blockrobots", "adult_content") if $u->is_visible;
     if (!$u->is_visible || $u->should_block_robots) {
         $head .= LJ::robot_meta_tags();
     }
diff -r 1138cfcfec8f -r 9fbd871d8aeb t/content_flag.t
--- a/t/content_flag.t	Wed Apr 01 03:43:15 2009 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-# -*-perl-*-
-
-use strict;
-use Test::More 'no_plan';
-use lib "$ENV{LJHOME}/cgi-bin";
-require 'ljlib.pl';
-use LJ::ContentFlag;
-use LJ::Test;
-
-my $u = temp_user();
-my $u2 = temp_user();
-my $u3 = temp_user();
-my $u4 = temp_user();
-
-my @flags;
-
-my $entry = $u->t_post_fake_entry();
-my $flag = LJ::ContentFlag->flag(item => $entry, reporter => $u2, journal => $u, cat => LJ::ContentFlag::CHILD_PORN);
-ok($flag, "flagged entry");
-push @flags, $flag;
-
-ok($flag->flagid, "got flag id");
-
-is($flag->status, LJ::ContentFlag::NEW, "flag is new");
-is($flag->catid, LJ::ContentFlag::CHILD_PORN, "flag cat");
-is($flag->modtime, undef, "no modtime");
-
-my $time = time();
-$flag->set_status(LJ::ContentFlag::CLOSED);
-is($flag->status, LJ::ContentFlag::CLOSED, "status change");
-ok(($flag->modtime - $time) < 2, "modtime");
-
-my $flagid = $flag->flagid;
-
-my ($dbflag) = LJ::ContentFlag->load_by_flagid($flagid);
-ok($dbflag, "got flag object loading by flagid");
-is_deeply($dbflag, $flag, "loaded same flag from db");
-
-$flag->set_status(LJ::ContentFlag::NEW);
-
-($dbflag) = LJ::ContentFlag->load_by_flagid($flagid, lock => 1);
-ok($dbflag, "load_outstanding");
-
-($dbflag) = LJ::ContentFlag->load_by_flagid($flagid, lock => 1);
-ok(! $dbflag, "didn't get locked flag");
-
-my $flag2 = LJ::ContentFlag->flag(item => $entry, reporter => $u3, journal => $u, cat => LJ::ContentFlag::CHILD_PORN);
-push @flags, LJ::ContentFlag->flag(item => $entry, reporter => $u4, journal => $u, cat => LJ::ContentFlag::CHILD_PORN);
-push @flags, LJ::ContentFlag->flag(item => $entry, reporter => $u3, journal => $u, cat => LJ::ContentFlag::ILLEGAL_CONTENT);
-push @flags, $flag2;
-
-my @flags = LJ::ContentFlag->load_by_journal($u, group => 1);
-is($flags[0]->count, 4, "group by");
-
-$flag2->set_field('instime', 10);
-($dbflag) = LJ::ContentFlag->load_by_flagid($flag2->flagid, from => 10);
-ok(! $dbflag, "time constraint");
-
-($dbflag) = LJ::ContentFlag->load_by_flagid($flag2->flagid, from => 9);
-ok($dbflag, "time constraint");
-
-# test rate limiting
-{
-    push @flags, LJ::ContentFlag->flag(item => $entry, reporter => $u3, journal => $u, cat => LJ::ContentFlag::ILLEGAL_CONTENT);
-    push @flags, LJ::ContentFlag->flag(item => $entry, reporter => $u3, journal => $u, cat => LJ::ContentFlag::ILLEGAL_CONTENT);
-
-    ok($u3->can_flag_content, 'not rate limited');
-    push @flags, LJ::ContentFlag->flag(item => $entry, reporter => $u3, journal => $u, cat => LJ::ContentFlag::ILLEGAL_CONTENT);
-
-    ok(! $u3->can_flag_content, 'rate limited');
-}
-
-END {
-    $_->delete foreach @flags;
-};
--------------------------------------------------------------------------------