-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
97 lines (93 loc) · 2.43 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
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html lang="en">
<script type="text/javascript">
function checkMobileApp(){
var a=document.getElementsByTagName("a");
for(var i=0;i<a.length;i++)
{
if(a[i].id != "back" ) {
a[i].onclick=function()
{
window.location=this.getAttribute("href");
return false;
}
}
}
}
</script>
<?php
require_once ('conf/define.php');
require_once ('helper/auto_include.php');
$site = new Site();
if(!$site->isSetSession()) {
$site->setlanguage("en");
$site->setSession();
} else {
$site = $site->getSession();
}
// check language to show
SessionHandlers::checkSession ();
$_SESSION ["locale"] = $site->getlanguage();
if ($_SESSION ["locale"] == "kh") {
echo "<style> * { font-family: 'Khmer OS System','Khmer OS','Khmer OS Muol','Khmer OS Battambang'; !important }</style>";
}
$user1 = new User();
if ($user1->isLogin ()) {
$log_user = Tool::getLoginUser();
if (!$site->isExist($log_user)) {
$site->setrefUser($log_user->getId());
$site->insertDatabase($log_user);
} else {
$site->setrefUser($log_user->getId());
$site->setSessionByUser();
}
// HTML HEAD
require_once 'public/masterPages/head.php';
// BODY
$frame = false;
$clearMargin = "style='margin: 0px; padding: 0px;'";
if(!isset($_GET[VIEW]) || $_GET[VIEW] != FRAME) {
$frame = true;
$clearMargin ='';
}
echo '<body class="tooltips" '.$clearMargin.' onload="checkMobileApp()">';
// ===================
// MAIN
// ===================
if($frame) {
require_once 'public/masterPages/main.php';
}
if (isset ( $_GET ["menu"] )) {
switch ($_GET ["menu"]) {
case PAGE_USER_REGISTER :
require_once ('public/register.php');
break;
case PAGE_FOOD :
require_once 'public/pages/Food/pageManageFood.php';
break;
case PAGE_MANAGE_USER :
Tool::isLoginUserTypeAdmin($log_user);
require_once 'public/pages/User/pageManageUser.php';
break;
case PAGE_SITE_CONFIGURE :
Tool::isLoginUserTypeAdmin($log_user);
require_once 'public/site/configureSite.php';
break;
default :
require_once ('public/masterPages/dashboard.php');
}
} else {
require_once ('public/masterPages/dashboard.php');
}
if($frame) {
require_once 'public/masterPages/footer.php';
}// SCRIPT
require_once 'public/masterPages/script.php';
// END BODY
echo '</body>';
} else {
require_once ('public/login.php');
}
exit ();
?>
</html>