示例#1
0
文件: App.php 项目: xamiro-dev/xamiro
                case XC_OPERATION_NEW_FILE_STR:
                case XC_OPERATION_UPLOAD:
                case XC_OPERATION_DOWNLOAD:
                case XC_OPERATION_EXTRACT:
                    return true;
            }
            return true;
        }
        public function getUserName()
        {
            return 'admin';
        }
        public function getToken()
        {
            return md5(self::$_salt);
        }
    }
    XAPP_AUTH_DELEGATE::$_salt = $XAPP_SALT_KEY;
    XAPP_AUTH_DELEGATE::$_config = $XFILE_CONFIG;
    $authDelegate = new XAPP_AUTH_DELEGATE();
    $XAPP_XFILE_CONFIG_ARRAY = array();
    $XAPP_XFILE_CONFIG_ARRAY['XAPP_FILE_START_PATH'] = '';
    $XAPP_XFILE_CONFIG_ARRAY['XAPP_FILE_ROOT'] = $REPOSITORY_ROOT;
    require_once XAPP_BASEDIR . 'lib/standalone/StoreDelegate.php';
    $extraParams = count($urlParams) ? '&' . http_build_query($urlParams) : '';
    if (!$XAPP_RESOURCE_CONFIG) {
        $XAPP_RESOURCE_CONFIG = '';
    }
    $renderStruct = xapp_commander_render_app(XAPP_BASEDIR, 'xbox', $XAPP_CLIENT_DIRECTORY, $REPOSITORY_ROOT, $REPOSITORY_START_PATH, $UPLOAD_EXTENSIONS, $XFILE_CONFIG, $XAPP_JQUERY_THEME, dirname(XApp_Service_Entry_Utils::getUrl()) . '/', dirname(XApp_Service_Entry_Utils::getUrl()) . '/xapp/commander/plugins/', dirname(XApp_Service_Entry_Utils::getUrl()) . '/' . XAPP_INDEX . '?view=rpc', $authDelegate, '', '', $LOG_DIRECTORY, $XF_PROHIBITED_PLUGINS, 'standalone', 'XCOM_Resource_Renderer', '', new stdClass(), null, null, null, null, dirname(XApp_Service_Entry_Utils::getUrl()) . '/' . XAPP_INDEX . '?view=smdCall' . $extraParams, dirname(XApp_Service_Entry_Utils::getUrl()) . '/' . XAPP_INDEX . '?view=rpc' . $extraParams, 'XApp_Store_Delegate', $CONF_FILE, $XAPP_SALT_KEY, $RELATIVE_VARIABLES, XApp_Service_Entry_Utils::isDebug() === true, $XAPP_COMPONENTS, $XAPP_RESOURCE_CONFIG, $XAPP_BOOTSTRAP_OVERRIDE);
    return $renderStruct;
}
示例#2
0
 private function setupRPC()
 {
     /***
      * We support JSONP for all services
      */
     $isJSONP = false;
     $hasJSONP = true;
     if ($hasJSONP) {
         $isJSONP = XApp_Service_Entry_Utils::isJSONP();
     }
     $method = $_SERVER['REQUEST_METHOD'];
     if ($method === 'POST') {
         $hasJSONP = false;
     }
     /***
      * Filtered methods
      */
     $ignoredRPCMethods = array('load', 'getObject', 'init', 'setup', 'log', 'onBeforeCall', 'onAfterCall', 'dumpObject', 'applyFilter', 'getLastJSONError', 'cleanUrl', 'rootUrl', 'siteUrl', 'getXCOption', 'getIndexer', 'getIndexOptions', 'getIndexOptions', 'indexDocument', 'onBeforeSearch', 'toDSURL', 'searchTest');
     if (xapp_get_option(self::IGNORED_RPC_METHODS, $this)) {
         $ignoredRPCMethods = array_merge(xapp_get_option(self::IGNORED_RPC_METHODS, $this), $ignoredRPCMethods);
     } elseif (xapp_has_option(self::AUTH_DELEGATE, $this)) {
         /***
          * Additional security here, mark each service method which has not been authorized by the
          * auth delegate as ignored!
          */
         $authDelegate = xapp_get_option(self::AUTH_DELEGATE, $this);
         if (method_exists($authDelegate, 'authorize')) {
             $xCommanderFunctionTable = XApp_Service_Entry_Utils::getXCommanderFuncTable();
             foreach ($xCommanderFunctionTable as $key => $value) {
                 if (!$authDelegate::authorize($value)) {
                     array_push($ignoredRPCMethods, $value);
                 }
             }
         }
     }
     $server = null;
     if ($hasJSONP && $isJSONP) {
         //Options for SMD based JSONP-RPC classes
         $opt = array(Xapp_Rpc_Smd::IGNORE_METHODS => $ignoredRPCMethods, Xapp_Rpc_Smd::IGNORE_PREFIXES => array('_', '__'));
         $smd = new Xapp_Rpc_Smd_Jsonp($opt);
         //Options for RPC server
         $opt = array(Xapp_Rpc_Server::ALLOW_FUNCTIONS => true, Xapp_Rpc_Server::APPLICATION_ERROR => false, Xapp_Rpc_Server::METHOD_AS_SERVICE => true, Xapp_Rpc_Server::DEBUG => XApp_Service_Entry_Utils::isDebug(), Xapp_Rpc_Server::SMD => $smd);
         $server = Xapp_Rpc::server(XApp_Service_Entry_Utils::isRaw() ? 'raw' : 'jsonp', $opt);
     } else {
         //Options for SMD based RPC classes
         $opt = array(Xapp_Rpc_Smd_Json::IGNORE_METHODS => $ignoredRPCMethods, Xapp_Rpc_Smd_Json::IGNORE_PREFIXES => array('_', '__'), Xapp_Rpc_Smd_Json::METHOD_TARGET => false, Xapp_Rpc_Smd_Json::SERVICE_OVER_GET => true, Xapp_Rpc_Smd_Json::TARGET => xapp_get_option(self::RPC_TARGET, $this));
         $smd = new Xapp_Rpc_Smd_Json($opt);
         //Options for RPC server
         $opt = array(Xapp_Rpc_Server::ALLOW_FUNCTIONS => true, Xapp_Rpc_Server::APPLICATION_ERROR => false, Xapp_Rpc_Server::METHOD_AS_SERVICE => false, Xapp_Rpc_Server::ALLOW_BATCHED_REQUESTS => true, Xapp_Rpc_Server::SERVICE_OVER_GET => true, Xapp_Rpc_Server::DEBUG => XApp_Service_Entry_Utils::isDebug(), Xapp_Rpc_Server::VALIDATE => !XApp_Service_Entry_Utils::isUpload(), Xapp_Rpc_Server::SMD => $smd);
         $server = Xapp_Rpc::server('json', $opt);
     }
     if ($server) {
         xapp_set_option(self::RPC_SERVER, $server, $this);
     }
 }
示例#3
0
 public function setup()
 {
     /***
      * The very basic paths
      */
     if (!defined('XAPP_BASEDIR')) {
         define("XAPP_BASEDIR", xapp_get_option(self::BASEDIR, $this));
     }
     if (!defined('XAPP_LIB')) {
         define("XAPP_LIB", XAPP_BASEDIR . DIRECTORY_SEPARATOR . "lib" . DIRECTORY_SEPARATOR);
     }
     /***
      * Load utils
      */
     if (!class_exists('XApp_Service_Entry_Utils')) {
         include_once XAPP_BASEDIR . 'XApp_Service_Entry_Utils.php';
     }
     /***
      * Get run-time configuration, there is 'debug' and 'release'. For both cases there are
      * different resources to load.
      */
     $XAPP_RUN_TIME_CONFIGURATION = XApp_Service_Utils::_getKey('rtConfig', XApp_Service_Entry_Utils::getRunTimeConfiguration());
     /***
      * Now include all xapp stuff
      */
     //pull in parts of xapp core framework
     XApp_Service_Entry_Utils::includeXAppCore();
     //pull in registry of xapp core framework
     XApp_Service_Entry_Utils::includeXAppRegistry();
     //pull in parts of xapp json framework
     XApp_Service_Entry_Utils::includeXAppJSONStoreClasses();
     //pull in json utils (to read client app's resource configuration
     XApp_Service_Entry_Utils::includeXAppJSONTools();
     //some debugging tools
     XApp_Service_Entry_Utils::includeXAppDebugTools();
     //pull in legacy client app renderer
     xapp_import('xapp.app.Renderer');
     self::loadCommons();
     //pull in xapp commander renderer
     /*include_once(XAPP_BASEDIR . DIRECTORY_SEPARATOR . 'app'. DIRECTORY_SEPARATOR . 'Commander.php');*/
     //pull in xapp resource renderer
     include_once XAPP_BASEDIR . '/Resource/Renderer.php';
     //pull in xapp resource renderer
     xapp_import('xapp.commander.Resource.Renderer');
     //pull in xapp resource renderer
     xapp_import('xapp.Resource.Renderer');
     //pull in xide resource Renderer
     xapp_import('xapp.xide.Resource.Renderer');
     //pull in xide resource Renderer
     //xapp_import('xapp.xcf.Resource.Renderer');
     //pull in cms related resource renderer
     include_once XAPP_LIB . DIRECTORY_SEPARATOR . xapp_get_option(self::RESOURCE_RENDERER_PREFIX, $this) . DIRECTORY_SEPARATOR . 'ResourceRenderer.php';
     /***
      * Prepare resource renderer
      */
     //clients resource config path
     $XAPP_RESOURCE_CONFIG_PATH = '' . xapp_get_option(self::APPDIR, $this) . DIRECTORY_SEPARATOR;
     $XAPP_RESOURCE_CONFIG = xapp_get_option(self::XAPP_RESOURCE_CONFIG, $this);
     if (strlen($XAPP_RESOURCE_CONFIG)) {
         if ($XAPP_RUN_TIME_CONFIGURATION === 'debug') {
             $XAPP_RESOURCE_CONFIG_PATH .= 'lib' . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . $XAPP_RESOURCE_CONFIG . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
         } else {
             if ($XAPP_RUN_TIME_CONFIGURATION === 'release') {
                 $XAPP_RESOURCE_CONFIG_PATH .= DIRECTORY_SEPARATOR . xapp_get_option(self::APP_FOLDER, $this) . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . $XAPP_RESOURCE_CONFIG . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
             }
         }
     } else {
         if ($XAPP_RUN_TIME_CONFIGURATION === 'debug') {
             $XAPP_RESOURCE_CONFIG_PATH .= 'lib' . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . 'resources-' . $XAPP_RUN_TIME_CONFIGURATION . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
         } else {
             if ($XAPP_RUN_TIME_CONFIGURATION === 'release') {
                 $XAPP_RESOURCE_CONFIG_PATH .= DIRECTORY_SEPARATOR . xapp_get_option(self::APP_FOLDER, $this) . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . 'resources-' . $XAPP_RUN_TIME_CONFIGURATION . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
             }
         }
     }
     //error_log('$XAPP_RESOURCE_CONFIG ' . $XAPP_RESOURCE_CONFIG . "   =  " . $XAPP_RESOURCE_CONFIG_PATH);
     if (!file_exists($XAPP_RESOURCE_CONFIG_PATH)) {
         $this->log('have no core resources, ' . $XAPP_RESOURCE_CONFIG_PATH . ' doesnt exists');
         return null;
     }
     $resources = (object) XApp_Utils_JSONUtils::read_json($XAPP_RESOURCE_CONFIG_PATH, 'json', false, true);
     $pluginResources = null;
     /***
      * Load plugin resources
      */
     if (xapp_get_option(self::ALLOW_PLUGINS, $this) && xapp_get_option(self::PLUGIN_DIRECTORY, $this) && xapp_get_option(self::PLUGIN_DIRECTORY, $this)) {
         //pull in xapp plugin manager
         include_once XAPP_BASEDIR . '/commander/PluginManager.php';
         //pull in xapp commander plugin base class
         include_once XAPP_BASEDIR . '/commander/Plugin.php';
         //pull in RPC interface
         if (!class_exists('Xapp_Rpc_Interface_Callable')) {
             //pull in xapp commander plugin base class
             include_once XAPP_BASEDIR . '/Rpc/Interface/Callable.php';
         }
         $xComPluginManager = new XApp_Commander_PluginManager();
         $loadedPlugins = null;
         $plugins = $xComPluginManager->loadPlugins(xapp_get_option(self::PLUGIN_DIRECTORY, $this), xapp_get_option(self::PLUGIN_DIRECTORY, $this), xapp_get_option(self::PLUGIN_MASK, $this));
         $pluginResources = $this->getPluginResources($plugins, $XAPP_RUN_TIME_CONFIGURATION, $XAPP_RESOURCE_CONFIG);
     }
     //error_log('flags ' . json_encode(xapp_get_option(self::FLAGS, $this)));
     //now merge into app resources, filtered
     if ($pluginResources) {
         foreach ($pluginResources as $pluginResourceItems) {
             foreach ($pluginResourceItems as $pluginResource) {
                 $prohibited = explode(',', xapp_get_option(self::PROHIBITED_PLUGINS, $this));
                 if (property_exists($pluginResource, 'type') && property_exists($pluginResource, 'name')) {
                     //is plugin item
                     if (in_array('X' . $pluginResource->name, $prohibited)) {
                         continue;
                     } else {
                         array_push($resources->items, $pluginResource);
                     }
                 } else {
                     array_push($resources->items, $pluginResource);
                 }
             }
         }
     }
     $resourceRendererOptions = array(XApp_Resource_Renderer::DOC_ROOT => xapp_get_option(self::DOC_ROOT, $this), XApp_Resource_Renderer::DOC_ROOT_PATH => xapp_get_option(self::APPDIR, $this), XApp_Resource_Renderer::RESOURCES_DATA => $resources, XApp_Resource_Renderer::RENDER_DELEGATE => xapp_get_option(self::RENDER_DELEGATE, $this));
     $clz = xapp_get_option(self::RESOURCE_RENDERER_CLZ, $this);
     $xappResourceRenderer = new $clz($resourceRendererOptions);
     $xappResourceRenderer->registerDefault();
     if (xapp_has_option(self::RELATIVE_VARIABLES)) {
         $rVariables = xapp_get_option(self::RELATIVE_VARIABLES, $this);
         if ($rVariables != null && count($rVariables)) {
             foreach ($rVariables as $variable => $value) {
                 $xappResourceRenderer->registerRelative($variable, $value);
             }
         }
     }
     $XAPP_DOJO_PACKAGES = '[]';
     $XAPP_DOJO_PACKAGE_LOCATION_PREFIX = $xappResourceRenderer->resolveRelative('%PLUGIN_PACKAGE_ROOT_URL%');
     $javascriptPlugins = $xappResourceRenderer->getJavascriptPlugins();
     if ($javascriptPlugins && count($javascriptPlugins)) {
         if (XApp_Service_Entry_Utils::isDebug()) {
             $dojoPackages = array();
             $dojoPackagesStr = '[';
             $pIdx = 0;
             foreach ($javascriptPlugins as $plugin) {
                 if (!is_object($plugin)) {
                     continue;
                 }
                 if ($pIdx > 0) {
                     $dojoPackagesStr .= ",";
                 }
                 $dojoPackagesStr .= "{name:" . "'" . $plugin->name . "',";
                 if (property_exists($plugin, 'packageLocation')) {
                     $dojoPackagesStr .= "location:" . "'" . $plugin->packageLocation . "'}";
                 } else {
                     $dojoPackagesStr .= "location:" . "'" . $XAPP_DOJO_PACKAGE_LOCATION_PREFIX . $plugin->name . '/client/' . "'}";
                 }
                 if ($pIdx < count($javascriptPlugins) - 1) {
                     $dojoPackagesStr .= ',';
                 }
             }
             $dojoPackagesStr .= ']';
             $XAPP_DOJO_PACKAGES = $dojoPackagesStr;
         } else {
             $packageSuffix = "";
             $dojoPackages = array();
             array_push($dojoPackages, array('name' => 'dojo', 'location' => 'dojo'));
             array_push($dojoPackages, array('name' => 'dojox', 'location' => 'dojox'));
             array_push($dojoPackages, array('name' => 'dijit', 'location' => 'dijit'));
             array_push($dojoPackages, array('name' => 'cbtree', 'location' => 'cbtree'));
             array_push($dojoPackages, array('name' => 'xfile', 'location' => 'xfile'));
             array_push($dojoPackages, array('name' => 'xide', 'location' => 'xide'));
             array_push($dojoPackages, array('name' => 'xwordpress', 'location' => 'xwordpress'));
             array_push($dojoPackages, array('name' => 'xbox', 'location' => 'xbox'));
             array_push($dojoPackages, array('name' => 'xjoomla', 'location' => 'xjoomla'));
             foreach ($javascriptPlugins as $plugin) {
                 if (is_object($plugin)) {
                     if (property_exists($plugin, 'packageSuffix')) {
                         $packageSuffix = $plugin->{'packageSuffix'};
                     }
                     $packageLocation = $XAPP_DOJO_PACKAGE_LOCATION_PREFIX . $plugin->name . '/client/';
                     if (strlen($packageSuffix)) {
                         $packageLocation .= $packageSuffix . '/';
                     }
                     if (property_exists($plugin, 'packageLocation')) {
                         $packageLocation = $plugin->packageLocation;
                     }
                     array_push($dojoPackages, array('name' => $plugin->name, 'location' => $packageLocation));
                 }
             }
             $XAPP_DOJO_PACKAGES = json_encode($dojoPackages);
         }
         /****
          * Render plugin resources
          */
         $javaScriptHeaderStr = '';
         $javaScriptHeaderStr .= 'var xappPluginResources=';
         $javaScriptHeaderStr .= json_encode($javascriptPlugins) . ';';
         $javaScriptHeaderStr .= '';
         $xappResourceRenderer->registerRelative('XAPP_PLUGIN_RESOURCES', json_encode($javascriptPlugins));
         //important: get the resource variables before adding 'head' otherwise it breaks the JSON structure!
         $resourceVariables = (array) $xappResourceRenderer->registryToKeyValues(xapp_get_option(XApp_Resource_Renderer::RELATIVE_REGISTRY_NAMESPACE, $xappResourceRenderer));
         $resourceVariables['HTML_HEADER'] = array();
         $resourceVariables['XAPP_PLUGIN_RESOURCES'] = $javascriptPlugins;
         $resourceVariables['DOJOPACKAGES'] = array();
         $resourceVariables['XFILE_CONFIG_MIXIN'] = array();
         $resourceVariables['RESOURCE_VARIABLES'] = array();
         $xappResourceRenderer->registerRelative('RESOURCE_VARIABLES', Xapp_Util_Json::prettify(json_encode($resourceVariables, true)), LOCK_EX);
     }
     $xappResourceRenderer->registerRelative('DOJOPACKAGES', $XAPP_DOJO_PACKAGES);
     $pConfigDefault = $xappResourceRenderer->resolveRelative('%PACKAGE_CONFIG%');
     if (!strlen($pConfigDefault)) {
         $pConfigDefault = 'run-release-debug';
     }
     //error_log('$pConfigDefault ' .$pConfigDefault);
     $xappResourceRenderer->registerRelative('PACKAGE_CONFIG', XApp_Service_Utils::_getKey('pConfig', $pConfigDefault));
     /****
      * Build XApp-App-Renderer - Config
      */
     $opt = array(XApp_App_Commander::DOC_ROOT_PATH => xapp_get_option(self::APPDIR, $this), XApp_App_Commander::DOC_ROOT => xapp_get_option(self::DOC_ROOT, $this), XApp_App_Commander::APP_NAME => xapp_get_option(self::APP_NAME, $this), XApp_App_Commander::APP_FOLDER => xapp_get_option(self::APP_FOLDER, $this), XApp_App_Commander::CONFIG_NAME => $XAPP_RUN_TIME_CONFIGURATION, XApp_App_Commander::SERVICE_URL => xapp_get_option(self::SERVICE, $this), XApp_App_Commander::RESOURCE_RENDERER => $xappResourceRenderer);
     $xappAppRenderer = new XApp_App_Commander($opt);
     $this->appRenderer = $xappAppRenderer;
     $this->resourceRenderer = $xappResourceRenderer;
     return $xappAppRenderer;
 }
示例#4
0
require_once XAPP_BASEDIR . '/Bootstrap.php';
XApp_Bootstrap::loadMin();
XApp_Bootstrap::loadRPC();
xapp_setup_language_standalone();
xapp_import('xapp.Service');
xapp_import('xapp.File.Utils');
xapp_import('xapp.Directory.Utils');
xapp_import('xapp.Directory.Service');
xapp_import('xapp.xide.Directory.Service');
xapp_import('xapp.Path.Utils');
xapp_import('xapp.VFS.Interface.Access');
xapp_import('xapp.VFS.Base');
xapp_import('xapp.VFS.Local');
xapp_import('xapp.Resource.Renderer');
xapp_import('xapp.Xapp.Hook');
xapp_import('xapp.Option.*');
xapp_import("xapp.xide.Models.User");
xapp_import('xapp.xide.Controller.UserManager');
xapp_import('xapp.xide.Controller.UserService');
xapp_import('xapp.xide.Workbench.Service');
xapp_import('xapp.Store.Json.Json');
/***
 * Build bootstrap config for the RPC service
 */
$user = new XApp_User();
$user->setName('A');
$opt = array(XApp_Bootstrap::BASEDIR => XAPP_BASEDIR, XApp_Bootstrap::FLAGS => array(XAPP_BOOTSTRAP_SETUP_XAPP, XAPP_BOOTSTRAP_SETUP_RPC, XAPP_BOOTSTRAP_SETUP_GATEWAY, XAPP_BOOTSTRAP_SETUP_SERVICES), XApp_Bootstrap::RPC_TARGET => $XAPP_SMD_TARGET, XApp_Bootstrap::SIGNED_SERVICE_TYPES => array(), XApp_Bootstrap::GATEWAY_CONF => array(Xapp_Rpc_Gateway::OMIT_ERROR => XApp_Service_Entry_Utils::isDebug()), XApp_Bootstrap::LOGGING_FLAGS => array(), XApp_Bootstrap::LOGGING_CONF => array(Xapp_Log::PATH => $XAPP_LOG_DIRECTORY, Xapp_Log::EXTENSION => 'log', Xapp_Log::NAME => 'xide'), XApp_Bootstrap::XAPP_CONF => array(XAPP_CONF_DEBUG_MODE => null, XAPP_CONF_AUTOLOAD => false, XAPP_CONF_DEV_MODE => XApp_Service_Entry_Utils::isDebug(), XAPP_CONF_HANDLE_BUFFER => true, XAPP_CONF_HANDLE_SHUTDOWN => false, XAPP_CONF_HTTP_GZIP => true, XAPP_CONF_CONSOLE => false, XAPP_CONF_HANDLE_ERROR => true, XAPP_CONF_HANDLE_EXCEPTION => true), XApp_Bootstrap::SERIVCE_CONF => array(XApp_Service::instance('XIDE_Directory_Service', array(XApp_Directory_Service::REPOSITORY_ROOT => $XAPP_WORKSPACE_DIRECTORY, XApp_Directory_Service::FILE_SYSTEM => 'XApp_VFS_Local', XApp_Directory_Service::VFS_CONFIG_PATH => $XAPP_VFS_CONFIG_PATH, XApp_Directory_Service::FILE_SYSTEM_CONF => array(XApp_VFS_Base::ABSOLUTE_VARIABLES => array('WS_ABS_PATH' => $XAPP_WORKSPACE_DIRECTORY), XApp_VFS_Base::RELATIVE_VARIABLES => array()))), XApp_Service::factory('xapp.xide.Workbench.Service', array(XApp_XIDE_Workbench_Service::WORKBENCH_USER => $user, XApp_XIDE_Workbench_Service::WORKBENCH_DIRECTORY => $XAPP_WORKSPACE_DIRECTORY, XApp_XIDE_Workbench_Service::SITE_CONFIG_DIRECTORY => realpath(XAPP_BASEDIR . '/xide/Workbench/siteconfig/'))), XApp_Service::instance('XApp_XIDE_Controller_UserService', array(XApp_Service::MANAGED_CLASS_OPTIONS => array(XApp_UserManager::STORE_CONF => array(XApp_Store_JSON::CONF_FILE => $XAPP_BASE_DIRECTORY . "xide" . DIRECTORY_SEPARATOR . "Data" . DIRECTORY_SEPARATOR . "Users.json"))))));
$xappBootrapper = new XApp_Bootstrap($opt);
$xappBootrapper->init();
//$userService = XApp_XIDE_Controller_UserService::instance();
//$xappBootrapper->run();
示例#5
0
 public function setup()
 {
     $this->loadMin();
     /***
      * Get run-time configuration, there is 'debug' and 'release'. For both cases there are
      * different resources to load.
      */
     $XAPP_RUN_TIME_CONFIGURATION = XApp_Service_Entry_Utils::getRunTimeConfiguration();
     /***
      * Now include all xapp stuff
      */
     //pull in registry of xapp core framework
     XApp_Service_Entry_Utils::includeXAppRegistry();
     //pull in parts of xapp json framework
     self::loadXAppJSONStoreClasses();
     //pull in json utils (to read client app's resource configuration
     self::loadJSONTools();
     //some debugging tools
     self::loadDebuggingTools();
     //pull in legacy client app renderer
     xapp_import('xapp.app.Renderer');
     //pull in xapp resource renderer
     xapp_import('xapp.Resource.Renderer');
     //pull in custom resource Renderer
     xapp_import('xapp.xide.Resource.Renderer');
     /***
      * Prepare resource renderer
      */
     //clients resource config path
     $XAPP_RESOURCE_CONFIG_PATH = '' . xapp_get_option(self::APPDIR, $this) . DIRECTORY_SEPARATOR;
     if ($XAPP_RUN_TIME_CONFIGURATION === 'debug') {
         $XAPP_RESOURCE_CONFIG_PATH .= 'lib' . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . 'resources-' . $XAPP_RUN_TIME_CONFIGURATION . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
     } else {
         if ($XAPP_RUN_TIME_CONFIGURATION === 'release') {
             $XAPP_RESOURCE_CONFIG_PATH .= DIRECTORY_SEPARATOR . xapp_get_option(self::APP_FOLDER, $this) . DIRECTORY_SEPARATOR . xapp_get_option(self::APP_NAME, $this) . DIRECTORY_SEPARATOR . 'resources-' . $XAPP_RUN_TIME_CONFIGURATION . xapp_get_option(self::RESOURCE_CONFIG_SUFFIX, $this) . '.json';
         }
     }
     if (!file_exists($XAPP_RESOURCE_CONFIG_PATH)) {
         $this->log('have no client resource configuration at ' . $XAPP_RESOURCE_CONFIG_PATH . ', aborting');
     }
     //load resource configuration
     $resources = (object) XApp_Utils_JSONUtils::read_json($XAPP_RESOURCE_CONFIG_PATH, 'json', false, true);
     $pluginResources = null;
     $resourceRendererOptions = array(XApp_Resource_Renderer::DOC_ROOT => xapp_get_option(self::DOC_ROOT, $this), XApp_Resource_Renderer::DOC_ROOT_PATH => xapp_get_option(self::APPDIR, $this), XApp_Resource_Renderer::RESOURCES_DATA => $resources);
     $clz = xapp_get_option(self::RESOURCE_RENDERER_CLZ, $this);
     $xappResourceRenderer = new $clz($resourceRendererOptions);
     $xappResourceRenderer->registerDefault();
     if (xapp_has_option(self::RELATIVE_VARIABLES)) {
         $rVariables = xapp_get_option(self::RELATIVE_VARIABLES, $this);
         foreach ($rVariables as $variable => $value) {
             $xappResourceRenderer->registerRelative($variable, $value);
         }
     }
     //determine Dojo package paths and store them as JSON serialized resource variable
     $XAPP_DOJO_PACKAGE_LOCATION_PREFIX = $xappResourceRenderer->resolveRelative('%PLUGIN_PACKAGE_ROOT_URL%');
     $javascriptPlugins = $xappResourceRenderer->getJavascriptPlugins();
     $dojoPackages = $this->getDojoPackages($XAPP_DOJO_PACKAGE_LOCATION_PREFIX, $javascriptPlugins, XApp_Service_Entry_Utils::isDebug());
     $xappResourceRenderer->registerRelative('XAPP_PLUGIN_RESOURCES', $dojoPackages['plugins']);
     $xappResourceRenderer->registerRelative('DOJOPACKAGES', $dojoPackages['packages']);
     /****
      * Build XApp-App-Renderer - Config
      */
     $opt = array(XApp_App_Renderer::DOC_ROOT_PATH => xapp_get_option(self::APPDIR, $this), XApp_App_Renderer::DOC_ROOT => xapp_get_option(self::DOC_ROOT, $this), XApp_App_Renderer::APP_NAME => xapp_get_option(self::APP_NAME, $this), XApp_App_Renderer::APP_FOLDER => xapp_get_option(self::APP_FOLDER, $this), XApp_App_Renderer::CONFIG_NAME => $XAPP_RUN_TIME_CONFIGURATION, XApp_App_Renderer::SERVICE_URL => xapp_get_option(self::SERVICE, $this), XApp_App_Renderer::RESOURCE_RENDERER => $xappResourceRenderer);
     $this->appRenderer = new XApp_App_Renderer($opt);
     $this->resourceRenderer = xo_get(XApp_App_Renderer::RESOURCE_RENDERER, $this->appRenderer);
 }