X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=inc%2Fclasses%2Fmain%2Fresponse%2Fclass_BaseResponse.php;h=33064b8c2f4864e6460abec854ee8941edc70aa0;hb=1ee35e6d96c456b8e3499bd683f1647aa28bd501;hp=2533d7c95582f893b60de635b752141f1d604db8;hpb=ac948286448f4e0d4ef71d2dc8daaac53e8c902b;p=core.git diff --git a/inc/classes/main/response/class_BaseResponse.php b/inc/classes/main/response/class_BaseResponse.php index 2533d7c9..33064b8c 100644 --- a/inc/classes/main/response/class_BaseResponse.php +++ b/inc/classes/main/response/class_BaseResponse.php @@ -2,11 +2,11 @@ /** * A generic request class * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Core Developer Team + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2014 Core Developer Team * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.shipsimu.org * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -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 - array_push($this->fatalMessages, $this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId)); + $this->addFatalMessagePlain($this->getApplicationInstance()->getLanguageInstance()->getMessage($messageId)); } /** @@ -136,7 +131,7 @@ class BaseResponse extends BaseFrameworkSystem { */ public final function addFatalMessagePlain ($message) { // Adds the resolved message id to the fatal message list - array_push($this->fatalMessages, $message); + $this->pushValueToGenericArrayKey('fatal_messages', 'generic', 'message', $message); } /** @@ -148,8 +143,8 @@ class BaseResponse extends BaseFrameworkSystem { * @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()) { @@ -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);