mourningdove/htdocs/customize/preview_redirect.bml

55 lines
1.5 KiB
Text
Raw Permalink Normal View History

2026-05-24 01:03:05 +00:00
<?_c
# This code was forked from the LiveJournal project owned and operated
# by Live Journal, Inc. The code has been modified and expanded by
# Dreamwidth Studios, LLC. These files were originally licensed under
# the terms of the license supplied by Live Journal, Inc, which can
# currently be found at:
#
# http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt
#
# In accordance with the original license, this code and all its
# modifications are provided under the GNU General Public License.
# A copy of that license can be found in the LICENSE file included as
# part of this distribution.
_c?>
<?page
body<=
<?_code
{
use strict;
use vars qw(%GET %POST $title $headextra @errors @warnings);
use LJ::S2Theme;
my $u = LJ::get_effective_remote();
return $ML{'.error.user'} unless LJ::isu($u);
my $themeid = $GET{themeid}+0;
my $layoutid = $GET{layoutid}+0;
my $theme;
if ($themeid) {
$theme = LJ::S2Theme->load_by_themeid($themeid, $u);
} elsif ($layoutid) {
$theme = LJ::S2Theme->load_custom_layoutid($layoutid, $u);
} else {
return $ML{'.error.id'};
}
my $styleid = $theme->get_preview_styleid($u);
return $ML{'.error.preview'} unless $styleid;
if ( $u->is_identity ) {
return BML::redirect( $u->openid_journal_base . "/?s2id=$styleid" );
} else {
return BML::redirect( $u->journal_base . "/?s2id=$styleid" );
}
}
_code?>
<=body
title=><?_code return $title; _code?>
head<=
<?_code return $headextra; _code?>
<=head
page?>