Commit d2602939 authored by Ruslan Kabalin's avatar Ruslan Kabalin
Browse files

Keep the redirection URL clean if search query is empty.



On pages where searching is done using search_submit function, make sure that
parameters with no value are not shown in the URL used in redirection.
Signed-off-by: default avatarRuslan Kabalin <ruslan.kabalin@luns.net.uk>
parent 0579d182
......@@ -57,7 +57,7 @@ $searchform = pieform(array(
));
function search_submit(Pieform $form, $values) {
redirect(get_config('wwwroot') . 'admin/groups/groups.php?query=' . urlencode($values['query']));
redirect(get_config('wwwroot') . 'admin/groups/groups.php' . (!empty($values['query']) ? '?query=' . urlencode($values['query']) : ''));
}
$groups = search_group($query, $limit, $offset, 'all');
......
......@@ -158,7 +158,7 @@ $pagination = build_pagination(array(
));
function search_submit(Pieform $form, $values) {
redirect('/group/find.php?filter=' . $values['filter'] . (isset($values['query']) ? '&query=' . urlencode($values['query']) : '') . (!empty($values['groupcategory']) ? '&groupcategory=' . intval($values['groupcategory']) : ''));
redirect('/group/find.php?filter=' . $values['filter'] . (!empty($values['query']) ? '&query=' . urlencode($values['query']) : '') . (!empty($values['groupcategory']) ? '&groupcategory=' . intval($values['groupcategory']) : ''));
}
$smarty = smarty();
......
......@@ -94,7 +94,7 @@ $smarty->assign('form', $searchform);
$smarty->display('user/find.tpl');
function search_submit(Pieform $form, $values) {
redirect('/user/find.php' . (isset($values['query']) ? '?query=' . urlencode($values['query']) : ''));
redirect('/user/find.php' . (!empty($values['query']) ? '?query=' . urlencode($values['query']) : ''));
}
?>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment