Fix comparisons in the files external app
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
e30287cf81
commit
7a62fbd205
|
@ -46,8 +46,8 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
|
||||||
$client->setApprovalPrompt('force');
|
$client->setApprovalPrompt('force');
|
||||||
$client->setAccessType('offline');
|
$client->setAccessType('offline');
|
||||||
if (isset($_POST['step'])) {
|
if (isset($_POST['step'])) {
|
||||||
$step = $_POST['step'];
|
$step = (int) $_POST['step'];
|
||||||
if ($step == 1) {
|
if ($step === 1) {
|
||||||
try {
|
try {
|
||||||
$authUrl = $client->createAuthUrl();
|
$authUrl = $client->createAuthUrl();
|
||||||
OCP\JSON::success(array('data' => array(
|
OCP\JSON::success(array('data' => array(
|
||||||
|
@ -58,7 +58,7 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST
|
||||||
'message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage()))
|
'message' => $l->t('Step 1 failed. Exception: %s', array($exception->getMessage()))
|
||||||
)));
|
)));
|
||||||
}
|
}
|
||||||
} else if ($step == 2 && isset($_POST['code'])) {
|
} else if ($step === 2 && isset($_POST['code'])) {
|
||||||
try {
|
try {
|
||||||
$token = $client->authenticate((string)$_POST['code']);
|
$token = $client->authenticate((string)$_POST['code']);
|
||||||
OCP\JSON::success(array('data' => array(
|
OCP\JSON::success(array('data' => array(
|
||||||
|
|
|
@ -161,8 +161,8 @@ class Import extends Base {
|
||||||
if (
|
if (
|
||||||
$existingMount->getMountPoint() === $mount->getMountPoint() &&
|
$existingMount->getMountPoint() === $mount->getMountPoint() &&
|
||||||
$existingMount->getApplicableGroups() === $mount->getApplicableGroups() &&
|
$existingMount->getApplicableGroups() === $mount->getApplicableGroups() &&
|
||||||
$existingMount->getApplicableUsers() == $mount->getApplicableUsers() &&
|
$existingMount->getApplicableUsers() === $mount->getApplicableUsers() &&
|
||||||
$existingMount->getBackendOptions() == $mount->getBackendOptions()
|
$existingMount->getBackendOptions() === $mount->getBackendOptions()
|
||||||
) {
|
) {
|
||||||
$output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>");
|
$output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>");
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -47,7 +47,7 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||||
private $oauth;
|
private $oauth;
|
||||||
|
|
||||||
public function __construct($params) {
|
public function __construct($params) {
|
||||||
if (isset($params['configured']) && $params['configured'] == 'true'
|
if (isset($params['configured']) && $params['configured'] === 'true'
|
||||||
&& isset($params['app_key'])
|
&& isset($params['app_key'])
|
||||||
&& isset($params['app_secret'])
|
&& isset($params['app_secret'])
|
||||||
&& isset($params['token'])
|
&& isset($params['token'])
|
||||||
|
@ -187,12 +187,12 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function filetype($path) {
|
public function filetype($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path === '' || $path === '/') {
|
||||||
return 'dir';
|
return 'dir';
|
||||||
} else {
|
} else {
|
||||||
$metaData = $this->getDropBoxMetaData($path);
|
$metaData = $this->getDropBoxMetaData($path);
|
||||||
if ($metaData) {
|
if ($metaData) {
|
||||||
if ($metaData['is_dir'] == 'true') {
|
if ($metaData['is_dir'] === 'true') {
|
||||||
return 'dir';
|
return 'dir';
|
||||||
} else {
|
} else {
|
||||||
return 'file';
|
return 'file';
|
||||||
|
@ -203,7 +203,7 @@ class Dropbox extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function file_exists($path) {
|
public function file_exists($path) {
|
||||||
if ($path == '' || $path == '/') {
|
if ($path === '' || $path === '/') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if ($this->getDropBoxMetaData($path)) {
|
if ($this->getDropBoxMetaData($path)) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ class FTP extends StreamWrapper{
|
||||||
$this->secure = false;
|
$this->secure = false;
|
||||||
}
|
}
|
||||||
$this->root=isset($params['root'])?$params['root']:'/';
|
$this->root=isset($params['root'])?$params['root']:'/';
|
||||||
if ( ! $this->root || $this->root[0]!='/') {
|
if ( ! $this->root || $this->root[0]!=='/') {
|
||||||
$this->root='/'.$this->root;
|
$this->root='/'.$this->root;
|
||||||
}
|
}
|
||||||
if (substr($this->root, -1) !== '/') {
|
if (substr($this->root, -1) !== '/') {
|
||||||
|
|
|
@ -40,10 +40,10 @@ class OwnCloud extends \OC\Files\Storage\DAV{
|
||||||
// (owncloud install path on host)
|
// (owncloud install path on host)
|
||||||
$host = $params['host'];
|
$host = $params['host'];
|
||||||
// strip protocol
|
// strip protocol
|
||||||
if (substr($host, 0, 8) == "https://") {
|
if (substr($host, 0, 8) === "https://") {
|
||||||
$host = substr($host, 8);
|
$host = substr($host, 8);
|
||||||
$params['secure'] = true;
|
$params['secure'] = true;
|
||||||
} else if (substr($host, 0, 7) == "http://") {
|
} else if (substr($host, 0, 7) === "http://") {
|
||||||
$host = substr($host, 7);
|
$host = substr($host, 7);
|
||||||
$params['secure'] = false;
|
$params['secure'] = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,11 +102,11 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
$this->root
|
$this->root
|
||||||
= isset($params['root']) ? $this->cleanPath($params['root']) : '/';
|
= isset($params['root']) ? $this->cleanPath($params['root']) : '/';
|
||||||
|
|
||||||
if ($this->root[0] != '/') {
|
if ($this->root[0] !== '/') {
|
||||||
$this->root = '/' . $this->root;
|
$this->root = '/' . $this->root;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (substr($this->root, -1, 1) != '/') {
|
if (substr($this->root, -1, 1) !== '/') {
|
||||||
$this->root .= '/';
|
$this->root .= '/';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
// The SSH Host Key MUST be verified before login().
|
// The SSH Host Key MUST be verified before login().
|
||||||
$currentHostKey = $this->client->getServerPublicHostKey();
|
$currentHostKey = $this->client->getServerPublicHostKey();
|
||||||
if (array_key_exists($this->host, $hostKeys)) {
|
if (array_key_exists($this->host, $hostKeys)) {
|
||||||
if ($hostKeys[$this->host] != $currentHostKey) {
|
if ($hostKeys[$this->host] !== $currentHostKey) {
|
||||||
throw new \Exception('Host public key does not match known key');
|
throw new \Exception('Host public key does not match known key');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -248,7 +248,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
if ($lines) {
|
if ($lines) {
|
||||||
foreach ($lines as $line) {
|
foreach ($lines as $line) {
|
||||||
$hostKeyArray = explode("::", $line, 2);
|
$hostKeyArray = explode("::", $line, 2);
|
||||||
if (count($hostKeyArray) == 2) {
|
if (count($hostKeyArray) === 2) {
|
||||||
$hosts[] = $hostKeyArray[0];
|
$hosts[] = $hostKeyArray[0];
|
||||||
$keys[] = $hostKeyArray[1];
|
$keys[] = $hostKeyArray[1];
|
||||||
}
|
}
|
||||||
|
@ -300,7 +300,7 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
$id = md5('sftp:' . $path);
|
$id = md5('sftp:' . $path);
|
||||||
$dirStream = array();
|
$dirStream = array();
|
||||||
foreach($list as $file) {
|
foreach($list as $file) {
|
||||||
if ($file != '.' && $file != '..') {
|
if ($file !== '.' && $file !== '..') {
|
||||||
$dirStream[] = $file;
|
$dirStream[] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,11 +316,11 @@ class SFTP extends \OC\Files\Storage\Common {
|
||||||
public function filetype($path) {
|
public function filetype($path) {
|
||||||
try {
|
try {
|
||||||
$stat = $this->getConnection()->stat($this->absPath($path));
|
$stat = $this->getConnection()->stat($this->absPath($path));
|
||||||
if ($stat['type'] == NET_SFTP_TYPE_REGULAR) {
|
if ((int) $stat['type'] === NET_SFTP_TYPE_REGULAR) {
|
||||||
return 'file';
|
return 'file';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
|
if ((int) $stat['type'] === NET_SFTP_TYPE_DIRECTORY) {
|
||||||
return 'dir';
|
return 'dir';
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -81,10 +81,10 @@ class SMB extends Common implements INotifyStorage {
|
||||||
$this->share = $this->server->getShare(trim($params['share'], '/'));
|
$this->share = $this->server->getShare(trim($params['share'], '/'));
|
||||||
|
|
||||||
$this->root = isset($params['root']) ? $params['root'] : '/';
|
$this->root = isset($params['root']) ? $params['root'] : '/';
|
||||||
if (!$this->root || $this->root[0] != '/') {
|
if (!$this->root || $this->root[0] !== '/') {
|
||||||
$this->root = '/' . $this->root;
|
$this->root = '/' . $this->root;
|
||||||
}
|
}
|
||||||
if (substr($this->root, -1, 1) != '/') {
|
if (substr($this->root, -1, 1) !== '/') {
|
||||||
$this->root .= '/';
|
$this->root .= '/';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -435,7 +435,7 @@ class Swift extends \OC\Files\Storage\Common {
|
||||||
}
|
}
|
||||||
$metadata = array('timestamp' => $mtime);
|
$metadata = array('timestamp' => $mtime);
|
||||||
if ($this->file_exists($path)) {
|
if ($this->file_exists($path)) {
|
||||||
if ($this->is_dir($path) && $path != '.') {
|
if ($this->is_dir($path) && $path !== '.') {
|
||||||
$path .= '/';
|
$path .= '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -640,7 +640,7 @@ class Swift extends \OC\Files\Storage\Common {
|
||||||
}, $cachedContent);
|
}, $cachedContent);
|
||||||
sort($cachedNames);
|
sort($cachedNames);
|
||||||
sort($content);
|
sort($content);
|
||||||
return $cachedNames != $content;
|
return $cachedNames !== $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
|
|
||||||
<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
|
<form data-can-create="<?php echo $canCreateMounts?'true':'false' ?>" id="files_external" class="section" data-encryption-enabled="<?php echo $_['encryptionEnabled']?'true': 'false'; ?>">
|
||||||
<h2 data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2>
|
<h2 data-anchor-name="external-storage"><?php p($l->t('External storages')); ?></h2>
|
||||||
<?php if (isset($_['dependencies']) and ($_['dependencies']<>'') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
|
<?php if (isset($_['dependencies']) and ($_['dependencies'] !== '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?>
|
||||||
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
|
<table id="externalStorage" class="grid" data-admin='<?php print_unescaped(json_encode($_['visibilityType'] === BackendService::VISIBILITY_ADMIN)); ?>'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -169,10 +169,10 @@
|
||||||
|
|
||||||
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
|
<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
|
||||||
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
|
<input type="checkbox" name="allowUserMounting" id="allowUserMounting" class="checkbox"
|
||||||
value="1" <?php if ($_['allowUserMounting'] == 'yes') print_unescaped(' checked="checked"'); ?> />
|
value="1" <?php if ($_['allowUserMounting'] === 'yes') print_unescaped(' checked="checked"'); ?> />
|
||||||
<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
|
<label for="allowUserMounting"><?php p($l->t('Allow users to mount external storage')); ?></label> <span id="userMountingMsg" class="msg"></span>
|
||||||
|
|
||||||
<p id="userMountingBackends"<?php if ($_['allowUserMounting'] != 'yes'): ?> class="hidden"<?php endif; ?>>
|
<p id="userMountingBackends"<?php if ($_['allowUserMounting'] !== 'yes'): ?> class="hidden"<?php endif; ?>>
|
||||||
<?php p($l->t('Allow users to mount the following external storage')); ?><br />
|
<?php p($l->t('Allow users to mount the following external storage')); ?><br />
|
||||||
<?php
|
<?php
|
||||||
$userBackends = array_filter($_['backends'], function($backend) {
|
$userBackends = array_filter($_['backends'], function($backend) {
|
||||||
|
|
Loading…
Reference in New Issue