Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 102529
Collapse All | Expand All

(-)viewforum.php_orig (-5 / +37 lines)
Lines 539-544 Link Here
539
{
539
{
540
	for($i = 0; $i < $total_topics; $i++)
540
	for($i = 0; $i < $total_topics; $i++)
541
	{
541
	{
542
543
	
544
// 2006-04-14 - ian!
545
// get max(post_time) - hackish, ugly... but it gives an idea how we can make it work
546
$sql = "SELECT MAX(post_edit_time) AS post_edit_time FROM " . POSTS_TABLE . " WHERE topic_id = " . $topic_rowset[$i]['topic_id'];
547
548
if ( !($result = $db->sql_query($sql)) )
549
{
550
   message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql);
551
}
552
553
while( $row = $db->sql_fetchrow($result) )
554
{
555
	$topic_rowset[$i]['post_edit_time'] = $row['post_edit_time'];
556
}
557
558
$db->sql_freeresult($result);
559
560
561
542
		$topic_id = $topic_rowset[$i]['topic_id'];
562
		$topic_id = $topic_rowset[$i]['topic_id'];
543
563
544
		$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
564
		$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title'];
Lines 608-614 Link Here
608
			$newest_post_img = '';
628
			$newest_post_img = '';
609
			if( $userdata['session_logged_in'] )
629
			if( $userdata['session_logged_in'] )
610
			{
630
			{
611
				if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) 
631
				// ian says: we need to look for edits here
632
				if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] || $topic_rowset[$i]['post_edit_time'] > $userdata['user_lastvisit'] ) 
612
				{
633
				{
613
					if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
634
					if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
614
					{
635
					{
Lines 616-622 Link Here
616
637
617
						if( !empty($tracking_topics[$topic_id]) )
638
						if( !empty($tracking_topics[$topic_id]) )
618
						{
639
						{
619
							if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] )
640
							// same here
641
							if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] && $topic_rowset[$i]['post_edit_time'] >= $userdata['user_lastvisit'] )
620
							{
642
							{
621
								$unread_topics = false;
643
								$unread_topics = false;
622
							}
644
							}
Lines 624-630 Link Here
624
646
625
						if( !empty($tracking_forums[$forum_id]) )
647
						if( !empty($tracking_forums[$forum_id]) )
626
						{
648
						{
627
							if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] )
649
							// and here
650
							if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] && $tracking_forums[$forum_id] >= $userdata['user_lastvisit'] )
628
							{
651
							{
629
								$unread_topics = false;
652
								$unread_topics = false;
630
							}
653
							}
Lines 632-650 Link Here
632
655
633
						if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
656
						if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) )
634
						{
657
						{
635
							if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] )
658
							// and here
659
							if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] && $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $userdata['user_lastvisit'] )
636
							{
660
							{
637
								$unread_topics = false;
661
								$unread_topics = false;
638
							}
662
							}
639
						}
663
						}
640
664
641
						if( $unread_topics )
665
						if( $unread_topics && $topic_rowset[$i]['post_time'] >= $userdata['user_lastvisit'] )
642
						{
666
						{
643
							$folder_image = $folder_new;
667
							$folder_image = $folder_new;
644
							$folder_alt = $lang['New_posts'];
668
							$folder_alt = $lang['New_posts'];
645
669
646
							$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
670
							$newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&amp;view=newest") . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> ';
647
						}
671
						}
672
						else if ( $unread_topics && $topic_rowset[$i]['post_time'] < $userdata['user_lastvisit'] )
673
						{
674
							// and all this to get in here..
675
							// when we got in here a post of the thread has been modified since users last visit
676
							$folder_image = $folder_new;
677
							$folder_alt = $lang['New_posts'];
678
							$newest_post_img = '';
679
						}
648
						else
680
						else
649
						{
681
						{
650
							$folder_image = $folder;
682
							$folder_image = $folder;

Return to bug 102529