You are here

function bakery_settings_submit in Bakery Single Sign-On System 6.2

Same name and namespace in other branches
  1. 6 bakery.module \bakery_settings_submit()
  2. 7.4 bakery.module \bakery_settings_submit()
  3. 7.2 bakery.module \bakery_settings_submit()
  4. 7.3 bakery.pages.inc \bakery_settings_submit()
1 string reference to 'bakery_settings_submit'
bakery_settings in ./bakery.module
Admin settings, see INSTALL.txt

File

./bakery.module, line 563

Code

function bakery_settings_submit($form, &$form_state) {

  // Rebuild the menu because the router items are based on the selection of
  // the master site.
  menu_rebuild();

  // Updating of data on slave sites will not work unless the url of the master site has a trailing slash.
  // We now remove the trailing slash (if present) and concatenate with a new trailing slash.
  $form_state['values']['bakery_master'] = trim($form_state['values']['bakery_master'], '/') . '/';

  // The list of slave sites needs transforming from a text string into array for storage.
  // Also, redirection after login will only work if there is a trailing slash after each entry.
  if ($form_state['values']['bakery_slaves']) {

    // Transform the text string into an array.
    $form_state['values']['bakery_slaves'] = explode("\n", trim(str_replace("\r", '', $form_state['values']['bakery_slaves'])));

    // For each entry, remove the trailing slash (if present) and concatenate with a new trailing slash.
    foreach ($form_state['values']['bakery_slaves'] as &$slave) {
      $slave = trim($slave, '/') . '/';
    }
  }
  else {
    $form_state['values']['bakery_slaves'] = array();
  }
}