$threadrate = @intval(@($post['rate'] + $rate) / abs($post['rate'] + $rate));
$db->query("UPDATE {$tablepre}threads SET rate='$threadrate' WHERE tid='$tid'");
$db->query("UPDATE {$tablepre}threads SET rate=(SELECT rateFROM {$tablepre}posts WHERE pid='$pid') WHERE tid='$tid'");
<img src="{IMGDIR}/agree.gif" alt="" />
<!--{if $thread['rate'] > 1}--> [<spanclass="warning">+{$thread[rate]}</span>]<!--{/if}-->
<img src="{IMGDIR}/disagree.gif" alt="" />
<!--{if $thread['rate'] < -1}--> [<strongclass="warning">{$thread[rate]}</strong>]<!--{/if}-->