Attachments now work :)

This commit is contained in:
Ice
2008-08-11 15:25:45 +00:00
parent e3a38cbf5f
commit 336a4ef10e
7 changed files with 94 additions and 3 deletions

View File

@@ -168,7 +168,18 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
'S_POLL' => $fetch_news[$i]['poll'],
'S_UNREAD_INFO' => $unread_topic,
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false,
));
if( !empty($fetch_news[$i]['attachments']) )
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
$template->assign_block_vars('announcements_row.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}
if ($portal_config['portal_number_of_announcements'] <> 0 && $portal_config['portal_announcements_archive'])
{
@@ -221,8 +232,19 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_global_announcements_foru
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket,
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? 'yes' : 'no',
));
if( !empty($fetch_news[$i]['attachments']) )
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
$template->assign_block_vars('announcements_row.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}
if ($portal_config['portal_number_of_announcements'] <> 0 && $portal_config['portal_announcements_archive'])
{
$template->assign_vars(array(

View File

@@ -147,6 +147,7 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
'REPLIES' => $fetch_news[$i]['topic_replies'],
'TOPIC_VIEWS' => $fetch_news[$i]['topic_views'],
'N_ID' => $i,
'BAD' => 'BOOBS',
'U_VIEWFORUM' => append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $fetch_news[$i]['forum_id']),
'U_LAST_COMMENTS' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . $fetch_news[$i]['forum_id'] . '&amp;t=' . $fetch_news[$i]['topic_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", 'f=' . $fetch_news[$i]['forum_id'] . '&amp;t=' . $fetch_news[$i]['topic_id']),
@@ -160,8 +161,19 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
'S_POLL' => $fetch_news[$i]['poll'],
'S_UNREAD_INFO' => $unread_topic,
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false,
));
if( !empty($fetch_news[$i]['attachments']) )
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
$template->assign_block_vars('news_row.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}
if ($portal_config['portal_number_of_news'] <> 0 && $portal_config['portal_news_archive'])
{
$template->assign_vars(array(
@@ -213,8 +225,19 @@ $fetch_news = phpbb_fetch_posts($portal_config['portal_news_forum'], $portal_con
'OPEN' => $open_bracket,
'CLOSE' => $close_bracket,
'PAGINATION' => topic_generate_pagination($fetch_news[$i]['topic_replies'], $view_topic_url),
'S_HAS_ATTACHMENTS' => (!empty($fetch_news[$i]['attachments'])) ? true : false,
));
if( !empty($fetch_news[$i]['attachments']) )
{
foreach ($fetch_news[$i]['attachments'] as $attachment)
{
$template->assign_block_vars('news_row.attachment', array(
'DISPLAY_ATTACHMENT' => $attachment)
);
}
}
if ($portal_config['portal_number_of_news'] <> 0 && $portal_config['portal_news_archive'])
{
$template->assign_vars(array(

View File

@@ -254,6 +254,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
while ( $row = $db->sql_fetchrow($result) )
{
$attachments = array();
if( $config['allow_attachments'] )
{
// Pull attachment data
@@ -301,7 +302,7 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
{
$global_f = $row['forum_id'];
}
$posts[$i] = array_merge($posts[$i], array(
'post_text' => ap_validate($message),
'topic_id' => $row['topic_id'],
@@ -319,7 +320,8 @@ function phpbb_fetch_posts($forum_from, $permissions, $number_of_posts, $text_le
'poll' => ($row['poll_title']) ? true : false,
'attachment' => ($row['topic_attachment']) ? true : false,
'topic_views' => $row['topic_views'],
'forum_name' => $row['forum_name']
'forum_name' => $row['forum_name'],
'attachments' => (!empty($attachments)) ? $attachments : array(),
));
$posts['global_id'] = $global_f;

View File

@@ -34,6 +34,14 @@
<br />
{announcements_row.TEXT}
</div>
<!-- IF announcements_row.S_HAS_ATTACHMENTS -->
<dl class="attachbox">
<dt>{L_ATTACHMENTS}</dt>
<!-- BEGIN attachment -->
<dd>{announcements_row.attachment.DISPLAY_ATTACHMENT}</dd>
<!-- END attachment -->
</dl>
<!-- ENDIF -->
<br style="clear:both" />
<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: right; margin: 0 0 5px 0">{announcements_row.OPEN}<a href="{announcements_row.U_READ_FULL}">{announcements_row.L_READ_FULL}</a>{announcements_row.CLOSE}</span>

View File

@@ -19,7 +19,7 @@
<h4 class="first"><a name="n{news_row.N_ID}"></a><!-- IF news_row.S_UNREAD_INFO --><a href="{news_row.U_VIEW_UNREAD}">{NEWEST_POST_IMG}</a><!-- ELSE --><a href="{news_row.U_VIEW_COMMENTS}">{READ_POST_IMG}</a><!-- ENDIF --> {news_row.ATTACH_ICON_IMG} <!-- IF news_row.S_POLL --><strong>{L_POLL}: </strong><!-- ENDIF --><a href="{news_row.U_LAST_COMMENTS}"><strong>{news_row.TITLE}</strong></a></h4>
<!-- IF news_row.PAGINATION --><strong class="pagination"><span>{news_row.PAGINATION}</span></strong><!-- ENDIF -->
<ul class="linklist">
<li>{POSTED_BY_TEXT} {L_POST_BY_AUTHOR}: {news_row.POSTER_FULL} {L_POSTED_ON_DATE} {news_rownews_row.TIME}</li>
<li>{POSTED_BY_TEXT} {L_POST_BY_AUTHOR}: {news_row.POSTER_FULL} {L_POSTED_ON_DATE} {news_row.TIME}</li>
</ul>
<ul class="linklist">
<li>{L_FORUM}: <strong><a href="{news_row.U_VIEWFORUM}">{news_row.FORUM_NAME}</a></strong></li>
@@ -28,6 +28,14 @@
<br />
{news_row.TEXT}
</div>
<!-- IF news_row.S_HAS_ATTACHMENTS -->
<dl class="attachbox">
<dt>{L_ATTACHMENTS}</dt>
<!-- BEGIN attachment -->
<dd>{news_row.attachment.DISPLAY_ATTACHMENT}</dd>
<!-- END attachment -->
</dl>
<!-- ENDIF -->
<br style="clear:both" />
<span style="float: left;">{L_TOPIC_VIEWS}: {news_row.TOPIC_VIEWS} &nbsp;&bull;&nbsp; <a href="{news_row.U_VIEW_COMMENTS}" title="{L_VIEW_COMMENTS}">{L_COMMENTS}: {news_row.REPLIES}</a> &nbsp;&bull;&nbsp; <a href="{news_row.U_POST_COMMENT}">{L_POST_REPLY}</a></span>
<span style="float: right; margin: 0 0 5px 0">{news_row.OPEN}<a href="{news_row.U_READ_FULL}">{news_row.L_READ_FULL}</a>{news_row.CLOSE}</span>

View File

@@ -30,6 +30,20 @@
<div class="postbody">
{announcements_row.TEXT}
</div>
<!-- IF announcements_row.S_HAS_ATTACHMENTS -->
<br clear="all" /><br />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="row3"><b class="genmed">{L_ATTACHMENTS}: </b></td>
</tr>
<!-- BEGIN attachment -->
<tr>
<!-- IF announcements_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{announcements_row.attachment.DISPLAY_ATTACHMENT}</td>
</tr>
<!-- END attachment -->
</table>
<!-- ENDIF -->
<br /><br />
<!-- IF announcements_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {announcements_row.PAGINATION} ]</span><!-- ENDIF -->
</td>

View File

@@ -25,6 +25,20 @@
<div class="postbody">
{news_row.TEXT}
</div>
<!-- IF news_row.S_HAS_ATTACHMENTS -->
<br clear="all" /><br />
<table class="tablebg" width="100%" cellspacing="1">
<tr>
<td class="row3"><b class="genmed">{L_ATTACHMENTS}: </b></td>
</tr>
<!-- BEGIN attachment -->
<tr>
<!-- IF news_row.attachment.S_ROW_COUNT is even --><td class="row2"><!-- ELSE --><td class="row1"><!-- ENDIF -->{news_row.attachment.DISPLAY_ATTACHMENT}</td>
</tr>
<!-- END attachment -->
</table>
<!-- ENDIF -->
<br /><br />
<!-- IF news_row.PAGINATION --><span style="float: right;">[ {GOTO_PAGE_IMG}{L_GOTO_PAGE}: {news_row.PAGINATION} ]</span><!-- ENDIF -->
</td>