From f5d9544164b039001906db98b59c92f7250553fb Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Tue, 05 Apr 2011 07:28:45 -0400
Subject: [PATCH] Meerged revisions 2265-2278 from stable branch.

---
 interface/web/client/client_edit.php                |   22 +++++++++++++++++++---
 interface/web/client/reseller_edit.php              |   19 +++++++++++++++++--
 interface/lib/classes/remoting_lib.inc.php          |    9 ++++++---
 interface/web/dashboard/dashboard.php               |    2 +-
 server/plugins-available/maildrop_plugin.inc.php    |    1 +
 server/plugins-available/maildeliver_plugin.inc.php |    1 +
 server/conf/bind_pri.domain.master                  |    2 +-
 7 files changed, 46 insertions(+), 10 deletions(-)

diff --git a/interface/lib/classes/remoting_lib.inc.php b/interface/lib/classes/remoting_lib.inc.php
index 57ff998..ecd71bf 100644
--- a/interface/lib/classes/remoting_lib.inc.php
+++ b/interface/lib/classes/remoting_lib.inc.php
@@ -701,7 +701,7 @@
 		function ispconfig_sysuser_update($params,$client_id){
 			global $app;
 			$username = $app->db->quote($params["username"]);
-			$password = $app->db->quote($params["password"]);
+			$clear_password = $app->db->quote($params["password"]);
 			$client_id = intval($client_id);
 			$salt="$1$";
 			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
@@ -709,8 +709,9 @@
 				$salt.=$base64_alphabet[mt_rand(0,63)];
 			}
 			$salt.="$";
-			$password = crypt(stripslashes($password),$salt);
-			$sql = "UPDATE sys_user set username = '$username', passwort = '$password' WHERE client_id = $client_id";
+			$password = crypt(stripslashes($clear_password),$salt);
+			if ($clear_password) $pwstring = ", passwort = '$password'"; else $pwstring ="" ;
+			$sql = "UPDATE sys_user set username = '$username' $pwstring WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
 		
@@ -719,6 +720,8 @@
 			$client_id = intval($client_id);
 			$sql = "DELETE FROM sys_user WHERE client_id = $client_id";
 			$app->db->query($sql);
+			$sql = "DELETE FROM sys_group WHERE client_id = $client_id";
+			$app->db->query($sql);
 		}
 
         function datalogSave($action,$primary_id, $record_old, $record_new) {
diff --git a/interface/web/client/client_edit.php b/interface/web/client/client_edit.php
index 4514b5c..843e435 100644
--- a/interface/web/client/client_edit.php
+++ b/interface/web/client/client_edit.php
@@ -150,6 +150,15 @@
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
 		
+		$salt="$1$";
+		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+		for ($n=0;$n<8;$n++) {
+			$salt.=$base64_alphabet[mt_rand(0,63)];
+		}
+		$salt.="$";
+		$password = crypt(stripslashes($password),$salt);
+		
+		// Create the controlpaneluser for the client
 		//Generate ssh-rsa-keys
 		exec('ssh-keygen -t rsa -C '.$username.'-rsa-key-'.time().' -f /tmp/id_rsa -N ""');
 		$app->db->query("UPDATE client SET created_at = ".time().", id_rsa = '".file_get_contents('/tmp/id_rsa')."', ssh_rsa = '".file_get_contents('/tmp/id_rsa.pub')."' WHERE client_id = ".$this->id;
@@ -157,7 +166,7 @@
 		
 		// Create the controlpaneluser for the client
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
-		VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
+		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
 		
 		//* If the user who inserted the client is a reseller (not admin), we will have to add this new client group 
@@ -198,8 +207,15 @@
 		// password changed
 		if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
+			$salt="$1$";
+			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+			for ($n=0;$n<8;$n++) {
+				$salt.=$base64_alphabet[mt_rand(0,63)];
+			}
+			$salt.="$";
+			$password = crypt(stripslashes($password),$salt);
 			$client_id = $this->id;
-			$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
+			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
 		
@@ -232,4 +248,4 @@
 $page = new page_action;
 $page->onLoad();
 
-?>
+?>
\ No newline at end of file
diff --git a/interface/web/client/reseller_edit.php b/interface/web/client/reseller_edit.php
index 1c9a2a1..9ab6369 100644
--- a/interface/web/client/reseller_edit.php
+++ b/interface/web/client/reseller_edit.php
@@ -150,9 +150,17 @@
 		$active = 1;
 		$language = $app->db->quote($this->dataRecord["language"]);
 		
+		$salt="$1$";
+		$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+		for ($n=0;$n<8;$n++) {
+			$salt.=$base64_alphabet[mt_rand(0,63)];
+		}
+		$salt.="$";
+		$password = crypt(stripslashes($password),$salt);
+		
 		// Create the controlpaneluser for the reseller
 		$sql = "INSERT INTO sys_user (username,passwort,modules,startmodule,app_theme,typ,active,language,groups,default_group,client_id)
-		VALUES ('$username',md5('$password'),'$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
+		VALUES ('$username','$password','$modules','$startmodule','$usertheme','$type','$active','$language',$groups,$groupid,".$this->id.")";
 		$app->db->query($sql);
 		
 		//* set the number of clients to 1
@@ -188,7 +196,14 @@
 		if($conf['demo_mode'] != true && isset($this->dataRecord["password"]) && $this->dataRecord["password"] != '') {
 			$password = $app->db->quote($this->dataRecord["password"]);
 			$client_id = $this->id;
-			$sql = "UPDATE sys_user SET passwort = md5('$password') WHERE client_id = $client_id";
+			$salt="$1$";
+			$base64_alphabet='ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+			for ($n=0;$n<8;$n++) {
+				$salt.=$base64_alphabet[mt_rand(0,63)];
+			}
+			$salt.="$";
+			$password = crypt(stripslashes($password),$salt);
+			$sql = "UPDATE sys_user SET passwort = '$password' WHERE client_id = $client_id";
 			$app->db->query($sql);
 		}
 		
diff --git a/interface/web/dashboard/dashboard.php b/interface/web/dashboard/dashboard.php
index 377f563..a7ed82e 100644
--- a/interface/web/dashboard/dashboard.php
+++ b/interface/web/dashboard/dashboard.php
@@ -131,7 +131,7 @@
 
 /* Which dashlets in which column */
 /******************************************************************************/
-$leftcol_dashlets = array('modules');
+$leftcol_dashlets = array('modules','invoices');
 $rightcol_dashlets = array('limits');
 /******************************************************************************/
 
diff --git a/server/conf/bind_pri.domain.master b/server/conf/bind_pri.domain.master
index 057daad..0bd54b7 100644
--- a/server/conf/bind_pri.domain.master
+++ b/server/conf/bind_pri.domain.master
@@ -12,7 +12,7 @@
 {tmpl_var name='name'}      NS        {tmpl_var name='data'}
 </tmpl_if>
 <tmpl_if name="type" op='==' value='A'>
-{tmpl_var name='name'}      A        {tmpl_var name='data'}
+{tmpl_var name='name'} {tmpl_var name='ttl'} A        {tmpl_var name='data'}
 </tmpl_if>
 <tmpl_if name="type" op='==' value='AAAA'>
 {tmpl_var name='name'}      AAAA        {tmpl_var name='data'}
diff --git a/server/plugins-available/maildeliver_plugin.inc.php b/server/plugins-available/maildeliver_plugin.inc.php
index 33f00ae..4d0b465 100644
--- a/server/plugins-available/maildeliver_plugin.inc.php
+++ b/server/plugins-available/maildeliver_plugin.inc.php
@@ -60,6 +60,7 @@
 		Register for the events
 		*/
 		
+		$app->plugins->registerEvent('mail_user_insert','maildeliver_plugin','update');
 		$app->plugins->registerEvent('mail_user_update','maildeliver_plugin','update');
 		$app->plugins->registerEvent('mail_user_delete','maildeliver_plugin','delete');
 		
diff --git a/server/plugins-available/maildrop_plugin.inc.php b/server/plugins-available/maildrop_plugin.inc.php
index 3b1360f..a0ad50e 100644
--- a/server/plugins-available/maildrop_plugin.inc.php
+++ b/server/plugins-available/maildrop_plugin.inc.php
@@ -60,6 +60,7 @@
 		Register for the events
 		*/
 		
+		$app->plugins->registerEvent('mail_user_update','maildrop_plugin','insert');
 		$app->plugins->registerEvent('mail_user_update','maildrop_plugin','update');
 		$app->plugins->registerEvent('mail_user_delete','maildrop_plugin','delete');
 		

--
Gitblit v1.9.1