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,96 @@
<html>
<head>
<title>Friends Page</title>
<meta name="viewport" content="width = 320" />
</head>
<body>
<p><?_code
{
use vars qw (%GET);
my $u = LJ::get_remote();
return "<?needlogin?>"
unless $u;
my $itemsperpage = 50;
my $ret;
my $skip = $GET{skip}+0 || 0;
my $prevcount = $skip + $itemsperpage;
my $nextcount = $skip ? $skip - $itemsperpage : -1;
my $nextlink = $nextcount != -1 ? " | <a href='?skip=$nextcount'>Next $itemsperpage &gt;&gt;</a>" : '';
my $prevlink = "<a href='?skip=$prevcount'>&lt;&lt; Previous $itemsperpage</a>";
# Filter first to a "Mobile View" friends group if they have one,
# then fall back to "Default View", and then just show them everything
my $filter;
my $groupname = "All friends";
foreach ("Mobile View", "Default View") {
if (my $grp = LJ::get_friend_group($u, { 'name' => $_ })) {
$groupname = $_;
$filter = 1 << $grp->{'groupnum'};
last;
}
}
$ret = qq {
<a href='./'>&lt;&lt; Back</a> to LiveJournal Mobile.
<div style="font-size: 16pt; font-weight: bold; margin: 0.8em;">Friends Page</div>
<div style="margin: 1em;">
<div style="font-weight: bold;">Viewing: $groupname</div>
<div>$prevlink$nextlink</div><br/>
</div>
};
sub New;
my %friends;
my @items = LJ::get_friend_items({
'remote' => $u,
'itemshow' => $itemsperpage,
'skip' => $skip,
'showtypes' => 'PYC',
'u' => $u,
'filter' => $filter,
'friends_u' => \%friends,
});
# how many characters to truncate entry at
my $max_entry_length = 400;
foreach my $ei (@items) {
next unless $ei;
# my $entry;
# if ($ei->{'ditemid'}) {
# $entry = LJ::Entry->new($ei->{'journalid'},
# ditemid => $ei->{'ditemid'});
# } elsif ($ei->{'jitemid'} && $ei->{'anum'}) {
# $entry = LJ::Entry->new($ei->{'journalid'},
# jitemid => $ei->{'jitemid'},
# anum => $ei->{'anum'});
# }
# next unless $entry;
# my $pu = $entry->poster;
# my $ju = $entry->journal;
# my $url = $entry->url;
# $url .= "?format=light";
# my $who = "<a href='" . $pu->journal_base . "/'><b>$pu->{user}</b></a>";
# if ($pu->{userid} != $ju->{userid}) {
# $who .= " in " . "<a href='" . $ju->journal_base . "/'><b>$ju->{user}</b></a>";
# }
# $ret .= "$who: " . "<a href='$url'>" . ($entry->subject_text || "(no subject)") . "</a><br />";
}
return $ret;
}
_code?>
</body>
</html>

View File

@@ -0,0 +1,42 @@
<html>
<head>
<title><?_code return $LJ::SITENAMESHORT; _code?> Mobile</title>
<meta name="viewport" content="width = 320" />
</head>
<body>
<h1><?_code return $LJ::SITENAMESHORT; _code?> Mobile</h1>
<p><?_code
{
my $u = LJ::get_remote();
my $ret = "";
$ret .= $u ? "Hello, <b>" . $u->display_name . "</b>!\n" : "";
$ret .= "<p>Welcome to the mobile version of $LJ::SITENAMESHORT.</p>"
unless $u;
$ret .= "<h2>Options:</h2><ul>";
unless ($u) {
$ret .= <<OPTS
<li><a href="login.bml">Log in</a> -- required</li>
OPTS
}
if ($u) {
$ret .= "<li><a href='login.bml'>Log in</a> -- you're currently logged in as ";
$ret .= $u->display_name . "</li>";
$ret .= '<li><a href="post.bml">Post to LiveJournal</a></li>'
unless $u->{'journaltype'} eq 'I';
$ret .= '<li><a href="friends.bml">Read friends page</a></li>';
}
return $ret;
}
_code?>
</ul>
</body>
</html>

View File

@@ -0,0 +1,70 @@
<?_code
{
use strict;
use vars qw(%POST);
return "" unless LJ::did_post();
my $err = sub {
BML::finish();
return $_[0];
};
my $u = LJ::load_user($POST{user})
or return $err->("Invalid username");
my ($banned, $ok);
$ok = LJ::auth_okay($u, $POST{password}, undef, undef, \$banned);
if ($banned) {
return $err->("Your IP address is temporarily banned for exceeding the login failure rate.");
}
unless ($ok) {
return $err->("Bad password");
}
my $etime = time() + 60*60*24*60;
my $sess_opts = {
'exptype' => 'long',
'ipfixed' => 0,
};
$u->make_login_session('long');
return BML::redirect("$LJ::SITEROOT/mobile/?t=" . time());
}
_code?>
<html>
<head>
<meta name="viewport" content="width = 320" />
<style>
h2 { font-size: 110%; text-decoration: underline; padding-bottom: 0; margin-bottom: 0.2em; }
p { margin-top: 0.3em; }
form { margin-left: 2em; }
</style>
</head>
<body>
<a href="./">&lt;&lt; Back</a> to LiveJournal Mobile.
<h1>Login</h1>
<h2>SSL secure login</h2>
<p>Secure using SSL, but may not work on all mobile devices:</p>
<form method='post' action='<?_code return $LJ::SSLROOT _code?>/mobile/login.bml'>
Username: <input name='user' size='15' /><br />
Password: <input name='password' type='password' size='15' />
<input type='submit' value="Login" />
</form>
<h2>Insecure basic login</h2>
<p>This sends your password unprotected, probably over the air. Not a good idea on Wifi. Probably okay over a mobile carrier's data network.</p>
<form method='post' action='<?_code return $LJ::SITEROOT _code?>/mobile/login.bml'>
Username: <input name='user' size='15' /><br />
Password: <input name='password' type='password' size='15' />
<input type='submit' value="Login" />
</form>
</body>
</html>

View File

@@ -0,0 +1,105 @@
<?_info
nocache=>1
_info?><?_code
{
use strict;
use vars qw(%POST $u $res);
my $err = sub {
BML::finish();
return $_[0];
};
$u = LJ::get_remote()
or return $err->("You must <a href='login.bml'>log in</a> before posting.");
$res = LJ::Protocol::do_request("login", {
"ver" => $LJ::PROTOCOL_VER,
"username" => $u->{'user'},
"getpickws" => 1,
}, undef, {
"noauth" => 1,
"u" => $u,
});
return "" unless LJ::did_post();
return "<b>$ML{'Error'}</b> $ML{'error.invalidform'}" unless LJ::check_form_auth();
my $event = LJ::Util::blogger_deserialize($POST{'event'});
my $journal = $POST{'usejournal'};
my $sec = $POST{'security'};
my $allowmask = undef;
if ($sec eq "friends") {
$sec = "usemask";
$allowmask = 1;
}
my $req = {
'usejournal' => $journal ne $u->{user} ? $journal : undef,
'ver' => 1,
'username' => $u->{'user'},
'password' => $u->{'password'},
'event' => $event->{'event'},
'subject' => $POST{'subject'},
'props' => $event->{'props'},
'tz' => 'guess',
'security' => $sec,
'allowmask' => $allowmask,
};
my $errcode;
my $res = LJ::Protocol::do_request("postevent", $req, \$errcode);
if ($errcode) {
return $err->("Error posting: " . LJ::Protocol::error_message($errcode));
}
my $url = $res->{url};
BML::finish();
my $ret = "";
$ret .= "<a href='./'>&lt;&lt; Back</a> to LiveJournal Mobile.</a><h1>Success!</h1>";
$ret .= "Posted. Available <a href='$url'>here</a>.";
return $ret;
}
_code?>
<html>
<head>
<meta name="viewport" content="width = 320" />
<style>
</style>
</head>
<body>
<a href="./">&lt;&lt; Back</a> to LiveJournal Mobile.
<h1>Post</h1>
<form method='post' action='/mobile/post.bml'>
<?_code { return LJ::form_auth(); } _code?>
Subject:<br />
<input name='subject' size='50' style='width: 90%' /><br />
Post:<br />
<textarea rows='10' cols='40' name='event' wrap='virtual' style='width: 90%'></textarea><br />
Security: <?_code {
my @secs = ("public", BML::ml('label.security.public'), "private", BML::ml('label.security.private'),
"friends", BML::ml('label.security.friends'));
return LJ::html_select({ 'name' => 'security',
'selected' => "public" }, @secs);
} _code?><br />
<hr />
<center>
<input type='submit' value="Post" /> to <?_code
{
return LJ::html_select({ 'name' => 'usejournal', },
"", $u->{'user'},
map { $_, $_ } @{$res->{'usejournals'} || []});
}_code?>
</center>
</form>
</body>
</html>