diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php new file mode 100644 index 0000000000..121793e36f --- /dev/null +++ b/apps/files_sharing/get.php @@ -0,0 +1,85 @@ +assign("file", $dir); + $tmpl->printPage(); + exit; + } + if (OC_Filesystem::is_dir($source)) { + $files = array(); + $rootLength = strlen($root); + foreach (OC_Files::getdirectorycontent($source) as $i) { + $i['date'] = OC_Util::formatDate($i['mtime'] ); + if ($i['type'] == 'file') { + $i['extention'] = substr($i['name'], strrpos($i['name'], ".")); + $i['basename'] = substr($i['name'], 0, strrpos($i['name'], ".")); + } + $i['directory'] = substr($i['directory'], $rootLength); + if ($i['directory'] == "/") { + $i['directory'] = ""; + } + $files[] = $i; + } + // Make breadcrumb + $breadcrumb = array(); + $pathtohere = "/"; + foreach (explode("/", $dir) as $i) { + if ($i != "") { + $pathtohere .= "$i/"; + $breadcrumb[] = array("dir" => $pathtohere, "name" => $i); + } + } + // Load the files we need + OC_Util::addStyle("files", "files"); + OC_Util::addScript("files", "files"); + OC_Util::addScript("files", "filelist"); + $breadcrumbNav = new OC_Template("files", "part.breadcrumb", ""); + $breadcrumbNav->assign("breadcrumb", $breadcrumb); + $breadcrumbNav->assign("baseUrl", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&"); + $list = new OC_Template("files", "part.list", ""); + $list->assign("files", $files); + $list->assign("baseUrl", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&"); + $tmpl = new OC_Template("files", "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($source); + header("Content-Transfer-Encoding: binary"); + header("Expires: 0"); + header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Pragma: public"); + header("Content-Disposition: filename='".basename($source)."'"); + header("Content-Type: " . $mimetype); + header("Content-Length: " . OC_Filesystem::filesize($source)); + //download the file + @ob_clean(); + OC_Filesystem::readfile($source); + } +} else { + header("HTTP/1.0 404 Not Found"); + $tmpl = new OC_Template("", "404", "guest"); + $tmpl->printPage(); + die(); +} +?> \ No newline at end of file diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index c7ac7c3e8f..df704c131e 100644 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -135,6 +135,7 @@ class OC_Share { $in .= ", '".$uid."@".$group."'"; } } + $in .= ", '".self::PUBLICLINK."'"; $in .= ")"; return $in; } diff --git a/files/index.php b/files/index.php index 821879b034..5ab74a6267 100644 --- a/files/index.php +++ b/files/index.php @@ -69,8 +69,10 @@ foreach( explode( "/", $dir ) as $i ){ // make breadcrumb und filelist markup $list = new OC_Template( "files", "part.list", "" ); $list->assign( "files", $files ); +$list->assign( "baseUrl", OC_Helper::linkTo("files", "index.php?")); $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" ); $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); +$breadcrumbNav->assign( "baseUrl", OC_Helper::linkTo("files", "index.php?")); $maxUploadFilesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize')); diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index 96342919df..c4f75bf86b 100644 --- a/files/templates/part.breadcrumb.php +++ b/files/templates/part.breadcrumb.php @@ -1,5 +1,5 @@
")'> - "> + ">
diff --git a/files/templates/part.list.php b/files/templates/part.list.php index 942f749c82..b6f586443d 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -9,7 +9,7 @@ '> - +