Skip to content

Commit 072520e

Browse files
committed
eForm - Made the same as the development code
modxcms/evolution@bffb840 Made the same as the development code
1 parent 910332f commit 072520e

2 files changed

Lines changed: 14 additions & 32 deletions

File tree

assets/snippets/eform/eform.inc.php

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// eForm 1.4.6 - Electronic Form Snippet
2+
// eForm 1.4.8 - Electronic Form Snippet
33
// Original created by: Raymond Irving 15-Dec-2004.
44
// Extended by: Jelle Jager (TobyL) September 2006
55
// -----------------------------------------------------
@@ -54,7 +54,7 @@ function eForm($modx,$params) {
5454

5555
extract($params,EXTR_SKIP); // extract params into variables
5656

57-
$fileVersion = '1.4.6';
57+
$fileVersion = '1.4.8';
5858
$version = isset($version) ? $version : 'prior to 1.4.2';
5959

6060
// include default language file
@@ -166,18 +166,17 @@ function eForm($modx,$params) {
166166

167167
// get user post back data
168168
foreach($_POST as $name => $value){
169-
if(is_array($value)){
170-
//remove empty values
171-
$fields[$name] = array_filter($value,create_function('$v','return (!empty($v));'));
169+
if(is_array($value)){ // type="checkbox" etc. remove empty values
170+
$value = array_filter($value,create_function('$v','return (!empty($v));'));
172171
} else {
173-
if ($allowhtml && $formats[$name][2]=='html') {
174-
$fields[$name] = stripslashes($value);
175-
} else {
176-
$fields[$name] = strip_tags(stripslashes($value));
177-
}
172+
if(get_magic_quotes_gpc()) $value = stripslashes($value); // For before PHP 5.3
173+
if(!$allowhtml || $formats[$name][2]!='html') $value = strip_tags($value);
178174
}
175+
$fields[$name] = $value;
179176
}
180-
177+
178+
modx_sanitize_gpc($fields); // Remove the danger values that the result of stripslashes and strip_tags.
179+
181180
// get uploaded files
182181
foreach($_FILES as $name => $value){
183182
$fields[$name] = $value;
@@ -192,24 +191,8 @@ function eForm($modx,$params) {
192191
$rClass['vericode']=$invalidClass; //added in 1.4.4
193192
}
194193
}
195-
196-
// sanitize the values with slashes stripped to avoid remote execution of Snippets
197-
$version = $modx->getVersionData();
198-
if (version_compare($version['version'], '1.0.9', '<=')) {
199-
modx_sanitize_gpc($fields, array(
200-
'@<script[^>]*?>.*?</script>@si',
201-
'@&#(\d+);@e',
202-
'@\[\~(.*?)\~\]@si',
203-
'@\[\((.*?)\)\]@si',
204-
'@{{(.*?)}}@si',
205-
'@\[\+(.*?)\+\]@si',
206-
'@\[\*(.*?)\*\]@si',
207-
'@\[\[(.*?)\]\]@si',
208-
'@\[!(.*?)!\]@si'
209-
));
210-
}
211-
212-
# validate fields
194+
195+
// validate fields
213196
foreach($fields as $name => $value) {
214197
$fld = $formats[$name];
215198
if ($fld) {

assets/snippets/eform/snippet.eform.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Robust form parser/processor with validation, multiple sending options, chunk/page support for forms and reports, and file uploads
66
*
77
* @category snippet
8-
* @version 1.4.7
8+
* @version 1.4.8
99
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License (GPL)
1010
* @internal @properties
1111
* @internal @modx_category Forms
@@ -101,7 +101,7 @@
101101
'errorTpl' => isset($errorTpl)?$errorTpl:'<div class="errors"><strong>[+ef_message_text+]</strong><br />[+ef_wrapper+]</div>',
102102
'errorRequiredTpl' => isset($errorRequiredTpl)?$errorRequiredTpl:'<span class="requiredlist"><span>[+ef_required_list+]</span>.</span>',
103103
'errorRequiredSeparator' => isset($errorRequiredSeparator)?$errorRequiredSeparator:'</span>, <span>',
104-
'version' => '1.4.6'
104+
'version' => '1.4.8'
105105
);
106106

107107
// pixelchutes PHx workaround
@@ -115,4 +115,3 @@
115115

116116
# Return
117117
return $output;
118-
?>

0 commit comments

Comments
 (0)