From 0a8f0e4ece06642808c1b52d7ea9c4af3ea356a1 Mon Sep 17 00:00:00 2001
From: tbrehm <t.brehm@ispconfig.org>
Date: Mon, 22 Oct 2012 07:18:05 -0400
Subject: [PATCH] Fixed: FS#2362 - client_id from remoting.inc.php functions is ignored

---
 install/lib/install.lib.php |   55 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 52 insertions(+), 3 deletions(-)

diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index 71ebe0b..8d2ae48 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -163,9 +163,9 @@
 		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 			$distname = 'Debian';
 			$distver = 'Wheezy/Sid';
-			$distid = 'debian70';
+			$distid = 'debian60';
 			$distbaseid = 'debian';
-			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
+			swriteln("Operating System: Debian 7.0 (Wheezy/Sid) or compatible\n");
 		} else {
 			$distname = 'Debian';
 			$distver = 'Unknown';
@@ -723,7 +723,7 @@
 	if(is_file($ispconfig_vhost_file)) {
 		$tmp = file_get_contents($ispconfig_vhost_file);
 		preg_match($regex,$tmp,$matches);
-		$port_number = intval($matches[1]);
+		$port_number = @intval($matches[1]);
 		if($port_number > 0) {
 			return $port_number;
 		} else {
@@ -750,6 +750,55 @@
 	}
 }
 
+/** 
+  Function to find the hash file for timezone detection
+  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+*/
+function find_hash_file($hash, $dir, $basedir = '') {
+    $res = opendir($dir);
+    if(!$res) return false;
+    
+    if(substr($dir, -1) === '/') $dir = substr($dir, 0, strlen($dir) - 1);
+    if($basedir === '') $basedir = $dir;
+    
+    while($cur = readdir($res)) {
+        if($cur == '.' || $cur == '..') continue;
+        $entry = $dir.'/'.$cur;
+        if(is_dir($entry)) {
+            $result = find_hash_file($hash, $entry, $basedir);
+            if($result !== false) return $result;
+        } elseif(md5_file($entry) === $hash) {
+            $entry = substr($entry, strlen($basedir));
+            if(substr($entry, 0, 7) === '/posix/') $entry = substr($entry, 7);
+            return $entry;
+        }
+    }
+    closedir($res);
+    return false;
+}
+
+/** 
+  Function to get the timezone of the Linux system
+  (c) 2012 Marius Cramer, pixcept KG, m.cramer@pixcept.de
+*/
+function get_system_timezone() {
+	if(is_link('/etc/localtime')) {
+		$timezone = readlink('/etc/localtime');
+		$timezone = str_replace('/usr/share/zoneinfo/', '', $timezone);
+		if(substr($timezone, 0, 6) === 'posix/') $timezone = substr($timezone, 6);
+	} else {
+		$hash = md5_file('/etc/localtime');
+		$timezone = find_hash_file($hash, '/usr/share/zoneinfo');
+	}
+
+	if(!$timezone) {
+		exec('date +%Z', $tzinfo);
+		$timezone = $tzinfo[0];
+	}
+
+	return $timezone;
+}
+
 
 
 ?>

--
Gitblit v1.9.1