Added iOS detection to Utils::getOS()

This commit is contained in:
Shoghi Cervantes 2014-02-09 03:20:09 +01:00
parent c2d4dd093a
commit 0e1c099906

View File

@ -90,12 +90,16 @@ class Utils{
} }
public static function getOS(){ public static function getOS(){
$uname = trim(strtoupper(php_uname("s"))); $uname = php_uname("s");
if(strpos($uname, "DARWIN") !== false){ if(stripos($uname, "Darwin") !== false){
return "mac"; if(strpos(php_uname("m"), "iP") === 0){
}elseif(strpos($uname, "WIN") !== false){ return "ios";
}else{
return "mac";
}
}elseif(stripos($uname, "Win") !== false){
return "win"; return "win";
}elseif(strpos($uname, "LINUX") !== false){ }elseif(stripos($uname, "Linux") !== false){
return "linux"; return "linux";
}else{ }else{
return "other"; return "other";
@ -569,7 +573,7 @@ class Utils{
for($i = 0; $i < 8; $i += 4){ for($i = 0; $i < 8; $i += 4){
$value = bcmul($value, "4294967296", 0); //4294967296 == 2^32 $value = bcmul($value, "4294967296", 0); //4294967296 == 2^32
$value = bcadd($value, 0x1000000 * ord($x{$i}) + ((ord($x{$i + 1}) << 16) | (ord($x{$i + 2}) << 8) | ord($x{$i + 3})), 0); $value = bcadd($value, 0x1000000 * ord(@$x{$i}) + ((ord(@$x{$i + 1}) << 16) | (ord(@$x{$i + 2}) << 8) | ord(@$x{$i + 3})), 0);
} }
return ($negative === true ? "-".$value:$value); return ($negative === true ? "-".$value:$value);
} }