aboutsummaryrefslogtreecommitdiffstats
path: root/apps/calendar/ajax/settimezone.php
blob: 32926f13859a276a05e86a9a271684ff41998a9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
/*************************************************
 * ownCloud - Calendar Plugin                     *
 *                                                *
 * (c) Copyright 2011 Bart Visscher               *
 * License: GNU AFFERO GENERAL PUBLIC LICENSE     *
 *                                                *
 * If you are not able to view the License,       *
 * <http://www.gnu.org/licenses/>                 *
 * please write to the Free Software Foundation.  *
 * Address:                                       *
 * 59 Temple Place, Suite 330, Boston,            *
 * MA 02111-1307  USA                             *
 *************************************************/

// Init owncloud
require_once('../../../lib/base.php');

$l=new OC_L10N('calendar');

// We send json data
header( "Content-Type: application/jsonrequest" );

// Check if we are a user
if( !OC_User::isLoggedIn()){
	echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Authentication error") )));
	exit();
}

// Get data
if( isset( $_POST['timezone'] ) ){
	$timezone=$_POST['timezone'];
	OC_Preferences::setValue( OC_User::getUser(), 'calendar', 'timezone', $timezone );
	echo json_encode( array( "status" => "success", "data" => array( "message" => $l->t("Timezone changed") )));
}else{
	echo json_encode( array( "status" => "error", "data" => array( "message" => $l->t("Invalid request") )));
}

?>