<?php
// entry.php
require_once('sitebase.inc');
require_once('entry.inc');
tophdr(0);
$cnum=$_REQUEST['cnum'];
edset();
//$home=$_REQUEST['home'];
//$idq='id='.substr($edid,3).'&cnum='.$cnum;
//$_SESSION['home']=$home;
if (($topicno=$_REQUEST['topicno']) != 0)
    {$erec=getrec('entry','entryno',
                  getfield('topic','entryno','topicno',$topicno));
    $listall=TRUE; }
else {$erec=getrec('entry','entryno',$_REQUEST['entryno']);
    $topicno=$erec['topicno'];
    if ($erec['next']==0
        && getfield('topic','entryno','topicno',$erec['topicno'])
            ==$erec['entryno'])
        {$listall=TRUE; }
    else {$listall=FALSE; }
    }
if (!$_SESSION['HomeTopicno']) $_SESSION['HomeTopicno']=$topicno;
edhdr();

if ($listall)
    {// Display topic + responses
    disp_nav1($topicno);
    $trec=getrec('topic', 'topicno', $topicno);
    disp_entry($erec);
    while ($erec['next'])
        {$erec=getrec('entry','entryno',$erec['next']);
        disp_entry($erec); }
    echo '<br clear=all><br>';
    disp_nav1($topicno);
    }
else {disp_nav2($erec);
    disp_entry($erec);
    echo '<br clear=all><br>';
    disp_nav2($erec);
    }
edfoot();

?>
