X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=lib%2Fhtmloutputter.php;h=b1aae16fad7a0819b634c4069b60d85837a92c52;hb=7220b3ddd4a32b947e851c946cb6ad6146bebf7d;hp=7eccd6cc0e56cddd9ed745fc20cd2e35b17bf733;hpb=2196d00b1b9a97b498897099c6993383c43b1d44;p=quix0rs-gnu-social.git diff --git a/lib/htmloutputter.php b/lib/htmloutputter.php index 7eccd6cc0e..b1aae16fad 100644 --- a/lib/htmloutputter.php +++ b/lib/htmloutputter.php @@ -108,10 +108,17 @@ class HTMLOutputter extends XMLOutputter header('Content-Type: '.$type); + // Output anti-framing headers to prevent clickjacking (respected by newer + // browsers). + if (common_config('javascript', 'bustframes')) { + header('X-XSS-Protection: 1; mode=block'); // detect XSS Reflection attacks + header('X-Frame-Options: SAMEORIGIN'); // no rendering if origin mismatch + } + $this->extraHeaders(); if (preg_match("/.*\/.*xml/", $type)) { // Required for XML documents - $this->xw->startDocument('1.0', 'UTF-8'); + $this->startXML(); } $this->xw->writeDTD('html', '-//W3C//DTD XHTML 1.0 Strict//EN', @@ -119,9 +126,16 @@ class HTMLOutputter extends XMLOutputter $language = $this->getLanguage(); - $this->elementStart('html', array('xmlns' => 'http://www.w3.org/1999/xhtml', - 'xml:lang' => $language, - 'lang' => $language)); + $attrs = array( + 'xmlns' => 'http://www.w3.org/1999/xhtml', + 'xml:lang' => $language, + 'lang' => $language + ); + + if (Event::handle('StartHtmlElement', array($this, &$attrs))) { + $this->elementStart('html', $attrs); + Event::handle('EndHtmlElement', array($this, &$attrs)); + } } function getLanguage() @@ -159,27 +173,37 @@ class HTMLOutputter extends XMLOutputter * a cluster of elements, including a