ViaThinkSoft CodeLib
This article is in:
CodeLib → How-Tos → Miscellaneous
This patch disables following informations from PHP iCalender publicly:
- event_text
- description
- url
- location
- don't allow that the ICS gets downloaded
This patch was tested with the latest version PHP iCalendar 2.4 RC7 (2010-06-15).
PHP iCalender can be downloaded here: http://sourceforge.net/projects/phpicalendar/
functions/date_functions.php
functions/template.php
rss/rss.php, rss/rss1.0.php, rss/rss2.0.php
rss/rss_common.php
error.php
Hiding local calendars
Please note that for local calendars the calender still can be downloaded e.g. with the Download link "calendars/test.ics". Therefore you should lock the folder calendars with a file "calendars/.htaccess" with following contents:
Alternatively you can use Basic Auth or you can hide the download link:
- event_text
- description
- url
- location
- don't allow that the ICS gets downloaded
This patch was tested with the latest version PHP iCalendar 2.4 RC7 (2010-06-15).
PHP iCalender can be downloaded here: http://sourceforge.net/projects/phpicalendar/
functions/date_functions.php
function openevent()
Find:
global $cpath, $timeFormat, $dateFormat_week;
Replace:
global $cpath, $timeFormat, $dateFormat_week;
// To filter the event text
$arr['event_text'] = 'BUSY';
// To filter the description (seen in the hover box)
$arr['description'] = 'Information not available';
// To censor the location
$arr['location'] = 'Information not available';
// To filter event's URL (if set) which is seen in the popup window.
$arr['url'] = '';
functions/template.php
function draw_subscribe()
Find:
if ($cal != $phpiCal_config->ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') {
Replace:
$subscribe_path = '';
$download_filename = '';
if ($cal != $phpiCal_config->ALL_CALENDARS_COMBINED && $subscribe_path != '' && $download_filename != '') {
function draw_month()
Find:
$location = '<br /><span style="font-size: 95%">' . sanitizeForWeb(stripslashes(urldecode($val['location']))) . '</span>';
Replace:
$val['location'] = 'Unknown';
$location = '<br /><span style="font-size: 95%">' . sanitizeForWeb(stripslashes(urldecode($val['location']))) . '</span>';
function draw_print()
Find:
$replace = array($event_start, $event_text, $description, $location);
Replace:
$event_text = 'BUSY';
$description = 'No information available.';
$location = 'Unknown';
$replace = array($event_start, $event_text, $description, $location);
function draw_search()
Find:
$replace = array($event_start, $event_text, $description, $location);
Replace:
$event_text = 'BUSY';
$description = 'No information available.';
$location = 'Unknown';
$replace = array($event_start, $event_text, $description, $location);
---
Find:
$except_tmp = str_replace('{EVENT_TEXT}', $except_event_text, $except_tmp);
Replace:
$except_event_text = 'Not busy';
$except_tmp = str_replace('{EVENT_TEXT}', $except_event_text, $except_tmp);
---
Find:
$except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp);
Replace:
$except_description = 'No information available';
$except_tmp = str_replace('{EXCEPT_DESCRIPTION}', $except_description, $except_tmp);
function monthbottom()
Find:
if ($switch['EVENT_TEXT'] != '') {
Replace:
$switch['EVENT_TEXT'] = 'BUSY';
$switch['DESCRIPTION'] = 'No information available';
if ($switch['EVENT_TEXT'] != '') {
rss/rss.php, rss/rss1.0.php, rss/rss2.0.php
function rss_item()
Find:
if (isset($val['location']) && $val['location'] !=''){
Replace:
if (isset($val['location']) && $val['location'] !=''){
$val['location'] = 'Unknown';
rss/rss_common.php
Find:
$event_text = stripslashes(urldecode($val["event_text"]));
Replace:
$event_text = stripslashes(urldecode($val["event_text"]));
$event_text = 'BUSY';
$val["event_text"] = $event_text;
---
Find:
$description = stripslashes(urldecode($val["description"]));
Replace:
$description = stripslashes(urldecode($val["description"]));
$description = 'No information available';
$val["description"] = $description;
error.php
function error()
Find:
$error_calendar = sprintf($lang['l_error_calendar'], print_r($file,true));
Replace:
$file = '(URL hidden)';
# Failed to copy file - The calendar "..." was being processed when this error occurred.
$error_calendar = sprintf($lang['l_error_calendar'], print_r($file,true));
Hiding local calendars
Please note that for local calendars the calender still can be downloaded e.g. with the Download link "calendars/test.ics". Therefore you should lock the folder calendars with a file "calendars/.htaccess" with following contents:
Order Deny,Allow
Deny From All
Alternatively you can use Basic Auth or you can hide the download link:
AuthName "My calendar ICS files"
AuthUserFile /path/to/your/docroot/.htpasswd
AuthType Basic
require valid-user
Daniel Marschall
ViaThinkSoft Co-Founder
ViaThinkSoft Co-Founder