Package: webcalendar
Version: 0.9.45-2
Severity: wishlist
Tags: patch
I want to share a single webcalendar installation across multiple sites
hosted on my server. The way settings.php is used in the stock code,
this is not possible. And oddly, settings.php has PHP tags but is not
parseable as a PHP file. If it were, it would be possible to make the
settings file figure out which site's database connection information
to use.
Of course, changing the interpretation of settings.php to be a proper PHP
file would break existing configurations. My solution is to interpret
an existing settings.php file in the old non-PHP way, but if that file
is not there then use the PHP require() mechanism to interpret the file,
and rely on the include path to find it.
Patch:
diff -ur webcalendar-0.9.45-2/includes/config.php
webcalendar/includes/config.php
--- webcalendar-0.9.45-2/includes/config.php 2004-12-13 19:19:43.000000000
-0500
+++ webcalendar/includes/config.php 2005-01-14 17:09:00.000000000 -0500
@@ -22,20 +22,9 @@
$settings = array ();
$fd = @fopen ( "settings.php", "rb", true );
if ( empty ( $fd ) ) {
- // There is no settings.php file.
- // Redirect user to install page if it exists.
- if ( file_exists ( "install/index.php" ) ) {
- Header ( "Location: install/index.php" );
- exit;
- } else {
- echo "<html>\n<title>Error</title>\n</head>\n<body>\n" .
- "<p>Error: could not find settings.php file.<br />\n" .
- "Please copy settings.php.orig to settings.php and modify for your " .
- "site. </p>\n" .
- "</body></html>\n";
- exit;
- }
-}
+ require('webcalendar/settings.php');
+
+} else {
while ( ! feof ( $fd ) ) {
$buffer = fgets ( $fd, 4096 );
$buffer = trim ( $buffer, "\r\n " );
@@ -75,6 +64,7 @@
// Type of user authentication
$user_inc = $settings['user_inc'];
+} // end of manually interpreting settings.php
// We can add extra 'nonuser' calendars such as a corporate calendar,
// holiday calendar, departmental calendar, etc. We need a unique prefix
-- 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]