<?
include('../Code/confHeader.inc');
$Me -> goIfInvalid("../index.php");
$Me -> goIfNotAssistant('../index.php');
$Conf -> connect();

//
// Don't send any output until late into the script..
//

//
// Check if they're allowed to get the paper..
//

$query = "SELECT paperId FROM Paper "
. " WHERE ( Paper.paperId='$paperId' )";

$result = $Conf->qe($query);

//
// Check if they're allowed to get the paper..
//

if ( $Conf -> downloadPaper($paperId) ) {
    //
    // Happy happy joy joy - do nothing
    //
    $Conf->log("Downloading $paperId for review", $Me);
    exit();
  } else {
    echo "<html>";
    $Conf->header("Error Retrieving Paper #$paperId");
    echo " <body> <p> There appears to be a problem ";
    echo "downloading the file "
      . $result->getMessage()
      . " </p> </body> </html>";

    $Conf->log("Error downloading $paperId for review"
	       . $result->getMessage(), $Me);
  }
?>
