diff options
author | Chad Little <clittle@users.sourceforge.net> | 2003-02-13 07:22:18 +0000 |
---|---|---|
committer | Chad Little <clittle@users.sourceforge.net> | 2003-02-13 07:22:18 +0000 |
commit | 498d423eee0cb2ae7664a46bfa198aee1a17e996 (patch) | |
tree | 3a2de4dacf67a3e1684b0f7d735f001e68b7e859 | |
parent | 1abdce2be8b964f28768e663e84359eb321a369c (diff) | |
download | phpicalendar-498d423eee0cb2ae7664a46bfa198aee1a17e996.tar.gz phpicalendar-498d423eee0cb2ae7664a46bfa198aee1a17e996.tar.bz2 phpicalendar-498d423eee0cb2ae7664a46bfa198aee1a17e996.zip |
Basic unset prefs support. Ready for testing.
-rw-r--r-- | config.inc.php | 2 | ||||
-rw-r--r-- | languages/english.inc.php | 2 | ||||
-rw-r--r-- | preferences.php | 34 |
3 files changed, 29 insertions, 9 deletions
diff --git a/config.inc.php b/config.inc.php index fece6b7..d5e93c5 100644 --- a/config.inc.php +++ b/config.inc.php @@ -37,7 +37,7 @@ $enable_rss = 'yes'; // Enable RSS access to your calendars (good thing). $show_search = 'yes'; // Show the search box in the sidebar. $header_always = 'no'; // Set to yes to have header on print.php $allow_preferences = 'yes'; // Allow visitors to change various preferences via cookies. -$printview_default = 'yes'; // Set print view as the default view. day, week, and month only supported views for $default_view (listed well above). +$printview_default = 'no'; // Set print view as the default view. day, week, and month only supported views for $default_view (listed well above). $show_todos = 'yes'; // Show your todo list on the side of day and week view. $show_completed = 'yes'; // Show completed todos on your todo list. diff --git a/languages/english.inc.php b/languages/english.inc.php index 90b35f3..677b550 100644 --- a/languages/english.inc.php +++ b/languages/english.inc.php @@ -88,6 +88,8 @@ $unfinished_lang = 'Unfinished'; // ----- New for 0.9.1 $prefs_set_lang = 'Your preferences have been set.'; +$prefs_unset_lang = 'Preferences unset. Changes will take place next page load.'; +$unset_prefs_lang = 'Unset preferences:'; // - navigation $back_lang = 'Back'; diff --git a/preferences.php b/preferences.php index d5ad006..ffd1e0b 100644 --- a/preferences.php +++ b/preferences.php @@ -13,12 +13,16 @@ if ($action == 'setcookie') { $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']; + $cookie_time = $HTTP_POST_VARS['cookie_time']; + $cookie_unset = $HTTP_POST_VARS['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 = serialize($the_cookie); - setcookie("phpicalendar","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0); + if ($cookie_unset) { + setcookie("phpicalendar","$the_cookie",time()-(60*60*24*7) ,"/","$cookie_uri",0); + } else { + setcookie("phpicalendar","$the_cookie",time()+(60*60*24*7*12*10) ,"/","$cookie_uri",0); + } $HTTP_COOKIE_VARS['phpicalendar'] = $the_cookie; - #unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday); } if ($HTTP_COOKIE_VARS['phpicalendar']) { @@ -29,13 +33,16 @@ if ($HTTP_COOKIE_VARS['phpicalendar']) { $cookie_style = $phpicalendar['cookie_style']; $cookie_startday = $phpicalendar['cookie_startday']; $cookie_time = $phpicalendar['cookie_time']; + if ($cookie_unset) { + unset ($cookie_language, $cookie_calendar, $cookie_view, $cookie_style,$cookie_startday); + } } #echo "$cookie_uri"; #print_r(unserialize($HTTP_COOKIE_VARS['phpicalendar'])); #print_r($phpicalendar); include(BASE.'functions/ical_parser.php'); -if (!isset($HTTP_COOKIE_VARS['phpicalendar'])) { +if ((!isset($HTTP_COOKIE_VARS['phpicalendar'])) || ($cookie_unset)) { # No cookie set -> use defaults from config file. $cookie_language = ucfirst($language); $cookie_calendar = $default_cal; @@ -93,13 +100,17 @@ if (!isset($HTTP_COOKIE_VARS['phpicalendar'])) { <td> <table width="100%" border="0" cellspacing="0" cellpadding="0" class="G10B"> <?php - - if ($action == 'setcookie') { ?> + if ($action == 'setcookie') { + if (!$cookie_unset) { + $message = $prefs_set_lang; + } else { + $message = $prefs_unset_lang; + } + ?> <tr> - <td colspan="2" align="center"><font class="G10BOLD"><?php echo "$prefs_set_lang"; ?></font></td> + <td colspan="2" align="center"><font class="G10BOLD"><?php echo "$message"; ?></font></td> </tr> <?php } ?> - <tr> <td width="2%"></td> <td width="98%" valign="top" align="left"> @@ -273,6 +284,13 @@ if (!isset($HTTP_COOKIE_VARS['phpicalendar'])) { ?> </td> </tr> + <?php if ($HTTP_COOKIE_VARS['phpicalendar']) { ?> + <tr> + <td align="left" valign="top" nowrap><?php echo "$unset_prefs_lang"; ?></td> + <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> + <td align="left" valign="top"><INPUT TYPE="checkbox" NAME="unset" VALUE="true"></td> + </tr> + <?php } ?> <tr> <td align="left" valign="top" nowrap> </td> <td align="left" valign="top"><img src="images/spacer.gif" alt=" " width="20" height="1" border="0"></td> |