function hosting_ssl_hosting_site_options_alter in Hostmaster (Aegir) 6
File
- modules/
hosting/ web_server/ ssl/ hosting_ssl.nodeapi.inc, line 54
Code
function hosting_ssl_hosting_site_options_alter(&$return, $node) {
// Disable the ssl key fields by default.
if (!sizeof(hosting_ssl_get_servers())) {
$return['ssl_enabled'] = FALSE;
}
$return['ssl_key'] = false;
$return['ssl_key_new'] = false;
// Test if ssl has been enabled.
if ($node->ssl_enabled != 0) {
$keys = hosting_ssl_get_keys($node->client, TRUE);
// return the list of valid keys, including the special 'new key' option.
$return['ssl_key'] = array_keys($keys);
// properly default this value so things dont fall apart later.
if (sizeof($return['ssl_key']) == 1) {
$node->ssl_key = HOSTING_SSL_CUSTOM_KEY;
}
// the user has chosen to enter a new key
if ($node->ssl_key == HOSTING_SSL_CUSTOM_KEY) {
// default the new key to the site's domain name, after filtering.
$default = hosting_ssl_filter_key($node->title);
$return['ssl_key_new'] = !empty($default) ? $default : true;
}
// we need to ensure that the return value is properly indexed, otherwise it
// gets interpreted as an object by jquery.
$return['profile'] = array_values(array_intersect($return['profile'], hosting_ssl_get_profiles()));
$return['platform'] = array_values(array_intersect($return['platform'], hosting_ssl_get_platforms()));
}
}