forked from teopiaz/Qwench-Diablo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
87 lines (63 loc) · 1.78 KB
/
index.php
File metadata and controls
87 lines (63 loc) · 1.78 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/* Start Session */
session_name("qwench");
session_start();
/* Define */
define('ROOT',DIRNAME(__FILE__));
define('DS',DIRECTORY_SEPARATOR);
/* Get Basic Details */
if (isset($_SERVER['PATH_INFO'])) {
$path = explode("/", substr($_SERVER['PATH_INFO'],1));
}
$controller = 'questions';
$action = 'index';
if (empty($_GET['type'])) {
$_GET['type'] = "active";
}
$norender = FALSE;
$noheader = FALSE;
if (!empty($path[0])) {
$controller = $path[0];
if ($_GET['type'] == "active") {
$_GET['type'] = "";
}
}
if (!empty($path[1])) {
$action = $path[1];
if ($_GET['type'] == "active") {
$_GET['type'] = "";
}
}
/* Include Libraries */
include_once(ROOT.DS.'config.php');
include_once(ROOT.DS.'libraries'.DS.'template.class.php');
include_once(ROOT.DS.'libraries'.DS.'helper.class.php');
$template = new Template($controller,$action);
$helper = new Helper();
include_once(ROOT.DS.'libraries'.DS.'shared.php');
include_once(ROOT.DS.'libraries'.DS.'markdown.php');
include_once(ROOT.DS.'libraries'.DS.'timeago.php');
include_once(ROOT.DS.'libraries'.DS.'score.php');
include_once(ROOT.DS.'libraries'.DS.'pagination.class.php');
include_once(ROOT.DS.'controllers'.DS.'helpers.php');
require_once(ROOT.DS.'libraries'.DS.'recaptchalib.php');
/* Debug Mode */
error_reporting(E_ALL);
ini_set('display_errors','On');
/* Basic Bootstrapping */
if(file_exists(ROOT.DS.'install.php')){
header("Location: install.php");
}
if(!file_exists(ROOT.DS.'controllers'.DS.$controller.'.php')) {
$controller = "error"; // error controller name
$action = "index"; // default error controller action
}
include ROOT.DS.'controllers'.DS.$controller.'.php';
if (function_exists($action)) {
call_user_func($action);
} else {
call_user_func('index');
}
if ($norender == FALSE) {
$template->render($noheader);
}