Package: webcalendar
Version: 0.9.45-2
Severity: wishlist
Tags: patch
Webcalendar allows setting a custom HTML header and footer in the database,
but it would be nice to allow including files for the header/footer in
order to integrate with non-webcalendar pages in a site.
My solution for this is to use the existing header/footer fields, and
have the code check whether the data there looks like a filename rather
than like HTML.
Patch:
diff -ur webcalendar-0.9.45-2/includes/init.php webcalendar/includes/init.php
--- webcalendar-0.9.45-2/includes/init.php 2004-11-20 12:55:31.000000000
-0500
+++ webcalendar/includes/init.php 2005-01-17 17:18:49.000000000 -0500
@@ -302,7 +302,13 @@
"WHERE cal_template_type = 'H' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
+ if (eregi('^[a-z0-9/_.+-]+\.[a-z0-9]{2,4}$', $row[0])) {
+ // it's a file to include, so include it
+ include($_SERVER['DOCUMENT_ROOT'].'/'.$row[0]);
+ } else {
+ // it's text to write out directly
echo $row[0];
+ }
}
dbi_free_result ( $res );
}
@@ -335,7 +341,13 @@
"WHERE cal_template_type = 'T' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
- echo $row[0];
+ if (eregi('^[a-z0-9/_.+-]+\.[a-z0-9]{2,4}$', $row[0])) {
+ // it's a file to include, so include it
+ include($_SERVER['DOCUMENT_ROOT'].'/'.$row[0]);
+ } else {
+ // it's text to write out directly
+ echo $row[0];
+ }
}
dbi_free_result ( $res );
}
diff -ur webcalendar-0.9.45-2/login.php webcalendar/login.php
--- webcalendar-0.9.45-2/login.php 2004-11-23 02:55:16.000000000 -0500
+++ webcalendar/login.php 2005-01-17 17:43:00.000000000 -0500
@@ -165,7 +165,13 @@
"WHERE cal_template_type = 'H' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
- echo $row[0];
+ if (eregi('^[a-z0-9/_.+-]+\.[a-z0-9]{2,4}$', $row[0])) {
+ // it's a file to include, so include it
+ include($_SERVER['DOCUMENT_ROOT'].'/'.$row[0]);
+ } else {
+ // it's text to write out directly
+ echo $row[0];
+ }
}
dbi_free_result ( $res );
}
@@ -228,7 +236,13 @@
"WHERE cal_template_type = 'T' and cal_report_id = 0" );
if ( $res ) {
if ( $row = dbi_fetch_row ( $res ) ) {
- echo $row[0];
+ if (eregi('^[a-z0-9/_.+-]+\.[a-z0-9]{2,4}$', $row[0])) {
+ // it's a file to include, so include it
+ include($_SERVER['DOCUMENT_ROOT'].'/'.$row[0]);
+ } else {
+ // it's text to write out directly
+ echo $row[0];
+ }
}
dbi_free_result ( $res );
}
-- System Information:
Debian Release: 3.1
APT prefers testing
APT policy: (500, 'testing'), (50, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.7-1-686-smp
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages webcalendar depends on:
ii apache [httpd] 1.3.33-3 versatile, high-performance HTTP s
ii debconf [debconf-2.0] 1.4.30.11 Debian configuration management sy
ii mysql-server 4.0.23-3 mysql database server binaries
ii php4 4:4.3.10-2 server-side, HTML-embedded scripti
ii php4-cli 4:4.3.10-2 command-line interpreter for the p
ii php4-mysql 4:4.3.10-2 MySQL module for php4
-- debconf information:
webcalendar/conf/single_user_mode: false
webcalendar/conf/db_host: localhost
webcalendar/conf/db_database:
webcalendar/note/sql_install:
webcalendar/conf/db_type: mysql
webcalendar/status/db_installed: false
webcalendar/note/admin_user:
webcalendar/conf/db_login:
webcalendar/conf/db_persistent: true
webcalendar/conf/single_user_login:
webcalendar/conf/db_password:
webcalendar/conf/use_http_auth: false
* webcalendar/status/debconf_managed: false
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]