From 0732d32f508045da40fe9df607b9ef20ce2d198f Mon Sep 17 00:00:00 2001
From: xaver <xaver@ispconfig3>
Date: Tue, 06 Mar 2012 10:03:23 -0500
Subject: [PATCH] join fix - disappered in commit + Switch traffic joins, because its faster - Tested in a productive system (MySQL 5.1) as query few tausend domains 1-3 sec for Webtraffic sort, faster SQL = faster and MySQL 5.5 is much faster with joins (standard is not sorted with slow traffic querys) -> slowest part is coping the tables into temp -> more tweeks on cache... -> faster by heavy use

---
 interface/web/sites/database_phpmyadmin.php |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/interface/web/sites/database_phpmyadmin.php b/interface/web/sites/database_phpmyadmin.php
index 84a31c6..e0ab324 100644
--- a/interface/web/sites/database_phpmyadmin.php
+++ b/interface/web/sites/database_phpmyadmin.php
@@ -53,12 +53,26 @@
 $serverData = $app->db->queryOneRecord(
     "SELECT server_name FROM server WHERE server_id = " .
     $serverId);
+	
+$app->uses('getconf');
+$global_config = $app->getconf->get_global_config('sites');
+$web_config = $app->getconf->get_server_config($serverId,'web');
 
 /*
  * We only redirect to the login-form, so there is no need, to check any rights
  */
-isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
-($_SERVER["SERVER_PORT"] != '80' and $http == 'https')? $serverPort = ':'.$_SERVER["SERVER_PORT"] : $serverPort = '';
-header('location:'.$http.'://'.$serverData['server_name'].$serverPort.'/phpmyadmin');
+ 
+if($global_config['phpmyadmin_url'] != '') {
+	$phpmyadmin_url = $global_config['phpmyadmin_url'];
+	$phpmyadmin_url = str_replace('[SERVERNAME]',$serverData['server_name'],$phpmyadmin_url);
+	header('Location:'.$phpmyadmin_url);
+} else {
+	isset($_SERVER['HTTPS'])? $http = 'https' : $http = 'http';
+	if($web_config['server_type'] == 'nginx') {
+		header('location:' . $http . '://' . $serverData['server_name'] . ':8081/phpmyadmin');
+	} else {
+		header('location:' . $http . '://' . $serverData['server_name'] . '/phpmyadmin');
+	}
+}
 exit;
 ?>
\ No newline at end of file

--
Gitblit v1.9.1