aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Hu <jimhu@users.sourceforge.net>2005-11-27 07:56:31 +0000
committerJim Hu <jimhu@users.sourceforge.net>2005-11-27 07:56:31 +0000
commit6b786f6023ec8ff6e8ece7b352d0fa95b7946e02 (patch)
treee74866aa5ca8d090b2c8922fb301d3829d0407fc
parent561a87eeef31ad4927e20aec1be00d7a58ecf08b (diff)
downloadphpicalendar-6b786f6023ec8ff6e8ece7b352d0fa95b7946e02.tar.gz
phpicalendar-6b786f6023ec8ff6e8ece7b352d0fa95b7946e02.tar.bz2
phpicalendar-6b786f6023ec8ff6e8ece7b352d0fa95b7946e02.zip
patches to fix several files to work better with cookies. Changes in preferences.php, preferencees.tpl, init.inc.php
-rw-r--r--functions/init.inc.php24
-rw-r--r--preferences.php12
-rw-r--r--templates/default/preferences.tpl3
3 files changed, 27 insertions, 12 deletions
diff --git a/functions/init.inc.php b/functions/init.inc.php
index d7d0dc4..60a6633 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -15,23 +15,31 @@ $ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
if (!defined('BASE')) define('BASE', './');
include_once(BASE.'config.inc.php');
include_once(BASE.'error.php');
-if($_REQUEST['cpath']){
- $cpath = $_REQUEST['cpath'];
- $calendar_path .= "/$cpath";
- $tmp_dir .= "/$cpath";
-}
-include_once(BASE.'functions/calendar_functions.php');
-include_once(BASE.'functions/userauth_functions.php');
if (isset($_COOKIE['phpicalendar'])) {
$phpicalendar = unserialize(stripslashes($_COOKIE['phpicalendar']));
if (isset($phpicalendar['cookie_language'])) $language = $phpicalendar['cookie_language'];
if (isset($phpicalendar['cookie_calendar'])) $default_cal_check = $phpicalendar['cookie_calendar'];
+ if (isset($phpicalendar['cookie_cpath'])) $default_cpath_check = $phpicalendar['cookie_cpath'];
if (isset($phpicalendar['cookie_view'])) $default_view = $phpicalendar['cookie_view'];
- if (isset($phpicalendar['cookie_style'])) $style_sheet = $phpicalendar['cookie_style'];
+ if (isset($phpicalendar['cookie_style'])) $template = $phpicalendar['cookie_style'];
if (isset($phpicalendar['cookie_startday'])) $week_start_day = $phpicalendar['cookie_startday'];
if (isset($phpicalendar['cookie_time'])) $day_start = $phpicalendar['cookie_time'];
}
+if($_REQUEST['cpath']){
+ $cpath = $_REQUEST['cpath'];
+ $calendar_path .= "/$cpath";
+ $tmp_dir .= "/$cpath";
+}elseif(isset($default_cpath_check)){
+ $cpath = $default_cpath_check;
+ $calendar_path .= "/$cpath";
+ $tmp_dir .= "/$cpath";
+}
+
+#these need cpath to be set
+include_once(BASE.'functions/calendar_functions.php');
+include_once(BASE.'functions/userauth_functions.php');
+
// Set the cookie URI.
if ($cookie_uri == '') {
diff --git a/preferences.php b/preferences.php
index c865e76..f3ec74d 100644
--- a/preferences.php
+++ b/preferences.php
@@ -25,16 +25,18 @@ if (isset($_GET['action'])) {
}
$startdays = array ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
+$cpath = $_REQUEST['cpath'];
if ($action == 'setcookie') {
$cookie_language = $_POST['cookie_language'];
+ $cookie_cpath = $_POST['cpath'];
$cookie_calendar = $_POST['cookie_calendar'];
$cookie_view = $_POST['cookie_view'];
$cookie_style = $_POST['cookie_style'];
$cookie_startday = $_POST['cookie_startday'];
$cookie_time = $_POST['cookie_time'];
$cookie_unset = $_POST['unset'];
- $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 = 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", "cookie_cpath"=>"$cookie_cpath");
$the_cookie = serialize($the_cookie);
if ($cookie_unset) {
setcookie("phpicalendar","$the_cookie",time()-(60*60*24*7) ,"/","$cookie_uri",0);
@@ -42,6 +44,8 @@ if ($action == 'setcookie') {
setcookie("phpicalendar","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0);
}
$_COOKIE['phpicalendar'] = $the_cookie;
+ $cpath = $cookie_cpath;
+ $cal = $cookie_calendar;
}
if (isset($_COOKIE['phpicalendar'])) {
@@ -62,7 +66,7 @@ if ((!isset($_COOKIE['phpicalendar'])) || ($cookie_unset)) {
$cookie_language = ucfirst($language);
$cookie_calendar = $default_cal;
$cookie_view = $default_view;
- $cookie_style = $style_sheet;
+ $cookie_style = $template;
$cookie_startday = $week_start_day;
$cookie_time = $day_start;
}
@@ -93,7 +97,8 @@ while ($file = readdir($dir_handle)) {
closedir($dir_handle);
// select for calendars
-$calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED));
+$calendar_select = display_ical_list(availableCalendars($username, $password, $ALL_CALENDARS_COMBINED),TRUE);
+$calendar_select .="<option value=\"$ALL_CALENDARS_COMBINED\">$all_cal_comb_lang</option>";
// select for dayview
$view_select = ($cookie_view == 'day') ? '<option value="day" selected="selected">{L_DAY}</option>' : '<option value="day">{L_DAY}</option>';
@@ -146,6 +151,7 @@ $page->replace_tags(array(
'charset' => $charset,
'template' => $template,
'default_path' => '',
+ 'cpath' => $cpath,
'cal' => $cal,
'getdate' => $getdate,
'calendar_name' => $calendar_name,
diff --git a/templates/default/preferences.tpl b/templates/default/preferences.tpl
index 769ef27..3c154df 100644
--- a/templates/default/preferences.tpl
+++ b/templates/default/preferences.tpl
@@ -45,7 +45,8 @@
<tr align="left" valign="top">
<td nowrap="nowrap">{L_SELECT_CAL}:</td>
<td><img src="images/spacer.gif" alt=" " width="20" height="1" border="0" /></td>
- <td><select name="cookie_calendar" class="query_style">{CALENDAR_SELECT}</select></td>
+ <td><select name="cookie_calendar" class="query_style">{CALENDAR_SELECT}</select>
+ <input type="hidden" name="cpath" value="{CPATH}"></td>
</tr>
<tr align="left" valign="top">
<td nowrap="nowrap">{L_SELECT_VIEW}:</td>

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