Changeset 3279:0fc10be22e4c for inc/admin
- Timestamp:
- 07/21/16 14:07:55 (9 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/lib.dc.page.php
r3278 r3279 90 90 91 91 # Display 92 header('Content-Type: text/html; charset=UTF-8'); 93 94 // Prevents Clickjacking as far as possible 92 $headers = new arrayobject(array()); 93 94 # Content-Type 95 $headers['content-type'] = 'Content-Type: text/html; charset=UTF-8'; 96 97 # Prevents Clickjacking as far as possible 95 98 if (isset($options['x-frame-allow'])) { 96 self::setXFrameOptions($ options['x-frame-allow']);99 self::setXFrameOptions($headers,$options['x-frame-allow']); 97 100 } else { 98 self::setXFrameOptions( );101 self::setXFrameOptions($headers); 99 102 } 100 103 101 104 # Content-Security-Policy (report only up to now) 102 header(105 $headers['csp'] = 103 106 "Content-Security-Policy: ". 104 107 "default-src 'self' ; ". … … 106 109 "style-src 'self' 'unsafe-inline' ; ". 107 110 "img-src 'self' data: media.dotaddict.org". 108 (version_compare(phpversion(),'5.4','>=') ? " ; report-uri ".DC_ADMIN_URL."csp_report.php" : '') 109 ); 111 (version_compare(phpversion(),'5.4','>=') ? " ; report-uri ".DC_ADMIN_URL."csp_report.php" : ''); 112 113 # --BEHAVIOR-- adminPageHTTPHeaders 114 $core->callBehavior('adminPageHTTPHeaders',$headers); 115 foreach ($headers as $key => $value) { 116 header($value); 117 } 110 118 111 119 echo … … 1023 1031 } 1024 1032 1025 public static function setXFrameOptions($ origin = null)1033 public static function setXFrameOptions($headers,$origin = null) 1026 1034 { 1027 1035 if (self::$xframe_loaded) { … … 1030 1038 if ($origin !== null) { 1031 1039 $url = parse_url($origin); 1032 header(sprintf('X-Frame-Options: %s',is_array($url) ?1040 $headers['x-frame-options'] = sprintf('X-Frame-Options: %s',is_array($url) ? 1033 1041 ("ALLOW-FROM ".(isset($url['scheme']) ? $url['scheme'].':' : '' ).'//'.$url['host']) : 1034 'SAMEORIGIN') );1042 'SAMEORIGIN'); 1035 1043 } else { 1036 header('X-Frame-Options: SAMEORIGIN'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+1044 $headers['x-frame-options'] = 'X-Frame-Options: SAMEORIGIN'; // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+ 1037 1045 } 1038 1046 self::$xframe_loaded = true;
Note: See TracChangeset
for help on using the changeset viewer.