//make sure we have the forum id if (!$forumId) { WCF::SetupNotification('Please make sure you have selected a valid forum.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } $res = $DB->prepare("SELECT * FROM `wcf_forums` WHERE `id` = :id LIMIT 1;"); $res->bindParam(':id', $forumId, PDO::PARAM_INT); $res->execute(); if ($res->rowCount() == 0) { WCF::SetupNotification('The selected forum does not exist or was deleted.'); header("Location: " . $config['BaseURL'] . "/forums.php"); die; } //save the last viewd forum WCF::setLastViewedForum($forumId); //Fetch the forum record $row = $res->fetch(); //Set the title $TPL->SetTitle(WCF::parseTitle($row['name'])); $TPL->SetParameter('topbar', true); //Print the header $TPL->LoadHeader(); if ($catName = WCF::getCategoryName($row['category'])) { $row['category_name'] = $catName; } else { $row['category_name'] = 'Unknown'; } unset($catName); //count the total topics $count = WCF::getTopicsCount($row['id']);