Make sure we init strings before we use them in string operations. Some 
cleanup.

        Patch by kareila. 

diffs (203 lines):

diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/DW/Hooks/NavStrip.pm
--- a/cgi-bin/DW/Hooks/NavStrip.pm      Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/DW/Hooks/NavStrip.pm      Mon Oct 11 21:38:34 2010 +0800
@@ -82,7 +82,8 @@ LJ::Hooks::register_hook( 'control_strip
 
     my $color;
     my %GET = LJ::parse_args( $r->query_string );
-    $color = $GET{style} eq 'mine' && $remote
+    my $style = $GET{style} || '';
+    $color = $style eq 'mine' && $remote
         ? $remote->prop( 'control_strip_color' )
         : $journal->prop( 'control_strip_color' );
     $color = $color || 'dark';
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/DW/Logic/LogItems.pm
--- a/cgi-bin/DW/Logic/LogItems.pm      Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/DW/Logic/LogItems.pm      Mon Oct 11 21:38:34 2010 +0800
@@ -396,9 +396,10 @@ sub recent_items
     my $notafter = $args{notafter} ? $args{notafter} + 0 : 0;
     $notafter ||= $args{friendsview} ? $LJ::EndOfTime - 1 : $LJ::EndOfTime;
 
-    my $skip = $args{'skip'}+0;
-    my $itemshow = $args{'itemshow'}+0;
-    if ($itemshow > $max_hints) { $itemshow = $max_hints; }
+    my $skip = $args{skip} ? $args{skip} + 0 : 0;
+    my $itemshow = $args{itemshow} ? $args{itemshow} + 0 : 0;
+    $itemshow = $max_hints if $itemshow > $max_hints;
+
     my $maxskip = $max_hints - $itemshow;
     if ($skip < 0) { $skip = 0; }
     if ($skip > $maxskip) { $skip = $maxskip; }
@@ -438,7 +439,7 @@ sub recent_items
     }
 
     # if we need to get by tag, get an itemid list now
-    my $jitemidwhere;
+    my $jitemidwhere = '';
     if (ref $args{tagids} eq 'ARRAY' && @{$args{tagids}}) {
         # select jitemids uniquely
         my $in = join(',', map { $_+0 } @{$args{tagids}});
@@ -459,7 +460,7 @@ sub recent_items
     }
 
     # if we need to filter by security, build up the where clause for that too
-    my $securitywhere;
+    my $securitywhere = '';
     if ($args{'security'}) {
         my $security = $args{'security'};
         if ( ( $security eq "public" ) || ( $security eq "private" ) ) {
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm       Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/Entry.pm       Mon Oct 11 21:38:34 2010 +0800
@@ -2226,8 +2226,7 @@ sub currents {
     if ( $props->{"${key}current_mood"} || $props->{"${key}current_moodid"} ) {
         my $moodid = $props->{"${key}current_moodid"};
         my $mood = $props->{"${key}current_mood"};
-        my $moodname;
-        my $moodpic;
+        my ( $moodname, $moodpic ) = ( '', '' );
 
         # favor custom mood over system mood
         if ( my $val = $mood ) {
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm        Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/Poll.pm        Mon Oct 11 21:38:34 2010 +0800
@@ -729,7 +729,8 @@ sub is_closed {
 sub is_closed {
     my $self = shift;
     $self->_load;
-    return $self->{status} eq 'X' ? 1 : 0;
+    my $status = $self->{status} || '';
+    return $status eq 'X' ? 1 : 0;
 }
 
 # return true if remote is also the owner
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm  Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/S2.pm  Mon Oct 11 21:38:34 2010 +0800
@@ -760,7 +760,8 @@ sub s2_context
     # if we are supposed to use modtime checking (i.e. for stylesheets) then go
     # ahead and do that logic now
     if ( $opts{use_modtime} ) {
-        if ( $r->header_in( 'If-Modified-Since' ) eq LJ::time_to_http( 
$modtime )) {
+        my $mod_since = $r->header_in( 'If-Modified-Since' ) || '';
+        if ( $mod_since eq LJ::time_to_http( $modtime ) ) {
             # 304 return; unload non-public layers
             LJ::S2::cleanup_layers(@layers);
             $r->status_line( '304 Not Modified' );
@@ -3504,6 +3505,7 @@ sub Date__date_format
 {
     my ($ctx, $this, $fmt, $as_link) = @_;
     $fmt ||= "short";
+    $as_link ||= "";
     # formatted as link is separate from format as not link
     my $c = \$ctx->[S2::SCRATCH]->{'_code_datefmt'}->{$fmt . $as_link};
     return $$c->($this) if ref $$c eq "CODE";
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/S2/RecentPage.pm
--- a/cgi-bin/LJ/S2/RecentPage.pm       Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/S2/RecentPage.pm       Mon Oct 11 21:38:34 2010 +0800
@@ -109,7 +109,8 @@ sub RecentPage
     if ($skip > $maxskip) { $skip = $maxskip; }
 
     # honor ?style=mine
-    my $mine = $get->{'style'} eq "mine" ? "mine" : "";
+    my $mine = $get->{style} || '';
+    $mine = '' unless $mine eq 'mine';
 
     # do they want to view all entries, regardless of security?
     my $viewall = 0;
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm        Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm        Mon Oct 11 21:38:34 2010 +0800
@@ -76,7 +76,7 @@ sub talkargs {
 sub talkargs {
     my $talkurl = shift;
     my $args = join("&", grep {$_} @_);
-    my $sep;
+    my $sep = '';
     $sep = ($talkurl =~ /\?/ ? "&" : "?") if $args;
     return "$talkurl$sep$args";
 }
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/Widget/JournalTitles.pm
--- a/cgi-bin/LJ/Widget/JournalTitles.pm        Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/Widget/JournalTitles.pm        Mon Oct 11 21:38:34 2010 +0800
@@ -38,12 +38,13 @@ sub render_body {
     $ret .= "<p class='detail'>" . $class->ml('widget.journaltitles.desc') . " 
" . LJ::help_icon('journal_titles') . "</p>";
 
     foreach my $id (qw( journaltitle journalsubtitle friendspagetitle )) {
+        my $eprop = LJ::ehtml( $u->prop( $id ) ) || '';
         $ret .= $class->start_form( id => "${id}_form" );
 
         $ret .= "<p>";
         $ret .= "<label>" . $class->ml("widget.journaltitles.$id") . "</label> 
";
         $ret .= "<span id='${id}_view'>";
-        $ret .= "<strong>" . LJ::ehtml($u->prop($id)) . "</strong> ";
+        $ret .= "<strong>$eprop</strong> ";
         $ret .= "<a href='' class='theme-title-control' id='${id}_edit'>" . 
$class->ml('widget.journaltitles.edit') . "</a>";
         $ret .= "</span>";
 
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/LJ/Widget/ThemeNav.pm
--- a/cgi-bin/LJ/Widget/ThemeNav.pm     Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/LJ/Widget/ThemeNav.pm     Mon Oct 11 21:38:34 2010 +0800
@@ -118,7 +118,8 @@ sub render_body {
     
     $ret .= "<ul class='theme-nav-small nostyle'>";
     $ret .= "<li class='first'><a href='$LJ::SITEROOT/customize/advanced/'>" . 
$class->ml('widget.themenav.developer') . "</a>";
-    $ret .= LJ::Hooks::run_hook('customize_advanced_area_upsell', $u) . 
"</li>"; 
+    my $upsell = LJ::Hooks::run_hook( 'customize_advanced_area_upsell', $u ) 
|| '';
+    $ret .= "$upsell</li>";
     $ret .= "</ul>";
 
     $ret .= "</div>";
diff -r 11ca108e2963 -r 61fef0b4ad3e cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl Mon Oct 11 21:08:07 2010 +0800
+++ b/cgi-bin/weblib.pl Mon Oct 11 21:38:34 2010 +0800
@@ -950,6 +950,7 @@ Takes a list of viewing styles arguments
 
 sub viewing_style_opts {
     my ( %args ) = @_;
+    return {} unless %args;
 
     my $valid_style_args = {
         format => { light => 1 },
diff -r 11ca108e2963 -r 61fef0b4ad3e htdocs/editjournal.bml
--- a/htdocs/editjournal.bml    Mon Oct 11 21:08:07 2010 +0800
+++ b/htdocs/editjournal.bml    Mon Oct 11 21:38:34 2010 +0800
@@ -32,10 +32,6 @@ body<=
     my $mode = $GET{'mode'} || $POST{'mode'} || "init";
     if ($GET{'itemid'} || $POST{'itemid'}) { $mode = "edit"; }
 
-    my $ret;
-    my $getextra;
-    $getextra = "?authas=$GET{'authas'}" if $GET{'authas'};
-
     LJ::need_res( { priority => $LJ::OLD_RES_PRIORITY }, 'stc/entry.css' );
     LJ::need_res( 'js/inputcomplete.js' );
     
@@ -52,7 +48,7 @@ body<=
     undef $usejournal if $usejournal eq $u->{'user'}; # ignore if it's the user
 
     # extra get arguments
-    my $getextra;
+    my $getextra = '';
     $getextra .= "authas=$authas&" if $authas ne $u->{'user'};
     $getextra .= "usejournal=$usejournal&" if $usejournal;
     chop $getextra;
@@ -434,7 +430,7 @@ body<=
             # entry object right now, this is just easier
             $entry->{prop_xpost} = $entry_obj->prop( 'xpost' );
 
-            foreach ( keys %POST ) { $entry->{$_} = %POST->{$_}; }
+            $entry->{$_} = $POST{$_} foreach keys %POST;
             $entry->{'richtext_default'} = $entry->{"prop_used_rte"} ? 1 : 0,
 
             my $onload;
@@ -530,6 +526,8 @@ body<=
         ### display results
         return $entry_chooser->(\%res, show_ad => 1);
     } elsif ($mode eq "init") {
+        my $ret = '';
+
         # no authentication needs to be done on this page, it's just a form 
anyway
 
         $ret .= "<table style='width: 100%;'><tr><td>";
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to