This repository was archived by the owner on Mar 30, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
72 lines (68 loc) Β· 1.5 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
<?php
/**
* TaskTimeTerminate Sync-Server
* https://github.com/KIMB-technologies/TaskTimeTerminate
*
* (c) 2020 KIMB-technologies
* https://github.com/KIMB-technologies/
*
* released under the terms of GNU Public License Version 3
* https://www.gnu.org/licenses/gpl-3.0.txt
*/
define( 'TaskTimeTerminate', 'GUI' );
require_once( __DIR__ . '/core/load.php' );
$param = new ParamParser();
$login = new Login();
$gui = new WebGUI($param, $login);
if( $login->isLoggedIn() ){
if($param->isLogoutGet()){
$login->logUserOut();
}
}
else {
if( $param->isLoginPost() ){
$token = $login->userLogin(
$param->loginPost('group'),
$param->loginPost('password'),
!empty($_POST['stayloggedin']) && $_POST['stayloggedin'] === 'yes'
);
if(!is_null($token)){
$gui->showLoginToken($token);
}
}
else if( $param->isSessionPost() ) {
$login->sessionLogin(
$param->loginPost('group'),
$param->loginPost('token')
);
}
}
if( isset($_GET['err']) && in_array($_GET['err'], array(404, 403)) ){
$gui->errorPage($_GET['err']);
}
else{
if( $login->isLoggedIn() ){
switch ($param->getTask()) {
case ParamParser::TASK_ACCOUNT:
$gui->accountManage();
break;
case ParamParser::TASK_DEVICES:
$gui->deviceManage();
break;
case ParamParser::TASK_RECORD:
$gui->addTaskRecord();
break;
case ParamParser::TASK_STATS:
$gui->showStats();
break;
case ParamParser::TASK_HOME:
case ParamParser::TASK_NONE:
default:
$gui->home();
}
}
else{
$gui->loginForm();
}
}
?>