Browse Source

Fix comparisons in the dav app

Signed-off-by: Joas Schilling <coding@schilljs.com>
tags/v13.0.0beta1
Joas Schilling 7 years ago
parent
commit
89238164e1

+ 1
- 1
apps/dav/lib/CalDAV/CalDavBackend.php View File

@@ -1158,7 +1158,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$requirePostFilter = false;
}
// There was a time-range filter
if ($componentType == 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) {
if ($componentType === 'VEVENT' && isset($filters['comp-filters'][0]['time-range'])) {
$timeRange = $filters['comp-filters'][0]['time-range'];

// If start time OR the end time is not specified, we can do a

+ 2
- 2
apps/dav/lib/CalDAV/Search/SearchPlugin.php View File

@@ -134,7 +134,7 @@ class SearchPlugin extends ServerPlugin {

// If we're dealing with the calendar home, the calendar home itself is
// responsible for the calendar-query
if ($node instanceof CalendarHome && $depth == 2) {
if ($node instanceof CalendarHome && $depth === 2) {

$nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset);

@@ -156,4 +156,4 @@ class SearchPlugin extends ServerPlugin {
$this->server->generateMultiStatus($result,
$prefer['return'] === 'minimal'));
}
}
}

+ 1
- 1
apps/dav/lib/CardDAV/CardDavBackend.php View File

@@ -1019,7 +1019,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
}
$preferred = 0;
foreach($property->parameters as $parameter) {
if ($parameter->name == 'TYPE' && strtoupper($parameter->getValue()) == 'PREF') {
if ($parameter->name === 'TYPE' && strtoupper($parameter->getValue()) === 'PREF') {
$preferred = 1;
break;
}

+ 1
- 1
apps/dav/lib/Connector/Sabre/Directory.php View File

@@ -225,7 +225,7 @@ class Directory extends \OCA\DAV\Connector\Sabre\Node
throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located');
}

if ($info['mimetype'] == 'httpd/unix-directory') {
if ($info['mimetype'] === 'httpd/unix-directory') {
$node = new \OCA\DAV\Connector\Sabre\Directory($this->fileView, $info, $this->tree, $this->shareManager);
} else {
$node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info, $this->shareManager);

+ 2
- 2
apps/dav/lib/Connector/Sabre/File.php View File

@@ -147,7 +147,7 @@ class File extends Node implements IFile {
// compare expected and actual size
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
$expected = $_SERVER['CONTENT_LENGTH'];
if ($count != $expected) {
if ($count !== $expected) {
throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
}
}
@@ -410,7 +410,7 @@ class File extends Node implements IFile {
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
if ($bytesWritten != $expected) {
if ($bytesWritten !== $expected) {
$chunk_handler->remove($info['index']);
throw new BadRequest(
'expected filesize ' . $expected . ' got ' . $bytesWritten);

+ 1
- 1
apps/dav/lib/Connector/Sabre/ObjectTree.php View File

@@ -81,7 +81,7 @@ class ObjectTree extends \Sabre\DAV\Tree {
if (isset($_SERVER['HTTP_OC_CHUNKED'])) {
// resolve to real file name to find the proper node
list($dir, $name) = \Sabre\Uri\split($path);
if ($dir == '/' || $dir == '.') {
if ($dir === '/' || $dir === '.') {
$dir = '';
}


+ 1
- 1
apps/dav/lib/DAV/Sharing/Backend.php View File

@@ -170,7 +170,7 @@ class Backend {
'href' => "principal:${row['principaluri']}",
'commonName' => isset($p['{DAV:}displayname']) ? $p['{DAV:}displayname'] : '',
'status' => 1,
'readOnly' => ($row['access'] == self::ACCESS_READ),
'readOnly' => ((int) $row['access'] === self::ACCESS_READ),
'{http://owncloud.org/ns}principal' => $row['principaluri'],
'{http://owncloud.org/ns}group-share' => is_null($p)
];

Loading…
Cancel
Save