예제 #1
0
파일: index.php 프로젝트: josmel/HosPot
 /**
  * 
  * @return Zend_Application
  */
 public static function getApplication()
 {
     $application = new Zend_Application(APPLICATION_ENV);
     $applicationini = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", APPLICATION_ENV);
     $options = $applicationini->toArray();
     foreach (self::$_ini as $value) {
         $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
         if (is_readable($iniFile)) {
             $config = new Zend_Config_Ini($iniFile);
             $options = $application->mergeOptions($options, $config->toArray());
         } else {
             throw new Zend_Exception('error en la configuracion de los .ini');
         }
     }
     //        foreach (self::$_ini as $value) {
     //            $iniFile = APPLICATION_PATH . self::$_pathConfig . $value;
     //
     //            if (is_readable($iniFile)) {
     //                $config = new Zend_Config_Ini($iniFile);
     //                $options = $application->mergeOptions($options,
     //                    $config->toArray());
     //            } else {
     //            throw new Zend_Exception('error en la configuracion de los .ini');
     //            }
     //        }
     Zend_Registry::set('config', $options);
     $a = $application->setOptions($options);
     return $application;
 }
 public function onRequest(GetResponseEvent $event)
 {
     if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) {
         // don't do anything if it's not the master request
         return;
     }
     $request = $event->getRequest();
     $pos = strpos($request->server->get('REQUEST_URI'), '_profiler');
     // don't call Zend Application for profiler.
     if (false === $pos) {
         // init adodb
         require_once __DIR__ . '/../../../../db_connect.php';
         // Fill zend application options
         $config = $this->container->getParameterBag()->all();
         $application = new \Zend_Application(APPLICATION_ENV);
         $application->setOptions($config);
         $application->bootstrap();
         \Zend_Registry::set('zend_application', $application);
     }
 }
예제 #3
0
 /**
  * @see    Zend_Application::setOptions()
  * @param  array $options
  * @return Core_Application provides a fluent interface
  */
 public function setOptions(array $options)
 {
     if (!empty($options['config'])) {
         $options = $this->_mergeFilesRecursive($options);
         unset($options['config']);
     }
     if (!empty($options['pluginCache'])) {
         if (!is_string($options['pluginCache'])) {
             throw new Zend_Application_Exception('Plugin cache deve ser string');
         }
         Zend_Loader_PluginLoader::setIncludeFileCache($options['pluginCache']);
         if (file_exists($options['pluginCache'])) {
             include_once $options['pluginCache'];
         }
     }
     return parent::setOptions($options);
 }
예제 #4
0
파일: index.php 프로젝트: tudorfis/php-api
<?php

/* set crossdomain request */
header('Access-Control-Allow-Origin: *');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
header("Access-Control-Allow-Credentials: true");
// Define application environment
if (!isset($_REQUEST['env']) || empty($_REQUEST['env'])) {
    die;
} else {
    define('APPLICATION_DB', $_REQUEST['env']);
}
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
/* Define application environment */
defined('APPLICATION_ENV') || define('APPLICATION_ENV', getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production');
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
$config = $application->getOptions();
$config['resources']['db']['params']['dbname'] = APPLICATION_DB;
$application->setOptions($config)->bootstrap()->run();
예제 #5
0
 /**
  * Set options for Centurion_Config_Manager
  *
  * @param array $options Options
  * @return $this
  */
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     Centurion_Config_Manager::add($options);
     return $this;
 }
예제 #6
0
파일: index.php 프로젝트: n3r/parseKp
<?php

defined('APPLICATION_ROOT') || define('APPLICATION_ROOT', realpath(__DIR__ . '/../'));
require_once APPLICATION_ROOT . '/app/Init.php';
require_once 'Zend/Application.php';
$application = new Zend_Application(APPLICATION_ENV);
$config = (include APPLICATION_PATH . '/configs/' . APPLICATION_ENV . '.php');
$application->setOptions($config);
try {
    $application->bootstrap()->run();
} catch (Exception $e) {
    Zend_Debug::dump($e->getMessage());
    Zend_Debug::dump($e->getTraceAsString());
    die;
}