You are here

function domain_block_view_server in Domain Access 7.3

Same name and namespace in other branches
  1. 7.2 domain.blocks.inc \domain_block_view_server()

Prints information about the current HTTP request.

See also

domain_block_view()

File

./domain.blocks.inc, line 85
Block view functions for Domain Access.

Code

function domain_block_view_server() {
  $_domain = domain_get_domain();
  $output = '';
  $header = array(
    t('Property'),
    t('Value'),
  );
  $rows = array();
  $rows[] = array(
    t('HTTP_HOST request'),
    check_plain($_SERVER['HTTP_HOST']),
  );
  $check = domain_lookup(NULL, $_SERVER['HTTP_HOST']);
  $match = t('TRUE');
  if ($check == -1) {

    // Specific check for Domain Alias.
    if (isset($_domain['active_alias_id'])) {
      $match = t('ALIAS: Using alias %id', array(
        '%id' => $_domain['active_alias_id'],
      ));
    }
    else {
      $match = t('FALSE: Using default domain.');
    }
  }
  $rows[] = array(
    t('Domain match'),
    $match,
  );
  foreach ($_domain as $key => $value) {
    if (is_null($value)) {
      $value = t('NULL');
    }
    elseif ($value === TRUE) {
      $value = t('TRUE');
    }
    elseif ($value === FALSE) {
      $value = t('FALSE');
    }
    $rows[] = array(
      check_plain($key),
      !is_array($value) ? check_plain($value) : _domain_block_print_array($value),
    );
  }
  $output = theme('table', array(
    'header' => $header,
    'rows' => $rows,
  ));
  $block = array(
    'subject' => t('Domain server information'),
    'content' => array(
      '#markup' => $output,
    ),
  );
  return $block;
}