예제 #1
0
function MAX_cookieSendP3PHeaders()
{
    if ($GLOBALS['_MAX']['CONF']['p3p']['policies']) {
        MAX_header("P3P: " . _generateP3PHeader());
    }
}
예제 #2
0
 /**
  * Test that the P3P string to be put into the P3P header is generated correctly
  *
  */
 function test_generateP3PHeader()
 {
     $conf =& $GLOBALS['_MAX']['CONF'];
     // Test that nothing is generated if $conf['p3p']['policies'] is false
     $conf['p3p']['policies'] = false;
     $this->assertEqual(_generateP3PHeader(), '');
     // Test that the compact policy header is generated correctly with a compact policy
     // and a policyLocation
     $conf['p3p']['policies'] = true;
     $conf['p3p']['compactPolicy'] = 'CUR ADM OUR NOR STA NID';
     $conf['p3p']['policyLocation'] = 'http://www.openx.org/policy.xml';
     $this->assertEqual(_generateP3PHeader(), ' policyref="' . $conf['p3p']['policyLocation'] . '",  CP="' . $conf['p3p']['compactPolicy'] . '"');
     // Test that the compact policy header is generated correctly with just a compact policy
     $conf['p3p']['policies'] = true;
     $conf['p3p']['compactPolicy'] = 'CUR ADM OUR NOR STA NID';
     $conf['p3p']['policyLocation'] = '';
     $this->assertEqual(_generateP3PHeader(), ' CP="' . $conf['p3p']['compactPolicy'] . '"');
     // Test that the compact policy header is generated correctly with just a policy location
     $conf['p3p']['policies'] = true;
     $conf['p3p']['compactPolicy'] = '';
     $conf['p3p']['policyLocation'] = 'http://www.openx.org/policy.xml';
     $this->assertEqual(_generateP3PHeader(), ' policyref="' . $conf['p3p']['policyLocation'] . '"');
     // Test that the compact policy header is not generated without either policy location or compact policy
     $conf['p3p']['policies'] = true;
     $conf['p3p']['compactPolicy'] = '';
     $conf['p3p']['policyLocation'] = '';
     $this->assertEqual(_generateP3PHeader(), '');
 }