You are here

function hosting_ssl_get_keys in Hosting 6.2

Same name and namespace in other branches
  1. 7.4 web_server/ssl/hosting_ssl.nodeapi.inc \hosting_ssl_get_keys()
  2. 7.3 web_server/ssl/hosting_ssl.nodeapi.inc \hosting_ssl_get_keys()

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 site/hosting_site.api.php
hosting_ssl_hosting_site_options_alter in web_server/ssl/hosting_ssl.nodeapi.inc
hosting_ssl_site_form in web_server/ssl/hosting_ssl.nodeapi.inc

File

web_server/ssl/hosting_ssl.nodeapi.inc, line 293

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;
}