-
Notifications
You must be signed in to change notification settings - Fork 118
/
Copy pathindex.php
48 lines (35 loc) · 1.21 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
ini_set('display_errors', 1);
ini_set('display_startup_erros', 1);
error_reporting(E_ALL);
if (
(getenv('APP_ENV', 'local') != 'production' && getenv('APP_DISPLAY_ERRORS', 'false') == 'true') ||
!file_exists('.env')
) {
ini_set('display_errors', 1);
ini_set('display_startup_erros', 1);
error_reporting(E_ALL);
}
require_once(__DIR__ . '/vendor/autoload.php');
if (!file_exists(__DIR__. '/.env')) {
require_once(__DIR__.'/System/Bootstrap/install.php');
exit;
}
# Load env configuration
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
header('Access-Control-Allow-Origin: *');
header('Content-type: text/html; charset=UTF-8');
System\Session\Session::start();
System\Session\Token::verify();
date_default_timezone_set(getenv('TIMEZONE', 'America/Bahia'));
use System\Route\GetRoute;
use System\Route\SelectController;
# Load controllers
$route = new SelectController(new GetRoute);
# esse código será rodado temporariamente para gerar codigo de barra nos produtos antigos
if (file_exists(__DIR__.'/.temps/preenche-codigo-de-barras-nos-produtos.php')) {
include __DIR__.'/.temps/preenche-codigo-de-barras-nos-produtos.php';
}
# Load routes
require_once(__DIR__ . '/routes/routes.php');