Exemplo n.º 1
0
// Define PATH to configuration
define('CONFIGURATION_PATH', APPLICATION_PATH . '/configs');
chdir(dirname(__DIR__));
// Load Zend Framework
require_once 'Zend/Loader/Autoloader.php';
$zendLoader = Zend_Loader_Autoloader::getInstance();
$zendLoader->registerNamespace('Dot_');
$zendLoader->registerNamespace('Api_');
// Create registry object, as read-only object to store there config, settings, and database
$registry = new Zend_Registry(array(), ArrayObject::ARRAY_AS_PROPS);
Zend_Registry::setInstance($registry);
// Load configuration settings from application.ini file and store it in registry
$config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV);
$registry->configuration = $config;
// Set PHP configuration settings from application.ini file
Dot_Settings::setPhpSettings($config->phpSettings->toArray());
// check if api enabled from application.ini
if ($registry->configuration->api->params->enable != true) {
    Api_Model_Header::setHeaderByCode(403);
    exit;
}
// Get the action and the other arguments
$arguments = array();
$arguments = $_GET;
$arguments['key'] = isset($arguments['key']) ? $arguments['key'] : '';
$action = '';
if (isset($arguments['action'])) {
    $action = $arguments['action'];
    unset($arguments['action']);
}
$registry->action = $action;
Exemplo n.º 2
0
 /**
  * Initialize the global variables 
  * @access public 
  * @static
  * @param int $startTime
  * @return bool $success
  */
 public static function initialize($startTime)
 {
     // Create registry object, as read-only object to store there config, settings, and database
     $registry = self::_initializeRegistry();
     // mark the start time
     $registry->startTime = $startTime;
     //Load configuration settings from application.ini file and store it in registry
     $config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV);
     $registry->configuration = $config;
     //start the cache
     Dot_Cache::loadCache();
     //Load routes(modules, controllers, actions) settings from router.xml file and store it in registry
     $registry->router = self::_loadRouter();
     // load the plugin configuration
     $registry->pluginConfiguration = self::_loadPluginConfiguration();
     //Load configuration settings from application.ini file and store it in registry
     $config = new Zend_Config_Ini(CONFIGURATION_PATH . '/application.ini', APPLICATION_ENV);
     $registry->configuration = $config;
     // Create  connection to database, as singleton , and store it in registry
     $db = Zend_Db::factory('Pdo_Mysql', $config->database->params->toArray());
     $registry->database = $db;
     //Load specific configuration settings from database, and store it in registry
     $settings = Dot_Settings::getSettings();
     $registry->settings = $settings;
     //Set PHP configuration settings from application.ini file
     Dot_Settings::setPhpSettings($config->phpSettings->toArray());
     // Extract the route from the URI
     Dot_Route::setRoute();
     // initialize seo options
     $registry->seo = Dot_Route::getOption();
     // initialize default options for dots that may be overwritten
     $option = Dot_Settings::getOptionVariables($registry->requestModule, 'default');
     $registry->option = $option;
     return true;
 }