Example #1
0
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;
        function __construct(SystemContainer $container)
Example #2
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();
	}