diff --git a/htdocs/admin.php b/htdocs/admin.php index f2117974..7fe272c3 100644 --- a/htdocs/admin.php +++ b/htdocs/admin.php @@ -24,7 +24,7 @@ if ( ! @include_once( $code_file ) ) { $c->messages[] = sprintf('No page found to %s %s%s%s', $action, ($action == 'browse' ? '' : 'a '), $component, ($action == 'browse' ? 's' : '')); include('page-header.php'); include('page-footer.php'); - exit(0); + @ob_flush(); exit(0); } include('page-header.php'); diff --git a/htdocs/always.php b/htdocs/always.php index f84bd95d..256f0e6d 100644 --- a/htdocs/always.php +++ b/htdocs/always.php @@ -26,6 +26,7 @@ function early_exception_handler($e) { foreach( $trace AS $k => $v ) { printf( "%s[%d] %s%s%s()\n", $v['file'], $v['line'], (isset($v['class'])?$v['class']:''), (isset($v['type'])?$v['type']:''), (isset($v['function'])?$v['function']:'') ); } + @ob_flush(); } set_exception_handler('early_exception_handler'); @@ -89,7 +90,7 @@ if ( ! @include_once('AWLUtilities.php') ) { } if ( ! @include_once('AWLUtilities.php') ) { echo "Could not find the AWL libraries. Are they installed? Check your include_path in php.ini!\n"; - exit; + @ob_flush(); exit(0); } } @@ -145,7 +146,7 @@ else if ( @file_exists('config/config.php') ) { } else { include('davical_configuration_missing.php'); - exit; + @ob_flush(); exit(0); } $config_warnings = trim(ob_get_contents()); ob_end_clean(); diff --git a/htdocs/caldav.php b/htdocs/caldav.php index 8b0d9334..97845e0f 100644 --- a/htdocs/caldav.php +++ b/htdocs/caldav.php @@ -17,17 +17,17 @@ if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^(/favicon.ico|davical.css|(i else { fpassthru($fh); } - exit(0); + @ob_flush(); exit(0); } require_once('./always.php'); if ( isset($_SERVER['PATH_INFO']) && preg_match( '{^/\.well-known/(.+)$}', $_SERVER['PATH_INFO'], $matches ) ) { require ('well-known.php'); - exit(0); + @ob_flush(); exit(0); } elseif ( isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] == '/autodiscover/autodiscover.xml' ) { require ('autodiscover-handler.php'); - exit(0); + @ob_flush(); exit(0); } function logRequestHeaders() { @@ -102,7 +102,7 @@ if ( ! ($request->IsPrincipal() || isset($request->collection) || $request->meth $redirect_url = ConstructURL('/caldav.php'.$matches[1]); dbg_error_log( 'LOG WARNING', 'Redirecting %s for "%s" to "%s"', $request->method, $request->path, $redirect_url ); header('Location: '.$redirect_url ); - exit(0); + @ob_flush(); exit(0); } } diff --git a/htdocs/index.php b/htdocs/index.php index cdbc96c9..782578e1 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -4,7 +4,7 @@ if ( $_SERVER['REQUEST_METHOD'] != "GET" && $_SERVER['REQUEST_METHOD'] != "POST" * If the request is not a GET or POST then they must really want caldav.php! */ include("./caldav.php"); - exit; // Not that it should return from that! + @ob_flush(); exit(0); // Not that it should return from that! } include("./always.php"); diff --git a/htdocs/tools.php b/htdocs/tools.php index 6e60b978..e73a31ea 100644 --- a/htdocs/tools.php +++ b/htdocs/tools.php @@ -21,7 +21,7 @@ require_once("caldav-PUT-functions.php"); include_once('check_UTF8.php'); if ( !$session->AllowedTo("Admin" ) ) - exit; + @ob_flush(); exit(0); if( function_exists("sync_LDAP") && isset($_POST['Sync_LDAP'])){ sync_LDAP(); diff --git a/inc/CalDAVRequest.php b/inc/CalDAVRequest.php index 4455472e..52649da3 100644 --- a/inc/CalDAVRequest.php +++ b/inc/CalDAVRequest.php @@ -1201,8 +1201,7 @@ EOSQL; @dbg_error_log("statistics", "Method: %s, Status: %d, Script: %5.3lfs, Queries: %5.3lfs, URL: %s", $this->method, $status, $script_time, $c->total_query_time, $this->path); } - - exit(0); + @ob_flush(); exit(0); } } diff --git a/inc/DAViCalSession.php b/inc/DAViCalSession.php index e06f1384..68d0f97a 100644 --- a/inc/DAViCalSession.php +++ b/inc/DAViCalSession.php @@ -113,7 +113,7 @@ class DAViCalSession extends Session || (isset($c->restrict_admin_port) && $c->restrict_admin_port != $_SERVER['SERVER_PORT'] ) ) { header('Location: caldav.php'); dbg_error_log( 'LOG WARNING', 'Access to "%s" via "%s:%d" rejected.', $_SERVER['REQUEST_URI'], $current_domain, $_SERVER['SERVER_PORT'] ); - exit(0); + @ob_flush(); exit(0); } if ( isset($c->restrict_admin_roles) && $roles == '' ) $roles = $c->restrict_admin_roles; if ( $this->logged_in && $roles == '' ) return; @@ -156,7 +156,7 @@ class DAViCalSession extends Session } include('page-footer.php'); - exit; + @ob_flush(); exit(0); } } diff --git a/inc/HTTPAuthSession.php b/inc/HTTPAuthSession.php index 1715ea1d..12cf9c07 100644 --- a/inc/HTTPAuthSession.php +++ b/inc/HTTPAuthSession.php @@ -88,7 +88,7 @@ class HTTPAuthSession { header( $auth_header ); echo 'Please log in for access to this system.'; dbg_error_log( "HTTPAuth", ":Session: User is not authorised: %s ", $_SERVER['REMOTE_ADDR'] ); - exit; + @ob_flush(); exit(0); } diff --git a/inc/always.php.in b/inc/always.php.in index 05a9ac22..b1c32d23 100644 --- a/inc/always.php.in +++ b/inc/always.php.in @@ -26,6 +26,7 @@ function early_exception_handler($e) { foreach( $trace AS $k => $v ) { printf( "%s[%d] %s%s%s()\n", $v['file'], $v['line'], (isset($v['class'])?$v['class']:''), (isset($v['type'])?$v['type']:''), (isset($v['function'])?$v['function']:'') ); } + @ob_flush(); } set_exception_handler('early_exception_handler'); @@ -89,7 +90,7 @@ if ( ! @include_once('AWLUtilities.php') ) { } if ( ! @include_once('AWLUtilities.php') ) { echo "Could not find the AWL libraries. Are they installed? Check your include_path in php.ini!\n"; - exit; + @ob_flush(); exit(0); } } @@ -145,7 +146,7 @@ else if ( @file_exists('config/config.php') ) { } else { include('davical_configuration_missing.php'); - exit; + @ob_flush(); exit(0); } $config_warnings = trim(ob_get_contents()); ob_end_clean(); diff --git a/inc/auth-functions.php b/inc/auth-functions.php index 6ada2c2a..b716f2f6 100644 --- a/inc/auth-functions.php +++ b/inc/auth-functions.php @@ -299,7 +299,7 @@ function AuthExternalAWL( $username, $password ) { EOERRMSG; - exit(1); + @ob_flush(); exit(1); } if ( $qry->Exec('Login',__LINE__,__FILE__) && $qry->rows() == 1 ) { diff --git a/inc/autodiscover-handler.php b/inc/autodiscover-handler.php index abf4fcac..65f5ba87 100644 --- a/inc/autodiscover-handler.php +++ b/inc/autodiscover-handler.php @@ -14,7 +14,7 @@ $request = new CalDAVRequest(); if ( !isset($c->enable_autodiscover) || ! $c->enable_autodiscover ) { $request->DoResponse( 404 ); - exit(0); + exit(0); // unneccessary } $ns_outlook_req_2006 = "http://schemas.microsoft.com/exchange/autodiscover/outlook/requestschema/2006"; @@ -40,7 +40,7 @@ function errorResponse( $code, $message, $debugdata = '' ) { ERROR; $request->DoResponse( $code, $response, 'text/xml; charset="utf-8"' ); - exit(0); + exit(0); // unneccessary } diff --git a/inc/caldav-PROPPATCH.php b/inc/caldav-PROPPATCH.php index 80d301a6..4e1163cd 100644 --- a/inc/caldav-PROPPATCH.php +++ b/inc/caldav-PROPPATCH.php @@ -353,6 +353,5 @@ if ( $qry->Commit() ) { * Or it was all crap. */ $request->DoResponse( 500 ); - -exit(0); +exit(0); // unneccessary diff --git a/inc/well-known.php b/inc/well-known.php index 6e50b1b3..6da42435 100644 --- a/inc/well-known.php +++ b/inc/well-known.php @@ -34,7 +34,7 @@ switch ( $request->path ) { if ( $c->enable_scheduling != true ) { $request->DoResponse( 404, translate('The application program does not understand that request.') ); - exit (); + // Does not return } header ( 'iSchedule-Version: 1.0' ); @@ -103,5 +103,6 @@ RESPONSE; RESPONSE; - exit ( 0 ); + + @ob_flush(); exit(0); }