diff options
36 files changed, 493 insertions, 62 deletions
diff --git a/phpBB/adm/style/overall_header.html b/phpBB/adm/style/overall_header.html index 1fc1261489..7e7f0cecee 100644 --- a/phpBB/adm/style/overall_header.html +++ b/phpBB/adm/style/overall_header.html @@ -112,6 +112,8 @@ function popup(url, width, height, name) <body class="{S_CONTENT_DIRECTION} nojs"> +<!-- EVENT acp_overall_header_body_before --> + <div id="wrap"> <div id="page-header"> <h1>{L_ADMIN_PANEL}</h1> diff --git a/phpBB/adm/style/simple_header.html b/phpBB/adm/style/simple_header.html index 0ca751cd7e..770b7da8a6 100644 --- a/phpBB/adm/style/simple_header.html +++ b/phpBB/adm/style/simple_header.html @@ -106,4 +106,6 @@ function find_username(url) <body class="{S_CONTENT_DIRECTION}"> +<!-- EVENT acp_simple_header_body_before --> + <div id="page-body" class="simple-page-body"> diff --git a/phpBB/docs/events.md b/phpBB/docs/events.md index dfefc0c1ea..57c152c242 100644 --- a/phpBB/docs/events.md +++ b/phpBB/docs/events.md @@ -40,6 +40,12 @@ acp_overall_footer_after * Since: 3.1.0-a1 * Purpose: Add content below the footer in the ACP +acp_overall_header_body_before +=== +* Location: adm/style/overall_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + acp_overall_header_head_append === * Location: adm/style/overall_header.html @@ -52,6 +58,12 @@ acp_simple_footer_after * Since: 3.1.0-a1 * Purpose: Add content below the simple footer in the ACP +acp_simple_header_body_before +=== +* Location: adm/style/simple_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + acp_simple_header_head_append === * Location: adm/style/overall_header.html @@ -118,6 +130,14 @@ forumlist_body_subforums_before * Since: 3.1.0-a4 * Purpose: Add content before the list of subforums (if any) for each forum on the forum list. +forumlist_body_last_row_after +==== +* Locations: + + styles/prosilver/template/forumlist_body.html + + styles/subsilver2/template/forumlist_body.html +* Since: 3.1.0-b2 +* Purpose: Add content after the very last row of the forum list. + index_body_linklist_after === * Locations: @@ -160,6 +180,22 @@ memberlist_body_username_prepend * Purpose: Add information before every username in the memberlist. Works in all display modes (leader, group and normal memberlist). +memberlist_view_contact_after +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Since: 3.1.0-b2 +* Purpose: Add content after the user contact part of any user profile + +memberlist_view_contact_before +=== +* Locations: + + styles/prosilver/template/memberlist_view.html + + styles/subsilver2/template/memberlist_view.html +* Since: 3.1.0-b2 +* Purpose: Add content before the user contact part of any user profile + memberlist_view_content_append === * Locations: @@ -223,6 +259,14 @@ overall_footer_copyright_prepend * Since: 3.1.0-a1 * Purpose: Add content before the copyright line +overall_header_body_before +=== +* Locations: + + styles/prosilver/template/overall_header.html + + styles/subsilver2/template/overall_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + overall_header_breadcrumb_append === * Locations: @@ -319,6 +363,22 @@ posting_editor_subject_before * Since: 3.1.0-a2 * Purpose: Add field (e.g. textbox) to the posting screen before the subject +quickreply_editor_panel_after +=== +* Locations: + + styles/prosilver/template/quickreply_editor.html + + styles/subsilver2/template/quickreply_editor.html +* Since: 3.1.0-b2 +* Purpose: Add content after the quick reply panel (but inside the form) + +quickreply_editor_panel_before +=== +* Locations: + + styles/prosilver/template/quickreply_editor.html + + styles/subsilver2/template/quickreply_editor.html +* Since: 3.1.0-b2 +* Purpose: Add content before the quick reply panel (but inside the form) + quickreply_editor_message_after === * Locations: @@ -342,6 +402,14 @@ simple_footer_after * Since: 3.1.0-a1 * Purpose: Add content directly prior to the `</body>` tag of the simple footer +simple_header_body_before +=== +* Locations: + + styles/prosilver/template/simple_header.html + + styles/subsilver2/template/simple_header.html +* Since: 3.1.0-b2 +* Purpose: Add content to the header body + topiclist_row_prepend === * Locations: diff --git a/phpBB/includes/functions_content.php b/phpBB/includes/functions_content.php index 8122b87e4b..dd9201165b 100644 --- a/phpBB/includes/functions_content.php +++ b/phpBB/includes/functions_content.php @@ -1415,6 +1415,38 @@ function phpbb_add_quickmod_option($option, $lang_string) } /** +* Concatenate an array into a string list. +* +* @param array $items Array of items to concatenate +* @param object $user The phpBB $user object. +* +* @return string String list. Examples: "A"; "A and B"; "A, B, and C" +*/ +function phpbb_generate_string_list($items, $user) +{ + if (empty($items)) + { + return ''; + } + + $count = sizeof($items); + $last_item = array_pop($items); + $lang_key = 'STRING_LIST_MULTI'; + + if ($count == 1) + { + return $last_item; + } + else if ($count == 2) + { + $lang_key = 'STRING_LIST_SIMPLE'; + } + $list = implode($user->lang['COMMA_SEPARATOR'], $items); + + return $user->lang($lang_key, $list, $last_item); +} + +/** * @package phpBB3 */ class bitfield diff --git a/phpBB/includes/ucp/ucp_main.php b/phpBB/includes/ucp/ucp_main.php index f0ce21fb48..b4b14b11d7 100644 --- a/phpBB/includes/ucp/ucp_main.php +++ b/phpBB/includes/ucp/ucp_main.php @@ -354,6 +354,8 @@ class ucp_main 'LAST_POST_AUTHOR_FULL' => get_username_string('full', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), + 'S_UNREAD_FORUM' => $unread_forum, + 'U_LAST_POST' => $last_post_url, 'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $row['forum_id'])) ); diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php index fba78d34aa..501195de72 100644 --- a/phpBB/language/en/common.php +++ b/phpBB/language/en/common.php @@ -422,18 +422,29 @@ $lang = array_merge($lang, array( 'NOT_WATCHING_FORUM' => 'You are no longer subscribed to updates on this forum.', 'NOT_WATCHING_TOPIC' => 'You are no longer subscribed to this topic.', 'NOTIFICATIONS' => 'Notifications', - 'NOTIFICATION_BOOKMARK' => '%1$s replied to the topic "%2$s" you have bookmarked.', - 'NOTIFICATION_BOOKMARK_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$s” you have bookmarked.', + // This applies for NOTIFICATION_BOOKMARK, NOTIFICATION_POST, and NOTIFICATION_QUOTE. + // %1$s will return a list of users that's concatenated using "," and "and" - see STRING_LIST + // Once the user count reaches 5 users or more, the list is trimmed using NOTIFICATION_X_OTHERS + // Examples: + // A replied... + // A and B replied... + // A, B and C replied... + // A, B, C and 2 others replied... + 'NOTIFICATION_BOOKMARK' => array( + 1 => '%1$s replied to the topic “%2$s” you have bookmarked.', + ), 'NOTIFICATION_GROUP_REQUEST' => '%1$s is requesting to join the group %2$s.', 'NOTIFICATION_GROUP_REQUEST_APPROVED' => 'Your request to join the group %1$s has been approved.', 'NOTIFICATION_PM' => '%1$s sent you a Private Message "%2$s".', - 'NOTIFICATION_POST' => '%1$s replied to the topic "%2$s".', - 'NOTIFICATION_POST_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$s”', + 'NOTIFICATION_POST' => array( + 1 => '%1$s replied to the topic “%2$s”.', + ), 'NOTIFICATION_POST_APPROVED' => 'Your post was approved "%2$s".', 'NOTIFICATION_POST_DISAPPROVED' => 'Your post "%1$s" was disapproved for reason: "%2$s".', 'NOTIFICATION_POST_IN_QUEUE' => 'A new post titled "%2$s" was posted by %1$s and needs approval.', - 'NOTIFICATION_QUOTE' => '%1$s quoted you in the post "%2$s".', - 'NOTIFICATION_QUOTE_TRIMMED' => '%1$s and %3$d others replied to the topic “%2$s”', + 'NOTIFICATION_QUOTE' => array( + 1 => '%1$s quoted you in the post “%2$s”.', + ), 'NOTIFICATION_REPORT_PM' => '%1$s reported a Private Message "%2$s" for reason: "%3$s".', 'NOTIFICATION_REPORT_POST' => '%1$s reported a post "%2$s" for reason: "%3$s".', 'NOTIFICATION_REPORT_CLOSED' => '%1$s closed the report you made for "%2$s".', @@ -443,6 +454,10 @@ $lang = array_merge($lang, array( 'NOTIFICATION_TOPIC_IN_QUEUE' => 'A new topic titled "%2$s" was posted by %1$s and needs approval.', 'NOTIFICATION_TYPE_NOT_EXIST' => 'The notification type "%s" is missing from the file system.', 'NOTIFICATION_ADMIN_ACTIVATE_USER' => 'The user “%1$s” is newly registered and requires activation.', + // Used in conjuction with NOTIFICATION_BOOKMARK, NOTIFICATION_POST, and NOTIFICATION_QUOTE. + 'NOTIFICATION_X_OTHERS' => array( + 2 => '%d others', + ), 'NOTIFY_ADMIN' => 'Please notify the board administrator or webmaster.', 'NOTIFY_ADMIN_EMAIL' => 'Please notify the board administrator or webmaster: <a href="mailto:%1$s">%1$s</a>', 'NO_ACCESS_ATTACHMENT' => 'You are not allowed to access this file.', @@ -666,6 +681,8 @@ $lang = array_merge($lang, array( 'START_WATCHING_TOPIC' => 'Subscribe topic', 'STOP_WATCHING_FORUM' => 'Unsubscribe forum', 'STOP_WATCHING_TOPIC' => 'Unsubscribe topic', + 'STRING_LIST_MULTI' => '%1$s, and %2$s', + 'STRING_LIST_SIMPLE' => '%1$s and %2$s', 'SUBFORUM' => 'Subforum', 'SUBFORUMS' => 'Subforums', 'SUBJECT' => 'Subject', diff --git a/phpBB/memberlist.php b/phpBB/memberlist.php index df47fd2f4b..07c7ceaa13 100644 --- a/phpBB/memberlist.php +++ b/phpBB/memberlist.php @@ -596,9 +596,12 @@ switch ($mode) * enabled? * @var bool foes_enabled Is the ucp foes module * enabled? + * @var bool friend Is the user friend? + * @var bool foe Is the user foe? * @since 3.1-A1 + * @changed 3.1.0-b2 Added friend and foe status */ - $vars = array('member', 'user_notes_enabled', 'warn_user_enabled', 'zebra_enabled', 'friends_enabled', 'foes_enabled'); + $vars = array('member', 'user_notes_enabled', 'warn_user_enabled', 'zebra_enabled', 'friends_enabled', 'foes_enabled', 'friend', 'foe'); extract($phpbb_dispatcher->trigger_event('core.memberlist_view_profile', compact($vars))); $template->assign_vars(show_profile($member, $user_notes_enabled, $warn_user_enabled)); diff --git a/phpBB/phpbb/notification/type/post.php b/phpBB/phpbb/notification/type/post.php index b2ad8ff33d..f973becc3b 100644 --- a/phpBB/phpbb/notification/type/post.php +++ b/phpBB/phpbb/notification/type/post.php @@ -205,18 +205,17 @@ class post extends \phpbb\notification\type\base $usernames[] = $this->user_loader->get_username($responder['poster_id'], 'no_profile'); } } - $lang_key = $this->language_key; if ($trimmed_responders_cnt) { - $lang_key .= '_TRIMMED'; + $usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt); } return $this->user->lang( - $lang_key, - implode($this->user->lang['COMMA_SEPARATOR'], $usernames), + $this->language_key, + phpbb_generate_string_list($usernames, $this->user), censor_text($this->get_data('topic_title')), - $trimmed_responders_cnt + $responders_cnt ); } diff --git a/phpBB/styles/prosilver/template/forumlist_body.html b/phpBB/styles/prosilver/template/forumlist_body.html index 3b02431183..0dd47bea9e 100644 --- a/phpBB/styles/prosilver/template/forumlist_body.html +++ b/phpBB/styles/prosilver/template/forumlist_body.html @@ -29,6 +29,7 @@ <li class="row"> <dl class="icon {forumrow.FORUM_IMG_STYLE}"> <dt title="{forumrow.FORUM_FOLDER_IMG_ALT}"> + <!-- IF forumrow.S_UNREAD_FORUM --><a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF S_ENABLE_FEEDS and forumrow.S_FEED_ENABLED --><!-- <a class="feed-icon-forum" title="{L_FEED} - {forumrow.FORUM_NAME}" href="{U_FEED}?f={forumrow.FORUM_ID}"><img src="{T_THEME_PATH}/images/feed.gif" alt="{L_FEED} - {forumrow.FORUM_NAME}" /></a> --><!-- ENDIF --> @@ -87,6 +88,7 @@ </div> </div> + <!-- EVENT forumlist_body_last_row_after --> <!-- ENDIF --> <!-- BEGINELSE --> diff --git a/phpBB/styles/prosilver/template/mcp_forum.html b/phpBB/styles/prosilver/template/mcp_forum.html index 6ca176a4aa..4a8c4c5de9 100644 --- a/phpBB/styles/prosilver/template/mcp_forum.html +++ b/phpBB/styles/prosilver/template/mcp_forum.html @@ -40,6 +40,7 @@ <li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->"> <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF topicrow.S_SELECT_TOPIC --><a href="{topicrow.U_SELECT_TOPIC}" class="topictitle">[ {L_SELECT_MERGE} ]</a> <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/memberlist_view.html b/phpBB/styles/prosilver/template/memberlist_view.html index caff3b287c..57d6fe0911 100644 --- a/phpBB/styles/prosilver/template/memberlist_view.html +++ b/phpBB/styles/prosilver/template/memberlist_view.html @@ -53,6 +53,7 @@ <span class="clear"></span></div> </div> +<!-- EVENT memberlist_view_contact_before --> <div class="panel bg2"> <div class="inner"> <div class="column1"> @@ -104,6 +105,7 @@ </div> <span class="clear"></span></div> </div> +<!-- EVENT memberlist_view_contact_after --> <!-- IF SIGNATURE --> <div class="panel bg1"> diff --git a/phpBB/styles/prosilver/template/overall_header.html b/phpBB/styles/prosilver/template/overall_header.html index df02963e3c..3c4f03c073 100644 --- a/phpBB/styles/prosilver/template/overall_header.html +++ b/phpBB/styles/prosilver/template/overall_header.html @@ -50,6 +50,8 @@ </head> <body id="phpbb" class="nojs section-{SCRIPT_NAME} {S_CONTENT_DIRECTION}"> +<!-- EVENT overall_header_body_before --> + <div id="wrap"> <a id="top" accesskey="t"></a> <div id="page-header"> diff --git a/phpBB/styles/prosilver/template/posting_layout.html b/phpBB/styles/prosilver/template/posting_layout.html index c0bd0225de..0b9ddedf47 100644 --- a/phpBB/styles/prosilver/template/posting_layout.html +++ b/phpBB/styles/prosilver/template/posting_layout.html @@ -7,7 +7,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> diff --git a/phpBB/styles/prosilver/template/quickreply_editor.html b/phpBB/styles/prosilver/template/quickreply_editor.html index 774d013cd3..8da9919db8 100644 --- a/phpBB/styles/prosilver/template/quickreply_editor.html +++ b/phpBB/styles/prosilver/template/quickreply_editor.html @@ -1,4 +1,5 @@ <form method="post" action="{U_QR_ACTION}" id="qr_postform"> +<!-- EVENT quickreply_editor_panel_before --> <div class="panel"> <div class="inner"> <h2>{L_QUICKREPLY}</h2> @@ -21,4 +22,5 @@ </fieldset> </div> </div> +<!-- EVENT quickreply_editor_panel_after --> </form> diff --git a/phpBB/styles/prosilver/template/search_results.html b/phpBB/styles/prosilver/template/search_results.html index da73a7eef9..3307c68627 100644 --- a/phpBB/styles/prosilver/template/search_results.html +++ b/phpBB/styles/prosilver/template/search_results.html @@ -61,16 +61,12 @@ <li class="row<!-- IF searchresults.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> <dl class="icon {searchresults.TOPIC_IMG_STYLE}"> <dt <!-- IF searchresults.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{searchresults.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{searchresults.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> - <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --> - <a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{searchresults.U_NEWEST_POST}" class="topictitle">{searchresults.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> - <!-- ENDIF --> - {searchresults.ATTACH_ICON_IMG} + <!-- IF searchresults.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --> + <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> {searchresults.ATTACH_ICON_IMG} <!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_DELETED --><a href="{searchresults.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> <!-- IF searchresults.S_TOPIC_REPORTED --><a href="{searchresults.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> @@ -88,7 +84,7 @@ </ul> </div> <!-- ENDIF --> - {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{searchresults.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{searchresults.FIRST_POST_TIME}</a><!-- ELSE -->{searchresults.FIRST_POST_TIME}<!-- ENDIF --> » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> + {L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a> <!-- EVENT topiclist_row_append --> </div> diff --git a/phpBB/styles/prosilver/template/simple_header.html b/phpBB/styles/prosilver/template/simple_header.html index 53c86689e0..24a99154d0 100644 --- a/phpBB/styles/prosilver/template/simple_header.html +++ b/phpBB/styles/prosilver/template/simple_header.html @@ -28,6 +28,8 @@ <body id="phpbb" class="nojs {S_CONTENT_DIRECTION}"> +<!-- EVENT simple_header_body_before --> + <div id="simple-wrap"> <a id="top" accesskey="t"></a> <div id="page-body"> diff --git a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html index 96becc42e7..b9e3c16524 100644 --- a/phpBB/styles/prosilver/template/ucp_main_bookmarks.html +++ b/phpBB/styles/prosilver/template/ucp_main_bookmarks.html @@ -36,16 +36,11 @@ <!-- ELSE --> <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD_TOPIC --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ENDIF --> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> - <br /> + <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -62,7 +57,7 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_front.html b/phpBB/styles/prosilver/template/ucp_main_front.html index 861cf87c92..942d26edc6 100644 --- a/phpBB/styles/prosilver/template/ucp_main_front.html +++ b/phpBB/styles/prosilver/template/ucp_main_front.html @@ -15,14 +15,9 @@ <li class="row<!-- IF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt <!-- IF topicrow.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ENDIF --> - <br /> + <!-- IF topicrow.S_UNREAD --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a><br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -39,7 +34,7 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_main_subscribed.html b/phpBB/styles/prosilver/template/ucp_main_subscribed.html index 0187f3cc3f..74ab5226cb 100755 --- a/phpBB/styles/prosilver/template/ucp_main_subscribed.html +++ b/phpBB/styles/prosilver/template/ucp_main_subscribed.html @@ -24,6 +24,7 @@ <li class="row<!-- IF forumrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> <dl class="icon {forumrow.FORUM_IMG_STYLE}"> <dt> + <!-- IF forumrow.S_UNREAD_FORUM --><a href="{forumrow.U_VIEWFORUM}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <a href="{forumrow.U_VIEWFORUM}" class="forumtitle">{forumrow.FORUM_NAME}</a><br /> {forumrow.FORUM_DESC} @@ -35,7 +36,7 @@ </div> </dt> <dd class="lastpost"><!-- IF forumrow.LAST_POST_TIME --><span><dfn>{L_LAST_POST} </dfn>{L_POST_BY_AUTHOR} {forumrow.LAST_POST_AUTHOR_FULL} - <a href="{topicrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{forumrow.LAST_POST_TIME}</span> + <a href="{forumrow.U_LAST_POST}">{LAST_POST_IMG}</a> <br />{forumrow.LAST_POST_TIME}</span> <!-- ELSE -->{L_NO_POSTS}<br /> <!-- ENDIF --> </dd> <dd class="mark"><input type="checkbox" name="f[{forumrow.FORUM_ID}]" id="f{forumrow.FORUM_ID}" /></dd> @@ -71,16 +72,11 @@ <li class="row<!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ELSEIF topicrow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF -->"> <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> - <!-- IF topicrow.S_UNREAD_TOPIC --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ENDIF --> + <!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> - <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --> - <br /> + <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> <!-- IF .topicrow.pagination --> <div class="pagination"> <ul> @@ -97,7 +93,7 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} </div> <div class="responsive-show" style="display: none;"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> diff --git a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html index efe6663db0..b081c14498 100644 --- a/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html +++ b/phpBB/styles/prosilver/template/ucp_pm_viewfolder.html @@ -59,6 +59,7 @@ <li class="row<!-- IF messagerow.S_ROW_COUNT is odd --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF messagerow.PM_CLASS --> {messagerow.PM_CLASS}<!-- ENDIF -->"> <dl class="icon {messagerow.FOLDER_IMG_STYLE}"> <dt<!-- IF messagerow.PM_ICON_URL and S_PM_ICONS --> style="background-image: url({messagerow.PM_ICON_URL}); background-repeat: no-repeat;"<!-- ENDIF -->> + <!-- IF messagerow.S_PM_UNREAD and not messagerow.S_PM_DELETED --><a href="{messagerow.U_VIEW_PM}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- IF messagerow.S_PM_DELETED --> diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html index e4c0a40d3a..b464e18470 100644 --- a/phpBB/styles/prosilver/template/viewforum_body.html +++ b/phpBB/styles/prosilver/template/viewforum_body.html @@ -11,7 +11,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> @@ -141,14 +141,10 @@ <li class="row<!-- IF topicrow.S_ROW_COUNT is even --> bg1<!-- ELSE --> bg2<!-- ENDIF --><!-- IF topicrow.S_POST_GLOBAL --> global-announce<!-- ENDIF --><!-- IF topicrow.S_POST_ANNOUNCE --> announce<!-- ENDIF --><!-- IF topicrow.S_POST_STICKY --> sticky<!-- ENDIF --><!-- IF topicrow.S_TOPIC_REPORTED --> reported<!-- ENDIF -->"> <dl class="icon {topicrow.TOPIC_IMG_STYLE}"> <dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"> + <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{topicrow.U_NEWEST_POST}" class="icon-link"></a><!-- ENDIF --> <div class="list-inner"> <!-- EVENT topiclist_row_prepend --> - <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --> - <a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> - <a href="{topicrow.U_NEWEST_POST}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ELSE --> - <a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> - <!-- ENDIF --> + <!-- IF topicrow.S_UNREAD_TOPIC and not S_IS_BOT --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a> <!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF --> <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br /> @@ -168,7 +164,7 @@ <!-- ENDIF --> <div class="responsive-hide"> <!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF --> - {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » <!-- IF not S_IS_BOT --><a href="{topicrow.U_VIEW_TOPIC}" title="{L_GOTO_FIRST_POST}">{topicrow.FIRST_POST_TIME}</a><!-- ELSE -->{topicrow.FIRST_POST_TIME}<!-- ENDIF --> + {L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME} <!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF --> </div> <!-- IF not S_IS_BOT --> diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html index 4d96a0e392..8103ecda7f 100644 --- a/phpBB/styles/prosilver/template/viewtopic_body.html +++ b/phpBB/styles/prosilver/template/viewtopic_body.html @@ -11,7 +11,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="rules"> + <div class="rules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <div class="inner"> <!-- IF U_FORUM_RULES --> diff --git a/phpBB/styles/prosilver/theme/bidi.css b/phpBB/styles/prosilver/theme/bidi.css index 0c52e12fdc..850726db89 100644 --- a/phpBB/styles/prosilver/theme/bidi.css +++ b/phpBB/styles/prosilver/theme/bidi.css @@ -378,6 +378,18 @@ ul.linklist li.small-icon > a, ul.linklist li.breadcrumbs span:first-child > a { padding-right: 45px; /* Space for folder icon */ } +.rtl dl.icon dt { /* fix for topic row icon links */ + position: relative; +} + +.rtl dl a.icon-link { /* topic row icon links */ + display: inline-block; + left: auto; + right: 0; + margin-left: 0; + margin-right: 2px; +} + .rtl dd.lastpost span, .rtl ul.topiclist dd.info span, .rtl ul.topiclist dd.time span, .rtl dd.redirect span, .rtl dd.moderation span { padding-left: 0; padding-right: 5px; diff --git a/phpBB/styles/prosilver/theme/content.css b/phpBB/styles/prosilver/theme/content.css index 03473a34f4..33b97a0814 100644 --- a/phpBB/styles/prosilver/theme/content.css +++ b/phpBB/styles/prosilver/theme/content.css @@ -162,6 +162,18 @@ dl.icon dt, dl.icon dd { min-height: 35px; } +dl a.icon-link { /* topic row icon links */ + display: block; + width: 30px; + height: 30px; + padding: 0; + position: absolute; + top: 50%; + left: 0; + margin-top: -15px; + margin-left: 9px; +} + dd.posts, dd.topics, dd.views, dd.extra, dd.mark { width: 80px; text-align: center; diff --git a/phpBB/styles/subsilver2/template/forumlist_body.html b/phpBB/styles/subsilver2/template/forumlist_body.html index 63d8aba9bb..0d522a6959 100644 --- a/phpBB/styles/subsilver2/template/forumlist_body.html +++ b/phpBB/styles/subsilver2/template/forumlist_body.html @@ -85,6 +85,7 @@ </td> </tr> <!-- ENDIF --> + <!-- EVENT forumlist_body_last_row_after --> <!-- BEGINELSE --> <tr> <td class="row1" colspan="5" align="center"><p class="gensmall">{L_NO_FORUMS}</p></td> diff --git a/phpBB/styles/subsilver2/template/memberlist_view.html b/phpBB/styles/subsilver2/template/memberlist_view.html index b88bfc7092..52f40707c0 100644 --- a/phpBB/styles/subsilver2/template/memberlist_view.html +++ b/phpBB/styles/subsilver2/template/memberlist_view.html @@ -105,6 +105,7 @@ <td class="cat" align="center"><h4>{L_CONTACT_USER}</h4></td> <td class="cat" align="center"><h4>{L_ABOUT_USER}</h4></td> </tr> + <!-- EVENT memberlist_view_contact_before --> <tr> <td class="row1"> <table width="100%" cellspacing="1" cellpadding="2" border="0"> @@ -166,6 +167,7 @@ </table> </td> </tr> + <!-- EVENT memberlist_view_contact_after --> <!-- IF SIGNATURE --> <tr> <td class="cat" colspan="2" align="center"><h4>{L_SIGNATURE}</h4></td> diff --git a/phpBB/styles/subsilver2/template/overall_header.html b/phpBB/styles/subsilver2/template/overall_header.html index 5da73bd70d..fbf01ce6a8 100644 --- a/phpBB/styles/subsilver2/template/overall_header.html +++ b/phpBB/styles/subsilver2/template/overall_header.html @@ -134,6 +134,8 @@ function marklist(id, name, state) </head> <body class="{S_CONTENT_DIRECTION}"> +<!-- EVENT overall_header_body_before --> + <a name="top"></a> <div id="wrapheader"> diff --git a/phpBB/styles/subsilver2/template/posting_body.html b/phpBB/styles/subsilver2/template/posting_body.html index b501c4146a..321e4227ee 100644 --- a/phpBB/styles/subsilver2/template/posting_body.html +++ b/phpBB/styles/subsilver2/template/posting_body.html @@ -5,7 +5,7 @@ <!-- ENDIF --> <!-- IF S_FORUM_RULES --> - <div class="forumrules"> + <div class="forumrules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <!-- IF U_FORUM_RULES --> <h3>{L_FORUM_RULES}</h3><br /> <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> diff --git a/phpBB/styles/subsilver2/template/quickreply_editor.html b/phpBB/styles/subsilver2/template/quickreply_editor.html index b2b7b1624e..5afc723f48 100644 --- a/phpBB/styles/subsilver2/template/quickreply_editor.html +++ b/phpBB/styles/subsilver2/template/quickreply_editor.html @@ -1,5 +1,5 @@ <form method="post" action="{U_QR_ACTION}"> - +<!-- EVENT quickreply_editor_panel_before --> <table class="tablebg" width="100%" cellspacing="1"> <tr> <th align="center" colspan="2">{L_QUICKREPLY}</th> @@ -24,6 +24,6 @@ </td> </tr> </table> - +<!-- EVENT quickreply_editor_panel_after --> </form> <br clear="all" /> diff --git a/phpBB/styles/subsilver2/template/simple_header.html b/phpBB/styles/subsilver2/template/simple_header.html index 43ca16ed87..85528e6769 100644 --- a/phpBB/styles/subsilver2/template/simple_header.html +++ b/phpBB/styles/subsilver2/template/simple_header.html @@ -12,5 +12,6 @@ </head> <body class="{S_CONTENT_DIRECTION}"> +<!-- EVENT simple_header_body_before --> <a name="top"></a> <div id="wrapcentre"> diff --git a/phpBB/styles/subsilver2/template/viewforum_body.html b/phpBB/styles/subsilver2/template/viewforum_body.html index 3d4336a2a3..af14fc0129 100644 --- a/phpBB/styles/subsilver2/template/viewforum_body.html +++ b/phpBB/styles/subsilver2/template/viewforum_body.html @@ -1,7 +1,7 @@ <!-- INCLUDE overall_header.html --> <!-- IF S_FORUM_RULES --> - <div class="forumrules"> + <div class="forumrules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <!-- IF U_FORUM_RULES --> <h3>{L_FORUM_RULES}</h3><br /> <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> diff --git a/phpBB/styles/subsilver2/template/viewtopic_body.html b/phpBB/styles/subsilver2/template/viewtopic_body.html index f8f95c660d..6f2f1141a9 100644 --- a/phpBB/styles/subsilver2/template/viewtopic_body.html +++ b/phpBB/styles/subsilver2/template/viewtopic_body.html @@ -1,7 +1,7 @@ <!-- INCLUDE overall_header.html --> <!-- IF S_FORUM_RULES --> - <div class="forumrules"> + <div class="forumrules<!-- IF U_FORUM_RULES --> rules-link<!-- ENDIF -->"> <!-- IF U_FORUM_RULES --> <h3>{L_FORUM_RULES}</h3><br /> <a href="{U_FORUM_RULES}"><b>{L_FORUM_RULES_LINK}</b></a> diff --git a/tests/functions/generate_string_list.php b/tests/functions/generate_string_list.php new file mode 100644 index 0000000000..cfc150c1f4 --- /dev/null +++ b/tests/functions/generate_string_list.php @@ -0,0 +1,60 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_generate_string_list_test extends phpbb_test_case +{ + public $user; + + public function setUp() + { + parent::setUp(); + + $this->user = new \phpbb\user(); + $this->user->data = array('user_lang' => 'en'); + $this->user->add_lang('common'); + } + + public function generate_string_list_data() + { + return array( + array( + array(), + '', + ), + array( + array('A'), + 'A', + ), + array( + array(2 => 'A', 3 => 'B'), + 'A and B', + ), + array( + array('A' => 'A', 'B' => 'B', 'C' => 'C'), + 'A, B, and C', + ), + array( + array('A', 'B', 'C', 'D'), + 'A, B, C, and D', + ) + ); + } + + /** + * @dataProvider generate_string_list_data + */ + public function test_generate_string_list($items, $expected_result) + { + $result = phpbb_generate_string_list($items, $this->user); + $this->assertEquals($expected_result, $result); + } +} diff --git a/tests/mock/notification_type_post.php b/tests/mock/notification_type_post.php new file mode 100644 index 0000000000..80f2afbae0 --- /dev/null +++ b/tests/mock/notification_type_post.php @@ -0,0 +1,36 @@ +<?php +/** +* +* @package notifications +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +/** +* @ignore +*/ +if (!defined('IN_PHPBB')) +{ + exit; +} + +class phpbb_mock_notification_type_post extends \phpbb\notification\type\post +{ + public function __construct($user_loader, $db, $cache, $user, $auth, $config, $phpbb_root_path, $php_ext, $notification_types_table, $notifications_table, $user_notifications_table) + { + $this->user_loader = $user_loader; + $this->db = $db; + $this->cache = $cache; + $this->user = $user; + $this->auth = $auth; + $this->config = $config; + + $this->phpbb_root_path = $phpbb_root_path; + $this->php_ext = $php_ext; + + $this->notification_types_table = $notification_types_table; + $this->notifications_table = $notifications_table; + $this->user_notifications_table = $user_notifications_table; + } +} diff --git a/tests/notification/fixtures/user_list_trim.xml b/tests/notification/fixtures/user_list_trim.xml new file mode 100644 index 0000000000..4f708714da --- /dev/null +++ b/tests/notification/fixtures/user_list_trim.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8" ?> +<dataset> + <table name="phpbb_users"> + <column>user_id</column> + <column>username</column> + <column>username_clean</column> + <column>user_colour</column> + <column>user_permissions</column> + <column>user_sig</column> + <row> + <value>2</value> + <value>A</value> + <value>a</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>3</value> + <value>B</value> + <value>b</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>4</value> + <value>C</value> + <value>c</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>5</value> + <value>D</value> + <value>d</value> + <value></value> + <value></value> + <value></value> + </row> + <row> + <value>6</value> + <value>E</value> + <value>e</value> + <value></value> + <value></value> + <value></value> + </row> + </table> +</dataset> diff --git a/tests/notification/user_list_trim_test.php b/tests/notification/user_list_trim_test.php new file mode 100644 index 0000000000..a8422f80b5 --- /dev/null +++ b/tests/notification/user_list_trim_test.php @@ -0,0 +1,139 @@ +<?php +/** +* +* @package testing +* @copyright (c) 2014 phpBB Group +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 +* +*/ + +require_once dirname(__FILE__) . '/../../phpBB/includes/functions_content.php'; +require_once dirname(__FILE__) . '/../../phpBB/includes/functions.php'; + +class phpbb_notification_user_list_trim_test extends phpbb_database_test_case +{ + protected $notification; + + public function getDataSet() + { + return $this->createXMLDataSet(dirname(__FILE__) . '/fixtures/user_list_trim.xml'); + } + + public function setUp() + { + global $phpbb_root_path, $phpEx, $phpbb_dispatcher, $user, $cache, $auth; + + parent::setUp(); + + $phpbb_dispatcher = new phpbb_mock_event_dispatcher(); + $db = $this->new_dbal(); + + $config = new \phpbb\config\config(array()); + set_config(null, null, null, $config); + set_config_count(null, null, null, $config); + + $cache = new \phpbb\cache\service( + new \phpbb\cache\driver\null(), + $config, + $db, + $phpbb_root_path, + $phpEx + ); + + $auth = $this->getMock('\phpbb\auth\auth'); + $auth->expects($this->any()) + ->method('acl_get') + ->with($this->stringContains('_'), + $this->anything()) + ->will($this->returnValueMap(array( + array('u_viewprofile', 1, false), + ))); + + $user = new \phpbb\user(); + $user->data = array('user_lang' => 'en'); + $user->add_lang('common'); + + $user_loader = new phpbb\user_loader($db, $phpbb_root_path, $phpEx, USERS_TABLE); + $user_loader->load_users(array(2, 3, 4, 5, 6)); + + $this->notification = new phpbb_mock_notification_type_post( + $user_loader, null, null, $user, null, null, $phpbb_root_path, $phpEx, null, null, null + ); + } + + public function user_list_trim_data() + { + return array( + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => null, + ), + 'A replied to the topic “Test”.', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + ), + ), + 'A and B replied to the topic “Test”.', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + ), + ), + 'A, B, and C replied to the topic “Test”.', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + array('username' => '', 'poster_id' => 5), + ), + ), + 'A, B, C, and D replied to the topic “Test”.', + ), + array( + array( + 'topic_title' => 'Test', + 'poster_id' => 2, + 'post_username' => 'A', + 'responders' => array( + array('username' => '', 'poster_id' => 3), + array('username' => '', 'poster_id' => 4), + array('username' => '', 'poster_id' => 5), + array('username' => '', 'poster_id' => 6), + ), + ), + 'A, B, C, and 2 others replied to the topic “Test”.', + ), + ); + } + + /** + * @dataProvider user_list_trim_data + */ + public function test_user_list_trim($data, $expected_result) + { + $data = array('notification_data' => serialize($data)); + $this->notification->set_initial_data($data); + + $this->assertEquals($expected_result, $this->notification->get_title()); + } +} |