mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
Merge pull request #1619 from VSEphpbb/ticket/11749
[ticket/11749] PHP and Template Events for Topic Preview Extension
This commit is contained in:
commit
6cbe887ea0
7 changed files with 76 additions and 2 deletions
|
@ -114,6 +114,24 @@ simple_footer_after
|
|||
* Location: styles/prosilver/template/simple_footer.html
|
||||
* Purpose: Add content directly prior to the `</body>` tag of the simple footer
|
||||
|
||||
topiclist_row_prepend
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/search_results.html
|
||||
+ styles/prosilver/template/viewforum_body.html
|
||||
+ styles/subsilver2/template/search_results.html
|
||||
+ styles/subsilver2/template/viewforum_body.html
|
||||
* Purpose: Add content into topic rows (inside the elements containing topic titles)
|
||||
|
||||
topiclist_row_append
|
||||
===
|
||||
* Locations:
|
||||
+ styles/prosilver/template/search_results.html
|
||||
+ styles/prosilver/template/viewforum_body.html
|
||||
+ styles/subsilver2/template/search_results.html
|
||||
+ styles/subsilver2/template/viewforum_body.html
|
||||
* Purpose: Add content into topic rows (inside the elements containing topic titles)
|
||||
|
||||
ucp_pm_viewmessage_print_head_append
|
||||
===
|
||||
* Location: styles/prosilver/template/ucp_pm_viewmessage_print.html
|
||||
|
|
|
@ -687,6 +687,18 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
$tracking_topics = ($tracking_topics) ? tracking_unserialize($tracking_topics) : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query before the topic data is retrieved
|
||||
*
|
||||
* @event core.search_get_topic_data
|
||||
* @var string sql_select The SQL SELECT string used by search to get topic data
|
||||
* @var string sql_from The SQL FROM string used by search to get topic data
|
||||
* @var string sql_where The SQL WHERE string used by search to get topic data
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('sql_select', 'sql_from', 'sql_where');
|
||||
extract($phpbb_dispatcher->trigger_event('core.search_get_topic_data', compact($vars)));
|
||||
|
||||
$sql = "SELECT $sql_select
|
||||
FROM $sql_from
|
||||
WHERE $sql_where";
|
||||
|
@ -989,7 +1001,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
);
|
||||
}
|
||||
|
||||
$template->assign_block_vars('searchresults', array_merge($tpl_ary, array(
|
||||
$tpl_ary = array_merge($tpl_ary, array(
|
||||
'FORUM_ID' => $forum_id,
|
||||
'TOPIC_ID' => $result_topic_id,
|
||||
'POST_ID' => ($show_results == 'posts') ? $row['post_id'] : false,
|
||||
|
@ -1001,9 +1013,22 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
|||
|
||||
'U_VIEW_TOPIC' => $view_topic_url,
|
||||
'U_VIEW_FORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id),
|
||||
'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '')
|
||||
'U_VIEW_POST' => (!empty($row['post_id'])) ? append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=" . $row['topic_id'] . '&p=' . $row['post_id'] . (($u_hilit) ? '&hilit=' . $u_hilit : '')) . '#p' . $row['post_id'] : '',
|
||||
));
|
||||
|
||||
/**
|
||||
* Modify the topic data before it is assigned to the template
|
||||
*
|
||||
* @event core.search_modify_tpl_ary
|
||||
* @var array row Array with topic data
|
||||
* @var array tpl_ary Template block array with topic data
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('row', 'tpl_ary');
|
||||
extract($phpbb_dispatcher->trigger_event('core.search_modify_tpl_ary', compact($vars)));
|
||||
|
||||
$template->assign_block_vars('searchresults', $tpl_ary);
|
||||
|
||||
if ($show_results == 'topics')
|
||||
{
|
||||
phpbb_generate_template_pagination($template, $view_topic_url, 'searchresults.pagination', 'start', $replies + 1, $config['posts_per_page'], 1, true, true);
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
<dt <!-- IF searchresults.TOPIC_ICON_IMG -->style="background-image: url({T_ICONS_PATH}{searchresults.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{searchresults.TOPIC_FOLDER_IMG_ALT}">
|
||||
<div class="list-inner">
|
||||
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF -->
|
||||
<a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a> {searchresults.ATTACH_ICON_IMG}
|
||||
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED --><a href="{searchresults.U_MCP_QUEUE}">{searchresults.UNAPPROVED_IMG}</a> <!-- ENDIF -->
|
||||
|
@ -83,6 +84,7 @@
|
|||
</div>
|
||||
<!-- ENDIF -->
|
||||
{L_POST_BY_AUTHOR} {searchresults.TOPIC_AUTHOR_FULL} » {searchresults.FIRST_POST_TIME} » {L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a>
|
||||
<!-- EVENT topiclist_row_append -->
|
||||
|
||||
</div>
|
||||
</dt>
|
||||
|
|
|
@ -144,6 +144,7 @@
|
|||
<dl class="icon {topicrow.TOPIC_IMG_STYLE}">
|
||||
<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}">
|
||||
<div class="list-inner">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
|
||||
<!-- IF topicrow.S_TOPIC_DELETED --><a href="{topicrow.U_MCP_QUEUE}">{DELETED_IMG}</a> <!-- ENDIF -->
|
||||
|
@ -164,6 +165,7 @@
|
|||
<!-- ENDIF -->
|
||||
<!-- IF topicrow.ATTACH_ICON_IMG -->{topicrow.ATTACH_ICON_IMG} <!-- ENDIF -->{L_POST_BY_AUTHOR} {topicrow.TOPIC_AUTHOR_FULL} » {topicrow.FIRST_POST_TIME}
|
||||
<!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --> » {L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a><!-- ENDIF -->
|
||||
<!-- EVENT topiclist_row_append -->
|
||||
</div>
|
||||
</dt>
|
||||
<dd class="posts">{topicrow.REPLIES} <dfn>{L_REPLIES}</dfn></dd>
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
<!-- ENDIF -->
|
||||
</td>
|
||||
<td class="row1">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF searchresults.S_UNREAD_TOPIC --><a href="{searchresults.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{searchresults.ATTACH_ICON_IMG} <a href="{searchresults.U_VIEW_TOPIC}" class="topictitle">{searchresults.TOPIC_TITLE}</a>
|
||||
<!-- IF searchresults.S_TOPIC_UNAPPROVED or searchresults.S_POSTS_UNAPPROVED -->
|
||||
|
@ -58,6 +59,7 @@
|
|||
] </p>
|
||||
<!-- ENDIF -->
|
||||
<p class="gensmall">{L_IN} <a href="{searchresults.U_VIEW_FORUM}">{searchresults.FORUM_TITLE}</a></p>
|
||||
<!-- EVENT topiclist_row_append -->
|
||||
</td>
|
||||
<td class="row2" width="100" align="center"><p class="topicauthor">{searchresults.TOPIC_AUTHOR_FULL}</p></td>
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{searchresults.TOPIC_REPLIES}</p></td>
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
<td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="{topicrow.U_VIEW_TOPIC}"class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
|
||||
|
@ -63,6 +64,7 @@
|
|||
<!-- END pagination -->
|
||||
] </p>
|
||||
<!-- ENDIF -->
|
||||
<!-- EVENT topiclist_row_append -->
|
||||
</td>
|
||||
<td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td>
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td>
|
||||
|
@ -203,6 +205,7 @@
|
|||
<td class="row1" width="25" align="center"><!-- IF topicrow.TOPIC_ICON_IMG --><img src="{T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}" width="{topicrow.TOPIC_ICON_IMG_WIDTH}" height="{topicrow.TOPIC_ICON_IMG_HEIGHT}" alt="" title="" /><!-- ENDIF --></td>
|
||||
<!-- ENDIF -->
|
||||
<td class="row1">
|
||||
<!-- EVENT topiclist_row_prepend -->
|
||||
<!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}" class="imageset">{NEWEST_POST_IMG}</a><!-- ENDIF -->
|
||||
{topicrow.ATTACH_ICON_IMG} <!-- IF topicrow.S_HAS_POLL or topicrow.S_TOPIC_MOVED --><b>{topicrow.TOPIC_TYPE}</b> <!-- ENDIF --><a title="{L_POSTED}{L_COLON} {topicrow.FIRST_POST_TIME}" href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
|
||||
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED -->
|
||||
|
@ -227,6 +230,7 @@
|
|||
] </p>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF topicrow.S_POST_GLOBAL and FORUM_ID != topicrow.FORUM_ID --><p class="gensmall">{L_IN} <a href="{topicrow.U_VIEW_FORUM}">{topicrow.FORUM_NAME}</a></p><!-- ENDIF -->
|
||||
<!-- EVENT topiclist_row_append -->
|
||||
</td>
|
||||
<td class="row2" width="130" align="center"><p class="topicauthor">{topicrow.TOPIC_AUTHOR_FULL}</p></td>
|
||||
<td class="row1" width="50" align="center"><p class="topicdetails">{topicrow.REPLIES}</p></td>
|
||||
|
|
|
@ -372,6 +372,16 @@ $sql_array = array(
|
|||
'LEFT_JOIN' => array(),
|
||||
);
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query before the topic data is retrieved
|
||||
*
|
||||
* @event core.viewforum_get_topic_data
|
||||
* @var array sql_array The SQL array to get the data of all topics
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('sql_array');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_get_topic_data', compact($vars)));
|
||||
|
||||
$sql_approved = ' AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||
|
||||
if ($user->data['is_registered'])
|
||||
|
@ -554,6 +564,17 @@ if (sizeof($shadow_topic_list))
|
|||
$sql = 'SELECT *
|
||||
FROM ' . TOPICS_TABLE . '
|
||||
WHERE ' . $db->sql_in_set('topic_id', array_keys($shadow_topic_list));
|
||||
|
||||
/**
|
||||
* Event to modify the SQL query before the shadowtopic data is retrieved
|
||||
*
|
||||
* @event core.viewforum_get_shadowtopic_data
|
||||
* @var string sql The SQL string to get the data of any shadowtopics
|
||||
* @since 3.1-A1
|
||||
*/
|
||||
$vars = array('sql');
|
||||
extract($phpbb_dispatcher->trigger_event('core.viewforum_get_shadowtopic_data', compact($vars)));
|
||||
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
|
|
Loading…
Add table
Reference in a new issue