From 7fd3342945454649f583029f09ad982d0973ae8d Mon Sep 17 00:00:00 2001
From: ftimme <ft@falkotimme.com>
Date: Thu, 01 Nov 2012 10:23:56 -0400
Subject: [PATCH] - Bugfix: system username was not changed when client username was modified.

---
 interface/web/client/client_edit.php   |    2 +-
 interface/web/client/reseller_edit.php |    8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 350244c..6f7cf53 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -190,7 +190,7 @@
 	 the data was successful updated in the database.
 	*/
 	function onAfterUpdate() {
-		global $app;
+		global $app, $conf;
 		// username changed
 		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
 			$username = $app->db->quote($this->dataRecord["username"]);
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index d482bdb..83754f3 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -190,7 +190,7 @@
 		global $app, $conf;
 		
 		// username changed
-		if($conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['username']) && $this->dataRecord['username'] != '' && $this->oldDataRecord['username'] != $this->dataRecord['username']) {
 			$username = $app->db->quote($this->dataRecord["username"]);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET username = '$username' WHERE client_id = $client_id";
@@ -202,7 +202,7 @@
 		}
 		
 		// password changed
-		if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
 			$client_id = $this->id;
 			$salt="$1$";
@@ -217,7 +217,7 @@
 		}
 		
 		// language changed
-		if($conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] != true && isset($this->dataRecord['language']) && $this->dataRecord['language'] != '' && $this->oldDataRecord['language'] != $this->dataRecord['language']) {
 			$language = $app->db->quote($this->dataRecord["language"]);
 			$client_id = $this->id;
 			$sql = "UPDATE sys_user SET language = '$language' WHERE client_id = $client_id";
@@ -225,7 +225,7 @@
 		}
 		
 		// ensure that a reseller is not converted to a client in demo mode when client_id <= 2
-		if($conf['demo_mode'] == true && $this->id <= 2) {
+		if(isset($conf['demo_mode']) && $conf['demo_mode'] == true && $this->id <= 2) {
 			if(isset($this->dataRecord["limit_client"]) && $this->dataRecord["limit_client"] != -1) {
 				$app->db->query('UPDATE client set limit_client = -1 WHERE client_id = '.$this->id);
 			}

--
Gitblit v1.9.1