68 lines
1.5 KiB
Plaintext
68 lines
1.5 KiB
Plaintext
|
<?_code
|
||
|
{
|
||
|
use strict;
|
||
|
use vars qw($title $body %GET %POST);
|
||
|
|
||
|
$title = "";
|
||
|
$body = "";
|
||
|
|
||
|
|
||
|
# S2 Redirector, for Calendar view
|
||
|
|
||
|
if ($POST{'redir_type'} eq "monthview") {
|
||
|
my $user = LJ::canonical_username($POST{'redir_user'});
|
||
|
my $vhost;
|
||
|
$vhost = $POST{'redir_vhost'} if $POST{'redir_vhost'}=~/users|tilde|community|front|other/;
|
||
|
if ($vhost eq "other") {
|
||
|
# FIXME: lookup their domain alias, and make vhost be "other:domain.com";
|
||
|
}
|
||
|
my $base = LJ::journal_base($user, $vhost);
|
||
|
return $ML{'.error.redirkey'} unless $POST{'redir_key'} =~/^(\d\d\d\d)(\d\d)$/;
|
||
|
my ($year, $month) = ($1, $2);
|
||
|
return BML::redirect("$base/$year/$month/");
|
||
|
}
|
||
|
|
||
|
|
||
|
# prev/next talkread links
|
||
|
|
||
|
my $journal = $GET{'journal'};
|
||
|
my $itemid = $GET{'itemid'}+0;
|
||
|
my $dir= $GET{'dir'};
|
||
|
|
||
|
if ($journal && $itemid && $dir)
|
||
|
{
|
||
|
my $u = LJ::load_user($journal);
|
||
|
|
||
|
# sanity check
|
||
|
unless ($u) {
|
||
|
$body = $ML{'.error.usernotfound'};
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
my $jumpid = LJ::get_itemid_near2($u, $itemid, $dir);
|
||
|
|
||
|
if ($jumpid) {
|
||
|
return BML::redirect(LJ::journal_base($u) . "/$jumpid.html");
|
||
|
|
||
|
} else {
|
||
|
$title = $ML{'.error.noentrytitle'};
|
||
|
|
||
|
if ($dir eq "next") {
|
||
|
$body = $ML{'.error.noentry.next'};
|
||
|
} elsif ($dir eq "prev") {
|
||
|
$body = $ML{'.error.noentry.prev'};
|
||
|
}
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
$title = $ML{'.defaulttitle'};
|
||
|
$body = $ML{'.defaultbody'};
|
||
|
|
||
|
return;
|
||
|
}
|
||
|
_code?><?page
|
||
|
title=><?_code return $title; _code?>
|
||
|
body=><?_code return $body; _code?>
|
||
|
page?>
|