-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
102 lines (93 loc) · 2.73 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
98
99
100
<?php
/*
作業上傳系統獨立精簡版 v1
CopyRight(C) 程式設計 Coding axer@tc.edu.tw 20120216-0228
版權宣告:本程式遵從GNUv3規範 http://www.gnu.org/licenses/gpl.html
首頁管理程式
*/
include "includes/init.php";
include "includes/index.class.php";
// Enable Class
$obj = new index_class();
$obj->DB= $DB;
$obj->f = $f;
$obj->SetSession($_SESSION);
//For index only
$view->caching = 0;
$view->compile_check = true;
$view->cache_lifetime = 10800; //3 hours
if( !isset($_SESSION['priv'])) $_SESSION['priv'] = $obj->GetNoLoginPrivArr();
$view->assign('obj', $obj);
$view->assign('f', $f);
switch($f){
case "About":
$currDT =date("Y-m-d");
//if( $currDT <= '2012-02-29')print "YES";
$view->display('About.mtpl');
break;
case "Exhibition":
$view->display('Exhibition.mtpl');
break;
case "HwDetail":
$view->assign('f', "List");
$sn=0;
$_SESSION['currURL']= $_SERVER['REQUEST_URI'];
if( !empty($_GET["c"])){
$sn= $obj->LongDecode($_GET["c"]);
$view->assign('c', $_GET["c"]);
}
if($sn<=0){
$msg="錯誤的作業編號";
$msg .= $obj->JS_CntDn( SITE_URL, 2000);
$view->assign('msg', $msg);
$view->display('Message.mtpl');
break;
}
$url = urlencode(SITE_URL . $_SERVER['REQUEST_URI']);
$view->assign('url', $url);
$view->assign('hID', $sn);
$view->assign('maxsize',ini_get("upload_max_filesize"));
$view->display('HwPage.mtpl');
break;
case "Login":
$view->display('LoginPage.mtpl');
break;
case "TCLogin":
$view->display('TCLoginPage.mtpl');
break;
default:
$view->assign('f', "List");
$view->caching = 0;
if( empty($_POST['c']) && empty($_GET['c'])){
$tbl=array(
"pg"=>1,
"hkw"=> empty($_POST["hkw"])?"": trim(addslashes($_POST["hkw"])),
"s" => empty( $_POST["hs"])?"": $_POST["hs"],
);
}else{
$c =empty($_POST['c'])? $_GET['c']:$_POST['c'];
$tbl= $obj->Decrypt_c2Arr( $c );
if(! isset($tbl['pg']))$tbl['pg']=1;
}
if(! empty($tbl['s'])){ //_kw=1,_date=1,_state=1,state=0
$s= $tbl['s'];
$srr = explode(",",$s);
foreach($srr as $it){
preg_match('/(\w+)=(\w+)/', $it, $match);
$k= $match[1];
$v= $match[2];
$tbl[$k]=$v;
}
}
if(isset($tbl['stp'])) $stp= (int)$tbl['stp'];
else $stp= empty($_POST['stp'])?(empty($_GET['stp'])?0:(int)$_GET['stp']):(int)$_POST['stp'];
$tbl['odr']= empty($_GET['odr'])?(empty($tbl['odr'])?0:$tbl['odr']):(int)$_GET['odr']; //default no orderb
unset($tbl['s']);
$obj->SetCurrParam($tbl);
unset($tbl['stp']); //clear
$c= $obj->Encrypt_Arr2c($tbl);
$view->assign('c', $c);
$view->display('Index.mtpl');
break;
}
?>