Ejemplo n.º 1
0
/**
 * 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';
$application->run();
Ejemplo n.º 2
0
// 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;
        function __construct(SystemContainer $container)
        {
            $this->container = $container;
            $this->user = $container->getService('user');
            $this->parameters = $container->parameters;
        }
        function name()
        {
Ejemplo n.º 3
0
// 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";
$container->router[] = $adminRouter = new NRouteList('Admin');
$adminRouter[] = new NRoute('admin/<presenter>/<action>[/<id>]', 'Homepage:default');
Ejemplo n.º 4
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();
	}