You are here

hosting_ssl.module in Hostmaster (Aegir) 6

File

modules/hosting/web_server/ssl/hosting_ssl.module
View source
<?php

/**
 * SSL is disabled for this site.
 */
define('HOSTING_SSL_DISABLED', 0);

/**
 * SSL is enabled for this site.
 */
define('HOSTING_SSL_ENABLED', 1);

/**
 * SSL is required for this site.
 */
define('HOSTING_SSL_REQUIRED', 2);
include_once 'hosting_ssl.nodeapi.inc';
function hosting_ssl_hosting_service() {
  return array(
    'apache_ssl' => 'http',
  );
}

/**
 * Implementation of hook_perm()
 */
function hosting_ssl_perm() {
  return array(
    'administer ssl',
  );
}

/**
 * Return a list of servers which have SSL enabled web services.
 */
function hosting_ssl_get_servers() {
  $servers = hosting_get_servers('http');
  $ssl_servers = array();
  foreach ($servers as $nid => $title) {
    $node = node_load($nid);
    if ($node->services['http']->ssl_enabled) {
      $ssl_servers[] = $nid;
    }
  }
  return $ssl_servers;
}

/**
 * Return a list of platforms on SSL enabled servers.
 */
function hosting_ssl_get_platforms() {
  $servers = hosting_ssl_get_servers();
  $ssl_platforms = array();
  $platforms = _hosting_get_platforms();
  foreach ($platforms as $nid => $title) {
    $platform = node_load($nid);
    if (in_array($platform->web_server, $servers)) {
      $ssl_platforms[] = $nid;
    }
  }
  return $ssl_platforms;
}

/**
 * Return a list of profiles with SSL enabled platforms.
 */
function hosting_ssl_get_profiles() {
  $platforms = hosting_ssl_get_platforms();
  $ssl_profiles = array();
  foreach ($platforms as $nid) {
    $platform = node_load($nid);
    $ssl_profiles = array_merge($ssl_profiles, array_keys($platform->profiles));
  }
  return array_unique($ssl_profiles);
}
function hosting_ssl_form_alter(&$form, &$form_state, $form_id) {
  if ($form_id == 'site_node_form') {
    hosting_ssl_site_form($form, $form_state, $form_id);
  }
}

Functions

Namesort descending Description
hosting_ssl_form_alter
hosting_ssl_get_platforms Return a list of platforms on SSL enabled servers.
hosting_ssl_get_profiles Return a list of profiles with SSL enabled platforms.
hosting_ssl_get_servers Return a list of servers which have SSL enabled web services.
hosting_ssl_hosting_service
hosting_ssl_perm Implementation of hook_perm()

Constants

Namesort descending Description
HOSTING_SSL_DISABLED SSL is disabled for this site.
HOSTING_SSL_ENABLED SSL is enabled for this site.
HOSTING_SSL_REQUIRED SSL is required for this site.