You are here

function backup_migrate_destination_nodesquirrel::edit_form_validate in Backup and Migrate 7.2

Same name and namespace in other branches
  1. 8.3 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form_validate()
  2. 6.3 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form_validate()
  3. 6.2 includes/destinations.nodesquirrel.inc \backup_migrate_destination_nodesquirrel::edit_form_validate()

Submit the configuration form. Glue the url together and add the old password back if a new one was not specified.

Overrides backup_migrate_item::edit_form_validate

File

includes/destinations.nodesquirrel.inc, line 348
Functions to handle the NodeSquirrel backup destination.

Class

backup_migrate_destination_nodesquirrel
A destination for sending database backups to the NodeSquirel backup service.

Code

function edit_form_validate($form, &$form_state) {
  $key = trim($form_state['values']['settings']['secret_key']);
  if ($key) {
    if (!preg_match(NODESQUIRREL_SECRET_KEY_PATTERN, $key)) {
      form_set_error('secret_key', 'The secret key you entered is not the right format. Please make sure you copy it exactly.');
      return;
    }
    $this->settings['secret_key'] = check_plain($key);
    $limits = $this
      ->check_limits();
    if (!$limits) {
      $err = xmlrpc_error();
      if (!empty($err->code) && $err->code == '401') {
        form_set_error('user', 'Could not login to server. Please check that your secret key is correct.');
      }
      else {
        form_set_error('', 'There was an error retrieving the specified site. Please check that your secret key is correct.');
      }
    }
  }
}