diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 8f6c42d662..754c34ef08 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -139,7 +139,8 @@ if (strpos($dir, '..') === false) {
'originalname' => $files['tmp_name'][$i],
'uploadMaxFilesize' => $maxUploadFileSize,
'maxHumanFilesize' => $maxHumanFileSize,
- 'permissions' => $meta['permissions'] & $allowedPermissions
+ 'permissions' => $meta['permissions'] & $allowedPermissions,
+ 'directory' => \OC\Files\Filesystem::normalizePath(stripslashes($dir)),
);
}
@@ -166,7 +167,8 @@ if (strpos($dir, '..') === false) {
'originalname' => $files['tmp_name'][$i],
'uploadMaxFilesize' => $maxUploadFileSize,
'maxHumanFilesize' => $maxHumanFileSize,
- 'permissions' => $meta['permissions'] & $allowedPermissions
+ 'permissions' => $meta['permissions'] & $allowedPermissions,
+ 'directory' => \OC\Files\Filesystem::normalizePath(stripslashes($dir)),
);
}
}
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index f538af1036..a855d6cbe5 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 = $('');
@@ -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 a535700c1b..1ec4c4ec7a 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_encryption/hooks/hooks.php b/apps/files_encryption/hooks/hooks.php
index 4c4b3f2040..83abf3ba9d 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/tests/hooks.php b/apps/files_encryption/tests/hooks.php
index c26cba6406..4452579174 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
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 01d588b372..48fc4dfe46 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');
@@ -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/lib/cache.php b/apps/files_sharing/lib/cache.php
index 86e324409f..1b102f9e5f 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -92,12 +92,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'];
@@ -106,6 +105,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;
@@ -334,6 +339,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 c956c55a1d..ec0f368386 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/user_ldap/appinfo/info.xml b/apps/user_ldap/appinfo/info.xml
index 148a72cecb..9cc908e852 100644
--- a/apps/user_ldap/appinfo/info.xml
+++ b/apps/user_ldap/appinfo/info.xml
@@ -14,4 +14,7 @@
+
+ http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap
+
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index acf88ef58a..792638f2b5 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 72f9c74092..b619f62f29 100644
--- a/apps/user_ldap/lib/access.php
+++ b/apps/user_ldap/lib/access.php
@@ -729,7 +729,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 20587cba7d..e60cf5ec63 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 dda8533c41..a99c648012 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 b70ede8599..00623b74fb 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -567,6 +567,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);
@@ -1010,6 +1014,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 a19af86086..619a992bd1 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;
@@ -137,6 +135,26 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
return false;
}
+ /**
+ * @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 $uid The username
@@ -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;
}
diff --git a/config/config.sample.php b/config/config.sample.php
index ef5fb7ea5a..0cd321d095 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -120,8 +120,14 @@ $CONFIG = array(
/* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
"mail_smtppassword" => "",
-/* memcached hostname and port (Only used when xCache, APC and APCu are absent.) */
-"memcached_server" => array('localhost', 11211),
+/* memcached servers (Only used when xCache, APC and APCu are absent.) */
+"memcached_servers" => array(
+ // hostname, port and optional weight. Also see:
+ // http://www.php.net/manual/en/memcached.addservers.php
+ // http://www.php.net/manual/en/memcached.addserver.php
+ array('localhost', 11211),
+ //array('other.host.local', 11211),
+),
/* How long should ownCloud keep deleted files in the trash bin, default value: 30 days */
'trashbin_retention_obligation' => 30,
diff --git a/core/ajax/share.php b/core/ajax/share.php
index 8b48effb45..c251f8e7ba 100644
--- a/core/ajax/share.php
+++ b/core/ajax/share.php
@@ -354,6 +354,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
break;
}
}
+ $sorter = new \OC\Share\SearchResultSorter($_GET['search'],
+ 'label',
+ new \OC\Log());
+ usort($shareWith, array($sorter, 'sort'));
OC_JSON::success(array('data' => $shareWith));
}
break;
diff --git a/core/setup/controller.php b/core/setup/controller.php
index 58ed4d28dc..697408cfb5 100644
--- a/core/setup/controller.php
+++ b/core/setup/controller.php
@@ -91,7 +91,7 @@ class Controller {
$databases['sqlite'] = 'SQLite';
}
if ($hasMySQL) {
- $databases['mysql'] = 'MySQL';
+ $databases['mysql'] = 'MySQL/MariaDB';
}
if ($hasPostgreSQL) {
$databases['pgsql'] = 'PostgreSQL';
diff --git a/lib/private/files/cache/storage.php b/lib/private/files/cache/storage.php
index 5657cf06e1..5b1b30176e 100644
--- a/lib/private/files/cache/storage.php
+++ b/lib/private/files/cache/storage.php
@@ -70,4 +70,23 @@ class Storage {
return false;
}
}
+
+ /**
+ * remove the entry for the storage
+ *
+ * @param string $storageId
+ */
+ public static function remove($storageId) {
+ $storageCache = new Storage($storageId);
+ $numericId = $storageCache->getNumericId();
+
+ if (strlen($storageId) > 64) {
+ $storageId = md5($storageId);
+ }
+ $sql = 'DELETE FROM `*PREFIX*storages` WHERE `id` = ?';
+ \OC_DB::executeAudited($sql, array($storageId));
+
+ $sql = 'DELETE FROM `*PREFIX*filecache` WHERE `storage` = ?';
+ \OC_DB::executeAudited($sql, array($numericId));
+ }
}
diff --git a/lib/private/files/type/detection.php b/lib/private/files/type/detection.php
index d7cc9ebbf4..11e439032c 100644
--- a/lib/private/files/type/detection.php
+++ b/lib/private/files/type/detection.php
@@ -72,11 +72,12 @@ class Detection {
and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME)
) {
$info = @strtolower(finfo_file($finfo, $path));
+ finfo_close($finfo);
if ($info) {
$mimeType = substr($info, 0, strpos($info, ';'));
return empty($mimeType) ? 'application/octet-stream' : $mimeType;
}
- finfo_close($finfo);
+
}
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index 98665c84c5..1aa1dc5ea2 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -132,10 +132,10 @@ class OC_L10N implements \OCP\IL10N {
$i18ndir = self::findI18nDir($app);
// Localization is in /l10n, Texts are in $i18ndir
// (Just no need to define date/time format etc. twice)
- if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
- || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
+ if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/lib/l10n/')
|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')
+ || OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
)
&& file_exists($i18ndir.$lang.'.php')) {
// Include the file, save the data from $CONFIG
diff --git a/lib/private/memcache/memcached.php b/lib/private/memcache/memcached.php
index 978e6c2eff..075828eeba 100644
--- a/lib/private/memcache/memcached.php
+++ b/lib/private/memcache/memcached.php
@@ -18,8 +18,16 @@ class Memcached extends Cache {
parent::__construct($prefix);
if (is_null(self::$cache)) {
self::$cache = new \Memcached();
- list($host, $port) = \OC_Config::getValue('memcached_server', array('localhost', 11211));
- self::$cache->addServer($host, $port);
+ $servers = \OC_Config::getValue('memcached_servers');
+ if (!$servers) {
+ $server = \OC_Config::getValue('memcached_server');
+ if ($server) {
+ $servers = array($server);
+ } else {
+ $servers = array(array('localhost', 11211));
+ }
+ }
+ self::$cache->addServers($servers);
}
}
diff --git a/lib/private/ocs/result.php b/lib/private/ocs/result.php
index 84f06fa01c..9f14e8da7e 100644
--- a/lib/private/ocs/result.php
+++ b/lib/private/ocs/result.php
@@ -29,7 +29,13 @@ class OC_OCS_Result{
* @param $data mixed the data to return
*/
public function __construct($data=null, $code=100, $message=null) {
- $this->data = $data;
+ if ($data === null) {
+ $this->data = array();
+ } elseif (!is_array($data)) {
+ $this->data = array($this->data);
+ } else {
+ $this->data = $data;
+ }
$this->statusCode = $code;
$this->message = $message;
}
@@ -49,7 +55,7 @@ class OC_OCS_Result{
public function setItemsPerPage(int $items) {
$this->perPage = $items;
}
-
+
/**
* get the status code
* @return int
@@ -57,7 +63,7 @@ class OC_OCS_Result{
public function getStatusCode() {
return $this->statusCode;
}
-
+
/**
* get the meta data for the result
* @return array
@@ -76,15 +82,15 @@ class OC_OCS_Result{
return $meta;
}
-
+
/**
* get the result data
- * @return array|string|int
+ * @return array
*/
public function getData() {
return $this->data;
}
-
+
/**
* return bool if the method succedded
* @return bool
diff --git a/lib/private/preview/office.php b/lib/private/preview/office.php
index 7a4826c76e..884b6e7dc9 100644
--- a/lib/private/preview/office.php
+++ b/lib/private/preview/office.php
@@ -6,7 +6,7 @@
* See the COPYING-README file.
*/
//both, libreoffice backend and php fallback, need imagick
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
// LibreOffice preview is currently not supported on Windows
diff --git a/lib/private/preview/pdf.php b/lib/private/preview/pdf.php
index cc974b6881..572b8788ac 100644
--- a/lib/private/preview/pdf.php
+++ b/lib/private/preview/pdf.php
@@ -7,7 +7,7 @@
*/
namespace OC\Preview;
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
class PDF extends Provider {
diff --git a/lib/private/preview/svg.php b/lib/private/preview/svg.php
index b49e51720f..07a37e8f8c 100644
--- a/lib/private/preview/svg.php
+++ b/lib/private/preview/svg.php
@@ -7,7 +7,7 @@
*/
namespace OC\Preview;
-if (extension_loaded('imagick')) {
+if (extension_loaded('imagick') && count(\Imagick::queryFormats("SVG")) === 1) {
class SVG extends Provider {
diff --git a/lib/private/preview/unknown.php b/lib/private/preview/unknown.php
index 4747f9e25e..8145c82614 100644
--- a/lib/private/preview/unknown.php
+++ b/lib/private/preview/unknown.php
@@ -22,7 +22,7 @@ class Unknown extends Provider {
$svgPath = substr_replace($path, 'svg', -3);
- if (extension_loaded('imagick') && file_exists($svgPath)) {
+ if (extension_loaded('imagick') && file_exists($svgPath) && count(\Imagick::queryFormats("SVG")) === 1) {
// http://www.php.net/manual/de/imagick.setresolution.php#85284
$svg = new \Imagick();
diff --git a/lib/private/setup/mysql.php b/lib/private/setup/mysql.php
index d97b6d2602..b2c28173b1 100644
--- a/lib/private/setup/mysql.php
+++ b/lib/private/setup/mysql.php
@@ -3,13 +3,13 @@
namespace OC\Setup;
class MySQL extends AbstractDatabase {
- public $dbprettyname = 'MySQL';
+ public $dbprettyname = 'MySQL/MariaDB';
public function setupDatabase($username) {
//check if the database user has admin right
$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
if(!$connection) {
- throw new \DatabaseSetupException($this->trans->t('MySQL username and/or password not valid'),
+ throw new \DatabaseSetupException($this->trans->t('MySQL/MariaDB username and/or password not valid'),
$this->trans->t('You need to enter either an existing account or the administrator.'));
}
$oldUser=\OC_Config::getValue('dbuser', false);
@@ -82,14 +82,14 @@ class MySQL extends AbstractDatabase {
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection);
if (!$result) {
- throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'localhost' exists already.", array($name)),
- $this->trans->t("Drop this user from MySQL", array($name)));
+ throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'localhost' exists already.", array($name)),
+ $this->trans->t("Drop this user from MySQL/MariaDB", array($name)));
}
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
$result = mysql_query($query, $connection);
if (!$result) {
- throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'%%' already exists", array($name)),
- $this->trans->t("Drop this user from MySQL."));
+ throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
+ $this->trans->t("Drop this user from MySQL/MariaDB."));
}
}
}
diff --git a/lib/private/share/searchresultsorter.php b/lib/private/share/searchresultsorter.php
new file mode 100644
index 0000000000..fbf7717909
--- /dev/null
+++ b/lib/private/share/searchresultsorter.php
@@ -0,0 +1,59 @@
+
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ *
+ */
+namespace OC\Share;
+
+class SearchResultSorter {
+ private $search;
+ private $encoding;
+ private $key;
+ private $log;
+
+ /**
+ * @param $search the search term as was given by the user
+ * @param $key the array key containing the value that should be compared
+ * against
+ * @param $encoding optional, encoding to use, defaults to UTF-8
+ * @param $log optional, an \OC\Log instance
+ */
+ public function __construct($search, $key, \OC\Log $log = null, $encoding = 'UTF-8') {
+ $this->encoding = $encoding;
+ $this->key = $key;
+ $this->log = $log;
+ $this->search = mb_strtolower($search, $this->encoding);
+ }
+
+ /**
+ * User and Group names matching the search term at the beginning shall appear
+ * on top of the share dialog. Following entries in alphabetical order.
+ * Callback function for usort. http://php.net/usort
+ */
+ public function sort($a, $b) {
+ if(!isset($a[$this->key]) || !isset($b[$this->key])) {
+ if(!is_null($this->log)) {
+ $this->log->error('Sharing dialogue: cannot sort due to ' .
+ 'missing array key', array('app' => 'core'));
+ }
+ return 0;
+ }
+ $nameA = mb_strtolower($a[$this->key], $this->encoding);
+ $nameB = mb_strtolower($b[$this->key], $this->encoding);
+ $i = mb_strpos($nameA, $this->search, 0, $this->encoding);
+ $j = mb_strpos($nameB, $this->search, 0, $this->encoding);
+
+ if($i === $j || $i > 0 && $j > 0) {
+ return strcmp(mb_strtolower($nameA, $this->encoding),
+ mb_strtolower($nameB, $this->encoding));
+ } elseif ($i === 0) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+}
+
diff --git a/lib/private/user.php b/lib/private/user.php
index 98ebebbe5c..2519200d0f 100644
--- a/lib/private/user.php
+++ b/lib/private/user.php
@@ -205,6 +205,9 @@ class OC_User {
// Delete user files in /data/
OC_Helper::rmdirr(\OC_User::getHome($uid));
+ // Delete the users entry in the storage table
+ \OC\Files\Cache\Storage::remove('home::' . $uid);
+
// Remove it from the Cache
self::getManager()->delete($uid);
}
diff --git a/lib/public/share.php b/lib/public/share.php
index f832d04a70..ae7d29e8b8 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1152,7 +1152,7 @@ class Share {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
.'`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
.'`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
- .'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `encrypted`, `etag`, `mail_send`';
+ .'`name`, `mtime`, `mimetype`, `mimepart`, `size`, `unencrypted_size`, `encrypted`, `etag`, `mail_send`';
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
diff --git a/settings/js/personal.js b/settings/js/personal.js
index e6e1d538a1..3b87646775 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -158,7 +158,7 @@ $(document).ready(function(){
if(typeof timeout !== 'undefined'){
clearTimeout(timeout);
}
- timeout = setTimeout('changeDisplayName()',1000);
+ timeout = setTimeout(changeDisplayName, 1000);
}
});
@@ -173,7 +173,7 @@ $(document).ready(function(){
if(typeof timeout !== 'undefined'){
clearTimeout(timeout);
}
- timeout = setTimeout('changeEmailAddress()',1000);
+ timeout = setTimeout(changeEmailAddress, 1000);
}
});
diff --git a/tests/lib/share/searchresultsorter.php b/tests/lib/share/searchresultsorter.php
new file mode 100644
index 0000000000..eaf93400a7
--- /dev/null
+++ b/tests/lib/share/searchresultsorter.php
@@ -0,0 +1,47 @@
+
+*
+* 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 .
+*/
+
+class Test_Share_Search extends \PHPUnit_Framework_TestCase {
+ public function testSort() {
+ $search = 'lin';
+ $sorter = new \OC\Share\SearchResultSorter($search, 'foobar');
+
+ $result = array(
+ array('foobar' => 'woot'),
+ array('foobar' => 'linux'),
+ array('foobar' => 'Linus'),
+ array('foobar' => 'Bicyclerepairwoman'),
+ );
+
+ usort($result, array($sorter, 'sort'));
+ $this->assertTrue($result[0]['foobar'] === 'Linus');
+ $this->assertTrue($result[1]['foobar'] === 'linux');
+ $this->assertTrue($result[2]['foobar'] === 'Bicyclerepairwoman');
+ $this->assertTrue($result[3]['foobar'] === 'woot');
+ }
+
+ /**
+ * @expectedException PHPUnit_Framework_Error
+ */
+ public function testSortWrongLog() {
+ $sorter = new \OC\Share\SearchResultSorter('foo', 'bar', 'UTF-8', 'foobar');
+ }
+}