Enable per session view online, change layout, potential for links to terms and privacy policy

git-svn-id: file:///svn/phpbb/trunk@3623 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-03-09 16:11:08 +00:00
parent cd9b3af2b5
commit 5cdf2b0b59
7 changed files with 138 additions and 116 deletions

View file

@ -39,7 +39,7 @@ if ($config['gzip_compress'])
if ($user->data['user_id'] != ANONYMOUS) if ($user->data['user_id'] != ANONYMOUS)
{ {
$u_login_logout = 'login.'.$phpEx. $SID . '&logout=true'; $u_login_logout = 'login.'.$phpEx. $SID . '&logout=true';
$l_login_logout = $user->lang['LOGOUT'] . ' [ ' . $user->data['username'] . ' ]'; $l_login_logout = sprintf($user->lang['LOGOUT_USER'], $user->data['username']);
} }
else else
{ {
@ -66,7 +66,7 @@ if (!empty($_REQUEST['f']))
$reading_sql = 'AND s.session_page LIKE \'%f=' . intval($_REQUEST['f']) . '%\''; $reading_sql = 'AND s.session_page LIKE \'%f=' . intval($_REQUEST['f']) . '%\'';
} }
$sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip $sql = "SELECT u.username, u.user_id, u.user_allow_viewonline, u.user_colour, s.session_ip, s.session_allow_viewonline
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE ." s
WHERE s.session_time >= " . (time() - 300) . " WHERE s.session_time >= " . (time() - 300) . "
$reading_sql $reading_sql
@ -87,19 +87,20 @@ while ($row = $db->sql_fetchrow($result))
$row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>'; $row['username'] = '<b style="color:#' . $row['user_colour'] . '">' . $row['username'] . '</b>';
} }
if ($row['user_allow_viewonline']) if ($row['user_allow_viewonline'] && $row['session_allow_viewonline'])
{ {
$user_online_link = '<a href="' . "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $row['username'] . '</a>'; $user_online_link = $row['username'];
$logged_visible_online++; $logged_visible_online++;
} }
else else
{ {
$user_online_link = '<a href="' . "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '"><i>' . $row['username'] . '</i></a>'; $user_online_link = '<i>' . $row['username'] . '</i>';
$logged_hidden_online++; $logged_hidden_online++;
} }
if ($row['user_allow_viewonline'] || $auth->acl_get('a_')) if ($row['user_allow_viewonline'] || $auth->acl_get('a_'))
{ {
$user_online_link = '<a href="' . "memberlist.$phpEx$SID&amp;mode=viewprofile&amp;u=" . $row['user_id'] . '">' . $user_online_link . '</a>';
$online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link;
} }
} }

View file

@ -130,7 +130,7 @@ class session
} }
// Create a new session // Create a new session
function create(&$user_id, &$autologin, $set_autologin = false) function create(&$user_id, &$autologin, $set_autologin = false, $viewonline = 1)
{ {
global $SID, $db, $config; global $SID, $db, $config;
@ -229,7 +229,7 @@ class session
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
$sql = "UPDATE " . SESSIONS_TABLE . " $sql = "UPDATE " . SESSIONS_TABLE . "
SET session_user_id = $user_id, session_last_visit = " . $this->data['session_last_visit'] . ", session_start = $current_time, session_time = $current_time, session_browser = '$this->browser', session_page = '$this->page' SET session_user_id = $user_id, session_last_visit = " . $this->data['session_last_visit'] . ", session_start = $current_time, session_time = $current_time, session_browser = '$this->browser', session_page = '$this->page', session_allow_viewonline = $viewonline
WHERE session_id = '" . $this->session_id . "'"; WHERE session_id = '" . $this->session_id . "'";
if (!$db->sql_query($sql) || !$db->sql_affectedrows()) if (!$db->sql_query($sql) || !$db->sql_affectedrows())
{ {
@ -237,8 +237,8 @@ class session
$this->session_id = md5(uniqid($user_ip)); $this->session_id = md5(uniqid($user_ip));
$sql = "INSERT INTO " . SESSIONS_TABLE . " $sql = "INSERT INTO " . SESSIONS_TABLE . "
(session_id, session_user_id, session_last_visit, session_start, session_time, session_ip, session_browser, session_page) (session_id, session_user_id, session_last_visit, session_start, session_time, session_ip, session_browser, session_page, session_allow_viewonline)
VALUES ('" . $this->session_id . "', $user_id, " . $this->data['session_last_visit'] . ", $current_time, $current_time, '$this->ip', '$this->browser', '$this->page')"; VALUES ('" . $this->session_id . "', $user_id, " . $this->data['session_last_visit'] . ", $current_time, $current_time, '$this->ip', '$this->browser', '$this->page', $viewonline)";
$db->sql_query($sql); $db->sql_query($sql);
} }
$db->sql_return_on_error(false); $db->sql_return_on_error(false);
@ -1196,7 +1196,7 @@ class auth
} }
// Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him. // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
function login($username, $password, $autologin = false) function login($username, $password, $autologin = false, $viewonline = 1)
{ {
global $config, $user, $phpbb_root_path, $phpEx; global $config, $user, $phpbb_root_path, $phpEx;
@ -1209,13 +1209,16 @@ class auth
$method = 'login_' . $method; $method = 'login_' . $method;
if (function_exists($method)) if (function_exists($method))
{ {
if (!($login = $method($username, $password))) $login = $method($username, $password);
// If login returned anything other than an array there was an error
if (!is_array($login))
{ {
return false; return $login;
} }
$autologin = (!empty($autologin)) ? md5($password) : ''; $autologin = (!empty($autologin)) ? md5($password) : '';
return ($login['user_active']) ? $user->create($login['user_id'], $autologin, true) : false; return ($login['user_active']) ? $user->create($login['user_id'], $autologin, true, $viewonline) : false;
} }
} }

View file

@ -214,29 +214,27 @@ $lang = array_merge($lang, array(
'Disallowed_groups' => 'Disallowed groups', 'Disallowed_groups' => 'Disallowed groups',
'Remove_selected' => 'Remove selected', 'Remove_selected' => 'Remove selected',
'Advanced' => 'Advanced', 'Advanced' => 'Advanced',
'Applies_to_User' => 'Applies to User ...', 'USER_CAN' => 'User can ... ',
'Applies_to_Group' => 'Applies to Group ...', 'GROUP_CAN' => 'Group can ... ',
'User_can' => 'User can ... ', 'OPTION' => 'Option',
'Group_can' => 'Group can ... ', 'ALLOW' => 'Allow',
'Option' => 'Option', 'INHERIT' => 'Inherit',
'Allow' => 'Allow', 'DENY' => 'Deny',
'Inherit' => 'Inherit', 'BASIC' => 'Basic',
'Deny' => 'Deny',
'Basic' => 'Basic',
'USER_PRESETS' => 'User presets', 'USER_PRESETS' => 'User presets',
'ALL_ALLOW' => 'All Allow', 'ALL_ALLOW' => 'All Allow',
'ALL_DENY' => 'All Deny', 'ALL_DENY' => 'All Deny',
'ALL_INHERIT' => 'All Inherit', 'ALL_INHERIT' => 'All Inherit',
'INHERIT_PARENT' => 'From Parent', 'INHERIT_PARENT' => 'From Parent',
'ACL_PRESET' => 'Preset', 'ACL_PRESET' => 'Preset',
'Inheritance' => 'Inheritance', 'INHERITANCE' => 'Inheritance',
'Inheritance_explain' => 'Select the subforums you want to inherit these permissions', 'INHERITANCE_EXPLAIN' => 'Select the subforums you want to inherit these permissions',
'PRESETS' => 'Presets', 'PRESETS' => 'Presets',
'PRESETS_EXPLAIN' => 'To update or delete an existing preset select it from the list.', 'PRESETS_EXPLAIN' => 'To update or delete an existing preset select it from the list.',
'SELECT_PRESET' => 'Select preset', 'SELECT_PRESET' => 'Select preset',
'PRESET_NAME' => 'Preset name', 'PRESET_NAME' => 'Preset name',
'EMPTY' => 'Empty', 'EMPTY' => 'Empty',
'Auth_updated' => 'Permissions have been updated', 'AUTH_UPDATED' => 'Permissions have been updated',
'acl_a_server' => 'Alter Server/Email Settings', 'acl_a_server' => 'Alter Server/Email Settings',
'acl_a_defaults' => 'Alter Board Defaults', 'acl_a_defaults' => 'Alter Board Defaults',
@ -270,46 +268,54 @@ $lang = array_merge($lang, array(
'acl_a_restore' => 'Restore Database', 'acl_a_restore' => 'Restore Database',
'acl_a_clearlogs' => 'Clear Admin/Mod Logs', 'acl_a_clearlogs' => 'Clear Admin/Mod Logs',
'acl_m_edit' => 'Edit posts', 'acl_m_edit' => 'Edit posts',
'acl_m_delete' => 'Delete posts', 'acl_m_delete' => 'Delete posts',
'acl_m_move' => 'Move posts', 'acl_m_move' => 'Move posts',
'acl_m_lock' => 'Lock topics', 'acl_m_lock' => 'Lock topics',
'acl_m_split' => 'Split topics', 'acl_m_split' => 'Split topics',
'acl_m_merge' => 'Merge topics', 'acl_m_merge' => 'Merge topics',
'acl_m_approve' => 'Approve posts', 'acl_m_approve' => 'Approve posts',
'acl_m_unrate' => 'Un-rate topics', 'acl_m_unrate' => 'Un-rate topics',
'acl_m_auth' => 'Set permissions', 'acl_m_auth' => 'Set permissions',
'acl_m_ip' => 'View IP\'s', 'acl_m_ip' => 'View IP\'s',
'acl_f_list' => 'See forum', 'acl_f_list' => 'See forum',
'acl_f_read' => 'Read forum', 'acl_f_read' => 'Read forum',
'acl_f_post' => 'Post in forum', 'acl_f_post' => 'Post in forum',
'acl_f_reply' => 'Reply to posts', 'acl_f_reply' => 'Reply to posts',
'acl_f_edit' => 'Edit own posts', 'acl_f_edit' => 'Edit own posts',
'acl_f_delete' => 'Delete own posts', 'acl_f_delete' => 'Delete own posts',
'acl_f_poll' => 'Create polls', 'acl_f_poll' => 'Create polls',
'acl_f_vote' => 'Vote in polls', 'acl_f_vote' => 'Vote in polls',
'acl_f_announce' => 'Post announcements', 'acl_f_announce' => 'Post announcements',
'acl_f_sticky' => 'Post stickies', 'acl_f_sticky' => 'Post stickies',
'acl_f_attach' => 'Attach files', 'acl_f_attach' => 'Attach files',
'acl_f_download' => 'Download files', 'acl_f_download' => 'Download files',
'acl_f_html' => 'Post HTML', 'acl_f_html' => 'Post HTML',
'acl_f_bbcode' => 'Post BBCode', 'acl_f_bbcode' => 'Post BBCode',
'acl_f_smilies' => 'Post smilies', 'acl_f_smilies' => 'Post smilies',
'acl_f_img' => 'Post images', 'acl_f_img' => 'Post images',
'acl_f_flash' => 'Post Flash', 'acl_f_flash' => 'Post Flash',
'acl_f_sigs' => 'Use signatures', 'acl_f_sigs' => 'Use signatures',
'acl_f_search' => 'Search the forum', 'acl_f_search' => 'Search the forum',
'acl_f_email' => 'Email topics', 'acl_f_email' => 'Email topics',
'acl_f_rate' => 'Rate topics', 'acl_f_rate' => 'Rate topics',
'acl_f_print' => 'Print topics', 'acl_f_print' => 'Print topics',
'acl_f_ignoreflood' => 'Ignore flood limit', 'acl_f_ignoreflood' => 'Ignore flood limit',
'acl_f_ignorequeue' => 'Ignore mod queue', 'acl_f_ignorequeue' => 'Ignore mod queue',
'acl_f_postcount' => 'Increment post counter',
'acl_u_viewonline' => 'View all online', 'acl_u_viewonline' => 'View all online',
'acl_u_pm' => 'Send messages', 'acl_u_viewprofile' => 'View profiles',
'acl_u_avatar' => 'Display avatar', 'acl_u_sendemail' => 'Send emails',
'acl_u_email' => 'Send emails', 'acl_u_sendpm' => 'Send messages',
'acl_u_readpm' => 'Read messages',
'acl_u_chgavatar' => 'Change avatar',
'acl_u_chgcolor' => 'Change colour',
'acl_u_chgemail' => 'Change email address',
'acl_u_chgname' => 'Change username',
'acl_u_chgpasswd' => 'Change password',
'acl_u_search' => 'Search board',
'Prune_users' => 'Prune Users', 'Prune_users' => 'Prune Users',
@ -397,6 +403,8 @@ $lang = array_merge($lang, array(
'Use_SMTP' => 'Use SMTP Server for email', 'Use_SMTP' => 'Use SMTP Server for email',
'Use_SMTP_explain' => 'Say yes if you want or have to send email via a named server instead of the local mail function', 'Use_SMTP_explain' => 'Say yes if you want or have to send email via a named server instead of the local mail function',
'SMTP_server' => 'SMTP Server Address', 'SMTP_server' => 'SMTP Server Address',
'SMTP_PORT' => 'SMTP Server Port',
'SMTP_PORT_EXPLAIN' => 'Only change this if you know your SMTP server is on a different port',
'SMTP_username' => 'SMTP Username', 'SMTP_username' => 'SMTP Username',
'SMTP_username_explain' => 'Only enter a username if your smtp server requires it', 'SMTP_username_explain' => 'Only enter a username if your smtp server requires it',
'SMTP_password' => 'SMTP Password', 'SMTP_password' => 'SMTP Password',

View file

@ -133,6 +133,9 @@ $lang = array(
'SEARCH_SELF' => 'View your posts', 'SEARCH_SELF' => 'View your posts',
'SEARCH_UNANSWERED' => 'View unanswered posts', 'SEARCH_UNANSWERED' => 'View unanswered posts',
'LOGIN' => 'Login',
'LOGOUT_USER' => 'Logout [ %s ]',
'LOGOUT' => 'Logout',
'REGISTER' => 'Register', 'REGISTER' => 'Register',
'PROFILE' => 'User Control Panel', 'PROFILE' => 'User Control Panel',
'SEARCH' => 'Search', 'SEARCH' => 'Search',
@ -197,13 +200,15 @@ $lang = array(
'POST_TOPIC_LOCKED' => 'Topic is locked', 'POST_TOPIC_LOCKED' => 'Topic is locked',
'Enter_password' => 'Please enter your username and password to login', 'LOGIN' => 'Login',
'LOGIN' => 'Login', 'TERMS_USE' => 'Terms of Use',
'LOGOUT' => 'Logout', 'PRIVACY' => 'Privacy Policy',
'Forgotten_password' => 'I forgot my password', 'FORGOT_PASS' => 'I forgot my password',
'LOG_ME_IN' => 'Log me on automatically each visit', 'LOG_ME_IN' => 'Log me on automatically each visit',
'Error_login' => 'You have specified an incorrect or inactive username or an invalid password', 'HIDE_ME' => 'Hide my online status this session',
'Index' => 'Index', 'LOGIN_ERROR' => 'You have specified an incorrect username or password. Please check them both and try again. If you continue to have problems please contact a board administrator.',
'ACTIVE_ERROR' => 'You have specified an inactive username. Please activate your account and try again. If you continue to have problems please contact a board administrator.',
'Private_Message' => 'Private Message', 'Private_Message' => 'Private Message',
'Private_Messages' => 'Private Messages', 'Private_Messages' => 'Private Messages',
@ -250,6 +255,7 @@ $lang = array(
'NO_TOPIC' => 'The requested topic does not exist.', 'NO_TOPIC' => 'The requested topic does not exist.',
'NO_POSTS' => 'No Posts were found.', 'NO_POSTS' => 'No Posts were found.',
'NO_POST' => 'The requested post does not exist.', 'NO_POST' => 'The requested post does not exist.',
'NO_USER' => 'The requested user does not exist.',
'Stop_watching_forum' => 'Stop watching this forum', 'Stop_watching_forum' => 'Stop watching this forum',
'Start_watching_forum' => 'Watch this forum for new posts', 'Start_watching_forum' => 'Watch this forum for new posts',
@ -265,7 +271,7 @@ $lang = array(
'VIEW_PREVIOUS_TOPIC' => 'View previous topic', 'VIEW_PREVIOUS_TOPIC' => 'View previous topic',
'NO_NEWER_TOPICS' => 'There are no newer topics in this forum', 'NO_NEWER_TOPICS' => 'There are no newer topics in this forum',
'NO_OLDER_TOPICS' => 'There are no older topics in this forum', 'NO_OLDER_TOPICS' => 'There are no older topics in this forum',
'POST_IGNORE' => 'This post was made by <b>%s</b> who is on your ignore list. To display this post click %sHERE%s.', 'POST_IGNORE' => 'This post was made by <b>%1$s</b> who is on your ignore list. To display this post click %sHERE%s.',
'POST_BELOW_KARMA' => 'This post was made by <b>%1$s</b> whose karma rating of <b>%2$d</b> is below your desired minimum. To display this post click %3$sHERE%4$s.', 'POST_BELOW_KARMA' => 'This post was made by <b>%1$s</b> whose karma rating of <b>%2$d</b> is below your desired minimum. To display this post click %3$sHERE%4$s.',
'POST_ENCODING' => 'This post by <b>%1$s</b> was made in a character set different to yours. To view this post in its proper encoding click %2$sHERE%3$s.', 'POST_ENCODING' => 'This post by <b>%1$s</b> was made in a character set different to yours. To view this post in its proper encoding click %2$sHERE%3$s.',
'DISPLAY_POSTS' => 'Display posts from previous', 'DISPLAY_POSTS' => 'Display posts from previous',
@ -281,7 +287,7 @@ $lang = array(
'DELETE_POST' => 'Delete', 'DELETE_POST' => 'Delete',
'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered', 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered',
'REPORT_TO_ADMIN' => 'Report this post', 'REPORT_TO_ADMIN' => 'Report this post',
'POST_BEEN_REPORTED' => 'This post has been reported', 'POST_BEEN_REPORTED' => 'This post has already been reported.',
'wrote' => 'wrote', 'wrote' => 'wrote',
'Quote' => 'Quote', 'Quote' => 'Quote',
'Code' => 'Code', 'Code' => 'Code',
@ -305,8 +311,8 @@ $lang = array(
'VIEW_RESULTS' => 'View Results', 'VIEW_RESULTS' => 'View Results',
'MESSAGE_BODY' => 'Message body', 'MESSAGE_BODY' => 'Message body',
'MESSAGE_BODY_EXPLAIN' => 'Enter your message here, it may contain no more than <b>%d</b> characters.', 'MESSAGE_BODY_EXPLAIN' => 'Enter your message here, it may contain no more than <b>%d</b> characters.',
'TOPIC_REVIEW' => 'Topic review', 'TOPIC_REVIEW' => 'Topic review',
'TOPIC_ICON' => 'Topic icon', 'TOPIC_ICON' => 'Topic icon',
'POST_ICON' => 'Post icon', 'POST_ICON' => 'Post icon',
@ -496,11 +502,11 @@ $lang = array(
'ABOUT_USER' => 'Profile', 'ABOUT_USER' => 'Profile',
'CONTACT_USER' => 'Contact', 'CONTACT_USER' => 'Contact',
'USER_FORUM' => 'Forum statistics', 'USER_FORUM' => 'Forum statistics',
'USER_PRESENCE' => 'User presence', 'USER_PRESENCE' => 'Forum presence',
'USER_POST' => '%d Post', 'USER_POST' => '%d Post',
'USER_POSTS' => '%d Posts', 'USER_POSTS' => '%d Posts',
'POST_PCT' => '%.2f%% of total', 'POST_PCT' => '%.2f%% of all posts',
'POST_DAY' => '%.2f posts per day', 'POST_DAY' => '%.2f posts per day',
'TOTAL_POSTS' => 'Total posts', 'TOTAL_POSTS' => 'Total posts',
'ACTIVE_IN_FORUM' => 'Most active forum', 'ACTIVE_IN_FORUM' => 'Most active forum',
@ -619,17 +625,6 @@ $lang = array(
'No_email_match' => 'The email address you supplied does not match the one listed for that username', 'No_email_match' => 'The email address you supplied does not match the one listed for that username',
'New_password_activation' => 'New password activation', 'New_password_activation' => 'New password activation',
'Password_activated' => 'Your account has been re-activated. To logon please use the password supplied in the email you received', 'Password_activated' => 'Your account has been re-activated. To logon please use the password supplied in the email you received',
'Send_email_msg' => 'Send an email message',
'No_user_specified' => 'No user was specified',
'User_prevent_email' => 'This user does not wish to receive email. Try sending them a private message',
'User_not_exist' => 'That user does not exist',
'CC_email' => 'Send a copy of this email to yourself',
'Email_message_desc' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.',
'Flood_email_limit' => 'You cannot send another email at this time, try again later',
'Recipient' => 'Recipient',
'Email_sent' => 'The email has been sent',
'Empty_subject_email' => 'You must specify a subject for the email',
'Empty_message_email' => 'You must enter a message to be emailed',
'FIND_USERNAME' => 'Find a member', 'FIND_USERNAME' => 'Find a member',
@ -657,6 +652,16 @@ $lang = array(
'AFTER' => 'After', 'AFTER' => 'After',
'NEVER' => 'Never', 'NEVER' => 'Never',
'SEND_EMAIL' => 'Send Email',
'NO_EMAIL' => 'You are not permitted to send email to this user.',
'CC_EMAIL' => 'Send a copy of this email to yourself',
'EMAIL_BODY_EXPLAIN' => 'This message will be sent as plain text, do not include any HTML or BBCode. The return address for this message will be set to your email address.',
'FLOOD_EMAIL_LIMIT' => 'You cannot send another email at this time. Please try again later.',
'RECIPIENT' => 'Recipient',
'EMAIL_SENT' => 'The email has been sent.',
'EMPTY_SUBJECT_EMAIL' => 'You must specify a subject for the email.',
'EMPTY_MESSAGE_EMAIL' => 'You must enter a message to be emailed.',
'Group_Control_Panel' => 'Group Control Panel', 'Group_Control_Panel' => 'Group Control Panel',
'Group_member_details' => 'Group Membership Details', 'Group_member_details' => 'Group Membership Details',

View file

@ -43,6 +43,7 @@ if (isset($login) || isset($logout))
if (isset($login) && $user->data['user_id'] == ANONYMOUS) if (isset($login) && $user->data['user_id'] == ANONYMOUS)
{ {
$autologin = (!empty($autologin)) ? true : false; $autologin = (!empty($autologin)) ? true : false;
$viewonline = (!empty($viewonline)) ? 0 : 1;
// Is the board disabled? Are we an admin? No, then back to the index we go // Is the board disabled? Are we an admin? No, then back to the index we go
if (!empty($config['board_disable']) && !$auth->acl_get('a_')) if (!empty($config['board_disable']) && !$auth->acl_get('a_'))
@ -50,13 +51,18 @@ if (isset($login) || isset($logout))
redirect("index.$phpEx$SID"); redirect("index.$phpEx$SID");
} }
if (!$auth->login($username, $password, $autologin)) if (($result = $auth->login($username, $password, $autologin, $viewonline)) !== true)
{ {
$template->assign_vars(array( // If we get a non-numeric (e.g. string) value we output an error
'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">') if (!is_numeric($result))
); {
trigger_error($result, E_USER_ERROR);
}
// If we get an integer zero then we are inactive, else the username/password is wrong
$message = ($result === 0) ? $user->lang['ACTIVE_ERROR'] : $user->lang['LOGIN_ERROR'];
$message .= '<br /><br />' . sprintf($user->lang['RETURN_LOGIN'], '<a href="' . "login.$phpEx$SID&amp;redirect=$redirect" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['RETURN_INDEX'], '<a href="' . "index.$phpEx$SID" . '">', '</a>');
$message = $user->lang['Error_login'] . '<br /><br />' . sprintf($user->lang['Click_return_login'], '<a href="' . "login.$phpEx$SID&amp;redirect=$redirect" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a>');
trigger_error($message); trigger_error($message);
} }
} }
@ -65,25 +71,22 @@ if (isset($login) || isset($logout))
$user->destroy(); $user->destroy();
} }
//
// Redirect to wherever we're supposed to go ... // Redirect to wherever we're supposed to go ...
// $redirect_url = ($redirect) ? preg_replace('#^.*?redirect=(.*?)&(.*?)$#', '\1' . $SID . '&\2', $redirect) : 'index.'.$phpEx;
$redirect_url = ($redirect) ? preg_replace('/^.*?redirect=(.*?)&(.*?)$/', '\\1' . $SID . '&\\2', $redirect) : 'index.'.$phpEx;
redirect($redirect_url); redirect($redirect_url);
} }
if ($user->data['user_id'] == ANONYMOUS) if ($user->data['user_id'] == ANONYMOUS)
{ {
$template->assign_vars(array( $template->assign_vars(array(
'L_ENTER_PASSWORD' => $user->lang['Enter_password'],
'L_SEND_PASSWORD' => $user->lang['Forgotten_password'],
'U_SEND_PASSWORD' => "ucp.$phpEx$SID&amp;mode=sendpassword", 'U_SEND_PASSWORD' => "ucp.$phpEx$SID&amp;mode=sendpassword",
'U_TERMS_USE' => "ucp.$phpEx$SID&amp;mode=terms",
'U_PRIVACY' => "ucp.$phpEx$SID&amp;mode=privacy",
'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />') 'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />')
); );
$page_title = $user->lang['Login']; $page_title = $user->lang['LOGIN'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(

View file

@ -1,40 +1,42 @@
<!-- $Id$ --> <!-- $Id$ -->
<!-- INCLUDE overall_header.html --> <!-- INCLUDE overall_header.html -->
<form action="{S_LOGIN_ACTION}" method="post"><table width="100%" cellspacing="2" cellpadding="2" border="0" align="center"> <form action="{S_LOGIN_ACTION}" method="post"><table width="50%" cellspacing="2" cellpadding="2" border="0" align="center">
<tr> <tr>
<td align="left" class="nav"><a href="{U_INDEX}">{L_INDEX}</a></td> <td align="left"><a class="nav" href="{U_INDEX}">{L_INDEX}</a></td>
</tr> </tr>
</table> </table>
<table class="tablebg" width="100%" cellspacing="1" cellpadding="2" border="0" align="center"> <table class="tablebg" width="50%" cellspacing="1" cellpadding="2" border="0" align="center">
<tr> <tr>
<th height="25" nowrap="nowrap">{L_ENTER_PASSWORD}</th> <th height="25">{L_LOGIN}</th>
</tr> </tr>
<tr> <tr>
<td class="row1"><table width="100%" cellspacing="1" cellpadding="2" border="0"> <td class="row3" align="center"><span class="gensmall"><a href="{U_TERMS_USE}">{L_TERMS_USE}</a> &nbsp;<a href="{U_PRIVACY}">{L_PRIVACY}</a></span></td>
</tr>
<tr>
<td class="row1" align="center"><table cellspacing="1" cellpadding="2" border="0">
<tr> <tr>
<td colspan="2" align="center">&nbsp;</td> <td><b class="gensmall">{L_USERNAME}:</b></td>
<td><input class="post" type="text" name="username" size="25" maxlength="40" value="{USERNAME}" /><br /><a class="gensmall" href="{U_REGISTER}">{L_REGISTER}</a></td>
</tr> </tr>
<tr> <tr>
<td width="45%" align="right"><span class="gen">{L_USERNAME}:</span></td> <td><b class="gensmall">{L_PASSWORD}:</b></td>
<td><input type="text" name="username" size="25" maxlength="40" value="{USERNAME}" /></td> <td><input class="post" type="password" name="password" size="25" maxlength="25" /><br /><a class="gensmall" href="{U_SEND_PASSWORD}">{L_FORGOT_PASS}</a></td>
</tr> </tr>
<tr> <tr>
<td class="gen" align="right">{L_PASSWORD}:</td> <td>&nbsp;</td>
<td><input class="text" type="password" name="password" size="25" maxlength="25" /></td> <td><input type="checkbox" name="autologin" /> <span class="gensmall">{L_LOG_ME_IN}</span></td>
</tr> </tr>
<tr align="center"> <tr>
<td class="gen" colspan="2">{L_AUTO_LOGIN}: <input type="checkbox" name="autologin" /></td> <td>&nbsp;</td>
</tr> <td><input type="checkbox" name="viewonline" /> <span class="gensmall">{L_HIDE_ME}</span></td>
<tr align="center">
<td colspan="2">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="mainoption" value="{L_LOGIN}" /></td>
</tr>
<tr align="center">
<td class="gensmall" colspan="2"><a href="{U_SEND_PASSWORD}">{L_SEND_PASSWORD}</a></td>
</tr> </tr>
</table></td> </table></td>
</tr> </tr>
<tr>
<td class="cat" colspan="2" align="center">{S_HIDDEN_FIELDS}<input type="submit" name="login" class="mainoption" value="{L_LOGIN}" /></td>
</tr>
</table></form> </table></form>
<!-- INCLUDE overall_footer.html --> <!-- INCLUDE overall_footer.html -->

View file

@ -41,7 +41,7 @@ while ($row = $db->sql_fetchrow($result))
} }
// Get user list // Get user list
$sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_colour, s.session_time, s.session_page, s.session_ip $sql = "SELECT u.user_id, u.username, u.user_allow_viewonline, u.user_colour, s.session_time, s.session_page, s.session_ip, s.session_allow_viewonline
FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s FROM " . USERS_TABLE . " u, " . SESSIONS_TABLE . " s
WHERE u.user_id = s.session_user_id WHERE u.user_id = s.session_user_id
AND s.session_time >= ".(time() - 300) . " AND s.session_time >= ".(time() - 300) . "
@ -74,7 +74,7 @@ while ($row = $db->sql_fetchrow($result))
$username = '<b style="color:#' . $row['user_colour'] . '">' . $username . '</b>'; $username = '<b style="color:#' . $row['user_colour'] . '">' . $username . '</b>';
} }
if (!$row['user_allow_viewonline']) if (!$row['user_allow_viewonline'] || !$row['session_allow_viewonline'])
{ {
$view_online = ($auth->acl_gets('u_viewonline', 'a_')) ? true : false; $view_online = ($auth->acl_gets('u_viewonline', 'a_')) ? true : false;
$hidden_users++; $hidden_users++;