<?php if (!isset($_GET['blid'])) { return []; } require_once realpath(dirname(__DIR__) . "/class/CommentManager.php"); $blid = $_GET['blid'] + 0; //force it to be a number $commentIDs = CommentManager::getCommentsFromBLID($blid); $comments = []; foreach ($commentIDs as $cid) { $comment = CommentManager::getFromID($cid); if ($comment !== false) { $comments[] = $comment; } } return $comments; // require_once(realpath(dirname(__DIR__) . "/private/class/DatabaseManager.php")); // $database = new DatabaseManager(); // // //the "and `verified` = 1 can be deleted if we decide to force blid database entries to be unique // $result = $database->query("SELECT * FROM `addon_comments` WHERE `blid` = '" . $database->sanitize($_GET['blid']) . "' AND `verified` = 1"); // // if(!$result) { // echo("Database error: " . $database->error()); // } else { // if($result->num_rows == 0) { // echo("<tr style=\"vertical-align:top\">"); // echo("<td colspan=\"2\" style=\"text-align: center;\">"); // echo("There are no comments here yet."); // echo("</td></tr>");