<?php
if(isset($_POST['sessionId'])) $_COOKIE['FIL_SESSION'] = $_POST['sessionId'];

include_once 'slex.php';
if($_GET['ac']=='login') xAutoSession::setAutoLogin(true);
xCore::start();

if(in_array($_GET['ac'], array(
	'login',
	'list',
	'addFolder',
	'remove',
	'rename',
	'upload',
	'tokenget',
	'share',
	'move',
	'cancelshare',
	'logout',
	'register',
	'shareList',
	'changePwd',
	'reEmailVer'
))) {
	if(xUser::$cur->isGuest()) {
		if($_GET['ac'] == 'login' || $_GET['ac'] == 'tokenget' || $_GET['ac'] == 'register') {
			$_ENV->exec($_GET['ac'], false, 'ajax/');
		} else {
			echo json_encode(array(
				'result' => '-1',
				'msg' => '请先登录'
			));
		}
	} else {
		$_ENV->exec($_GET['ac'], false, 'ajax/');
	}
} else {
	echo 'Access Fail.';
}

