-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
72 lines (56 loc) · 2.05 KB
/
index.php
File metadata and controls
72 lines (56 loc) · 2.05 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<?php
error_reporting(E_ALL | E_STRICT);
define('QF_CLI', false);
//show errors only on localhost
if (in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
define('QF_DEBUG', true);
} else {
define('QF_DEBUG', false);
}
ini_set('display_errors', QF_DEBUG ? '1' : '0');
ini_set('log_errors', '1');
define('QF_BASEPATH', dirname(__FILE__).'/');
try {
require_once(QF_BASEPATH.'data/config.php');
require_once(QF_BASEPATH.'data/routes.php');
require_once(QF_BASEPATH.'lib/qfAutoload.php');
require_once(QF_BASEPATH.'lib/functions.php');
$autoloader = new qfAutoload();
spl_autoload_register(array($autoloader, 'autoload'));
$config = new qfConfig($qf_config);
$autoloader->setPaths($config->autoload_paths);
$config->format = isset($_GET['format']) ? $_GET['format'] : null;
$qf = new qfCore($config); // or new qfCoreI18n($config); to add i18n-capability to getUrl/redirectRoute methods
//i18n
/*
$language = isset($_GET['language']) ? $_GET['language'] : '';
$qf->i18n = new qfI18n($qf, $language);
$qf->t = $qf->i18n->get();
//set i18n title/description
$qf->config->website_title = $qf->t->website_title;
$qf->config->meta_description = $qf->t->meta_description;
*/
//database
/*
$qf->qfDB = new qfDB($qf);
$qf->db = $qf->db->get();
*/
//start a session if needed
/*
session_name('your_session_name');
session_start();
*/
$route = isset($_GET['route']) ? $_GET['route'] : '';
$routeData = $qf->parseRoute($route);
$pageContent = $qf->callPage($routeData['module'], $routeData['page'], $routeData['parameter'], true);
echo $qf->parseTemplate($pageContent);
} catch (Exception $e) {
//display the error page with template
try {
echo $qf->parseTemplate($qf->parse('error', '500', array('exception' => $e)));
} catch (Exception $e) {
//seems like the error was inside the template or error page
//display a fallback page
require(QF_BASEPATH.'templates/error.php');
}
}