-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SvenDowideit noted that if a user attempts to install the patch using the patch utility, it fails because of multiple patches for the same file are bundled together. Break into separate files. git-svn-id: http://svn.foswiki.org/trunk/PatchItem12285Contrib@16197 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
- Loading branch information
GeorgeClark
authored and
GeorgeClark
committed
Dec 13, 2012
1 parent
35f81b9
commit 29f4f7f
Showing
6 changed files
with
109 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
!noci | ||
data/System/PatchItem12285Contrib.txt 0644 | ||
lib/Foswiki/Contrib/PatchItem12285Contrib.pm 0444 | ||
working/configure/patch/Item12285-001.patch 0644 Patch to improve Store performance. | ||
working/configure/patch/Item12285-001.patch 0644 Patch to Foswiki 1.1.0-1.1.2. | ||
working/configure/patch/Item12285-002.patch 0644 Patch to Foswiki 1.1.3-1.1.6. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
Author: GeorgeClark <GeorgeClark@0b4bb1d4-4e5a-0410-9cc4-b2b747904278> | ||
Date: Mon Dec 10 00:49:20 2012 +0000 | ||
|
||
Item12285: Better validations This patch applies to Foswiki 1.1.3 - 1.1.6 | ||
|
||
|
||
~~~PATCH 160f04fc478c5f9b81d2ef6c9e614074 lib/Foswiki/Macros/MAKETEXT.pm (Foswiki 1.1.3 - Foswiki 1.1.6) | ||
--- lib/Foswiki/Macros/MAKETEXT.pm 2012-12-11 10:51:12.959268829 -0500 | ||
+++ lib/Foswiki/Macros/MAKETEXT.pm.new 2012-12-11 10:37:31.674486503 -0500 | ||
@@ -4,9 +4,19 @@ | ||
use strict; | ||
use warnings; | ||
|
||
+use Locale::Maketext; | ||
+my $escape = | ||
+ ( $Foswiki::cfg{UserInterfaceInternationalisation} | ||
+ && $Locale::Maketext::VERSION | ||
+ && $Locale::Maketext::VERSION < 1.23 ); | ||
+ | ||
sub MAKETEXT { | ||
my ( $this, $params ) = @_; | ||
|
||
+ my $max; | ||
+ my $min; | ||
+ my $param_error; | ||
+ | ||
my $str = $params->{_DEFAULT} || $params->{string} || ""; | ||
return "" unless $str; | ||
|
||
@@ -18,15 +28,22 @@ | ||
$str =~ s/~~\[/~[/g; | ||
$str =~ s/~~\]/~]/g; | ||
|
||
+ $max = 0; | ||
+ $min = 1; | ||
+ $param_error = 0; | ||
+ | ||
# unescape parameters and calculate highest parameter number: | ||
- my $max = 0; | ||
- $str =~ s/~\[(\_(\d+))~\]/ $max = $2 if ($2 > $max); "[$1]"/ge; | ||
+ $str =~ s/~\[(\_(\d+))~\]/_validate($1, $2, $max, $min, $param_error)/ge; | ||
$str =~ | ||
-s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ $max = $2 if ($2 > $max); "[$1]"/ge; | ||
+s/~\[(\*,\_(\d+),[^,]+(,([^,]+))?)~\]/ _validate($1, $2, $max, $min, $param_error)/ge; | ||
+ return $str if ($param_error); | ||
|
||
# get the args to be interpolated. | ||
my $argsStr = $params->{args} || ""; | ||
|
||
+ # Escape any escapes. | ||
+ $str =~ s#\\#\\\\#g if ($escape); # escape any escapes | ||
+ | ||
my @args = split( /\s*,\s*/, $argsStr ); | ||
|
||
# fill omitted args with empty strings | ||
@@ -47,6 +64,26 @@ | ||
return $result; | ||
} | ||
|
||
+sub _validate { | ||
+ | ||
+ #my ( $contents, $number, $max, $min, $param_error ) = @_ | ||
+ | ||
+ $_[2] = $_[1] if ( $_[1] > $_[2] ); # Record maximum param number | ||
+ $_[3] = $_[1] if ( $_[1] < $_[3] ); # Record minimum param number | ||
+ | ||
+ if ( $_[1] > 100 ) { | ||
+ $_[4] = 1; # Set error flag | ||
+ return | ||
+"<span class=\"foswikiAlert\">Excessive parameter number $_[2], MAKETEXT rejected.</span>"; | ||
+ } | ||
+ if ( $_[1] < 1 ) { | ||
+ $_[4] = 1; # Set error flag | ||
+ return | ||
+"<span class=\"foswikiAlert\">Invalid parameter <code>\"$_[0]\"</code>, MAKETEXT rejected.</span>"; | ||
+ } | ||
+ return "[$_[0]]"; # Return the complete bracket parameter without escapes | ||
+} | ||
+ | ||
1; | ||
__END__ | ||
Foswiki - The Free and Open Source Wiki, http://foswiki.org/ | ||
|