Similar Topic - Auffälligkeit

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
Dungeonwatcher
Mitglied
Beiträge: 635
Registriert: 11.07.2004 10:04
Wohnort: Berlin

Beitrag von Dungeonwatcher »

Hi! 8)

Hmmm, PHP ist für mich nur wirre Buchstaben, da habe ich leider Null durchsicht. HTML wäre mir da lieber. 8)

Der zuständige Code dürfte dieser sein:

Code: Alles auswählen

if ( $count_similar > 0 )
{
	$template->assign_block_vars('similar', array(
		'L_SIMILAR' => $lang['Similar'],
		'L_TOPIC' => $lang['Topic'],
		'L_AUTHOR' => $lang['Author'],
		'L_FORUM' =>  $lang['Forum'],
		'L_REPLIES' => $lang['Replies'],
		'L_LAST_POST' => $lang['Posted'])
	);

	for($i = 0; $i < $count_similar; $i++)
	{
		$sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
		FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
		WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
		AND f.forum_id = t.forum_id
		AND f.forum_id NOT IN (" . $except_forum_id . ")
		AND p.topic_id = t.topic_id
		AND u.user_id = p.poster_id
		GROUP BY t.topic_id";

		if ( !($result = $db->sql_query($sql)) )
		{
			message_die(GENERAL_ERROR, "Could not get similar topics", '', __LINE__, __FILE__, $sql);
		}
 
		while ( $row = $db->sql_fetchrow($result) )
		{
			$similar = $row;

			$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();
			$topic_type =  ( $similar['topic_type'] == POST_ANNOUNCE ) ? $lang['Topic_Announcement'] .' ': '';
			$topic_type .= ( $similar['topic_type'] == POST_STICKY ) ? $lang['Topic_Sticky'] .' ': '';
			$topic_type .= ( $similar['topic_vote'] ) ? $lang['Topic_Poll'] .' ': '';
			$replies = $similar['topic_replies'];

			if( $similar['topic_status'] == TOPIC_LOCKED )
			{
				$folder = $images['folder_locked'];
				$folder_new = $images['folder_locked_new'];
			}
			else if( $similar['topic_type'] == POST_ANNOUNCE )
			{
				$folder = $images['folder_announce'];
				$folder_new = $images['folder_announce_new'];
			}
			else if( $similar['topic_type'] == POST_GLOBAL_ANNOUNCE )
			{
				$folder = $images['folder_global_announce'];
				$folder_new = $images['folder_global_announce_new'];
			}
			else if( $similar['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( $similar['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] >= $similar['post_time'] )
							{
								$unread_topics = false;
							}
						}
						if( !empty($tracking_forums[$forum_id]) )
						{
							if( $tracking_forums[$forum_id] >= $similar['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'] >= $similar['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_image = $folder;
							$folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
							$newest_img = '';
						}
					}
					else
					{
						$folder_image = $folder_new;
						$folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $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 = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
					$newest_img = '';
				}
			}
			else
			{
				$folder_image = $folder;
				$folder_alt = ( $similar['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts'];
				$newest_img = '';
			}

			$title = (strlen($similar['topic_title']) > 60) ? (substr($similar['topic_title'], 0, 40) . '...') : $similar['topic_title'];
			$topic_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_TOPIC_URL .'='. $similar['topic_id']) .'">'. $title . '</a>';

			$author_url = append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $similar['user_id']);
			$author = ( $similar['user_id'] != ANONYMOUS ) ? '<a href="'. append_sid("profile.$phpEx?mode=viewprofile&". POST_USERS_URL .'='. $similar['user_id']) .'">'. $similar['username'] .'</a>' : ( ($similar['post_username'] != '' ) ? $similar['post_username'] : $lang['Guest'] );

			$forum_url = append_sid("viewforum.$phpEx?f=". $similar['forum_id']);
			$forum = '<a href="'. $forum_url .'">'. $similar['forum_name'] .'</a>';

			$post_url = '<a href="'. append_sid("viewtopic.$phpEx?". POST_POST_URL .'='. $similar['topic_last_post_id']) .'#'. $similar['topic_last_post_id'] .'"><img src="'. $images['icon_latest_reply'] .'" alt="'. $lang['View_latest_post'] .'" title="'. $lang['View_latest_post'] .'" border="0" /></a>';
			$post_time = create_date($board_config['default_dateformat'], $similar['topic_time'], $board_config['board_timezone']);

			$template->assign_block_vars('similar.topics', array(
				'FOLDER' => $folder_image,
				'ALT' => $folder_alt,
				'TYPE' => $topic_type,
				'TOPICS' => $topic_url,
				'AUTHOR' => $author,
				'FORUM' => $forum,
				'REPLIES' => $replies,
				'NEWEST' => $newest_img,
				'POST_TIME' => $post_time,
				'POST_URL' => $post_url)
				);
		}
	}
}
Wie müsste das ganze geändert werden?

THNX
Benutzeravatar
Gumfuzi
Ehemaliges Teammitglied
Beiträge: 2454
Registriert: 26.03.2004 22:25
Wohnort: Linz, AT
Kontaktdaten:

Beitrag von Gumfuzi »

Ist jetzt ohne Board schwer zu testen, aber probiere es mal damit:

suche:

Code: Alles auswählen

      $sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
      FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
      WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
      AND f.forum_id = t.forum_id
      AND f.forum_id NOT IN (" . $except_forum_id . ")
      AND p.topic_id = t.topic_id
      AND u.user_id = p.poster_id
      GROUP BY t.topic_id";
ersetze mit:

Code: Alles auswählen

      $sql = "SELECT t.topic_type, t.topic_status, t.topic_id, t.topic_title, t.topic_time, t.topic_replies, t.topic_last_post_id, t.topic_poster, u.user_id, u.username, f.forum_id, f.forum_name, p.post_time, p.post_username
      FROM ". TOPICS_TABLE ." t, ". USERS_TABLE ." u, ". FORUMS_TABLE ." f, ". POSTS_TABLE ." p
      WHERE t.topic_id = '". $topics[$i]['topic_id'] ."'
      AND f.forum_id = t.forum_id
      AND f.forum_id NOT IN (" . $except_forum_id . ")
      AND p.topic_id = t.topic_id
      AND u.user_id = t.topic_poster
      GROUP BY t.topic_id";
Du kannst niemals alle mit deinem Tun begeistern. Selbst wenn du über's Wasser laufen kannst, kommt einer daher und fragt, ob du zu blöd zum Schwimmen bist.
https://www.deskmodder.de
Benutzeravatar
Dungeonwatcher
Mitglied
Beiträge: 635
Registriert: 11.07.2004 10:04
Wohnort: Berlin

Beitrag von Dungeonwatcher »

Moin! 8)

Das funktioniert perfekt. THNX

Bye
Benutzeravatar
Gumfuzi
Ehemaliges Teammitglied
Beiträge: 2454
Registriert: 26.03.2004 22:25
Wohnort: Linz, AT
Kontaktdaten:

Beitrag von Gumfuzi »

gerne doch!
Du kannst niemals alle mit deinem Tun begeistern. Selbst wenn du über's Wasser laufen kannst, kommt einer daher und fragt, ob du zu blöd zum Schwimmen bist.
https://www.deskmodder.de
Antworten

Zurück zu „phpBB 2.0: Mod Support“