Recent Mod Problem

Du hast Probleme beim Einbau oder bei der Benutzung eines Mods? In diesem Forum bist du richtig.
Forumsregeln
phpBB 3.0 hat das Ende seiner Lebenszeit überschritten
phpBB 3.0 wird nicht mehr aktiv unterstützt. Insbesondere werden - auch bei Sicherheitslücken - keine Patches mehr bereitgestellt. Der Einsatz von phpBB 3.0 erfolgt daher auf eigene Gefahr. Wir empfehlen einen Umstieg auf die neuste phpBB-Version, welches aktiv weiterentwickelt wird und für welches regelmäßig Updates zur Verfügung gestellt werden.
Antworten
Benutzeravatar
x16
Mitglied
Beiträge: 472
Registriert: 03.11.2005 22:35
Wohnort: Hamburg
Kontaktdaten:

Recent Mod Problem

Beitrag von x16 »

Ich habe einen alten Recent Mod über den ich auf der Hompage aktuelle Themen ausgebe. Er hat immer gut funktioniert. Gestern ist mir aufgefallen, dass manche Themen doppelt aufgelistet werden. Hoffe jemand kann anhand der PHP Datei den fehler finden. Keine Ahnung welcher Mod das genau war und vom wem er ist.

Code: Alles auswählen

<?php
// ############         Edit below         ########################################
$topic_length = '40';                 // Laenge der Themen-Titel
$topic_limit = '9';                   // Anzahl der Themen
$special_forums = '1';                // Foren ausschluss ('0' = deaktivieren; '1' = aktivieren)
$forum_ids = '15,16,17';              // IDs der Foren, die ausgeschlossen werden sollen; mit Komma trennen

$config_path = '/';                                // Pfad zu config.php
$root_path = 'http://www.test.de/forum/';      // Link-Pfad
// ############         Edit above         ########################################

$path = dirname(__FILE__);
include_once($path.$config_path .'config.php');
mysql_connect($dbhost, $dbuser, $dbpasswd) OR die('Server nicht erreichbar.');
mysql_select_db($dbname) OR die('Datenbank nicht zugreifbar.');

// ############## output ##############
echo '<table border="0" cellpadding="0" cellspacing="0" style="width: 135px; text-align: center; margin: auto;" id="Table_DSF-Top5">';
// ############## output ##############

$where_forums = ( $special_forums == '0' ) ? '' : 't.forum_id NOT IN ('. $forum_ids .') AND ';
$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username AS first_poster, u.user_id AS first_poster_id, u2.username AS last_poster, u2.user_id AS last_poster_id, p.post_username AS first_poster_name, p2.post_username AS last_poster_name, p2.post_time
   FROM ". $table_prefix ."topics t, ". $table_prefix ."forums f, ". $table_prefix ."users u, ". $table_prefix ."posts p, ". $table_prefix ."posts p2, ". $table_prefix ."users u2
   WHERE $where_forums t.topic_poster = u.user_id AND f.forum_id = t.forum_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id
   ORDER BY t.topic_last_post_id DESC LIMIT $topic_limit";
$result = mysql_query($sql);
if( !$result )
{
   die('SQL Statement Error: '. mysql_error());
   exit();
}

$line = array();
while( $row = mysql_fetch_array($result) )
{
   $line[] = $row;
}

for( $i = 0; $i < count($line); $i++ )
{
   $forum_id = $line[$i]['forum_id'];
   $forum_url = $root_path .'viewforum.php?f='. $forum_id;
   $topic_id = $line[$i]['topic_id'];
   $topic_url = $root_path .'viewtopic.php?t='. $topic_id;

   $topic_title = ( strlen($line[$i]['topic_title']) < $topic_length ) ? $line[$i]['topic_title'] : substr(stripslashes($line[$i]['topic_title']), 0, $topic_length) .'...';

   $topic_type =  ( $line[$i]['topic_type'] == '2' ) ? 'Announcement ': '';
   $topic_type .= ( $line[$i]['topic_type'] == '3' ) ? 'Global Announcement ': '';
   $topic_type .= ( $line[$i]['topic_type'] == '1' ) ? 'Sticky ': '';
   $topic_type .= ( $line[$i]['topic_vote'] ) ? 'Poll ': '';

   $views = $line[$i]['topic_views'];
   $replies = $line[$i]['topic_replies'];

   $first_time = date('d.m.Y', $line[$i]['topic_time']);
   $first_author = ( $line[$i]['first_poster_id'] != '-1' ) ? '<a href="'. $root_path .'memberlist.php?mode=viewprofile&u='. $line[$i]['first_poster_id'] .'" target="_blank">'. $line[$i]['first_poster'] .'</a>' : ( ($line[$i]['first_poster_name'] != '' ) ? $line[$i]['first_poster_name'] : 'Guest' );
   $last_time = date('d.m.Y', $line[$i]['post_time']);
   $last_author = ( $line[$i]['last_poster_id'] != '-1' ) ? $line[$i]['last_poster'] : ( ($line[$i]['last_poster_name'] != '' ) ? $line[$i]['last_poster_name'] : 'Guest' );
   $last_url = '<a href="'. $root_path .'viewtopic.php?p='. $line[$i]['topic_last_post_id'] .'#p'. $line[$i]['topic_last_post_id'] .'" target="_blank">'. utf8_decode($last_author).'</a>';

   // ############## output ##############
   echo '<tr>
            <td style="height: 33px; text-align: center;"><a href="'. $topic_url .'" target="_blank" style="text-decoration: none;">'.$topic_title.'</a></td>
        </tr>';
   // ############## output ##############
}

echo '</table>';
mysql_close();
?>
Antworten

Zurück zu „[3.0.x] Mod Support“