From 7ee336c7ccb5f8d35b8eb05cf5e812a42154cbc2 Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Wed, 15 Apr 2015 15:19:30 +0200
Subject: [PATCH] - ported some patches

---
 interface/web/dns/list/dns_slave.list.php              | 3 ++-
 interface/web/dns/list/dns_soa.list.php                | 3 ++-
 interface/web/mail/list/mail_domain.list.php           | 3 ++-
 interface/web/sites/list/database.list.php             | 3 ++-
 interface/web/sites/list/web_vhost_domain.list.php     | 3 ++-
 interface/web/themes/default/templates/sidenav.tpl.htm | 4 ++--
 server/lib/classes/cron.d/300-quota_notify.inc.php     | 5 +++++
 server/lib/classes/cron.d/500-backup.inc.php           | 2 +-
 8 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/interface/web/dns/list/dns_slave.list.php b/interface/web/dns/list/dns_slave.list.php
index 5c0be05fb3..9be70553f8 100644
--- a/interface/web/dns/list/dns_slave.list.php
+++ b/interface/web/dns/list/dns_slave.list.php
@@ -83,7 +83,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		'prefix' => "",
 		'suffix' => "",
 		'datasource' => array (  'type' => 'SQL',
-			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			//'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name",
 			'keyfield'=> 'groupid',
 			'valuefield'=> 'name'
 		),
diff --git a/interface/web/dns/list/dns_soa.list.php b/interface/web/dns/list/dns_soa.list.php
index d6f56414e0..f2adf6f611 100644
--- a/interface/web/dns/list/dns_soa.list.php
+++ b/interface/web/dns/list/dns_soa.list.php
@@ -83,7 +83,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		'prefix' => "",
 		'suffix' => "",
 		'datasource' => array (  'type' => 'SQL',
-			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			//'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name",
 			'keyfield'=> 'groupid',
 			'valuefield'=> 'name'
 		),
diff --git a/interface/web/mail/list/mail_domain.list.php b/interface/web/mail/list/mail_domain.list.php
index 6756f5bb25..6da4b8f85d 100644
--- a/interface/web/mail/list/mail_domain.list.php
+++ b/interface/web/mail/list/mail_domain.list.php
@@ -70,7 +70,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		'prefix' => "",
 		'suffix' => "",
 		'datasource' => array (  'type' => 'SQL',
-			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			//'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name",
 			'keyfield'=> 'groupid',
 			'valuefield'=> 'name'
 		),
diff --git a/interface/web/sites/list/database.list.php b/interface/web/sites/list/database.list.php
index 599cf96f43..82da7b4ebe 100644
--- a/interface/web/sites/list/database.list.php
+++ b/interface/web/sites/list/database.list.php
@@ -91,7 +91,8 @@ if($_SESSION['s']['user']['typ'] == 'admin') {
 		'prefix' => "",
 		'suffix' => "",
 		'datasource' => array (  'type' => 'SQL',
-			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			//'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name",
 			'keyfield'=> 'groupid',
 			'valuefield'=> 'name'
 		),
diff --git a/interface/web/sites/list/web_vhost_domain.list.php b/interface/web/sites/list/web_vhost_domain.list.php
index f997d7b410..eed93914fa 100644
--- a/interface/web/sites/list/web_vhost_domain.list.php
+++ b/interface/web/sites/list/web_vhost_domain.list.php
@@ -88,7 +88,8 @@ if($_SESSION['s']['user']['typ'] == 'admin' && $vhostdomain_type == 'domain') {
 		'prefix' => "",
 		'suffix' => "",
 		'datasource' => array (  'type' => 'SQL',
-			'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			//'querystring' => 'SELECT groupid, name FROM sys_group WHERE groupid != 1 ORDER BY name',
+			'querystring' => "SELECT sys_group.groupid,CONCAT(IF(client.company_name != '', CONCAT(client.company_name, ' :: '), ''), IF(client.contact_firstname != '', CONCAT(client.contact_firstname, ' '), ''), client.contact_name, ' (', client.username, IF(client.customer_no != '', CONCAT(', ', client.customer_no), ''), ')') as name FROM sys_group, client WHERE sys_group.groupid != 1 AND sys_group.client_id = client.client_id ORDER BY client.company_name, client.contact_name",
 			'keyfield'=> 'groupid',
 			'valuefield'=> 'name'
 		),
diff --git a/interface/web/themes/default/templates/sidenav.tpl.htm b/interface/web/themes/default/templates/sidenav.tpl.htm
index 9515c40ab5..b851003360 100644
--- a/interface/web/themes/default/templates/sidenav.tpl.htm
+++ b/interface/web/themes/default/templates/sidenav.tpl.htm
@@ -9,13 +9,13 @@
 			<tmpl_else>
 				<a href="#" data-load-content="<tmpl_var name='link'>">
 			</tmpl_if>
-		<tmpl_else>
-			<a href="#">
 		</tmpl_if>
 		  <div>
 			<strong><tmpl_var name="title"></strong>
 		  </div>
+		<tmpl_if name="link">
 		</a>
+		</tmpl_if>
 	  </li>
 	  </tmpl_loop>
 	</ul>
diff --git a/server/lib/classes/cron.d/300-quota_notify.inc.php b/server/lib/classes/cron.d/300-quota_notify.inc.php
index 9b2b79d0d8..d250fe7466 100644
--- a/server/lib/classes/cron.d/300-quota_notify.inc.php
+++ b/server/lib/classes/cron.d/300-quota_notify.inc.php
@@ -49,6 +49,11 @@ class cronjob_quota_notify extends cronjob {
 
 	public function onRunJob() {
 		global $app, $conf;
+		
+		/* used for all monitor cronjobs */
+		$app->load('monitor_tools');
+		$this->_tools = new monitor_tools();
+		/* end global section for monitor cronjobs */
 
 		//######################################################################################################
 		// enforce traffic quota (run only on the "master-server")
diff --git a/server/lib/classes/cron.d/500-backup.inc.php b/server/lib/classes/cron.d/500-backup.inc.php
index 6b200989ff..e16e2a89ff 100644
--- a/server/lib/classes/cron.d/500-backup.inc.php
+++ b/server/lib/classes/cron.d/500-backup.inc.php
@@ -228,7 +228,7 @@ class cronjob_backup extends cronjob {
 							$db_name = $rec['database_name'];
 							$db_backup_file = 'db_'.$db_name.'_'.date('Y-m-d_H-i').'.sql';
 							//$command = "mysqldump -h '".escapeshellcmd($clientdb_host)."' -u '".escapeshellcmd($clientdb_user)."' -p'".escapeshellcmd($clientdb_password)."' -c --add-drop-table --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
-							$command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --create-options --quick --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
+							$command = "mysqldump -h ".escapeshellarg($clientdb_host)." -u ".escapeshellarg($clientdb_user)." -p".escapeshellarg($clientdb_password)." -c --add-drop-table --create-options --quick --max_allowed_packet=512M --result-file='".$db_backup_dir.'/'.$db_backup_file."' '".$db_name."'";
 							exec($command, $tmp_output, $retval);
 
 							//* Compress the backup with gzip
-- 
GitLab