I recently updated the script from 1.02 to 1.03 and some problems occured.
I changed the default code to suit my needs (utf-8, different style, max 30 chars in topic title etc.). I applied the same changes that worked in 1.02 to 1.03 but now every once in a while there are two arrows in front of one topic title. I added an arrow .gif in front of every topic title so it links to the newpost in that topic. For some reason this arrow is doubled by one of the topics on the list. It is not always the same topic and I can't find a rule that triggers this behaviour.
Below is my modified code. Help would be much appreciated.
Code:
## NO NEED TO TOUCH ANYTHING BELOW #####################################
#############################################################################
if (!($recent_topics_connection = mysql_connect("$db_host", "$db_user", "$db_pw")))
die ("could not connect");
if (!(mysql_select_db("$db_name", $recent_topics_connection)))
mysql_error();
mysql_query('set names utf8');
mysql_query('set character set utf8');
$fid_array = explode (',', $fid_raw);
if ($fid_raw) {
$fid_final .= "AND (";
foreach( $fid_array as $key => $value){
if ($key == 0) { $fid_final .= "t.forumid=".$value; }
else { $fid_final .= " OR t.forumid=".$value; }
}
$fid_final .= ")";
}
$fidx_array = explode (',', $fidx_raw);
if ($fidx_raw) {
$fidx_final .= "AND NOT (";
foreach( $fidx_array as $key => $value){
if ($key == 0) { $fidx_final .= "t.forumid=".$value; }
else { $fidx_final .= " OR t.forumid=".$value; }
}
$fidx_final .= ")";
}
$thread_sql = mysql_query("SELECT SQL_CACHE t.threadid,t.title,t.lastpost,t.lastposter,t.forumid,substring(p.pagetext,1,200) as post_text
FROM ".$GLOBALS['db_prefix']."thread t
INNER JOIN ".$GLOBALS['db_prefix']."post p
ON t.firstpostid = p.postid
WHERE t.visible=1
AND t.open=1 $fidi_final $fidx_final
ORDER BY t.lastpost desc
LIMIT $limit");
while($thread_get=@mysql_fetch_array($thread_sql))
{
$lastpost = $thread_get['lastpost'];
$poster = $thread_get['lastposter'];
$tid = $thread_get['threadid'];
$text = $thread_get['post_text'];
if ($post_date_format == "1") { $date2 = date ("m/d/y h:i A" ,$lastpost); }
elseif ($post_date_format == "2") { $date2 = date ("h:i A" ,$lastpost); }
else { $date2 = date ("m/d/y h:i A" ,$lastpost); }
echo " <a href=\"$forum_url/showthread.php?t=$tid&goto=newpost\" class=\"povezava\" target=\"_parent\"><img src=\"arrow.gif\" border=\"0\" align=\"absmiddle\"> </a>";
echo " <a href=\"$forum_url/showthread.php?t=$tid\" class=\"povezava\" target=\"_parent\" title=\"".$text."\">";
if (strlen($thread_get[title])>30) echo substr($thread_get[title],0,30)."...";
else echo $thread_get[title];
echo "</a><br />\n";
}
mysql_close($recent_topics_connection);
?>