From d1aebcddf26c155c4efa580d19bb99c0e51ecbba Mon Sep 17 00:00:00 2001 From: Michael Gapczynski Date: Thu, 18 Aug 2011 19:32:24 -0400 Subject: [PATCH] Add downloadURL to files templates for both public links and files --- apps/files_sharing/get.php | 14 +++++++------- files/index.php | 5 +++-- files/templates/part.breadcrumb.php | 2 +- files/templates/part.list.php | 2 +- 4 files changed, 12 insertions(+), 11 deletions(-) diff --git a/apps/files_sharing/get.php b/apps/files_sharing/get.php index 121793e36f..a828989a8a 100644 --- a/apps/files_sharing/get.php +++ b/apps/files_sharing/get.php @@ -13,14 +13,13 @@ if ($source !== false) { $user = substr($source, 1, strpos($source, "/", 1) - 1); OC_Util::setupFS($user); $source = substr($source, strlen("/".$user."/files")); - $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : ''; - print_r($dir); + $subPath = isset( $_GET['path'] ) ? $_GET['path'] : ''; $root = $source; - $source .= $dir; + $source .= $subPath; if (!OC_Filesystem::file_exists($source)) { header("HTTP/1.0 404 Not Found"); $tmpl = new OC_Template("", "404", "guest"); - $tmpl->assign("file", $dir); + $tmpl->assign("file", $subPath); $tmpl->printPage(); exit; } @@ -42,7 +41,7 @@ if ($source !== false) { // Make breadcrumb $breadcrumb = array(); $pathtohere = "/"; - foreach (explode("/", $dir) as $i) { + foreach (explode("/", $subPath) as $i) { if ($i != "") { $pathtohere .= "$i/"; $breadcrumb[] = array("dir" => $pathtohere, "name" => $i); @@ -54,10 +53,11 @@ if ($source !== false) { 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."&"); + $breadcrumbNav->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path="); $list = new OC_Template("files", "part.list", ""); $list->assign("files", $files); - $list->assign("baseUrl", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&"); + $list->assign("baseURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path="); + $list->assign("downloadURL", OC_Helper::linkTo("files_sharing", "get.php")."?token=".$token."&path="); $tmpl = new OC_Template("files", "index", "user"); $tmpl->assign("fileList", $list->fetchPage()); $tmpl->assign("breadcrumb", $breadcrumbNav->fetchPage()); diff --git a/files/index.php b/files/index.php index 5ab74a6267..e62c924644 100644 --- a/files/index.php +++ b/files/index.php @@ -69,10 +69,11 @@ 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?")); +$list->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir=")); +$list->assign( "downloadURL", OC_Helper::linkTo("files", "download.php?file=")); $breadcrumbNav = new OC_Template( "files", "part.breadcrumb", "" ); $breadcrumbNav->assign( "breadcrumb", $breadcrumb ); -$breadcrumbNav->assign( "baseUrl", OC_Helper::linkTo("files", "index.php?")); +$breadcrumbNav->assign( "baseURL", OC_Helper::linkTo("files", "index.php?dir=")); $maxUploadFilesize = OC_Helper::computerFileSize(ini_get('upload_max_filesize')); diff --git a/files/templates/part.breadcrumb.php b/files/templates/part.breadcrumb.php index c4f75bf86b..9a265a9c1e 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 b6f586443d..0484f90c26 100644 --- a/files/templates/part.list.php +++ b/files/templates/part.list.php @@ -9,7 +9,7 @@ '> - +