Fix comparisons in the sharing app

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-05-10 14:16:22 +02:00 committed by Morris Jobke
parent 7a62fbd205
commit 80febeae21
5 changed files with 10 additions and 10 deletions

View File

@ -514,7 +514,7 @@ class ShareController extends Controller {
$this->emitAccessShareHook($share);
$server_params = array( 'head' => $this->request->getMethod() == 'HEAD' );
$server_params = array( 'head' => $this->request->getMethod() === 'HEAD' );
/**
* Http range requests support

View File

@ -132,7 +132,7 @@ class Helper {
Filesystem::initMountPoints($owner);
$info = Filesystem::getFileInfo($target);
$ownerView = new View('/'.$owner.'/files');
if ( $owner != User::getUser() ) {
if ( $owner !== User::getUser() ) {
$path = $ownerView->getPath($info['fileid']);
} else {
$path = $target;
@ -183,7 +183,7 @@ class Helper {
$uid = User::getUser();
}
Filesystem::initMountPoints($uid);
if ( $uid != User::getUser() ) {
if ( $uid !== User::getUser() ) {
$info = Filesystem::getFileInfo($filename);
$ownerView = new View('/'.$uid.'/files');
try {

View File

@ -123,7 +123,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
}
public function formatItems($items, $format, $parameters = null) {
if ($format == self::FORMAT_SHARED_STORAGE) {
if ($format === self::FORMAT_SHARED_STORAGE) {
// Only 1 item should come through for this format call
$item = array_shift($items);
return array(
@ -133,7 +133,7 @@ class File implements \OCP\Share_Backend_File_Dependent {
'permissions' => $item['permissions'],
'uid_owner' => $item['uid_owner'],
);
} else if ($format == self::FORMAT_GET_FOLDER_CONTENTS) {
} else if ($format === self::FORMAT_GET_FOLDER_CONTENTS) {
$files = array();
foreach ($items as $item) {
$file = array();
@ -156,13 +156,13 @@ class File implements \OCP\Share_Backend_File_Dependent {
$files[] = $file;
}
return $files;
} else if ($format == self::FORMAT_OPENDIR) {
} else if ($format === self::FORMAT_OPENDIR) {
$files = array();
foreach ($items as $item) {
$files[] = basename($item['file_target']);
}
return $files;
} else if ($format == self::FORMAT_GET_ALL) {
} else if ($format === self::FORMAT_GET_ALL) {
$ids = array();
foreach ($items as $item) {
$ids[] = $item['file_source'];

View File

@ -83,7 +83,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
$query = \OCP\DB::prepare('SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = ?');
$result = $query->execute(array('httpd/unix-directory'));
if ($row = $result->fetchRow()) {
$mimetype = $row['id'];
$mimetype = (int) $row['id'];
} else {
$mimetype = -1;
}
@ -96,7 +96,7 @@ class Folder extends File implements \OCP\Share_Backend_Collection {
while ($file = $result->fetchRow()) {
$children[] = array('source' => $file['fileid'], 'file_path' => $file['name']);
// If a child folder is found look inside it
if ($file['mimetype'] == $mimetype) {
if ((int) $file['mimetype'] === $mimetype) {
$parents[] = $file['fileid'];
}
}

View File

@ -75,7 +75,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
<?php if (isset($_['folder'])): ?>
<?php print_unescaped($_['folder']); ?>
<?php else: ?>
<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) == 'video'): ?>
<?php if ($_['previewEnabled'] && substr($_['mimetype'], 0, strpos($_['mimetype'], '/')) === 'video'): ?>
<div id="imgframe">
<video tabindex="0" controls="" preload="none" style="max-width: <?php p($_['previewMaxX']); ?>px; max-height: <?php p($_['previewMaxY']); ?>px">
<source src="<?php p($_['downloadURL']); ?>" type="<?php p($_['mimetype']); ?>" />