[dw-free] move cgi-bin/lj*.pl files into proper modules (in cgi-bin/LJ)
[commit: http://hg.dwscoalition.org/dw-free/rev/9457acb16e2d]
http://bugs.dwscoalition.org/show_bug.cgi?id=1726
Remove uninitialized warnings from ljfeed.pl
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1726
Remove uninitialized warnings from ljfeed.pl
Patch by
Files modified:
- cgi-bin/ljfeed.pl
--------------------------------------------------------------------------------
diff -r eef4b4d00c30 -r 9457acb16e2d cgi-bin/ljfeed.pl
--- a/cgi-bin/ljfeed.pl Mon Oct 24 19:47:32 2011 +0800
+++ b/cgi-bin/ljfeed.pl Mon Oct 24 19:56:39 2011 +0800
@@ -15,7 +15,6 @@
package LJ::Feed;
use strict;
-no warnings 'uninitialized';
use LJ::Entry;
use XML::Atom::Person;
@@ -55,8 +54,9 @@
foreach ("name", "url", "urlname");
# opt_synlevel will default to 'cut'
- $u->{'opt_synlevel'} = 'cut'
- unless $u->{'opt_synlevel'} =~ /^(?:full|cut|summary|title)$/;
+ $u->{opt_synlevel} = 'cut'
+ unless $u->{opt_synlevel} &&
+ $u->{opt_synlevel} =~ /^(?:full|cut|summary|title)$/;
# some data used throughout the channel
my $journalinfo = {
@@ -90,7 +90,7 @@
my (@itemids, @items);
# for consistency, we call ditemids "itemid" in user-facing settings
- my $ditemid = $FORM{itemid}+0;
+ my $ditemid = defined $FORM{itemid} ? $FORM{itemid} + 0 : 0;
if ($ditemid) {
my $entry = LJ::Entry->new($u, ditemid => $ditemid);
@@ -139,7 +139,7 @@
my $lastmod = 0;
foreach my $item (@items) {
# revtime of the item.
- my $revtime = $logprops{$item->{itemid}}->{revtime};
+ my $revtime = $logprops{$item->{itemid}}->{revtime} || 0;
$lastmod = $revtime if $revtime > $lastmod;
# if we don't have a revtime, use the logtime of the item.
@@ -268,6 +268,8 @@
}
my $createtime = $LJ::EndOfTime - $it->{rlogtime};
+ my $can_comment = ! defined $logprops{$itemid}->{opt_nocomments} ||
+ ( $logprops{$itemid}->{opt_nocomments} == 0 );
my $cleanitem = {
itemid => $itemid,
ditemid => $ditemid,
@@ -276,7 +278,7 @@
createtime => $createtime,
eventtime => $it->{alldatepart}, # ugly: this is of a different format than the other two times.
modtime => $logprops{$itemid}->{revtime} || $createtime,
- comments => ($logprops{$itemid}->{'opt_nocomments'} == 0),
+ comments => $can_comment,
music => $logprops{$itemid}->{'current_music'},
mood => $mood,
ppid => $ppid,
--------------------------------------------------------------------------------
