From 5384ed0240d9ce6774373deb3a324801049a82aa Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Thu, 09 Sep 2010 06:54:01 -0400
Subject: [PATCH] Fixed a problem with client templates in the remoting functions.
---
interface/lib/classes/tform.inc.php | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 6369146..49fd2bd 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -40,7 +40,7 @@
* - DOUBLE
* - CURRENCY (Formats digits in currency notation)
* - VARCHAR (No format check)
-* - DATE (Date format, converts from and to linux timestamps automatically)
+* - DATE (Date format, converts from and to UNIX timestamps automatically)
*
* Formtype:
* - TEXT (Normal text field)
@@ -361,7 +361,11 @@
// If Datasource is set, get the data from there
if(isset($field['datasource']) && is_array($field['datasource'])) {
- $field["value"] = $this->getDatasourceData($field, $record);
+ if(is_array($field["value"])) {
+ $field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+ } else {
+ $field["value"] = $this->getDatasourceData($field, $record);
+ }
}
// If a limitation for the values is set
@@ -470,7 +474,11 @@
// If Datasource is set, get the data from there
if(@is_array($field['datasource'])) {
- $field["value"] = $this->getDatasourceData($field, $record);
+ if(is_array($field["value"])) {
+ $field["value"] = array_merge($field["value"],$this->getDatasourceData($field, $record));
+ } else {
+ $field["value"] = $this->getDatasourceData($field, $record);
+ }
}
// If a limitation for the values is set
@@ -612,8 +620,9 @@
break;
case 'DATE':
if($record[$key] != '' && $record[$key] != '0000-00-00') {
- list($tag,$monat,$jahr) = explode('.',$record[$key]);
- $new_record[$key] = $jahr.'-'.$monat.'-'.$tag;
+ $date_parts = date_parse_from_format($this->dateformat,$record[$key]);
+ //list($tag,$monat,$jahr) = explode('.',$record[$key]);
+ $new_record[$key] = $date_parts['year'].'-'.$date_parts['month'].'-'.$date_parts['day'];
//$tmp = strptime($record[$key],$this->dateformat);
//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
} else {
@@ -725,7 +734,7 @@
}
break;
case 'ISEMAIL':
- if(!preg_match("/^\w+[\w.-]*\w{0,}@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
+ if(!preg_match("/^\w+[\w\.\-\+]*\w{0,}@\w+[\w.-]*\w+\.[a-z]{2,10}$/i", $field_value)) {
$errmsg = $validator['errmsg'];
if(isset($this->wordbook[$errmsg])) {
$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
@@ -1117,15 +1126,18 @@
}
- function getAuthSQL($perm) {
+ function getAuthSQL($perm, $table = '') {
if($_SESSION["s"]["user"]["typ"] == 'admin') {
return '1';
} else {
+ if ($table != ''){
+ $table = ' ' . $table . '.';
+ }
$groups = ( $_SESSION["s"]["user"]["groups"] ) ? $_SESSION["s"]["user"]["groups"] : 0;
$sql = '(';
- $sql .= "(sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND sys_perm_user like '%$perm%') OR ";
- $sql .= "(sys_groupid IN (".$groups.") AND sys_perm_group like '%$perm%') OR ";
- $sql .= "sys_perm_other like '%$perm%'";
+ $sql .= "(" . $table . "sys_userid = ".$_SESSION["s"]["user"]["userid"]." AND " . $table . "sys_perm_user like '%$perm%') OR ";
+ $sql .= "(" . $table . "sys_groupid IN (".$groups.") AND " . $table ."sys_perm_group like '%$perm%') OR ";
+ $sql .= $table . "sys_perm_other like '%$perm%'";
$sql .= ')';
return $sql;
@@ -1410,4 +1422,4 @@
}
}
-?>
\ No newline at end of file
+?>
--
Gitblit v1.9.1