You are here

function radioactivity_http_port_edit_submit in Radioactivity 5

File

plugins/radioactivity_http.module, line 264

Code

function radioactivity_http_port_edit_submit($form_id, $form) {
  $ports = _radioactivity_http_get_ports();
  $port_id = $form['port_id'];
  if ($port_id == 'new') {

    // search new port id
    if (count($ports)) {
      $port_ids = array_keys($ports);
      sort($port_ids, SORT_NUMERIC);
      $port_id = 1 + $port_ids[count($ports) - 1];
    }
    else {
      $port_id = 1;
    }
  }
  $ports[$port_id] = array(
    'path' => $form['path'],
    'security_scheme' => $form['security_scheme'],
    'private_key' => $form['private_key'],
    'access_method' => $form['access_method'],
    'exposed_methods' => $form['exposed_methods'],
    'return' => $form['return'],
  );
  drupal_set_message(t('Saved port %id', array(
    '%id' => $port_id,
  )));
  variable_set('radioactivity_http_ports', $ports);
  if ($form['op'] == t('Save and edit')) {
    drupal_goto('admin/settings/radioactivity/http_port/' . $port_id);
  }
  else {
    drupal_goto('admin/settings/radioactivity/http_ports');
  }
}