summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
m---------3rdparty0
-rw-r--r--apps/files/js/filelist.js5
-rw-r--r--apps/files/templates/part.breadcrumb.php6
-rw-r--r--apps/files_encryption/appinfo/info.xml2
-rw-r--r--apps/files_encryption/lib/proxy.php4
-rw-r--r--apps/files_external/js/dropbox.js17
-rw-r--r--apps/files_external/js/google.js21
-rw-r--r--apps/files_external/js/settings.js14
-rw-r--r--apps/files_external/lib/webdav.php2
-rw-r--r--apps/files_sharing/public.php2
-rw-r--r--apps/files_trashbin/lib/trashbin.php6
-rw-r--r--apps/files_versions/lib/versions.php6
-rw-r--r--apps/user_ldap/lib/connection.php3
-rw-r--r--apps/user_ldap/lib/wizard.php11
-rw-r--r--core/css/fixes.css6
-rw-r--r--core/css/styles.css17
-rw-r--r--core/js/setup.js22
-rw-r--r--core/setup.php2
-rw-r--r--core/templates/installation.php1
-rw-r--r--lib/private/api.php42
-rw-r--r--lib/private/files/cache/scanner.php2
-rw-r--r--lib/public/share.php10
-rw-r--r--settings/css/settings.css13
-rw-r--r--settings/js/personal.js12
-rw-r--r--settings/js/users.js2
-rw-r--r--settings/personal.php4
-rw-r--r--settings/templates/personal.php2
-rw-r--r--tests/lib/api.php35
-rw-r--r--tests/lib/files/cache/cache.php6
-rw-r--r--tests/lib/files/cache/scanner.php2
-rw-r--r--tests/lib/files/cache/updater.php2
-rw-r--r--tests/lib/files/view.php17
-rw-r--r--tests/lib/share/share.php58
33 files changed, 269 insertions, 85 deletions
diff --git a/3rdparty b/3rdparty
-Subproject 95ab25149c4903650a1113c01ccb1732fb089f1
+Subproject 3f466720839295d8607f57bf7a96b7a03d77b52
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index c02ab70ce8d..30aea9c8c8d 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -300,7 +300,10 @@ var FileList={
},
remove:function(name){
var fileEl = FileList.findFileEl(name);
- fileEl.find('td.filename').draggable('destroy');
+ if (fileEl.data('permissions') & OC.PERMISSION_DELETE) {
+ // file is only draggable when delete permissions are set
+ fileEl.find('td.filename').draggable('destroy');
+ }
fileEl.remove();
FileList.updateFileSummary();
if ( ! $('tr[data-file]').exists() ) {
diff --git a/apps/files/templates/part.breadcrumb.php b/apps/files/templates/part.breadcrumb.php
index 90d07d4336c..2a0df622767 100644
--- a/apps/files/templates/part.breadcrumb.php
+++ b/apps/files/templates/part.breadcrumb.php
@@ -1,6 +1,10 @@
<div class="crumb <?php if(!count($_["breadcrumb"])) p('last');?>" data-dir=''>
<a href="<?php print_unescaped($_['baseURL']); ?>">
- <img src="<?php print_unescaped(OCP\image_path('core', 'places/home.svg'));?>" class="svg" />
+ <?php if(isset($_['rootBreadCrumb'])):
+ echo $_['rootBreadCrumb'];
+ else:?>
+ <img src="<?php print_unescaped(OCP\image_path('core', 'places/home.svg'));?>" class="svg" />
+ <?php endif;?>
</a>
</div>
<?php for($i=0; $i<count($_["breadcrumb"]); $i++):
diff --git a/apps/files_encryption/appinfo/info.xml b/apps/files_encryption/appinfo/info.xml
index 9d495916d26..ee05b651361 100644
--- a/apps/files_encryption/appinfo/info.xml
+++ b/apps/files_encryption/appinfo/info.xml
@@ -2,7 +2,7 @@
<info>
<id>files_encryption</id>
<name>Encryption</name>
- <description>The new ownCloud 5 files encryption system. After the app was enabled you need to re-login to initialize your encryption keys.</description>
+ <description>The ownCloud files encryption system provides server side-encryption. After the app was enabled you need to re-login to initialize your encryption keys.</description>
<licence>AGPL</licence>
<author>Sam Tuke, Bjoern Schiessle, Florin Peter</author>
<require>4</require>
diff --git a/apps/files_encryption/lib/proxy.php b/apps/files_encryption/lib/proxy.php
index c1b60799e64..0b7e066f2e2 100644
--- a/apps/files_encryption/lib/proxy.php
+++ b/apps/files_encryption/lib/proxy.php
@@ -255,8 +255,8 @@ class Proxy extends \OC_FileProxy {
// split the path parts
$pathParts = explode('/', $path);
- // FIXME: handling for /userId/cache used by webdav for chunking. The cache chunks are NOT encrypted
- if (isset($pathParts[2]) && $pathParts[2] === 'cache') {
+ // don't try to encrypt/decrypt cache chunks or files in the trash bin
+ if (isset($pathParts[2]) && ($pathParts[2] === 'cache' || $pathParts[2] === 'files_trashbin')) {
return $result;
}
diff --git a/apps/files_external/js/dropbox.js b/apps/files_external/js/dropbox.js
index 957daeb4d1f..6baaabe11b6 100644
--- a/apps/files_external/js/dropbox.js
+++ b/apps/files_external/js/dropbox.js
@@ -23,9 +23,12 @@ $(document).ready(function() {
$(token).val(result.access_token);
$(token_secret).val(result.access_token_secret);
$(configured).val('true');
- OC.MountConfig.saveStorage(tr);
- $(tr).find('.configuration input').attr('disabled', 'disabled');
- $(tr).find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
+ OC.MountConfig.saveStorage(tr, function(status) {
+ if (status) {
+ $(tr).find('.configuration input').attr('disabled', 'disabled');
+ $(tr).find('.configuration').append('<span id="access" style="padding-left:0.5em;">'+t('files_external', 'Access granted')+'</span>');
+ }
+ });
} else {
OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage'));
}
@@ -77,7 +80,6 @@ $(document).ready(function() {
var tr = $(this).parent().parent();
var app_key = $(this).parent().find('[data-parameter="app_key"]').val();
var app_secret = $(this).parent().find('[data-parameter="app_secret"]').val();
- var statusSpan = $(tr).find('.status span');
if (app_key != '' && app_secret != '') {
var tr = $(this).parent().parent();
var configured = $(this).parent().find('[data-parameter="configured"]');
@@ -88,10 +90,9 @@ $(document).ready(function() {
$(configured).val('false');
$(token).val(result.data.request_token);
$(token_secret).val(result.data.request_token_secret);
- OC.MountConfig.saveStorage(tr);
- statusSpan.removeClass();
- statusSpan.addClass('waiting');
- window.location = result.data.url;
+ OC.MountConfig.saveStorage(tr, function() {
+ window.location = result.data.url;
+ });
} else {
OC.dialogs.alert(result.data.message, t('files_external', 'Error configuring Dropbox storage'));
}
diff --git a/apps/files_external/js/google.js b/apps/files_external/js/google.js
index b4be1c1dc41..068c2c13c66 100644
--- a/apps/files_external/js/google.js
+++ b/apps/files_external/js/google.js
@@ -32,11 +32,14 @@ $(document).ready(function() {
if (result && result.status == 'success') {
$(token).val(result.data.token);
$(configured).val('true');
- OC.MountConfig.saveStorage(tr);
- $(tr).find('.configuration input').attr('disabled', 'disabled');
- $(tr).find('.configuration').append($('<span/>')
- .attr('id', 'access')
- .text(t('files_external', 'Access granted')));
+ OC.MountConfig.saveStorage(tr, function(status) {
+ if (status) {
+ $(tr).find('.configuration input').attr('disabled', 'disabled');
+ $(tr).find('.configuration').append($('<span/>')
+ .attr('id', 'access')
+ .text(t('files_external', 'Access granted')));
+ }
+ });
} else {
OC.dialogs.alert(result.data.message,
t('files_external', 'Error configuring Google Drive storage')
@@ -99,7 +102,6 @@ $(document).ready(function() {
var configured = $(this).parent().find('[data-parameter="configured"]');
var client_id = $(this).parent().find('[data-parameter="client_id"]').val();
var client_secret = $(this).parent().find('[data-parameter="client_secret"]').val();
- var statusSpan = $(tr).find('.status span');
if (client_id != '' && client_secret != '') {
var token = $(this).parent().find('[data-parameter="token"]');
$.post(OC.filePath('files_external', 'ajax', 'google.php'),
@@ -112,10 +114,9 @@ $(document).ready(function() {
if (result && result.status == 'success') {
$(configured).val('false');
$(token).val('false');
- OC.MountConfig.saveStorage(tr);
- statusSpan.removeClass();
- statusSpan.addClass('waiting');
- window.location = result.data.url;
+ OC.MountConfig.saveStorage(tr, function(status) {
+ window.location = result.data.url;
+ });
} else {
OC.dialogs.alert(result.data.message,
t('files_external', 'Error configuring Google Drive storage')
diff --git a/apps/files_external/js/settings.js b/apps/files_external/js/settings.js
index 886c324e338..895f97bd2c3 100644
--- a/apps/files_external/js/settings.js
+++ b/apps/files_external/js/settings.js
@@ -12,7 +12,7 @@ function updateStatus(statusEl, result){
}
OC.MountConfig={
- saveStorage:function(tr) {
+ saveStorage:function(tr, callback) {
var mountPoint = $(tr).find('.mountPoint input').val();
if (mountPoint == '') {
return false;
@@ -84,9 +84,15 @@ OC.MountConfig={
},
success: function(result) {
status = updateStatus(statusSpan, result);
+ if (callback) {
+ callback(status);
+ }
},
error: function(result){
status = updateStatus(statusSpan, result);
+ if (callback) {
+ callback(status);
+ }
}
});
});
@@ -137,9 +143,15 @@ OC.MountConfig={
},
success: function(result) {
status = updateStatus(statusSpan, result);
+ if (callback) {
+ callback(status);
+ }
},
error: function(result){
status = updateStatus(statusSpan, result);
+ if (callback) {
+ callback(status);
+ }
}
});
}
diff --git a/apps/files_external/lib/webdav.php b/apps/files_external/lib/webdav.php
index 0f8034e57d9..f6f4cb16e87 100644
--- a/apps/files_external/lib/webdav.php
+++ b/apps/files_external/lib/webdav.php
@@ -224,7 +224,7 @@ class DAV extends \OC\Files\Storage\Common{
if (isset($response['{DAV:}quota-available-bytes'])) {
return (int)$response['{DAV:}quota-available-bytes'];
} else {
- return 0;
+ return \OC\Files\SPACE_UNKNOWN;
}
} catch(\Exception $e) {
return \OC\Files\SPACE_UNKNOWN;
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index f4042f65248..ef4345da20e 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -111,6 +111,7 @@ if (isset($path)) {
}
}
$basePath = $path;
+ $rootName = basename($path);
if (isset($_GET['path']) && \OC\Files\Filesystem::isReadable($basePath . $_GET['path'])) {
$getPath = \OC\Files\Filesystem::normalizePath($_GET['path']);
$path .= $getPath;
@@ -216,6 +217,7 @@ if (isset($path)) {
$list->assign('sharingroot', $basePath);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb);
+ $breadcrumbNav->assign('rootBreadCrumb', $rootName);
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=');
$maxUploadFilesize=OCP\Util::maxUploadFilesize($path);
$fileHeader = (!isset($files) or count($files) > 0);
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php
index 567f88b91b1..769fd8d8990 100644
--- a/apps/files_trashbin/lib/trashbin.php
+++ b/apps/files_trashbin/lib/trashbin.php
@@ -189,7 +189,7 @@ class Trashbin {
if ($rootView->is_dir($owner . '/files_versions/' . $ownerPath)) {
$size += self::calculateSize(new \OC\Files\View('/' . $owner . '/files_versions/' . $ownerPath));
if ($owner !== $user) {
- $rootView->copy($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp);
+ self::copy_recursive($owner . '/files_versions/' . $ownerPath, $owner . '/files_trashbin/versions/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
}
$rootView->rename($owner . '/files_versions/' . $ownerPath, $user . '/files_trashbin/versions/' . $filename . '.d' . $timestamp);
} else if ($versions = \OCA\Files_Versions\Storage::getVersions($owner, $ownerPath)) {
@@ -247,7 +247,7 @@ class Trashbin {
if ($rootView->is_dir($keyfile)) {
$size += self::calculateSize(new \OC\Files\View($keyfile));
if ($owner !== $user) {
- $rootView->copy($keyfile, $owner . '/files_trashbin/keyfiles/' . basename($ownerPath) . '.d' . $timestamp);
+ self::copy_recursive($keyfile, $owner . '/files_trashbin/keyfiles/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
}
$rootView->rename($keyfile, $user . '/files_trashbin/keyfiles/' . $filename . '.d' . $timestamp);
} else {
@@ -265,7 +265,7 @@ class Trashbin {
if ($rootView->is_dir($sharekeys)) {
$size += self::calculateSize(new \OC\Files\View($sharekeys));
if ($owner !== $user) {
- $rootView->copy($sharekeys, $owner . '/files_trashbin/share-keys/' . basename($ownerPath) . '.d' . $timestamp);
+ self::copy_recursive($sharekeys, $owner . '/files_trashbin/share-keys/' . basename($ownerPath) . '.d' . $timestamp, $rootView);
}
$rootView->rename($sharekeys, $user . '/files_trashbin/share-keys/' . $filename . '.d' . $timestamp);
} else {
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 42a15612d67..7e6cc818efb 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -98,7 +98,6 @@ class Storage {
$files_view = new \OC\Files\View('/'.$uid .'/files');
$users_view = new \OC\Files\View('/'.$uid);
- $versions_view = new \OC\Files\View('/'.$uid.'/files_versions');
// check if filename is a directory
if($files_view->is_dir($filename)) {
@@ -132,7 +131,10 @@ class Storage {
\OC_FileProxy::$enabled = false;
// store a new version of a file
- $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'.$users_view->filemtime('files'.$filename));
+ $mtime = $users_view->filemtime('files'.$filename);
+ $users_view->copy('files'.$filename, 'files_versions'.$filename.'.v'. $mtime);
+ // call getFileInfo to enforce a file cache entry for the new version
+ $users_view->getFileInfo('files_versions'.$filename.'.v'.$mtime);
// reset proxy state
\OC_FileProxy::$enabled = $proxyStatus;
diff --git a/apps/user_ldap/lib/connection.php b/apps/user_ldap/lib/connection.php
index 14dfaa1174d..c4e4efd0483 100644
--- a/apps/user_ldap/lib/connection.php
+++ b/apps/user_ldap/lib/connection.php
@@ -50,7 +50,8 @@ class Connection extends LDAPUtility {
parent::__construct($ldap);
$this->configPrefix = $configPrefix;
$this->configID = $configID;
- $this->configuration = new Configuration($configPrefix);
+ $this->configuration = new Configuration($configPrefix,
+ !is_null($configID));
$memcache = new \OC\Memcache\Factory();
if($memcache->isAvailable()) {
$this->cache = $memcache->create();
diff --git a/apps/user_ldap/lib/wizard.php b/apps/user_ldap/lib/wizard.php
index 348a871e2b3..b70ede8599c 100644
--- a/apps/user_ldap/lib/wizard.php
+++ b/apps/user_ldap/lib/wizard.php
@@ -792,10 +792,13 @@ class Wizard extends LDAPUtility {
\OCP\Util::writeLog('user_ldap', 'Wiz: Setting LDAP Options ', \OCP\Util::DEBUG);
//set LDAP options
- $a = $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
- $c = $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
+ $this->ldap->setOption($cr, LDAP_OPT_PROTOCOL_VERSION, 3);
+ $this->ldap->setOption($cr, LDAP_OPT_NETWORK_TIMEOUT, self::LDAP_NW_TIMEOUT);
if($tls) {
- $this->ldap->startTls($cr);
+ $isTlsWorking = @$this->ldap->startTls($cr);
+ if(!$isTlsWorking) {
+ return false;
+ }
}
\OCP\Util::writeLog('user_ldap', 'Wiz: Attemping to Bind ', \OCP\Util::DEBUG);
@@ -809,7 +812,7 @@ class Wizard extends LDAPUtility {
if($ncc) {
throw new \Exception('Certificate cannot be validated.');
}
- \OCP\Util::writeLog('user_ldap', 'Wiz: Bind succesfull with Port '. $port, \OCP\Util::DEBUG);
+ \OCP\Util::writeLog('user_ldap', 'Wiz: Bind successfull to Port '. $port . ' TLS ' . intval($tls), \OCP\Util::DEBUG);
return true;
}
diff --git a/core/css/fixes.css b/core/css/fixes.css
index bec002b96b3..4ee854addef 100644
--- a/core/css/fixes.css
+++ b/core/css/fixes.css
@@ -63,3 +63,9 @@
.ie8 #nojavascript {
filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,startColorstr='#4c320000', endColorstr='#4c320000'); /* IE */
}
+
+/* IE8 doesn't have rounded corners, so the strengthify bar should be wider */
+.lte8 #body-login .strengthify-wrapper {
+ width: 271px;
+ left: 6px;
+}
diff --git a/core/css/styles.css b/core/css/styles.css
index df014567087..29fcdd45738 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -341,7 +341,7 @@ input[type="submit"].enabled {
margin-bottom: 20px;
text-align: left;
}
-#body-login form #adminaccount { margin-bottom:5px; }
+#body-login form #adminaccount { margin-bottom:15px; }
#body-login form fieldset legend, #datadirContent label {
width: 100%;
font-weight: bold;
@@ -361,6 +361,21 @@ input[type="submit"].enabled {
margin-left: -4px;
}
+/* strengthify wrapper */
+#body-login .strengthify-wrapper {
+ display: inline-block;
+ position: relative;
+ left: 15px;
+ top: -21px;
+ width: 252px;
+}
+
+/* tipsy for the strengthify wrapper looks better with following font settings */
+#body-login .tipsy-inner {
+ font-weight: bold;
+ color: #ccc;
+}
+
/* Icons for username and password fields to better recognize them */
#adminlogin, #adminpass, #user, #password { width:11.7em!important; padding-left:1.8em; }
#adminlogin+label+img, #adminpass-icon, #user+label+img, #password-icon {
diff --git a/core/js/setup.js b/core/js/setup.js
index 0863be35886..279b5fbebb9 100644
--- a/core/js/setup.js
+++ b/core/js/setup.js
@@ -7,9 +7,9 @@ $(document).ready(function() {
oracle:!!$('#hasOracle').val(),
mssql:!!$('#hasMSSQL').val()
};
-
+
$('#selectDbType').buttonset();
-
+
if($('#hasSQLite').val()){
$('#use_other_db').hide();
$('#use_oracle_db').hide();
@@ -63,17 +63,27 @@ $(document).ready(function() {
form.submit();
return false;
});
-
+
// Expand latest db settings if page was reloaded on error
var currentDbType = $('input[type="radio"]:checked').val();
-
+
if (currentDbType === undefined){
$('input[type="radio"]').first().click();
}
-
+
if (currentDbType === 'sqlite' || (dbtypes.sqlite && currentDbType === undefined)){
$('#datadirContent').hide(250);
$('#databaseField').hide(250);
}
-
+
+ $('#adminpass').strengthify({
+ zxcvbn: OC.linkTo('3rdparty','zxcvbn/js/zxcvbn.js'),
+ titles: [
+ t('core', 'Very weak password'),
+ t('core', 'Weak password'),
+ t('core', 'So-so password'),
+ t('core', 'Good password'),
+ t('core', 'Strong password')
+ ]
+ });
});
diff --git a/core/setup.php b/core/setup.php
index 781d6e572af..958376b2cce 100644
--- a/core/setup.php
+++ b/core/setup.php
@@ -20,6 +20,8 @@ if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) {
}
}
+OC_Util::addScript( '3rdparty', 'strengthify/jquery.strengthify' );
+OC_Util::addStyle( '3rdparty', 'strengthify/strengthify' );
OC_Util::addScript('setup');
$hasSQLite = class_exists('SQLite3');
diff --git a/core/templates/installation.php b/core/templates/installation.php
index ec55a65ea58..182fc83a4d4 100644
--- a/core/templates/installation.php
+++ b/core/templates/installation.php
@@ -59,6 +59,7 @@
<img class="svg" id="adminpass-icon" src="<?php print_unescaped(image_path('', 'actions/password.svg')); ?>" alt="" />
<input type="checkbox" id="show" name="show" />
<label for="show"></label>
+ <div class="strengthify-wrapper"></div>
</p>
</fieldset>
diff --git a/lib/private/api.php b/lib/private/api.php
index 03d7b7382a5..c713368125c 100644
--- a/lib/private/api.php
+++ b/lib/private/api.php
@@ -33,7 +33,7 @@ class OC_API {
const USER_AUTH = 1;
const SUBADMIN_AUTH = 2;
const ADMIN_AUTH = 3;
-
+
/**
* API Response Codes
*/
@@ -41,13 +41,13 @@ class OC_API {
const RESPOND_SERVER_ERROR = 996;
const RESPOND_NOT_FOUND = 998;
const RESPOND_UNKNOWN_ERROR = 999;
-
+
/**
* api actions
*/
protected static $actions = array();
private static $logoutRequired = false;
-
+
/**
* registers an api call
* @param string $method the http method
@@ -58,7 +58,7 @@ class OC_API {
* @param array $defaults
* @param array $requirements
*/
- public static function register($method, $url, $action, $app,
+ public static function register($method, $url, $action, $app,
$authLevel = OC_API::USER_AUTH,
$defaults = array(),
$requirements = array()) {
@@ -75,7 +75,7 @@ class OC_API {
}
self::$actions[$name][] = array('app' => $app, 'action' => $action, 'authlevel' => $authLevel);
}
-
+
/**
* handles an api call
* @param array $parameters
@@ -125,7 +125,7 @@ class OC_API {
self::respond($response, $format);
}
-
+
/**
* merge the returned result objects into one response
* @param array $responses
@@ -166,32 +166,31 @@ class OC_API {
// Maybe any that are not OC_API::RESPOND_SERVER_ERROR
// Merge failed responses if more than one
$data = array();
- $meta = array();
foreach($shipped['failed'] as $failure) {
$data = array_merge_recursive($data, $failure['response']->getData());
}
$picked = reset($shipped['failed']);
$code = $picked['response']->getStatusCode();
- $response = new OC_OCS_Result($data, $code);
+ $meta = $picked['response']->getMeta();
+ $response = new OC_OCS_Result($data, $code, $meta['message']);
return $response;
} elseif(!empty($shipped['succeeded'])) {
$responses = array_merge($shipped['succeeded'], $thirdparty['succeeded']);
} elseif(!empty($thirdparty['failed'])) {
// Merge failed responses if more than one
$data = array();
- $meta = array();
foreach($thirdparty['failed'] as $failure) {
$data = array_merge_recursive($data, $failure['response']->getData());
}
$picked = reset($thirdparty['failed']);
$code = $picked['response']->getStatusCode();
- $response = new OC_OCS_Result($data, $code);
+ $meta = $picked['response']->getMeta();
+ $response = new OC_OCS_Result($data, $code, $meta['message']);
return $response;
} else {
$responses = $thirdparty['succeeded'];
}
// Merge the successful responses
- $meta = array();
$data = array();
foreach($responses as $app => $response) {
@@ -200,22 +199,25 @@ class OC_API {
} else {
$data = array_merge_recursive($data, $response['response']->getData());
}
- $codes[] = $response['response']->getStatusCode();
+ $codes[] = array('code' => $response['response']->getStatusCode(),
+ 'meta' => $response['response']->getMeta());
}
// Use any non 100 status codes
$statusCode = 100;
+ $statusMessage = null;
foreach($codes as $code) {
- if($code != 100) {
- $statusCode = $code;
+ if($code['code'] != 100) {
+ $statusCode = $code['code'];
+ $statusMessage = $code['meta']['message'];
break;
}
}
- $result = new OC_OCS_Result($data, $statusCode);
+ $result = new OC_OCS_Result($data, $statusCode, $statusMessage);
return $result;
}
-
+
/**
* authenticate the api call
* @param array $action the action details as supplied to OC_API::register()
@@ -261,8 +263,8 @@ class OC_API {
return false;
break;
}
- }
-
+ }
+
/**
* http basic auth
* @return string|false (username, or false on failure)
@@ -294,7 +296,7 @@ class OC_API {
return false;
}
-
+
/**
* respond to a call
* @param OC_OCS_Result $result
@@ -343,5 +345,5 @@ class OC_API {
}
}
}
-
+
}
diff --git a/lib/private/files/cache/scanner.php b/lib/private/files/cache/scanner.php
index a8c069ee99f..92a4c01841b 100644
--- a/lib/private/files/cache/scanner.php
+++ b/lib/private/files/cache/scanner.php
@@ -122,7 +122,7 @@ class Scanner extends BasicEmitter {
$propagateETagChange = true;
}
// only reuse data if the file hasn't explicitly changed
- if (isset($data['mtime']) && isset($cacheData['mtime']) && $data['mtime'] === $cacheData['mtime']) {
+ if (isset($data['storage_mtime']) && isset($cacheData['storage_mtime']) && $data['storage_mtime'] === $cacheData['storage_mtime']) {
if (($reuseExisting & self::REUSE_SIZE) && ($data['size'] === -1)) {
$data['size'] = $cacheData['size'];
}
diff --git a/lib/public/share.php b/lib/public/share.php
index f0fd8e1ab1b..eb1dd8d1c95 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -655,7 +655,15 @@ class Share {
* @return Returns true on success or false on failure
*/
public static function unshareAll($itemType, $itemSource) {
- if ($shares = self::getItemShared($itemType, $itemSource)) {
+ // Get all of the owners of shares of this item.
+ $query = \OC_DB::prepare( 'SELECT `uid_owner` from `*PREFIX*share` WHERE `item_type`=? AND `item_source`=?' );
+ $result = $query->execute(array($itemType, $itemSource));
+ $shares = array();
+ // Add each owner's shares to the array of all shares for this item.
+ while ($row = $result->fetchRow()) {
+ $shares = array_merge($shares, self::getItems($itemType, $itemSource, null, null, $row['uid_owner']));
+ }
+ if (!empty($shares)) {
// Pass all the vars we have for now, they may be useful
$hookParams = array(
'itemType' => $itemType,
diff --git a/settings/css/settings.css b/settings/css/settings.css
index 2e464c3f110..a93c675d466 100644
--- a/settings/css/settings.css
+++ b/settings/css/settings.css
@@ -147,3 +147,16 @@ table.shareAPI td { padding-bottom: 0.8em; }
/* HELP */
.pressed {background-color:#DDD;}
+/* PASSWORD */
+.strengthify-wrapper {
+ position: absolute;
+ left: 189px;
+ width: 131px;
+ margin-top: -7px;
+}
+
+/* OPERA hack for strengthify*/
+doesnotexist:-o-prefocus, .strengthify-wrapper {
+ left: 185px;
+ width: 129px;
+}
diff --git a/settings/js/personal.js b/settings/js/personal.js
index 2934677f256..591eb8abe2e 100644
--- a/settings/js/personal.js
+++ b/settings/js/personal.js
@@ -1,5 +1,6 @@
/**
* Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com>
+ * 2013, Morris Jobke <morris.jobke@gmail.com>
* This file is licensed under the Affero General Public License version 3 or later.
* See the COPYING-README file.
*/
@@ -243,6 +244,17 @@ $(document).ready(function(){
$('#sendcropperbutton').click(function(){
sendCropData();
});
+
+ $('#pass2').strengthify({
+ zxcvbn: OC.linkTo('3rdparty','zxcvbn/js/zxcvbn.js'),
+ titles: [
+ t('core', 'Very weak password'),
+ t('core', 'Weak password'),
+ t('core', 'So-so password'),
+ t('core', 'Good password'),
+ t('core', 'Strong password')
+ ]
+ });
} );
OC.Encryption = {
diff --git a/settings/js/users.js b/settings/js/users.js
index 5ae157b07c6..6886db668b5 100644
--- a/settings/js/users.js
+++ b/settings/js/users.js
@@ -44,7 +44,7 @@ var UserList = {
// Provide user with option to undo
$('#notification').data('deleteuser', true);
- OC.Notification.showHtml(t('users', 'deleted') + ' ' + escapeHTML(uid) + '<span class="undo">' + t('users', 'undo') + '</span>');
+ OC.Notification.showHtml(t('settings', 'deleted') + ' ' + escapeHTML(uid) + '<span class="undo">' + t('settings', 'undo') + '</span>');
},
/**
diff --git a/settings/personal.php b/settings/personal.php
index 44e1048941b..cf1a496bdf0 100644
--- a/settings/personal.php
+++ b/settings/personal.php
@@ -13,6 +13,8 @@ $defaults = new OC_Defaults(); // initialize themable default strings and urls
// Highlight navigation entry
OC_Util::addScript( 'settings', 'personal' );
OC_Util::addStyle( 'settings', 'settings' );
+OC_Util::addScript( '3rdparty', 'strengthify/jquery.strengthify' );
+OC_Util::addStyle( '3rdparty', 'strengthify/strengthify' );
OC_Util::addScript( '3rdparty', 'chosen/chosen.jquery.min' );
OC_Util::addStyle( '3rdparty', 'chosen' );
\OC_Util::addScript('files', 'jquery.fileupload');
@@ -20,6 +22,8 @@ if (\OC_Config::getValue('enable_avatars', true) === true) {
\OC_Util::addScript('3rdparty/Jcrop', 'jquery.Jcrop.min');
\OC_Util::addStyle('3rdparty/Jcrop', 'jquery.Jcrop.min');
}
+
+// Highlight navigation entry
OC_App::setActiveNavigationEntry( 'personal' );
$storageInfo=OC_Helper::getStorageInfo('/');
diff --git a/settings/templates/personal.php b/settings/templates/personal.php
index 3eb864655bb..1518b48b979 100644
--- a/settings/templates/personal.php
+++ b/settings/templates/personal.php
@@ -44,6 +44,8 @@ if($_['passwordChangeSupported']) {
placeholder="<?php echo $l->t('New password');?>" data-typetoggle="#personal-show" />
<input type="checkbox" id="personal-show" name="show" /><label for="personal-show"></label>
<input id="passwordbutton" type="submit" value="<?php echo $l->t('Change password');?>" />
+ <br/>
+ <div class="strengthify-wrapper"></div>
</fieldset>
</form>
<?php
diff --git a/tests/lib/api.php b/tests/lib/api.php
index 95d75f15311..9c4324e63e0 100644
--- a/tests/lib/api.php
+++ b/tests/lib/api.php
@@ -7,12 +7,12 @@
*/
class Test_API extends PHPUnit_Framework_TestCase {
-
+
// Helps build a response variable
- function buildResponse($shipped, $data, $code) {
+ function buildResponse($shipped, $data, $code, $message=null) {
return array(
'shipped' => $shipped,
- 'response' => new OC_OCS_Result($data, $code),
+ 'response' => new OC_OCS_Result($data, $code, $message),
'app' => uniqid('testapp_', true),
);
}
@@ -64,24 +64,24 @@ class Test_API extends PHPUnit_Framework_TestCase {
// Two shipped success results
array(true, 100, true, 100, true),
// Two shipped results, one success and one failure
- array(true, 100, true, 997, false),
+ array(true, 100, true, 998, false),
// Two shipped results, both failure
- array(true, 997, true, 997, false),
+ array(true, 997, true, 998, false),
// Two third party success results
array(false, 100, false, 100, true),
// Two third party results, one success and one failure
- array(false, 100, false, 997, false),
+ array(false, 100, false, 998, false),
// Two third party results, both failure
- array(false, 997, false, 997, false),
+ array(false, 997, false, 998, false),
// One of each, both success
array(false, 100, true, 100, true),
array(true, 100, false, 100, true),
// One of each, both failure
- array(false, 997, true, 997, false),
+ array(false, 997, true, 998, false),
// One of each, shipped success
array(false, 997, true, 100, true),
// One of each, third party success
- array(false, 100, true, 997, false),
+ array(false, 100, true, 998, false),
);
}
/**
@@ -117,12 +117,25 @@ class Test_API extends PHPUnit_Framework_TestCase {
// Two shipped success results
$result = OC_API::mergeResponses(array(
- $this->buildResponse($shipped1, $data1, $statusCode1),
- $this->buildResponse($shipped2, $data2, $statusCode2),
+ $this->buildResponse($shipped1, $data1, $statusCode1, "message1"),
+ $this->buildResponse($shipped2, $data2, $statusCode2, "message2"),
));
$this->checkResult($result, $succeeded);
$resultData = $result->getData();
+ $resultMeta = $result->getMeta();
+ $resultStatusCode = $result->getStatusCode();
+
$this->assertArrayHasKey('jan', $resultData['users']);
+
+ // check if the returned status message matches the selected status code
+ if ($resultStatusCode === 997) {
+ $this->assertEquals('message1', $resultMeta['message']);
+ } elseif ($resultStatusCode === 998) {
+ $this->assertEquals('message2', $resultMeta['message']);
+ } elseif ($resultStatusCode === 100) {
+ $this->assertEquals(null, $resultMeta['message']);
+ }
+
}
}
diff --git a/tests/lib/files/cache/cache.php b/tests/lib/files/cache/cache.php
index 5ef1ed7ca30..5d876932479 100644
--- a/tests/lib/files/cache/cache.php
+++ b/tests/lib/files/cache/cache.php
@@ -169,9 +169,9 @@ class Cache extends \PHPUnit_Framework_TestCase {
$this->assertEquals(916, $this->cache->calculateFolderSize($file1));
// direct cache entry retrieval returns the original values
- $cacheResult = $this->cache->get($file1);
- $this->assertEquals(1025, $cacheResult['size']);
- $this->assertEquals(916, $cacheResult['unencrypted_size']);
+ $entry = $this->cache->get($file1);
+ $this->assertEquals(1025, $entry['size']);
+ $this->assertEquals(916, $entry['unencrypted_size']);
$this->cache->remove($file2);
$this->cache->remove($file3);
diff --git a/tests/lib/files/cache/scanner.php b/tests/lib/files/cache/scanner.php
index 3f3a045377a..3f5604b4d45 100644
--- a/tests/lib/files/cache/scanner.php
+++ b/tests/lib/files/cache/scanner.php
@@ -147,7 +147,7 @@ class Scanner extends \PHPUnit_Framework_TestCase {
$this->scanner->scan('');
$oldData = $this->cache->get('');
$this->storage->unlink('folder/bar.txt');
- $this->cache->put('folder', array('mtime' => $this->storage->filemtime('folder')));
+ $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']);
diff --git a/tests/lib/files/cache/updater.php b/tests/lib/files/cache/updater.php
index 91e384e12af..48986149a73 100644
--- a/tests/lib/files/cache/updater.php
+++ b/tests/lib/files/cache/updater.php
@@ -88,7 +88,7 @@ class Updater extends \PHPUnit_Framework_TestCase {
public function testWrite() {
$textSize = strlen("dummy file data\n");
$imageSize = filesize(\OC::$SERVERROOT . '/core/img/logo.png');
- $this->cache->put('foo.txt', array('mtime' => 100));
+ $this->cache->put('foo.txt', array('mtime' => 100, 'storage_mtime' => 150));
$rootCachedData = $this->cache->get('');
$this->assertEquals(3 * $textSize + $imageSize, $rootCachedData['size']);
diff --git a/tests/lib/files/view.php b/tests/lib/files/view.php
index 76a7fd5f1ca..72a2f854cb2 100644
--- a/tests/lib/files/view.php
+++ b/tests/lib/files/view.php
@@ -545,4 +545,21 @@ class View extends \PHPUnit_Framework_TestCase {
$this->assertContains($item['name'], $names);
}
}
+
+ public function testTouchNotSupported() {
+ $storage = new TemporaryNoTouch(array());
+ $scanner = $storage->getScanner();
+ \OC\Files\Filesystem::mount($storage, array(), '/test/');
+ $past = time() - 100;
+ $storage->file_put_contents('test', 'foobar');
+ $scanner->scan('');
+ $view = new \OC\Files\View('');
+ $info = $view->getFileInfo('/test/test');
+
+ $view->touch('/test/test', $past);
+ $scanner->scanFile('test', \OC\Files\Cache\Scanner::REUSE_ETAG);
+
+ $info2 = $view->getFileInfo('/test/test');
+ $this->assertEquals($info['etag'], $info2['etag']);
+ }
}
diff --git a/tests/lib/share/share.php b/tests/lib/share/share.php
index 84e2e5c63eb..2fe2837019f 100644
--- a/tests/lib/share/share.php
+++ b/tests/lib/share/share.php
@@ -149,6 +149,26 @@ class Test_Share extends PHPUnit_Framework_TestCase {
);
}
+ protected function shareUserTestFileWithUser($sharer, $receiver) {
+ OC_User::setUserId($sharer);
+ $this->assertTrue(
+ OCP\Share::shareItem('test', 'test.txt', OCP\Share::SHARE_TYPE_USER, $receiver, OCP\PERMISSION_READ | OCP\PERMISSION_SHARE),
+ 'Failed asserting that ' . $sharer . ' successfully shared text.txt with ' . $receiver . '.'
+ );
+ $this->assertContains(
+ 'test.txt',
+ OCP\Share::getItemShared('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'Failed asserting that test.txt is a shared file of ' . $sharer . '.'
+ );
+
+ OC_User::setUserId($receiver);
+ $this->assertContains(
+ 'test.txt',
+ OCP\Share::getItemSharedWith('test', 'test.txt', Test_Share_Backend::FORMAT_SOURCE),
+ 'Failed asserting that ' . $receiver . ' has access to test.txt after initial sharing.'
+ );
+ }
+
public function testShareWithUser() {
// Invalid shares
$message = 'Sharing test.txt failed, because the user '.$this->user1.' is the item owner';
@@ -585,25 +605,55 @@ class Test_Share extends PHPUnit_Framework_TestCase {
}
public function testUnshareAll() {
- $this->shareUserOneTestFileWithUserTwo();
+ $this->shareUserTestFileWithUser($this->user1, $this->user2);
+ $this->shareUserTestFileWithUser($this->user2, $this->user3);
+ $this->shareUserTestFileWithUser($this->user3, $this->user4);
$this->shareUserOneTestFileWithGroupOne();
OC_User::setUserId($this->user1);
$this->assertEquals(
array('test.txt', 'test.txt'),
OCP\Share::getItemsShared('test', 'test.txt'),
- 'Failed asserting that the test.txt file is shared exactly two times.'
+ 'Failed asserting that the test.txt file is shared exactly two times by user1.'
+ );
+
+ OC_User::setUserId($this->user2);
+ $this->assertEquals(
+ array('test.txt'),
+ OCP\Share::getItemsShared('test', 'test.txt'),
+ 'Failed asserting that the test.txt file is shared exactly once by user2.'
+ );
+
+ OC_User::setUserId($this->user3);
+ $this->assertEquals(
+ array('test.txt'),
+ OCP\Share::getItemsShared('test', 'test.txt'),
+ 'Failed asserting that the test.txt file is shared exactly once by user3.'
);
$this->assertTrue(
OCP\Share::unshareAll('test', 'test.txt'),
- 'Failed asserting that user 1 successfully unshared all shares of the test.txt share.'
+ 'Failed asserting that user 3 successfully unshared all shares of the test.txt share.'
);
$this->assertEquals(
array(),
OCP\Share::getItemsShared('test'),
- 'Failed asserting that both shares of the test.txt file have been removed.'
+ 'Failed asserting that the share of the test.txt file by user 3 has been removed.'
+ );
+
+ OC_User::setUserId($this->user1);
+ $this->assertEquals(
+ array(),
+ OCP\Share::getItemsShared('test'),
+ 'Failed asserting that both shares of the test.txt file by user 1 have been removed.'
+ );
+
+ OC_User::setUserId($this->user2);
+ $this->assertEquals(
+ array(),
+ OCP\Share::getItemsShared('test'),
+ 'Failed asserting that the share of the test.txt file by user 2 has been removed.'
);
}
}