Permalink
Browse files

Remove old isValid testing; Atom fixes

  • Loading branch information...
1 parent d13a099 commit 81a1ba29d0e48a64a7a7067f41fa41231f9f365f @pudge pudge committed Aug 16, 2005
@@ -8651,6 +8651,7 @@ sub getSubmissionForUser {
'submission_param',
"subid=" . $self->sqlQuote($sub->{subid})
);
+ $sub->{orig_time} = $sub->{'time'};
for my $key (keys %$append) {
$sub->{$key} = $append->{$key};
}
@@ -259,10 +259,13 @@ sub as_atom_1_0 {
foreach my $item (@{$self->{items}}) {
if ($item->{title}) {
$output .= "<entry>\n";
- $output .= atom_encode($self, 'id', $item->{'link'});
- $output .= atom_encode($self, 'title', $item->{title});
$val = $self->encode($item->{'link'});
+ $output .= qq[<id>$val</id>\n];
+
+ $output .= atom_encode($self, 'title', $item->{title});
+
+ # $val still same as directly above
$output .= qq[<link href="$val"/>\n];
# XXXX if at some point we can know this is the whole text
@@ -311,7 +314,7 @@ sub atom_encode {
return '' unless $value;
$value = $self->encode($value);
# XXX make this more robust?
- my $type = $value =~ /(?:&amp;\w+;|&[lg]t;)/ ? 'html' : 'text';
+ my $type = $value =~ /(?:&amp;#?\w+;|&[lg]t;)/ ? 'html' : 'text';
# try parsing. If well formed, replace the value and type
if ($type eq 'html' && $value =~ /&[lg]t;/) {
@@ -178,6 +178,7 @@ sub create {
title => $constants->{sitename},
description => $constants->{slogan},
'link' => $absolutedir . '/',
+ selflink => '',
# dc
date => $self->date2iso8601(),
@@ -295,6 +296,11 @@ sub create {
if ($item->{story}) {
# set up story params in $encoded_item ref
$self->rss_story($item, $encoded_item, $version, \%channel);
+ } else {
+ $encoded_item->{dc}{date} = $self->encode($self->date2iso8601($item->{'time'}))
+ if $item->{'time'};
+ $encoded_item->{dc}{creator} = $self->encode($item->{creator})
+ if $item->{creator};
}
for my $key (keys %$item) {
@@ -275,7 +275,6 @@ sub displayRSS {
title => "$title $journals",
description => "$title $constants->{sitename} $journals",
'link' => root2abs() . '/~' . fixparam($juser->{nickname}) . $link,
- creator => $juser->{nickname},
},
image => 1,
items => \@items,
@@ -724,9 +723,6 @@ sub saveArticle {
my $validator = getObject('Slash::Validator');
my $article = $journal->get($form->{id});
my $strip_art = balanceTags(strip_mode($article->{article}, $article->{posttype}), { deep_nesting => 1 });
- if ($user->{nickname} eq 'pudge') {
- $strip_art .= '</div>'; # intentionally break to test
- }
$validator->isValid($strip_art, {
data_type => 'journal',
data_id => $form->{id},
@@ -375,11 +375,15 @@ sub commentSearchRSS {
$comments = $searchDB->findComments($form, $start, 15, $form->{sort});
}
+ my $reader = getObject('Slash::DB', { db_type => 'reader' });
+
my @items;
for my $entry (@$comments) {
my $time = timeCalc($entry->{date});
push @items, {
title => "$entry->{subject} ($time)",
+ time => $entry->{date},
+ creator => $reader->getUser($entry->{uid}, 'nickname'),
'link' => ($gSkin->{absolutedir} . "/comments.pl?sid=$entry->{did}&cid=$entry->{cid}"),
};
}
@@ -412,6 +416,7 @@ sub userSearchRSS {
my $time = timeCalc($entry->{journal_last_entry_date});
push @items, {
title => $entry->{nickname},
+ time => $entry->{journal_last_entry_date},
'link' => ($gSkin->{absolutedir} . '/users.pl?nick=' . $entry->{nickname}),
};
}
@@ -439,13 +444,17 @@ sub storySearchRSS {
$stories = $searchDB->findStory($form, $start, 15, $form->{sort});
}
+ my $reader = getObject('Slash::DB', { db_type => 'reader' });
+
my @items;
for my $entry (@$stories) {
my $time = timeCalc($entry->{time});
# Link should be made to be sectional -Brian
# so why didn't make it sectional?
push @items, {
title => $entry->{title},
+ time => $entry->{time},
+ creator => $reader->getUser($entry->{uid}, 'nickname'),
'link' => ($gSkin->{absolutedir} . '/article.pl?sid=' . $entry->{sid}),
description => $entry->{introtext}
};
@@ -483,6 +492,7 @@ sub pollSearchRSS {
my $link = $url || $gSkin->{absolutedir};
push @items, {
title => "$entry->{question} ($time)",
+ time => $entry->{date},
'link' => ($link . '/pollBooth.pl?qid=' . $entry->{qid}),
};
}
@@ -559,6 +569,8 @@ sub journalSearchRSS {
my $time = timeCalc($entry->{date});
push @items, {
title => "$entry->{description} ($time)",
+ time => $entry->{date},
+ creator => $entry->{nickname},
'link' => ($gSkin->{absolutedir} . '/~' . fixparam($entry->{nickname}) . '/journal/' . $entry->{id}),
description => $constants->{article},
};
@@ -642,6 +654,7 @@ sub submissionSearchRSS {
my $time = timeCalc($entry->{time});
push @items, {
title => "$entry->{subj} ($time)",
+ time => $entry->{time},
'link' => ($gSkin->{absolutedir} . '/submit.pl?subid=' . $entry->{subid}),
'description' => $entry->{story},
};
@@ -721,6 +734,7 @@ sub rssSearchRSS {
my $time = timeCalc($entry->[2]);
push @items, {
title => "$entry->{title} ($time)",
+ time => $entry->[2],
'link' => $entry->{link}, # No, this is not right -Brian
'description' => $entry->{description},
};
@@ -25,9 +25,11 @@ IF op == 'stories';
thisurl = Slash.db.getSkin(entry.primaryskid).url || gSkin.absolutedir;
thislink = thisurl _ '/article.pl?sid=' _ entry.sid;
rss.items.push({
- title => entry.title,
- description => entry.introtext,
- link => thislink
+ title => entry.title,
+ description => entry.introtext,
+ link => thislink,
+ time => entry.time,
+ creator => Slash.db.getUser(entry.uid, 'nickname'),
});
END;
rss.channel.title = '$constants.sitename Story Search';
@@ -40,8 +42,10 @@ ELSIF op == 'comments';
thislink = gSkin.absolutedir _ '/comments.pl?sid=' _ entry.did _ '&cid=' _ entry.cid;
thistime = Slash.timeCalc(entry.date);
rss.items.push({
- title => "$entry.subject ($thistime)",
- link => thislink
+ title => "$entry.subject ($thistime)",
+ link => thislink,
+ time => entry.date,
+ creator => Slash.db.getUser(entry.uid, 'nickname'),
});
END;
rss.channel.title = '$constants.sitename Comment Search';
@@ -52,8 +56,9 @@ ELSIF op == 'users';
thisnick = entry.nickname | fixparam;
thislink = gSkin.absolutedir _ '/~' _ thisnick;
rss.items.push({
- title => entry.nickname,
- link => thislink
+ title => entry.nickname,
+ link => thislink,
+ time => entry.journal_last_entry_date,
});
END;
rss.channel.title = '$constants.sitename User Search';
@@ -65,8 +70,9 @@ ELSIF op == 'polls';
thislink = thisurl _ '/pollBooth.pl?qid=' _ entry.qid;
thistime = Slash.timeCalc(entry.date);
rss.items.push({
- title => entry.nickname,
- link => thislink
+ title => entry.nickname,
+ link => thislink,
+ time => entry.date,
});
END;
rss.channel.title = '$constants.sitename Poll Search';
@@ -78,8 +84,10 @@ ELSIF op == 'journals';
thislink = gSkin.absolutedir _ '/~' _ thisnick _ '/journal/' _ entry.id;
thistime = Slash.timeCalc(entry.date);
rss.items.push({
- title => "$entry.description ($thistime)",
- link => thislink
+ title => "$entry.description ($thistime)",
+ link => thislink,
+ time => entry.date,
+ creator => entry.nickname,
});
END;
rss.channel.title = '$constants.sitename Journal Search';
@@ -90,9 +98,10 @@ ELSIF op == 'submissions';
thislink = gSkin.absolutedir _ '/submit.pl?subid=' _ entry.subid;
thistime = Slash.timeCalc(entry.date);
rss.items.push({
- title => "$entry.subj ($thistime)",
- description => entry.story,
- link => thislink
+ title => "$entry.subj ($thistime)",
+ description => entry.story,
+ link => thislink,
+ time => entry.time,
});
END;
rss.channel.title = '$constants.sitename Submission Search';
@@ -103,8 +112,8 @@ ELSIF op == 'submissions';
ELSIF op == 'test';
FOREACH entry = results.records;
rss.items.push({
- title => entry,
- link => gSkin.absolutedir _ '/search.pl?op=test'
+ title => entry,
+ link => gSkin.absolutedir _ '/search.pl?op=test'
});
END;
rss.channel.title = '$constants.sitename Test Search';
@@ -1205,9 +1205,6 @@ sub submitComment {
if ($constants->{validate_html}) {
my $validator = getObject('Slash::Validator');
my $test = parseDomainTags($tempComment);
- if ($user->{nickname} eq 'pudge') {
- $test .= '</div>'; # intentionally break to test
- }
$validator->isValid($test, {
data_type => 'comment',
data_id => $maxCid,
@@ -24,7 +24,7 @@
newxml(@_, undef, $stories);
newrdf(@_, undef, $stories);
newrss(@_, undef, $stories);
-# newatom(@_, undef, $stories);
+ newatom(@_, undef, $stories);
}
my $skins = $slashdb->getSkins();
@@ -36,7 +36,7 @@
newxml(@_, $name, $stories);
newrdf(@_, $name, $stories);
newrss(@_, $name, $stories);
-# newatom(@_, $name, $stories);
+ newatom(@_, $name, $stories);
}
}

0 comments on commit 81a1ba2

Please sign in to comment.