1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
#!/usr/bin/perl -w
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2001 by Open Source Development Network. See README
# and COPYING for more information, or see http://slashcode.com/.
# $Id: article.pl,v 1.6.2.18 2001/10/29 20:31:55 pudge Exp $
use strict;
use Slash;
use Slash::Display;
use Slash::Utility;
##################################################################
sub main {
my $slashdb = getCurrentDB();
my $constants = getCurrentStatic();
my $user = getCurrentUser();
my $form = getCurrentForm();
my $story;
my $authorbox;
#Yeah, I am being lazy and paranoid -Brian
if (!($user->{author} or $user->{is_admin}) and !$slashdb->checkStoryViewable($form->{sid})) {
$story = '';
} else {
$story = $slashdb->getStory($form->{sid});
}
if ($story) {
my $SECT = $slashdb->getSection($story->{section});
my $title = $SECT->{isolate} ?
"$SECT->{title} | $story->{title}" :
"$constants->{sitename} | $story->{title}";
# set things up to use the <LINK> tag in the header
my $next = $slashdb->getStoryByTime('>', $story, $SECT);
my $prev = $slashdb->getStoryByTime('<', $story, $SECT);
my $links = {
title => $title,
'link' => {
section => $SECT->{title},
prev => $prev,
'next' => $next,
author => $story->{uid},
},
};
header($links, $story->{section});
if ($user->{seclev} >= 100) {
my $newestthree = $slashdb->getBlock('newestthree','block');
my $nextthree = $slashdb->getNextThree($story->{time});
my $nextstories = {};
for (@$nextthree) {
my $tmpstory = $slashdb->getStory($_->[0], ['title', 'uid', 'time']);
my $author = $slashdb->getUser($tmpstory->{uid},'nickname');
$nextstories->{$_->[0]}{author} = $slashdb->getUser($tmpstory->{uid},'nickname');
$nextstories->{$_->[0]}{title} = $tmpstory->{title};
$nextstories->{$_->[0]}{time} = $tmpstory->{time};
}
my $nextblock = slashDisplay('three', { stories => $nextstories}, { Return => 1, Page => 'misc', Section => 'default'});
$authorbox = $newestthree . $nextblock;
}
my $pollbooth = pollbooth($story->{sid}, 1);
slashDisplay('display', {
poll => $pollbooth,
authorbox => $user->{is_admin} ? $authorbox : '',
section => $SECT,
section_block => $slashdb->getBlock($SECT->{section}),
show_poll => $pollbooth ? 1 : 0,
story => $story,
'next' => $next,
prev => $prev,
});
my $discussion = $slashdb->getDiscussionBySid($story->{sid});
printComments($discussion);
} else {
my $message = getData('no_such_sid');
header($message);
print $message;
}
footer();
if ($story) {
writeLog($story->{sid} || $form->{sid});
} else {
writeLog($form->{sid});
}
}
createEnvironment();
main();
1;
|