generate correct link for shared files and shared directories

This commit is contained in:
Björn Schießle 2012-10-11 13:45:16 +02:00
parent f1d9359acf
commit c1f645cd5f
1 changed files with 7 additions and 2 deletions

View File

@ -45,6 +45,11 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
}
if (isset($linkItem['share_with'])) {
// Check password
if (isset($_GET['file'])) {
$url = OCP\Util::linkToPublic('files').'&file='.$_GET['file'];
} else {
$url = OCP\Util::linkToPublic('files').'&dir='.$_GET['dir'];
}
if (isset($_POST['password'])) {
$password = $_POST['password'];
$storedHash = $linkItem['share_with'];
@ -52,7 +57,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
$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('URL', $url);
$tmpl->assign('error', true);
$tmpl->printPage();
exit();
@ -64,7 +69,7 @@ if (isset($_GET['file']) || isset($_GET['dir'])) {
} 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->assign('URL', $url);
$tmpl->printPage();
exit();
}