<?php

class disk_sxExe extends xIExecutor {

	public function main() {
		if(!xUser::$cur->isGuest()) {
			$group = xUser::$cur->getGroup();
			define('USER_ID',					xUser::$cur->id);
			define('USER_NAME',					xUser::$cur->username);
			define('USER_EMAIL',				xUser::$cur->email);
			define('USER_GROUP_NAME',			$group->name);
			define('DISK_USAGE_STR',			xFile::toStrSize(xUser::$cur->disk_usage));
			define('DISK_MAX_STR',				xFile::toStrSize(xUser::$cur->disk_max));
			if(xUser::$cur->disk_usage > 0 && xUser::$cur->disk_max > 0)
				define('USAGE_PER',				round(xUser::$cur->disk_usage/xUser::$cur->disk_max*100));
			else define('USAGE_PER',			0);
			// --- 单文件限制 ---
			$serverFileLimit = str_replace('M','',get_cfg_var('upload_max_filesize')) * 1024 * 1024;
			if(($group->filesize_limit == 0) || ($group->filesize_limit > $serverFileLimit))
				define('FILESIZE_LIMIT',		$serverFileLimit);
			else
				define('FILESIZE_LIMIT',		$group->filesize_limit);
			// --- 文件类型限制 ---
			if($group->file_ext == '')
				define('FILE_EXT',				'*.*');
			else
				define('FILE_EXT',				'*.'.str_replace(',', '; *.', $group->file_ext));
			// --- load page ---
			xUI::loadPage('disk.php');
		} else {
			header('Location: ./');
		}
	}

	public function onError($result) {

	}
}