include_once('init.php');include_once('header.php'); [$catid,$docid]=iddecode(getpar('cdid')); if (chkreadaccess($catid)) { $sql="SELECT * FROM docs WHERE catid=$catid AND docid=$docid"; $res=mydo($DB,$sql,1); $numrows =mysqli_num_rows($res); $row = mysqli_fetch_assoc($res); if ($numrows==1) { $prevf0=$row['f0']; $prevcatid=$row['catid']; $prevdocid=$row['docid']; $dlink="".$row['filename'].""; $previewtxt="(".$dlink.", $docid, ".formsize($row['size']).", ".$row['mime'].")"; $prevmime=$row['mime']; $prevfilename=$row['filename']; $prevfilepath="$DATA/".$row['catid']."/".$row['docid']; if (!is_null($row['fcatid']) && !is_null($row['fdocid'])) { $prevfilepath="$DATA/".$row['fcatid']."/".$row['fdocid']; } $sres=mydo($DB,"select docid,filename from docs where catid=$prevcatid and rm=0 ". "and docid>$prevdocid order by docid limit 1",1); $nextlink=""; $snumrows =mysqli_num_rows($sres); if ($snumrows==1) { $srow = mysqli_fetch_assoc($sres); $nextlink="NEXT"; } $sres=mydo($DB,"select docid,filename from docs where catid=$prevcatid and rm=0 ". "and docid<$prevdocid order by docid desc limit 1",1); $prevlink=""; $snumrows =mysqli_num_rows($sres); if ($snumrows==1) { $srow = mysqli_fetch_assoc($sres); $prevlink="PREV"; } echo "
";
echo "Preview$previewtxt"; echo " | "; echo "BACK  "; if (!PM("/^\s*$/",$prevlink)) echo " $prevlink"; if (!PM("/^\s*$/",$nextlink)) echo " $nextlink"; echo " |
readfile($prevfilepath); ?>} else if (PM("/^image\//",$prevmime)) { ?>
} else if (PM("/^application\/pdf$/",$prevmime)) { ?>
header("Location: /send/".idencode($catid,$row['docid']));exit; ?>
} else { ?>
}?> include_once('footer.php'); ?>