Servus,
ich weiß nicht wo es hin gehört. Habe den SMF Center Block einmal dahingehend erweitert, dass man auch den "letzten Beitrag" ausblenden kann.
<?php
/************************************
pragmaMx SMF-port
Copyright (C) 2005 by A.Ellsel (Tora) - http://pragmaMx.org
***********************************
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***********************************
$Source: /home/www/dps3311/home/cvsroot/pragmamx2/SMF-port/html/blocks/block-smf_Center.php,v $
$Revision: 1.5 $
$Author: tora60 $
$Date: 2005/12/31 21:51:34 $
************************************/
if (!defined("mxMainFileLoaded")) die ("You can't access this file directly...");
/// der Modulname (Ordner des Moduls)
$boardname = 'Forum';
/// Anzahl der angezeigten neuesten Threads
$num_threads = 6;
/// Boards die nicht angezeigt werden sollen, als Array
$exclude_boards = null;
/// Thread-Icons in Liste anzeigen
$show_icons = 1;
/// Anzahl, wie oft gelesen, in Liste anzeigen
$show_views = 0;
/// Anzahl der Antworten in Liste anzeigen
$show_replies = 0;
/// Name des Themenstarters in Liste anzeigen
$show_starter = 0;
/// Letzter Beitrag anzeigen
$show_last = 0;
/// kleine Forumsstatistik anzeigen
$show_stats = 1;
/// User-Onlinestatistik anzeigen
$show_online = 0;
/// in Onlinestatistik die Buddies extra listen
$show_buddies = 0;
/// Farben des Blocks
global $bgcolor1, $bgcolor2, $bgcolor3, $textcolor1, $textcolor2;
/// Rahmen um die Liste
$color['border'] = $bgcolor2;
/// Hintergrund Überschriften
$color['row1'] = $bgcolor1;
/// Hintergrund normaler Thread
$color['row2'] = $bgcolor3;
/// Textfarbe Überschriften
$color['txtrow1'] = $textcolor1;
/// Textfarbe normaler Thread
$color['txtrow2'] = $textcolor2;
//////////// ENDE DER EINSTELLUNGEN ///////////////////////////////////////////////////////
/// versch. globale Variablen vorher initialisieren, weil in Funktionen aufgerufen
global $db_prefix, $settings, $context, $scripturl, $mxsmf;
/// die SSI-Datei includen
include(dirname(dirname(__FILE__)) . '/modules/'.$boardname.'/mx_SSI.php');
/// Boardstatistik
$boardstats = ssi_boardStats('array');
$boardstats = '
'. $txt[330]. ': '. $boardstats['topics']. ' |
'. $txt[95]. ': '. $boardstats['posts']. ' |
'. $txt[331]. ': <a href="modules.php?name='. $boardname. '&action=mlist" title="'.$txt['332'].'">'. $boardstats['members']. '</a>
';
/// Wer ist Online?
if ($show_online) {
$whoonline = ssi_whosOnline('array');
$whoonline_out = ''. $whoonline['guests']. ' '. (($whoonline['guests'] == 1) ? $txt['guest'] : $txt['guests']). ', '. $whoonline['num_users']. ' '. (($whoonline['num_users'] == 1) ? $txt['user'] : $txt['users']);
// Hidden users. or buddies?
if ($whoonline['hidden'] > 0 || $show_buddies)
$whoonline_out .= ' (' . ($show_buddies ? ($whoonline['buddies'] . ' ' . (($whoonline['buddies'] == 1) ? $txt['buddy'] : $txt['buddies'])) : '') . ($show_buddies && $whoonline['hidden'] ? ', ' : '') . (!$whoonline['hidden'] ? '' : $whoonline['hidden'] . ' ' . $txt['hidden']) . ')';
if (count($whoonline['users'])) {
$whoonline_list = '';
foreach ($whoonline['users'] as $user)
$whoonline_list .= (($user['hidden']) ? '<i>' . $user['link'] . '</i>' : $user['link']). (($user['is_last']) ? '' : '. ');
}
#mxDebugFuncVars($whoonline_out);
}
/// die Threads und Posts
$posts = ssi_recentTopics(intval($num_threads), $exclude_boards, 'array');
if ($show_starter || $show_replies || $show_views) {
/// alle Thread-ID's vorher auslesen, für Datenbankbedingung
foreach ($posts as $post) {
$topics[$post['topic']] = $post['topic'];
}
if (isset($topics)) {
/// zusätzliche Daten, die nicht von SSI bereitgestellt werden ermitteln
$qry = "SELECT DISTINCT m.ID_MEMBER, m.posterName, t.numReplies, t.numViews, t.ID_TOPIC
FROM {$db_prefix}topics AS t
LEFT JOIN {$db_prefix}messages AS m ON ( m.ID_MSG = t.ID_FIRST_MSG )
WHERE t.ID_TOPIC IN (".implode(',',$topics).")
LIMIT ".intval($num_threads)."";
$result = sql_query($qry);
/// die zusätzlichen Daten sind dann über den Index des Arrays ansprechbar, dieser index entspricht der Thread-ID
while ($row = sql_fetch_assoc($result)) {
$row['link'] = (empty($row['ID_MEMBER'])) ? $row['posterName'] : '<a href="modules.php?name='. $boardname. '&action=profile;u=' . $row['ID_MEMBER'] . '" title="'. $txt[92]. ' ' . $row['posterName'] . '">' . $row['posterName'] . '</a>';
$posts_more[$row['ID_TOPIC']] = $row;
}
}
}
#mxDebugFuncVars($topics, $posts_more);
/// Der Tabellenkopf für die Threads und Posts
$content = '<table width="100%" border="0" cellspacing="1" cellpadding="2" style="background: '.$color['border'].';">
<tr style="background: '.$color['row1'].'; color: '.$color['txtrow1'].';">';
$content .= '<th colspan="'.(($show_icons) ? 2 : 1).'">'.$txt['319'].'</th>'; # Thema
if ($show_starter)
$content .= '<th>'.$txt['109'].'</th>'; # Themenstarter
if ($show_replies)
$content .= '<th>'.$txt['110'].'</th>'; # Antworten
if ($show_views)
$content .= '<th>'.$txt['301'].'</th>'; # Aufrufe
if ($show_last)
$content .= '<th>'.$txt['111'].'</th>'; # Letzter Beitrag
$content .= '
</tr>
';
/// die Hauptliste der einzelnen Threads
foreach ($posts as $post) {
#mxDebugFuncVars($post);
$new = (!$post['new']) ? ' <a href="modules.php?name='. $boardname. '&topic=' . $post['topic'] . '.msg' . $post['new_from'] . ';topicseen#new"><img src="' . $settings['images_url'] . '/' . $context['user']['language'] . '/new.gif" alt="' . $txt[302] . '" border="0" align="right"></a> ': '';
$content .= '<tr style="background: '.$color['row2'].'; color: '.$color['txtrow2'].';">';
if ($show_icons)
$content .= '<td width="1%" align="center" style="background: '.$color['row1'].';">'.$post['icon'].'</td>';
$content .= '<td>'.$new.'<a href="'. $post['href']. '">'. $post['subject']. '</a><br /><em>'. $txt['smf88']. ' '. $post['board']['link']. '</em></td>';
if ($show_starter)
$content .= '<td width="1%" style="white-space: nowrap;">'.((isset($posts_more[$post['topic']]['link'])) ? $posts_more[$post['topic']]['link'] : '').'</td>';
if ($show_replies)
$content .= '<td width="1%" align="center">'.((isset($posts_more[$post['topic']]['numReplies'])) ? $posts_more[$post['topic']]['numReplies'] : 0).'</td>';
if ($show_views)
$content .= '<td width="1%" align="center">'.((isset($posts_more[$post['topic']]['numViews'])) ? $posts_more[$post['topic']]['numViews'] : 0).'</td>';
if ($show_last)
$content .= '<td>'. $post['time']. '<br />'. $txt[525]. ' '. $post['poster']['link']. '</td>';
$content .= '</tr>';
}
/// Boardstatistik anzeigen
if ($show_stats)
$content .= '
<tr style="background: '.$color['row1'].'; color: '.$color['txtrow1'].';">
<td colspan="6" align="center"><div class="content">'.$boardstats.'</div></td>
</tr>';
/// Wer ist Online anzeigen
if ($show_online)
$content .= '
<tr style="background: '.$color['row2'].'; color: '.$color['txtrow2'].';">
<td colspan="6" align="center"><div class="content">'.$txt['who_title'].' - '.$whoonline_out.'</div></td>
</tr>';
/// Wer ist Online anzeigen, die Liste der einzelnen User
if ($show_online && !empty($whoonline_list))
$content .= '
<tr style="background: '.$color['row1'].'; color: '.$color['txtrow1'].';">
<td colspan="6"><div class="content">'.$whoonline_list.'</div></td>
</tr>';
/// Der Tabellenfuss für die Threads und Posts
$content .= '</table>';
/// Den Output für pragmaMx aufbereiten (links usw. anpassen)
$content = mxSmfPrepareOutput($content);
#mxDebugFuncVars($txt);
#mxDebugFuncVars($content);
#mxDebugFuncVars($GLOBALS, $whoonline_out, $boardstats, $threads, $txt);
#mxDebugFuncVars($whoonline_out, $boardstats, $threads, $txt);
#mxDebugFuncVars($table, $whoonline_out, $boardstats, $posts);