aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2003-11-24 01:29:17 +0000
committerChad Little <clittle@users.sourceforge.net>2003-11-24 01:29:17 +0000
commit323c110cb7787a09c175594001e2ba16674d9c50 (patch)
tree27cb9a6bcf650ca9f184c5a505a8fc4b572a4ae8
parent2d2a0f5bc3b8ec9b756412da4228128afdf5d9da (diff)
downloadphpicalendar-323c110cb7787a09c175594001e2ba16674d9c50.tar.gz
phpicalendar-323c110cb7787a09c175594001e2ba16674d9c50.tar.bz2
phpicalendar-323c110cb7787a09c175594001e2ba16674d9c50.zip
Made some changed to user:pass system to be more auto configuring, and
now cookies work as well, as well as fixing subscribe and download links.
-rw-r--r--config.inc.php15
-rw-r--r--functions/init.inc.php15
-rw-r--r--includes/login.php4
3 files changed, 16 insertions, 18 deletions
diff --git a/config.inc.php b/config.inc.php
index 729da3e..5516444 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -20,16 +20,13 @@ $tomorrows_events_lines = '1'; // Number of lines to wrap each event title in
$allday_week_lines = '1'; // Number of lines to wrap each event title in all-day events in week view, 0 means display all lines.
$week_events_lines = '1'; // Number of lines to wrap each event title in the 'Tommorrow's events' box, 0 means display all lines.
$timezone = ''; // Set timezone. Read TIMEZONES file for more information
-$default_path = 'http://www.example.com/phpicalendar'; // The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar
$tmp_dir = '/tmp'; // The temporary directory on your system (/tmp is fine for UNIXes including Mac OS X)
$calendar_path = ''; // Leave this blank on most installs, place your full path to calendars if they are outside the phpicalendar folder.
$second_offset = '0'; // The time in seconds between your time and your server's time.
-$bleed_time = '0400'; // This allows events past midnight to just be displayed on the starting date, only good up to 24 hours. Range from '0000' to '2359'
-
-// Advanced settings for custom installs, cookies, etc.
-// In most cases these will not need to be set.
+$bleed_time = ''; // This allows events past midnight to just be displayed on the starting date, only good up to 24 hours. Range from '0000' to '2359'. Is automatically set to $day_start if left blank.
$cookie_uri = ''; // The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar
$download_uri = ''; // The HTTP URL to your calendars directory, ie. http://www.example.com/phpicalendar/calendars
+$default_path = 'http://www.example.com/phpicalendar'; // The HTTP URL to the PHP iCalendar directory, ie. http://www.example.com/phpicalendar
// Yes/No questions --- 'yes' means Yes, anything else means no. 'yes' must be lowercase.
$save_parsed_cals = 'no'; // Recommended 'yes'. Saves a copy of the cal in /tmp after it's been parsed. Improves performence.
@@ -75,10 +72,10 @@ $locked_cals[] = ''; // exact calendar filename without the .ics suffix.
$locked_cals[] = ''; //
// add more lines as necessary
-$locked_map[] = ''; // Map username:password accounts to locked calendars that should be
-$locked_map[] = ''; // unlocked if logged in. Calendar names should be the same as what is
-$locked_map[] = ''; // listed in the $locked_cals, again without the .ics suffix.
-$locked_map[] = ''; // Example: $locked_map['username:password'] = array('Locked1', 'Locked2');
+$locked_map['user1:pass'] = array(''); // Map username:password accounts to locked calendars that should be
+$locked_map['user2:pass'] = array(''); // unlocked if logged in. Calendar names should be the same as what is
+$locked_map['user3:pass'] = array(''); // listed in the $locked_cals, again without the .ics suffix.
+$locked_map['user4:pass'] = array(''); // Example: $locked_map['username:password'] = array('Locked1', 'Locked2');
// add more lines as necessary
diff --git a/functions/init.inc.php b/functions/init.inc.php
index c2ce6a8..7661184 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -23,6 +23,10 @@ if (isset($HTTP_COOKIE_VARS['phpicalendar'])) {
if (isset($phpicalendar['cookie_time'])) $day_start = $phpicalendar['cookie_time'];
}
+if ($cookie_uri == '') {
+ $cookie_uri = $HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/'));
+}
+
// Look for a login cookie.
unset($username, $password);
if (isset($HTTP_COOKIE_VARS['phpicalendar_login'])) {
@@ -38,11 +42,8 @@ if (isset($HTTP_GET_VARS['password'])) $password = $HTTP_GET_VARS['password'];
else if (isset($HTTP_POST_VARS['password'])) $password = $HTTP_POST_VARS['password'];
// Set the login cookie if logging in. Clear it if logging out.
-if (isset($HTTP_GET_VARS['action'])) {
- $action = $HTTP_GET_VARS['action'];
-} else {
- $action = '';
-}
+$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : '';
+
if ($action == 'login') {
$the_cookie = serialize(array('username' => $username, 'password' => $password));
setcookie('phpicalendar_login', $the_cookie, time()+(60*60*24*7*12*10), '/', $cookie_uri, 0);
@@ -133,10 +134,10 @@ if ($is_webcal) {
}
// Sets the download and subscribe paths from the config if present.
- if ($download_uri == '' && preg_match('/(^\/|..\/)/', $filename) == 0) {
+ if ($download_uri == '') {
$subscribe_path = 'webcal://'.$HTTP_SERVER_VARS['SERVER_NAME'].dirname($HTTP_SERVER_VARS['PHP_SELF']).'/'.$filename;
$download_filename = $filename;
- } else if ($download_uri != '') {
+ } elseif ($download_uri != '') {
$newurl = eregi_replace("^(http://)", "", $download_uri);
$subscribe_path = 'webcal://'.$newurl.'/'.$cal_filename.'.ics';
$download_filename = $download_uri.'/'.$cal_filename.'.ics';
diff --git a/includes/login.php b/includes/login.php
index 43cf105..f374c31 100644
--- a/includes/login.php
+++ b/includes/login.php
@@ -27,8 +27,8 @@ echo <<<END
<div style="padding: 5px;">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr>
- <td>Username:</td>
- <td><input class="login_style" type="text" size="8" name="username"></td>
+ <td width="5%">Username:</td>
+ <td width="95%"><input class="login_style" type="text" size="8" name="username"></td>
</tr>
<tr>
<td>Password:</td>

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