aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/l10n/el.php4
-rw-r--r--apps/files_sharing/l10n/eu.php4
-rw-r--r--apps/files_sharing/l10n/sl.php11
-rw-r--r--apps/files_sharing/lib/sharedstorage.php106
-rw-r--r--apps/files_sharing/public.php8
-rw-r--r--apps/files_sharing/templates/public.php1
6 files changed, 72 insertions, 62 deletions
diff --git a/apps/files_sharing/l10n/el.php b/apps/files_sharing/l10n/el.php
index 4584e261b01..79387a91472 100644
--- a/apps/files_sharing/l10n/el.php
+++ b/apps/files_sharing/l10n/el.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Αυτός ο κοινόχρηστος φάκελος προστατεύεται με κωδικό",
"The password is wrong. Try again." => "Εσφαλμένο συνθηματικό. Προσπαθήστε ξανά.",
"Password" => "Συνθηματικό",
"Sorry, this link doesn’t seem to work anymore." => "Συγγνώμη, αυτός ο σύνδεσμος μοιάζει να μην ισχύει πια.",
@@ -13,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Λήψη",
"Upload" => "Μεταφόρτωση",
"Cancel upload" => "Ακύρωση αποστολής",
-"No preview available for" => "Δεν υπάρχει διαθέσιμη προεπισκόπηση για"
+"No preview available for" => "Δεν υπάρχει διαθέσιμη προεπισκόπηση για",
+"Direct link" => "Άμεσος σύνδεσμος"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/eu.php b/apps/files_sharing/l10n/eu.php
index 91be195368a..20de5a085ab 100644
--- a/apps/files_sharing/l10n/eu.php
+++ b/apps/files_sharing/l10n/eu.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Elkarbanatutako hau pasahitzarekin babestuta dago",
"The password is wrong. Try again." => "Pasahitza ez da egokia. Saiatu berriro.",
"Password" => "Pasahitza",
"Sorry, this link doesn’t seem to work anymore." => "Barkatu, lotura ez dirudi eskuragarria dagoenik.",
@@ -13,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Deskargatu",
"Upload" => "Igo",
"Cancel upload" => "Ezeztatu igoera",
-"No preview available for" => "Ez dago aurrebista eskuragarririk hauentzat "
+"No preview available for" => "Ez dago aurrebista eskuragarririk hauentzat ",
+"Direct link" => "Lotura zuzena"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/sl.php b/apps/files_sharing/l10n/sl.php
index 58bbf87c19f..d5ef46e180e 100644
--- a/apps/files_sharing/l10n/sl.php
+++ b/apps/files_sharing/l10n/sl.php
@@ -1,11 +1,20 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "To mesto je zaščiteno z geslom.",
+"The password is wrong. Try again." => "Geslo je napačno. Poskusite znova.",
"Password" => "Geslo",
+"Sorry, this link doesn’t seem to work anymore." => "Povezava očitno ni več v uporabi.",
+"Reasons might be:" => "Vzrok je lahko:",
+"the item was removed" => "predmet je odstranjen,",
+"the link expired" => "povezava je pretekla,",
+"sharing is disabled" => "souporaba je onemogočena.",
+"For more info, please ask the person who sent this link." => "Za več podrobnosti stopite v stik s pošiljateljem te povezave.",
"%s shared the folder %s with you" => "Oseba %s je določila mapo %s za souporabo",
"%s shared the file %s with you" => "Oseba %s je določila datoteko %s za souporabo",
"Download" => "Prejmi",
"Upload" => "Pošlji",
"Cancel upload" => "Prekliči pošiljanje",
-"No preview available for" => "Predogled ni na voljo za"
+"No preview available for" => "Predogled ni na voljo za",
+"Direct link" => "Neposredna povezava"
);
$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 6141d832199..3116cd717fb 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -34,15 +34,15 @@ class Shared extends \OC\Files\Storage\Common {
$this->sharedFolder = $arguments['sharedFolder'];
}
- public function getId(){
+ public function getId() {
return 'shared::' . $this->sharedFolder;
}
/**
- * @brief Get the source file path, permissions, and owner for a shared file
- * @param string Shared target file path
- * @return Returns array with the keys path, permissions, and owner or false if not found
- */
+ * @brief Get the source file path, permissions, and owner for a shared file
+ * @param string Shared target file path
+ * @return Returns array with the keys path, permissions, and owner or false if not found
+ */
public function getFile($target) {
if (!isset($this->files[$target])) {
// Check for partial files
@@ -62,10 +62,10 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the source file path for a shared file
- * @param string Shared target file path
- * @return string source file path or false if not found
- */
+ * @brief Get the source file path for a shared file
+ * @param string Shared target file path
+ * @return string source file path or false if not found
+ */
public function getSourcePath($target) {
$source = $this->getFile($target);
if ($source) {
@@ -73,7 +73,7 @@ class Shared extends \OC\Files\Storage\Common {
\OC\Files\Filesystem::initMountPoints($source['fileOwner']);
$mount = \OC\Files\Filesystem::getMountByNumericId($source['storage']);
if (is_array($mount)) {
- $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint().$source['path'];
+ $this->files[$target]['fullPath'] = $mount[key($mount)]->getMountPoint() . $source['path'];
} else {
$this->files[$target]['fullPath'] = false;
}
@@ -84,10 +84,10 @@ class Shared extends \OC\Files\Storage\Common {
}
/**
- * @brief Get the permissions granted for a shared file
- * @param string Shared target file path
- * @return int CRUDS permissions granted or false if not found
- */
+ * @brief Get the permissions granted for a shared file
+ * @param string Shared target file path
+ * @return int CRUDS permissions granted or false if not found
+ */
public function getPermissions($target) {
$source = $this->getFile($target);
if ($source) {
@@ -222,7 +222,7 @@ class Shared extends \OC\Files\Storage\Common {
if ($path == '' || $path == '/') {
$mtime = 0;
$dh = $this->opendir($path);
- if(is_resource($dh)) {
+ if (is_resource($dh)) {
while (($filename = readdir($dh)) !== false) {
$tempmtime = $this->filemtime($filename);
if ($tempmtime > $mtime) {
@@ -244,7 +244,7 @@ class Shared extends \OC\Files\Storage\Common {
$source = $this->getSourcePath($path);
if ($source) {
$info = array(
- 'target' => $this->sharedFolder.$path,
+ 'target' => $this->sharedFolder . $path,
'source' => $source,
);
\OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_get_contents', $info);
@@ -257,13 +257,14 @@ class Shared extends \OC\Files\Storage\Common {
if ($source = $this->getSourcePath($path)) {
// Check if permission is granted
if (($this->file_exists($path) && !$this->isUpdatable($path))
- || ($this->is_dir($path) && !$this->isCreatable($path))) {
+ || ($this->is_dir($path) && !$this->isCreatable($path))
+ ) {
return false;
}
$info = array(
- 'target' => $this->sharedFolder.$path,
- 'source' => $source,
- );
+ 'target' => $this->sharedFolder . $path,
+ 'source' => $source,
+ );
\OCP\Util::emitHook('\OC\Files\Storage\Shared', 'file_put_contents', $info);
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
$result = $storage->file_put_contents($internalPath, $data);
@@ -304,31 +305,16 @@ class Shared extends \OC\Files\Storage\Common {
$pos1 = strpos($path1, '/', 1);
$pos2 = strpos($path2, '/', 1);
if ($pos1 !== false && $pos2 !== false && ($oldSource = $this->getSourcePath($path1))) {
- $newSource = $this->getSourcePath(dirname($path2)).'/'.basename($path2);
- if (dirname($path1) == dirname($path2)) {
- // Rename the file if UPDATE permission is granted
- if ($this->isUpdatable($path1)) {
- list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
- list( , $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
- return $storage->rename($oldInternalPath, $newInternalPath);
- }
- } else {
- // Move the file if DELETE and CREATE permissions are granted
- if ($this->isDeletable($path1) && $this->isCreatable(dirname($path2))) {
- // Get the root shared folder
- $folder1 = substr($path1, 0, $pos1);
- $folder2 = substr($path2, 0, $pos2);
- // Copy and unlink the file if it exists in a different shared folder
- if ($folder1 != $folder2) {
- if ($this->copy($path1, $path2)) {
- return $this->unlink($path1);
- }
- } else {
- list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
- list( , $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
- return $storage->rename($oldInternalPath, $newInternalPath);
- }
- }
+ $newSource = $this->getSourcePath(dirname($path2)) . '/' . basename($path2);
+ // Within the same folder, we only need UPDATE permissions
+ if (dirname($path1) == dirname($path2) and $this->isUpdatable($path1)) {
+ list($storage, $oldInternalPath) = \OC\Files\Filesystem::resolvePath($oldSource);
+ list(, $newInternalPath) = \OC\Files\Filesystem::resolvePath($newSource);
+ return $storage->rename($oldInternalPath, $newInternalPath);
+ // otherwise DELETE and CREATE permissions required
+ } elseif ($this->isDeletable($path1) && $this->isCreatable(dirname($path2))) {
+ $rootView = new \OC\Files\View('');
+ return $rootView->rename($oldSource, $newSource);
}
}
}
@@ -338,10 +324,10 @@ class Shared extends \OC\Files\Storage\Common {
public function copy($path1, $path2) {
// Copy the file if CREATE permission is granted
if ($this->isCreatable(dirname($path2))) {
- $source = $this->fopen($path1, 'r');
- $target = $this->fopen($path2, 'w');
- list ($count, $result) = \OC_Helper::streamCopy($source, $target);
- return $result;
+ $oldSource = $this->getSourcePath($path1);
+ $newSource = $this->getSourcePath(dirname($path2)) . '/' . basename($path2);
+ $rootView = new \OC\Files\View('');
+ return $rootView->copy($oldSource, $newSource);
}
return false;
}
@@ -363,16 +349,16 @@ class Shared extends \OC\Files\Storage\Common {
case 'xb':
case 'a':
case 'ab':
- $exists = $this->file_exists($path);
- if ($exists && !$this->isUpdatable($path)) {
- return false;
- }
- if (!$exists && !$this->isCreatable(dirname($path))) {
- return false;
- }
+ $exists = $this->file_exists($path);
+ if ($exists && !$this->isUpdatable($path)) {
+ return false;
+ }
+ if (!$exists && !$this->isCreatable(dirname($path))) {
+ return false;
+ }
}
$info = array(
- 'target' => $this->sharedFolder.$path,
+ 'target' => $this->sharedFolder . $path,
'source' => $source,
'mode' => $mode,
);
@@ -412,6 +398,7 @@ class Shared extends \OC\Files\Storage\Common {
}
return false;
}
+
public function touch($path, $mtime = null) {
if ($source = $this->getSourcePath($path)) {
list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($source);
@@ -422,11 +409,12 @@ class Shared extends \OC\Files\Storage\Common {
public static function setup($options) {
if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user']
- || \OCP\Share::getItemsSharedWith('file')) {
+ || \OCP\Share::getItemsSharedWith('file')
+ ) {
$user_dir = $options['user_dir'];
\OC\Files\Filesystem::mount('\OC\Files\Storage\Shared',
array('sharedFolder' => '/Shared'),
- $user_dir.'/Shared/');
+ $user_dir . '/Shared/');
}
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 6504de84386..3c902ea9a3a 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -149,6 +149,7 @@ if (isset($path)) {
$tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path));
$tmpl->assign('fileTarget', basename($linkItem['file_target']));
$tmpl->assign('dirToken', $linkItem['token']);
+ $tmpl->assign('sharingToken', $token);
$tmpl->assign('disableSharing', true);
$allowPublicUploadEnabled = (bool) ($linkItem['permissions'] & OCP\PERMISSION_CREATE);
if (\OCP\App::isEnabled('files_encryption')) {
@@ -220,6 +221,8 @@ if (isset($path)) {
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
$maxUploadFilesize=OCP\Util::maxUploadFilesize($path);
+ $fileHeader = (!isset($files) or count($files) > 0);
+ $emptyContent = ($allowPublicUploadEnabled and !$fileHeader);
$folder = new OCP\Template('files', 'index', '');
$folder->assign('fileList', $list->fetchPage());
$folder->assign('breadcrumb', $breadcrumbNav->fetchPage());
@@ -233,6 +236,11 @@ if (isset($path)) {
$folder->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
$folder->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
$folder->assign('usedSpacePercent', 0);
+ $folder->assign('fileHeader', $fileHeader);
+ $folder->assign('disableSharing', true);
+ $folder->assign('trash', false);
+ $folder->assign('emptyContent', $emptyContent);
+ $folder->assign('ajaxLoad', false);
$tmpl->assign('folder', $folder->fetchPage());
$maxInputFileSize = OCP\Config::getSystemValue('maxZipInputSize', OCP\Util::computerFileSize('800 MB'));
$allowZip = OCP\Config::getSystemValue('allowZipDownload', true)
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index ef4c1c433da..1d527dca8eb 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -6,6 +6,7 @@
<input type="hidden" id="isPublic" name="isPublic" value="1">
<input type="hidden" name="dir" value="<?php p($_['dir']) ?>" id="dir">
<input type="hidden" name="downloadURL" value="<?php p($_['downloadURL']) ?>" id="downloadURL">
+<input type="hidden" name="sharingToken" value="<?php p($_['sharingToken']) ?>" id="sharingToken">
<input type="hidden" name="filename" value="<?php p($_['filename']) ?>" id="filename">
<input type="hidden" name="mimetype" value="<?php p($_['mimetype']) ?>" id="mimetype">
<header><div id="header">