$msg_list = new query($DB, $sSQL); $row = $msg_list->firstrow(); if (is_array($row)) { if (!$read) { $rec = $thread_list->firstrow(); while (is_array($rec)) { $thd = $rec["thread"]; if (!isset($rec["tcount"])) { $rec["tcount"] = 0; } $tcount = $rec["tcount"]; $threadtotal[$thd] = $tcount; $rec = $thread_list->getrow(); } } else { $threadtotal[$thread] = $msg_list->numrows(); } $topics["max"] = "0"; $topics["min"] = "0"; while (is_array($row)) { $x = "" . $row["id"] . ""; $p = "" . $row["parent"] . ""; $messages["{$x}"] = $row; $messages["{$p}"]["replies"]["{$x}"] = "{$x}"; $messages["{$p}"]["max"] = $row["id"]; if (!isset($messages["max"])) { $messages["max"] = 0; } if (!isset($messages["min"])) { $messages["min"] = 0; }
} $q->query($DB, $sSQL); $rec = $q->getrow(); } else { $rec = ""; } if (is_array($rec)) { while (is_array($rec)) { $empty = false; $name = $rec["name"]; $num = $rec["id"]; $description = $rec["description"]; if (!$rec["folder"]) { $sSQL = "select count(*) as posts from {$rec['table_name']} where approved='Y'"; $tq = new query($DB, $sSQL); if ($tq->numrows()) { $trec = $tq->getrow(); $num_posts = $trec["posts"]; } else { $num_posts = '0'; } $sSQL = "select max(datestamp) as max_date from {$rec['table_name']} where approved='Y'"; $tq->query($DB, $sSQL); $trec = $tq->getrow(); if (empty($trec["max_date"])) { $last_post_date = ""; } else { $last_post_date = phorum_date_format($trec["max_date"]); } $posts = "{$lNumPosts}: <strong>{$num_posts}</strong> "; $last = "{$lLastPostDate}: <strong>{$last_post_date}</strong>";
} break; case 1: $cutoff_thread = $thread + $cutoff; if ($ForumMultiLevel == 2) { $sSQL = "select thread, id from {$ForumTableName} where modifystamp>{$thms} {$limitApproved} order by modifystamp {$limit}"; } else { $sSQL = "Select thread, id from {$ForumTableName} where thread<{$cutoff_thread} and thread>{$thread} and id=thread {$limitApproved} order by thread asc {$limit}"; } break; } $msg = new query($DB, $sSQL); if ($DB->type == "postgresql") { $q->query($DB, "set QUERY_LIMIT TO '0'"); } if ($msg->numrows() == 0) { Header("Location: {$list_page}.{$ext}?f={$num}{$GetVars}"); exit; } $tres = $msg->getrow(); Header("Location: {$read_page}.{$ext}?f={$num}&i={$tres['id']}&t={$tres['thread']}{$GetVars}"); exit; } $sSQL = "Select * from {$ForumTableName} where thread={$thread} {$limitApproved} order by id"; $msg_list = new query($DB, $sSQL); $rec = $msg_list->getrow(); $x = 0; while (is_array($rec)) { $headers[] = $rec; if ($rec["id"] == $id) { $loc = $x;