Exemplo n.º 1
0
		public static function StartApp()
		{
			ob_start('ob_gzhandler');
			session_start();
			
			// Defines
			define('BASEURL', substr((empty($_SERVER['HTTPS']) ? 'http://' : 'https://' ) . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'],0,-10));
			define('BASEPATH', substr($_SERVER['SCRIPT_FILENAME'],0,-10));
			
			// Helper Boot Loader
			require(BASEPATH.'/core/bootloader.php');
			
			// Initialize Helpers
			BootLoader::loadHelpers();
			Registry::getInstance();
			
			// Handle Errors
			Registry::setDebugMode(true);
			set_error_handler('Template::handleError');
			set_exception_handler('Template::handleException');
	
			// Initialize Database
			Model::$db = DBO::getInstance('sqlite:example.sqldb');
			
			// Init Autoloads
			spl_autoload_register('Autoload::controllers');
			spl_autoload_register('Autoload::models');
			
			// Determine Controllers and Methods
			Routes::getRoute();
			
			// Run Application
			Routes::run();
		}
Exemplo n.º 2
0
 function run()
 {
     $config = parse_ini_file('../.config');
     $this->setUpDb();
     $showErrors = isset($config['showErrors']) ? $config['showErrors'] : false;
     $configuration = ['settings' => ['displayErrorDetails' => $showErrors]];
     $c = new \Slim\Container($configuration);
     // create new Slim instance
     $app = new \Slim\App($c);
     // create new Slim instance
     //$app = new \Slim\App();
     $app->db = $this->database;
     $this->flashDB(false);
     $app->auth = false;
     $app->user = '';
     $app->register = $config['registerActive'];
     $app->add(function ($request, $response, $next) use(&$app) {
         if (isset($_SESSION['userID'])) {
             $app->auth = true;
             $app->user = $_SESSION['username'];
         }
         $response = $next($request, $response);
         return $response;
     });
     $container = $app->getContainer();
     $container['view'] = function ($c) {
         // templates location and a settings array
         $view = new \Slim\Views\Twig('../templates', ['cache' => '../cache', 'auto_reload' => true, 'debug' => true]);
         // Instantiate and add Slim specific extension
         $view->addExtension(new Slim\Views\TwigExtension($c['router'], $c['request']->getUri()));
         return $view;
     };
     $route = new Routes($app);
     $app = $route->run($app);
     $this->app = $app;
     // Run app
     $this->app->run();
 }
Exemplo n.º 3
0
<?php

// Load up the framework
require_once 'core/autoload.php';
// Run the current route
Routes::run();
Exemplo n.º 4
0
 public static function ini()
 {
     include_once "../app/Routes.php";
     Routes::run();
 }