You are here

function hosting_ssl_get_keys in Hostmaster (Aegir) 6

Retrieve an associated array of possible keys.

Parameters

$client: The client to filter the keys by.

$ask_custom: Include the special 'generate new key' value used by the site form.

3 calls to hosting_ssl_get_keys()
hook_hosting_site_options_alter in modules/hosting/site/hosting_site.api.php
hosting_ssl_hosting_site_options_alter in modules/hosting/web_server/ssl/hosting_ssl.nodeapi.inc
hosting_ssl_site_form in modules/hosting/web_server/ssl/hosting_ssl.nodeapi.inc

File

modules/hosting/web_server/ssl/hosting_ssl.nodeapi.inc, line 269

Code

function hosting_ssl_get_keys($client = null, $ask_custom = FALSE) {
  $keys = array();
  if ($ask_custom == TRUE) {
    $keys[HOSTING_SSL_CUSTOM_KEY] = t("Generate a new encryption key.");
  }
  $args = array();
  $query = "SELECT cid, ssl_key FROM {hosting_ssl_cert}";
  if (!is_null($client)) {
    $client = hosting_get_client($client);
    if ($client) {
      $query .= " WHERE client = %d";
      $args[] = $client->nid;
    }
  }
  $result = db_query($query, $args);
  while ($obj = db_fetch_object($result)) {
    if (sizeof($obj->ssl_key)) {
      $keys[$obj->cid] = $obj->ssl_key;
    }
  }
  return $keys;
}