Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor changes. Readded date checking code to admin.pl -- this was ori…

…ginally a patch WAY back to Slash 1.0.2 which got lost in the shuffle.
  • Loading branch information...
commit 8dcac33f49182f57db2ad93ab771356f948327ea 1 parent b9ea1b2
@Xliff Xliff authored
View
2  CHANGES
@@ -12,6 +12,8 @@ slash-1.0.7, 2000.07.xx
* Added fixparam() function (same as fixurl($foo, 1)) and
cleaned up fixurl() to better handle stuff
+* Slash now checks story dates for validity before saves and updates.
+
slash-1.0.6, 2000.07.10
-----------------------
View
10 plugins/Submit/submit.pl
@@ -35,7 +35,6 @@ sub main {
getSlash();
my $id = getFormkeyId($I{U}{uid});
-
my($section, $op, $seclev, $aid) = (
$I{F}{section}, $I{F}{op}, $I{U}{aseclev}, $I{U}{aid}
);
@@ -411,10 +410,13 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
+ # @strs is for DISPLAY purposes, nothing more.
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" : "";
- my $stitle = '&title=' . fixparam($subj);
+ $strs[0] .= '...' if length($subj) > 35;
+
+ # Adds proper section and title for form editor.
+ my $sec = $section ne $I{defaultsection} ? "&section=$section" : '';
+ my $stitle = '&title=' . fixurl($subj, 1);
$stitle =~ s/%/%%/g; # for sprintf
printf(($admin ? <<ADMIN : <<USER), @strs);
View
19 public_html/admin.pl
@@ -26,6 +26,7 @@
use strict;
use lib '../';
use vars '%I';
+use Date::Manip;
use Image::Size;
use Slash;
@@ -1117,13 +1118,15 @@ sub otherLinks {
##################################################################
# Story Editing
sub editstory {
- my($sid) = @_;
+ my($sid, $msg) = @_;
my($S, $A, $T);
foreach (keys %{$I{F}}) { $S->{$_} = $I{F}{$_} }
my $newarticle = 1 if !$sid && !$I{F}{sid};
-
+
+ print "$msg" if (defined($msg));
+
print <<EOT;
<!-- begin editstory -->
@@ -1580,6 +1583,12 @@ sub saveExtras {
##################################################################
sub updateStory {
+ # Check for valid date first.
+ if (! ParseDate($I{F}{'time'})) {
+ editstory('', "Invalid date entered: '$I{F}{time}'");
+ return;
+ }
+
# Some users can only post to a fixed section
if ($I{U}{asection}) {
$I{F}{section} = $I{U}{asection};
@@ -1631,6 +1640,12 @@ sub updateStory {
##################################################################
sub saveStory {
+ # Check for valid date first.
+ if (! ParseDate($I{F}{'time'})) {
+ editstory('', "Invalid date entered: '$I{F}{time}'");
+ return;
+ }
+
$I{F}{sid} = getsid();
$I{F}{displaystatus} ||= '1' if $I{U}{asection};
$I{F}{section} = $I{U}{asection} if $I{U}{asection};
View
10 public_html/submit.pl
@@ -35,7 +35,6 @@ sub main {
getSlash();
my $id = getFormkeyId($I{U}{uid});
-
my($section, $op, $seclev, $aid) = (
$I{F}{section}, $I{F}{op}, $I{U}{aseclev}, $I{U}{aid}
);
@@ -411,10 +410,13 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
+ # @strs is for DISPLAY purposes, nothing more.
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" : "";
- my $stitle = '&title=' . fixparam($subj);
+ $strs[0] .= '...' if length($subj) > 35;
+
+ # Adds proper section and title for form editor.
+ my $sec = $section ne $I{defaultsection} ? "&section=$section" : '';
+ my $stitle = '&title=' . fixurl($subj, 1);
$stitle =~ s/%/%%/g; # for sprintf
printf(($admin ? <<ADMIN : <<USER), @strs);
View
19 themes/slashcode/htdocs/admin.pl
@@ -26,6 +26,7 @@
use strict;
use lib '../';
use vars '%I';
+use Date::Manip;
use Image::Size;
use Slash;
@@ -1117,13 +1118,15 @@ sub otherLinks {
##################################################################
# Story Editing
sub editstory {
- my($sid) = @_;
+ my($sid, $msg) = @_;
my($S, $A, $T);
foreach (keys %{$I{F}}) { $S->{$_} = $I{F}{$_} }
my $newarticle = 1 if !$sid && !$I{F}{sid};
-
+
+ print "$msg" if (defined($msg));
+
print <<EOT;
<!-- begin editstory -->
@@ -1580,6 +1583,12 @@ sub saveExtras {
##################################################################
sub updateStory {
+ # Check for valid date first.
+ if (! ParseDate($I{F}{'time'})) {
+ editstory('', "Invalid date entered: '$I{F}{time}'");
+ return;
+ }
+
# Some users can only post to a fixed section
if ($I{U}{asection}) {
$I{F}{section} = $I{U}{asection};
@@ -1631,6 +1640,12 @@ sub updateStory {
##################################################################
sub saveStory {
+ # Check for valid date first.
+ if (! ParseDate($I{F}{'time'})) {
+ editstory('', "Invalid date entered: '$I{F}{time}'");
+ return;
+ }
+
$I{F}{sid} = getsid();
$I{F}{displaystatus} ||= '1' if $I{U}{asection};
$I{F}{section} = $I{U}{asection} if $I{U}{asection};
View
10 themes/slashcode/htdocs/submit.pl
@@ -35,7 +35,6 @@ sub main {
getSlash();
my $id = getFormkeyId($I{U}{uid});
-
my($section, $op, $seclev, $aid) = (
$I{F}{section}, $I{F}{op}, $I{U}{aseclev}, $I{U}{aid}
);
@@ -411,10 +410,13 @@ sub submissionEd {
$karma = $uid > -1 && defined $karma ? " ($karma)" : "";
+ # @strs is for DISPLAY purposes, nothing more.
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" : "";
- my $stitle = '&title=' . fixparam($subj);
+ $strs[0] .= '...' if length($subj) > 35;
+
+ # Adds proper section and title for form editor.
+ my $sec = $section ne $I{defaultsection} ? "&section=$section" : '';
+ my $stitle = '&title=' . fixurl($subj, 1);
$stitle =~ s/%/%%/g; # for sprintf
printf(($admin ? <<ADMIN : <<USER), @strs);
Please sign in to comment.
Something went wrong with that request. Please try again.