aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.jshintrc2
-rw-r--r--.scrutinizer.yml23
m---------3rdparty0
-rw-r--r--apps/files/ajax/rawlist.php59
-rw-r--r--apps/files_encryption/lib/proxy.php34
-rw-r--r--apps/files_encryption/lib/session.php8
-rw-r--r--apps/files_encryption/lib/stream.php3
-rw-r--r--apps/files_encryption/lib/util.php8
-rwxr-xr-xapps/files_encryption/tests/util.php4
-rwxr-xr-xapps/files_external/lib/config.php2
-rw-r--r--apps/files_sharing/templates/authenticate.php5
-rw-r--r--apps/files_sharing/tests/api.php68
-rw-r--r--apps/files_sharing/tests/base.php1
-rw-r--r--apps/user_ldap/lib/helper.php2
-rw-r--r--apps/user_ldap/user_proxy.php17
-rwxr-xr-xconfig/config.sample.php3
-rw-r--r--core/css/icons.css5
-rw-r--r--core/css/styles.css16
-rw-r--r--core/img/logo-mail.gifbin2196 -> 1191 bytes
-rw-r--r--core/lostpassword/controller.php2
-rw-r--r--core/templates/installation.php2
-rw-r--r--core/templates/mail.php22
-rw-r--r--lib/base.php6
-rw-r--r--lib/private/app.php2
-rw-r--r--lib/private/config.php2
-rw-r--r--lib/private/db/mdb2schemamanager.php3
-rw-r--r--lib/private/db/mdb2schemareader.php2
-rw-r--r--lib/private/defaults.php14
-rw-r--r--lib/private/files/filesystem.php2
-rw-r--r--lib/private/image.php31
-rw-r--r--lib/private/l10n.php28
-rw-r--r--lib/private/mimetypes.list.php1
-rw-r--r--lib/private/ocs/cloud.php16
-rwxr-xr-xlib/private/preview.php241
-rw-r--r--lib/private/setup.php2
-rw-r--r--lib/private/template/base.php2
-rw-r--r--lib/public/share.php16
-rw-r--r--settings/ajax/decryptall.php2
-rw-r--r--settings/templates/personal.php4
-rw-r--r--tests/data/db_structure.xml15
-rw-r--r--tests/data/db_structure2.xml15
-rw-r--r--tests/lib/appframework/http/ResponseTest.php2
-rw-r--r--tests/lib/files/cache/scanner.php26
-rw-r--r--tests/lib/files/cache/updater.php85
-rw-r--r--tests/lib/files/etagtest.php6
-rw-r--r--tests/lib/files/view.php2
46 files changed, 545 insertions, 266 deletions
diff --git a/.jshintrc b/.jshintrc
index f40dd22b5fd..90cec5c5961 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -1,5 +1,5 @@
{
- "camelCase": true,
+ "camelcase": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
diff --git a/.scrutinizer.yml b/.scrutinizer.yml
new file mode 100644
index 00000000000..4473cf9056d
--- /dev/null
+++ b/.scrutinizer.yml
@@ -0,0 +1,23 @@
+filter:
+ excluded_paths:
+ - '3rdparty/*'
+ - 'apps/*/3rdparty/*'
+ - 'l10n/*'
+ - 'core/l10n/*'
+ - 'apps/*/l10n/*'
+ - 'lib/l10n/*'
+ - 'core/js/tests/lib/*.js'
+ - 'core/js/jquery-1.10.0.min.js'
+ - 'core/js/jquery-migrate-1.2.1.min.js'
+ - 'core/js/jquery-showpassword.js'
+ - 'core/js/jquery-tipsy.js'
+ - 'core/js/jquery.infieldlabel.js'
+ - 'core/js/jquery-ui-1.10.0.custom.js'
+ - 'core/js/jquery.inview.js'
+ - 'core/js/jquery.placeholder.js'
+
+
+imports:
+ - javascript
+ - php
+
diff --git a/3rdparty b/3rdparty
-Subproject 177d3ff656bcf1153b4def12403c5f2d4fc53e7
+Subproject 184f0a59f87c590ee7e89ced401205a87f21395
diff --git a/apps/files/ajax/rawlist.php b/apps/files/ajax/rawlist.php
index 40da32b223a..89c21a172fc 100644
--- a/apps/files/ajax/rawlist.php
+++ b/apps/files/ajax/rawlist.php
@@ -1,12 +1,12 @@
<?php
// only need filesystem apps
-$RUNTIME_APPTYPES=array('filesystem');
+$RUNTIME_APPTYPES = array('filesystem');
OCP\JSON::checkLoggedIn();
// Load the files
-$dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
+$dir = isset($_GET['dir']) ? $_GET['dir'] : '';
$mimetypes = isset($_GET['mimetypes']) ? json_decode($_GET['mimetypes'], true) : '';
// Clean up duplicates from array and deal with non-array requests
@@ -18,43 +18,40 @@ if (is_array($mimetypes)) {
// make filelist
$files = array();
+/**
+ * @var \OCP\Files\FileInfo[] $files
+ */
// If a type other than directory is requested first load them.
-if($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
- foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, 'httpd/unix-directory' ) as $file ) {
- $file['directory'] = $dir;
- $file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
- $file["date"] = OCP\Util::formatDate($file["mtime"]);
- $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
- $files[] = $file;
- }
+if ($mimetypes && !in_array('httpd/unix-directory', $mimetypes)) {
+ $files = array_merge($files, \OC\Files\Filesystem::getDirectoryContent($dir, 'httpd/unix-directory'));
}
if (is_array($mimetypes) && count($mimetypes)) {
foreach ($mimetypes as $mimetype) {
- foreach( \OC\Files\Filesystem::getDirectoryContent( $dir, $mimetype ) as $file ) {
- $file['directory'] = $dir;
- $file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
- $file["date"] = OCP\Util::formatDate($file["mtime"]);
- $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
- $files[] = $file;
- }
+ $files = array_merge($files, \OC\Files\Filesystem::getDirectoryContent($dir, $mimetype));
}
} else {
- foreach( \OC\Files\Filesystem::getDirectoryContent( $dir ) as $file ) {
- $file['directory'] = $dir;
- $file['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file['mimetype']);
- $file["date"] = OCP\Util::formatDate($file["mtime"]);
- $file['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
- $files[] = $file;
- }
+ $files = array_merge($files, \OC\Files\Filesystem::getDirectoryContent($dir));
+}
+
+$result = array();
+foreach ($files as $file) {
+ $fileData = array();
+ $fileData['directory'] = $dir;
+ $fileData['name'] = $file->getName();
+ $fileData['type'] = $file->getType();
+ $fileData['path'] = $file['path'];
+ $fileData['id'] = $file->getId();
+ $fileData['size'] = $file->getSize();
+ $fileData['mtime'] = $file->getMtime();
+ $fileData['mimetype'] = $file->getMimetype();
+ $fileData['isPreviewAvailable'] = \OC::$server->getPreviewManager()->isMimeSupported($file->getMimetype());
+ $fileData["date"] = OCP\Util::formatDate($file->getMtime());
+ $fileData['mimetype_icon'] = \OCA\Files\Helper::determineIcon($file);
+ $result[] = $fileData;
}
// Sort by name
-usort($files, function ($a, $b) {
- if ($a['name'] === $b['name']) {
- return 0;
- }
- return ($a['name'] < $b['name']) ? -1 : 1;
-});
+usort($result, array('\OCA\Files\Helper', 'fileCmp'));
-OC_JSON::success(array('data' => $files));
+OC_JSON::success(array('data' => $result));
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index 9d456f6c517..a2d42c22c13 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -38,6 +38,7 @@ class Proxy extends \OC_FileProxy {
private static $blackList = null; //mimetypes blacklisted from encryption
private static $unencryptedSizes = array(); // remember unencrypted size
+ private static $fopenMode = array(); // remember the fopen mode
/**
* Check if a file requires encryption
@@ -146,7 +147,7 @@ class Proxy extends \OC_FileProxy {
if ( isset(self::$unencryptedSizes[$normalizedPath]) ) {
$view = new \OC_FilesystemView('/');
$view->putFileInfo($normalizedPath,
- array('encrypted' => true, 'encrypted_size' => self::$unencryptedSizes[$normalizedPath]));
+ array('encrypted' => true, 'unencrypted_size' => self::$unencryptedSizes[$normalizedPath]));
unset(self::$unencryptedSizes[$normalizedPath]);
}
@@ -214,6 +215,16 @@ class Proxy extends \OC_FileProxy {
}
/**
+ * @brief remember initial fopen mode because sometimes it gets changed during the request
+ * @param string $path path
+ * @param string $mode type of access
+ */
+ public function preFopen($path, $mode) {
+ self::$fopenMode[$path] = $mode;
+ }
+
+
+ /**
* @param $path
* @param $result
* @return resource
@@ -240,7 +251,15 @@ class Proxy extends \OC_FileProxy {
$proxyStatus = \OC_FileProxy::$enabled;
\OC_FileProxy::$enabled = false;
- $meta = stream_get_meta_data($result);
+ // if we remember the mode from the pre proxy we re-use it
+ // oterwise we fall back to stream_get_meta_data()
+ if (isset(self::$fopenMode[$path])) {
+ $mode = self::$fopenMode[$path];
+ unset(self::$fopenMode[$path]);
+ } else {
+ $meta = stream_get_meta_data($result);
+ $mode = $meta['mode'];
+ }
$view = new \OC_FilesystemView('');
@@ -258,14 +277,15 @@ class Proxy extends \OC_FileProxy {
// Open the file using the crypto stream wrapper
// protocol and let it do the decryption work instead
- $result = fopen('crypt://' . $path, $meta['mode']);
+ $result = fopen('crypt://' . $path, $mode);
} elseif (
- self::shouldEncrypt($path)
- and $meta['mode'] !== 'r'
- and $meta['mode'] !== 'rb'
+ self::shouldEncrypt($path)
+ and $mode !== 'r'
+ and $mode !== 'rb'
+
) {
- $result = fopen('crypt://' . $path, $meta['mode']);
+ $result = fopen('crypt://' . $path, $mode);
}
// Re-enable the proxy
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php
index aa58e33e9d2..3daaa06425f 100644
--- a/apps/files_encryption/lib/session.php
+++ b/apps/files_encryption/lib/session.php
@@ -134,6 +134,14 @@ class Session {
}
+ /**
+ * @brief remove encryption keys and init status from session
+ */
+ public function closeSession() {
+ \OC::$session->remove('encryptionInitialized');
+ \OC::$session->remove('privateKey');
+ }
+
/**
* @brief Gets status if we already tried to initialize the encryption app
diff --git a/apps/files_encryption/lib/stream.php b/apps/files_encryption/lib/stream.php
index 88eacc6f136..58ac03373a7 100644
--- a/apps/files_encryption/lib/stream.php
+++ b/apps/files_encryption/lib/stream.php
@@ -167,6 +167,9 @@ class Stream {
} else {
$this->meta = stream_get_meta_data($this->handle);
+ // sometimes fopen changes the mode, e.g. for a url "r" convert to "r+"
+ // but we need to remember the original access type
+ $this->meta['mode'] = $mode;
}
diff --git a/apps/files_encryption/lib/util.php b/apps/files_encryption/lib/util.php
index ec06bd52f5e..6bf69cd8ee1 100644
--- a/apps/files_encryption/lib/util.php
+++ b/apps/files_encryption/lib/util.php
@@ -1772,4 +1772,12 @@ class Util {
return $session;
}
+ /*
+ * @brief remove encryption related keys from the session
+ */
+ public function closeEncryptionSession() {
+ $session = new \OCA\Encryption\Session($this->view);
+ $session->closeSession();
+ }
+
}
diff --git a/apps/files_encryption/tests/util.php b/apps/files_encryption/tests/util.php
index f70e30c4d73..203ba55dbfd 100755
--- a/apps/files_encryption/tests/util.php
+++ b/apps/files_encryption/tests/util.php
@@ -344,7 +344,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
// check if mtime and etags unchanged
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
- $this->assertEquals($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
+ $this->assertSame($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
$this->view->unlink($this->userId . '/files/' . $filename);
}
@@ -373,7 +373,7 @@ class Test_Encryption_Util extends \PHPUnit_Framework_TestCase {
// check if mtime and etags unchanged
$this->assertEquals($fileInfoEncrypted['mtime'], $fileInfoUnencrypted['mtime']);
- $this->assertEquals($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
+ $this->assertSame($fileInfoEncrypted['etag'], $fileInfoUnencrypted['etag']);
// file should no longer be encrypted
$this->assertEquals(0, $fileInfoUnencrypted['encrypted']);
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 43275d36c06..8456b81d255 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -45,7 +45,7 @@ class OC_Mount_Config {
'datadir' => 'Location'));
$backends['\OC\Files\Storage\AmazonS3']=array(
- 'backend' => 'Amazon S3',
+ 'backend' => 'Amazon S3 and compliant',
'configuration' => array(
'key' => 'Access Key',
'secret' => '*Secret Key',
diff --git a/apps/files_sharing/templates/authenticate.php b/apps/files_sharing/templates/authenticate.php
index 928be93fc96..19b1fb27630 100644
--- a/apps/files_sharing/templates/authenticate.php
+++ b/apps/files_sharing/templates/authenticate.php
@@ -8,7 +8,10 @@
<?php endif; ?>
<p class="infield">
<label for="password" class="infield"><?php p($l->t('Password')); ?></label>
- <input type="password" name="password" id="password" placeholder="" value="" autofocus />
+ <input type="password" name="password" id="password"
+ placeholder="" value=""
+ autocomplete="off" autocapitalize="off" autocorrect="off"
+ autofocus />
<input type="submit" value="" class="svg icon icon-confirm" />
</p>
</fieldset>
diff --git a/apps/files_sharing/tests/api.php b/apps/files_sharing/tests/api.php
index 1278e0c4d1f..0d3d9b98b2e 100644
--- a/apps/files_sharing/tests/api.php
+++ b/apps/files_sharing/tests/api.php
@@ -33,13 +33,16 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
parent::setUp();
$this->folder = '/folder_share_api_test';
+ $this->subfolder = '/subfolder_share_api_test';
$this->filename = 'share-api-test.txt';
// save file with content
$this->view->file_put_contents($this->filename, $this->data);
$this->view->mkdir($this->folder);
+ $this->view->mkdir($this->folder . '/' . $this->subfolder);
$this->view->file_put_contents($this->folder.'/'.$this->filename, $this->data);
+ $this->view->file_put_contents($this->folder.'/' . $this->subfolder . '/' .$this->filename, $this->data);
}
function tearDown() {
@@ -287,6 +290,71 @@ class Test_Files_Sharing_Api extends Test_Files_Sharing_Base {
}
/**
+ * @brief share a folder, than reshare a file within the shared folder and check if we construct the correct path
+ * @medium
+ */
+ function testGetShareFromFolderReshares() {
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ $fileInfo1 = $this->view->getFileInfo($this->folder);
+ $fileInfo2 = $this->view->getFileInfo($this->folder.'/'.$this->filename);
+ $fileInfo3 = $this->view->getFileInfo($this->folder.'/' . $this->subfolder . '/' .$this->filename);
+
+ // share root folder to user2
+ $result = \OCP\Share::shareItem('folder', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2, 31);
+
+ // share was successful?
+ $this->assertTrue($result);
+
+ // login as user2
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+
+ // share file in root folder
+ $result = \OCP\Share::shareItem('file', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK, null, 1);
+ // share was successful?
+ $this->assertTrue(is_string($result));
+
+ // share file in subfolder
+ $result = \OCP\Share::shareItem('file', $fileInfo3['fileid'], \OCP\Share::SHARE_TYPE_LINK, null, 1);
+ // share was successful?
+ $this->assertTrue(is_string($result));
+
+ $testValues=array(
+ array('query' => 'Shared/' . $this->folder,
+ 'expectedResult' => '/Shared' . $this->folder . '/' . $this->filename),
+ array('query' => 'Shared/' . $this->folder . $this->subfolder,
+ 'expectedResult' => '/Shared' . $this->folder . $this->subfolder . '/' . $this->filename),
+ );
+ foreach ($testValues as $value) {
+
+ $_GET['path'] = $value['query'];
+ $_GET['subfiles'] = 'true';
+
+ $result = Share\Api::getAllShares(array());
+
+ $this->assertTrue($result->succeeded());
+
+ // test should return one share within $this->folder
+ $data = $result->getData();
+
+ $this->assertEquals($value['expectedResult'], $data[0]['path']);
+ }
+
+ // cleanup
+
+ \OCP\Share::unshare('file', $fileInfo2['fileid'], \OCP\Share::SHARE_TYPE_LINK, null);
+ \OCP\Share::unshare('file', $fileInfo3['fileid'], \OCP\Share::SHARE_TYPE_LINK, null);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+
+ \OCP\Share::unshare('folder', $fileInfo1['fileid'], \OCP\Share::SHARE_TYPE_USER,
+ \Test_Files_Sharing_Api::TEST_FILES_SHARING_API_USER2);
+
+ }
+
+ /**
* @medium
*/
function testGetShareFromUnknownId() {
diff --git a/apps/files_sharing/tests/base.php b/apps/files_sharing/tests/base.php
index 3e283271f5d..d44972d01f1 100644
--- a/apps/files_sharing/tests/base.php
+++ b/apps/files_sharing/tests/base.php
@@ -43,6 +43,7 @@ abstract class Test_Files_Sharing_Base extends \PHPUnit_Framework_TestCase {
*/
public $view;
public $folder;
+ public $subfolder;
public static function setUpBeforeClass() {
// reset backend
diff --git a/apps/user_ldap/lib/helper.php b/apps/user_ldap/lib/helper.php
index 7de7fe8667f..b5955cb2abb 100644
--- a/apps/user_ldap/lib/helper.php
+++ b/apps/user_ldap/lib/helper.php
@@ -120,7 +120,7 @@ class Helper {
$saveOtherConfigurations = '';
if(empty($prefix)) {
- $saveOtherConfigurations = 'AND `Configkey` NOT LIKE \'s%\'';
+ $saveOtherConfigurations = 'AND `configkey` NOT LIKE \'s%\'';
}
$query = \OCP\DB::prepare('
diff --git a/apps/user_ldap/user_proxy.php b/apps/user_ldap/user_proxy.php
index 5ad127197f3..2cb3dfb2c60 100644
--- a/apps/user_ldap/user_proxy.php
+++ b/apps/user_ldap/user_proxy.php
@@ -54,11 +54,15 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
protected function walkBackends($uid, $method, $parameters) {
$cacheKey = $this->getUserCacheKey($uid);
foreach($this->backends as $configPrefix => $backend) {
-// print("walkBackend '$configPrefix'<br/>");
- if($result = call_user_func_array(array($backend, $method), $parameters)) {
+ $instance = $backend;
+ if(!method_exists($instance, $method)
+ && method_exists($this->getAccess($configPrefix), $method)) {
+ $instance = $this->getAccess($configPrefix);
+ }
+ if($result = call_user_func_array(array($instance, $method), $parameters)) {
$this->writeToCache($cacheKey, $configPrefix);
return $result;
- }
+ }
}
return false;
}
@@ -77,7 +81,12 @@ class User_Proxy extends lib\Proxy implements \OCP\UserInterface {
//in case the uid has been found in the past, try this stored connection first
if(!is_null($prefix)) {
if(isset($this->backends[$prefix])) {
- $result = call_user_func_array(array($this->backends[$prefix], $method), $parameters);
+ $instance = $this->backends[$prefix];
+ if(!method_exists($instance, $method)
+ && method_exists($this->getAccess($prefix), $method)) {
+ $instance = $this->getAccess($prefix);
+ }
+ $result = call_user_func_array(array($instance, $method), $parameters);
if($result === $passOnWhen) {
//not found here, reset cache to null if user vanished
//because sometimes methods return false with a reason
diff --git a/config/config.sample.php b/config/config.sample.php
index 9c5eca8a5ec..987a866e49b 100755
--- a/config/config.sample.php
+++ b/config/config.sample.php
@@ -178,6 +178,9 @@ $CONFIG = array(
/* Enable or disable the logging of IP addresses in case of webform auth failures */
"log_authfailip" => false,
+/* Whether http-basic username must equal username to login */
+"basic_auth" => true,
+
/*
* Configure the size in bytes log rotation should happen, 0 or false disables the rotation.
* This rotates the current owncloud logfile to a new name, this way the total log usage
diff --git a/core/css/icons.css b/core/css/icons.css
index 814749c5af8..027a3f8557f 100644
--- a/core/css/icons.css
+++ b/core/css/icons.css
@@ -1,4 +1,4 @@
-.icon {
+[class^="icon-"], [class*=" icon-"] {
background-repeat: no-repeat;
background-position: center;
}
@@ -66,7 +66,8 @@
.icon-delete {
background-image: url('../img/actions/delete.svg');
}
-.icon-delete-hover {
+.icon-delete:hover,
+.icon-delete:focus {
background-image: url('../img/actions/delete-hover.svg');
}
diff --git a/core/css/styles.css b/core/css/styles.css
index 341a507ce37..bf9ca835dca 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -204,18 +204,18 @@ textarea:disabled {
/* Primary action button, use sparingly */
.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary {
border: 1px solid #1d2d44;
- background: #35537a;
+ background-color: #35537a;
color: #ddd;
}
.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,
.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {
border: 1px solid #1d2d44;
- background: #304d76;
+ background-color: #304d76;
color: #fff;
}
.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active {
border: 1px solid #1d2d44;
- background: #1d2d44;
+ background-color: #1d2d44;
color: #bbb;
}
@@ -233,7 +233,7 @@ textarea:disabled {
}
input[type="submit"].enabled {
- background: #66f866;
+ background-color: #66f866;
border: 1px solid #5e5;
}
@@ -405,11 +405,9 @@ input[name="adminpass-clone"] { padding-left:1.8em; width:11.7em !important; }
/* General new input field look */
#body-login input[type="text"],
#body-login input[type="password"],
-#body-login input[type="email"] {
- border: 1px solid #323233;
- border-radius: 5px;
-}
-#body-login input[type='submit'] {
+#body-login input[type="email"],
+#body-login input[type="submit"] {
+ border: none;
border-radius: 5px;
}
diff --git a/core/img/logo-mail.gif b/core/img/logo-mail.gif
index 6a1caaa9188..f1dd108450e 100644
--- a/core/img/logo-mail.gif
+++ b/core/img/logo-mail.gif
Binary files differ
diff --git a/core/lostpassword/controller.php b/core/lostpassword/controller.php
index fd20c6ba249..c858696885b 100644
--- a/core/lostpassword/controller.php
+++ b/core/lostpassword/controller.php
@@ -69,7 +69,7 @@ class Controller {
$defaults = new \OC_Defaults();
\OC_Mail::send($email, $_POST['user'], $l->t('%s password reset', array($defaults->getName())), $msg, $from, $defaults->getName());
} catch (Exception $e) {
- \OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
+ \OC_Template::printErrorPage( $l->t('A problem has occurred whilst sending the email, please contact your administrator.') );
}
self::displayLostPasswordPage(false, true);
} else {
diff --git a/core/templates/installation.php b/core/templates/installation.php
index a85b68f248d..e2d296a713f 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -67,7 +67,7 @@
<?php if(!$_['directoryIsSet'] OR !$_['dbIsSet'] OR count($_['errors']) > 0): ?>
<fieldset id="advancedHeader">
- <legend><a id="showAdvanced"><?php p($l->t( 'Advanced' )); ?> <img class="svg" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
+ <legend><a id="showAdvanced"><?php p($l->t( 'Storage & database' )); ?> <img class="svg" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend>
</fieldset>
<?php endif; ?>
diff --git a/core/templates/mail.php b/core/templates/mail.php
index b8b0a2bfe96..ae46eaca788 100644
--- a/core/templates/mail.php
+++ b/core/templates/mail.php
@@ -2,15 +2,15 @@
<tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr>
-<td bgcolor="#1d2d44" width="20px">&nbsp;</td>
-<td bgcolor="#1d2d44">
-<img src="<?php print_unescaped(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
+<td bgcolor="<?php p($theme->getMailHeaderColor());?>" width="20px">&nbsp;</td>
+<td bgcolor="<?php p($theme->getMailHeaderColor());?>">
+<img src="<?php p(OC_Helper::makeURLAbsolute(image_path('', 'logo-mail.gif'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td>
</tr>
-<tr><td bgcolor="#f8f8f8" colspan="2">&nbsp;</td></tr>
+<tr><td colspan="2">&nbsp;</td></tr>
<tr>
-<td bgcolor="#f8f8f8" width="20px">&nbsp;</td>
-<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
+<td width="20px">&nbsp;</td>
+<td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">
<?php
print_unescaped($l->t('Hey there,<br><br>just letting you know that %s shared <strong>%s</strong> with you.<br><a href="%s">View it!</a><br><br>', array($_['user_displayname'], $_['filename'], $_['link'])));
if ( isset($_['expiration']) ) {
@@ -21,17 +21,17 @@ p($l->t('Cheers!'));
?>
</td>
</tr>
-<tr><td bgcolor="#f8f8f8" colspan="2">&nbsp;</td></tr>
+<tr><td colspan="2">&nbsp;</td></tr>
<tr>
-<td bgcolor="#f8f8f8" width="20px">&nbsp;</td>
-<td bgcolor="#f8f8f8" style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
+<td width="20px">&nbsp;</td>
+<td style="font-weight:normal; font-size:0.8em; line-height:1.2em; font-family:verdana,'arial',sans;">--<br>
<?php p($theme->getName()); ?> -
<?php p($theme->getSlogan()); ?>
-<br><a href="<?php print_unescaped($theme->getBaseUrl()); ?>"><?php print_unescaped($theme->getBaseUrl());?></a>
+<br><a href="<?php p($theme->getBaseUrl()); ?>"><?php p($theme->getBaseUrl());?></a>
</td>
</tr>
<tr>
-<td bgcolor="#f8f8f8" colspan="2">&nbsp;</td>
+<td colspan="2">&nbsp;</td>
</tr>
</table>
</td></tr>
diff --git a/lib/base.php b/lib/base.php
index 525d290931f..351b91b7dfa 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -554,7 +554,8 @@ class OC {
OC_User::useBackend(new OC_User_Database());
OC_Group::useBackend(new OC_Group_Database());
- if (isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('loginname')
+ $basic_auth = OC_Config::getValue('basic_auth', true);
+ if ($basic_auth && isset($_SERVER['PHP_AUTH_USER']) && self::$session->exists('loginname')
&& $_SERVER['PHP_AUTH_USER'] !== self::$session->get('loginname')) {
$sessionUser = self::$session->get('loginname');
$serverUser = $_SERVER['PHP_AUTH_USER'];
@@ -752,7 +753,8 @@ class OC {
OC_Preferences::deleteKey(OC_User::getUser(), 'login_token', $_COOKIE['oc_token']);
}
OC_User::logout();
- header("Location: " . OC::$WEBROOT . '/');
+ // redirect to webroot and add slash if webroot is empty
+ header("Location: " . OC::$WEBROOT.(empty(OC::$WEBROOT) ? '/' : ''));
} else {
if (is_null($file)) {
$param['file'] = 'index.php';
diff --git a/lib/private/app.php b/lib/private/app.php
index 048d4d4aeb1..58bf67c1d47 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -219,6 +219,8 @@ class OC_App{
$appdata=OC_OCSClient::getApplication($app);
$download=OC_OCSClient::getApplicationDownload($app, 1);
if(isset($download['downloadlink']) and $download['downloadlink']!='') {
+ // Replace spaces in download link without encoding entire URL
+ $download['downloadlink'] = str_replace(' ', '%20', $download['downloadlink']);
$info = array('source'=>'http', 'href'=>$download['downloadlink'], 'appdata'=>$appdata);
$app=OC_Installer::installApp($info);
}
diff --git a/lib/private/config.php b/lib/private/config.php
index 3649da84973..56f47256134 100644
--- a/lib/private/config.php
+++ b/lib/private/config.php
@@ -77,7 +77,7 @@ class Config {
/**
* @brief Gets a value from config.php
* @param string $key key
- * @param string|null $default = null default value
+ * @param array|bool|string|null $default = null default value
* @return string the value or $default
*
* This function gets the value from config.php. If it does not exist,
diff --git a/lib/private/db/mdb2schemamanager.php b/lib/private/db/mdb2schemamanager.php
index c050d47b499..aaf2ea543b9 100644
--- a/lib/private/db/mdb2schemamanager.php
+++ b/lib/private/db/mdb2schemamanager.php
@@ -82,6 +82,9 @@ class MDB2SchemaManager {
$platform = $this->conn->getDatabasePlatform();
foreach($schemaDiff->changedTables as $tableDiff) {
$tableDiff->name = $platform->quoteIdentifier($tableDiff->name);
+ foreach($tableDiff->changedColumns as $column) {
+ $column->oldColumnName = $platform->quoteIdentifier($column->oldColumnName);
+ }
}
if ($generateSql) {
diff --git a/lib/private/db/mdb2schemareader.php b/lib/private/db/mdb2schemareader.php
index f9a76786c3e..1c16d03eab2 100644
--- a/lib/private/db/mdb2schemareader.php
+++ b/lib/private/db/mdb2schemareader.php
@@ -41,7 +41,9 @@ class MDB2SchemaReader {
*/
public function loadSchemaFromFile($file) {
$schema = new \Doctrine\DBAL\Schema\Schema();
+ $loadEntities = libxml_disable_entity_loader(false);
$xml = simplexml_load_file($file);
+ libxml_disable_entity_loader($loadEntities);
foreach ($xml->children() as $child) {
/**
* @var \SimpleXMLElement $child
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index 59630cda5c0..79be211b82f 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -21,6 +21,7 @@ class OC_Defaults {
private $defaultDocBaseUrl;
private $defaultSlogan;
private $defaultLogoClaim;
+ private $defaultMailHeaderColor;
function __construct() {
$this->l = OC_L10N::get('core');
@@ -33,6 +34,7 @@ class OC_Defaults {
$this->defaultDocBaseUrl = "http://doc.owncloud.org";
$this->defaultSlogan = $this->l->t("web services under your control");
$this->defaultLogoClaim = "";
+ $this->defaultMailHeaderColor = "#1d2d44"; /* header color of mail notifications */
if (class_exists("OC_Theme")) {
$this->theme = new OC_Theme();
@@ -181,4 +183,16 @@ class OC_Defaults {
return $this->getDocBaseUrl() . '/server/6.0/go.php?to=' . $key;
}
+ /**
+ * Returns mail header color
+ * @return mail header color
+ */
+ public function getMailHeaderColor() {
+ if ($this->themeExist('getMailHeaderColor')) {
+ return $this->theme->getMailHeaderColor();
+ } else {
+ return $this->defaultMailHeaderColor;
+ }
+ }
+
}
diff --git a/lib/private/files/filesystem.php b/lib/private/files/filesystem.php
index 7f7b6f7f468..6478854eae8 100644
--- a/lib/private/files/filesystem.php
+++ b/lib/private/files/filesystem.php
@@ -761,7 +761,7 @@ class Filesystem {
*
* @param string $directory path under datadirectory
* @param string $mimetype_filter limit returned content to this mimetype or mimepart
- * @return array
+ * @return \OC\Files\FileInfo[]
*/
public static function getDirectoryContent($directory, $mimetype_filter = '') {
return self::$defaultInstance->getDirectoryContent($directory, $mimetype_filter);
diff --git a/lib/private/image.php b/lib/private/image.php
index 17caaa012f5..da32aa4760f 100644
--- a/lib/private/image.php
+++ b/lib/private/image.php
@@ -41,8 +41,7 @@ class OC_Image {
// exif_imagetype throws "read error!" if file is less than 12 byte
if (filesize($filePath) > 11) {
$imageType = exif_imagetype($filePath);
- }
- else {
+ } else {
$imageType = false;
}
return $imageType ? image_type_to_mime_type($imageType) : '';
@@ -50,7 +49,7 @@ class OC_Image {
/**
* @brief Constructor.
- * @param $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
+ * @param string|resource $imageref The path to a local file, a base64 encoded string or a resource created by an imagecreate* function.
* @returns bool False on error
*/
public function __construct($imageRef = null) {
@@ -115,13 +114,11 @@ class OC_Image {
case 3:
case 4: // Not tested
return $this->width();
- break;
case 5: // Not tested
case 6:
case 7: // Not tested
case 8:
return $this->height();
- break;
}
return $this->width();
}
@@ -140,13 +137,11 @@ class OC_Image {
case 3:
case 4: // Not tested
return $this->height();
- break;
case 5: // Not tested
case 6:
case 7: // Not tested
case 8:
return $this->width();
- break;
}
return $this->height();
}
@@ -197,7 +192,6 @@ class OC_Image {
return false;
}
- $retVal = false;
switch($this->imageType) {
case IMAGETYPE_GIF:
$retVal = imagegif($this->resource, $filePath);
@@ -264,8 +258,8 @@ class OC_Image {
}
/**
- * @returns Returns a base64 encoded string suitable for embedding in a VCard.
- */
+ * @return string - base64 encoded, which is suitable for embedding in a VCard.
+ */
function __toString() {
return base64_encode($this->data());
}
@@ -307,43 +301,33 @@ class OC_Image {
$o = $this->getOrientation();
OC_Log::write('core', 'OC_Image->fixOrientation() Orientation: '.$o, OC_Log::DEBUG);
$rotate = 0;
- $flip = false;
switch($o) {
case -1:
return false; //Nothing to fix
- break;
case 1:
$rotate = 0;
- $flip = false;
break;
case 2: // Not tested
$rotate = 0;
- $flip = true;
break;
case 3:
$rotate = 180;
- $flip = false;
break;
case 4: // Not tested
$rotate = 180;
- $flip = true;
break;
case 5: // Not tested
$rotate = 90;
- $flip = true;
break;
case 6:
//$rotate = 90;
$rotate = 270;
- $flip = false;
break;
case 7: // Not tested
$rotate = 270;
- $flip = true;
break;
case 8:
$rotate = 90;
- $flip = false;
break;
}
if($rotate) {
@@ -367,6 +351,7 @@ class OC_Image {
return false;
}
}
+ return false;
}
/**
@@ -599,9 +584,9 @@ class OC_Image {
$meta['imagesize'] = $meta['filesize'] - $meta['offset'];
// in rare cases filesize is equal to offset so we need to read physical size
if ($meta['imagesize'] < 1) {
- $meta['imagesize'] = @filesize($filename) - $meta['offset'];
+ $meta['imagesize'] = @filesize($fileName) - $meta['offset'];
if ($meta['imagesize'] < 1) {
- trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $filename . '!', E_USER_WARNING);
+ trigger_error('imagecreatefrombmp: Can not obtain filesize of ' . $fileName . '!', E_USER_WARNING);
return false;
}
}
@@ -947,7 +932,7 @@ if ( ! function_exists( 'imagebmp') ) {
$index = imagecolorat($im, $i, $j);
if ($index !== $lastIndex || $sameNum > 255) {
if ($sameNum != 0) {
- $bmpData .= chr($same_num) . chr($lastIndex);
+ $bmpData .= chr($sameNum) . chr($lastIndex);
}
$lastIndex = $index;
$sameNum = 1;
diff --git a/lib/private/l10n.php b/lib/private/l10n.php
index ad979a92870..197b2d6791b 100644
--- a/lib/private/l10n.php
+++ b/lib/private/l10n.php
@@ -73,8 +73,8 @@ class OC_L10N implements \OCP\IL10N {
/**
* get an L10N instance
- * @param $app string
- * @param $lang string|null
+ * @param string $app
+ * @param string|null $lang
* @return OC_L10N
*/
public static function get($app, $lang=null) {
@@ -87,8 +87,8 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief The constructor
- * @param $app string app requesting l10n
- * @param $lang string default: null Language
+ * @param string $app app requesting l10n
+ * @param string $lang default: null Language
* @returns OC_L10N-Object
*
* If language is not set, the constructor tries to find the right
@@ -237,7 +237,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief Translating
- * @param $text String The text we need a translation for
+ * @param string $text The text we need a translation for
* @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text
*
@@ -250,9 +250,9 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief Translating
- * @param $text_singular String the string to translate for exactly one object
- * @param $text_plural String the string to translate for n objects
- * @param $count Integer Number of objects
+ * @param string $text_singular the string to translate for exactly one object
+ * @param string $text_plural the string to translate for n objects
+ * @param integer $count Number of objects
* @param array $parameters default:array() Parameters for sprintf
* @return \OC_L10N_String Translation or the same text
*
@@ -351,7 +351,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief Localization
- * @param $type Type of localization
+ * @param string $type Type of localization
* @param $params parameters for this localization
* @returns String or false
*
@@ -406,7 +406,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief Choose a language
- * @param $texts Associative Array with possible strings
+ * @param array $text Associative Array with possible strings
* @returns String
*
* $text is an array 'de' => 'hallo welt', 'en' => 'hello world', ...
@@ -421,7 +421,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief find the best language
- * @param $app Array or string, details below
+ * @param array|string $app details below
* @returns string language
*
* If $app is an array, ownCloud assumes that these are the available
@@ -494,7 +494,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief find the l10n directory
- * @param $app App that needs to be translated
+ * @param string $app App that needs to be translated
* @returns directory
*/
protected static function findI18nDir($app) {
@@ -514,7 +514,7 @@ class OC_L10N implements \OCP\IL10N {
/**
* @brief find all available languages for an app
- * @param $app App that needs to be translated
+ * @param string $app App that needs to be translated
* @returns array an array of available languages
*/
public static function findAvailableLanguages($app=null) {
@@ -533,7 +533,9 @@ class OC_L10N implements \OCP\IL10N {
}
/**
+ * @param string $app
* @param string $lang
+ * @returns bool
*/
public static function languageExists($app, $lang) {
if ($lang == 'en') {//english is always available
diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php
index 9bd07b89023..a216414c9dd 100644
--- a/lib/private/mimetypes.list.php
+++ b/lib/private/mimetypes.list.php
@@ -31,6 +31,7 @@ return array(
'bash' => 'text/x-shellscript',
'blend' => 'application/x-blender',
'bin' => 'application/x-bin',
+ 'bmp' => 'image/bmp',
'cb7' => 'application/x-cbr',
'cba' => 'application/x-cbr',
'cbr' => 'application/x-cbr',
diff --git a/lib/private/ocs/cloud.php b/lib/private/ocs/cloud.php
index cbbf3b626f5..06d6a8eb4b0 100644
--- a/lib/private/ocs/cloud.php
+++ b/lib/private/ocs/cloud.php
@@ -61,17 +61,29 @@ class OC_OCS_Cloud {
* the user from whom the information will be returned
*/
public static function getUser($parameters) {
+ $return = array();
// Check if they are viewing information on themselves
if($parameters['userid'] === OC_User::getUser()) {
// Self lookup
$storage = OC_Helper::getStorageInfo('/');
- $quota = array(
+ $return['quota'] = array(
'free' => $storage['free'],
'used' => $storage['used'],
'total' => $storage['total'],
'relative' => $storage['relative'],
);
- return new OC_OCS_Result(array('quota' => $quota));
+ }
+ if(OC_User::isAdminUser(OC_User::getUser())
+ || OC_Subadmin::isUserAccessible(OC_User::getUser(), $parameters['userid'])) {
+ if(OC_User::userExists($parameters['userid'])) {
+ // Is an admin/subadmin so can see display name
+ $return['displayname'] = OC_User::getDisplayName($parameters['userid']);
+ } else {
+ return new OC_OCS_Result(null, 101);
+ }
+ }
+ if(count($return)) {
+ return new OC_OCS_Result($return);
} else {
// No permission to view this user data
return new OC_OCS_Result(null, 997);
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 80fd003ed8d..798a1322b03 100755
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -53,6 +53,11 @@ class Preview {
static private $registeredProviders = array();
/**
+ * @var \OCP\Files\FileInfo
+ */
+ protected $info;
+
+ /**
* @brief check if thumbnail or bigger version of thumbnail of file is cached
* @param string $user userid - if no user is given, OC_User::getUser will be used
* @param string $root path of root
@@ -61,12 +66,12 @@ class Preview {
* @param int $maxY The maximum Y size of the thumbnail. It can be smaller depending on the shape of the image
* @param bool $scalingUp Disable/Enable upscaling of previews
* @return mixed (bool / string)
- * false if thumbnail does not exist
- * path to thumbnail if thumbnail exists
- */
- public function __construct($user='', $root='/', $file='', $maxX=1, $maxY=1, $scalingUp=true) {
+ * false if thumbnail does not exist
+ * path to thumbnail if thumbnail exists
+ */
+ public function __construct($user = '', $root = '/', $file = '', $maxX = 1, $maxY = 1, $scalingUp = true) {
//init fileviews
- if($user === ''){
+ if ($user === '') {
$user = \OC_User::getUser();
}
$this->fileView = new \OC\Files\View('/' . $user . '/' . $root);
@@ -86,11 +91,11 @@ class Preview {
$this->preview = null;
//check if there are preview backends
- if(empty(self::$providers)) {
+ if (empty(self::$providers)) {
self::initProviders();
}
- if(empty(self::$providers)) {
+ if (empty(self::$providers)) {
\OC_Log::write('core', 'No preview providers exist', \OC_Log::ERROR);
throw new \Exception('No preview providers');
}
@@ -99,15 +104,15 @@ class Preview {
/**
* @brief returns the path of the file you want a thumbnail from
* @return string
- */
- public function getFile() {
+ */
+ public function getFile() {
return $this->file;
}
/**
* @brief returns the max width of the preview
* @return integer
- */
+ */
public function getMaxX() {
return $this->maxX;
}
@@ -115,7 +120,7 @@ class Preview {
/**
* @brief returns the max height of the preview
* @return integer
- */
+ */
public function getMaxY() {
return $this->maxY;
}
@@ -123,7 +128,7 @@ class Preview {
/**
* @brief returns whether or not scalingup is enabled
* @return bool
- */
+ */
public function getScalingUp() {
return $this->scalingup;
}
@@ -131,7 +136,7 @@ class Preview {
/**
* @brief returns the name of the thumbnailfolder
* @return string
- */
+ */
public function getThumbnailsFolder() {
return self::THUMBNAILS_FOLDER;
}
@@ -139,7 +144,7 @@ class Preview {
/**
* @brief returns the max scale factor
* @return string
- */
+ */
public function getMaxScaleFactor() {
return $this->maxScaleFactor;
}
@@ -147,7 +152,7 @@ class Preview {
/**
* @brief returns the max width set in ownCloud's config
* @return string
- */
+ */
public function getConfigMaxX() {
return $this->configMaxX;
}
@@ -155,20 +160,28 @@ class Preview {
/**
* @brief returns the max height set in ownCloud's config
* @return string
- */
+ */
public function getConfigMaxY() {
return $this->configMaxY;
}
+ protected function getFileInfo() {
+ if (!$this->info) {
+ $this->info = $this->fileView->getFileInfo($this->file);
+ }
+ return $this->info;
+ }
+
/**
* @brief set the path of the file you want a thumbnail from
* @param string $file
* @return $this
- */
+ */
public function setFile($file) {
$this->file = $file;
+ $this->info = null;
if ($file !== '') {
- $this->mimetype = $this->fileView->getMimeType($this->file);
+ $this->mimetype = $this->getFileInfo()->getMimetype();
}
return $this;
}
@@ -185,14 +198,14 @@ class Preview {
* @brief set the the max width of the preview
* @param int $maxX
* @return $this
- */
- public function setMaxX($maxX=1) {
- if($maxX <= 0) {
+ */
+ public function setMaxX($maxX = 1) {
+ if ($maxX <= 0) {
throw new \Exception('Cannot set width of 0 or smaller!');
}
$configMaxX = $this->getConfigMaxX();
- if(!is_null($configMaxX)) {
- if($maxX > $configMaxX) {
+ if (!is_null($configMaxX)) {
+ if ($maxX > $configMaxX) {
\OC_Log::write('core', 'maxX reduced from ' . $maxX . ' to ' . $configMaxX, \OC_Log::DEBUG);
$maxX = $configMaxX;
}
@@ -205,14 +218,14 @@ class Preview {
* @brief set the the max height of the preview
* @param int $maxY
* @return $this
- */
- public function setMaxY($maxY=1) {
- if($maxY <= 0) {
+ */
+ public function setMaxY($maxY = 1) {
+ if ($maxY <= 0) {
throw new \Exception('Cannot set height of 0 or smaller!');
}
$configMaxY = $this->getConfigMaxY();
- if(!is_null($configMaxY)) {
- if($maxY > $configMaxY) {
+ if (!is_null($configMaxY)) {
+ if ($maxY > $configMaxY) {
\OC_Log::write('core', 'maxX reduced from ' . $maxY . ' to ' . $configMaxY, \OC_Log::DEBUG);
$maxY = $configMaxY;
}
@@ -225,9 +238,9 @@ class Preview {
* @brief set whether or not scalingup is enabled
* @param bool $scalingUp
* @return $this
- */
+ */
public function setScalingup($scalingUp) {
- if($this->getMaxScaleFactor() === 1) {
+ if ($this->getMaxScaleFactor() === 1) {
$scalingUp = false;
}
$this->scalingup = $scalingUp;
@@ -237,15 +250,15 @@ class Preview {
/**
* @brief check if all parameters are valid
* @return bool
- */
+ */
public function isFileValid() {
$file = $this->getFile();
- if($file === '') {
+ if ($file === '') {
\OC_Log::write('core', 'No filename passed', \OC_Log::DEBUG);
return false;
}
- if(!$this->fileView->file_exists($file)) {
+ if (!$this->fileView->file_exists($file)) {
\OC_Log::write('core', 'File:"' . $file . '" not found', \OC_Log::DEBUG);
return false;
}
@@ -256,40 +269,38 @@ class Preview {
/**
* @brief deletes previews of a file with specific x and y
* @return bool
- */
+ */
public function deletePreview() {
$file = $this->getFile();
- $fileInfo = $this->fileView->getFileInfo($file);
- $fileId = $fileInfo['fileid'];
+ $fileInfo = $this->getFileInfo($file);
+ $fileId = $fileInfo->getId();
$previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/' . $this->getMaxX() . '-' . $this->getMaxY() . '.png';
- $this->userView->unlink($previewPath);
- return !$this->userView->file_exists($previewPath);
+ return $this->userView->unlink($previewPath);
}
/**
* @brief deletes all previews of a file
* @return bool
- */
+ */
public function deleteAllPreviews() {
$file = $this->getFile();
- $fileInfo = $this->fileView->getFileInfo($file);
- $fileId = $fileInfo['fileid'];
+ $fileInfo = $this->getFileInfo($file);
+ $fileId = $fileInfo->getId();
$previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
$this->userView->deleteAll($previewPath);
- $this->userView->rmdir($previewPath);
- return !$this->userView->is_dir($previewPath);
+ return $this->userView->rmdir($previewPath);
}
/**
* @brief check if thumbnail or bigger version of thumbnail of file is cached
* @return mixed (bool / string)
- * false if thumbnail does not exist
- * path to thumbnail if thumbnail exists
- */
+ * false if thumbnail does not exist
+ * path to thumbnail if thumbnail exists
+ */
private function isCached() {
$file = $this->getFile();
$maxX = $this->getMaxX();
@@ -297,75 +308,75 @@ class Preview {
$scalingUp = $this->getScalingUp();
$maxScaleFactor = $this->getMaxScaleFactor();
- $fileInfo = $this->fileView->getFileInfo($file);
- $fileId = $fileInfo['fileid'];
+ $fileInfo = $this->getFileInfo($file);
+ $fileId = $fileInfo->getId();
- if(is_null($fileId)) {
+ if (is_null($fileId)) {
return false;
}
$previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
- if(!$this->userView->is_dir($previewPath)) {
+ if (!$this->userView->is_dir($previewPath)) {
return false;
}
//does a preview with the wanted height and width already exist?
- if($this->userView->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) {
+ if ($this->userView->file_exists($previewPath . $maxX . '-' . $maxY . '.png')) {
return $previewPath . $maxX . '-' . $maxY . '.png';
}
- $wantedAspectRatio = (float) ($maxX / $maxY);
+ $wantedAspectRatio = (float)($maxX / $maxY);
//array for usable cached thumbnails
$possibleThumbnails = array();
$allThumbnails = $this->userView->getDirectoryContent($previewPath);
- foreach($allThumbnails as $thumbnail) {
+ foreach ($allThumbnails as $thumbnail) {
$name = rtrim($thumbnail['name'], '.png');
$size = explode('-', $name);
- $x = (int) $size[0];
- $y = (int) $size[1];
+ $x = (int)$size[0];
+ $y = (int)$size[1];
- $aspectRatio = (float) ($x / $y);
- if($aspectRatio !== $wantedAspectRatio) {
+ $aspectRatio = (float)($x / $y);
+ if ($aspectRatio !== $wantedAspectRatio) {
continue;
}
- if($x < $maxX || $y < $maxY) {
- if($scalingUp) {
+ if ($x < $maxX || $y < $maxY) {
+ if ($scalingUp) {
$scalefactor = $maxX / $x;
- if($scalefactor > $maxScaleFactor) {
+ if ($scalefactor > $maxScaleFactor) {
continue;
}
- }else{
+ } else {
continue;
}
}
$possibleThumbnails[$x] = $thumbnail['path'];
}
- if(count($possibleThumbnails) === 0) {
+ if (count($possibleThumbnails) === 0) {
return false;
}
- if(count($possibleThumbnails) === 1) {
+ if (count($possibleThumbnails) === 1) {
return current($possibleThumbnails);
}
ksort($possibleThumbnails);
- if(key(reset($possibleThumbnails)) > $maxX) {
+ if (key(reset($possibleThumbnails)) > $maxX) {
return current(reset($possibleThumbnails));
}
- if(key(end($possibleThumbnails)) < $maxX) {
+ if (key(end($possibleThumbnails)) < $maxX) {
return current(end($possibleThumbnails));
}
- foreach($possibleThumbnails as $width => $path) {
- if($width < $maxX) {
+ foreach ($possibleThumbnails as $width => $path) {
+ if ($width < $maxX) {
continue;
- }else{
+ } else {
return $path;
}
}
@@ -374,9 +385,9 @@ class Preview {
/**
* @brief return a preview of a file
* @return \OC_Image
- */
+ */
public function getPreview() {
- if(!is_null($this->preview) && $this->preview->valid()){
+ if (!is_null($this->preview) && $this->preview->valid()) {
return $this->preview;
}
@@ -386,22 +397,22 @@ class Preview {
$maxY = $this->getMaxY();
$scalingUp = $this->getScalingUp();
- $fileInfo = $this->fileView->getFileInfo($file);
- $fileId = $fileInfo['fileid'];
+ $fileInfo = $this->getFileInfo($file);
+ $fileId = $fileInfo->getId();
$cached = $this->isCached();
- if($cached) {
+ if ($cached) {
$image = new \OC_Image($this->userView->file_get_contents($cached, 'r'));
$this->preview = $image->valid() ? $image : null;
$this->resizeAndCrop();
}
- if(is_null($this->preview)) {
+ if (is_null($this->preview)) {
$preview = null;
- foreach(self::$providers as $supportedMimetype => $provider) {
- if(!preg_match($supportedMimetype, $this->mimetype)) {
+ foreach (self::$providers as $supportedMimetype => $provider) {
+ if (!preg_match($supportedMimetype, $this->mimetype)) {
continue;
}
@@ -409,7 +420,7 @@ class Preview {
$preview = $provider->getThumbnail($file, $maxX, $maxY, $scalingUp, $this->fileView);
- if(!($preview instanceof \OC_Image)) {
+ if (!($preview instanceof \OC_Image)) {
continue;
}
@@ -419,11 +430,11 @@ class Preview {
$previewPath = $this->getThumbnailsFolder() . '/' . $fileId . '/';
$cachePath = $previewPath . $maxX . '-' . $maxY . '.png';
- if($this->userView->is_dir($this->getThumbnailsFolder() . '/') === false) {
+ if ($this->userView->is_dir($this->getThumbnailsFolder() . '/') === false) {
$this->userView->mkdir($this->getThumbnailsFolder() . '/');
}
- if($this->userView->is_dir($previewPath) === false) {
+ if ($this->userView->is_dir($previewPath) === false) {
$this->userView->mkdir($previewPath);
}
@@ -433,7 +444,7 @@ class Preview {
}
}
- if(is_null($this->preview)) {
+ if (is_null($this->preview)) {
$this->preview = new \OC_Image();
}
@@ -443,10 +454,10 @@ class Preview {
/**
* @brief show preview
* @return void
- */
+ */
public function showPreview() {
\OCP\Response::enableCaching(3600 * 24); // 24 hours
- if(is_null($this->preview)) {
+ if (is_null($this->preview)) {
$this->getPreview();
}
$this->preview->show();
@@ -456,7 +467,7 @@ class Preview {
/**
* @brief show preview
* @return void
- */
+ */
public function show() {
$this->showPreview();
return;
@@ -465,7 +476,7 @@ class Preview {
/**
* @brief resize, crop and fix orientation
* @return void
- */
+ */
private function resizeAndCrop() {
$image = $this->preview;
$x = $this->getMaxX();
@@ -473,17 +484,17 @@ class Preview {
$scalingUp = $this->getScalingUp();
$maxscalefactor = $this->getMaxScaleFactor();
- if(!($image instanceof \OC_Image)) {
+ if (!($image instanceof \OC_Image)) {
\OC_Log::write('core', '$this->preview is not an instance of OC_Image', \OC_Log::DEBUG);
return;
}
$image->fixOrientation();
- $realx = (int) $image->width();
- $realy = (int) $image->height();
+ $realx = (int)$image->width();
+ $realy = (int)$image->height();
- if($x === $realx && $y === $realy) {
+ if ($x === $realx && $y === $realy) {
$this->preview = $image;
return;
}
@@ -491,36 +502,36 @@ class Preview {
$factorX = $x / $realx;
$factorY = $y / $realy;
- if($factorX >= $factorY) {
+ if ($factorX >= $factorY) {
$factor = $factorX;
- }else{
+ } else {
$factor = $factorY;
}
- if($scalingUp === false) {
- if($factor > 1) {
+ if ($scalingUp === false) {
+ if ($factor > 1) {
$factor = 1;
}
}
- if(!is_null($maxscalefactor)) {
- if($factor > $maxscalefactor) {
+ if (!is_null($maxscalefactor)) {
+ if ($factor > $maxscalefactor) {
\OC_Log::write('core', 'scalefactor reduced from ' . $factor . ' to ' . $maxscalefactor, \OC_Log::DEBUG);
$factor = $maxscalefactor;
}
}
- $newXsize = (int) ($realx * $factor);
- $newYsize = (int) ($realy * $factor);
+ $newXsize = (int)($realx * $factor);
+ $newYsize = (int)($realy * $factor);
$image->preciseResize($newXsize, $newYsize);
- if($newXsize === $x && $newYsize === $y) {
+ if ($newXsize === $x && $newYsize === $y) {
$this->preview = $image;
return;
}
- if($newXsize >= $x && $newYsize >= $y) {
+ if ($newXsize >= $x && $newYsize >= $y) {
$cropX = floor(abs($x - $newXsize) * 0.5);
//don't crop previews on the Y axis, this sucks if it's a document.
//$cropY = floor(abs($y - $newYsize) * 0.5);
@@ -532,19 +543,19 @@ class Preview {
return;
}
- if($newXsize < $x || $newYsize < $y) {
- if($newXsize > $x) {
+ if ($newXsize < $x || $newYsize < $y) {
+ if ($newXsize > $x) {
$cropX = floor(($newXsize - $x) * 0.5);
$image->crop($cropX, 0, $x, $newYsize);
}
- if($newYsize > $y) {
+ if ($newYsize > $y) {
$cropY = floor(($newYsize - $y) * 0.5);
$image->crop(0, $cropY, $newXsize, $y);
}
- $newXsize = (int) $image->width();
- $newYsize = (int) $image->height();
+ $newXsize = (int)$image->width();
+ $newYsize = (int)$image->height();
//create transparent background layer
$backgroundlayer = imagecreatetruecolor($x, $y);
@@ -573,8 +584,8 @@ class Preview {
* @param array $options
* @return void
*/
- public static function registerProvider($class, $options=array()) {
- self::$registeredProviders[]=array('class'=>$class, 'options'=>$options);
+ public static function registerProvider($class, $options = array()) {
+ self::$registeredProviders[] = array('class' => $class, 'options' => $options);
}
/**
@@ -582,19 +593,19 @@ class Preview {
* @return void
*/
private static function initProviders() {
- if(!\OC_Config::getValue('enable_previews', true)) {
+ if (!\OC_Config::getValue('enable_previews', true)) {
$provider = new Preview\Unknown(array());
self::$providers = array($provider->getMimeType() => $provider);
return;
}
- if(count(self::$providers)>0) {
+ if (count(self::$providers) > 0) {
return;
}
- foreach(self::$registeredProviders as $provider) {
- $class=$provider['class'];
- $options=$provider['options'];
+ foreach (self::$registeredProviders as $provider) {
+ $class = $provider['class'];
+ $options = $provider['options'];
$object = new $class($options);
@@ -611,7 +622,7 @@ class Preview {
public static function post_delete($args) {
$path = $args['path'];
- if(substr($path, 0, 1) === '/') {
+ if (substr($path, 0, 1) === '/') {
$path = substr($path, 1);
}
$preview = new Preview(\OC_User::getUser(), 'files/', $path);
@@ -622,19 +633,19 @@ class Preview {
* @param string $mimetype
*/
public static function isMimeSupported($mimetype) {
- if(!\OC_Config::getValue('enable_previews', true)) {
+ if (!\OC_Config::getValue('enable_previews', true)) {
return false;
}
//check if there are preview backends
- if(empty(self::$providers)) {
+ if (empty(self::$providers)) {
self::initProviders();
}
//remove last element because it has the mimetype *
$providers = array_slice(self::$providers, 0, -1);
- foreach($providers as $supportedMimetype => $provider) {
- if(preg_match($supportedMimetype, $mimetype)) {
+ foreach ($providers as $supportedMimetype => $provider) {
+ if (preg_match($supportedMimetype, $mimetype)) {
return true;
}
}
diff --git a/lib/private/setup.php b/lib/private/setup.php
index 3906204bda3..0d5bf424b33 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -147,7 +147,7 @@ class OC_Setup {
$content.= "RewriteRule ^.well-known/host-meta /public.php?service=host-meta [QSA,L]\n";
$content.= "RewriteRule ^.well-known/carddav /remote.php/carddav/ [R]\n";
$content.= "RewriteRule ^.well-known/caldav /remote.php/caldav/ [R]\n";
- $content.= "RewriteRule ^apps/([^/]*)/(.*\.(css|php))$ index.php?app=$1&getfile=$2 [QSA,L]\n";
+ $content.= "RewriteRule ^apps/([^/]*)/(.*\.(php))$ index.php?app=$1&getfile=$2 [QSA,L]\n";
$content.= "RewriteRule ^remote/(.*) remote.php [QSA,L]\n";
$content.= "</IfModule>\n";
$content.= "<IfModule mod_mime.c>\n";
diff --git a/lib/private/template/base.php b/lib/private/template/base.php
index 232a29939cc..7aa0cb4a956 100644
--- a/lib/private/template/base.php
+++ b/lib/private/template/base.php
@@ -61,7 +61,7 @@ class Base {
/**
* @brief Assign variables
* @param string $key key
- * @param string $value value
+ * @param array|bool|integer|string $value value
* @return bool
*
* This function assigns a variable. It can be accessed via $_[$key] in
diff --git a/lib/public/share.php b/lib/public/share.php
index ebc555dba5f..2fed41488ca 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -1250,7 +1250,21 @@ class Share {
// Remove root from file source paths if retrieving own shared items
if (isset($uidOwner) && isset($row['path'])) {
if (isset($row['parent'])) {
- $row['path'] = '/Shared/'.basename($row['path']);
+ $query = \OC_DB::prepare('SELECT `file_target` FROM `*PREFIX*share` WHERE `id` = ?');
+ $parentResult = $query->execute(array($row['parent']));
+ if (\OC_DB::isError($result)) {
+ \OC_Log::write('OCP\Share', 'Can\'t select parent: ' .
+ \OC_DB::getErrorMessage($result) . ', select=' . $select . ' where=' . $where,
+ \OC_Log::ERROR);
+ } else {
+ $parentRow = $parentResult->fetchRow();
+ $splitPath = explode('/', $row['path']);
+ $tmpPath = '/Shared' . $parentRow['file_target'];
+ foreach (array_slice($splitPath, 2) as $pathPart) {
+ $tmpPath = $tmpPath . '/' . $pathPart;
+ }
+ $row['path'] = $tmpPath;
+ }
} else {
if (!isset($mounts[$row['storage']])) {
$mountPoints = \OC\Files\Filesystem::getMountByNumericId($row['storage']);
diff --git a/settings/ajax/decryptall.php b/settings/ajax/decryptall.php
index d7c104ab151..4782a4cfc81 100644
--- a/settings/ajax/decryptall.php
+++ b/settings/ajax/decryptall.php
@@ -24,6 +24,8 @@ if ($result !== false) {
$successful = false;
}
+ $util->closeEncryptionSession();
+
if ($successful === true) {
\OCP\JSON::success(array('data' => array('message' => 'Files decrypted successfully')));
} else {
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 188ff75f96b..9024f435657 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -83,7 +83,7 @@ if($_['passwordChangeSupported']) {
placeholder="<?php p($l->t('Your email address'));?>"
autocomplete="on" autocapitalize="off" autocorrect="off" />
<span class="msg"></span><br />
- <em><?php p($l->t('Fill in an email address to enable password recovery'));?></em>
+ <em><?php p($l->t('Fill in an email address to enable password recovery and receive notifications'));?></em>
</fieldset>
</form>
<?php
@@ -108,7 +108,7 @@ if($_['passwordChangeSupported']) {
<?php endif; ?>
</div>
<div id="cropper" class="hidden">
- <div class="inlineblock button" id="abortcropperbutton"><?php p($l->t('Abort')); ?></div>
+ <div class="inlineblock button" id="abortcropperbutton"><?php p($l->t('Cancel')); ?></div>
<div class="inlineblock button primary" id="sendcropperbutton"><?php p($l->t('Choose as profile image')); ?></div>
</div>
</fieldset>
diff --git a/tests/data/db_structure.xml b/tests/data/db_structure.xml
index d98066c4b7e..858c9ab1002 100644
--- a/tests/data/db_structure.xml
+++ b/tests/data/db_structure.xml
@@ -223,4 +223,19 @@
</declaration>
</table>
+<table>
+ <name>*dbprefix*migratekeyword</name>
+
+ <declaration>
+
+ <field>
+ <name>select</name>
+ <type>text</type>
+ <default></default>
+ <notnull>true</notnull>
+ <length>255</length>
+ </field>
+ </declaration>
+</table>
+
</database>
diff --git a/tests/data/db_structure2.xml b/tests/data/db_structure2.xml
index ae5f22e9573..568d90ab0a9 100644
--- a/tests/data/db_structure2.xml
+++ b/tests/data/db_structure2.xml
@@ -119,4 +119,19 @@
</declaration>
</table>
+ <table>
+ <name>*dbprefix*migratekeyword</name>
+
+ <declaration>
+
+ <field>
+ <name>select</name>
+ <type>text</type>
+ <default></default>
+ <notnull>false</notnull>
+ <length>255</length>
+ </field>
+ </declaration>
+ </table>
+
</database>
diff --git a/tests/lib/appframework/http/ResponseTest.php b/tests/lib/appframework/http/ResponseTest.php
index 4f21d77a170..063ab8b5d33 100644
--- a/tests/lib/appframework/http/ResponseTest.php
+++ b/tests/lib/appframework/http/ResponseTest.php
@@ -78,7 +78,7 @@ class ResponseTest extends \PHPUnit_Framework_TestCase {
public function testGetEtag() {
$this->childResponse->setEtag('hi');
- $this->assertEquals('hi', $this->childResponse->getEtag());
+ $this->assertSame('hi', $this->childResponse->getEtag());
}
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 3f5604b4d45..5182fac8b10 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -150,13 +150,15 @@ class Scanner extends \PHPUnit_Framework_TestCase {
$this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder'), 'storage_mtime' => $this->storage->filemtime('folder')));
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_SIZE);
$newData = $this->cache->get('');
- $this->assertNotEquals($oldData['etag'], $newData['etag']);
+ $this->assertInternalType('string', $oldData['etag']);
+ $this->assertInternalType('string', $newData['etag']);
+ $this->assertNotSame($oldData['etag'], $newData['etag']);
$this->assertEquals($oldData['size'], $newData['size']);
$oldData = $newData;
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_ETAG);
$newData = $this->cache->get('');
- $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertSame($oldData['etag'], $newData['etag']);
$this->assertEquals(-1, $newData['size']);
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE);
@@ -164,17 +166,17 @@ class Scanner extends \PHPUnit_Framework_TestCase {
$this->assertNotEquals(-1, $oldData['size']);
$this->scanner->scanFile('', \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
$newData = $this->cache->get('');
- $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertSame($oldData['etag'], $newData['etag']);
$this->assertEquals($oldData['size'], $newData['size']);
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_RECURSIVE, \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
$newData = $this->cache->get('');
- $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertSame($oldData['etag'], $newData['etag']);
$this->assertEquals($oldData['size'], $newData['size']);
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_ETAG + \OC\Files\Cache\Scanner::REUSE_SIZE);
$newData = $this->cache->get('');
- $this->assertEquals($oldData['etag'], $newData['etag']);
+ $this->assertSame($oldData['etag'], $newData['etag']);
$this->assertEquals($oldData['size'], $newData['size']);
}
@@ -217,8 +219,11 @@ class Scanner extends \PHPUnit_Framework_TestCase {
// manipulate etag to simulate an empty etag
$this->scanner->scan('', \OC\Files\Cache\Scanner::SCAN_SHALLOW, \OC\Files\Cache\Scanner::REUSE_ETAG);
$data0 = $this->cache->get('folder/bar.txt');
+ $this->assertInternalType('string', $data0['etag']);
$data1 = $this->cache->get('folder');
+ $this->assertInternalType('string', $data1['etag']);
$data2 = $this->cache->get('');
+ $this->assertInternalType('string', $data2['etag']);
$data0['etag'] = '';
$this->cache->put('folder/bar.txt', $data0);
@@ -227,10 +232,15 @@ class Scanner extends \PHPUnit_Framework_TestCase {
// verify cache content
$newData0 = $this->cache->get('folder/bar.txt');
+ $this->assertInternalType('string', $newData0['etag']);
+ $this->assertNotEmpty($newData0['etag']);
+
$newData1 = $this->cache->get('folder');
+ $this->assertInternalType('string', $newData1['etag']);
+ $this->assertNotSame($data1['etag'], $newData1['etag']);
+
$newData2 = $this->cache->get('');
- $this->assertNotEmpty($newData0['etag']);
- $this->assertNotEquals($data1['etag'], $newData1['etag']);
- $this->assertNotEquals($data2['etag'], $newData2['etag']);
+ $this->assertInternalType('string', $newData2['etag']);
+ $this->assertNotSame($data2['etag'], $newData2['etag']);
}
}
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index 48986149a73..a6ee8c46661 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -96,10 +96,14 @@ class Updater extends \PHPUnit_Framework_TestCase {
Filesystem::file_put_contents('foo.txt', 'asd');
$cachedData = $this->cache->get('foo.txt');
$this->assertEquals(3, $cachedData['size']);
- $this->assertNotEquals($fooCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $fooCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($fooCachedData['etag'], $cachedData['etag']);
$cachedData = $this->cache->get('');
$this->assertEquals(2 * $textSize + $imageSize + 3, $cachedData['size']);
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$rootCachedData = $cachedData;
$this->assertFalse($this->cache->inCache('bar.txt'));
@@ -110,12 +114,15 @@ class Updater extends \PHPUnit_Framework_TestCase {
$mtime = $cachedData['mtime'];
$cachedData = $this->cache->get('');
$this->assertEquals(2 * $textSize + $imageSize + 2 * 3, $cachedData['size']);
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $mtime);
}
public function testWriteWithMountPoints() {
$storage2 = new \OC\Files\Storage\Temporary(array());
+ $storage2->getScanner()->scan(''); //initialize etags
$cache2 = $storage2->getCache();
Filesystem::mount($storage2, array(), '/' . self::$user . '/files/folder/substorage');
$folderCachedData = $this->cache->get('folder');
@@ -127,11 +134,15 @@ class Updater extends \PHPUnit_Framework_TestCase {
$mtime = $cachedData['mtime'];
$cachedData = $cache2->get('');
- $this->assertNotEquals($substorageCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $substorageCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
$this->assertEquals($mtime, $cachedData['mtime']);
$cachedData = $this->cache->get('folder');
- $this->assertNotEquals($folderCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $folderCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
$this->assertEquals($mtime, $cachedData['mtime']);
}
@@ -146,19 +157,25 @@ class Updater extends \PHPUnit_Framework_TestCase {
$this->assertFalse($this->cache->inCache('foo.txt'));
$cachedData = $this->cache->get('');
$this->assertEquals(2 * $textSize + $imageSize, $cachedData['size']);
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
$rootCachedData = $cachedData;
Filesystem::mkdir('bar_folder');
$this->assertTrue($this->cache->inCache('bar_folder'));
$cachedData = $this->cache->get('');
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$rootCachedData = $cachedData;
Filesystem::rmdir('bar_folder');
$this->assertFalse($this->cache->inCache('bar_folder'));
$cachedData = $this->cache->get('');
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
}
@@ -174,11 +191,15 @@ class Updater extends \PHPUnit_Framework_TestCase {
$this->assertFalse($cache2->inCache('foo.txt'));
$cachedData = $cache2->get('');
- $this->assertNotEquals($substorageCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $substorageCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($substorageCachedData['mtime'], $cachedData['mtime']);
$cachedData = $this->cache->get('folder');
- $this->assertNotEquals($folderCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $folderCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($folderCachedData['mtime'], $cachedData['mtime']);
}
@@ -199,7 +220,9 @@ class Updater extends \PHPUnit_Framework_TestCase {
$mtime = $cachedData['mtime'];
$cachedData = $this->cache->get('');
$this->assertEquals(3 * $textSize + $imageSize, $cachedData['size']);
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
}
public function testRenameExtension() {
@@ -227,12 +250,16 @@ class Updater extends \PHPUnit_Framework_TestCase {
$mtime = $cachedData['mtime'];
$cachedData = $cache2->get('');
- $this->assertNotEquals($substorageCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $substorageCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
// rename can cause mtime change - invalid assert
// $this->assertEquals($mtime, $cachedData['mtime']);
$cachedData = $this->cache->get('folder');
- $this->assertNotEquals($folderCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $folderCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
// rename can cause mtime change - invalid assert
// $this->assertEquals($mtime, $cachedData['mtime']);
}
@@ -242,11 +269,15 @@ class Updater extends \PHPUnit_Framework_TestCase {
$fooCachedData = $this->cache->get('foo.txt');
Filesystem::touch('foo.txt');
$cachedData = $this->cache->get('foo.txt');
- $this->assertNotEquals($fooCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $fooCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($fooCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($fooCachedData['mtime'], $cachedData['mtime']);
$cachedData = $this->cache->get('');
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$this->assertGreaterThanOrEqual($rootCachedData['mtime'], $cachedData['mtime']);
$rootCachedData = $cachedData;
@@ -255,14 +286,20 @@ class Updater extends \PHPUnit_Framework_TestCase {
$folderCachedData = $this->cache->get('folder');
Filesystem::touch('folder/bar.txt', $time);
$cachedData = $this->cache->get('folder/bar.txt');
- $this->assertNotEquals($barCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $barCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($barCachedData['etag'], $cachedData['etag']);
$this->assertEquals($time, $cachedData['mtime']);
$cachedData = $this->cache->get('folder');
- $this->assertNotEquals($folderCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $folderCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
$cachedData = $this->cache->get('');
- $this->assertNotEquals($rootCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $rootCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($rootCachedData['etag'], $cachedData['etag']);
$this->assertEquals($time, $cachedData['mtime']);
}
@@ -279,14 +316,20 @@ class Updater extends \PHPUnit_Framework_TestCase {
$time = 1371006070;
Filesystem::touch('folder/substorage/foo.txt', $time);
$cachedData = $cache2->get('foo.txt');
- $this->assertNotEquals($fooCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $fooCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($fooCachedData['etag'], $cachedData['etag']);
$this->assertEquals($time, $cachedData['mtime']);
$cachedData = $cache2->get('');
- $this->assertNotEquals($substorageCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $substorageCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($substorageCachedData['etag'], $cachedData['etag']);
$cachedData = $this->cache->get('folder');
- $this->assertNotEquals($folderCachedData['etag'], $cachedData['etag']);
+ $this->assertInternalType('string', $folderCachedData['etag']);
+ $this->assertInternalType('string', $cachedData['etag']);
+ $this->assertNotSame($folderCachedData['etag'], $cachedData['etag']);
$this->assertEquals($time, $cachedData['mtime']);
}
diff --git a/tests/lib/files/etagtest.php b/tests/lib/files/etagtest.php
index ce05adb188a..af9f66835f0 100644
--- a/tests/lib/files/etagtest.php
+++ b/tests/lib/files/etagtest.php
@@ -65,7 +65,11 @@ class EtagTest extends \PHPUnit_Framework_TestCase {
$scanner = new \OC\Files\Utils\Scanner($user1);
$scanner->backgroundScan('/');
- $this->assertEquals($originalEtags, $this->getEtags($files));
+ $newEtags = $this->getEtags($files);
+ // loop over array and use assertSame over assertEquals to prevent false positives
+ foreach ($originalEtags as $file => $originalEtag) {
+ $this->assertSame($originalEtag, $newEtags[$file]);
+ }
}
/**
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 371d1ed1798..c85f1128dbe 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -563,6 +563,6 @@ class View extends \PHPUnit_Framework_TestCase {
$scanner->scanFile('test', \OC\Files\Cache\Scanner::REUSE_ETAG);
$info2 = $view->getFileInfo('/test/test');
- $this->assertEquals($info['etag'], $info2['etag']);
+ $this->assertSame($info['etag'], $info2['etag']);
}
}