Fix debugging code so this doesn't break a server with open_basedir

enabled.  Not that I in any way endorse the use of open_basedir...
This commit is contained in:
Andrew McMillan 2008-01-21 17:30:31 +13:00
parent 8b3ef09ff1
commit 949d28a5c1
3 changed files with 13 additions and 9 deletions

View File

@ -53,13 +53,13 @@ $c->protocol_server_port_script = sprintf( "%s://%s%s%s", (isset($_SERVER['HTTPS
init_gettext( 'rscds', '../locale' );
if ( file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) {
if ( @file_exists("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php") ) {
include_once("/etc/davical/".$_SERVER['SERVER_NAME']."-conf.php");
}
else if ( file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) {
else if ( @file_exists("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php") ) {
include_once("/etc/rscds/".$_SERVER['SERVER_NAME']."-conf.php");
}
else if ( file_exists("../config/config.php") ) {
else if ( @file_exists("../config/config.php") ) {
include_once("../config/config.php");
}
else {

View File

@ -124,10 +124,12 @@ function import_collection( $ics_content, $user_no, $path, $caldav_context ) {
// According to RFC2445 we should always end with CRLF, but the CalDAV spec says
// that normalising XML parses often muck with it and may remove the CR.
$icalendar = preg_replace('/\r?\n /', '', $ics_content );
if ( isset($c->dbg['ALL']) || isset($c->dbg['put']) ) {
if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || isset($c->dbg['put'])) ) {
$fh = fopen('/tmp/PUT-2.txt','w');
fwrite($fh,$icalendar);
fclose($fh);
if ( $fh ) {
fwrite($fh,$icalendar);
fclose($fh);
}
}
$lines = preg_split('/\r?\n/', $icalendar );

View File

@ -10,10 +10,12 @@
*/
dbg_error_log("REPORT", "method handler");
if ( isset($c->dbg['ALL']) || $c->dbg['report'] ) {
if ( ! ini_get('open_basedir') && (isset($c->dbg['ALL']) || $c->dbg['report']) ) {
$fh = fopen('/tmp/REPORT.txt','w');
fwrite($fh,$request->raw_post);
fclose($fh);
if ( $fh ) {
fwrite($fh,$request->raw_post);
fclose($fh);
}
}
if ( ! ($request->AllowedTo('read') || $request->AllowedTo('freebusy')) ) {