コード例 #1
0
ファイル: IniConfig.php プロジェクト: Cryde/sydney-core
 /**
  *
  * @return Zend_Config_Ini
  */
 public function getConfig()
 {
     $this->config = new Zend_Config_Ini(array_shift($this->configFiles), $this->section, true);
     foreach ($this->configFiles as $file) {
         $this->config->merge(new Zend_Config_Ini($file, $this->section, true));
     }
     return $this->config;
 }
コード例 #2
0
 /**
  * Load configuration file of options
  *
  * @param  string $file
  * @return array
  */
 protected function _loadConfig($file, $environment)
 {
     $configCommon = new Zend_Config_Ini($file, $environment, true);
     $configCustom = new Zend_Config_Ini(str_replace('.common.ini', '.ini', $file), $environment);
     $configCommon->merge($configCustom);
     $configCommon->path->root = getcwd();
     $config = new System_Config_Placeholder($configCommon);
     return $config->toArray();
 }
コード例 #3
0
 public function __construct()
 {
     $this->originalFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR, '/var/settings/upgrades.ini');
     $this->upgradeFile = GEMS_ROOT_DIR . str_replace('/', DIRECTORY_SEPARATOR, '/var/settings/upgrades_' . APPLICATION_ENV . '.ini');
     if (!file_exists($this->originalFile)) {
         touch($this->originalFile);
     }
     if (!file_exists($this->upgradeFile)) {
         touch($this->upgradeFile);
     }
     $this->_info = new \Zend_Config_Ini($this->originalFile, null, array('allowModifications' => true));
     // Merge the environment config file
     $this->_info->merge(new \Zend_Config_Ini($this->upgradeFile, null, array('allowModifications' => true)));
 }
コード例 #4
0
ファイル: Bootstrap.php プロジェクト: KasaiDot/FansubCMS
 /**
  * init configuration
  * @return void
  */
 protected function _initConfig()
 {
     $this->applicationStatus = getenv('APPLICATION_ENV');
     # fetch the application settings
     $this->settings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", "settings", true);
     $this->routes = new Zend_Config_Ini(APPLICATION_PATH . "/configs/application.ini", "routes");
     $this->mailsettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/email.ini", "email");
     $this->databasesettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/database.ini", "database");
     $this->environmentsettings = new Zend_Config_Ini(APPLICATION_PATH . "/configs/environment.ini", "environment");
     # merge settings in main settings obj
     $this->settings->merge($this->mailsettings);
     $this->settings->merge($this->databasesettings);
     $this->settings->merge($this->environmentsettings);
 }
コード例 #5
0
ファイル: AngelTestAbstract.php プロジェクト: ud223/yj
 public function setUp()
 {
     parent::setUp();
     $config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', null, true);
     $system_ini = new \Zend_Config_Ini('/var/yujiaqu.ini');
     $config->merge($system_ini);
     $application = new Zend_Application(APPLICATION_ENV, $config->get(APPLICATION_ENV));
     $application->bootstrap();
     $this->_bootstrap = $application->getBootstrap();
     // manually init Zend_Controller_Front, otherwise, it is not inited in testing environment
     $this->_bootstrap->getResource('FrontController')->setParam('bootstrap', $this->_bootstrap);
     $this->_angel_bootstrap = $this->_bootstrap->getResource('modules')->offsetGet('angel');
     $this->_container = $this->_bootstrap->getResource('serviceContainer');
     $this->_documentManager = $this->_angel_bootstrap->getResource('mongoDocumentManager');
     $this->_logger = $this->_bootstrap->getResource('logger');
 }
コード例 #6
0
ファイル: Application.php プロジェクト: eugenzor/zfhrtool
 /**
  * Добавляет конфиг в реестр, сливает с конфигом-патчем (если есть)
  *
  * @param  string $file
  * @throws Zend_Application_Exception When invalid configuration file is provided
  * @return array
  */
 protected function _loadConfig($file)
 {
     $environment = $this->getEnvironment();
     $config = new Zend_Config_Ini($file, $environment, true);
     # Получаем путь к дополнительному конфигу
     $additionConfig = isset($config->config) ? $config->config : dirname($file) . '/_' . basename($file);
     if (is_readable($additionConfig)) {
         try {
             $configCustom = new Zend_Config_Ini($additionConfig, $environment);
             $config->merge($configCustom);
         } catch (Zend_Config_Exception $e) {
         }
     }
     if (isset($config->config)) {
         unset($config->config);
     }
     $config->setReadOnly();
     Zend_Registry::set('config', $config);
     return $config->toArray();
 }
コード例 #7
0
    // by using PEAR-type naming conventions, autoload will always know where to
    // find class definitions
    function __autoload($class)
    {
        require str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}
define('CRON_ROOT', dirname(__FILE__));
define('APP_ROOT', dirname(CRON_ROOT));
// convoluted way to find the job root
$callstack = debug_backtrace();
$cwd = explode(DIRECTORY_SEPARATOR, dirname($callstack[0]['file']));
$webroot = explode(DIRECTORY_SEPARATOR, CRON_ROOT);
$diff = array_diff($cwd, $webroot);
define('JOB_ROOT', CRON_ROOT . DIRECTORY_SEPARATOR . current($diff) . DIRECTORY_SEPARATOR . next($diff));
set_include_path('.' . PATH_SEPARATOR . JOB_ROOT . PATH_SEPARATOR . JOB_ROOT . "/tests" . PATH_SEPARATOR . APP_ROOT . '/application/lib' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . APP_ROOT . '/thirdpartylibs');
// be careful if modifying the following line.
// phing replaces it when deploying this project.
$env = 'development';
// merge the global config and this job's config and save it in registry
$params = array('allowModifications' => true);
$config = new Zend_Config_Ini(APP_ROOT . '/config/config.ini', $env, $params);
$jobConfig = new Zend_Config_Ini(JOB_ROOT . '/config.ini', $env);
$config->merge($jobConfig);
Zend_Registry::set('config', $config);
// set up logger and save it in registry
$logger = $logger =& Log::singleton('console');
$debug = (bool) $config->application->debug->enabled;
$loglevel = $debug ? PEAR_LOG_DEBUG : PEAR_LOG_INFO;
$logger->setMask(Log::MAX($loglevel));
Zend_Registry::set('logger', $logger);
コード例 #8
0
ファイル: Application.php プロジェクト: kandy/system
 protected function _loadConfigFromFile($file)
 {
     $environment = $this->getEnvironment();
     $configCommon = new Zend_Config_Ini($file, $environment, true);
     $configCustom = new Zend_Config_Ini(str_replace('.common.ini', '.ini', $file), $environment);
     $configCommon->merge($configCustom);
     if (isset($this->rootDir)) {
         $configCommon->path->root = $this->rootDir;
     }
     require_once 'System/Config/Placeholder.php';
     $config = new System_Config_Placeholder($configCommon);
     return $config->toArray();
 }
コード例 #9
0
<?php

// only define __autoload if it has not already been defined (phing may define
// it in its build script
if (!function_exists('__autoload')) {
    // by using PEAR-type naming conventions, autoload will always know where to
    // find class definitions
    function __autoload($class)
    {
        require str_replace('_', DIRECTORY_SEPARATOR, $class) . '.php';
    }
}
define('APP_ROOT', dirname(dirname(dirname(__FILE__))));
set_include_path('.' . PATH_SEPARATOR . APP_ROOT . '/application/lib' . PATH_SEPARATOR . APP_ROOT . '/application/models' . PATH_SEPARATOR . APP_ROOT . '/application/controllers' . PATH_SEPARATOR . APP_ROOT . '/application/tests/lib' . PATH_SEPARATOR . APP_ROOT . '/application/tests/models' . PATH_SEPARATOR . APP_ROOT . '/application/tests/controllers' . PATH_SEPARATOR . get_include_path() . PATH_SEPARATOR . APP_ROOT . '/cron' . PATH_SEPARATOR . APP_ROOT . '/thirdpartylibs');
// merge the real config and test config and save it in registry
$params = array('allowModifications' => true);
$config = new Zend_Config_Ini(APP_ROOT . '/config/config.ini', 'development', $params);
$testConfig = new Zend_Config_Ini(APP_ROOT . '/application/tests/config.ini');
$config->merge($testConfig);
Zend_Registry::set('config', $config);
// use a null logger for unit tests
$logger = new Mock_Logger();
Zend_Registry::set('logger', $logger);
// use a mock database for unit tests
$db = new Mock_Database();
Zend_Registry::set('db', $db);
// use a mock cache for unit tests
$cache = new Mock_Cache();
Zend_Registry::set('cache', $cache);
コード例 #10
0
 private function _getDependenciesConfig($assetsType)
 {
     $ret = new Zend_Config_Ini(KWF_PATH . '/config.ini', 'dependencies', array('allowModifications' => true));
     $ret->merge(new Zend_Config_Ini('config.ini', 'dependencies'));
     return $ret;
 }
コード例 #11
0
ファイル: index.php プロジェクト: anunay/stentors
set_include_path('.' . PATH_SEPARATOR . "{$extranet_path}/includes" . PATH_SEPARATOR . "{$rootDir}/lib" . PATH_SEPARATOR . "{$extranet_path}/modules/banners/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/cart/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/catalog/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/default/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/events/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/form/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/forms/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/gallery/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/member/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/medical/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/news/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/newsletter/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/order/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/page/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/parent/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/partners/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/profile/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/video/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/retailers/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/rss/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/rssreader/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/search/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/staff/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/text/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/users/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/utilities/models/" . PATH_SEPARATOR . "{$extranet_path}/modules/volunteers/models/" . PATH_SEPARATOR . "{$rootDir}/lib/Cible/Models/" . PATH_SEPARATOR . get_include_path());
require_once 'Zend/Loader.php';
Zend_Loader::registerAutoload();
// loading configuration
$host = explode('.', $_SERVER['HTTP_HOST']);
$envVar = 'production';
$envVar = 'production';
if (in_array('sandboxes', $host) || in_array('localhost', $host)) {
    $envVar = 'development';
} elseif (in_array('staging', $host)) {
    $envVar = 'staging';
}
$app_config = new Zend_Config_Ini("{$application_path}/config.ini", $envVar);
$imgCfg = new Zend_Config_Ini("{$application_path}/config.ini", 'Images', true);
$config = new Zend_Config_Ini("{$extranet_path}/config.ini", 'general', true);
$config->merge($imgCfg);
$config->readOnly();
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
$registry->set('relativeRootPath', $web_root);
$registry->set('absolute_web_root', $absolute_web_root);
// establishment of the database
$db = Zend_Db::factory($app_config->db);
Zend_Db_Table::setDefaultAdapter($db);
$db->query('SET NAMES utf8');
$registry->set('db', $db);
$registry->set('extranet_root', $extranet_path);
$registry->set('www_root', $www_root);
$registry->set('lucene_index', realpath(dirname(__FILE__) . '/../') . "/indexation/all_index");
// Enables the loading of helpers from /lib/Cible/View/Helper
$view = new Zend_View();
コード例 #12
0
ファイル: Connector.php プロジェクト: laiello/resmania
 public function initConfig()
 {
     $coreConfig = new Zend_Config_Ini(implode(DIRECTORY_SEPARATOR, array($this->_rootPath, 'RM', 'system', 'config', 'core.config.ini')), self::$_mode, array('allowModifications' => true));
     Zend_Registry::set('config', $coreConfig->merge($this->_config));
 }
コード例 #13
0
ファイル: index.php プロジェクト: KOBV/opus4-matheon
 * @version     $Id$
 */
// Saving start time for profiling.
$GLOBALS['start_mtime'] = microtime(true);
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__))));
// Define application environment (use 'production' by default)
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(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'library'), realpath(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'vendor'), get_include_path())));
require_once 'autoload.php';
require_once 'opus-php-compatibility.php';
// Zend_Application
$config = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
$localConfig = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/config.ini', APPLICATION_ENV, array('allowModifications' => true));
$config->merge($localConfig);
// configuration file that is modified via application user interface
if (is_readable(APPLICATION_PATH . '/application/configs/config.xml')) {
    $onlineConfig = new Zend_Config_Xml(APPLICATION_PATH . '/application/configs/config.xml');
    $config->merge($onlineConfig);
}
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, $config);
try {
    $application->bootstrap()->run();
} catch (Exception $e) {
    if (APPLICATION_ENV === 'production') {
        header("HTTP/1.0 500 Internal Server Error");
        echo $e->getMessage();
    } else {
        throw $e;
コード例 #14
0
ファイル: Ini.php プロジェクト: nstapelbroek/Glitch_Lib
 /**
  * Loads the configuration
  *
  * First, the main configuration file - "application.ini" - is loaded from
  * the root of the configs directory. Second, all other configuration files,
  * if any, are loaded recursively - except for "user.ini". Third, the
  * developer-specific configuration file - "user.ini" - is loaded. This
  * file overrides any setting in the previously loaded files and is only
  * regarded in development and testing mode.
  *
  * This method must be 'public static' - Zend_Cache_Class requires so.
  * However, users shouldn't call it directly; use getConfig() instead.
  *
  * @param string $section
  * @return Zend_Config
  */
 public static function loadConfig($section)
 {
     // Load the main configuration file
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_APPLICATION;
     $ini = new Zend_Config_Ini($configFile, $section, array('allowModifications' => true));
     // Recursively load all other ini files, if any, but exclude the special cases
     $pattern = '~^(?!' . preg_quote(self::FILENAME_APPLICATION) . '|' . preg_quote(self::FILENAME_USER) . ').+\\.ini$~';
     $dirIterator = new RecursiveDirectoryIterator(GLITCH_CONFIGS_PATH, RecursiveDirectoryIterator::KEY_AS_FILENAME);
     $recursiveIterator = new RecursiveIteratorIterator($dirIterator);
     $iterator = new RegexIterator($recursiveIterator, $pattern, RegexIterator::MATCH, RegexIterator::USE_KEY);
     foreach ($iterator as $file) {
         $ini->merge(new Zend_Config_Ini($file->getPathname(), $section));
     }
     // Optionally load developer-specific settings, overriding previous settings
     $configFile = GLITCH_CONFIGS_PATH . DIRECTORY_SEPARATOR . self::FILENAME_USER;
     if (('development' == $section || 'testing' == $section) && file_exists($configFile)) {
         $ini->merge(new Zend_Config_Ini($configFile, $section));
     }
     if ('testing' != $section) {
         $ini->setReadOnly();
     }
     return $ini;
 }
コード例 #15
0
ファイル: Bootstrap.php プロジェクト: cfrancois7/aksw.org
 /**
  * Loads the application config file
  *
  * @since 0.9.5
  */
 public function _initConfig()
 {
     // load default application configuration file
     try {
         $config = new Zend_Config_Ini(APPLICATION_PATH . 'config/default.ini', 'default', true);
     } catch (Zend_Config_Exception $e) {
         throw $e;
     }
     // load user application configuration files
     $tryDistConfig = false;
     try {
         $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'config.ini', 'private', true);
         $config->merge($privateConfig);
     } catch (Zend_Config_Exception $e) {
         $tryDistConfig = true;
     }
     if ($tryDistConfig === true) {
         try {
             $privateConfig = new Zend_Config_Ini(ONTOWIKI_ROOT . 'config.ini.dist', 'private', true);
             $config->merge($privateConfig);
         } catch (Zend_Config_Exception $e) {
             $message = '<p>OntoWiki can not find a proper configuration.</p>' . PHP_EOL . '<p>Maybe you have to copy and modify the distributed ' . '<code>config.ini.dist</code> file?</p>' . PHP_EOL . '<details><summary>Error Details</summary>' . $e->getMessage() . '</details>';
             throw new OntoWiki_Exception($message);
         }
     }
     // normalize path names
     $config->themes->path = rtrim($config->themes->path, '/\\') . '/';
     $config->themes->default = rtrim($config->themes->default, '/\\') . '/';
     $config->extensions->base = rtrim($config->extensions->base, '/\\') . '/';
     if (false === defined('EXTENSION_PATH')) {
         define('EXTENSION_PATH', $config->extensions->base);
     }
     $config->extensions->legacy = EXTENSION_PATH . rtrim($config->extensions->legacy, '/\\') . '/';
     $config->languages->path = EXTENSION_PATH . rtrim($config->languages->path, '/\\') . '/';
     $config->libraries->path = rtrim($config->libraries->path, '/\\') . '/';
     $config->cache->path = rtrim($config->cache->path, '/\\') . '/';
     $config->log->path = rtrim($config->log->path, '/\\') . '/';
     // support absolute path
     $matches = array();
     if (!(preg_match('/^(\\w:[\\/|\\\\]|\\/)/', $config->cache->path, $matches) === 1)) {
         $config->cache->path = ONTOWIKI_ROOT . $config->cache->path;
     }
     // set path variables
     $rewriteBase = substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], BOOTSTRAP_FILE));
     // set protocol and read headers sent by proxies
     $protocol = 'http';
     if (isset($_SERVER['X-Forwarded-Protocol'])) {
         $protocol = strtolower($_SERVER['X-Forwarded-Protocol']);
     } else {
         if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
             $protocol = strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']);
         } else {
             if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
                 $protocol = 'https';
             }
         }
     }
     if (isset($_SERVER['HTTP_HOST'])) {
         $httpHost = $_SERVER['HTTP_HOST'];
     } else {
         $httpHost = 'localhost';
     }
     $urlBase = sprintf('%s://%s%s', $protocol, $httpHost, $rewriteBase);
     // construct URL variables
     $config->host = parse_url($urlBase, PHP_URL_HOST);
     $config->urlBase = rtrim($urlBase . (ONTOWIKI_REWRITE ? '' : BOOTSTRAP_FILE), '/\\') . '/';
     $config->staticUrlBase = rtrim($urlBase, '/\\') . '/';
     $config->themeUrlBase = $config->staticUrlBase . $config->themes->path . $config->themes->default;
     $config->libraryUrlBase = $config->staticUrlBase . $config->libraries->path;
     // define constants for development/debugging
     if (isset($config->debug) && (bool) $config->debug) {
         // display errors
         error_reporting(E_ALL | E_STRICT);
         ini_set('display_errors', 'On');
         // enable debugging options
         if (false === defined('_OWDEBUG')) {
             define('_OWDEBUG', 1);
         }
         // log everything
         $config->log->level = 7;
     }
     return $config;
 }
コード例 #16
0
ファイル: index.php プロジェクト: brunopbaffonso/ongonline
    // Define data path
    defined('APPLICATION_DATA_PATH') || define('APPLICATION_DATA_PATH', realpath(APPLICATION_PATH . '/../data'));
} else {
    // Define path to application directory
    defined('APPLICATION_PATH') || define('APPLICATION_PATH', '/home/ong/ongonline_app/agana');
    // Define lib path
    defined('LIB_PATH') || define('LIB_PATH', realpath(APPLICATION_PATH . '/../lib'));
    // Define data path
    defined('APPLICATION_DATA_PATH') || define('APPLICATION_DATA_PATH', '/home/ong/ongonline_app/data');
}
// Define path to public directory (the view of the client)
defined('PUBLIC_PATH') || define('PUBLIC_PATH', realpath(dirname(__FILE__)));
// 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(LIB_PATH, get_include_path())));
/** Zend_Application */
require 'Zend/Application.php';
require 'Zend/Config/Ini.php';
if (strtolower(getenv('APPLICATION_ENV')) == 'development') {
    $config = new Zend_Config_Ini(APPLICATION_PATH . '/../../configs/agana_ongonline.ini', APPLICATION_ENV, array('allowModifications' => true));
    $config->merge(new Zend_Config_Ini(APPLICATION_PATH . '/../../configs/agana_ongonline_version.ini'));
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, $config);
} else {
    $config = new Zend_Config_Ini(APPLICATION_PATH . '/../configs/agana_ongonline.ini', APPLICATION_ENV, array('allowModifications' => true));
    $config->merge(new Zend_Config_Ini(APPLICATION_PATH . '/../configs/agana_ongonline_version.ini'));
    // Create application, bootstrap, and run
    $application = new Zend_Application(APPLICATION_ENV, $config);
}
$application->bootstrap()->run();
コード例 #17
0
ファイル: cli_all.php プロジェクト: psychoticbeef/deepserve
<?php

$user_ini_file = CONFIGS_PATH . '/user.ini';
set_include_path(implode(PATH_SEPARATOR, array(realpath(APPLICATION_PATH . '/../library'), get_include_path())));
require_once 'Zend/Application.php';
require_once 'Zend/Config/Ini.php';
// Load application and user ini
$ini = new Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', APPLICATION_ENV, true);
$ini_user = new Zend_Config_Ini($user_ini_file, APPLICATION_ENV);
$ini->merge($ini_user);
// Create application, bootstrap, and run
global $application;
$application = new Zend_Application(APPLICATION_ENV, $ini);
$application->bootstrap();
コード例 #18
0
ファイル: index.php プロジェクト: anunay/stentors
// define the timezone
date_default_timezone_set('Canada/Eastern');
$locale = new Zend_Locale('fr_CA');
Zend_Registry::set('Zend_Locale', $locale);
// loading configuration
$host = explode('.', $_SERVER['HTTP_HOST']);
$envVar = 'production';
if (in_array('sandboxes', $host) || in_array('localhost', $host)) {
    $envVar = 'development';
} elseif (in_array('staging', $host)) {
    $envVar = 'staging';
}
$config = new Zend_Config_Ini("{$application_path}/config.ini", 'general', true);
$imgCfg = new Zend_Config_Ini("{$application_path}/config.ini", 'Images', true);
$envCfg = new Zend_Config_Ini("{$application_path}/config.ini", $envVar);
$config->merge($imgCfg);
$config->merge($envCfg);
$config->setReadOnly();
$registry = Zend_Registry::getInstance();
$registry->set('config', $config);
// establishment of the database
$db = Zend_Db::factory($config->db);
Zend_Db_Table::setDefaultAdapter($db);
$db->query('SET NAMES utf8');
$registry->set('db', $db);
$registry->set('siteName', $config->site->title);
$registry->set('application_path', $application_path);
$registry->set('orders_path', $orders_path);
$registry->set('document_root', "{$rootDir}/{$config->document_root}");
$registry->set('web_root', $web_root);
$registry->set('www_root', $web_root);
コード例 #19
0
ファイル: index.php プロジェクト: alexukua/opus4
 * @author      Thoralf Klein <*****@*****.**>
 * @copyright   Copyright (c) 2008-2010, OPUS 4 development team
 * @license     http://www.gnu.org/licenses/gpl.html General Public License
 * @version     $Id: index.php 10347 2012-06-12 14:02:40Z tklein $
 */
// Saving start time for profiling.
$GLOBALS['start_mtime'] = microtime(true);
// Define path to application directory
defined('APPLICATION_PATH') || define('APPLICATION_PATH', realpath(dirname(dirname(__FILE__))));
// Define application environment (use 'production' by default)
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(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'library'), get_include_path())));
///** Zend_Application */
require_once 'Zend/Application.php';
require_once 'Zend/Config/Ini.php';
$config = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/application.ini', APPLICATION_ENV, array('allowModifications' => true));
$localConfig = new Zend_Config_Ini(APPLICATION_PATH . '/application/configs/config.ini', APPLICATION_ENV, array('allowModifications' => true));
$config->merge($localConfig);
//// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, $config);
try {
    $application->bootstrap()->run();
} catch (Exception $e) {
    if (APPLICATION_ENV === 'production') {
        header("HTTP/1.0 500 Internal Server Error");
        echo $e->getMessage();
    } else {
        throw $e;
    }
}
コード例 #20
0
ファイル: initenv.php プロジェクト: niieani/nandu
// This uses the async generator
defined('ASYNCHRONOUS_LAUNCH') || define('ASYNCHRONOUS_LAUNCH', true);

// Here we add include paths to files which are an absolute must
set_include_path(
	ROOT_PATH . DS. 'library' . DS . 'vendor' . PS .
	get_include_path()
);

require_once 'Zend/Application.php';
require_once 'Zend/Config/Ini.php';

// We load main application configuration file, all sections (null) and we allow to further modify configuration values (true)
try {
	$config = new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'application.ini', null, true);
	$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'routing.ini'));
	if (is_file(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini')) {
		$config->merge(new Zend_Config_Ini(APPLICATION_PATH . DS . 'configs' . DS . 'custom.ini'));
	}
} catch (Zend_Config_Exception $e) {
	if (PHP_SAPI !== 'cli') header('Content-Type: text/plain; charset=UTF-8');
	exit('The application was unable to read one of the main configuration file (application.ini or routing.ini). It makes me a sad panda as well.' . PHP_EOL);
}

try {
	// Instantiate the application, bootstrap, and run
	$application = new Zend_Application(APPLICATION_ENV, $config->{APPLICATION_ENV});

	$autoloader = $application->getAutoloader();

	// We want the autoloader to load any namespace
コード例 #21
0
 /**
  *
  * @param type $path
  * @return \Zend_Config_Ini
  */
 protected function _loadConfig($path)
 {
     if (file_exists($path . '/template.ini')) {
         $config = new \Zend_Config_Ini($path . '/template.ini', null, array('allowModifications' => true));
         if (file_exists($path . '/template-local.ini')) {
             $config->merge(new \Zend_Config_Ini($path . '/template-local.ini', null, array('allowModifications' => true)));
         }
         return $config;
     }
 }
コード例 #22
0
ファイル: index.php プロジェクト: ud223/yj
<?php

// 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');
if (APPLICATION_ENV != 'production') {
    define('ALI_LOG', true);
}
define('ALI_LOG_PATH', realpath(dirname(__FILE__) . '/../data/log/'));
// 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';
require_once 'Zend/Config/Ini.php';
$system_ini_path = 'yujiaqu.ini';
if (file_exists($system_ini_path)) {
    $system_ini = new \Zend_Config_Ini($system_ini_path);
} else {
    echo "Cannot find the system ini file.";
    exit;
}
$config = new \Zend_Config_Ini(APPLICATION_PATH . '/configs/application.ini', null, true);
$config->merge($system_ini);
// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, $config->get(APPLICATION_ENV));
$application->bootstrap()->run();
コード例 #23
0
ファイル: bootstrap.php プロジェクト: VUW-SIM-FIS/emiemi
// use. In this case, XHTML1 Strict.
$view = Zend_Layout::getMvcInstance()->getView();
$view->doctype('XHTML1_STRICT');
// add login redirector
require_once APPLICATION_PATH . '/auth/AuthPlugin.php';
$frontController->registerPlugin(new AuthPlugin());
//
// CONFIGURATION - Setup the configuration object
// The Zend_Config_Ini component will parse the ini file, and resolve all of
// the values for the given section.  Here we will be using the section name
// that corresponds to the APP's Environment
$configuration = new Zend_Config_Ini(CONFIG_FILE, APPLICATION_ENVIRONMENT, true);
$arsConfig = new Zend_Config_Ini(APPLICATION_PATH . '/modules/ars/config/ars.ini', APPLICATION_ENVIRONMENT);
if (file_exists(LOCAL_CONFIG_FILE) && is_readable(LOCAL_CONFIG_FILE)) {
    $localConfig = new Zend_Config_Ini(LOCAL_CONFIG_FILE, APPLICATION_ENVIRONMENT);
    $configuration->merge($localConfig);
}
// LOGGER
$logfile = APPLICATION_PATH . "/" . $configuration->log->path;
if (is_file($logfile) && !is_writeable($logfile)) {
    die("Unable to write to log file " . $logfile);
}
$writer = new Zend_Log_Writer_Stream($logfile);
$writer->setFormatter(new Zend_Log_Formatter_Simple('%timestamp% %priorityName% %request% %remote%: %message%' . "\n"));
$filter = new Zend_Log_Filter_Priority((int) $configuration->log->level);
$writer->addFilter($filter);
$logger = new Zend_Log($writer);
$logger->setEventItem('pid', getmypid());
$logger->setEventItem('request', $_SERVER['REQUEST_URI']);
$logger->setEventItem('remote', $_SERVER['REMOTE_ADDR']);
// TRANSLATIONS