<?php
$lenguage = 'es_ES.UTF-8';
putenv("LANG=$lenguage");
setlocale(LC_ALL, $lenguage);

#error_reporting(E_ERROR | E_WARNING | E_PARSE);
#ini_set('display_errors', 1);

define('DS', DIRECTORY_SEPARATOR);
define('ROOT', realpath(dirname(__FILE__)) . DS);
define('APP_PATH', ROOT . 'application' . DS);
define('APP_PATH_GOOGLE', ROOT . 'google-api-php-client' . DS);

try {
	require_once APP_PATH . 'Autoload.php';

	require_once APP_PATH_GOOGLE . 'vendor/autoload.php';
	require_once APP_PATH . 'Googleauth.php';

	require_once APP_PATH . 'Config.php';

	Session::init();
	$registry = Registry::getInstancia();
	$registry->_request = new Request();
	$registry->_db = DataBase::getInstancia();
	#$registry->_dbcert = DataBaseCert::getInstancia();

	$registry->_model = new Model();
	$registry->_acl = new ACL();
	$registry->_process = new Process();
	Bootstrap::run($registry->_request);

	$googleclient = new Google_Client();
	#var_dump($googleclient);
	$registry->_googleclient = $googleclient;
	$registry->_googleoauth = new Googleauth($googleclient);

} catch (Exception $e) {
	echo $e->getMessage();
}
