You are here

crossdomain.module in Crossdomain 7

Same filename and directory in other branches
  1. 8 crossdomain.module

File

crossdomain.module
View source
<?php

/**
 * Implements hook_menu().
 */
function crossdomain_menu() {
  $items['admin/config/media/crossdomain'] = array(
    'title' => 'Cross Domain Settings',
    'page callback' => 'drupal_get_form',
    'page arguments' => array(
      'crossdomain_form',
    ),
    'access arguments' => array(
      'administer crossdomain',
    ),
    'file' => 'crossdomain.admin.inc',
  );
  $items['crossdomain.xml'] = array(
    'page callback' => 'crossdomain_render',
    'access arguments' => array(
      'access content',
    ),
  );
  return $items;
}

/**
 * Implements hook_permission().
 */
function crossdomain_permission() {
  return array(
    'administer crossdomain' => array(
      'title' => t('Administer crossdomain'),
      'description' => t('Perform administration tasks for crossdomain'),
    ),
  );
}
function crossdomain_render() {
  drupal_add_http_header('Content-Type', 'text/xml');
  $domains = variable_get('crossdomain', array());
  $output = "<?xml version=\"1.0\"?>\n\n<cross-domain-policy>\n";
  foreach ($domains as $domain) {
    $output .= "  <allow-access-from domain=\"{$domain}\" />\n";
  }
  $output .= '</cross-domain-policy>';
  print $output;
  exit;
}

Functions