Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

In this commit...

comments.pl
-----------

-  All instances of '-1' and '5' when it comes to comment
scores have been changed to $I{comment_minscore} and
$I{comment_maxscore} respectively. The appropriate entries have been
entered into slashdotrc.pl

- Multiple moderation on one comment by the same user is now disallowed.


admin.pl
--------

- When editing a story, that story's title now appears in the brower's
titlebar.


index.pl
--------

- Section articles appearing on main page now have an ADDITIONAL link to
the section's homepage on the "Read More" line.


submit.pl
---------

- When editing a submission, that submission's title (and eventually,
the name of the story it will become) now appears in the browser's
titlebar. This is useful for admins who open lots of windows at once
when dealing with submissions and like to cover most of the window or
roll it up and yet still see what window belongs to what operation.


Slash.pm
--------

- Moderation used to be allowed if an author was logged in as an AUTHOR but
not as a user. Now moderation form elements will NOT show for any UID
that is not positive.
  • Loading branch information...
commit c94e287cb024d93e4ec5ed20d42d7d86e887d4dd 1 parent b7a1f2b
@Xliff Xliff authored
View
12 CHANGES
@@ -22,6 +22,18 @@ slash-1.0.6, 2000.06.xx
with formkeys in submission and comment posting forms
in Slash.pm, comments.pl
+* Fixed bug that allowed users to moderate a single comment more
+ than once.
+
+* Submission titles are now shown on the browser's titlebar.
+
+* Section articles appearing on the main index now also have a link
+ to the section's home page by the "Read More" link. (Suggested by
+ Russ Nelson)
+
+* Fixed bug where authors could moderate if they were logged in as
+ authors, but not logged in as a registered user.
+
slash-1.0.5, 2000.06.13
-----------------------
View
8 Slash.pm
@@ -2003,7 +2003,7 @@ EOT
print "\n\t</TD></TR>\n" if $lvl; # || ($I{U}{mode} eq "nested" and $lvl);
print $lcp;
- print <<EOT if $I{U}{aseclev} || $I{U}{points};
+ print <<EOT if ($I{U}{aseclev} || $I{U}{points}) && $I{U}{uid} > 0;
<TR><TD>
<P>Have you read the
<A HREF="$I{rootdir}/moderation.shtml">Moderator Guidelines</A>
@@ -2260,11 +2260,13 @@ EOT
subject => 'Parent'
}, $pid);
- if (( $I{U}{willing}
+ # UID -MUST- be positive for moderator access.
+ if ((( $I{U}{willing}
&& $I{U}{points} > 0
&& $C->{uid} ne $I{U}{uid}
&& $C->{lastmod} ne $I{U}{uid})
- || ($I{U}{aseclev} > 99 && $I{authors_unlimited})) {
+ || ($I{U}{aseclev} > 99 && $I{authors_unlimited}))
+ && $I{U}{uid} > 0) {
my $o;
foreach (0 .. @{$I{reasons}} - 1) {
View
20 plugins/Submit/submit.pl
@@ -28,6 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
+use HTML::Entities;
#################################################################
sub main {
@@ -47,8 +48,15 @@ sub main {
$I{F}{subj} = stripByMode($I{F}{subj}) if $I{F}{subj};
$I{F}{email} = stripByMode($I{F}{email}) if $I{F}{email};
+ # Show submission title on browser's titlebar.
+ my($tbtitle) = $I{F}{title};
+ if ($tbtitle) {
+ $tbtitle =~ s/^"?(.+?)"?$/"$1"/;
+ $tbtitle = "- $tbtitle";
+ }
+
$section = "admin" if $seclev > 100;
- header("$I{sitename} Submissions", $section);
+ header("$I{sitename} Submissions$tbtitle", $section);
# print "from $I{F}{from} email $I{F}{email} subject $I{F}{subj}<BR>\n";
#adminMenu() if $seclev > 100;
@@ -406,20 +414,24 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
my @strs = (substr($subj, 0, 35), substr($name, 0, 20), substr($email, 0, 20));
+ # Adds proper section for form editor.
my $sec = $section ne $I{defaultsection} ? "&section=$section" : "";
- printf(($admin ? <<ADMIN : <<USER), @strs);
+ $HTML::Entities::char2entity{' '} = '+';
+ my $stitle = '&title=' . encode_entities($strs[0], '<>&" ');
+ printf(($admin ? <<ADMIN : <<USER), @strs);
</FONT><INPUT TYPE="CHECKBOX" NAME="del_$subid">
</NOBR></TD><TD>$ptime</TD><TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$sec">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle$sec">%s&nbsp;</A>
</TD><TD><FONT SIZE="2">%s$karma<BR>%s</FONT></TD></TR>
ADMIN
<TD>\u$section</TD><TD>$ptime</TD>
<TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle">%s&nbsp;</A>
</TD><TD><FONT SIZE="-1">%s<BR>%s</FONT></TD></TR>
<TR><TD COLSPAN="6"><IMG SRC="$I{imagedir}/pix.gif" ALT="" HEIGHT="3"></TD></TR>
USER
+
}
my $quik = $I{F}{note} eq "Quik" ? <<EOT : '';
View
20 public_html/admin.pl
@@ -28,13 +28,25 @@
use vars '%I';
use Image::Size;
use Slash;
+use HTML::Entities;
sub main {
*I = getSlashConf();
getSlash();
getSection('admin');
- header("backSlash $I{U}{tzcode} $I{U}{offset}", 'admin');
+ my($tbtitle);
+ if ($I{F}{op} =~ /^preview|edit$/ && $I{F}{title}) {
+ # Show submission title on browser's titlebar.
+ $tbtitle = $I{F}{title};
+ $tbtitle =~ s/"/'/g;
+ $tbtitle = " - \"$tbtitle\"";
+ # Undef the form title value if we have SID defined since the editor
+ # will have to get it from the database anyways.
+ undef $I{F}{title} if $I{F}{sid} && $I{F}{op} eq 'edit';
+ }
+
+ header("backSlash $I{U}{tzcode} $I{U}{offset}$tbtitle", 'admin');
# Admin Menu
print "<P>&nbsp;</P>" unless $I{U}{aseclev};
@@ -1185,6 +1197,8 @@ sub editstory {
my @extracolumns = sqlSelectColumns($S->{section})
if sqlTableExists($S->{section});
+ # This may cause problems w/ browsers that don't decode their form
+ # fields.
$S->{introtext} =~ s/&/&amp;/g;
$S->{bodytext} =~ s/&/&amp;/g;
my $SECT = getSection($S->{section});
@@ -1353,7 +1367,9 @@ sub listStories {
print qq[\t<TR BGCOLOR="$bgcolor"><TD ALIGN="RIGHT">\n];
if ($I{U}{aid} eq $aid || $I{U}{aseclev} > 100) {
- print qq!\t\t[<A HREF="$ENV{SCRIPT_NAME}?op=edit&sid=$sid">$x</A>\n]!;
+ $HTML::Entities::char2entity{' '} = '+';
+ my($tbtitle) = encode_entities($title, '<>&" ');
+ print qq!\t\t[<A HREF="$ENV{SCRIPT_NAME}?title=$tbtitle&op=edit&sid=$sid">$x</A>\n]!;
} else {
print "\t\t[$x]\n"
View
39 public_html/comments.pl
@@ -653,8 +653,8 @@ sub submitComment {
$pts-- if $I{U}{karma} < -10;
$pts++ if $I{U}{karma} > 25 and !$I{F}{nobonus};
# Enforce proper ranges on comment points.
- $pts = -1 if $pts < -1;
- $pts = 5 if $pts > 5;
+ $pts = $I{comment_minscore} if $pts < $I{comment_minscore};
+ $pts = $I{comment_maxscore} if $pts > $I{comment_maxscore};
}
$I{dbh}->do("LOCK TABLES comments WRITE");
@@ -806,6 +806,15 @@ sub moderateCid {
"cid=$cid and sid='$sid'"
);
+ my($mid) = sqlSelect(
+ "id", "moderatorlog",
+ "uid=$I{U}{uid} and cid=$cid and sid='$sid'"
+ );
+ if ($mid) {
+ print "<LI>$subj ($sid-$cid, <B>Already moderated</B>)</LI>";
+ return;
+ }
+
my $modreason = $reason;
my $val = "-1";
if ($reason == 9) { # Overrated
@@ -820,6 +829,24 @@ sub moderateCid {
$val = "+1";
}
+ my $scorecheck = $points + $val;
+ # If the resulting score is out of comment score range, no further actions
+ # need be performed.
+ if ($scorecheck < $I{comment_minscore} || $scorecheck > $I{comment_maxscore}) {
+ # We should still log the attempt.
+ sqlInsert("moderatorlog", {
+ uid => $I{U}{uid},
+ val => $val,
+ sid => $sid,
+ cid => $cid,
+ reason => $modreason,
+ -ts => 'now()'
+ });
+
+ print "<LI>$subj ($sid-$cid, <B>Comment already at limit</B>)</LI>";
+ return;
+ }
+
my $strsql = "UPDATE comments SET
points=points$val,
reason=$reason,
@@ -827,9 +854,8 @@ sub moderateCid {
WHERE sid=" . $I{dbh}->quote($sid)."
AND cid=$cid
AND points " .
- ($val < 0 ? " > -1" : "") .
- ($val > 0 ? " < 5" : "");
-
+ ($val < 0 ? " > $I{comment_minscore}" : "") .
+ ($val > 0 ? " < $I{comment_maxscore}" : "");
$strsql .= " AND lastmod<>$I{U}{uid}"
unless $I{U}{aseclev} > 99 && $I{authors_unlimited};
@@ -926,7 +952,8 @@ sub undoModeration {
);
# Insure scores still fall within the proper boundaries
- my $scorelogic = $val < 0 ? "points < 5" : "points > -1";
+ my $scorelogic = $val < 0 ? "points < $I{comment_maxscore}" :
+ "points > $I{comment_minscore}";
sqlUpdate(
"comments",
{ -points => "points+" . (-1 * $val) },
View
5 public_html/index.pl
@@ -256,6 +256,11 @@ sub displayStories {
print ' </B>comment', $cc > 1 ? 's' : '' if $cc;
}
+
+ if ($thissection ne $I{defaultsection}) {
+ my($SEC) = getSection($thissection);
+ print qq' | <A HREF="$I{rootdir}/$thissection/">$SEC->{title}</A>';
+ }
print qq' | <A HREF="$I{rootdir}/admin.pl?op=edit&sid=$sid">Edit</A>'
if $I{U}{aseclev} > 100;
View
20 public_html/submit.pl
@@ -28,6 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
+use HTML::Entities;
#################################################################
sub main {
@@ -47,8 +48,15 @@ sub main {
$I{F}{subj} = stripByMode($I{F}{subj}) if $I{F}{subj};
$I{F}{email} = stripByMode($I{F}{email}) if $I{F}{email};
+ # Show submission title on browser's titlebar.
+ my($tbtitle) = $I{F}{title};
+ if ($tbtitle) {
+ $tbtitle =~ s/^"?(.+?)"?$/"$1"/;
+ $tbtitle = "- $tbtitle";
+ }
+
$section = "admin" if $seclev > 100;
- header("$I{sitename} Submissions", $section);
+ header("$I{sitename} Submissions$tbtitle", $section);
# print "from $I{F}{from} email $I{F}{email} subject $I{F}{subj}<BR>\n";
#adminMenu() if $seclev > 100;
@@ -406,20 +414,24 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
my @strs = (substr($subj, 0, 35), substr($name, 0, 20), substr($email, 0, 20));
+ # Adds proper section for form editor.
my $sec = $section ne $I{defaultsection} ? "&section=$section" : "";
- printf(($admin ? <<ADMIN : <<USER), @strs);
+ $HTML::Entities::char2entity{' '} = '+';
+ my $stitle = '&title=' . encode_entities($strs[0], '<>&" ');
+ printf(($admin ? <<ADMIN : <<USER), @strs);
</FONT><INPUT TYPE="CHECKBOX" NAME="del_$subid">
</NOBR></TD><TD>$ptime</TD><TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$sec">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle$sec">%s&nbsp;</A>
</TD><TD><FONT SIZE="2">%s$karma<BR>%s</FONT></TD></TR>
ADMIN
<TD>\u$section</TD><TD>$ptime</TD>
<TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle">%s&nbsp;</A>
</TD><TD><FONT SIZE="-1">%s<BR>%s</FONT></TD></TR>
<TR><TD COLSPAN="6"><IMG SRC="$I{imagedir}/pix.gif" ALT="" HEIGHT="3"></TD></TR>
USER
+
}
my $quik = $I{F}{note} eq "Quik" ? <<EOT : '';
View
2  slashdotrc.pl
@@ -74,6 +74,8 @@
# The following variables can be used to tweak your Slash Moderation
authors_unlimited => 1, # authors have unlimited moderation
+ comment_minscore => -1, # Minimum score for a specific comment.
+ comment_maxscore => 5, # Maximum score for a specific comment.
metamod_sum => 3, # sum of moderations 1 for release
maxtokens => 40, # Token threshold that must be hit to get any points
tokensperpoint => 8, # Number of tokens per point
View
20 themes/slashcode/htdocs/admin.pl
@@ -28,13 +28,25 @@
use vars '%I';
use Image::Size;
use Slash;
+use HTML::Entities;
sub main {
*I = getSlashConf();
getSlash();
getSection('admin');
- header("backSlash $I{U}{tzcode} $I{U}{offset}", 'admin');
+ my($tbtitle);
+ if ($I{F}{op} =~ /^preview|edit$/ && $I{F}{title}) {
+ # Show submission title on browser's titlebar.
+ $tbtitle = $I{F}{title};
+ $tbtitle =~ s/"/'/g;
+ $tbtitle = " - \"$tbtitle\"";
+ # Undef the form title value if we have SID defined since the editor
+ # will have to get it from the database anyways.
+ undef $I{F}{title} if $I{F}{sid} && $I{F}{op} eq 'edit';
+ }
+
+ header("backSlash $I{U}{tzcode} $I{U}{offset}$tbtitle", 'admin');
# Admin Menu
print "<P>&nbsp;</P>" unless $I{U}{aseclev};
@@ -1185,6 +1197,8 @@ sub editstory {
my @extracolumns = sqlSelectColumns($S->{section})
if sqlTableExists($S->{section});
+ # This may cause problems w/ browsers that don't decode their form
+ # fields.
$S->{introtext} =~ s/&/&amp;/g;
$S->{bodytext} =~ s/&/&amp;/g;
my $SECT = getSection($S->{section});
@@ -1353,7 +1367,9 @@ sub listStories {
print qq[\t<TR BGCOLOR="$bgcolor"><TD ALIGN="RIGHT">\n];
if ($I{U}{aid} eq $aid || $I{U}{aseclev} > 100) {
- print qq!\t\t[<A HREF="$ENV{SCRIPT_NAME}?op=edit&sid=$sid">$x</A>\n]!;
+ $HTML::Entities::char2entity{' '} = '+';
+ my($tbtitle) = encode_entities($title, '<>&" ');
+ print qq!\t\t[<A HREF="$ENV{SCRIPT_NAME}?title=$tbtitle&op=edit&sid=$sid">$x</A>\n]!;
} else {
print "\t\t[$x]\n"
View
39 themes/slashcode/htdocs/comments.pl
@@ -653,8 +653,8 @@ sub submitComment {
$pts-- if $I{U}{karma} < -10;
$pts++ if $I{U}{karma} > 25 and !$I{F}{nobonus};
# Enforce proper ranges on comment points.
- $pts = -1 if $pts < -1;
- $pts = 5 if $pts > 5;
+ $pts = $I{comment_minscore} if $pts < $I{comment_minscore};
+ $pts = $I{comment_maxscore} if $pts > $I{comment_maxscore};
}
$I{dbh}->do("LOCK TABLES comments WRITE");
@@ -806,6 +806,15 @@ sub moderateCid {
"cid=$cid and sid='$sid'"
);
+ my($mid) = sqlSelect(
+ "id", "moderatorlog",
+ "uid=$I{U}{uid} and cid=$cid and sid='$sid'"
+ );
+ if ($mid) {
+ print "<LI>$subj ($sid-$cid, <B>Already moderated</B>)</LI>";
+ return;
+ }
+
my $modreason = $reason;
my $val = "-1";
if ($reason == 9) { # Overrated
@@ -820,6 +829,24 @@ sub moderateCid {
$val = "+1";
}
+ my $scorecheck = $points + $val;
+ # If the resulting score is out of comment score range, no further actions
+ # need be performed.
+ if ($scorecheck < $I{comment_minscore} || $scorecheck > $I{comment_maxscore}) {
+ # We should still log the attempt.
+ sqlInsert("moderatorlog", {
+ uid => $I{U}{uid},
+ val => $val,
+ sid => $sid,
+ cid => $cid,
+ reason => $modreason,
+ -ts => 'now()'
+ });
+
+ print "<LI>$subj ($sid-$cid, <B>Comment already at limit</B>)</LI>";
+ return;
+ }
+
my $strsql = "UPDATE comments SET
points=points$val,
reason=$reason,
@@ -827,9 +854,8 @@ sub moderateCid {
WHERE sid=" . $I{dbh}->quote($sid)."
AND cid=$cid
AND points " .
- ($val < 0 ? " > -1" : "") .
- ($val > 0 ? " < 5" : "");
-
+ ($val < 0 ? " > $I{comment_minscore}" : "") .
+ ($val > 0 ? " < $I{comment_maxscore}" : "");
$strsql .= " AND lastmod<>$I{U}{uid}"
unless $I{U}{aseclev} > 99 && $I{authors_unlimited};
@@ -926,7 +952,8 @@ sub undoModeration {
);
# Insure scores still fall within the proper boundaries
- my $scorelogic = $val < 0 ? "points < 5" : "points > -1";
+ my $scorelogic = $val < 0 ? "points < $I{comment_maxscore}" :
+ "points > $I{comment_minscore}";
sqlUpdate(
"comments",
{ -points => "points+" . (-1 * $val) },
View
5 themes/slashcode/htdocs/index.pl
@@ -256,6 +256,11 @@ sub displayStories {
print ' </B>comment', $cc > 1 ? 's' : '' if $cc;
}
+
+ if ($thissection ne $I{defaultsection}) {
+ my($SEC) = getSection($thissection);
+ print qq' | <A HREF="$I{rootdir}/$thissection/">$SEC->{title}</A>';
+ }
print qq' | <A HREF="$I{rootdir}/admin.pl?op=edit&sid=$sid">Edit</A>'
if $I{U}{aseclev} > 100;
View
20 themes/slashcode/htdocs/submit.pl
@@ -28,6 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
+use HTML::Entities;
#################################################################
sub main {
@@ -47,8 +48,15 @@ sub main {
$I{F}{subj} = stripByMode($I{F}{subj}) if $I{F}{subj};
$I{F}{email} = stripByMode($I{F}{email}) if $I{F}{email};
+ # Show submission title on browser's titlebar.
+ my($tbtitle) = $I{F}{title};
+ if ($tbtitle) {
+ $tbtitle =~ s/^"?(.+?)"?$/"$1"/;
+ $tbtitle = "- $tbtitle";
+ }
+
$section = "admin" if $seclev > 100;
- header("$I{sitename} Submissions", $section);
+ header("$I{sitename} Submissions$tbtitle", $section);
# print "from $I{F}{from} email $I{F}{email} subject $I{F}{subj}<BR>\n";
#adminMenu() if $seclev > 100;
@@ -406,20 +414,24 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
my @strs = (substr($subj, 0, 35), substr($name, 0, 20), substr($email, 0, 20));
+ # Adds proper section for form editor.
my $sec = $section ne $I{defaultsection} ? "&section=$section" : "";
- printf(($admin ? <<ADMIN : <<USER), @strs);
+ $HTML::Entities::char2entity{' '} = '+';
+ my $stitle = '&title=' . encode_entities($strs[0], '<>&" ');
+ printf(($admin ? <<ADMIN : <<USER), @strs);
</FONT><INPUT TYPE="CHECKBOX" NAME="del_$subid">
</NOBR></TD><TD>$ptime</TD><TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$sec">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle$sec">%s&nbsp;</A>
</TD><TD><FONT SIZE="2">%s$karma<BR>%s</FONT></TD></TR>
ADMIN
<TD>\u$section</TD><TD>$ptime</TD>
<TD>
- <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}">%s&nbsp;</A>
+ <A HREF="$ENV{SCRIPT_NAME}?op=viewsub&subid=$subid&note=$I{F}{note}$stitle">%s&nbsp;</A>
</TD><TD><FONT SIZE="-1">%s<BR>%s</FONT></TD></TR>
<TR><TD COLSPAN="6"><IMG SRC="$I{imagedir}/pix.gif" ALT="" HEIGHT="3"></TD></TR>
USER
+
}
my $quik = $I{F}{note} eq "Quik" ? <<EOT : '';
Please sign in to comment.
Something went wrong with that request. Please try again.