-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.php
More file actions
135 lines (129 loc) · 5.61 KB
/
data.php
File metadata and controls
135 lines (129 loc) · 5.61 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
/**
* Process all DATA
*
* Diese Datenklasse verarbeitet alle Daten an einem zentralen Punkt und verteilt sie an die entsprechenden Klassen zur durchführung.
*
* @author Piere Woehl <woehlpiere@googlemail.com>
*/
include_once './includes/classes/classes.php';
checkLogin();
if (isset($_GET['type'])) {
$type = $_GET['type'];
$action = $_GET['action'];
$item = $_GET['item'];
switch ($type) {
case "question":
switch ($action) {
case "delete":
deleteQuestion($item);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=survey-control">';
break;
}
break;
case "user":
switch ($action) {
case "delete":
deleteUser($item);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=user-control">';
break;
case "activate":
activateUser($item);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=user-control">';
break;
case "deactivate":
deactivateUser($item);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=user-control">';
break;
}
break;
case "group":
switch ($action) {
case "delete":
deleteGroup($item);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=group-control">';
break;
}
break;
case "results":
switch ($action) {
case "reset":
resetResults();
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=results">';
break;
}
break;
}
}
if (isset($_POST['type'])) {
$type = $_POST['type'];
$action = $_POST['action'];
$item = $_GET['item'];
switch ($type) {
case "survey":
switch ($action) {
case "transmit":
$question = getQuestionList();
for ($i = 0; $i < sizeof($question); $i++) {
addResult($question[$i]['idask_question'],getUserID($_SESSION['username']),$_POST[$question[$i]['idask_question']]);
}
if ($_SESSION['role'] == "user") {
queryDB("UPDATE ask_user SET status=0 WHERE username='".$_SESSION['username']."';");
}
echo '<meta http-equiv="refresh" content="1; URL=index.php?view_category=successfull-survey">';
break;
}
break;
case "question":
switch ($action) {
case "new":
addQuestion($_POST['newquestion']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=survey-control&message_type=add&message_reason=successfull-question">';
break;
case "change":
changeQuestion($_POST['item'],$_POST['changequestion']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=survey-control&message_type=change&message_reason=successfull-question">';
break;
}
break;
case "user":
switch ($action) {
case "new":
addUser($_POST['username'],md5($_POST['password']),$_POST['role'],$_POST['group']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=user-control&message_type=add&message_reason=successfull-user">';
break;
case "change":
setUsername($_POST['item'],$_POST['username']);
setPassword($_POST['item'],md5($_POST['password']));
changeGroup($_POST['item'],$_POST['group']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=user-control&message_type=change&message_reason=successfull-user">';
break;
case "generate":
getMultiUserPrintView(autoCreateUser($_POST['amount'],$_POST['group']));
echo '<p><a href="index.php?view_category=user-control">Weiter</a></p>';
break;
}
break;
case "group":
switch ($action) {
case "new":
addGroup($_POST['newgroup']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=group-control&message_type=add&message_reason=successfull-group">';
break;
case "change":
setGroupName($_POST['item'],$_POST['changedgroup']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=group-control&message_type=change&message_reason=successfull-group">';
break;
}
break;
case "system":
switch ($action) {
case "change":
updateSystem('title',$_POST['title']);
updateSystem('systemroot',$_POST['systemroot']);
echo '<meta http-equiv="refresh" content="0; URL=index.php?view_category=system-control">';
break;
}
break;
}
}