I applied some 100% mechanical refactorings to your code plus a minor fixes. I haven't tested this, I just formatted and compacted the code and made a minor fix that could be the cause of your issue. This code is equivalent except for the qa_redirect_base line:
function qa_redirect($request, $params = null, $rooturl = null, $neaturls = null, $anchor = null) {
$qa_page = qa_request_part(0);
if ($qa_page === 'register') {
$to_page = qa_get('to');
$params = isset($to_page) ? array('to' => $to_page) : null;
$url = qa_path('thePageThatIwant', $params, null, null, null);
header('Location: ' . $url);
qa_exit('redirect');
} else {
return qa_redirect_base($request, $params, $rooturl, $neaturls, $anchor);
}
}
Notes:
1. Including qa-base.php is never needed
2. When calling a function, parameters are evaluated before the call so this:
return qa_redirect_base($request, $params=null, $rooturl=null, $neaturls=null, $anchor=null);
Is actually assigning null to each parameter and THEN calling the function so basically you're calling this function like this:
return qa_redirect_base($request, null, null, null, null);
Hence, losing all parameters. So it makes sense that, e.g., in pages that are not the register one and require parameters you might have issues because you're removing all the parameters you receive.
Remember I don't know if my code there is what you expect, but I'm pretty sure yours is not :)