aboutsummaryrefslogtreecommitdiffstats
path: root/preferences.php
blob: 83363cd98d1a04e941146ae917aaba379e931af3 (plain) (blame)
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
<?php
$cookie_uri = $HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/'));
define('BASE','./');
$current_view = "preferences";
$default_view = "$default_view" . ".php";
if ($allow_preferences == 'no') header("Location: $default_view");
$action = $HTTP_GET_VARS['action'];
$startdays = array ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');

if ($action == 'setcookie') { 
	$cookie_language 	= $HTTP_POST_VARS['cookie_language'];
	$cookie_calendar 	= $HTTP_POST_VARS['cookie_calendar'];
	$cookie_view 		= $HTTP_POST_VARS['cookie_view'];
	$cookie_style 		= $HTTP_POST_VARS['cookie_style'];
	$cookie_startday	= $HTTP_POST_VARS['cookie_startday'];
	$cookie_time	= $HTTP_POST_VARS['cookie_time'];
	$the_cookie = array ("cookie_language" => "$cookie_language", "cookie_calendar" => "$cookie_calendar", "cookie_view" => "$cookie_view", "cookie_startday" => "$cookie_startday", "cookie_style" => "$cookie_style", "cookie_time" => "$cookie_time");
	$the_cookie 		= serialize($the_cookie);
	setcookie("phpicalendar","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0);
	#unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday);
}

if ($HTTP_COOKIE_VARS['phpicalendar']) {
	$phpicalendar 		= unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar']));
	$cookie_language 	= $phpicalendar['cookie_language'];
	$cookie_calendar 	= $phpicalendar['cookie_calendar'];
	$cookie_view 		= $phpicalendar['cookie_view'];
	$cookie_style 		= $phpicalendar['cookie_style'];
	$cookie_startday	= $phpicalendar['cookie_startday'];
	$cookie_time		= $phpicalendar['cookie_time'];
}
#echo "$cookie_uri";
#print_r(unserialize($HTTP_COOKIE_VARS['phpicalendar']));
#print_r($phpicalendar);
include(BASE.'functions/ical_parser.php');
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
<html>
<head>
	<meta http-equiv="content-type" content="text/html;charset=UTF-8">
	<title><?php echo "$cal $calendar_lang - $preferences_lang"; ?></title>
  	<link rel="stylesheet" type="text/css" href="<?php echo BASE."styles/$style_sheet/default.css"; ?>">
</head>
<body bgcolor="#FFFFFF">
<?php include (BASE.'header.inc.php'); ?>
<center>
<table border="0" width="700" cellspacing="0" cellpadding="0">
	<tr>
		<td width="520" valign="top" align="center">
			<table width="640" border="0" cellspacing="0" cellpadding="0" class="calborder">
				<tr>
					<td align="center" valign="middle">
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr>
								<td align="left" width="90" class="navback"><?php echo '<a href="'.$back_page.'"><img src="'.BASE.'/styles/'.$style_sheet.'/back.gif" alt="" border="0" align="left"></a>'; ?></td>
								<td class="navback">
									<table width="100%" border="0" cellspacing="0" cellpadding="0">
										<tr>
											<td align="center" class="navback" nowrap valign="middle"><font class="H20"><?php echo "$preferences_lang"; ?></font></td>
										</tr>
									</table>
								</td>
								<td align="right" width="90" class="navback">	
									<table width="90" border="0" cellpadding="0" cellspacing="0">
										<tr>
											<td><?php echo '<a class="psf" href="day.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'/styles/'.$style_sheet.'/day_on.gif" alt="" border="0"></td>'; ?>
											<td><?php echo '<a class="psf" href="week.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'/styles/'.$style_sheet.'/week_on.gif" alt="" border="0"></td>'; ?>
											<td><?php echo '<a class="psf" href="month.php?cal='.$cal.'&getdate='.$getdate.'"><img src="'.BASE.'/styles/'.$style_sheet.'/month_on.gif" alt="" border="0"></td>'; ?>
										</tr>
									</table>
								</td>
							</tr>
			      		</table>
					</td>
				</tr>
				<tr>
					<td class="dayborder"><img src="images/spacer.gif" width="1" height="5"></td>
				</tr>
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B">	
							<?php
							
							if ($action == 'setcookie') { ?>
							<tr>
								<td colspan="2" align="center"><font class="G10BOLD">Your preferences have been set.</font></td>
							</tr>
							<?php } ?>
							
							<tr>
								<td width="2%"></td>
								<td width="98%" valign="top" align="left">
								<form action="preferences.php?action=setcookie" METHOD="post">
								<?php 
								
								
								
								
								// Begin Language Selection
								//
								echo 'Select your default language:<br><br>';
								print "<select name=\"cookie_language\" class=\"query_style\">\n";
								$dir_handle = @opendir(BASE.'languages/');
								$tmp_pref_language = urlencode(ucfirst($language));
								while ($file = readdir($dir_handle)) {
									if (substr($file, -8) == ".inc.php") {
										$language_tmp = urlencode(ucfirst(substr($file, 0, -8)));
										if ($language_tmp == $cookie_language) {
											print "<option value=\"$language_tmp\" selected>in $language_tmp</option>\n";
										} else {
											print "<option value=\"$language_tmp\">in $language_tmp</option>\n";
										}
									}
								}
								closedir($dir_handle);
								print "</select>\n";
								echo '<br><br>';
								
								// Begin Calendar Selection
								//
								echo 'Select your default calendar:<br><br>';
								print "<select name=\"cookie_calendar\" class=\"query_style\">\n";
								$dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
								while ($file = readdir($dir_handle)) {
									if (substr($file, -4) == ".ics") {
										$cal_filename_tmp = substr($file,0,-4);
										$cal_tmp = urlencode($cal_filename_tmp);
										$cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp);
										if (!in_array($cal_filename_tmp, $blacklisted_cals)) {
											if ($cal_tmp == $cookie_calendar) {
												print "<option value=\"$cal_tmp\" selected>$cal_displayname_tmp $calendar_lang</option>\n";
											} else {
												print "<option value=\"$cal_tmp\">$cal_displayname_tmp $calendar_lang</option>\n";	
											}		
										}	
									}
								}			
								foreach($list_webcals as $cal_tmp) {
									if ($cal_tmp != '') {
										$cal_displayname_tmp = basename($cal_tmp);
										$cal_displayname_tmp = str_replace("32", " ", $cal_displayname_tmp);
										$cal_displayname_tmp = substr($cal_displayname_tmp,0,-4);
										$cal_encoded_tmp = urlencode($cal_tmp);
										if ($cal_tmp == $cal_httpPrefix || $cal_tmp == $cal_webcalPrefix) {
											print "<option value=\"$cal_encoded_tmp\" selected>$cal_displayname_tmp Webcal</option>\n";
										} else {
											print "<option value=\"$cal_encoded_tmp\">$cal_displayname_tmp Webcal</option>\n";	
										}		
									}
								}
								closedir($dir_handle);
								print "</select>\n";
								echo '<br><br>';
								
								// Begin View Selection
								//
								echo 'Select your default view:<br><br>';
								print "<select name=\"cookie_view\" class=\"query_style\">\n";
								print "<option value=\"day\">$day_lang</option>\n";
								print "<option value=\"week\">$week_lang</option>\n";
								print "<option value=\"month\">$month_lang</option>\n";
								print "<option value=\"print\">$printer_lang</option>\n";
								print "</select>\n";
								echo '<br><br>';
								
								// Begin Time Selection
								//
								echo 'Select your default start time:<br><br>';
								print "<select name=\"cookie_time\" class=\"query_style\">\n";
								print "<option value=\"0500\">0500</option>\n";
								print "<option value=\"0600\">0600</option>\n";
								print "<option value=\"0700\">0700</option>\n";
								print "<option value=\"0800\">0800</option>\n";
								print "<option value=\"0900\">0900</option>\n";
								print "</select>\n";
								echo '<br><br>';
								
								// Begin Day Start Selection
								//
								echo 'Select your start day of week:<br><br>';
								print "<select name=\"cookie_startday\" class=\"query_style\">\n";
								$i=0;
								foreach ($daysofweek_lang as $daysofweek) {
									if ($startdays[$i] == "$cookie_startday") {
										print "<option value=\"$startdays[$i]\" selected>$daysofweek</option>\n";
									} else {
										print "<option value=\"$startdays[$i]\">$daysofweek</option>\n";
									}
									$i++;
								}
								print "</select>\n";
								echo '<br><br>';
								
								// Begin Style Selection
								//
								echo 'Select your default style:<br><br>';
								print "<select name=\"cookie_style\" class=\"query_style\">\n";
								$dir_handle = @opendir(BASE.'styles/');
								while ($file = readdir($dir_handle)) {
									if (($file != ".") && ($file != "..") && ($file != "CVS")) {
										if (!is_file($file)) {
											$file = ucfirst($file);
											if ($file == "$cookie_style") {
												print "<option value=\"$file\" selected>$file</option>\n";
											} else {
												print "<option value=\"$file\">$file</option>\n";
											}
										}
									}
								}
								closedir($dir_handle);
								print "</select>\n";
								echo '<br><br>';
								#echo '<hidden name="action" value="setcookie"><br>';
								echo '<button type="submit" name="set" value="true" class=\"query_style\">Set Cookie</button>';
								echo '</form><br>'; 
								 ?>
								</td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
<?php include (BASE.'footer.inc.php'); ?>
</center>
</body>
</html>

© 2014-2024 Faster IT GmbH | imprint | privacy policy