Compare commits

...

94 Commits

Author SHA1 Message Date
Frank Karlitschek 0d24b22485 6.0.0a 2013-12-14 20:40:17 +01:00
Frank Karlitschek e8a696cff9 Merge pull request #6389 from owncloud/ignore_comments_on_columns
ignore comments on schema as a quickfix for oc6
2013-12-14 11:31:20 -08:00
Vincent Petry 811ef19ada Removed comments in database schema of encryption app 2013-12-14 11:18:48 +01:00
Jörn Friedrich Dreyer db696a2dda ignore comments on schema as a quickfix for oc6 2013-12-13 19:21:14 +01:00
Vincent Petry 0b665700b5 Merge pull request #6406 from owncloud/stable6-no-backgroundjobs-during-upgrade
dont try to register background jobs if we haven't upgraded yet
2013-12-13 08:58:50 -08:00
Robin Appelman 0a0d89296b dont try to register background jobs if we haven't upgraded yet 2013-12-13 17:13:18 +01:00
blizzz fede36d515 Merge pull request #6308 from owncloud/fix_webdav_session_login_user_comparison
Fix webdav session login user comparison
2013-12-13 07:56:28 -08:00
Vincent Petry 527a16852e Merge pull request #6367 from owncloud/fix_expiration_date_conversion
rely only on php DateTime to parse the db datetime string
2013-12-13 07:36:30 -08:00
blizzz aab7c187f2 Merge pull request #6372 from owncloud/ldap_fix_setConfig
LDAP: fix method behind save button on advancend and expert tabs, fixes ...
2013-12-13 07:28:44 -08:00
Vincent Petry dd7b074dfa Fix webroot for update page
On the update page, config.js was missing which caused oc_webroot to not
be available. That would trigger the faulty oc_webroot fallback that
didn't take URLs like "/owncloud/index.php/files/apps" into account.

This fix adds config.js in the update page and also a fix for the
oc_webroot fallback, in case it is used elsewhere.

Backport of df1a404
2013-12-13 14:36:35 +01:00
Robin Appelman 71e93c2b79 remove unneeded ; in comment 2013-12-13 13:52:39 +01:00
Robin Appelman ca161e2a96 Add test for having utf8 filenames in the cache 2013-12-13 13:52:32 +01:00
Arthur Schiwon ab8691d84b adjust test 2013-12-13 12:56:06 +01:00
Thomas Müller a48cf28e17 Merge pull request #6364 from owncloud/backport-6302-stable6
Send "SET NAMES utf8" to MySQL for PHP below 5.3.6
2013-12-13 00:56:28 -08:00
Thomas Müller cd7c974fb6 Updated 3rdparty ref 2013-12-13 00:03:20 +01:00
Arthur Schiwon 3b5d032dd5 LDAP: fix method behind save button on advancend and expert tabs, fixes at least Home Folder setinng 2013-12-12 23:09:31 +01:00
Jörn Friedrich Dreyer f8088ecd29 rely only on php DateTime to parse the db datetime string 2013-12-12 19:09:21 +01:00
Bjoern Schiessle e83ff69465 toggle select all checkbox 2013-12-12 18:47:31 +01:00
Andreas Fischer 66af605697 Send "SET NAMES utf8" to MySQL for PHP below 5.3.6 2013-12-12 12:26:17 -05:00
Jörn Friedrich Dreyer 71dc81d420 update 3rdparty 2013-12-12 17:59:46 +01:00
blizzz 02c9bb76ff Merge pull request #6350 from owncloud/ldap_dont_autofill
LDAP: the browser shall not autofill userdn and password, usually login ...
2013-12-12 05:14:44 -08:00
Arthur Schiwon 7b388eb4a8 LDAP: the browser shall not autofill userdn and password, usually login credentials are inserted. fixes #6283 2013-12-12 14:04:10 +01:00
Arthur Schiwon c770089b50 coding style 2013-12-11 14:01:48 +01:00
Arthur Schiwon afaac05f61 coding style 2013-12-11 13:57:02 +01:00
Arthur Schiwon aba8199a82 On webdav sesssions, loginname was compared to username which does not need to match necessarily 2013-12-11 13:56:45 +01:00
Andreas Fischer 5ac339b866 Document memcached settings in config.sample.php 2013-12-09 14:35:20 +01:00
Morris Jobke 95c90ddbc4 fix wrong test data in l10n 2013-12-09 10:41:57 +01:00
Morris Jobke 2417c8a49e fix plural translation - fixes #6226 2013-12-09 10:41:51 +01:00
Frank Karlitschek 26d0adf2fe 6.0.0 2013-12-06 21:20:22 +01:00
Frank Karlitschek 734fdbddea RC4 2013-12-06 21:06:42 +01:00
Robin Appelman 33144941a9 add test case for removing background jobs that are throwing exceptions 2013-12-06 20:58:12 +01:00
Robin Appelman f309920bef Dont use exceptions for the backgroundjob test cases 2013-12-06 20:58:06 +01:00
Robin Appelman e78a309111 remove background jobs if they are failing 2013-12-06 20:57:58 +01:00
Robin Appelman 46a4ad4f3c Catch exceptions from background jobs and log them 2013-12-06 20:57:52 +01:00
Frank Karlitschek 3842c0d766 Merge pull request #6225 from owncloud/stable6-backgroundscan-reuse-etag
Stable6 backgroundscan reuse etag
2013-12-06 11:55:23 -08:00
Robin Appelman 8369c1f05b get rid of failing test that don't cause additional downloads 2013-12-06 19:19:10 +01:00
Robin Appelman cadf1c232e extend test case for etag preservation 2013-12-06 19:19:10 +01:00
Robin Appelman 713651738c reuse etags when doing a background scan 2013-12-06 19:19:10 +01:00
Bart Visscher 1475245465 XSendfile and encryption don't work together
The file on disk is encrypted, and not readable on client systems
2013-12-06 19:07:22 +01:00
Bart Visscher 281bbf4bd4 Don't try to encrypt a file when the temp file isn't created 2013-12-06 19:07:11 +01:00
Bart Visscher a2bbbb1448 Users of getFolderContent are mostly interested in the unecrypted file size 2013-12-06 19:06:42 +01:00
root 87a28957aa correctly propagate the return value of ldap_set_option
otherwise LDAP_OPT_REFERRALS won't be set to 0 and in turn
active directory paging will stop working
(Operations error on ldap_control_paged_result_response)
2013-12-06 18:01:42 +01:00
Bjoern Schiessle 01de6c565a set unencrypted_size to 0 after decryption... so that the unencrypted_size gets re-calculated if encryption was enabled again 2013-12-06 17:08:17 +01:00
Bjoern Schiessle f3e341edac add a optional parameter to skip check for expired files, this is necessary to find out to whom a file was shared after it was expired. 2013-12-06 14:42:09 +01:00
Bjoern Schiessle c5d6af3c5a get owner from share item, if we expire a share while the user updates his /Shared folder than the owner is different from the currently logged in user 2013-12-06 14:41:59 +01:00
Bjoern Schiessle cc1577054d it is not possible to unshare files 2013-12-06 12:36:31 +01:00
Björn Schießle 3e6b18b2d0 Merge pull request #6208 from owncloud/enc_only_create_new_key_if_no_other_key_exists
[Encryption] Only create new key if no other key exists
2013-12-06 03:07:52 -08:00
Nico Kaiser 7eb505e6dd Fix user's displayName being overwritten by (old) cookie 2013-12-05 20:56:41 +01:00
Bjoern Schiessle 91ca1cf985 fix typo 2013-12-05 20:02:41 +01:00
Bjoern Schiessle f8a4bcdd50 only create new key on password change if a recovery key exists or if the user don't have any private/public keys 2013-12-05 19:41:01 +01:00
Bjoern Schiessle 418d401bf9 show change password form if key couldn't be decrypted 2013-12-05 18:50:52 +01:00
Bjoern Schiessle d0afd774b7 add method to check if users private/public key exists 2013-12-05 18:49:55 +01:00
Morris Jobke 0af65cae37 fix appearance of error message - .errors is outdated 2013-12-05 16:11:52 +01:00
Frank Karlitschek 4d50fe5f12 ownCloud 6 RC3 2013-12-05 12:02:53 +01:00
Vincent Petry f24aca61a9 Merge pull request #6180 from owncloud/fix_6143
fixes checkboxes in Advanced Tab don't save unchecked state anymore, #6143
2013-12-04 08:33:12 -08:00
Bjoern Schiessle d3e2226b38 config switch to disable auto expire for the trash bin 2013-12-04 16:55:07 +01:00
Arthur Schiwon 73fa6259be LDAP Wizard: avoid a manually deactivated LDAP configuration is enabled by just opening the admin page 2013-12-04 14:01:31 +01:00
Morris Jobke dffc2a8b1c Revert "Adjust files_encryption requirements to the new core requirement (PHP 5.3.8)."
This reverts commit efbf18652c.
2013-12-04 13:26:59 +01:00
Vincent Petry fd634fdec8 Added unit test for the test() method
This is to make sure that method isn't broken
2013-12-04 13:22:25 +01:00
Arthur Schiwon 328ebaefde LDAP: make unsetting checkboxes from Advanced tab work again, fixes #6143 2013-12-04 13:15:17 +01:00
Thomas Müller 4de8c4e5db Merge pull request #6175 from owncloud/fix_6142
LDAP Wizard: make sure auto-detected suggestions are really applied initially, fixes #6142
2013-12-04 02:54:07 -08:00
Frank Karlitschek 8dc3cb2ffb lower required php version to 5.3.3 2013-12-04 10:51:12 +01:00
Arthur Schiwon c67ece0f6b LDAP Wizard: don't generate filter when not allowed 2013-12-03 20:50:46 +01:00
Arthur Schiwon 6640e120b7 some equals are more equal than other equals 2013-12-03 20:45:05 +01:00
Thomas Mueller 6f7b394d99 fixing PHPDoc and spelling 2013-12-03 17:49:37 +01:00
Andreas Fischer 91f47645b0 Use getLastError() everywhere. 2013-12-03 17:49:37 +01:00
Andreas Fischer 18903cc8f7 Add getLastError() 2013-12-03 17:49:37 +01:00
Andreas Fischer 7e467484a8 No function as oci_last_error. It's oci_error. 2013-12-03 17:49:37 +01:00
Andreas Fischer 21bf6abd41 There is no property such as dbusername. It's 'dbuser'. 2013-12-03 17:49:37 +01:00
Andreas Fischer 401728b2a2 Correct property name. It's 'dbpassword', with the 'db' prefix. 2013-12-03 17:49:37 +01:00
Andreas Fischer bfd0dc3314 Correct property name. It's just 'tableprefix', without the 'db' prefix. 2013-12-03 17:49:37 +01:00
Jan-Christoph Borchardt ad92b12559 fix time input field properly, details 2013-12-03 17:42:03 +01:00
Morris Jobke 4391992b8c fix public page - gallery view issues 2013-12-03 17:20:29 +01:00
Morris Jobke 728e6d735a fix trashbin and pbulic page controls 2013-12-03 17:20:23 +01:00
Morris Jobke 66df8c3bb3 fix and cleanup CSS for public page 2013-12-03 17:20:17 +01:00
Jan-Christoph Borchardt ca08d21da0 change different shades of grey for public share page to white 2013-12-03 17:20:08 +01:00
Jan-Christoph Borchardt 7d0f458f11 remove app specific code 2013-12-03 17:20:00 +01:00
Jan-Christoph Borchardt f15aeb3bbc fix details for buttons in header and controls bar 2013-12-03 17:19:53 +01:00
Jan-Christoph Borchardt 9333244925 account for shift of controls bar due to app navigation, do not shift on public page 2013-12-03 17:19:38 +01:00
Vincent Petry 50f5ab8515 Merge pull request #6173 from owncloud/stable6-extstorage-s3fixes
Backport of S3 ext storage fixes to stable6
2013-12-03 08:16:10 -08:00
Arthur Schiwon 4df0d2e7e8 LDAP Wizard: return correct var 2013-12-03 16:37:11 +01:00
Vincent Petry f2e17a0b68 Fixed placeholder after page reload
The placeholder somehow had too many characters stripping from it...
2013-12-03 15:55:24 +01:00
Vincent Petry e372971f2b Fixed test function for S3
Fixes #5752
2013-12-03 15:55:15 +01:00
Vincent Petry 3bf30377b8 Fixed Amazon S3 ext storage config UI
Optional parameters are now really optional

Fixes #5861
2013-12-03 15:55:08 +01:00
Arthur Schiwon 67b67b6d66 LDAP Wizard: make sure auto-detected suggestions are really applied initially. Also make initial filter compilation and user counting robust against race conditions. 2013-12-03 13:27:45 +01:00
Arthur Schiwon b8390f15d4 LDAP: on testing configuration, set active property to true, otherwise inactive connections cannot be tested properly 2013-12-03 13:21:55 +01:00
Robin Appelman 5ac3f9bfa5 check if a directory exists before we try to remove it 2013-12-03 12:45:41 +01:00
Arthur Schiwon 02fe013d2f LDAP: set default value for login filter to empty, otherwise the wizard signals completed configuration too early when it might be not correct, i.e. login won't work 2013-12-03 12:11:43 +01:00
Bjoern Schiessle 5e5e4fe3a4 make it possible to select folders 2013-12-02 22:23:51 +01:00
Arthur Schiwon d49e4e53fd LDAP Wizard: don't send ldap_tls change back to the interface as the element was removed, for it is detected fully automatically. Resolves an JS error and thus an ever-spinning spinner 2013-12-02 21:11:20 +01:00
Bjoern Schiessle 2d11290121 check explicitely all possible dir values 2013-12-02 16:06:51 +01:00
Bjoern Schiessle 1a197292da set delete all to true if a complete folder was deleted 2013-12-02 16:06:36 +01:00
Bjoern Schiessle 3b59979746 fix delete files from trash bin 2013-12-02 16:06:24 +01:00
Bjoern Schiessle 259d619af3 fix restore from files in sub-folders 2013-12-02 16:06:14 +01:00
65 changed files with 814 additions and 353 deletions
+5 -14
View File
@@ -69,20 +69,11 @@
<th <?php if (!$_['fileHeader']):?>class="hidden"<?php endif; ?> id="headerDate">
<span id="modified"><?php p($l->t( 'Modified' )); ?></span>
<?php if ($_['permissions'] & OCP\PERMISSION_DELETE): ?>
<!-- NOTE: Temporary fix to allow unsharing of files in root of Shared folder -->
<?php if ($_['dir'] == '/Shared'): ?>
<span class="selectedActions"><a href="" class="delete-selected">
<?php p($l->t('Unshare'))?>
<img class="svg" alt="<?php p($l->t('Unshare'))?>"
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
</a></span>
<?php else: ?>
<span class="selectedActions"><a href="" class="delete-selected">
<?php p($l->t('Delete'))?>
<img class="svg" alt="<?php p($l->t('Delete'))?>"
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
</a></span>
<?php endif; ?>
<span class="selectedActions"><a href="" class="delete-selected">
<?php p($l->t('Delete'))?>
<img class="svg" alt="<?php p($l->t('Delete'))?>"
src="<?php print_unescaped(OCP\image_path("core", "actions/delete.svg")); ?>" />
</a></span>
<?php endif; ?>
</th>
</tr>
+1 -4
View File
@@ -18,22 +18,19 @@
<type>text</type>
<notnull>true</notnull>
<length>64</length>
<comments>What client-side / server-side configuration is used</comments>
</field>
<field>
<name>recovery_enabled</name>
<type>integer</type>
<notnull>true</notnull>
<default>0</default>
<comments>Whether encryption key recovery is enabled</comments>
</field>
<field>
<name>migration_status</name>
<type>integer</type>
<notnull>true</notnull>
<default>0</default>
<comments>Whether encryption migration has been performed</comments>
</field>
</declaration>
</table>
</database>
</database>
+28 -23
View File
@@ -179,9 +179,9 @@ class Hooks {
// the necessary keys)
if (Crypt::mode() === 'server') {
if ($params['uid'] === \OCP\User::getUser()) {
$view = new \OC_FilesystemView('/');
$view = new \OC_FilesystemView('/');
if ($params['uid'] === \OCP\User::getUser()) {
$session = new \OCA\Encryption\Session($view);
@@ -202,36 +202,41 @@ class Hooks {
} else { // admin changed the password for a different user, create new keys and reencrypt file keys
$user = $params['uid'];
$recoveryPassword = $params['recoveryPassword'];
$newUserPassword = $params['password'];
$util = new Util($view, $user);
$recoveryPassword = isset($params['recoveryPassword']) ? $params['recoveryPassword'] : null;
$view = new \OC_FilesystemView('/');
if (($util->recoveryEnabledForUser() && $recoveryPassword)
|| !$util->userKeysExists()) {
// make sure that the users home is mounted
\OC\Files\Filesystem::initMountPoints($user);
$recoveryPassword = $params['recoveryPassword'];
$newUserPassword = $params['password'];
$keypair = Crypt::createKeypair();
// make sure that the users home is mounted
\OC\Files\Filesystem::initMountPoints($user);
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
$keypair = Crypt::createKeypair();
// Save public key
$view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
// Disable encryption proxy to prevent recursive calls
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
// Encrypt private key empty passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
// Save public key
$view->file_put_contents('/public-keys/' . $user . '.public.key', $keypair['publicKey']);
// Save private key
$view->file_put_contents(
'/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
// Encrypt private key empty passphrase
$encryptedPrivateKey = Crypt::symmetricEncryptFileContent($keypair['privateKey'], $newUserPassword);
if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
$util = new Util($view, $user);
$util->recoverUsersFiles($recoveryPassword);
// Save private key
$view->file_put_contents(
'/' . $user . '/files_encryption/' . $user . '.private.key', $encryptedPrivateKey);
if ($recoveryPassword) { // if recovery key is set we can re-encrypt the key files
$util = new Util($view, $user);
$util->recoverUsersFiles($recoveryPassword);
}
\OC_FileProxy::$enabled = $proxyStatus;
}
\OC_FileProxy::$enabled = $proxyStatus;
}
}
}
+8 -1
View File
@@ -370,7 +370,14 @@ class Helper {
* @return bool true if requirements are met
*/
public static function checkRequirements() {
return extension_loaded('openssl');
$result = true;
//openssl extension needs to be loaded
$result &= extension_loaded("openssl");
// we need php >= 5.3.3
$result &= version_compare(phpversion(), '5.3.3', '>=');
return (bool) $result;
}
/**
+35 -23
View File
@@ -101,15 +101,24 @@ class Util {
or !$this->view->file_exists($this->publicKeyPath)
or !$this->view->file_exists($this->privateKeyPath)
) {
return false;
} else {
return true;
}
}
/**
* @brief check if the users private & public key exists
* @return boolean
*/
public function userKeysExists() {
if (
$this->view->file_exists($this->privateKeyPath) &&
$this->view->file_exists($this->publicKeyPath)) {
return true;
} else {
return false;
}
}
/**
@@ -761,7 +770,7 @@ class Util {
\OC\Files\Filesystem::putFileInfo($relPath, array(
'encrypted' => false,
'size' => $size,
'unencrypted_size' => $size,
'unencrypted_size' => 0,
'etag' => $fileInfo['etag']
));
@@ -831,32 +840,35 @@ class Util {
// Open enc file handle for binary writing, with same filename as original plain file
$encHandle = fopen('crypt://' . $rawPath . '.part', 'wb');
// Move plain file to a temporary location
$size = stream_copy_to_stream($plainHandle, $encHandle);
if (is_resource($encHandle)) {
// Move plain file to a temporary location
$size = stream_copy_to_stream($plainHandle, $encHandle);
fclose($encHandle);
fclose($plainHandle);
fclose($encHandle);
fclose($plainHandle);
$fakeRoot = $this->view->getRoot();
$this->view->chroot('/' . $this->userId . '/files');
$fakeRoot = $this->view->getRoot();
$this->view->chroot('/' . $this->userId . '/files');
$this->view->rename($relPath . '.part', $relPath);
$this->view->rename($relPath . '.part', $relPath);
// set timestamp
$this->view->touch($relPath, $timestamp);
// set timestamp
$this->view->touch($relPath, $timestamp);
$this->view->chroot($fakeRoot);
$encSize = $this->view->filesize($relPath);
// Add the file to the cache
\OC\Files\Filesystem::putFileInfo($relPath, array(
'encrypted' => true,
'size' => $size,
'unencrypted_size' => $size,
'etag' => $fileInfo['etag']
));
$this->view->chroot($fakeRoot);
$encryptedFiles[] = $relPath;
// Add the file to the cache
\OC\Files\Filesystem::putFileInfo($relPath, array(
'encrypted' => true,
'size' => $encSize,
'unencrypted_size' => $size,
'etag' => $fileInfo['etag']
));
$encryptedFiles[] = $relPath;
}
}
// Encrypt legacy encrypted files
@@ -2,7 +2,7 @@
<fieldset class="personalblock">
<h2><?php p( $l->t( 'Encryption' ) ); ?></h2>
<?php if ( ! $_["privateKeySet"] && $_["initialized"] ): ?>
<?php if ( $_["initialized"] === '1' ): ?>
<p>
<a name="changePKPasswd" />
<label for="changePrivateKeyPasswd">
+7 -5
View File
@@ -81,9 +81,9 @@ class AmazonS3 extends \OC\Files\Storage\Common {
$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
$this->test = isset($params['test']);
$this->timeout = ( ! isset($params['timeout'])) ? 15 : $params['timeout'];
$params['region'] = ( ! isset($params['region'])) ? 'eu-west-1' : $params['region'];
$params['hostname'] = ( !isset($params['hostname'])) ? 's3.amazonaws.com' : $params['hostname'];
if (!isset($params['port'])) {
$params['region'] = ( ! isset($params['region']) || $params['region'] === '' ) ? 'eu-west-1' : $params['region'];
$params['hostname'] = ( !isset($params['hostname']) || $params['hostname'] === '' ) ? 's3.amazonaws.com' : $params['hostname'];
if (!isset($params['port']) || $params['port'] === '') {
$params['port'] = ($params['use_ssl'] === 'false') ? 80 : 443;
}
$base_url = $scheme.'://'.$params['hostname'].':'.$params['port'].'/';
@@ -507,8 +507,10 @@ class AmazonS3 extends \OC\Files\Storage\Common {
}
public function test() {
$test = $this->s3->get_canonical_user_id();
if (isset($test['id']) && $test['id'] != '') {
$test = $this->connection->getBucketAcl(array(
'Bucket' => $this->bucket,
));
if (isset($test) && !is_null($test->getPath('Owner/ID'))) {
return true;
}
return false;
+4 -3
View File
@@ -50,9 +50,9 @@ class OC_Mount_Config {
'key' => 'Access Key',
'secret' => '*Secret Key',
'bucket' => 'Bucket',
'hostname' => 'Hostname (optional)',
'port' => 'Port (optional)',
'region' => 'Region (optional)',
'hostname' => '&Hostname (optional)',
'port' => '&Port (optional)',
'region' => '&Region (optional)',
'use_ssl' => '!Enable SSL',
'use_path_style' => '!Enable Path Style'));
@@ -244,6 +244,7 @@ class OC_Mount_Config {
$storage = new $class($options);
return $storage->test();
} catch (Exception $exception) {
\OCP\Util::logException('files_external', $exception);
return false;
}
}
+1 -1
View File
@@ -60,7 +60,7 @@
class="optional"
data-parameter="<?php p($parameter); ?>"
value="<?php p($value); ?>"
placeholder="<?php p(substr($placeholder, 5)); ?>" />
placeholder="<?php p(substr($placeholder, 1)); ?>" />
<?php elseif (strpos($placeholder, '#') !== false): ?>
<input type="hidden"
data-parameter="<?php p($parameter); ?>"
+18 -11
View File
@@ -1,5 +1,5 @@
body {
background:#ddd;
height: auto;
}
#header {
@@ -22,7 +22,7 @@ body {
#public_upload,
#download {
font-weight:700;
margin: 0 0.4em 0 0;
margin: 0 0 0 .4em;
padding: 0 5px;
height: 32px;
float: left;
@@ -49,12 +49,14 @@ body {
vertical-align:text-bottom;
}
#controls {
left: 0;
}
#preview {
background:#eee;
border-bottom:1px solid #f8f8f8;
min-height:30em;
text-align:center;
margin:45px auto;
background: #fff;
text-align: center;
margin: 45px auto 0;
}
#noPreview {
@@ -62,11 +64,16 @@ body {
padding-top:5em;
}
footer {
margin-top: 45px;
}
p.info {
color:#777;
text-align:center;
width:22em;
margin:2em auto;
color: #777;
text-align: center;
width: 22em;
margin: 0 auto;
padding: 20px;
}
p.info a {
+6 -2
View File
@@ -112,8 +112,12 @@ class Shared_Updater {
*/
static public function shareHook($params) {
if ($params['itemType'] === 'file' || $params['itemType'] === 'folder') {
$uidOwner = \OCP\User::getUser();
$users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true);
if (isset($params['uidOwner'])) {
$uidOwner = $params['uidOwner'];
} else {
$uidOwner = \OCP\User::getUser();
}
$users = \OCP\Share::getUsersItemShared($params['itemType'], $params['fileSource'], $uidOwner, true, false);
if (!empty($users)) {
while (!empty($users)) {
$reshareUsers = array();
+18 -14
View File
@@ -4,14 +4,24 @@ OCP\JSON::checkLoggedIn();
OCP\JSON::callCheck();
// "empty trash" command
$deleteAll = false;
if (isset($_POST['allfiles']) and $_POST['allfiles'] === 'true'){
$user = \OCP\User::getUser();
$list = OCA\Files_Trashbin\Helper::getTrashFiles('/');
$deleteAll = true;
$dirlisting = '0';
$folder = isset($_POST['dir']) ? $_POST['dir'] : '/';
if ($folder === '/' || $folder === '') {
OCA\Files_Trashbin\Trashbin::deleteAll();
$list = array();
} else {
$dirname = dirname($folder);
if ( $dirname !== '/' && $dirname !== '.' ) {
$dirlisting = '1';
} else {
$dirlisting = '0';
}
$list[] = $folder;
}
}
else {
$deleteAll = false;
$files = $_POST['files'];
$dirlisting = $_POST['dirlisting'];
$list = json_decode($files);
@@ -19,19 +29,13 @@ else {
$error = array();
$success = array();
$i = 0;
foreach ($list as $file) {
if ( $dirlisting === '0') {
if ($deleteAll) {
$filename = $file['name'];
$timestamp = $file['timestamp'];
}
else {
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
}
$file = ltrim($file, '/');
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
} else {
$filename = $file;
$timestamp = null;
+1
View File
@@ -13,6 +13,7 @@ $success = array();
$i = 0;
foreach ($list as $file) {
if ( $dirlisting === '0') {
$file = ltrim($file, '/');
$delimiter = strrpos($file, '.d');
$filename = substr($file, 0, $delimiter);
$timestamp = substr($file, $delimiter+2);
+3
View File
@@ -0,0 +1,3 @@
#fileList td a.file, #fileList td a.file span {
cursor: default;
}
+1
View File
@@ -10,6 +10,7 @@ OCP\Util::addScript('files', 'fileactions');
$tmpl = new OCP\Template('files_trashbin', 'index', 'user');
OCP\Util::addStyle('files', 'files');
OCP\Util::addStyle('files_trashbin', 'trash');
OCP\Util::addScript('files', 'filelist');
// filelist overrides
OCP\Util::addScript('files_trashbin', 'filelist');
+19 -39
View File
@@ -8,7 +8,7 @@ $(document).ready(function() {
deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
$.post(OC.filePath('files_trashbin', 'ajax', 'undelete.php'),
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
{files: JSON.stringify([$('#dir').val() + '/' + filename]), dirlisting: tr.attr('data-dirlisting')},
function(result) {
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
@@ -35,7 +35,7 @@ $(document).ready(function() {
deleteAction.removeClass('delete-icon').addClass('progress-icon');
disableActions();
$.post(OC.filePath('files_trashbin', 'ajax', 'delete.php'),
{files: JSON.stringify([filename]), dirlisting: tr.attr('data-dirlisting')},
{files: JSON.stringify([$('#dir').val() + '/' +filename]), dirlisting: tr.attr('data-dirlisting')},
function(result) {
for (var i = 0; i < result.data.success.length; i++) {
var row = document.getElementById(result.data.success[i].filename);
@@ -66,41 +66,6 @@ $(document).ready(function() {
procesSelection();
});
$('#fileList').on('click', 'td.filename a', function(event) {
if (event.shiftKey) {
event.preventDefault();
var last = $(lastChecked).parent().parent().prevAll().length;
var first = $(this).parent().parent().prevAll().length;
var start = Math.min(first, last);
var end = Math.max(first, last);
var rows = $(this).parent().parent().parent().children('tr');
for (var i = start; i < end; i++) {
$(rows).each(function(index) {
if (index == i) {
var checkbox = $(this).children().children('input:checkbox');
$(checkbox).attr('checked', 'checked');
$(checkbox).parent().parent().addClass('selected');
}
});
}
}
var checkbox = $(this).parent().children('input:checkbox');
lastChecked = checkbox;
if ($(checkbox).attr('checked')) {
$(checkbox).removeAttr('checked');
$(checkbox).parent().parent().removeClass('selected');
$('#select_all').removeAttr('checked');
} else {
$(checkbox).attr('checked', 'checked');
$(checkbox).parent().parent().toggleClass('selected');
var selectedCount = $('td.filename input:checkbox:checked').length;
if (selectedCount == $('td.filename input:checkbox').length) {
$('#select_all').attr('checked', 'checked');
}
}
procesSelection();
});
$('.undelete').click('click', function(event) {
event.preventDefault();
var files = getSelectedFiles('file');
@@ -136,7 +101,8 @@ $(document).ready(function() {
var params = {};
if (allFiles) {
params = {
allfiles: true
allfiles: true,
dir: $('#dir').val()
};
}
else {
@@ -183,6 +149,20 @@ $(document).ready(function() {
});
$('#fileList').on('click', 'td.filename input', function() {
var checkbox = $(this).parent().children('input:checkbox');
$(checkbox).parent().parent().toggleClass('selected');
if ($(checkbox).is(':checked')) {
var selectedCount = $('td.filename input:checkbox:checked').length;
if (selectedCount === $('td.filename input:checkbox').length) {
$('#select_all').prop('checked', true);
}
} else {
$('#select_all').prop('checked',false);
}
procesSelection();
});
$('#fileList').on('click', 'td.filename a', function(event) {
var mime = $(this).parent().parent().data('mime');
if (mime !== 'httpd/unix-directory') {
@@ -229,7 +209,7 @@ function getSelectedFiles(property){
elements.each(function(i,element){
var file={
name:$(element).attr('data-filename'),
file:$(element).attr('data-file'),
file:$('#dir').val() + "/" + $(element).attr('data-file'),
timestamp:$(element).attr('data-timestamp'),
type:$(element).attr('data-type'),
dirlisting:$(element).attr('data-dirlisting')
+2
View File
@@ -44,8 +44,10 @@ class Helper
}
$files = array();
$id = 0;
foreach ($result as $r) {
$i = array();
$i['id'] = $id++;
$i['name'] = $r['id'];
$i['date'] = \OCP\Util::formatDate($r['timestamp']);
$i['timestamp'] = $r['timestamp'];
+21 -1
View File
@@ -564,6 +564,21 @@ class Trashbin {
return $size;
}
/**
* @brief delete all files from the trash
*/
public static function deleteAll() {
$user = \OCP\User::getUser();
$view = new \OC\Files\View('/' . $user);
$view->deleteAll('files_trashbin');
self::setTrashbinSize($user, 0);
$query = \OC_DB::prepare('DELETE FROM `*PREFIX*files_trash` WHERE `user`=?');
$query->execute(array($user));
return true;
}
/**
* @brief delete file from trash bin permanently
*
@@ -763,8 +778,13 @@ class Trashbin {
*/
private static function expire($trashbinSize, $user) {
// let the admin disable auto expire
$autoExpire = \OC_Config::getValue('trashbin_auto_expire', true);
if ($autoExpire === false) {
return 0;
}
$user = \OCP\User::getUser();
$view = new \OC\Files\View('/' . $user);
$availableSpace = self::calculateFreeSpace($trashbinSize);
$size = 0;
+8 -5
View File
@@ -35,18 +35,21 @@
<?php endif; ?>
<?php endif; ?>
>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?><input type="checkbox" /><?php endif; ?>
<?php if(!isset($_['readonly']) || !$_['readonly']): ?>
<input id="select-<?php p($file['id']); ?>" type="checkbox" />
<label for="select-<?php p($file['id']); ?>"></label>
<?php endif; ?>
<?php if($file['type'] === 'dir'): ?>
<?php if( $_['dirlisting'] ): ?>
<a class="name" href="<?php p($_['baseURL'].'/'.$name); ?>" title="">
<a class="name dir" href="<?php p($_['baseURL'].'/'.$name); ?>" title="">
<?php else: ?>
<a class="name" href="<?php p($_['baseURL'].'/'.$name.'.d'.$file['timestamp']); ?>" title="">
<a class="name dir" href="<?php p($_['baseURL'].'/'.$name.'.d'.$file['timestamp']); ?>" title="">
<?php endif; ?>
<?php else: ?>
<?php if( $_['dirlisting'] ): ?>
<a class="name" href="<?php p($_['downloadURL'].'/'.$name); ?>" title="">
<a class="name file" href="<?php p($_['downloadURL'].'/'.$name); ?>" title="">
<?php else: ?>
<a class="name" href="<?php p($_['downloadURL'].'/'.$name.'.d'.$file['timestamp']);?>" title="">
<a class="name file" href="<?php p($_['downloadURL'].'/'.$name.'.d'.$file['timestamp']);?>" title="">
<?php endif; ?>
<?php endif; ?>
<span class="nametext">
+12
View File
@@ -27,6 +27,18 @@ OCP\JSON::checkAppEnabled('user_ldap');
OCP\JSON::callCheck();
$prefix = $_POST['ldap_serverconfig_chooser'];
// Checkboxes are not submitted, when they are unchecked. Set them manually.
// only legacy checkboxes (Advanced and Expert tab) need to be handled here,
// the Wizard-like tabs handle it on their own
$chkboxes = array('ldap_configuration_active', 'ldap_override_main_server',
'ldap_nocase', 'ldap_turn_off_cert_check');
foreach($chkboxes as $boxid) {
if(!isset($_POST[$boxid])) {
$_POST[$boxid] = 0;
}
}
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, $prefix);
$connection->setConfiguration($_POST);
@@ -30,6 +30,8 @@ $l=OC_L10N::get('user_ldap');
$ldapWrapper = new OCA\user_ldap\lib\LDAP();
$connection = new \OCA\user_ldap\lib\Connection($ldapWrapper, '', null);
//needs to be true, otherwise it will also fail with an irritating message
$_POST['ldap_configuration_active'] = 1;
if($connection->setConfiguration($_POST)) {
//Configuration is okay
if($connection->bind()) {
+66 -6
View File
@@ -407,6 +407,7 @@ var LdapWizard = {
if($('#rawLoginFilterContainer').hasClass('invisible')) {
$('#ldap_loginfilter_attributes').multiselect('enable');
}
LdapWizard.postInitLoginFilter();
},
function (result) {
//deactivate if no attributes found
@@ -443,10 +444,24 @@ var LdapWizard = {
//enable only when raw filter editing is not turned on
$('#'+multisel).multiselect('enable');
}
if(type === 'Users') {
//required for initial save
filter = $('#ldap_userlist_filter').val();
if(!filter) {
LdapWizard.saveMultiSelect(multisel,
$('#'+multisel).multiselect("getChecked"));
}
LdapWizard.userFilterAvailableGroupsHasRun = true;
LdapWizard.postInitUserFilter();
}
},
function (result) {
LdapWizard.hideSpinner('#'+multisel);
$('#'+multisel).multiselect('disable');
if(type == 'Users') {
LdapWizard.userFilterAvailableGroupsHasRun = true;
LdapWizard.postInitUserFilter();
}
}
);
},
@@ -471,9 +486,23 @@ var LdapWizard = {
LdapWizard.hideSpinner('#'+multisel);
LdapWizard.applyChanges(result);
$('#'+multisel).multiselect('refresh');
if(type === 'User') {
//required for initial save
filter = $('#ldap_userlist_filter').val();
if(!filter) {
LdapWizard.saveMultiSelect(multisel,
$('#'+multisel).multiselect("getChecked"));
}
LdapWizard.userFilterObjectClassesHasRun = true;
LdapWizard.postInitUserFilter();
}
},
function (result) {
LdapWizard.hideSpinner('#'+multisel);
if(type == 'User') {
LdapWizard.userFilterObjectClassesHasRun = true;
LdapWizard.postInitUserFilter();
}
//TODO: error handling
}
);
@@ -489,13 +518,17 @@ var LdapWizard = {
loginfilter = $('#ldap_login_filter').val();
//FIXME: activates a manually deactivated configuration.
if(host && port && base && userfilter && loginfilter) {
if(host && port && base && userfilter && loginfilter) {
LdapWizard.updateStatusIndicator(true);
if($('#ldap_configuration_active').is(':checked')) {
return;
}
$('#ldap_configuration_active').prop('checked', true);
LdapWizard.save($('#ldap_configuration_active')[0]);
if(!LdapWizard.isConfigurationActiveControlLocked) {
//avoids a manually deactivated connection will be activated
//upon opening the admin page
$('#ldap_configuration_active').prop('checked', true);
LdapWizard.save($('#ldap_configuration_active')[0]);
}
} else {
if($('#ldap_configuration_active').is(':checked')) {
$('#ldap_configuration_active').prop('checked', false);
@@ -517,9 +550,12 @@ var LdapWizard = {
$(id + " + button").css('display', 'inline');
},
isConfigurationActiveControlLocked: true,
init: function() {
LdapWizard.basicStatusCheck();
LdapWizard.functionalityCheck();
LdapWizard.isConfigurationActiveControlLocked = false;
},
initGroupFilter: function() {
@@ -529,11 +565,21 @@ var LdapWizard = {
LdapWizard.countGroups();
},
/** init login filter tab section **/
initLoginFilter: function() {
LdapWizard.regardFilterMode('Login');
LdapWizard.findAttributes();
},
postInitLoginFilter: function() {
if($('#rawLoginFilterContainer').hasClass('invisible')) {
LdapWizard.composeFilter('login');
}
},
/** end of init user filter tab section **/
initMultiSelect: function(object, id, caption) {
object.multiselect({
header: false,
@@ -546,13 +592,29 @@ var LdapWizard = {
});
},
/** init user filter tab section **/
userFilterObjectClassesHasRun: false,
userFilterAvailableGroupsHasRun: false,
initUserFilter: function() {
LdapWizard.userFilterObjectClassesHasRun = false;
LdapWizard.userFilterAvailableGroupsHasRun = false;
LdapWizard.regardFilterMode('User');
LdapWizard.findObjectClasses('ldap_userfilter_objectclass', 'User');
LdapWizard.findAvailableGroups('ldap_userfilter_groups', 'Users');
LdapWizard.countUsers();
},
postInitUserFilter: function() {
if(LdapWizard.userFilterObjectClassesHasRun
&& LdapWizard.userFilterAvailableGroupsHasRun) {
LdapWizard.composeFilter('user');
LdapWizard.countUsers();
}
},
/** end of init user filter tab section **/
onTabChange: function(event, ui) {
newTabIndex = 0;
if(ui.newTab[0].id === '#ldapWizard2') {
@@ -619,8 +681,6 @@ var LdapWizard = {
} else if(mode == LdapWizard.filterModeAssisted
&& !$('#raw'+subject+'FilterContainer').hasClass('invisible')) {
LdapWizard['toggleRaw'+subject+'Filter']();
} else {
c = $('#raw'+subject+'FilterContainer').hasClass('invisible');
}
},
function (result) {
+7 -6
View File
@@ -129,6 +129,7 @@ class Configuration {
if(!empty($val) && strpos($val, 'attr:') === false) {
$val = 'attr:'.$val;
}
break;
case 'ldapBase':
case 'ldapBaseUsers':
case 'ldapBaseGroups':
@@ -140,11 +141,11 @@ class Configuration {
case 'ldapGroupFilterGroups':
case 'ldapLoginFilterAttributes':
$setMethod = 'setMultiLine';
default:
$this->$setMethod($key, $val);
if(is_array($applied)) {
$applied[] = $inputkey;
}
break;
}
$this->$setMethod($key, $val);
if(is_array($applied)) {
$applied[] = $inputkey;
}
}
@@ -308,7 +309,7 @@ class Configuration {
'ldap_user_filter_mode' => 0,
'ldap_userfilter_objectclass' => '',
'ldap_userfilter_groups' => '',
'ldap_login_filter' => 'uid=%uid',
'ldap_login_filter' => '',
'ldap_login_filter_mode' => 0,
'ldap_loginfilter_email' => 0,
'ldap_loginfilter_username' => 1,
+1 -1
View File
@@ -91,7 +91,7 @@ class LDAP implements ILDAPWrapper {
}
public function setOption($link, $option, $value) {
$this->invokeLDAPMethod('set_option', $link, $option, $value);
return $this->invokeLDAPMethod('set_option', $link, $option, $value);
}
public function sort($link, $result, $sortfilter) {
+1 -2
View File
@@ -432,7 +432,6 @@ class Wizard extends LDAPUtility {
$this->configuration->setConfiguration($config);
\OCP\Util::writeLog('user_ldap', 'Wiz: detected Port '. $p, \OCP\Util::DEBUG);
$this->result->addChange('ldap_port', $p);
$this->result->addChange('ldap_tls', intval($t));
return $this->result;
}
}
@@ -1001,7 +1000,7 @@ class Wizard extends LDAPUtility {
private function getConnection() {
if(!is_null($this->cr)) {
return $cr;
return $this->cr;
}
$cr = $this->ldap->connect(
$this->configuration->ldapHost.':'.$this->configuration->ldapPort,
@@ -41,7 +41,7 @@
<div class="tablerow">
<input type="text" id="ldap_dn" name="ldap_dn"
class="tablecell lwautosave"
placeholder="<?php p($l->t('User DN'));?>"
placeholder="<?php p($l->t('User DN'));?>" autocomplete="off"
title="<?php p($l->t('The DN of the client user with which the bind shall be done, e.g. uid=agent,dc=example,dc=com. For anonymous access, leave DN and Password empty.'));?>"
/>
</div>
@@ -49,7 +49,7 @@
<div class="tablerow">
<input type="password" id="ldap_agent_password"
class="tablecell lwautosave" name="ldap_agent_password"
placeholder="<?php p($l->t('Password'));?>"
placeholder="<?php p($l->t('Password'));?>" autocomplete="off"
title="<?php p($l->t('For anonymous access, leave DN and Password empty.'));?>"
/>
</div>
Regular → Executable
+8 -2
View File
@@ -114,9 +114,15 @@ $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),
/* How long should ownCloud keep deleted files in the trash bin, default value: 30 days */
'trashbin_retention_obligation' => 30,
/* Disable/Enable auto expire for the trash bin, by default auto expire is enabled */
'trashbin_auto_expire' => true,
/* allow user to change his display name, if it is supported by the back-end */
'allow_user_to_change_display_name' => true,
@@ -185,8 +191,8 @@ $CONFIG = array(
// "datadirectory" => "",
/* Enable maintenance mode to disable ownCloud
If you want to prevent users to login to ownCloud before you start doing some maintenance work,
you need to set the value of the maintenance parameter to true.
If you want to prevent users to login to ownCloud before you start doing some maintenance work,
you need to set the value of the maintenance parameter to true.
Please keep in mind that users who are already logged-in are kicked out of ownCloud instantly.
*/
"maintenance" => false,
+10 -3
View File
@@ -105,8 +105,8 @@ textarea:hover, textarea:focus, textarea:active {
input[type="checkbox"] { margin:0; padding:0; height:auto; width:auto; }
input[type="checkbox"]:hover+label, input[type="checkbox"]:focus+label { color:#111 !important; }
input[type="time"] {
width: 110px;
height: 30px;
width: initial;
height: 31px;
-moz-box-sizing: border-box; box-sizing: border-box;
}
#quota {
@@ -202,13 +202,20 @@ input[type="submit"].enabled {
box-sizing: border-box;
position: fixed;
right: 0;
left: 80px;
left: 0;
height: 44px;
width: 100%;
padding: 0;
margin: 0;
background: #eee;
border-bottom: 1px solid #e7e7e7;
z-index: 50;
}
/* account for shift of controls bar due to app navigation */
#body-user #controls,
#body-settings #controls {
padding-left: 80px;
}
#controls .button,
#controls button,
#controls input[type='submit'],
+9 -2
View File
@@ -12,7 +12,14 @@ var oc_current_user = document.getElementsByTagName('head')[0].getAttribute('dat
var oc_requesttoken = document.getElementsByTagName('head')[0].getAttribute('data-requesttoken');
if (typeof oc_webroot === "undefined") {
oc_webroot = location.pathname.substr(0, location.pathname.lastIndexOf('/'));
oc_webroot = location.pathname;
var pos = oc_webroot.indexOf('/index.php/');
if (pos !== -1) {
oc_webroot = oc_webroot.substr(0, pos);
}
else {
oc_webroot = oc_webroot.substr(0, oc_webroot.lastIndexOf('/'));
}
}
if (oc_debug !== true || typeof console === "undefined" || typeof console.log === "undefined") {
if (!window.console) {
@@ -115,7 +122,7 @@ t.cache = {};
*/
function n(app, text_singular, text_plural, count, vars) {
initL10N(app);
var identifier = '_' + text_singular + '__' + text_plural + '_';
var identifier = '_' + text_singular + '_::_' + text_plural + '_';
if( typeof( t.cache[app][identifier] ) !== 'undefined' ){
var translation = t.cache[app][identifier];
if ($.isArray(translation)) {
+6 -5
View File
@@ -6,18 +6,19 @@
<form action="index.php" method="post">
<input type="hidden" name="install" value="true" />
<?php if(count($_['errors']) > 0): ?>
<ul class="errors">
<fieldset class="warning">
<legend><strong><?php p($l->t('Error'));?></strong></legend>
<?php foreach($_['errors'] as $err): ?>
<li>
<p>
<?php if(is_array($err)):?>
<?php print_unescaped($err['error']); ?>
<p class='hint'><?php print_unescaped($err['hint']); ?></p>
<span class='hint'><?php print_unescaped($err['hint']); ?></span>
<?php else: ?>
<?php print_unescaped($err); ?>
<?php endif; ?>
</li>
</p>
<?php endforeach; ?>
</ul>
</fieldset>
<?php endif; ?>
<?php if($_['vulnerableToNullByte']): ?>
<fieldset class="warning">
+4 -2
View File
@@ -50,6 +50,8 @@ try {
session_write_close();
$logger = \OC_Log::$object;
// Don't do anything if ownCloud has not been installed
if (!OC_Config::getValue('installed', false)) {
exit(0);
@@ -98,7 +100,7 @@ try {
$jobList = new \OC\BackgroundJob\JobList();
$jobs = $jobList->getAll();
foreach ($jobs as $job) {
$job->execute($jobList);
$job->execute($jobList, $logger);
}
} else {
// We call cron.php from some website
@@ -109,7 +111,7 @@ try {
// Work and success :-)
$jobList = new \OC\BackgroundJob\JobList();
$job = $jobList->getNext();
$job->execute($jobList);
$job->execute($jobList, $logger);
$jobList->setLastJob($job);
OC_JSON::success();
}
+48 -47
View File
@@ -131,8 +131,8 @@ class OC {
OC::$THIRDPARTYROOT = rtrim(dirname(OC::$SERVERROOT), '/');
} else {
throw new Exception('3rdparty directory not found! Please put the ownCloud 3rdparty'
.' folder in the ownCloud folder or the folder above.'
.' You can also configure the location in the config.php file.');
. ' folder in the ownCloud folder or the folder above.'
. ' You can also configure the location in the config.php file.');
}
// search the apps folder
$config_paths = OC_Config::getValue('apps_paths', array());
@@ -156,7 +156,7 @@ class OC {
if (empty(OC::$APPSROOTS)) {
throw new Exception('apps directory not found! Please put the ownCloud apps folder in the ownCloud folder'
.' or the folder above. You can also configure the location in the config.php file.');
. ' or the folder above. You can also configure the location in the config.php file.');
}
$paths = array();
foreach (OC::$APPSROOTS as $path) {
@@ -176,7 +176,8 @@ class OC {
public static function checkConfig() {
if (file_exists(OC::$SERVERROOT . "/config/config.php")
and !is_writable(OC::$SERVERROOT . "/config/config.php")) {
and !is_writable(OC::$SERVERROOT . "/config/config.php")
) {
$defaults = new OC_Defaults();
if (self::$CLI) {
echo "Can't write into config directory!\n";
@@ -188,7 +189,7 @@ class OC {
OC_Template::printErrorPage(
"Can't write into config directory!",
'This can usually be fixed by '
.'<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.'
. '<a href="' . \OC_Helper::linkToDocs('admin-dir_permissions') . '" target="_blank">giving the webserver write access to the config directory</a>.'
);
}
}
@@ -254,30 +255,42 @@ class OC {
}
}
public static function checkUpgrade($showTemplate = true) {
/**
* check if the instance needs to preform an upgrade
*
* @return bool
*/
public static function needUpgrade() {
if (OC_Config::getValue('installed', false)) {
$installedVersion = OC_Config::getValue('version', '0.0.0');
$currentVersion = implode('.', OC_Util::getVersion());
if (version_compare($currentVersion, $installedVersion, '>')) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
OC_Config::setValue('theme', '');
$minimizerCSS = new OC_Minimizer_CSS();
$minimizerCSS->clearCache();
$minimizerJS = new OC_Minimizer_JS();
$minimizerJS->clearCache();
OC_Util::addScript('update');
$tmpl = new OC_Template('', 'update.admin', 'guest');
$tmpl->assign('version', OC_Util::getVersionString());
$tmpl->printPage();
exit();
} else {
return true;
}
}
return version_compare($currentVersion, $installedVersion, '>');
} else {
return false;
}
}
public static function checkUpgrade($showTemplate = true) {
if (self::needUpgrade()) {
if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
OC_Config::setValue('theme', '');
$minimizerCSS = new OC_Minimizer_CSS();
$minimizerCSS->clearCache();
$minimizerJS = new OC_Minimizer_JS();
$minimizerJS->clearCache();
OC_Util::addScript('config'); // needed for web root
OC_Util::addScript('update');
$tmpl = new OC_Template('', 'update.admin', 'guest');
$tmpl->assign('version', OC_Util::getVersionString());
$tmpl->printPage();
exit();
} else {
return true;
}
}
return false;
}
public static function initTemplateEngine() {
// Add the stuff we need always
OC_Util::addScript("jquery-1.10.0.min");
@@ -461,7 +474,7 @@ class OC {
// OC_Util::getInstanceId() for namespacing. See #5409.
try {
self::$loader->setMemoryCache(\OC\Memcache\Factory::createLowLatency('Autoloader'));
} catch(\Exception $ex) {
} catch (\Exception $ex) {
}
}
OC_Util::isSetLocaleWorking();
@@ -506,7 +519,7 @@ class OC {
if (count($errors) > 0) {
if (self::$CLI) {
foreach ($errors as $error) {
echo $error['error']."\n";
echo $error['error'] . "\n";
echo $error['hint'] . "\n\n";
}
} else {
@@ -528,8 +541,8 @@ class OC {
OC_Group::useBackend(new OC_Group_Database());
if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('user_id')
&& $_SERVER['PHP_AUTH_USER'] != self::$session->get('user_id')) {
$sessionUser = self::$session->get('user_id');
&& $_SERVER['PHP_AUTH_USER'] !== self::$session->get('loginname')) {
$sessionUser = self::$session->get('loginname');
$serverUser = $_SERVER['PHP_AUTH_USER'];
OC_Log::write('core',
"Session user-id ($sessionUser) doesn't match SERVER[PHP_AUTH_USER] ($serverUser).",
@@ -601,13 +614,9 @@ class OC {
* register hooks for the cache
*/
public static function registerCacheHooks() {
if (OC_Config::getValue('installed', false)) { //don't try to do this before we are properly setup
// register cache cleanup jobs
try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception
\OCP\BackgroundJob::registerJob('OC\Cache\FileGlobalGC');
} catch (Exception $e) {
if (OC_Config::getValue('installed', false) && !self::needUpgrade()) { //don't try to do this before we are properly setup
\OCP\BackgroundJob::registerJob('OC\Cache\FileGlobalGC');
}
// NOTE: This will be replaced to use OCP
$userSession = \OC_User::getUserSession();
$userSession->listen('postLogin', '\OC\Cache\File', 'loginListener');
@@ -618,14 +627,9 @@ class OC {
* register hooks for the cache
*/
public static function registerLogRotate() {
if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false)) {
if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false) && !self::needUpgrade()) {
//don't try to do this before we are properly setup
// register cache cleanup jobs
try { //if this is executed before the upgrade to the new backgroundjob system is completed it will throw an exception
\OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT.'/data').'/owncloud.log');
} catch (Exception $e) {
}
\OCP\BackgroundJob::registerJob('OC\Log\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT . '/data') . '/owncloud.log');
}
}
@@ -652,7 +656,7 @@ class OC {
* register hooks for sharing
*/
public static function registerShareHooks() {
if(\OC_Config::getValue('installed')) {
if (\OC_Config::getValue('installed')) {
OC_Hook::connect('OC_User', 'post_deleteUser', 'OCP\Share', 'post_deleteUser');
OC_Hook::connect('OC_User', 'post_addToGroup', 'OCP\Share', 'post_addToGroup');
OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OCP\Share', 'post_removeFromGroup');
@@ -675,7 +679,7 @@ class OC {
}
$request = OC_Request::getPathInfo();
if(substr($request, -3) !== '.js') {// we need these files during the upgrade
if (substr($request, -3) !== '.js') { // we need these files during the upgrade
self::checkMaintenanceMode();
self::checkUpgrade();
}
@@ -793,18 +797,16 @@ class OC {
// auth possible via apache module?
if (OC::tryApacheAuth()) {
$error[] = 'apacheauthfailed';
}
// remember was checked after last login
} // remember was checked after last login
elseif (OC::tryRememberLogin()) {
$error[] = 'invalidcookie';
}
// logon via web form
} // logon via web form
elseif (OC::tryFormLogin()) {
$error[] = 'invalidpassword';
if ( OC_Config::getValue('log_authfailip', false) ) {
OC_Log::write('core', 'Login failed: user \''.$_POST["user"].'\' , wrong password, IP:'.$_SERVER['REMOTE_ADDR'],
OC_Log::WARN);
} else {
} else {
OC_Log::write('core', 'Login failed: user \''.$_POST["user"].'\' , wrong password, IP:set log_authfailip=true in conf',
OC_Log::WARN);
}
@@ -866,7 +868,6 @@ class OC {
OC_User::setMagicInCookie($_COOKIE['oc_username'], $token);
// login
OC_User::setUserId($_COOKIE['oc_username']);
OC_User::setDisplayName($_COOKIE['oc_username'], $_COOKIE['display_name']);
OC_Util::redirectToDefaultPage();
// doesn't return
}
+21 -2
View File
@@ -9,16 +9,35 @@
namespace OC\BackgroundJob;
abstract class Job {
/**
* @var int $id
*/
protected $id;
/**
* @var int $lastRun
*/
protected $lastRun;
/**
* @var mixed $argument
*/
protected $argument;
/**
* @param JobList $jobList
* @param \OC\Log $logger
*/
public function execute($jobList) {
public function execute($jobList, $logger = null) {
$jobList->setLastRun($this);
$this->run($this->argument);
try {
$this->run($this->argument);
} catch (\Exception $e) {
if ($logger) {
$logger->error('Error while running background job: ' . $e->getMessage());
}
$jobList->remove($this, $this->argument);
}
}
abstract protected function run($argument);
+3 -2
View File
@@ -20,9 +20,10 @@ abstract class QueuedJob extends Job {
* run the job, then remove it from the joblist
*
* @param JobList $jobList
* @param \OC\Log $logger
*/
public function execute($jobList) {
public function execute($jobList, $logger = null) {
$jobList->remove($this);
$this->run($this->argument);
parent::execute($jobList, $logger);
}
}
+3 -3
View File
@@ -31,11 +31,11 @@ abstract class TimedJob extends Job {
* run the job if
*
* @param JobList $jobList
* @param \OC\Log $logger
*/
public function execute($jobList) {
public function execute($jobList, $logger = null) {
if ((time() - $this->lastRun) > $this->interval) {
$jobList->setLastRun($this);
$this->run($this->argument);
parent::execute($jobList, $logger);
}
}
}
+3
View File
@@ -101,6 +101,9 @@ class OC_DB {
);
$connectionParams['adapter'] = '\OC\DB\Adapter';
$connectionParams['wrapperClass'] = 'OC\DB\Connection';
// Send "SET NAMES utf8". Only required on PHP 5.3 below 5.3.6.
// See http://stackoverflow.com/questions/4361459/php-pdo-charset-set-names#4361485
$eventManager->addEventSubscriber(new \Doctrine\DBAL\Event\Listeners\MysqlSessionInit);
break;
case 'pgsql':
$connectionParams = array(
+3 -2
View File
@@ -176,8 +176,9 @@ class MDB2SchemaReader {
$options['default'] = $default;
break;
case 'comments':
$comment = (string)$child;
$options['comment'] = $comment;
//FIXME for now we ignore comments https://github.com/doctrine/dbal/pull/407
//$comment = (string)$child;
//$options['comment'] = $comment;
break;
case 'primary':
$primary = $this->asBool($child);
+3
View File
@@ -109,6 +109,9 @@ class OC_Files {
$zip = false;
$filename = $dir . '/' . $files;
$name = $files;
if ($xsendfile && OC_App::isEnabled('files_encryption')) {
$xsendfile = false;
}
}
OC_Util::obEnd();
if ($zip or \OC\Files\Filesystem::isReadable($filename)) {
+4
View File
@@ -178,6 +178,10 @@ class Cache {
if ($file['storage_mtime'] == 0) {
$file['storage_mtime'] = $file['mtime'];
}
if ($file['encrypted']) {
$file['encrypted_size'] = $file['size'];
$file['size'] = $file['unencrypted_size'];
}
}
return $files;
} else {
+1 -1
View File
@@ -286,7 +286,7 @@ class Scanner extends BasicEmitter {
public function backgroundScan() {
$lastPath = null;
while (($path = $this->cache->getIncomplete()) !== false && $path !== $lastPath) {
$this->scan($path);
$this->scan($path, self::SCAN_RECURSIVE, self::REUSE_ETAG);
$this->cache->correctFolderSize($path);
$lastPath = $path;
}
@@ -424,4 +424,12 @@ class Wrapper implements \OC\Files\Storage\Storage {
public function getETag($path) {
return $this->storage->getETag($path);
}
/**
* Returns true
* @return true
*/
public function test() {
return $this->storage->test();
}
}
+6 -2
View File
@@ -159,7 +159,11 @@ class View {
}
public function rmdir($path) {
return $this->basicOperation('rmdir', $path, array('delete'));
if ($this->is_dir($path)) {
return $this->basicOperation('rmdir', $path, array('delete'));
} else {
return false;
}
}
public function opendir($path) {
@@ -712,7 +716,7 @@ class View {
return false;
}
$defaultRoot = Filesystem::getRoot();
if($this->fakeRoot === $defaultRoot){
if ($this->fakeRoot === $defaultRoot) {
return true;
}
return (strlen($this->fakeRoot) > strlen($defaultRoot)) && (substr($this->fakeRoot, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/');
+1 -1
View File
@@ -262,7 +262,7 @@ class OC_L10N implements \OCP\IL10N {
*/
public function n($text_singular, $text_plural, $count, $parameters = array()) {
$this->init();
$identifier = "_${text_singular}__${text_plural}_";
$identifier = "_${text_singular}_::_${text_plural}_";
if( array_key_exists($identifier, $this->translations)) {
return new OC_L10N_String( $this, $identifier, $parameters, $count );
}
+4
View File
@@ -3,6 +3,10 @@
namespace OC\Setup;
abstract class AbstractDatabase {
/**
* @var \OC_L10N
*/
protected $trans;
protected $dbDefinitionFile;
protected $dbuser;
+39 -24
View File
@@ -29,10 +29,10 @@ class OCI extends AbstractDatabase {
\OC_Log::write('setup oracle', 'connect string: ' . $easy_connect_string, \OC_Log::DEBUG);
$connection = @oci_connect($this->dbuser, $this->dbpassword, $easy_connect_string);
if(!$connection) {
$e = oci_error();
if (is_array ($e) && isset ($e['message'])) {
$errorMessage = $this->getLastError();
if ($errorMessage) {
throw new \DatabaseSetupException($this->trans->t('Oracle connection could not be established'),
$e['message'].' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
$errorMessage.' Check environment: ORACLE_HOME='.getenv('ORACLE_HOME')
.' ORACLE_SID='.getenv('ORACLE_SID')
.' LD_LIBRARY_PATH='.getenv('LD_LIBRARY_PATH')
.' NLS_LANG='.getenv('NLS_LANG')
@@ -51,7 +51,7 @@ class OCI extends AbstractDatabase {
." WHERE user_role_privs.granted_role = role_sys_privs.role AND privilege = 'CREATE ROLE'";
$stmt = oci_parse($connection, $query);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_last_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
@@ -68,25 +68,25 @@ class OCI extends AbstractDatabase {
$this->dbpassword=\OC_Util::generateRandomBytes(30);
//oracle passwords are treated as identifiers:
// must start with aphanumeric char
// must start with alphanumeric char
// needs to be shortened to 30 bytes, as the two " needed to escape the identifier count towards the identifier length.
$this->dbpassword=substr($this->dbpassword, 0, 30);
$this->createDBUser($connection);
\OC_Config::setValue('dbuser', $this->dbusername);
\OC_Config::setValue('dbname', $this->dbusername);
\OC_Config::setValue('dbuser', $this->dbuser);
\OC_Config::setValue('dbname', $this->dbuser);
\OC_Config::setValue('dbpassword', $this->dbpassword);
//create the database not neccessary, oracle implies user = schema
//$this->createDatabase($this->dbname, $this->dbusername, $connection);
//create the database not necessary, oracle implies user = schema
//$this->createDatabase($this->dbname, $this->dbuser, $connection);
} else {
\OC_Config::setValue('dbuser', $this->dbuser);
\OC_Config::setValue('dbname', $this->dbname);
\OC_Config::setValue('dbpassword', $this->dbpassword);
//create the database not neccessary, oracle implies user = schema
//create the database not necessary, oracle implies user = schema
//$this->createDatabase($this->dbname, $this->dbuser, $connection);
}
@@ -115,10 +115,10 @@ class OCI extends AbstractDatabase {
}
$query = "SELECT count(*) FROM user_tables WHERE table_name = :un";
$stmt = oci_parse($connection, $query);
$un = $this->dbtableprefix.'users';
$un = $this->tableprefix.'users';
oci_bind_by_name($stmt, ':un', $un);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
@@ -133,25 +133,22 @@ class OCI extends AbstractDatabase {
}
/**
*
* @param String $name
* @param String $password
* @param resource $connection
*/
private function createDBUser($connection) {
$name = $this->dbuser;
$password = $this->password;
$password = $this->dbpassword;
$query = "SELECT * FROM all_users WHERE USERNAME = :un";
$stmt = oci_parse($connection, $query);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
@@ -162,14 +159,14 @@ class OCI extends AbstractDatabase {
$query = 'CREATE USER '.$name.' IDENTIFIED BY "'.$password.'" DEFAULT TABLESPACE '.$this->dbtablespace;
$stmt = oci_parse($connection, $query);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
//oci_bind_by_name($stmt, ':un', $name);
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
@@ -178,7 +175,7 @@ class OCI extends AbstractDatabase {
$query = "ALTER USER :un IDENTIFIED BY :pw";
$stmt = oci_parse($connection, $query);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
@@ -186,7 +183,7 @@ class OCI extends AbstractDatabase {
oci_bind_by_name($stmt, ':pw', $password);
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
@@ -195,16 +192,34 @@ class OCI extends AbstractDatabase {
$query = 'GRANT CREATE SESSION, CREATE TABLE, CREATE SEQUENCE, CREATE TRIGGER, UNLIMITED TABLESPACE TO '.$name;
$stmt = oci_parse($connection, $query);
if (!$stmt) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s"', array($query)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
$result = oci_execute($stmt);
if(!$result) {
$entry = $this->trans->t('DB Error: "%s"', array(oci_error($connection))) . '<br />';
$entry = $this->trans->t('DB Error: "%s"', array($this->getLastError($connection))) . '<br />';
$entry .= $this->trans->t('Offending command was: "%s", name: %s, password: %s',
array($query, $name, $password)) . '<br />';
\OC_Log::write('setup.oci', $entry, \OC_Log::WARN);
}
}
/**
* @param resource $connection
* @return string
*/
protected function getLastError($connection = null) {
if ($connection) {
$error = oci_error($connection);
} else {
$error = oci_error();
}
foreach (array('message', 'code') as $key) {
if (isset($error[$key])) {
return $error[$key];
}
}
return '';
}
}
+34
View File
@@ -112,6 +112,38 @@ class Session implements Emitter, \OCP\IUserSession {
}
}
/**
* set the login name
*
* @param string login name for the logged in user
*/
public function setLoginname($loginname) {
if (is_null($loginname)) {
$this->session->remove('loginname');
} else {
$this->session->set('loginname', $loginname);
}
}
/**
* get the login name of the current user
*
* @return string
*/
public function getLoginname() {
if ($this->activeUser) {
return $this->session->get('loginname');
} else {
$uid = $this->session->get('user_id');
if ($uid) {
$this->activeUser = $this->manager->get($uid);
return $this->session->get('loginname');
} else {
return null;
}
}
}
/**
* try to login with the provided credentials
*
@@ -126,6 +158,7 @@ class Session implements Emitter, \OCP\IUserSession {
if (!is_null($user)) {
if ($user->isEnabled()) {
$this->setUser($user);
$this->setLoginname($uid);
$this->manager->emit('\OC\User', 'postLogin', array($user, $password));
return true;
} else {
@@ -143,6 +176,7 @@ class Session implements Emitter, \OCP\IUserSession {
public function logout() {
$this->manager->emit('\OC\User', 'logout');
$this->setUser(null);
$this->setLoginname(null);
$this->unsetMagicInCookie();
}
+10 -2
View File
@@ -437,9 +437,9 @@ class OC_Util {
);
$webServerRestart = true;
}
if(version_compare(phpversion(), '5.3.8', '<')) {
if(version_compare(phpversion(), '5.3.3', '<')) {
$errors[] = array(
'error'=>'PHP 5.3.8 or higher is required.',
'error'=>'PHP 5.3.3 or higher is required.',
'hint'=>'Please ask your server administrator to update PHP to the latest version.'
.' Your PHP version is no longer supported by ownCloud and the PHP community.'
);
@@ -874,6 +874,14 @@ class OC_Util {
return function_exists('finfo_open');
}
/**
* @brief Check if a PHP version older then 5.3.8 is installed.
* @return bool
*/
public static function isPHPoutdated() {
return version_compare(phpversion(), '5.3.8', '<');
}
/**
* @brief Check if the ownCloud server can connect to the internet
* @return bool
+6 -2
View File
@@ -45,6 +45,7 @@ use \OC\BackgroundJob\JobList;
class BackgroundJob {
/**
* get the execution type of background jobs
*
* @return string
*
* This method returns the type how background jobs are executed. If the user
@@ -56,6 +57,7 @@ class BackgroundJob {
/**
* sets the background jobs execution type
*
* @param string $type execution type
* @return boolean
*
@@ -83,8 +85,10 @@ class BackgroundJob {
* @return true
*/
public static function addRegularTask($klass, $method) {
self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
return true;
if (!\OC::needUpgrade()) {
self::registerJob('OC\BackgroundJob\Legacy\RegularJob', array($klass, $method));
return true;
}
}
/**
+23 -17
View File
@@ -423,11 +423,13 @@ class Share {
* @param string Item source
* @param string Owner
* @param bool Include collections
* @praram bool check expire date
* @return Return array of users
*/
public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false) {
public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false, $checkExpireDate = true) {
$users = array();
$items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections);
$items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections, false, $checkExpireDate);
if ($items) {
foreach ($items as $item) {
if ((int)$item['share_type'] === self::SHARE_TYPE_USER) {
@@ -848,9 +850,8 @@ class Share {
protected static function expireItem(array $item) {
if (!empty($item['expiration'])) {
$now = new \DateTime();
$expirationDate = \Doctrine\DBAL\Types\Type::getType('datetime')
->convertToPhpValue($item['expiration'], \OC_DB::getConnection()->getDatabasePlatform());
if ($now > $expirationDate) {
$expires = new \DateTime($item['expiration']);
if ($now > $expires) {
self::unshareItem($item);
return true;
}
@@ -866,12 +867,14 @@ class Share {
protected static function unshareItem(array $item) {
// Pass all the vars we have for now, they may be useful
$hookParams = array(
'itemType' => $item['item_type'],
'itemSource' => $item['item_source'],
'shareType' => $item['share_type'],
'shareWith' => $item['share_with'],
'itemParent' => $item['parent'],
'itemType' => $item['item_type'],
'itemSource' => $item['item_source'],
'shareType' => $item['share_type'],
'shareWith' => $item['share_with'],
'itemParent' => $item['parent'],
'uidOwner' => $item['uid_owner'],
);
\OC_Hook::emit('OCP\Share', 'pre_unshare', $hookParams + array(
'fileSource' => $item['file_source'],
));
@@ -961,6 +964,7 @@ class Share {
* @param int Number of items to return, -1 to return all matches (optional)
* @param bool Include collection item types (optional)
* @param bool TODO (optional)
* @prams bool check expire date
* @return mixed
*
* See public functions getItem(s)... for parameter usage
@@ -968,7 +972,7 @@ class Share {
*/
private static function getItems($itemType, $item = null, $shareType = null, $shareWith = null,
$uidOwner = null, $format = self::FORMAT_NONE, $parameters = null, $limit = -1,
$includeCollections = false, $itemShareWithBySource = false) {
$includeCollections = false, $itemShareWithBySource = false, $checkExpireDate = true) {
if (!self::isEnabled()) {
if ($limit == 1 || (isset($uidOwner) && isset($item))) {
return false;
@@ -1108,19 +1112,19 @@ class Share {
if ($format == self::FORMAT_STATUSES) {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
.' `share_type`, `file_source`, `path`, `expiration`, `storage`, `mail_send`';
.' `share_type`, `file_source`, `path`, `expiration`, `storage`, `share_with`, `mail_send`, `uid_owner`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `expiration`, `mail_send`';
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `expiration`, `mail_send`, `uid_owner`';
}
} else {
if (isset($uidOwner)) {
if ($itemType == 'file' || $itemType == 'folder') {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `*PREFIX*share`.`parent`,'
.' `share_type`, `share_with`, `file_source`, `path`, `permissions`, `stime`,'
.' `expiration`, `token`, `storage`, `mail_send`';
.' `expiration`, `token`, `storage`, `mail_send`, `uid_owner`';
} else {
$select = '`id`, `item_type`, `item_source`, `parent`, `share_type`, `share_with`, `permissions`,'
.' `stime`, `file_source`, `expiration`, `token`, `mail_send`';
.' `stime`, `file_source`, `expiration`, `token`, `mail_send`, `uid_owner`';
}
} else {
if ($fileDependent) {
@@ -1234,8 +1238,10 @@ class Share {
}
}
}
if (self::expireItem($row)) {
continue;
if($checkExpireDate) {
if (self::expireItem($row)) {
continue;
}
}
// Check if resharing is allowed, if not remove share permission
if (isset($row['permissions']) && !self::isResharingAllowed()) {
+1
View File
@@ -28,6 +28,7 @@ $tmpl->assign('internetconnectionworking', OC_Util::isInternetConnectionEnabled(
$tmpl->assign('isLocaleWorking', OC_Util::isSetLocaleWorking());
$tmpl->assign('isWebDavWorking', OC_Util::isWebDAVWorking());
$tmpl->assign('has_fileinfo', OC_Util::fileInfoLoaded());
$tmpl->assign('old_php', OC_Util::isPHPoutdated());
$tmpl->assign('backgroundjobs_mode', OC_Appconfig::getValue('core', 'backgroundjobs_mode', 'ajax'));
$tmpl->assign('shareAPIEnabled', OC_Appconfig::getValue('core', 'shareapi_enabled', 'yes'));
+14
View File
@@ -72,6 +72,20 @@ if (!$_['has_fileinfo']) {
<?php
}
// is PHP at least at 5.3.8?
if ($_['old_php']) {
?>
<fieldset class="personalblock">
<h2><?php p($l->t('Your PHP version is outdated'));?></h2>
<span class="connectionwarning">
<?php p($l->t('Your PHP version is outdated. We strongly recommend to update to 5.3.8 or newer because older versions are known to be broken. It is possible that this installation is not working correctly.')); ?>
</span>
</fieldset>
<?php
}
// is locale working ?
if (!$_['isLocaleWorking']) {
?>
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
$TRANSLATIONS = array(
"_%n window__%n windows_" => array("%n okno", "%n okna", "%n oken")
"_%n window_::_%n windows_" => array("%n okno", "%n okna", "%n oken")
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
$TRANSLATIONS = array(
"_%n file__%n files_" => array("%n Datei", "%n Dateien")
"_%n file_::_%n files_" => array("%n Datei", "%n Dateien")
);
$PLURAL_FORMS = "nplurals=2; plural=(n != 1);";
+1 -1
View File
@@ -1,5 +1,5 @@
<?php
$TRANSLATIONS = array(
"_%n file__%n files_" => array("%n файл", "%n файла", "%n файлов")
"_%n file_::_%n files_" => array("%n файл", "%n файла", "%n файлов")
);
$PLURAL_FORMS = "nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);";
-3
View File
@@ -8,9 +8,6 @@
namespace Test\BackgroundJob;
class JobRun extends \Exception {
}
/**
* Class DummyJobList
*
+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* Copyright (c) 2013 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\BackgroundJob;
class TestJob extends \OC\BackgroundJob\Job {
private $testCase;
/**
* @var callable $callback
*/
private $callback;
/**
* @param Job $testCase
* @param callable $callback
*/
public function __construct($testCase, $callback) {
$this->testCase = $testCase;
$this->callback = $callback;
}
public function run($argument) {
$this->testCase->markRun();
$callback = $this->callback;
$callback($argument);
}
}
class Job extends \PHPUnit_Framework_TestCase {
private $run = false;
public function setUp() {
$this->run = false;
}
public function testRemoveAfterException() {
$jobList = new DummyJobList();
$job = new TestJob($this, function () {
throw new \Exception();
});
$jobList->add($job);
$this->assertCount(1, $jobList->getAll());
$job->execute($jobList);
$this->assertTrue($this->run);
$this->assertCount(0, $jobList->getAll());
}
public function markRun() {
$this->run = true;
}
}
+21 -9
View File
@@ -9,8 +9,17 @@
namespace Test\BackgroundJob;
class TestQueuedJob extends \OC\BackgroundJob\QueuedJob {
private $testCase;
/**
* @param QueuedJob $testCase
*/
public function __construct($testCase) {
$this->testCase = $testCase;
}
public function run($argument) {
throw new JobRun(); //throw an exception so we can detect if this function is called
$this->testCase->markRun();
}
}
@@ -24,19 +33,22 @@ class QueuedJob extends \PHPUnit_Framework_TestCase {
*/
private $job;
private $jobRun = false;
public function markRun() {
$this->jobRun = true;
}
public function setup() {
$this->jobList = new DummyJobList();
$this->job = new TestQueuedJob();
$this->job = new TestQueuedJob($this);
$this->jobList->add($this->job);
$this->jobRun = false;
}
public function testJobShouldBeRemoved() {
try {
$this->assertTrue($this->jobList->has($this->job, null));
$this->job->execute($this->jobList);
$this->fail("job should have been run");
} catch (JobRun $e) {
$this->assertFalse($this->jobList->has($this->job, null));
}
$this->assertTrue($this->jobList->has($this->job, null));
$this->job->execute($this->jobList);
$this->assertTrue($this->jobRun);
}
}
+25 -26
View File
@@ -9,12 +9,18 @@
namespace Test\BackgroundJob;
class TestTimedJob extends \OC\BackgroundJob\TimedJob {
public function __construct() {
private $testCase;
/**
* @param TimedJob $testCase
*/
public function __construct($testCase) {
$this->setInterval(10);
$this->testCase = $testCase;
}
public function run($argument) {
throw new JobRun(); //throw an exception so we can detect if this function is called
$this->testCase->markRun();
}
}
@@ -28,44 +34,37 @@ class TimedJob extends \PHPUnit_Framework_TestCase {
*/
private $job;
private $jobRun = false;
public function markRun() {
$this->jobRun = true;
}
public function setup() {
$this->jobList = new DummyJobList();
$this->job = new TestTimedJob();
$this->job = new TestTimedJob($this);
$this->jobList->add($this->job);
$this->jobRun = false;
}
public function testShouldRunAfterInterval() {
$this->job->setLastRun(time() - 12);
try {
$this->job->execute($this->jobList);
$this->fail("job should have run");
} catch (JobRun $e) {
}
$this->assertTrue(true);
$this->job->execute($this->jobList);
$this->assertTrue($this->jobRun);
}
public function testShouldNotRunWithinInterval() {
$this->job->setLastRun(time() - 5);
try {
$this->job->execute($this->jobList);
} catch (JobRun $e) {
$this->fail("job should not have run");
}
$this->assertTrue(true);
$this->job->execute($this->jobList);
$this->assertFalse($this->jobRun);
}
public function testShouldNotTwice() {
$this->job->setLastRun(time() - 15);
try {
$this->job->execute($this->jobList);
$this->fail("job should have run the first time");
} catch (JobRun $e) {
try {
$this->job->execute($this->jobList);
} catch (JobRun $e) {
$this->fail("job should not have run the second time");
}
}
$this->assertTrue(true);
$this->job->execute($this->jobList);
$this->assertTrue($this->jobRun);
$this->jobRun = false;
$this->job->execute($this->jobList);
$this->assertFalse($this->jobRun);
}
}
+79
View File
@@ -0,0 +1,79 @@
<?php
/**
* Copyright (c) 2012 Robin Appelman <icewind@owncloud.com>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
namespace Test\Files;
use OC\Files\Filesystem;
use OCP\Share;
class EtagTest extends \PHPUnit_Framework_TestCase {
private $datadir;
private $tmpDir;
private $uid;
/**
* @var \OC_User_Dummy $userBackend
*/
private $userBackend;
public function setUp() {
\OC_Hook::clear('OC_Filesystem', 'setup');
\OCP\Util::connectHook('OC_Filesystem', 'setup', '\OC\Files\Storage\Shared', 'setup');
\OCP\Share::registerBackend('file', 'OC_Share_Backend_File');
\OCP\Share::registerBackend('folder', 'OC_Share_Backend_Folder', 'file');
$this->datadir = \OC_Config::getValue('datadirectory');
$this->tmpDir = \OC_Helper::tmpFolder();
\OC_Config::setValue('datadirectory', $this->tmpDir);
$this->uid = \OC_User::getUser();
\OC_User::setUserId(null);
$this->userBackend = new \OC_User_Dummy();
\OC_User::useBackend($this->userBackend);
\OC_Util::tearDownFS();
}
public function tearDown() {
\OC_Config::setValue('datadirectory', $this->datadir);
\OC_User::setUserId($this->uid);
\OC_Util::setupFS($this->uid);
}
public function testNewUser() {
$user1 = uniqid('user_');
$this->userBackend->createUser($user1, '');
\OC_Util::tearDownFS();
\OC_User::setUserId($user1);
\OC_Util::setupFS($user1);
Filesystem::mkdir('/folder');
Filesystem::mkdir('/folder/subfolder');
Filesystem::file_put_contents('/foo.txt', 'asd');
Filesystem::file_put_contents('/folder/bar.txt', 'fgh');
Filesystem::file_put_contents('/folder/subfolder/qwerty.txt', 'jkl');
$files = array('/foo.txt', '/folder/bar.txt', '/folder/subfolder', '/folder/subfolder/qwerty.txt');
$originalEtags = $this->getEtags($files);
$scanner = new \OC\Files\Utils\Scanner($user1);
$scanner->backgroundScan('/');
$this->assertEquals($originalEtags, $this->getEtags($files));
}
private function getEtags($files) {
$etags = array();
foreach ($files as $file) {
$info = Filesystem::getFileInfo($file);
$etags[$file] = $info['etag'];
}
return $etags;
}
}
+23 -23
View File
@@ -26,7 +26,7 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
/**
* @var array tmpDirs
*/
private $tmpDirs=array();
private $tmpDirs = array();
/**
* @return array
@@ -51,21 +51,21 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
}
public function testMount() {
\OC\Files\Filesystem::mount('\OC\Files\Storage\Local',self::getStorageData(),'/');
$this->assertEquals('/',\OC\Files\Filesystem::getMountPoint('/'));
$this->assertEquals('/',\OC\Files\Filesystem::getMountPoint('/some/folder'));
list( , $internalPath)=\OC\Files\Filesystem::resolvePath('/');
$this->assertEquals('',$internalPath);
list( , $internalPath)=\OC\Files\Filesystem::resolvePath('/some/folder');
$this->assertEquals('some/folder',$internalPath);
\OC\Files\Filesystem::mount('\OC\Files\Storage\Local', self::getStorageData(), '/');
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/'));
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/some/folder'));
list(, $internalPath) = \OC\Files\Filesystem::resolvePath('/');
$this->assertEquals('', $internalPath);
list(, $internalPath) = \OC\Files\Filesystem::resolvePath('/some/folder');
$this->assertEquals('some/folder', $internalPath);
\OC\Files\Filesystem::mount('\OC\Files\Storage\Local',self::getStorageData(),'/some');
$this->assertEquals('/',\OC\Files\Filesystem::getMountPoint('/'));
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some/folder'));
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some/'));
$this->assertEquals('/some/',\OC\Files\Filesystem::getMountPoint('/some'));
list( , $internalPath)=\OC\Files\Filesystem::resolvePath('/some/folder');
$this->assertEquals('folder',$internalPath);
\OC\Files\Filesystem::mount('\OC\Files\Storage\Local', self::getStorageData(), '/some');
$this->assertEquals('/', \OC\Files\Filesystem::getMountPoint('/'));
$this->assertEquals('/some/', \OC\Files\Filesystem::getMountPoint('/some/folder'));
$this->assertEquals('/some/', \OC\Files\Filesystem::getMountPoint('/some/'));
$this->assertEquals('/some/', \OC\Files\Filesystem::getMountPoint('/some'));
list(, $internalPath) = \OC\Files\Filesystem::resolvePath('/some/folder');
$this->assertEquals('folder', $internalPath);
}
public function testNormalize() {
@@ -136,20 +136,20 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
}
public function testHooks() {
if(\OC\Files\Filesystem::getView()){
if (\OC\Files\Filesystem::getView()) {
$user = \OC_User::getUser();
}else{
$user=uniqid();
\OC\Files\Filesystem::init($user, '/'.$user.'/files');
} else {
$user = uniqid();
\OC\Files\Filesystem::init($user, '/' . $user . '/files');
}
\OC_Hook::clear('OC_Filesystem');
\OC_Hook::connect('OC_Filesystem', 'post_write', $this, 'dummyHook');
\OC\Files\Filesystem::mount('OC\Files\Storage\Temporary', array(), '/');
$rootView=new \OC\Files\View('');
$rootView->mkdir('/'.$user);
$rootView->mkdir('/'.$user.'/files');
$rootView = new \OC\Files\View('');
$rootView->mkdir('/' . $user);
$rootView->mkdir('/' . $user . '/files');
// \OC\Files\Filesystem::file_put_contents('/foo', 'foo');
\OC\Files\Filesystem::mkdir('/bar');
@@ -215,7 +215,7 @@ class Filesystem extends \PHPUnit_Framework_TestCase {
$homeMount = \OC\Files\Filesystem::getStorage('/' . $userId . '/');
$this->assertInstanceOf('\OC\Files\Storage\Home', $homeMount);
$this->assertEquals('local::' . $datadir. '/' . $userId . '/', $homeMount->getId());
$this->assertEquals('local::' . $datadir . '/' . $userId . '/', $homeMount->getId());
\OC_User::deleteUser($userId);
// delete storage entry
+7
View File
@@ -42,6 +42,13 @@ abstract class Storage extends \PHPUnit_Framework_TestCase {
$this->assertTrue($this->instance->isUpdatable('/'), 'Root folder is not writable');
}
/**
* Check that the test() function works
*/
public function testTestFunction() {
$this->assertTrue($this->instance->test());
}
/**
* @dataProvider directoryProvider
*/
+31 -1
View File
@@ -15,7 +15,7 @@ class TemporaryNoTouch extends \OC\Files\Storage\Temporary {
class View extends \PHPUnit_Framework_TestCase {
/**
* @var \OC\Files\Storage\Storage[] $storages;
* @var \OC\Files\Storage\Storage[] $storages
*/
private $storages = array();
@@ -473,4 +473,34 @@ class View extends \PHPUnit_Framework_TestCase {
array('', '/'),
);
}
public function testUTF8Names() {
$names = array('虚', '和知しゃ和で', 'regular ascii', 'sɨˈrɪlɪk', 'ѨѬ', 'أنا أحب القراءة كثيرا');
$storage = new \OC\Files\Storage\Temporary(array());
\OC\Files\Filesystem::mount($storage, array(), '/');
$rootView = new \OC\Files\View('');
foreach ($names as $name) {
$rootView->file_put_contents('/' . $name, 'dummy content');
}
$list = $rootView->getDirectoryContent('/');
$this->assertCount(count($names), $list);
foreach ($list as $item) {
$this->assertContains($item['name'], $names);
}
$cache = $storage->getCache();
$scanner = $storage->getScanner();
$scanner->scan('');
$list = $cache->getFolderContents('');
$this->assertCount(count($names), $list);
foreach ($list as $item) {
$this->assertContains($item['name'], $names);
}
}
}
+13 -2
View File
@@ -52,9 +52,20 @@ class Session extends \PHPUnit_Framework_TestCase {
public function testLoginValidPasswordEnabled() {
$session = $this->getMock('\OC\Session\Memory', array(), array(''));
$session->expects($this->once())
$session->expects($this->exactly(2))
->method('set')
->with('user_id', 'foo');
->with($this->callback(function($key) {
switch($key) {
case 'user_id':
case 'loginname':
return true;
break;
default:
return false;
break;
}
},
'foo'));
$manager = $this->getMock('\OC\User\Manager');
+2 -2
View File
@@ -1,10 +1,10 @@
<?php
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel when updating major/minor version number.
$OC_Version=array(6, 00, 0, 10);
$OC_Version=array(6, 00, 0, 14);
// The human readable string
$OC_VersionString='6.0 RC2';
$OC_VersionString='6.0.0a';
// The ownCloud edition
$OC_Edition='';