/** * Outputs exception information * @return type */ public function output() { if (!defined('AJAX_REQUEST') && Ajax::validateRequest($_REQUEST)) { // Return valid JS in ajax requests if the 'fail' status was thrown before ajax initialization header('Content-type: application/json'); $message = json_encode(array('error' => $this->message)); if (!empty($_REQUEST['callback'])) { $message = $_REQUEST['callback'] . "(" . $message . ");"; } echo $message; exit; } elseif (defined('CONSOLE') || Debugger::isActive() || defined('DEVELOPMENT') && DEVELOPMENT) { echo $this->printDebug(defined('CONSOLE')); } else { $debug = "<!--\n" . $this->printDebug(true) . "\n-->"; Development::showStub(array('[title]' => 'Service unavailable', '[banner]' => 'Service<br/> unavailable', '[message]' => 'Sorry, service is temporarily unavailable.'), $debug); } }
/** * Init ajax engine * * @return boolean true if current request is ajax, false - otherwise */ function fn_init_ajax() { if (defined('AJAX_REQUEST')) { return array(INIT_STATUS_OK); } Embedded::init(); if (Ajax::validateRequest($_REQUEST)) { Tygh::$app['ajax'] = new Ajax($_REQUEST); fn_define('AJAX_REQUEST', true); } return array(INIT_STATUS_OK); }
/** * Init ajax engine * * @return boolean true if current request is ajax, false - otherwise */ function fn_init_ajax() { if (defined('AJAX_REQUEST')) { return array(INIT_STATUS_OK); } Embedded::init(); if (Ajax::validateRequest($_REQUEST)) { $ajax = new Ajax($_REQUEST); Registry::set('ajax', $ajax); fn_define('AJAX_REQUEST', true); } return array(INIT_STATUS_OK); }