diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css index aa76c06175..f38afae3dd 100644 --- a/apps/files_sharing/css/public.css +++ b/apps/files_sharing/css/public.css @@ -1,2 +1,7 @@ -#content { position:relative; } -#preview p { text-align: center; } \ No newline at end of file +body { background:#ddd; } +#header { position:fixed; top:0; left:0; right:0; z-index:100; height:2.5em; line-height:2.5em; padding:.5em; background:#1d2d44; -moz-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; -webkit-box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; box-shadow:0 0 10px rgba(0, 0, 0, .5), inset 0 -2px 10px #222; } +#details { color:#fff; } +#download { margin-left:2em; font-weight:bold; color:#fff; } +#preview { min-height:30em; margin:50px auto; border-bottom:1px solid #f8f8f8; background:#eee; text-align:center; } +p.info { width:22em; text-align: center; margin:2em auto; color:#777; text-shadow:#fff 0 1px 0; } +p.info a { font-weight:bold; color:#777; } \ No newline at end of file diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php index 15dac576d9..a4bf0230a3 100644 --- a/apps/files_sharing/public.php +++ b/apps/files_sharing/public.php @@ -5,6 +5,7 @@ if (isset($_GET['file'])) { $pos = strpos($_GET['file'], '/', 1); $uidOwner = substr($_GET['file'], 1, $pos - 1); if (OCP\User::userExists($uidOwner)) { + OC_Util::tearDownFS(); OC_Util::setupFS($uidOwner); $file = substr($_GET['file'], $pos); $fileSource = OC_Filecache::getId($_GET['file'], ''); @@ -18,14 +19,19 @@ if (isset($_GET['file'])) { $hasher = new PasswordHash(8, $forcePortable); if (!($hasher->CheckPassword($password.OC_Config::getValue('passwordsalt', ''), $storedHash))) { $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); + $tmpl->assign('URL', OCP\Util::linkToPublic('files').'&file='.$_GET['file']); $tmpl->assign('error', true); $tmpl->printPage(); exit(); + } else { + // Save item id in session for future requests + $_SESSION['public_link_authenticated'] = $linkItem['id']; } - // Continue on if password is valid - } else { + // Check if item id is set in session + } else if (!isset($_SESSION['public_link_authenticated']) || $_SESSION['public_link_authenticated'] !== $linkItem['id']) { // Prompt for password $tmpl = new OCP\Template('files_sharing', 'authenticate', 'guest'); + $tmpl->assign('URL', OCP\Util::linkToPublic('files').'&file='.$_GET['file']); $tmpl->printPage(); exit(); } @@ -45,7 +51,8 @@ if (isset($_GET['file'])) { OCP\Util::addStyle('files_sharing', 'public'); OCP\Util::addScript('files_sharing', 'public'); OCP\Util::addScript('files', 'fileactions'); - $tmpl = new OCP\Template('files_sharing', 'public', 'guest'); + $tmpl = new OCP\Template('files_sharing', 'public', 'base'); + $tmpl->assign('details', $uidOwner.' shared the file '.basename($path).' with you'); $tmpl->assign('owner', $uidOwner); $tmpl->assign('name', basename($path)); // Show file list diff --git a/apps/files_sharing/templates/authenticate.php b/apps/files_sharing/templates/authenticate.php index 41064d5146..9695caebf1 100644 --- a/apps/files_sharing/templates/authenticate.php +++ b/apps/files_sharing/templates/authenticate.php @@ -1,4 +1,4 @@ -