From d9bcf68e395d6156645a7974b1a992aa6e6c00aa Mon Sep 17 00:00:00 2001
From: Marius Cramer <m.cramer@pixcept.de>
Date: Mon, 14 Oct 2013 08:57:25 -0400
Subject: [PATCH] Added missing empty directories from svn import

---
 install/lib/install.lib.php |   63 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 1 deletions(-)

diff --git a/install/lib/install.lib.php b/install/lib/install.lib.php
index f901264..9c61759 100644
--- a/install/lib/install.lib.php
+++ b/install/lib/install.lib.php
@@ -160,7 +160,7 @@
 			$distid = 'debian60';
 			$distbaseid = 'debian';
 			swriteln("Operating System: Debian 6.0 (Squeeze/Sid) or compatible\n");
-		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'6.0') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
+		} elseif(strstr(trim(file_get_contents('/etc/debian_version')),'7.0') || strstr(trim(file_get_contents('/etc/debian_version')),'7.1') || trim(file_get_contents('/etc/debian_version')) == 'wheezy/sid') {
 			$distname = 'Debian';
 			$distver = 'Wheezy/Sid';
 			$distid = 'debian60';
@@ -343,6 +343,12 @@
 		return $ret_val;
 	}
 	return false;
+}
+
+function rfsel($file, $file2) {
+    clearstatcache();
+    if(is_file($file)) return rf($file);
+    else return rf($file2);
 }
 
 function rf($file){
@@ -750,6 +756,61 @@
 	}
 }
 
+/** 
+  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($basedir, -1) === '/') $basedir = substr($basedir, 0, strlen($basedir) - 1);
+    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) + 1);
+            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() {
+    $timezone = false;
+    if(file_exists('/etc/timezone') && is_readable('/etc/timezone')) {
+        $timezone = trim(file_get_contents('/etc/timezone'));
+        if(file_exists('/usr/share/zoneinfo/' . $timezone) == false) $timezone = false;
+    }
+    
+    if(!$timezone && 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);
+    } elseif(!$timezone) {
+        $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