From 4038091382fb9d5e429c1eaee79413f077a54d2d Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Mon, 9 May 2011 23:11:56 +0200 Subject: [ticket/9999] Remove broken and unused L_FORUM_FOLDER_ALT variable. L_FORUM_FOLDER_ALT was supposed to be a language variable but the language variable is never looked up but directly passed as L_FORUM_FOLDER_ALT instead. Also, the expected functionality is correctly implemented by FORUM_FOLDER_IMG_ALT. PHPBB3-9999 --- phpBB/includes/functions_display.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index acaef49fe8..d7422aa2c9 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -477,7 +477,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'SUBFORUMS' => $s_subforums_list, 'L_SUBFORUM_STR' => $l_subforums, - 'L_FORUM_FOLDER_ALT' => $folder_alt, 'L_MODERATOR_STR' => $l_moderator, 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', -- cgit v1.2.1 From b2a65ac76db38e47c0644389ba737492ef6307f6 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 6 Jul 2011 13:40:21 +0200 Subject: [ticket/10237] Use confirm-box to handle unwatching a forum/topic actions PHPBB3-10237 --- phpBB/includes/functions_display.php | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index d7422aa2c9..496da72344 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1097,22 +1097,34 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $message = $user->lang['ERR_UNWATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); trigger_error($message); } - if ($_GET['unwatch'] == $mode) - { - $is_watching = 0; + if (confirm_box(true)) + { $sql = 'DELETE FROM ' . $table_sql . " WHERE $where_sql = $match_id AND user_id = $user_id"; $db->sql_query($sql); - } - - $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - meta_refresh(3, $redirect_url); + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + meta_refresh(3, $redirect_url); + trigger_error($message); + } + else + { + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'unwatch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } - $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); - trigger_error($message); + confirm_box(false, 'UNWATCH_' . strtoupper($mode), build_hidden_fields($s_hidden_fields)); + } } else { -- cgit v1.2.1 From 773561f862e9cf4016a4176454e3fb59489259ac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Jul 2011 19:20:45 +0200 Subject: [ticket/10237] Handle watching and unwatching the same way. Also add some information to the confirm-box (forum_name / topic title) PHPBB3-10237 --- phpBB/includes/functions_display.php | 54 +++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 496da72344..391b56ab69 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1058,7 +1058,7 @@ function display_user_activity(&$userdata) /** * Topic and forum watching common code */ -function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0) +function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $notify_status = 'unset', $start = 0, $item_title = '') { global $template, $db, $user, $phpEx, $start, $phpbb_root_path; @@ -1091,15 +1091,17 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if (isset($_GET['unwatch'])) { $uid = request_var('uid', 0); - if ($uid != $user_id) - { - $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['ERR_UNWATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); - trigger_error($message); - } + $token = request_var('hash', ''); - if (confirm_box(true)) + if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true)) { + if (($uid != $user_id) || ($_GET['unwatch'] != $mode)) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_UNWATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + trigger_error($message); + } + $sql = 'DELETE FROM ' . $table_sql . " WHERE $where_sql = $match_id AND user_id = $user_id"; @@ -1123,7 +1125,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $s_hidden_fields['t'] = $topic_id; } - confirm_box(false, 'UNWATCH_' . strtoupper($mode), build_hidden_fields($s_hidden_fields)); + $confirm_box_message = (($item_title == '') ? 'UNWATCH_' . strtoupper($mode) : $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title)); + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); } } else @@ -1144,26 +1147,45 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { if (isset($_GET['watch'])) { + $uid = request_var('uid', 0); $token = request_var('hash', ''); - $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - if ($_GET['watch'] == $mode && check_link_hash($token, "{$mode}_$match_id")) + if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true)) { + if (($uid != $user_id) || ($_GET['watch'] != $mode)) + { + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); + $message = $user->lang['ERR_WATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + trigger_error($message); + } + $is_watching = true; $sql = 'INSERT INTO ' . $table_sql . " (user_id, $where_sql, notify_status) VALUES ($user_id, $match_id, " . NOTIFY_YES . ')'; $db->sql_query($sql); + + $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ARE_WATCHING_' . strtoupper($mode)] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + meta_refresh(3, $redirect_url); + trigger_error($message); } else { - $message = $user->lang['ERR_WATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); - } - - meta_refresh(3, $redirect_url); + $s_hidden_fields = array( + 'uid' => $user->data['user_id'], + 'watch' => $mode, + 'start' => $start, + 'f' => $forum_id, + ); + if ($mode != 'forum') + { + $s_hidden_fields['t'] = $topic_id; + } - trigger_error($message); + $confirm_box_message = (($item_title == '') ? 'WATCH_' . strtoupper($mode) : $user->lang('WATCH_' . strtoupper($mode) . '_DETAILED', $item_title)); + confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); + } } else { -- cgit v1.2.1 From d60ffdd55c4066b8e69c0522c464ec1ada4b0913 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 11 Jul 2011 19:31:11 +0200 Subject: [ticket/10237] Also display login-box on subscribing PHPBB3-10237 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 391b56ab69..7982b9908d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1195,7 +1195,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, } else { - if (isset($_GET['unwatch']) && $_GET['unwatch'] == $mode) + if ((isset($_GET['unwatch']) && $_GET['unwatch'] == $mode) || (isset($_GET['watch']) && $_GET['watch'] == $mode)) { login_box(); } -- cgit v1.2.1 From 4f8bb02a57dbc11a1c390abf7ca70fd08d8fd5c2 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Thu, 25 Aug 2011 17:33:39 +0200 Subject: [ticket/10320] Exclude passworded forums when determining "Most active topic". PHPBB3-10320 --- phpBB/includes/functions_display.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7982b9908d..4d66e17fe9 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -996,13 +996,17 @@ function display_user_activity(&$userdata) } // Obtain active topic + // We need to exclude passworded forums here so we do not leak the topic title + $forum_ary_topic = array_unique(array_merge($forum_ary, $user->get_passworded_forums())); + $forum_sql_topic = (!empty($forum_ary_topic)) ? 'AND ' . $db->sql_in_set('forum_id', $forum_ary_topic, true) : ''; + $sql = 'SELECT topic_id, COUNT(post_id) AS num_posts FROM ' . POSTS_TABLE . ' WHERE poster_id = ' . $userdata['user_id'] . " AND post_postcount = 1 AND (post_approved = 1 $sql_m_approve) - $forum_sql + $forum_sql_topic GROUP BY topic_id ORDER BY num_posts DESC"; $result = $db->sql_query_limit($sql, 1); -- cgit v1.2.1 From e4e854863f872c37ef82d9f468408d7528850dae Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Aug 2011 03:29:05 +0200 Subject: [ticket/9995] Remove useless statement from display_forums() The $forum_ids array is only used if $mark_read == 'forums'. When $mark_read == 'forums', we either continue when $auth->acl_get('f_list', $forum_id) is false or true. So this statement is never useful. PHPBB3-9995 --- phpBB/includes/functions_display.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7982b9908d..0e62a0bb14 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -152,8 +152,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod continue; } - $forum_ids[] = $forum_id; - if ($config['load_db_lastread'] && $user->data['is_registered']) { $forum_tracking_info[$forum_id] = (!empty($row['mark_time'])) ? $row['mark_time'] : $user->data['user_lastmark']; -- cgit v1.2.1 From afc35f610d6a93b8b753f7b8b0ce12f4ea0f8cd0 Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Aug 2011 03:32:36 +0200 Subject: [ticket/9995] Always continue when harvesting $forum_ids for markread(). PHPBB3-9995 --- phpBB/includes/functions_display.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 0e62a0bb14..f5941fe75f 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -125,8 +125,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($auth->acl_get('f_list', $forum_id)) { $forum_ids[] = $forum_id; - continue; } + + continue; } // Category with no members -- cgit v1.2.1 From 7ae871dfaefb00579ec9cc9eaf3e1d0bc7c82fed Mon Sep 17 00:00:00 2001 From: Andreas Fischer Date: Fri, 26 Aug 2011 03:59:39 +0200 Subject: [ticket/9995] Do not run forum SQL query when marking the whole board read. PHPBB3-9995 --- phpBB/includes/functions_display.php | 41 ++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index f5941fe75f..0dcfab8449 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -51,6 +51,27 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $sql_where = 'left_id > ' . $root_data['left_id'] . ' AND left_id < ' . $root_data['right_id']; } + // Handle marking everything read + if ($mark_read == 'all') + { + $redirect = build_url(array('mark', 'hash')); + meta_refresh(3, $redirect); + + if (check_link_hash(request_var('hash', ''), 'global')) + { + markread('all'); + + trigger_error( + $user->lang['FORUMS_MARKED'] . '

' . + sprintf($user->lang['RETURN_INDEX'], '', '') + ); + } + else + { + trigger_error(sprintf($user->lang['RETURN_PAGE'], '', '')); + } + } + // Display list of active topics for this category? $show_active = (isset($root_data['forum_flags']) && ($root_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS)) ? true : false; @@ -120,7 +141,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_id = $row['forum_id']; // Mark forums read? - if ($mark_read == 'forums' || $mark_read == 'all') + if ($mark_read == 'forums') { if ($auth->acl_get('f_list', $forum_id)) { @@ -254,24 +275,16 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $db->sql_freeresult($result); // Handle marking posts - if ($mark_read == 'forums' || $mark_read == 'all') + if ($mark_read == 'forums') { $redirect = build_url(array('mark', 'hash')); $token = request_var('hash', ''); if (check_link_hash($token, 'global')) { - if ($mark_read == 'all') - { - markread('all'); - $message = sprintf($user->lang['RETURN_INDEX'], '', ''); - } - else - { - // Add 0 to forums array to mark global announcements correctly - $forum_ids[] = 0; - markread('topics', $forum_ids); - $message = sprintf($user->lang['RETURN_FORUM'], '', ''); - } + // Add 0 to forums array to mark global announcements correctly + $forum_ids[] = 0; + markread('topics', $forum_ids); + $message = sprintf($user->lang['RETURN_FORUM'], '', ''); meta_refresh(3, $redirect); trigger_error($user->lang['FORUMS_MARKED'] . '

' . $message); } -- cgit v1.2.1 From 830c3f4047d0718ed398c38d4640cc0f1fe77a7f Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Sat, 3 Sep 2011 23:50:00 +0300 Subject: [feature/remove-imagesets] Adjustments to php files Removing imagesets. Adjustments to php files PHPBB3-10336 --- phpBB/includes/functions_display.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 131e3c1321..08442f0913 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -458,7 +458,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $l_post_click_count => $post_click_count, 'FORUM_IMG_STYLE' => $folder_image, 'FORUM_FOLDER_IMG' => $user->img($folder_image, $folder_alt), - 'FORUM_FOLDER_IMG_SRC' => $user->img($folder_image, $folder_alt, false, '', 'src'), 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', -- cgit v1.2.1 From b38fbc6d25d1f76683acec83627238ed5b5dbf8c Mon Sep 17 00:00:00 2001 From: Vjacheslav Trushkin Date: Tue, 4 Oct 2011 12:24:42 +0300 Subject: [ticket/10397] Pagination inconsistency fix Fixing topic_generate_pagination() PHPBB3-10397 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 14d0c44dcf..86eabc419c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -674,7 +674,7 @@ function topic_generate_pagination($replies, $url) $pagination .= '' . $times . ''; if ($times == 1 && $total_pages > 5) { - $pagination .= ' ... '; + $pagination .= ' ... '; // Display the last three pages $times = $total_pages - 3; -- cgit v1.2.1 From da8cac280c0d7067291ee173a06a92e24a906d6e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 29 Oct 2011 16:26:17 +0200 Subject: [ticket/9036] Add template variable 'S_AUTH_READ' to forumlist PHPBB3-9036 --- phpBB/includes/functions_display.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 14d0c44dcf..88be332eff 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -465,6 +465,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_NO_CAT' => $catless && !$last_catless, 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, 'S_UNREAD_FORUM' => $forum_unread, + 'S_AUTH_READ' => $auth->acl_get('f_read', $row['forum_id']), 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, -- cgit v1.2.1 From 1a19388aa38113262db648caedd4a745f5691ed1 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jul 2011 00:55:49 +0200 Subject: [ticket/10237] Display login-box for guests, when (un)subscribing Also initialise $is_watching for PHP Notice: Undefined variable is_watching PHPBB3-10237 --- phpBB/includes/functions_display.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7982b9908d..ffc9fecb5e 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1067,6 +1067,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $match_id = ($mode == 'forum') ? $forum_id : $topic_id; $u_url = "uid={$user->data['user_id']}"; $u_url .= ($mode == 'forum') ? '&f' : '&f=' . $forum_id . '&t'; + $is_watching = 0; // Is user watching this thread? if ($user_id != ANONYMOUS) @@ -1093,9 +1094,9 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $uid = request_var('uid', 0); $token = request_var('hash', ''); - if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true)) + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { - if (($uid != $user_id) || ($_GET['unwatch'] != $mode)) + if ($uid != $user_id || $_GET['unwatch'] != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_UNWATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); @@ -1108,7 +1109,8 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $db->sql_query($sql); $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); - $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); + $message = $user->lang['NOT_WATCHING_' . strtoupper($mode)] . '

'; + $message .= sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); meta_refresh(3, $redirect_url); trigger_error($message); } @@ -1125,7 +1127,14 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $s_hidden_fields['t'] = $topic_id; } - $confirm_box_message = (($item_title == '') ? 'UNWATCH_' . strtoupper($mode) : $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title)); + if ($item_title == '') + { + $confirm_box_message = 'UNWATCH_' . strtoupper($mode); + } + else + { + $confirm_box_message = $user->lang('UNWATCH_' . strtoupper($mode) . '_DETAILED', $item_title); + } confirm_box(false, $confirm_box_message, build_hidden_fields($s_hidden_fields)); } } @@ -1150,9 +1159,9 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, $uid = request_var('uid', 0); $token = request_var('hash', ''); - if (($token && check_link_hash($token, "{$mode}_$match_id")) || confirm_box(true)) + if ($token && check_link_hash($token, "{$mode}_$match_id") || confirm_box(true)) { - if (($uid != $user_id) || ($_GET['watch'] != $mode)) + if ($uid != $user_id || $_GET['watch'] != $mode) { $redirect_url = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&start=$start"); $message = $user->lang['ERR_WATCHING'] . '

' . sprintf($user->lang['RETURN_' . strtoupper($mode)], '', ''); -- cgit v1.2.1 From 4c77903129749008cd08c346006d2a57cf6ff544 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 21 Nov 2011 16:22:07 +0100 Subject: [ticket/10484] Use variables for sql_build_query() calls It's easier for mods/extensions to extend the arrays. PHPBB3-10484 --- phpBB/includes/functions_display.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 39d0793030..2b871a21ec 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -110,7 +110,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $sql_array['SELECT'] .= ', fa.user_id'; } - $sql = $db->sql_build_query('SELECT', array( + $sql_ary = array( 'SELECT' => $sql_array['SELECT'], 'FROM' => $sql_array['FROM'], 'LEFT_JOIN' => $sql_array['LEFT_JOIN'], @@ -118,8 +118,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'WHERE' => $sql_where, 'ORDER_BY' => 'f.left_id', - )); + ); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); $forum_tracking_info = array(); -- cgit v1.2.1 From 88ae40a4b19360645d5e5a614cc378e7cce4afe3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 14 Sep 2011 00:28:52 +0200 Subject: [ticket/10345] Make use of the plural function in some basic places PHPBB3-10345 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 2b871a21ec..2ec34e1084 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1043,10 +1043,10 @@ function display_user_activity(&$userdata) $template->assign_vars(array( 'ACTIVE_FORUM' => $active_f_name, - 'ACTIVE_FORUM_POSTS' => ($active_f_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_f_count), + 'ACTIVE_FORUM_POSTS' => $user->lang('USER_POSTS', (int) $active_f_count), 'ACTIVE_FORUM_PCT' => sprintf($l_active_pct, $active_f_pct), 'ACTIVE_TOPIC' => censor_text($active_t_name), - 'ACTIVE_TOPIC_POSTS' => ($active_t_count == 1) ? sprintf($user->lang['USER_POST'], 1) : sprintf($user->lang['USER_POSTS'], $active_t_count), + 'ACTIVE_TOPIC_POSTS' => $user->lang('USER_POSTS', (int) $active_t_count), 'ACTIVE_TOPIC_PCT' => sprintf($l_active_pct, $active_t_pct), 'U_ACTIVE_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $active_f_id), 'U_ACTIVE_TOPIC' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 't=' . $active_t_id), -- cgit v1.2.1 From 7a04c9048c110f0bd21ea3e9e869e17b408d640e Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 31 Dec 2011 13:32:52 +0000 Subject: [ticket/9916] Updating header license and removing Version $Id$ PHPBB3-9916 --- phpBB/includes/functions_display.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 2ec34e1084..9335cabc15 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -2,9 +2,8 @@ /** * * @package phpBB3 -* @version $Id$ * @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License +* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2 * */ -- cgit v1.2.1 From 41d8a777dc73350a2f3bba6aaae2686921110d08 Mon Sep 17 00:00:00 2001 From: Igor Wiedler Date: Sat, 31 Mar 2012 01:26:04 +0200 Subject: [feature/ajax] Add entirely unrelated but nice newlines PHPBB3-10270 --- phpBB/includes/functions_display.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9335cabc15..18db64cc68 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -273,6 +273,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod markread('topics', $forum_ids); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); meta_refresh(3, $redirect); + trigger_error($user->lang['FORUMS_MARKED'] . '

' . $message); } else -- cgit v1.2.1 From f32547c2150a3e6201edf0f856a93229040c73be Mon Sep 17 00:00:00 2001 From: Rahul Date: Sat, 24 Mar 2012 12:57:28 +0530 Subject: [ticket/10650] Displaying last topic on forum list The most recent topic title of the forum can now be displayed on the board index. An option is provided in the ACP under the 'General Forum Setting' which allows the admin to enable or disable this feature. PHPBB3-10650 --- phpBB/includes/functions_display.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 18db64cc68..9b80763ee4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -451,6 +451,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, + 'S_DISPLAY_SUBJECT' => ($row['display_last_subject']) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 663b5f6542cc3088919836324f71413320997fe8 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Tue, 3 Apr 2012 21:36:26 +0530 Subject: [ticket/10650] Cropped subject and inserted newline The subject being displayed in the forum list have been shortened to 30 characters. Also it is now being shown in a separate line. PHPBB3-10650 --- phpBB/includes/functions_display.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9b80763ee4..b331ed7d71 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,6 +397,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; + if (strlen($last_post_subject) > 30) + { + $last_post_subject = substr($last_post_subject, 0, 30); + $last_post_subject .= '...'; + } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } -- cgit v1.2.1 From 08bee4c522dd68f7da591fd8ea7a674ac5b9bf67 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 00:39:52 +0530 Subject: [ticket/10650]Added permission checking and utf8 functions Passworded forums and ones in which user doesn't have read access will be excluded. Also uft8 based string functions and html encode/decode functions have been used to sanitise subject. PHPBB3-10650 --- phpBB/includes/functions_display.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b331ed7d71..8e0005eadf 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,9 +397,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - if (strlen($last_post_subject) > 30) - { - $last_post_subject = substr($last_post_subject, 0, 30); + if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) + { + $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); $last_post_subject .= '...'; } $last_post_time = $user->format_date($row['forum_last_post_time']); @@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($row['display_last_subject']) ? true : false, + 'S_DISPLAY_SUBJECT' => ($row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 7bb9e301994cb9789478b32c1282238e5762acee Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 01:19:46 +0530 Subject: [ticket/10650] Corrected intendation Corrected the intendation of if condition. PHPBB3-10650 --- phpBB/includes/functions_display.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 8e0005eadf..a28f546be0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -398,10 +398,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { $last_post_subject = $row['forum_last_post_subject']; if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) - { - $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); - $last_post_subject .= '...'; - } + { + $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); + $last_post_subject .= '...'; + } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } -- cgit v1.2.1 From 3e9711d6a4c1786ec4702b1d87810c4ed0182953 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 02:02:02 +0530 Subject: [ticket/10650] Added checking for empty subjects Now empty subjects will not be displayed in a new line on the forum list. PHPBB3-10650 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a28f546be0..4e70a4911c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject && $row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 98964a913cb22761553d04170aa4830e324f7488 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Wed, 4 Apr 2012 18:28:36 -0400 Subject: [ticket/10650] Revert merge of 'rahulr92/ticket/10650' into develop The pull request (#654) was merged a little too quickly. In particular, display_last_subject per-forum option needs consensus. This reverts commit b1fb34a4d7e446768b9f66ba6dd359173cd2a5fb, reversing changes made to 7d6b289671c51694f17dd5f9849abf2534b55e59. PHPBB3-10650 --- phpBB/includes/functions_display.php | 6 ------ 1 file changed, 6 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4e70a4911c..18db64cc68 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,11 +397,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) - { - $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); - $last_post_subject .= '...'; - } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } @@ -456,7 +451,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($last_post_subject && $row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 9b30bd639201ffbbf1d1b3ae32fda7e75d3253dd Mon Sep 17 00:00:00 2001 From: Rahul Date: Sat, 24 Mar 2012 12:57:28 +0530 Subject: [ticket/10650] Displaying last topic on forum list The most recent topic title of the forum can now be displayed on the board index. An option is provided in the ACP under the 'General Forum Setting' which allows the admin to enable or disable this feature. PHPBB3-10650 --- phpBB/includes/functions_display.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 18db64cc68..9b80763ee4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -451,6 +451,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, + 'S_DISPLAY_SUBJECT' => ($row['display_last_subject']) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 720fc46807f92364321bcb26291eafea1688c5ca Mon Sep 17 00:00:00 2001 From: Rahul R Date: Tue, 3 Apr 2012 21:36:26 +0530 Subject: [ticket/10650] Cropped subject and inserted newline The subject being displayed in the forum list have been shortened to 30 characters. Also it is now being shown in a separate line. PHPBB3-10650 --- phpBB/includes/functions_display.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9b80763ee4..b331ed7d71 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,6 +397,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; + if (strlen($last_post_subject) > 30) + { + $last_post_subject = substr($last_post_subject, 0, 30); + $last_post_subject .= '...'; + } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } -- cgit v1.2.1 From 4bb20d7ceaf4d8f2cf19fa7f79ba239156326045 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 00:39:52 +0530 Subject: [ticket/10650]Added permission checking and utf8 functions Passworded forums and ones in which user doesn't have read access will be excluded. Also uft8 based string functions and html encode/decode functions have been used to sanitise subject. PHPBB3-10650 --- phpBB/includes/functions_display.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b331ed7d71..8e0005eadf 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,9 +397,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - if (strlen($last_post_subject) > 30) - { - $last_post_subject = substr($last_post_subject, 0, 30); + if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) + { + $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); $last_post_subject .= '...'; } $last_post_time = $user->format_date($row['forum_last_post_time']); @@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($row['display_last_subject']) ? true : false, + 'S_DISPLAY_SUBJECT' => ($row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 630c0397b9a1735fc60ef3704be41d05e4929ceb Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 01:19:46 +0530 Subject: [ticket/10650] Corrected intendation Corrected the intendation of if condition. PHPBB3-10650 --- phpBB/includes/functions_display.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 8e0005eadf..a28f546be0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -398,10 +398,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { $last_post_subject = $row['forum_last_post_subject']; if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) - { - $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); - $last_post_subject .= '...'; - } + { + $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); + $last_post_subject .= '...'; + } $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } -- cgit v1.2.1 From 2a8481d68188480061e9769711195091f05f7134 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Thu, 5 Apr 2012 02:02:02 +0530 Subject: [ticket/10650] Added checking for empty subjects Now empty subjects will not be displayed in a new line on the forum list. PHPBB3-10650 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a28f546be0..4e70a4911c 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject && $row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From c524236ef6d84f6ef78f684aeb7bb469ca844db4 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Fri, 6 Apr 2012 01:07:23 +0530 Subject: [ticket/10650] Changed acp option from per forum to global Changed the display last subject acp toggle option from per forum to global. Modified associated database entries. New option is available in ACP General->Board Features. Also corrected
in forumlist_body.html. PHPBB3-10650 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 4e70a4911c..99adf6f6a7 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -456,7 +456,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'S_LOCKED_FORUM' => ($row['forum_status'] == ITEM_LOCKED) ? true : false, 'S_LIST_SUBFORUMS' => ($row['display_subforum_list']) ? true : false, 'S_SUBFORUMS' => (sizeof($subforums_list)) ? true : false, - 'S_DISPLAY_SUBJECT' => ($last_post_subject && $row['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, + 'S_DISPLAY_SUBJECT' => ($last_post_subject && $config['display_last_subject'] && !$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? true : false, 'S_FEED_ENABLED' => ($config['feed_forum'] && !phpbb_optionget(FORUM_OPTION_FEED_EXCLUDE, $row['forum_options']) && $row['forum_type'] == FORUM_POST) ? true : false, 'FORUM_ID' => $row['forum_id'], -- cgit v1.2.1 From 094dbe7ccc22119aa50963ae4714a00e76aef9a5 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Sun, 8 Apr 2012 12:25:25 +0530 Subject: [ticket/10650] Made use of truncate_string() function Removed manual cropping and used truncate_string function. Also made a new variable so that is preserved. PHPBB3-10650 --- phpBB/includes/functions_display.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 99adf6f6a7..fbb6d65b92 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,11 +397,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - if (utf8_strlen(htmlspecialchars_decode($last_post_subject)) > 30) - { - $last_post_subject = htmlspecialchars(utf8_substr(htmlspecialchars_decode($last_post_subject, 0, 30))); - $last_post_subject .= '...'; - } + $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255 ,false, '…'); $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } @@ -470,6 +466,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', 'LAST_POST_SUBJECT' => censor_text($last_post_subject), + 'LAST_POST_SUBJECT_TRUNCATED' => censor_text($last_post_subject_truncated), 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), -- cgit v1.2.1 From 2dec700aabcb8b5bebf707b41378ede61512e745 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Sun, 8 Apr 2012 22:52:49 +0530 Subject: [ticket/10650] Added ellipsis to language file Added ELLIPSIS to language file common.php and also corrected language explanation of ACP option. PHPBB3-10650 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index fbb6d65b92..138749d2db 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,7 +397,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255 ,false, '…'); + $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255 ,false, $user->lang['ELLIPSIS']); $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } -- cgit v1.2.1 From 1e4710b1949155543a729d36b5da89c9c965f6c0 Mon Sep 17 00:00:00 2001 From: Rahul R Date: Tue, 10 Apr 2012 08:22:52 +0530 Subject: [ticket/10650] Moving censoring to before truncation The censor_text function is now being applied to the last_post_subject before being truncated. PHPBB3-10650 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 138749d2db..950c1f0cd8 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -397,7 +397,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($row['forum_last_post_id']) { $last_post_subject = $row['forum_last_post_subject']; - $last_post_subject_truncated = truncate_string($last_post_subject, 30, 255 ,false, $user->lang['ELLIPSIS']); + $last_post_subject_truncated = truncate_string(censor_text($last_post_subject), 30, 255, false, $user->lang['ELLIPSIS']); $last_post_time = $user->format_date($row['forum_last_post_time']); $last_post_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $row['forum_id_last_post'] . '&p=' . $row['forum_last_post_id']) . '#p' . $row['forum_last_post_id']; } @@ -466,7 +466,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', 'LAST_POST_SUBJECT' => censor_text($last_post_subject), - 'LAST_POST_SUBJECT_TRUNCATED' => censor_text($last_post_subject_truncated), + 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated, 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), -- cgit v1.2.1 From fc3a19567f1852389dfa78472cca4b1d01387bfa Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 16 May 2012 13:44:40 +0200 Subject: [ticket/10811] Make it easier for MODs/Extensions to define the alt-text PHPBB3-10811 --- phpBB/includes/functions_display.php | 1 + 1 file changed, 1 insertion(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 18db64cc68..7c1d007d55 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1219,6 +1219,7 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, { $s_watching['link'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['is_watching'] = $is_watching; } -- cgit v1.2.1 From e2d286d9f133ffb5128262fc88bfd86766f7b50f Mon Sep 17 00:00:00 2001 From: Rahul R Date: Sat, 19 May 2012 01:59:25 +0530 Subject: [ticket/10650] Subject is cleared if no permissions exist The subject line will be cleared before passing to the template in case the user doesn't have sufficient permissions. PHPBB3-10650 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 950c1f0cd8..0c5b80c609 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -465,8 +465,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'FORUM_FOLDER_IMG_ALT' => isset($user->lang[$folder_alt]) ? $user->lang[$folder_alt] : '', 'FORUM_IMAGE' => ($row['forum_image']) ? '' . $user->lang[$folder_alt] . '' : '', 'FORUM_IMAGE_SRC' => ($row['forum_image']) ? $phpbb_root_path . $row['forum_image'] : '', - 'LAST_POST_SUBJECT' => censor_text($last_post_subject), - 'LAST_POST_SUBJECT_TRUNCATED' => $last_post_subject_truncated, + 'LAST_POST_SUBJECT' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? censor_text($last_post_subject) : "", + 'LAST_POST_SUBJECT_TRUNCATED' => (!$row['forum_password'] && $auth->acl_get('f_read', $row['forum_id'])) ? $last_post_subject_truncated : "", 'LAST_POST_TIME' => $last_post_time, 'LAST_POSTER' => get_username_string('username', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'LAST_POSTER_COLOUR' => get_username_string('colour', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), -- cgit v1.2.1 From c31996ea84fff5038328974b511c95d95fcd3fe7 Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 26 May 2012 21:21:22 -0400 Subject: [ticket/10912] Default last post subject to empty lacking last post info PHPBB3-10912 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 0c5b80c609..1f45d5e8e1 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -403,7 +403,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } else { - $last_post_subject = $last_post_time = $last_post_url = ''; + $last_post_subject = $last_post_time = $last_post_url = $last_post_subject_truncated = ''; } // Output moderator listing ... if applicable -- cgit v1.2.1 From f1056a9b2fd6e4ff7bc107372e9210bae9e077f0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 5 Jul 2012 00:30:02 +0200 Subject: [ticket/10811] Make toogle_subscribe more generic so it can toogle all links PHPBB3-10811 --- phpBB/includes/functions_display.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7c1d007d55..bbfd6fd6b6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1218,8 +1218,9 @@ function watch_topic_forum($mode, &$s_watching, $user_id, $forum_id, $topic_id, if ($can_watch) { $s_watching['link'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . (($is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); + $s_watching['link_toggle'] = append_sid("{$phpbb_root_path}view$mode.$phpEx", "$u_url=$match_id&" . ((!$is_watching) ? 'unwatch' : 'watch') . "=$mode&start=$start&hash=" . generate_link_hash("{$mode}_$match_id")); $s_watching['title'] = $user->lang[(($is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; - $s_watching['toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; + $s_watching['title_toggle'] = $user->lang[((!$is_watching) ? 'STOP' : 'START') . '_WATCHING_' . strtoupper($mode)]; $s_watching['is_watching'] = $is_watching; } -- cgit v1.2.1 From 922147f05a75d5a0e00b34f0102bc014583df984 Mon Sep 17 00:00:00 2001 From: Drae Date: Wed, 4 Jul 2012 23:19:59 +0100 Subject: [ticket/10968] Render pagination within the template Since phpBB 2 pagination has been rendered mostly within the source. This limits just what designers can do with pagination. The current form is also questionable in terms of "best practice". The aim is to move rendering completely to the template via the use of a block element. Enabling S_ template vars also allows for control over specific aspects of the pagination output such as next, previous, active and ellipsis. Related to this - merging the capabilities of the topic_generate_pagination with generate_pagination removes an element of duplication. PHPBB3-10968 --- phpBB/includes/functions_display.php | 42 ------------------------------------ 1 file changed, 42 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 545f75ad67..00efd281c0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -639,48 +639,6 @@ function get_forum_parents(&$forum_data) return $forum_parents; } -/** -* Generate topic pagination -*/ -function topic_generate_pagination($replies, $url) -{ - global $config, $user; - - // Make sure $per_page is a valid value - $per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; - - if (($replies + 1) > $per_page) - { - $total_pages = ceil(($replies + 1) / $per_page); - $pagination = ''; - - $times = 1; - for ($j = 0; $j < $replies + 1; $j += $per_page) - { - $pagination .= '' . $times . ''; - if ($times == 1 && $total_pages > 5) - { - $pagination .= ' ... '; - - // Display the last three pages - $times = $total_pages - 3; - $j += ($total_pages - 4) * $per_page; - } - else if ($times < $total_pages) - { - $pagination .= '' . $user->lang['COMMA_SEPARATOR'] . ''; - } - $times++; - } - } - else - { - $pagination = ''; - } - - return $pagination; -} - /** * Obtain list of moderators of each forum */ -- cgit v1.2.1 From cf4d6e926dd83d61073ac355cdaf7778a18dcbf8 Mon Sep 17 00:00:00 2001 From: Drae Date: Fri, 6 Jul 2012 14:44:04 +0100 Subject: [feature/pagination-as-list] Rename and deprecate functions Returned and marked deprecated topic_generate_pagination. Rename new function in line with coding guidelines. PHPBB3-10968 --- phpBB/includes/functions_display.php | 43 ++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 00efd281c0..15e20ab541 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -639,6 +639,49 @@ function get_forum_parents(&$forum_data) return $forum_parents; } +/** +* Generate topic pagination +* @deprecated - Use phpbb_generate_template_pagination +*/ +function topic_generate_pagination($replies, $url) +{ + global $config, $user; + + // Make sure $per_page is a valid value + $per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; + + if (($replies + 1) > $per_page) + { + $total_pages = ceil(($replies + 1) / $per_page); + $pagination = ''; + + $times = 1; + for ($j = 0; $j < $replies + 1; $j += $per_page) + { + $pagination .= '' . $times . ''; + if ($times == 1 && $total_pages > 5) + { + $pagination .= ' ... '; + + // Display the last three pages + $times = $total_pages - 3; + $j += ($total_pages - 4) * $per_page; + } + else if ($times < $total_pages) + { + $pagination .= '' . $user->lang['COMMA_SEPARATOR'] . ''; + } + $times++; + } + } + else + { + $pagination = ''; + } + + return $pagination; +} + /** * Obtain list of moderators of each forum */ -- cgit v1.2.1 From 27d8aef528460e87efc90bc4fffc82c0d1fa87d9 Mon Sep 17 00:00:00 2001 From: Drae Date: Sun, 8 Jul 2012 21:07:28 +0100 Subject: [feature/pagination-as-list] Updates for nils comments Re-remove deprecated functions, change on_page to phpbb_on_page, add null returns, remove globals and pass as params. PHPBB3-10968 --- phpBB/includes/functions_display.php | 43 ------------------------------------ 1 file changed, 43 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 15e20ab541..00efd281c0 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -639,49 +639,6 @@ function get_forum_parents(&$forum_data) return $forum_parents; } -/** -* Generate topic pagination -* @deprecated - Use phpbb_generate_template_pagination -*/ -function topic_generate_pagination($replies, $url) -{ - global $config, $user; - - // Make sure $per_page is a valid value - $per_page = ($config['posts_per_page'] <= 0) ? 1 : $config['posts_per_page']; - - if (($replies + 1) > $per_page) - { - $total_pages = ceil(($replies + 1) / $per_page); - $pagination = ''; - - $times = 1; - for ($j = 0; $j < $replies + 1; $j += $per_page) - { - $pagination .= '' . $times . ''; - if ($times == 1 && $total_pages > 5) - { - $pagination .= ' ... '; - - // Display the last three pages - $times = $total_pages - 3; - $j += ($total_pages - 4) * $per_page; - } - else if ($times < $total_pages) - { - $pagination .= '' . $user->lang['COMMA_SEPARATOR'] . ''; - } - $times++; - } - } - else - { - $pagination = ''; - } - - return $pagination; -} - /** * Obtain list of moderators of each forum */ -- cgit v1.2.1 From 67665f59577092badf7eb0b5585e5ae39c52c8da Mon Sep 17 00:00:00 2001 From: Nathan Date: Sat, 14 Jul 2012 18:12:57 -0500 Subject: [ticket/10990] Use $user->lang['COMMA_SEPARATOR'] when appropriate PHPBB3-10990 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 00efd281c0..a1ff7a1f99 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -411,7 +411,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if ($display_moderators && !empty($forum_moderators[$forum_id])) { $l_moderator = (sizeof($forum_moderators[$forum_id]) == 1) ? $user->lang['MODERATOR'] : $user->lang['MODERATORS']; - $moderators_list = implode(', ', $forum_moderators[$forum_id]); + $moderators_list = implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]); } $l_post_click_count = ($row['forum_type'] == FORUM_LINK) ? 'CLICKS' : 'POSTS'; @@ -422,7 +422,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { $s_subforums_list[] = '' . $subforum['name'] . ''; } - $s_subforums_list = (string) implode(', ', $s_subforums_list); + $s_subforums_list = (string) implode($user->lang['COMMA_SEPARATOR'], $s_subforums_list); $catless = ($row['parent_id'] == $root_data['forum_id']) ? true : false; if ($row['forum_type'] != FORUM_LINK) -- cgit v1.2.1 From 3c20ac71c51c9e8033884f5694fbad2fa6040ca6 Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 4 Mar 2011 02:00:54 -0500 Subject: [feature/events] Started on hooks for advanced last topic titles mod. PHPBB3-9550 --- phpBB/includes/functions_display.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 00efd281c0..b23540bcbd 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -119,6 +119,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'ORDER_BY' => 'f.left_id', ); + run_hooks('display_forums_sql_inject', &$sql_ary); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -127,6 +129,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod while ($row = $db->sql_fetchrow($result)) { + run_hooks('display_forums_row_inject', &$row); + $forum_id = $row['forum_id']; // Mark forums read? @@ -223,6 +227,9 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; + + $data = array(&$forum_rows, &$parent_id, &$row); + run_hooks('display_forums_row_values_inject', &$data); } else if ($row['forum_type'] != FORUM_CAT) { @@ -482,6 +489,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url) ); + + run_hooks('display_forums_assign_block_vars', &$row); // Assign subforums loop for style authors foreach ($subforums_list as $subforum) -- cgit v1.2.1 From 4da001625df4cc13d71e0ae6a61d573207165a7f Mon Sep 17 00:00:00 2001 From: Oleg Pudeyev Date: Fri, 3 Feb 2012 02:22:29 -0500 Subject: [feature/events] Replace run_hooks calls with event dispatcher. PHPBB3-9550 --- phpBB/includes/functions_display.php | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b23540bcbd..b320d35e09 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -22,7 +22,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod { global $db, $auth, $user, $template; global $phpbb_root_path, $phpEx, $config; - global $request; + global $request, $phpbb_dispatcher; $forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array(); $parent_id = $visible_forums = 0; @@ -119,7 +119,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'ORDER_BY' => 'f.left_id', ); - run_hooks('display_forums_sql_inject', &$sql_ary); + $vars = array('sql_ary'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.display_forums_sql_inject', $event); + extract($event->get_data_filtered($vars)); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -129,7 +132,10 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod while ($row = $db->sql_fetchrow($result)) { - run_hooks('display_forums_row_inject', &$row); + $vars = array('row'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.display_forums_row_inject', $event); + extract($event->get_data_filtered($vars)); $forum_id = $row['forum_id']; @@ -227,9 +233,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; - - $data = array(&$forum_rows, &$parent_id, &$row); - run_hooks('display_forums_row_values_inject', &$data); + + $vars = array('forum_rows', 'parent_id', 'row'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.display_forums_row_values_inject', $event); + extract($event->get_data_filtered($vars)); } else if ($row['forum_type'] != FORUM_CAT) { @@ -489,8 +497,11 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), 'U_LAST_POST' => $last_post_url) ); - - run_hooks('display_forums_assign_block_vars', &$row); + + $vars = array('row'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.display_forums_assign_block_vars', $event); + extract($event->get_data_filtered($vars)); // Assign subforums loop for style authors foreach ($subforums_list as $subforum) -- cgit v1.2.1 From 69407cae7bc50af526db86a3be3718d68f57d2bc Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 11:21:12 +0100 Subject: [feature/events] Adding ledge display_custom_bbcodes_row Used by phpBB Gallery PHPBB3-9550 --- phpBB/includes/functions_display.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index b320d35e09..604197b2eb 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -850,7 +850,7 @@ function topic_status(&$topic_row, $replies, $unread_topic, &$folder_img, &$fold */ function display_custom_bbcodes() { - global $db, $template, $user; + global $db, $template, $user, $phpbb_dispatcher; // Start counting from 22 for the bbcode ids (every bbcode takes two ids - opening/closing) $num_predefined_bbcodes = 22; @@ -870,13 +870,20 @@ function display_custom_bbcodes() $row['bbcode_helpline'] = $user->lang[strtoupper($row['bbcode_helpline'])]; } - $template->assign_block_vars('custom_tags', array( + $custom_tags = array( 'BBCODE_NAME' => "'[{$row['bbcode_tag']}]', '[/" . str_replace('=', '', $row['bbcode_tag']) . "]'", 'BBCODE_ID' => $num_predefined_bbcodes + ($i * 2), 'BBCODE_TAG' => $row['bbcode_tag'], 'BBCODE_HELPLINE' => $row['bbcode_helpline'], 'A_BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']), - )); + ); + + $vars = array('custom_tags', 'row'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.display_custom_bbcodes_row', $event); + extract($event->get_data_filtered($vars)); + + $template->assign_block_vars('custom_tags', $custom_tags); $i++; } -- cgit v1.2.1 From 1a7f83948eb9f4c1b8ab7fa411444a11e967fcd0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 11:22:31 +0100 Subject: [feature/events] Adding ledge display_custom_bbcodes Used by phpBB Gallery PHPBB3-9550 --- phpBB/includes/functions_display.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 604197b2eb..684729fc0d 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -888,6 +888,8 @@ function display_custom_bbcodes() $i++; } $db->sql_freeresult($result); + + $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); } /** -- cgit v1.2.1 From 8af7d225ef481cd26e6fd7862847183d25727117 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Tue, 20 Mar 2012 11:23:03 +0000 Subject: [feature/events] Change to use the new method of adding events PHPBB3-9550 --- phpBB/includes/functions_display.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 684729fc0d..507576b1d6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -120,9 +120,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod ); $vars = array('sql_ary'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.display_forums_sql_inject', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_sql_inject', compact($vars), $vars)); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -133,9 +131,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod while ($row = $db->sql_fetchrow($result)) { $vars = array('row'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.display_forums_row_inject', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_row_inject', compact($vars), $vars)); $forum_id = $row['forum_id']; @@ -235,9 +231,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $vars = array('forum_rows', 'parent_id', 'row'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.display_forums_row_values_inject', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_row_values_inject', compact($vars), $vars)); } else if ($row['forum_type'] != FORUM_CAT) { @@ -499,9 +493,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod ); $vars = array('row'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.display_forums_assign_block_vars', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_assign_block_vars', compact($vars), $vars)); // Assign subforums loop for style authors foreach ($subforums_list as $subforum) @@ -879,9 +871,7 @@ function display_custom_bbcodes() ); $vars = array('custom_tags', 'row'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.display_custom_bbcodes_row', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_row', compact($vars), $vars)); $template->assign_block_vars('custom_tags', $custom_tags); -- cgit v1.2.1 From 3f1b4e83aef7f7344cd551463b59de71bb4bd6fe Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Sat, 31 Mar 2012 13:39:41 +0100 Subject: [feature/events] Removing the third trigger_event parameter PHPBB3-9550 --- phpBB/includes/functions_display.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 507576b1d6..003724a8f5 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -120,7 +120,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod ); $vars = array('sql_ary'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_sql_inject', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_sql_inject', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -131,7 +131,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod while ($row = $db->sql_fetchrow($result)) { $vars = array('row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_row_inject', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_row_inject', compact($vars))); $forum_id = $row['forum_id']; @@ -231,7 +231,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; $vars = array('forum_rows', 'parent_id', 'row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_row_values_inject', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_row_values_inject', compact($vars))); } else if ($row['forum_type'] != FORUM_CAT) { @@ -493,7 +493,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod ); $vars = array('row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_assign_block_vars', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.display_forums_assign_block_vars', compact($vars))); // Assign subforums loop for style authors foreach ($subforums_list as $subforum) @@ -871,7 +871,7 @@ function display_custom_bbcodes() ); $vars = array('custom_tags', 'row'); - extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_row', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_row', compact($vars))); $template->assign_block_vars('custom_tags', $custom_tags); -- cgit v1.2.1 From 6059bc7b45a098e4bc846fe3704543137cc1aba1 Mon Sep 17 00:00:00 2001 From: David King Date: Fri, 25 May 2012 18:18:27 -0400 Subject: [feature/events] Added core.user_default_avatar event This way, extension authors can overwrite the empty value returned when a user does not have an avatar with a default value to display instead of nothing in the avatar space. PHPBB3-9550 --- phpBB/includes/functions_display.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 003724a8f5..53a07d5591 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1267,10 +1267,19 @@ function get_user_rank($user_rank, $user_posts, &$rank_title, &$rank_img, &$rank function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $alt = 'USER_AVATAR', $ignore_config = false) { global $user, $config, $phpbb_root_path, $phpEx; + global $phpbb_dispatcher; if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) { - return ''; + $empty_avatar = ''; + if ($config['allow_avatar'] || $ignore_config) + { + // This allows extensions to change the default return when no avatar is given + // Useful for default avatars + $vars = array('empty_avatar'); + extract($phpbb_dispatcher->trigger_event('core.user_default_avatar', compact($vars))); + } + return $empty_avatar; } $avatar_img = ''; -- cgit v1.2.1 From 611d965b043c2a566e817f29d618ff841aa02c34 Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 11 Jun 2012 08:26:44 -0400 Subject: [feature/events] Renamed $empty_avatar to $default_avatar PHPBB3-9550 --- phpBB/includes/functions_display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 53a07d5591..6b145ea422 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1271,15 +1271,15 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) { - $empty_avatar = ''; + $default_avatar = ''; if ($config['allow_avatar'] || $ignore_config) { // This allows extensions to change the default return when no avatar is given // Useful for default avatars - $vars = array('empty_avatar'); + $vars = array('default_avatar'); extract($phpbb_dispatcher->trigger_event('core.user_default_avatar', compact($vars))); } - return $empty_avatar; + return $default_avatar; } $avatar_img = ''; -- cgit v1.2.1 From 730bd6eb08aa76dc54e661b03207e2d695d9a8c5 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 15:52:45 +0200 Subject: [feature/php-events] Rename display_forums_sql_inject to be less misleading PHPBB3-9550 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 6b145ea422..68c49c2457 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -120,7 +120,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod ); $vars = array('sql_ary'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_sql_inject', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.display_forums_build_query', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From 3af0ae69eed6955a23b29087891258efb1a06e33 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 15:54:55 +0200 Subject: [feature/php-events] Properly name user_default_avatar and add additional vars PHPBB3-9550 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 68c49c2457..ca2bfc3b65 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1276,8 +1276,8 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ { // This allows extensions to change the default return when no avatar is given // Useful for default avatars - $vars = array('default_avatar'); - extract($phpbb_dispatcher->trigger_event('core.user_default_avatar', compact($vars))); + $vars = array('avatar', 'avatar_type', 'ignore_config', 'default_avatar'); + extract($phpbb_dispatcher->trigger_event('core.get_user_avatar_default', compact($vars))); } return $default_avatar; } -- cgit v1.2.1 From bdfedba521ee38ef6b8915bfb130b2f164c040c0 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:43:08 +0200 Subject: [feature/php-events] Make handling of forumrow consistent with others PHPBB3-9550 --- phpBB/includes/functions_display.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index ca2bfc3b65..9ab90a6482 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -452,7 +452,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } } - $template->assign_block_vars('forumrow', array( + $forum_row = array( 'S_IS_CAT' => false, 'S_NO_CAT' => $catless && !$last_catless, 'S_IS_LINK' => ($row['forum_type'] == FORUM_LINK) ? true : false, @@ -489,12 +489,14 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_UNAPPROVED_TOPICS' => ($row['forum_id_unapproved_topics']) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=unapproved_topics&f=' . $row['forum_id_unapproved_topics']) : '', 'U_VIEWFORUM' => $u_viewforum, 'U_LAST_POSTER' => get_username_string('profile', $row['forum_last_poster_id'], $row['forum_last_poster_name'], $row['forum_last_poster_colour']), - 'U_LAST_POST' => $last_post_url) + 'U_LAST_POST' => $last_post_url, ); - $vars = array('row'); + $vars = array('row', 'forum_row'); extract($phpbb_dispatcher->trigger_event('core.display_forums_assign_block_vars', compact($vars))); + $template->assign_block_vars('forumrow', $forum_row); + // Assign subforums loop for style authors foreach ($subforums_list as $subforum) { -- cgit v1.2.1 From 099aaab7208123a5fb8195ccd5bdccee80ea2460 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Sat, 28 Jul 2012 22:47:00 +0200 Subject: [feature/php-events] Fix docs and naming of core.display_forums_modify_sql PHPBB3-9550 --- phpBB/includes/functions_display.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 9ab90a6482..7111153fd4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -119,8 +119,15 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'ORDER_BY' => 'f.left_id', ); + /** + * Event to modify the SQL query before the forum data is queried + * + * @event core.display_forums_modify_sql + * @var array sql_ary The SQL array to get the data of the forums + * @since 3.1-A1 + */ $vars = array('sql_ary'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_build_query', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_sql', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From 14edfd2856b602ea435f5d473322950e23868b6e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 14:12:12 +0200 Subject: [feature/php-events] Fix docs of core.display_forums_modify_row PHPBB3-9550 --- phpBB/includes/functions_display.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 7111153fd4..a022b9a807 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -137,8 +137,18 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod while ($row = $db->sql_fetchrow($result)) { - $vars = array('row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_row_inject', compact($vars))); + /** + * Event to modify the data set of a forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_row + * @var int branch_root_id Last top-level forum + * @var array row The data of the forum + * @since 3.1-A1 + */ + $vars = array('branch_root_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_row', compact($vars))); $forum_id = $row['forum_id']; -- cgit v1.2.1 From d4f9442e8749152d08ff50ca678b105d0ed2b703 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 15:34:53 +0200 Subject: [feature/php-events] Move core.display_forums_modify_forum_rows to better point PHPBB3-9550 --- phpBB/includes/functions_display.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a022b9a807..3f37f227f6 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -246,9 +246,6 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $forum_rows[$parent_id]['forum_id_last_post'] = $row['forum_id']; $forum_rows[$parent_id]['orig_forum_last_post_time'] = $row['forum_last_post_time']; - - $vars = array('forum_rows', 'parent_id', 'row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_row_values_inject', compact($vars))); } else if ($row['forum_type'] != FORUM_CAT) { @@ -286,6 +283,22 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $forum_rows[$parent_id]['forum_id_last_post'] = $forum_id; } } + + /** + * Event to modify the forum rows data set + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_forum_rows + * @var array forum_rows Data array of all forums we display + * @var array subforums Data array of all subforums we display + * @var int branch_root_id Current top-level forum + * @var int parent_id Current parent forum + * @var array row The data of the forum + * @since 3.1-A1 + */ + $vars = array('forum_rows', 'subforums', 'branch_root_id', 'parent_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_forum_rows', compact($vars))); } $db->sql_freeresult($result); -- cgit v1.2.1 From 8b7e3739a04bd3ea707493894fa2ebf8dc81410e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 15:47:42 +0200 Subject: [feature/php-events] Fix docs and naming of display_forums_modify_template_vars PHPBB3-9550 --- phpBB/includes/functions_display.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 3f37f227f6..448c261580 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -522,8 +522,18 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod 'U_LAST_POST' => $last_post_url, ); - $vars = array('row', 'forum_row'); - extract($phpbb_dispatcher->trigger_event('core.display_forums_assign_block_vars', compact($vars))); + /** + * Modify the template data block of the forum + * + * This event is triggered once per forum + * + * @event core.display_forums_modify_template_vars + * @var array forum_row Template data of the forum + * @var array row The data of the forum + * @since 3.1-A1 + */ + $vars = array('forum_row', 'row'); + extract($phpbb_dispatcher->trigger_event('core.display_forums_modify_template_vars', compact($vars))); $template->assign_block_vars('forumrow', $forum_row); -- cgit v1.2.1 From 96f20160bcfa7a08870602b25fa528370f034128 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 16:00:19 +0200 Subject: [feature/php-events] Fix docs and naming of display_custom_bbcodes_modify_row PHPBB3-9550 --- phpBB/includes/functions_display.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 448c261580..807f5a2192 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -912,8 +912,18 @@ function display_custom_bbcodes() 'A_BBCODE_HELPLINE' => str_replace(array('&', '"', "'", '<', '>'), array('&', '"', "\'", '<', '>'), $row['bbcode_helpline']), ); + /** + * Modify the template data block of a bbcode + * + * This event is triggered once per bbcode + * + * @event core.display_custom_bbcodes_modify_row + * @var array custom_tags Template data of the bbcode + * @var array row The data of the bbcode + * @since 3.1-A1 + */ $vars = array('custom_tags', 'row'); - extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_row', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.display_custom_bbcodes_modify_row', compact($vars))); $template->assign_block_vars('custom_tags', $custom_tags); -- cgit v1.2.1 From 4f13b049f813916e6393c8c4cc0227d3f52c2318 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 16:35:01 +0200 Subject: [feature/php-events] Fix docs of core.display_custom_bbcodes PHPBB3-9550 --- phpBB/includes/functions_display.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 807f5a2192..1e093e6811 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -931,6 +931,12 @@ function display_custom_bbcodes() } $db->sql_freeresult($result); + /** + * Display custom bbcodes + * + * @event core.display_custom_bbcodes + * @since 3.1-A1 + */ $phpbb_dispatcher->dispatch('core.display_custom_bbcodes'); } -- cgit v1.2.1 From 39869d46b1c4f3dcc178cdb7cd05e8f28fcc1f47 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 30 Jul 2012 17:01:35 +0200 Subject: [feature/php-events] Allow core.user_get_avatar to overwrite all avatars PHPBB3-9550 --- phpBB/includes/functions_display.php | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 1e093e6811..bf379a40f4 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1327,17 +1327,33 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ global $user, $config, $phpbb_root_path, $phpEx; global $phpbb_dispatcher; + $overwrite_avatar = ''; + + /** + * Overwrite users avatar + * + * @event core.display_custom_bbcodes_modify_row + * @var string avatar Users assigned avatar name + * @var int avatar_type Type of avatar + * @var string avatar_width Width of users avatar + * @var string avatar_height Height of users avatar + * @var string alt Language string for alt tag within image + * Can be a language key or text + * @var bool ignore_config Ignores config and force displaying avatar + * @var string overwrite_avatar If set, this string will be the avatar + * @since 3.1-A1 + */ + $vars = array('avatar', 'avatar_type', 'avatar_width', 'avatar_height', 'alt', 'ignore_config', 'overwrite_avatar'); + extract($phpbb_dispatcher->trigger_event('core.user_get_avatar', compact($vars))); + + if ($overwrite_avatar) + { + return $overwrite_avatar; + } + if (empty($avatar) || !$avatar_type || (!$config['allow_avatar'] && !$ignore_config)) { - $default_avatar = ''; - if ($config['allow_avatar'] || $ignore_config) - { - // This allows extensions to change the default return when no avatar is given - // Useful for default avatars - $vars = array('avatar', 'avatar_type', 'ignore_config', 'default_avatar'); - extract($phpbb_dispatcher->trigger_event('core.get_user_avatar_default', compact($vars))); - } - return $default_avatar; + return ''; } $avatar_img = ''; -- cgit v1.2.1 From ee7d9614c07c3961d62edbd0e8bf5ef1e2d75ff8 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Sat, 4 Aug 2012 13:18:20 +0100 Subject: [feature/attach-dl] Downloading all attachments fully implemented Added a function to list all available archiving methods and integrated it with the prosilver style. Heavy modifications to download/file.php to support archiving and downloading of multiple files at once. PHPBB3-11042 --- phpBB/includes/functions_display.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a1ff7a1f99..a99d2353ed 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1285,3 +1285,33 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ $avatar_img .= $avatar; return '' . ((!empty($user->lang[$alt])) ? $user->lang[$alt] : $alt) . ''; } + +/** +* Generate a list of archive types available for compressing attachments +* +* @param string $param_key Either topic_id or post_id +* @param string $param_val The value of the topic or post id +* @param string $phpbb_root_path The root path of the phpBB installation +* @param string $phpEx The PHP extension +* +* @return array Array containing the link and the type of compression +*/ +function gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx) +{ + $methods = compress::methods(); + $links = array(); + + foreach ($methods as $method) + { + $type = array_pop(explode('.', $method)); + $params = array('archive' => $method); + $params[$param_key] = $param_val; + + $links[] = array( + 'LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", $params), + 'TYPE' => $type, + ); + } + + return $links; +} -- cgit v1.2.1 From 18d7210a11b4d98c50ad55bb427c8cd2cc14a2f1 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Sat, 4 Aug 2012 13:58:50 +0100 Subject: [feature/attach-dl] Prefixed gen_download_links with phpbb_ PHPBB3-11042 --- phpBB/includes/functions_display.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index a99d2353ed..6164885732 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1296,7 +1296,7 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ * * @return array Array containing the link and the type of compression */ -function gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx) +function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx) { $methods = compress::methods(); $links = array(); -- cgit v1.2.1 From 773c513ac0a0d3b580462a5eec2f65782f26b3c3 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Tue, 7 Aug 2012 16:59:57 +0100 Subject: [feature/attach-dl] Moved include of compress class inside function PHPBB3-11042 --- phpBB/includes/functions_display.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 6164885732..1f541a7733 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1298,6 +1298,11 @@ function get_user_avatar($avatar, $avatar_type, $avatar_width, $avatar_height, $ */ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $phpEx) { + if (!class_exists('compress')) + { + require $phpbb_root_path . 'includes/functions_compress.' . $phpEx; + } + $methods = compress::methods(); $links = array(); -- cgit v1.2.1 From 9cba0b5263a8dcf0ff4cbfd6db2b37cd0cce55f1 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 18:51:29 -0500 Subject: [ticket/8796] Mark read links updated to include time() in url Submitting the current time() allows us to mark only the topics and forums read up until a certain time (when the user loaded the page). This means that any new posts or topics posted between when the user opened the page and clicked the link are still shown as unread. PHPBB3-8796 --- phpBB/includes/functions_display.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 881c95907b..e9c7143473 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -59,7 +59,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod if (check_link_hash(request_var('hash', ''), 'global')) { - markread('all'); + markread('all', false, false, request_var('mark_time', 0)); trigger_error( $user->lang['FORUMS_MARKED'] . '

' . @@ -309,7 +309,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod $token = request_var('hash', ''); if (check_link_hash($token, 'global')) { - markread('topics', $forum_ids); + markread('topics', $forum_ids, false, request_var('mark_time', 0)); $message = sprintf($user->lang['RETURN_FORUM'], '', ''); meta_refresh(3, $redirect); @@ -551,7 +551,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod } $template->assign_vars(array( - 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums') : '', + 'U_MARK_FORUMS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . '&f=' . $root_data['forum_id'] . '&mark=forums&mark_time=' . time()) : '', 'S_HAS_SUBFORUM' => ($visible_forums) ? true : false, 'L_SUBFORUM' => ($visible_forums == 1) ? $user->lang['SUBFORUM'] : $user->lang['SUBFORUMS'], 'LAST_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_LATEST_POST'), -- cgit v1.2.1 From fccbf09e4aa9034afba5d5992d773b209f59bba7 Mon Sep 17 00:00:00 2001 From: Nathaniel Guse Date: Mon, 3 Sep 2012 18:58:38 -0500 Subject: [ticket/8796] Fix a few issues with the previous commits Fix an SQL error and the redirect url generated PHPBB3-8796 --- phpBB/includes/functions_display.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index e9c7143473..39ec8445c5 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -54,7 +54,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Handle marking everything read if ($mark_read == 'all') { - $redirect = build_url(array('mark', 'hash')); + $redirect = build_url(array('mark', 'hash', 'mark_time')); meta_refresh(3, $redirect); if (check_link_hash(request_var('hash', ''), 'global')) @@ -305,7 +305,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod // Handle marking posts if ($mark_read == 'forums') { - $redirect = build_url(array('mark', 'hash')); + $redirect = build_url(array('mark', 'hash', 'mark_time')); $token = request_var('hash', ''); if (check_link_hash($token, 'global')) { -- cgit v1.2.1 From c93b3827dc0644ea4aece1af661224aaa68a4cae Mon Sep 17 00:00:00 2001 From: Nathan Guse Date: Thu, 6 Sep 2012 18:27:49 -0500 Subject: [ticket/11092] phpbb_gen_download_links strict standards errors Two strict standards errors in phpbb_gen_download_links PHPBB3-11092 --- phpBB/includes/functions_display.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/includes/functions_display.php') diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 881c95907b..8328b9ee7a 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -1410,7 +1410,8 @@ function phpbb_gen_download_links($param_key, $param_val, $phpbb_root_path, $php foreach ($methods as $method) { - $type = array_pop(explode('.', $method)); + $exploded = explode('.', $method); + $type = array_pop($exploded); $params = array('archive' => $method); $params[$param_key] = $param_val; -- cgit v1.2.1