Example #1
0
 /** 
  * Send data directly, for ajax requests.
  * 
  * @param  misc    $data 
  * @param  string $type 
  * @access public
  * @return void
  */
 public function send($data, $type = 'json')
 {
     if ($type == 'json') {
         echo json_encode($data);
     }
     die(removeUTF8Bom(ob_get_clean()));
 }
Example #2
0
include '../framework/helper.class.php';
/* Log the time and define the run mode. */
$startTime = getTime();
/* Instance the app. */
$app = router::createApp('pms', dirname(dirname(__FILE__)));
/* Check the reqeust is getconfig or not. Check installed or not. */
if (isset($_GET['mode']) and $_GET['mode'] == 'getconfig') {
    die($app->exportConfig());
}
//
if (!isset($config->installed) or !$config->installed) {
    die(header('location: install.php'));
}
/* Detect mobile. */
$mobile = $app->loadClass('mobile');
if ($mobile->isMobile() or $mobile->isTablet()) {
    $app->viewType = $config->default->view = 'mhtml';
}
/* Run the app. */
$common = $app->loadCommon();
/* Check for need upgrade. */
$config->installedVersion = $common->loadModel('setting')->getVersion();
if (!(!is_numeric($config->version[0]) and $config->version[0] != $config->installedVersion[0]) and version_compare($config->version, $config->installedVersion, '>')) {
    die(header('location: upgrade.php'));
}
$app->parseRequest();
$common->checkPriv();
$app->loadModule();
/* Flush the buffer. */
echo removeUTF8Bom(ob_get_clean());