Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

fix realemail/fakeemail/homepage stuff

  • Loading branch information...
commit 3eaf7b0a4a3559b5c74275ce97654b3a83741ed9 1 parent aec4899
Chris Nandor authored July 31, 2000
15  Slash.pm
@@ -42,7 +42,7 @@ BEGIN {
42 42
 
43 43
 	require Exporter;
44 44
 	use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %I $CRLF);
45  
-	$VERSION = '1.0.6';
  45
+	$VERSION = '1.0.7';
46 46
 	@ISA	 = 'Exporter';
47 47
 	@EXPORT  = qw(
48 48
 		sqlSelectMany sqlSelect sqlSelectHash sqlSelectAll approveTag
@@ -58,7 +58,7 @@ BEGIN {
58 58
 		getDateFormat dispComment getDateOffset linkComment redirect
59 59
 		insertFormkey getFormkeyId checkSubmission checkTimesPosted
60 60
 		updateFormkeyId formSuccess formAbuse formFailure errorMessage
61  
-		fixurl fixparam
  61
+		fixurl fixparam chopEntity
62 62
 	);
63 63
 	$CRLF = "\015\012";
64 64
 }
@@ -1225,7 +1225,8 @@ sub stripByMode {
1225 1225
 		$str =~ s/>//g;
1226 1226
 
1227 1227
 	} elsif ($fmode eq 'attribute') {
1228  
-		$str =~ s/"//g;
  1228
+		$str =~ s/"/"/g;
  1229
+		$str =~ s/'/'/g;
1229 1230
 
1230 1231
 	} else {
1231 1232
 		$str = stripBadHtml($str);
@@ -1364,6 +1365,14 @@ sub approveTag {
1364 1365
 }
1365 1366
 
1366 1367
 ########################################################
  1368
+sub chopEntity {
  1369
+	my($text, $length) = @_;
  1370
+	$text = substr($text, 0, $length) if $length;
  1371
+	$text =~ s/&#?[a-zA-Z0-9]*$//;
  1372
+	return $text;
  1373
+}
  1374
+
  1375
+########################################################
1367 1376
 sub fixparam {
1368 1377
 	fixurl($_[0], 1);
1369 1378
 }
2  portald
@@ -262,7 +262,7 @@ sub getRDF {
262 262
 			return;
263 263
 		}
264 264
 
265  
-		$d =~ s/&(?!(?:[a-zA-Z0-9]+|#\d+);)/&/g; #s/&/&/g;
  265
+		$d =~ s/&(?!#?[a-zA-Z0-9]+;)/&/g; #s/&/&/g;
266 266
 		$p->parse($d) or portaldLog("$bid did not parse properly");
267 267
 		setblock($bid, "$str$other");
268 268
 	};
7  public_html/users.pl
@@ -26,6 +26,7 @@
26 26
 use strict;
27 27
 use lib '../';
28 28
 use vars '%I';
  29
+use Email::Valid;
29 30
 use Slash;
30 31
 
31 32
 #################################################################
@@ -777,9 +778,9 @@ sub saveUser {
777 778
 
778 779
 	# stripByMode _after_ fitting sig into schema, 120 chars
779 780
 	$I{F}{sig}	 = stripByMode(substr($I{F}{sig}, 0, 120), 'html');
780  
-	$I{F}{fakeemail} = stripByMode($I{F}{fakeemail});
  781
+	$I{F}{fakeemail} = chopEntity(stripByMode($I{F}{fakeemail}, 'attribute'), 50);
781 782
 	$I{F}{homepage}	 = "" if $I{F}{homepage} eq "http://";
782  
-	$I{F}{homepage}	 = stripByMode($I{F}{homepage});
  783
+	$I{F}{homepage}	 = fixurl($I{F}{homepage});
783 784
 
784 785
 	# for the users table
785 786
 	my $H = {
@@ -799,7 +800,7 @@ sub saveUser {
799 800
 		"nickname=" . $I{dbh}->quote($name));
800 801
 
801 802
 	if ($oldEmail ne $I{F}{realemail}) {
802  
-		$H->{realemail} = $I{F}{realemail};
  803
+		$H->{realemail} = chopEntity(stripByMode($I{F}{realemail}, 'attribute'), 50);
803 804
 		print "\nNotifying $oldEmail of the change to their account.<BR>\n";
804 805
 
805 806
 		sendEmail($oldEmail, "$I{sitename} user email change for $name", <<EOT);
7  themes/slashcode/htdocs/users.pl
@@ -26,6 +26,7 @@
26 26
 use strict;
27 27
 use lib '../';
28 28
 use vars '%I';
  29
+use Email::Valid;
29 30
 use Slash;
30 31
 
31 32
 #################################################################
@@ -777,9 +778,9 @@ sub saveUser {
777 778
 
778 779
 	# stripByMode _after_ fitting sig into schema, 120 chars
779 780
 	$I{F}{sig}	 = stripByMode(substr($I{F}{sig}, 0, 120), 'html');
780  
-	$I{F}{fakeemail} = stripByMode($I{F}{fakeemail});
  781
+	$I{F}{fakeemail} = chopEntity(stripByMode($I{F}{fakeemail}, 'attribute'), 50);
781 782
 	$I{F}{homepage}	 = "" if $I{F}{homepage} eq "http://";
782  
-	$I{F}{homepage}	 = stripByMode($I{F}{homepage});
  783
+	$I{F}{homepage}	 = fixurl($I{F}{homepage});
783 784
 
784 785
 	# for the users table
785 786
 	my $H = {
@@ -799,7 +800,7 @@ sub saveUser {
799 800
 		"nickname=" . $I{dbh}->quote($name));
800 801
 
801 802
 	if ($oldEmail ne $I{F}{realemail}) {
802  
-		$H->{realemail} = $I{F}{realemail};
  803
+		$H->{realemail} = chopEntity(stripByMode($I{F}{realemail}, 'attribute'), 50);
803 804
 		print "\nNotifying $oldEmail of the change to their account.<BR>\n";
804 805
 
805 806
 		sendEmail($oldEmail, "$I{sitename} user email change for $name", <<EOT);

0 notes on commit 3eaf7b0

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