X-Git-Url: https://git.mxchange.org/?p=core.git;a=blobdiff_plain;f=inc%2Fclasses%2Fmain%2Fresponse%2Fclass_BaseResponse.php;h=a2d0e302bd840d3d97e001bfcd17af123b41d0d9;hp=14c2117ec7eea3e5e1188327779ebbc1099e23b0;hb=89f25725096fa51850e2d4d0a2ed57906c0b23e0;hpb=7bcffaf69d46f44263cb79dc4b5d0054202197ea diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index 14c2117e..a2d0e302 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org * @@ -50,11 +50,6 @@ class BaseResponse extends BaseFrameworkSystem { */ private $templateInstance = NULL; - /** - * Fatal resolved messages from filters and so on - */ - private $fatalMessages = array(); - /** * Protected constructor * @@ -125,7 +120,7 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessage ($messageId) { // Adds the resolved message id to the fatal message list - $this->fatalMessages[] = $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId); + $this->addFatalMessagePlain($this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId)); } /** @@ -136,20 +131,20 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessagePlain ($message) { // Adds the resolved message id to the fatal message list - $this->fatalMessages[] = $message; + $this->pushValueToGenericArrayElement('fatal_messages', 'generic', 'message', $message); } /** * Flushs the cached HTTP response to the outer world * - * @param $force Wether we shall force the output or abort if headers are + * @param $force Whether we shall force the output or abort if headers are * already sent with an exception * @return void * @throws ResponseHeadersAlreadySentException Thrown if headers are * already sent */ - public function flushBuffer ($force = false) { - if ((headers_sent()) && ($force === false)) { + public function flushBuffer ($force = FALSE) { + if ((headers_sent()) && ($force === FALSE)) { // Headers are already sent! throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT); } elseif (!headers_sent()) { @@ -171,7 +166,7 @@ class BaseResponse extends BaseFrameworkSystem { // Send all headers foreach ($this->responseHeaders as $name => $value) { header($name . ': ' . $value); - //* DEBUG: */ $this->debugOutput('name=' . $name . ',value=' . $value); + //* DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('name=' . $name . ',value=' . $value); } // END - foreach // Send cookies out? @@ -186,12 +181,12 @@ class BaseResponse extends BaseFrameworkSystem { } // Are there some error messages? - if (count($this->fatalMessages) == 0) { + if ($this->countGenericArrayElements('fatal_messages', 'generic', 'message') == 0) { // Flush the output to the world $this->getWebOutputInstance()->output($this->responseBody); } else { // Display all error messages - $this->getApplicationInstance()->handleFatalMessages($this->fatalMessages); + $this->getApplicationInstance()->handleFatalMessages($this->getGenericArrayKey('fatal_messages', 'generic', 'message')); // Send the error messages out to the world $this->getWebOutputInstance()->output($this->responseBody);