Compare commits
455 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 5ac339b866 | |||
| 95c90ddbc4 | |||
| 2417c8a49e | |||
| 26d0adf2fe | |||
| 734fdbddea | |||
| 33144941a9 | |||
| f309920bef | |||
| e78a309111 | |||
| 46a4ad4f3c | |||
| 3842c0d766 | |||
| 8369c1f05b | |||
| cadf1c232e | |||
| 713651738c | |||
| 1475245465 | |||
| 281bbf4bd4 | |||
| a2bbbb1448 | |||
| 87a28957aa | |||
| 01de6c565a | |||
| f3e341edac | |||
| c5d6af3c5a | |||
| cc1577054d | |||
| 3e6b18b2d0 | |||
| 7eb505e6dd | |||
| 91ca1cf985 | |||
| f8a4bcdd50 | |||
| 418d401bf9 | |||
| d0afd774b7 | |||
| 0af65cae37 | |||
| 4d50fe5f12 | |||
| f24aca61a9 | |||
| d3e2226b38 | |||
| 73fa6259be | |||
| dffc2a8b1c | |||
| fd634fdec8 | |||
| 328ebaefde | |||
| 4de8c4e5db | |||
| 8dc3cb2ffb | |||
| c67ece0f6b | |||
| 6640e120b7 | |||
| 6f7b394d99 | |||
| 91f47645b0 | |||
| 18903cc8f7 | |||
| 7e467484a8 | |||
| 21bf6abd41 | |||
| 401728b2a2 | |||
| bfd0dc3314 | |||
| ad92b12559 | |||
| 4391992b8c | |||
| 728e6d735a | |||
| 66df8c3bb3 | |||
| ca08d21da0 | |||
| 7d0f458f11 | |||
| f15aeb3bbc | |||
| 9333244925 | |||
| 50f5ab8515 | |||
| 4df0d2e7e8 | |||
| f2e17a0b68 | |||
| e372971f2b | |||
| 3bf30377b8 | |||
| 67b67b6d66 | |||
| b8390f15d4 | |||
| 5ac3f9bfa5 | |||
| 02fe013d2f | |||
| 5e5e4fe3a4 | |||
| d49e4e53fd | |||
| 2d11290121 | |||
| 1a197292da | |||
| 3b59979746 | |||
| 259d619af3 | |||
| c2e83e635d | |||
| 832be7c908 | |||
| c2b11cae83 | |||
| efbf18652c | |||
| baa587fd3c | |||
| 338a55e36c | |||
| 1b18c5a047 | |||
| 3c62de90fd | |||
| 0d464421ed | |||
| 80d2371f97 | |||
| 2ec085b51f | |||
| 7ca0de9bd3 | |||
| d69243ee51 | |||
| 1dc931b778 | |||
| a03ba06dcd | |||
| 0b698e6901 | |||
| 41a1a32e5a | |||
| 0cbe9d79ba | |||
| 587fc1aff3 | |||
| b3724cd9c6 | |||
| 348706854c | |||
| 466ed01e5d | |||
| bdfef554c4 | |||
| bef5108218 | |||
| 863aedf784 | |||
| eeb31420fe | |||
| f723bf744a | |||
| 3a31f7eb4a | |||
| 603613e6e6 | |||
| b87e88b48a | |||
| eaedda2116 | |||
| ee78d48186 | |||
| da1a89fd15 | |||
| f361036cf8 | |||
| dab3629ff5 | |||
| 30b2ed588b | |||
| 84f3dd15a6 | |||
| 6c16d45dc7 | |||
| d2567129a1 | |||
| 69a3327f47 | |||
| a1d2f0f516 | |||
| 24a08c686d | |||
| f23d641b82 | |||
| efe7c4075a | |||
| bc64931cd0 | |||
| 54b24ca88d | |||
| 55d7cf8ffd | |||
| d9729168f9 | |||
| 0219b8b3b9 | |||
| e0924a5f07 | |||
| 68f610a90e | |||
| 43b1cf7988 | |||
| 885d04bc86 | |||
| 5295993144 | |||
| 34a8c3c4cd | |||
| f94180a996 | |||
| aee7781f22 | |||
| 39f9e16f20 | |||
| 4a78f12682 | |||
| d2840a045d | |||
| 1536c7ea58 | |||
| 6deda1b9f6 | |||
| 6b3b3d8af4 | |||
| 1065c33543 | |||
| 40231c08cf | |||
| 41c6752030 | |||
| 3360719bbf | |||
| f9f123c6f6 | |||
| 457a7d4baa | |||
| c47e46fda0 | |||
| 060e0ad0cd | |||
| 9fb71af988 | |||
| 5b7b053634 | |||
| 7f2bdb0e97 | |||
| 7f3b178d73 | |||
| a81909097c | |||
| 7755e69af0 | |||
| b910524acb | |||
| 34704eded6 | |||
| af46d99730 | |||
| 3456109916 | |||
| 8506d2bf42 | |||
| 7c88736292 | |||
| 2d822e3b95 | |||
| 4fbc2774ef | |||
| 0013e2e6a8 | |||
| 68986f5272 | |||
| 2714a22ba8 | |||
| ab773650cd | |||
| bc77ba1d4c | |||
| 8cde5e80f6 | |||
| f4031d4320 | |||
| 035199acab | |||
| 5450d166b0 | |||
| 466e8985a8 | |||
| 4f15282bc9 | |||
| 43f0e30315 | |||
| 790155e574 | |||
| 46e32b08c0 | |||
| 6da5b05176 | |||
| d083108e72 | |||
| ea26282493 | |||
| 421a1e69dc | |||
| 33e77d34f4 | |||
| ad603388ca | |||
| 7240d349da | |||
| 1fef97f6a5 | |||
| 7d1f67b7a9 | |||
| a018dacac2 | |||
| e2ca88af5e | |||
| c7e1fe50c2 | |||
| 52941341fd | |||
| fb7aa2f014 | |||
| d9a98b126e | |||
| 30e086fb53 | |||
| 81f6be92ef | |||
| 2653d914d9 | |||
| dbd8128c07 | |||
| 2a93720f3f | |||
| 10d84f6e9b | |||
| eca9f69282 | |||
| 16ce56553c | |||
| a48fc120d0 | |||
| 5cb1ce4a28 | |||
| 5d2299eab8 | |||
| 69518b9013 | |||
| 712b47757a | |||
| 2556647a10 | |||
| e102eec89a | |||
| 62afe7fe7a | |||
| 06df3822a0 | |||
| 3bbaba1eca | |||
| a330b2ef9b | |||
| 7c81ac3d28 | |||
| 9fb1da2811 | |||
| 0617e06f69 | |||
| 35a6ad255d | |||
| dc67c7efa9 | |||
| faf14b4c79 | |||
| 46dff0677d | |||
| 8974107b4e | |||
| d6fb2afa85 | |||
| 5310a5924b | |||
| d7d7d9b8e3 | |||
| 03375d6c52 | |||
| 3955388f20 | |||
| 9fbccc83e3 | |||
| 844b4785f1 | |||
| 4626fae882 | |||
| c3e34676ba | |||
| af7118aa5d | |||
| 944d4156bf | |||
| abe63bd329 | |||
| fc1d897ea5 | |||
| 4b67d4258d | |||
| a42d152ac3 | |||
| 1fdd2ac7ee | |||
| a5bfa6b1c3 | |||
| 4dc35909b5 | |||
| f8fcd567a7 | |||
| b3e7e54c8d | |||
| 4e0fa85307 | |||
| bc8cc9142e | |||
| 019f3299b0 | |||
| a609a53647 | |||
| 1bcb04f94e | |||
| 27cc333dfe | |||
| a324c09e6c | |||
| 71c1327691 | |||
| b9fed935b4 | |||
| 248eed16a6 | |||
| 31d0ba0344 | |||
| a0a665ea45 | |||
| 7f47cc062c | |||
| 2d2af90fce | |||
| b7ddc78626 | |||
| d3bfb433d1 | |||
| 317d421874 | |||
| d88025bf6b | |||
| 993fea2f05 | |||
| 1b0c5e57e5 | |||
| de2b444030 | |||
| 15f7315231 | |||
| f1f172e16e | |||
| 49038545f8 | |||
| 9c4b8ae54c | |||
| b82146eeee | |||
| 60e2ee631a | |||
| 1a69079139 | |||
| 2a465fb20f | |||
| a2d4cd87d0 | |||
| 45db67d174 | |||
| f6df4b349f | |||
| 228f1788fa | |||
| 229630f14c | |||
| 6229f457d0 | |||
| 77bb168007 | |||
| 22e39baf77 | |||
| a11192bab3 | |||
| 2ce850f7db | |||
| aef34618de | |||
| ba0e09adce | |||
| d9347f2c9b | |||
| 6085878966 | |||
| 2d947835b9 | |||
| c62cce8269 | |||
| a49e873d3f | |||
| aeefe48cba | |||
| acf74b24f2 | |||
| ae6610f0ea | |||
| 3b904647b0 | |||
| c67b8f2b22 | |||
| 2cc0c90015 | |||
| 7e4f50d4e3 | |||
| c05177b25b | |||
| 6fdce3b7e9 | |||
| 8ccac86c98 | |||
| 54f0deff2a | |||
| c503588827 | |||
| 2f73db12bb | |||
| 92c8672c0f | |||
| 3488f0b77a | |||
| 14e7075030 | |||
| c22019dec5 | |||
| 60cfdae503 | |||
| f94a6eb166 | |||
| 00071401d7 | |||
| aa5d5a422f | |||
| 3b48d23478 | |||
| 476d8e6de0 | |||
| 0b2c9b823c | |||
| 4a2f9636cf | |||
| 39cbdca429 | |||
| 5d9731cef2 | |||
| 6443e570c2 | |||
| d0265f3388 | |||
| d2e6f7d979 | |||
| 3e1ade4397 | |||
| 418a9b11c4 | |||
| 14ad1ebf53 | |||
| cd1cf58875 | |||
| a20c6049c3 | |||
| bd50ed0ded | |||
| 69e8e7dbd5 | |||
| 9d16353e09 | |||
| 356eef0739 | |||
| c9646ddc4c | |||
| dd5e1092c7 | |||
| 87f2696e6a | |||
| c7dc6dc2c2 | |||
| 009bbef17e | |||
| 16b484209c | |||
| 18c80e47b6 | |||
| 391f267d38 | |||
| 19af45c7d1 | |||
| 2b361ea085 | |||
| f2fe47bc21 | |||
| 02b92137b3 | |||
| b27fc42e1f | |||
| 318db64b2d | |||
| b9c18d16fe | |||
| e11afd3066 | |||
| c2ccf4a6b3 | |||
| e26500045f | |||
| c5cb4206f5 | |||
| 5de5c317c1 | |||
| a88aec8a5c | |||
| 8f33286b19 | |||
| c221e8272c | |||
| fe44024868 | |||
| 51a8172868 | |||
| ce1318c9f1 | |||
| a0d570b4cc | |||
| b4e7258a04 | |||
| 30b8f4ec8e | |||
| 726a202cdb | |||
| f3e2a63712 | |||
| caf486d6e7 | |||
| 0c24c7c420 | |||
| ff9ecc8a51 | |||
| 8bc339413b | |||
| 93ff86e31f | |||
| b823505bd1 | |||
| 5f6f78ee03 | |||
| 5b6d1d79d0 | |||
| 8ab40f1959 | |||
| a7962faa56 | |||
| c309067c81 | |||
| b55a66187c | |||
| 4a0d295e4a | |||
| cdc72ddd8d | |||
| 3e2fd9942b | |||
| 614e4d485c | |||
| b51d405852 | |||
| b678766c7d | |||
| 5da2929180 | |||
| c8cf3320a4 | |||
| 463b054530 | |||
| f2d18867af | |||
| 8dd50dc9a6 | |||
| 44c2f9aad2 | |||
| d306f5c4cf | |||
| a2e3821b87 | |||
| 7e6f3817d0 | |||
| 385a296864 | |||
| e5994f9c1a | |||
| 7f3d717037 | |||
| 82f30d37ca | |||
| c3746e866a | |||
| 3e2d4c1bc1 | |||
| 68f278025c | |||
| cb968c77d1 | |||
| 3ad546002f | |||
| 6355af162c | |||
| f36ee69855 | |||
| 11425d142d | |||
| fa44c699f7 | |||
| 368342a085 | |||
| f9a64d2b27 | |||
| 630e46f60a | |||
| bcf56b0407 | |||
| 16dce51917 | |||
| 54364f172e | |||
| 1e863cd959 | |||
| 49e9f771ff | |||
| 926b274200 | |||
| 6ef39931cb | |||
| 57a3141cb1 | |||
| 617dc0e468 | |||
| ecc7b01cee | |||
| 2bb4c266a6 | |||
| 98c9334175 | |||
| faa08da944 | |||
| 447e468d1a | |||
| 29e9f2833d | |||
| bd3ead0d31 | |||
| ca675d7b08 | |||
| 7e63722534 | |||
| d9ab964ff9 | |||
| 19e03ef77f | |||
| f670d74634 | |||
| 55355ba28e | |||
| 008c3b80d6 | |||
| c06d8bb007 | |||
| 2624a6cb32 | |||
| 2df3763675 | |||
| 1449437c9e | |||
| bb182bbfb2 | |||
| ca5c39a3a1 | |||
| 5a2d700866 | |||
| a39f3fdbf9 | |||
| 790055571d | |||
| b06682b7fb | |||
| 00944a376a | |||
| 959513fdc8 | |||
| f19caeed33 | |||
| 8d0d0836ba | |||
| cd4a816c11 | |||
| 84a882c651 | |||
| 7a61dcadd2 | |||
| 4ee296051b | |||
| 222fa88eec | |||
| 17e45e2002 | |||
| ec51825d31 | |||
| dd0ebcede2 | |||
| e2fb8d7128 | |||
| 894856ce01 | |||
| abc428916c | |||
| 53f17a71d1 | |||
| 4b01eaf6cc | |||
| 9c1c8d57f0 | |||
| 95b3eb2c75 | |||
| 80c8666d3a | |||
| dcca887f18 | |||
| c5cd0b2d26 | |||
| 99ee95d46c | |||
| b278356eb9 | |||
| df288605d4 | |||
| a6d8854d2a | |||
| 4b5083e3ca | |||
| 0c6af55112 | |||
| bcd776b0c0 | |||
| 4ac05e071a | |||
| 507325dd50 | |||
| fc040755c1 | |||
| c737b521ab |
@@ -10,7 +10,7 @@ OCP\JSON::checkLoggedIn();
|
||||
|
||||
// Load the files
|
||||
$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
|
||||
|
||||
$dir = \OC\Files\Filesystem::normalizePath($dir);
|
||||
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
|
||||
header("HTTP/1.0 404 Not Found");
|
||||
exit();
|
||||
|
||||
@@ -14,10 +14,11 @@
|
||||
padding: 0 !important; /* override default control bar button padding */
|
||||
}
|
||||
#trash {
|
||||
margin-right: 12px;
|
||||
margin-right: 8px;
|
||||
float: right;
|
||||
z-index: 1010;
|
||||
padding: 10px;
|
||||
font-weight: normal;
|
||||
}
|
||||
#new>a {
|
||||
padding: 14px 10px;
|
||||
@@ -64,6 +65,9 @@
|
||||
top: 44px;
|
||||
width: 100%;
|
||||
}
|
||||
#filestable, #controls {
|
||||
min-width: 680px;
|
||||
}
|
||||
#filestable tbody tr { background-color:#fff; height:2.5em; }
|
||||
#filestable tbody tr:hover, tbody tr:active {
|
||||
background-color: rgb(240,240,240);
|
||||
|
||||
@@ -36,6 +36,7 @@ OCP\Util::addscript('files', 'filelist');
|
||||
OCP\App::setActiveNavigationEntry('files_index');
|
||||
// Load the files
|
||||
$dir = isset($_GET['dir']) ? stripslashes($_GET['dir']) : '';
|
||||
$dir = \OC\Files\Filesystem::normalizePath($dir);
|
||||
// Redirect if directory does not exist
|
||||
if (!\OC\Files\Filesystem::is_dir($dir . '/')) {
|
||||
header('Location: ' . OCP\Util::getScriptName() . '');
|
||||
@@ -107,7 +108,6 @@ if ($needUpgrade) {
|
||||
// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
|
||||
$encryptionInitStatus = 2;
|
||||
if (OC_App::isEnabled('files_encryption')) {
|
||||
$publicUploadEnabled = 'no';
|
||||
$session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
|
||||
$encryptionInitStatus = $session->getInitialized();
|
||||
}
|
||||
@@ -128,7 +128,7 @@ if ($needUpgrade) {
|
||||
$tmpl = new OCP\Template('files', 'index', 'user');
|
||||
$tmpl->assign('fileList', $list->fetchPage());
|
||||
$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
|
||||
$tmpl->assign('dir', \OC\Files\Filesystem::normalizePath($dir));
|
||||
$tmpl->assign('dir', $dir);
|
||||
$tmpl->assign('isCreatable', $isCreatable);
|
||||
$tmpl->assign('permissions', $permissions);
|
||||
$tmpl->assign('files', $files);
|
||||
|
||||
@@ -508,11 +508,15 @@ $(document).ready(function() {
|
||||
$(this).children('p').remove();
|
||||
|
||||
// add input field
|
||||
var form=$('<form></form>');
|
||||
var input=$('<input type="text">');
|
||||
var form = $('<form></form>');
|
||||
var input = $('<input type="text">');
|
||||
var newName = $(this).attr('data-newname') || '';
|
||||
if (newName) {
|
||||
input.val(newName);
|
||||
}
|
||||
form.append(input);
|
||||
$(this).append(form);
|
||||
|
||||
var lastPos;
|
||||
var checkInput = function () {
|
||||
var filename = input.val();
|
||||
if (type === 'web' && filename.length === 0) {
|
||||
@@ -543,6 +547,12 @@ $(document).ready(function() {
|
||||
});
|
||||
|
||||
input.focus();
|
||||
// pre select name up to the extension
|
||||
lastPos = newName.lastIndexOf('.');
|
||||
if (lastPos === -1) {
|
||||
lastPos = newName.length;
|
||||
}
|
||||
input.selectRange(0, lastPos);
|
||||
form.submit(function(event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
@@ -422,12 +422,27 @@ var FileList={
|
||||
}
|
||||
tr.find('.fileactions').effect('highlight', {}, 5000);
|
||||
tr.effect('highlight', {}, 5000);
|
||||
// remove loading mark and recover old image
|
||||
td.css('background-image', oldBackgroundImage);
|
||||
}
|
||||
else {
|
||||
var fileInfo = result.data;
|
||||
tr.attr('data-mime', fileInfo.mime);
|
||||
tr.attr('data-etag', fileInfo.etag);
|
||||
if (fileInfo.isPreviewAvailable) {
|
||||
Files.lazyLoadPreview(fileInfo.directory + '/' + fileInfo.name, result.data.mime, function(previewpath) {
|
||||
tr.find('td.filename').attr('style','background-image:url('+previewpath+')');
|
||||
}, null, null, result.data.etag);
|
||||
}
|
||||
else {
|
||||
tr.find('td.filename').removeClass('preview').attr('style','background-image:url('+fileInfo.icon+')');
|
||||
}
|
||||
}
|
||||
// reinsert row
|
||||
tr.detach();
|
||||
FileList.insertElement( tr.attr('data-file'), tr.attr('data-type'),tr );
|
||||
// remove loading mark and recover old image
|
||||
td.css('background-image', oldBackgroundImage);
|
||||
// update file actions in case the extension changed
|
||||
FileActions.display( tr.find('td.filename'), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -569,8 +584,18 @@ var FileList={
|
||||
FileList.updateEmptyContent();
|
||||
Files.updateStorageStatistics();
|
||||
} else {
|
||||
if (result.status === 'error' && result.data.message) {
|
||||
OC.Notification.show(result.data.message);
|
||||
}
|
||||
else {
|
||||
OC.Notification.show(t('files', 'Error deleting file.'));
|
||||
}
|
||||
// hide notification after 10 sec
|
||||
setTimeout(function() {
|
||||
OC.Notification.hide();
|
||||
}, 10000);
|
||||
$.each(files,function(index,file) {
|
||||
var deleteAction = $('tr[data-file="'+files[i]+'"]').children("td.date").children(".action.delete");
|
||||
var deleteAction = $('tr[data-file="' + file + '"] .action.delete');
|
||||
deleteAction.removeClass('progress-icon').addClass('delete-icon');
|
||||
});
|
||||
}
|
||||
@@ -598,7 +623,7 @@ var FileList={
|
||||
var fileSize = '<td class="filesize">'+humanFileSize(summary.totalSize)+'</td>';
|
||||
}
|
||||
|
||||
var $summary = $('<tr class="summary"><td><span class="info">'+info+'</span></td>'+fileSize+'<td></td></tr>');
|
||||
var $summary = $('<tr class="summary" data-file="undefined"><td><span class="info">'+info+'</span></td>'+fileSize+'<td></td></tr>');
|
||||
$('#fileList').append($summary);
|
||||
|
||||
var $dirInfo = $summary.find('.dirinfo');
|
||||
@@ -681,8 +706,9 @@ var FileList={
|
||||
var $fileList = $('#fileList');
|
||||
var permissions = $('#permissions').val();
|
||||
var isCreatable = (permissions & OC.PERMISSION_CREATE) !== 0;
|
||||
$('#emptycontent').toggleClass('hidden', !isCreatable || $fileList.find('tr').exists());
|
||||
$('#filestable th').toggleClass('hidden', $fileList.find('tr').exists() === false);
|
||||
var exists = $fileList.find('tr:first').exists();
|
||||
$('#emptycontent').toggleClass('hidden', !isCreatable || exists);
|
||||
$('#filestable th').toggleClass('hidden', !exists);
|
||||
},
|
||||
showMask: function() {
|
||||
// in case one was shown before
|
||||
@@ -723,7 +749,7 @@ var FileList={
|
||||
},
|
||||
filter:function(query) {
|
||||
$('#fileList tr:not(.summary)').each(function(i,e) {
|
||||
if ($(e).data('file').toLowerCase().indexOf(query.toLowerCase()) !== -1) {
|
||||
if ($(e).data('file').toString().toLowerCase().indexOf(query.toLowerCase()) !== -1) {
|
||||
$(e).addClass("searchresult");
|
||||
} else {
|
||||
$(e).removeClass("searchresult");
|
||||
|
||||
@@ -3,6 +3,14 @@ $TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "Nelze přesunout %s - již existuje soubor se stejným názvem",
|
||||
"Could not move %s" => "Nelze přesunout %s",
|
||||
"File name cannot be empty." => "Název souboru nemůže být prázdný řetězec.",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Název souboru nesmí obsahovat \"/\". Vyberte prosím jiné jméno.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Název %s ve složce %s již existuje. Vyberte prosím jiné jméno.",
|
||||
"Not a valid source" => "Neplatný zdroj",
|
||||
"Error while downloading %s to %s" => "Chyba při stahování %s do %s",
|
||||
"Error when creating the file" => "Chyba při vytváření souboru",
|
||||
"Folder name cannot be empty." => "Název složky nemůže být prázdný.",
|
||||
"Folder name must not contain \"/\". Please choose a different name." => "Název složky nesmí obsahovat \"/\". Zvolte prosím jiný.",
|
||||
"Error when creating the folder" => "Chyba při vytváření složky",
|
||||
"Unable to set upload directory." => "Nelze nastavit adresář pro nahrané soubory.",
|
||||
"Invalid Token" => "Neplatný token",
|
||||
"No file was uploaded. Unknown error" => "Žádný soubor nebyl odeslán. Neznámá chyba",
|
||||
@@ -23,13 +31,19 @@ $TRANSLATIONS = array(
|
||||
"Upload cancelled." => "Odesílání zrušeno.",
|
||||
"Could not get result from server." => "Nepodařilo se získat výsledek ze serveru.",
|
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "Probíhá odesílání souboru. Opuštění stránky způsobí zrušení nahrávání.",
|
||||
"URL cannot be empty" => "URL nemůže zůstat prázdná",
|
||||
"In the home folder 'Shared' is a reserved filename" => "V osobní složce je název 'Shared' rezervovaný",
|
||||
"{new_name} already exists" => "{new_name} již existuje",
|
||||
"Could not create file" => "Nepodařilo se vytvořit soubor",
|
||||
"Could not create folder" => "Nepodařilo se vytvořit složku",
|
||||
"Share" => "Sdílet",
|
||||
"Delete permanently" => "Trvale odstranit",
|
||||
"Rename" => "Přejmenovat",
|
||||
"Pending" => "Nevyřízené",
|
||||
"Could not rename file" => "Nepodařilo se přejmenovat soubor",
|
||||
"replaced {new_name} with {old_name}" => "nahrazeno {new_name} s {old_name}",
|
||||
"undo" => "vrátit zpět",
|
||||
"Error deleting file." => "Chyba při mazání souboru.",
|
||||
"_%n folder_::_%n folders_" => array("%n složka","%n složky","%n složek"),
|
||||
"_%n file_::_%n files_" => array("%n soubor","%n soubory","%n souborů"),
|
||||
"{dirs} and {files}" => "{dirs} a {files}",
|
||||
@@ -47,6 +61,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Název",
|
||||
"Size" => "Velikost",
|
||||
"Modified" => "Upraveno",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Neplatný název složky. Použití 'Shared' je rezervováno.",
|
||||
"%s could not be renamed" => "%s nemůže být přejmenován",
|
||||
"Upload" => "Odeslat",
|
||||
"File handling" => "Zacházení se soubory",
|
||||
@@ -63,6 +78,7 @@ $TRANSLATIONS = array(
|
||||
"From link" => "Z odkazu",
|
||||
"Deleted files" => "Odstraněné soubory",
|
||||
"Cancel upload" => "Zrušit odesílání",
|
||||
"You don’t have permission to upload or create files here" => "Nemáte oprávnění zde nahrávat či vytvářet soubory",
|
||||
"Nothing in here. Upload something!" => "Žádný obsah. Nahrajte něco.",
|
||||
"Download" => "Stáhnout",
|
||||
"Unshare" => "Zrušit sdílení",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Die Datei konnte nicht umbenannt werden",
|
||||
"replaced {new_name} with {old_name}" => "{old_name} ersetzt durch {new_name}",
|
||||
"undo" => "rückgängig machen",
|
||||
"Error deleting file." => "Fehler beim Löschen der Datei.",
|
||||
"_%n folder_::_%n folders_" => array("%n Ordner","%n Ordner"),
|
||||
"_%n file_::_%n files_" => array("%n Datei","%n Dateien"),
|
||||
"{dirs} and {files}" => "{dirs} und {files}",
|
||||
|
||||
@@ -22,11 +22,11 @@ $TRANSLATIONS = array(
|
||||
"Missing a temporary folder" => "Kein temporärer Ordner vorhanden",
|
||||
"Failed to write to disk" => "Fehler beim Schreiben auf die Festplatte",
|
||||
"Not enough storage available" => "Nicht genug Speicher vorhanden.",
|
||||
"Upload failed. Could not get file info." => "Hochladen fehlgeschlagen. Dateiinformationen konnten nicht abgerufen werden.",
|
||||
"Upload failed. Could not find uploaded file" => "Hochladen fehlgeschlagen. Hochgeladene Datei konnte nicht gefunden werden.",
|
||||
"Upload failed. Could not get file info." => "Hochladen fehlgeschlagen. Die Dateiinformationen konnten nicht abgerufen werden.",
|
||||
"Upload failed. Could not find uploaded file" => "Hochladen fehlgeschlagen. Die hochgeladene Datei konnte nicht gefunden werden.",
|
||||
"Invalid directory." => "Ungültiges Verzeichnis.",
|
||||
"Files" => "Dateien",
|
||||
"Unable to upload {filename} as it is a directory or has 0 bytes" => "Datei {filename} kann nicht hochgeladen werden, da sie entweder ein Verzeichnis oder 0 Bytes groß ist",
|
||||
"Unable to upload {filename} as it is a directory or has 0 bytes" => "Die Datei {filename} kann nicht hochgeladen werden, da sie entweder ein Verzeichnis oder 0 Bytes groß ist",
|
||||
"Not enough space available" => "Nicht genügend Speicherplatz verfügbar",
|
||||
"Upload cancelled." => "Upload abgebrochen.",
|
||||
"Could not get result from server." => "Ergebnis konnte nicht vom Server abgerufen werden.",
|
||||
@@ -34,7 +34,7 @@ $TRANSLATIONS = array(
|
||||
"URL cannot be empty" => "Die URL darf nicht leer sein",
|
||||
"In the home folder 'Shared' is a reserved filename" => "Das Benutzerverzeichnis 'Shared' ist ein reservierter Dateiname",
|
||||
"{new_name} already exists" => "{new_name} existiert bereits",
|
||||
"Could not create file" => "Datei konnte nicht erstellt werden",
|
||||
"Could not create file" => "Die Datei konnte nicht erstellt werden",
|
||||
"Could not create folder" => "Der Ordner konnte nicht erstellt werden",
|
||||
"Share" => "Teilen",
|
||||
"Delete permanently" => "Endgültig löschen",
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Die Datei konnte nicht umbenannt werden",
|
||||
"replaced {new_name} with {old_name}" => "{old_name} wurde ersetzt durch {new_name}",
|
||||
"undo" => "rückgängig machen",
|
||||
"Error deleting file." => "Fehler beim Löschen der Datei.",
|
||||
"_%n folder_::_%n folders_" => array("%n Ordner","%n Ordner"),
|
||||
"_%n file_::_%n files_" => array("%n Datei","%n Dateien"),
|
||||
"{dirs} and {files}" => "{dirs} und {files}",
|
||||
@@ -51,8 +52,8 @@ $TRANSLATIONS = array(
|
||||
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Ungültiger Name, '\\', '/', '<', '>', ':', '\"', '|', '?' und '*' sind nicht zulässig.",
|
||||
"Your storage is full, files can not be updated or synced anymore!" => "Ihr Speicher ist voll, daher können keine Dateien mehr aktualisiert oder synchronisiert werden!",
|
||||
"Your storage is almost full ({usedSpacePercent}%)" => "Ihr Speicher ist fast voll ({usedSpacePercent}%)",
|
||||
"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Verschlüsselung-App ist aktiviert aber Ihre Schlüssel sind nicht initialisiert. Bitte melden sich nochmals ab und wieder an.",
|
||||
"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "Ungültiger privater Schlüssel für die Verschlüsselung-App. Bitte aktualisieren Sie Ihr privates Schlüssel-Passwort um den Zugriff auf Ihre verschlüsselten Dateien wiederherzustellen.",
|
||||
"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Verschlüsselung-App ist aktiviert, aber Ihre Schlüssel sind nicht initialisiert. Bitte melden sich nochmals ab und wieder an.",
|
||||
"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "Ungültiger privater Schlüssel für die Verschlüsselung-App. Bitte aktualisieren Sie Ihr privates Schlüssel-Passwort, um den Zugriff auf Ihre verschlüsselten Dateien wiederherzustellen.",
|
||||
"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Die Verschlüsselung wurde deaktiviert, jedoch sind Ihre Dateien nach wie vor verschlüsselt. Bitte gehen Sie zu Ihren persönlichen Einstellungen, um Ihre Dateien zu entschlüsseln.",
|
||||
"Your download is being prepared. This might take some time if the files are big." => "Ihr Download wird vorbereitet. Dies kann bei größeren Dateien etwas dauern.",
|
||||
"Error moving file" => "Fehler beim Verschieben der Datei",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Could not rename file",
|
||||
"replaced {new_name} with {old_name}" => "replaced {new_name} with {old_name}",
|
||||
"undo" => "undo",
|
||||
"Error deleting file." => "Error deleting file.",
|
||||
"_%n folder_::_%n folders_" => array("%n folder","%n folders"),
|
||||
"_%n file_::_%n files_" => array("%n file","%n files"),
|
||||
"{dirs} and {files}" => "{dirs} and {files}",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "No se pudo renombrar el archivo",
|
||||
"replaced {new_name} with {old_name}" => "reemplazado {new_name} con {old_name}",
|
||||
"undo" => "deshacer",
|
||||
"Error deleting file." => "Error borrando el archivo.",
|
||||
"_%n folder_::_%n folders_" => array("%n carpeta","%n carpetas"),
|
||||
"_%n file_::_%n files_" => array("%n archivo","%n archivos"),
|
||||
"{dirs} and {files}" => "{dirs} y {files}",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Ei suuda faili ümber nimetada",
|
||||
"replaced {new_name} with {old_name}" => "asendas nime {old_name} nimega {new_name}",
|
||||
"undo" => "tagasi",
|
||||
"Error deleting file." => "Viga faili kustutamisel.",
|
||||
"_%n folder_::_%n folders_" => array("%n kataloog","%n kataloogi"),
|
||||
"_%n file_::_%n files_" => array("%n fail","%n faili"),
|
||||
"{dirs} and {files}" => "{dirs} ja {files}",
|
||||
|
||||
@@ -6,6 +6,7 @@ $TRANSLATIONS = array(
|
||||
"File name must not contain \"/\". Please choose a different name." => "Tiedoston nimessä ei saa olla merkkiä \"/\". Valitse toinen nimi.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Nimi %s on jo käytössä kansiossa %s. Valitse toinen nimi.",
|
||||
"Not a valid source" => "Virheellinen lähde",
|
||||
"Error while downloading %s to %s" => "Virhe ladatessa kohdetta %s sijaintiin %s",
|
||||
"Error when creating the file" => "Virhe tiedostoa luotaessa",
|
||||
"Folder name cannot be empty." => "Kansion nimi ei voi olla tyhjä.",
|
||||
"Folder name must not contain \"/\". Please choose a different name." => "Kansion nimessä ei saa olla merkkiä \"/\". Valitse toinen nimi.",
|
||||
@@ -19,6 +20,7 @@ $TRANSLATIONS = array(
|
||||
"Missing a temporary folder" => "Tilapäiskansio puuttuu",
|
||||
"Failed to write to disk" => "Levylle kirjoitus epäonnistui",
|
||||
"Not enough storage available" => "Tallennustilaa ei ole riittävästi käytettävissä",
|
||||
"Upload failed. Could not find uploaded file" => "Lähetys epäonnistui. Lähettävää tiedostoa ei löydetty.",
|
||||
"Invalid directory." => "Virheellinen kansio.",
|
||||
"Files" => "Tiedostot",
|
||||
"Unable to upload {filename} as it is a directory or has 0 bytes" => "Kohdetta {filename} ei voi lähettää, koska se on joko kansio tai sen koko on 0 tavua",
|
||||
@@ -36,6 +38,7 @@ $TRANSLATIONS = array(
|
||||
"Pending" => "Odottaa",
|
||||
"Could not rename file" => "Tiedoston nimeäminen uudelleen epäonnistui",
|
||||
"undo" => "kumoa",
|
||||
"Error deleting file." => "Virhe tiedostoa poistaessa.",
|
||||
"_%n folder_::_%n folders_" => array("%n kansio","%n kansiota"),
|
||||
"_%n file_::_%n files_" => array("%n tiedosto","%n tiedostoa"),
|
||||
"{dirs} and {files}" => "{dirs} ja {files}",
|
||||
@@ -51,6 +54,8 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Nimi",
|
||||
"Size" => "Koko",
|
||||
"Modified" => "Muokattu",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Virheellinen kansion nimi. 'Shared':n käyttö on varattu.",
|
||||
"%s could not be renamed" => "%s ei pysty uudelleen nimeämään",
|
||||
"Upload" => "Lähetä",
|
||||
"File handling" => "Tiedostonhallinta",
|
||||
"Maximum upload size" => "Lähetettävän tiedoston suurin sallittu koko",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Impossible de renommer le fichier",
|
||||
"replaced {new_name} with {old_name}" => "{new_name} a été remplacé par {old_name}",
|
||||
"undo" => "annuler",
|
||||
"Error deleting file." => "Erreur pendant la suppression du fichier.",
|
||||
"_%n folder_::_%n folders_" => array("%n dossier","%n dossiers"),
|
||||
"_%n file_::_%n files_" => array("%n fichier","%n fichiers"),
|
||||
"{dirs} and {files}" => "{dirs} et {files}",
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"_%n folder_::_%n folders_" => array("",""),
|
||||
"_%n file_::_%n files_" => array("",""),
|
||||
"_Uploading %n file_::_Uploading %n files_" => array("","")
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=2; plural=(n > 1);";
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "Non se moveu %s - Xa existe un ficheiro con ese nome.",
|
||||
"Could not move %s - File with this name already exists" => "Non foi posíbel mover %s; Xa existe un ficheiro con ese nome.",
|
||||
"Could not move %s" => "Non foi posíbel mover %s",
|
||||
"File name cannot be empty." => "O nome de ficheiro non pode estar baleiro",
|
||||
"File name must not contain \"/\". Please choose a different name." => "O nome do ficheiro non pode conter «/». Escolla outro nome.",
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Non foi posíbel renomear o ficheiro",
|
||||
"replaced {new_name} with {old_name}" => "substituír {new_name} por {old_name}",
|
||||
"undo" => "desfacer",
|
||||
"Error deleting file." => "Produciuse un erro ao eliminar o ficheiro.",
|
||||
"_%n folder_::_%n folders_" => array("%n cartafol","%n cartafoles"),
|
||||
"_%n file_::_%n files_" => array("%n ficheiro","%n ficheiros"),
|
||||
"{dirs} and {files}" => "{dirs} e {files}",
|
||||
|
||||
@@ -60,6 +60,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Név",
|
||||
"Size" => "Méret",
|
||||
"Modified" => "Módosítva",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Érvénytelen mappanév. A 'Shared' a rendszer számára fenntartott elnevezés.",
|
||||
"%s could not be renamed" => "%s átnevezése nem sikerült",
|
||||
"Upload" => "Feltöltés",
|
||||
"File handling" => "Fájlkezelés",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Impossibile rinominare il file",
|
||||
"replaced {new_name} with {old_name}" => "sostituito {new_name} con {old_name}",
|
||||
"undo" => "annulla",
|
||||
"Error deleting file." => "Errore durante l'eliminazione del file.",
|
||||
"_%n folder_::_%n folders_" => array("%n cartella","%n cartelle"),
|
||||
"_%n file_::_%n files_" => array("%n file","%n file"),
|
||||
"{dirs} and {files}" => "{dirs} e {files}",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "ファイルの名前変更ができませんでした",
|
||||
"replaced {new_name} with {old_name}" => "{old_name} を {new_name} に置換",
|
||||
"undo" => "元に戻す",
|
||||
"Error deleting file." => "ファイルの削除エラー。",
|
||||
"_%n folder_::_%n folders_" => array("%n 個のフォルダ"),
|
||||
"_%n file_::_%n files_" => array("%n 個のファイル"),
|
||||
"{dirs} and {files}" => "{dirs} と {files}",
|
||||
@@ -60,6 +61,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "名前",
|
||||
"Size" => "サイズ",
|
||||
"Modified" => "更新日時",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "無効なフォルダ名。「Shared」の利用は予約されています。",
|
||||
"%s could not be renamed" => "%sの名前を変更できませんでした",
|
||||
"Upload" => "アップロード",
|
||||
"File handling" => "ファイル操作",
|
||||
|
||||
@@ -4,6 +4,8 @@ $TRANSLATIONS = array(
|
||||
"Could not move %s" => "Nepavyko perkelti %s",
|
||||
"File name cannot be empty." => "Failo pavadinimas negali būti tuščias.",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Failo pavadinime negali būti simbolio \"/\". Prašome pasirinkti kitokį pavadinimą.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Pavadinimas %s jau naudojamas aplanke %s. Prašome pasirinkti kitokį pavadinimą.",
|
||||
"Not a valid source" => "Netinkamas šaltinis",
|
||||
"Error while downloading %s to %s" => "Klaida siunčiant %s į %s",
|
||||
"Error when creating the file" => "Klaida kuriant failą",
|
||||
"Folder name cannot be empty." => "Aplanko pavadinimas negali būti tuščias.",
|
||||
@@ -40,6 +42,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Neįmanoma pervadinti failo",
|
||||
"replaced {new_name} with {old_name}" => "pakeiskite {new_name} į {old_name}",
|
||||
"undo" => "anuliuoti",
|
||||
"Error deleting file." => "Klaida trinant failą.",
|
||||
"_%n folder_::_%n folders_" => array("%n aplankas","%n aplankai","%n aplankų"),
|
||||
"_%n file_::_%n files_" => array("%n failas","%n failai","%n failų"),
|
||||
"{dirs} and {files}" => "{dirs} ir {files}",
|
||||
|
||||
@@ -3,7 +3,14 @@ $TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "Nie można było przenieść %s - Plik o takiej nazwie już istnieje",
|
||||
"Could not move %s" => "Nie można było przenieść %s",
|
||||
"File name cannot be empty." => "Nazwa pliku nie może być pusta.",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Nazwa pliku nie może zawierać \"/\". Proszę wybrać inną nazwę.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Nazwa %s jest już używana w folderze %s. Proszę wybrać inną nazwę.",
|
||||
"Not a valid source" => "Niepoprawne źródło",
|
||||
"Error while downloading %s to %s" => "Błąd podczas pobierania %s do %S",
|
||||
"Error when creating the file" => "Błąd przy tworzeniu pliku",
|
||||
"Folder name cannot be empty." => "Nazwa folderu nie może być pusta.",
|
||||
"Folder name must not contain \"/\". Please choose a different name." => "Nazwa folderu nie może zawierać \"/\". Proszę wybrać inną nazwę.",
|
||||
"Error when creating the folder" => "Błąd przy tworzeniu folderu",
|
||||
"Unable to set upload directory." => "Nie można ustawić katalog wczytywania.",
|
||||
"Invalid Token" => "Nieprawidłowy Token",
|
||||
"No file was uploaded. Unknown error" => "Żaden plik nie został załadowany. Nieznany błąd",
|
||||
@@ -24,11 +31,16 @@ $TRANSLATIONS = array(
|
||||
"Upload cancelled." => "Wczytywanie anulowane.",
|
||||
"Could not get result from server." => "Nie można uzyskać wyniku z serwera.",
|
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "Wysyłanie pliku jest w toku. Jeśli opuścisz tę stronę, wysyłanie zostanie przerwane.",
|
||||
"URL cannot be empty" => "URL nie może być pusty",
|
||||
"In the home folder 'Shared' is a reserved filename" => "W katalogu domowym \"Shared\" jest zarezerwowana nazwa pliku",
|
||||
"{new_name} already exists" => "{new_name} już istnieje",
|
||||
"Could not create file" => "Nie można utworzyć pliku",
|
||||
"Could not create folder" => "Nie można utworzyć folderu",
|
||||
"Share" => "Udostępnij",
|
||||
"Delete permanently" => "Trwale usuń",
|
||||
"Rename" => "Zmień nazwę",
|
||||
"Pending" => "Oczekujące",
|
||||
"Could not rename file" => "Nie można zmienić nazwy pliku",
|
||||
"replaced {new_name} with {old_name}" => "zastąpiono {new_name} przez {old_name}",
|
||||
"undo" => "cofnij",
|
||||
"_%n folder_::_%n folders_" => array("%n katalog","%n katalogi","%n katalogów"),
|
||||
@@ -48,6 +60,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Nazwa",
|
||||
"Size" => "Rozmiar",
|
||||
"Modified" => "Modyfikacja",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Niepoprawna nazwa folderu. Wykorzystanie \"Shared\" jest zarezerwowane.",
|
||||
"%s could not be renamed" => "%s nie można zmienić nazwy",
|
||||
"Upload" => "Wyślij",
|
||||
"File handling" => "Zarządzanie plikami",
|
||||
@@ -64,6 +77,7 @@ $TRANSLATIONS = array(
|
||||
"From link" => "Z odnośnika",
|
||||
"Deleted files" => "Pliki usunięte",
|
||||
"Cancel upload" => "Anuluj wysyłanie",
|
||||
"You don’t have permission to upload or create files here" => "Nie masz uprawnień do wczytywania lub tworzenia plików w tym miejscu",
|
||||
"Nothing in here. Upload something!" => "Pusto. Wyślij coś!",
|
||||
"Download" => "Pobierz",
|
||||
"Unshare" => "Zatrzymaj współdzielenie",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Não foi possível renomear o arquivo",
|
||||
"replaced {new_name} with {old_name}" => "Substituído {old_name} por {new_name} ",
|
||||
"undo" => "desfazer",
|
||||
"Error deleting file." => "Erro eliminando o arquivo.",
|
||||
"_%n folder_::_%n folders_" => array("%n pasta","%n pastas"),
|
||||
"_%n file_::_%n files_" => array("%n arquivo","%n arquivos"),
|
||||
"{dirs} and {files}" => "{dirs} e {files}",
|
||||
|
||||
@@ -7,9 +7,11 @@ $TRANSLATIONS = array(
|
||||
"_%n file_::_%n files_" => array("","",""),
|
||||
"_Uploading %n file_::_Uploading %n files_" => array("","",""),
|
||||
"Error" => "Ошибка",
|
||||
"Size" => "Размер",
|
||||
"Upload" => "Загрузка",
|
||||
"Save" => "Сохранить",
|
||||
"Cancel upload" => "Отмена загрузки",
|
||||
"Download" => "Загрузка"
|
||||
"Download" => "Загрузка",
|
||||
"Delete" => "Удалить"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
|
||||
|
||||
@@ -3,6 +3,14 @@ $TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "Nie je možné presunúť %s - súbor s týmto menom už existuje",
|
||||
"Could not move %s" => "Nie je možné presunúť %s",
|
||||
"File name cannot be empty." => "Meno súboru nemôže byť prázdne",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Názov súboru nesmie obsahovať \"/\". Prosím zvoľte iný názov.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Názov %s už používa priečinok s%. Prosím zvoľte iný názov.",
|
||||
"Not a valid source" => "Neplatný zdroj",
|
||||
"Error while downloading %s to %s" => "Chyba pri sťahovaní súboru %s do %s",
|
||||
"Error when creating the file" => "Chyba pri vytváraní súboru",
|
||||
"Folder name cannot be empty." => "Názov súboru nemôže byť prázdny.",
|
||||
"Folder name must not contain \"/\". Please choose a different name." => "Názov priečinka nesmie obsahovať \"/\". Prosím zvoľte iný názov.",
|
||||
"Error when creating the folder" => "Chyba pri vytváraní priečinka",
|
||||
"Unable to set upload directory." => "Nemožno nastaviť priečinok pre nahrané súbory.",
|
||||
"Invalid Token" => "Neplatný token",
|
||||
"No file was uploaded. Unknown error" => "Žiaden súbor nebol nahraný. Neznáma chyba",
|
||||
@@ -23,11 +31,16 @@ $TRANSLATIONS = array(
|
||||
"Upload cancelled." => "Odosielanie zrušené.",
|
||||
"Could not get result from server." => "Nepodarilo sa dostať výsledky zo servera.",
|
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "Opustenie stránky zruší práve prebiehajúce odosielanie súboru.",
|
||||
"URL cannot be empty" => "URL nemôže byť prázdna",
|
||||
"In the home folder 'Shared' is a reserved filename" => "V domovskej zložke je názov \"Shared\" vyhradený názov súboru",
|
||||
"{new_name} already exists" => "{new_name} už existuje",
|
||||
"Could not create file" => "Nemožno vytvoriť súbor",
|
||||
"Could not create folder" => "Nemožno vytvoriť priečinok",
|
||||
"Share" => "Zdieľať",
|
||||
"Delete permanently" => "Zmazať trvalo",
|
||||
"Rename" => "Premenovať",
|
||||
"Pending" => "Prebieha",
|
||||
"Could not rename file" => "Nemožno premenovať súbor",
|
||||
"replaced {new_name} with {old_name}" => "prepísaný {new_name} súborom {old_name}",
|
||||
"undo" => "vrátiť",
|
||||
"_%n folder_::_%n folders_" => array("%n priečinok","%n priečinky","%n priečinkov"),
|
||||
@@ -47,6 +60,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Názov",
|
||||
"Size" => "Veľkosť",
|
||||
"Modified" => "Upravené",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Názov priečinka je chybný. Použitie názvu 'Shared' nie je povolené.",
|
||||
"%s could not be renamed" => "%s nemohol byť premenovaný",
|
||||
"Upload" => "Odoslať",
|
||||
"File handling" => "Nastavenie správania sa k súborom",
|
||||
@@ -63,6 +77,7 @@ $TRANSLATIONS = array(
|
||||
"From link" => "Z odkazu",
|
||||
"Deleted files" => "Zmazané súbory",
|
||||
"Cancel upload" => "Zrušiť odosielanie",
|
||||
"You don’t have permission to upload or create files here" => "Nemáte oprávnenie sem nahrávať alebo vytvoriť súbory",
|
||||
"Nothing in here. Upload something!" => "Žiadny súbor. Nahrajte niečo!",
|
||||
"Download" => "Sťahovanie",
|
||||
"Unshare" => "Zrušiť zdieľanie",
|
||||
|
||||
+34
-9
@@ -1,8 +1,16 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "%s ni mogoče premakniti - datoteka s tem imenom že obstaja",
|
||||
"Could not move %s" => "Ni mogoče premakniti %s",
|
||||
"Could not move %s - File with this name already exists" => "Datoteke %s ni mogoče premakniti - datoteka s tem imenom že obstaja.",
|
||||
"Could not move %s" => "Datoteke %s ni mogoče premakniti",
|
||||
"File name cannot be empty." => "Ime datoteke ne sme biti prazno polje.",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Ime datoteke ne sme vsebovati znaka \"/\". Določiti je treba drugo ime.",
|
||||
"The name %s is already used in the folder %s. Please choose a different name." => "Ime %s je že v mapi %s že v uporabi. Izbrati je treba drugo ime.",
|
||||
"Not a valid source" => "Vir ni veljaven",
|
||||
"Error while downloading %s to %s" => "Napaka med prejemanjem %s v mapo %s",
|
||||
"Error when creating the file" => "Napaka med ustvarjanjem datoteke",
|
||||
"Folder name cannot be empty." => "Ime mape ne more biti prazna vrednost.",
|
||||
"Folder name must not contain \"/\". Please choose a different name." => "Ime mape ne sme vsebovati znaka \"/\". Določiti je treba drugo ime.",
|
||||
"Error when creating the folder" => "Napaka med ustvarjanjem mape",
|
||||
"Unable to set upload directory." => "Mapo, v katero boste prenašali dokumente, ni mogoče določiti",
|
||||
"Invalid Token" => "Neveljaven žeton",
|
||||
"No file was uploaded. Unknown error" => "Ni poslane datoteke. Neznana napaka.",
|
||||
@@ -14,31 +22,47 @@ $TRANSLATIONS = array(
|
||||
"Missing a temporary folder" => "Manjka začasna mapa",
|
||||
"Failed to write to disk" => "Pisanje na disk je spodletelo",
|
||||
"Not enough storage available" => "Na voljo ni dovolj prostora",
|
||||
"Upload failed. Could not get file info." => "Pošiljanje je spodletelo. Ni mogoče pridobiti podrobnosti datoteke.",
|
||||
"Upload failed. Could not find uploaded file" => "Pošiljanje je spodletelo. Ni mogoče najti poslane datoteke.",
|
||||
"Invalid directory." => "Neveljavna mapa.",
|
||||
"Files" => "Datoteke",
|
||||
"Unable to upload {filename} as it is a directory or has 0 bytes" => "Ni mogoče poslati datoteke {filename}, saj je to ali mapa ali pa je velikost datoteke 0 bajtov.",
|
||||
"Not enough space available" => "Na voljo ni dovolj prostora.",
|
||||
"Upload cancelled." => "Pošiljanje je preklicano.",
|
||||
"Could not get result from server." => "Ni mogoče pridobiti podatkov s strežnika.",
|
||||
"File upload is in progress. Leaving the page now will cancel the upload." => "V teku je pošiljanje datoteke. Če zapustite to stran zdaj, bo pošiljanje preklicano.",
|
||||
"URL cannot be empty" => "Polje naslova URL ne sme biti prazno",
|
||||
"In the home folder 'Shared' is a reserved filename" => "V domači mapi ni dovoljeno ustvariti mape z imenom 'Souporabe', saj je ime zadržano za javno mapo.",
|
||||
"{new_name} already exists" => "{new_name} že obstaja",
|
||||
"Could not create file" => "Ni mogoče ustvariti datoteke",
|
||||
"Could not create folder" => "Ni mogoče ustvariti mape",
|
||||
"Share" => "Souporaba",
|
||||
"Delete permanently" => "Izbriši dokončno",
|
||||
"Rename" => "Preimenuj",
|
||||
"Pending" => "V čakanju ...",
|
||||
"Could not rename file" => "Ni mogoče preimenovati datoteke",
|
||||
"replaced {new_name} with {old_name}" => "preimenovano ime {new_name} z imenom {old_name}",
|
||||
"undo" => "razveljavi",
|
||||
"_%n folder_::_%n folders_" => array("","","",""),
|
||||
"_%n file_::_%n files_" => array("","","",""),
|
||||
"_Uploading %n file_::_Uploading %n files_" => array("","","",""),
|
||||
"Error deleting file." => "Napaka brisanja datoteke.",
|
||||
"_%n folder_::_%n folders_" => array("%n mapa","%n mapi","%n mape","%n map"),
|
||||
"_%n file_::_%n files_" => array("%n datoteka","%n datoteki","%n datoteke","%n datotek"),
|
||||
"{dirs} and {files}" => "{dirs} in {files}",
|
||||
"_Uploading %n file_::_Uploading %n files_" => array("Posodabljanje %n datoteke","Posodabljanje %n datotek","Posodabljanje %n datotek","Posodabljanje %n datotek"),
|
||||
"'.' is an invalid file name." => "'.' je neveljavno ime datoteke.",
|
||||
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Neveljavno ime, znaki '\\', '/', '<', '>', ':', '\"', '|', '?' in '*' niso dovoljeni.",
|
||||
"Invalid name, '\\', '/', '<', '>', ':', '\"', '|', '?' and '*' are not allowed." => "Neveljavno ime; znaki '\\', '/', '<', '>', ':', '\"', '|', '?' in '*' niso dovoljeni.",
|
||||
"Your storage is full, files can not be updated or synced anymore!" => "Shramba je povsem napolnjena. Datotek ni več mogoče posodabljati in usklajevati!",
|
||||
"Your storage is almost full ({usedSpacePercent}%)" => "Mesto za shranjevanje je skoraj polno ({usedSpacePercent}%)",
|
||||
"Your download is being prepared. This might take some time if the files are big." => "Postopek priprave datoteke za prejem je lahko dolgotrajen, če je datoteka zelo velika.",
|
||||
"Your storage is almost full ({usedSpacePercent}%)" => "Prostor za shranjevanje je skoraj do konca zaseden ({usedSpacePercent}%)",
|
||||
"Encryption App is enabled but your keys are not initialized, please log-out and log-in again" => "Program za šifriranje je omogočen, vendar ni začet. Odjavite se in nato ponovno prijavite.",
|
||||
"Invalid private key for Encryption App. Please update your private key password in your personal settings to recover access to your encrypted files." => "Ni ustreznega osebnega ključa za program za šifriranje. Posodobite osebni ključ za dostop do šifriranih datotek med nastavitvami.",
|
||||
"Encryption was disabled but your files are still encrypted. Please go to your personal settings to decrypt your files." => "Šifriranje je onemogočeno, datoteke pa so še vedno šifrirane. Odšifrirajte jih med nastavitvami.",
|
||||
"Your download is being prepared. This might take some time if the files are big." => "Postopek priprave datoteke za prejem je lahko dolgotrajen, kadar je datoteka zelo velika.",
|
||||
"Error moving file" => "Napaka premikanja datoteke",
|
||||
"Error" => "Napaka",
|
||||
"Name" => "Ime",
|
||||
"Size" => "Velikost",
|
||||
"Modified" => "Spremenjeno",
|
||||
"%s could not be renamed" => "%s ni bilo mogoče preimenovati",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Neveljavno ime mape. Ime 'Souporaba' je zadržana za javno mapo.",
|
||||
"%s could not be renamed" => "%s ni mogoče preimenovati",
|
||||
"Upload" => "Pošlji",
|
||||
"File handling" => "Upravljanje z datotekami",
|
||||
"Maximum upload size" => "Največja velikost za pošiljanja",
|
||||
@@ -54,6 +78,7 @@ $TRANSLATIONS = array(
|
||||
"From link" => "Iz povezave",
|
||||
"Deleted files" => "Izbrisane datoteke",
|
||||
"Cancel upload" => "Prekliči pošiljanje",
|
||||
"You don’t have permission to upload or create files here" => "Ni ustreznih dovoljenj za pošiljanje ali ustvarjanje datotek na tem mestu.",
|
||||
"Nothing in here. Upload something!" => "Tukaj še ni ničesar. Najprej je treba kakšno datoteko poslati v oblak!",
|
||||
"Download" => "Prejmi",
|
||||
"Unshare" => "Prekliči souporabo",
|
||||
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Kan ej byta filnamn",
|
||||
"replaced {new_name} with {old_name}" => "ersatt {new_name} med {old_name}",
|
||||
"undo" => "ångra",
|
||||
"Error deleting file." => "Kunde inte ta bort filen.",
|
||||
"_%n folder_::_%n folders_" => array("%n mapp","%n mappar"),
|
||||
"_%n file_::_%n files_" => array("%n fil","%n filer"),
|
||||
"{dirs} and {files}" => "{dirs} och {files}",
|
||||
@@ -60,6 +61,7 @@ $TRANSLATIONS = array(
|
||||
"Name" => "Namn",
|
||||
"Size" => "Storlek",
|
||||
"Modified" => "Ändrad",
|
||||
"Invalid folder name. Usage of 'Shared' is reserved." => "Ogiltigt mappnamn. Användande av 'Shared' är reserverat av ownCloud",
|
||||
"%s could not be renamed" => "%s kunde inte namnändras",
|
||||
"Upload" => "Ladda upp",
|
||||
"File handling" => "Filhantering",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Could not move %s - File with this name already exists" => "%s taşınamadı. Bu isimde dosya zaten var.",
|
||||
"Could not move %s - File with this name already exists" => "%s taşınamadı - Bu isimde dosya zaten var",
|
||||
"Could not move %s" => "%s taşınamadı",
|
||||
"File name cannot be empty." => "Dosya adı boş olamaz.",
|
||||
"File name must not contain \"/\". Please choose a different name." => "Dosya adı \"/\" içermemelidir. Lütfen farklı bir isim seçin.",
|
||||
@@ -43,6 +43,7 @@ $TRANSLATIONS = array(
|
||||
"Could not rename file" => "Dosya adlandırılamadı",
|
||||
"replaced {new_name} with {old_name}" => "{new_name} ismi {old_name} ile değiştirildi",
|
||||
"undo" => "geri al",
|
||||
"Error deleting file." => "Dosya silinirken hata.",
|
||||
"_%n folder_::_%n folders_" => array("%n dizin","%n dizin"),
|
||||
"_%n file_::_%n files_" => array("%n dosya","%n dosya"),
|
||||
"{dirs} and {files}" => "{dirs} ve {files}",
|
||||
|
||||
+18
-5
@@ -76,12 +76,25 @@ class App {
|
||||
$this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)
|
||||
) {
|
||||
// successful rename
|
||||
$result['success'] = true;
|
||||
$result['data'] = array(
|
||||
'dir' => $dir,
|
||||
'file' => $oldname,
|
||||
'newname' => $newname
|
||||
$meta = $this->view->getFileInfo($dir . '/' . $newname);
|
||||
if ($meta['mimetype'] === 'httpd/unix-directory') {
|
||||
$meta['type'] = 'dir';
|
||||
}
|
||||
else {
|
||||
$meta['type'] = 'file';
|
||||
}
|
||||
$fileinfo = array(
|
||||
'id' => $meta['fileid'],
|
||||
'mime' => $meta['mimetype'],
|
||||
'size' => $meta['size'],
|
||||
'etag' => $meta['etag'],
|
||||
'directory' => $dir,
|
||||
'name' => $newname,
|
||||
'isPreviewAvailable' => \OC::$server->getPreviewManager()->isMimeSupported($meta['mimetype']),
|
||||
'icon' => \OCA\Files\Helper::determineIcon($meta)
|
||||
);
|
||||
$result['success'] = true;
|
||||
$result['data'] = $fileinfo;
|
||||
} else {
|
||||
// rename failed
|
||||
$result['data'] = array(
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
<a><?php p($l->t('New'));?></a>
|
||||
<ul>
|
||||
<li style="background-image:url('<?php p(OCP\mimetype_icon('text/plain')) ?>')"
|
||||
data-type='file'><p><?php p($l->t('Text file'));?></p></li>
|
||||
data-type='file' data-newname='<?php p($l->t('New text file')) ?>.txt'><p><?php p($l->t('Text file'));?></p></li>
|
||||
<li style="background-image:url('<?php p(OCP\mimetype_icon('dir')) ?>')"
|
||||
data-type='folder'><p><?php p($l->t('Folder'));?></p></li>
|
||||
data-type='folder' data-newname='<?php p($l->t('New folder')) ?>'><p><?php p($l->t('Folder'));?></p></li>
|
||||
<li style="background-image:url('<?php p(OCP\image_path('core', 'places/link.svg')) ?>')"
|
||||
data-type='web'><p><?php p($l->t('From link'));?></p></li>
|
||||
</ul>
|
||||
@@ -25,7 +25,7 @@
|
||||
data-url="<?php print_unescaped(OCP\Util::linkTo('files', 'ajax/upload.php')); ?>" />
|
||||
<a href="#" class="svg"></a>
|
||||
</div>
|
||||
<?php if ($_['trash'] ): ?>
|
||||
<?php if ($_['trash']): ?>
|
||||
<input id="trash" type="button" value="<?php p($l->t('Deleted files'));?>" class="button" <?php $_['trashEmpty'] ? p('disabled') : '' ?>></input>
|
||||
<?php endif; ?>
|
||||
<div id="uploadprogresswrapper">
|
||||
@@ -69,20 +69,11 @@
|
||||
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerDate">
|
||||
<span id="modified"><?php p($l->t( 'Modified' )); ?></span>
|
||||
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
|
||||
<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
|
||||
<?php if ($_['dir'] == '/Shared'): ?>
|
||||
<span class="selectedActions"><a href="" class="delete-selected">
|
||||
<?php p($l->t('Unshare'))?>
|
||||
<img class="svg" alt="<?php p($l->t('Unshare'))?>"
|
||||
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
|
||||
</a></span>
|
||||
<?php else: ?>
|
||||
<span class="selectedActions"><a href="" class="delete-selected">
|
||||
<?php p($l->t('Delete'))?>
|
||||
<img class="svg" alt="<?php p($l->t('Delete'))?>"
|
||||
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
|
||||
</a></span>
|
||||
<?php endif; ?>
|
||||
<span class="selectedActions"><a href="" class="delete-selected">
|
||||
<?php p($l->t('Delete'))?>
|
||||
<img class="svg" alt="<?php p($l->t('Delete'))?>"
|
||||
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
|
||||
</a></span>
|
||||
<?php endif; ?>
|
||||
</th>
|
||||
</tr>
|
||||
@@ -111,8 +102,9 @@
|
||||
<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
|
||||
<input type="hidden" name="allowZipDownload" id="allowZipDownload" value="<?php p($_['allowZipDownload']); ?>" />
|
||||
<input type="hidden" name="usedSpacePercent" id="usedSpacePercent" value="<?php p($_['usedSpacePercent']); ?>" />
|
||||
<?php if (!$_['isPublic']) :?>
|
||||
<input type="hidden" name="encryptedFiles" id="encryptedFiles" value="<?php $_['encryptedFiles'] ? p('1') : p('0'); ?>" />
|
||||
<input type="hidden" name="encryptedInitStatus" id="encryptionInitStatus" value="<?php p($_['encryptionInitStatus']) ?>" />
|
||||
<input type="hidden" name="mailNotificationEnabled" id="mailNotificationEnabled" value="<?php p($_['mailNotificationEnabled']) ?>" />
|
||||
<input type="hidden" name="allowShareWithLink" id="allowShareWithLink" value="<?php p($_['allowShareWithLink']) ?>" />
|
||||
|
||||
<?php endif;
|
||||
|
||||
@@ -22,23 +22,39 @@
|
||||
*/
|
||||
|
||||
class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
|
||||
private static $user;
|
||||
|
||||
function setUp() {
|
||||
// mock OC_L10n
|
||||
if (!self::$user) {
|
||||
self::$user = uniqid();
|
||||
}
|
||||
\OC_User::createUser(self::$user, 'password');
|
||||
\OC_User::setUserId(self::$user);
|
||||
|
||||
\OC\Files\Filesystem::init(self::$user, '/' . self::$user . '/files');
|
||||
|
||||
$l10nMock = $this->getMock('\OC_L10N', array('t'), array(), '', false);
|
||||
$l10nMock->expects($this->any())
|
||||
->method('t')
|
||||
->will($this->returnArgument(0));
|
||||
$viewMock = $this->getMock('\OC\Files\View', array('rename', 'normalizePath'), array(), '', false);
|
||||
$viewMock = $this->getMock('\OC\Files\View', array('rename', 'normalizePath', 'getFileInfo'), array(), '', false);
|
||||
$viewMock->expects($this->any())
|
||||
->method('normalizePath')
|
||||
->will($this->returnArgument(0));
|
||||
$viewMock->expects($this->any())
|
||||
->method('rename')
|
||||
->will($this->returnValue(true));
|
||||
$this->viewMock = $viewMock;
|
||||
$this->files = new \OCA\Files\App($viewMock, $l10nMock);
|
||||
}
|
||||
|
||||
function tearDown() {
|
||||
$result = \OC_User::deleteUser(self::$user);
|
||||
$this->assertTrue($result);
|
||||
\OC\Files\Filesystem::tearDown();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief test rename of file/folder named "Shared"
|
||||
*/
|
||||
@@ -64,17 +80,28 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
|
||||
$oldname = 'Shared';
|
||||
$newname = 'new_name';
|
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname);
|
||||
$expected = array(
|
||||
'success' => true,
|
||||
'data' => array(
|
||||
'dir' => $dir,
|
||||
'file' => $oldname,
|
||||
'newname' => $newname
|
||||
)
|
||||
);
|
||||
$this->viewMock->expects($this->any())
|
||||
->method('getFileInfo')
|
||||
->will($this->returnValue(array(
|
||||
'fileid' => 123,
|
||||
'type' => 'dir',
|
||||
'mimetype' => 'httpd/unix-directory',
|
||||
'size' => 18,
|
||||
'etag' => 'abcdef',
|
||||
'directory' => '/',
|
||||
'name' => 'new_name',
|
||||
)));
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
$result = $this->files->rename($dir, $oldname, $newname);
|
||||
|
||||
$this->assertTrue($result['success']);
|
||||
$this->assertEquals(123, $result['data']['id']);
|
||||
$this->assertEquals('new_name', $result['data']['name']);
|
||||
$this->assertEquals('/test', $result['data']['directory']);
|
||||
$this->assertEquals(18, $result['data']['size']);
|
||||
$this->assertEquals('httpd/unix-directory', $result['data']['mime']);
|
||||
$this->assertEquals(\OC_Helper::mimetypeIcon('dir'), $result['data']['icon']);
|
||||
$this->assertFalse($result['data']['isPreviewAvailable']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -102,16 +129,29 @@ class Test_OC_Files_App_Rename extends \PHPUnit_Framework_TestCase {
|
||||
$oldname = 'oldname';
|
||||
$newname = 'newname';
|
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname);
|
||||
$expected = array(
|
||||
'success' => true,
|
||||
'data' => array(
|
||||
'dir' => $dir,
|
||||
'file' => $oldname,
|
||||
'newname' => $newname
|
||||
)
|
||||
);
|
||||
$this->viewMock->expects($this->any())
|
||||
->method('getFileInfo')
|
||||
->will($this->returnValue(array(
|
||||
'fileid' => 123,
|
||||
'type' => 'dir',
|
||||
'mimetype' => 'httpd/unix-directory',
|
||||
'size' => 18,
|
||||
'etag' => 'abcdef',
|
||||
'directory' => '/',
|
||||
'name' => 'new_name',
|
||||
)));
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
|
||||
$result = $this->files->rename($dir, $oldname, $newname);
|
||||
|
||||
$this->assertTrue($result['success']);
|
||||
$this->assertEquals(123, $result['data']['id']);
|
||||
$this->assertEquals('newname', $result['data']['name']);
|
||||
$this->assertEquals('/', $result['data']['directory']);
|
||||
$this->assertEquals(18, $result['data']['size']);
|
||||
$this->assertEquals('httpd/unix-directory', $result['data']['mime']);
|
||||
$this->assertEquals('abcdef', $result['data']['etag']);
|
||||
$this->assertEquals(\OC_Helper::mimetypeIcon('dir'), $result['data']['icon']);
|
||||
$this->assertFalse($result['data']['isPreviewAvailable']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013, Bjoern Schiessle <schiessle@owncloud.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file.
|
||||
*
|
||||
* @brief check migration status
|
||||
*/
|
||||
use OCA\Encryption\Util;
|
||||
|
||||
\OCP\JSON::checkAppEnabled('files_encryption');
|
||||
|
||||
$loginname = isset($_POST['user']) ? $_POST['user'] : '';
|
||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
||||
|
||||
$migrationCompleted = true;
|
||||
|
||||
if ($loginname !== '' && $password !== '') {
|
||||
$username = \OCP\User::checkPassword($loginname, $password);
|
||||
if ($username) {
|
||||
$util = new Util(new \OC_FilesystemView('/'), $username);
|
||||
if ($util->getMigrationStatus() !== Util::MIGRATION_COMPLETED) {
|
||||
$migrationCompleted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
\OCP\JSON::success(array('data' => array('migrationCompleted' => $migrationCompleted)));
|
||||
@@ -10,6 +10,8 @@ OC::$CLASSPATH['OCA\Encryption\Session'] = 'files_encryption/lib/session.php';
|
||||
OC::$CLASSPATH['OCA\Encryption\Capabilities'] = 'files_encryption/lib/capabilities.php';
|
||||
OC::$CLASSPATH['OCA\Encryption\Helper'] = 'files_encryption/lib/helper.php';
|
||||
|
||||
\OCP\Util::addscript('files_encryption', 'detect-migration');
|
||||
|
||||
if (!OC_Config::getValue('maintenance', false)) {
|
||||
OC_FileProxy::register(new OCA\Encryption\Proxy());
|
||||
|
||||
@@ -52,4 +54,3 @@ if (!OC_Config::getValue('maintenance', false)) {
|
||||
// Register settings scripts
|
||||
OCP\App::registerAdmin('files_encryption', 'settings-admin');
|
||||
OCP\App::registerPersonal('files_encryption', 'settings-personal');
|
||||
|
||||
|
||||
@@ -179,9 +179,9 @@ class Hooks {
|
||||
// the necessary keys)
|
||||
if (Crypt::mode() === 'server') {
|
||||
|
||||
if ($params['uid'] === \OCP\User::getUser()) {
|
||||
$view = new \OC_FilesystemView('/');
|
||||
|
||||
$view = new \OC_FilesystemView('/');
|
||||
if ($params['uid'] === \OCP\User::getUser()) {
|
||||
|
||||
$session = new \OCA\Encryption\Session($view);
|
||||
|
||||
@@ -202,36 +202,41 @@ class Hooks {
|
||||
} else { // admin changed the password for a different user, create new keys and reencrypt file keys
|
||||
|
||||
$user = $params['uid'];
|
||||
$recoveryPassword = $params['recoveryPassword'];
|
||||
$newUserPassword = $params['password'];
|
||||
$util = new Util($view, $user);
|
||||
$recoveryPassword = isset($params['recoveryPassword']) ? $params['recoveryPassword'] : null;
|
||||
|
||||
$view = new \OC_FilesystemView('/');
|
||||
if (($util->recoveryEnabledForUser() && $recoveryPassword)
|
||||
|| !$util->userKeysExists()) {
|
||||
|
||||
// make sure that the users home is mounted
|
||||
\OC\Files\Filesystem::initMountPoints($user);
|
||||
$recoveryPassword = $params['recoveryPassword'];
|
||||
$newUserPassword = $params['password'];
|
||||
|
||||
$keypair = Crypt::createKeypair();
|
||||
// make sure that the users home is mounted
|
||||
\OC\Files\Filesystem::initMountPoints($user);
|
||||
|
||||
// Disable encryption proxy to prevent recursive calls
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$keypair = Crypt::createKeypair();
|
||||
|
||||
// Save public key
|
||||
$view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
|
||||
// Disable encryption proxy to prevent recursive calls
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
// Encrypt private key empty passphrase
|
||||
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
|
||||
// Save public key
|
||||
$view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
|
||||
|
||||
// Save private key
|
||||
$view->file_put_contents(
|
||||
'/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
|
||||
// Encrypt private key empty passphrase
|
||||
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
|
||||
|
||||
if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
|
||||
$util = new Util($view, $user);
|
||||
$util->recoverUsersFiles($recoveryPassword);
|
||||
// Save private key
|
||||
$view->file_put_contents(
|
||||
'/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
|
||||
|
||||
if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
|
||||
$util = new Util($view, $user);
|
||||
$util->recoverUsersFiles($recoveryPassword);
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
}
|
||||
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -318,8 +323,8 @@ class Hooks {
|
||||
// get the parent from current share
|
||||
$parent = $util->getShareParent($params['parent']);
|
||||
|
||||
// if parent is file the it is an 1:1 share
|
||||
if ($parent['item_type'] === 'file') {
|
||||
// if parent has the same type than the child it is a 1:1 share
|
||||
if ($parent['item_type'] === $params['itemType']) {
|
||||
|
||||
// prefix path with Shared
|
||||
$path = '/Shared' . $parent['file_target'];
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) 2013
|
||||
* Bjoern Schiessle <schiessle@owncloud.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
|
||||
$(document).ready(function(){
|
||||
$('form[name="login"]').on('submit', function() {
|
||||
var user = $('#user').val();
|
||||
var password = $('#password').val();
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
url: OC.linkTo('files_encryption', 'ajax/getMigrationStatus.php'),
|
||||
dataType: 'json',
|
||||
data: {user: user, password: password},
|
||||
async: false,
|
||||
success: function(response) {
|
||||
if (response.data.migrationCompleted === false) {
|
||||
var message = t('files_encryption', 'Initial encryption started... This can take some time. Please wait.');
|
||||
$('#messageText').text(message);
|
||||
$('#message').removeClass('hidden').addClass('update');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
|
||||
"Private key password successfully updated." => "Heslo soukromého klíče úspěšně aktualizováno.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Nelze aktualizovat heslo soukromého klíče. Možná nebylo staré heslo správně.",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Aplikace pro šifrování není inicializována! Je možné, že aplikace byla znovu aktivována během vašeho přihlášení. Zkuste se prosím odhlásit a znovu přihlásit pro provedení inicializace šifrovací aplikace.",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Váš soukromý klíč není platný! Pravděpodobně bylo vaše heslo změněno vně systému %s (např. ve vašem firemním adresáři). Heslo vašeho soukromého klíče můžete změnit ve svém osobním nastavení pro obnovení přístupu k vašim zašifrovaným souborům.",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Tento soubor se nepodařilo dešifrovat, pravděpodobně je sdílený. Požádejte prosím majitele souboru, aby jej s vámi znovu sdílel.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Neznámá chyba, zkontrolujte vaše systémová nastavení nebo kontaktujte vašeho správce",
|
||||
"Missing requirements." => "Nesplněné závislosti.",
|
||||
|
||||
@@ -1,13 +1,34 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Recovery key successfully enabled" => "Επιτυχής ενεργοποίηση κλειδιού ανάκτησης",
|
||||
"Could not enable recovery key. Please check your recovery key password!" => "Αποτυχία ενεργοποίησης κλειδιού ανάκτησης. Παρακαλώ ελέγξτε τον κωδικό του κλειδιού ανάκτησής σας!",
|
||||
"Recovery key successfully disabled" => "Επιτυχής απενεργοποίηση κλειδιού ανάκτησης",
|
||||
"Could not disable recovery key. Please check your recovery key password!" => "Αποτυχία απενεργοποίησης κλειδιού ανάκτησης. Παρακαλώ ελέγξτε τον κωδικό του κλειδιού ανάκτησής σας!",
|
||||
"Password successfully changed." => "Ο κωδικός αλλάχτηκε επιτυχώς.",
|
||||
"Could not change the password. Maybe the old password was not correct." => "Αποτυχία αλλαγής κωδικού ίσως ο παλιός κωδικός να μην ήταν σωστός.",
|
||||
"Private key password successfully updated." => "Το Προσωπικό κλειδί πρόσβασης ενημερώθηκε επιτυχώς",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Αποτυχία ενημέρωσης του κωδικού για το προσωπικό κλειδί. Ενδεχομένως ο παλιός κωδικός δεν ήταν σωστός.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Άγνωστο σφάλμα, παρακαλώ ελέγξτε τις ρυθμίσεις συστήματος ή επικοινωνήστε με τον διαχειριστή σας ",
|
||||
"Missing requirements." => "Προαπαιτούμενα που απουσιάζουν.",
|
||||
"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Παρακαλώ επιβεβαιώστε ότι η PHP 5.3.3 ή νεότερη είναι εγκατεστημένη και ότι το OpenSSL μαζί με το PHP extension είναι ενεργοποιήμένο και έχει ρυθμιστεί σωστά. Προς το παρόν, η εφαρμογή κρυπτογράφησης είναι απενεργοποιημένη.",
|
||||
"Following users are not set up for encryption:" => "Οι κάτωθι χρήστες δεν έχουν ρυθμιστεί για κρυπογράφηση:",
|
||||
"Saving..." => "Γίνεται αποθήκευση...",
|
||||
"Go directly to your " => "Πηγαίνε απευθείας στο ",
|
||||
"personal settings" => "προσωπικές ρυθμίσεις",
|
||||
"Encryption" => "Κρυπτογράφηση",
|
||||
"Recovery key password" => "Επαναφορά κωδικού κλειδιού",
|
||||
"Enabled" => "Ενεργοποιημένο",
|
||||
"Disabled" => "Απενεργοποιημένο",
|
||||
"New Recovery key password" => "Νέο κλειδί επαναφοράς κωδικού",
|
||||
"Change Password" => "Αλλαγή Κωδικού Πρόσβασης",
|
||||
"File recovery settings updated" => "Οι ρυθμίσεις επαναφοράς αρχείων ανανεώθηκαν"
|
||||
"Your private key password no longer match your log-in password:" => "Ο κωδικός του προσωπικού κλειδιού δεν ταιριάζει πλέον με τον κωδικό σύνδεσής σας:",
|
||||
" If you don't remember your old password you can ask your administrator to recover your files." => "Εάν δεν θυμάστε τον παλιό σας κωδικό μπορείτε να ζητήσετε από τον διαχειριστή σας να επανακτήσει τα αρχεία σας.",
|
||||
"Old log-in password" => "Παλαιό συνθηματικό εισόδου",
|
||||
"Current log-in password" => "Τρέχον συνθηματικό πρόσβασης",
|
||||
"Update Private Key Password" => "Ενημέρωση Προσωπικού Κλειδού Πρόσβασης",
|
||||
"Enable password recovery:" => "Ενεργοποιήστε την ανάκτηση κωδικού πρόσβασης",
|
||||
"Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" => "Η ενεργοποίηση αυτής της επιλογής θα σας επιτρέψει να επανακτήσετε πρόσβαση στα κρυπτογραφημένα σας αρχεία σε περίπτωση απώλειας του κωδικού σας",
|
||||
"File recovery settings updated" => "Οι ρυθμίσεις επαναφοράς αρχείων ανανεώθηκαν",
|
||||
"Could not update file recovery" => "Αποτυχία ενημέρωσης ανάκτησης αρχείων"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
|
||||
|
||||
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
|
||||
"Private key password successfully updated." => "秘密鍵のパスワードが正常に更新されました。",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "秘密鍵のパスワードを更新できませんでした。古いパスワードが正確でない場合があります。",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "暗号化アプリが初期化されていません。暗号化アプリが接続中に再度有効かされた可能性があります。暗号化アプリを初期化する為に、1回ログアウトしてログインしなおしてください。",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "プライベートキーが有効ではありません!パスワードが%sの外部で変更された(例: 共同ディレクトリ)と思われます。個人設定でプライベートキーのパスワードを更新して、暗号化ファイルへのアクセスを回復することができます。",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "このファイルを復号化できません、共有ファイルの可能性があります。ファイルの所有者にお願いして、ファイルを共有しなおしてもらってください。",
|
||||
"Unknown error please check your system settings or contact your administrator" => "不明なエラーです。システム設定を確認するか、管理者に問い合わせてください。",
|
||||
"Missing requirements." => "必要要件が満たされていません。",
|
||||
|
||||
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
|
||||
"Private key password successfully updated." => "Pomyślnie zaktualizowano hasło klucza prywatnego.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Nie można zmienić prywatnego hasła. Może stare hasło nie było poprawne.",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Szyfrowanie aplikacja nie została zainicjowane! Może szyfrowanie aplikacji zostało ponownie włączone podczas tej sesji. Spróbuj się wylogować i zalogować ponownie aby zainicjować szyfrowanie aplikacji.",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Klucz prywatny nie jest poprawny! Prawdopodobnie Twoje hasło zostało zmienione poza %s (np. w katalogu firmy). Aby odzyskać dostęp do zaszyfrowanych plików można zaktualizować hasło klucza prywatnego w ustawieniach osobistych.",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Nie można odszyfrować tego pliku, prawdopodobnie jest to plik udostępniony. Poproś właściciela pliku o ponowne udostępnianie pliku Tobie.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Nieznany błąd proszę sprawdzić ustawienia systemu lub skontaktuj się z administratorem",
|
||||
"Missing requirements." => "Brak wymagań.",
|
||||
|
||||
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
|
||||
"Private key password successfully updated." => "Heslo súkromného kľúča je úspešne aktualizované.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Nemožno aktualizovať heslo súkromného kľúča. Možno nebolo staré heslo správne.",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Šifrovacia aplikácia nie je inicializovaná. Je možné, že aplikácia bola znova aktivovaná počas vášho prihlasovania. Pokúste sa odhlásiť a znova prihlásiť pre inicializáciu šifrovania.",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Váš súkromný kľúč nie je platný! Možno bolo vaše heslo zmenené mimo %s (napr. firemný priečinok). Môžete si aktualizovať heslo svojho súkromného kľúča vo vašom osobnom nastavení, ak si chcete obnoviť prístup k šifrovaným súborom.",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Tento súbor sa nepodarilo dešifrovať, pravdepodobne je zdieľaný. Požiadajte majiteľa súboru, aby ho s vami znovu vyzdieľal.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Neznáma chyba, skontrolujte si vaše systémové nastavenia alebo kontaktujte administrátora",
|
||||
"Missing requirements." => "Chýbajúce požiadavky.",
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Recovery key successfully enabled" => "Ključ za obnovitev gesla je bil uspešno nastavljen",
|
||||
"Could not enable recovery key. Please check your recovery key password!" => "Ključa za obnovitev gesla ni bilo mogoče nastaviti. Preverite ključ!",
|
||||
"Recovery key successfully disabled" => "Ključ za obnovitev gesla je bil uspešno onemogočen",
|
||||
"Could not disable recovery key. Please check your recovery key password!" => "Ključa za obnovitev gesla ni bilo mogoče onemogočiti. Preverite ključ!",
|
||||
"Password successfully changed." => "Geslo je bilo uspešno spremenjeno.",
|
||||
"Could not change the password. Maybe the old password was not correct." => "Gesla ni bilo mogoče spremeniti. Morda vnos starega gesla ni bil pravilen.",
|
||||
"Private key password successfully updated." => "Zasebni ključ za geslo je bil uspešno posodobljen.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Zasebnega ključa za geslo ni bilo mogoče posodobiti. Morda vnos starega gesla ni bil pravilen.",
|
||||
"Recovery key successfully enabled" => "Ključ za obnovitev gesla je uspešno nastavljen",
|
||||
"Could not enable recovery key. Please check your recovery key password!" => "Ključa za obnovitev gesla ni mogoče nastaviti. Preverite ključ!",
|
||||
"Recovery key successfully disabled" => "Ključ za obnovitev gesla je uspešno onemogočen",
|
||||
"Could not disable recovery key. Please check your recovery key password!" => "Ključa za obnovitev gesla ni mogoče onemogočiti. Preverite ključ!",
|
||||
"Password successfully changed." => "Geslo je uspešno spremenjeno.",
|
||||
"Could not change the password. Maybe the old password was not correct." => "Gesla ni mogoče spremeniti. Morda vnos starega gesla ni pravilen.",
|
||||
"Private key password successfully updated." => "Zasebni ključ za geslo je uspešno posodobljen.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Zasebnega ključa za geslo ni mogoče posodobiti. Morda vnos starega gesla ni bil pravilen.",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Program za šifriranje ni začet. Morda je bil program ponovno omogočen šele med zagonom trenutne seje. Odjavite se in se nato prijavite nazaj. S tem morda razrešite napako.",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Zasebni ključ ni veljaven. Najverjetneje je bilo geslo spremenjeno izven %s (najverjetneje je to poslovna mapa). Geslo lahko posodobite med osebnimi nastavitvami in s tem obnovite dostop do šifriranih datotek.",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Te datoteke ni mogoče šifrirati, ker je to najverjetneje datoteka v souporabi. Prosite lastnika datoteke, da jo da ponovno v souporabo.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Prišlo je do neznane napake. Preverite nastavitve sistema ali pa stopite v stik s skrbnikom sistema.",
|
||||
"Missing requirements." => "Manjkajoče zahteve",
|
||||
"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Preverite, da imate na strežniku nameščen paket PHP 5.3.3 ali novejši in da je omogočen in pravilno nastavljen PHP OpenSSL . Zaenkrat je šifriranje onemogočeno.",
|
||||
"Following users are not set up for encryption:" => "Naslednji uporabniki še nimajo nastavljenega šifriranja:",
|
||||
"Please make sure that PHP 5.3.3 or newer is installed and that OpenSSL together with the PHP extension is enabled and configured properly. For now, the encryption app has been disabled." => "Preverite, ali je na strežniku nameščen paket PHP 5.3.3 ali novejši, da je omogočen in pravilno nastavljen PHP OpenSSL. Z obstoječimi možnostmi šifriranje ni mogoče.",
|
||||
"Following users are not set up for encryption:" => "Navedeni uporabniki še nimajo nastavljenega šifriranja:",
|
||||
"Saving..." => "Poteka shranjevanje ...",
|
||||
"Go directly to your " => "Skočite neposredno na",
|
||||
"personal settings" => "osebne nastavitve",
|
||||
"Encryption" => "Šifriranje",
|
||||
"Enable recovery key (allow to recover users files in case of password loss):" => "Omogoči ključ za obnovitev datotek (v primeru izgube gesla)",
|
||||
"Enable recovery key (allow to recover users files in case of password loss):" => "Omogoči ključ za obnovitev datotek (v primeru izgube gesla):",
|
||||
"Recovery key password" => "Ključ za obnovitev gesla",
|
||||
"Repeat Recovery key password" => "Ponovi ključ za obnovitev gesla",
|
||||
"Enabled" => "Omogočeno",
|
||||
"Disabled" => "Onemogočeno",
|
||||
"Change recovery key password:" => "Spremeni ključ za obnovitev gesla:",
|
||||
"Old Recovery key password" => "Stari ključ za obnovitev gesla",
|
||||
"New Recovery key password" => "Nov ključ za obnovitev gesla",
|
||||
"New Recovery key password" => "Novi ključ za obnovitev gesla",
|
||||
"Repeat New Recovery key password" => "Ponovi novi ključ za obnovitev gesla",
|
||||
"Change Password" => "Spremeni geslo",
|
||||
"Your private key password no longer match your log-in password:" => "Vaš zasebni ključ za geslo se ne ujema z vnešenim geslom ob prijavi:",
|
||||
"Set your old private key password to your current log-in password." => "Nastavite svoj star zasebni ključ v geslo, vnešeno ob prijavi.",
|
||||
" If you don't remember your old password you can ask your administrator to recover your files." => "Če ste svoje geslo pozabili, lahko vaše datoteke obnovi skrbnik sistema.",
|
||||
"Your private key password no longer match your log-in password:" => "Vaš zasebni ključ za geslo se ne ujema z geslom, vnesenim ob prijavi:",
|
||||
"Set your old private key password to your current log-in password." => "Nastavite svoj star zasebni ključ v geslo, vneseno ob prijavi.",
|
||||
" If you don't remember your old password you can ask your administrator to recover your files." => "Če ste pozabili svoje geslo, lahko vaše datoteke obnovi le skrbnik sistema.",
|
||||
"Old log-in password" => "Staro geslo",
|
||||
"Current log-in password" => "Trenutno geslo",
|
||||
"Update Private Key Password" => "Posodobi zasebni ključ",
|
||||
"Enable password recovery:" => "Omogoči obnovitev gesla:",
|
||||
"Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" => "Nastavitev te možnosti omogoča ponovno pridobitev dostopa do šifriranih datotek, v primeru da boste geslo pozabili.",
|
||||
"File recovery settings updated" => "Nastavitve obnavljanja dokumentov so bile posodobljene",
|
||||
"Could not update file recovery" => "Nastavitev za obnavljanje dokumentov ni bilo mogoče posodobiti"
|
||||
"Enabling this option will allow you to reobtain access to your encrypted files in case of password loss" => "Nastavitev te možnosti omogoča ponovno pridobitev dostopa do šifriranih datotek, v primeru, da boste geslo pozabili.",
|
||||
"File recovery settings updated" => "Nastavitve obnavljanja dokumentov so posodobljene",
|
||||
"Could not update file recovery" => "Nastavitev za obnavljanje dokumentov ni mogoče posodobiti"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
|
||||
|
||||
@@ -9,6 +9,7 @@ $TRANSLATIONS = array(
|
||||
"Private key password successfully updated." => "Den privata nyckelns lösenord uppdaterades utan problem.",
|
||||
"Could not update the private key password. Maybe the old password was not correct." => "Kunde inte uppdatera lösenordet för den privata nyckeln. Kanske var det gamla lösenordet fel.",
|
||||
"Encryption app not initialized! Maybe the encryption app was re-enabled during your session. Please try to log out and log back in to initialize the encryption app." => "Krypteringsprogrammet kunde inte initieras! Möjligen blev krypteringsprogrammet återaktiverad under din session. Försök med att logga ut och in igen för att initiera krypteringsprogrammet.",
|
||||
"Your private key is not valid! Likely your password was changed outside of %s (e.g. your corporate directory). You can update your private key password in your personal settings to recover access to your encrypted files." => "Din privata lösenordsnyckel är inte giltig! Troligen har ditt lösenord ändrats utanför %s (t.ex. i företagets katalogtjänst). Du kan uppdatera den privata lösenordsnyckeln under dina personliga inställningar för att återfå tillgång till dina filer.",
|
||||
"Can not decrypt this file, probably this is a shared file. Please ask the file owner to reshare the file with you." => "Kan ej dekryptera denna fil, förmodligen är det en delad fil. Be ägaren av filen att dela den med dig.",
|
||||
"Unknown error please check your system settings or contact your administrator" => "Oväntat fel, kolla dina system inställningar eller kontakta din administratör",
|
||||
"Missing requirements." => "Krav som saknas",
|
||||
|
||||
@@ -165,7 +165,7 @@ class Helper {
|
||||
public static function isPartialFilePath($path) {
|
||||
|
||||
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
||||
if ( $extension === 'part' || $extension === 'etmp') {
|
||||
if ( $extension === 'part') {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -183,7 +183,7 @@ class Helper {
|
||||
public static function stripPartialFileExtension($path) {
|
||||
$extension = pathinfo($path, PATHINFO_EXTENSION);
|
||||
|
||||
if ( $extension === 'part' || $extension === 'etmp') {
|
||||
if ( $extension === 'part') {
|
||||
|
||||
$newLength = strlen($path) - 5; // 5 = strlen(".part") = strlen(".etmp")
|
||||
$fPath = substr($path, 0, $newLength);
|
||||
@@ -225,10 +225,7 @@ class Helper {
|
||||
* @return bool
|
||||
*/
|
||||
public static function isPublicAccess() {
|
||||
if (\OCP\USER::getUser() === false
|
||||
|| (isset($_GET['service']) && $_GET['service'] == 'files'
|
||||
&& isset($_GET['t']))
|
||||
) {
|
||||
if (\OCP\User::getUser() === false) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
@@ -256,24 +253,88 @@ class Helper {
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get path to the correspondig file in data/user/files
|
||||
* @brief try to get the user from the path if no user is logged in
|
||||
* @param string $path
|
||||
* @return mixed user or false if we couldn't determine a user
|
||||
*/
|
||||
public static function getUser($path) {
|
||||
|
||||
$user = \OCP\User::getUser();
|
||||
|
||||
|
||||
// if we are logged in, then we return the userid
|
||||
if ($user) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
// if no user is logged in we try to access a publicly shared files.
|
||||
// In this case we need to try to get the user from the path
|
||||
|
||||
$trimmed = ltrim($path, '/');
|
||||
$split = explode('/', $trimmed);
|
||||
|
||||
// it is not a file relative to data/user/files
|
||||
if (count($split) < 2 || $split[1] !== 'files') {
|
||||
return false;
|
||||
}
|
||||
|
||||
$user = $split[0];
|
||||
|
||||
if (\OCP\User::userExists($user)) {
|
||||
return $user;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief get path to the corresponding file in data/user/files if path points
|
||||
* to a version or to a file in cache
|
||||
* @param string $path path to a version or a file in the trash
|
||||
* @return string path to correspondig file relative to data/user/files
|
||||
* @return string path to corresponding file relative to data/user/files
|
||||
*/
|
||||
public static function getPathToRealFile($path) {
|
||||
$trimmed = ltrim($path, '/');
|
||||
$split = explode('/', $trimmed);
|
||||
$result = false;
|
||||
|
||||
if (count($split) < 3 || $split[1] !== "files_versions") {
|
||||
return false;
|
||||
if (count($split) >= 3 && ($split[1] === "files_versions" || $split[1] === 'cache')) {
|
||||
$sliced = array_slice($split, 2);
|
||||
$result = implode('/', $sliced);
|
||||
if ($split[1] === "files_versions") {
|
||||
// we skip user/files
|
||||
$sliced = array_slice($split, 2);
|
||||
$relPath = implode('/', $sliced);
|
||||
//remove the last .v
|
||||
$result = substr($relPath, 0, strrpos($relPath, '.v'));
|
||||
}
|
||||
if ($split[1] === "cache") {
|
||||
// we skip /user/cache/transactionId
|
||||
$sliced = array_slice($split, 3);
|
||||
$result = implode('/', $sliced);
|
||||
//prepare the folders
|
||||
self::mkdirr($path, new \OC\Files\View('/'));
|
||||
}
|
||||
}
|
||||
|
||||
$sliced = array_slice($split, 2);
|
||||
$realPath = implode('/', $sliced);
|
||||
//remove the last .v
|
||||
$realPath = substr($realPath, 0, strrpos($realPath, '.v'));
|
||||
return $result;
|
||||
}
|
||||
|
||||
return $realPath;
|
||||
/**
|
||||
* @brief create directory recursively
|
||||
* @param string $path
|
||||
* @param \OC\Files\View $view
|
||||
*/
|
||||
public static function mkdirr($path, $view) {
|
||||
$dirname = \OC_Filesystem::normalizePath(dirname($path));
|
||||
$dirParts = explode('/', $dirname);
|
||||
$dir = "";
|
||||
foreach ($dirParts as $part) {
|
||||
$dir = $dir . '/' . $part;
|
||||
if (!$view->file_exists($dir)) {
|
||||
$view->mkdir($dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -112,21 +112,18 @@ class Keymanager {
|
||||
* @brief store file encryption key
|
||||
*
|
||||
* @param \OC_FilesystemView $view
|
||||
* @param \OCA\Encryption\Util $util
|
||||
* @param string $path relative path of the file, including filename
|
||||
* @param $userId
|
||||
* @param $catfile
|
||||
* @internal param string $key
|
||||
* @param string $catfile keyfile content
|
||||
* @return bool true/false
|
||||
* @note The keyfile is not encrypted here. Client code must
|
||||
* asymmetrically encrypt the keyfile before passing it to this method
|
||||
*/
|
||||
public static function setFileKey(\OC_FilesystemView $view, $path, $userId, $catfile) {
|
||||
public static function setFileKey(\OC_FilesystemView $view, $util, $path, $catfile) {
|
||||
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
list($owner, $filename) = $util->getUidAndFilename($path);
|
||||
|
||||
// in case of system wide mount points the keys are stored directly in the data directory
|
||||
@@ -172,16 +169,15 @@ class Keymanager {
|
||||
/**
|
||||
* @brief retrieve keyfile for an encrypted file
|
||||
* @param \OC_FilesystemView $view
|
||||
* @param $userId
|
||||
* @param \OCA\Encryption\Util $util
|
||||
* @param $filePath
|
||||
* @internal param \OCA\Encryption\file $string name
|
||||
* @return string file key or false
|
||||
* @note The keyfile returned is asymmetrically encrypted. Decryption
|
||||
* of the keyfile must be performed by client code
|
||||
*/
|
||||
public static function getFileKey(\OC_FilesystemView $view, $userId, $filePath) {
|
||||
public static function getFileKey($view, $util, $filePath) {
|
||||
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($filePath);
|
||||
$filename = Helper::stripPartialFileExtension($filename);
|
||||
@@ -217,17 +213,17 @@ class Keymanager {
|
||||
* @brief Delete a keyfile
|
||||
*
|
||||
* @param \OC_FilesystemView $view
|
||||
* @param string $userId username
|
||||
* @param string $path path of the file the key belongs to
|
||||
* @return bool Outcome of unlink operation
|
||||
* @note $path must be relative to data/user/files. e.g. mydoc.txt NOT
|
||||
* /data/admin/files/mydoc.txt
|
||||
*/
|
||||
public static function deleteFileKey(\OC_FilesystemView $view, $userId, $path) {
|
||||
public static function deleteFileKey(\OC_FilesystemView $view, $path) {
|
||||
|
||||
$trimmed = ltrim($path, '/');
|
||||
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
if($util->isSystemWideMountPoint($path)) {
|
||||
$keyPath = '/files_encryption/keyfiles/' . $trimmed;
|
||||
@@ -316,16 +312,15 @@ class Keymanager {
|
||||
/**
|
||||
* @brief store multiple share keys for a single file
|
||||
* @param \OC_FilesystemView $view
|
||||
* @param $path
|
||||
* @param \OCA\Encryption\Util $util
|
||||
* @param string $path
|
||||
* @param array $shareKeys
|
||||
* @return bool
|
||||
*/
|
||||
public static function setShareKeys(\OC_FilesystemView $view, $path, array $shareKeys) {
|
||||
public static function setShareKeys(\OC_FilesystemView $view, $util, $path, array $shareKeys) {
|
||||
|
||||
// $shareKeys must be an array with the following format:
|
||||
// [userId] => [encrypted key]
|
||||
// Here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($path);
|
||||
|
||||
@@ -364,21 +359,18 @@ class Keymanager {
|
||||
* @brief retrieve shareKey for an encrypted file
|
||||
* @param \OC_FilesystemView $view
|
||||
* @param string $userId
|
||||
* @param \OCA\Encryption\Util $util
|
||||
* @param string $filePath
|
||||
* @internal param \OCA\Encryption\file $string name
|
||||
* @return string file key or false
|
||||
* @note The sharekey returned is encrypted. Decryption
|
||||
* of the keyfile must be performed by client code
|
||||
*/
|
||||
public static function getShareKey(\OC_FilesystemView $view, $userId, $filePath) {
|
||||
public static function getShareKey(\OC_FilesystemView $view, $userId, $util, $filePath) {
|
||||
|
||||
// try reusing key file if part file
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($filePath);
|
||||
$filename = Helper::stripPartialFileExtension($filename);
|
||||
// in case of system wide mount points the keys are stored directly in the data directory
|
||||
@@ -445,8 +437,9 @@ class Keymanager {
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
//here we need the currently logged in user, while userId can be a different user
|
||||
$util = new Util($view, \OCP\User::getUser());
|
||||
$userId = Helper::getUser($filePath);
|
||||
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
list($owner, $filename) = $util->getUidAndFilename($filePath);
|
||||
|
||||
|
||||
@@ -47,8 +47,10 @@ class Proxy extends \OC_FileProxy {
|
||||
*/
|
||||
private static function shouldEncrypt($path) {
|
||||
|
||||
$userId = Helper::getUser($path);
|
||||
|
||||
if (\OCP\App::isEnabled('files_encryption') === false || Crypt::mode() !== 'server' ||
|
||||
strpos($path, '/' . \OCP\User::getUser() . '/files') !== 0) {
|
||||
strpos($path, '/' . $userId . '/files') !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -90,7 +92,13 @@ class Proxy extends \OC_FileProxy {
|
||||
return true;
|
||||
}
|
||||
|
||||
$handle = fopen('crypt://' . $path . '.etmp', 'w');
|
||||
// create random cache folder
|
||||
$cacheFolder = rand();
|
||||
$path_slices = explode('/', \OC_Filesystem::normalizePath($path));
|
||||
$path_slices[2] = "cache/".$cacheFolder;
|
||||
$tmpPath = implode('/', $path_slices);
|
||||
|
||||
$handle = fopen('crypt://' . $tmpPath, 'w');
|
||||
if (is_resource($handle)) {
|
||||
|
||||
// write data to stream
|
||||
@@ -104,10 +112,10 @@ class Proxy extends \OC_FileProxy {
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
// get encrypted content
|
||||
$data = $view->file_get_contents($path . '.etmp');
|
||||
$data = $view->file_get_contents($tmpPath);
|
||||
|
||||
// remove our temp file
|
||||
$view->unlink($path . '.etmp');
|
||||
$view->deleteAll('/' . \OCP\User::getUser() . '/cache/' . $cacheFolder);
|
||||
|
||||
// re-enable proxy - our work is done
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
@@ -195,7 +203,7 @@ class Proxy extends \OC_FileProxy {
|
||||
list($owner, $ownerPath) = $util->getUidAndFilename($relativePath);
|
||||
|
||||
// Delete keyfile & shareKey so it isn't orphaned
|
||||
if (!Keymanager::deleteFileKey($view, $owner, $ownerPath)) {
|
||||
if (!Keymanager::deleteFileKey($view, $ownerPath)) {
|
||||
\OCP\Util::writeLog('Encryption library',
|
||||
'Keyfile or shareKey could not be deleted for file "' . $ownerPath . '"', \OCP\Util::ERROR);
|
||||
}
|
||||
@@ -238,9 +246,6 @@ class Proxy extends \OC_FileProxy {
|
||||
// split the path parts
|
||||
$pathParts = explode('/', $path);
|
||||
|
||||
// get relative path
|
||||
$relativePath = \OCA\Encryption\Helper::stripUserFilesPath($path);
|
||||
|
||||
// FIXME: handling for /userId/cache used by webdav for chunking. The cache chunks are NOT encrypted
|
||||
if (isset($pathParts[2]) && $pathParts[2] === 'cache') {
|
||||
return $result;
|
||||
@@ -254,7 +259,8 @@ class Proxy extends \OC_FileProxy {
|
||||
|
||||
$view = new \OC_FilesystemView('');
|
||||
|
||||
$util = new Util($view, \OCP\USER::getUser());
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
// If file is already encrypted, decrypt using crypto protocol
|
||||
if (
|
||||
@@ -317,7 +323,7 @@ class Proxy extends \OC_FileProxy {
|
||||
|
||||
$view = new \OC_FilesystemView('/');
|
||||
|
||||
$userId = \OCP\User::getUser();
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
// if encryption is no longer enabled or if the files aren't migrated yet
|
||||
@@ -343,7 +349,10 @@ class Proxy extends \OC_FileProxy {
|
||||
$fileInfo = false;
|
||||
// get file info from database/cache if not .part file
|
||||
if (!Helper::isPartialFilePath($path)) {
|
||||
$proxyState = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$fileInfo = $view->getFileInfo($path);
|
||||
\OC_FileProxy::$enabled = $proxyState;
|
||||
}
|
||||
|
||||
// if file is encrypted return real file size
|
||||
@@ -392,7 +401,7 @@ class Proxy extends \OC_FileProxy {
|
||||
|
||||
$view = new \OC_FilesystemView('/');
|
||||
$session = new \OCA\Encryption\Session($view);
|
||||
$userId = \OCP\User::getUser();
|
||||
$userId = Helper::getUser($path);
|
||||
$util = new Util($view, $userId);
|
||||
|
||||
// split the path parts
|
||||
|
||||
@@ -55,6 +55,7 @@ class Stream {
|
||||
private $rawPath; // The raw path relative to the data dir
|
||||
private $relPath; // rel path to users file dir
|
||||
private $userId;
|
||||
private $keyId;
|
||||
private $handle; // Resource returned by fopen
|
||||
private $meta = array(); // Header / meta for source stream
|
||||
private $writeCache;
|
||||
@@ -67,6 +68,7 @@ class Stream {
|
||||
* @var \OC\Files\View
|
||||
*/
|
||||
private $rootView; // a fsview object set to '/'
|
||||
|
||||
/**
|
||||
* @var \OCA\Encryption\Session
|
||||
*/
|
||||
@@ -89,17 +91,22 @@ class Stream {
|
||||
$this->rootView = new \OC_FilesystemView('/');
|
||||
}
|
||||
|
||||
|
||||
$this->session = new \OCA\Encryption\Session($this->rootView);
|
||||
|
||||
$this->privateKey = $this->session->getPrivateKey($this->userId);
|
||||
|
||||
$util = new Util($this->rootView, \OCP\USER::getUser());
|
||||
|
||||
$this->userId = $util->getUserId();
|
||||
$this->privateKey = $this->session->getPrivateKey();
|
||||
|
||||
// rawPath is relative to the data directory
|
||||
$this->rawPath = \OC\Files\Filesystem::normalizePath(str_replace('crypt://', '', $path));
|
||||
|
||||
$this->userId = Helper::getUser($this->rawPath);
|
||||
|
||||
$util = new Util($this->rootView, $this->userId);
|
||||
|
||||
// get the key ID which we want to use, can be the users key or the
|
||||
// public share key
|
||||
$this->keyId = $util->getKeyId();
|
||||
|
||||
// Strip identifier text from path, this gives us the path relative to data/<user>/files
|
||||
$this->relPath = Helper::stripUserFilesPath($this->rawPath);
|
||||
// if raw path doesn't point to a real file, check if it is a version or a file in the trash bin
|
||||
@@ -108,7 +115,7 @@ class Stream {
|
||||
}
|
||||
|
||||
if($this->relPath === false) {
|
||||
\OCP\Util::writeLog('Encryption library', 'failed to open file "' . $this->rawPath . '" expecting a path to user/files or to user/files_versions', \OCP\Util::ERROR);
|
||||
\OCP\Util::writeLog('Encryption library', 'failed to open file "' . $this->rawPath . '" expecting a path to "files", "files_versions" or "cache"', \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -249,12 +256,13 @@ class Stream {
|
||||
|
||||
// Fetch and decrypt keyfile
|
||||
// Fetch existing keyfile
|
||||
$this->encKeyfile = Keymanager::getFileKey($this->rootView, $this->userId, $this->relPath);
|
||||
$util = new \OCA\Encryption\Util($this->rootView, $this->userId);
|
||||
$this->encKeyfile = Keymanager::getFileKey($this->rootView, $util, $this->relPath);
|
||||
|
||||
// If a keyfile already exists
|
||||
if ($this->encKeyfile) {
|
||||
|
||||
$shareKey = Keymanager::getShareKey($this->rootView, $this->userId, $this->relPath);
|
||||
$shareKey = Keymanager::getShareKey($this->rootView, $this->keyId, $util, $this->relPath);
|
||||
|
||||
// if there is no valid private key return false
|
||||
if ($this->privateKey === false) {
|
||||
@@ -484,13 +492,14 @@ class Stream {
|
||||
}
|
||||
|
||||
// if private key is not valid redirect user to a error page
|
||||
\OCA\Encryption\Helper::redirectToErrorPage();
|
||||
\OCA\Encryption\Helper::redirectToErrorPage($this->session);
|
||||
}
|
||||
|
||||
if (
|
||||
$this->meta['mode'] !== 'r' &&
|
||||
$this->meta['mode'] !== 'rb' &&
|
||||
$this->size > 0
|
||||
$this->size > 0 &&
|
||||
$this->unencryptedSize > 0
|
||||
) {
|
||||
|
||||
// only write keyfiles if it was a new file
|
||||
@@ -501,7 +510,7 @@ class Stream {
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
// Fetch user's public key
|
||||
$this->publicKey = Keymanager::getPublicKey($this->rootView, $this->userId);
|
||||
$this->publicKey = Keymanager::getPublicKey($this->rootView, $this->keyId);
|
||||
|
||||
// Check if OC sharing api is enabled
|
||||
$sharingEnabled = \OCP\Share::isEnabled();
|
||||
@@ -519,29 +528,31 @@ class Stream {
|
||||
$this->encKeyfiles = Crypt::multiKeyEncrypt($this->plainKey, $publicKeys);
|
||||
|
||||
// Save the new encrypted file key
|
||||
Keymanager::setFileKey($this->rootView, $this->relPath, $this->userId, $this->encKeyfiles['data']);
|
||||
Keymanager::setFileKey($this->rootView, $util, $this->relPath, $this->encKeyfiles['data']);
|
||||
|
||||
// Save the sharekeys
|
||||
Keymanager::setShareKeys($this->rootView, $this->relPath, $this->encKeyfiles['keys']);
|
||||
Keymanager::setShareKeys($this->rootView, $util, $this->relPath, $this->encKeyfiles['keys']);
|
||||
|
||||
// Re-enable proxy - our work is done
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
}
|
||||
|
||||
// we need to update the file info for the real file, not for the
|
||||
// part file.
|
||||
$path = Helper::stripPartialFileExtension($this->rawPath);
|
||||
|
||||
// get file info
|
||||
$fileInfo = $this->rootView->getFileInfo($this->rawPath);
|
||||
if (!is_array($fileInfo)) {
|
||||
$fileInfo = array();
|
||||
$fileInfo = $this->rootView->getFileInfo($path);
|
||||
if (is_array($fileInfo)) {
|
||||
// set encryption data
|
||||
$fileInfo['encrypted'] = true;
|
||||
$fileInfo['size'] = $this->size;
|
||||
$fileInfo['unencrypted_size'] = $this->unencryptedSize;
|
||||
|
||||
// set fileinfo
|
||||
$this->rootView->putFileInfo($path, $fileInfo);
|
||||
}
|
||||
|
||||
// set encryption data
|
||||
$fileInfo['encrypted'] = true;
|
||||
$fileInfo['size'] = $this->size;
|
||||
$fileInfo['unencrypted_size'] = $this->unencryptedSize;
|
||||
|
||||
// set fileinfo
|
||||
$this->rootView->putFileInfo($this->rawPath, $fileInfo);
|
||||
|
||||
}
|
||||
|
||||
return fclose($this->handle);
|
||||
|
||||
+105
-100
@@ -38,7 +38,8 @@ class Util {
|
||||
const MIGRATION_OPEN = 0; // user still needs to be migrated
|
||||
|
||||
private $view; // OC_FilesystemView object for filesystem operations
|
||||
private $userId; // ID of the currently logged-in user
|
||||
private $userId; // ID of the user we use to encrypt/decrypt files
|
||||
private $keyId; // ID of the key we want to manipulate
|
||||
private $client; // Client side encryption mode flag
|
||||
private $publicKeyDir; // Dir containing all public user keys
|
||||
private $encryptionDir; // Dir containing user's files_encryption
|
||||
@@ -58,47 +59,33 @@ class Util {
|
||||
public function __construct(\OC_FilesystemView $view, $userId, $client = false) {
|
||||
|
||||
$this->view = $view;
|
||||
$this->userId = $userId;
|
||||
$this->client = $client;
|
||||
$this->isPublic = false;
|
||||
$this->userId = $userId;
|
||||
|
||||
$this->publicShareKeyId = \OC_Appconfig::getValue('files_encryption', 'publicShareKeyId');
|
||||
$this->recoveryKeyId = \OC_Appconfig::getValue('files_encryption', 'recoveryKeyId');
|
||||
|
||||
// if we are anonymous/public
|
||||
if (\OCA\Encryption\Helper::isPublicAccess()) {
|
||||
$this->userId = $this->publicShareKeyId;
|
||||
|
||||
// only handle for files_sharing app
|
||||
if (isset($GLOBALS['app']) && $GLOBALS['app'] === 'files_sharing') {
|
||||
$this->userDir = '/' . $GLOBALS['fileOwner'];
|
||||
$this->fileFolderName = 'files';
|
||||
$this->userFilesDir = '/' . $GLOBALS['fileOwner'] . '/'
|
||||
. $this->fileFolderName; // TODO: Does this need to be user configurable?
|
||||
$this->publicKeyDir = '/' . 'public-keys';
|
||||
$this->encryptionDir = '/' . $GLOBALS['fileOwner'] . '/' . 'files_encryption';
|
||||
$this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
|
||||
$this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
|
||||
$this->publicKeyPath =
|
||||
$this->publicKeyDir . '/' . $this->userId . '.public.key'; // e.g. data/public-keys/admin.public.key
|
||||
$this->privateKeyPath =
|
||||
'/owncloud_private_key/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key
|
||||
$this->isPublic = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
$this->userDir = '/' . $this->userId;
|
||||
$this->fileFolderName = 'files';
|
||||
$this->userFilesDir =
|
||||
'/' . $this->userId . '/' . $this->fileFolderName; // TODO: Does this need to be user configurable?
|
||||
$this->publicKeyDir = '/' . 'public-keys';
|
||||
$this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
|
||||
$this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
|
||||
$this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
|
||||
$this->publicKeyPath =
|
||||
$this->userDir = '/' . $this->userId;
|
||||
$this->fileFolderName = 'files';
|
||||
$this->userFilesDir =
|
||||
'/' . $userId . '/' . $this->fileFolderName; // TODO: Does this need to be user configurable?
|
||||
$this->publicKeyDir = '/' . 'public-keys';
|
||||
$this->encryptionDir = '/' . $this->userId . '/' . 'files_encryption';
|
||||
$this->keyfilesPath = $this->encryptionDir . '/' . 'keyfiles';
|
||||
$this->shareKeysPath = $this->encryptionDir . '/' . 'share-keys';
|
||||
$this->publicKeyPath =
|
||||
$this->publicKeyDir . '/' . $this->userId . '.public.key'; // e.g. data/public-keys/admin.public.key
|
||||
$this->privateKeyPath =
|
||||
$this->privateKeyPath =
|
||||
$this->encryptionDir . '/' . $this->userId . '.private.key'; // e.g. data/admin/admin.private.key
|
||||
// make sure that the owners home is mounted
|
||||
\OC\Files\Filesystem::initMountPoints($userId);
|
||||
|
||||
if (\OCA\Encryption\Helper::isPublicAccess()) {
|
||||
$this->keyId = $this->publicShareKeyId;
|
||||
$this->isPublic = true;
|
||||
} else {
|
||||
$this->keyId = $this->userId;
|
||||
$this->isPublic = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,15 +101,24 @@ class Util {
|
||||
or !$this->view->file_exists($this->publicKeyPath)
|
||||
or !$this->view->file_exists($this->privateKeyPath)
|
||||
) {
|
||||
|
||||
return false;
|
||||
|
||||
} else {
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief check if the users private & public key exists
|
||||
* @return boolean
|
||||
*/
|
||||
public function userKeysExists() {
|
||||
if (
|
||||
$this->view->file_exists($this->privateKeyPath) &&
|
||||
$this->view->file_exists($this->publicKeyPath)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,13 +180,13 @@ class Util {
|
||||
// check if public-key exists but private-key is missing
|
||||
if ($this->view->file_exists($this->publicKeyPath) && !$this->view->file_exists($this->privateKeyPath)) {
|
||||
\OCP\Util::writeLog('Encryption library',
|
||||
'public key exists but private key is missing for "' . $this->userId . '"', \OCP\Util::FATAL);
|
||||
'public key exists but private key is missing for "' . $this->keyId . '"', \OCP\Util::FATAL);
|
||||
return false;
|
||||
} else {
|
||||
if (!$this->view->file_exists($this->publicKeyPath) && $this->view->file_exists($this->privateKeyPath)
|
||||
) {
|
||||
\OCP\Util::writeLog('Encryption library',
|
||||
'private key exists but public key is missing for "' . $this->userId . '"', \OCP\Util::FATAL);
|
||||
'private key exists but public key is missing for "' . $this->keyId . '"', \OCP\Util::FATAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -363,7 +359,7 @@ class Util {
|
||||
// scanning every file like this
|
||||
// will eat server resources :(
|
||||
if (
|
||||
Keymanager::getFileKey($this->view, $this->userId, $relPath)
|
||||
Keymanager::getFileKey($this->view, $this, $relPath)
|
||||
&& $isEncryptedPath
|
||||
) {
|
||||
|
||||
@@ -468,22 +464,19 @@ class Util {
|
||||
*/
|
||||
public function isEncryptedPath($path) {
|
||||
|
||||
// Disable encryption proxy so data retrieved is in its
|
||||
// original form
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$relPath = Helper::getPathToRealFile($path);
|
||||
|
||||
// we only need 24 byte from the last chunk
|
||||
$data = '';
|
||||
$handle = $this->view->fopen($path, 'r');
|
||||
if (is_resource($handle) && !fseek($handle, -24, SEEK_END)) {
|
||||
$data = fgets($handle);
|
||||
if ($relPath === false) {
|
||||
$relPath = Helper::stripUserFilesPath($path);
|
||||
}
|
||||
|
||||
// re-enable proxy
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
$fileKey = Keymanager::getFileKey($this->view, $this, $relPath);
|
||||
|
||||
return Crypt::isCatfileContent($data);
|
||||
if ($fileKey === false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
@@ -717,17 +710,17 @@ class Util {
|
||||
// Encrypt unencrypted files
|
||||
foreach ($found['encrypted'] as $encryptedFile) {
|
||||
|
||||
//get file info
|
||||
$fileInfo = \OC\Files\Filesystem::getFileInfo($encryptedFile['path']);
|
||||
|
||||
//relative to data/<user>/file
|
||||
$relPath = Helper::stripUserFilesPath($encryptedFile['path']);
|
||||
|
||||
//get file info
|
||||
$fileInfo = \OC\Files\Filesystem::getFileInfo($relPath);
|
||||
|
||||
//relative to /data
|
||||
$rawPath = $encryptedFile['path'];
|
||||
|
||||
//get timestamp
|
||||
$timestamp = $this->view->filemtime($rawPath);
|
||||
$timestamp = $fileInfo['mtime'];
|
||||
|
||||
//enable proxy to use OC\Files\View to access the original file
|
||||
\OC_FileProxy::$enabled = true;
|
||||
@@ -768,16 +761,16 @@ class Util {
|
||||
|
||||
$this->view->rename($relPath . '.part', $relPath);
|
||||
|
||||
$this->view->chroot($fakeRoot);
|
||||
|
||||
//set timestamp
|
||||
$this->view->touch($rawPath, $timestamp);
|
||||
$this->view->touch($relPath, $timestamp);
|
||||
|
||||
$this->view->chroot($fakeRoot);
|
||||
|
||||
// Add the file to the cache
|
||||
\OC\Files\Filesystem::putFileInfo($relPath, array(
|
||||
'encrypted' => false,
|
||||
'size' => $size,
|
||||
'unencrypted_size' => $size,
|
||||
'unencrypted_size' => 0,
|
||||
'etag' => $fileInfo['etag']
|
||||
));
|
||||
|
||||
@@ -839,7 +832,7 @@ class Util {
|
||||
$rawPath = '/' . $this->userId . '/files/' . $plainFile['path'];
|
||||
|
||||
// keep timestamp
|
||||
$timestamp = $this->view->filemtime($rawPath);
|
||||
$timestamp = $fileInfo['mtime'];
|
||||
|
||||
// Open plain file handle for binary reading
|
||||
$plainHandle = $this->view->fopen($rawPath, 'rb');
|
||||
@@ -847,32 +840,35 @@ class Util {
|
||||
// Open enc file handle for binary writing, with same filename as original plain file
|
||||
$encHandle = fopen('crypt://' . $rawPath . '.part', 'wb');
|
||||
|
||||
// Move plain file to a temporary location
|
||||
$size = stream_copy_to_stream($plainHandle, $encHandle);
|
||||
if (is_resource($encHandle)) {
|
||||
// Move plain file to a temporary location
|
||||
$size = stream_copy_to_stream($plainHandle, $encHandle);
|
||||
|
||||
fclose($encHandle);
|
||||
fclose($plainHandle);
|
||||
fclose($encHandle);
|
||||
fclose($plainHandle);
|
||||
|
||||
$fakeRoot = $this->view->getRoot();
|
||||
$this->view->chroot('/' . $this->userId . '/files');
|
||||
$fakeRoot = $this->view->getRoot();
|
||||
$this->view->chroot('/' . $this->userId . '/files');
|
||||
|
||||
$this->view->rename($relPath . '.part', $relPath);
|
||||
$this->view->rename($relPath . '.part', $relPath);
|
||||
|
||||
$this->view->chroot($fakeRoot);
|
||||
// set timestamp
|
||||
$this->view->touch($relPath, $timestamp);
|
||||
|
||||
// set timestamp
|
||||
$this->view->touch($rawPath, $timestamp);
|
||||
$encSize = $this->view->filesize($relPath);
|
||||
|
||||
// Add the file to the cache
|
||||
\OC\Files\Filesystem::putFileInfo($relPath, array(
|
||||
'encrypted' => true,
|
||||
'size' => $size,
|
||||
'unencrypted_size' => $size,
|
||||
'etag' => $fileInfo['etag']
|
||||
));
|
||||
$this->view->chroot($fakeRoot);
|
||||
|
||||
$encryptedFiles[] = $relPath;
|
||||
// Add the file to the cache
|
||||
\OC\Files\Filesystem::putFileInfo($relPath, array(
|
||||
'encrypted' => true,
|
||||
'size' => $encSize,
|
||||
'unencrypted_size' => $size,
|
||||
'etag' => $fileInfo['etag']
|
||||
));
|
||||
|
||||
$encryptedFiles[] = $relPath;
|
||||
}
|
||||
}
|
||||
|
||||
// Encrypt legacy encrypted files
|
||||
@@ -1055,10 +1051,10 @@ class Util {
|
||||
private function decryptKeyfile($filePath, $privateKey) {
|
||||
|
||||
// Get the encrypted keyfile
|
||||
$encKeyfile = Keymanager::getFileKey($this->view, $this->userId, $filePath);
|
||||
$encKeyfile = Keymanager::getFileKey($this->view, $this, $filePath);
|
||||
|
||||
// The file has a shareKey and must use it for decryption
|
||||
$shareKey = Keymanager::getShareKey($this->view, $this->userId, $filePath);
|
||||
$shareKey = Keymanager::getShareKey($this->view, $this->keyId, $this, $filePath);
|
||||
|
||||
$plainKeyfile = Crypt::multiKeyDecrypt($encKeyfile, $shareKey, $privateKey);
|
||||
|
||||
@@ -1109,8 +1105,8 @@ class Util {
|
||||
// Save the recrypted key to it's owner's keyfiles directory
|
||||
// Save new sharekeys to all necessary user directory
|
||||
if (
|
||||
!Keymanager::setFileKey($this->view, $filePath, $fileOwner, $multiEncKey['data'])
|
||||
|| !Keymanager::setShareKeys($this->view, $filePath, $multiEncKey['keys'])
|
||||
!Keymanager::setFileKey($this->view, $this, $filePath, $multiEncKey['data'])
|
||||
|| !Keymanager::setShareKeys($this->view, $this, $filePath, $multiEncKey['keys'])
|
||||
) {
|
||||
|
||||
\OCP\Util::writeLog('Encryption library',
|
||||
@@ -1261,7 +1257,6 @@ class Util {
|
||||
$sql = 'SELECT `migration_status` FROM `*PREFIX*encryption` WHERE `uid` = ?';
|
||||
|
||||
$args = array($this->userId);
|
||||
|
||||
$query = \OCP\DB::prepare($sql);
|
||||
|
||||
$result = $query->execute($args);
|
||||
@@ -1282,20 +1277,23 @@ class Util {
|
||||
// If no record is found
|
||||
if (empty($migrationStatus)) {
|
||||
\OCP\Util::writeLog('Encryption library', "Could not get migration status for " . $this->userId . ", no record found", \OCP\Util::ERROR);
|
||||
// insert missing entry in DB with status open
|
||||
$sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`,`migration_status`) VALUES (?,?,?,?)';
|
||||
$args = array(
|
||||
$this->userId,
|
||||
'server-side',
|
||||
0,
|
||||
self::MIGRATION_OPEN
|
||||
);
|
||||
$query = \OCP\DB::prepare($sql);
|
||||
$query->execute($args);
|
||||
// insert missing entry in DB with status open if the user exists
|
||||
if (\OCP\User::userExists($this->userId)) {
|
||||
$sql = 'INSERT INTO `*PREFIX*encryption` (`uid`,`mode`,`recovery_enabled`,`migration_status`) VALUES (?,?,?,?)';
|
||||
$args = array(
|
||||
$this->userId,
|
||||
'server-side',
|
||||
0,
|
||||
self::MIGRATION_OPEN
|
||||
);
|
||||
$query = \OCP\DB::prepare($sql);
|
||||
$query->execute($args);
|
||||
|
||||
return self::MIGRATION_OPEN;
|
||||
// If a record is found
|
||||
} else {
|
||||
return self::MIGRATION_OPEN;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else { // If a record is found
|
||||
return (int)$migrationStatus[0];
|
||||
}
|
||||
|
||||
@@ -1334,7 +1332,7 @@ class Util {
|
||||
// handle public access
|
||||
if ($this->isPublic) {
|
||||
$filename = $path;
|
||||
$fileOwnerUid = $GLOBALS['fileOwner'];
|
||||
$fileOwnerUid = $this->userId;
|
||||
|
||||
return array(
|
||||
$fileOwnerUid,
|
||||
@@ -1559,6 +1557,13 @@ class Util {
|
||||
return $this->userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getKeyId() {
|
||||
return $this->keyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<fieldset class="personalblock">
|
||||
<h2><?php p( $l->t( 'Encryption' ) ); ?></h2>
|
||||
|
||||
<?php if ( ! $_["privateKeySet"] && $_["initialized"] ): ?>
|
||||
<?php if ( $_["initialized"] === '1' ): ?>
|
||||
<p>
|
||||
<a name="changePKPasswd" />
|
||||
<label for="changePrivateKeyPasswd">
|
||||
|
||||
@@ -157,6 +157,8 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
$filename = 'tmp-' . time() . '.test';
|
||||
|
||||
$util = new Encryption\Util(new \OC_FilesystemView(), $this->userId);
|
||||
|
||||
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/'. $filename, $this->dataShort);
|
||||
|
||||
// Test that data was successfully written
|
||||
@@ -176,10 +178,10 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertNotEquals($this->dataShort, $retreivedCryptedFile);
|
||||
|
||||
// Get the encrypted keyfile
|
||||
$encKeyfile = Encryption\Keymanager::getFileKey($this->view, $this->userId, $filename);
|
||||
$encKeyfile = Encryption\Keymanager::getFileKey($this->view, $util, $filename);
|
||||
|
||||
// Attempt to fetch the user's shareKey
|
||||
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $filename);
|
||||
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $util, $filename);
|
||||
|
||||
// get session
|
||||
$session = new \OCA\Encryption\Session($this->view);
|
||||
@@ -199,7 +201,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
// Teardown
|
||||
$this->view->unlink($this->userId . '/files/' . $filename);
|
||||
|
||||
Encryption\Keymanager::deleteFileKey($this->view, $this->userId, $filename);
|
||||
Encryption\Keymanager::deleteFileKey($this->view, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,6 +216,8 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
// Generate a a random filename
|
||||
$filename = 'tmp-' . time() . '.test';
|
||||
|
||||
$util = new Encryption\Util(new \OC_FilesystemView(), $this->userId);
|
||||
|
||||
// Save long data as encrypted file using stream wrapper
|
||||
$cryptedFile = file_put_contents('crypt:///' . $this->userId . '/files/' . $filename, $this->dataLong . $this->dataLong);
|
||||
|
||||
@@ -244,16 +248,16 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
$i = 0;
|
||||
while ($i < count($r)-1) {
|
||||
$e[] = $r[$i] . $r[$i+1];
|
||||
$i = $i + 2;
|
||||
$i = $i + 2;
|
||||
}
|
||||
|
||||
//print_r($e);
|
||||
|
||||
// Get the encrypted keyfile
|
||||
$encKeyfile = Encryption\Keymanager::getFileKey($this->view, $this->userId, $filename);
|
||||
$encKeyfile = Encryption\Keymanager::getFileKey($this->view, $util, $filename);
|
||||
|
||||
// Attempt to fetch the user's shareKey
|
||||
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $filename);
|
||||
$shareKey = Encryption\Keymanager::getShareKey($this->view, $this->userId, $util, $filename);
|
||||
|
||||
// get session
|
||||
$session = new \OCA\Encryption\Session($this->view);
|
||||
@@ -283,7 +287,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
$this->view->unlink($this->userId . '/files/' . $filename);
|
||||
|
||||
Encryption\Keymanager::deleteFileKey($this->view, $this->userId, $filename);
|
||||
Encryption\Keymanager::deleteFileKey($this->view, $filename);
|
||||
|
||||
}
|
||||
|
||||
@@ -387,7 +391,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
* @brief test decryption using legacy blowfish method
|
||||
*/
|
||||
function testLegacyDecryptShort() {
|
||||
|
||||
|
||||
$crypted = $this->legacyEncrypt($this->dataShort, $this->pass);
|
||||
|
||||
$decrypted = Encryption\Crypt::legacyBlockDecrypt($crypted, $this->pass);
|
||||
@@ -401,7 +405,7 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
* @brief test decryption using legacy blowfish method
|
||||
*/
|
||||
function testLegacyDecryptLong() {
|
||||
|
||||
|
||||
$crypted = $this->legacyEncrypt($this->dataLong, $this->pass);
|
||||
|
||||
$decrypted = Encryption\Crypt::legacyBlockDecrypt($crypted, $this->pass);
|
||||
@@ -653,8 +657,8 @@ class Test_Encryption_Crypt extends \PHPUnit_Framework_TestCase {
|
||||
// tear down
|
||||
$view->unlink($filename);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief encryption using legacy blowfish method
|
||||
* @param $data string data to encrypt
|
||||
|
||||
@@ -51,4 +51,17 @@ class Test_Encryption_Helper extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertEquals('testfile.txt', Encryption\Helper::stripPartialFileExtension($filename));
|
||||
}
|
||||
|
||||
}
|
||||
function testGetPathToRealFile() {
|
||||
|
||||
// the relative path to /user/files/ that's what we want to get from getPathToRealFile()
|
||||
$relativePath = "foo/bar/test.txt";
|
||||
|
||||
// test paths
|
||||
$versionPath = "/user/files_versions/foo/bar/test.txt.v456756835";
|
||||
$cachePath = "/user/cache/transferid636483/foo/bar/test.txt";
|
||||
|
||||
$this->assertEquals($relativePath, Encryption\Helper::getPathToRealFile($versionPath));
|
||||
$this->assertEquals($relativePath, Encryption\Helper::getPathToRealFile($cachePath));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -145,13 +145,15 @@ class Test_Encryption_Keymanager extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
$file = 'unittest-' . time() . '.txt';
|
||||
|
||||
$util = new Encryption\Util($this->view, $this->userId);
|
||||
|
||||
// Disable encryption proxy to prevent recursive calls
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
|
||||
$this->view->file_put_contents($this->userId . '/files/' . $file, $this->dataShort);
|
||||
|
||||
Encryption\Keymanager::setFileKey($this->view, $file, $this->userId, $key);
|
||||
Encryption\Keymanager::setFileKey($this->view, $util, $file, $key);
|
||||
|
||||
$this->assertTrue($this->view->file_exists('/' . $this->userId . '/files_encryption/keyfiles/' . $file . '.key'));
|
||||
|
||||
|
||||
@@ -281,6 +281,64 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
|
||||
$this->assertFalse($this->util->isSharedPath($path));
|
||||
}
|
||||
|
||||
function testEncryptAll() {
|
||||
|
||||
$filename = "/encryptAll" . time() . ".txt";
|
||||
$util = new Encryption\Util($this->view, $this->userId);
|
||||
|
||||
// disable encryption to upload a unencrypted file
|
||||
\OC_App::disable('files_encryption');
|
||||
|
||||
$this->view->file_put_contents($this->userId . '/files/' . $filename, $this->dataShort);
|
||||
|
||||
$fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
|
||||
|
||||
$this->assertTrue(is_array($fileInfoUnencrypted));
|
||||
|
||||
// enable file encryption again
|
||||
\OC_App::enable('files_encryption');
|
||||
|
||||
// encrypt all unencrypted files
|
||||
$util->encryptAll('/' . $this->userId . '/' . 'files');
|
||||
|
||||
$fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
|
||||
|
||||
$this->assertTrue(is_array($fileInfoEncrypted));
|
||||
|
||||
// check if mtime and etags unchanged
|
||||
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
|
||||
$this->assertEquals($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
|
||||
|
||||
$this->view->unlink($this->userId . '/files/' . $filename);
|
||||
}
|
||||
|
||||
|
||||
function testDecryptAll() {
|
||||
|
||||
$filename = "/decryptAll" . time() . ".txt";
|
||||
$util = new Encryption\Util($this->view, $this->userId);
|
||||
|
||||
$this->view->file_put_contents($this->userId . '/files/' . $filename, $this->dataShort);
|
||||
|
||||
$fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
|
||||
|
||||
$this->assertTrue(is_array($fileInfoEncrypted));
|
||||
|
||||
// encrypt all unencrypted files
|
||||
$util->decryptAll('/' . $this->userId . '/' . 'files');
|
||||
|
||||
$fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename);
|
||||
|
||||
$this->assertTrue(is_array($fileInfoUnencrypted));
|
||||
|
||||
// check if mtime and etags unchanged
|
||||
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
|
||||
$this->assertEquals($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
|
||||
|
||||
$this->view->unlink($this->userId . '/files/' . $filename);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @large
|
||||
*/
|
||||
|
||||
+25
-3
@@ -127,6 +127,7 @@ class smb {
|
||||
$old_locale = getenv('LC_ALL');
|
||||
putenv('LC_ALL=en_US.UTF-8');
|
||||
$output = popen (SMB4PHP_SMBCLIENT." -N {$auth} {$options} {$port} {$options} {$params} 2>/dev/null", 'r');
|
||||
$gotInfo = false;
|
||||
$info = array ();
|
||||
$info['info']= array ();
|
||||
$mode = '';
|
||||
@@ -188,7 +189,12 @@ class smb {
|
||||
}
|
||||
trigger_error($regs[0].' params('.$params.')', E_USER_ERROR);
|
||||
case 'error-connect':
|
||||
return false;
|
||||
// connection error can happen after obtaining share list if
|
||||
// NetBIOS is disabled/blocked on the target server,
|
||||
// in which case we keep the info and continue
|
||||
if (!$gotInfo) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($i) switch ($i[1]) {
|
||||
case 'file':
|
||||
@@ -196,6 +202,7 @@ class smb {
|
||||
case 'disk':
|
||||
case 'server':
|
||||
case 'workgroup': $info[$i[1]][] = $i[0];
|
||||
$gotInfo = true;
|
||||
}
|
||||
}
|
||||
pclose($output);
|
||||
@@ -295,6 +302,7 @@ class smb {
|
||||
}
|
||||
|
||||
function rename ($url_from, $url_to) {
|
||||
$replace = false;
|
||||
list ($from, $to) = array (smb::parse_url($url_from), smb::parse_url($url_to));
|
||||
if ($from['host'] <> $to['host'] ||
|
||||
$from['share'] <> $to['share'] ||
|
||||
@@ -307,7 +315,20 @@ class smb {
|
||||
trigger_error('rename(): error in URL', E_USER_ERROR);
|
||||
}
|
||||
smb::clearstatcache ($url_from);
|
||||
$result = smb::execute ('rename "'.$from['path'].'" "'.$to['path'].'"', $to);
|
||||
$cmd = '';
|
||||
// check if target file exists
|
||||
if (smb::url_stat($url_to)) {
|
||||
// delete target file first
|
||||
$cmd = 'del "' . $to['path'] . '"; ';
|
||||
$replace = true;
|
||||
}
|
||||
$cmd .= 'rename "' . $from['path'] . '" "' . $to['path'] . '"';
|
||||
$result = smb::execute($cmd, $to);
|
||||
if ($replace) {
|
||||
// clear again, else the cache will return the info
|
||||
// from the old file
|
||||
smb::clearstatcache ($url_to);
|
||||
}
|
||||
return $result !== false;
|
||||
}
|
||||
|
||||
@@ -460,7 +481,8 @@ class smb_stream_wrapper extends smb {
|
||||
|
||||
function stream_tell () { return ftell($this->stream); }
|
||||
|
||||
function stream_seek ($offset, $whence=null) { return fseek($this->stream, $offset, $whence); }
|
||||
// PATCH: the wrapper must return true when fseek succeeded by returning 0.
|
||||
function stream_seek ($offset, $whence=null) { return fseek($this->stream, $offset, $whence) === 0; }
|
||||
|
||||
function stream_flush () {
|
||||
if ($this->mode <> 'r' && $this->need_flush) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Folder name" => "اسم المجلد",
|
||||
"Options" => "خيارات",
|
||||
"All Users" => "كل المستخدمين",
|
||||
"Groups" => "مجموعات",
|
||||
"Users" => "المستخدمين",
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Options" => "Опции",
|
||||
"Delete" => "Удалить"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
|
||||
@@ -9,7 +9,7 @@ $TRANSLATIONS = array(
|
||||
"<b>Warning:</b> The FTP support in PHP is not enabled or installed. Mounting of FTP shares is not possible. Please ask your system administrator to install it." => "<b>Upozornenie:</b> Podpora FTP v PHP nie je povolená alebo nainštalovaná. Nie je možné pripojenie oddielov FTP. Požiadajte administrátora systému, nech ho nainštaluje.",
|
||||
"<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it." => "<b>Varovanie:</b> nie je nainštalovaná, alebo povolená, podpora Curl v PHP. Nie je možné pripojenie oddielov ownCloud, WebDAV, či GoogleDrive. Prosím požiadajte svojho administrátora systému, nech ju nainštaluje.",
|
||||
"External Storage" => "Externé úložisko",
|
||||
"Folder name" => "Meno priečinka",
|
||||
"Folder name" => "Názov priečinka",
|
||||
"External storage" => "Externé úložisko",
|
||||
"Configuration" => "Nastavenia",
|
||||
"Options" => "Možnosti",
|
||||
@@ -21,7 +21,7 @@ $TRANSLATIONS = array(
|
||||
"Users" => "Používatelia",
|
||||
"Delete" => "Zmazať",
|
||||
"Enable User External Storage" => "Povoliť externé úložisko",
|
||||
"Allow users to mount their own external storage" => "Povoliť používateľom pripojiť ich vlastné externé úložisko",
|
||||
"Allow users to mount their own external storage" => "Povoliť používateľom pripojiť si vlastné externé úložisko",
|
||||
"SSL root certificates" => "Koreňové SSL certifikáty",
|
||||
"Import Root Certificate" => "Importovať koreňový certifikát"
|
||||
);
|
||||
|
||||
@@ -81,9 +81,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
||||
$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
|
||||
$this->test = isset($params['test']);
|
||||
$this->timeout = ( ! isset($params['timeout'])) ? 15 : $params['timeout'];
|
||||
$params['region'] = ( ! isset($params['region'])) ? 'eu-west-1' : $params['region'];
|
||||
$params['hostname'] = ( !isset($params['hostname'])) ? 's3.amazonaws.com' : $params['hostname'];
|
||||
if (!isset($params['port'])) {
|
||||
$params['region'] = ( ! isset($params['region']) || $params['region'] === '' ) ? 'eu-west-1' : $params['region'];
|
||||
$params['hostname'] = ( !isset($params['hostname']) || $params['hostname'] === '' ) ? 's3.amazonaws.com' : $params['hostname'];
|
||||
if (!isset($params['port']) || $params['port'] === '') {
|
||||
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
|
||||
}
|
||||
$base_url = $scheme.'://'.$params['hostname'].':'.$params['port'].'/';
|
||||
@@ -300,14 +300,6 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function unlink($path) {
|
||||
$path = $this->normalizePath($path);
|
||||
|
||||
@@ -515,8 +507,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
|
||||
}
|
||||
|
||||
public function test() {
|
||||
$test = $this->s3->get_canonical_user_id();
|
||||
if (isset($test['id']) && $test['id'] != '') {
|
||||
$test = $this->connection->getBucketAcl(array(
|
||||
'Bucket' => $this->bucket,
|
||||
));
|
||||
if (isset($test) && !is_null($test->getPath('Owner/ID'))) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -50,9 +50,9 @@ class OC_Mount_Config {
|
||||
'key' => 'Access Key',
|
||||
'secret' => '*Secret Key',
|
||||
'bucket' => 'Bucket',
|
||||
'hostname' => 'Hostname (optional)',
|
||||
'port' => 'Port (optional)',
|
||||
'region' => 'Region (optional)',
|
||||
'hostname' => '&Hostname (optional)',
|
||||
'port' => '&Port (optional)',
|
||||
'region' => '&Region (optional)',
|
||||
'use_ssl' => '!Enable SSL',
|
||||
'use_path_style' => '!Enable Path Style'));
|
||||
|
||||
@@ -244,6 +244,7 @@ class OC_Mount_Config {
|
||||
$storage = new $class($options);
|
||||
return $storage->test();
|
||||
} catch (Exception $exception) {
|
||||
\OCP\Util::logException('files_external', $exception);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -266,6 +267,11 @@ class OC_Mount_Config {
|
||||
$mountType,
|
||||
$applicable,
|
||||
$isPersonal = false) {
|
||||
$mountPoint = OC\Files\Filesystem::normalizePath($mountPoint);
|
||||
if ($mountPoint === '' || $mountPoint === '/' || $mountPoint == '/Shared') {
|
||||
// can't mount at root or "Shared" folder
|
||||
return false;
|
||||
}
|
||||
if ($isPersonal) {
|
||||
// Verify that the mount point applies for the current user
|
||||
// Prevent non-admin users from mounting local storage
|
||||
|
||||
@@ -50,6 +50,22 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
}
|
||||
}
|
||||
|
||||
private function deleteMetaData($path) {
|
||||
$path = $this->root.$path;
|
||||
if (isset($this->metaData[$path])) {
|
||||
unset($this->metaData[$path]);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the path's metadata
|
||||
* @param $path path for which to return the metadata
|
||||
* @param $list if true, also return the directory's contents
|
||||
* @return directory contents if $list is true, file metadata if $list is
|
||||
* false, null if the file doesn't exist or "false" if the operation failed
|
||||
*/
|
||||
private function getMetaData($path, $list = false) {
|
||||
$path = $this->root.$path;
|
||||
if ( ! $list && isset($this->metaData[$path])) {
|
||||
@@ -62,24 +78,35 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
$contents = array();
|
||||
if ($response && isset($response['contents'])) {
|
||||
$contents = $response['contents'];
|
||||
// Cache folder's contents
|
||||
foreach ($contents as $file) {
|
||||
$this->metaData[$path.'/'.basename($file['path'])] = $file;
|
||||
foreach ($response['contents'] as $file) {
|
||||
if (!isset($file['is_deleted']) || !$file['is_deleted']) {
|
||||
$this->metaData[$path.'/'.basename($file['path'])] = $file;
|
||||
$contents[] = $file;
|
||||
}
|
||||
}
|
||||
unset($response['contents']);
|
||||
}
|
||||
if (!isset($response['is_deleted']) || !$response['is_deleted']) {
|
||||
$this->metaData[$path] = $response;
|
||||
}
|
||||
$this->metaData[$path] = $response;
|
||||
// Return contents of folder only
|
||||
return $contents;
|
||||
} else {
|
||||
try {
|
||||
$response = $this->dropbox->getMetaData($path, 'false');
|
||||
$this->metaData[$path] = $response;
|
||||
return $response;
|
||||
if (!isset($response['is_deleted']) || !$response['is_deleted']) {
|
||||
$this->metaData[$path] = $response;
|
||||
return $response;
|
||||
}
|
||||
return null;
|
||||
} catch (\Exception $exception) {
|
||||
if ($exception instanceof \Dropbox_Exception_NotFound) {
|
||||
// don't log, might be a file_exist check
|
||||
return false;
|
||||
}
|
||||
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
||||
return false;
|
||||
}
|
||||
@@ -108,7 +135,7 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
|
||||
public function opendir($path) {
|
||||
$contents = $this->getMetaData($path, true);
|
||||
if ($contents) {
|
||||
if ($contents !== false) {
|
||||
$files = array();
|
||||
foreach ($contents as $file) {
|
||||
$files[] = basename($file['path']);
|
||||
@@ -146,14 +173,6 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return $this->file_exists($path);
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return $this->file_exists($path);
|
||||
}
|
||||
|
||||
public function file_exists($path) {
|
||||
if ($path == '' || $path == '/') {
|
||||
return true;
|
||||
@@ -165,9 +184,9 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
}
|
||||
|
||||
public function unlink($path) {
|
||||
$path = $this->root.$path;
|
||||
try {
|
||||
$this->dropbox->delete($path);
|
||||
$this->dropbox->delete($this->root.$path);
|
||||
$this->deleteMetaData($path);
|
||||
return true;
|
||||
} catch (\Exception $exception) {
|
||||
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
||||
@@ -176,10 +195,14 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
}
|
||||
|
||||
public function rename($path1, $path2) {
|
||||
$path1 = $this->root.$path1;
|
||||
$path2 = $this->root.$path2;
|
||||
try {
|
||||
$this->dropbox->move($path1, $path2);
|
||||
// overwrite if target file exists and is not a directory
|
||||
$destMetaData = $this->getMetaData($path2);
|
||||
if (isset($destMetaData) && $destMetaData !== false && !$destMetaData['is_dir']) {
|
||||
$this->unlink($path2);
|
||||
}
|
||||
$this->dropbox->move($this->root.$path1, $this->root.$path2);
|
||||
$this->deleteMetaData($path1);
|
||||
return true;
|
||||
} catch (\Exception $exception) {
|
||||
\OCP\Util::writeLog('files_external', $exception->getMessage(), \OCP\Util::ERROR);
|
||||
@@ -277,7 +300,12 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||
}
|
||||
|
||||
public function touch($path, $mtime = null) {
|
||||
return false;
|
||||
if ($this->file_exists($path)) {
|
||||
return false;
|
||||
} else {
|
||||
$this->file_put_contents($path, '');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
|
||||
if ( ! $this->root || $this->root[0]!='/') {
|
||||
$this->root='/'.$this->root;
|
||||
}
|
||||
if (substr($this->root, -1) !== '/') {
|
||||
$this->root .= '/';
|
||||
}
|
||||
} else {
|
||||
throw new \Exception();
|
||||
}
|
||||
@@ -58,6 +61,22 @@ class FTP extends \OC\Files\Storage\StreamWrapper{
|
||||
$url.='://'.$this->user.':'.$this->password.'@'.$this->host.$this->root.$path;
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlinks file or directory
|
||||
* @param string @path
|
||||
*/
|
||||
public function unlink($path) {
|
||||
if ($this->is_dir($path)) {
|
||||
return $this->rmdir($path);
|
||||
}
|
||||
else {
|
||||
$url = $this->constructUrl($path);
|
||||
$result = unlink($url);
|
||||
clearstatcache(true, $url);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
public function fopen($path,$mode) {
|
||||
switch($mode) {
|
||||
case 'r':
|
||||
|
||||
@@ -317,10 +317,6 @@ class Google extends \OC\Files\Storage\Common {
|
||||
}
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return $this->file_exists($path);
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
$file = $this->getDriveFile($path);
|
||||
if ($file) {
|
||||
|
||||
@@ -94,15 +94,17 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||
private function writeHostKeys($keys) {
|
||||
try {
|
||||
$keyPath = $this->hostKeysPath();
|
||||
$fp = fopen($keyPath, 'w');
|
||||
foreach ($keys as $host => $key) {
|
||||
fwrite($fp, $host . '::' . $key . "\n");
|
||||
if ($keyPath && file_exists($keyPath)) {
|
||||
$fp = fopen($keyPath, 'w');
|
||||
foreach ($keys as $host => $key) {
|
||||
fwrite($fp, $host . '::' . $key . "\n");
|
||||
}
|
||||
fclose($fp);
|
||||
return true;
|
||||
}
|
||||
fclose($fp);
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private function readHostKeys() {
|
||||
@@ -178,14 +180,6 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function file_exists($path) {
|
||||
try {
|
||||
return $this->client->stat($this->absPath($path)) !== false;
|
||||
@@ -291,6 +285,9 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||
|
||||
public function rename($source, $target) {
|
||||
try {
|
||||
if (!$this->is_dir($target) && $this->file_exists($target)) {
|
||||
$this->unlink($target);
|
||||
}
|
||||
return $this->client->rename(
|
||||
$this->absPath($source),
|
||||
$this->absPath($target)
|
||||
|
||||
@@ -47,8 +47,13 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
|
||||
|
||||
public function constructUrl($path) {
|
||||
if (substr($path, -1)=='/') {
|
||||
$path=substr($path, 0, -1);
|
||||
$path = substr($path, 0, -1);
|
||||
}
|
||||
if (substr($path, 0, 1)=='/') {
|
||||
$path = substr($path, 1);
|
||||
}
|
||||
// remove trailing dots which some versions of samba don't seem to like
|
||||
$path = rtrim($path, '.');
|
||||
$path = urlencode($path);
|
||||
$user = urlencode($this->user);
|
||||
$pass = urlencode($this->password);
|
||||
@@ -76,6 +81,24 @@ class SMB extends \OC\Files\Storage\StreamWrapper{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlinks file or directory
|
||||
* @param string @path
|
||||
*/
|
||||
public function unlink($path) {
|
||||
if ($this->is_dir($path)) {
|
||||
$this->rmdir($path);
|
||||
}
|
||||
else {
|
||||
$url = $this->constructUrl($path);
|
||||
unlink($url);
|
||||
clearstatcache(false, $url);
|
||||
}
|
||||
// smb4php still returns false even on success so
|
||||
// check here whether file was really deleted
|
||||
return !file_exists($path);
|
||||
}
|
||||
|
||||
/**
|
||||
* check if a file or folder has been updated since $time
|
||||
* @param string $path
|
||||
|
||||
@@ -25,8 +25,9 @@ abstract class StreamWrapper extends Common {
|
||||
$this->unlink($path . '/' . $file);
|
||||
}
|
||||
}
|
||||
$success = rmdir($this->constructUrl($path));
|
||||
clearstatcache();
|
||||
$url = $this->constructUrl($path);
|
||||
$success = rmdir($url);
|
||||
clearstatcache(false, $url);
|
||||
return $success;
|
||||
} else {
|
||||
return false;
|
||||
@@ -38,15 +39,7 @@ abstract class StreamWrapper extends Common {
|
||||
}
|
||||
|
||||
public function filetype($path) {
|
||||
return filetype($this->constructUrl($path));
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return true; //not properly supported
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return true; //not properly supported
|
||||
return @filetype($this->constructUrl($path));
|
||||
}
|
||||
|
||||
public function file_exists($path) {
|
||||
@@ -54,8 +47,11 @@ abstract class StreamWrapper extends Common {
|
||||
}
|
||||
|
||||
public function unlink($path) {
|
||||
$success = unlink($this->constructUrl($path));
|
||||
clearstatcache();
|
||||
$url = $this->constructUrl($path);
|
||||
$success = unlink($url);
|
||||
// normally unlink() is supposed to do this implicitly,
|
||||
// but doing it anyway just to be sure
|
||||
clearstatcache(false, $url);
|
||||
return $success;
|
||||
}
|
||||
|
||||
@@ -76,6 +72,7 @@ abstract class StreamWrapper extends Common {
|
||||
}
|
||||
} else {
|
||||
$this->file_put_contents($path, '');
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -268,14 +268,6 @@ class Swift extends \OC\Files\Storage\Common {
|
||||
}
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function unlink($path) {
|
||||
$path = $this->normalizePath($path);
|
||||
|
||||
@@ -372,7 +364,7 @@ class Swift extends \OC\Files\Storage\Common {
|
||||
'X-Object-Meta-Timestamp' => $mtime
|
||||
)
|
||||
);
|
||||
$object->Update($settings);
|
||||
return $object->Update($settings);
|
||||
} else {
|
||||
$object = $this->container->DataObject();
|
||||
if (is_null($mtime)) {
|
||||
@@ -385,7 +377,7 @@ class Swift extends \OC\Files\Storage\Common {
|
||||
'X-Object-Meta-Timestamp' => $mtime
|
||||
)
|
||||
);
|
||||
$object->Create($settings);
|
||||
return $object->Create($settings);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -134,14 +134,6 @@ class DAV extends \OC\Files\Storage\Common{
|
||||
}
|
||||
}
|
||||
|
||||
public function isReadable($path) {
|
||||
return true;//not properly supported
|
||||
}
|
||||
|
||||
public function isUpdatable($path) {
|
||||
return true;//not properly supported
|
||||
}
|
||||
|
||||
public function file_exists($path) {
|
||||
$this->init();
|
||||
$path=$this->cleanPath($path);
|
||||
@@ -242,6 +234,7 @@ class DAV extends \OC\Files\Storage\Common{
|
||||
} else {
|
||||
$this->file_put_contents($path, '');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function getFile($path, $target) {
|
||||
@@ -268,7 +261,7 @@ class DAV extends \OC\Files\Storage\Common{
|
||||
public function rename($path1, $path2) {
|
||||
$this->init();
|
||||
$path1=$this->cleanPath($path1);
|
||||
$path2=$this->root.$this->cleanPath($path2);
|
||||
$path2=$this->createBaseUri().$this->cleanPath($path2);
|
||||
try {
|
||||
$this->client->request('MOVE', $path1, null, array('Destination'=>$path2));
|
||||
return true;
|
||||
@@ -280,7 +273,7 @@ class DAV extends \OC\Files\Storage\Common{
|
||||
public function copy($path1, $path2) {
|
||||
$this->init();
|
||||
$path1=$this->cleanPath($path1);
|
||||
$path2=$this->root.$this->cleanPath($path2);
|
||||
$path2=$this->createBaseUri().$this->cleanPath($path2);
|
||||
try {
|
||||
$this->client->request('COPY', $path1, null, array('Destination'=>$path2));
|
||||
return true;
|
||||
@@ -323,11 +316,9 @@ class DAV extends \OC\Files\Storage\Common{
|
||||
}
|
||||
|
||||
public function cleanPath($path) {
|
||||
if ( ! $path || $path[0]=='/') {
|
||||
return substr($path, 1);
|
||||
} else {
|
||||
return $path;
|
||||
}
|
||||
$path = \OC\Files\Filesystem::normalizePath($path);
|
||||
// remove leading slash
|
||||
return substr($path, 1);
|
||||
}
|
||||
|
||||
private function simpleResponse($method, $path, $body, $expected) {
|
||||
|
||||
@@ -60,7 +60,7 @@
|
||||
class="optional"
|
||||
data-parameter="<?php p($parameter); ?>"
|
||||
value="<?php p($value); ?>"
|
||||
placeholder="<?php p(substr($placeholder, 5)); ?>" />
|
||||
placeholder="<?php p(substr($placeholder, 1)); ?>" />
|
||||
<?php elseif (strpos($placeholder, '#') !== false): ?>
|
||||
<input type="hidden"
|
||||
data-parameter="<?php p($parameter); ?>"
|
||||
|
||||
@@ -21,6 +21,22 @@ class Dropbox extends Storage {
|
||||
$this->instance = new \OC\Files\Storage\Dropbox($this->config['dropbox']);
|
||||
}
|
||||
|
||||
public function directoryProvider() {
|
||||
// doesn't support leading/trailing spaces
|
||||
return array(array('folder'));
|
||||
}
|
||||
|
||||
public function testDropboxTouchReturnValue() {
|
||||
$this->assertFalse($this->instance->file_exists('foo'));
|
||||
|
||||
// true because succeeded
|
||||
$this->assertTrue($this->instance->touch('foo'));
|
||||
$this->assertTrue($this->instance->file_exists('foo'));
|
||||
|
||||
// false because not supported
|
||||
$this->assertFalse($this->instance->touch('foo'));
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
if ($this->instance) {
|
||||
$this->instance->unlink('/');
|
||||
|
||||
@@ -34,19 +34,31 @@ class FTP extends Storage {
|
||||
'password' => 'ftp',
|
||||
'root' => '/',
|
||||
'secure' => false );
|
||||
$instance = new OC_Filestorage_FTP($config);
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = true;
|
||||
$instance = new OC_Filestorage_FTP($config);
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = 'false';
|
||||
$instance = new OC_Filestorage_FTP($config);
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftp://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['secure'] = 'true';
|
||||
$instance = new OC_Filestorage_FTP($config);
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/', $instance->constructUrl(''));
|
||||
|
||||
$config['root'] = '';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
|
||||
$config['root'] = '/abc/';
|
||||
$instance = new \OC\Files\Storage\FTP($config);
|
||||
$this->assertEquals('ftps://ftp:ftp@localhost/abc/somefile.txt', $instance->constructUrl('somefile.txt'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
/**
|
||||
* ownCloud
|
||||
*
|
||||
* @author Vincent Petry
|
||||
* Copyright (c) 2013 Vincent Petry <pvince81@owncloud.com>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../../../lib/base.php';
|
||||
|
||||
require __DIR__ . '/../lib/config.php';
|
||||
|
||||
class Test_Mount_Config_Dummy_Storage {
|
||||
public function test() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class Test_Mount_Config
|
||||
*/
|
||||
class Test_Mount_Config extends \PHPUnit_Framework_TestCase {
|
||||
/**
|
||||
* Test mount point validation
|
||||
*/
|
||||
public function testAddMountPointValidation() {
|
||||
$storageClass = 'Test_Mount_Config_Dummy_Storage';
|
||||
$mountType = 'user';
|
||||
$applicable = 'all';
|
||||
$isPersonal = false;
|
||||
$this->assertEquals(false, OC_Mount_Config::addMountPoint('', $storageClass, array(), $mountType, $applicable, $isPersonal));
|
||||
$this->assertEquals(false, OC_Mount_Config::addMountPoint('/', $storageClass, array(), $mountType, $applicable, $isPersonal));
|
||||
$this->assertEquals(false, OC_Mount_Config::addMountPoint('Shared', $storageClass, array(), $mountType, $applicable, $isPersonal));
|
||||
$this->assertEquals(false, OC_Mount_Config::addMountPoint('/Shared', $storageClass, array(), $mountType, $applicable, $isPersonal));
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,6 +29,11 @@ class SMB extends Storage {
|
||||
}
|
||||
}
|
||||
|
||||
public function directoryProvider() {
|
||||
// doesn't support leading/trailing spaces
|
||||
return array(array('folder'));
|
||||
}
|
||||
|
||||
public function testRenameWithSpaces() {
|
||||
$this->instance->mkdir('with spaces');
|
||||
$result = $this->instance->rename('with spaces', 'foo bar');
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (c) 2013 Vincent Petry <pvince81@owncloud.com>
|
||||
* This file is licensed under the Affero General Public License version 3 or
|
||||
* later.
|
||||
* See the COPYING-README file.
|
||||
*/
|
||||
|
||||
namespace Test\Files\Storage;
|
||||
|
||||
class SMBFunctions extends \PHPUnit_Framework_TestCase {
|
||||
|
||||
public function setUp() {
|
||||
$id = uniqid();
|
||||
// dummy config
|
||||
$this->config = array(
|
||||
'run'=>false,
|
||||
'user'=>'test',
|
||||
'password'=>'testpassword',
|
||||
'host'=>'smbhost',
|
||||
'share'=>'/sharename',
|
||||
'root'=>'/rootdir/',
|
||||
);
|
||||
|
||||
$this->instance = new \OC\Files\Storage\SMB($this->config);
|
||||
}
|
||||
|
||||
public function tearDown() {
|
||||
}
|
||||
|
||||
public function testGetId() {
|
||||
$this->assertEquals('smb::test@smbhost//sharename//rootdir/', $this->instance->getId());
|
||||
}
|
||||
|
||||
public function testConstructUrl() {
|
||||
$this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc'));
|
||||
$this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc", $this->instance->constructUrl('/abc/'));
|
||||
$this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2F", $this->instance->constructUrl('/abc/.'));
|
||||
$this->assertEquals("smb://test:testpassword@smbhost/sharename/rootdir/abc%2Fdef", $this->instance->constructUrl('/abc/def'));
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,8 @@ if(!\OC_App::isEnabled('files_sharing')){
|
||||
exit;
|
||||
}
|
||||
|
||||
\OC_User::setIncognitoMode(true);
|
||||
|
||||
$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : '';
|
||||
$maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36';
|
||||
$maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36';
|
||||
@@ -36,10 +38,12 @@ if(!isset($linkedItem['uid_owner']) || !isset($linkedItem['file_source'])) {
|
||||
|
||||
$userId = $linkedItem['uid_owner'];
|
||||
\OC_Util::setupFS($userId);
|
||||
\OC\Files\Filesystem::initMountPoints($userId);
|
||||
$view = new \OC\Files\View('/' . $userId . '/files');
|
||||
|
||||
$pathId = $linkedItem['file_source'];
|
||||
$path = \OC\Files\Filesystem::getPath($pathId);
|
||||
$pathInfo = \OC\Files\Filesystem::getFileInfo($path);
|
||||
$path = $view->getPath($pathId);
|
||||
$pathInfo = $view->getFileInfo($path);
|
||||
$sharedFile = null;
|
||||
|
||||
if($linkedItem['item_type'] === 'folder') {
|
||||
@@ -54,7 +58,7 @@ if($linkedItem['item_type'] === 'folder') {
|
||||
|
||||
if($linkedItem['item_type'] === 'file') {
|
||||
$parent = $pathInfo['parent'];
|
||||
$path = \OC\Files\Filesystem::getPath($parent);
|
||||
$path = $view->getPath($parent);
|
||||
$sharedFile = $pathInfo['name'];
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
|
||||
OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
|
||||
OCP\Util::addScript('files_sharing', 'share');
|
||||
\OC_Hook::connect('OC_Filesystem', 'post_write', '\OC\Files\Cache\Shared_Updater', 'writeHook');
|
||||
\OC_Hook::connect('OC_Filesystem', 'post_delete', '\OC\Files\Cache\Shared_Updater', 'postDeleteHook');
|
||||
\OC_Hook::connect('OC_Filesystem', 'delete', '\OC\Files\Cache\Shared_Updater', 'deleteHook');
|
||||
\OC_Hook::connect('OC_Filesystem', 'post_rename', '\OC\Files\Cache\Shared_Updater', 'renameHook');
|
||||
\OC_Hook::connect('OCP\Share', 'post_shared', '\OC\Files\Cache\Shared_Updater', 'shareHook');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
body {
|
||||
background:#ddd;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
#header {
|
||||
@@ -22,7 +22,7 @@ body {
|
||||
#public_upload,
|
||||
#download {
|
||||
font-weight:700;
|
||||
margin: 0 0.4em 0 0;
|
||||
margin: 0 0 0 .4em;
|
||||
padding: 0 5px;
|
||||
height: 32px;
|
||||
float: left;
|
||||
@@ -49,12 +49,14 @@ body {
|
||||
vertical-align:text-bottom;
|
||||
}
|
||||
|
||||
#controls {
|
||||
left: 0;
|
||||
}
|
||||
|
||||
#preview {
|
||||
background:#eee;
|
||||
border-bottom:1px solid #f8f8f8;
|
||||
min-height:30em;
|
||||
text-align:center;
|
||||
margin:45px auto;
|
||||
background: #fff;
|
||||
text-align: center;
|
||||
margin: 45px auto 0;
|
||||
}
|
||||
|
||||
#noPreview {
|
||||
@@ -62,11 +64,16 @@ body {
|
||||
padding-top:5em;
|
||||
}
|
||||
|
||||
footer {
|
||||
margin-top: 45px;
|
||||
}
|
||||
|
||||
p.info {
|
||||
color:#777;
|
||||
text-align:center;
|
||||
width:22em;
|
||||
margin:2em auto;
|
||||
color: #777;
|
||||
text-align: center;
|
||||
width: 22em;
|
||||
margin: 0 auto;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
p.info a {
|
||||
|
||||
@@ -14,6 +14,7 @@ $TRANSLATIONS = array(
|
||||
"Download" => "Stáhnout",
|
||||
"Upload" => "Odeslat",
|
||||
"Cancel upload" => "Zrušit odesílání",
|
||||
"No preview available for" => "Náhled není dostupný pro"
|
||||
"No preview available for" => "Náhled není dostupný pro",
|
||||
"Direct link" => "Přímý odkaz"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
|
||||
|
||||
@@ -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);";
|
||||
|
||||
@@ -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);";
|
||||
|
||||
@@ -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);";
|
||||
|
||||
@@ -1,11 +1,20 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"This share is password-protected" => "Цей ресурс обміну захищений паролем",
|
||||
"The password is wrong. Try again." => "Невірний пароль. Спробуйте ще раз.",
|
||||
"Password" => "Пароль",
|
||||
"Sorry, this link doesn’t seem to work anymore." => "На жаль, посилання більше не працює.",
|
||||
"Reasons might be:" => "Можливі причини:",
|
||||
"the item was removed" => "цей пункт був вилучений",
|
||||
"the link expired" => "посилання застаріло",
|
||||
"sharing is disabled" => "обмін заборонений",
|
||||
"For more info, please ask the person who sent this link." => "Для отримання додаткової інформації, будь ласка, зверніться до особи, яка надіслала це посилання.",
|
||||
"%s shared the folder %s with you" => "%s опублікував каталог %s для Вас",
|
||||
"%s shared the file %s with you" => "%s опублікував файл %s для Вас",
|
||||
"Download" => "Завантажити",
|
||||
"Upload" => "Вивантажити",
|
||||
"Cancel upload" => "Перервати завантаження",
|
||||
"No preview available for" => "Попередній перегляд недоступний для"
|
||||
"No preview available for" => "Попередній перегляд недоступний для",
|
||||
"Direct link" => "Пряме посилання"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
|
||||
|
||||
@@ -23,6 +23,9 @@ namespace OC\Files\Cache;
|
||||
|
||||
class Shared_Updater {
|
||||
|
||||
// shares which can be removed from oc_share after the delete operation was successful
|
||||
static private $toRemove = array();
|
||||
|
||||
/**
|
||||
* Correct the parent folders' ETags for all users shared the file at $target
|
||||
*
|
||||
@@ -58,15 +61,17 @@ class Shared_Updater {
|
||||
* @param string $path
|
||||
*/
|
||||
private static function removeShare($path) {
|
||||
$fileInfo = \OC\Files\Filesystem::getFileInfo($path);
|
||||
$fileSource = $fileInfo['fileid'];
|
||||
$fileSource = self::$toRemove[$path];
|
||||
|
||||
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source`=?');
|
||||
try {
|
||||
\OC_DB::executeAudited($query, array($fileSource));
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('files_sharing', "can't remove share: " . $e->getMessage(), \OCP\Util::WARN);
|
||||
if (!\OC\Files\Filesystem::file_exists($path)) {
|
||||
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*share` WHERE `file_source`=?');
|
||||
try {
|
||||
\OC_DB::executeAudited($query, array($fileSource));
|
||||
} catch (\Exception $e) {
|
||||
\OCP\Util::writeLog('files_sharing', "can't remove share: " . $e->getMessage(), \OCP\Util::WARN);
|
||||
}
|
||||
}
|
||||
unset(self::$toRemove[$path]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,17 +94,30 @@ class Shared_Updater {
|
||||
*/
|
||||
static public function deleteHook($params) {
|
||||
self::correctFolders($params['path']);
|
||||
self::removeShare($params['path']);
|
||||
$fileInfo = \OC\Files\Filesystem::getFileInfo($params['path']);
|
||||
// mark file as deleted so that we can clean up the share table if
|
||||
// the file was deleted successfully
|
||||
self::$toRemove[$params['path']] = $fileInfo['fileid'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
*/
|
||||
static public function postDeleteHook($params) {
|
||||
self::removeShare($params['path']);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $params
|
||||
*/
|
||||
static public function shareHook($params) {
|
||||
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
|
||||
$uidOwner = \OCP\User::getUser();
|
||||
$users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true);
|
||||
if (isset($params['uidOwner'])) {
|
||||
$uidOwner = $params['uidOwner'];
|
||||
} else {
|
||||
$uidOwner = \OCP\User::getUser();
|
||||
}
|
||||
$users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true, false);
|
||||
if (!empty($users)) {
|
||||
while (!empty($users)) {
|
||||
$reshareUsers = array();
|
||||
|
||||
@@ -149,11 +149,9 @@ 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')) {
|
||||
$allowPublicUploadEnabled = false;
|
||||
}
|
||||
if (OC_Appconfig::getValue('core', 'shareapi_allow_public_upload', 'yes') === 'no') {
|
||||
$allowPublicUploadEnabled = false;
|
||||
}
|
||||
@@ -220,6 +218,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 +233,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)
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -3,17 +3,36 @@
|
||||
OCP\JSON::checkLoggedIn();
|
||||
OCP\JSON::callCheck();
|
||||
|
||||
$files = $_POST['files'];
|
||||
$dirlisting = $_POST['dirlisting'];
|
||||
$list = json_decode($files);
|
||||
|
||||
// "empty trash" command
|
||||
if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
|
||||
$deleteAll = true;
|
||||
$folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
|
||||
if ($folder === '/' || $folder === '') {
|
||||
OCA\Files_Trashbin\Trashbin::deleteAll();
|
||||
$list = array();
|
||||
} else {
|
||||
$dirname = dirname($folder);
|
||||
if ( $dirname !== '/' && $dirname !== '.' ) {
|
||||
$dirlisting = '1';
|
||||
} else {
|
||||
$dirlisting = '0';
|
||||
}
|
||||
$list[] = $folder;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$deleteAll = false;
|
||||
$files = $_POST['files'];
|
||||
$dirlisting = $_POST['dirlisting'];
|
||||
$list = json_decode($files);
|
||||
}
|
||||
$error = array();
|
||||
$success = array();
|
||||
|
||||
|
||||
$i = 0;
|
||||
foreach ($list as $file) {
|
||||
if ( $dirlisting === '0') {
|
||||
$file = ltrim($file, '/');
|
||||
$delimiter = strrpos($file, '.d');
|
||||
$filename = substr($file, 0, $delimiter);
|
||||
$timestamp = substr($file, $delimiter+2);
|
||||
@@ -23,13 +42,15 @@ foreach ($list as $file) {
|
||||
}
|
||||
|
||||
OCA\Files_Trashbin\Trashbin::delete($filename, $timestamp);
|
||||
if (!OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
|
||||
if (OCA\Files_Trashbin\Trashbin::file_exists($filename, $timestamp)) {
|
||||
$error[] = $filename;
|
||||
OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
|
||||
}
|
||||
// only list deleted files if not deleting everything
|
||||
else if (!$deleteAll) {
|
||||
$success[$i]['filename'] = $file;
|
||||
$success[$i]['timestamp'] = $timestamp;
|
||||
$i++;
|
||||
} else {
|
||||
$error[] = $filename;
|
||||
OC_Log::write('trashbin','can\'t delete ' . $filename . ' permanently.', OC_Log::ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,14 @@ if($maxX === 0 || $maxY === 0) {
|
||||
}
|
||||
|
||||
try{
|
||||
$preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files');
|
||||
$preview->setFile($file);
|
||||
$preview = new \OC\Preview(\OC_User::getUser(), 'files_trashbin/files', $file);
|
||||
$view = new \OC\Files\View('/'.\OC_User::getUser(). '/files_trashbin/files');
|
||||
if ($view->is_dir($file)) {
|
||||
$mimetype = 'httpd/unix-directory';
|
||||
} else {
|
||||
$mimetype = \OC_Helper::getFileNameMimeType(pathinfo($file, PATHINFO_FILENAME));
|
||||
}
|
||||
$preview->setMimetype($mimetype);
|
||||
$preview->setMaxX($maxX);
|
||||
$preview->setMaxY($maxY);
|
||||
$preview->setScalingUp($scalingUp);
|
||||
|
||||
@@ -13,6 +13,7 @@ $success = array();
|
||||
$i = 0;
|
||||
foreach ($list as $file) {
|
||||
if ( $dirlisting === '0') {
|
||||
$file = ltrim($file, '/');
|
||||
$delimiter = strrpos($file, '.d');
|
||||
$filename = substr($file, 0, $delimiter);
|
||||
$timestamp = substr($file, $delimiter+2);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
ownCloud keeps a copy of your deleted files in case you need them again.
|
||||
To make sure that the user doesn't run out of memory the deleted files app
|
||||
manages the size of the deleted files for the user. By default deleted files
|
||||
stay in the trash bin for 180 days. ownCloud checks the age of the files
|
||||
stay in the trash bin for 90 days. ownCloud checks the age of the files
|
||||
every time a new files gets moved to the deleted files and remove all files
|
||||
older than 180 days. The user can adjust this value in the config.php by
|
||||
setting the "trashbin_retention_obligation" value.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#fileList td a.file, #fileList td a.file span {
|
||||
cursor: default;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ OCP\Util::addScript('files', 'fileactions');
|
||||
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
|
||||
|
||||
OCP\Util::addStyle('files', 'files');
|
||||
OCP\Util::addStyle('files_trashbin', 'trash');
|
||||
OCP\Util::addScript('files', 'filelist');
|
||||
// filelist overrides
|
||||
OCP\Util::addScript('files_trashbin', 'filelist');
|
||||
|
||||
@@ -22,3 +22,10 @@ FileList.reload = function(){
|
||||
FileList.linkTo = function(dir){
|
||||
return OC.linkTo('files_trashbin', 'index.php')+"?dir="+ encodeURIComponent(dir).replace(/%2F/g, '/');
|
||||
}
|
||||
|
||||
FileList.updateEmptyContent = function(){
|
||||
var $fileList = $('#fileList');
|
||||
var exists = $fileList.find('tr:first').exists();
|
||||
$('#emptycontent').toggleClass('hidden', exists);
|
||||
$('#filestable th').toggleClass('hidden', !exists);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ $(document).ready(function() {
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
disableActions();
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
|
||||
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
{files: JSON.stringify([$('#dir').val() + '/' + filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
function(result) {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
@@ -19,6 +19,7 @@ $(document).ready(function() {
|
||||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
FileList.updateEmptyContent();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -34,7 +35,7 @@ $(document).ready(function() {
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
disableActions();
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
|
||||
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
{files: JSON.stringify([$('#dir').val() + '/' +filename]), dirlisting: tr.attr('data-dirlisting')},
|
||||
function(result) {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
@@ -45,6 +46,7 @@ $(document).ready(function() {
|
||||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
FileList.updateEmptyContent();
|
||||
}
|
||||
);
|
||||
|
||||
@@ -64,41 +66,6 @@ $(document).ready(function() {
|
||||
procesSelection();
|
||||
});
|
||||
|
||||
$('#fileList').on('click', 'td.filename a', function(event) {
|
||||
if (event.shiftKey) {
|
||||
event.preventDefault();
|
||||
var last = $(lastChecked).parent().parent().prevAll().length;
|
||||
var first = $(this).parent().parent().prevAll().length;
|
||||
var start = Math.min(first, last);
|
||||
var end = Math.max(first, last);
|
||||
var rows = $(this).parent().parent().parent().children('tr');
|
||||
for (var i = start; i < end; i++) {
|
||||
$(rows).each(function(index) {
|
||||
if (index == i) {
|
||||
var checkbox = $(this).children().children('input:checkbox');
|
||||
$(checkbox).attr('checked', 'checked');
|
||||
$(checkbox).parent().parent().addClass('selected');
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
var checkbox = $(this).parent().children('input:checkbox');
|
||||
lastChecked = checkbox;
|
||||
if ($(checkbox).attr('checked')) {
|
||||
$(checkbox).removeAttr('checked');
|
||||
$(checkbox).parent().parent().removeClass('selected');
|
||||
$('#select_all').removeAttr('checked');
|
||||
} else {
|
||||
$(checkbox).attr('checked', 'checked');
|
||||
$(checkbox).parent().parent().toggleClass('selected');
|
||||
var selectedCount = $('td.filename input:checkbox:checked').length;
|
||||
if (selectedCount == $('td.filename input:checkbox').length) {
|
||||
$('#select_all').attr('checked', 'checked');
|
||||
}
|
||||
}
|
||||
procesSelection();
|
||||
});
|
||||
|
||||
$('.undelete').click('click', function(event) {
|
||||
event.preventDefault();
|
||||
var files = getSelectedFiles('file');
|
||||
@@ -122,39 +89,72 @@ $(document).ready(function() {
|
||||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
FileList.updateEmptyContent();
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$('.delete').click('click', function(event) {
|
||||
event.preventDefault();
|
||||
var files = getSelectedFiles('file');
|
||||
var fileslist = JSON.stringify(files);
|
||||
var dirlisting = getSelectedFiles('dirlisting')[0];
|
||||
var allFiles = $('#select_all').is(':checked');
|
||||
var files = [];
|
||||
var params = {};
|
||||
if (allFiles) {
|
||||
params = {
|
||||
allfiles: true,
|
||||
dir: $('#dir').val()
|
||||
};
|
||||
}
|
||||
else {
|
||||
files = getSelectedFiles('file');
|
||||
params = {
|
||||
files: JSON.stringify(files),
|
||||
dirlisting: getSelectedFiles('dirlisting')[0]
|
||||
};
|
||||
};
|
||||
|
||||
disableActions();
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
if (allFiles) {
|
||||
FileList.showMask();
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var deleteAction = $('tr').filterAttr('data-file', files[i]).children("td.date").children(".action.delete");
|
||||
deleteAction.removeClass('delete-icon').addClass('progress-icon');
|
||||
}
|
||||
}
|
||||
|
||||
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
|
||||
{files: fileslist, dirlisting: dirlisting},
|
||||
params,
|
||||
function(result) {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
row.parentNode.removeChild(row);
|
||||
if (allFiles) {
|
||||
FileList.hideMask();
|
||||
// simply remove all files
|
||||
$('#fileList').empty();
|
||||
}
|
||||
else {
|
||||
for (var i = 0; i < result.data.success.length; i++) {
|
||||
var row = document.getElementById(result.data.success[i].filename);
|
||||
row.parentNode.removeChild(row);
|
||||
}
|
||||
}
|
||||
if (result.status !== 'success') {
|
||||
OC.dialogs.alert(result.data.message, t('core', 'Error'));
|
||||
}
|
||||
enableActions();
|
||||
FileList.updateFileSummary();
|
||||
FileList.updateEmptyContent();
|
||||
}
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
$('#fileList').on('click', 'td.filename input', function() {
|
||||
var checkbox = $(this).parent().children('input:checkbox');
|
||||
$(checkbox).parent().parent().toggleClass('selected');
|
||||
procesSelection();
|
||||
});
|
||||
|
||||
$('#fileList').on('click', 'td.filename a', function(event) {
|
||||
var mime = $(this).parent().parent().data('mime');
|
||||
if (mime !== 'httpd/unix-directory') {
|
||||
@@ -201,7 +201,7 @@ function getSelectedFiles(property){
|
||||
elements.each(function(i,element){
|
||||
var file={
|
||||
name:$(element).attr('data-filename'),
|
||||
file:$(element).attr('data-file'),
|
||||
file:$('#dir').val() + "/" + $(element).attr('data-file'),
|
||||
timestamp:$(element).attr('data-timestamp'),
|
||||
type:$(element).attr('data-type'),
|
||||
dirlisting:$(element).attr('data-dirlisting')
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Error" => "Ошибка"
|
||||
"Error" => "Ошибка",
|
||||
"Delete" => "Удалить"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<?php
|
||||
$TRANSLATIONS = array(
|
||||
"Couldn't delete %s permanently" => "Datoteke %s ni mogoče dokončno izbrisati.",
|
||||
"Couldn't delete %s permanently" => "Datoteke %s ni mogoče trajno izbrisati.",
|
||||
"Couldn't restore %s" => "Ni mogoče obnoviti %s",
|
||||
"Error" => "Napaka",
|
||||
"restored" => "obnovljeno",
|
||||
"Nothing in here. Your trash bin is empty!" => "Mapa smeti je prazna.",
|
||||
"Name" => "Ime",
|
||||
"Restore" => "Obnovi",
|
||||
|
||||
@@ -44,8 +44,10 @@ class Helper
|
||||
}
|
||||
|
||||
$files = array();
|
||||
$id = 0;
|
||||
foreach ($result as $r) {
|
||||
$i = array();
|
||||
$i['id'] = $id++;
|
||||
$i['name'] = $r['id'];
|
||||
$i['date'] = \OCP\Util::formatDate($r['timestamp']);
|
||||
$i['timestamp'] = $r['timestamp'];
|
||||
|
||||
@@ -41,13 +41,7 @@ class Trashbin {
|
||||
return array($uid, $filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* move file to the trash bin
|
||||
*
|
||||
* @param $file_path path to the deleted file/directory relative to the files root directory
|
||||
*/
|
||||
public static function move2trash($file_path) {
|
||||
$user = \OCP\User::getUser();
|
||||
private static function setUpTrash($user) {
|
||||
$view = new \OC\Files\View('/' . $user);
|
||||
if (!$view->is_dir('files_trashbin')) {
|
||||
$view->mkdir('files_trashbin');
|
||||
@@ -64,6 +58,48 @@ class Trashbin {
|
||||
if (!$view->is_dir('files_trashbin/share-keys')) {
|
||||
$view->mkdir('files_trashbin/share-keys');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static function copyFilesToOwner($sourcePath, $owner, $ownerPath, $timestamp, $type, $mime) {
|
||||
self::setUpTrash($owner);
|
||||
|
||||
$ownerFilename = basename($ownerPath);
|
||||
$ownerLocation = dirname($ownerPath);
|
||||
|
||||
$sourceFilename = basename($sourcePath);
|
||||
|
||||
$view = new \OC\Files\View('/');
|
||||
|
||||
$source = \OCP\User::getUser().'/files_trashbin/files/' . $sourceFilename . '.d' . $timestamp;
|
||||
$target = $owner.'/files_trashbin/files/' . $ownerFilename . '.d' . $timestamp;
|
||||
self::copy_recursive($source, $target, $view);
|
||||
|
||||
|
||||
if ($view->file_exists($target)) {
|
||||
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`type`,`mime`,`user`) VALUES (?,?,?,?,?,?)");
|
||||
$result = $query->execute(array($ownerFilename, $timestamp, $ownerLocation, $type, $mime, $owner));
|
||||
if (!$result) { // if file couldn't be added to the database than also don't store it in the trash bin.
|
||||
$view->deleteAll($owner.'/files_trashbin/files/' . $ownerFilename . '.d' . $timestamp);
|
||||
\OC_Log::write('files_trashbin', 'trash bin database couldn\'t be updated for the files owner', \OC_log::ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* move file to the trash bin
|
||||
*
|
||||
* @param $file_path path to the deleted file/directory relative to the files root directory
|
||||
*/
|
||||
public static function move2trash($file_path) {
|
||||
$user = \OCP\User::getUser();
|
||||
$size = 0;
|
||||
list($owner, $ownerPath) = self::getUidAndFilename($file_path);
|
||||
self::setUpTrash($user);
|
||||
|
||||
$view = new \OC\Files\View('/' . $user);
|
||||
$path_parts = pathinfo($file_path);
|
||||
|
||||
$filename = $path_parts['basename'];
|
||||
@@ -77,19 +113,20 @@ class Trashbin {
|
||||
$type = 'file';
|
||||
}
|
||||
|
||||
$trashbinSize = self::getTrashbinSize($user);
|
||||
if ($trashbinSize === false || $trashbinSize < 0) {
|
||||
$trashbinSize = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
|
||||
$userTrashSize = self::getTrashbinSize($user);
|
||||
if ($userTrashSize === false || $userTrashSize < 0) {
|
||||
$userTrashSize = self::calculateSize(new \OC\Files\View('/' . $user . '/files_trashbin'));
|
||||
}
|
||||
|
||||
// disable proxy to prevent recursive calls
|
||||
$proxyStatus = \OC_FileProxy::$enabled;
|
||||
\OC_FileProxy::$enabled = false;
|
||||
$sizeOfAddedFiles = self::copy_recursive($file_path, 'files_trashbin/files/' . $filename . '.d' . $timestamp, $view);
|
||||
$trashPath = '/files_trashbin/files/' . $filename . '.d' . $timestamp;
|
||||
$sizeOfAddedFiles = self::copy_recursive('/files/'.$file_path, $trashPath, $view);
|
||||
\OC_FileProxy::$enabled = $proxyStatus;
|
||||
|
||||
if ($view->file_exists('files_trashbin/files/' . $filename . '.d' . $timestamp)) {
|
||||
$trashbinSize += $sizeOfAddedFiles;
|
||||
$size = $sizeOfAddedFiles;
|
||||
$query = \OC_DB::prepare("INSERT INTO `*PREFIX*files_trash` (`id`,`timestamp`,`location`,`type`,`mime`,`user`) VALUES (?,?,?,?,?,?)");
|
||||
$result = $query->execute(array($filename, $timestamp, $location, $type, $mime, $user));
|
||||
if (!$result) { // if file couldn't be added to the database than also don't store it in the trash bin.
|
||||
@@ -100,15 +137,31 @@ class Trashbin {
|
||||
\OCP\Util::emitHook('\OCA\Files_Trashbin\Trashbin', 'post_moveToTrash', array('filePath' => \OC\Files\Filesystem::normalizePath($file_path),
|
||||
'trashPath' => \OC\Files\Filesystem::normalizePath($filename . '.d' . $timestamp)));
|
||||
|
||||
$trashbinSize += self::retainVersions($file_path, $filename, $timestamp);
|
||||
$trashbinSize += self::retainEncryptionKeys($file_path, $filename, $timestamp);
|
||||
$size += self::retainVersions($file_path, $filename, $timestamp);
|
||||
$size += self::retainEncryptionKeys($file_path, $filename, $timestamp);
|
||||
|
||||
// if owner !== user we need to also add a copy to the owners trash
|
||||
if ($user !== $owner) {
|
||||
self::copyFilesToOwner($file_path, $owner, $ownerPath, $timestamp, $type, $mime);
|
||||
}
|
||||
} else {
|
||||
\OC_Log::write('files_trashbin', 'Couldn\'t move ' . $file_path . ' to the trash bin', \OC_log::ERROR);
|
||||
}
|
||||
|
||||
$trashbinSize -= self::expire($trashbinSize);
|
||||
$userTrashSize += $size;
|
||||
$userTrashSize -= self::expire($userTrashSize, $user);
|
||||
self::setTrashbinSize($user, $userTrashSize);
|
||||
|
||||
self::setTrashbinSize($user, $trashbinSize);
|
||||
// if owner !== user we also need to update the owners trash size
|
||||
if($owner !== $user) {
|
||||
$ownerTrashSize = self::getTrashbinSize($owner);
|
||||
if ($ownerTrashSize === false || $ownerTrashSize < 0) {
|
||||
$ownerTrashSize = self::calculateSize(new \OC\Files\View('/' . $owner . '/files_trashbin'));
|
||||
}
|
||||
$ownerTrashSize += $size;
|
||||
$ownerTrashSize -= self::expire($ownerTrashSize, $owner);
|
||||
self::setTrashbinSize($owner, $ownerTrashSize);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -135,10 +188,16 @@ class Trashbin {
|
||||
|
||||
if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
|
||||
$size += self::calculateSize(new \OC\Files\View('/' . $owner . '/files_versions/' . $ownerPath));
|
||||
if ($owner !== $user) {
|
||||
$rootView->copy($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp);
|
||||
}
|
||||
$rootView->rename($owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
|
||||
} else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
|
||||
foreach ($versions as $v) {
|
||||
$size += $rootView->filesize($owner . '/files_versions' . $v['path'] . '.v' . $v['version']);
|
||||
if ($owner !== $user) {
|
||||
$rootView->copy($owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $owner . '/files_trashbin/versions/' . $v['name'] . '.v' . $v['version'] . '.d' . $timestamp);
|
||||
}
|
||||
$rootView->rename($owner . '/files_versions' . $v['path'] . '.v' . $v['version'], $user . '/files_trashbin/versions/' . $filename . '.v' . $v['version'] . '.d' . $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -187,9 +246,15 @@ class Trashbin {
|
||||
// move keyfiles
|
||||
if ($rootView->is_dir($keyfile)) {
|
||||
$size += self::calculateSize(new \OC\Files\View($keyfile));
|
||||
if ($owner !== $user) {
|
||||
$rootView->copy($keyfile, $owner . '/files_trashbin/keyfiles/' . basename($ownerPath) . '.d' . $timestamp);
|
||||
}
|
||||
$rootView->rename($keyfile, $user . '/files_trashbin/keyfiles/' . $filename . '.d' . $timestamp);
|
||||
} else {
|
||||
$size += $rootView->filesize($keyfile . '.key');
|
||||
if ($owner !== $user) {
|
||||
$rootView->copy($keyfile . '.key', $owner . '/files_trashbin/keyfiles/' . basename($ownerPath) . '.key.d' . $timestamp);
|
||||
}
|
||||
$rootView->rename($keyfile . '.key', $user . '/files_trashbin/keyfiles/' . $filename . '.key.d' . $timestamp);
|
||||
}
|
||||
}
|
||||
@@ -199,6 +264,9 @@ class Trashbin {
|
||||
|
||||
if ($rootView->is_dir($sharekeys)) {
|
||||
$size += self::calculateSize(new \OC\Files\View($sharekeys));
|
||||
if ($owner !== $user) {
|
||||
$rootView->copy($sharekeys, $owner . '/files_trashbin/share-keys/' . basename($ownerPath) . '.d' . $timestamp);
|
||||
}
|
||||
$rootView->rename($sharekeys, $user . '/files_trashbin/share-keys/' . $filename . '.d' . $timestamp);
|
||||
} else {
|
||||
// get local path to share-keys
|
||||
@@ -211,22 +279,23 @@ class Trashbin {
|
||||
// get source file parts
|
||||
$pathinfo = pathinfo($src);
|
||||
|
||||
// we only want to keep the owners key so we can access the private key
|
||||
$ownerShareKey = $filename . '.' . $user . '.shareKey';
|
||||
// we only want to keep the users key so we can access the private key
|
||||
$userShareKey = $filename . '.' . $user . '.shareKey';
|
||||
|
||||
// if we found the share-key for the owner, we need to move it to files_trashbin
|
||||
if ($pathinfo['basename'] == $ownerShareKey) {
|
||||
if ($pathinfo['basename'] == $userShareKey) {
|
||||
|
||||
// calculate size
|
||||
$size += $rootView->filesize($sharekeys . '.' . $user . '.shareKey');
|
||||
|
||||
// move file
|
||||
$rootView->rename($sharekeys . '.' . $user . '.shareKey', $user . '/files_trashbin/share-keys/' . $ownerShareKey . '.d' . $timestamp);
|
||||
$rootView->rename($sharekeys . '.' . $user . '.shareKey', $user . '/files_trashbin/share-keys/' . $userShareKey . '.d' . $timestamp);
|
||||
} elseif ($owner !== $user) {
|
||||
$ownerShareKey = basename($ownerPath) . '.' . $owner . '.shareKey';
|
||||
if ($pathinfo['basename'] == $ownerShareKey) {
|
||||
$rootView->rename($sharekeys . '.' . $owner . '.shareKey', $owner . '/files_trashbin/share-keys/' . $ownerShareKey . '.d' . $timestamp);
|
||||
}
|
||||
} else {
|
||||
|
||||
// calculate size
|
||||
$size += filesize($src);
|
||||
|
||||
// don't keep other share-keys
|
||||
unlink($src);
|
||||
}
|
||||
@@ -495,6 +564,21 @@ class Trashbin {
|
||||
return $size;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief delete all files from the trash
|
||||
*/
|
||||
public static function deleteAll() {
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC\Files\View('/' . $user);
|
||||
$view->deleteAll('files_trashbin');
|
||||
self::setTrashbinSize($user, 0);
|
||||
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
|
||||
$query->execute(array($user));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief delete file from trash bin permanently
|
||||
*
|
||||
@@ -679,7 +763,7 @@ class Trashbin {
|
||||
$freeSpace = self::calculateFreeSpace($size);
|
||||
|
||||
if ($freeSpace < 0) {
|
||||
$newSize = $size - self::expire($size);
|
||||
$newSize = $size - self::expire($size, $user);
|
||||
if ($newSize !== $size) {
|
||||
self::setTrashbinSize($user, $newSize);
|
||||
}
|
||||
@@ -688,13 +772,19 @@ class Trashbin {
|
||||
|
||||
/**
|
||||
* clean up the trash bin
|
||||
* @param current size of the trash bin
|
||||
* @return size of expired files
|
||||
* @param int $trashbinSize current size of the trash bin
|
||||
* @param string $user
|
||||
* @return int size of expired files
|
||||
*/
|
||||
private static function expire($trashbinSize) {
|
||||
private static function expire($trashbinSize, $user) {
|
||||
|
||||
// let the admin disable auto expire
|
||||
$autoExpire = \OC_Config::getValue('trashbin_auto_expire', true);
|
||||
if ($autoExpire === false) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
$user = \OCP\User::getUser();
|
||||
$view = new \OC\Files\View('/' . $user);
|
||||
$availableSpace = self::calculateFreeSpace($trashbinSize);
|
||||
$size = 0;
|
||||
|
||||
@@ -742,23 +832,23 @@ class Trashbin {
|
||||
*/
|
||||
private static function copy_recursive($source, $destination, $view) {
|
||||
$size = 0;
|
||||
if ($view->is_dir('files' . $source)) {
|
||||
if ($view->is_dir($source)) {
|
||||
$view->mkdir($destination);
|
||||
$view->touch($destination, $view->filemtime('files' . $source));
|
||||
foreach (\OC_Files::getDirectoryContent($source) as $i) {
|
||||
$view->touch($destination, $view->filemtime($source));
|
||||
foreach ($view->getDirectoryContent($source) as $i) {
|
||||
$pathDir = $source . '/' . $i['name'];
|
||||
if ($view->is_dir('files' . $pathDir)) {
|
||||
if ($view->is_dir($pathDir)) {
|
||||
$size += self::copy_recursive($pathDir, $destination . '/' . $i['name'], $view);
|
||||
} else {
|
||||
$size += $view->filesize('files' . $pathDir);
|
||||
$view->copy('files' . $pathDir, $destination . '/' . $i['name']);
|
||||
$view->touch($destination . '/' . $i['name'], $view->filemtime('files' . $pathDir));
|
||||
$size += $view->filesize($pathDir);
|
||||
$view->copy($pathDir, $destination . '/' . $i['name']);
|
||||
$view->touch($destination . '/' . $i['name'], $view->filemtime($pathDir));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$size += $view->filesize('files' . $source);
|
||||
$view->copy('files' . $source, $destination);
|
||||
$view->touch($destination, $view->filemtime('files' . $source));
|
||||
$size += $view->filesize($source);
|
||||
$view->copy($source, $destination);
|
||||
$view->touch($destination, $view->filemtime($source));
|
||||
}
|
||||
return $size;
|
||||
}
|
||||
|
||||
@@ -4,9 +4,7 @@
|
||||
</div>
|
||||
<div id='notification'></div>
|
||||
|
||||
<?php if (isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad']):?>
|
||||
<div id="emptycontent"><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
|
||||
<?php endif; ?>
|
||||
<div id="emptycontent" <?php if (!(isset($_['files']) && count($_['files']) === 0 && $_['dirlisting'] === false && !$_['ajaxLoad'])):?>class="hidden"<?php endif; ?>><?php p($l->t('Nothing in here. Your trash bin is empty!'))?></div>
|
||||
|
||||
<input type="hidden" name="ajaxLoad" id="ajaxLoad" value="<?php p($_['ajaxLoad']); ?>" />
|
||||
<input type="hidden" id="disableSharing" data-status="<?php p($_['disableSharing']); ?>"></input>
|
||||
|
||||
@@ -35,18 +35,21 @@
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
>
|
||||
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
|
||||
<?php if(!isset($_['readonly']) || !$_['readonly']): ?>
|
||||
<input id="select-<?php p($file['id']); ?>" type="checkbox" />
|
||||
<label for="select-<?php p($file['id']); ?>"></label>
|
||||
<?php endif; ?>
|
||||
<?php if($file['type'] === 'dir'): ?>
|
||||
<?php if( $_['dirlisting'] ): ?>
|
||||
<a class="name" href="<?php p($_['baseURL'].'/'.$name); ?>" title="">
|
||||
<a class="name dir" href="<?php p($_['baseURL'].'/'.$name); ?>" title="">
|
||||
<?php else: ?>
|
||||
<a class="name" href="<?php p($_['baseURL'].'/'.$name.'.d'.$file['timestamp']); ?>" title="">
|
||||
<a class="name dir" href="<?php p($_['baseURL'].'/'.$name.'.d'.$file['timestamp']); ?>" title="">
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php if( $_['dirlisting'] ): ?>
|
||||
<a class="name" href="<?php p($_['downloadURL'].'/'.$name); ?>" title="">
|
||||
<a class="name file" href="<?php p($_['downloadURL'].'/'.$name); ?>" title="">
|
||||
<?php else: ?>
|
||||
<a class="name" href="<?php p($_['downloadURL'].'/'.$name.'.d'.$file['timestamp']);?>" title="">
|
||||
<a class="name file" href="<?php p($_['downloadURL'].'/'.$name.'.d'.$file['timestamp']);?>" title="">
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<span class="nametext">
|
||||
|
||||
@@ -37,8 +37,9 @@ if($maxX === 0 || $maxY === 0) {
|
||||
}
|
||||
|
||||
try{
|
||||
$preview = new \OC\Preview($user, 'files_versions');
|
||||
$preview->setFile($file.'.v'.$version);
|
||||
$preview = new \OC\Preview($user, 'files_versions', $file.'.v'.$version);
|
||||
$mimetype = \OC_Helper::getFileNameMimeType($file);
|
||||
$preview->setMimetype($mimetype);
|
||||
$preview->setMaxX($maxX);
|
||||
$preview->setMaxY($maxY);
|
||||
$preview->setScalingUp($scalingUp);
|
||||
|
||||
@@ -12,6 +12,7 @@ OCP\Util::addStyle('files_versions', 'versions');
|
||||
OCP\Util::connectHook('OC_Filesystem', 'write', "OCA\Files_Versions\Hooks", "write_hook");
|
||||
// Listen to delete and rename signals
|
||||
OCP\Util::connectHook('OC_Filesystem', 'post_delete', "OCA\Files_Versions\Hooks", "remove_hook");
|
||||
OCP\Util::connectHook('OC_Filesystem', 'delete', "OCA\Files_Versions\Hooks", "pre_remove_hook");
|
||||
OCP\Util::connectHook('OC_Filesystem', 'rename', "OCA\Files_Versions\Hooks", "rename_hook");
|
||||
//Listen to delete user signal
|
||||
OCP\Util::connectHook('OC_User', 'pre_deleteUser', "OCA\Files_Versions\Hooks", "deleteUser_hook");
|
||||
|
||||
@@ -21,7 +21,7 @@ $(document).ready(function(){
|
||||
// Action to perform when clicked
|
||||
if (scanFiles.scanning){return;}//workaround to prevent additional http request block scanning feedback
|
||||
|
||||
var file = $('#dir').val()+'/'+filename;
|
||||
var file = $('#dir').val().replace(/(?!<=\/)$|\/$/, '/' + filename);
|
||||
var createDropDown = true;
|
||||
// Check if drop down is already visible for a different file
|
||||
if (($('#dropdown').length > 0) ) {
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
$TRANSLATIONS = array(
|
||||
"Could not revert: %s" => "Ni mogoče povrniti: %s",
|
||||
"Versions" => "Različice",
|
||||
"Failed to revert {file} to revision {timestamp}." => "Povrnitev datoteke {file} na objavo {timestamp} je spodletelo.",
|
||||
"More versions..." => "Več različic",
|
||||
"No other versions available" => "Ni drugih različic",
|
||||
"Restore" => "Obnovi"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=4; plural=(n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3);";
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
$TRANSLATIONS = array(
|
||||
"Could not revert: %s" => "Не вдалося відновити: %s",
|
||||
"Versions" => "Версії",
|
||||
"Failed to revert {file} to revision {timestamp}." => "Не вдалося повернути {file} до ревізії {timestamp}.",
|
||||
"More versions..." => "Більше версій ...",
|
||||
"No other versions available" => "Інші версії недоступні",
|
||||
"Restore" => "Відновити"
|
||||
);
|
||||
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user