/*$_GET['aid'] = $_REQUEST['id'];
$comments = include(dirname(__DIR__) . "/../../../private/json/getPageCommentsWithUsers.php");
echo json_encode($comments, JSON_PRETTY_PRINT);*/
require_once dirname(__DIR__) . "/../../../private/class/AddonManager.php";
require_once dirname(__DIR__) . "/../../../private/class/CommentManager.php";
$aid = $_REQUEST['id'];
if (!isset($_REQUEST['page'])) {
    $page = 0;
} else {
    $page = $_REQUEST['page'];
}
$addonObject = AddonManager::getFromID($aid);
if (isset($_REQUEST['newcomment'])) {
    if ($con->isAuthed()) {
        CommentManager::submitComment($addonObject->getId(), $con->getBlid(), stripcslashes($_REQUEST['newcomment']));
    }
}
$res = new stdClass();
$res->status = "success";
$ret = array();
$start = $page * 10;
$comments = CommentManager::getCommentIDsFromAddon($addonObject->getId(), $start, 10, 1);
foreach ($comments as $comid) {
    $comment = CommentManager::getFromId($comid);
    $commento = new stdClass();
    $commento->id = $comment->getId();
    $commento->author = utf8_encode(UserLog::getCurrentUsername($comment->getBLID()));
    $commento->authorblid = $comment->getBlid();
    $text = str_replace("\r\n", "<br>", $comment->getComment());
    $text = str_replace("\n", "<br>", $text);
Beispiel #2
0
    }
} else {
    header('Location: /addons');
    die;
}
if ($addonObject->isRejected()) {
    include 'rejected.php';
    die;
} else {
    if (!$addonObject->getApproved()) {
        include 'unapproved.php';
        die;
    }
}
if (isset($_POST['comment'])) {
    CommentManager::submitComment($addonObject->getId(), UserManager::getCurrent()->getBLID(), $_POST['comment']);
}
$_PAGETITLE = "Blockland Glass | " . $addonObject->getName();
include realpath(dirname(__DIR__) . "/private/header.php");
include realpath(dirname(__DIR__) . "/private/navigationbar.php");
?>
<script type="text/javascript">
	$(document).ready(function() {
		var avgRating = 0<?php 
echo @round($addonObject->getRating());
?>
;

		for(var i = 0; i < avgRating; i++) {
			$('#star' + (i+1)).attr("src","/img/icons32/star.png");
		}