Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

More whitespace fix stuff

  • Loading branch information...
commit de0ee65efd937880402d388d5e3ee77c42aca7ee 1 parent f03abf5
Chris Nandor pudge authored
43 plugins/Submit/submit.pl
@@ -142,6 +142,8 @@ sub previewForm {
142 142 sqlSelect("subid,email,name,subj,tid,story,time,comment",
143 143 "submissions", "subid=$subid_dbi");
144 144
  145 + $introtext = processSub($email, $name, $introtext);
  146 +
145 147 if ($comment && $admin) {
146 148 # This probably should be a block.
147 149 print <<EOT;
@@ -500,8 +502,9 @@ sub displayForm {
500 502
501 503 EOT
502 504
503   - my $story = processSub($fakeemail, $user, $I{F}{story});
504   - print stripByMode($story, 'html');
  505 + print processSub($fakeemail, $user,
  506 + stripByMode(url2html($I{F}{story}), 'html')
  507 + );
505 508 }
506 509
507 510 print formLabel("The Scoop",
@@ -547,13 +550,12 @@ sub saveSub {
547 550 my($sec, $min, $hour, $mday, $mon, $year) = localtime;
548 551
549 552 my $subid = "$hour$min$sec.$mon$mday$year";
550   - $I{F}{story} = processSub($I{F}{from}, $I{F}{email}, $I{F}{story});
551 553
552 554 sqlInsert("submissions", {
553 555 email => $I{F}{email},
554 556 uid => $I{U}{uid},
555 557 name => $I{F}{from},
556   - story => stripByMode($I{F}{story}, 'html'),
  558 + story => stripByMode(url2html($I{F}{story}), 'html'),
557 559 -'time' => 'now()',
558 560 subid => $subid,
559 561 subj => $I{F}{subj},
@@ -568,20 +570,7 @@ sub saveSub {
568 570 #################################################################
569 571 sub processSub {
570 572 my($email, $name, $introtext) = @_;
571   - $introtext =~ s/\n\n/\n<P>/gi;
572   - $introtext .= " ";
573 573
574   - # this is kinda experimental ... esp. the $extra line
575   - # we know it can break real URLs, but probably will preserve
576   - # real URLs more often than it will break them
577   - $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
578   - my($proto, $url) = ($1, $2);
579   - my $extra = '';
580   - $extra = $1 if $url =~ s/([?!;:.,']+)$//;
581   - $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
582   - qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
583   - }ogie;
584   - $introtext =~ s/\s+$//;
585 574 $introtext = qq!<I>"$introtext"</I>! if $name;
586 575
587 576 if ($email) {
@@ -602,6 +591,26 @@ sub processSub {
602 591 return $introtext;
603 592 }
604 593
  594 +#################################################################
  595 +sub url2html {
  596 + my($introtext) = @_;
  597 + $introtext =~ s/\n\n/\n<P>/gi;
  598 + $introtext .= " ";
  599 +
  600 + # this is kinda experimental ... esp. the $extra line
  601 + # we know it can break real URLs, but probably will preserve
  602 + # real URLs more often than it will break them
  603 + $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
  604 + my($proto, $url) = ($1, $2);
  605 + my $extra = '';
  606 + $extra = $1 if $url =~ s/([?!;:.,']+)$//;
  607 + $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
  608 + qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
  609 + }ogie;
  610 + $introtext =~ s/\s+$//;
  611 + return $introtext;
  612 +}
  613 +
605 614 main();
606 615 $I{dbh}->disconnect if $I{dbh};
607 616 1;
43 public_html/submit.pl
@@ -142,6 +142,8 @@ sub previewForm {
142 142 sqlSelect("subid,email,name,subj,tid,story,time,comment",
143 143 "submissions", "subid=$subid_dbi");
144 144
  145 + $introtext = processSub($email, $name, $introtext);
  146 +
145 147 if ($comment && $admin) {
146 148 # This probably should be a block.
147 149 print <<EOT;
@@ -500,8 +502,9 @@ sub displayForm {
500 502
501 503 EOT
502 504
503   - my $story = processSub($fakeemail, $user, $I{F}{story});
504   - print stripByMode($story, 'html');
  505 + print processSub($fakeemail, $user,
  506 + stripByMode(url2html($I{F}{story}), 'html')
  507 + );
505 508 }
506 509
507 510 print formLabel("The Scoop",
@@ -547,13 +550,12 @@ sub saveSub {
547 550 my($sec, $min, $hour, $mday, $mon, $year) = localtime;
548 551
549 552 my $subid = "$hour$min$sec.$mon$mday$year";
550   - $I{F}{story} = processSub($I{F}{from}, $I{F}{email}, $I{F}{story});
551 553
552 554 sqlInsert("submissions", {
553 555 email => $I{F}{email},
554 556 uid => $I{U}{uid},
555 557 name => $I{F}{from},
556   - story => stripByMode($I{F}{story}, 'html'),
  558 + story => stripByMode(url2html($I{F}{story}), 'html'),
557 559 -'time' => 'now()',
558 560 subid => $subid,
559 561 subj => $I{F}{subj},
@@ -568,20 +570,7 @@ sub saveSub {
568 570 #################################################################
569 571 sub processSub {
570 572 my($email, $name, $introtext) = @_;
571   - $introtext =~ s/\n\n/\n<P>/gi;
572   - $introtext .= " ";
573 573
574   - # this is kinda experimental ... esp. the $extra line
575   - # we know it can break real URLs, but probably will preserve
576   - # real URLs more often than it will break them
577   - $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
578   - my($proto, $url) = ($1, $2);
579   - my $extra = '';
580   - $extra = $1 if $url =~ s/([?!;:.,']+)$//;
581   - $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
582   - qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
583   - }ogie;
584   - $introtext =~ s/\s+$//;
585 574 $introtext = qq!<I>"$introtext"</I>! if $name;
586 575
587 576 if ($email) {
@@ -602,6 +591,26 @@ sub processSub {
602 591 return $introtext;
603 592 }
604 593
  594 +#################################################################
  595 +sub url2html {
  596 + my($introtext) = @_;
  597 + $introtext =~ s/\n\n/\n<P>/gi;
  598 + $introtext .= " ";
  599 +
  600 + # this is kinda experimental ... esp. the $extra line
  601 + # we know it can break real URLs, but probably will preserve
  602 + # real URLs more often than it will break them
  603 + $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
  604 + my($proto, $url) = ($1, $2);
  605 + my $extra = '';
  606 + $extra = $1 if $url =~ s/([?!;:.,']+)$//;
  607 + $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
  608 + qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
  609 + }ogie;
  610 + $introtext =~ s/\s+$//;
  611 + return $introtext;
  612 +}
  613 +
605 614 main();
606 615 $I{dbh}->disconnect if $I{dbh};
607 616 1;
43 themes/slashcode/htdocs/submit.pl
@@ -142,6 +142,8 @@ sub previewForm {
142 142 sqlSelect("subid,email,name,subj,tid,story,time,comment",
143 143 "submissions", "subid=$subid_dbi");
144 144
  145 + $introtext = processSub($email, $name, $introtext);
  146 +
145 147 if ($comment && $admin) {
146 148 # This probably should be a block.
147 149 print <<EOT;
@@ -500,8 +502,9 @@ sub displayForm {
500 502
501 503 EOT
502 504
503   - my $story = processSub($fakeemail, $user, $I{F}{story});
504   - print stripByMode($story, 'html');
  505 + print processSub($fakeemail, $user,
  506 + stripByMode(url2html($I{F}{story}), 'html')
  507 + );
505 508 }
506 509
507 510 print formLabel("The Scoop",
@@ -547,13 +550,12 @@ sub saveSub {
547 550 my($sec, $min, $hour, $mday, $mon, $year) = localtime;
548 551
549 552 my $subid = "$hour$min$sec.$mon$mday$year";
550   - $I{F}{story} = processSub($I{F}{from}, $I{F}{email}, $I{F}{story});
551 553
552 554 sqlInsert("submissions", {
553 555 email => $I{F}{email},
554 556 uid => $I{U}{uid},
555 557 name => $I{F}{from},
556   - story => stripByMode($I{F}{story}, 'html'),
  558 + story => stripByMode(url2html($I{F}{story}), 'html'),
557 559 -'time' => 'now()',
558 560 subid => $subid,
559 561 subj => $I{F}{subj},
@@ -568,20 +570,7 @@ sub saveSub {
568 570 #################################################################
569 571 sub processSub {
570 572 my($email, $name, $introtext) = @_;
571   - $introtext =~ s/\n\n/\n<P>/gi;
572   - $introtext .= " ";
573 573
574   - # this is kinda experimental ... esp. the $extra line
575   - # we know it can break real URLs, but probably will preserve
576   - # real URLs more often than it will break them
577   - $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
578   - my($proto, $url) = ($1, $2);
579   - my $extra = '';
580   - $extra = $1 if $url =~ s/([?!;:.,']+)$//;
581   - $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
582   - qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
583   - }ogie;
584   - $introtext =~ s/\s+$//;
585 574 $introtext = qq!<I>"$introtext"</I>! if $name;
586 575
587 576 if ($email) {
@@ -602,6 +591,26 @@ sub processSub {
602 591 return $introtext;
603 592 }
604 593
  594 +#################################################################
  595 +sub url2html {
  596 + my($introtext) = @_;
  597 + $introtext =~ s/\n\n/\n<P>/gi;
  598 + $introtext .= " ";
  599 +
  600 + # this is kinda experimental ... esp. the $extra line
  601 + # we know it can break real URLs, but probably will preserve
  602 + # real URLs more often than it will break them
  603 + $introtext =~ s{(?<!["=>])(http|ftp|gopher|telnet)://([$URI::uric#]+)}{
  604 + my($proto, $url) = ($1, $2);
  605 + my $extra = '';
  606 + $extra = $1 if $url =~ s/([?!;:.,']+)$//;
  607 + $extra = ')' . $extra if $url !~ /\(/ && $url =~ s/\)$//;
  608 + qq[<A HREF="$proto://$url">$proto://$url</A>$extra];
  609 + }ogie;
  610 + $introtext =~ s/\s+$//;
  611 + return $introtext;
  612 +}
  613 +
605 614 main();
606 615 $I{dbh}->disconnect if $I{dbh};
607 616 1;

0 comments on commit de0ee65

Please sign in to comment.
Something went wrong with that request. Please try again.