function bakery_settings_submit in Bakery Single Sign-On System 6
Same name and namespace in other branches
- 6.2 bakery.module \bakery_settings_submit()
- 7.4 bakery.module \bakery_settings_submit()
- 7.2 bakery.module \bakery_settings_submit()
- 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 298
Code
function bakery_settings_submit($form, &$form_state) {
db_query("DELETE FROM {url_alias} WHERE src = 'bakery' AND dst IN ('user/login', 'user/register')");
if (!$form_state['values']['bakery_is_master']) {
// Add URL aliases to bakery
$aliases = array(
array(
'src' => 'bakery',
'dst' => 'user/login',
),
array(
'src' => 'bakery',
'dst' => 'user/register',
),
);
foreach ($aliases as $alias) {
drupal_write_record('url_alias', $alias);
}
}
// 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();
}
}