<?php
/* Set the error reporting. */
error_reporting(0);

/* Start output buffer. */
ob_start();

/* Define the run mode as front. */
define('RUN_MODE', 'api');

/* Load the framework. */
include '../framework/api/router.class.php';
include '../framework/api/entry.class.php';
include '../framework/control.class.php';
include '../framework/model.class.php';
include '../framework/helper.class.php';

/* Log the time and define the run mode. */
$startTime = getTime();

/* Instance the app. */
$app = router::createApp('api', '', 'api');

/* Run the app. */
$common = $app->loadCommon();

/* Check entry. */
if(!$app->version) $common->checkEntry();

/* Set default params. */
$config->requestType   = 'GET';
$config->default->view = 'json';

$app->parseRequest();
if(!$app->version) $common->checkPriv();
$app->loadModule();

$output = ob_get_clean();

/* Flush the buffer. */
echo helper::removeUTF8Bom($output);
