diff --git a/install/lib/installer_base.lib.php b/install/lib/installer_base.lib.php
index 41013564bf25d2b82472ff9798bf3cd2212b13ed..d33b304744bf82c08d2a871846bd333693cdbe64 100644
--- a/install/lib/installer_base.lib.php
+++ b/install/lib/installer_base.lib.php
@@ -159,6 +159,11 @@ class installer_base {
 			if(count($db_tables) == 0) {
 				$this->error('Unable to load SQL-Dump into database table.');
 			}
+			
+			//* Load system.ini into the sys_ini table
+			$system_ini = $this->db->quote(rf('tpl/system.ini.master'));
+			$this->db->query("UPDATE sys_ini SET config = '$system_ini' WHERE sysini_id = 1");
+			
 		}
 	}
 	
diff --git a/install/sql/ispconfig3.sql b/install/sql/ispconfig3.sql
index fbb2539088f5041ab087b23a02f6d1160b192051..cc5b8938b32ae542feb69391f3e690bf281ea443 100644
--- a/install/sql/ispconfig3.sql
+++ b/install/sql/ispconfig3.sql
@@ -997,6 +997,24 @@ INSERT INTO `sys_group` (`groupid`, `name`, `description`, `client_id`) VALUES (
 
 -- --------------------------------------------------------
 
+-- 
+-- Tabellenstruktur für Tabelle `sys_ini`
+-- 
+
+CREATE TABLE `sys_ini` (
+  `sysini_id` int(11) NOT NULL auto_increment,
+  `config` longtext NOT NULL,
+  PRIMARY KEY  (`sysini_id`)
+) ENGINE=MyISAM AUTO_INCREMENT=1 ;
+
+-- 
+-- Daten für Tabelle `sys_ini`
+-- 
+
+INSERT INTO `sys_ini` (`sysini_id`, `config`) VALUES (1, '');
+
+-- --------------------------------------------------------
+
 -- 
 -- Tabellenstruktur für Tabelle `sys_log`
 -- 
diff --git a/install/tpl/system.ini.master b/install/tpl/system.ini.master
new file mode 100644
index 0000000000000000000000000000000000000000..2ef756e1a81cadb925774bea97db1577c2e9fd96
--- /dev/null
+++ b/install/tpl/system.ini.master
@@ -0,0 +1,19 @@
+[global]
+
+[admin]
+
+[client]
+
+[dns]
+
+[mail]
+
+[monitor]
+
+[sites]
+dbname_prefix=[CLIENTNAME]_
+dbuser_prefix=[CLIENTNAME]
+ftpuser_prefix=[CLIENTNAME]
+shelluser_prefix=[CLIENTNAME]
+
+[tools]
\ No newline at end of file
diff --git a/install/update.php b/install/update.php
index 0bfaf3d376466b6b00efd8a9e7d2d113896020c8..8af109761002be896029f866904a848a2d3765c2 100644
--- a/install/update.php
+++ b/install/update.php
@@ -199,6 +199,28 @@ unset($tpl_ini_array);
 unset($new_ini);
 
 
+//** Update system ini
+$tmp_server_rec = $inst->db->queryOneRecord("SELECT config FROM sys_ini WHERE sysini_id = 1");
+$old_ini_array = ini_to_array(stripslashes($tmp_server_rec['config']));
+unset($tmp_server_rec);
+$tpl_ini_array = ini_to_array(rf('tpl/system.ini.master'));
+
+// update the new template with the old values
+if(is_array($old_ini_array)) {
+	foreach($old_ini_array as $tmp_section_name => $tmp_section_content) {
+		foreach($tmp_section_content as $tmp_var_name => $tmp_var_content) {
+			$tpl_ini_array[$tmp_section_name][$tmp_var_name] = $tmp_var_content;
+		}
+	}
+}
+
+$new_ini = array_to_ini($tpl_ini_array);
+$inst->db->query("UPDATE sys_ini SET config = '".mysql_real_escape_string($new_ini)."' WHERE sysini_id = 1");
+unset($old_ini_array);
+unset($tpl_ini_array);
+unset($new_ini);
+
+
 //** Shall the services be reconfigured during update
 $reconfigure_services_answer = $inst->simple_query('Reconfigure Services?', array('yes','no'),'yes');
 
diff --git a/interface/lib/classes/getconf.inc.php b/interface/lib/classes/getconf.inc.php
index 097342c53adde7bdc918e9f2e9cda6a7daeb7fb2..2a9dcc1a06f45cdff38b0dcaa30b7c91a778fbc6 100644
--- a/interface/lib/classes/getconf.inc.php
+++ b/interface/lib/classes/getconf.inc.php
@@ -44,9 +44,15 @@ class getconf {
 		return ($section == '') ? $this->config[$server_id] : $this->config[$server_id][$section];
 	}
 	
-	public function get_global_config() {
+	public function get_global_config($section = '') {
+		global $app;
 		
-		die("not yet implemented");
+		if(!is_array($this->config['global'])) {
+			$app->uses('ini_parser');
+			$tmp = $app->db->queryOneRecord("SELECT config FROM sys_ini WHERE sysini_id = 1");
+			$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp["config"]));
+		}
+		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
 }
 
diff --git a/interface/web/sites/database_edit.php b/interface/web/sites/database_edit.php
index 514726510cf9edfbdb05b0c19f7e3ddc4f2827a7..5ed2dc88e91dec7a6b9ee9e329154bb7e3ec383f 100644
--- a/interface/web/sites/database_edit.php
+++ b/interface/web/sites/database_edit.php
@@ -153,39 +153,25 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		if ($interfaceConf['restrict_names'] == true){
-			/* get the restriction */
-			$restriction = '[CLIENTNAME]_';
-			if (isset($interfaceConf['restrict_dbname'])) $restriction = $interfaceConf['restrict_dbname'];
-			$tmpRestriction = $restriction;
-			/* Get the group-id */
-			if($_SESSION["s"]["user"]["typ"] != 'admin') {
-				// Get the group-id of the user
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			}
-			else {
-				// Get the group-id from the data itself
-				$client_group_id = $this->dataRecord['sys_groupid'];
-			}
-			/* get the name of the client */
-			$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-			$clientName = $tmp['name'];
-			if ($clientName == "") $clientName = 'default';
-			$clientName = convertClientName($clientName);
-			$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-			if ($this->dataRecord['database_name'] != ""){
-				/* REMOVE the restriction */
-				$app->tpl->setVar("database_name", str_replace($restriction , '', $this->dataRecord['database_name']));
-				$app->tpl->setVar("database_user", str_replace($restriction , '', $this->dataRecord['database_user']));
-			}
-			if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-				$app->tpl->setVar("database_name_prefix", $tmpRestriction);
-				$app->tpl->setVar("database_user_prefix", $tmpRestriction);
-			}
-			else {
-				$app->tpl->setVar("database_name_prefix", $restriction);
-				$app->tpl->setVar("database_user_prefix", $restriction);
-			}
+		
+		//* Get the database name and database user prefix
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$dbname_prefix = ($global_config['dbname_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbname_prefix']);
+		$dbuser_prefix = ($global_config['dbuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbuser_prefix']);
+		
+		if ($this->dataRecord['database_name'] != ""){
+			/* REMOVE the restriction */
+			$app->tpl->setVar("database_name", str_replace($dbname_prefix , '', $this->dataRecord['database_name']));
+			$app->tpl->setVar("database_user", str_replace($dbuser_prefix , '', $this->dataRecord['database_user']));
+		}
+		
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			$app->tpl->setVar("database_name_prefix", $global_config['dbname_prefix']);
+			$app->tpl->setVar("database_user_prefix", $global_config['dbuser_prefix']);
+		} else {
+			$app->tpl->setVar("database_name_prefix", $dbname_prefix);
+			$app->tpl->setVar("database_user_prefix", $dbuser_prefix);
 		}
 
 		parent::onShowEnd();
@@ -233,44 +219,23 @@ class page_action extends tform_actions {
 		global $app, $conf, $interfaceConf;
 
 		/*
-		 * If the names should be restricted -> do it!
-		 */
-		if ($interfaceConf['restrict_names'] == true){
-			/* get the restriction */
-			$restriction = '[CLIENTNAME]_';
-			if (isset($interfaceConf['restrict_dbname'])) $restriction = $interfaceConf['restrict_dbname'];
-
-			/* Get the group-id */
-			if($_SESSION["s"]["user"]["typ"] != 'admin') {
-				// Get the group-id of the user
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			}
-			else {
-				// Get the group-id from the data itself
-				$client_group_id = $this->dataRecord['client_group_id'];
-			}
-			/* get the name of the client */
-			$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-			$clientName = $tmp['name'];
-			if ($clientName == "") $clientName = 'default';
-			$clientName = convertClientName($clientName);
-			$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-		}
-		else {
-			$restriction = '';
-		}
-
-		$error = false;
+		* If the names should be restricted -> do it!
+		*/
+		
+		
+		//* Get the database name and database user prefix
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$dbname_prefix = ($global_config['dbname_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbname_prefix']);
+		$dbuser_prefix = ($global_config['dbuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbuser_prefix']);
 
 		//* Prevent that the database name and charset is changed
 		$old_record = $app->tform->getDataRecord($this->id);
 		if($old_record["database_name"] != $restriction . $this->dataRecord["database_name"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_name_change_txt"].'<br />';
-			$error = true;
 		}
 		if($old_record["database_charset"] != $this->dataRecord["database_charset"]) {
 			$app->tform->errorMessage .= $app->tform->wordbook["database_charset_change_txt"].'<br />';
-			$error = true;
 		}
 
 		//* Check if the server has been changed
@@ -280,15 +245,14 @@ class page_action extends tform_actions {
 				//* Add a error message and switch back to old server
 				$app->tform->errorMessage .= $app->lng('The Server can not be changed.');
 				$this->dataRecord["server_id"] = $rec['server_id'];
-				$error = true;
 			}
 		}
 		unset($old_record);
 
-		if ($error == false){
+		if ($app->tform->errorMessage == ''){
 			/* restrict the names if there is no error */
-			$this->dataRecord['database_name'] = $restriction . $this->dataRecord['database_name'];
-			$this->dataRecord['database_user'] = $restriction . $this->dataRecord['database_user'];
+			$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name'];
+			$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user'];
 		}
 
 		parent::onBeforeUpdate();
@@ -297,34 +261,16 @@ class page_action extends tform_actions {
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
 
-		/*
-		 * If the names should be restricted -> do it!
-		 */
-		if ($interfaceConf['restrict_names'] == true){
-			/* get the restriction */
-			$restriction = '[CLIENTNAME]_';
-			if (isset($interfaceConf['restrict_dbname'])) $restriction = $interfaceConf['restrict_dbname'];
-
-			/* Get the group-id */
-			if($_SESSION["s"]["user"]["typ"] != 'admin') {
-				// Get the group-id of the user
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			}
-			else {
-				// Get the group-id from the data itself
-				$client_group_id = $this->dataRecord['client_group_id'];
-			}
-			/* get the name of the client */
-			$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-			$clientName = $tmp['name'];
-			if ($clientName == "") $clientName = 'default';
-			$clientName = convertClientName($clientName);
-			$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-
-			/* restrict the names */
-			$this->dataRecord['database_name'] = $restriction . $this->dataRecord['database_name'];
-			$this->dataRecord['database_user'] = $restriction . $this->dataRecord['database_user'];
-		}
+		//* Get the database name and database user prefix
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$dbname_prefix = ($global_config['dbname_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbname_prefix']);
+		$dbuser_prefix = ($global_config['dbuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['dbuser_prefix']);
+
+		/* restrict the names */
+		$this->dataRecord['database_name'] = $dbname_prefix . $this->dataRecord['database_name'];
+		$this->dataRecord['database_user'] = $dbuser_prefix . $this->dataRecord['database_user'];
+
 		parent::onBeforeInsert();
 	}
 
@@ -358,6 +304,24 @@ class page_action extends tform_actions {
 		}
 
 	}
+	
+	function getClientName() {
+		global $app, $conf;
+	
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the group-id of the user
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			$client_group_id = $this->dataRecord['client_group_id'];
+		}
+		/* get the name of the client */
+		$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
+		$clientName = $tmp['name'];
+		if ($clientName == "") $clientName = 'default';
+		$clientName = convertClientName($clientName);
+	
+	}
 
 }
 
diff --git a/interface/web/sites/ftp_user_edit.php b/interface/web/sites/ftp_user_edit.php
index 980e00f8524364fed2669ef51681eea98641f8bc..2ceff9c125897b1a95a8da7f4bf13c19826dcb33 100644
--- a/interface/web/sites/ftp_user_edit.php
+++ b/interface/web/sites/ftp_user_edit.php
@@ -79,38 +79,20 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		if ($interfaceConf['restrict_names'] == true){
-			/* get the restriction */
-			$restriction = '[CLIENTNAME]_';
-			if (isset($interfaceConf['restrict_ftpuser'])) $restriction = $interfaceConf['restrict_ftpuser'];
-			$tmplRestriction = $restriction;
-			/* Get the group-id */
-			if($_SESSION["s"]["user"]["typ"] != 'admin') {
-				// Get the group-id of the user
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			}
-			else {
-				// Get the group-id from the data itself
-				$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-				$client_group_id = $web['sys_groupid'];
-			}
-			/* get the name of the client */
-			$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-			$clientName = $tmp['name'];
-			if ($clientName == "") $clientName = 'default';
-			$clientName = convertClientName($clientName);
-			$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-			if ($this->dataRecord['username'] != ""){
-				/* REMOVE the restriction */
-				$app->tpl->setVar("username", str_replace($restriction , '', $this->dataRecord['username']));
-				$app->tpl->setVar("username", str_replace($restriction , '', $this->dataRecord['username']));
-			}
-			if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-				$app->tpl->setVar("username_prefix", $tmplRestriction);
-			}
-			else {
-				$app->tpl->setVar("username_prefix", $restriction);
-			}
+		
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$ftpuser_prefix = ($global_config['ftpuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['ftpuser_prefix']);
+		
+		if ($this->dataRecord['username'] != ""){
+			/* REMOVE the restriction */
+			$app->tpl->setVar("username", str_replace($ftpuser_prefix , '', $this->dataRecord['username']));
+		}
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			$app->tpl->setVar("username_prefix", $global_config['ftpuser_prefix']);
+		}
+		else {
+			$app->tpl->setVar("username_prefix", $ftpuser_prefix);
 		}
 
 		parent::onShowEnd();
@@ -130,39 +112,15 @@ class page_action extends tform_actions {
 	
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
-
-		$error = false;
-
-		/*
-		 * If the names should be restricted -> do it!
-		 */
-		if ($error == false){
-			if ($interfaceConf['restrict_names'] == true){
-				/* get the restriction */
-				$restriction = '[CLIENTNAME]_';
-				if (isset($interfaceConf['restrict_ftpuser'])) $restriction = $interfaceConf['restrict_ftpuser'];
-
-				/* Get the group-id */
-				if($_SESSION["s"]["user"]["typ"] != 'admin') {
-					// Get the group-id of the user
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				}
-				else {
-					// Get the group-id from the data itself
-					$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-					$client_group_id = $web['sys_groupid'];
-				}
-				/* get the name of the client */
-				$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-				$clientName = $tmp['name'];
-				if ($clientName == "") $clientName = 'default';
-				$clientName = convertClientName($clientName);
-				$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-
-				/* restrict the names */
-				$this->dataRecord['username'] = $restriction . $this->dataRecord['username'];
-			}
+		
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$ftpuser_prefix = ($global_config['ftpuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['ftpuser_prefix']);
+		
+		if ($app->tform->errorMessage == '') {
+			$this->dataRecord['username'] = $ftpuser_prefix . $this->dataRecord['username'];
 		}
+		
 		parent::onBeforeInsert();
 	}
 
@@ -187,39 +145,17 @@ class page_action extends tform_actions {
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
 
-		$error = false;
-
 		/*
 		 * If the names should be restricted -> do it!
 		 */
-		if ($error == false){
-			/*
-			* If the names should be restricted -> do it!
-			*/
-			if ($interfaceConf['restrict_names'] == true){
-				/* get the restriction */
-				$restriction = '[CLIENTNAME]_';
-				if (isset($interfaceConf['restrict_dbname'])) $restriction = $interfaceConf['restrict_dbname'];
-
-				/* Get the group-id */
-				if($_SESSION["s"]["user"]["typ"] != 'admin') {
-					// Get the group-id of the user
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				}
-				else {
-					// Get the group-id from the data itself
-					$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-					$client_group_id = $web['sys_groupid'];
-				}
-				/* get the name of the client */
-				$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-				$clientName = $tmp['name'];
-				if ($clientName == "") $clientName = 'default';
-				$clientName = convertClientName($clientName);
-				$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-				/* restrict the names */
-				$this->dataRecord['username'] = $restriction . $this->dataRecord['username'];
-			}
+		
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$ftpuser_prefix = ($global_config['ftpuser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['ftpuser_prefix']);
+		
+		/* restrict the names */
+		if ($app->tform->errorMessage == '') {
+			$this->dataRecord['username'] = $restriction . $this->dataRecord['username'];
 		}
 	}
 	
@@ -229,6 +165,24 @@ class page_action extends tform_actions {
 		
 	}
 	
+	function getClientName() {
+		global $app, $conf;
+	
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the group-id of the user
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			$client_group_id = $this->dataRecord['client_group_id'];
+		}
+		/* get the name of the client */
+		$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
+		$clientName = $tmp['name'];
+		if ($clientName == "") $clientName = 'default';
+		$clientName = convertClientName($clientName);
+	
+	}
+	
 }
 
 $page = new page_action;
diff --git a/interface/web/sites/shell_user_edit.php b/interface/web/sites/shell_user_edit.php
index d45413ae67492fd5aeccf69af07f0a84cfdc72ec..0ce040463165a5cf4608daa66c828d50f871f1b0 100644
--- a/interface/web/sites/shell_user_edit.php
+++ b/interface/web/sites/shell_user_edit.php
@@ -79,38 +79,19 @@ class page_action extends tform_actions {
 		 * If the names are restricted -> remove the restriction, so that the
 		 * data can be edited
 		 */
-		if ($interfaceConf['restrict_names'] == true){
-			/* get the restriction */
-			$restriction = '[CLIENTNAME]_';
-			if (isset($interfaceConf['restrict_shelluser'])) $restriction = $interfaceConf['restrict_shelluser'];
-			$tmplRestriction = $restriction;
-			/* Get the group-id */
-			if($_SESSION["s"]["user"]["typ"] != 'admin') {
-				// Get the group-id of the user
-				$client_group_id = $_SESSION["s"]["user"]["default_group"];
-			}
-			else {
-				// Get the group-id from the data itself
-				$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-				$client_group_id = $web['sys_groupid'];
-			}
-			/* get the name of the client */
-			$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-			$clientName = $tmp['name'];
-			if ($clientName == "") $clientName = 'default';
-			$clientName = convertClientName($clientName);
-			$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-			if ($this->dataRecord['username'] != ""){
-				/* REMOVE the restriction */
-				$app->tpl->setVar("username", str_replace($restriction , '', $this->dataRecord['username']));
-				$app->tpl->setVar("username", str_replace($restriction , '', $this->dataRecord['username']));
-			}
-			if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
-				$app->tpl->setVar("username_prefix", $tmplRestriction);
-			}
-			else {
-				$app->tpl->setVar("username_prefix", $restriction);
-			}
+		
+		$app->uses('getconf');
+		$global_config = $app->getconf->get_global_config('sites');
+		$shelluser_prefix = ($global_config['shelluser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['shelluser_prefix']);
+		
+		if ($this->dataRecord['username'] != ""){
+			/* REMOVE the restriction */
+			$app->tpl->setVar("username", str_replace($shelluser_prefix , '', $this->dataRecord['username']));
+		}
+		if($_SESSION["s"]["user"]["typ"] == 'admin' || $app->auth->has_clients($_SESSION['s']['user']['userid'])) {
+			$app->tpl->setVar("username_prefix", $global_config['shelluser_prefix']);
+		} else {
+			$app->tpl->setVar("username_prefix", $shelluser_prefix);
 		}
 
 		parent::onShowEnd();
@@ -131,13 +112,11 @@ class page_action extends tform_actions {
 	function onBeforeInsert() {
 		global $app, $conf, $interfaceConf;
 
-		$error = false;
 		// check if the username is not blacklisted
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
 			if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
 				$app->tform->errorMessage .= 'The username is not allowed.';
-				$error = true;
 			}
 		}
 		unset($blacklist);
@@ -145,32 +124,14 @@ class page_action extends tform_actions {
 		/*
 		 * If the names should be restricted -> do it!
 		 */
-		if ($error == false){
-			if ($interfaceConf['restrict_names'] == true){
-				/* get the restriction */
-				$restriction = '[CLIENTNAME]_';
-				if (isset($interfaceConf['restrict_shelluser'])) $restriction = $interfaceConf['restrict_shelluser'];
-
-				/* Get the group-id */
-				if($_SESSION["s"]["user"]["typ"] != 'admin') {
-					// Get the group-id of the user
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				}
-				else {
-					// Get the group-id from the data itself
-					$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-					$client_group_id = $web['sys_groupid'];
-				}
-				/* get the name of the client */
-				$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-				$clientName = $tmp['name'];
-				if ($clientName == "") $clientName = 'default';
-				$clientName = convertClientName($clientName);
-				$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-
-				/* restrict the names */
-				$this->dataRecord['username'] = $restriction . $this->dataRecord['username'];
-			}
+		if ($app->tform->errorMessage == ''){
+			
+			$app->uses('getconf');
+			$global_config = $app->getconf->get_global_config('sites');
+			$shelluser_prefix = ($global_config['shelluser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['shelluser_prefix']);
+
+			/* restrict the names */
+			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
 		}
 		parent::onBeforeInsert();
 	}
@@ -195,13 +156,11 @@ class page_action extends tform_actions {
 	function onBeforeUpdate() {
 		global $app, $conf, $interfaceConf;
 		
-		$error = false;
 		// check if the username is not blacklisted
 		$blacklist = file(ISPC_LIB_PATH.'/shelluser_blacklist');
 		foreach($blacklist as $line) {
 			if(strtolower(trim($line)) == strtolower(trim($this->dataRecord['username']))){
 				$app->tform->errorMessage .= 'The username is not allowed.';
-				$error = true;
 			}
 		}
 		unset($blacklist);
@@ -209,34 +168,16 @@ class page_action extends tform_actions {
 		/*
 		 * If the names should be restricted -> do it!
 		 */
-		if ($error == false){
+		if ($app->tform->errorMessage == '') {
 			/*
 			* If the names should be restricted -> do it!
 			*/
-			if ($interfaceConf['restrict_names'] == true){
-				/* get the restriction */
-				$restriction = '[CLIENTNAME]_';
-				if (isset($interfaceConf['restrict_dbname'])) $restriction = $interfaceConf['restrict_dbname'];
-
-				/* Get the group-id */
-				if($_SESSION["s"]["user"]["typ"] != 'admin') {
-					// Get the group-id of the user
-					$client_group_id = $_SESSION["s"]["user"]["default_group"];
-				}
-				else {
-					// Get the group-id from the data itself
-					$web = $app->db->queryOneRecord("SELECT sys_groupid FROM web_domain WHERE domain_id = ".intval($this->dataRecord["parent_domain_id"]));
-					$client_group_id = $web['sys_groupid'];
-				}
-				/* get the name of the client */
-				$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
-				$clientName = $tmp['name'];
-				if ($clientName == "") $clientName = 'default';
-				$clientName = convertClientName($clientName);
-				$restriction = str_replace('[CLIENTNAME]', $clientName, $restriction);
-				/* restrict the names */
-				$this->dataRecord['username'] = $restriction . $this->dataRecord['username'];
-			}
+			$app->uses('getconf');
+			$global_config = $app->getconf->get_global_config('sites');
+			$shelluser_prefix = ($global_config['shelluser_prefix'] == '')?'':str_replace('[CLIENTNAME]', $this->getClientName(), $global_config['shelluser_prefix']);
+			
+			/* restrict the names */
+			$this->dataRecord['username'] = $shelluser_prefix . $this->dataRecord['username'];
 		}
 	}
 	
@@ -246,6 +187,24 @@ class page_action extends tform_actions {
 		
 	}
 	
+	function getClientName() {
+		global $app, $conf;
+	
+		if($_SESSION["s"]["user"]["typ"] != 'admin') {
+			// Get the group-id of the user
+			$client_group_id = $_SESSION["s"]["user"]["default_group"];
+		} else {
+			// Get the group-id from the data itself
+			$client_group_id = $this->dataRecord['client_group_id'];
+		}
+		/* get the name of the client */
+		$tmp = $app->db->queryOneRecord("SELECT name FROM sys_group WHERE groupid = " . $client_group_id);
+		$clientName = $tmp['name'];
+		if ($clientName == "") $clientName = 'default';
+		$clientName = convertClientName($clientName);
+	
+	}
+	
 }
 
 $page = new page_action;
diff --git a/interface/web/sites/tools.inc.php b/interface/web/sites/tools.inc.php
index 400c05fe169e4399509d8fffff2dd3b6f7a0c5fe..c2b8297f87e470851f83e31b9312a23b28c09df8 100644
--- a/interface/web/sites/tools.inc.php
+++ b/interface/web/sites/tools.inc.php
@@ -17,4 +17,6 @@ function convertClientName($name){
 	}
 	return $res;
 }
+
+
 ?>
diff --git a/server/lib/classes/getconf.inc.php b/server/lib/classes/getconf.inc.php
index 7bff61fc91b75d29a3ff3ea45b03b9c325f650d5..a4bc83234cacce74799e4e808c34fa1dad7770ff 100644
--- a/server/lib/classes/getconf.inc.php
+++ b/server/lib/classes/getconf.inc.php
@@ -49,10 +49,15 @@ class getconf {
 		}
 	}
 	
-	function get_global_config() {
-		
-		die("not yet implemented");
+	public function get_global_config($section = '') {
+		global $app;
 		
+		if(!is_array($this->config['global'])) {
+			$app->uses('ini_parser');
+			$tmp = $app->db->queryOneRecord("SELECT config FROM sys_ini WHERE sysini_id = 1");
+			$this->config['global'] = $app->ini_parser->parse_ini_string(stripslashes($tmp["config"]));
+		}
+		return ($section == '') ? $this->config['global'] : $this->config['global'][$section];
 	}
 	
 }