You are here

function hosting_ssl_server_cert_list in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 web_server/ssl/hosting_ssl.module \hosting_ssl_server_cert_list()
  2. 7.3 web_server/ssl/hosting_ssl.module \hosting_ssl_server_cert_list()

List SSL certificates associated with the given server

1 string reference to 'hosting_ssl_server_cert_list'
hosting_ssl_menu in web_server/ssl/hosting_ssl.module
Per-server, per-ip certificate listing

File

web_server/ssl/hosting_ssl.module, line 126

Code

function hosting_ssl_server_cert_list($node) {
  $args = array(
    $node->nid,
  );
  drupal_set_title(t('Certificates installed on server @server', array(
    '@server' => $node->title,
  )));
  $header = array(
    array(
      'data' => t('Domain'),
      'field' => 'domain',
    ),
    array(
      'data' => t('IP address'),
      'field' => 'ip_address',
    ),
    array(
      'data' => t('Client'),
      'field' => 'client',
    ),
  );
  $sql = 'SELECT ips.ip_address, cert.ssl_key AS domain, cert.status, client.title AS client
            FROM {hosting_ip_addresses} ips
            INNER JOIN {hosting_ssl_cert_ips} cert_ip ON cert_ip.ip_address = ips.id
            INNER JOIN {hosting_ssl_cert} cert ON cert.cid = cert_ip.cid
            INNER JOIN {node} client ON client.nid = cert.client
            WHERE ips.nid = %d';
  $sql .= tablesort_sql($header);
  $result = pager_query(db_rewrite_sql($sql, 'cert'), 25, 2, null, $args);
  $rows = array();
  while ($cert = db_fetch_object($result)) {

    // XXX: not in use?

    //$row_class = ($cert->status == 1) ? 'hosting-success' : 'hosting-info';
    $row = array();
    $row[] = $cert->domain;
    $row[] = $cert->ip_address;
    $row[] = filter_xss($cert->client);
    $rows[] = $row;
  }
  return theme('table', $header, $rows, array(
    'class' => 'hostign-table',
  )) . theme('pager', null, 25, 2);
}