-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
46 lines (37 loc) · 1.31 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
<?php
use \DataHandle\Config;
use \DataHandle\Request;
require 'config.php';
header( 'Content-Type: text/html; charset=utf-8' );
header( 'X-Frame-Options: SAMEORIGIN' );
define( 'APP_PATH', dirname( __FILE__ ));
ini_set("display_errors", "1"); //desabilita mostrar erros na tela
ini_set("log_errors", "1"); //habilita log de erros
ini_set("error_log", getcwd() . '/error.log');
ini_set('memory_limit', -1);
function filePath( $class, $extension = 'php' )
{
$file = APP_PATH . '/' . strtolower( str_replace('\\','/',$class) ) . '.' . $extension;
return $file;
}
function loadFile( $class )
{
$filename = filePath( '/'. $class, 'php' );
if ( is_file( $filename ) )
{
require $filename;
}
}
spl_autoload_register( 'loadFile' );
$config[ 'defaultPage' ] = 'page\main';
$config[ 'response' ] = 'content';
$config[ 'dbConnType' ] = Request::get( 'dbConnType' );
$config[ 'dbConnHost' ] = Request::get( 'dbConnHost' );
$config[ 'dbConnName' ] = Request::get( 'dbConnName' );
$config[ 'dbConnUser' ] = Request::get( 'dbConnUser' );
$config[ 'dbConnPassword' ] = Request::get( 'dbConnPassword' );
$config[ 'dbConnDsn' ] = $config[ 'dbConnType' ] . ':host = ' . $config[ 'dbConnHost' ] . ';
dbname = ' . $config[ 'dbConnName' ];
Config::getInstance()->setData( $config );
$app = new App();
$app->handle();