aboutsummaryrefslogtreecommitdiffstats
path: root/functions
diff options
context:
space:
mode:
authorChad Little <clittle@users.sourceforge.net>2003-09-15 01:00:44 +0000
committerChad Little <clittle@users.sourceforge.net>2003-09-15 01:00:44 +0000
commitcab875ea0e16e37bc62b60782d0359865fc402e6 (patch)
treeb9dcc57c7b80bff07638afaf628d731caf4af94c /functions
parentea8ebe6a3122e066814a23c5c9d7233a2d48fbf7 (diff)
downloadphpicalendar-cab875ea0e16e37bc62b60782d0359865fc402e6.tar.gz
phpicalendar-cab875ea0e16e37bc62b60782d0359865fc402e6.tar.bz2
phpicalendar-cab875ea0e16e37bc62b60782d0359865fc402e6.zip
Fix for bug #794853 listing dot-files.
Diffstat (limited to 'functions')
-rw-r--r--functions/admin_functions.php2
-rw-r--r--functions/ical_parser.php63
-rw-r--r--functions/init.inc.php4
-rw-r--r--functions/list_icals.php2
4 files changed, 13 insertions, 58 deletions
diff --git a/functions/admin_functions.php b/functions/admin_functions.php
index 7e7a8a6..325a9dd 100644
--- a/functions/admin_functions.php
+++ b/functions/admin_functions.php
@@ -294,7 +294,7 @@ function get_calendar_files($calendar_path) {
$dir_handle = @opendir($calendar_path) or die(error(sprintf($error_path_lang, $calendar_path)));
$filelist = array();
while ($file = readdir($dir_handle)) {
- if (substr($file, -4) == ".ics") {
+ if (preg_match("/^[^.].+\.ics$/", $file)) {
array_push($filelist, $file);
}
}
diff --git a/functions/ical_parser.php b/functions/ical_parser.php
index 9dc4e61..3b0c0cc 100644
--- a/functions/ical_parser.php
+++ b/functions/ical_parser.php
@@ -883,20 +883,15 @@ foreach ($cal_filelist as $filename) {
break;
case 'DURATION':
if (($first_duration == TRUE) && (!stristr($field, '=DURATION'))) {
- ereg ('^P([0-9]{1,2})?([W,D]{0,1}[T])?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration);
- if ($duration[2] = 'W') {
- $weeks = $duration[1];
- $days = 0;
- } else {
- $days = $duration[1];
- $weeks = 0;
- }
- $hours = ereg_replace('H', '', $duration[3]);
- $minutes = ereg_replace('M', '', $duration[4]);
- $seconds = ereg_replace('S', '', $duration[5]);
- $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds);
- $end_unixtime = $start_unixtime + $the_duration;
- $end_time = date ('Hi', $end_unixtime);
+ ereg ('^P([0-9]{1,2}[W])?([0-9]{1,2}[D])?([T]{0,1})?([0-9]{1,2}[H])?([0-9]{1,2}[M])?([0-9]{1,2}[S])?', $data, $duration);
+ $weeks = ereg_replace('W', '', $duration[1]);
+ $days = ereg_replace('D', '', $duration[2]);
+ $hours = ereg_replace('H', '', $duration[4]);
+ $minutes = ereg_replace('M', '', $duration[5]);
+ $seconds = ereg_replace('S', '', $duration[6]);
+ $the_duration = ($weeks * 60 * 60 * 24 * 7) + ($days * 60 * 60 * 24) + ($hours * 60 * 60) + ($minutes * 60) + ($seconds);
+ $end_unixtime = $start_unixtime + $the_duration;
+ $end_time = date ('Hi', $end_unixtime);
$first_duration = FALSE;
}
break;
@@ -926,46 +921,6 @@ foreach ($cal_filelist as $filename) {
}
}
}
-
- /*
- //print '<pre>';
- // Remove pesky recurrences
- if (is_array($recurrence_delete)) {
- foreach ($recurrence_delete as $delete => $delete_key) {
- foreach ($delete_key as $key => $val) {
- #echo "Before Delete:: $delete $key $val<br>";
- #print_r($master_array["$delete"]);
- if (is_array($master_array[($delete)][($key)][($val)])) {
- removeOverlap($delete, $key, $val);
- unset($master_array["$delete"]["$key"]["$val"]);
- // Remove date from array if no events
- if (sizeof($master_array["$delete"]["$key"] = 1)) {
- #echo "deleting $delete $key $val<br>";
- unset($master_array["$delete"]["$key"]);
- if (!sizeof($master_array["$delete"] > 1)) {
- #echo "deleting $delete $key $val<br>";
- unset($master_array["$delete"]);
- }
- }
- #print_r($master_array["$delete"]);
- // Check for overlaps and rewrite them
- foreach($master_array["$delete"] as $overlap_time => $overlap_val) {
- $recur_data_date = $delete;
- foreach ($overlap_val as $uid => $val) {
- $start_time = $val['event_start'];
- $end_time = $val['event_end'];
- #$nbrOfOverlaps = checkOverlap($recur_data_date, $start_time, $end_time, $uid);
- #$master_array[($recur_data_date)][($start_time)][($uid)]['event_overlap'] = 0;
- #echo "$recur_data_date - $uid - $start_time - $end_time - $nbrOfOverlaps<br>";
- #print_r($val);
- }
- }
- }
- }
- }
- }
-
- */
}
$calnumber = $calnumber + 1;
}
diff --git a/functions/init.inc.php b/functions/init.inc.php
index db76044..2a145ed 100644
--- a/functions/init.inc.php
+++ b/functions/init.inc.php
@@ -106,14 +106,14 @@ if ($is_webcal) {
// build the array
while (false != ($file = readdir($dir_handle))) {
- if (substr($file, -4) == ".ics") {
+ if (preg_match("/^[^.].+\.ics$/", $file)) {
$file = $calendar_path.'/'.$file;
array_push($cal_filelist, $file);
}
}
// add webcals
foreach ($list_webcals as $file) {
- if (substr($file, -4) == ".ics") {
+ if (preg_match("/^[^.].+\.ics$/", $file)) {
array_push($cal_filelist, $file);
}
}
diff --git a/functions/list_icals.php b/functions/list_icals.php
index 75d85b4..91b6b7c 100644
--- a/functions/list_icals.php
+++ b/functions/list_icals.php
@@ -17,7 +17,7 @@ if ($display_ical_list == "yes") {
// build the <option> tags
while (false != ($file = readdir($dir_handle))) {
- if (substr($file, -4) == ".ics") {
+ if (preg_match("/^[^.].+\.ics$/", $file)) {
array_push($filelist, $file);
}
}

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