From 2cb656cf7af0d018c36e36eccb53240a1dd384af Mon Sep 17 00:00:00 2001
From: mcramer <m.cramer@pixcept.de>
Date: Wed, 05 Sep 2012 04:52:45 -0400
Subject: [PATCH] Fixed: "old" style folder protection without comment lines in htaccess (3.0.4.6) get removed, too.
---
interface/lib/classes/remoting_lib.inc.php | 71 +++++++++++++++++++++++++++++------
1 files changed, 58 insertions(+), 13 deletions(-)
diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 06ca43a..fcde405 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -44,9 +44,9 @@
* Tabellendefinition
*
* Datentypen:
-* - INTEGER (Wandelt Ausdr�cke in Int um)
+* - INTEGER (Wandelt Ausdr�cke in Int um)
* - DOUBLE
-* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
+* - CURRENCY (Formatiert Zahlen nach W�hrungsnotation)
* - VARCHAR (kein weiterer Format Check)
* - DATE (Datumsformat, Timestamp Umwandlung)
*
@@ -60,10 +60,10 @@
* - Wert oder Array
*
* SEPARATOR
-* - Trennzeichen f�r multiple Felder
+* - Trennzeichen f�r multiple Felder
*
* Hinweis:
-* Das ID-Feld ist nicht bei den Table Values einzuf�gen.
+* Das ID-Feld ist nicht bei den Table Values einzuf�gen.
*/
class remoting_lib {
@@ -121,7 +121,7 @@
function loadFormDef($file) {
global $app,$conf;
- include_once($file);
+ include($file);
$this->formDef = $form;
unset($this->formDef['tabs']);
@@ -452,7 +452,17 @@
}
break;
case 'ISEMAIL':
- if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
+ if(function_exists('filter_var')) {
+ if(!filter_var($field_value, FILTER_VALIDATE_EMAIL)) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br />\r\n";
+ }
+ }
+ } else {
+ if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-zA-Z0-9\-]{2,30}$/i", $field_value)) {
$errmsg = $validator['errmsg'];
if(isset($this->wordbook[$errmsg])) {
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
@@ -460,8 +470,19 @@
$this->errorMessage .= $errmsg."<br />\r\n";
}
}
+ }
break;
case 'ISINT':
+ if(function_exists('filter_var')) {
+ if($vield_value != '' && filter_var($field_value, FILTER_VALIDATE_INT) === false) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br />\r\n";
+ }
+ }
+ } else {
$tmpval = intval($field_value);
if($tmpval === 0 and !empty($field_value)) {
$errmsg = $validator['errmsg'];
@@ -471,6 +492,7 @@
$this->errorMessage .= $errmsg."<br />\r\n";
}
}
+ }
break;
case 'ISPOSITIVE':
if(!is_numeric($field_value) || $field_value <= 0){
@@ -529,6 +551,27 @@
}
}
}
+ break;
+ case 'RANGE':
+ //* Checks if the value is within the given range or above / below a value
+ //* Range examples: < 10 = ":10", between 2 and 10 = "2:10", above 5 = "5:".
+ $range_parts = explode(':',trim($validator['range']));
+ $ok = true;
+ if($range_parts[0] != '' && $field_value < $range_parts[0]) {
+ $ok = false;
+ }
+ if($range_parts[1] != '' && $field_value > $range_parts[1]) {
+ $ok = false;
+ }
+ if($ok != true) {
+ $errmsg = $validator['errmsg'];
+ if(isset($this->wordbook[$errmsg])) {
+ $this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+ } else {
+ $this->errorMessage .= $errmsg."<br />\r\n";
+ }
+ }
+ unset($range_parts);
break;
case 'CUSTOM':
// Calls a custom class to validate this record
@@ -608,17 +651,19 @@
$sql_insert_val .= "'".$record[$key]."', ";
}
} else {
+
if($field['formtype'] == 'PASSWORD') {
- if($field['encryption'] == 'CRYPT') {
+ if(isset($field['encryption']) && $field['encryption'] == 'CRYPT') {
$record[$key] = $app->auth->crypt_password(stripslashes($record[$key]));
- } elseif ($field['encryption'] == 'MYSQL') {
- $sql_insert_val .= "PASSWORD('".$app->db->quote($record[$key])."'), ";
- } elseif ($field['encryption'] == 'CLEARTEXT') {
- $sql_insert_val .= "'".$app->db->quote($record[$key])."', ";
+ $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
+ } elseif (isset($field['encryption']) && $field['encryption'] == 'MYSQL') {
+ $sql_update .= "`$key` = PASSWORD('".$app->db->quote($record[$key])."'), ";
+ } elseif (isset($field['encryption']) && $field['encryption'] == 'CLEARTEXT') {
+ $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
} else {
- $record[$key] = md5($record[$key]);
+ $record[$key] = md5(stripslashes($record[$key]));
+ $sql_update .= "`$key` = '".$app->db->quote($record[$key])."', ";
}
- $sql_update .= "`$key` = '".$record[$key]."', ";
} elseif ($field['formtype'] == 'CHECKBOX') {
if($record[$key] == '') {
// if a checkbox is not set, we set it to the unchecked value
--
Gitblit v1.9.1