aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWesley Miaw <josuah@users.sourceforge.net>2003-11-22 21:16:10 +0000
committerWesley Miaw <josuah@users.sourceforge.net>2003-11-22 21:16:10 +0000
commit3b3487be53650bb9b39d9ed8c7afd1c04b943b60 (patch)
treec0ab013a59cebcbdbc024a99b8050b54b4d4fce8
parent3fa43afd25ab763d3540fc5ddaa4c164b2af33c1 (diff)
downloadphpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.tar.gz
phpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.tar.bz2
phpicalendar-3b3487be53650bb9b39d9ed8c7afd1c04b943b60.zip
Added username/password login to access locked calendars. Moved
calendar availability logic (with support for login) to a calendar_functions.php file. RSS feeds support the login feature when determining which calendars to return. Styles updated for the login box.
-rw-r--r--admin.php3
-rw-r--r--config.inc.php13
-rw-r--r--functions/admin_functions.php21
-rw-r--r--functions/calendar_functions.php113
-rw-r--r--functions/init.inc.php67
-rw-r--r--functions/list_icals.php29
-rw-r--r--includes/calendar_nav.php10
-rw-r--r--includes/login.php65
-rw-r--r--includes/sidebar.php10
-rw-r--r--preferences.php10
-rw-r--r--rss/index.php36
-rw-r--r--styles/green/default.css1
-rw-r--r--styles/grey/default.css2
-rw-r--r--styles/orange/default.css1
-rw-r--r--styles/red/default.css2
-rw-r--r--styles/silver/default.css2
-rw-r--r--styles/tan/default.css1
17 files changed, 275 insertions, 111 deletions
diff --git a/admin.php b/admin.php
index 7b72859..f3ea145 100644
--- a/admin.php
+++ b/admin.php
@@ -4,6 +4,7 @@ session_start();
define('BASE', './');
include (BASE.'functions/init.inc.php');
include (BASE.'functions/admin_functions.php');
+include (BASE.'functions/calendar_functions.php');
// Redirect if administration is not allowed
if ($allow_admin != "yes") {
@@ -234,7 +235,7 @@ if ($action == "delete") {
//
$COLUMNS_TO_PRINT = 3;
$column = 1;
- $filelist = get_calendar_files($calendar_path);
+ $filelist = availableCalendarNames('', '', '', true);
foreach ($filelist as $file) {
if ($column > $COLUMNS_TO_PRINT) {
echo "</tr>";
diff --git a/config.inc.php b/config.inc.php
index b739dc4..c7fe55c 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -47,6 +47,7 @@ $allow_preferences = 'yes'; // Allow visitors to change various preferences v
$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.
+$show_login = 'no'; // Set to yes to prompt for login to unlock calendars.
// Administration settings
$allow_admin = 'no'; // Set to yes to allow the admin page - remember to change the default password if using 'internal' as the $auth_method
@@ -68,6 +69,18 @@ $list_webcals[] = ''; // or webcal:// and the filename should contain the .
$list_webcals[] = ''; // $allow_webcals does *not* need to be "yes" for these to show up and work
// add more lines as necessary
+$locked_cals[] = ''; // Fill in-between the quotes the names of the calendars you wish to hide
+$locked_cals[] = ''; // unless unlocked by a username/password login. This should be the
+$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');
+// add more lines as necessary
+
$color_cals[] = 'silver'; // Fill in between the quotes the colors you want to display
$color_cals[] = 'red'; // multiple calendars in.
$color_cals[] = 'orange'; // The first color will be used if no color is selected.
diff --git a/functions/admin_functions.php b/functions/admin_functions.php
index 325a9dd..207dcf7 100644
--- a/functions/admin_functions.php
+++ b/functions/admin_functions.php
@@ -284,23 +284,4 @@ function is_uploaded_ics ($filename) {
}
}
-// Get all calendar filenames (not including path)
-//
-// argo: string path to calendar files
-// returns array filenames (not including path)
-function get_calendar_files($calendar_path) {
- global $error_path_lang;
-
- $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path)));
- $filelist = array();
- while ($file = readdir($dir_handle)) {
- if (preg_match("/^[^.].+\.ics$/", $file)) {
- array_push($filelist, $file);
- }
- }
- closedir($dir_handle);
- natcasesort($filelist);
- return $filelist;
-}
-
-?> \ No newline at end of file
+?>
diff --git a/functions/calendar_functions.php b/functions/calendar_functions.php
new file mode 100644
index 0000000..84f22cc
--- /dev/null
+++ b/functions/calendar_functions.php
@@ -0,0 +1,113 @@
+<?php
+
+// This function returns a list of all calendars that the current user
+// has access to. Basically, all local calendars found in the calendar
+// directory, plus any webcals listed in the configuration file, but
+// excluding blacklisted calendars and locked calendars which the user,
+// if logged in, does not have access to.
+//
+// $username = The username. Empty if no username provided.
+// $password = The password. Empty if no password provided.
+// $cal_filename = The calendar name without .ics.
+// $admin = True if this is an administrative request, in
+// which case all local calendars only will be
+// returned.
+function availableCalendars($username, $password, $cal_filename, $admin = false) {
+ // Import globals.
+ global $calendar_path, $blacklisted_cals, $list_webcals, $locked_cals, $locked_map, $error_path_lang, $error_restrictedcal_lang, $ALL_CALENDARS_COMBINED;
+
+ // Create the list of available calendars.
+ $calendars = array();
+
+ // Grab the list of unlocked calendars.
+ $unlocked_cals = array();
+ if (isset($locked_map["$username:$password"])) {
+ $unlocked_cals = $locked_map["$username:$password"];
+ }
+
+ // Include all local and web calendars if asking for all calendars
+ // combined.
+ if ($cal_filename == $ALL_CALENDARS_COMBINED || $admin) {
+ // Add local calendars.
+ $dir_handle = @opendir($calendar_path)
+ or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
+ while (($file = readdir($dir_handle)) != false) {
+ // Make sure this is not a dot file and it ends with .ics,
+ // and that it is not blacklisted.
+ if (!preg_match("/^[^.].+\.ics$/i", $file)) continue;
+ $cal_name = substr($file, 0, -4);
+ if (in_array($cal_name, $blacklisted_cals)) continue;
+
+ // Exclude locked calendars.
+ if (!$admin &&
+ in_array($cal_name, $locked_cals) &&
+ !in_array($cal_name, $unlocked_cals))
+ {
+ continue;
+ }
+
+ // Add this calendar.
+ array_push($calendars, "$calendar_path/$file");
+ }
+
+ // Add web calendars.
+ if (!$admin) {
+ foreach ($list_webcals as $file) {
+ // Make sure the URL ends with .ics.
+ if (!preg_match("/.ics$/i", $file)) continue;
+
+ // Add this calendar.
+ array_push($calendars, $file);
+ }
+ }
+ }
+
+ // Otherwise just include the requested calendar.
+ else {
+ // Make sure this is not a blacklisted calendar. We don't have
+ // to remove a .ics suffix because it would not have been passed
+ // in the argument.
+ if (in_array($cal_filename, $blacklisted_cals))
+ exit(error($error_restrictedcal_lang, $cal_filename));
+
+ // Make sure this calendar is not locked.
+ if (in_array($cal_filename, $locked_cals) &&
+ !in_array($cal_filename, $unlocked_cals))
+ {
+ // Use the invalid calendar message so that the user is
+ // not made aware of locked calendars.
+ exit(error($error_invalidcal_lang, $cal_filename));
+ }
+
+ // Add this calendar.
+ array_push($calendars, "$calendar_path/$cal_filename.ics");
+ }
+
+ // Return the sorted calendar list.
+ natcasesort($calendars);
+ return $calendars;
+}
+
+// This function returns the result of the availableCalendars function
+// but only includes the calendar filename (including the .ics) and not
+// the entire path.
+//
+// $username = The username. Empty if no username provided.
+// $password = The password. Empty if no password provided.
+// $cal_filename = The calendar name without .ics.
+// $admin = True if this is an administrative request, in
+// which case all local calendars only will be
+// returned.
+function availableCalendarNames($username, $password, $cal_filename, $admin = false) {
+ // Grab the available calendar paths.
+ $calendars = availableCalendars($username, $password, $cal_filename, $admin);
+
+ // Strip the paths off the calendars.
+ foreach (array_keys($calendars) as $key) {
+ $calendars[$key] = basename($calendars[$key]);
+ }
+
+ // Return the sorted calendar names.
+ natcasesort($calendars);
+ return $calendars;
+}
diff --git a/functions/init.inc.php b/functions/init.inc.php
index 512a487..c2ce6a8 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -12,6 +12,7 @@ $ALL_CALENDARS_COMBINED = 'all_calendars_combined971';
if (!defined('BASE')) define('BASE', './');
include(BASE.'config.inc.php');
include(BASE.'functions/error.php');
+include(BASE.'functions/calendar_functions.php');
if (isset($HTTP_COOKIE_VARS['phpicalendar'])) {
$phpicalendar = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar']));
if (isset($phpicalendar['cookie_language'])) $language = $phpicalendar['cookie_language'];
@@ -22,6 +23,34 @@ if (isset($HTTP_COOKIE_VARS['phpicalendar'])) {
if (isset($phpicalendar['cookie_time'])) $day_start = $phpicalendar['cookie_time'];
}
+// Look for a login cookie.
+unset($username, $password);
+if (isset($HTTP_COOKIE_VARS['phpicalendar_login'])) {
+ $login_cookie = unserialize(stripslashes($HTTP_COOKIE_VARS['phpicalendar_login']));
+ if (isset($login_cookie['username'])) $username = $login_cookie['username'];
+ if (isset($login_cookie['password'])) $password = $login_cookie['password'];
+}
+
+// Look for a new username and password.
+if (isset($HTTP_GET_VARS['username'])) $username = $HTTP_GET_VARS['username'];
+else if (isset($HTTP_POST_VARS['username'])) $username = $HTTP_POST_VARS['username'];
+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 = '';
+}
+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);
+} else if ($action == 'logout') {
+ setcookie('phpicalendar_login', '', time()-(60*60*24*7), '/', $cookie_uri, 0);
+ unset($username, $password);
+}
+
// language support
$language = strtolower($language);
$lang_file = BASE.'/languages/'.$language.'.inc.php';
@@ -99,42 +128,8 @@ if ($is_webcal) {
exit(error($error_restrictedcal_lang, $cal_filename));
} else {
if (!isset($filename)) {
- // empty the filelist array
- $cal_filelist = array();
- if ($cal == $ALL_CALENDARS_COMBINED) { // Create an array with the paths to all files to be combined
- // Note: code here is similar to code in list_icals.php
- // open directory
- $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
-
- // build the array
- while (false != ($file = readdir($dir_handle))) {
- if (preg_match("/^[^.].+\.ics$/", $file) &&
- !in_array(substr($file, 0, -4), $blacklisted_cals)) {
- $file = $calendar_path.'/'.$file;
- array_push($cal_filelist, $file);
- }
- }
- // add webcals
- foreach ($list_webcals as $file) {
- if (preg_match("/^[^.].+\.ics$/", $file)) {
- array_push($cal_filelist, $file);
- }
- }
- natcasesort($cal_filelist);
- } else { // Handle a single file
- $filename = $calendar_path.'/'.$cal_filename.'.ics';
- if (true == false) {
- $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 = urlencode(substr($file, 0, -4));
- $filename = $calendar_path.'/'.$file;
- break;
- }
- }
- }
- array_push($cal_filelist, $filename);
- }
+ $cal_filelist = availableCalendars($username, $password, $cal_filename);
+ if (count($cal_filelist) == 1) $filename = $cal_filelist[0];
}
// Sets the download and subscribe paths from the config if present.
diff --git a/functions/list_icals.php b/functions/list_icals.php
index 9382656..c2e6ce4 100644
--- a/functions/list_icals.php
+++ b/functions/list_icals.php
@@ -8,16 +8,8 @@ if ($display_ical_list == "yes") {
// open file
$dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
- // empty the filelist array
- $filelist = array();
-
- // build the <option> tags
- while (false != ($file = readdir($dir_handle))) {
- if (preg_match("/^[^.].+\.ics$/", $file)) {
- array_push($filelist, $file);
- }
- }
- natcasesort($filelist);
+ // Grab all calendars.
+ $filelist = availableCalendarNames($username, $password, $ALL_CALENDARS_COMBINED);
foreach ($filelist as $file) {
// $cal_filename is the filename of the calendar without .ics
@@ -26,13 +18,11 @@ if ($display_ical_list == "yes") {
$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 == $cal) {
- print "<option value=\"$current_view.php?cal=$cal_tmp&amp;getdate=$getdate\" selected>$cal_displayname_tmp $calendar_lang</option>";
- } else {
- print "<option value=\"$current_view.php?cal=$cal_tmp&amp;getdate=$getdate\">$cal_displayname_tmp $calendar_lang</option>";
- }
- }
+ if ($cal_tmp == $cal) {
+ print "<option value=\"$current_view.php?cal=$cal_tmp\" selected>$cal_displayname_tmp $calendar_lang</option>\n";
+ } else {
+ print "<option value=\"$current_view.php?cal=$cal_tmp\">$cal_displayname_tmp $calendar_lang</option>\n";
+ }
}
// option to open all (non-web) calenders together
@@ -55,14 +45,9 @@ if ($display_ical_list == "yes") {
}
}
}
-
- // close file
- closedir($dir_handle);
// finish <select>
print "</select>";
}
-
-
?>
diff --git a/includes/calendar_nav.php b/includes/calendar_nav.php
index 4cd4bcc..b08d50a 100644
--- a/includes/calendar_nav.php
+++ b/includes/calendar_nav.php
@@ -20,6 +20,10 @@
$fake_getdate_time = strtotime($this_year.'-'.$this_month.'-15');
?>
<br>
+<?php
+ $login_width = 737;
+ include(BASE.'includes/login.php');
+?>
<table border="0" width="737" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" class="calborder">
<tr>
<td align="left" valign="top" width="1%" class="sideback"><?php echo "<a class=\"psf\" href=\"month.php?cal=$cal&amp;getdate=$prev_day\"><img src=\"styles/$style_sheet/left_arrows.gif\" alt=\"[$last_day_lang]\" border=\"0\" align=\"left\"></a>"; ?></td>
@@ -146,6 +150,12 @@
echo "<a class=\"psf\" href=\"print.php?cal=$cal&amp;getdate=$getdate&amp;printview=$current_view\">$goprint_lang</a><br>\n";
if ($allow_preferences != 'no') echo "<a class=\"psf\" href=\"preferences.php?cal=$cal&amp;getdate=$getdate\">$preferences_lang</a><br>\n";
if ($cal != $ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') echo "<a class=\"psf\" href=\"$subscribe_path\">$subscribe_lang</a>&nbsp;|&nbsp;<a class=\"psf\" href=\"$download_filename\">$download_lang</a>\n";
+ if (isset($username)) {
+ $querys = preg_replace("/action=[^&]+/", "action=logout", $QUERY_STRING);
+ if ($querys == $QUERY_STRING) $querys .= '&action=logout";
+ $querys = preg_replace("/(username|password)=[^&]+/", "", $querys);
+ echo "<a class=\"psf\" href=\"$SCRIPT_NAME?$querys\">Logout $username</a><br>\n";
+ }
?>
</td>
</tr>
diff --git a/includes/login.php b/includes/login.php
new file mode 100644
index 0000000..14cc96c
--- /dev/null
+++ b/includes/login.php
@@ -0,0 +1,65 @@
+<?php
+ // Hide the login block if logged in or there are no lock usernames.
+ if (!isset($username) && $allow_login == 'yes') {
+ // Set the login table width if not set.
+ if (!isset($login_width)) $login_width = "100%";
+
+ // Remove the username, password, and action values from the form action.
+ $form_action = preg_replace("/(username|password|action)=[^&]+/", "", $REQUEST_URI);
+?>
+ <form style="margin-bottom:0;" action="<?php echo $form_action; ?>" method="POST">
+ <input type="hidden" name="action" value="login">
+ <?php
+ foreach (array_keys($HTTP_GET_VARS) as $key) {
+ if ($key == 'action' ||
+ $key == 'username' ||
+ $key == 'password')
+ {
+ continue;
+ }
+ echo "<input type=\"hidden\" name=\"$key\" value=\"$HTTP_GET_VARS[$key]\">\n";
+ }
+ ?>
+ <table cellpadding="0" cellspacing="0" border="0" width="<?php echo $login_width; ?>" class="calborder">
+ <tr>
+ <td bgcolor="#FFFFFF" valign="middle" align="center">
+ <table cellpadding="0" cellspacing="0" border="0">
+ <tr>
+ <td align="left" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
+ <td colspan="3" align="center" width="98%" class="sideback"><font class="G10BOLD">Login</font></td>
+ <td align="right" valign="top" width="1%" class="sideback"><img src="images/spacer.gif" width="1" height="20" alt=" "></td>
+ </tr>
+ <tr>
+ <td colspan="5"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
+ </tr>
+ <tr>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ <td width="48%"><font class="G10B">Username:</font></td>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ <td width="48%"><input class="login_style" type="text" size="8" name="username"></td>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ </tr>
+ <tr>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ <td width="48%"><font class="G10B">Password:</font></td>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ <td width="48%"><input class="login_style" type="password" size="8" name="password"></td>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ </tr>
+ <tr>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ <td colspan="3" align="center"><input class="login_style" type="submit" value="Login"></td>
+ <td width="1%"><img src="images/spacer.gif" width="4" height="1" alt=""></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td bgcolor="#FFFFFF"><img src="images/spacer.gif" width="148" height="6" alt=" "></td>
+ </tr>
+ </table>
+ </form>
+ <img src="images/spacer.gif" width="1" height="10" alt=" "><br>
+<?php
+ }
+?>
diff --git a/includes/sidebar.php b/includes/sidebar.php
index 009ace0..fbbf43f 100644
--- a/includes/sidebar.php
+++ b/includes/sidebar.php
@@ -16,6 +16,10 @@ if (strlen($cal_displayname2) > 24) {
$search_box = '<form style="margin-bottom:0;" action="search.php" method="GET"><input type="hidden" name="cal" value="'.$cal.'"><input type="hidden" name="getdate" value="'.$getdate.'"><input type="text" style="font-size:10px" size="15" class="search_style" name="query" value="'.$search_lang.'" onfocus="javascript:if(this.value==\''.$search_lang.'\') {this.value=\'\';}" onblur="javascript:if(this.value==\'\') {this.value=\''.$search_lang.'\'}"><INPUT type="image" src="styles/'.$style_sheet.'/search.gif" name="submit" value="Search"></form>';
?>
+<?php
+ $login_width = 170;
+ include(BASE.'includes/login.php');
+?>
<table width="170" border="0" cellpadding="0" cellspacing="0" class="calborder">
<tr>
<td align="left" valign="top" width="24" class="sideback"><?php echo "<a class=\"psf\" href=\"day.php?cal=$cal&amp;getdate=$yesterdays_date\"><img src=\"styles/$style_sheet/left_arrows.gif\" alt=\"[$prev_lang]\" width=\"16\" height=\"20\" border=\"0\" align=\"left\"></a>"; ?></td>
@@ -35,6 +39,12 @@ $search_box = '<form style="margin-bottom:0;" action="search.php" method="GET"><
echo "<a class=\"psf\" href=\"print.php?cal=$cal&amp;getdate=$getdate&amp;printview=$current_view\">$goprint_lang</a><br>\n";
if ($allow_preferences != 'no') echo "<a class=\"psf\" href=\"preferences.php?cal=$cal&amp;getdate=$getdate\">$preferences_lang</a><br>\n";
if ($cal != $ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') echo "<a class=\"psf\" href=\"$subscribe_path\">$subscribe_lang</a>&nbsp;|&nbsp;<a class=\"psf\" href=\"$download_filename\">$download_lang</a>\n";
+ if (isset($username)) {
+ $querys = preg_replace("/action=[^&]+/", "action=logout", $QUERY_STRING);
+ if ($querys == $QUERY_STRING) $querys .= '&action=logout';
+ $querys = preg_replace("/(username|password)=[^&]+/", "", $querys);
+ echo "<br>\n<a class=\"psf\" href=\"$SCRIPT_NAME?$querys\">Logout $username</a>\n";
+ }
echo '</span></div>';
?>
</td>
diff --git a/preferences.php b/preferences.php
index e7d464f..7c67ec7 100644
--- a/preferences.php
+++ b/preferences.php
@@ -2,6 +2,7 @@
define('BASE','./');
include(BASE.'functions/ical_parser.php');
+include(BASE.'functions/calendar_functions.php');
$display_date = $preferences_lang;
if ($cookie_uri == '') {
@@ -157,14 +158,7 @@ include (BASE.'includes/header.inc.php');
// Begin Calendar Selection
//
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));
- $filelist = array();
- while ($file = readdir($dir_handle)) {
- if (preg_match("/^[^.].+\.ics$/", $file)) {
- array_push($filelist, $file);
- }
- }
- natcasesort($filelist);
+ $filelist = availableCalendarNames($username, $password, $ALL_CALENDARS_COMBINED);
foreach ($filelist as $file) {
$cal_filename_tmp = substr($file,0,-4);
$cal_tmp = urlencode($cal_filename_tmp);
diff --git a/rss/index.php b/rss/index.php
index 187b3b1..75ef9cb 100644
--- a/rss/index.php
+++ b/rss/index.php
@@ -2,6 +2,7 @@
define('BASE','../');
include(BASE.'functions/ical_parser.php');
+include(BASE.'functions/calendar_functions.php');
$default_path = 'http://'.$HTTP_SERVER_VARS['SERVER_NAME'].substr($HTTP_SERVER_VARS['PHP_SELF'],0,strpos($HTTP_SERVER_VARS['PHP_SELF'], '/rss/'));
if (isset($HTTP_SERVER_VARS['HTTP_REFERER']) && $HTTP_SERVER_VARS['HTTP_REFERER'] != '') {
$back_page = $HTTP_SERVER_VARS['HTTP_REFERER'];
@@ -57,28 +58,21 @@ include (BASE.'includes/header.inc.php'); ?>
<br>
<?php
- // open file
- $dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path), $cal_filename));
-
// build the <option> tags
- while ($file = readdir($dir_handle)) {
- if (preg_match("/^[^.].+\.ics$/", $file)) {
-
- // $cal_filename is the filename of the calendar without .ics
- // $cal is a urlencoded version of $cal_filename
- // $cal_displayname is $cal_filename with occurrences of "32" replaced with " "
- $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)) {
- echo '<font class="V12" color="blue"><b>'.$cal_displayname_tmp.' '. $calendar_lang.'</b></font><br>';
- echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=day<br>';
- echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=week<br>';
- echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=month<br>';
- $footer_check = $default_path.'/rss/rss.php?cal='.$default_cal.'&rssview='.$default_view;
- echo '<br><br>';
- }
- }
+ $filelist = availableCalendarNames($username, $password, $ALL_CALENDARS_COMBINED);
+ foreach ($filelist as $file) {
+ // $cal_filename is the filename of the calendar without .ics
+ // $cal is a urlencoded version of $cal_filename
+ // $cal_displayname is $cal_filename with occurrences of "32" replaced with " "
+ $cal_filename_tmp = substr($file,0,-4);
+ $cal_tmp = urlencode($cal_filename_tmp);
+ $cal_displayname_tmp = str_replace("32", " ", $cal_filename_tmp);
+ echo '<font class="V12" color="blue"><b>'.$cal_displayname_tmp.' '. $calendar_lang.'</b></font><br>';
+ echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=day<br>';
+ echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=week<br>';
+ echo $default_path.'/rss/rss.php?cal='.$cal_tmp.'&rssview=month<br>';
+ $footer_check = $default_path.'/rss/rss.php?cal='.$default_cal.'&rssview='.$default_view;
+ echo '<br><br>';
}
?>
</td>
diff --git a/styles/green/default.css b/styles/green/default.css
index 3009ee5..218e6bb 100644
--- a/styles/green/default.css
+++ b/styles/green/default.css
@@ -98,3 +98,4 @@ body { background-image: url(background.gif); }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }
diff --git a/styles/grey/default.css b/styles/grey/default.css
index eca0559..14b7d3a 100644
--- a/styles/grey/default.css
+++ b/styles/grey/default.css
@@ -98,4 +98,4 @@ body { background-image: url(background.gif); }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
-
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }
diff --git a/styles/orange/default.css b/styles/orange/default.css
index 66bdfbb..00c1f6b 100644
--- a/styles/orange/default.css
+++ b/styles/orange/default.css
@@ -97,3 +97,4 @@ body { background-color: #E5E5E5; }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }
diff --git a/styles/red/default.css b/styles/red/default.css
index 12c452e..83e2741 100644
--- a/styles/red/default.css
+++ b/styles/red/default.css
@@ -97,4 +97,4 @@ body { background-color: #774444; }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
-
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }
diff --git a/styles/silver/default.css b/styles/silver/default.css
index 59b01d1..ea762c7 100644
--- a/styles/silver/default.css
+++ b/styles/silver/default.css
@@ -96,4 +96,4 @@ body { background-color: #E5E5E5; }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
-
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }
diff --git a/styles/tan/default.css b/styles/tan/default.css
index f5a0405..eda1699 100644
--- a/styles/tan/default.css
+++ b/styles/tan/default.css
@@ -95,4 +95,5 @@ body { background-image: url(background.gif); }
.query_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 156px; margin-bottom: 0; }
.search_style { font-size: 12px; font-family: verdana, geneva, arial, sans-serif; width: 134px; margin-bottom: 0; }
+.login_style { font-size: 11px; font-family: verdana, geneva, arial, sans-serif; width: 80px; margin-bottom: 0; }

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