//make sure we have the forum id if (!$topicId) { WCF::SetupNotification('Please make sure you have selected a valid topic.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } $res = $DB->prepare("SELECT * FROM `wcf_topics` WHERE `id` = :id LIMIT 1;"); $res->bindParam(':id', $topicId, PDO::PARAM_INT); $res->execute(); if ($res->rowCount() == 0) { WCF::SetupNotification('The selected topic does not exist or was deleted.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } //save the last viewd topic WCF::setLastViewedTopic($topicId); //Fetch the post record $row = $res->fetch(); //format the time $row['added'] = date('D M j, Y, h:i A', strtotime($row['added'])); //Set the title $TPL->SetTitle(WCF::parseTitle($row['name'])); $TPL->SetParameter('topbar', true); //Add CSS to the loader $TPL->AddCss('template/style/select.css'); //Print the header $TPL->LoadHeader(); if ($forumRow = WCF::getForumInfo($row['forum'])) { if ($catName = WCF::getCategoryName($forumRow['category'])) { $forumRow['category_name'] = $catName; } else {