aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_main.html54
-rw-r--r--phpBB/docs/events.md7
-rw-r--r--phpBB/includes/acp/acp_extensions.php6
-rw-r--r--phpBB/includes/functions_posting.php30
-rw-r--r--phpBB/includes/mcp/mcp_post.php110
-rw-r--r--phpBB/includes/ucp/ucp_pm_compose.php11
-rw-r--r--phpBB/language/en/acp/common.php8
-rw-r--r--phpBB/styles/prosilver/template/index_body.html2
-rw-r--r--phpBB/styles/prosilver/template/mcp_post.html30
-rw-r--r--phpBB/styles/prosilver/theme/bidi.css6
-rw-r--r--phpBB/styles/prosilver/theme/colours.css5
-rw-r--r--phpBB/styles/prosilver/theme/content.css6
-rw-r--r--phpBB/styles/prosilver/theme/icons.css11
-rw-r--r--tests/mcp/fixtures/post_ip.xml73
-rw-r--r--tests/mcp/post_ip_test.php67
15 files changed, 360 insertions, 66 deletions
diff --git a/phpBB/adm/style/acp_main.html b/phpBB/adm/style/acp_main.html
index e306ce78e9..9522baa9c2 100644
--- a/phpBB/adm/style/acp_main.html
+++ b/phpBB/adm/style/acp_main.html
@@ -94,45 +94,15 @@
<!-- EVENT acp_main_notice_after -->
- <table class="table1 no-header" style="width: auto;" data-no-responsive-header="true">
- <caption>{L_SOFTWARE_HEADING}</caption>
- <col class="col1" /><col class="col2" />
- <thead>
- <tr>
- <th>{L_SOFTWARE_PRODUCT}</th>
- <th>{L_SOFTWARE_VERSION}</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>{L_BOARD_VERSION}</td>
- <!-- IF S_VERSIONCHECK -->
- <td><strong><a href="{U_VERSIONCHECK}" <!-- IF S_VERSION_UP_TO_DATE -->style="color: #228822;" <!-- ELSEIF not S_VERSIONCHECK_FAIL -->style="color: #BC2A4D;" <!-- ENDIF -->title="{L_MORE_INFORMATION}">{BOARD_VERSION}</a></strong> [&nbsp;<a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a>&nbsp;]
- </td>
- <!-- ELSE -->
- <td><strong>{BOARD_VERSION}</strong></td>
- <!-- ENDIF -->
- </tr>
- <tr>
- <td>{L_PHP_VERSION}</td>
- <td><strong>{PHP_VERSION_INFO}</strong></td>
- </tr>
- <tr>
- <td>{L_DATABASE_SERVER_INFO}</td>
- <td><strong>{DATABASE_INFO}</strong></td>
- </tr>
- </tbody>
- </table>
-
<table class="table1 two-columns no-header" data-no-responsive-header="true">
<caption>{L_FORUM_STATS}</caption>
<col class="col1" /><col class="col2" /><col class="col1" /><col class="col2" />
<thead>
<tr>
- <th style="width: 25%">{L_STATISTIC}</th>
- <th style="width: 25%">{L_VALUE}</th>
- <th style="width: 25%">{L_STATISTIC}</th>
- <th style="width: 25%">{L_VALUE}</th>
+ <th>{L_STATISTIC}</th>
+ <th>{L_VALUE}</th>
+ <th>{L_STATISTIC}</th>
+ <th>{L_VALUE}</th>
</tr>
</thead>
<tbody>
@@ -173,8 +143,14 @@
<td><strong>{UPLOAD_DIR_SIZE}</strong></td>
</tr>
<tr>
+ <td>{L_DATABASE_SERVER_INFO}{L_COLON} </td>
+ <td><strong>{DATABASE_INFO}</strong></td>
<td>{L_GZIP_COMPRESSION}{L_COLON} </td>
<td><strong>{GZIP_COMPRESSION}</strong></td>
+ </tr>
+ <tr>
+ <td>{L_PHP_VERSION}{L_COLON} </td>
+ <td><strong>{PHP_VERSION_INFO}</strong></td>
<!-- IF S_TOTAL_ORPHAN -->
<td>{L_NUMBER_ORPHAN}{L_COLON} </td>
<td><strong>{TOTAL_ORPHAN}</strong></td>
@@ -183,6 +159,16 @@
<td>&nbsp;</td>
<!-- ENDIF -->
</tr>
+ <!-- IF S_VERSIONCHECK -->
+ <tr>
+ <td>{L_BOARD_VERSION}{L_COLON} </td>
+ <td>
+ <strong><a href="{U_VERSIONCHECK}" <!-- IF S_VERSION_UP_TO_DATE -->style="color: #228822;" <!-- ELSEIF not S_VERSIONCHECK_FAIL -->style="color: #BC2A4D;" <!-- ENDIF -->title="{L_MORE_INFORMATION}">{BOARD_VERSION}</a></strong> [&nbsp;<a href="{U_VERSIONCHECK_FORCE}">{L_VERSIONCHECK_FORCE_UPDATE}</a>&nbsp;]
+ </td>
+ <td>&nbsp;</td>
+ <td>&nbsp;</td>
+ </tr>
+ <!-- ENDIF -->
</tbody>
</table>
diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md
index 9b0d70b46b..7ca4637ac7 100644
--- a/phpBB/docs/events.md
+++ b/phpBB/docs/events.md
@@ -709,6 +709,13 @@ forumlist_body_last_row_after
* Since: 3.1.0-b2
* Purpose: Add content after the very last row of the forum list.
+index_body_birthday_block_before
+===
+* Locations:
+ + styles/prosilver/template/index_body.html
+* Since: 3.1.11-RC1
+* Purpose: Add new statistic blocks before the Birthday block
+
index_body_block_birthday_append
===
* Locations:
diff --git a/phpBB/includes/acp/acp_extensions.php b/phpBB/includes/acp/acp_extensions.php
index 5c589222c6..c08674841c 100644
--- a/phpBB/includes/acp/acp_extensions.php
+++ b/phpBB/includes/acp/acp_extensions.php
@@ -106,7 +106,7 @@ class acp_extensions
catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
- trigger_error($message, E_USER_WARNING);
+ trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
}
}
@@ -161,7 +161,7 @@ class acp_extensions
{
$md_manager->validate_enable();
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
@@ -192,7 +192,7 @@ class acp_extensions
{
$md_manager->validate_enable();
}
- catch (\phpbb\extension\exception $e)
+ catch (exception_interface $e)
{
$message = call_user_func_array(array($this->user, 'lang'), array_merge(array($e->getMessage()), $e->get_parameters()));
trigger_error($message . adm_back_link($this->u_action), E_USER_WARNING);
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 7bc9608536..92679f8503 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1165,7 +1165,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
*/
function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
{
- global $db, $user, $phpbb_container;
+ global $db, $user, $phpbb_container, $phpbb_dispatcher;
global $config, $phpEx, $phpbb_root_path;
// Specify our post mode
@@ -1416,6 +1416,34 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
sync('topic_reported', 'topic_id', array($topic_id));
}
+ /**
+ * This event is used for performing actions directly after a post or topic
+ * has been deleted.
+ *
+ * @event core.delete_post_after
+ * @var int forum_id Post forum ID
+ * @var int topic_id Post topic ID
+ * @var int post_id Post ID
+ * @var array data Post data
+ * @var bool is_soft Soft delete flag
+ * @var string softdelete_reason Soft delete reason
+ * @var string post_mode delete_topic, delete_first_post, delete_last_post or delete
+ * @var mixed next_post_id Next post ID in the topic (post ID or false)
+ *
+ * @since 3.1.11-RC1
+ */
+ $vars = array(
+ 'forum_id',
+ 'topic_id',
+ 'post_id',
+ 'data',
+ 'is_soft',
+ 'softdelete_reason',
+ 'post_mode',
+ 'next_post_id',
+ );
+ extract($phpbb_dispatcher->trigger_event('core.delete_post_after', compact($vars)));
+
return $next_post_id;
}
diff --git a/phpBB/includes/mcp/mcp_post.php b/phpBB/includes/mcp/mcp_post.php
index 7fa6ef4fff..dd7aebdbd1 100644
--- a/phpBB/includes/mcp/mcp_post.php
+++ b/phpBB/includes/mcp/mcp_post.php
@@ -26,7 +26,7 @@ function mcp_post_details($id, $mode, $action)
{
global $phpEx, $phpbb_root_path, $config, $request;
global $template, $db, $user, $auth;
- global $phpbb_dispatcher;
+ global $phpbb_container, $phpbb_dispatcher;
$user->add_lang('posting');
@@ -352,7 +352,11 @@ function mcp_post_details($id, $mode, $action)
// Get IP
if ($auth->acl_get('m_info', $post_info['forum_id']))
{
+ /** @var \phpbb\pagination $pagination */
+ $pagination = $phpbb_container->get('pagination');
+
$rdns_ip_num = $request->variable('rdns', '');
+ $start_users = $request->variable('start_users', 0);
if ($rdns_ip_num != 'all')
{
@@ -361,23 +365,46 @@ function mcp_post_details($id, $mode, $action)
);
}
+ $num_users = false;
+ if ($start_users)
+ {
+ $num_users = phpbb_get_num_posters_for_ip($db, $post_info['poster_ip']);
+ $start_users = $pagination->validate_start($start_users, $config['posts_per_page'], $num_users);
+ }
+
// Get other users who've posted under this IP
$sql = 'SELECT poster_id, COUNT(poster_id) as postings
FROM ' . POSTS_TABLE . "
WHERE poster_ip = '" . $db->sql_escape($post_info['poster_ip']) . "'
+ AND poster_id <> " . (int) $post_info['poster_id'] . "
GROUP BY poster_id
- ORDER BY postings DESC";
- $result = $db->sql_query($sql);
+ ORDER BY postings DESC, poster_id ASC";
+ $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start_users);
+ $page_users = 0;
while ($row = $db->sql_fetchrow($result))
{
- // Fill the user select list with users who have posted under this IP
- if ($row['poster_id'] != $post_info['poster_id'])
+ $page_users++;
+ $users_ary[$row['poster_id']] = $row;
+ }
+ $db->sql_freeresult($result);
+
+ if ($page_users == $config['posts_per_page'] || $start_users)
+ {
+ if ($num_users === false)
{
- $users_ary[$row['poster_id']] = $row;
+ $num_users = phpbb_get_num_posters_for_ip($db, $post_info['poster_ip']);
}
+
+ $pagination->generate_template_pagination(
+ $url . '&amp;i=main&amp;mode=post_details',
+ 'pagination',
+ 'start_users',
+ $num_users,
+ $config['posts_per_page'],
+ $start_users
+ );
}
- $db->sql_freeresult($result);
if (sizeof($users_ary))
{
@@ -412,16 +439,26 @@ function mcp_post_details($id, $mode, $action)
// A compound index on poster_id, poster_ip (posts table) would help speed up this query a lot,
// but the extra size is only valuable if there are persons having more than a thousands posts.
// This is better left to the really really big forums.
+ $start_ips = $request->variable('start_ips', 0);
+
+ $num_ips = false;
+ if ($start_ips)
+ {
+ $num_ips = phpbb_get_num_ips_for_poster($db, $post_info['poster_id']);
+ $start_ips = $pagination->validate_start($start_ips, $config['posts_per_page'], $num_ips);
+ }
$sql = 'SELECT poster_ip, COUNT(poster_ip) AS postings
FROM ' . POSTS_TABLE . '
WHERE poster_id = ' . $post_info['poster_id'] . "
GROUP BY poster_ip
- ORDER BY postings DESC";
- $result = $db->sql_query($sql);
+ ORDER BY postings DESC, poster_ip ASC";
+ $result = $db->sql_query_limit($sql, $config['posts_per_page'], $start_ips);
+ $page_ips = 0;
while ($row = $db->sql_fetchrow($result))
{
+ $page_ips++;
$hostname = (($rdns_ip_num == $row['poster_ip'] || $rdns_ip_num == 'all') && $row['poster_ip']) ? @gethostbyaddr($row['poster_ip']) : '';
$template->assign_block_vars('iprow', array(
@@ -436,6 +473,23 @@ function mcp_post_details($id, $mode, $action)
}
$db->sql_freeresult($result);
+ if ($page_ips == $config['posts_per_page'] || $start_ips)
+ {
+ if ($num_ips === false)
+ {
+ $num_ips = phpbb_get_num_ips_for_poster($db, $post_info['poster_id']);
+ }
+
+ $pagination->generate_template_pagination(
+ $url . '&amp;i=main&amp;mode=post_details',
+ 'pagination_ips',
+ 'start_ips',
+ $num_ips,
+ $config['posts_per_page'],
+ $start_ips
+ );
+ }
+
$user_select = '';
if (sizeof($usernames_ary))
@@ -454,6 +508,44 @@ function mcp_post_details($id, $mode, $action)
}
/**
+ * Get the number of posters for a given ip
+ *
+ * @param \phpbb\db\driver\driver_interface $db DBAL interface
+ * @param string $poster_ip IP
+ * @return int Number of posters
+ */
+function phpbb_get_num_posters_for_ip(\phpbb\db\driver\driver_interface $db, $poster_ip)
+{
+ $sql = 'SELECT COUNT(DISTINCT poster_id) as num_users
+ FROM ' . POSTS_TABLE . "
+ WHERE poster_ip = '" . $db->sql_escape($poster_ip) . "'";
+ $result = $db->sql_query($sql);
+ $num_users = (int) $db->sql_fetchfield('num_users');
+ $db->sql_freeresult($result);
+
+ return $num_users;
+}
+
+/**
+ * Get the number of ips for a given poster
+ *
+ * @param \phpbb\db\driver\driver_interface $db
+ * @param int $poster_id Poster user ID
+ * @return int Number of IPs for given poster
+ */
+function phpbb_get_num_ips_for_poster(\phpbb\db\driver\driver_interface $db, $poster_id)
+{
+ $sql = 'SELECT COUNT(DISTINCT poster_ip) as num_ips
+ FROM ' . POSTS_TABLE . '
+ WHERE poster_id = ' . (int) $poster_id;
+ $result = $db->sql_query($sql);
+ $num_ips = (int) $db->sql_fetchfield('num_ips');
+ $db->sql_freeresult($result);
+
+ return $num_ips;
+}
+
+/**
* Change a post's poster
*/
function change_poster(&$post_info, $userdata)
diff --git a/phpBB/includes/ucp/ucp_pm_compose.php b/phpBB/includes/ucp/ucp_pm_compose.php
index 06f76aa01a..86cdb090c8 100644
--- a/phpBB/includes/ucp/ucp_pm_compose.php
+++ b/phpBB/includes/ucp/ucp_pm_compose.php
@@ -449,6 +449,17 @@ function compose_pm($id, $mode, $action, $user_folders = array())
$message_attachment = 0;
$message_text = $message_subject = '';
+ /**
+ * Predefine message text and subject
+ *
+ * @event core.ucp_pm_compose_predefined_message
+ * @var string message_text Message text
+ * @var string message_subject Messate subject
+ * @since 3.1.11-RC1
+ */
+ $vars = array('message_text', 'message_subject');
+ extract($phpbb_dispatcher->trigger_event('core.ucp_pm_compose_predefined_message', compact($vars)));
+
if ($to_user_id && $to_user_id != ANONYMOUS && $action == 'post')
{
$address_list['u'][$to_user_id] = 'to';
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 9be3cc9676..63235c01d8 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -367,7 +367,7 @@ $lang = array_merge($lang, array(
'AVATAR_DIR_SIZE' => 'Avatar directory size',
'BOARD_STARTED' => 'Board started',
- 'BOARD_VERSION' => 'phpBB',
+ 'BOARD_VERSION' => 'Board version',
'DATABASE_SERVER_INFO' => 'Database server',
'DATABASE_SIZE' => 'Database size',
@@ -395,7 +395,7 @@ $lang = array_merge($lang, array(
'NUMBER_USERS' => 'Number of users',
'NUMBER_ORPHAN' => 'Orphan attachments',
- 'PHP_VERSION' => 'PHP',
+ 'PHP_VERSION' => 'PHP version',
'PHP_VERSION_OLD' => 'The version of PHP on this server (%1$s) will no longer be supported by future versions of phpBB. The minimum required version will be PHP %2$s. %3$sDetails%4$s',
'POSTS_PER_DAY' => 'Posts per day',
@@ -430,10 +430,6 @@ $lang = array_merge($lang, array(
'RESYNC_STATS_SUCCESS' => 'Resynchronised statistics',
'RUN' => 'Run now',
- 'SOFTWARE_HEADING' => 'Installed software',
- 'SOFTWARE_PRODUCT' => 'Product',
- 'SOFTWARE_VERSION' => 'Version',
-
'STATISTIC' => 'Statistic',
'STATISTIC_RESYNC_OPTIONS' => 'Resynchronise or reset statistics',
diff --git a/phpBB/styles/prosilver/template/index_body.html b/phpBB/styles/prosilver/template/index_body.html
index ec5bf35476..b4febd1d49 100644
--- a/phpBB/styles/prosilver/template/index_body.html
+++ b/phpBB/styles/prosilver/template/index_body.html
@@ -47,6 +47,8 @@
</div>
<!-- ENDIF -->
+<!-- EVENT index_body_birthday_block_before -->
+
<!-- IF S_DISPLAY_BIRTHDAY_LIST -->
<div class="stat-block birthday-list">
<h3>{L_BIRTHDAYS}</h3>
diff --git a/phpBB/styles/prosilver/template/mcp_post.html b/phpBB/styles/prosilver/template/mcp_post.html
index a0de554e21..af16c8ab84 100644
--- a/phpBB/styles/prosilver/template/mcp_post.html
+++ b/phpBB/styles/prosilver/template/mcp_post.html
@@ -294,6 +294,14 @@
</tbody>
</table>
+ <div class="pagination">
+ <!-- INCLUDE pagination.html -->
+ </div>
+ </div>
+ </div>
+
+ <div class="panel">
+ <div class="inner">
<table class="table1">
<thead>
<tr>
@@ -315,7 +323,27 @@
</tbody>
</table>
- <p><a href="{U_LOOKUP_ALL}#ip">{L_LOOKUP_ALL}</a></p>
+ <div class="buttons">
+ <p><a href="{U_LOOKUP_ALL}#ip">{L_LOOKUP_ALL}</a></p>
+ </div>
+
+ <div class="pagination">
+ <ul>
+ <!-- BEGIN pagination_ips -->
+ <!-- IF pagination_ips.S_IS_PREV -->
+ <li class="arrow previous"><a class="button button-icon-only" href="{pagination_ips.PAGE_URL}" rel="prev" role="button"><i class="icon fa-chevron-{S_CONTENT_FLOW_BEGIN} fa-fw" aria-hidden="true"></i><span class="sr-only">{L_PREVIOUS}</span></a></li>
+ <!-- ELSEIF pagination_ips.S_IS_CURRENT -->
+ <li class="active"><span>{pagination_ips.PAGE_NUMBER}</span></li>
+ <!-- ELSEIF pagination_ips.S_IS_ELLIPSIS -->
+ <li class="ellipsis" role="separator"><span>{L_ELLIPSIS}</span></li>
+ <!-- ELSEIF pagination_ips.S_IS_NEXT -->
+ <li class="arrow next"><a class="button button-icon-only" href="{pagination_ips.PAGE_URL}" rel="next" role="button"><i class="icon fa-chevron-{S_CONTENT_FLOW_END} fa-fw" aria-hidden="true"></i><span class="sr-only">{L_NEXT}</span></a></li>
+ <!-- ELSE -->
+ <li><a class="button" href="{pagination_ips.PAGE_URL}" role="button">{pagination_ips.PAGE_NUMBER}</a></li>
+ <!-- ENDIF -->
+ <!-- END pagination_ips -->
+ </ul>
+ </div>
</div>
</div>
diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css
index 860c2f6cb4..70cfb83a78 100644
--- a/phpBB/styles/prosilver/theme/bidi.css
+++ b/phpBB/styles/prosilver/theme/bidi.css
@@ -501,7 +501,6 @@ li.breadcrumbs span:first-child > a {
/* Quote block */
.rtl blockquote {
margin: 0.5em 25px 0 1px;
- background-position: 99% 8px;
}
.rtl blockquote blockquote {
@@ -511,10 +510,13 @@ li.breadcrumbs span:first-child > a {
.rtl blockquote cite {
/* Username/source of quoter */
- margin-right: 20px;
margin-left: 0;
}
+.rtl blockquote cite:before, .rtl .uncited:before {
+ padding-left: 5px;
+}
+
.rtl blockquote .codebox {
margin-right: 0;
}
diff --git a/phpBB/styles/prosilver/theme/colours.css b/phpBB/styles/prosilver/theme/colours.css
index 35490c9338..ffaa71034f 100644
--- a/phpBB/styles/prosilver/theme/colours.css
+++ b/phpBB/styles/prosilver/theme/colours.css
@@ -409,14 +409,9 @@ dl.faq dt {
/* Quote block */
blockquote {
background-color: #EBEADD;
- background-image: url("./images/quote.gif");
border-color:#DBDBCE;
}
-.rtl blockquote {
- background-image: url("./images/quote_rtl.gif");
-}
-
blockquote blockquote {
/* Nested quotes */
background-color:#EFEED9;
diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css
index 95168d1d97..7ff6b4d5ef 100644
--- a/phpBB/styles/prosilver/theme/content.css
+++ b/phpBB/styles/prosilver/theme/content.css
@@ -448,7 +448,6 @@ ul.searchresults {
----------------------------------------*/
/* Quote block */
blockquote {
- background: transparent none 6px 8px no-repeat;
border: 1px solid transparent;
font-size: 0.95em;
margin: 1em 1px 1em 25px;
@@ -466,7 +465,6 @@ blockquote cite {
/* Username/source of quoter */
font-style: normal;
font-weight: bold;
- margin-left: 20px;
display: block;
font-size: 0.9em;
}
@@ -475,8 +473,8 @@ blockquote cite cite {
font-size: 1em;
}
-blockquote.uncited {
- padding-top: 25px;
+blockquote cite:before, .uncited:before {
+ padding-right: 5px;
}
blockquote cite > div {
diff --git a/phpBB/styles/prosilver/theme/icons.css b/phpBB/styles/prosilver/theme/icons.css
index 411fecaf3b..6643f12d06 100644
--- a/phpBB/styles/prosilver/theme/icons.css
+++ b/phpBB/styles/prosilver/theme/icons.css
@@ -9,7 +9,7 @@
* Just change the name of the font after the 14/1 to the name of
* the font you wish to use.
*/
-.icon, .button .icon {
+.icon, .button .icon, blockquote cite:before, .uncited:before {
display: inline-block;
font-weight: normal;
font-style: normal;
@@ -85,3 +85,12 @@
line-height: .9;
height: 12px;
}
+
+blockquote cite:before, .uncited:before {
+ content: '\f10d'; /* Font Awesome quote-left */
+}
+
+.rtl blockquote cite:before, .rtl .uncited:before {
+ content: '\f10e'; /* Font Awesome quote-right */
+}
+
diff --git a/tests/mcp/fixtures/post_ip.xml b/tests/mcp/fixtures/post_ip.xml
new file mode 100644
index 0000000000..fad2193396
--- /dev/null
+++ b/tests/mcp/fixtures/post_ip.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<dataset>
+ <table name="phpbb_posts">
+ <column>post_id</column>
+ <column>poster_id</column>
+ <column>post_edit_user</column>
+ <column>post_delete_user</column>
+ <column>post_username</column>
+ <column>topic_id</column>
+ <column>forum_id</column>
+ <column>post_visibility</column>
+ <column>post_time</column>
+ <column>post_text</column>
+ <column>post_reported</column>
+ <column>poster_ip</column>
+ <row>
+ <value>1</value>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value></value>
+ <value>1</value>
+ <value>127.0.0.1</value>
+ </row>
+ <row>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Other</value>
+ <value>2</value>
+ <value>2</value>
+ <value>1</value>
+ <value>1</value>
+ <value></value>
+ <value>1</value>
+ <value>127.0.0.2</value>
+ </row>
+ <row>
+ <value>3</value>
+ <value>2</value>
+ <value>2</value>
+ <value>2</value>
+ <value></value>
+ <value>3</value>
+ <value>3</value>
+ <value>1</value>
+ <value>1</value>
+ <value></value>
+ <value>1</value>
+ <value>127.0.0.3</value>
+ </row>
+ <row>
+ <value>4</value>
+ <value>1</value>
+ <value>1</value>
+ <value>1</value>
+ <value>Other</value>
+ <value>4</value>
+ <value>4</value>
+ <value>1</value>
+ <value>1</value>
+ <value></value>
+ <value>1</value>
+ <value>127.0.0.1</value>
+ </row>
+ </table>
+</dataset>
diff --git a/tests/mcp/post_ip_test.php b/tests/mcp/post_ip_test.php
new file mode 100644
index 0000000000..72a9f62774
--- /dev/null
+++ b/tests/mcp/post_ip_test.php
@@ -0,0 +1,67 @@
+<?php
+/**
+ *
+ * This file is part of the phpBB Forum Software package.
+ *
+ * @copyright (c) phpBB Limited <https://www.phpbb.com>
+ * @license GNU General Public License, version 2 (GPL-2.0)
+ *
+ * For full copyright and license information, please see
+ * the docs/CREDITS.txt file.
+ *
+ */
+
+require_once dirname(__FILE__) . '/../../phpBB/includes/mcp/mcp_post.php';
+
+class phpbb_mcp_post_ip_test extends phpbb_database_test_case
+{
+ /** @var \phpbb\db\driver\driver_interface */
+ protected $db;
+
+ public function getDataSet()
+ {
+ return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/post_ip.xml');
+ }
+
+ protected function setUp()
+ {
+ parent::setUp();
+
+ $this->db = $this->new_dbal();
+ }
+
+ public function data_get_num_ips()
+ {
+ return array(
+ array(2, 1),
+ array(2, 2),
+ array(0, 3),
+ );
+ }
+
+ /**
+ * @dataProvider data_get_num_ips
+ */
+ public function test_get_num_ips($expected, $poster_id)
+ {
+ $this->assertSame($expected, phpbb_get_num_ips_for_poster($this->db, $poster_id));
+ }
+
+ public function data_get_num_posters()
+ {
+ return array(
+ array(2, '127.0.0.1'),
+ array(1, '127.0.0.2'),
+ array(1, '127.0.0.3'),
+ array(0, '127.0.0.4'),
+ );
+ }
+
+ /**
+ * @dataProvider data_get_num_posters
+ */
+ public function test_get_num_posters($expected, $ip)
+ {
+ $this->assertSame($expected, phpbb_get_num_posters_for_ip($this->db, $ip));
+ }
+}