diff --git a/plugins/publiclink/get.php b/plugins/publiclink/get.php new file mode 100644 index 0000000000..cdfe42ef26 --- /dev/null +++ b/plugins/publiclink/get.php @@ -0,0 +1,76 @@ + $pathtohere, "name" => $i ); + } + } + + $breadcrumbNav = new OC_TEMPLATE( "plugins/publiclink", "breadcrumb", "" ); + $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); + $breadcrumbNav->assign('token',$token); + + $list = new OC_TEMPLATE( 'plugins/publiclink', 'files', '' ); + $list->assign( 'files', $files ); + $list->assign('token',$token); + + $tmpl = new OC_TEMPLATE( 'plugins/publiclink', 'index', 'user' ); + $tmpl->assign('fileList', $list->fetchPage()); + $tmpl->assign( "breadcrumb", $breadcrumbNav->fetchPage() ); + $tmpl->printPage(); + }else{ + //get time mimetype and set the headers + $mimetype=OC_FILESYSTEM::getMimeType($path); + header('Content-Transfer-Encoding: binary'); + header('Content-Disposition: attachment; filename="'.basename($path).'"'); + header('Expires: 0'); + header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); + header('Pragma: public'); + header('Content-Type: ' . $mimetype); + header('Content-Length: ' . OC_FILESYSTEM::filesize($path)); + + //download the file + ob_clean(); + OC_FILESYSTEM::readfile($path); + } +}else{ + header("HTTP/1.0 404 Not Found"); + echo '404 Not Found'; + die(); +} +?> \ No newline at end of file diff --git a/plugins/publiclink/getfile.php b/plugins/publiclink/getfile.php deleted file mode 100644 index 15a568df3d..0000000000 --- a/plugins/publiclink/getfile.php +++ /dev/null @@ -1,11 +0,0 @@ - \ No newline at end of file diff --git a/plugins/publiclink/lib_public.php b/plugins/publiclink/lib_public.php index 7c25c938fd..436dddeef2 100644 --- a/plugins/publiclink/lib_public.php +++ b/plugins/publiclink/lib_public.php @@ -22,10 +22,9 @@ class OC_PublicLink{ } /** - * download a file shared by a public link - * @param string token + * get the path of that shared file */ - public static function downloadFile($token){ + public static function getPath($token){ //remove expired links $query=OC_DB::prepare("DELETE FROM *PREFIX*publiclink WHERE expire_time < NOW() AND expire_time!=0"); $query->execute(); @@ -41,23 +40,9 @@ class OC_PublicLink{ //prepare the filesystem OC_UTIL::setupFS($user); - //get time mimetype and set the headers - $mimetype=OC_FILESYSTEM::getMimeType($path); - // header('Content-Disposition: attachment; filename="'.basename($path).'"'); - header('Content-Transfer-Encoding: binary'); - header('Expires: 0'); - header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); - header('Pragma: public'); - header('Content-Type: ' . $mimetype); - header('Content-Length: ' . OC_FILESYSTEM::filesize($path)); - - //download the file - ob_clean(); - OC_FILESYSTEM::readfile($path); + return $path; }else{ - header("HTTP/1.0 404 Not Found"); - echo '404 Not Found'; - die(); + return false; } } diff --git a/plugins/publiclink/templates/breadcrumb.php b/plugins/publiclink/templates/breadcrumb.php new file mode 100644 index 0000000000..3f4ae863ee --- /dev/null +++ b/plugins/publiclink/templates/breadcrumb.php @@ -0,0 +1,4 @@ + " alt="Root" /> + + "> + \ No newline at end of file diff --git a/plugins/publiclink/templates/files.php b/plugins/publiclink/templates/files.php new file mode 100644 index 0000000000..6473ad4c5c --- /dev/null +++ b/plugins/publiclink/templates/files.php @@ -0,0 +1,9 @@ + + + + )" href="" title=""> + + + + + + \ No newline at end of file diff --git a/plugins/publiclink/templates/index.php b/plugins/publiclink/templates/index.php new file mode 100644 index 0000000000..9e23845260 --- /dev/null +++ b/plugins/publiclink/templates/index.php @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + +
NameSizeModified
\ No newline at end of file