From 89e4329a8068e3631d3f64f6896fa3907c687cf5 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Thu, 08 Jan 2015 09:08:50 -0500
Subject: [PATCH] Layout fix: tab toggle and monitor tables

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

diff --git a/interface/lib/classes/tform.inc.php b/interface/lib/classes/tform.inc.php
index f334508..7912f53 100644
--- a/interface/lib/classes/tform.inc.php
+++ b/interface/lib/classes/tform.inc.php
@@ -66,9 +66,11 @@
 		This function checks if a user has the parmissions $perm for the data record with the ID $record_id
 		If record_id = 0, the the permissions are tested against the defaults of the form file.
 		*/
+
 	function checkPerm($record_id, $perm) {
 		global $app;
 
+		$record_id = $app->functions->intval($record_id);
 		if($record_id > 0) {
 			// Add backticks for incomplete table names.
 			if(stristr($this->formDef['db_table'], '.')) {
@@ -163,7 +165,7 @@
 		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
 
 		// Get the limits of the client that is currently logged in
-		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
 		$client = $app->db->queryOneRecord("SELECT $limit_name as number, parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
 		// Check if the user may add another item
@@ -185,7 +187,7 @@
 		if($limit_name == '') $app->error('Limit name missing in function checkClientLimit.');
 
 		// Get the limits of the client that is currently logged in
-		$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		$client_group_id = $app->functions->intval($_SESSION["s"]["user"]["default_group"]);
 		$client = $app->db->queryOneRecord("SELECT parent_client_id FROM sys_group, client WHERE sys_group.client_id = client.client_id and sys_group.groupid = $client_group_id");
 
 		//* If the client belongs to a reseller, we will check against the reseller Limit too
@@ -248,7 +250,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