summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--apps/files/js/filelist.js14
-rw-r--r--build/integration/features/bootstrap/BasicStructure.php9
-rw-r--r--build/integration/features/provisioning-v1.feature23
-rw-r--r--console.php10
-rw-r--r--core/css/styles.css8
-rw-r--r--core/js/files/client.js7
-rw-r--r--core/js/files/fileinfo.js7
-rw-r--r--core/js/oc-dialogs.js14
-rw-r--r--core/templates/filepicker.html4
-rw-r--r--index.php3
-rw-r--r--lib/base.php4
-rw-r--r--lib/private/App/DependencyAnalyzer.php3
-rw-r--r--lib/private/legacy/app.php39
-rw-r--r--lib/private/legacy/helper.php14
-rw-r--r--lib/private/legacy/response.php1
-rw-r--r--lib/private/legacy/util.php18
-rw-r--r--tests/lib/App/DependencyAnalyzerTest.php56
17 files changed, 149 insertions, 85 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index d932c06d853..e728a816cc0 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -1521,13 +1521,15 @@
var comparator = FileList.Comparators[sort] || FileList.Comparators.name;
this._sort = sort;
this._sortDirection = (direction === 'desc')?'desc':'asc';
- this._sortComparator = comparator;
+ this._sortComparator = function(fileInfo1, fileInfo2) {
+ if(fileInfo1.isFavorite && !fileInfo2.isFavorite) {
+ return -1;
+ } else if(!fileInfo1.isFavorite && fileInfo2.isFavorite) {
+ return 1;
+ }
+ return direction === 'asc' ? comparator(fileInfo1, fileInfo2) : -comparator(fileInfo1, fileInfo2);
+ };
- if (direction === 'desc') {
- this._sortComparator = function(fileInfo1, fileInfo2) {
- return -comparator(fileInfo1, fileInfo2);
- };
- }
this.$el.find('thead th .sort-indicator')
.removeClass(this.SORT_INDICATOR_ASC_CLASS)
.removeClass(this.SORT_INDICATOR_DESC_CLASS)
diff --git a/build/integration/features/bootstrap/BasicStructure.php b/build/integration/features/bootstrap/BasicStructure.php
index a8438927731..2fc940981eb 100644
--- a/build/integration/features/bootstrap/BasicStructure.php
+++ b/build/integration/features/bootstrap/BasicStructure.php
@@ -179,6 +179,15 @@ trait BasicStructure {
}
}
+ /**
+ * @When /^sending "([^"]*)" with exact url to "([^"]*)"$/
+ * @param string $verb
+ * @param string $url
+ */
+ public function sendingToDirectUrl($verb, $url) {
+ $this->sendingToWithDirectUrl($verb, $url, null);
+ }
+
public function sendingToWithDirectUrl($verb, $url, $body) {
$fullUrl = substr($this->baseUrl, 0, -5) . $url;
$client = new Client();
diff --git a/build/integration/features/provisioning-v1.feature b/build/integration/features/provisioning-v1.feature
index fba69cd6225..98bf321dc64 100644
--- a/build/integration/features/provisioning-v1.feature
+++ b/build/integration/features/provisioning-v1.feature
@@ -497,16 +497,23 @@ Feature: provisioning
And As an "admin"
And user "subadmin" is disabled
- Scenario: Making a web request with an enabled user
- Given As an "admin"
+ Scenario: Making a ocs request with an enabled user
+ Given As an "admin"
And user "user0" exists
And As an "user0"
When sending "GET" to "/cloud/capabilities"
Then the HTTP status code should be "200"
And the OCS status code should be "100"
- Scenario: Making a web request with a disabled user
- Given As an "admin"
+ Scenario: Making a web request with an enabled user
+ Given As an "admin"
+ And user "user0" exists
+ And As an "user0"
+ When sending "GET" with exact url to "/index.php/apps/files"
+ Then the HTTP status code should be "200"
+
+ Scenario: Making a ocs request with a disabled user
+ Given As an "admin"
And user "user0" exists
And assure user "user0" is disabled
And As an "user0"
@@ -514,3 +521,11 @@ Feature: provisioning
Then the OCS status code should be "997"
And the HTTP status code should be "401"
+ Scenario: Making a web request with a disabled user
+ Given As an "admin"
+ And user "user0" exists
+ And assure user "user0" is disabled
+ And As an "user0"
+ When sending "GET" with exact url to "/index.php/apps/files"
+ And the HTTP status code should be "403"
+
diff --git a/console.php b/console.php
index c9a9a49c4e9..c368a28cac0 100644
--- a/console.php
+++ b/console.php
@@ -31,10 +31,10 @@ use Symfony\Component\Console\Output\ConsoleOutput;
define('OC_CONSOLE', 1);
-// Show warning if a PHP version below 5.4.0 is used, this has to happen here
-// because base.php will already use 5.4 syntax.
-if (version_compare(PHP_VERSION, '5.4.0') === -1) {
- echo 'This version of ownCloud requires at least PHP 5.4.0'.PHP_EOL;
+// Show warning if a PHP version below 5.6.0 is used, this has to happen here
+// because base.php will already use 5.6 syntax.
+if (version_compare(PHP_VERSION, '5.6.0') === -1) {
+ echo 'This version of Nextcloud requires at least PHP 5.6.0'.PHP_EOL;
echo 'You are currently running ' . PHP_VERSION . '. Please update your PHP version.'.PHP_EOL;
return;
}
@@ -67,7 +67,7 @@ try {
echo "Console has to be executed with the user that owns the file config/config.php" . PHP_EOL;
echo "Current user: " . $user['name'] . PHP_EOL;
echo "Owner of config.php: " . $configUser['name'] . PHP_EOL;
- echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
+ echo "Try adding 'sudo -u " . $configUser['name'] . " ' to the beginning of the command (without the single quotes)" . PHP_EOL;
exit(1);
}
diff --git a/core/css/styles.css b/core/css/styles.css
index 94e60562ad8..d94a31c4cf1 100644
--- a/core/css/styles.css
+++ b/core/css/styles.css
@@ -782,6 +782,14 @@ a.bookmarklet { background-color:#ddd; border:1px solid #ccc; padding:5px;paddin
width: 100%;
padding-bottom: 55px;
}
+
+#oc-dialog-filepicker-content .emptycontent {
+ color: #888;
+ text-align: center;
+ margin-top: 80px;
+ width: 100%;
+ display: none;
+}
#oc-dialog-filepicker-content .filelist {
background-color:white;
width:100%;
diff --git a/core/js/files/client.js b/core/js/files/client.js
index 43743fb2d8c..fdc51c4a197 100644
--- a/core/js/files/client.js
+++ b/core/js/files/client.js
@@ -287,6 +287,13 @@
data.hasPreview = true;
}
+ var isFavorite = props['{' + Client.NS_OWNCLOUD + '}favorite'];
+ if (!_.isUndefined(isFavorite)) {
+ data.isFavorite = isFavorite === '1';
+ } else {
+ data.isFavorite = false;
+ }
+
var contentType = props['{' + Client.NS_DAV + '}getcontenttype'];
if (!_.isUndefined(contentType)) {
data.mimetype = contentType;
diff --git a/core/js/files/fileinfo.js b/core/js/files/fileinfo.js
index 1fc239da47a..7c8e4586448 100644
--- a/core/js/files/fileinfo.js
+++ b/core/js/files/fileinfo.js
@@ -132,7 +132,12 @@
/**
* @type boolean
*/
- hasPreview: true
+ hasPreview: true,
+
+ /**
+ * @type boolean
+ */
+ isFavorite: false
};
if (!OC.Files) {
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 7a7876bf30f..5a5bdc33d5d 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -157,7 +157,8 @@ var OCdialogs = {
}
self.$filePicker = $tmpl.octemplate({
dialog_name: dialogName,
- title: title
+ title: title,
+ emptytext: t('core', 'No files in here')
}).data('path', '').data('multiselect', multiselect).data('mimetype', mimetypeFilter);
if (modal === undefined) {
@@ -193,7 +194,10 @@ var OCdialogs = {
});
} else {
datapath = self.$filePicker.data('path');
- datapath += '/' + self.$filelist.find('tr.filepicker_element_selected').data('entryname');
+ var selectedName = self.$filelist.find('tr.filepicker_element_selected').data('entryname');
+ if (selectedName) {
+ datapath += '/' + selectedName;
+ }
}
callback(datapath);
self.$filePicker.ocdialog('close');
@@ -771,6 +775,12 @@ var OCdialogs = {
self._fillSlug();
+ if (files.length === 0) {
+ self.$filePicker.find('.emptycontent').show();
+ } else {
+ self.$filePicker.find('.emptycontent').hide();
+ }
+
$.each(files, function(idx, entry) {
entry.icon = OC.MimeType.getIconUrl(entry.mimetype);
if (typeof(entry.size) !== 'undefined' && entry.size >= 0) {
diff --git a/core/templates/filepicker.html b/core/templates/filepicker.html
index b665ca26893..215311348cb 100644
--- a/core/templates/filepicker.html
+++ b/core/templates/filepicker.html
@@ -1,6 +1,10 @@
<div id="{dialog_name}" title="{title}">
<span class="dirtree breadcrumb"></span>
<div class="filelist-container">
+ <div class="emptycontent">
+ <div class="icon-folder"></div>
+ <h2>{emptytext}</h2>
+ </div>
<table id="filestable" class="filelist">
<tbody>
<tr data-entryname="{filename}" data-type="{type}">
diff --git a/index.php b/index.php
index ce4cdf06e7e..cd95b0c7965 100644
--- a/index.php
+++ b/index.php
@@ -48,6 +48,9 @@ try {
} catch (\OC\HintException $ex) {
OC_Response::setStatus(OC_Response::STATUS_SERVICE_UNAVAILABLE);
OC_Template::printErrorPage($ex->getMessage(), $ex->getHint());
+} catch (\OC\User\LoginException $ex) {
+ OC_Response::setStatus(OC_Response::STATUS_FORBIDDEN);
+ OC_Template::printErrorPage($ex->getMessage(), $ex->getMessage());
} catch (Exception $ex) {
\OC::$server->getLogger()->logException($ex, array('app' => 'index'));
diff --git a/lib/base.php b/lib/base.php
index 0c4acab8fd2..883c1f54b17 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -625,7 +625,9 @@ class OC {
@ini_set('display_errors', 0);
@ini_set('log_errors', 1);
- date_default_timezone_set('UTC');
+ if(!date_default_timezone_set('UTC')) {
+ throw new \RuntimeException('Could not set timezone to UTC');
+ };
//try to configure php to enable big file uploads.
//this doesn´t work always depending on the webserver and php configuration.
diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php
index 7b48e81f3eb..67268981e99 100644
--- a/lib/private/App/DependencyAnalyzer.php
+++ b/lib/private/App/DependencyAnalyzer.php
@@ -227,6 +227,9 @@ class DependencyAnalyzer {
if (!is_array($libs)) {
$libs = array($libs);
}
+ if (isset($libs['@value'])) {
+ $libs = [$libs];
+ }
foreach ($libs as $lib) {
$libName = $this->getValue($lib);
$libVersion = $this->platform->getLibraryVersion($libName);
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php
index 5e05884f5c0..d25534aa822 100644
--- a/lib/private/legacy/app.php
+++ b/lib/private/legacy/app.php
@@ -334,9 +334,16 @@ class OC_App {
* This function set an app as enabled in appconfig.
*/
public static function enable($app, $groups = null) {
- self::$enabledAppsCache = array(); // flush
+ self::$enabledAppsCache = []; // flush
if (!Installer::isInstalled($app)) {
$app = self::installApp($app);
+ } else {
+ // check for required dependencies
+ $config = \OC::$server->getConfig();
+ $l = \OC::$server->getL10N('core');
+ $info = self::getAppInfo($app);
+
+ self::checkAppDependencies($config, $l, $info);
}
$appManager = \OC::$server->getAppManager();
@@ -1186,16 +1193,7 @@ class OC_App {
}
// check for required dependencies
- $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
- $missing = $dependencyAnalyzer->analyze($info);
- if (!empty($missing)) {
- $missingMsg = join(PHP_EOL, $missing);
- throw new \Exception(
- $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s',
- array($info['name'], $missingMsg)
- )
- );
- }
+ self::checkAppDependencies($config, $l, $info);
$config->setAppValue($app, 'enabled', 'yes');
if (isset($appData['id'])) {
@@ -1438,4 +1436,23 @@ class OC_App {
return $data;
}
+
+ /**
+ * @param $config
+ * @param $l
+ * @param $info
+ * @throws Exception
+ */
+ protected static function checkAppDependencies($config, $l, $info) {
+ $dependencyAnalyzer = new DependencyAnalyzer(new Platform($config), $l);
+ $missing = $dependencyAnalyzer->analyze($info);
+ if (!empty($missing)) {
+ $missingMsg = join(PHP_EOL, $missing);
+ throw new \Exception(
+ $l->t('App "%s" cannot be installed because the following dependencies are not fulfilled: %s',
+ [$info['name'], $missingMsg]
+ )
+ );
+ }
+ }
}
diff --git a/lib/private/legacy/helper.php b/lib/private/legacy/helper.php
index 65b4c0d8afe..9c4bc895fb9 100644
--- a/lib/private/legacy/helper.php
+++ b/lib/private/legacy/helper.php
@@ -254,16 +254,9 @@ class OC_Helper {
if ($path === false) {
$path = getenv("PATH");
}
- // check method depends on operating system
- if (!strncmp(PHP_OS, "WIN", 3)) {
- // on Windows an appropriate COM or EXE file needs to exist
- $exts = array(".exe", ".com");
- $check_fn = "file_exists";
- } else {
- // anywhere else we look for an executable file of that name
- $exts = array("");
- $check_fn = "is_executable";
- }
+ // we look for an executable file of that name
+ $exts = [""];
+ $check_fn = "is_executable";
// Default check will be done with $path directories :
$dirs = explode(PATH_SEPARATOR, $path);
// WARNING : We have to check if open_basedir is enabled :
@@ -498,7 +491,6 @@ class OC_Helper {
/**
* Try to find a program
- * Note: currently windows is not supported
*
* @param string $program
* @return null|string
diff --git a/lib/private/legacy/response.php b/lib/private/legacy/response.php
index 0ec27251ba5..88725d5e30b 100644
--- a/lib/private/legacy/response.php
+++ b/lib/private/legacy/response.php
@@ -33,6 +33,7 @@ class OC_Response {
const STATUS_NOT_MODIFIED = 304;
const STATUS_TEMPORARY_REDIRECT = 307;
const STATUS_BAD_REQUEST = 400;
+ const STATUS_FORBIDDEN = 403;
const STATUS_NOT_FOUND = 404;
const STATUS_INTERNAL_SERVER_ERROR = 500;
const STATUS_SERVICE_UNAVAILABLE = 503;
diff --git a/lib/private/legacy/util.php b/lib/private/legacy/util.php
index b6c3b375396..42fd0ba7db3 100644
--- a/lib/private/legacy/util.php
+++ b/lib/private/legacy/util.php
@@ -667,15 +667,6 @@ class OC_Util {
$webServerRestart = true;
}
- // Check if server running on Windows platform
- if(OC_Util::runningOnWindows()) {
- $errors[] = [
- 'error' => $l->t('Microsoft Windows Platform is not supported'),
- 'hint' => $l->t('Running Nextcloud Server on the Microsoft Windows platform is not supported. We suggest you ' .
- 'use a Linux server in a virtual machine if you have no option for migrating the server itself.')
- ];
- }
-
// Check if config folder is writable.
if(!OC_Helper::isReadOnlyConfigEnabled()) {
if (!is_writable(OC::$configDir) or !is_readable(OC::$configDir)) {
@@ -1268,15 +1259,6 @@ class OC_Util {
}
/**
- * Checks whether the server is running on Windows
- *
- * @return bool true if running on Windows, false otherwise
- */
- public static function runningOnWindows() {
- return (substr(PHP_OS, 0, 3) === "WIN");
- }
-
- /**
* Checks whether the server is running on Mac OS X
*
* @return bool true if running on Mac OS X, false otherwise
diff --git a/tests/lib/App/DependencyAnalyzerTest.php b/tests/lib/App/DependencyAnalyzerTest.php
index 091479798b3..c41829b796b 100644
--- a/tests/lib/App/DependencyAnalyzerTest.php
+++ b/tests/lib/App/DependencyAnalyzerTest.php
@@ -9,7 +9,7 @@
namespace Test\App;
-use OC;
+use OC\App\DependencyAnalyzer;
use OC\App\Platform;
use OCP\IL10N;
use Test\TestCase;
@@ -22,11 +22,11 @@ class DependencyAnalyzerTest extends TestCase {
/** @var IL10N */
private $l10nMock;
- /** @var \OC\App\DependencyAnalyzer */
+ /** @var DependencyAnalyzer */
private $analyser;
public function setUp() {
- $this->platformMock = $this->getMockBuilder('\OC\App\Platform')
+ $this->platformMock = $this->getMockBuilder(Platform::class)
->disableOriginalConstructor()
->getMock();
$this->platformMock->expects($this->any())
@@ -67,7 +67,7 @@ class DependencyAnalyzerTest extends TestCase {
return vsprintf($text, $parameters);
}));
- $this->analyser = new \OC\App\DependencyAnalyzer($this->platformMock, $this->l10nMock);
+ $this->analyser = new DependencyAnalyzer($this->platformMock, $this->l10nMock);
}
/**
@@ -101,12 +101,14 @@ class DependencyAnalyzerTest extends TestCase {
/**
* @dataProvider providesDatabases
+ * @param $expectedMissing
+ * @param $databases
*/
public function testDatabases($expectedMissing, $databases) {
- $app = array(
- 'dependencies' => array(
- )
- );
+ $app = [
+ 'dependencies' => [
+ ]
+ ];
if (!is_null($databases)) {
$app['dependencies']['database'] = $databases;
}
@@ -228,28 +230,30 @@ class DependencyAnalyzerTest extends TestCase {
* @return array
*/
function providesLibs() {
- return array(
+ return [
// we expect curl to exist
- array(array(), 'curl'),
+ [[], 'curl'],
// we expect abcde to exist
- array(array('The library abcde is not available.'), array('abcde')),
+ [['The library abcde is not available.'], ['abcde']],
// curl in version 100.0 does not exist
- array(array('Library curl with a version higher than 100.0 is required - available version 2.3.4.'),
- array(array('@attributes' => array('min-version' => '100.0'), '@value' => 'curl'))),
+ [['Library curl with a version higher than 100.0 is required - available version 2.3.4.'],
+ [['@attributes' => ['min-version' => '100.0'], '@value' => 'curl']]],
// curl in version 100.0 does not exist
- array(array('Library curl with a version lower than 1.0.0 is required - available version 2.3.4.'),
- array(array('@attributes' => array('max-version' => '1.0.0'), '@value' => 'curl'))),
- array(array('Library curl with a version lower than 2.3.3 is required - available version 2.3.4.'),
- array(array('@attributes' => array('max-version' => '2.3.3'), '@value' => 'curl'))),
- array(array('Library curl with a version higher than 2.3.5 is required - available version 2.3.4.'),
- array(array('@attributes' => array('min-version' => '2.3.5'), '@value' => 'curl'))),
- array(array(),
- array(array('@attributes' => array('min-version' => '2.3.4', 'max-version' => '2.3.4'), '@value' => 'curl'))),
- array(array(),
- array(array('@attributes' => array('min-version' => '2.3', 'max-version' => '2.3'), '@value' => 'curl'))),
- array(array(),
- array(array('@attributes' => array('min-version' => '2', 'max-version' => '2'), '@value' => 'curl'))),
- );
+ [['Library curl with a version lower than 1.0.0 is required - available version 2.3.4.'],
+ [['@attributes' => ['max-version' => '1.0.0'], '@value' => 'curl']]],
+ [['Library curl with a version lower than 2.3.3 is required - available version 2.3.4.'],
+ [['@attributes' => ['max-version' => '2.3.3'], '@value' => 'curl']]],
+ [['Library curl with a version higher than 2.3.5 is required - available version 2.3.4.'],
+ [['@attributes' => ['min-version' => '2.3.5'], '@value' => 'curl']]],
+ [[],
+ [['@attributes' => ['min-version' => '2.3.4', 'max-version' => '2.3.4'], '@value' => 'curl']]],
+ [[],
+ [['@attributes' => ['min-version' => '2.3', 'max-version' => '2.3'], '@value' => 'curl']]],
+ [[],
+ [['@attributes' => ['min-version' => '2', 'max-version' => '2'], '@value' => 'curl']]],
+ [[],
+ ['@attributes' => ['min-version' => '2', 'max-version' => '2'], '@value' => 'curl']],
+ ];
}
/**