kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2011-12-01 05:53 am

[dw-free] better organization of LJ functions

[commit: http://hg.dwscoalition.org/dw-free/rev/1cb6ed2d70b0]

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

Strip trailing whitespace.

Patch by [personal profile] kareila.

Files modified:
  • bin/ljsysban.pl
  • cgi-bin/DW/InviteCodes/Promo.pm
  • cgi-bin/LJ/Console/Command/ChangeJournalType.pm
  • cgi-bin/LJ/S2.pm
  • htdocs/admin/pay/index.bml
  • htdocs/admin/vgifts/inactive.bml
  • htdocs/community/settings.bml
--------------------------------------------------------------------------------
diff -r f70eb003acee -r 1cb6ed2d70b0 bin/ljsysban.pl
--- a/bin/ljsysban.pl	Wed Nov 30 19:51:36 2011 +0800
+++ b/bin/ljsysban.pl	Wed Nov 30 23:53:06 2011 -0600
@@ -42,9 +42,9 @@
                 "             [--what=? --status=? --bandate=datetime --banuntil=datetime\n" .
                 "              --value=? --note=?]\n" .
                 "           }\n\n" .
-                "  --add    <--what=? --value=?\n" . 
+                "  --add    <--what=? --value=?\n" .
                 "             [--status=? --bandate=datetime { --banuntil=datetime | --banlength=duration } --note=?]>\n\n" .
-                "  --modify <--banid=?>\n" . 
+                "  --modify <--banid=?>\n" .
                 "             [--status=? --bandate=datetime { --banuntil=datetime |\n" .
                 "              --banlength=duration } --value=? --note=?]\n\n" .
                 "datetime in format 'YYYY-MM-DD HH:MM:SS', duration in format 'N[dhms]' e.g. '5d' or '3h'.\n\n" .
@@ -109,8 +109,8 @@
     $status = ($status eq 'expired' ? 'expired' : 'active');
 
     $dbh->do("INSERT INTO sysban (status, what, value, note, bandate, banuntil)" .
-             "VALUES (?, ?, ?, ?, " . 
-             ($bandate ? $dbh->quote($bandate) : 'NOW()') . ", " . 
+             "VALUES (?, ?, ?, ?, " .
+             ($bandate ? $dbh->quote($bandate) : 'NOW()') . ", " .
              ($banuntil ? $dbh->quote($banuntil) : 'NULL') . ")",
              undef, $status, $what, $value, $note);
     die $dbh->errstr if $dbh->err;
@@ -141,7 +141,7 @@
 
     # ip/uniq ban and we're going to change the value
     if (($value && $value ne $ban->{'value'}) ||
-        $banuntil && $banuntil ne $ban->{'banuntil'} || 
+        $banuntil && $banuntil ne $ban->{'banuntil'} ||
         ($status && $status ne $ban->{'status'} && $status eq 'expired')) {
 
         LJ::Sysban::ban_undo( $ban->{what}, $value || $ban->{value} );
@@ -155,7 +155,7 @@
 
     # ip/uniq ban and we are going to change the value
     if (($value && $value ne $ban->{'value'}) ||
-        $banuntil && $banuntil ne $ban->{'banuntil'} || 
+        $banuntil && $banuntil ne $ban->{'banuntil'} ||
         ($status && $status ne $ban->{'status'} && $status eq 'active')) {
 
         my $new_value    = $value || $ban->{value};
diff -r f70eb003acee -r 1cb6ed2d70b0 cgi-bin/DW/InviteCodes/Promo.pm
--- a/cgi-bin/DW/InviteCodes/Promo.pm	Wed Nov 30 19:51:36 2011 +0800
+++ b/cgi-bin/DW/InviteCodes/Promo.pm	Wed Nov 30 23:53:06 2011 -0600
@@ -108,9 +108,9 @@
 
 sub usable {
     my ( $self ) = @_;
-        
+
     return 0 unless $self->{active};
-    return 0 unless $self->{current_count} < $self->{max_count}; 
+    return 0 unless $self->{current_count} < $self->{max_count};
 
     # 0 for expiry_date means never expire;
     return 0 if $self->{expiry_date} && time() >= $self->{expiry_date};
diff -r f70eb003acee -r 1cb6ed2d70b0 cgi-bin/LJ/Console/Command/ChangeJournalType.pm
--- a/cgi-bin/LJ/Console/Command/ChangeJournalType.pm	Wed Nov 30 19:51:36 2011 +0800
+++ b/cgi-bin/LJ/Console/Command/ChangeJournalType.pm	Wed Nov 30 23:53:06 2011 -0600
@@ -92,7 +92,7 @@
                                            undef, $u->id);
         if ($count) {
             if ($args[0] eq 'force') {
-                $u->do("UPDATE log2 SET posterid = ? WHERE journalid = ? AND posterid = journalid", undef, $ou->id, $u->id) 
+                $u->do("UPDATE log2 SET posterid = ? WHERE journalid = ? AND posterid = journalid", undef, $ou->id, $u->id)
                     or return $self->error($DBI::errstr);
                 $self->info("$count entries of user '$u->{user}' belong to '$ou->{user}' now");
             } else {
diff -r f70eb003acee -r 1cb6ed2d70b0 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Wed Nov 30 19:51:36 2011 +0800
+++ b/cgi-bin/LJ/S2.pm	Wed Nov 30 23:53:06 2011 -0600
@@ -103,7 +103,7 @@
             '_input_captures' => [],
             '_content' => $opts->{siteviews_extra_content},
         };
-        
+
         $ctx->[S2::SCRATCH]->{siteviews_enabled} = 1;
         $ctx->[S2::PROPS]->{SITEVIEWS} = $siteviews_class;
     } else {
@@ -2056,7 +2056,7 @@
     # their journal.  if either are yes, it needs to be added to comment links
     my %opt_stylemine = $remote && $remote->prop( 'opt_stylemine' ) && $remote->id != $journalid ? ( style => 'mine' ) : ();
     my $style_args = LJ::viewing_style_args( %$get, %opt_stylemine );
-    
+
     #load and prepare subject and text of entry
     my $subject = LJ::CleanHTML::quote_html( $entry_obj->subject_html, $get->{nohtml} );
     my $text = $no_entry_body ? "" : LJ::CleanHTML::quote_html( $entry_obj->event_raw, $get->{nohtml} );
@@ -2082,7 +2082,7 @@
             $cleanhtml_opts->{$k} = $cleanhtml_extra->{$k}
         }
         LJ::CleanHTML::clean_event( \$text, $cleanhtml_opts );
-    
+
         LJ::expand_embedded( $journal, $jitemid, $remote, \$text );
         $text = DW::Logic::AdultContent->transform_post( post => $text, journal => $journal,
                                                          remote => $remote, entry => $entry_obj );
@@ -2852,10 +2852,10 @@
     my $remote = LJ::get_remote();
     return 0 unless $remote;
     return 0 unless defined $LJ::S2::CURR_PAGE;
- 
+
     my $ju = $LJ::S2::CURR_PAGE->{_u};
 
-    # return based on this function 
+    # return based on this function
     return $ju->allow_search_by( $remote );
 }
 
@@ -3995,7 +3995,7 @@
     }
     if ($key eq "edit_tags") {
         my $entry = LJ::Entry->new( $journalu, ditemid => $this->{itemid} );
-        
+
         return $null_link unless $remote && LJ::Tags::can_add_entry_tags( $remote, $entry );
         return LJ::S2::Link("$LJ::SITEROOT/edittags?journal=$journal&amp;itemid=$this->{'itemid'}",
                             $ctx->[S2::PROPS]->{"text_edit_tags"},
@@ -4617,7 +4617,7 @@
 sub Siteviews__set_content {
     my ($ctx, $this, $content, $text) = @_;
     die "Siteviews doesn't work standalone" unless $ctx->[S2::SCRATCH]->{siteviews_enabled};
-    
+
     $this->{_content}->{$content} = $text;
 }
 
diff -r f70eb003acee -r 1cb6ed2d70b0 htdocs/admin/pay/index.bml
--- a/htdocs/admin/pay/index.bml	Wed Nov 30 19:51:36 2011 +0800
+++ b/htdocs/admin/pay/index.bml	Wed Nov 30 23:53:06 2011 -0600
@@ -11,7 +11,7 @@
     my @displayprivs = ( "payments" );
     my $numprivs = @displayprivs;
 
-    return "<?needlogin?>" unless $remote; 
+    return "<?needlogin?>" unless $remote;
     return BML::ml( "admin.noprivserror", { numprivs => $numprivs, needprivs => "<b>" . join(", ", @displayprivs) . "</b>"} )
         unless $remote->has_priv( 'payments' );
 
@@ -35,7 +35,7 @@
                   return BML::redirect( "$LJ::SITEROOT/admin/pay/index?view=$u->{user}" );
               }
               return "Error: " . DW::Pay::error_text() . "\n";
-            } 
+            }
 
             return "invalid type"
                 unless $type =~ /^(?:seed|premium|paid|expire)$/;
@@ -50,7 +50,7 @@
                                            "Admin override: expired account." );
                     return BML::redirect( "$LJ::SITEROOT/admin/pay/index?view=$u->{user}" );
                 }
-                    
+
             } else {
                 my $rv = DW::Pay::add_paid_time( $u, $type, $months, $days );
                 if ( $rv ) {
@@ -139,7 +139,7 @@
         <option value="expire">FORCE EXPIRATION</option>
     </select></td>
 <td align="center">
-        for <input type="text" name="months" maxlength="2" size="3" /> months, 
+        for <input type="text" name="months" maxlength="2" size="3" /> months,
         <input type="text" name="days" maxlength="2" size="3" /> days
 </td>
         <td><input type="checkbox" name="sendemail">Email?</td>
diff -r f70eb003acee -r 1cb6ed2d70b0 htdocs/admin/vgifts/inactive.bml
--- a/htdocs/admin/vgifts/inactive.bml	Wed Nov 30 19:51:36 2011 +0800
+++ b/htdocs/admin/vgifts/inactive.bml	Wed Nov 30 23:53:06 2011 -0600
@@ -13,7 +13,7 @@
 
     # helper routines
 
-    my $error = sub { 
+    my $error = sub {
         $title = $ML{'.error'};
         $body = join '', @_;
         return undef;
@@ -34,7 +34,7 @@
         my ( $name, $ml, $optref ) = @_;
         my %opts = $optref ? %$optref : ();
         my $text = "\n<label for='$name'>$ML{$ml}</label>";
-        $text .= '<br />' and delete $opts{br} if $opts{br}; 
+        $text .= '<br />' and delete $opts{br} if $opts{br};
         $text .= LJ::html_text( { name => $name, id => $name, %opts } );
         return $text;
     };
diff -r f70eb003acee -r 1cb6ed2d70b0 htdocs/community/settings.bml
--- a/htdocs/community/settings.bml	Wed Nov 30 19:51:36 2011 +0800
+++ b/htdocs/community/settings.bml	Wed Nov 30 23:53:06 2011 -0600
@@ -41,7 +41,7 @@
     use strict;
     use vars qw(%GET %POST);
 
-    my $ret; 
+    my $ret;
     my %errors;
 
 
@@ -72,8 +72,8 @@
         my $sth;
         my $cuser = LJ::canonical_username($POST{'cuser'});
         my $cu = LJ::load_user($cuser);
-        
-        
+
+
         $errors{username} = $ML{'.error.notfound'} unless $cu;
 
         $errors{username} = $ML{'.error.samenames'}
@@ -93,10 +93,10 @@
         if ( $mode eq 'create' && !%errors && ( !$remote || !$remote->has_priv( "changejournaltype", "" ) ) ) {
             my $count;
             my $userid=$cu->{'userid'}+0;
-            
+
             my $dbcr = LJ::get_cluster_reader($cu);
             $count = $dbcr->selectrow_array("SELECT COUNT(*) FROM log2 WHERE journalid=$userid AND posterid=journalid");
-            
+
             $errors{'username'} = $ML{'.error.hasentries'} if $count;
         }
 
@@ -207,14 +207,14 @@
     my ($cname, $c);
 
     $cname = $POST{'cuser'}; # if we're falling through with errors when creating
-    
+
     my %info = (
                 'membership'=>$POST{'membership'} || 'open',
                 'postlevel'=>$POST{'postlevel'} || 'members',
                 'nonmember_posting'=>$POST{'nonmember_posting'} || 0,
                 'moderated'=>$POST{'moderated'} || 0,
                 'hide_join_post_link'=>$POST{'showjoinpostlink'} ? 0 : 1,
-                'posting_guidelines_entry'=>$POST{'postingguidelinesentry'} || '',                
+                'posting_guidelines_entry'=>$POST{'postingguidelinesentry'} || '',
                 );
 
     if ($mode eq 'modify') {
@@ -238,7 +238,7 @@
         # get props unless we're reloading the form because of an error
         unless ( LJ::did_post() ) {
             my $dbr = LJ::get_db_reader();
-            ($info{'membership'},$info{'postlevel'}) = 
+            ($info{'membership'},$info{'postlevel'}) =
                 $dbr->selectrow_array("SELECT membership, postlevel FROM community WHERE userid=$c->{'userid'}");
             $c->preload_props( qw/ nonmember_posting moderated hide_join_post_link posting_guidelines_entry / );
             $info{'nonmember_posting'} = $c->{'nonmember_posting'} ? 1 : 0;
@@ -276,13 +276,13 @@
     $ret .= "<fieldset id='membership'>";
     $ret .= "<legend>$ML{'.label.membership'}</legend><div><?p $ML{'.label.whocanjoin'} p?>";
     $ret .= "<p class='input-wrapper'>";
-    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memopen', 
+    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memopen',
                              value => 'open', selected => ($info{membership} eq 'open' ? 1 : 0)});
     $ret .= "<label for='memopen'> $ML{'.label.openmemb'}</label></p><p class='input-wrapper'>";
-    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memmoderated', 
+    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memmoderated',
                              value => 'moderated', selected => ($info{membership} eq 'moderated' ? 1 : 0)});
     $ret .= " <label for='memmoderated'>$ML{'.label.moderatedmemb'}</label></p><p class='input-wrapper'>";
-    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memclosed', 
+    $ret .= LJ::html_check({ type => 'radio', name => 'membership', id => 'memclosed',
                              value => 'closed', selected => ($info{membership} eq 'closed' ? 1 : 0)});
     $ret .= "<label for='memclosed'> $ML{'.label.closedmemb2'}</label></p>";
     $ret .= "</div></fieldset>";
--------------------------------------------------------------------------------