[2.0.x] Anzeige der letzten Themen

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

Beitrag von Loewenherz »

Hier: http://www.reikiland.de/forum/forum.php - /forum/ ist der phpBB-Ordner.
Acid
Ehrenadmin
Beiträge: 12195
Registriert: 26.04.2001 02:00
Wohnort: Berlin

Beitrag von Acid »

hmm.. und mit $include = '1' bekommst du die "redeclare" Fehlermeldung?
Da du es ja "includest" sollte es auf '1' stehen.
Benutzeravatar
Loewenherz
Mitglied
Beiträge: 624
Registriert: 10.02.2003 20:11
Wohnort: Saarlouis
Kontaktdaten:

Beitrag von Loewenherz »

Acid hat geschrieben:hmm.. und mit $include = '1' bekommst du die "redeclare" Fehlermeldung?
Richtig.

Spasseshalber hab ich die Forum.php, die die recent.php includiert mal eine Abteilung höher gelegt. Jetzt sieht das Ganze so aus: http://www.reikiland.de/forum.php

P.S.: Nachdem ich die info.php rausgenommen habe, geht es. Siehe http://www.reikiland.de/forum/forum2.php

Da die beiden Includes sich also ins Gehege zu kommen scheinen, hier mal der Quelltext der info.php, die ebenfalls im /forum/ Ordner liegt:

Code: Alles auswählen

<?php
define('IN_PHPBB', true);
$phpbb_root_path = '/home/htdocs/web0/html/reiki/forum/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$total_posts = get_db_stat('postcount');
$total_users = get_db_stat('usercount');

$sql = "SELECT u.user_id, s.session_ip
FROM ".USERS_TABLE." u, ".SESSIONS_TABLE." s
WHERE u.user_id = s.session_user_id
AND s.session_time >= ".( time() - 300 );
if( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Datenbank-Problem!', '', __LINE__, __FILE__, $sql);
}

while( $row = $db->sql_fetchrow($result) )
{
if ( $row['session_logged_in'] )
{
$logged_visible_online++;
$logged_hidden_online++;
}
else
{
$guests_online++;
}
}

$total_online_users = $logged_visible_online + $logged_hidden_online + $guests_online;

echo "$total_online_users User online<br />";
echo "$total_posts Posts<br />";
echo "$total_users registrierte Mitglieder<br />";

?>
BrainChild
Mitglied
Beiträge: 5
Registriert: 01.09.2004 10:01

Beitrag von BrainChild »

@ Acid,
ich versuche sie als Block in phpNuke einzubinden. phpNuke hat zwar ein Forum, aber ich habe noch ein externes, wobei ich die Themen gerne auf phpNuke anzeigen möchte.
Benutzeravatar
Loewenherz
Mitglied
Beiträge: 624
Registriert: 10.02.2003 20:11
Wohnort: Saarlouis
Kontaktdaten:

Beitrag von Loewenherz »

Hier noch einmal die Zusammenfassung plus Ergänzungen:

1. Wird die recent.php von einer nicht-phpBB-Seite innerhalb des phpBB-Ordners aufgerufen, gibt es diese Fehlermeldung. Siehe: http://www.reikiland.de/forum/forum.php

2. Wird die news.php (Quelltext s.o.) nicht eingebunden, gibt es keine Fehlermeldung. Siehe http://www.reikiland.de/forum/forum2.php - leider kenne ich kein anderes Script, dass mir diese drei Angaben auf die vorgelagerte Startseite des Forums zaubert.

3. Wird die recent.php von einer nicht-phpBB-Seite ausserhalb des phpBB-Ordners aufgerufen, gibt es eine andere Fehlermeldung. Siehe:
http://www.reikiland.de/main/komm/index.php

Leider gibt es auch bei der erfolgreichen zweiten Variante dieselben Probleme wie bei der ersten Mod-Version:
- Wenn man die vorgelagerte Startseite mit der Anzeige der Themen besucht hat und dann ins Forum geht, werden alle Beiträge als gelesen angezeigt. Das ist nicht im Sinn der Sache.
- Als Überschrift wird nur "10" angezeigt, aber nicht "Aktuelle Themen". Sieht also aus, als wäre

Code: Alles auswählen

{L_RECENT_TITLE}
nicht klar definiert.
Acid
Ehrenadmin
Beiträge: 12195
Registriert: 26.04.2001 02:00
Wohnort: Berlin

Beitrag von Acid »

1. Wird die recent.php von einer nicht-phpBB-Seite innerhalb des phpBB-Ordners aufgerufen, gibt es diese Fehlermeldung. Siehe: http://www.reikiland.de/forum/forum.php
hmm.. es wird zwar in eine nicht-phpBB-Seite eingebunden, aber du bindest in dieser ja noch eine andere, eine phpBB-Seite ein (also mit phpBB-Codes). Daher kommt´s dann zum Konflikt. Da müsstest du also das include auf "0" stehen lassen, damit $userdata usw. in der recent.php nicht aufgeführt wird. Davon wäre dann auch die tpl-Einbindung betroffen. Entweder kopierst du den HTML-Code, der für die recent_body.tpl gedacht wäre, in eine andere tpl (wenn du auf dieser Startseite mit verschiedenen tpl-Dateien arbeitest) oder direkt in die recent.php, was aber noch Anpassungen verlangen würde.
3. Wird die recent.php von einer nicht-phpBB-Seite ausserhalb des phpBB-Ordners aufgerufen, gibt es eine andere Fehlermeldung. Siehe:
http://www.reikiland.de/main/komm/index.php
Da stimmt dann einfach der Pfad nicht. Egal wo sich die recent.php befindet, musst du den Pfad immer von dieser Startseite ausgehend einstellen. Wenn sich diese Startseite also ein Verzeichnis über dem phpBB befindet, wäre der Pfad /phpBB/.
- Wenn man die vorgelagerte Startseite mit der Anzeige der Themen besucht hat und dann ins Forum geht, werden alle Beiträge als gelesen angezeigt. Das ist nicht im Sinn der Sache.
Dann müsste auf die Anzeige der neuen/alten Beiträge im recent-Code verzichtet werden.
- Als Überschrift wird nur "10" angezeigt, aber nicht "Aktuelle Themen". Sieht also aus, als wäre {L_RECENT_TITLE} nicht klar definiert.
Existiert die $lang['Recent_topics']-Variabel in der lang_main.php ?

In dem Package gibt´s noch eine vereinfachte recent.php-Version, die keinerlei phpBB-Code enthält (somit aber auch sehr minimal ausgestattet ist, keinerlei Zugriff-Überprüfung der anzuzeigenden Foren etc.).
Die könntest du benutzen, BrainChild, da´s im nuke-Bereich sicherlich mehr Konflikte geben würde.
Dein Vorhaben, Löwenherz, funktioniert aber auch mit der "richtigen" Version.
Helmut
Mitglied
Beiträge: 2048
Registriert: 27.12.2002 20:35
Wohnort: Augsburg

Beitrag von Helmut »

Hallo Acid,

ich habe jetzt auch die Laufzeile zum laufen gebracht, so daß in dieser nur die Subjects der Topics angezeigt werden. Du hast mir mehrere Versionen gemacht, die ich jetzt aber zu einer Version zusammenfassen wollte. Irgendwie komme ich da nicht so zurecht und daher nochmal die beiden Versionen die dann eine Version bilden sollen.

Version 1:

Code: Alles auswählen

// last topics aktuelle Version

// ############ Edit below ############
$length = '25'; // length of topic title
$limit = '4'; // how many topics?
$special_forums = '0'; // 0 = no; 1 = yes
$forums = '1,2,3'; // ID of forums; separate them with a comma
$content = '150'; // length of post_text
// ############ Edit above ############

include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);

$sql = "SELECT post_id FROM " . POSTS_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
	message_die(GENERAL_ERROR, 'Could not obtain matched posts list', '', __LINE__, __FILE__, $sql);
}
$recent_ids = array();
while( $row = $db->sql_fetchrow($result) )
{
	$recent_ids[] = $row['post_id'];
}
$db->sql_freeresult($result);

$recent_forum = ( isset($HTTP_POST_VARS['forum']) ) ? intval($HTTP_POST_VARS['forum']) : -1;
if ( $recent_forum == -1 )
{
        $is_auth_ary = auth(AUTH_READ, AUTH_LIST_ALL, $userdata); 
        $ignore_forum_sql = '';
        while( list($key, $value) = each($is_auth_ary) )
        {
                if ( !$value['auth_read'] )
                {
                        $ignore_forum_sql .= ( ( $ignore_forum_sql != '' ) ? ', ' : '' ) . $key;
                }
        }
        if ( $ignore_forum_sql != '' )
        {
                $auth_sql .= ( $auth_sql != '' ) ? " AND f.forum_id NOT IN ($ignore_forum_sql) " : "f.forum_id NOT IN ($ignore_forum_sql) ";
        }
}
                if ( $recent_author == '' && $auth_sql == '' )
                {
                        $sql = "SELECT topic_id FROM " . POSTS_TABLE . "
                                WHERE post_id IN (" . implode(", ", $recent_ids) . ") 
                                $where_sql GROUP BY topic_id";
                }
                else
                {
                        $from_sql = POSTS_TABLE . " p"; 
                        if ( $auth_sql != '' )
                        {
                                $from_sql .= ", " . FORUMS_TABLE . " f";
                                $where_sql .= " AND f.forum_id = p.forum_id AND $auth_sql";
                        }
                        $sql = "SELECT p.topic_id FROM $from_sql 
                                WHERE p.post_id IN (" . implode(", ", $recent_ids) . ") 
                                $where_sql GROUP BY p.topic_id";
                }
                if ( !($result = $db->sql_query($sql)) )
                {
                        message_die(GENERAL_ERROR, 'Could not obtain topic ids', '', __LINE__, __FILE__, $sql);
                }

                $recent_ids = array();
                while( $row = $db->sql_fetchrow($result) )
                {
                        $recent_ids[] = $row['topic_id'];
                }
                $db->sql_freeresult($result);

$auth_results = implode(', ', $recent_ids);
$where_part1 = ( $special_forums == '0' ) ? 't.topic_id IN ('.$auth_results.')' : 'f.forum_id IN ('.$forums.')';

$sql = "SELECT t.*, f.forum_id, f.forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p.enable_html, p.enable_bbcode, p.enable_smilies, p2.post_username AS post_username2, p2.post_time, pt.* 
        FROM ". TOPICS_TABLE ." t, ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". POSTS_TABLE ." p, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2, ". POSTS_TEXT_TABLE ." pt
        WHERE $where_part1
	      AND pt.post_id = t.topic_last_post_id 
              AND 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 $limit";
if ( !$result = $db->sql_query($sql) )
{
        message_die(GENERAL_ERROR, 'Could not obtain main information', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
        $line[] = $row;
}
$db->sql_freeresult($result);		
		
        $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array();
        $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array();
        for($i = 0; $i < count($line); $i++)
        {
                $forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $line[$i]['forum_id']);
                $forum_id = $line[$i]['forum_id'];
                $topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $line[$i]['topic_id']);
                $topic_id = $line[$i]['topic_id'];

                $orig_word = array();
                $replacement_word = array();
                obtain_word_list($orig_word, $replacement_word);
                $word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $line[$i]['topic_title']) : $line[$i]['topic_title']; 
                $topic_title = ( strlen($line[$i]['topic_title']) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "..."; 

                $topic_type = ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
                $topic_type .= ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';
                $topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
                $topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';

                $views = $line[$i]['topic_views'];
                $replies = $line[$i]['topic_replies'];
                if ( ( $replies + 1 ) > $board_config['posts_per_page'] )
                {
                        $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] );
                        $goto_page = ' [ ';
                        $times = 1;
                        for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page'])
                        {
                                $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j") . '" >' . $times . '</a>';
                                if ( $times == 1 && $total_pages > 4 )
                                {
                                        $goto_page .= ' ... ';
                                        $times = $total_pages - 3;
                                        $j += ( $total_pages - 4 ) * $board_config['posts_per_page'];
                                }
                                else if ( $times < $total_pages )
                                {
                                        $goto_page .= ', ';
                                }
                                $times++;
                        }
                        $goto_page .= ' ] ';
                }
                else
                {
                        $goto_page = '';
                }

                if ( $line[$i]['topic_status'] == TOPIC_LOCKED )
                {
                        $folder = $images['folder_locked'];
                        $folder_new = $images['folder_locked_new'];
                }
                else if ( $line[$i]['topic_type'] == POST_ANNOUNCE )
                {
                        $folder = $images['folder_announce'];
                        $folder_new = $images['folder_announce_new'];
                }
                else if ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE )
                {
                        $folder = $images['folder_global_announce'];
                        $folder_new = $images['folder_global_announce_new'];
                }
                else if ( $line[$i]['topic_type'] == POST_STICKY )
                {
                        $folder = $images['folder_sticky'];
                        $folder_new = $images['folder_sticky_new'];
                }
                else
                {
                        if ( $replies >= $board_config['hot_threshold'] )
                        {
                                $folder = $images['folder_hot'];
                                $folder_new = $images['folder_hot_new'];
                        }
                        else
                        {
                                $folder = $images['folder'];
                                $folder_new = $images['folder_new'];
                        }
                }

                if ( $userdata['session_logged_in'] )
                {
                        if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] ) 
                        {
                                if ( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                {
                                        $unread_topics = true;
                                        if ( !empty($tracking_topics[$topic_id]) )
                                        {
                                                if ( $tracking_topics[$topic_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
                                                }
                                        }
                                        if ( !empty($tracking_forums[$forum_id]) )
                                        {
                                                if ( $tracking_forums[$forum_id] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
					}
                                        }
                                        if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
                                        {
                                                if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $line[$i]['post_time'] )
                                                {
                                                        $unread_topics = false;
					}
                                        }
                                        if ( $unread_topics )
                                        {
                                                $folder_image = $folder_new;
					$folder_alt = $lang['New_posts'];
                				$newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                        }
                                        else
                                        {
                                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                                $folder_image = $folder;
					$folder_alt = $folder_alt;
					$newest_img = '';
                                        }
                                }
                                else if ( $line[$i]['post_time'] > $userdata['user_lastvisit'] ) 
                                {
                                        $folder_image = $folder_new;
                                        $folder_alt = $lang['New_posts'];
                                        $newest_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest") . '"><img src="'. $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
                                }
                                else 
                                {
                                        $folder_image = $folder;
                                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                        $newest_img = '';
                                }
                        }
                        else
                        {
                                $folder_image = $folder;
                                $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                                $newest_img = '';
                        }
                }
                else
                {
                        $folder_image = $folder;
                        $folder_alt = ( $line[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
                        $newest_img = '';
                }
				
                $first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);
                $first_author = ( $line[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['user_id']) . '" class="genmed">'.$line[$i]['username'].'</a>' : ( ($line[$i]['post_username'] != '' ) ? $line[$i]['post_username'] : $lang['Guest'] ); 
                $last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);
                $last_author = ( $line[$i]['id2'] == ANONYMOUS ) ? ( ($line[$i]['post_username2'] != '' ) ? $line[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '='  . $line[$i]['id2']) . '" class="genmed">' . $line[$i]['user2'] . '</a>';
                $last_url = '<a href="' . append_sid("viewtopic.$phpEx?"  . POST_POST_URL . '=' . $line[$i]['topic_last_post_id']) . '#' . $line[$i]['topic_last_post_id'] . '"><img src="'. $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>';

                $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
		
                $bbcode_uid = $line[$i]['bbcode_uid'];
                $post_text = $line[$i]['post_text'];
                $text_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $post_text) : $post_text;
                $post_text = ( strlen($post_text) < $content ) ? $text_censor : substr(stripslashes($text_censor), 0, $content) . "...";
                if ( !$board_config['allow_html'] )
                {
                        if ( $line[$i]['enable_html'] )
		{
			$post_text = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $post_text);
		}
			}
			if ( $board_config['allow_bbcode'] )
			{
		if ( $bbcode_uid != '' )
		{
			$post_text = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($post_text, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $post_text);
		}
			}
			if ( $board_config['allow_smilies'] )
			{
		if ( $line[$i]['enable_smilies'] )
		{
			$post_text = smilies_pass($post_text);
		}
		
			}
			$post_text = str_replace("\n", "\n<br />\n", $post_text);
			$post_text = make_clickable($post_text);		

                $template->assign_block_vars('recent', array(
                        'TOPIC_TITLE' => $topic_title,
                        'TOPIC_TYPE' => $topic_type,
                        'VIEWS' => $views,
                        'REPLIES' => $replies,
                        'GOTO_PAGE' => $goto_page,
                        'TOPIC_FOLDER_IMG' => '<img src='.$folder_image.' width=19 height=18 alt='.$folder_alt.' />', 
                        'NEWEST_IMG' => $newest_img, 
                        'FIRST_TIME' => $first_time,
                        'FIRST_AUTHOR' => $first_author,
                        'LAST_TIME' => $last_time,
                        'LAST_AUTHOR' => $last_author,
                        'LAST_URL' => $last_url,
                        'ROW_CLASS' => $row_class,
			'POST_TEXT' => $post_text,
                        'L_BY' => $lang['by'],
                        'L_STARTED' => $lang['Started'],
                        'L_REPLIES' => $lang['Replies'],
                        'L_VIEWS' => $lang['Views'],
                        'FORUM_NAME' => $line[$i]['forum_name'],
                        'U_VIEW_FORUM' => $forum_url, 
                        'FORUM_ID' => $forum_id,
                        'U_VIEW_TOPIC' => $topic_url,
                        'TOPIC_ID' => $topic_id
                ));
		// show only by user logged in
                if ( $userdata['session_logged_in'] )
                {
                   $template->assign_block_vars('recent.switch_user_logged', array());
                }
		//---
        }

        $template->assign_vars(array(
                'L_RECENT_TITLE' => $lang['Title']
        ));
//end insert last topics
Diese Version soll so im Funktionsumfang erhalten bleiben und die Funktionen vom folgenden Code mit übernommen werden. Darin sind nun die Änderungen für die Laufzeile enthalten, bei der die Subjects der Topics angezeigt werden, wenn der User nicht eingelogt ist. Wenn der User sich einlogt, dann sollen die letzten Topics entsprechend seiner Berechtigung und den Einstellungen im Code angezeigt werden.

Version 2:

Code: Alles auswählen

//insert last topics Test5
// ############ Edit below ############
$length = '100'; // Laenge des Titels
$limit = '5'; // Anzahl der Themen
$special_forums = '1'; // 0 = nein; 1 = ja
$forums = '21'; // ID der Foren
$topic_id = '21'; // ID des Themas
// ############ Edit above ############

$topic_id2 = $topic_id;//für Laufzeile
include_once($phpbb_root_path . 'includes/bbcode.'.$phpEx);

if( $special_forums == '0' && $userdata['session_logged_in'] )
{
	$sql_auth = "SELECT * FROM ". FORUMS_TABLE;
	if( !$result_auth = $db->sql_query($sql_auth) )
	{
		message_die(GENERAL_ERROR, 'Could not query forums information.', '', __LINE__, __FILE__, $sql_auth);
	}
	$forums = array();
	while( $row_auth = $db->sql_fetchrow($result_auth) )
	{
		$forums[] = $row_auth;
	}
	$db->sql_freeresult($result);

	$is_auth_ary = array();
	$is_auth_ary = auth(AUTH_ALL, AUTH_LIST_ALL, $userdata, $forums);

	$except_forums = '\'start\'';
	for ($f = 0; $f < count($forums); $f++)
	{
		if( (!$is_auth_ary[$forums[$f]['forum_id']]['auth_read']) || (!$is_auth_ary[$forums[$f]['forum_id']]['auth_view']) )
		{
			if( $except_forums == '\'start\'' )
			{
				$except_forums = $forums[$f]['forum_id'];
			}
			else
			{
				$except_forums .= ',' . $forums[$f]['forum_id'];
			}
		}
	}
}
$where_forums = ( $special_forums == '0' ) ? 'f.forum_id NOT IN ('. $except_forums .')' : 'f.forum_id NOT IN ('. $forums .')';

$select_sql = ( $userdata['session_logged_in'] ) ? 't.*, f.forum_id, f.forum_name, u.username, u.user_id, p.post_username, u2.username as user2, u2.user_id as id2, p2.post_username AS post_username2, p2.post_time' : 'p.post_id, pt.post_subject';
$from_sql  = ( $userdata['session_logged_in'] ) ? ", ". FORUMS_TABLE ." f, ". USERS_TABLE ." u, ". TOPICS_TABLE ." t, ". POSTS_TABLE ." p2, ". USERS_TABLE ." u2" : ", ". POSTS_TEXT_TABLE ." pt";
$where_sql = ( $userdata['session_logged_in'] ) ? $where_forums .' AND 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' : 'p.topic_id IN ('. $topic_id .') AND p.post_id = pt.post_id';
$order_sql = ( $userdata['session_logged_in'] ) ? 't.topic_last_post_id' : 'p.post_id';

$sql = "SELECT $select_sql FROM ". POSTS_TABLE ." p $from_sql WHERE $where_sql ORDER BY $order_sql DESC LIMIT $limit";
if( !$result = $db->sql_query($sql) )
{
	message_die(GENERAL_ERROR, 'Could not obtain main information.', '', __LINE__, __FILE__, $sql);
}
$line = array();
while( $row = $db->sql_fetchrow($result) )
{
	$line[] = $row;
}
$db->sql_freeresult($result);

$laufzeile = "";
$top_count = ($userdata['session_logged_in'] ) ? $limit : 1;//Auswahl für Zähler Topics login oder Laufzeile

for( $i = 0; $i < $top_count; $i++ )//Zähler für Topics
{
	$forum_url = append_sid("viewforum.$phpEx?". POST_FORUM_URL .'='. $line[$i]['forum_id']);
	$forum_id = $line[$i]['forum_id'];

	$first_time = create_date($board_config['default_dateformat'], $line[$i]['topic_time'], $board_config['board_timezone']);
	$first_author = ( $line[$i]['user_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $line[$i]['user_id']) .'" class="genmed">'. $line[$i]['username'] .'</a>' : ( ($line[$i]['post_username'] != '' ) ? $line[$i]['post_username'] : $lang['Guest'] );

	$last_time = create_date($board_config['default_dateformat'], $line[$i]['post_time'], $board_config['board_timezone']);
	$last_author = ( $line[$i]['id2'] == ANONYMOUS ) ? ( ($line[$i]['post_username2'] != '' ) ? $line[$i]['post_username2'] .' ' : $lang['Guest'] .' ' ) : '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $line[$i]['id2']) .'" class="genmed">'. $line[$i]['user2'] .'</a>';
	$last_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL .'='. $line[$i]['topic_last_post_id']) .'#'. $line[$i]['topic_last_post_id'] .'"><img src="'. $images['icon_latest_reply'] .'" alt="'. $lang['View_latest_post'] .'" title="'. $lang['View_latest_post'] .'" border="0" /></a>';

	$topic_id = ( $userdata['session_logged_in'] ) ? $line[$i]['topic_id'] : $line[$i]['post_id'];
	$topic_url = ( $userdata['session_logged_in'] ) ? append_sid("viewtopic.$phpEx?". POST_TOPIC_URL ."=$topic_id") : append_sid("newsweek.$phpEx?"." t=$topic_id2");//Link für Topics oder Laufzeile

	$orig_word = array();
	$replacement_word = array();
	obtain_word_list($orig_word, $replacement_word);
	$topic = ( $userdata['session_logged_in'] ) ? $line[$i]['topic_title'] : $line[$i]['post_subject'];
	$word_censor = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic) : $topic;
	$topic_title = ( strlen($topic) < $length ) ? $word_censor : substr(stripslashes($word_censor), 0, $length) . "...";

	$topic_type = ( $line[$i]['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
	$topic_type .= ( $line[$i]['topic_type'] == POST_GLOBAL_ANNOUNCE ) ? $lang['Topic_global_announcement'] .' ': '';
	$topic_type .= ( $line[$i]['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
	$topic_type .= ( $line[$i]['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';
             
	$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
	
	for($j = 0; $j < $limit; $j++ )//Zähler für Subjects in Laufzeile
	{
		$laufzeile = $laufzeile."<font color=\"$000000\"> +++NEWS+++ </font>". $line[$j]['post_subject'];//Laufzeile
	}	
	$template->assign_block_vars('recent', array(
		'TOPIC_TITLE' => $topic_title,
		'TOPIC_TYPE' => $topic_type,
		'FIRST_TIME' => $first_time,
		'FIRST_AUTHOR' => $first_author,
		'LAST_TIME' => $last_time,
		'LAST_AUTHOR' => $last_author,
		'LAST_URL' => $last_url,
		'ROW_CLASS' => $row_class,
		'FORUM_NAME' => $line[$i]['forum_name'],
		'U_VIEW_FORUM' => $forum_url,
		'FORUM_ID' => $forum_id,
		'U_VIEW_TOPIC' => $topic_url,
		'TOPIC_ID' => $topic_id,
		'TOPIC_LAUFZEILE' => $laufzeile //Laufzeile
	)); 

	if( $userdata['session_logged_in'] )
	{
		$template->assign_block_vars('recent.user_logged_in', array());
	}
	else
	{
		$template->assign_block_vars('recent.user_logged_out', array());
	}
}
$template->assign_vars(array(
	'L_RECENT_TITLE' => $lang['Title']
));
Hier nun der Teil, der in der index_body.tpl eingebunden ist:

Code: Alles auswählen

		<!-- BEGIN recent -->
                    <!-- BEGIN user_logged_in -->
                    <tr> 
                      <td class="row1" width="100%"> 
			<p><span class="gensmall">Forum: &raquo;&raquo; <a href="{recent.U_VIEW_FORUM}" class="genmed">{recent.FORUM_NAME} </a>««</span><br>
			<span class="gensmall"></span><span class="topictitle">{recent.TOPIC_TYPE}
			<a href="{recent.U_VIEW_TOPIC}" class="genmed">{recent.TOPIC_TITLE}</a></span><br>
			<span class="gensmall">{recent.L_STARTED} {recent.FIRST_TIME} {recent.L_BY} {recent.FIRST_AUTHOR}<br>{recent.L_ON} {recent.FIRST_POST}</span></p>
			<p><span class="gensmall"> {recent.LAST_URL} {recent.LAST_TIME}&nbsp;&nbsp;{recent.LAST_AUTHOR}</span>&nbsp;&nbsp;</p>
		   </td>
                    </tr>
		   
                    <!-- END user_logged_in -->
			
			<!-- BEGIN user_logged_out -->
				<marquee id="recent" width="700" align="center" scrollamount="2" scrolldelay="20">
				<span class="topictitle"><a href="{recent.U_VIEW_TOPIC}" class="genmed">{recent.TOPIC_LAUFZEILE}</a></span><br />
				</marquee></span>
			<!-- END user_logged_out -->


		<!-- END recent -->
Acid, wäre sehr nett von dir, wenn du mir dies beiden Versionen zusammenfassen könntest. Die Funktion mit der Laufzeile kannst du gerne auch für deine anderen Versionen übernehmen.

Gruß Helmut :wink:
Ich bin nicht ganz dicht.... na und.
Helmut
Mitglied
Beiträge: 2048
Registriert: 27.12.2002 20:35
Wohnort: Augsburg

Beitrag von Helmut »

Hallo Acid,

hast du dir schon die Sache angeschaut?

Gruß Helmut
Ich bin nicht ganz dicht.... na und.
Acid
Ehrenadmin
Beiträge: 12195
Registriert: 26.04.2001 02:00
Wohnort: Berlin

Beitrag von Acid »

ja.. hab Geduld. :wink:
Helmut
Mitglied
Beiträge: 2048
Registriert: 27.12.2002 20:35
Wohnort: Augsburg

Beitrag von Helmut »

Hallo Acid,

wollte nur wissen, ob du schon mal einen Blick reingeworfen hast. Es macht nichts, wenn es noch ne Weile dauert, es ist nicht so Eilig.

Gruß Helmut
Ich bin nicht ganz dicht.... na und.
Antworten

Zurück zu „phpBB 2.0: Mod Support“