예제 #1
0
<?php

/**
 * My Application bootstrap file.
 */
// Load Nette Framework
require LIBS_DIR . '/Nette/loader.php';
// Enable Nette Debugger for error visualisation & logging
NDebugger::$logDirectory = dirname(__FILE__) . '/../log';
NDebugger::$strictMode = TRUE;
NDebugger::enable();
// Configure application
$configurator = new NConfigurator();
$configurator->setTempDirectory(dirname(__FILE__) . '/../temp');
// Enable RobotLoader - this will load all classes automatically
$configurator->createRobotLoader()->addDirectory(APP_DIR)->addDirectory(LIBS_DIR)->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(dirname(__FILE__) . '/config/config.neon');
$container = $configurator->createContainer();
// Opens already started session
if ($container->session->exists()) {
    $container->session->start();
}
// Setup router
$router = $container->router;
$router[] = new NRoute('index.php', 'Dashboard:default', NRoute::ONE_WAY);
$router[] = new NRoute('<presenter>/<action>[/<id>]', 'Dashboard:default');
// Configure and run the application!
$application = $container->application;
//$application->catchExceptions = TRUE;
$application->errorPresenter = 'Error';
예제 #2
0
파일: bootstrap.php 프로젝트: krecek/nrsn
<?php

// Load Nette Framework or autoloader generated by Composer
require dirname(__FILE__) . '/../libs/autoload.php';
ini_set('error_reporting', 1);
$configurator = new NConfigurator();
// Enable Nette Debugger for error visualisation & logging
//if ($_SERVER['HTTP_HOST'] == 'gis.drino.net' || $_SERVER['HTTP_HOST']=='gymfed.drino.net') {
$configurator->setDebugMode(TRUE);
$configurator->addParameters(array("environment" => 'development'));
//}
$configurator->enableDebugger(dirname(__FILE__) . '/../log');
// Specify folder for cache
$configurator->setTempDirectory(dirname(__FILE__) . '/../temp');
// Enable RobotLoader - this will load all classes automatically
$configurator->createRobotLoader()->addDirectory(dirname(__FILE__))->addDirectory(dirname(__FILE__) . '/../libs')->register();
// Create Dependency Injection container from config.neon file
$configurator->addConfig(dirname(__FILE__) . '/config/config.neon');
$configurator->addConfig(dirname(__FILE__) . '/config/config.local.neon', NConfigurator::NONE);
// none section
$container = $configurator->createContainer();
//////////////////
function dd($var, $name = null)
{
    return NDebugger::barDump($var, $name);
}
/////////////////
// Nastavi priznak NRoute::SECURED, pokud prichazime pres HTTPS
//NRoute::$defaultFlags |= ($container->getService('httpRequest')->isSecured() ? NRoute::SECURED : 0);
//    if(preg_match('~.*\.drino\.net~', $_SERVER['HTTP_HOST'])) $domena = "gymfed.drino.net";
//    else $domena = "www.gymfed.cz";
예제 #3
0
	/**
	 * Loads global configuration from file and process it.
	 * @param  string
	 * @param  string
	 * @return NArrayHash
	 */
	public static function loadConfig($file = NULL, $section = NULL)
	{
		if (self::$createdAt) {
			throw new InvalidStateException('NConfigurator has already been created automatically by NEnvironment at ' . self::$createdAt);
		}
		$configurator = new NConfigurator;
		$configurator
			->setProductionMode(self::isProduction())
			->setTempDirectory(defined('TEMP_DIR') ? TEMP_DIR : '');
		if ($file) {
			$configurator->addConfig($file, $section);
		}
		self::$context = $configurator->createContainer();

		self::$createdAt = '?';
		foreach (debug_backtrace(FALSE) as $row) {
			if (isset($row['file']) && is_file($row['file']) && strpos($row['file'], NETTE_DIR . DIRECTORY_SEPARATOR) !== 0) {
				self::$createdAt = "$row[file]:$row[line]";
				break;
			}
		}
		return self::getConfig();
	}
예제 #4
0
파일: index.php 프로젝트: oaki/demoshop
ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
// absolute filesystem path to the web root
define('WWW_DIR', dirname(__FILE__) . '/');
// absolute filesystem path to the application root
define('APP_DIR', WWW_DIR . '../app');
// absolute filesystem path to the libraries
define('LIBS_DIR', WWW_DIR . '../vendor');
// absolute filesystem path to the temporary files
define('TEMP_DIR', APP_DIR . '/temp');
// absolute filesystem path to the temporary files
define('LOG_DIR', APP_DIR . '/log');
require LIBS_DIR . '/nette.min.php';
require LIBS_DIR . '/shortcuts.php';
// Configure application
$configurator = new NConfigurator();
$configurator->setProductionMode(false);
$configurator->enableDebugger(LOG_DIR);
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(TEMP_DIR);
$configurator->createRobotLoader()->addDirectory(LIBS_DIR)->addDirectory(APP_DIR)->register();
// Create Dependency Injection container from config.neon file
//$configurator->addConfig(APP_DIR . '/config/config.neon');
$configurator->addConfig(APP_DIR . '/config/config.db.neon');
$container = $configurator->createContainer();
function adminer_object()
{
    class AdminerSoftware extends Adminer
    {
        private $container;
        private $user;
예제 #5
0
파일: bootstrap.php 프로젝트: oaki/demoshop
ini_set('error_reporting', E_ALL ^ E_NOTICE);
ini_set('display_errors', 1);
function set_magic_quotes_runtime()
{
    return false;
}
// iba kvolyufilenode, ktore sa pouziva aj pre nette aj pre stare CMS
define('_NETTE_MODE', true);
// Step 1: Load Nette Framework
// this allows load Nette Framework classes automatically so that
// you don't have to litter your code with 'require' statements
//require LIBS_DIR . '/nette.min.php';
require LIBS_DIR . '/nette.min.php';
require LIBS_DIR . '/shortcuts.php';
// Configure application
$configurator = new NConfigurator();
// Enable Nette Debugger for error visualisation & logging
$_ips = array('127.0.0.1', '82.119.100.182s', '99.38.224.183');
$ip = NULL;
if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) and $_SERVER['HTTP_X_FORWARDED_FOR'] != '') {
    list($ip) = explode(", ", $_SERVER['HTTP_X_FORWARDED_FOR']);
} else {
    $ip = $_SERVER['REMOTE_ADDR'];
}
if (in_array($ip, $_ips)) {
    $configurator->setProductionMode(false);
}
unset($_ips);
$configurator->enableDebugger(dirname(__FILE__) . '/log');
// Enable RobotLoader - this will load all classes automatically
$configurator->setTempDirectory(dirname(__FILE__) . '/temp');