forked from devalexandre/templateERP_Bootstrap
/
engine.php
executable file
·52 lines (47 loc) · 1.75 KB
/
engine.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
49
50
51
52
<?php
// define the autoloader
include_once 'lib/adianti/util/TAdiantiLoader.class.php';
spl_autoload_register(array('TAdiantiLoader', 'autoload_web'));
// read configurations
$ini = parse_ini_file('application.ini');
date_default_timezone_set($ini['timezone']);
TAdiantiCoreTranslator::setLanguage( $ini['language'] );
TApplicationTranslator::setLanguage( $ini['language'] );
// define constants
define('APPLICATION_NAME', $ini['application']);
define('OS', strtoupper(substr(PHP_OS, 0, 3)));
define('PATH', dirname(__FILE__));
class TApplication extends TCoreApplication
{
static public function run($debug = FALSE)
{
new TSession;
if ($_REQUEST)
{
$class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
if( ! TSession::getValue('logged') AND $class !== 'LoginForm' )
{
new TMessage('error', _t('Permission denied'), new TAction(array('LoginForm','onLogout')) );
}
else
{
if( $class AND $class !== 'LoginForm' )
{
$programs = (array) TSession::getValue('programs');
$default_programs = array('TStandardSeek' => TRUE,
'TFileUploader' => TRUE,
'EmptyPage' => TRUE );
$programs = array_merge($programs,$default_programs);
if( ! isset($programs[$class]) )
{
new TMessage('error', _t('Permission denied'));
return false;
}
}
parent::run($debug);
}
}
}
}
TApplication::run(TRUE);
?>