diff --git a/src/config.php b/src/config.php index f2efa7c6e8..4bbf82d649 100644 --- a/src/config.php +++ b/src/config.php @@ -26,7 +26,29 @@ the Free Software Foundation, either version 3 of the License, or */ set_time_limit(0); -date_default_timezone_set(@date_default_timezone_get()); + +date_default_timezone_set("GMT"); +if(strpos(" ".strtoupper(php_uname("s")), " WIN") !== false){ + $time = time(); + $time -= $time % 60; + exec("time.exe /T", $hour); + $i = array_map("intval", explode(":", trim($hour[0]))); + exec("date.exe /T", $date); + $j = array_map("intval", explode("/", trim($date[0]))); + $offset = round((mktime($i[0], $i[1], 0, $j[1], $j[0], $j[2]) - $time) / 60) * 60; +}else{ + exec("date +%s", trim($t[0])); + $offset = round((intval($t) - time()) / 60) * 60; +} + +$daylight = (int) date("I"); + +if($daylight === 0){ + $offset -= 3600; +} + +date_default_timezone_set(timezone_name_from_abbr("", $offset, $daylight)); + gc_enable(); error_reporting(E_ALL ^ E_NOTICE); ini_set("allow_url_fopen", 1); diff --git a/src/functions.php b/src/functions.php index 2b93b012b4..a7425dc5d8 100644 --- a/src/functions.php +++ b/src/functions.php @@ -73,16 +73,12 @@ function safe_var_dump($var, $cnt = 0){ function kill($pid){ switch(Utils::getOS()){ case "win": - ob_start(); - passthru("%WINDIR%\\System32\\taskkill.exe /F /PID ".((int) $pid)." > NUL"); - ob_end_clean(); + exec("taskkill.exe /F /PID ".((int) $pid)." > NUL"); break; case "mac": case "linux": default: - ob_start(); - passthru("kill -9 ".((int) $pid)." > /dev/null 2>&1"); - ob_end_clean(); + exec("kill -9 ".((int) $pid)." > /dev/null 2>&1"); } } diff --git a/src/utils/Utils.php b/src/utils/Utils.php index 22d884043b..6955d71552 100644 --- a/src/utils/Utils.php +++ b/src/utils/Utils.php @@ -32,9 +32,6 @@ define("ENDIANNESS", (pack("d", 1) === "\77\360\0\0\0\0\0\0" ? BIG_ENDIAN:LITTLE class Utils{ public static $online = true; public static $ip = false; - public function run(){ - - } public static function isOnline(){ return ((@fsockopen("google.com", 80) !== false or @fsockopen("www.linux.org", 80) !== false or @fsockopen("www.php.net", 80) !== false) ? true:false); @@ -73,11 +70,11 @@ class Utils{ public static function getOS(){ $uname = trim(strtoupper(php_uname("s"))); - if(strpos($uname, "DARWIN") !== false or $uname === "DARWIN"){ + if(strpos($uname, "DARWIN") !== false){ return "mac"; - }elseif(strpos($uname, "WIN") !== false or $uname === "WIN"){ + }elseif(strpos($uname, "WIN") !== false){ return "win"; - }elseif(strpos($uname, "LINUX") !== false or $uname === "LINUX"){ + }elseif(strpos($uname, "LINUX") !== false){ return "linux"; }else{ return "other";