Skip to content
Snippets Groups Projects
Commit 5f133568 authored by Eric Rasmussen's avatar Eric Rasmussen
Browse files

Merge remote-tracking branch 'tsteiner2/issue-526' into issue-526

parents 47625812 dfae2b38
Branches
No related tags found
No related merge requests found
...@@ -839,12 +839,22 @@ function unl_page_alias_create($form, &$form_state) { ...@@ -839,12 +839,22 @@ function unl_page_alias_create($form, &$form_state) {
* Form Validate: Create New Page Alias * Form Validate: Create New Page Alias
*/ */
function unl_page_alias_create_validate($form, &$form_state) { function unl_page_alias_create_validate($form, &$form_state) {
if ($form_state['values']['from_uri'] == $form_state['values']['to_uri']) { $form_state['values']['from_uri'] = trim($form_state['values']['from_uri']);
form_set_error('', t('From URL cannot equal To URL.')); $form_state['values']['to_uri'] = trim($form_state['values']['to_uri']);
}
if ($form_state['values']['from_uri'] == url('', array('https' => FALSE)) || $from = $form_state['values']['from_uri'];
$form_state['values']['from_uri'] == str_replace('http://', 'https://', url('', array('https' => FALSE)))) { $to = $form_state['values']['to_uri'];
form_set_error('', t('From URL cannot be the root of the default site.')); $root = url('', array('absolute' => TRUE));
if (parse_url($from, PHP_URL_HOST) == parse_url($to, PHP_URL_HOST) &&
parse_url($from, PHP_URL_PATH) == parse_url($to, PHP_URL_PATH) &&
parse_url($from, PHP_URL_QUERY) == parse_url($to, PHP_URL_QUERY)) {
form_set_error('to_uri', 'From URL cannot equal To URL.');
}
if (parse_url($from, PHP_URL_HOST) == parse_url($root, PHP_URL_HOST) &&
parse_url($from, PHP_URL_PATH) == parse_url($root, PHP_URL_PATH) &&
parse_url($from, PHP_URL_QUERY) == parse_url($root, PHP_URL_QUERY)) {
form_set_error('from_uri', 'From URL cannot be the root of the default site.');
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment