From b889edb33e4a09cc1f65d2fb9ad9f9ea16b1eae9 Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Tue, 04 Sep 2012 11:42:42 -0400
Subject: [PATCH] - Ported changes from Apache plugin to nginx plugin. - Fixed errors in system.inc.php-

---
 interface/lib/classes/remoting.inc.php |   15 +++++----------
 1 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/interface/lib/classes/remoting.inc.php b/interface/lib/classes/remoting.inc.php
index 8efecc8..ae731d7 100644
--- a/interface/lib/classes/remoting.inc.php
+++ b/interface/lib/classes/remoting.inc.php
@@ -1063,7 +1063,8 @@
 					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
 					return false;
 			}
-		$affected_rows = $this->klientadd('../client/form/client.tform.php',$reseller_id, $params);
+        if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+		$affected_rows = $this->klientadd('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php',$reseller_id, $params);
 		return $affected_rows;  
 				  
 	}
@@ -1077,7 +1078,8 @@
 					$this->server->fault('permission_denied','You do not have the permissions to access this function.');
 					return false;
 			}
-			$affected_rows = $this->updateQuery('../client/form/client.tform.php', $reseller_id, $client_id, $params);
+            if(!isset($params['parent_client_id']) || $params['parent_client_id'] == 0) $params['parent_client_id'] = $reseller_id;
+			$affected_rows = $this->updateQuery('../client/form/' . (isset($params['limit_client']) && $params['limit_client'] > 0 ? 'reseller' : 'client') . '.tform.php', $reseller_id, $client_id, $params);
 			
 			$app->remoting_lib->ispconfig_sysuser_update($params,$client_id);
 			
@@ -2612,13 +2614,6 @@
 		//* load the user profile of the client
 		$app->remoting_lib->loadUserProfile($reseller_id);
 		
-		//* load the client template
-		if(isset($params['template_master']) and $params['template_master'] > 0)
-		{
-			$template=$app->db->queryOneRecord("SELECT * FROM client_template WHERE template_id=".intval($params['template_master']));
-			if(is_array($template)) $params=array_merge($params,$template);
-		}
-		
 		//* Get the SQL query
 		$sql = $app->remoting_lib->getSQL($params,'INSERT',0);
 		
@@ -2647,7 +2642,7 @@
 		$this->id = $insert_id;
 		$this->dataRecord = $params;
 		
-		$app->plugin->raiseEvent('client:client:on_after_insert',$this);
+		$app->plugin->raiseEvent('client:' . ($reseller_id ? 'reseller' : 'client') . ':on_after_insert',$this);
 		
 		/*
 		if($app->db->errorMessage != '') {

--
Gitblit v1.9.1