diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-14 23:03:27 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2014-02-14 23:03:27 +0100 |
commit | 9fac95c2ab46a734607657bbad6f164aaa61286f (patch) | |
tree | fc035f83bc812fd4b2f36427bb130ddabf71433e /apps | |
parent | b330d07b51a983dc563a91244a3c83e691c9e97d (diff) | |
parent | df282d9ef8e040833574fac5c5fd3cbbae1b3209 (diff) | |
download | nextcloud-server-9fac95c2ab46a734607657bbad6f164aaa61286f.tar.gz nextcloud-server-9fac95c2ab46a734607657bbad6f164aaa61286f.zip |
Merge branch 'master' into scrutinizer_documentation_patches
Conflicts:
lib/private/appconfig.php
Diffstat (limited to 'apps')
26 files changed, 142 insertions, 61 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php index 8f6c42d6620..145f40c50da 100644 --- a/apps/files/ajax/upload.php +++ b/apps/files/ajax/upload.php @@ -22,6 +22,7 @@ if (empty($_POST['dirToken'])) { } else { // return only read permissions for public upload $allowedPermissions = OCP\PERMISSION_READ; + $public_directory = !empty($_POST['subdir']) ? $_POST['subdir'] : '/'; $linkItem = OCP\Share::getShareByToken($_POST['dirToken']); if ($linkItem === false) { @@ -45,7 +46,7 @@ if (empty($_POST['dirToken'])) { $dir = sprintf( "/%s/%s", $path, - isset($_POST['subdir']) ? $_POST['subdir'] : '' + $public_directory ); if (!$dir || empty($dir) || $dir === false) { @@ -112,7 +113,14 @@ if (strpos($dir, '..') === false) { } else { $target = \OC\Files\Filesystem::normalizePath(stripslashes($dir).'/'.$files['name'][$i]); } - + + $directory = \OC\Files\Filesystem::normalizePath(stripslashes($dir)); + if (isset($public_directory)) { + // If we are uploading from the public app, + // we want to send the relative path in the ajax request. + $directory = $public_directory; + } + if ( ! \OC\Files\Filesystem::file_exists($target) || (isset($_POST['resolution']) && $_POST['resolution']==='replace') ) { @@ -139,7 +147,8 @@ if (strpos($dir, '..') === false) { 'originalname' => $files['tmp_name'][$i], 'uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, - 'permissions' => $meta['permissions'] & $allowedPermissions + 'permissions' => $meta['permissions'] & $allowedPermissions, + 'directory' => $directory, ); } @@ -166,7 +175,8 @@ if (strpos($dir, '..') === false) { 'originalname' => $files['tmp_name'][$i], 'uploadMaxFilesize' => $maxUploadFileSize, 'maxHumanFilesize' => $maxHumanFileSize, - 'permissions' => $meta['permissions'] & $allowedPermissions + 'permissions' => $meta['permissions'] & $allowedPermissions, + 'directory' => $directory, ); } } diff --git a/apps/files/command/scan.php b/apps/files/command/scan.php index 25ab70af362..f334f29a939 100644 --- a/apps/files/command/scan.php +++ b/apps/files/command/scan.php @@ -58,6 +58,7 @@ class Scan extends Command { protected function execute(InputInterface $input, OutputInterface $output) { if ($input->getOption('all')) { + \OC_App::loadApps('authentication'); $users = $this->userManager->search(''); } else { $users = $input->getArgument('user_id'); diff --git a/apps/files/css/files.css b/apps/files/css/files.css index 5526abaf6e2..27fa75ebc59 100644 --- a/apps/files/css/files.css +++ b/apps/files/css/files.css @@ -84,9 +84,26 @@ background-color: rgb(240,240,240); } tbody a { color:#000; } -span.extension, span.uploading, td.date { color:#999; } -span.extension { text-transform:lowercase; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; filter:alpha(opacity=70); opacity:.7; -webkit-transition:opacity 300ms; -moz-transition:opacity 300ms; -o-transition:opacity 300ms; transition:opacity 300ms; } -tr:hover span.extension { -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; filter:alpha(opacity=100); opacity:1; color:#777; } + +span.extension, span.uploading, td.date { + color: #999; +} +span.extension { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)"; + filter: alpha(opacity=70); + opacity: .7; + -webkit-transition: opacity 300ms; + -moz-transition: opacity 300ms; + -o-transition: opacity 300ms; + transition: opacity 300ms; +} +tr:hover span.extension { + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + filter: alpha(opacity=100); + opacity: 1; + color: #777; +} + table tr.mouseOver td { background-color:#eee; } table th { height:24px; padding:0 8px; color:#999; } table th .name { diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index f538af10362..a855d6cbe59 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -435,10 +435,9 @@ window.FileList={ tr.attr('data-file', newname); var path = td.children('a.name').attr('href'); td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newname))); + var basename = newname; if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') { - var basename=newname.substr(0,newname.lastIndexOf('.')); - } else { - var basename=newname; + basename = newname.substr(0,newname.lastIndexOf('.')); } td.find('a.name span.nametext').text(basename); if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') { @@ -544,10 +543,9 @@ window.FileList={ td.children('a.name .span').text(newName); var path = td.children('a.name').attr('href'); td.children('a.name').attr('href', path.replace(encodeURIComponent(oldName), encodeURIComponent(newName))); + var basename = newName; if (newName.indexOf('.') > 0) { - var basename = newName.substr(0, newName.lastIndexOf('.')); - } else { - var basename = newName; + basename = newName.substr(0, newName.lastIndexOf('.')); } td.children('a.name').empty(); var span = $('<span class="nametext"></span>'); @@ -924,8 +922,8 @@ $(document).ready(function() { data.context.find('td.filesize').text(humanFileSize(size)); } else { - // only append new file if dragged onto current dir's crumb (last) - if (data.context && data.context.hasClass('crumb') && !data.context.hasClass('last')) { + // only append new file if uploaded into the current folder + if (file.directory !== FileList.getCurrentDirectory()) { return; } diff --git a/apps/files/js/files.js b/apps/files/js/files.js index a535700c1b3..1ec4c4ec7ab 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -405,7 +405,7 @@ $(document).ready(function() { Files.resizeBreadcrumbs(width, true); // display storage warnings - setTimeout ( "Files.displayStorageWarnings()", 100 ); + setTimeout(Files.displayStorageWarnings, 100); OC.Notification.setDefault(Files.displayStorageWarnings); // only possible at the moment if user is logged in diff --git a/apps/files/lib/helper.php b/apps/files/lib/helper.php index 21d1f50e587..01fc65d76b7 100644 --- a/apps/files/lib/helper.php +++ b/apps/files/lib/helper.php @@ -5,14 +5,14 @@ namespace OCA\Files; class Helper { public static function buildFileStorageStatistics($dir) { + // information about storage capacities + $storageInfo = \OC_Helper::getStorageInfo($dir); + $l = new \OC_L10N('files'); - $maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir); + $maxUploadFilesize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']); $maxHumanFilesize = \OCP\Util::humanFileSize($maxUploadFilesize); $maxHumanFilesize = $l->t('Upload') . ' max. ' . $maxHumanFilesize; - // information about storage capacities - $storageInfo = \OC_Helper::getStorageInfo($dir); - return array('uploadMaxFilesize' => $maxUploadFilesize, 'maxHumanFilesize' => $maxHumanFilesize, 'freeSpace' => $storageInfo['free'], diff --git a/apps/files_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php index d599665644b..d2a8290156f 100644 --- a/apps/files_encryption/hooks/hooks.php +++ b/apps/files_encryption/hooks/hooks.php @@ -80,8 +80,15 @@ class Hooks { // Check if first-run file migration has already been performed
$ready = false;
- if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
+ $migrationStatus = $util->getMigrationStatus();
+ if ($migrationStatus === Util::MIGRATION_OPEN) {
$ready = $util->beginMigration();
+ } elseif ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
+ // refuse login as long as the initial encryption is running
+ while ($migrationStatus === Util::MIGRATION_IN_PROGRESS) {
+ sleep(60);
+ $migrationStatus = $util->getMigrationStatus();
+ }
}
// If migration not yet done
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php index 11048005969..2ea477a6e4d 100644 --- a/apps/files_encryption/lib/proxy.php +++ b/apps/files_encryption/lib/proxy.php @@ -283,7 +283,7 @@ class Proxy extends \OC_FileProxy { public function postGetFileInfo($path, $data) { // if path is a folder do nothing - if (\OCP\App::isEnabled('files_encryption') && is_array($data) && array_key_exists('size', $data)) { + if (\OCP\App::isEnabled('files_encryption') && $data !== false && array_key_exists('size', $data)) { // Disable encryption proxy to prevent recursive calls $proxyStatus = \OC_FileProxy::$enabled; @@ -341,7 +341,7 @@ class Proxy extends \OC_FileProxy { } // if file is encrypted return real file size - if (is_array($fileInfo) && $fileInfo['encrypted'] === true) { + if ($fileInfo && $fileInfo['encrypted'] === true) { // try to fix unencrypted file size if it doesn't look plausible if ((int)$fileInfo['size'] > 0 && (int)$fileInfo['unencrypted_size'] === 0 ) { $fixSize = $util->getFileSize($path); @@ -354,7 +354,7 @@ class Proxy extends \OC_FileProxy { $size = $fileInfo['unencrypted_size']; } else { // self healing if file was removed from file cache - if (!is_array($fileInfo)) { + if (!$fileInfo) { $fileInfo = array(); } diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php index b3bf34ddb82..88eacc6f136 100644 --- a/apps/files_encryption/lib/stream.php +++ b/apps/files_encryption/lib/stream.php @@ -567,7 +567,7 @@ class Stream { // get file info $fileInfo = $this->rootView->getFileInfo($path); - if (is_array($fileInfo)) { + if ($fileInfo) { // set encryption data $fileInfo['encrypted'] = true; $fileInfo['size'] = $this->size; diff --git a/apps/files_encryption/tests/hooks.php b/apps/files_encryption/tests/hooks.php index c26cba6406d..7d926caea1b 100644 --- a/apps/files_encryption/tests/hooks.php +++ b/apps/files_encryption/tests/hooks.php @@ -36,8 +36,8 @@ use OCA\Encryption; */ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { - const TEST_ENCRYPTION_HOOKS_USER1 = "test-proxy-user1"; - const TEST_ENCRYPTION_HOOKS_USER2 = "test-proxy-user2"; + const TEST_ENCRYPTION_HOOKS_USER1 = "test-encryption-hooks-user1"; + const TEST_ENCRYPTION_HOOKS_USER2 = "test-encryption-hooks-user2"; /** * @var \OC_FilesystemView @@ -203,7 +203,7 @@ class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase { $fileInfo = $this->user1View->getFileInfo($this->filename); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the file with user2 \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_ENCRYPTION_HOOKS_USER2, OCP\PERMISSION_ALL); diff --git a/apps/files_encryption/tests/share.php b/apps/files_encryption/tests/share.php index acf408a07f0..5c6569f20e7 100755 --- a/apps/files_encryption/tests/share.php +++ b/apps/files_encryption/tests/share.php @@ -150,7 +150,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files/' . $this->filename); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // check if the unencrypted file size is stored $this->assertGreaterThan(0, $fileInfo['unencrypted_size']); @@ -310,7 +310,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files' . $this->folder1); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // re-enable the file proxy \OC_FileProxy::$enabled = $proxyStatus; @@ -388,7 +388,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { . $this->subfolder); // check if we have a valid file info - $this->assertTrue(is_array($fileInfoSubFolder)); + $this->assertTrue($fileInfoSubFolder instanceof \OC\Files\FileInfo); // re-enable the file proxy \OC_FileProxy::$enabled = $proxyStatus; @@ -422,7 +422,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { . $this->subsubfolder . '/' . $this->filename); // check if we have fileInfos - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // share the file with user3 \OCP\Share::shareItem('file', $fileInfo['fileid'], \OCP\Share::SHARE_TYPE_USER, \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER4, OCP\PERMISSION_ALL); @@ -517,7 +517,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files/' . $this->filename); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // check if the unencrypted file size is stored $this->assertGreaterThan(0, $fileInfo['unencrypted_size']); @@ -595,7 +595,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files/' . $this->filename); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // check if the unencrypted file size is stored $this->assertGreaterThan(0, $fileInfo['unencrypted_size']); @@ -888,7 +888,7 @@ class Test_Encryption_Share extends \PHPUnit_Framework_TestCase { '/' . \Test_Encryption_Share::TEST_ENCRYPTION_SHARE_USER1 . '/files/' . $this->filename); // check if we have a valid file info - $this->assertTrue(is_array($fileInfo)); + $this->assertTrue($fileInfo instanceof \OC\Files\FileInfo); // check if the unencrypted file size is stored $this->assertGreaterThan(0, $fileInfo['unencrypted_size']); diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php index 9eaff79d850..f87502e6cab 100755 --- a/apps/files_encryption/tests/util.php +++ b/apps/files_encryption/tests/util.php @@ -328,7 +328,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename); - $this->assertTrue(is_array($fileInfoUnencrypted)); + $this->assertTrue($fileInfoUnencrypted instanceof \OC\Files\FileInfo); // enable file encryption again \OC_App::enable('files_encryption'); @@ -338,7 +338,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename); - $this->assertTrue(is_array($fileInfoEncrypted)); + $this->assertTrue($fileInfoEncrypted instanceof \OC\Files\FileInfo); // check if mtime and etags unchanged $this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']); @@ -357,14 +357,14 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase { $fileInfoEncrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename); - $this->assertTrue(is_array($fileInfoEncrypted)); + $this->assertTrue($fileInfoEncrypted instanceof \OC\Files\FileInfo); // encrypt all unencrypted files $util->decryptAll('/' . $this->userId . '/' . 'files'); $fileInfoUnencrypted = $this->view->getFileInfo($this->userId . '/files/' . $filename); - $this->assertTrue(is_array($fileInfoUnencrypted)); + $this->assertTrue($fileInfoUnencrypted instanceof \OC\Files\FileInfo); // check if mtime and etags unchanged $this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']); diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php index ae0f4e41a5a..94dc5fb7ad8 100755 --- a/apps/files_external/lib/config.php +++ b/apps/files_external/lib/config.php @@ -61,7 +61,7 @@ class OC_Mount_Config { 'configuration' => array( 'configured' => '#configured', 'app_key' => 'App key', - 'app_secret' => 'App secret', + 'app_secret' => '*App secret', 'token' => '#token', 'token_secret' => '#token_secret'), 'custom' => 'dropbox'); @@ -69,7 +69,7 @@ class OC_Mount_Config { if(OC_Mount_Config::checkphpftp()) $backends['\OC\Files\Storage\FTP']=array( 'backend' => 'FTP', 'configuration' => array( - 'host' => 'URL', + 'host' => 'Hostname', 'user' => 'Username', 'password' => '*Password', 'root' => '&Root', @@ -80,7 +80,7 @@ class OC_Mount_Config { 'configuration' => array( 'configured' => '#configured', 'client_id' => 'Client ID', - 'client_secret' => 'Client secret', + 'client_secret' => '*Client secret', 'token' => '#token'), 'custom' => 'google'); diff --git a/apps/files_sharing/ajax/publicpreview.php b/apps/files_sharing/ajax/publicpreview.php index a52f522afac..d12d212a2e6 100644 --- a/apps/files_sharing/ajax/publicpreview.php +++ b/apps/files_sharing/ajax/publicpreview.php @@ -11,7 +11,7 @@ if(!\OC_App::isEnabled('files_sharing')){ \OC_User::setIncognitoMode(true); -$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '36'; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '36'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php index cf89f3ea629..7d63e7a4fe3 100644 --- a/apps/files_sharing/lib/cache.php +++ b/apps/files_sharing/lib/cache.php @@ -95,12 +95,11 @@ class Shared_Cache extends Cache { } else { $query = \OC_DB::prepare( 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,' - .' `size`, `mtime`, `encrypted`' + .' `size`, `mtime`, `encrypted`, `unencrypted_size`' .' FROM `*PREFIX*filecache` WHERE `fileid` = ?'); $result = $query->execute(array($file)); $data = $result->fetchRow(); $data['fileid'] = (int)$data['fileid']; - $data['size'] = (int)$data['size']; $data['mtime'] = (int)$data['mtime']; $data['storage_mtime'] = (int)$data['storage_mtime']; $data['encrypted'] = (bool)$data['encrypted']; @@ -109,6 +108,12 @@ class Shared_Cache extends Cache { if ($data['storage_mtime'] === 0) { $data['storage_mtime'] = $data['mtime']; } + if ($data['encrypted'] or ($data['unencrypted_size'] > 0 and $data['mimetype'] === 'httpd/unix-directory')) { + $data['encrypted_size'] = (int)$data['size']; + $data['size'] = (int)$data['unencrypted_size']; + } else { + $data['size'] = (int)$data['size']; + } return $data; } return false; @@ -337,6 +342,12 @@ class Shared_Cache extends Cache { } $row['mimetype'] = $this->getMimetype($row['mimetype']); $row['mimepart'] = $this->getMimetype($row['mimepart']); + if ($row['encrypted'] or ($row['unencrypted_size'] > 0 and $row['mimetype'] === 'httpd/unix-directory')) { + $row['encrypted_size'] = $row['size']; + $row['size'] = $row['unencrypted_size']; + } else { + $row['size'] = $row['size']; + } $files[] = $row; } } diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php index c956c55a1df..ec0f368386f 100644 --- a/apps/files_sharing/lib/share/file.php +++ b/apps/files_sharing/lib/share/file.php @@ -91,10 +91,17 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent { $file['name'] = basename($item['file_target']); $file['mimetype'] = $item['mimetype']; $file['mimepart'] = $item['mimepart']; - $file['size'] = $item['size']; $file['mtime'] = $item['mtime']; $file['encrypted'] = $item['encrypted']; $file['etag'] = $item['etag']; + $storage = \OC\Files\Filesystem::getStorage('/'); + $cache = $storage->getCache(); + if ($item['encrypted'] or ($item['unencrypted_size'] > 0 and $cache->getMimetype($item['mimetype']) === 'httpd/unix-directory')) { + $file['size'] = $item['unencrypted_size']; + $file['encrypted_size'] = $item['size']; + } else { + $file['size'] = $item['size']; + } $files[] = $file; } return $files; diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 3ddaf4446df..3eb84ce1672 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -35,7 +35,7 @@ <?php else: ?> <div id="imgframe"> <?php $size = \OC\Preview::isMimeSupported($_['mimetype']) ? 500 : 128 ?> - <img src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $size, 'y' => $size, 'file' => urlencode($_['directory_path']), 't' => $_['dirToken']))); ?>" class="publicpreview"/> + <img src="<?php p(OCP\Util::linkToRoute( 'core_ajax_public_preview', array('x' => $size, 'y' => $size, 'file' => $_['directory_path'], 't' => $_['dirToken']))); ?>" class="publicpreview"/> </div> <?php endif; ?> <div class="directDownload"> diff --git a/apps/files_trashbin/ajax/preview.php b/apps/files_trashbin/ajax/preview.php index 44738734b19..ce64d9ecc9f 100644 --- a/apps/files_trashbin/ajax/preview.php +++ b/apps/files_trashbin/ajax/preview.php @@ -11,7 +11,7 @@ if(!\OC_App::isEnabled('files_trashbin')){ exit; } -$file = array_key_exists('file', $_GET) ? (string) urldecode($_GET['file']) : ''; +$file = array_key_exists('file', $_GET) ? (string) $_GET['file'] : ''; $maxX = array_key_exists('x', $_GET) ? (int) $_GET['x'] : '44'; $maxY = array_key_exists('y', $_GET) ? (int) $_GET['y'] : '44'; $scalingUp = array_key_exists('scalingup', $_GET) ? (bool) $_GET['scalingup'] : true; diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 6d2d3f08112..56ab2e72c7b 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -1007,6 +1007,6 @@ class Trashbin { } public static function preview_icon($path) { - return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => urlencode($path) )); + return \OC_Helper::linkToRoute( 'core_ajax_trashbin_preview', array('x' => 36, 'y' => 36, 'file' => $path )); } } diff --git a/apps/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml index 148a72cecbb..9cc908e8522 100644 --- a/apps/user_ldap/appinfo/info.xml +++ b/apps/user_ldap/appinfo/info.xml @@ -14,4 +14,7 @@ <types> <authentication/> </types> + <documentation> + <admin>http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap</admin> + </documentation> </info> diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js index acf88ef58a4..792638f2b58 100644 --- a/apps/user_ldap/js/settings.js +++ b/apps/user_ldap/js/settings.js @@ -240,6 +240,7 @@ var LdapWizard = { LdapWizard.hideSpinner('#ldap_base'); LdapWizard.showInfoBox('Please specify a Base DN'); LdapWizard.showInfoBox('Could not determine Base DN'); + $('#ldap_base').prop('disabled', false); } ); } diff --git a/apps/user_ldap/lib/access.php b/apps/user_ldap/lib/access.php index 579aedeefc3..8a8d8aa5e3a 100644 --- a/apps/user_ldap/lib/access.php +++ b/apps/user_ldap/lib/access.php @@ -750,7 +750,7 @@ class Access extends LDAPUtility { } } else { if(!is_null($limit)) { - \OCP\Util::writeLog('user_ldap', 'Paged search failed :(', \OCP\Util::INFO); + \OCP\Util::writeLog('user_ldap', 'Paged search was not available', \OCP\Util::INFO); } } } diff --git a/apps/user_ldap/lib/ildapwrapper.php b/apps/user_ldap/lib/ildapwrapper.php index 3cda2aac7a5..017d5549690 100644 --- a/apps/user_ldap/lib/ildapwrapper.php +++ b/apps/user_ldap/lib/ildapwrapper.php @@ -145,9 +145,11 @@ interface ILDAPWrapper { * @param $baseDN The DN of the entry to read from * @param $filter An LDAP filter * @param $attr array of the attributes to read + * @param $attrsonly optional, 1 if only attribute types shall be returned + * @param $limit optional, limits the result entries * @return an LDAP search result resource, false on error */ - public function search($link, $baseDN, $filter, $attr); + public function search($link, $baseDN, $filter, $attr, $attrsonly = 0, $limit = 0); /** * @brief Sets the value of the specified option to be $value diff --git a/apps/user_ldap/lib/ldap.php b/apps/user_ldap/lib/ldap.php index ffd97ab83f9..de9b7481c19 100644 --- a/apps/user_ldap/lib/ldap.php +++ b/apps/user_ldap/lib/ldap.php @@ -85,9 +85,9 @@ class LDAP implements ILDAPWrapper { return $this->invokeLDAPMethod('read', $link, $baseDN, $filter, $attr); } - public function search($link, $baseDN, $filter, $attr) { - return $this->invokeLDAPMethod('search', $link, $baseDN, - $filter, $attr); + public function search($link, $baseDN, $filter, $attr, $attrsonly = 0, $limit = 0) { + return $this->invokeLDAPMethod('search', $link, $baseDN, $filter, + $attr, $attrsonly, $limit); } public function setOption($link, $option, $value) { diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php index 27edeb2a449..5079642d954 100644 --- a/apps/user_ldap/lib/wizard.php +++ b/apps/user_ldap/lib/wizard.php @@ -569,6 +569,10 @@ class Wizard extends LDAPUtility { //get a result set > 0 on a proper base $rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1); if(!$this->ldap->isResource($rr)) { + $errorNo = $this->ldap->errno($cr); + $errorMsg = $this->ldap->error($cr); + \OCP\Util::writeLog('user_ldap', 'Wiz: Could not search base '.$base. + ' Error '.$errorNo.': '.$errorMsg, \OCP\Util::INFO); return false; } $entries = $this->ldap->countEntries($cr, $rr); @@ -1015,6 +1019,7 @@ class Wizard extends LDAPUtility { $this->configuration->ldapPort); $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3); + $this->ldap->setOption($cr, LDAP_OPT_REFERRALS, 0); $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT); if($this->configuration->ldapTLS === 1) { $this->ldap->startTls($cr); diff --git a/apps/user_ldap/user_ldap.php b/apps/user_ldap/user_ldap.php index f983c7835af..1088dafab71 100644 --- a/apps/user_ldap/user_ldap.php +++ b/apps/user_ldap/user_ldap.php @@ -85,15 +85,14 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { return; } - $jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto'); - \OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', time()); - if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) { + $avatarImage = $this->getAvatarImage($uid, $dn); + if($avatarImage === false) { //not set, nothing left to do; return; } $image = new \OCP\Image(); - $image->loadFromBase64(base64_encode($jpegPhoto[0])); + $image->loadFromBase64(base64_encode($avatarImage)); if(!$image->valid()) { \OCP\Util::writeLog('user_ldap', 'jpegPhoto data invalid for '.$dn, @@ -128,8 +127,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { if(!$dn) { return false; } - $jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto'); - if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) { + if($this->getAvatarImage($uid, $dn) === false) { //The user is allowed to change his avatar in ownCloud only if no //avatar is provided by LDAP return true; @@ -138,6 +136,26 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { } /** + * @brief reads the image from LDAP that shall be used as Avatar + * @param $uid string, the ownCloud user name + * @param $dn string, the user DN + * @return image data (provided by LDAP) | false + */ + private function getAvatarImage($uid, $dn) { + $attributes = array('jpegPhoto', 'thumbnailPhoto'); + foreach($attributes as $attribute) { + $result = $this->access->readAttribute($dn, $attribute); + \OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', + time()); + if($result !== false && is_array($result) && isset($result[0])) { + return $result[0]; + } + } + + return false; + } + + /** * @brief Check if the password is correct * @param string $uid The username * @param string $password The password @@ -238,7 +256,8 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface { } //check if user really still exists by reading its entry if(!is_array($this->access->readAttribute($dn, ''))) { - \OCP\Util::writeLog('user_ldap', 'LDAP says no user '.$dn, \OCP\Util::DEBUG); + \OCP\Util::writeLog('user_ldap', 'LDAP says no user '.$dn.' on '. + $this->access->connection->ldapHost, \OCP\Util::DEBUG); $this->access->connection->writeToCache('userExists'.$uid, false); return false; } |