| 1494 | | } elsif (!%$args) { |
|---|
| 1495 | | if (my $days = $ctx->stash('blog')->days_on_index) { |
|---|
| 1496 | | my @ago = offset_time_list(time - 3600 * 24 * $days, |
|---|
| 1497 | | $ctx->stash('blog_id')); |
|---|
| 1498 | | my $ago = sprintf "%04d%02d%02d%02d%02d%02d", |
|---|
| 1499 | | $ago[5]+1900, $ago[4]+1, @ago[3,2,1,0]; |
|---|
| 1500 | | $terms{created_on} = [ $ago ]; |
|---|
| 1501 | | $args{range_incl}{created_on} = 1; |
|---|
| 1502 | | } elsif (my $limit = $ctx->stash('blog')->entries_on_index) { |
|---|
| 1503 | | $args->{lastn} = $limit; |
|---|
| | 1494 | } else { |
|---|
| | 1495 | # Check attributes |
|---|
| | 1496 | my $found_valid_args = 0; |
|---|
| | 1497 | foreach my $valid_key ('lastn', 'offset', 'category', 'categories', 'tag', 'tags', 'author', 'days', 'recently_commented_on') { |
|---|
| | 1498 | if (exists($args->{$valid_key})) { |
|---|
| | 1499 | $found_valid_args = 1; |
|---|
| | 1500 | last; |
|---|
| | 1501 | } |
|---|
| | 1502 | } |
|---|
| | 1503 | |
|---|
| | 1504 | if (!$found_valid_args) { |
|---|
| | 1505 | # Uses weblog settings |
|---|
| | 1506 | if (my $days = $ctx->stash('blog')->days_on_index) { |
|---|
| | 1507 | my @ago = offset_time_list(time - 3600 * 24 * $days, |
|---|
| | 1508 | $ctx->stash('blog_id')); |
|---|
| | 1509 | my $ago = sprintf "%04d%02d%02d%02d%02d%02d", |
|---|
| | 1510 | $ago[5]+1900, $ago[4]+1, @ago[3,2,1,0]; |
|---|
| | 1511 | $terms{created_on} = [ $ago ]; |
|---|
| | 1512 | $args{range_incl}{created_on} = 1; |
|---|
| | 1513 | } elsif (my $limit = $ctx->stash('blog')->entries_on_index) { |
|---|
| | 1514 | $args->{lastn} = $limit; |
|---|
| | 1515 | } |
|---|