-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig_action.php
More file actions
175 lines (165 loc) · 9.26 KB
/
config_action.php
File metadata and controls
175 lines (165 loc) · 9.26 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<?php
// $Header: /cvsroot/tsheet/timesheet.php/config_action.php,v 1.6 2005/02/03 08:06:10 vexil Exp $
// Authenticate
require("class.AuthenticationManager.php");
require("class.CommandMenu.php");
//require("debuglog.php");
if (!$authenticationManager->isLoggedIn() || !$authenticationManager->hasClearance(CLEARANCE_ADMINISTRATOR)) {
Header('Location: login.php?clearanceRequired=Administrator');
exit;
}
// Connect to database.
$dbh = dbConnect();
//load local vars from request/post/get
$action = $_REQUEST["action"];
$headerhtml = isset($_REQUEST["headerhtml"]) ? $_REQUEST["headerhtml"]: "";
$bodyhtml = isset($_REQUEST["bodyhtml"]) ? $_REQUEST["bodyhtml"]: "";
$footerhtml = isset($_REQUEST["footerhtml"]) ? $_REQUEST["footerhtml"]: "";
$errorhtml = isset($_REQUEST["errorhtml"]) ? $_REQUEST["errorhtml"]: "";
$bannerhtml = isset($_REQUEST["bannerhtml"]) ? $_REQUEST["bannerhtml"]: "";
$tablehtml = isset($_REQUEST["tablehtml"]) ? $_REQUEST["tablehtml"]: "";
$locale = isset($_REQUEST["locale"]) ? $_REQUEST["locale"]: "";
$timezone = isset($_REQUEST["timezone"]) ? $_REQUEST["timezone"]: "";
$timeformat= isset($_REQUEST["timeformat"]) ? $_REQUEST["timeformat"]: "";
$projectItemsPerPage = isset($_REQUEST["projectItemsPerPage"]) ? $_REQUEST["projectItemsPerPage"]: "";
$taskItemsPerPage = isset($_REQUEST["taskItemsPerPage"]) ? $_REQUEST["taskItemsPerPage"]: "";
$headerReset = isset($_REQUEST["headerReset"]) ? $_REQUEST["headerReset"]: false;
$bodyReset = isset($_REQUEST["bodyReset"]) ? $_REQUEST["bodyReset"]: false;
$footerReset = isset($_REQUEST["footerReset"]) ? $_REQUEST["footerReset"]: false;
$errorReset = isset($_REQUEST["errorReset"]) ? $_REQUEST["errorReset"]: false;
$bannerReset = isset($_REQUEST["bannerReset"]) ? $_REQUEST["bannerReset"]: false;
$tableReset = isset($_REQUEST["tableReset"]) ? $_REQUEST["tableReset"]: false;
$localeReset = isset($_REQUEST["localeReset"]) ? $_REQUEST["localeReset"]: false;
$aclReset = isset($_REQUEST["aclReset"]) ? $_REQUEST["aclReset"]: false;
$timezoneReset = isset($_REQUEST["timezoneReset"]) ? $_REQUEST["timezoneReset"]: false;
$timeformatReset = isset($_REQUEST["timeformatReset"]) ? $_REQUEST["timeformatReset"]: false;
$projectItemsPerPageReset = isset($_REQUEST["projectItemsPerPageReset"]) ? $_REQUEST["projectItemsPerPageReset"]: false;
$taskItemsPerPageReset = isset($_REQUEST["taskItemsPerPageReset"]) ? $_REQUEST["taskItemsPerPageReset"]: false;
$useLDAP = isset($_REQUEST["useLDAP"]) ? $_REQUEST["useLDAP"]: false;
$LDAPFallback = isset( $_REQUEST["LDAPFallback"] ) ? $_REQUEST["LDAPFallback"]: false;
$LDAPReferrals = isset( $_REQUEST["LDAPReferrals"] ) ? $_REQUEST["LDAPReferrals"]: false;
$LDAPScheme = $_REQUEST["LDAPScheme"];
$LDAPHost = $_REQUEST["LDAPHost"];
$LDAPPort = $_REQUEST["LDAPPort"];
$LDAPBaseDN = $_REQUEST["LDAPBaseDN"];
$LDAPUsernameAttribute = $_REQUEST["LDAPUsernameAttribute"];
$LDAPSearchScope = $_REQUEST["LDAPSearchScope"];
$LDAPFilter = $_REQUEST["LDAPFilter"];
$LDAPProtocolVersion = $_REQUEST["LDAPProtocolVersion"];
$LDAPBindByUser = isset($_REQUEST["LDAPBindByUser"]) ? $_REQUEST["LDAPBindByUser"]: false;
$LDAPBindUsername = $_REQUEST["LDAPBindUsername"];
$LDAPBindPassword = $_REQUEST["LDAPBindPassword"];
$weekstartday = isset($_REQUEST["weekstartday"]) ? $_REQUEST["weekstartday"]: 0;
$weekStartDayReset = isset($_REQUEST["weekStartDayReset"]) ? $_REQUEST["weekStartDayReset"]: false;
$aclStopwatch = $_REQUEST["aclStopwatch"];
$aclDaily = $_REQUEST["aclDaily"];
$aclWeekly = $_REQUEST["aclWeekly"];
$aclMonthly = $_REQUEST["aclMonthly"];
$aclSimple = $_REQUEST["aclSimple"];
$aclClients = $_REQUEST["aclClients"];
$aclProjects = $_REQUEST["aclProjects"];
$aclTasks = $_REQUEST["aclTasks"];
$aclReports = $_REQUEST["aclReports"];
$aclRates = $_REQUEST["aclRates"];
$aclAbsences = $_REQUEST["aclAbsences"];
$simpleTimesheetLayout = $_REQUEST["simpleTimesheetLayout"];
$startPage = $_REQUEST["startPage"];
//$debug->write("startPage is $startPage\n");
if (!isset($action)) {
Header("Location: $HTTP_REFERER");
}
elseif ($action == "edit") {
$headerhtml = mysqli_real_escape_string($dbh, trim($headerhtml));
$bodyhtml = mysqli_real_escape_string($dbh, trim($bodyhtml));
$footerhtml = mysqli_real_escape_string($dbh, trim($footerhtml));
$errorhtml = mysqli_real_escape_string($dbh, trim($errorhtml));
$bannerhtml = mysqli_real_escape_string($dbh, trim($bannerhtml));
$tablehtml = mysqli_real_escape_string($dbh, trim($tablehtml));
$locale = mysqli_real_escape_string($dbh, trim($locale));
$timezone = mysqli_real_escape_string($dbh, trim($timezone));
$projectItemsPerPage = mysqli_real_escape_string($dbh, trim($projectItemsPerPage));
$taskItemsPerPage = mysqli_real_escape_string($dbh, trim($taskItemsPerPage));
// now change values in new configuration table
$tsx_config->set("headerhtml", $headerhtml);
$tsx_config->set("bodyhtml", $bodyhtml);
$tsx_config->set("footerhtml", $footerhtml);
$tsx_config->set("errorhtml", $errorhtml);
$tsx_config->set("bannerhtml", $bannerhtml);
$tsx_config->set("tablehtml", $tablehtml);
$tsx_config->set("locale", $locale);
$tsx_config->set("timezone", $timezone);
$tsx_config->set("timeformat", $timeformat);
$tsx_config->set("weekstartday", $weekstartday);
$tsx_config->set("project_items_per_page", $projectItemsPerPage);
$tsx_config->set("task_items_per_page", $taskItemsPerPage);
$tsx_config->set("useLDAP", $useLDAP);
$tsx_config->set("LDAPScheme", $LDAPScheme);
$tsx_config->set("LDAPHost", $LDAPHost);
$tsx_config->set("LDAPPort", $LDAPPort);
$tsx_config->set("LDAPBaseDN", $LDAPBaseDN);
$tsx_config->set("LDAPUsernameAttribute", $LDAPUsernameAttribute);
$tsx_config->set("LDAPSearchScope", $LDAPSearchScope);
$tsx_config->set("LDAPFilter", $LDAPFilter);
$tsx_config->set("LDAPProtocolVersion", $LDAPProtocolVersion);
$tsx_config->set("LDAPBindUsername", $LDAPBindUsername);
$tsx_config->set("LDAPBindPassword", $LDAPBindPassword);
$tsx_config->set("LDAPBindByUser", $LDAPBindByUser);
$tsx_config->set("LDAPReferrals", $LDAPReferrals);
$tsx_config->set("LDAPFallback", $LDAPFallback);
$tsx_config->set("aclStopwatch", $aclStopwatch);
$tsx_config->set("aclDaily", $aclDaily);
$tsx_config->set("aclWeekly", $aclWeekly);
$tsx_config->set("aclMonthly", $aclMonthly);
$tsx_config->set("aclSimple", $aclSimple);
$tsx_config->set("aclClients", $aclClients);
$tsx_config->set("aclProjects", $aclProjects);
$tsx_config->set("aclTasks", $aclTasks);
$tsx_config->set("aclReports", $aclReports);
$tsx_config->set("aclRates", $aclRates);
$tsx_config->set("aclAbsences", $aclAbsences);
$tsx_config->set("SimpleTimesheetLayout", $simpleTimesheetLayout);
$tsx_config->set("startPage", $startPage);
//$debug->write("$query\n");
if ($headerReset == true)
$tsx_config->set("headerhtml", '<meta name="description" content="Timesheet Next Gen">\r\n<link href="css/timesheet.css" rel="stylesheet" type="text/css">\r\n<link rel="shortcut icon" href="images/favicon.ico">');
if ($bodyReset == true)
$tsx_config->set("bodyhtml", 'link=\"#004E8A\" vlink=\"#171A42\"');
if ($footerReset == true)
$tsx_config->set("footerhtml", '<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\r\n<tr><td style=\"background-color: #000788; padding: 3;\" class=\"bottom_bar_text\" align=\"center\">\r\nTimesheetNextGen\r\n<br /><span style=\"font-size: 9px;\"><b>Page generated %time% %date% (%timezone% time)</b></span>\r\n</td></tr></table>');
if ($errorReset == true)
$tsx_config->set("errorhtml", '<table border=0 cellpadding=5 width=\"100%\">\r\n<tr>\r\n <td><font size=\"+2\" color=\"red\">%errormsg%</font></td>\r\n</tr></table>\r\n<p>Please go <a href=\"javascript:history.back()\">Back</a> and try again.</p>');
if ($bannerReset == true)
$tsx_config->set("bannerhtml", '<table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\"><tr>\r\n<td colspan=\"2\" ><img src=\"images/timesheet_banner.gif\" alt=\"Timesheet Banner\" /></td>\r\n</tr><tr>\r\n<td style=\"background-color: #F2F3FF; padding: 3;\">%commandmenu%</td>\r\n<td style=\"background-color: #F2F3FF; padding: 3;\" align=\"right\" width=\"145\" valign=\"top\">You are logged in as %username%</td>\r\n</tr><tr>\r\n<td colspan=\"2\" height=\"1\" style=\"background-color: #758DD6;\"><img src=\"images/spacer.gif\" alt=\"\" width=\"1\" height=\"1\" /></td>\r\n</tr></table>');
if ($tableReset == true)
$tsx_config->set("tablehtml", '');
if ($localeReset == true)
$tsx_config->set("locale", 'C');
if ($timezoneReset == true)
$tsx_config->set("timezone", 'Europe/Zurich');
if ($timeformatReset == true)
$tsx_config->set("timeformat", '12');
if ($weekStartDayReset == true)
$tsx_config->set("weekstartday", '1');
if ($projectItemsPerPageReset == true)
$tsx_config->set("project_items_per_page", '10');
if ($taskItemsPerPageReset == true)
$tsx_config->set("task_items_per_page", '10');
if ($aclReset == true)
{
$tsx_config->set("aclStopwatch", 'Basic');
$tsx_config->set("aclDaily", 'Basic');
$tsx_config->set("aclWeekly", 'Basic');
$tsx_config->set("aclMonthly", 'Basic');
$tsx_config->set("aclSimple", 'Basic');
$tsx_config->set("aclClients", 'Basic');
$tsx_config->set("aclProjects", 'Basic');
$tsx_config->set("aclTasks", 'Basic');
$tsx_config->set("aclReports", 'Basic');
$tsx_config->set("aclRates", 'Basic');
$tsx_config->set("aclAbsences", 'Basic');
}
}
//return to the config.php page
Header("Location: config.php");
// vim:ai:ts=4:sw=4
?>