Permalink
Browse files

More whitespace fix stuff

  • Loading branch information...
1 parent 666c11f commit 1394a754c7bfb27f2128a8b5ac75ca3d8fe568db @pudge pudge committed Nov 29, 2000
Showing with 126 additions and 87 deletions.
  1. +42 −29 plugins/Submit/submit.pl
  2. +42 −29 public_html/submit.pl
  3. +42 −29 themes/slashcode/htdocs/submit.pl
@@ -28,7 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
-use URI;
+require URI;
#################################################################
sub main {
@@ -141,18 +141,8 @@ sub previewForm {
($subid, my($email, $name, $title, $tid, $introtext, $time, $comment)) =
sqlSelect("subid,email,name,subj,tid,story,time,comment",
"submissions", "subid=$subid_dbi");
+ ($email, $name, $introtext) = processSub($email, $name, $introtext);
- $introtext =~ s/\n\n/\n<P>/gi;
- $introtext .= " ";
- $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
- my($proto, $url) = ($1, $2);
- my $extra = '';
- $extra = ',' if $url =~ s/,$//;
- $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
- qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
- }ogie;
- $introtext =~ s/\s+$//;
- $introtext = qq!<I>"$introtext"</I>! if $name;
if ($comment && $admin) {
# This probably should be a block.
@@ -162,21 +152,6 @@ sub previewForm {
EOT
}
- if ($email) {
- local $_ = $email;
- if (/@/) {
- $email = "mailto:$email";
- } elsif (!/http/) {
- $email = "http://$email";
- }
-
- $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
-
- } else {
- $introtext = "$name writes $introtext" if $name;
-
- }
-
my @fs = (
$I{query}->textfield(-name => 'title', -default => $title, -size => 50),
lockTest($title)
@@ -527,8 +502,10 @@ sub displayForm {
EOT
- my $story = stripByMode($I{F}{story}, 'html');
- print qq!<P>$user writes <I>"$story"</I></P>!;
+ my $story = $I{F}{story};
+ ($user, $fakeemail, $story) = processSub($user, $fakeemail, $story);
+ $story = stripByMode($story, 'html');
+ print qq!<P>$user writes $story</P>!;
}
print formLabel("The Scoop",
@@ -574,6 +551,9 @@ sub saveSub {
my($sec, $min, $hour, $mday, $mon, $year) = localtime;
my $subid = "$hour$min$sec.$mon$mday$year";
+ ($I{F}{from}, $I{F}{email}, $I{F}{story}) = processSub(
+ $I{F}{from}, $I{F}{email}, $I{F}{story}
+ );
sqlInsert("submissions", {
email => $I{F}{email},
@@ -591,6 +571,39 @@ sub saveSub {
}
}
+#################################################################
+sub processSub {
+ my($email, $name, $introtext) = @_;
+ $introtext =~ s/\n\n/\n<P>/gi;
+ $introtext .= " ";
+ $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
+ my($proto, $url) = ($1, $2);
+ my $extra = '';
+ $extra = ',' if $url =~ s/,$//;
+ $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
+ qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
+ }ogie;
+ $introtext =~ s/\s+$//;
+ $introtext = qq!<I>"$introtext"</I>! if $name;
+
+ if ($email) {
+ local $_ = $email;
+ if (/@/) {
+ $email = "mailto:$email";
+ } elsif (!/http/) {
+ $email = "http://$email";
+ }
+
+ $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
+
+ } else {
+ $introtext = "$name writes $introtext" if $name;
+
+ }
+
+ return($email, $name, $introtext);
+}
+
main();
$I{dbh}->disconnect if $I{dbh};
1;
View
@@ -28,7 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
-use URI;
+require URI;
#################################################################
sub main {
@@ -141,18 +141,8 @@ sub previewForm {
($subid, my($email, $name, $title, $tid, $introtext, $time, $comment)) =
sqlSelect("subid,email,name,subj,tid,story,time,comment",
"submissions", "subid=$subid_dbi");
+ ($email, $name, $introtext) = processSub($email, $name, $introtext);
- $introtext =~ s/\n\n/\n<P>/gi;
- $introtext .= " ";
- $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
- my($proto, $url) = ($1, $2);
- my $extra = '';
- $extra = ',' if $url =~ s/,$//;
- $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
- qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
- }ogie;
- $introtext =~ s/\s+$//;
- $introtext = qq!<I>"$introtext"</I>! if $name;
if ($comment && $admin) {
# This probably should be a block.
@@ -162,21 +152,6 @@ sub previewForm {
EOT
}
- if ($email) {
- local $_ = $email;
- if (/@/) {
- $email = "mailto:$email";
- } elsif (!/http/) {
- $email = "http://$email";
- }
-
- $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
-
- } else {
- $introtext = "$name writes $introtext" if $name;
-
- }
-
my @fs = (
$I{query}->textfield(-name => 'title', -default => $title, -size => 50),
lockTest($title)
@@ -527,8 +502,10 @@ sub displayForm {
EOT
- my $story = stripByMode($I{F}{story}, 'html');
- print qq!<P>$user writes <I>"$story"</I></P>!;
+ my $story = $I{F}{story};
+ ($user, $fakeemail, $story) = processSub($user, $fakeemail, $story);
+ $story = stripByMode($story, 'html');
+ print qq!<P>$user writes $story</P>!;
}
print formLabel("The Scoop",
@@ -574,6 +551,9 @@ sub saveSub {
my($sec, $min, $hour, $mday, $mon, $year) = localtime;
my $subid = "$hour$min$sec.$mon$mday$year";
+ ($I{F}{from}, $I{F}{email}, $I{F}{story}) = processSub(
+ $I{F}{from}, $I{F}{email}, $I{F}{story}
+ );
sqlInsert("submissions", {
email => $I{F}{email},
@@ -591,6 +571,39 @@ sub saveSub {
}
}
+#################################################################
+sub processSub {
+ my($email, $name, $introtext) = @_;
+ $introtext =~ s/\n\n/\n<P>/gi;
+ $introtext .= " ";
+ $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
+ my($proto, $url) = ($1, $2);
+ my $extra = '';
+ $extra = ',' if $url =~ s/,$//;
+ $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
+ qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
+ }ogie;
+ $introtext =~ s/\s+$//;
+ $introtext = qq!<I>"$introtext"</I>! if $name;
+
+ if ($email) {
+ local $_ = $email;
+ if (/@/) {
+ $email = "mailto:$email";
+ } elsif (!/http/) {
+ $email = "http://$email";
+ }
+
+ $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
+
+ } else {
+ $introtext = "$name writes $introtext" if $name;
+
+ }
+
+ return($email, $name, $introtext);
+}
+
main();
$I{dbh}->disconnect if $I{dbh};
1;
@@ -28,7 +28,7 @@
use lib '../';
use vars '%I';
use Slash;
-use URI;
+require URI;
#################################################################
sub main {
@@ -141,18 +141,8 @@ sub previewForm {
($subid, my($email, $name, $title, $tid, $introtext, $time, $comment)) =
sqlSelect("subid,email,name,subj,tid,story,time,comment",
"submissions", "subid=$subid_dbi");
+ ($email, $name, $introtext) = processSub($email, $name, $introtext);
- $introtext =~ s/\n\n/\n<P>/gi;
- $introtext .= " ";
- $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
- my($proto, $url) = ($1, $2);
- my $extra = '';
- $extra = ',' if $url =~ s/,$//;
- $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
- qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
- }ogie;
- $introtext =~ s/\s+$//;
- $introtext = qq!<I>"$introtext"</I>! if $name;
if ($comment && $admin) {
# This probably should be a block.
@@ -162,21 +152,6 @@ sub previewForm {
EOT
}
- if ($email) {
- local $_ = $email;
- if (/@/) {
- $email = "mailto:$email";
- } elsif (!/http/) {
- $email = "http://$email";
- }
-
- $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
-
- } else {
- $introtext = "$name writes $introtext" if $name;
-
- }
-
my @fs = (
$I{query}->textfield(-name => 'title', -default => $title, -size => 50),
lockTest($title)
@@ -527,8 +502,10 @@ sub displayForm {
EOT
- my $story = stripByMode($I{F}{story}, 'html');
- print qq!<P>$user writes <I>"$story"</I></P>!;
+ my $story = $I{F}{story};
+ ($user, $fakeemail, $story) = processSub($user, $fakeemail, $story);
+ $story = stripByMode($story, 'html');
+ print qq!<P>$user writes $story</P>!;
}
print formLabel("The Scoop",
@@ -574,6 +551,9 @@ sub saveSub {
my($sec, $min, $hour, $mday, $mon, $year) = localtime;
my $subid = "$hour$min$sec.$mon$mday$year";
+ ($I{F}{from}, $I{F}{email}, $I{F}{story}) = processSub(
+ $I{F}{from}, $I{F}{email}, $I{F}{story}
+ );
sqlInsert("submissions", {
email => $I{F}{email},
@@ -591,6 +571,39 @@ sub saveSub {
}
}
+#################################################################
+sub processSub {
+ my($email, $name, $introtext) = @_;
+ $introtext =~ s/\n\n/\n<P>/gi;
+ $introtext .= " ";
+ $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
+ my($proto, $url) = ($1, $2);
+ my $extra = '';
+ $extra = ',' if $url =~ s/,$//;
+ $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
+ qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
+ }ogie;
+ $introtext =~ s/\s+$//;
+ $introtext = qq!<I>"$introtext"</I>! if $name;
+
+ if ($email) {
+ local $_ = $email;
+ if (/@/) {
+ $email = "mailto:$email";
+ } elsif (!/http/) {
+ $email = "http://$email";
+ }
+
+ $introtext = qq!<A HREF="$email">$name</A> writes $introtext! if $name;
+
+ } else {
+ $introtext = "$name writes $introtext" if $name;
+
+ }
+
+ return($email, $name, $introtext);
+}
+
main();
$I{dbh}->disconnect if $I{dbh};
1;

0 comments on commit 1394a75

Please sign in to comment.