From b3cda72e93fff3a4c3476e9e7e78ef2b2a3f02b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 11 Jul 2014 17:06:51 +0200 Subject: PicoFarad framework for routing --- inc/3rdparty/PicoFarad/Response.php | 156 ++++++++++++++++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 inc/3rdparty/PicoFarad/Response.php (limited to 'inc/3rdparty/PicoFarad/Response.php') diff --git a/inc/3rdparty/PicoFarad/Response.php b/inc/3rdparty/PicoFarad/Response.php new file mode 100644 index 00000000..9114fde0 --- /dev/null +++ b/inc/3rdparty/PicoFarad/Response.php @@ -0,0 +1,156 @@ + $hosts) { + + if (is_array($hosts)) { + + $acl = ''; + + foreach ($hosts as &$host) { + + if ($host === '*' || $host === 'self' || strpos($host, 'http') === 0) { + $acl .= $host.' '; + } + } + } + else { + + $acl = $hosts; + } + + $values .= $policy.' '.trim($acl).'; '; + } + + header('Content-Security-Policy: '.$values); +} + + +function nosniff() +{ + header('X-Content-Type-Options: nosniff'); +} + + +function xss() +{ + header('X-XSS-Protection: 1; mode=block'); +} + + +function hsts() +{ + header('Strict-Transport-Security: max-age=31536000'); +} + + +function xframe($mode = 'DENY', array $urls = array()) +{ + header('X-Frame-Options: '.$mode.' '.implode(' ', $urls)); +} \ No newline at end of file -- cgit v1.2.3