diff options
-rw-r--r-- | phpBB/includes/functions.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 20 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_post.php | 2 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 2 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_reports.php | 4 | ||||
-rw-r--r-- | phpBB/install/database_update.php | 6 | ||||
-rw-r--r-- | phpBB/install/schemas/schema_data.sql | 2 | ||||
-rw-r--r-- | phpBB/language/en/acp/permissions_phpbb.php | 2 | ||||
-rw-r--r-- | phpBB/language/en/mcp.php | 2 | ||||
-rw-r--r-- | phpBB/memberlist.php | 2 | ||||
-rw-r--r-- | phpBB/viewtopic.php | 2 |
11 files changed, 30 insertions, 18 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index d20002dd96..b36b902991 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2620,11 +2620,11 @@ function make_clickable($text, $server_url = false) // matches a xxxx://aaaaa.bbb.cccc. ... $magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('url_inline') . ')#ie'; - $magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- m -->'"; + $magic_url_replace[] = "'\$1<!-- m --><a href=\"\$2\">' . ((strlen('\$2') > 55) ? str_replace('&', '&', substr(str_replace('&', '&', '\$2'), 0, 39)) . ' ... ' . str_replace('&', '&', substr(str_replace('&', '&', '\$2'), -10)) : '\$2') . '</a><!-- m -->'"; // matches a "www.xxxx.yyyy[/zzzz]" kinda lazy URL thing $magic_url_match[] = '#(^|[\n\t (])(' . get_preg_expression('www_url_inline') . ')#ie'; - $magic_url_replace[] = "'\$1<!-- w --><a href=\"http://\$2\">' . ((strlen('\$2') > 55) ? substr(str_replace('&', '&', '\$2'), 0, 39) . ' ... ' . substr(str_replace('&', '&', '\$2'), -10) : '\$2') . '</a><!-- w -->'"; + $magic_url_replace[] = "'\$1<!-- w --><a href=\"http://\$2\">' . ((strlen('\$2') > 55) ? str_replace('&', '&', substr(str_replace('&', '&', '\$2'), 0, 39)) . ' ... ' . str_replace('&', '&', substr(str_replace('&', '&', '\$2'), -10)) : '\$2') . '</a><!-- w -->'"; // matches an email@domain type address at the start of a line, or after a space or after what might be a BBCode. $magic_url_match[] = '/(^|[\n\t )])(' . get_preg_expression('email') . ')/ie'; diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 9e4a5c0843..c5eb47a6ac 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -99,10 +99,12 @@ function generate_smilies($mode, $forum_id) * Update last post information * Should be used instead of sync() if only the last post information are out of sync... faster * -* @param string $type Can be forum|topic -* @param mixed $ids topic/forum ids +* @param string $type Can be forum|topic +* @param mixed $ids topic/forum ids +* @param bool $return_update_sql true: SQL query shall be returned, false: execute SQL +* @param int $min_post_id 0: no bottom limit known, 1..n: MAX(post_id) >= n */ -function update_post_information($type, $ids, $return_update_sql = false) +function update_post_information($type, $ids, $return_update_sql = false, $min_post_id = 0) { global $db; @@ -113,6 +115,8 @@ function update_post_information($type, $ids, $return_update_sql = false) $update_sql = $empty_forums = $not_empty_forums = array(); + $min_post_id_sql = ($min_post_id) ? ' AND p.post_id >= ' . $min_post_id : ''; + if ($type != 'topic') { $topic_join = ', ' . TOPICS_TABLE . ' t'; @@ -130,7 +134,8 @@ function update_post_information($type, $ids, $return_update_sql = false) FROM ' . POSTS_TABLE . " p $topic_join WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " $topic_condition - AND p.post_approved = 1"; + AND p.post_approved = 1 + $min_post_id_sql"; } else { @@ -139,6 +144,7 @@ function update_post_information($type, $ids, $return_update_sql = false) WHERE " . $db->sql_in_set('p.' . $type . '_id', $ids) . " $topic_condition AND p.post_approved = 1 + $min_post_id_sql GROUP BY p.{$type}_id"; } $result = $db->sql_query($sql); @@ -1872,14 +1878,14 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u { if ($topic_type != POST_GLOBAL) { - $update_sql = update_post_information('forum', $data['forum_id'], true); + $update_sql = update_post_information('forum', $data['forum_id'], true, $data['post_id']); if (sizeof($update_sql)) { $sql_data[FORUMS_TABLE]['stat'][] = implode(', ', $update_sql[$data['forum_id']]); } } - $update_sql = update_post_information('topic', $data['topic_id'], true); + $update_sql = update_post_information('topic', $data['topic_id'], true, $data['post_id']); if (sizeof($update_sql)) { $sql_data[TOPICS_TABLE]['stat'][] = implode(', ', $update_sql[$data['topic_id']]); @@ -1888,7 +1894,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u if ($make_global) { - $update_sql = update_post_information('forum', $data['forum_id'], true); + $update_sql = update_post_information('forum', $data['forum_id'], true, $data['post_id']); if (sizeof($update_sql)) { $sql_data[FORUMS_TABLE]['stat'][] = implode(', ', $update_sql[$data['forum_id']]); diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php index d38d6c2a1b..ea2e2fafd7 100644 --- a/phpBB/includes/mcp/mcp_post.php +++ b/phpBB/includes/mcp/mcp_post.php @@ -141,7 +141,7 @@ function mcp_post_details($id, $mode, $action) 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 673e65dd58..0e8976c5d0 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -143,7 +143,7 @@ class mcp_queue 'U_MCP_APPROVE' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => $post_url, 'U_VIEW_TOPIC' => $topic_url, diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index b5b1dc0cf7..6ee46bc834 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -147,8 +147,8 @@ class mcp_reports 'U_MCP_REPORT' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $post_info['forum_id'] . '&p=' . $post_id), 'U_MCP_REPORTER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $report['user_id']), 'U_MCP_USER_NOTES' => append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $post_info['user_id']), - 'U_MCP_WARN_REPORTER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', - 'U_MCP_WARN_USER' => ($auth->acl_getf_global('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', + 'U_MCP_WARN_REPORTER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $report['user_id']) : '', + 'U_MCP_WARN_USER' => ($auth->acl_get('m_warn')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $post_info['user_id']) : '', 'U_VIEW_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&p=' . $post_info['post_id'] . '#p' . $post_info['post_id']), 'U_VIEW_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $post_info['forum_id'] . '&t=' . $post_info['topic_id']), diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php index 1ce64acb79..5ec0f8ffd2 100644 --- a/phpBB/install/database_update.php +++ b/phpBB/install/database_update.php @@ -1082,6 +1082,12 @@ if (version_compare($current_version, '3.0.b5', '<=')) $db->sql_query($sql); } unset($sql_in); + + $sql = 'UPDATE ' . ACL_OPTIONS_TABLE . ' SET is_local = 0 WHERE auth_option = \'m_warn\''; + $db->sql_query($sql); + + $sql = 'UPDATE ' . MODULES_TABLE . ' SET module_auth = \'acl_m_warn && acl_f_read,$id\' WHERE module_basename = \'warn\' AND module_mode = \'warn_post\''; + $db->sql_query($sql); $no_updates = false; } diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql index c0657dd26e..597d37d269 100644 --- a/phpBB/install/schemas/schema_data.sql +++ b/phpBB/install/schemas/schema_data.sql @@ -270,10 +270,10 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_merg INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1); INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1); -INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_warn', 1, 1); # -- Global moderator auth option (not a local option) INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1); +INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_warn', 0, 1); # -- Admin related auth options INSERT INTO phpbb_acl_options (auth_option, is_global) VALUES ('a_', 1); diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php index 47105d8828..97b7425f52 100644 --- a/phpBB/language/en/acp/permissions_phpbb.php +++ b/phpBB/language/en/acp/permissions_phpbb.php @@ -175,7 +175,7 @@ $lang = array_merge($lang, array( 'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'), 'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'), - 'acl_m_warn' => array('lang' => 'Can issue warnings', 'cat' => 'misc'), + 'acl_m_warn' => array('lang' => 'Can issue warnings', 'cat' => 'misc'), // This moderator setting is only global (and not local) 'acl_m_ban' => array('lang' => 'Can manage bans', 'cat' => 'misc'), // This moderator setting is only global (and not local) )); diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php index d985cb6c6d..433846b402 100644 --- a/phpBB/language/en/mcp.php +++ b/phpBB/language/en/mcp.php @@ -222,7 +222,7 @@ $lang = array_merge($lang, array( 'NO_TOPICS_QUEUE' => 'No topics', 'ONLY_TOPIC' => 'Only topic "%s"', - 'OTHER_USERS' => 'Users posting from this IP', + 'OTHER_USERS' => 'Other users posting from this IP', 'POSTER' => 'Poster', 'POSTS_APPROVED_SUCCESS' => 'The selected posts have been approved', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index bad74fe12d..9659a96a6c 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -1464,7 +1464,7 @@ function show_profile($data) 'U_SEARCH_USER' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$user_id&sr=posts") : '', 'U_NOTES' => $auth->acl_getf_global('m_') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $user_id, true, $user->session_id) : '', - 'U_WARN' => $auth->acl_getf_global('m_warn') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', + 'U_WARN' => $auth->acl_get('m_warn') ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_user&u=' . $user_id, true, $user->session_id) : '', 'U_PM' => ($config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($data['user_allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&u=' . $user_id) : '', 'U_EMAIL' => $email, 'U_WWW' => (!empty($data['user_website'])) ? $data['user_website'] : '', diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 48ae70c7d6..1da4d75fbb 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1409,7 +1409,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', 'U_PREV_POST_ID' => $prev_post_id, 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', - 'U_WARN' => ($auth->acl_getf_global('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', 'POST_ID' => $row['post_id'], 'POSTER_ID' => $poster_id, |