You are here

function kaltura_test_crossdomain in Kaltura 6

Same name and namespace in other branches
  1. 5 includes/kaltura.admin.inc \kaltura_test_crossdomain()
  2. 6.2 includes/kaltura.admin.inc \kaltura_test_crossdomain()
  3. 7.3 includes/kaltura.admin.inc \kaltura_test_crossdomain()
  4. 7.2 includes/kaltura.admin.inc \kaltura_test_crossdomain()
1 call to kaltura_test_crossdomain()
kaltura_settings_form in includes/kaltura.admin.inc

File

includes/kaltura.admin.inc, line 754

Code

function kaltura_test_crossdomain() {
  $filename = $_SERVER['DOCUMENT_ROOT'] . '/crossdomain.xml';
  $cd_xml = @fopen($filename, 'r');
  if ($cd_xml && filesize($filename) > 0 && file_exists($filename)) {
    if (!function_exists('simplexml_load_file')) {
      $result = alternate_xml_verification($filename);
      return $result;
    }
    $cd_xml_content = simplexml_load_file($filename);
    foreach ($cd_xml_content
      ->children() as $child) {
      $atts = $child
        ->attributes();
      if ($atts['domain'] == '*' || $atts['domain'] == '*.kaltura.com') {
        $kaltura_ok = TRUE;
      }
      if ($atts['headers'] == '*' && ($atts['domain'] == '*' || $atts['domain'] == '*.kaltura.com')) {
        $headers_ok = TRUE;
      }
    }
    if ($kaltura_ok && $headers_ok) {
      return array(
        TRUE,
        t('crossdomain.xml is in place and seems to be OK'),
      );
    }
    else {
      return array(
        FALSE,
        t('crossdomain.xml is in place, but it is probably not configured good') . '<br />' . t('Please read ') . l('here', 'admin/help/kaltura'),
      );
    }
  }
  else {
    return array(
      FALSE,
      t('crossdomain.xml file could not be found in your site\'s root directory') . ' [' . $filename . ']',
    );
  }
}