"; $app = " "." and $file <> ".." and $file <> "template.jaj" and $file <> "annotate.jaj"){ $full = $dirn . "/" . $file; if(!is_dir($full)) { $check = strrev($file); if($jaj and (substr($check, 0, 4) == "jaj.")){ if($print) echo $app . "op=view&request=" . urlencode($file) . "\" target=\"homeright\">". $file . " dnld
"; else if(($delete > 0) and ($iii < ($delete - $nmax))) unlink($full); $iii++; } if($print and !$jaj and (substr($check, 0, 4) <> "jaj.")) echo $app . "op=bg&request=" . urlencode($file) . "\" target=\"homeright\">". $file . "
"; } } } return $iii; } function view($request){ global $app, $jar, $wdir, $wdirn, $HTTP_HOST, $edit; echo ""; if($edit) echo $app . "op=edit&request=" . $request . "\" target=\"homeright\">Edit this Jarnal
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } function edit($request, $bg){ global $jar, $wdir, $wdirn, $HTTP_HOST, $japp; if($meta) { editmeta($request, $bg); return; } echo ""; echo ""; if($request == "unsaved.jaj") echo ""; else if($bg){ echo ""; echo ""; $request = "unsaved.jaj"; } else echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } //The code below generates a metadata file in response to clicking on a link; this file feeds Jarnal the parameters it needs to correctly store files back to the server function editmeta($request, $bg){ global $jar, $wdir, $wdirn, $HTTP_HOST, $japp; header("Content-Type: application/jarnal-meta"); echo "[Globals]\n"; if($request == "unsaved.jaj") echo "templateFile=http://" . $HTTP_HOST . $wdirn ."/template.jaj\n"; else if($bg){ echo "backgroundFile=http://" . $HTTP_HOST . $wdirn . "/" . $request . "\n"; echo "templateFile=http://" . $HTTP_HOST . $wdirn . "/annotate.jaj\n"; $request = "unsaved.jaj"; } else echo "jarnalFile=http://" . $HTTP_HOST . $wdirn . "/" . $request . "\n"; echo "netServer=http://" . $HTTP_HOST . $japp . "\n"; echo "netSaveName=" . $request . "\n"; echo "\n"; echo "[Net Options]\n"; echo "inname=\$g\n"; echo "infile=\$\$jarnal\n"; //The final \n is required not optional //You must use the unix convention of terminating lines with \n regardless of what operating system you are using } $userfile = $HTTP_POST_FILES["infile"]["tmp_name"]; if(is_uploaded_file($userfile)) { //A file is being uploaded - save it $check = strrev($inname); if(substr($check, 0, 4) <> "jaj.") $inname = $inname . ".jaj"; copy($userfile, $dirn . "/" . $inname); echo $inname . " received ok"; $iii = dirlist(true, false, 0); if($iii > $nmax){ rewinddir($dirh); dirlist(true, false, $iii); } exit; } if(empty($request) && empty($dirlist)){ echo "Jarnal Sample Network Application"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } if(!empty($dirlist)) { echo "". $title . ""; echo "

Reload file list

"; if($edit) echo "

" . $app . "op=edit&request=unsaved.jaj\" target=\"homeright\">Edit new Jarnal

"; echo "

View Jarnal:

"; dirlist(true, true, 0); rewinddir($dirh); if($edit){ echo "

Annotate file:

"; dirlist(false, true, 0); } } if($op == "view") view($request); if($op == "edit") edit($request, false); if($op == "bg") edit($request, true); ?>