aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/l10n/zh_TW.php49
-rw-r--r--lib/private/files/cache/storage.php2
-rwxr-xr-xlib/private/preview.php4
-rw-r--r--lib/private/share/share.php77
4 files changed, 108 insertions, 24 deletions
diff --git a/lib/l10n/zh_TW.php b/lib/l10n/zh_TW.php
index d6a9d6fabfe..84cb621ce24 100644
--- a/lib/l10n/zh_TW.php
+++ b/lib/l10n/zh_TW.php
@@ -56,6 +56,25 @@ $TRANSLATIONS = array(
"You are not allowed to share %s" => "你不被允許分享 %s",
"Sharing %s failed, because the user %s is the item owner" => "分享 %s 失敗,因為 %s 才是此項目的擁有者",
"Sharing %s failed, because the user %s does not exist" => "分享 %s 失敗,因為使用者 %s 不存在",
+"Sharing %s failed, because the user %s is not a member of any groups that %s is a member of" => "分享 %s 失敗,使用者 %s 並不屬於該項目擁有者 %s 所隸屬的任何一個群組",
+"Sharing %s failed, because this item is already shared with %s" => "分享 %s 失敗,因為此項目目前已經與 %s 分享",
+"Sharing %s failed, because the group %s does not exist" => "分享 %s 失敗,因為群組 %s 不存在",
+"Sharing %s failed, because %s is not a member of the group %s" => "分享 %s 失敗,因為 %s 不是群組 %s 的一員",
+"You need to provide a password to create a public link, only protected links are allowed" => "您必須為公開連結設定一組密碼,我們只允許受密碼保護的連結",
+"Sharing %s failed, because sharing with links is not allowed" => "分享 %s 失敗,因為目前不允許使用連結分享",
+"Share type %s is not valid for %s" => "分享類型 %s 對於 %s 來說無效",
+"Setting permissions for %s failed, because the permissions exceed permissions granted to %s" => "為 %s 設定權限失敗,因為欲設定的權限超出開放給 %s 的範圍",
+"Setting permissions for %s failed, because the item was not found" => "為 %s 設定權限失敗,因為找不到該項目",
+"Cannot set expiration date. Shares cannot expire later than %s after they have been shared" => "無法設定到期日,在分享之後,到期日不能設定為 %s 之後",
+"Cannot set expiration date. Expiration date is in the past" => "無法設定過去的日期為到期日",
+"Sharing backend %s must implement the interface OCP\\Share_Backend" => "分享後端 %s 必須實作 OCP\\Share_Backend interface",
+"Sharing backend %s not found" => "找不到分享後端 %s",
+"Sharing backend for %s not found" => "找不到 %s 的分享後端",
+"Sharing %s failed, because the user %s is the original sharer" => "分享 %s 失敗,因為使用者 %s 即是原本的分享者",
+"Sharing %s failed, because the permissions exceed permissions granted to %s" => "分享 %s 失敗,因為權限設定超出了授權給 %s 的範圍",
+"Sharing %s failed, because resharing is not allowed" => "分享 %s 失敗,不允許重複分享",
+"Sharing %s failed, because the sharing backend for %s could not find its source" => "分享 %s 失敗,因為 %s 的分享後端找不到它的來源",
+"Sharing %s failed, because the file could not be found in the file cache" => "分享 %s 失敗,因為在快取中找不到該檔案",
"Could not find category \"%s\"" => "找不到分類:\"%s\"",
"seconds ago" => "幾秒前",
"_%n minute ago_::_%n minutes ago_" => array("%n 分鐘前"),
@@ -67,9 +86,37 @@ $TRANSLATIONS = array(
"_%n month ago_::_%n months ago_" => array("%n 個月前"),
"last year" => "去年",
"years ago" => "幾年前",
+"Only the following characters are allowed in a username: \"a-z\", \"A-Z\", \"0-9\", and \"_.@-\"" => "使用者名稱當中只能包含下列字元:\"a-z\", \"A-Z\", \"0-9\", 和 \"_.@-\"",
"A valid username must be provided" => "必須提供一個有效的用戶名",
"A valid password must be provided" => "一定要提供一個有效的密碼",
"The username is already being used" => "這個使用者名稱已經有人使用了",
-"No database drivers (sqlite, mysql, or postgresql) installed." => "沒有安裝資料庫驅動程式 (sqlite, mysql, 或 postgresql)"
+"No database drivers (sqlite, mysql, or postgresql) installed." => "沒有安裝資料庫驅動程式 (sqlite, mysql, 或 postgresql)",
+"Permissions can usually be fixed by %sgiving the webserver write access to the root directory%s." => "通常藉由%s開放網頁伺服器對根目錄的權限%s就可以修正權限問題",
+"Cannot write into \"config\" directory" => "無法寫入 config 目錄",
+"Cannot write into \"apps\" directory" => "無法寫入 apps 目錄",
+"This can usually be fixed by %sgiving the webserver write access to the apps directory%s or disabling the appstore in the config file." => "通常藉由%s開放網頁伺服器對 apps 目錄的權限%s或是在設定檔中關閉 appstore 就可以修正這個問題",
+"Cannot create \"data\" directory (%s)" => "無法建立 data 目錄 (%s)",
+"This can usually be fixed by <a href=\"%s\" target=\"_blank\">giving the webserver write access to the root directory</a>." => "通常藉由<a href=\"%s\" target=\"_blank\">開放網頁伺服器對根目錄的權限</a>就可以修正權限問題",
+"Setting locale to %s failed" => "設定語系為 %s 失敗",
+"Please install one of these locales on your system and restart your webserver." => "請在系統中安裝這些語系的其中一個,然後重啓網頁伺服器",
+"Please ask your server administrator to install the module." => "請詢問系統管理員來安裝這些模組",
+"PHP module %s not installed." => "未安裝 PHP 模組 %s",
+"PHP %s or higher is required." => "需要 PHP %s 或更高版本",
+"Please ask your server administrator to update PHP to the latest version. Your PHP version is no longer supported by ownCloud and the PHP community." => "請詢問系統管理員將 PHP 升級至最新版,目前的 PHP 版本已經不再被 ownCloud 和 PHP 社群支援",
+"PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly." => "PHP 安全模式已經啟動,ownCloud 需要您將它關閉才能正常運作",
+"PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "PHP 安全模式已經被棄用,並且在大多數狀況下無助於提升安全性,它應該被關閉。請詢問系統管理員將其在 php.ini 或網頁伺服器當中關閉。",
+"Magic Quotes is enabled. ownCloud requires that it is disabled to work properly." => "Magic Quotes 已經被啟用,ownCloud 需要您將其關閉以正常運作",
+"Magic Quotes is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config." => "Magic Quotes 功能在大多數狀況下不會使用到,已經被上游棄用,因此它應該被停用。請詢問系統管理員將其在 php.ini 或網頁伺服器當中停用。",
+"PHP modules have been installed, but they are still listed as missing?" => "你已經安裝了指定的 PHP 模組,可是還是顯示為找不到嗎?",
+"Please ask your server administrator to restart the web server." => "請聯絡您的系統管理員重新啟動網頁伺服器",
+"PostgreSQL >= 9 required" => "需要 PostgreSQL 版本 >= 9",
+"Please upgrade your database version" => "請升級您的資料庫版本",
+"Error occurred while checking PostgreSQL version" => "檢查 PostgreSQL 版本時發生錯誤",
+"Please make sure you have PostgreSQL >= 9 or check the logs for more information about the error" => "請確定您的 PostgreSQL 版本 >= 9,或是看看記錄檔是否有更詳細的訊息",
+"Please change the permissions to 0770 so that the directory cannot be listed by other users." => "請將該目錄權限設定為 0770 ,以免其他使用者讀取",
+"Data directory (%s) is readable by other users" => "資料目錄 (%s) 可以被其他使用者讀取",
+"Data directory (%s) is invalid" => "資料目錄 (%s) 無效",
+"Please check that the data directory contains a file \".ocdata\" in its root." => "請確保資料目錄當中包含一個 .ocdata 的檔案",
+"Could not obtain lock type %d on \"%s\"." => "無法取得鎖定:類型 %d ,檔案 %s"
);
$PLURAL_FORMS = "nplurals=1; plural=0;";
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index a38656d8499..d7d57811a7d 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -105,10 +105,10 @@ class Storage {
*/
public static function remove($storageId) {
$storageId = self::adjustStorageId($storageId);
+ $numericId = self::getNumericStorageId($storageId);
$sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
\OC_DB::executeAudited($sql, array($storageId));
- $numericId = self::getNumericStorageId($storageId);
if (!is_null($numericId)) {
$sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
\OC_DB::executeAudited($sql, array($numericId));
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 4b21e324037..e9bfb3b9285 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -814,9 +814,7 @@ class Preview {
self::initProviders();
}
- //remove last element because it has the mimetype *
- $providers = array_slice(self::$providers, 0, -1);
- foreach ($providers as $supportedMimeType => $provider) {
+ foreach (self::$providers as $supportedMimeType => $provider) {
if (preg_match($supportedMimeType, $mimeType)) {
return true;
}
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index d861f0510e4..5314e09b8de 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -293,10 +293,20 @@ class Share extends \OC\Share\Constants {
public static function getItemSharedWithUser($itemType, $itemSource, $user) {
$shares = array();
+ $fileDependend = false;
- $column = ($itemType === 'file' || $itemType === 'folder') ? 'file_source' : 'item_source';
+ if ($itemType === 'file' || $itemType === 'folder') {
+ $fileDependend = true;
+ $column = 'file_source';
+ $where = 'INNER JOIN `*PREFIX*filecache` ON `file_source` = `*PREFIX*filecache`.`fileid` WHERE';
+ } else {
+ $column = 'item_source';
+ $where = 'WHERE';
+ }
+
+ $select = self::createSelectStatement(self::FORMAT_NONE, $fileDependend);
- $where = ' `' . $column . '` = ? AND `item_type` = ? ';
+ $where .= ' `' . $column . '` = ? AND `item_type` = ? ';
$arguments = array($itemSource, $itemType);
// for link shares $user === null
if ($user !== null) {
@@ -304,13 +314,7 @@ class Share extends \OC\Share\Constants {
$arguments[] = $user;
}
- // first check if there is a db entry for the specific user
- $query = \OC_DB::prepare(
- 'SELECT *
- FROM
- `*PREFIX*share`
- WHERE' . $where
- );
+ $query = \OC_DB::prepare('SELECT ' . $select . ' FROM `*PREFIX*share` '. $where);
$result = \OC_DB::executeAudited($query, $arguments);
@@ -323,7 +327,7 @@ class Share extends \OC\Share\Constants {
$groups = \OC_Group::getUserGroups($user);
$query = \OC_DB::prepare(
- 'SELECT `file_target`, `permissions`, `expiration`
+ 'SELECT *
FROM
`*PREFIX*share`
WHERE
@@ -1296,7 +1300,7 @@ class Share extends \OC\Share\Constants {
}
if (isset($item)) {
$collectionTypes = self::getCollectionItemTypes($itemType);
- if ($includeCollections && $collectionTypes) {
+ if ($includeCollections && $collectionTypes && !in_array('folder', $collectionTypes)) {
$where .= ' AND (';
} else {
$where .= ' AND';
@@ -1320,7 +1324,7 @@ class Share extends \OC\Share\Constants {
}
}
$queryArgs[] = $item;
- if ($includeCollections && $collectionTypes) {
+ if ($includeCollections && $collectionTypes && !in_array('folder', $collectionTypes)) {
$placeholders = join(',', array_fill(0, count($collectionTypes), '?'));
$where .= ' OR `item_type` IN ('.$placeholders.'))';
$queryArgs = array_merge($queryArgs, $collectionTypes);
@@ -1434,7 +1438,7 @@ class Share extends \OC\Share\Constants {
$mounts[$row['storage']] = current($mountPoints);
}
}
- if ($mounts[$row['storage']]) {
+ if (!empty($mounts[$row['storage']])) {
$path = $mounts[$row['storage']]->getMountPoint().$row['path'];
$relPath = substr($path, $root); // path relative to data/user
$row['path'] = rtrim($relPath, '/');
@@ -1482,7 +1486,7 @@ class Share extends \OC\Share\Constants {
}
}
// Check if this is a collection of the requested item type
- if ($includeCollections && $collectionTypes && in_array($row['item_type'], $collectionTypes)) {
+ if ($includeCollections && $collectionTypes && $row['item_type'] !== 'folder' && in_array($row['item_type'], $collectionTypes)) {
if (($collectionBackend = self::getBackend($row['item_type']))
&& $collectionBackend instanceof \OCP\Share_Backend_Collection) {
// Collections can be inside collections, check if the item is a collection
@@ -1542,6 +1546,15 @@ class Share extends \OC\Share\Constants {
$toRemove = $switchedItems[$toRemove];
}
unset($items[$toRemove]);
+ } elseif ($includeCollections && $collectionTypes && in_array($row['item_type'], $collectionTypes)) {
+ // FIXME: Thats a dirty hack to improve file sharing performance,
+ // see github issue #10588 for more details
+ // Need to find a solution which works for all back-ends
+ $collectionBackend = self::getBackend($row['item_type']);
+ $sharedParents = $collectionBackend->getParents($row['item_source']);
+ foreach ($sharedParents as $parent) {
+ $collectionItems[] = $parent;
+ }
}
}
if (!empty($collectionItems)) {
@@ -1549,6 +1562,20 @@ class Share extends \OC\Share\Constants {
}
return self::formatResult($items, $column, $backend, $format, $parameters);
+ } elseif ($includeCollections && $collectionTypes && in_array('folder', $collectionTypes)) {
+ // FIXME: Thats a dirty hack to improve file sharing performance,
+ // see github issue #10588 for more details
+ // Need to find a solution which works for all back-ends
+ $collectionItems = array();
+ $collectionBackend = self::getBackend('folder');
+ $sharedParents = $collectionBackend->getParents($item, $shareWith);
+ foreach ($sharedParents as $parent) {
+ $collectionItems[] = $parent;
+ }
+ if ($limit === 1) {
+ return reset($collectionItems);
+ }
+ return self::formatResult($collectionItems, $column, $backend, $format, $parameters);
}
return array();
@@ -1804,6 +1831,8 @@ class Share extends \OC\Share\Constants {
$l = \OC::$server->getL10N('lib');
$result = array();
+ $column = ($itemType === 'file' || $itemType === 'folder') ? 'file_source' : 'item_source';
+
$checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true);
if ($checkReshare) {
// Check if attempting to share back to owner
@@ -1826,12 +1855,22 @@ class Share extends \OC\Share\Constants {
} else {
// TODO Don't check if inside folder
$result['parent'] = $checkReshare['id'];
- $result['itemSource'] = $checkReshare['item_source'];
- $result['fileSource'] = $checkReshare['file_source'];
- $result['suggestedItemTarget'] = $checkReshare['item_target'];
- $result['suggestedFileTarget'] = $checkReshare['file_target'];
- $result['filePath'] = $checkReshare['file_target'];
$result['expirationDate'] = min($expirationDate, $checkReshare['expiration']);
+ // only suggest the same name as new target if it is a reshare of the
+ // same file/folder and not the reshare of a child
+ if ($checkReshare[$column] === $itemSource) {
+ $result['filePath'] = $checkReshare['file_target'];
+ $result['itemSource'] = $checkReshare['item_source'];
+ $result['fileSource'] = $checkReshare['file_source'];
+ $result['suggestedItemTarget'] = $checkReshare['item_target'];
+ $result['suggestedFileTarget'] = $checkReshare['file_target'];
+ } else {
+ $result['filePath'] = ($backend instanceof \OCP\Share_Backend_File_Dependent) ? $backend->getFilePath($itemSource, $uidOwner) : null;
+ $result['suggestedItemTarget'] = null;
+ $result['suggestedFileTarget'] = null;
+ $result['itemSource'] = $itemSource;
+ $result['fileSource'] = ($backend instanceof \OCP\Share_Backend_File_Dependent) ? $itemSource : null;
+ }
}
} else {
$message = 'Sharing %s failed, because resharing is not allowed';