fo_replyto!=0) $r = @mysql_fetch_object(@mysql_query("SELECT fo_replyto, fo_id, fo_admin from $dbtable WHERE fo_id=".$r->fo_replyto)); if ($r=@mysql_fetch_object(@mysql_query("SELECT Count(fo_id) as num from $dbtable WHERE fo_replyto=0 AND fo_id>=".$r->fo_id." AND fo_admin>=".$r->fo_admin))) $pg = ceil($r->num/$res_pp); } } else $rt = ""; echo ""; if (!$pg) $pg=1; $q=@mysql_query("SELECT fo_id from $dbtable WHERE fo_replyto=0"); $total=@mysql_num_rows($q); $pages=ceil($total/$res_pp); $start=$res_pp*($pg-1); $stop=$start+$res_pp; //navigation if ($pg<$pages) $next=": [ » ]"; else $next=": [ » ]"; if ($pg>1) $back="[ « ] :"; else $back="[ « ] :"; $nav="

$back: [ ] :$next

".($start+1)."-$stop $total
"; ####################### START OUTPUT ############## echo ""; ?>
"; echo ""; echo "\n"; $q=@mysql_query("select fo_id, fo_admin, fo_subj, fo_name, date_format(fo_posted, '%Y.%m.%d %H:%i') as date, unix_timestamp(fo_posted) as udate, fo_view from $dbtable where fo_replyto=0 order by fo_admin desc, fo_posted desc LIMIT $start, $res_pp"); while($r=@mysql_fetch_object($q)) { $r->fo_subj=trim(stripslashes(strip_tags(str_replace("'", "''", $r->fo_subj)))); if ($r->udate > $last_visit) $isnew=""; else $isnew=""; if ($r->fo_admin > 0) $isnew = $isnew.""; echo "\n\n \n"; get_replys($r->fo_id, 1, $rt); } echo '

$isnew fo_id target=detail"; if ($r->fo_id == $rt) echo " name=".$rt.">$r->fo_subj (fo_name/\" style='text-decoration: none !important;' target=_blank>$r->fo_name, $r->date)"; //, $r->fo_view else echo ">$r->fo_subj (fo_name/\" style='text-decoration: none !important;' target=_blank>$r->fo_name, $r->date)"; //, $r->fo_view if ($r->fo_admin > 0) echo ""; echo "

'; ################### FUNCTIONS ##################### function get_replys($m_id, $level=1, $rt){ global $dbtable, $last_visit; if ($level >=100) return; $space=str_repeat(" . ", $level); $q=@mysql_query("select fo_id, fo_subj, fo_name, date_format(fo_posted, '%Y.%m.%d %H:%i') as date, unix_timestamp(fo_posted) as udate, fo_view from $dbtable where fo_replyto='$m_id' order by fo_posted desc"); while($r=@mysql_fetch_object($q)){ $r->fo_subj=trim(stripslashes(strip_tags(str_replace("'", "''", $r->fo_subj)))); if ($r->udate > $last_visit) $isnew=""; else $isnew=""; echo " \n $isnew $space fo_id target=detail"; if ($r->fo_id == $rt) echo " name=".$rt.">$r->fo_subj (fo_name/\" style='text-decoration: none !important;' target=_blank>$r->fo_name, $r->date)"; // , $r->fo_view else echo ">$r->fo_subj (fo_name/\" style='text-decoration: none !important;' target=_blank>$r->fo_name, $r->date)"; // , $r->fo_view echo "\n \n"; get_replys($r->fo_id, $level+1, $rt); } } function u_pos($a,$b,$start) { $a = strtr(strtoupper($a), "", "Ũ"); $b = strtr(strtoupper($b), "", "Ũ"); return strpos($a,$b,$start); } ?>