-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontroller.php
117 lines (86 loc) · 2.28 KB
/
controller.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
/** Emupholio Bootstrap File
* controller.php
* version 0.9
* last change: 23.04.2012
*
*
*
**
* (C) 2012, Straussn
* straussn.eu
*/
require_once("./src/settings.php");
function __autoload($class) {
include "./src/".strtolower($class).".class.php";
}
if(!isset($_SESSION)) {
session_start();
}
header("Content-type: text/javascript; charset=UTF-8");
if (isset($_SESSION["user"])) {
switch ($_GET["action"]) {
case "getList":
$image = new Image($emupholioSettings);
echo json_encode($image->getList());
break;
case "crop":
$image = new Image($emupholioSettings);
echo $image->crop($_GET["name"], $_GET["x"], $_GET["y"], $_GET["w"], $_GET["h"], $_GET["targ_w"], $_GET["targ_h"]);
break;
case "upload":
$upload = new Upload($emupholioSettings);
header("Content-type: text/html; charset= UTF-8");
echo $upload->start($_FILES["uploads"]);
break;
case "delete":
$upload = new Upload($emupholioSettings);
echo $upload->delete($_GET["file"]);
break;
case "userCheck":
$user = new User($emupholioSettings);
echo json_encode($user->check());
break;
case "logout";
$user = new User($emupholioSettings);
echo json_encode($user->logout());
break;
case "admin":
header("location: backend.html");
break;
case "readExif":
$image = new Image($emupholioSettings);
echo json_encode($image->readExif($_GET["file"]));
break;
default:
header("location: index.html");
break;
}
} else {
switch($_GET["action"]) {
case "getList":
$image = new Image($emupholioSettings);
echo json_encode($image->getList());
break;
case "readExif":
$image = new Image($emupholioSettings);
echo json_encode($image->readExif($_GET["file"]));
break;
case "userCheck":
$user = new User($emupholioSettings);
echo json_encode($user->check());
break;
case "login":
$user = new User($emupholioSettings);
$user->login($_POST["user"], $_POST["pass"]);
header("location: backend.html");
break;
case "admin":
header("location: backend.html");
break;
default:
header("location: index.html");
break;
}
}
?>