]> git.mxchange.org Git - hub.git/blobdiff - inc/classes/main/response/class_HttpResponse.php
Merge from ship-simu trunk
[hub.git] / inc / classes / main / response / class_HttpResponse.php
index 3679fe96a33bae43603dd8c35154dc288c40dfa9..8172191acf66aedd2b36cacce1658213a4b82c00 100644 (file)
@@ -20,6 +20,9 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * The extended headers are taken from phpMyAdmin setup tool, written by
+ * Michal Cihar <michal@cihar.com>, licensed under GNU GPL 2.0.
  */
 class HttpResponse extends BaseFrameworkSystem implements Responseable {
        /**
@@ -119,13 +122,26 @@ class HttpResponse extends BaseFrameworkSystem implements Responseable {
         * @throws      ResponseHeadersAlreadySentException             Thrown if headers are
         *                                                                                                      already sent
         */
-       public function flushResponse ($force=false) {
+       public function flushBuffer ($force=false) {
                if ((headers_sent()) && (!$force)) {
                        // Headers are already sent!
                        throw new ResponseHeadersAlreadySentException($this, self::EXCEPTION_HEADERS_ALREADY_SENT);
                } elseif (!headers_sent()) {
                        // Send headers out
                        header("HTTP/1.0 {$this->responseStatus}");
+
+                       // Used later
+                       $now = gmdate('D, d M Y H:i:s') . ' GMT';
+
+                       // General header for no caching
+                       $this->addHeader('Expired', $now); // rfc2616 - Section 14.21
+                       $this->addHeader('Last-Modified', $now);
+                       $this->addHeader('Cache-Control:', 'no-store, no-cache, must-revalidate, pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
+                       $this->addHeader('Pragma:', 'no-cache'); // HTTP/1.0
+
+                       // Define the charset to be used
+                       $this->addHeader('Content-Type:', 'text/html; charset=utf-8');
+
                        foreach ($this->responseHeaders as $name=>$value) {
                                header("{$name}: {$value}");
                        }