fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-10-21 08:32 am

[dw-free] clean up log messages that appear when global warnings are on

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

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

More cleanup.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/DW/Logic/LogItems.pm
  • cgi-bin/LJ/CleanHTML.pm
  • cgi-bin/LJ/Comment.pm
  • cgi-bin/LJ/Customize.pm
  • cgi-bin/LJ/Entry.pm
  • cgi-bin/LJ/Faq.pm
  • cgi-bin/LJ/Poll.pm
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/EntryPage.pm
  • cgi-bin/LJ/S2/MonthPage.pm
  • cgi-bin/LJ/Talk.pm
  • cgi-bin/LJ/Widget/InboxFolderNav.pm
  • cgi-bin/LJ/Widget/ManageSiteMessages.pm
  • cgi-bin/htmlcontrols.pl
  • cgi-bin/ljcapabilities.pl
  • cgi-bin/weblib.pl
  • htdocs/manage/subscriptions/comments.bml
  • htdocs/manage/subscriptions/entry.bml
--------------------------------------------------------------------------------
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/DW/Logic/LogItems.pm
--- a/cgi-bin/DW/Logic/LogItems.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/DW/Logic/LogItems.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -139,7 +139,7 @@ sub watch_items
         # now push a properly formatted @friends_buffer row
         foreach my $fid (keys %$timeupdate) {
             my $fu = $friends_u{$fid};
-            my $rupdate = $LJ::EndOfTime - $timeupdate->{$fid};
+            my $rupdate = $LJ::EndOfTime - ( $timeupdate->{$fid} || 0 );
             my $clusterid = $fu->{'clusterid'};
             push @friends_buffer, [ $fid, $rupdate, $clusterid, $friends->{$fid}, $fu ];
         }
@@ -147,7 +147,7 @@ sub watch_items
         @friends_buffer =
             sort { $a->[1] <=> $b->[1] }
             grep {
-                $timeupdate->{$_->[0]} >= $lastmax and # reverse index
+                ( $timeupdate->{$_->[0]} || 0 ) >= $lastmax and # reverse index
                 ($events_date
                     ? $times->{created}->{$_->[0]} < $events_date
                     : 1
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/CleanHTML.pm
--- a/cgi-bin/LJ/CleanHTML.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/CleanHTML.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -1467,8 +1467,8 @@ sub clean_userbio {
 }
 
 sub canonical_url {
-    my $url = shift;
-    my $allow_all = shift;
+    my ( $url, $allow_all ) = @_;
+    $url ||= '';
 
     # strip leading and trailing spaces
     $url =~ s/^\s*//;
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Comment.pm
--- a/cgi-bin/LJ/Comment.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Comment.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -1046,26 +1046,26 @@ sub manage_buttons {
     my $poster = $self->poster ? $self->poster->user : "";
 
     if ($self->remote_can_edit) {
-        $managebtns .= "<a href='" . $self->edit_url . "'>" . LJ::img("editcomment", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
+        $managebtns .= "<a href='" . $self->edit_url . "'>" . LJ::img( "editcomment", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
     }
 
     if (LJ::Talk::can_delete($remote, $self->journal, $self->entry->poster, $poster)) {
-        $managebtns .= "<a href='$LJ::SITEROOT/delcomment?${jargent}id=$dtalkid'>" . LJ::img("btn_del", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
+        $managebtns .= "<a href='$LJ::SITEROOT/delcomment?${jargent}id=$dtalkid'>" . LJ::img( "btn_del", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
     }
 
     if (LJ::Talk::can_freeze($remote, $self->journal, $self->entry->poster, $poster)) {
         unless ($self->is_frozen) {
-            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=freeze&amp;${jargent}talkid=$dtalkid'>" . LJ::img("btn_freeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "</a>";
+            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=freeze&amp;${jargent}talkid=$dtalkid'>" . LJ::img( "btn_freeze", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
         } else {
-            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=unfreeze&amp;${jargent}talkid=$dtalkid'>" . LJ::img("btn_unfreeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "</a>";
+            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=unfreeze&amp;${jargent}talkid=$dtalkid'>" . LJ::img( "btn_unfreeze", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
         }
     }
 
     if (LJ::Talk::can_screen($remote, $self->journal, $self->entry->poster, $poster)) {
         unless ($self->is_screened) {
-            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=screen&amp;${jargent}talkid=$dtalkid'>" . LJ::img("btn_scr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
+            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=screen&amp;${jargent}talkid=$dtalkid'>" . LJ::img( "btn_scr", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
         } else {
-            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=unscreen&amp;${jargent}talkid=$dtalkid'>" . LJ::img("btn_unscr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
+            $managebtns .= "<a href='$LJ::SITEROOT/talkscreen?mode=unscreen&amp;${jargent}talkid=$dtalkid'>" . LJ::img( "btn_unscr", "", { align => 'absmiddle', hspace => 2 } ) . "</a>";
         }
     }
 
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Customize.pm
--- a/cgi-bin/LJ/Customize.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Customize.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -559,7 +559,7 @@ sub get_propgroups {
     my @propnames;
     
     my @grouped_properties = S2::get_properties( $lyr_core->{s2lid} );
-    @grouped_properties = grep { $_->{grouped} == 1 } @grouped_properties;
+    @grouped_properties = grep { $_->{grouped} && $_->{grouped} == 1 } @grouped_properties;
 
     foreach my $prop ( S2::get_properties( $lyr_layout->{s2lid} ), @grouped_properties ) {
         unless (ref $prop) {
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Entry.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -1010,7 +1010,7 @@ sub should_block_robots {
 
     my $adult_content = $self->adult_content_calculated;
 
-    return 1 if $LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{block_robots};
+    return 1 if $adult_content && $LJ::CONTENT_FLAGS{$adult_content} && $LJ::CONTENT_FLAGS{$adult_content}->{block_robots};
     return 0;
 }
 
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Faq.pm
--- a/cgi-bin/LJ/Faq.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Faq.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -129,7 +129,7 @@ sub load_all {
         $wherecat = "WHERE faqcat = " . $dbr->quote($faqcat) if defined $faqcat;
     } else {
         $wherecat = "WHERE faqcat "
-            . (length $faqcat ? "= " . $dbr->quote($faqcat) : "!= ''");
+            . (defined $faqcat && length $faqcat ? "= " . $dbr->quote($faqcat) : "!= ''");
     }
 
     croak("unknown parameters: " . join(", ", keys %opts))
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Poll.pm
--- a/cgi-bin/LJ/Poll.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Poll.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -856,9 +856,9 @@ sub render {
     my $page     = delete $opts{page};
     my $pagesize = delete $opts{pagesize};
 
-    # clearning the answers renders just like 'enter' mode, we just need to clear all selections
+    # clearing the answers renders just like 'enter' mode, we just need to clear all selections
     my $clearanswers;
-    if ( $mode eq "clear" ) {
+    if ( $mode && $mode eq "clear" ) {
         $clearanswers = 1;
         $mode = "enter";
     }
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/S2.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -240,7 +240,9 @@ sub s2_run
             $cleaner->parse("<!-- -->");
             $need_flush = 0;
         }
-        $$LJ::S2::ret_ref .= $_[0];
+        my $output = $_[0];
+        $output = '' unless defined $output;
+        $$LJ::S2::ret_ref .= $output;
         S2::check_depth() if ++$print_ctr % 8 == 0;
     };
     my $out_clean = sub {
@@ -2568,7 +2570,7 @@ sub rand
     } else {
         ($low, $high) = ($aa, $bb);
     }
-    return int(rand($high - $low + 1)) + $low;
+    return int( CORE::rand( $high - $low + 1 ) ) + $low;
 }
 
 sub pageview_unique_string {
@@ -3280,10 +3282,10 @@ sub _print_quickreply_link
     # clean up input:
     my $linktext = LJ::ehtml($opts->{'linktext'}) || "";
 
-    my $target = $opts->{'target'};
+    my $target = $opts->{target} || '';
     return unless $target =~ /^\w+$/; # if no target specified bail the fuck out
 
-    my $opt_class = $opts->{'class'};
+    my $opt_class = $opts->{class}|| '';
     undef $opt_class unless $opt_class =~ /^[\w\s-]+$/;
 
     my $opt_img = LJ::CleanHTML::canonical_url($opts->{'img_url'});
@@ -3311,17 +3313,16 @@ sub _print_quickreply_link
         $linktext = "<img src=\"$opt_img\" $width $height $align $title $alt $border />$linktext";
     }
 
-    my $basesubject = $opts->{'basesubject'}; #cleaned later
-
-    if ($opt_class) {
-        $opt_class = "class=\"$opt_class\"";
-    }
+    my $basesubject = $opts->{basesubject} || ''; #cleaned later
+
+    $opt_class = $opt_class ? "class=\"$opt_class\"" : "";
 
     my $page = get_page();
     my $remote = LJ::get_remote();
     my $onclick = "";
     unless ( $remote && $remote->prop( "opt_no_quickreply" ) ) {
-        my $pid = (int($target)&&$page->{'_type'} eq 'EntryPage') ? int($target /256) : 0;
+        my $pid = ( $target =~ /^\d+$/ && $page->{_type} eq 'EntryPage')
+                  ? int( $target /256 ) : 0;
 
         $basesubject =~ s/^(Re:\s*)*//i;
         $basesubject = "Re: $basesubject" if $basesubject;
@@ -3351,10 +3352,10 @@ sub _print_reply_container
     my $page = get_page();
     return unless $page->{'_type'} eq 'EntryPage';
 
-    my $target = $opts->{'target'};
+    my $target = $opts->{target} || '';
     undef $target unless $target =~ /^\w+$/;
 
-    my $class = $opts->{'class'} || undef;
+    my $class = $opts->{class} || '';
 
     # set target to the dtalkid if no target specified (link will be same)
     my $dtalkid = $this->{'talkid'} || undef;
@@ -3363,9 +3364,7 @@ sub _print_reply_container
 
     undef $class unless $class =~ /^([\w\s]+)$/;
 
-    if ($class) {
-        $class = "class=\"$class\"";
-    }
+    $class = $class ? "class=\"$class\"" : "";
 
     $S2::pout->("<div $class id=\"ljqrt$target\" style=\"display: none;\"></div>");
 
@@ -4073,6 +4072,7 @@ sub YearMonth__month_format
 {
     my ($ctx, $this, $fmt, $as_link) = @_;
     $fmt ||= "long";
+    $as_link ||= "";
     my $c = \$ctx->[S2::SCRATCH]->{'_code_monthfmt'}->{$fmt . $as_link};
     return $$c->($this) if ref $$c eq "CODE";
     if (++$ctx->[S2::SCRATCH]->{'_code_timefmt_count'} > 15) { return "[too_many_fmts]"; }
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -99,7 +99,7 @@ sub EntryPage
     my %user;
     my $copts = {
         'flat' => $flat_mode,
-        'thread' => ($get->{'thread'} >> 8),
+        'thread' => $get->{thread} ? ( $get->{thread} >> 8 ) : 0,
         'page' => $get->{'page'},
         'view' => $view_num,
         'userpicref' => \%userpic,
@@ -218,9 +218,10 @@ sub EntryPage
 
             # Comment Posted Notice
             my ($last_talkid, $last_jid) = LJ::get_lastcomment();
+            my $same_talkid = ( $last_talkid || 0 ) == ( $dtalkid || 0 );
+            my $same_jid = ( $last_jid || 0 ) == ( $remote ? $remote->userid : 0 );
             my $commentposted = "";
-            $commentposted = 1
-                 if ($last_talkid == $dtalkid && $last_jid == $remote->{'userid'});
+            $commentposted = 1 if $same_talkid && $same_jid;
 
             my $s2com = {
                 '_type' => 'Comment',
@@ -388,11 +389,12 @@ sub EntryPage
     $p->{'_picture_keyword'} = $get->{'prop_picture_keyword'};
 
     $p->{'viewing_thread'} = $get->{'thread'} ? 1 : 0;
-    $p->{_viewing_thread_id} = $get->{thread} + 0;
+    $p->{_viewing_thread_id} = $get->{thread} ? $get->{thread} + 0 : 0;
 
     # default values if there were no comments, because
     # LJ::Talk::load_comments() doesn't provide them.
-    if ($copts->{'out_error'} eq 'noposts' || scalar @comments < 1) {
+    my $out_error = $copts->{out_error} || '';
+    if ( $out_error eq 'noposts' || scalar @comments < 1 ) {
         $copts->{'out_pages'} = $copts->{'out_page'} = 1;
         $copts->{'out_items'} = 0;
         $copts->{'out_itemfirst'} = $copts->{'out_itemlast'} = undef;
@@ -502,8 +504,9 @@ sub EntryPage_entry
     my $comments = CommentInfo( $entry->comment_info(
         u => $u, remote => $remote, style_args => $style_args, viewall => $viewall
     ) );
-    $comments->{show_postlink} &&= $get->{mode} ne 'reply';
-    $comments->{show_readlink} &&= $get->{mode} eq 'reply';
+    my $get_mode = $get->{mode} || '';
+    $comments->{show_postlink} &&= $get_mode ne 'reply';
+    $comments->{show_readlink} &&= $get_mode eq 'reply';
 
     my $subject = LJ::CleanHTML::quote_html( $entry->subject_html, $get->{nohtml} );
     my $event = LJ::CleanHTML::quote_html( $entry->event_html, $get->{nohtml} );
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/S2/MonthPage.pm
--- a/cgi-bin/LJ/S2/MonthPage.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/S2/MonthPage.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -153,7 +153,7 @@ sub MonthPage
     $p->{'months'} = [];
 
     my $days = $u->get_daycounts( $remote ) || [];
-    my $lastmo;
+    my $lastmo = '';
     foreach my $day (@$days) {
         my ($oy, $om) = ($day->[0], $day->[1]);
         my $mo = "$oy-$om";
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -958,7 +958,7 @@ sub load_comments
 
             # see if we should ideally show it or not.  even if it's
             # zero, we'll still show it if it has any children (but we won't show content)
-            my $should_show = $post->{'state'} eq 'D' ? 0 : 1;
+            my $should_show = $post->{state} && $post->{state} eq 'D' ? 0 : 1;
             my $parenttalkid = $post->{parenttalkid};
             unless ( $viewall ) {
                 my $poster = LJ::load_userid( $post->{posterid} );
@@ -996,7 +996,7 @@ sub load_comments
             # which were already computed, since we're working new to old
             # and children are always newer.
             # then, if we or our children are showable, add us to the child list
-            my $sum = $should_show + $showable_children{$post->{'talkid'}};
+            my $sum = $should_show + ( $showable_children{$post->{talkid}} || 0 );
             if ($sum) {
                 $showable_children{$post->{'parenttalkid'}} += $sum;
                 unshift @{$children{$post->{'parenttalkid'}}}, $post->{'talkid'};
@@ -1041,7 +1041,7 @@ sub load_comments
             }
         }
     }
-    my $page = int($opts->{'page'}) || $page_from_view || 1;
+    my $page = int( $opts->{page} || 0 ) || $page_from_view || 1;
     $page = $page < 1 ? 1 : $page > $pages ? $pages : $page;
 
     my $itemfirst = $page_size * ($page-1) + 1;
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Widget/InboxFolderNav.pm
--- a/cgi-bin/LJ/Widget/InboxFolderNav.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Widget/InboxFolderNav.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -48,7 +48,7 @@ sub render_body {
         my $unread = shift || "";
         my $img = shift || 0;
 
-        $class .= " active" if $opts{view} eq $link_view;
+        $class .= " active" if $opts{view} && $opts{view} eq $link_view;
 
         my $link = qq{<a href=".?view=$link_view" class="$class" id="esn_folder_$link_view">};
         $link .= BML::ml( $link_label );
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/LJ/Widget/ManageSiteMessages.pm
--- a/cgi-bin/LJ/Widget/ManageSiteMessages.pm	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/LJ/Widget/ManageSiteMessages.pm	Thu Oct 21 16:32:30 2010 +0800
@@ -29,8 +29,8 @@ sub render_body {
     my $ret = "";
 
     # default values for year/month
-    my $year  = $get->{year}+0;
-    my $month = $get->{month}+0;
+    my $year  = $get->{year} ? $get->{year} + 0 : 0;
+    my $month = $get->{month} ? $get->{month} + 0 : 0;
 
     # if year and month aren't defined, use the current month
     unless ($year && $month) {
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/htmlcontrols.pl
--- a/cgi-bin/htmlcontrols.pl	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/htmlcontrols.pl	Thu Oct 21 16:32:30 2010 +0800
@@ -162,7 +162,8 @@ sub html_select
     $ret .= " disabled='disabled'" if $opts->{'disabled'};
     $ret .= " multiple='multiple'" if $opts->{'multiple'};
     foreach (grep { ! /^(raw|disabled|selected|noescape|multiple)$/ } keys %$opts) {
-        $ret .= " $_=\"" . ($ehtml ? ehtml($opts->{$_}) : $opts->{$_}) . "\"";
+        my $opt = $opts->{$_} || '';
+        $ret .= " $_=\"" . ( $ehtml ? ehtml( $opt ) : $opt ) . "\"";
     }
     $ret .= ">\n";
 
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/ljcapabilities.pl
--- a/cgi-bin/ljcapabilities.pl	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/ljcapabilities.pl	Thu Oct 21 16:32:30 2010 +0800
@@ -165,7 +165,8 @@ sub get_cap
         $caps = $u->{'caps'};
     # If it is not all digits assume it is a key
     } elsif ($caps && $caps !~ /^\d+$/) {
-        $caps = 1 << LJ::class_bit($caps);
+        my $bit = LJ::class_bit( $caps ) || 0;
+        $caps = 1 << $bit;
     }
     # The caps is the cap mask already or undef, force it to be a number
     $caps += 0;
diff -r c90544d5bd00 -r bc696fb40708 cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Wed Oct 20 15:52:20 2010 +0800
+++ b/cgi-bin/weblib.pl	Thu Oct 21 16:32:30 2010 +0800
@@ -64,7 +64,7 @@ sub img
                 $ssl = $attr->{ssl} && $LJ::IS_SSL;
                 delete $attr->{ssl};
             }
-            $attrs .= " $_=\"" . LJ::ehtml( $attr->{$_} ) . "\""
+            $attrs .= " $_=\"" . LJ::ehtml( $attr->{$_} || '' ) . "\""
                 foreach keys %$attr;
         } else {
             $attrs = " name=\"$attr\"";
@@ -654,7 +654,7 @@ sub create_qr_div {
     $qrhtml .= "<div id='qrformdiv'><form id='qrform' name='qrform' method='POST' action='$LJ::SITEROOT/talkpost_do'>";
     $qrhtml .= LJ::form_auth();
 
-    my $stylemineuri = $style_opts ? LJ::viewing_style_args( $style_opts ) : "";
+    my $stylemineuri = %$style_opts ? LJ::viewing_style_args( %$style_opts ) : "";
     my $basepath =  $u->journal_base . "/$ditemid.html?${stylemineuri}";
     my $usertype = ($remote->openid_identity && $remote->is_validated) ? 'openid_cookie' : 'cookieuser';
     $qrhtml .= LJ::html_hidden({'name' => 'replyto', 'id' => 'replyto', 'value' => ''},
@@ -962,10 +962,9 @@ sub viewing_style_opts {
     # only accept purely numerical s2ids
     $ret{s2id} = $args{s2id} if $args{s2id} && $args{s2id} =~ /^\d+$/;
 
-    for my $key( qw ( format style ) ) {
+    foreach my $key ( keys %{ $valid_style_args } ) {
         $ret{$key} = $args{$key}
-            if $valid_style_args->{$key} &&
-               $valid_style_args->{$key}->{$args{$key}};
+            if $args{$key} && $valid_style_args->{$key}->{$args{$key}};
     }
 
     return \%ret;
diff -r c90544d5bd00 -r bc696fb40708 htdocs/manage/subscriptions/comments.bml
--- a/htdocs/manage/subscriptions/comments.bml	Wed Oct 20 15:52:20 2010 +0800
+++ b/htdocs/manage/subscriptions/comments.bml	Thu Oct 21 16:32:30 2010 +0800
@@ -44,7 +44,8 @@ body<=
     my $dtalkid = $POST{'talkid'} || $GET{'talkid'} || $POST{'dtalkid'} || $POST{'dtalkid'};
     my $journal = $POST{'journal'} || $GET{'journal'};
 
-    my $journal = LJ::load_user($journal) or return LJ::error_list("Invalid journal '$journal'");
+    return LJ::error_list( "No journal specified" ) unless $journal;
+    $journal = LJ::load_user($journal) or return LJ::error_list("Invalid journal '$journal'");
 
     return LJ::error_list("No talkid specified") unless $dtalkid;
 
diff -r c90544d5bd00 -r bc696fb40708 htdocs/manage/subscriptions/entry.bml
--- a/htdocs/manage/subscriptions/entry.bml	Wed Oct 20 15:52:20 2010 +0800
+++ b/htdocs/manage/subscriptions/entry.bml	Thu Oct 21 16:32:30 2010 +0800
@@ -40,7 +40,8 @@ body<=
     my $journal = $POST{'journal'} || $GET{'journal'};
     my $ntypeid = int($POST{'ntypeid'});
 
-    my $journal = LJ::load_user($journal) or return LJ::error_list("Invalid journal '$journal'");
+    return LJ::error_list( "No journal specified" ) unless $journal;
+    $journal = LJ::load_user($journal) or return LJ::error_list("Invalid journal '$journal'");
 
     return LJ::error_list("No entry specified") unless $ditemid;
 
--------------------------------------------------------------------------------