From 6a5113d75bd362a69aa0ce1a344e260cf257b61d Mon Sep 17 00:00:00 2001
From: Till Brehm <tbrehm@ispconfig.org>
Date: Thu, 07 Aug 2014 03:26:03 -0400
Subject: [PATCH] Merge branch 'stable-3.0.5' of git.ispconfig.org:ispconfig/ispconfig3 into stable-3.0.5

---
 interface/lib/classes/tform.inc.php |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index 2f5c08d..4522304 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -131,7 +131,7 @@
 		$this->module = $module;
 		$wb = array();
 
-		include_once ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng';
+		include ISPC_ROOT_PATH.'/lib/lang/'.$_SESSION['s']['language'].'.lng';
 
 		if(is_array($wb)) $wb_global = $wb;
 
@@ -252,7 +252,9 @@
 			unset($tmp_recordid);
 
 			$querystring = str_replace("{AUTHSQL}", $this->getAuthSQL('r'), $querystring);
-			$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', "self::table_auth_sql", $querystring);
+			//$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', "self::table_auth_sql", $querystring);
+			//*Used the ld form to be compatible with php < 5.3
+			$querystring = preg_replace_callback('@{AUTHSQL::(.+?)}@', create_function('$matches','global $app; $tmp = $app->tform->getAuthSQL("r", $matches[1]); return $tmp;'), $querystring);
 
 			// Getting the records
 			$tmp_records = $app->db->queryAllRecords($querystring);
@@ -293,10 +295,12 @@
 		return $values;
 
 	}
-
+	
+	/*
 	function table_auth_sql($matches){
 		return $this->getAuthSQL('r', $matches[1]);
 	}
+	*/
 
 	//* If the parameter 'valuelimit' is set
 	function applyValueLimit($limit, $values) {
@@ -845,6 +849,15 @@
 					}
 				}
 				break;
+			case 'ISASCII':
+				if(preg_match("/[^\x20-\x7F]/", $field_value)) {
+					$errmsg = $validator['errmsg'];
+					if(isset($this->wordbook[$errmsg])) {
+						$this->errorMessage .= $this->wordbook[$errmsg]."<br />\r\n";
+					} else {
+						$this->errorMessage .= $errmsg."<br />\r\n";
+					}
+				}
 			case 'ISEMAIL':
 				if(function_exists('filter_var')) {
 					if(filter_var($field_value, FILTER_VALIDATE_EMAIL) === false) {
@@ -1293,7 +1306,7 @@
 		$perm = $app->db->quote($perm);
 		$table = $app->db->quote($table);
 		
-		if($_SESSION["s"]["user"]["typ"] == 'admin') {
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $_SESSION['s']['user']['mailuser_id'] > 0) {
 			return '1';
 		} else {
 			if ($table != ''){
@@ -1500,7 +1513,7 @@
 	 */
 	function _getDateTimeHTML($form_element, $default_value, $display_seconds=false)
 	{
-		$_datetime = strtotime($default_value);
+		$_datetime = ($default_value && $default_value != '0000-00-00 00:00:00' ? strtotime($default_value) : false);
 		$_showdate = ($_datetime === false) ? false : true;
 
 		$dselect = array('day', 'month', 'year', 'hour', 'minute');

--
Gitblit v1.9.1