Index: hosting.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/hosting/hosting.module,v
retrieving revision 1.107
diff -u -p -r1.107 hosting.module
--- hosting.module	20 Aug 2009 14:03:02 -0000	1.107
+++ hosting.module	23 Aug 2009 12:55:14 -0000
@@ -356,6 +356,10 @@ function hosting_format_interval($ts) {
   if ($ts==mktime()) { 
     return t('Now');
   }
+  if ($ts == -1) {
+    // If -1, a task has been attempted but has failed
+    return t('Last verification failed.');
+  }
   if (!$ts) {
     //Treats EPOCH as never
     return t('Never');
Index: platform/hosting_platform.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/hosting/platform/hosting_platform.module,v
retrieving revision 1.56
diff -u -p -r1.56 hosting_platform.module
--- platform/hosting_platform.module	13 Jul 2009 09:19:14 -0000	1.56
+++ platform/hosting_platform.module	23 Aug 2009 12:55:14 -0000
@@ -76,6 +76,18 @@ function _hosting_get_platforms() {
 }
 
 /**
+ * Small helper function to get only verified platforms.
+*/
+function _hosting_get_verified_platforms() {
+  $return = array();
+  $result = db_query("SELECT n.nid, n.title FROM {node} n LEFT JOIN {hosting_platform} p ON p.nid = n.nid WHERE n.type='platform' AND n.status=1 AND p.verified > 0");
+  while($server = db_fetch_object($result)) {
+    $return[$server->nid] = $server->title;
+  }
+  return $return;
+}
+
+/**
  * Implementation of hook_form().
  */
 function hosting_platform_form(&$node) {
Index: site/hosting_site.drush.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/hosting/site/hosting_site.drush.inc,v
retrieving revision 1.6
diff -u -p -r1.6 hosting_site.drush.inc
--- site/hosting_site.drush.inc	28 May 2009 05:54:43 -0000	1.6
+++ site/hosting_site.drush.inc	23 Aug 2009 12:55:14 -0000
@@ -135,7 +135,12 @@ function hosting_site_post_hosting_verif
 function hosting_site_hosting_verify_task_rollback($task, $data) {
   if ($task->ref->type == 'site') {
     $task->ref->no_verify = TRUE;
-    $task->ref->verified = 0;
+    $task->ref->verified = -1;
+    node_save($task->ref);
+  }
+  if ($task->ref->type == 'platform') {
+    $task->ref->no_verify = TRUE;
+    $task->ref->verified = -1;
     node_save($task->ref);
   }
 }
Index: site/hosting_site.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/hosting/site/hosting_site.module,v
retrieving revision 1.109
diff -u -p -r1.109 hosting_site.module
--- site/hosting_site.module	20 Jul 2009 15:13:57 -0000	1.109
+++ site/hosting_site.module	23 Aug 2009 12:55:15 -0000
@@ -203,6 +203,8 @@ function hosting_site_form($node) {
   $form['#pre_render'][] = '_hosting_site_form_pre_render';
 
   $type = node_get_types('type', $node);
+  // Get the list of verified platforms
+  $platforms = _hosting_get_verified_platforms();
 
   if ($node->nid) {
     $form['info']['#prefix'] = '<div class="clear-block" id="hosting-site-edit-info">';
@@ -217,6 +219,10 @@ function hosting_site_form($node) {
       '#default_value' => $node->title,
       '#weight' => -5
     );
+    if (empty($platforms)) {
+      // Warn the error a new site creation can't happen due to no verified sites.
+      form_set_error('title', t('You cannot create a new site because you have no verified platforms.'));
+    }
   }
   else {
     $form['info']['title'] = array(
@@ -287,22 +293,24 @@ function hosting_site_form($node) {
   }
 
   if (!$node->nid) {
-    $platforms = _hosting_get_platforms();
-    if (sizeof($platforms) > 1) {
-      $form['platform'] = array(
-        '#type' => 'radios',
-        '#title' => t('Platform'),
-        '#required' => TRUE,
-        '#description' => t('The platform you want the site to be hosted on.'),
-        '#options' => $platforms,
-        '#default_value' => HOSTING_DEFAULT_PLATFORM,
-      );
-    }
-    else {
-      $form['platform'] = array('#type' => 'hidden', '#value' => key($platforms));
+    if (!empty($platforms)) {
+      // If there is more than one verified platform, offer a list.
+      if (sizeof($platforms) > 1) {
+        $form['platform'] = array(
+          '#type' => 'radios',
+          '#title' => t('Platform'),
+          '#required' => TRUE,
+          '#description' => t('The platform you want the site to be hosted on. Unverified platforms will not be shown.'),
+          '#options' => $platforms,
+          '#default_value' => HOSTING_DEFAULT_PLATFORM,
+        );
+      }
+      else {
+        $form['platform'] = array('#type' => 'hidden', '#value' => key($platforms));
+      }
+      $form['profile'] = _hosting_site_form_profile();
+      $form['site_language'] = _hosting_site_form_site_language();
     }
-    $form['profile'] = _hosting_site_form_profile();
-    $form['site_language'] = _hosting_site_form_site_language();
   }
   else {
     $form['info']['platform'] = array(
@@ -358,27 +366,38 @@ function hosting_site_form($node) {
 function hosting_site_validate($node, &$form) {
   global $user;
   $url = strtolower($node->title); // domain names are case-insensitive
-  if (!_hosting_valid_fqdn($url)) {
-    form_set_error('title', t("You have not specified a valid url for this site."));
+  /**
+   * Run the bulk of the sanity checks only if there was a valid platform. 
+   * The user should not have submitted if not anyway, but in case they 
+   * did, don't send back errors relating to the other fields.
+   */
+  $platforms = _hosting_get_verified_platforms();
+  if (empty($platforms)) {
+    form_set_error('title', t('You cannot create a new site because you have no verified platforms.'));
   }
-  # TODO: maybe we should allow creation of sites that conflict with HOSTING_SITE_DISABLED (which would then need to be renamed before being re-enabled)
-  if (hosting_site_exists($url, $node->nid)) {
-    form_set_error('title', t("The domain name you have specified is not unique."));
-  }
-  if (!$node->new_client) {
-    $client = hosting_get_client($node->client);
-    if (!$node->client || !$client) {
-      form_set_error('client', t('Please fill in a valid client'));
+  else {
+    if (!_hosting_valid_fqdn($url)) {
+      form_set_error('title', t("You have not specified a valid url for this site."));
     }
-    if (!user_access('administer clients') && !array_key_exists($client->nid, hosting_get_client_from_user($user->uid))) {
-      form_set_error('client', t('Access denied to client @client', array('@client' => $client->title)));
+    # TODO: maybe we should allow creation of sites that conflict with HOSTING_SITE_DISABLED (which would then need to be renamed before being re-enabled)
+    if (hosting_site_exists($url, $node->nid)) {
+      form_set_error('title', t("The domain name you have specified is not unique."));
+    }
+    if (!$node->new_client) {
+      $client = hosting_get_client($node->client);
+      if (!$node->client || !$client) {
+        form_set_error('client', t('Please fill in a valid client'));
+      }
+      if (!user_access('administer clients') && !array_key_exists($client->nid, hosting_get_client_from_user($user->uid))) {
+        form_set_error('client', t('Access denied to client @client', array('@client' => $client->title)));
+      }
+    }
+    if (!array_key_exists($node->profile, hosting_get_profiles($node->platform))) {
+      form_set_error('profile', t('Please fill in a valid profile'));
+    }
+    if (!array_key_exists($node->site_language, hosting_get_profile_languages($node->profile, $node->platform))) {
+      form_set_error('site_language', t('Please fill in a valid language'));
     }
-  }
-  if (!array_key_exists($node->profile, hosting_get_profiles($node->platform))) {
-    form_set_error('profile', t('Please fill in a valid profile'));
-  }
-  if (!array_key_exists($node->site_language, hosting_get_profile_languages($node->profile, $node->platform))) {
-    form_set_error('site_language', t('Please fill in a valid language'));
   }
 
 }
