Dotclear

Changeset 3526:4659a409fa68 for inc


Ignore:
Timestamp:
02/06/17 16:44:11 (8 years ago)
Author:
franck <carnet.franck.paul@…>
Branch:
default
Message:

Allow 3rd party additional headers and extend arg of urlHandlerServeDocument in order to cope with

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inc/public/lib.urlhandlers.php

    r3519 r3526  
    110110 
    111111          header('Content-Type: '.$_ctx->content_type.'; charset=UTF-8'); 
     112 
     113          // Additional headers 
     114          $headers = new ArrayObject; 
    112115          if ($core->blog->settings->system->prevents_clickjacking) { 
    113116               if ($_ctx->exists('xframeoption')) { 
    114117                    $url = parse_url($_ctx->xframeoption); 
    115                     header(sprintf('X-Frame-Options: %s', is_array($url)?("ALLOW-FROM ".$url['scheme'].'://'.$url['host']):'SAMEORIGIN')); 
     118                    $header = sprintf('X-Frame-Options: %s', 
     119                         is_array($url)?("ALLOW-FROM ".$url['scheme'].'://'.$url['host']):'SAMEORIGIN'); 
    116120               } else { 
    117121                    // Prevents Clickjacking as far as possible 
    118                     header('X-Frame-Options: SAMEORIGIN'); // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+ 
    119                } 
     122                    $header = 'X-Frame-Options: SAMEORIGIN'; // FF 3.6.9+ Chrome 4.1+ IE 8+ Safari 4+ Opera 10.5+ 
     123               } 
     124               $headers[] = $header; 
     125          } 
     126          # --BEHAVIOR-- urlHandlerServeDocumentHeaders 
     127          $core->callBehavior('urlHandlerServeDocumentHeaders',$headers); 
     128 
     129          // Send additional headers if any 
     130          foreach ($headers as $header) { 
     131               header($header); 
    120132          } 
    121133 
     
    124136          $result['tpl'] = $_ctx->current_tpl; 
    125137          $result['blogupddt'] = $core->blog->upddt; 
     138          $result['headers'] = $headers; 
    126139 
    127140          # --BEHAVIOR-- urlHandlerServeDocument 
Note: See TracChangeset for help on using the changeset viewer.

Sites map