{
global $auth_method_type, $auth_users, $_msg_auth, $auth_user, $auth_groups;
global $auth_user_groups, $auth_type, $g_query_string;
- global $auth_external_login_url;
// Checked by:
$target_str = '';
if ($auth_method_type == 'pagename') {
} elseif (AUTH_TYPE_FORM === $auth_type) {
$url_after_login = get_script_uri() . '?' . $g_query_string;
$loginurl = get_script_uri() . '?plugin=loginform'
- . '&page=' . pagename_urlencode($page)
+ . '&page=' . rawurlencode($page)
. '&url_after_login=' . rawurlencode($url_after_login);
header('HTTP/1.0 302 Found');
header('Location: ' . $loginurl);
} elseif (AUTH_TYPE_EXTERNAL === $auth_type) {
$url_after_login = get_script_uri() . '?' . $g_query_string;
- $loginurl = $auth_external_login_url . '?'
- . '&page=' . pagename_urlencode($page)
- . '&url_after_login=' . rawurlencode($url_after_login);
+ $loginurl = get_auth_external_login_url($page, $url_after_login);
header('HTTP/1.0 302 Found');
header('Location: ' . $loginurl);
}
header('Location: ' . $url);
}
}
+
+/**
+ * Get External Auth log-in URL
+ */
+function get_auth_external_login_url($page, $url_after_login) {
+ global $auth_external_login_url_base;
+ $sep = '&';
+ if (strpos($auth_external_login_url_base, '?') === FALSE) {
+ $sep = '?';
+ }
+ $url = $auth_external_login_url_base . $sep
+ . 'page=' . rawurlencode($page)
+ . '&url_after_login=' . rawurlencode($url_after_login);
+ return $url;
+}
$enable_login = false;
$enable_logout = false;
- if (AUTH_TYPE_FORM === $auth_type) {
+ if (AUTH_TYPE_FORM === $auth_type || AUTH_TYPE_EXTERNAL === $auth_type) {
if ($auth_user) {
$enable_logout = true;
} else {
$_LINK['top'] = "$script?" . pagename_urlencode($defaultpage);
$_LINK['unfreeze'] = "$script?cmd=unfreeze&page=$r_page";
$_LINK['upload'] = "$script?plugin=attach&pcmd=upload&page=$r_page";
- $_LINK['login'] = "$script?plugin=loginform&pcmd=login&page=$r_page";
+ switch ($auth_type) {
+ case AUTH_TYPE_FORM:
+ $login_link = "$script?plugin=loginform&pcmd=login&page=$r_page";
+ break;
+ case AUTH_TYPE_EXTERNAL:
+ $login_link = get_auth_external_login_url($_page, $_LINK['reload']);
+ break;
+ }
+ $_LINK['login'] = htmlsc($login_link);
$_LINK['logout'] = "$script?plugin=loginform&pcmd=logout&page=$r_page";
// Compat: Skins for 1.4.4 and before
// Authentication type
// AUTH_TYPE_FORM, AUTH_TYPE_BASIC or AUTH_TYPE_EXTERNAL
// $auth_type = AUTH_TYPE_FORM;
-// $auth_external_login_url = './exlogin.php';
+// $auth_external_login_url_base = './exlogin.php';
/////////////////////////////////////////////////
// Authentication method