Fixed some problem with show later
Don't remember the details. Apparently the user name wasn't handled correctly?
This commit is contained in:
parent
10ed56e9d4
commit
3ccf06ad48
14
index.cgi
14
index.cgi
|
@ -166,10 +166,11 @@ sub list {
|
||||||
my $items;
|
my $items;
|
||||||
if ($show_read) {
|
if ($show_read) {
|
||||||
my $fields = "feeds.id as feed_id, feeds.title as feed_title, allow_img, link, items.title as item_title, content, "
|
my $fields = "feeds.id as feed_id, feeds.title as feed_title, allow_img, link, items.title as item_title, content, "
|
||||||
. "items.id as item_id, issued, username, lang";
|
. "items.id as item_id, issued, read.username, lang";
|
||||||
my $tables = "items
|
my $tables = "items
|
||||||
join feeds on items.feed_id=feeds.id
|
join feeds on items.feed_id=feeds.id
|
||||||
left outer join read on (items.id=read.item_id and username=?)";
|
left outer join read on (items.id=read.item_id and username=?)";
|
||||||
|
my @params = ($q->remote_user);
|
||||||
my @where;
|
my @where;
|
||||||
if (%feed_item_show) {
|
if (%feed_item_show) {
|
||||||
push @where, "feeds.id in (" . join(',', keys %feed_item_show) . ")";
|
push @where, "feeds.id in (" . join(',', keys %feed_item_show) . ")";
|
||||||
|
@ -179,10 +180,15 @@ sub list {
|
||||||
}
|
}
|
||||||
|
|
||||||
my $where = "where " . join(" and ", @where);
|
my $where = "where " . join(" and ", @where);
|
||||||
|
if ($show_later) {
|
||||||
|
$tables .= " left outer join later on (items.id=later.item_id and later.username=?)";
|
||||||
|
push @params, $q->remote_user;
|
||||||
|
$where .= " or (later.username is not null)"
|
||||||
|
}
|
||||||
|
|
||||||
my $cmd = "select $fields from $tables $where order by issued";
|
my $cmd = "select $fields from $tables $where order by issued";
|
||||||
print_log("$cmd");
|
print_log("$cmd");
|
||||||
my $items1 = $dbh->selectall_arrayref($cmd, { Slice => {} }, $q->remote_user);
|
my $items1 = $dbh->selectall_arrayref($cmd, { Slice => {} }, @params);
|
||||||
my $nrd = 0;
|
my $nrd = 0;
|
||||||
while (@$items1) {
|
while (@$items1) {
|
||||||
my $item = pop @$items1;
|
my $item = pop @$items1;
|
||||||
|
@ -208,8 +214,12 @@ sub list {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$show_old) {
|
if (!$show_old) {
|
||||||
|
if ($show_later) {
|
||||||
|
push @where, "(later.username is not null or items.old is null or items.old = 0)"
|
||||||
|
} else {
|
||||||
push @where, "(items.old is null or items.old = 0)"
|
push @where, "(items.old is null or items.old = 0)"
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
my $where = "where " . join(" and ", @where);
|
my $where = "where " . join(" and ", @where);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue