mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Enable redirect after login
git-svn-id: file:///svn/phpbb/trunk@4768 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
0608bc73e6
commit
c2f5e580aa
3 changed files with 33 additions and 20 deletions
|
@ -938,10 +938,12 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
|
||||||
$err = '';
|
$err = '';
|
||||||
if (isset($_POST['login']))
|
if (isset($_POST['login']))
|
||||||
{
|
{
|
||||||
$autologin = (!empty($_POST['autologin'])) ? TRUE : FALSE;
|
$username = request_var('username', '');
|
||||||
|
$password = request_var('password', '');
|
||||||
|
$autologin = (!empty($_POST['autologin'])) ? TRUE : FALSE;
|
||||||
$viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
|
$viewonline = (!empty($_POST['viewonline'])) ? 0 : 1;
|
||||||
|
|
||||||
if (($result = $auth->login($_POST['username'], $_POST['password'], $autologin, $viewonline)) === true)
|
if (($result = $auth->login($username, $password, $autologin, $viewonline)) === true)
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// Force change password ... plugin for EVENT_LOGIN in future
|
// Force change password ... plugin for EVENT_LOGIN in future
|
||||||
|
@ -960,6 +962,8 @@ function login_box($s_action, $s_hidden_fields = '', $login_explain = '')
|
||||||
$err = ($result === 0) ? $user->lang['ACTIVE_ERROR'] : $user->lang['LOGIN_ERROR'];
|
$err = ($result === 0) ? $user->lang['ACTIVE_ERROR'] : $user->lang['LOGIN_ERROR'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$s_hidden_fields = (!empty($_SERVER['HTTP_REFERER'])) ? '<input type="hidden" name="redirect" value="' . htmlspecialchars($_SERVER['HTTP_REFERER']) . '" />' : '';
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
'LOGIN_ERROR' => $err,
|
'LOGIN_ERROR' => $err,
|
||||||
'LOGIN_EXPLAIN' => $login_explain,
|
'LOGIN_EXPLAIN' => $login_explain,
|
||||||
|
|
|
@ -219,16 +219,19 @@ $lang = array(
|
||||||
'REPLY_TO_TOPIC' => 'Reply to topic',
|
'REPLY_TO_TOPIC' => 'Reply to topic',
|
||||||
'REPLY_WITH_QUOTE' => 'Reply with quote',
|
'REPLY_WITH_QUOTE' => 'Reply with quote',
|
||||||
|
|
||||||
'RETURN_INDEX' => 'Click %sHere%s to return to the index',
|
'RETURN_INDEX' => 'Click %sHere%s to return to the index',
|
||||||
'RETURN_TOPIC' => 'Click %sHere%s to return to the topic',
|
'RETURN_TOPIC' => 'Click %sHere%s to return to the topic',
|
||||||
'RETURN_POST' => 'Click %sHere%s to return to the post',
|
'RETURN_POST' => 'Click %sHere%s to return to the post',
|
||||||
'RETURN_FORUM' => 'Click %sHere%s to return to the forum',
|
'RETURN_FORUM' => 'Click %sHere%s to return to the forum',
|
||||||
'RETURN_LOGIN' => 'Click %sHere%s to try again',
|
'RETURN_LOGIN' => 'Click %sHere%s to try again',
|
||||||
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
|
'RETURN_MCP' => 'Click %sHere%s to return to the Moderator Control Panel',
|
||||||
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
|
'RETURN_GROUP' => 'Click %sHere%s to return to the Group Control Panel',
|
||||||
'RETURN_UCP' => 'Click %sHere%s to return to the User Control Panel',
|
'RETURN_UCP' => 'Click %sHere%s to return to the User Control Panel',
|
||||||
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
|
'VIEW_MESSAGE' => 'Click %sHere%s to view your message',
|
||||||
'URL_REDIRECT' => 'If your browser does not support meta redirection please click %sHERE%s to be redirected.',
|
'RETURN_PAGE' => 'Click %sHere%s to return to the previous page',
|
||||||
|
'LOGIN_REDIRECT' => 'You have been successfully logged in.',
|
||||||
|
'LOGOUT_REDIRECT' => 'You have been successfully logged out.',
|
||||||
|
'URL_REDIRECT' => 'If your browser does not support meta redirection please click %sHERE%s to be redirected.',
|
||||||
|
|
||||||
'INFORMATION' => 'Information',
|
'INFORMATION' => 'Information',
|
||||||
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable',
|
'BOARD_DISABLE' => 'Sorry but this board is currently unavailable',
|
||||||
|
|
|
@ -15,7 +15,6 @@
|
||||||
//
|
//
|
||||||
// * Registration
|
// * Registration
|
||||||
// * Link to (additional?) registration conditions
|
// * Link to (additional?) registration conditions
|
||||||
// * Admin forced revalidation of given user/s from ACP
|
|
||||||
|
|
||||||
// * Opening tab:
|
// * Opening tab:
|
||||||
// * Last visit time
|
// * Last visit time
|
||||||
|
@ -25,9 +24,6 @@
|
||||||
// * Unread PM counter
|
// * Unread PM counter
|
||||||
// * Link/s to MCP if applicable?
|
// * Link/s to MCP if applicable?
|
||||||
|
|
||||||
// * Black and White lists
|
|
||||||
// * Mark posts/PM's of buddies different colour?
|
|
||||||
|
|
||||||
// * PM system
|
// * PM system
|
||||||
// * See privmsg
|
// * See privmsg
|
||||||
|
|
||||||
|
@ -278,7 +274,12 @@ switch ($mode)
|
||||||
|
|
||||||
define('IN_LOGIN', true);
|
define('IN_LOGIN', true);
|
||||||
login_box("ucp.$phpEx$SID&mode=login");
|
login_box("ucp.$phpEx$SID&mode=login");
|
||||||
redirect("index.$phpEx$SID");
|
|
||||||
|
$redirect = request_var('redirect', "index.$phpEx$SID");
|
||||||
|
meta_refresh(3, $redirect);
|
||||||
|
|
||||||
|
$message = $user->lang['LOGIN_REDIRECT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a> ');
|
||||||
|
trigger_error($message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'logout':
|
case 'logout':
|
||||||
|
@ -287,13 +288,17 @@ switch ($mode)
|
||||||
$user->destroy();
|
$user->destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
redirect("index.$phpEx$SID");
|
$redirect = (!empty($_SERVER['HTTP_REFERER'])) ? htmlspecialchars($_SERVER['HTTP_REFERER']) : "index.$phpEx$SID";
|
||||||
|
meta_refresh(3, $redirect);
|
||||||
|
|
||||||
|
$message = $user->lang['LOGOUT_REDIRECT'] . '<br /><br />' . sprintf($user->lang['RETURN_PAGE'], '<a href="' . $redirect . '">', '</a> ');
|
||||||
|
trigger_error($message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Only registered users can go beyond this point
|
// Only registered users can go beyond this point
|
||||||
if ($user->data['user_type'] == USER_INACTIVE || $user->data['user_type'] == USER_IGNORE)
|
if ($user->data['user_id'] == ANONYMOUS || $user->data['user_type'] == USER_INACTIVE || $user->data['user_type'] == USER_IGNORE)
|
||||||
{
|
{
|
||||||
redirect("index.$phpEx");
|
redirect("index.$phpEx");
|
||||||
}
|
}
|
||||||
|
@ -305,6 +310,8 @@ obtain_word_list($censors);
|
||||||
|
|
||||||
|
|
||||||
// Output listing of friends online
|
// Output listing of friends online
|
||||||
|
$update_time = $config['load_online_time'] * 60;
|
||||||
|
|
||||||
$sql = 'SELECT DISTINCT u.user_id, u.username, MAX(s.session_time) as online_time, MIN(s.session_allow_viewonline) AS viewonline
|
$sql = 'SELECT DISTINCT u.user_id, u.username, MAX(s.session_time) as online_time, MIN(s.session_allow_viewonline) AS viewonline
|
||||||
FROM ((' . ZEBRA_TABLE . ' z
|
FROM ((' . ZEBRA_TABLE . ' z
|
||||||
LEFT JOIN ' . SESSIONS_TABLE . ' s ON s.session_user_id = z.zebra_id), ' . USERS_TABLE . ' u)
|
LEFT JOIN ' . SESSIONS_TABLE . ' s ON s.session_user_id = z.zebra_id), ' . USERS_TABLE . ' u)
|
||||||
|
@ -314,7 +321,6 @@ $sql = 'SELECT DISTINCT u.user_id, u.username, MAX(s.session_time) as online_tim
|
||||||
GROUP BY z.zebra_id';
|
GROUP BY z.zebra_id';
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$update_time = $config['load_online_time'] * 60;
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$which = (time() - $update_time < $row['online_time']) ? 'online' : 'offline';
|
$which = (time() - $update_time < $row['online_time']) ? 'online' : 'offline';
|
||||||
|
|
Loading…
Add table
Reference in a new issue