Merge branch 'master' into convert-oc_appconfig
This commit is contained in:
commit
a7c50514ac
|
@ -139,7 +139,8 @@ if (strpos($dir, '..') === false) {
|
||||||
'originalname' => $files['tmp_name'][$i],
|
'originalname' => $files['tmp_name'][$i],
|
||||||
'uploadMaxFilesize' => $maxUploadFileSize,
|
'uploadMaxFilesize' => $maxUploadFileSize,
|
||||||
'maxHumanFilesize' => $maxHumanFileSize,
|
'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],
|
'originalname' => $files['tmp_name'][$i],
|
||||||
'uploadMaxFilesize' => $maxUploadFileSize,
|
'uploadMaxFilesize' => $maxUploadFileSize,
|
||||||
'maxHumanFilesize' => $maxHumanFileSize,
|
'maxHumanFilesize' => $maxHumanFileSize,
|
||||||
'permissions' => $meta['permissions'] & $allowedPermissions
|
'permissions' => $meta['permissions'] & $allowedPermissions,
|
||||||
|
'directory' => \OC\Files\Filesystem::normalizePath(stripslashes($dir)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -435,10 +435,9 @@ window.FileList={
|
||||||
tr.attr('data-file', newname);
|
tr.attr('data-file', newname);
|
||||||
var path = td.children('a.name').attr('href');
|
var path = td.children('a.name').attr('href');
|
||||||
td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newname)));
|
td.children('a.name').attr('href', path.replace(encodeURIComponent(oldname), encodeURIComponent(newname)));
|
||||||
|
var basename = newname;
|
||||||
if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
|
if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
|
||||||
var basename=newname.substr(0,newname.lastIndexOf('.'));
|
basename = newname.substr(0,newname.lastIndexOf('.'));
|
||||||
} else {
|
|
||||||
var basename=newname;
|
|
||||||
}
|
}
|
||||||
td.find('a.name span.nametext').text(basename);
|
td.find('a.name span.nametext').text(basename);
|
||||||
if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
|
if (newname.indexOf('.') > 0 && tr.data('type') !== 'dir') {
|
||||||
|
@ -544,10 +543,9 @@ window.FileList={
|
||||||
td.children('a.name .span').text(newName);
|
td.children('a.name .span').text(newName);
|
||||||
var path = td.children('a.name').attr('href');
|
var path = td.children('a.name').attr('href');
|
||||||
td.children('a.name').attr('href', path.replace(encodeURIComponent(oldName), encodeURIComponent(newName)));
|
td.children('a.name').attr('href', path.replace(encodeURIComponent(oldName), encodeURIComponent(newName)));
|
||||||
|
var basename = newName;
|
||||||
if (newName.indexOf('.') > 0) {
|
if (newName.indexOf('.') > 0) {
|
||||||
var basename = newName.substr(0, newName.lastIndexOf('.'));
|
basename = newName.substr(0, newName.lastIndexOf('.'));
|
||||||
} else {
|
|
||||||
var basename = newName;
|
|
||||||
}
|
}
|
||||||
td.children('a.name').empty();
|
td.children('a.name').empty();
|
||||||
var span = $('<span class="nametext"></span>');
|
var span = $('<span class="nametext"></span>');
|
||||||
|
@ -924,8 +922,8 @@ $(document).ready(function() {
|
||||||
data.context.find('td.filesize').text(humanFileSize(size));
|
data.context.find('td.filesize').text(humanFileSize(size));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// only append new file if dragged onto current dir's crumb (last)
|
// only append new file if uploaded into the current folder
|
||||||
if (data.context && data.context.hasClass('crumb') && !data.context.hasClass('last')) {
|
if (file.directory !== FileList.getCurrentDirectory()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -405,7 +405,7 @@ $(document).ready(function() {
|
||||||
Files.resizeBreadcrumbs(width, true);
|
Files.resizeBreadcrumbs(width, true);
|
||||||
|
|
||||||
// display storage warnings
|
// display storage warnings
|
||||||
setTimeout ( "Files.displayStorageWarnings()", 100 );
|
setTimeout(Files.displayStorageWarnings, 100);
|
||||||
OC.Notification.setDefault(Files.displayStorageWarnings);
|
OC.Notification.setDefault(Files.displayStorageWarnings);
|
||||||
|
|
||||||
// only possible at the moment if user is logged in
|
// only possible at the moment if user is logged in
|
||||||
|
|
|
@ -80,8 +80,15 @@ class Hooks {
|
||||||
|
|
||||||
// Check if first-run file migration has already been performed
|
// Check if first-run file migration has already been performed
|
||||||
$ready = false;
|
$ready = false;
|
||||||
if ($util->getMigrationStatus() === Util::MIGRATION_OPEN) {
|
$migrationStatus = $util->getMigrationStatus();
|
||||||
|
if ($migrationStatus === Util::MIGRATION_OPEN) {
|
||||||
$ready = $util->beginMigration();
|
$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
|
// If migration not yet done
|
||||||
|
|
|
@ -36,8 +36,8 @@ use OCA\Encryption;
|
||||||
*/
|
*/
|
||||||
class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase {
|
class Test_Encryption_Hooks extends \PHPUnit_Framework_TestCase {
|
||||||
|
|
||||||
const TEST_ENCRYPTION_HOOKS_USER1 = "test-proxy-user1";
|
const TEST_ENCRYPTION_HOOKS_USER1 = "test-encryption-hooks-user1";
|
||||||
const TEST_ENCRYPTION_HOOKS_USER2 = "test-proxy-user2";
|
const TEST_ENCRYPTION_HOOKS_USER2 = "test-encryption-hooks-user2";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var \OC_FilesystemView
|
* @var \OC_FilesystemView
|
||||||
|
|
|
@ -61,7 +61,7 @@ class OC_Mount_Config {
|
||||||
'configuration' => array(
|
'configuration' => array(
|
||||||
'configured' => '#configured',
|
'configured' => '#configured',
|
||||||
'app_key' => 'App key',
|
'app_key' => 'App key',
|
||||||
'app_secret' => 'App secret',
|
'app_secret' => '*App secret',
|
||||||
'token' => '#token',
|
'token' => '#token',
|
||||||
'token_secret' => '#token_secret'),
|
'token_secret' => '#token_secret'),
|
||||||
'custom' => 'dropbox');
|
'custom' => 'dropbox');
|
||||||
|
@ -80,7 +80,7 @@ class OC_Mount_Config {
|
||||||
'configuration' => array(
|
'configuration' => array(
|
||||||
'configured' => '#configured',
|
'configured' => '#configured',
|
||||||
'client_id' => 'Client ID',
|
'client_id' => 'Client ID',
|
||||||
'client_secret' => 'Client secret',
|
'client_secret' => '*Client secret',
|
||||||
'token' => '#token'),
|
'token' => '#token'),
|
||||||
'custom' => 'google');
|
'custom' => 'google');
|
||||||
|
|
||||||
|
|
|
@ -92,12 +92,11 @@ class Shared_Cache extends Cache {
|
||||||
} else {
|
} else {
|
||||||
$query = \OC_DB::prepare(
|
$query = \OC_DB::prepare(
|
||||||
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
|
'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
|
||||||
.' `size`, `mtime`, `encrypted`'
|
.' `size`, `mtime`, `encrypted`, `unencrypted_size`'
|
||||||
.' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
.' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
|
||||||
$result = $query->execute(array($file));
|
$result = $query->execute(array($file));
|
||||||
$data = $result->fetchRow();
|
$data = $result->fetchRow();
|
||||||
$data['fileid'] = (int)$data['fileid'];
|
$data['fileid'] = (int)$data['fileid'];
|
||||||
$data['size'] = (int)$data['size'];
|
|
||||||
$data['mtime'] = (int)$data['mtime'];
|
$data['mtime'] = (int)$data['mtime'];
|
||||||
$data['storage_mtime'] = (int)$data['storage_mtime'];
|
$data['storage_mtime'] = (int)$data['storage_mtime'];
|
||||||
$data['encrypted'] = (bool)$data['encrypted'];
|
$data['encrypted'] = (bool)$data['encrypted'];
|
||||||
|
@ -106,6 +105,12 @@ class Shared_Cache extends Cache {
|
||||||
if ($data['storage_mtime'] === 0) {
|
if ($data['storage_mtime'] === 0) {
|
||||||
$data['storage_mtime'] = $data['mtime'];
|
$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 $data;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -334,6 +339,12 @@ class Shared_Cache extends Cache {
|
||||||
}
|
}
|
||||||
$row['mimetype'] = $this->getMimetype($row['mimetype']);
|
$row['mimetype'] = $this->getMimetype($row['mimetype']);
|
||||||
$row['mimepart'] = $this->getMimetype($row['mimepart']);
|
$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;
|
$files[] = $row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,10 +91,17 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
|
||||||
$file['name'] = basename($item['file_target']);
|
$file['name'] = basename($item['file_target']);
|
||||||
$file['mimetype'] = $item['mimetype'];
|
$file['mimetype'] = $item['mimetype'];
|
||||||
$file['mimepart'] = $item['mimepart'];
|
$file['mimepart'] = $item['mimepart'];
|
||||||
$file['size'] = $item['size'];
|
|
||||||
$file['mtime'] = $item['mtime'];
|
$file['mtime'] = $item['mtime'];
|
||||||
$file['encrypted'] = $item['encrypted'];
|
$file['encrypted'] = $item['encrypted'];
|
||||||
$file['etag'] = $item['etag'];
|
$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;
|
$files[] = $file;
|
||||||
}
|
}
|
||||||
return $files;
|
return $files;
|
||||||
|
|
|
@ -14,4 +14,7 @@
|
||||||
<types>
|
<types>
|
||||||
<authentication/>
|
<authentication/>
|
||||||
</types>
|
</types>
|
||||||
|
<documentation>
|
||||||
|
<admin>http://doc.owncloud.org/server/6.0/go.php?to=admin-ldap</admin>
|
||||||
|
</documentation>
|
||||||
</info>
|
</info>
|
||||||
|
|
|
@ -240,6 +240,7 @@ var LdapWizard = {
|
||||||
LdapWizard.hideSpinner('#ldap_base');
|
LdapWizard.hideSpinner('#ldap_base');
|
||||||
LdapWizard.showInfoBox('Please specify a Base DN');
|
LdapWizard.showInfoBox('Please specify a Base DN');
|
||||||
LdapWizard.showInfoBox('Could not determine Base DN');
|
LdapWizard.showInfoBox('Could not determine Base DN');
|
||||||
|
$('#ldap_base').prop('disabled', false);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -729,7 +729,7 @@ class Access extends LDAPUtility {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!is_null($limit)) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,9 +145,11 @@ interface ILDAPWrapper {
|
||||||
* @param $baseDN The DN of the entry to read from
|
* @param $baseDN The DN of the entry to read from
|
||||||
* @param $filter An LDAP filter
|
* @param $filter An LDAP filter
|
||||||
* @param $attr array of the attributes to read
|
* @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
|
* @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
|
* @brief Sets the value of the specified option to be $value
|
||||||
|
|
|
@ -85,9 +85,9 @@ class LDAP implements ILDAPWrapper {
|
||||||
return $this->invokeLDAPMethod('read', $link, $baseDN, $filter, $attr);
|
return $this->invokeLDAPMethod('read', $link, $baseDN, $filter, $attr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function search($link, $baseDN, $filter, $attr) {
|
public function search($link, $baseDN, $filter, $attr, $attrsonly = 0, $limit = 0) {
|
||||||
return $this->invokeLDAPMethod('search', $link, $baseDN,
|
return $this->invokeLDAPMethod('search', $link, $baseDN, $filter,
|
||||||
$filter, $attr);
|
$attr, $attrsonly, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setOption($link, $option, $value) {
|
public function setOption($link, $option, $value) {
|
||||||
|
|
|
@ -567,6 +567,10 @@ class Wizard extends LDAPUtility {
|
||||||
//get a result set > 0 on a proper base
|
//get a result set > 0 on a proper base
|
||||||
$rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1);
|
$rr = $this->ldap->search($cr, $base, 'objectClass=*', array('dn'), 0, 1);
|
||||||
if(!$this->ldap->isResource($rr)) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
$entries = $this->ldap->countEntries($cr, $rr);
|
$entries = $this->ldap->countEntries($cr, $rr);
|
||||||
|
@ -1010,6 +1014,7 @@ class Wizard extends LDAPUtility {
|
||||||
$this->configuration->ldapPort);
|
$this->configuration->ldapPort);
|
||||||
|
|
||||||
$this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
|
$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);
|
$this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
|
||||||
if($this->configuration->ldapTLS === 1) {
|
if($this->configuration->ldapTLS === 1) {
|
||||||
$this->ldap->startTls($cr);
|
$this->ldap->startTls($cr);
|
||||||
|
|
|
@ -85,15 +85,14 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto');
|
$avatarImage = $this->getAvatarImage($uid, $dn);
|
||||||
\OCP\Config::setUserValue($uid, 'user_ldap', 'lastJpegPhotoLookup', time());
|
if($avatarImage === false) {
|
||||||
if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) {
|
|
||||||
//not set, nothing left to do;
|
//not set, nothing left to do;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$image = new \OCP\Image();
|
$image = new \OCP\Image();
|
||||||
$image->loadFromBase64(base64_encode($jpegPhoto[0]));
|
$image->loadFromBase64(base64_encode($avatarImage));
|
||||||
|
|
||||||
if(!$image->valid()) {
|
if(!$image->valid()) {
|
||||||
\OCP\Util::writeLog('user_ldap', 'jpegPhoto data invalid for '.$dn,
|
\OCP\Util::writeLog('user_ldap', 'jpegPhoto data invalid for '.$dn,
|
||||||
|
@ -128,8 +127,7 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
|
||||||
if(!$dn) {
|
if(!$dn) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$jpegPhoto = $this->access->readAttribute($dn, 'jpegPhoto');
|
if($this->getAvatarImage($uid, $dn) === false) {
|
||||||
if(!$jpegPhoto || !is_array($jpegPhoto) || !isset($jpegPhoto[0])) {
|
|
||||||
//The user is allowed to change his avatar in ownCloud only if no
|
//The user is allowed to change his avatar in ownCloud only if no
|
||||||
//avatar is provided by LDAP
|
//avatar is provided by LDAP
|
||||||
return true;
|
return true;
|
||||||
|
@ -137,6 +135,26 @@ class USER_LDAP extends BackendUtility implements \OCP\UserInterface {
|
||||||
return false;
|
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
|
* @brief Check if the password is correct
|
||||||
* @param $uid The username
|
* @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
|
//check if user really still exists by reading its entry
|
||||||
if(!is_array($this->access->readAttribute($dn, ''))) {
|
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);
|
$this->access->connection->writeToCache('userExists'.$uid, false);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,8 +120,14 @@ $CONFIG = array(
|
||||||
/* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
|
/* Password to use for sendmail mail, depends on mail_smtpauth if this is used */
|
||||||
"mail_smtppassword" => "",
|
"mail_smtppassword" => "",
|
||||||
|
|
||||||
/* memcached hostname and port (Only used when xCache, APC and APCu are absent.) */
|
/* memcached servers (Only used when xCache, APC and APCu are absent.) */
|
||||||
"memcached_server" => array('localhost', 11211),
|
"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 */
|
/* How long should ownCloud keep deleted files in the trash bin, default value: 30 days */
|
||||||
'trashbin_retention_obligation' => 30,
|
'trashbin_retention_obligation' => 30,
|
||||||
|
|
|
@ -354,6 +354,10 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$sorter = new \OC\Share\SearchResultSorter($_GET['search'],
|
||||||
|
'label',
|
||||||
|
new \OC\Log());
|
||||||
|
usort($shareWith, array($sorter, 'sort'));
|
||||||
OC_JSON::success(array('data' => $shareWith));
|
OC_JSON::success(array('data' => $shareWith));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Controller {
|
||||||
$databases['sqlite'] = 'SQLite';
|
$databases['sqlite'] = 'SQLite';
|
||||||
}
|
}
|
||||||
if ($hasMySQL) {
|
if ($hasMySQL) {
|
||||||
$databases['mysql'] = 'MySQL';
|
$databases['mysql'] = 'MySQL/MariaDB';
|
||||||
}
|
}
|
||||||
if ($hasPostgreSQL) {
|
if ($hasPostgreSQL) {
|
||||||
$databases['pgsql'] = 'PostgreSQL';
|
$databases['pgsql'] = 'PostgreSQL';
|
||||||
|
|
|
@ -70,4 +70,23 @@ class Storage {
|
||||||
return false;
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,11 +72,12 @@ class Detection {
|
||||||
and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME)
|
and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME)
|
||||||
) {
|
) {
|
||||||
$info = @strtolower(finfo_file($finfo, $path));
|
$info = @strtolower(finfo_file($finfo, $path));
|
||||||
|
finfo_close($finfo);
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$mimeType = substr($info, 0, strpos($info, ';'));
|
$mimeType = substr($info, 0, strpos($info, ';'));
|
||||||
return empty($mimeType) ? 'application/octet-stream' : $mimeType;
|
return empty($mimeType) ? 'application/octet-stream' : $mimeType;
|
||||||
}
|
}
|
||||||
finfo_close($finfo);
|
|
||||||
}
|
}
|
||||||
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
|
$isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://');
|
||||||
if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {
|
if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) {
|
||||||
|
|
|
@ -132,10 +132,10 @@ class OC_L10N implements \OCP\IL10N {
|
||||||
$i18ndir = self::findI18nDir($app);
|
$i18ndir = self::findI18nDir($app);
|
||||||
// Localization is in /l10n, Texts are in $i18ndir
|
// Localization is in /l10n, Texts are in $i18ndir
|
||||||
// (Just no need to define date/time format etc. twice)
|
// (Just no need to define date/time format etc. twice)
|
||||||
if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC_App::getAppPath($app).'/l10n/')
|
if((OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/core/l10n/')
|
||||||
|| 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.'/lib/l10n/')
|
||||||
|| OC_Helper::issubdirectory($i18ndir.$lang.'.php', OC::$SERVERROOT.'/settings')
|
|| 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')) {
|
&& file_exists($i18ndir.$lang.'.php')) {
|
||||||
// Include the file, save the data from $CONFIG
|
// Include the file, save the data from $CONFIG
|
||||||
|
|
|
@ -18,8 +18,16 @@ class Memcached extends Cache {
|
||||||
parent::__construct($prefix);
|
parent::__construct($prefix);
|
||||||
if (is_null(self::$cache)) {
|
if (is_null(self::$cache)) {
|
||||||
self::$cache = new \Memcached();
|
self::$cache = new \Memcached();
|
||||||
list($host, $port) = \OC_Config::getValue('memcached_server', array('localhost', 11211));
|
$servers = \OC_Config::getValue('memcached_servers');
|
||||||
self::$cache->addServer($host, $port);
|
if (!$servers) {
|
||||||
|
$server = \OC_Config::getValue('memcached_server');
|
||||||
|
if ($server) {
|
||||||
|
$servers = array($server);
|
||||||
|
} else {
|
||||||
|
$servers = array(array('localhost', 11211));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self::$cache->addServers($servers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,13 @@ class OC_OCS_Result{
|
||||||
* @param $data mixed the data to return
|
* @param $data mixed the data to return
|
||||||
*/
|
*/
|
||||||
public function __construct($data=null, $code=100, $message=null) {
|
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->statusCode = $code;
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +55,7 @@ class OC_OCS_Result{
|
||||||
public function setItemsPerPage(int $items) {
|
public function setItemsPerPage(int $items) {
|
||||||
$this->perPage = $items;
|
$this->perPage = $items;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the status code
|
* get the status code
|
||||||
* @return int
|
* @return int
|
||||||
|
@ -57,7 +63,7 @@ class OC_OCS_Result{
|
||||||
public function getStatusCode() {
|
public function getStatusCode() {
|
||||||
return $this->statusCode;
|
return $this->statusCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the meta data for the result
|
* get the meta data for the result
|
||||||
* @return array
|
* @return array
|
||||||
|
@ -76,15 +82,15 @@ class OC_OCS_Result{
|
||||||
return $meta;
|
return $meta;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get the result data
|
* get the result data
|
||||||
* @return array|string|int
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getData() {
|
public function getData() {
|
||||||
return $this->data;
|
return $this->data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* return bool if the method succedded
|
* return bool if the method succedded
|
||||||
* @return bool
|
* @return bool
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
* See the COPYING-README file.
|
* See the COPYING-README file.
|
||||||
*/
|
*/
|
||||||
//both, libreoffice backend and php fallback, need imagick
|
//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');
|
$isShellExecEnabled = \OC_Helper::is_function_enabled('shell_exec');
|
||||||
|
|
||||||
// LibreOffice preview is currently not supported on Windows
|
// LibreOffice preview is currently not supported on Windows
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
namespace OC\Preview;
|
namespace OC\Preview;
|
||||||
|
|
||||||
if (extension_loaded('imagick')) {
|
if (extension_loaded('imagick') && count(\Imagick::queryFormats("PDF")) === 1) {
|
||||||
|
|
||||||
class PDF extends Provider {
|
class PDF extends Provider {
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
*/
|
*/
|
||||||
namespace OC\Preview;
|
namespace OC\Preview;
|
||||||
|
|
||||||
if (extension_loaded('imagick')) {
|
if (extension_loaded('imagick') && count(\Imagick::queryFormats("SVG")) === 1) {
|
||||||
|
|
||||||
class SVG extends Provider {
|
class SVG extends Provider {
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class Unknown extends Provider {
|
||||||
|
|
||||||
$svgPath = substr_replace($path, 'svg', -3);
|
$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
|
// http://www.php.net/manual/de/imagick.setresolution.php#85284
|
||||||
$svg = new \Imagick();
|
$svg = new \Imagick();
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
namespace OC\Setup;
|
namespace OC\Setup;
|
||||||
|
|
||||||
class MySQL extends AbstractDatabase {
|
class MySQL extends AbstractDatabase {
|
||||||
public $dbprettyname = 'MySQL';
|
public $dbprettyname = 'MySQL/MariaDB';
|
||||||
|
|
||||||
public function setupDatabase($username) {
|
public function setupDatabase($username) {
|
||||||
//check if the database user has admin right
|
//check if the database user has admin right
|
||||||
$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
|
$connection = @mysql_connect($this->dbhost, $this->dbuser, $this->dbpassword);
|
||||||
if(!$connection) {
|
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.'));
|
$this->trans->t('You need to enter either an existing account or the administrator.'));
|
||||||
}
|
}
|
||||||
$oldUser=\OC_Config::getValue('dbuser', false);
|
$oldUser=\OC_Config::getValue('dbuser', false);
|
||||||
|
@ -82,14 +82,14 @@ class MySQL extends AbstractDatabase {
|
||||||
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
|
$query = "CREATE USER '$name'@'localhost' IDENTIFIED BY '$password'";
|
||||||
$result = mysql_query($query, $connection);
|
$result = mysql_query($query, $connection);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'localhost' exists already.", 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", array($name)));
|
$this->trans->t("Drop this user from MySQL/MariaDB", array($name)));
|
||||||
}
|
}
|
||||||
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
|
$query = "CREATE USER '$name'@'%' IDENTIFIED BY '$password'";
|
||||||
$result = mysql_query($query, $connection);
|
$result = mysql_query($query, $connection);
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
throw new \DatabaseSetupException($this->trans->t("MySQL user '%s'@'%%' already exists", array($name)),
|
throw new \DatabaseSetupException($this->trans->t("MySQL/MariaDB user '%s'@'%%' already exists", array($name)),
|
||||||
$this->trans->t("Drop this user from MySQL."));
|
$this->trans->t("Drop this user from MySQL/MariaDB."));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2014 Arthur Schiwon <blizzz@owncloud.com>
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -205,6 +205,9 @@ class OC_User {
|
||||||
// Delete user files in /data/
|
// Delete user files in /data/
|
||||||
OC_Helper::rmdirr(\OC_User::getHome($uid));
|
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
|
// Remove it from the Cache
|
||||||
self::getManager()->delete($uid);
|
self::getManager()->delete($uid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1152,7 +1152,7 @@ class Share {
|
||||||
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
|
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`, `uid_owner`, '
|
||||||
.'`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
|
.'`share_type`, `share_with`, `file_source`, `path`, `file_target`, '
|
||||||
.'`permissions`, `expiration`, `storage`, `*PREFIX*filecache`.`parent` as `file_parent`, '
|
.'`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 {
|
} else {
|
||||||
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
|
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`,
|
||||||
`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
|
`*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`,
|
||||||
|
|
|
@ -158,7 +158,7 @@ $(document).ready(function(){
|
||||||
if(typeof timeout !== 'undefined'){
|
if(typeof timeout !== 'undefined'){
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
timeout = setTimeout('changeDisplayName()',1000);
|
timeout = setTimeout(changeDisplayName, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@ $(document).ready(function(){
|
||||||
if(typeof timeout !== 'undefined'){
|
if(typeof timeout !== 'undefined'){
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
timeout = setTimeout('changeEmailAddress()',1000);
|
timeout = setTimeout(changeEmailAddress, 1000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* ownCloud
|
||||||
|
*
|
||||||
|
* @author Arthur Schiwon
|
||||||
|
* @copyright 2014 Arthur Schiwon <blizzz@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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue