Esempio n. 1
0
<?php

ini_set('display_errors', '1');
error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT);
include_once 'config/defines.php';
function __autoload($className)
{
    $dirs = array('core', 'models', 'controllers', 'core/form');
    foreach ($dirs as $dir) {
        $file = $dir . '/' . $className . '.php';
        if (file_exists($file)) {
            include_once $file;
        }
    }
}
$database = new Database();
session_start();
Dispatcher::run();
Esempio n. 2
0
<?php

/**
 * Created by PhpStorm.
 * User: Europpa
 * Date: 24/10/14
 * Time: 07:13 PM
 */
define('DS', DIRECTORY_SEPARATOR);
define('ROOT', realpath(dirname(__FILE__)) . DS);
define('APP_PATH', ROOT . 'application' . DS);
header('Content-type: text/html; charset=utf-8');
//echo print_r(get_required_files());
try {
    require_once APP_PATH . 'config.php';
    require_once APP_PATH . 'Request.php';
    require_once APP_PATH . 'Controller.php';
    require_once APP_PATH . 'Dispatcher.php';
    require_once APP_PATH . 'View.php';
    require_once APP_PATH . 'Model.php';
    require_once APP_PATH . 'Database.php';
    require_once APP_PATH . 'Sessiones.php';
    Sessiones::construir_session();
    Dispatcher::run(new Request());
} catch (Exception $e) {
    echo $e->getMessage();
}
Esempio n. 3
0
File: index.php Progetto: kstep/pnut
try
{
	$config_cache = Cache::getInstance("cached_config");
	$route_config = "configs/routes.xml";
	$store_config = "configs/db.xml";
	$min_time = max(filemtime($route_config), filemtime($store_config));

	if ($config = $config_cache->get($min_time))
	{
		$routes = $config->routes;
	}
	else
	{
		$config = Config::getInstance();
		$config->loadXML($store_config, "storage");
		$routes = $config->loadXML($route_config, "routes");
		$config_cache->put($config);
	}

	//$dispatcher = new Dispatcher_Cached($routes["site"]);
	$dispatcher = new Dispatcher($routes['site']);
	$dispatcher->run();
} catch (Exception $e) {
	report_exception($e);
}

$end_time = microtime(true);
//include("debug.php");
?>
Esempio n. 4
0
}
$cur_stage = NetAidManager::get_stage();
$request = new Request($_GET['query']);
$dispatcher = new Dispatcher();
$controller = $request->getController();
$action = $request->getAction();
$updater = new Updater();
if ($cur_stage >= STAGE_ONLINE && $_SESSION['logged_in'] == 1 && $updater->updateAvailable()) {
    if ($controller != 'update') {
        $request->setController('update');
        $request->setAction('index');
    }
} else {
    if ($cur_stage != STAGE_ONLINE && $_SERVER['SERVER_NAME'] != '192.168.101.1') {
        header('Location: http://192.168.101.1/' . $controller . '/' . $action);
        die;
    }
}
$page_html = '';
try {
    $page_html = $dispatcher->run($request);
} catch (NotFoundException $e) {
    if ($cur_stage != STAGE_ONLINE) {
        header('Location: http://192.168.101.1/index/index');
        die;
    }
    $e->do_404();
}
$params = array('page_html' => $page_html);
$layout = new View('layout', $params);
$layout->display();
Esempio n. 5
0
    // Controllers
    if (!$return && file_exists(CONTROLLER_DIR . '/' . $filename)) {
        require_once CONTROLLER_DIR . '/' . $filename;
        $return = true;
    }
    // Models
    if (!$return && file_exists(MODELS_DIR . '/' . $filename)) {
        require_once MODELS_DIR . '/' . $filename;
        $return = true;
    }
    // Libs
    if (!$return && file_exists(LIBS_DIR . '/' . $filename)) {
        require_once LIBS_DIR . '/' . $filename;
        $return = true;
    }
    // Collections
    if (!$return && file_exists(COLLECTIONS_DIR . '/' . $filename)) {
        require_once COLLECTIONS_DIR . '/' . $filename;
        $return = true;
    }
    if (defined("PROFILER") && PROFILER) {
        $profilerClassAllocatedSize[$class_name] = memory_get_usage() - $memNow;
    }
    return $return;
}
// register the custom autoload method
spl_autoload_register('__autoload');
// start application
$application = new Dispatcher($db);
$application->run();
Esempio n. 6
0
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
/* very basic session management at this point */
session_start();
/* get the start time of the php script execution */
define('SCRIPT_START', microtime(true));
/* include paths config file */
include '../application/config/paths.php';
/* include general config file */
include DIR_CONFIG . 'general.live.php';
/* include database config file */
include DIR_CONFIG . 'database.live.php';
/* include api auth config file */
include DIR_CONFIG . 'api_auths.live.php';
/* include functions file */
include DIR_FUNCTIONS . 'general.php';
/* set error reporting */
error_reporting(SYSTEM_ERRORLEVEL);
/* set default timezone */
date_default_timezone_set(SYSTEM_TIMEZONE);
try {
    /* instantiate disbatcher class */
    $Dispatcher = new Dispatcher();
    /* perform functions and render page */
    $Dispatcher->run();
} catch (ExceptionAbstract $ExceptionAbstract) {
    /* display error message for thrown exception */
    $ExceptionAbstract->triggerEvent();
}