-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·36 lines (22 loc) · 1006 Bytes
/
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
<?php
session_start();
require_once('app/classes/db.abstract.php');
require_once('/var/www/settings/ugm.inc.php');
require ($settings['lwmvc'] . 'lwmvc.class.php');
$fm = new lwmvc();
$fm->setControllerDir($settings['install_dir'] . 'app/controllers');
$fm->setTemplateDir($settings['install_dir'] . 'app/templates');
$fm->setDefaultController('home');
$fm->setFrameworkDir($settings['lwmvc']);
$fm->setCaptureExternalFormPosts(true);
$fm->setFileNotFoundURL($settings['base_url'].'error/e404');
$args = explode('/',$_SERVER['REQUEST_URI']);
$controller = (isset($args[1]) && !empty($args[1])) ? $args[1]: 'home';
$action = (isset($args[2]) && !empty($args[2])) ? $args[2]: 'index';
$fm->overrideRequestParms(array('controller'=>$controller,'action'=>$action));
$request = $fm->getRequestParams();
if($request['controller'] != 'login' && !isset($_SESSION['user_id'])){
header('Location:/login/index');
}
$fm->assignGlobalSmarty('BASE_URL',$settings['base_url']);
$fm->handleRequest();