diff --git a/phpBB/includes/page_header.php b/phpBB/includes/page_header.php index 35e4ebc60d..f16fcd1b05 100644 --- a/phpBB/includes/page_header.php +++ b/phpBB/includes/page_header.php @@ -39,7 +39,7 @@ if ($config['gzip_compress']) if ($user->data['user_id'] != ANONYMOUS) { $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 { @@ -66,7 +66,7 @@ if (!empty($_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 WHERE s.session_time >= " . (time() - 300) . " $reading_sql @@ -87,19 +87,20 @@ while ($row = $db->sql_fetchrow($result)) $row['username'] = '' . $row['username'] . ''; } - if ($row['user_allow_viewonline']) + if ($row['user_allow_viewonline'] && $row['session_allow_viewonline']) { - $user_online_link = '' . $row['username'] . ''; + $user_online_link = $row['username']; $logged_visible_online++; } else { - $user_online_link = '' . $row['username'] . ''; + $user_online_link = '' . $row['username'] . ''; $logged_hidden_online++; } if ($row['user_allow_viewonline'] || $auth->acl_get('a_')) { + $user_online_link = '' . $user_online_link . ''; $online_userlist .= ($online_userlist != '') ? ', ' . $user_online_link : $user_online_link; } } diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php index 55155c2087..8b04dbea3c 100644 --- a/phpBB/includes/session.php +++ b/phpBB/includes/session.php @@ -130,7 +130,7 @@ class 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; @@ -229,7 +229,7 @@ class session $db->sql_return_on_error(true); $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 . "'"; if (!$db->sql_query($sql) || !$db->sql_affectedrows()) { @@ -237,8 +237,8 @@ class session $this->session_id = md5(uniqid($user_ip)); $sql = "INSERT INTO " . SESSIONS_TABLE . " - (session_id, session_user_id, session_last_visit, session_start, session_time, session_ip, session_browser, session_page) - VALUES ('" . $this->session_id . "', $user_id, " . $this->data['session_last_visit'] . ", $current_time, $current_time, '$this->ip', '$this->browser', '$this->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', $viewonline)"; $db->sql_query($sql); } $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. - function login($username, $password, $autologin = false) + function login($username, $password, $autologin = false, $viewonline = 1) { global $config, $user, $phpbb_root_path, $phpEx; @@ -1209,13 +1209,16 @@ class auth $method = 'login_' . $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) : ''; - 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; } } diff --git a/phpBB/language/en/lang_admin.php b/phpBB/language/en/lang_admin.php index 86f3091b94..7663920180 100644 --- a/phpBB/language/en/lang_admin.php +++ b/phpBB/language/en/lang_admin.php @@ -214,29 +214,27 @@ $lang = array_merge($lang, array( 'Disallowed_groups' => 'Disallowed groups', 'Remove_selected' => 'Remove selected', 'Advanced' => 'Advanced', - 'Applies_to_User' => 'Applies to User ...', - 'Applies_to_Group' => 'Applies to Group ...', - 'User_can' => 'User can ... ', - 'Group_can' => 'Group can ... ', - 'Option' => 'Option', - 'Allow' => 'Allow', - 'Inherit' => 'Inherit', - 'Deny' => 'Deny', - 'Basic' => 'Basic', + 'USER_CAN' => 'User can ... ', + 'GROUP_CAN' => 'Group can ... ', + 'OPTION' => 'Option', + 'ALLOW' => 'Allow', + 'INHERIT' => 'Inherit', + 'DENY' => 'Deny', + 'BASIC' => 'Basic', 'USER_PRESETS' => 'User presets', 'ALL_ALLOW' => 'All Allow', 'ALL_DENY' => 'All Deny', 'ALL_INHERIT' => 'All Inherit', 'INHERIT_PARENT' => 'From Parent', 'ACL_PRESET' => 'Preset', - 'Inheritance' => 'Inheritance', - 'Inheritance_explain' => 'Select the subforums you want to inherit these permissions', + 'INHERITANCE' => 'Inheritance', + 'INHERITANCE_EXPLAIN' => 'Select the subforums you want to inherit these permissions', 'PRESETS' => 'Presets', 'PRESETS_EXPLAIN' => 'To update or delete an existing preset select it from the list.', 'SELECT_PRESET' => 'Select preset', 'PRESET_NAME' => 'Preset name', 'EMPTY' => 'Empty', - 'Auth_updated' => 'Permissions have been updated', + 'AUTH_UPDATED' => 'Permissions have been updated', 'acl_a_server' => 'Alter Server/Email Settings', 'acl_a_defaults' => 'Alter Board Defaults', @@ -270,46 +268,54 @@ $lang = array_merge($lang, array( 'acl_a_restore' => 'Restore Database', 'acl_a_clearlogs' => 'Clear Admin/Mod Logs', - 'acl_m_edit' => 'Edit posts', - 'acl_m_delete' => 'Delete posts', - 'acl_m_move' => 'Move posts', - 'acl_m_lock' => 'Lock topics', - 'acl_m_split' => 'Split topics', - 'acl_m_merge' => 'Merge topics', + 'acl_m_edit' => 'Edit posts', + 'acl_m_delete' => 'Delete posts', + 'acl_m_move' => 'Move posts', + 'acl_m_lock' => 'Lock topics', + 'acl_m_split' => 'Split topics', + 'acl_m_merge' => 'Merge topics', 'acl_m_approve' => 'Approve posts', - 'acl_m_unrate' => 'Un-rate topics', - 'acl_m_auth' => 'Set permissions', - 'acl_m_ip' => 'View IP\'s', + 'acl_m_unrate' => 'Un-rate topics', + 'acl_m_auth' => 'Set permissions', + 'acl_m_ip' => 'View IP\'s', - 'acl_f_list' => 'See forum', - 'acl_f_read' => 'Read forum', - 'acl_f_post' => 'Post in forum', - 'acl_f_reply' => 'Reply to posts', - 'acl_f_edit' => 'Edit own posts', - 'acl_f_delete' => 'Delete own posts', - 'acl_f_poll' => 'Create polls', - 'acl_f_vote' => 'Vote in polls', - 'acl_f_announce' => 'Post announcements', - 'acl_f_sticky' => 'Post stickies', - 'acl_f_attach' => 'Attach files', - 'acl_f_download' => 'Download files', - 'acl_f_html' => 'Post HTML', - 'acl_f_bbcode' => 'Post BBCode', - 'acl_f_smilies' => 'Post smilies', - 'acl_f_img' => 'Post images', - 'acl_f_flash' => 'Post Flash', - 'acl_f_sigs' => 'Use signatures', - 'acl_f_search' => 'Search the forum', - 'acl_f_email' => 'Email topics', - 'acl_f_rate' => 'Rate topics', - 'acl_f_print' => 'Print topics', + 'acl_f_list' => 'See forum', + 'acl_f_read' => 'Read forum', + 'acl_f_post' => 'Post in forum', + 'acl_f_reply' => 'Reply to posts', + 'acl_f_edit' => 'Edit own posts', + 'acl_f_delete' => 'Delete own posts', + 'acl_f_poll' => 'Create polls', + 'acl_f_vote' => 'Vote in polls', + 'acl_f_announce' => 'Post announcements', + 'acl_f_sticky' => 'Post stickies', + 'acl_f_attach' => 'Attach files', + 'acl_f_download' => 'Download files', + 'acl_f_html' => 'Post HTML', + 'acl_f_bbcode' => 'Post BBCode', + 'acl_f_smilies' => 'Post smilies', + 'acl_f_img' => 'Post images', + 'acl_f_flash' => 'Post Flash', + 'acl_f_sigs' => 'Use signatures', + 'acl_f_search' => 'Search the forum', + 'acl_f_email' => 'Email topics', + 'acl_f_rate' => 'Rate topics', + 'acl_f_print' => 'Print topics', 'acl_f_ignoreflood' => 'Ignore flood limit', 'acl_f_ignorequeue' => 'Ignore mod queue', + 'acl_f_postcount' => 'Increment post counter', - 'acl_u_viewonline' => 'View all online', - 'acl_u_pm' => 'Send messages', - 'acl_u_avatar' => 'Display avatar', - 'acl_u_email' => 'Send emails', + 'acl_u_viewonline' => 'View all online', + 'acl_u_viewprofile' => 'View profiles', + 'acl_u_sendemail' => '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', @@ -397,6 +403,8 @@ $lang = array_merge($lang, array( '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', '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_explain' => 'Only enter a username if your smtp server requires it', 'SMTP_password' => 'SMTP Password', diff --git a/phpBB/language/en/lang_main.php b/phpBB/language/en/lang_main.php index 59cf9ccbdf..dc0b786bca 100644 --- a/phpBB/language/en/lang_main.php +++ b/phpBB/language/en/lang_main.php @@ -133,6 +133,9 @@ $lang = array( 'SEARCH_SELF' => 'View your posts', 'SEARCH_UNANSWERED' => 'View unanswered posts', + 'LOGIN' => 'Login', + 'LOGOUT_USER' => 'Logout [ %s ]', + 'LOGOUT' => 'Logout', 'REGISTER' => 'Register', 'PROFILE' => 'User Control Panel', 'SEARCH' => 'Search', @@ -197,13 +200,15 @@ $lang = array( 'POST_TOPIC_LOCKED' => 'Topic is locked', - 'Enter_password' => 'Please enter your username and password to login', - 'LOGIN' => 'Login', - 'LOGOUT' => 'Logout', - 'Forgotten_password' => 'I forgot my password', - 'LOG_ME_IN' => 'Log me on automatically each visit', - 'Error_login' => 'You have specified an incorrect or inactive username or an invalid password', - 'Index' => 'Index', + 'LOGIN' => 'Login', + 'TERMS_USE' => 'Terms of Use', + 'PRIVACY' => 'Privacy Policy', + 'FORGOT_PASS' => 'I forgot my password', + 'LOG_ME_IN' => 'Log me on automatically each visit', + 'HIDE_ME' => 'Hide my online status this session', + '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_Messages' => 'Private Messages', @@ -250,6 +255,7 @@ $lang = array( 'NO_TOPIC' => 'The requested topic does not exist.', 'NO_POSTS' => 'No Posts were found.', 'NO_POST' => 'The requested post does not exist.', + 'NO_USER' => 'The requested user does not exist.', 'Stop_watching_forum' => 'Stop watching this forum', 'Start_watching_forum' => 'Watch this forum for new posts', @@ -265,7 +271,7 @@ $lang = array( 'VIEW_PREVIOUS_TOPIC' => 'View previous topic', 'NO_NEWER_TOPICS' => 'There are no newer topics in this forum', 'NO_OLDER_TOPICS' => 'There are no older topics in this forum', - 'POST_IGNORE' => 'This post was made by %s who is on your ignore list. To display this post click %sHERE%s.', + 'POST_IGNORE' => 'This post was made by %1$s who is on your ignore list. To display this post click %sHERE%s.', 'POST_BELOW_KARMA' => 'This post was made by %1$s whose karma rating of %2$d is below your desired minimum. To display this post click %3$sHERE%4$s.', 'POST_ENCODING' => 'This post by %1$s 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', @@ -281,7 +287,7 @@ $lang = array( 'DELETE_POST' => 'Delete', 'DELETE_POST_WARN' => 'Once deleted the post cannot be recovered', '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', 'Quote' => 'Quote', 'Code' => 'Code', @@ -305,8 +311,8 @@ $lang = array( 'VIEW_RESULTS' => 'View Results', - 'MESSAGE_BODY' => 'Message body', - 'MESSAGE_BODY_EXPLAIN' => 'Enter your message here, it may contain no more than %d characters.', + 'MESSAGE_BODY' => 'Message body', + 'MESSAGE_BODY_EXPLAIN' => 'Enter your message here, it may contain no more than %d characters.', 'TOPIC_REVIEW' => 'Topic review', 'TOPIC_ICON' => 'Topic icon', 'POST_ICON' => 'Post icon', @@ -496,11 +502,11 @@ $lang = array( 'ABOUT_USER' => 'Profile', 'CONTACT_USER' => 'Contact', 'USER_FORUM' => 'Forum statistics', - 'USER_PRESENCE' => 'User presence', + 'USER_PRESENCE' => 'Forum presence', 'USER_POST' => '%d Post', 'USER_POSTS' => '%d Posts', - 'POST_PCT' => '%.2f%% of total', + 'POST_PCT' => '%.2f%% of all posts', 'POST_DAY' => '%.2f posts per day', 'TOTAL_POSTS' => 'Total posts', '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', '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', - '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', @@ -657,6 +652,16 @@ $lang = array( 'AFTER' => 'After', '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_member_details' => 'Group Membership Details', diff --git a/phpBB/login.php b/phpBB/login.php index 793e261ea1..41b61df083 100644 --- a/phpBB/login.php +++ b/phpBB/login.php @@ -43,6 +43,7 @@ if (isset($login) || isset($logout)) if (isset($login) && $user->data['user_id'] == ANONYMOUS) { $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 if (!empty($config['board_disable']) && !$auth->acl_get('a_')) @@ -50,13 +51,18 @@ if (isset($login) || isset($logout)) redirect("index.$phpEx$SID"); } - if (!$auth->login($username, $password, $autologin)) + if (($result = $auth->login($username, $password, $autologin, $viewonline)) !== true) { - $template->assign_vars(array( - 'META' => '') - ); + // If we get a non-numeric (e.g. string) value we output an error + 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 .= '

' . sprintf($user->lang['RETURN_LOGIN'], '', '') . '

' . sprintf($user->lang['RETURN_INDEX'], '', ''); - $message = $user->lang['Error_login'] . '

' . sprintf($user->lang['Click_return_login'], '', '') . '

' . sprintf($user->lang['Click_return_index'], '', ''); trigger_error($message); } } @@ -65,25 +71,22 @@ if (isset($login) || isset($logout)) $user->destroy(); } - // // 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); } if ($user->data['user_id'] == ANONYMOUS) { $template->assign_vars(array( - 'L_ENTER_PASSWORD' => $user->lang['Enter_password'], - 'L_SEND_PASSWORD' => $user->lang['Forgotten_password'], - 'U_SEND_PASSWORD' => "ucp.$phpEx$SID&mode=sendpassword", + 'U_TERMS_USE' => "ucp.$phpEx$SID&mode=terms", + 'U_PRIVACY' => "ucp.$phpEx$SID&mode=privacy", 'S_HIDDEN_FIELDS' => '') ); - $page_title = $user->lang['Login']; + $page_title = $user->lang['LOGIN']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( diff --git a/phpBB/templates/subSilver/login_body.html b/phpBB/templates/subSilver/login_body.html index 52c57f2c6f..f096fcdf6c 100644 --- a/phpBB/templates/subSilver/login_body.html +++ b/phpBB/templates/subSilver/login_body.html @@ -1,40 +1,42 @@ -
+
- +
{L_INDEX}
- +
- + + + + -
{L_ENTER_PASSWORD}{L_LOGIN}
{L_TERMS_USE}  {L_PRIVACY}
+ + + +
- + + - - + + - - + + - - - - - - - - + + +
 {L_USERNAME}:
{L_REGISTER}
{L_USERNAME}:{L_PASSWORD}:
{L_FORGOT_PASS}
{L_PASSWORD}:  {L_LOG_ME_IN}
{L_AUTO_LOGIN}:
{S_HIDDEN_FIELDS}
{L_SEND_PASSWORD}
  {L_HIDE_ME}
{S_HIDDEN_FIELDS}
\ No newline at end of file diff --git a/phpBB/viewonline.php b/phpBB/viewonline.php index 1154bafc92..7808f4730b 100644 --- a/phpBB/viewonline.php +++ b/phpBB/viewonline.php @@ -41,7 +41,7 @@ while ($row = $db->sql_fetchrow($result)) } // 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 WHERE u.user_id = s.session_user_id AND s.session_time >= ".(time() - 300) . " @@ -74,7 +74,7 @@ while ($row = $db->sql_fetchrow($result)) $username = '' . $username . ''; } - if (!$row['user_allow_viewonline']) + if (!$row['user_allow_viewonline'] || !$row['session_allow_viewonline']) { $view_online = ($auth->acl_gets('u_viewonline', 'a_')) ? true : false; $hidden_users++;