Report #15: Can't write global announcement reply

This commit is contained in:
Ice
2008-01-27 13:41:08 +00:00
parent 15cad4f972
commit b6f013433d
5 changed files with 85 additions and 92 deletions

View File

@@ -17,27 +17,38 @@ if (!defined('IN_PORTAL'))
exit; exit;
} }
$template->assign_vars(array(
'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
'S_DISPLAY_ANNOUNCEMENTS' => true,
));
#if (!isset($HTTP_GET_VARS['article']))
$news = request_var('announcement', -1); $fetch_news = phpbb_fetch_posts('', $portal_config['portal_number_of_announcements'], $portal_config['portal_announcements_length'], $portal_config['portal_announcements_day'], 'announcements');
if($news < 0)
// Get cleaned up list... return only those forums not having the f_read permission
$forum_ary = $auth->acl_getf('!f_read', true);
$forum_ary = array_unique(array_keys($forum_ary));
// Determine first forum the user is able to read into - for global announcement link
$sql = 'SELECT forum_id
FROM ' . FORUMS_TABLE . '
WHERE forum_type = ' . FORUM_POST;
if (sizeof($forum_ary))
{ {
$fetch_news = phpbb_fetch_posts('', $portal_config['portal_number_of_announcements'], $portal_config['portal_announcements_length'], $portal_config['portal_announcements_day'], 'announcements'); $sql .= ' AND ' . $db->sql_in_set('forum_id', $forum_ary, true);
}
$result = $db->sql_query_limit($sql, 1);
$g_forum_id = (int) $db->sql_fetchfield('forum_id');
$db->sql_freeresult($result);
if (count($fetch_news) == 0) $can_read = ( $g_forum_id == 0 ) ? false : true;
{
if (count($fetch_news) == 0)
{
$template->assign_block_vars('announcements_row', array( $template->assign_block_vars('announcements_row', array(
'S_NO_TOPICS' => true, 'S_NO_TOPICS' => true,
'S_NOT_LAST' => false 'S_NOT_LAST' => false
)); ));
} }
else else
{ {
for ($i = 0; $i < count($fetch_news); $i++) for ($i = 0; $i < count($fetch_news); $i++)
{ {
if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true ) if( isset($fetch_news[$i]['striped']) && $fetch_news[$i]['striped'] == true )
@@ -59,6 +70,8 @@ if($news < 0)
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false); $topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false);
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; $unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
$forum_id = ( $forum_id == 0 ) ? $g_forum_id : $forum_id;
$template->assign_block_vars('announcements_row', array( $template->assign_block_vars('announcements_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '', 'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TITLE' => $fetch_news[$i]['topic_title'], 'TITLE' => $fetch_news[$i]['topic_title'],
@@ -68,9 +81,9 @@ if($news < 0)
'TEXT' => $fetch_news[$i]['post_text'], 'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'], 'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'], 'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']), 'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($forum_id) ? 'f=' . $forum_id . '&amp;' : '') . 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 't=' . $fetch_news[$i]['topic_id']), 'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($forum_id) ? 'f=' . $forum_id . '&amp;' : '') . 't=' . $topic_id),
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&amp;' . (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 't=' . $fetch_news[$i]['topic_id']), 'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&amp;' . (($forum_id) ? 'f=' . $forum_id . '&amp;' : '') . 't=' . $topic_id),
'U_READ_FULL' => append_sid("{$phpbb_root_path}portal.$phpEx", 'announcement=' . $i), 'U_READ_FULL' => append_sid("{$phpbb_root_path}portal.$phpEx", 'announcement=' . $i),
'L_READ_FULL' => $read_full, 'L_READ_FULL' => $read_full,
'OPEN' => $open_bracket, 'OPEN' => $open_bracket,
@@ -81,33 +94,13 @@ if($news < 0)
'S_UNREAD_INFO' => $unread_topic, 'S_UNREAD_INFO' => $unread_topic,
)); ));
} }
}
} }
else
{
#$fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_config['portal_number_of_news'], 0, 0, ($portal_config['portal_show_all_news']) ? 'news_all' : 'news');
$fetch_news = $fetch_news = phpbb_fetch_posts('', $portal_config['portal_number_of_announcements'], 0, 0, 'announcements');
$i = $news; $template->assign_vars(array(
$forum_id = $fetch_news[$i]['forum_id']; 'NEWEST_POST_IMG' => $user->img('icon_topic_newest', 'VIEW_NEWEST_POST'),
$topic_id = $fetch_news[$i]['topic_id']; 'READ_POST_IMG' => $user->img('icon_topic_latest', 'VIEW_NEWEST_POST'),
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id, $global_announce_list = false); 'S_DISPLAY_ANNOUNCEMENTS' => true,
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $fetch_news[$i]['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false; 'S_CAN_READ' => $can_read,
));
$template->assign_block_vars('announcements_row', array(
'ATTACH_ICON_IMG' => ($fetch_news[$i]['attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'TITLE' => $fetch_news[$i]['topic_title'],
'POSTER' => $fetch_news[$i]['username'],
'TIME' => $fetch_news[$i]['topic_time'],
'TEXT' => $fetch_news[$i]['post_text'],
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 'p=' . $fetch_news[$i]['topic_last_post_id'] . '#p' . $fetch_news[$i]['topic_last_post_id']),
'U_VIEW_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 't=' . $fetch_news[$i]['topic_id']),
'U_POST_COMMENT' => append_sid("{$phpbb_root_path}posting.$phpEx", 'mode=reply&amp;' . (($fetch_news[$i]['forum_id']) ? 'f=' . $fetch_news[$i]['forum_id'] . '&amp;' : '') . 't=' . $fetch_news[$i]['topic_id']),
'S_POLL' => $fetch_news[$i]['poll'],
'S_UNREAD_INFO' => $unread_topic,
));
}
?> ?>

View File

@@ -19,7 +19,7 @@
</ul> </ul>
<br /> <br />
<div class="content"><div style="float: left; margin: 0 0 0 5px"> {announcements_row.TEXT}</div></div><br /> <div class="content"><div style="float: left; margin: 0 0 0 5px"> {announcements_row.TEXT}</div></div><br />
<span style="float: left; margin: 0 0 0 5px">{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS} &nbsp;&bull;&nbsp; <a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}: {announcements_row.REPLIES}</a> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span> <span style="float: left; margin: 0 0 0 5px">{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}<!-- IF S_CAN_READ --> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}: {announcements_row.REPLIES}</a> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_POST_COMMENT}">{L_POST_REPLY}</a><!-- ENDIF --></span>
<span style="float: right; margin: 0 5px 5px 0">{announcements_row.OPEN}<a href="{announcements_row.U_READ_FULL}">{announcements_row.L_READ_FULL}</a>{announcements_row.CLOSE}</span> <span style="float: right; margin: 0 5px 5px 0">{announcements_row.OPEN}<a href="{announcements_row.U_READ_FULL}">{announcements_row.L_READ_FULL}</a>{announcements_row.CLOSE}</span>
</div> </div>
<div class="back2top"><span style="float: right; margin: 0 5px 0 0"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span></div> <div class="back2top"><span style="float: right; margin: 0 5px 0 0"><a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span></div>

View File

@@ -22,7 +22,7 @@
<span style="float: right; margin: 0 5px 0 0;">{L_POST_BY_AUTHOR}: <strong><a href="{announcements_row.U_USER_PROFILE}">{announcements_row.POSTER}</a></strong></span> <span style="float: right; margin: 0 5px 0 0;">{L_POST_BY_AUTHOR}: <strong><a href="{announcements_row.U_USER_PROFILE}">{announcements_row.POSTER}</a></strong></span>
<br style="clear:both" /> <br style="clear:both" />
<span style="float: left; margin: 0 0 0 14px;"> <span style="float: left; margin: 0 0 0 14px;">
<a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {announcements_row.REPLIES}</em></span></a> <!-- IF S_CAN_READ --><a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}"><span style="font-size:0.9em;"><em>{L_COMMENTS}: {announcements_row.REPLIES}</em></span></a><!-- ENDIF -->
<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}</em></span> <span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}</em></span>
</span> </span>
<span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{announcements_row.TIME}</strong></span> <span style="float: right; margin: 0 5px 0 0;">{L_POSTED_ON_DATE} <strong>{announcements_row.TIME}</strong></span>

View File

@@ -29,7 +29,7 @@
</tr> </tr>
<tr class="row1"> <tr class="row1">
<td> <td>
<span style="float: left;">{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS} &nbsp;&bull;&nbsp; <a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}: {announcements_row.REPLIES}</a> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span> <span style="float: left;">{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}<!-- IF S_CAN_READ --> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}: {announcements_row.REPLIES}</a> &nbsp;&bull;&nbsp; <a href="{announcements_row.U_POST_COMMENT}">{L_POST_REPLY}</a><!-- ENDIF --></span>
<span style="float: right;">{announcements_row.OPEN}<a href="{announcements_row.U_READ_FULL}">{announcements_row.L_READ_FULL}</a>{announcements_row.CLOSE} <a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span> <span style="float: right;">{announcements_row.OPEN}<a href="{announcements_row.U_READ_FULL}">{announcements_row.L_READ_FULL}</a>{announcements_row.CLOSE} <a href="#wrap" class="top" title="{L_BACK_TO_TOP}">{L_BACK_TO_TOP}</a></span>
</td> </td>
</tr> </tr>

View File

@@ -20,9 +20,9 @@
{L_POST_BY_AUTHOR}: <strong><a href="{announcements_row.U_USER_PROFILE}">{announcements_row.POSTER}</a></strong> {L_POST_BY_AUTHOR}: <strong><a href="{announcements_row.U_USER_PROFILE}">{announcements_row.POSTER}</a></strong>
</span> </span>
<br /> <br />
<span style="float: left;font-size:0.9em;"> <!-- IF S_CAN_READ --><span style="float: left;font-size:0.9em;">
<a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}"><em>{L_COMMENTS}: {announcements_row.REPLIES}</em></a> <a href="{announcements_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}"><em>{L_COMMENTS}: {announcements_row.REPLIES}</em></a>
</span> </span><!-- ENDIF -->
<span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}</em></span> <span style="font-size:0.9em;"><em>{L_TOPIC_VIEWS}: {announcements_row.TOPIC_VIEWS}</em></span>
<span style="float: right;">{L_POSTED_ON_DATE} <strong>{announcements_row.TIME}</strong></span> <span style="float: right;">{L_POSTED_ON_DATE} <strong>{announcements_row.TIME}</strong></span>
</td> </td>