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 @@
 

View File

@@ -0,0 +1,34 @@
<?page
title=>Topic Directory Administration
body<=
<?_code
use strict;
my $ret;
my $remote = LJ::get_remote();
if (LJ::remote_has_priv($remote, "topicaddtopic")) {
$ret .= "<P><A HREF=\"screentop.bml\"><B>Screen Topic Submissions</B></A> that are awaiting approval into a category.";
}
if (LJ::remote_has_priv($remote, "topicscreencat")) {
$ret .= "<P><A HREF=\"screen.html\"><B>Screen Entry Submissions</B></A> that are awaiting approval into a topic.";
}
unless ($ret) {
$ret .= "You have no administrative priviledges in this area, or you are not logged in.";
}
return $ret;
_code?>
<=body
page?><?_c <LJDEP>
link: htdocs/admin/topics/screentop.bml, htdocs/admin/topics/screen.html
</LJDEP> _c?>

View File

@@ -0,0 +1,30 @@
<?_code
return "This page is old and uses a horrendous database query. It won't likely return.";
my $user = $FORM{'user'};
my $dbh = LJ::get_db_writer();
my $sth = $dbh->prepare("SELECT styleid, user, styledes, type, is_embedded, is_colorfree FROM style WHERE is_public='Y' ORDER BY user");
$sth->execute;
my $ret = "";
my $last = "";
while ($sty = $sth->fetchrow_hashref) {
if ($last ne $sty->{'user'}) {
$last = $sty->{'user'};
$ret .= "<B>$last</B><BR>\n";
}
if ($user) {
$ret .= "&nbsp;&nbsp;- <A TARGET=\"main\" HREF=\"/customview.cgi?styleid=$sty->{'styleid'}&amp;user=$user\">$sty->{'styledes'}</A><BR>\n";
} else {
$ret .= "&nbsp;&nbsp;- <A TARGET=\"main\" HREF=\"styleinfo.bml?styleid=$sty->{'styleid'}\">$sty->{'styledes'}</A><BR>\n";
}
}
return $ret;
_code?><?_c <LJDEP>
link: htdocs/customview.cgi, htdocs/admin/topics/styleinfo.bml
</LJDEP> _c?>

View File

@@ -0,0 +1,17 @@
<HTML>
<HEAD>
<TITLE>Topic Directory Administration</TITLE>
</HEAD>
<FRAMESET COLS="150,100%">
<FRAME NAME="links" SRC="screen_links.bml">
<FRAME NAME="main" SRC="screen_instructions.bml">
</FRAMESET>
</HTML>
<!--
<?_c <LJDEP>
post: htdocs/admin/topics/screen_links.bml, htdocs/admin/topics/screen_instructions.bml
</LJDEP> _c?>
-->

View File

@@ -0,0 +1,50 @@
<?_code
use strict;
use vars qw(%FORM);
my $remote = LJ::get_remote();
return $ML{'error.noremote'} unless $remote;
return "You don't have access to do this."
unless LJ::remote_has_priv($remote, "topicscreencat");
my $dbh = LJ::get_db_writer();
my $ret;
foreach my $field (keys %FORM)
{
my $act = $FORM{$field};
next if ($act eq "L");
next unless ($field =~ /^action:(\d+):(\d+)$/);
my $topid = $1;
my $itemid = $2;
if ($act eq "A") {
my $sth = $dbh->prepare("UPDATE topic_map SET status='on', screendate=NOW(), " .
"screenuserid=? WHERE tptopid=? AND itemid=? AND status='new'");
$sth->execute($remote->{'userid'}, $topid, $itemid);
if ($sth->rows) {
$ret .= "<b>$itemid</b> approved.<br />\n";
} else {
$ret .= "<b>$itemid</b> already acted on.<br />\n";
}
}
if ($act eq "D") {
my $sth = $dbh->prepare("UPDATE topic_map SET status='deny', screendate=NOW(), " .
"screenuserid=? WHERE tptopid=? AND itemid=? AND status='new'");
$sth->execute($remote->{'userid'}, $topid, $itemid);
if ($sth->rows) {
$ret .= "<B>$itemid</B> denied.<BR>\n";
} else {
$ret .= "<B>$itemid</B> already acted on.<BR>\n";
}
}
}
return $ret;
_code?><?_c <LJDEP>
# None
</LJDEP> _c?>

View File

@@ -0,0 +1,6 @@
Click an item on the left and it will appear here. Read it, decide if it's applicable to the category, and then select "Approve" or "Deny".
<!--
<?_c <LJDEP>
# None
</LJDEP> _c?>
-->

View File

@@ -0,0 +1,106 @@
<?_code
my ($ret, $sth);
my $remote = LJ::get_remote();
my %cataccess;
unless (LJ::remote_has_priv($remote, "topicscreencat", \%cataccess)) {
return "You don't have access to do this, or you're not logged in.";
}
my $dbh = LJ::get_db_writer();
my $and_cat_in = "";
unless ($cataccess{'all'}) {
my $in = join(", ", map { $dbh->quote($_); } keys %cataccess);
$and_cat_in = "AND tl.tpcatid IN ($in)";
}
$sth = $dbh->prepare("SELECT tm.tpmapid, tm.tptopid, tm.itemid FROM topic_map tm, topic_list tl WHERE tm.tptopid=tl.tptopid AND tm.status='new' $and_cat_in LIMIT 50");
$sth->execute;
if ($dbh->err) { return $dbh->errstr; }
my %topic;
while (my $map = $sth->fetchrow_hashref)
{
push @maps, $map;
$topic{$map->{'tptopid'}} = undef;
}
unless (@maps) {
return "<B>Empty!</B> ... no items are awaiting approval";
}
my $top_in = join(",", keys %topic);
$sth = $dbh->prepare("SELECT tptopid, tpcatid, topname FROM topic_list WHERE tptopid IN ($top_in)");
$sth->execute;
if ($dbh->err) { return $dbh->errstr; }
my %cat;
while (my $top = $sth->fetchrow_hashref)
{
$topic{$top->{'tptopid'}} = $top;
$cat{$top->{'tpcatid'}} = undef;
}
my $cat_in = join(",", keys %cat);
$sth = $dbh->prepare("SELECT tpcatid, parent, catname FROM topic_cats WHERE tpcatid IN ($cat_in)");
$sth->execute;
if ($dbh->err) { return $dbh->errstr; }
while (my $cat = $sth->fetchrow_hashref)
{
$cat{$cat->{'tpcatid'}} = $cat;
}
$ret .= "<FORM METHOD=POST ACTION=\"screen_do.bml\">";
foreach my $map (@maps)
{
my $catid = $topic{$map->{'tptopid'}}->{'tpcatid'};
next unless ($cataccess{'all'} || $cataccess{$catid});
&load_cats_up($catid, \%cat);
$ret .= "<P>";
my $fullcat;
my $catup = $catid;
while ($catup) {
$fullcat = "$cat{$catup}->{'catname'} : $fullcat";
$catup = $cat{$catup}->{'parent'};
}
$fullcat .= $topic{$map->{'tptopid'}}->{'topname'};
$ret .= "<B><FONT SIZE=-1>[$fullcat]</FONT></B>";
$ret .= "<BR><A HREF=\"/talkread.bml?itemid=$map->{'itemid'}\" TARGET=\"main\">$map->{'itemid'}</A>";
my %opts = ("L" => "Leave", "A" => "Approve", "D" => "Deny");
foreach (qw(L A D)) {
$ret .= "<BR><INPUT TYPE=RADIO NAME=\"action:$map->{'tptopid'}:$map->{'itemid'}\" VALUE=\"$_\">$opts{$_}\n";
}
}
$ret .= "<P><INPUT TYPE=SUBMIT VALUE=\"Submit\"></FORM>";
return $ret;
sub load_cats_up
{
my $catid = shift;
my $hashref = shift;
$catid += 0;
while ($catid)
{
unless ($hashref->{$catid}) {
$sth = $dbh->prepare("SELECT parent, catname FROM topic_cats WHERE tpcatid=$catid");
$sth->execute;
my $cat = $sth->fetchrow_hashref;
if ($cat) {
$hashref->{$catid} = $cat;
$catid = $cat->{'parent'}
}
} else {
$catid = $hashref->{$catid}->{'parent'};
}
}
}
_code?><?_c <LJDEP>
link: htdocs/talkpost.bml
post: htdocs/admin/topics/screen_links.bml
</LJDEP> _c?>

View File

@@ -0,0 +1,87 @@
<?page
title=>Screen Topics
body<=
<?_code
my $dbh = LJ::get_db_writer();
my ($ret, $sth);
my $remote = LJ::get_remote();
my %cataccess;
unless (LJ::remote_has_priv($remote, "topicscreencat", \%cataccess)) {
return "You don't have access to do this, or you're not logged in.";
}
my $and_cat_in = "";
unless ($cataccess{'all'}) {
my $in = join(", ", map { $dbh->quote($_); } keys %cataccess);
$and_cat_in = "AND tpcatid IN ($in)";
}
$sth = $dbh->prepare("SELECT tptopid, tpcatid, topname FROM topic_list WHERE status='new' $and_cat_in");
$sth->execute;
if ($dbh->err) { return $dbh->errstr; }
@new = ();
push @new, $_ while ($_ = $sth->fetchrow_hashref);
unless (@new) {
return "<B>Empty!</B> ... no topics are awaiting approval";
}
$ret .= "<FORM METHOD=POST ACTION=\"screentop_do.bml\">";
my $count = 0;
foreach my $new (@new)
{
next if (++$count > 50);
&load_cats_up($new->{'tpcatid'}, \%cat);
$ret .= "<P>";
my $fullcat;
my $catup = $new->{'tpcatid'};
while ($catup) {
$fullcat = "$cat{$catup}->{'catname'} : $fullcat";
$catup = $cat{$catup}->{'parent'};
}
$fullcat =~ s/\s+:\s+$//;
$ret .= "<B><FONT SIZE=-1>[$fullcat]</FONT></B>";
$ret .= "<BR>$new->{'topname'}";
my %opts = ("L" => "Leave", "A" => "Approve", "D" => "Deny");
foreach (qw(L A D)) {
$ret .= "<BR><INPUT TYPE=RADIO NAME=\"action:$new->{'tptopid'}\" VALUE=\"$_\">$opts{$_}\n";
}
}
$ret .= "<P><INPUT TYPE=SUBMIT VALUE=\"Submit\"></FORM>";
return $ret;
sub load_cats_up
{
my $catid = shift;
my $hashref = shift;
$catid += 0;
while ($catid)
{
unless ($hashref->{$catid}) {
$sth = $dbh->prepare("SELECT parent, catname FROM topic_cats WHERE tpcatid=$catid");
$sth->execute;
my $cat = $sth->fetchrow_hashref;
if ($cat) {
$hashref->{$catid} = $cat;
$catid = $cat->{'parent'}
}
} else {
$catid = $hashref->{$catid}->{'parent'};
}
}
}
_code?>
<=body
page?><?_c <LJDEP>
post: htdocs/admin/topics/screentop_do.bml
</LJDEP> _c?>

View File

@@ -0,0 +1,18 @@
<HTML>
<HEAD>
<TITLE>Topic Directory Administration</TITLE>
</HEAD>
<FRAMESET COLS="150,100%">
<FRAME NAME="links" SRC="screen_links.bml">
<FRAME NAME="main" SRC="screen_instructions.bml">
</FRAMESET>
</HTML>
<!--
<?_c <LJDEP>
link: htdocs/admin/topics/screen_links.bml, htdocs/admin/topics/screen_instructions.bml
</LJDEP> _c?>
-->

View File

@@ -0,0 +1,49 @@
<?_code
my $remote = LJ::get_remote();
unless (LJ::remote_has_priv($remote, "topicaddtopic")) {
return "You don't have access to do this, or you're not logged in.";
}
my $dbh = LJ::get_db_writer();
my $sth;
my $ret;
foreach my $field (keys %FORM)
{
next unless ($field =~ /^action:(\d+)$/);
my $act = $FORM{$field};
next if ($act eq "L");
my $topid = $1;
if ($act eq "A") {
$sth = $dbh->prepare("UPDATE topic_list SET status='on' WHERE tptopid=$topid AND status='new'");
$sth->execute;
if ($sth->rows) {
$ret .= "<B>$topid</B> approved.<BR>\n";
} else {
$ret .= "<B>$topid</B> already acted on.<BR>\n";
}
}
if ($act eq "D") {
$sth = $dbh->prepare("UPDATE topic_list SET status='deny' WHERE tptopid=$topid AND status='new'");
$sth->execute;
if ($sth->rows) {
$ret .= "<B>$topid</B> denied.<BR>\n";
} else {
$ret .= "<B>$topid</B> already acted on.<BR>\n";
}
}
}
return $ret;
_code?><?_c <LJDEP>
# None
</LJDEP> _c?>

View File

@@ -0,0 +1,12 @@
<FORM TARGET="links" ACTION="links.bml" METHOD=GET>
Username to preview:
<INPUT NAME="user" SIZE=15 MAXLENGTH=15>
<P><INPUT TYPE="SUBMIT" VALUE="Make links">
</FORM>
<!--
<?_c <LJDEP>
post: htdocs/admin/topics/links.bml
</LJDEP> _c?>
-->