You are here

function ldap_help_get_server in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_help/ldap_help.status.inc \ldap_help_get_server()
  2. 7 ldap_help/ldap_help.status.inc \ldap_help_get_server()
1 call to ldap_help_get_server()
ldap_help_status in ldap_help/ldap_help.status.inc
@file status file for ldaphelp module

File

ldap_help/ldap_help.status.inc, line 55
status file for ldaphelp module

Code

function ldap_help_get_server($phpinfo, &$info) {
  $info['phpversion'] = phpversion();
  $info['ldaploaded'] = extension_loaded('ldap');
  $info['ldap'] = $phpinfo['ldap'];
  $text = "";
  foreach ($phpinfo['ldap'] as $key => $value) {
    if (is_scalar($value)) {
      $text .= "<br/>{$key}: " . $value;
    }
    else {
      $text .= "<br/>{$key}: " . print_r($value, TRUE);
    }
  }
  $info['ldap']['text'] = $text;
  $modules = system_rebuild_module_data();
  $ldapmodules = array(
    'ldap_servers',
    'ldap_authentication',
    'ldap_authorization',
    'ldap_authorization_drupal_role',
    'ldap_authorization_og',
    'ldap_feeds',
    'ldap_query',
    'ldap_sso',
    'ldap_views',
  );
  foreach ($ldapmodules as $ldapmodule) {
    $data['status'] = $modules[$ldapmodule]->status;
    $data['schema_version'] = $modules[$ldapmodule]->schema_version;
    $data['version'] = $modules[$ldapmodule]->info['version'] ? $modules[$ldapmodule]->info['version'] : 'unknown';
    $data['text'] = "status: " . $data['status'] . ", schema_version: " . $data['schema_version'] . ", v: " . $data['version'];
    $info[$ldapmodule] = $data;
  }

  // set status array to be converted into html table.
  if (isset($phpinfo['Apache Environment'])) {
    $status[] = array(
      'title' => 'Apache',
      'value' => $phpinfo['Apache Environment']['SERVER_SOFTWARE'],
    );
  }
  elseif (isset($_SERVER["SERVER_SOFTWARE"])) {
    $status[] = array(
      'title' => 'SERVER_SOFTWARE',
      'value' => $_SERVER["SERVER_SOFTWARE"],
    );
  }
  $status[] = array(
    'title' => 'PHP version',
    'value' => phpversion(),
  );
  if (!$info['ldaploaded']) {
    $status[] = array(
      'title' => 'PHP ldap extension not loaded',
      'value' => l(t('PHP LDAP extension'), 'http://us2.php.net/ldap') . ' must be loaded for LDAP Integration to work.
    It comes compiled with most versions of PHP.',
      'severity' => REQUIREMENT_ERROR,
    );
  }
  else {
    $status[] = array(
      'title' => 'PHP ldap extension data',
      'value' => $info['ldap']['text'],
      'severity' => 0,
    );
  }
  $status[] = array(
    'title' => 'mcrypt extension loaded',
    'value' => extension_loaded('mcrypt') ? "yes" : "no",
  );
  $status[] = array(
    'title' => 'open ssl extension loaded',
    'value' => extension_loaded('openssl') ? "yes" : "no",
  );
  $status[] = array(
    'title' => 'Drupal',
    'value' => VERSION,
    'severity' => "0",
  );
  foreach ($ldapmodules as $ldapmodule) {
    $status[] = array(
      'title' => $ldapmodule,
      'value' => $info[$ldapmodule]['text'],
      'severity' => "0",
    );
  }
  return $status;
}