function urllogin_test_page in urllogin 7
Same name and namespace in other branches
- 6 urllogin.inc \urllogin_test_page()
Diagnostic test page for setting up urllogin urls.
Parameters
$urlstring: login string from URL
Return value
Page containing test results
1 string reference to 'urllogin_test_page'
- urllogin_menu in ./
urllogin.module - Implements hook_menu().
File
- ./
urllogin.inc, line 181
Code
function urllogin_test_page($urlstring = 'none') {
$urlstr = check_plain($urlstring);
// sanitize
$page = "<ul><li>Initial URL string = [{$urlstr}]</li>";
$resultmsg = "";
$uid = urllogin_decode($urlstr, variable_get('urllogin_codekey', 20110531), variable_get('urllogin_codemin', 20110531), urllogin_passphrase(), $resultmsg);
if ($uid > -1) {
$account = _urllogin_testuid($uid, $resultmsg);
}
else {
$account = NULL;
}
if ($account != NULL) {
// find where to go: get rid of first two arguments and use the rest of the URL as the destination
$args = arg();
unset($args[0]);
unset($args[1]);
$goto = implode('/', $args);
// maintain the original query string
$query = $_GET;
unset($query['q']);
if (count($query) > 0) {
$goto .= '?' . implode('&', $query);
}
// Check in case this user is already logged in
global $user;
if ($user->uid == $uid) {
// test if user already logged in
$resultmsg = t('User %username (%uid) was already logged in. Redirected to: %goto', array(
'%username' => $account->name,
'%uid' => $uid,
'%goto' => $goto,
));
}
else {
$resultmsg = t('Logging in as %username (%uid). Redirected to: %goto', array(
'%username' => $account->name,
'%uid' => $uid,
'%goto' => $goto,
));
}
// get rid of first two arguments and use the rest of the URL as the destination
$page .= "<li>{$resultmsg}</li><li>goto: {$goto}</li></ul>";
return $page;
}
$page .= "<li>{$resultmsg}</li></ul>";
return $page;
}