From 1665434853fb09e70337d23955e1c9a5f3f0d19d Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 7 Jul 2010 23:42:54 +0100 Subject: [feature/new-tz-handling] Remove code using legacy timezone properties. Code accessing the legacy user::$timezone and user::$dst properties has been removed and replaced with code utilising user::create_datetime(). Changed by Oleg: in viewtopic, memberlist and index use getTimestamp() + getOffset(). We show members that have birthdays on the specified date. getTimestamp() returns the current date in UTC. We add getOffset() to obtain the current local time in the viewing user's timezone. Then we find members having birthday on this date. Changed by Oleg again: Take leap year status out of the datetime object we have, this seems like it should work as one would expect. PHPBB3-9558 --- phpBB/viewtopic.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index e78ba73cd7..782f02fd4b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -965,7 +965,8 @@ $sql_ary = array( $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -$now = phpbb_gmgetdate(time() + $user->timezone + $user->dst); +$now = $user->create_datetime(); +$now = phpbb_gmgetdate($now->getTimestamp() + $now->getOffset()); // Posts are stored in the $rowset array while $attach_list, $user_cache // and the global bbcode_bitfield are built -- 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/viewtopic.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a43edee5da..6a15d4e15b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -450,6 +450,7 @@ $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&a $s_watching_topic = array( 'link' => '', 'title' => '', + 'toggle' => '', 'is_watching' => false, ); @@ -649,13 +650,14 @@ $template->assign_vars(array( 'U_PRINT_TOPIC' => ($auth->acl_get('f_print', $forum_id)) ? $viewtopic_url . '&view=print' : '', 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', - 'U_WATCH_TOPIC' => $s_watching_topic['link'], - 'L_WATCH_TOPIC' => $s_watching_topic['title'], + 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['toggle'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', - 'L_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], - 'L_BOOKMARK_TOPIC_REAL' => $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], + 'S_BOOKMARK_TOGGLE' => (!$user->data['is_registered'] || !$config['allow_bookmarks'] || !$topic_data['bookmarked']) ? $user->lang['BOOKMARK_TOPIC_REMOVE'] : $user->lang['BOOKMARK_TOPIC'], 'S_BOOKMARKED_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks'] && $topic_data['bookmarked']) ? true : false, 'U_POST_NEW_TOPIC' => ($auth->acl_get('f_post', $forum_id) || $user->data['user_id'] == ANONYMOUS) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=post&f=$forum_id") : '', -- 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/viewtopic.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 6a15d4e15b..a5561e4f4a 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -449,8 +449,9 @@ $viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&a // Are we watching this topic? $s_watching_topic = array( 'link' => '', + 'link_toggle' => '', 'title' => '', - 'toggle' => '', + 'title_toggle' => '', 'is_watching' => false, ); @@ -651,8 +652,9 @@ $template->assign_vars(array( 'U_EMAIL_TOPIC' => ($auth->acl_get('f_email', $forum_id) && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&t=$topic_id") : '', 'U_WATCH_TOPIC' => $s_watching_topic['link'], + 'U_WATCH_TOPIC_TOGGLE' => $s_watching_topic['link_toggle'], 'S_WATCH_TOPIC_TITLE' => $s_watching_topic['title'], - 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['toggle'], + 'S_WATCH_TOPIC_TOGGLE' => $s_watching_topic['title_toggle'], 'S_WATCHING_TOPIC' => $s_watching_topic['is_watching'], 'U_BOOKMARK_TOPIC' => ($user->data['is_registered'] && $config['allow_bookmarks']) ? $viewtopic_url . '&bookmark=1&hash=' . generate_link_hash("topic_$topic_id") : '', -- 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/viewtopic.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0d6e9afd54..98a4f123be 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -546,7 +546,7 @@ foreach($quickmod_array as $option => $qm_ary) } // If we've got a hightlight set pass it on to pagination. -$pagination = generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); +generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); // Navigation links generate_forum_nav($topic_data); @@ -598,7 +598,6 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGINATION' => $pagination, 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', -- cgit v1.2.1 From dc71c0629e60acccd39b59538f2e7f5b09b32509 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 5 Jul 2012 18:56:14 +0100 Subject: [feature/pagination-as-list] Various fixes and improvements Extracted common template code for prosilver as per subsilver2. Various other fixups and oversight corrections, changed name of the "new" template function and re-introduced existing version. Altered on_page to compensate for removal of some templating vars from pagination routine. PHPBB3-10968 --- phpBB/viewtopic.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 98a4f123be..969f6fb63e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -545,9 +545,6 @@ foreach($quickmod_array as $option => $qm_ary) } } -// If we've got a hightlight set pass it on to pagination. -generate_pagination(append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')), $total_posts, $config['posts_per_page'], $start); - // Navigation links generate_forum_nav($topic_data); @@ -585,6 +582,10 @@ if (!empty($_EXTRA_URL)) } } +// If we've got a hightlight set pass it on to pagination. +$base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); +generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); + // Send vars to template $template->assign_vars(array( 'FORUM_ID' => $forum_id, @@ -598,7 +599,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => on_page($total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => on_page($base_url, $total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', -- 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/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 969f6fb63e..2e197932af 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( -- 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/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 2e197932af..51c92df1af 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -phpbb_generate_template_pagination($base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( @@ -599,7 +599,7 @@ $template->assign_vars(array( 'TOPIC_AUTHOR_COLOUR' => get_username_string('colour', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), 'TOPIC_AUTHOR' => get_username_string('username', $topic_data['topic_poster'], $topic_data['topic_first_poster_name'], $topic_data['topic_first_poster_colour']), - 'PAGE_NUMBER' => on_page($base_url, $total_posts, $config['posts_per_page'], $start), + 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', -- cgit v1.2.1 From 584d49459d22ebf47239fc97ad8358a5404dacf4 Mon Sep 17 00:00:00 2001 From: Drae Date: Thu, 12 Jul 2012 02:36:00 +0100 Subject: [feature/pagination-as-list] New parameter for name of start var Add a new parameter to hold the name of the start variable. This fulfills ticket PHPBB3-8535. PHPBB3-10968 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 51c92df1af..c0dbc12fca 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -584,7 +584,7 @@ if (!empty($_EXTRA_URL)) // If we've got a hightlight set pass it on to pagination. $base_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id" . ((strlen($u_sort_param)) ? "&$u_sort_param" : '') . (($highlight_match) ? "&hilit=$highlight" : '')); -phpbb_generate_template_pagination($template, $base_url, 'pagination', $total_posts, $config['posts_per_page'], $start); +phpbb_generate_template_pagination($template, $base_url, 'pagination', 'start', $total_posts, $config['posts_per_page'], $start); // Send vars to template $template->assign_vars(array( -- 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/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 349f53cbe2..b6df14d42d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -602,7 +602,7 @@ $template->assign_vars(array( 'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total_posts, $config['posts_per_page'], $start), 'TOTAL_POSTS' => $user->lang('VIEW_TOPIC_POSTS', (int) $total_posts), 'U_MCP' => ($auth->acl_get('m_', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=topic_view&f=$forum_id&t=$topic_id" . (($start == 0) ? '' : "&start=$start") . ((strlen($u_sort_param)) ? "&$u_sort_param" : ''), true, $user->session_id) : '', - 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode(', ', $forum_moderators[$forum_id]) : '', + 'MODERATORS' => (isset($forum_moderators[$forum_id]) && sizeof($forum_moderators[$forum_id])) ? implode($user->lang['COMMA_SEPARATOR'], $forum_moderators[$forum_id]) : '', 'POST_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'FORUM_LOCKED') : $user->img('button_topic_new', 'POST_NEW_TOPIC'), 'QUOTE_IMG' => $user->img('icon_post_quote', 'REPLY_WITH_QUOTE'), -- cgit v1.2.1 From 54caef8f902cf5ea40da0d818b770d15b6d7e7e2 Mon Sep 17 00:00:00 2001 From: Michael Cullum Date: Thu, 15 Mar 2012 20:49:33 +0000 Subject: [feature/events] Add core.viewtopic_postrow ledge PHPBB3-9550 --- phpBB/viewtopic.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 349f53cbe2..4f95d40e73 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1574,6 +1574,11 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $postrow = array_merge($postrow, $cp_row['row']); } + $vars = array('postrow'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_postrow', $event); + extract($event->get_data_filtered($vars)); + // Dump vars into template $template->assign_block_vars('postrow', $postrow); -- cgit v1.2.1 From a47ac64e5f5ad1c01e6ecbb64a5e1c80ab2c90b2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:30:28 +0100 Subject: [feature/events] Adding ledge viewtopic_page_header Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 4f95d40e73..148446490e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1734,8 +1734,15 @@ if (!request_var('t', 0) && !empty($topic_id)) $request->overwrite('t', $topic_id); } +$page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); + +$vars = array('page_title', 'topic_data', 'forum_id', 'start'); +$event = new phpbb_event_data(compact($vars)); +$phpbb_dispatcher->dispatch('core.viewtopic_page_header', $event); +extract($event->get_data_filtered($vars)); + // Output the page -page_header($topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''), true, $forum_id); +page_header($page_title, true, $forum_id); $template->set_filenames(array( 'body' => ($view == 'print') ? 'viewtopic_print.html' : 'viewtopic_body.html') -- cgit v1.2.1 From dcf97714a56801bcaf41addeadb08bcacc4514df Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:38:29 +0100 Subject: [feature/events] Adding ledge viewtopic_get_userdata Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 148446490e..8bca1973a7 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -987,6 +987,11 @@ $sql_ary = array( AND u.user_id = p.poster_id', ); +$vars = array('sql_ary'); +$event = new phpbb_event_data(compact($vars)); +$phpbb_dispatcher->dispatch('core.viewtopic_get_userdata', $event); +extract($event->get_data_filtered($vars)); + $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From 2581b0e1e3c68bfae8357dddc1d379914fd67654 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:42:40 +0100 Subject: [feature/events] Adding ledge viewtopic_user_cache_guest Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 8bca1973a7..256bada0d9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1068,7 +1068,7 @@ while ($row = $db->sql_fetchrow($result)) { if ($poster_id == ANONYMOUS) { - $user_cache[$poster_id] = array( + $user_cache_data = array( 'joined' => '', 'posts' => '', 'from' => '', @@ -1103,6 +1103,13 @@ while ($row = $db->sql_fetchrow($result)) 'allow_pm' => 0, ); + $vars = array('user_cache_data', 'row', 'poster_id'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_user_cache_guest', $event); + extract($event->get_data_filtered($vars)); + + $user_cache[$poster_id] = $user_cache_data; + get_user_rank($row['user_rank'], false, $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); } else -- cgit v1.2.1 From 713f8e4782cd4c808d6f4a1cbb26f45144eef74e Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 16 Mar 2012 10:51:35 +0100 Subject: [feature/events] Adding ledge viewtopic_user_cache Used by phpBB Gallery PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 256bada0d9..99b875ae3d 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1124,7 +1124,7 @@ while ($row = $db->sql_fetchrow($result)) $id_cache[] = $poster_id; - $user_cache[$poster_id] = array( + $user_cache_data = array( 'joined' => $user->format_date($row['user_regdate']), 'posts' => $row['user_posts'], 'warnings' => (isset($row['user_warnings'])) ? $row['user_warnings'] : 0, @@ -1162,6 +1162,13 @@ while ($row = $db->sql_fetchrow($result)) 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), ); + $vars = array('user_cache_data', 'row', 'poster_id'); + $event = new phpbb_event_data(compact($vars)); + $phpbb_dispatcher->dispatch('core.viewtopic_user_cache', $event); + extract($event->get_data_filtered($vars)); + + $user_cache[$poster_id] = $user_cache_data; + get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if ((!empty($row['user_allow_viewemail']) && $auth->acl_get('u_sendemail')) || $auth->acl_get('a_email')) -- 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/viewtopic.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 99b875ae3d..34c8bfbc0f 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,9 +988,7 @@ $sql_ary = array( ); $vars = array('sql_ary'); -$event = new phpbb_event_data(compact($vars)); -$phpbb_dispatcher->dispatch('core.viewtopic_get_userdata', $event); -extract($event->get_data_filtered($vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars), $vars)); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -1104,9 +1102,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_user_cache_guest', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars), $vars)); $user_cache[$poster_id] = $user_cache_data; @@ -1163,9 +1159,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_user_cache', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars), $vars)); $user_cache[$poster_id] = $user_cache_data; @@ -1594,9 +1588,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $vars = array('postrow'); - $event = new phpbb_event_data(compact($vars)); - $phpbb_dispatcher->dispatch('core.viewtopic_postrow', $event); - extract($event->get_data_filtered($vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars), $vars)); // Dump vars into template $template->assign_block_vars('postrow', $postrow); @@ -1756,9 +1748,7 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -$event = new phpbb_event_data(compact($vars)); -$phpbb_dispatcher->dispatch('core.viewtopic_page_header', $event); -extract($event->get_data_filtered($vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars), $vars)); // Output the page page_header($page_title, true, $forum_id); -- 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/viewtopic.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 34c8bfbc0f..7a1b9ba9e4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,7 +988,7 @@ $sql_ary = array( ); $vars = array('sql_ary'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars), $vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); @@ -1102,7 +1102,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars))); $user_cache[$poster_id] = $user_cache_data; @@ -1159,7 +1159,7 @@ while ($row = $db->sql_fetchrow($result)) ); $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars))); $user_cache[$poster_id] = $user_cache_data; @@ -1588,7 +1588,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) } $vars = array('postrow'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars), $vars)); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); // Dump vars into template $template->assign_block_vars('postrow', $postrow); @@ -1748,7 +1748,7 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars), $vars)); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars))); // Output the page page_header($page_title, true, $forum_id); -- cgit v1.2.1 From f01d742b5649678de3e5ba4aa45f4176c8ff5aac Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:07:49 +0200 Subject: [feature/php-events] Add additional vars and control to viewtopic_postrow event PHPBB3-9550 --- phpBB/viewtopic.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 7a1b9ba9e4..20d4c2af1b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1582,14 +1582,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', ); + $user_poster_data = $user_cache[$poster_id]; + + $vars = array('row', 'cp_row', 'user_poster_data', 'postrow'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); + if (isset($cp_row['row']) && sizeof($cp_row['row'])) { $postrow = array_merge($postrow, $cp_row['row']); } - $vars = array('postrow'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); - // Dump vars into template $template->assign_block_vars('postrow', $postrow); -- cgit v1.2.1 From 16736d4e4cfabc65f84c6339bf81ae01f1edffc2 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 20 Jun 2012 16:43:48 +0200 Subject: [feature/php-events] Make naming of postrow consistent with others (post_row) PHPBB3-9550 --- phpBB/viewtopic.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 20d4c2af1b..ce73001c78 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1506,7 +1506,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ))); // - $postrow = array( + $post_row = array( 'POST_AUTHOR_FULL' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_full'] : get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR_COLOUR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_colour'] : get_username_string('colour', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), 'POST_AUTHOR' => ($poster_id != ANONYMOUS) ? $user_cache[$poster_id]['author_username'] : get_username_string('username', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), @@ -1584,16 +1584,16 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_poster_data = $user_cache[$poster_id]; - $vars = array('row', 'cp_row', 'user_poster_data', 'postrow'); + $vars = array('row', 'cp_row', 'user_poster_data', 'post_row'); extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { - $postrow = array_merge($postrow, $cp_row['row']); + $post_row = array_merge($post_row, $cp_row['row']); } // Dump vars into template - $template->assign_block_vars('postrow', $postrow); + $template->assign_block_vars('postrow', $post_row); if (!empty($cp_row['blockrow'])) { -- cgit v1.2.1 From 5bffd9883de02807817838cd840a5293b6b908ac Mon Sep 17 00:00:00 2001 From: Fyorl Date: Thu, 2 Aug 2012 20:47:09 +0100 Subject: [feature/attach-dl] Added links to the templates PHPBB3-11042 --- phpBB/viewtopic.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index b6df14d42d..fce1be7784 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1314,6 +1314,11 @@ if (sizeof($attach_list)) } } +$template->assign_vars(array( + 'S_HAS_ATTACHMENTS' => !empty($attachments), + 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", "topic_id=$topic_id"), +)); + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { @@ -1556,6 +1561,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_ID' => $poster_id, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, + 'S_MULTIPLE_ATTACH' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], @@ -1567,6 +1573,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', + + 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'post_id=' . $row['post_id']), ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) -- 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/viewtopic.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index fce1be7784..1199fc4d14 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -15,6 +15,7 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); +include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); // Start session management @@ -1316,9 +1317,14 @@ if (sizeof($attach_list)) $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), - 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", "topic_id=$topic_id"), )); +$methods = gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); +foreach ($methods as $method) +{ + $template->assign_block_vars('dl_method', $method); +} + // Instantiate BBCode if need be if ($bbcode_bitfield !== '') { @@ -1573,8 +1579,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'S_IGNORE_POST' => ($row['hide_post']) ? true : false, 'L_IGNORE_POST' => ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '', '') : '', - - 'U_DL_ALL_LINK' => append_sid("{$phpbb_root_path}download/file.$phpEx", 'post_id=' . $row['post_id']), ); if (isset($cp_row['row']) && sizeof($cp_row['row'])) @@ -1602,6 +1606,12 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'DISPLAY_ATTACHMENT' => $attachment) ); } + + $methods = gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + foreach ($methods as $method) + { + $template->assign_block_vars('postrow.dl_method', $method); + } } $prev_post_id = $row['post_id']; -- 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/viewtopic.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1199fc4d14..a4d7c8baa1 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1319,7 +1319,7 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); -$methods = gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); +$methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('dl_method', $method); @@ -1607,7 +1607,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ); } - $methods = gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('postrow.dl_method', $method); -- cgit v1.2.1 From 3f710b58a5a7c371b8016c808a756616a77f4503 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 15:37:02 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_get_post_data PHPBB3-9550 --- phpBB/viewtopic.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index ce73001c78..22b1bd9dea 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -987,8 +987,15 @@ $sql_ary = array( AND u.user_id = p.poster_id', ); +/** +* Event to modify the SQL query before the post and poster data is queried +* +* @event core.viewtopic_get_post_data +* @var array sql_ary The SQL array to get the data of posts and posters +* @since 3.1-A1 +*/ $vars = array('sql_ary'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_userdata', compact($vars))); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_get_post_data', compact($vars))); $sql = $db->sql_build_query('SELECT', $sql_ary); $result = $db->sql_query($sql); -- cgit v1.2.1 From ff12de97b72ef46a8bde5aca561e3cc18b7fa614 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:12:17 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_cache_guest_data PHPBB3-9550 --- phpBB/viewtopic.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 22b1bd9dea..1939d1f73b 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1108,8 +1108,17 @@ while ($row = $db->sql_fetchrow($result)) 'allow_pm' => 0, ); - $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache_guest', compact($vars))); + /** + * Modify the guests user data displayed with the posts + * + * @event core.viewtopic_cache_guest_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1-A1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_guest_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; -- cgit v1.2.1 From eb80d280b15ddb442f290c9722d394f63a9036e3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:17:29 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_cache_user_data PHPBB3-9550 --- phpBB/viewtopic.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1939d1f73b..cad3789fd4 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1174,8 +1174,17 @@ while ($row = $db->sql_fetchrow($result)) 'author_profile' => get_username_string('profile', $poster_id, $row['username'], $row['user_colour']), ); - $vars = array('user_cache_data', 'row', 'poster_id'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_user_cache', compact($vars))); + /** + * Modify the users' data displayed with their posts + * + * @event core.viewtopic_cache_user_data + * @var array user_cache_data Array with the user's data + * @var int poster_id Poster's user id + * @var array row Array with original user and post data + * @since 3.1-A1 + */ + $vars = array('user_cache_data', 'poster_id', 'row'); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_cache_user_data', compact($vars))); $user_cache[$poster_id] = $user_cache_data; -- cgit v1.2.1 From dcb4d3b92612faefc9c7b08c843be24f79d31c21 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 16:42:13 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_modify_post_row PHPBB3-9550 --- phpBB/viewtopic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index cad3789fd4..0881fb3e48 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1609,8 +1609,18 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) $user_poster_data = $user_cache[$poster_id]; + /** + * Modify the posts template block + * + * @event core.viewtopic_modify_post_row + * @var array row Array with original post and user data + * @var array cp_row Custom profile field data of the poster + * @var array user_poster_data Poster's data from user cache + * @var array post_row Template block array of the post + * @since 3.1-A1 + */ $vars = array('row', 'cp_row', 'user_poster_data', 'post_row'); - extract($phpbb_dispatcher->trigger_event('core.viewtopic_postrow', compact($vars))); + extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_post_row', compact($vars))); if (isset($cp_row['row']) && sizeof($cp_row['row'])) { -- cgit v1.2.1 From c277c240f83780b527511339068bd25d793712a9 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 6 Aug 2012 17:05:22 +0200 Subject: [feature/php-events] Fix doc and naming of core.viewtopic_modify_page_title PHPBB3-9550 --- phpBB/viewtopic.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 0881fb3e48..43aacbff0c 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1784,8 +1784,18 @@ if (!request_var('t', 0) && !empty($topic_id)) $page_title = $topic_data['topic_title'] . ($start ? ' - ' . sprintf($user->lang['PAGE_TITLE_NUMBER'], floor($start / $config['posts_per_page']) + 1) : ''); +/** +* You can use this event to modify the page title of the viewtopic page +* +* @event core.viewtopic_modify_page_title +* @var string page_title Title of the index page +* @var array topic_data Array with topic data +* @var int forum_id Forum ID of the topic +* @var int start Start offset used to calculate the page +* @since 3.1-A1 +*/ $vars = array('page_title', 'topic_data', 'forum_id', 'start'); -extract($phpbb_dispatcher->trigger_event('core.viewtopic_page_header', compact($vars))); +extract($phpbb_dispatcher->trigger_event('core.viewtopic_modify_page_title', compact($vars))); // Output the page page_header($page_title, true, $forum_id); -- cgit v1.2.1 From 058bf77a397aa49d1dfc76d95b2c2fde124cf984 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Tue, 7 Aug 2012 12:00:10 +0100 Subject: [feature/attach-dl] Moved functions_compress include PHPBB3-11042 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a4d7c8baa1..a65944742e 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -15,7 +15,6 @@ $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './'; $phpEx = substr(strrchr(__FILE__, '.'), 1); include($phpbb_root_path . 'common.' . $phpEx); include($phpbb_root_path . 'includes/functions_display.' . $phpEx); -include($phpbb_root_path . 'includes/functions_compress.' . $phpEx); include($phpbb_root_path . 'includes/bbcode.' . $phpEx); // Start session management @@ -1319,6 +1318,7 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); +require_once $phpbb_root_path . 'includes/functions_compress.' . $phpEx; $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { -- 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/viewtopic.php | 1 - 1 file changed, 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index a65944742e..9f044e0a89 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1318,7 +1318,6 @@ $template->assign_vars(array( 'S_HAS_ATTACHMENTS' => !empty($attachments), )); -require_once $phpbb_root_path . 'includes/functions_compress.' . $phpEx; $methods = phpbb_gen_download_links('topic_id', $topic_id, $phpbb_root_path, $phpEx); foreach ($methods as $method) { -- cgit v1.2.1 From 53aadd60a66c813db90aa1d54e649384679f2614 Mon Sep 17 00:00:00 2001 From: Fyorl Date: Fri, 17 Aug 2012 16:16:02 +0100 Subject: [feature/attach-dl] Renamed $post_id to $post_msg_id PHPBB3-11042 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 9f044e0a89..41566219b9 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1606,7 +1606,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) ); } - $methods = phpbb_gen_download_links('post_id', $row['post_id'], $phpbb_root_path, $phpEx); + $methods = phpbb_gen_download_links('post_msg_id', $row['post_id'], $phpbb_root_path, $phpEx); foreach ($methods as $method) { $template->assign_block_vars('postrow.dl_method', $method); -- cgit v1.2.1 From 6ad805713d4105372d4b4aabd8f2498662a10369 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Aug 2012 09:52:35 +0200 Subject: [feature/php-events] Fix doc of core.viewtopic_cache_guest_data PHPBB3-9550 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 43aacbff0c..1da962bbaa 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1109,7 +1109,7 @@ while ($row = $db->sql_fetchrow($result)) ); /** - * Modify the guests user data displayed with the posts + * Modify the guest user's data displayed with the posts * * @event core.viewtopic_cache_guest_data * @var array user_cache_data Array with the user's data -- cgit v1.2.1 From 64bc658c044451c4808fac3bd5781196c604ac38 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Mon, 20 Aug 2012 09:54:12 +0200 Subject: [feature/php-events] Fix doc of core.viewtopic_get_post_data PHPBB3-9550 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 1da962bbaa..c0dd800a99 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -988,7 +988,7 @@ $sql_ary = array( ); /** -* Event to modify the SQL query before the post and poster data is queried +* Event to modify the SQL query before the post and poster data is retrieved * * @event core.viewtopic_get_post_data * @var array sql_ary The SQL array to get the data of posts and posters -- cgit v1.2.1 From e1a4aa3ea255874660d31e13c0b4cadc8993ef4f Mon Sep 17 00:00:00 2001 From: Fyorl Date: Mon, 20 Aug 2012 21:52:42 +0100 Subject: [feature/attach-dl] Removed the use of some abbreviations PHPBB3-11042 --- phpBB/viewtopic.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/viewtopic.php') diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 41566219b9..036f70e729 100644 --- a/phpBB/viewtopic.php +++ b/phpBB/viewtopic.php @@ -1566,7 +1566,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'POSTER_ID' => $poster_id, 'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false, - 'S_MULTIPLE_ATTACH' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, + 'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1, 'S_POST_UNAPPROVED' => ($row['post_approved']) ? false : true, 'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false, 'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'], -- cgit v1.2.1