<?PHP
#
#   FILE:  CleanSpam.php
#
#   FUNCTIONS PROVIDED:
#
#   FUNCTIONS EXPECTED:
#       DisplayAddButtons()
#           - display add, delete, cancel buttons
#
#   Copyright 2011 Internet Scout Project
#   http://scout.wisc.edu/
#

# ----- EXPORTED FUNCTIONS ---------------------------------------------------

function PrintResourceComments($PosterId, $PosterName, $PosterEmail)
{
    global $DB;

    $Comments = array();
    $DB->Query("SELECT * FROM Messages WHERE PosterId=".$PosterId);
    while ($Row = $DB->FetchRow() )
    {
        $Comments []= $Row;
    }

    # for each comment
    foreach ($Comments as $Comment)
    {
        # print comment
        PrintForumMessage(
            $Comment["Subject"],
            $Comment["Body"],
            $Comment["DatePosted"],
            $PosterName,
            $PosterEmail,
            FALSE,
            NULL,
            NULL,
            NULL,
            TRUE,
            NULL);
    }
}

# ----- LOCAL FUNCTIONS ------------------------------------------------------

# ----- MAIN -----------------------------------------------------------------

PageTitle("Preview Message");

# check if current user is authorized
CheckAuthorization(PRIV_FORUMADMIN, PRIV_USERADMIN);

$PosterId   = isset($_GET["PosterId"]  ) ? intval($_GET["PosterId"]  ) : -1;
$ResourceId = isset($_GET["ResourceId"]) ? intval($_GET["ResourceId"]) : -1;

$TgtUser = new User ($DB, $PosterId);

$PosterName = $TgtUser->Name();
$PosterEmail = $TgtUser->Get("EMail");
