Skip to content

Commit

Permalink
Updates to allow for getting stories w/in a specific time window for …
Browse files Browse the repository at this point in the history
…story admin box
  • Loading branch information
tvroom committed Feb 28, 2006
1 parent c4b48f5 commit c93ec5a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions Slash/DB/MySQL/MySQL.pm
Expand Up @@ -7118,16 +7118,21 @@ sub getStoryByTimeAdmin {
my $order = $sign eq '<' ? 'DESC' : 'ASC';

$where .= " AND sid != '$story->{sid}'" if !$options->{no_story};
my $timebase = $story ? $self->sqlQuote($story->{time}) : "NOW()";
$where .= " AND DATE_SUB($timebase, INTERVAL $options->{hours_back} HOUR) " if $options->{hours_back};
$where .= " AND DATE_ADD($timebase, INTERVAL $options->{hours_forward} HOUR) " if $options->{hours_forward};

my $time = $story->{'time'};
$time = $self->getTime() if !$story->{time} && $options->{no_story};

my $limittext = $limit ? " LIMIT $limit" : "";

my $returnable = $self->sqlSelectAllHashrefArray(
'stories.stoid, title, sid, time',
'stories.stoid, title, sid, time, primaryskid',
'stories, story_text',
"stories.stoid=story_text.stoid
AND time $sign '$time' AND in_trash = 'no' $where",
"ORDER BY time $order LIMIT $limit"
"ORDER BY time $order $limittext"
);
foreach my $story (@$returnable) {
$story->{displaystatus} = $self->_displaystatus($story->{stoid}, { no_time_restrict => 1 });
Expand Down

0 comments on commit c93ec5a

Please sign in to comment.