From 8626e93d5b4362c86a58933dda9206ac8810476d Mon Sep 17 00:00:00 2001 From: Daniel Hunsaker Date: Mon, 4 Mar 2013 05:14:22 -0700 Subject: Reverting changes to functions that have no business being used in CLI apps to begin with Signed-off-by: Daniel Hunsaker --- system/core/Common.php | 15 ++++++--------- system/helpers/download_helper.php | 3 +-- system/libraries/Trackback.php | 6 ++---- system/libraries/Xmlrpcs.php | 3 +-- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/system/core/Common.php b/system/core/Common.php index e11668d5f..9baf5e315 100644 --- a/system/core/Common.php +++ b/system/core/Common.php @@ -531,16 +531,13 @@ if ( ! function_exists('set_status_header')) $server_protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : FALSE; - if ( ! headers_sent()) + if (strpos(php_sapi_name(), 'cgi') === 0) { - if (strpos(php_sapi_name(), 'cgi') === 0) - { - header('Status: '.$code.' '.$text, TRUE); - } - else - { - header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); - } + header('Status: '.$code.' '.$text, TRUE); + } + else + { + header(($server_protocol ? $server_protocol : 'HTTP/1.1').' '.$code.' '.$text, TRUE, $code); } } } diff --git a/system/helpers/download_helper.php b/system/helpers/download_helper.php index bd3296574..4fe6a0e88 100644 --- a/system/helpers/download_helper.php +++ b/system/helpers/download_helper.php @@ -141,8 +141,7 @@ if ( ! function_exists('force_download')) // If we have raw data - just dump it if ($data !== NULL) { - echo $data; - exit; + exit($data); } // Flush 1MB chunks of data diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php index ecc7129e3..5a45be8dd 100644 --- a/system/libraries/Trackback.php +++ b/system/libraries/Trackback.php @@ -211,8 +211,7 @@ class CI_Trackback { */ public function send_error($message = 'Incomplete Information') { - echo '\n\n1\n".$message."\n"; - exit; + exit('\n\n1\n".$message."\n"); } // -------------------------------------------------------------------- @@ -227,8 +226,7 @@ class CI_Trackback { */ public function send_success() { - echo '\n\n0\n"; - exit; + exit('\n\n0\n"); } // -------------------------------------------------------------------- diff --git a/system/libraries/Xmlrpcs.php b/system/libraries/Xmlrpcs.php index a6048cb9f..d263d789d 100644 --- a/system/libraries/Xmlrpcs.php +++ b/system/libraries/Xmlrpcs.php @@ -170,8 +170,7 @@ class CI_Xmlrpcs extends CI_Xmlrpc { header('Content-Type: text/xml'); header('Content-Length: '.strlen($payload)); - echo $payload; - exit; + exit($payload); } // -------------------------------------------------------------------- -- cgit v1.2.3-24-g4f1b