<?php 
require("common_begin.php");

$lst = Listopia::getInstance();

$listItemID = isset($_POST['item']) ? intval($_POST['item']) : -1;
$listID  = isset($_POST['list']) ? intval($_POST['list']) : 0;

if ($listItemID != -1)
{
  $newComments = $lst->getSingleListItemDiscussion($listItemID);
  if (!empty($newComments[0]))
  {
    foreach ($newComments as &$comment)
    {
      echo $lst->generateDiscussionCommentHTML($comment);
    }
  }
}
else if ($listID != 0)
{
  $newComments = $lst->getListComments($listID);
  if (!empty($newComments[0]))
  {
    foreach ($newComments as &$comment)
    {
      echo $lst->generateDiscussionCommentHTML($comment);
    }
  }  
}

require("common_end.php");

