2012-02-20 14:26:22 +04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Copyright (c) 2011, 2012 Georg Ehrke <ownclouddev at georgswebsite dot de>
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or
|
|
|
|
* later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
require_once('../../../../lib/base.php');
|
2012-02-26 16:45:51 +04:00
|
|
|
|
2012-02-20 14:26:22 +04:00
|
|
|
OC_JSON::checkLoggedIn();
|
|
|
|
OC_JSON::checkAppEnabled('calendar');
|
2012-02-26 16:45:51 +04:00
|
|
|
|
2012-02-20 14:26:22 +04:00
|
|
|
$l = new OC_L10N('calendar');
|
2012-02-26 16:45:51 +04:00
|
|
|
|
2012-02-20 14:26:22 +04:00
|
|
|
$lat = $_GET['lat'];
|
2012-02-26 16:45:51 +04:00
|
|
|
$lng = $_GET['long'];
|
|
|
|
|
|
|
|
$timezone = OC_Geo::timezone($lat, $lng);
|
|
|
|
|
|
|
|
if($timezone == OC_Preferences::getValue(OC_USER::getUser(), 'calendar', 'timezone')){
|
2012-02-20 14:26:22 +04:00
|
|
|
OC_JSON::success();
|
|
|
|
exit;
|
|
|
|
}
|
2012-02-26 16:45:51 +04:00
|
|
|
OC_Preferences::setValue(OC_USER::getUser(), 'calendar', 'timezone', $timezone);
|
|
|
|
$message = array('message'=> $l->t('New Timezone:') . $timezone);
|
|
|
|
OC_JSON::success($message);
|
|
|
|
?>
|