This commit is contained in:
2019-02-06 00:49:12 +03:00
commit 8dbb1bb605
4796 changed files with 506072 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
<html>
<head>
<title>Style Browser</title>
</head>
<frameset cols="200,*">
<frameset rows="100,*">
<frame name="start" src="start.bml">
<frame name="links" src="links.bml">
</frameset>
<frame name="main" src="instructions.bml">
</frameset>
</html><!-- <LJDEP>
link: htdocs/styles/browse/start.bml, htdocs/styles/browse/blank.bml, htdocs/styles/browse/instructions.bml
</LJDEP> -->

View File

@@ -0,0 +1,12 @@
<html>
<head>
<title>Style Browser</title>
</head>
<body>
<h1>Style Browser</h1>
<p>Enter a username in the box on the left and click "Preview" to see a list of that users'
public styles. In the list, click on the style name to view what the style looks like, or
click the dash to view style information.</p>
</body>
</html><!-- <LJDEP>
</LJDEP> -->

View File

@@ -0,0 +1,55 @@
<base target=_top>
<?_code
{
use strict;
use vars qw(%GET);
my $user = LJ::canonical_username($GET{'user'});
return "Enter a username." unless $user;
my $remote = LJ::get_remote();
my $dispuser = $remote ? $remote->{'user'} : $user;
my $styu = LJ::load_user($user);
my $styles;
if ($user eq 'system') {
$styles = LJ::S1::get_public_styles();
} else {
$styles = LJ::S1::get_user_styles($user);
}
my $admin = $remote &&
(LJ::check_priv($remote, 'canview', 'styles') ||
LJ::check_priv($remote, 'canview', '*'));
my ($dday,$dmon,$dyear) = (localtime(time))[3..5];
$dyear+=1900; $dmon++;
my %extra = ( 'day' => "&amp;month=$dmon&amp;day=$dday&amp;year=$dyear" );
my $ret = "Styles for " . LJ::ljuser($user) . ":<br /><br />";
my $last;
STY:
foreach my $sty (sort { $a->{'type'} cmp $b->{'type'} || $a->{'styledes'} cmp $b->{'styledes'} }
values %$styles) {
next STY unless $sty->{is_public} eq 'Y' || # public is always visible
LJ::u_equals($remote, $styu) || # yours are visible to you
LJ::can_manage($remote, $styu) ||# you can view things you manage
$admin; # you have appropriate canview
if ($last ne $LJ::viewinfo{$sty->{'type'}}->{'des'}) {
$last = $LJ::viewinfo{$sty->{'type'}}->{'des'};
$ret .= "<b>$last</b><br />\n";
}
$ret .= "<nobr>&nbsp;&nbsp;[<a target='main' href='styleinfo.bml?styleid=$sty->{'styleid'}'>info</a>] ";
$ret .= "<a target='main' href='/customview.cgi?styleid=$sty->{'styleid'}&amp;user=$dispuser&amp;";
$ret .= "nooverride=1$extra{$sty->{'type'}}'>$sty->{'styledes'}</a></nobr><br />\n";
}
$ret .= ".";
return $ret;
}
_code?><?_c <LJDEP>
link: htdocs/styles/browse/styleinfo.bml, htdocs/customview.cgi
</LJDEP> _c?>

View File

@@ -0,0 +1,9 @@
<FORM TARGET="links" ACTION="links.bml" METHOD=GET>
View styles of user:
<INPUT NAME="user" VALUE="system" SIZE=15 MAXLENGTH=15>
<BR>
<INPUT TYPE="SUBMIT" VALUE="Preview">
</FORM> <?_c <LJDEP>
form: htdocs/styles/browse/links.bml
</LJDEP> _c?>

View File

@@ -0,0 +1,45 @@
<?_code
my $styleid = $FORM{'styleid'}+0;
my $remote = LJ::get_remote();
my $sty = LJ::S1::get_style($styleid);
my $styu = LJ::load_user($sty->{user}) if $sty; # if $sty so we don't auto-vivify!
return "Style $styleid does not exist or is not public."
unless $sty &&
($sty->{is_public} eq 'Y' || # straight up public
LJ::u_equals($remote, $styu) || # is this your account?
LJ::can_manage($remote, $styu) || # how about your community?
LJ::check_priv($remote, 'canview', 'styles') || # can you see private styles?
LJ::check_priv($remote, 'canview', '*')); # or maybe you can see everything
my $ret = "";
$ret .= "<H1>Style Info</H1>\n";
$ret .= "<DL>\n";
$ret .= "<DT><B>Author</B><DD><A TARGET=_top HREF=\"$LJ::SITEROOT/userinfo.bml?user=$sty->{'user'}\">$sty->{'user'}</A>\n";
$ret .= "<DT><B>Style Description</B><DD>$sty->{'styledes'}<BR>\n";
$ret .= "<DT><B>Last Updated</B><DD>$sty->{'lastupdate'}<BR>\n";
$ret .= "<DT><B>View Type</B><DD>$sty->{'type'}<BR>\n";
$ret .= "<DT><B>Public?</B><DD>$sty->{'is_public'}<BR>\n";
$ret .= "<DT><B>Embeddable?</B><DD>$sty->{'is_embedded'}<BR>\n";
$ret .= "<DT><B>Color-free? (only uses color themes, not fixed colors)</B><DD>$sty->{'is_colorfree'}<BR>\n";
$ret .= "</DL>";
my %vars;
LJ::parse_vars(\$sty->{'formatdata'}, \%vars);
$ret .= "<H1>Style Variables</H1>\n";
foreach my $v (sort keys %vars) {
$ret .= "<H2>$v</H2>\n";
my $val = LJ::ehtml($vars{$v});
$val =~ s/\n/<BR>\n/g;
$ret .= $val;
}
return $ret;
_code?><?_c <LJDEP>
link: htdocs/userinfo.bml
</LJDEP> _c?>