optimize timezone detection

This commit is contained in:
Georg Ehrke 2011-12-09 14:35:59 +01:00
parent 2103c331a0
commit add48b2657
2 changed files with 2 additions and 1 deletions

View File

@ -28,7 +28,7 @@ $geolocation = file_get_contents('http://ws.geonames.org/timezone?lat=' . $lat .
//Information are by Geonames (http://www.geonames.org) and licensed under the Creative Commons Attribution 3.0 License
$geoxml = simplexml_load_string($geolocation);
$geoarray = make_array_out_of_xml($geoxml);
if(isset($geoarray['timezone']['timezoneId']) && $geoarray['timezone']['timezoneId'] != ''){
if(in_array($geoarray['timezone']['timezoneId'], DateTimeZone::listIdentifiers())){
OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $geoarray['timezone']['timezoneId']);
$message = array('message'=> $l->t('New Timezone:') . $geoarray['timezone']['timezoneId']);
OC_JSON::success($message);

View File

@ -10,6 +10,7 @@ if (navigator.geolocation) {
function(data){
if (data.status == 'success'){
$('#notification').html(data.message);
$('#notification').attr('title', 'CC BY 3.0 by Geonames.org');
$('#notification').slideDown();
window.setTimeout(function(){$('#notification').slideUp();}, 5000);
}else{