<?php
2
3/**
4 * Módulo padrão para todas as funções, responsável por carregar as classes e incluir funções globais
5 *
6 * @author Lucas/Postali
7 */
8
9define('REQUIRED_PHP_VERSION', '7.1');
10
11define('MAIN_FOLDER', __DIR__);
12
13/**
14 * Nomraliza os separadores de um nome de arquivo
15 * @param string $file Nome do arquivo
16 * @return string
17 */
18function normalizeDirSeparator($file)
19{
20 return preg_replace("/\\/|\\\\/", DIRECTORY_SEPARATOR, $file);
21}
22
23require_once('utils.php');
24
25$composerAutoloadFile = MAIN_FOLDER . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
26
27if (file_exists($composerAutoloadFile)){
28 require_once($composerAutoloadFile);
29}
30else{
31 Error('The composer autoload is not installed. Run composer install on console');
32}
33
34set_error_handler(
35 function ($errno, $errstr, $errfile, $errline) {
36 throw new Exception($errstr, $errno);
37 }
38);
39
40set_exception_handler(
41 function ($err) {
42 HandlerException($err);
43 }
44);
45
46//Função de carregamento automático das classes
47function _autoload($class)
48{
49 $folders = array(
50 array('Modules', 'Custom'),
51 array('Modules', 'Core'),
52 array('Modules', 'Classes'),
53 array('Controllers'),
54 array('Modules', 'Traits'),
55 array('vendor'),
56 array('Modules', 'Libraries'),
57 array('Modules', 'Interfaces'),
58 array('Models'),
59 array("Scripts")
60 );
61
62 foreach ($folders as $folder) {
63 $file = MAIN_FOLDER . DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $folder) . DIRECTORY_SEPARATOR . normalizeDirSeparator($class) . '.php';
64
65 if (file_exists($file)) {
66 //trace("Loading class '$class' from file '$file'", 'main', $class, TRACE_LOW);
67 require_once($file);
68 return;
69 }
70 }
71
72 trace("Class '$class' not found", 'main', $class, TRACE_ERROR);
73 throw new Exception("Class '$class' not found", 1);
74}
75
76//Auto registrar classes
77spl_autoload_register('_autoload');
78trace('System ready', 'main', MAIN_FOLDER, TRACE_LOW);
79
You can see detailed error trace in the console.
render ()
/var/www/vidasreais/dev.vidasreais.com.br/index.php 19
parseMethod ()
/var/www/vidasreais/dev.vidasreais.com.br/Modules/Core/Navigation/Page.php 377
downloadComprovante ()
/var/www/vidasreais/dev.vidasreais.com.br/Modules/Core/Utils/Util.php 144
requireAdminPermission ()
/var/www/vidasreais/dev.vidasreais.com.br/Controllers/Evento/Aberto.php 226
getUserPermissions ()
/var/www/vidasreais/dev.vidasreais.com.br/Modules/Core/Navigation/_Request.php 277
{closure} ()
/var/www/vidasreais/dev.vidasreais.com.br/Modules/Classes/CMS/_User.php 86
You can see detailed error trace in the console.
main
System ready
'/var/www/vidasreais/dev.vidasreais.com.br'
web
Starting session
true
web
Starting web module
''
Culture
Auto discovering culture
NULL
Culture
Setting culture
'Brasil'
Navigation\Navigation
Setting Navigation default timezone
'America/Sao_Paulo'
Navigation\Navigation
Setting Navigation default language
false
web
User
'216.73.216.33'
Navigation\Navigation
Interpreting URI
'eventos/comprovante'
CMS
Validating session
array ( )
Fault
User without session
NULL