-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
87 lines (73 loc) · 1.86 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
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
/*
create by weiganyi on 20131128
*/
define('ROOTPATH', dirname(__FILE__).'/');
//include model file
require_once(ROOTPATH . "model/tb_db.php");
$g_db = new tb_db();
//include control file
require_once(ROOTPATH . "control/tb_lang.php");
$g_lang = get_language();
require_once(ROOTPATH . "lang/$g_lang.php");
require_once(ROOTPATH . "control/tb_login.php");
$g_login = new tb_login();
require_once(ROOTPATH . "control/tb_cache.php");
$g_cache = new tb_cache();
require_once(ROOTPATH . "control/tb_function.php");
//session init
$g_login->login_init();
//do login, register, logout
$g_login->login_main();
//display page
if ($g_login->is_jump_to_login() == true)
{
require_once(ROOTPATH . "login.php");
}
elseif ($g_login->is_jump_to_register() == true)
{
require_once(ROOTPATH . "register.php");
}
elseif (is_ajax() == true)
{
$page = get_page();
if (!empty($page))
{
require_once(ROOTPATH . "$page.php");
}
}
elseif (has_page("image") == true)
{
require_once(ROOTPATH . "image.php");
}
else
{
//because the setcookie need be done before any html output, so do it in here
do_post_read_action();
$page = get_page();
if (!empty($page))
{
$page_file = $page . ".php";
if (!file_exists($page_file))
{
require_once(ROOTPATH . "404.php");
}
else
{
require_once(ROOTPATH . "head.php");
require_once(ROOTPATH . "menu.php");
require_once(ROOTPATH . "sidebar.php");
require_once(ROOTPATH . "$page.php");
require_once(ROOTPATH . "foot.php");
}
}
else
{
require_once(ROOTPATH . "head.php");
require_once(ROOTPATH . "menu.php");
require_once(ROOTPATH . "sidebar.php");
require_once(ROOTPATH . "post_list.php");
require_once(ROOTPATH . "foot.php");
}
}
?>