$post = new post($database); $user->updateLastActive(); //get config $config = $base->loadConfig(); //set some variables that are used a lot throughout the page $username = $user->getUsername($_COOKIE['user'], 2); $rank = $user->getRank($username); $f = $_GET['forum']; $i = $_GET['id']; //preform basic checks if (!ctype_digit($f) || !ctype_digit($i) || !$thread->checkExistence($i) || !$thread->canView($i, $username, $rank)) { $base->redirect('index.php'); } //if the GOTO field is set, let's skip to the selected post if (ctype_digit($_GET['goto'])) { $getPageNum = $thread->getPageNum($_GET['goto'], $i); if ($getPageNum) { $base->redirect('viewthread.php?forum=' . $f . '&id=' . $i . '&page=' . $getPageNum . '&highlight=' . $_GET['goto'] . '#' . $_GET['goto']); } } //extract thread details $detail_query = $database->processQuery("SELECT `id`,`lock`,`sticky`,`title`,`username`,`status`,`content`,`date`,`lastedit`,`qfc`,`moved`,`hidden`,`autohiding` FROM `threads` WHERE `id` = ? LIMIT 1", array($i), true); //assign data to details[] array $details['lock'] = $detail_query[0]['lock']; $details['sticky'] = $detail_query[0]['sticky']; $details['title'] = stripslashes(htmlentities($detail_query[0]['title'])); $details['username'] = $detail_query[0]['username']; $details['status'] = $detail_query[0]['status']; $details['content'] = $detail_query[0]['content']; $details['date'] = $detail_query[0]['date']; $details['lastedit'] = $detail_query[0]['lastedit'];