aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/css/public.css28
-rw-r--r--apps/files_sharing/js/share.js4
-rw-r--r--apps/files_sharing/l10n/ca.php4
-rw-r--r--apps/files_sharing/l10n/pl.php4
-rw-r--r--apps/files_sharing/lib/cache.php80
-rw-r--r--apps/files_sharing/lib/updater.php7
6 files changed, 63 insertions, 64 deletions
diff --git a/apps/files_sharing/css/public.css b/apps/files_sharing/css/public.css
index 3e1dec9bbe1..801c27506f1 100644
--- a/apps/files_sharing/css/public.css
+++ b/apps/files_sharing/css/public.css
@@ -4,14 +4,14 @@ body {
#header {
background: #1d2d44 url('%webroot%/core/img/noise.png') repeat;
- height:2.5em;
+ height:32px;
left:0;
- line-height:2.5em;
+ line-height:32px;
position:fixed;
right:0;
top:0;
z-index:100;
- padding:.5em;
+ padding:7px;
}
#details {
@@ -24,13 +24,18 @@ body {
font-weight:700;
margin: 0 0.4em 0 0;
padding: 0 5px;
- height: 27px;
+ height: 32px;
float: left;
}
.header-right #details {
- margin-right: 2em;
+ margin-right: 28px;
+}
+
+.header-right {
+ padding: 0;
+ height: 32px;
}
#public_upload {
@@ -90,7 +95,7 @@ thead{
#data-upload-form {
position: relative;
right: 0;
- height: 27px;
+ height: 32px;
overflow: hidden;
padding: 0;
float: right;
@@ -109,27 +114,20 @@ thead{
width: 100% !important;
}
-#download span {
- position: relative;
- bottom: 3px;
-}
-
#publicUploadButtonMock {
position:relative;
display:block;
width:100%;
- height:27px;
+ height:32px;
cursor:pointer;
z-index:10;
background-image:url('%webroot%/core/img/actions/upload.svg');
background-repeat:no-repeat;
- background-position:7px 6px;
+ background-position:7px 8px;
}
#publicUploadButtonMock span {
margin: 0 5px 0 28px;
- position: relative;
- top: -2px;
color: #555;
}
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index 68f6f3ba76f..340e0939445 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -35,14 +35,14 @@ $(document).ready(function() {
if ($(tr).data('id') != $('#dropdown').attr('data-item-source')) {
OC.Share.hideDropDown(function () {
$(tr).addClass('mouseOver');
- OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
+ OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
});
} else {
OC.Share.hideDropDown();
}
} else {
$(tr).addClass('mouseOver');
- OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions);
+ OC.Share.showDropDown(itemType, $(tr).data('id'), appendTo, true, possiblePermissions, filename);
}
});
}
diff --git a/apps/files_sharing/l10n/ca.php b/apps/files_sharing/l10n/ca.php
index e5e5910f8cf..96e59992967 100644
--- a/apps/files_sharing/l10n/ca.php
+++ b/apps/files_sharing/l10n/ca.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Aquest compartit està protegit amb contrasenya",
"The password is wrong. Try again." => "la contrasenya és incorrecta. Intenteu-ho de nou.",
"Password" => "Contrasenya",
"Sorry, this link doesn’t seem to work anymore." => "Aquest enllaç sembla que no funciona.",
@@ -13,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Baixa",
"Upload" => "Puja",
"Cancel upload" => "Cancel·la la pujada",
-"No preview available for" => "No hi ha vista prèvia disponible per a"
+"No preview available for" => "No hi ha vista prèvia disponible per a",
+"Direct link" => "Enllaç directe"
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
diff --git a/apps/files_sharing/l10n/pl.php b/apps/files_sharing/l10n/pl.php
index 63d373917e5..4c7498ee1b7 100644
--- a/apps/files_sharing/l10n/pl.php
+++ b/apps/files_sharing/l10n/pl.php
@@ -1,5 +1,6 @@
<?php
$TRANSLATIONS = array(
+"This share is password-protected" => "Udział ten jest chroniony hasłem",
"The password is wrong. Try again." => "To hasło jest niewłaściwe. Spróbuj ponownie.",
"Password" => "Hasło",
"Sorry, this link doesn’t seem to work anymore." => "Przepraszamy ale wygląda na to, że ten link już nie działa.",
@@ -13,6 +14,7 @@ $TRANSLATIONS = array(
"Download" => "Pobierz",
"Upload" => "Wyślij",
"Cancel upload" => "Anuluj wysyłanie",
-"No preview available for" => "Podgląd nie jest dostępny dla"
+"No preview available for" => "Podgląd nie jest dostępny dla",
+"Direct link" => "Bezpośredni link"
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 123268e240a..6b66edcacc5 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -228,69 +228,73 @@ class Shared_Cache extends Cache {
*/
public function search($pattern) {
+ $where = '`name` LIKE ? AND ';
+
// normalize pattern
- $pattern = $this->normalize($pattern);
+ $value = $this->normalize($pattern);
- $ids = $this->getAll();
+ return $this->searchWithWhere($where, $value);
- $files = array();
-
- // divide into 1k chunks
- $chunks = array_chunk($ids, 1000);
-
- foreach ($chunks as $chunk) {
- $placeholders = join(',', array_fill(0, count($chunk), '?'));
-
- $sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
- `encrypted`, `unencrypted_size`, `etag`
- FROM `*PREFIX*filecache` WHERE `name` LIKE ? AND `fileid` IN (' . $placeholders . ')';
-
- $result = \OC_DB::executeAudited($sql, array_merge(array($pattern), $chunk));
-
- while ($row = $result->fetchRow()) {
- if (substr($row['path'], 0, 6)==='files/') {
- $row['path'] = substr($row['path'],6); // remove 'files/' from path as it's relative to '/Shared'
- }
- $row['mimetype'] = $this->getMimetype($row['mimetype']);
- $row['mimepart'] = $this->getMimetype($row['mimepart']);
- $files[] = $row;
- }
- }
- return $files;
}
/**
* search for files by mimetype
*
- * @param string $part1
- * @param string $part2
+ * @param string $mimetype
* @return array
*/
public function searchByMime($mimetype) {
+
if (strpos($mimetype, '/')) {
- $where = '`mimetype` = ?';
+ $where = '`mimetype` = ? AND ';
} else {
- $where = '`mimepart` = ?';
+ $where = '`mimepart` = ? AND ';
}
- $mimetype = $this->getMimetypeId($mimetype);
+
+ $value = $this->getMimetypeId($mimetype);
+
+ return $this->searchWithWhere($where, $value);
+
+ }
+
+ /**
+ * The maximum number of placeholders that can be used in an SQL query.
+ * Value MUST be <= 1000 for oracle:
+ * see ORA-01795 maximum number of expressions in a list is 1000
+ * FIXME we should get this from doctrine as other DBs allow a lot more placeholders
+ */
+ const MAX_SQL_CHUNK_SIZE = 1000;
+
+ /**
+ * search for files with a custom where clause and value
+ * the $wherevalue will be array_merge()d with the file id chunks
+ *
+ * @param string $sqlwhere
+ * @param string $wherevalue
+ * @return array
+ */
+ private function searchWithWhere($sqlwhere, $wherevalue, $chunksize = self::MAX_SQL_CHUNK_SIZE) {
+
$ids = $this->getAll();
$files = array();
- // divide into 1k chunks
- $chunks = array_chunk($ids, 1000);
+ // divide into chunks
+ $chunks = array_chunk($ids, $chunksize);
foreach ($chunks as $chunk) {
- $placeholders = join(',', array_fill(0, count($ids), '?'));
+ $placeholders = join(',', array_fill(0, count($chunk), '?'));
$sql = 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`,
`encrypted`, `unencrypted_size`, `etag`
- FROM `*PREFIX*filecache` WHERE ' . $where . ' AND `fileid` IN (' . $placeholders . ')';
+ FROM `*PREFIX*filecache` WHERE ' . $sqlwhere . ' `fileid` IN (' . $placeholders . ')';
- $result = \OC_DB::executeAudited($sql, array_merge(array($mimetype), $chunk));
+ $stmt = \OC_DB::prepare($sql);
+
+ $result = $stmt->execute(array_merge(array($wherevalue), $chunk));
while ($row = $result->fetchRow()) {
- if (substr($row['path'], 0, 6)==='files/') {
- $row['path'] = substr($row['path'],6); // remove 'files/' from path as it's relative to '/Shared'
+ if (substr($row['path'], 0, 6) === 'files/') {
+ $row['path'] = substr($row['path'], 6); // remove 'files/' from path as it's relative to '/Shared'
}
$row['mimetype'] = $this->getMimetype($row['mimetype']);
$row['mimepart'] = $this->getMimetype($row['mimepart']);
diff --git a/apps/files_sharing/lib/updater.php b/apps/files_sharing/lib/updater.php
index 3381f75f16d..171999ea652 100644
--- a/apps/files_sharing/lib/updater.php
+++ b/apps/files_sharing/lib/updater.php
@@ -49,13 +49,6 @@ class Shared_Updater {
}
$users = $reshareUsers;
}
- // Correct folders of shared file owner
- $target = substr($target, 8);
- if ($uidOwner !== $uid && $source = \OC_Share_Backend_File::getSource($target)) {
- \OC\Files\Filesystem::initMountPoints($uidOwner);
- $source = '/'.$uidOwner.'/'.$source['path'];
- \OC\Files\Cache\Updater::correctFolder($source, $info['mtime']);
- }
}
}