query("select parent from $default->owl_folders_table where id = '$parent'"); while($sql->next_record()) { $path = fid_to_name($sql->f("parent"))."/".$path; $parent = $sql->f("parent"); } } return $path; } function fid_to_filename($id) { global $default; $sql = new Owl_DB; $sql->query("select filename from $default->owl_files_table where id = '$id'"); while($sql->next_record()) return $sql->f("filename"); } if($action == "image_show") { if(check_auth($id, "file_download", $userid) == 1) { if ($default->owl_use_fs) { $path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id); readfile("$path"); } else { $sql = new Owl_DB; $filename = fid_to_filename($id); if ($filetype = strrchr($filename,".")) { $filetype = substr($filetype,1); $sql->query("select * from $default->owl_mime_table where filetype = '$filetype'"); while($sql->next_record()) $mimeType = $sql->f("mimetype"); } if ($mimeType) { header("Content-Type: $mimeType"); $sql->query("select data,compressed from " . $default->owl_files_data_table . " where id='$id'"); while($sql->next_record()) { if ($sql->f("compressed")) { $tmpfile = $default->owl_FileDir . "owltmp.$id"; if (file_exists($tmpfile)) unlink($tmpfile); $fp=fopen($tmpfile,"w"); fwrite($fp, $sql->f("data")); fclose($fp); flush(passthru($default->gzip_path . " -dfc $tmpfile")); unlink($tmpfile); } else { print $sql->f("data"); } } } } } else { print($lang_nofileaccess); } die; } print("table_expand_width BGCOLOR=$default->main_header_bgcolor CELLSPACING=0 CELLPADDING=0 BORDER=$default->table_border HEIGHT=30>"); ?>
"); } print uid_to_name($userid); print (""); ?> $lang_logout");?> ");?>
table_expand_width BORDER=$default->table_border>"); print("".gen_navbar($parent)."/".flid_to_name($id).""); print("
table_expand_width>
"); $sql = new Owl_DB; $sql->query("select * from $default->owl_files_table where id = '$id'"); while($sql->next_record()) { $security = $sql->f("security"); if ($security == "0") $security = $lang_everyoneread; if ($security == "1") $security = $lang_everyonewrite; if ($security == "2") $security = $lang_groupread; if ($security == "3") $security = $lang_groupwrite; if ($security == "4") $security = $lang_onlyyou; if ($security == "5") $security = $lang_groupwrite_nod; if ($security == "6") $security = $lang_everyonewrite_nod; if ($security == "7") $security = $lang_groupwrite_worldread; if ($security == "8") $security = $lang_groupwrite_worldread_nod; print("table_border>
table_header_bg> $lang_title:".$sql->f("name")."
table_header_bg>$lang_file:".$sql->f("filename")." (".gen_filesize($sql->f("size")).")
table_header_bg>$lang_ownership: ".fid_to_creator($id)." (".group_to_name(owlfilegroup($id)).")
table_header_bg>$lang_permissions:$security
table_header_bg>$lang_keywords:".$sql->f("metadata")."
table_header_bg VALIGN=TOP>$lang_description:

"); include("./lib/footer.inc"); } } } if($action == "image_preview") { if(check_auth($id, "file_download", $userid) == 1) { $path = find_path($parent)."/".fid_to_filename($id); print("$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ."


"); print(""); } else { print($lang_nofileaccess); } } if($action == "zip_preview") { if(check_auth($id, "file_download", $userid) == 1) { $name = fid_to_filename($id); if ($default->owl_use_fs) { $path = find_path($parent)."/".$name; } else { $path = $name; if (file_exists($default->owl_FileDir. "/$path")) unlink($default->owl_FileDir. "/$path"); $file = fopen($default->owl_FileDir. "/$path", 'wb'); $sql->query("select data,compressed from $default->owl_files_data_table where id='$id'"); while($sql->next_record()) { if ($sql->f("compressed")) { $tmpfile = $default->owl_FileDir . "owltmp.$id.gz"; $uncomptmpfile = $default->owl_FileDir . "owltmp.$id"; if (file_exists($tmpfile)) unlink($tmpfile); $fp=fopen($tmpfile,"w"); fwrite($fp, $sql->f("data")); fclose($fp); system($default->gzip_path . " -df $tmpfile"); $fsize = filesize($uncomptmpfile); $fd = fopen($uncomptmpfile, 'rb'); $filedata = fread($fd, $fsize); fclose($fd); fwrite($file, $filedata); unlink($uncomptmpfile); } else { fwrite($file, $sql->f("data")); } fclose($file); } } //$path = find_path($parent)."/".$name; $expr = "-t"; if(ereg("gz", $name)) $expr .= "z"; print("$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ."


"); print("table_border CELLPADDING=0 CELLSPACING=0>
");
		passthru("$default->tar_path $expr < $default->owl_FileDir/$path | sort");
		unlink($default->owl_FileDir. "/$path");
		print("
"); } else { print($lang_nofileaccess); } } // BEGIN wes change if($action == "html_show" || $action == "text_show") { if(check_auth($id, "file_download", $userid) == 1) { if ($default->owl_use_fs) { $path = $default->owl_FileDir."/".find_path($parent)."/".fid_to_filename($id); print("
$lang_viewing". gen_navbar($parent) . "/" . fid_to_filename($id) ."


"); if ($action == "text_show") print(""); readfile("$path"); } else { print("$lang_viewing /".find_path($parent)."/".fid_to_filename($id)."<HR WIDTH=50%><BR><BR></CENTER>"); if ($action == "text_show") print("<xmp>"); $sql->query("select data,compressed from " . $default->owl_files_data_table . " where id='$id'"); while($sql->next_record()) { if ($sql->f("compressed")) { $tmpfile = $default->owl_FileDir . "owltmp.$id"; if (file_exists($tmpfile)) unlink($tmpfile); $fp=fopen($tmpfile,"w"); fwrite($fp, $sql->f("data")); fclose($fp); flush(passthru($default->gzip_path . " -dfc $tmpfile")); unlink($tmpfile); } else { print $sql->f("data"); } } } $path = find_path($parent)."/".fid_to_filename($id); } else { print($lang_nofileaccess); } } // end wes change ?>