示例#1
0
    Zend_Registry::set("DirectRequest", true);

    // Bootstrap and execute Ext.Direct stack dispatcher
    $application->bootstrap();
    
    $session = Zend_Registry::get('Session');

    require_once BASE_PATH . '/thirdparty/ExtDirect/API.php';
    require_once BASE_PATH . '/thirdparty/ExtDirect/Router.php';
    require_once BASE_PATH . '/thirdparty/ExtDirect/CacheProvider.php';
    require_once 'Extzf/ExtDirect/Router.php';

    $api = new ExtDirect_API();

    if (isset($session->extDirectState)) {
        $api->setState($session->extDirectState);
    }

    // Initialize translation etc. module based
    // This would normally happen in Bootstrap,
    // but since bootstrap has already been executed
    // and we know the requested module after $router
    // has been instanciated, this goes here.
    $rawPostData = file_get_contents("php://input");
    if (sizeof($rawPostData) > 0) {

        // Custom implemented high-performance call stack
        $request = json_decode($rawPostData);
        $i18nPlugin = Zend_Registry::get('i18nPlugin');

        // Static, no module dependency
示例#2
0
<?php

@session_start();
require_once 'includes/config.php';
require_once 'includes/ExtDirect/API.php';
require_once 'includes/ExtDirect/Router.php';
require_once 'includes/DbSimple/Generic.php';
if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes', $_POST);
    $_COOKIE = array_map('stripslashes', $_COOKIE);
}
if (INSTALLED) {
    $db = DbSimple_Generic::connect(SYS_DSN);
}
// this should alwasy be set but if its not, then execute api.php without outputting it
if (!isset($_SESSION['ext-direct-state'])) {
    ob_start();
    include 'api.php';
    ob_end_clean();
}
$api = new ExtDirect_API();
$api->setState($_SESSION['ext-direct-state']);
$router = new ExtDirect_Router($api);
$router->dispatch();
$router->getResponse(true);
// true to print the response instantly