Skip to content
2 changes: 1 addition & 1 deletion apps/dav/lib/CalDAV/CalDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1158,7 +1158,7 @@ function calendarQuery($calendarId, array $filters) {
$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
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/lib/CalDAV/Search/SearchPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ private function calendarSearch($report) {

// 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);

Expand All @@ -156,4 +156,4 @@ private function calendarSearch($report) {
$this->server->generateMultiStatus($result,
$prefer['return'] === 'minimal'));
}
}
}
2 changes: 1 addition & 1 deletion apps/dav/lib/CardDAV/CardDavBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -1019,7 +1019,7 @@ protected function updateProperties($addressBookId, $cardUri, $vCardSerialized)
}
$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;
}
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/Directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ public function getChild($name, $info = null) {
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);
Expand Down
8 changes: 4 additions & 4 deletions apps/dav/lib/Connector/Sabre/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ public function put($data) {
// double check if the file was fully received
// compare expected and actual size
if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
$expected = $_SERVER['CONTENT_LENGTH'];
if ($count != $expected) {
$expected = (int) $_SERVER['CONTENT_LENGTH'];
if ($count !== $expected) {
throw new BadRequest('expected filesize ' . $expected . ' got ' . $count);
}
}
Expand Down Expand Up @@ -409,8 +409,8 @@ private function createFileChunked($data) {
//detect aborted upload
if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') {
if (isset($_SERVER['CONTENT_LENGTH'])) {
$expected = $_SERVER['CONTENT_LENGTH'];
if ($bytesWritten != $expected) {
$expected = (int) $_SERVER['CONTENT_LENGTH'];
if ($bytesWritten !== $expected) {
$chunk_handler->remove($info['index']);
throw new BadRequest(
'expected filesize ' . $expected . ' got ' . $bytesWritten);
Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/Connector/Sabre/ObjectTree.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private function resolveChunkFile($path) {
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 = '';
}

Expand Down
2 changes: 1 addition & 1 deletion apps/dav/lib/DAV/Sharing/Backend.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function getShares($resourceId) {
'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)
];
Expand Down
2 changes: 1 addition & 1 deletion apps/encryption/lib/Crypto/Crypt.php
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ protected function parseHeader($data) {

$element = array_shift($exploded);

while ($element != self::HEADER_END) {
while ($element !== self::HEADER_END) {
$result[$element] = array_shift($exploded);
$element = array_shift($exploded);
}
Expand Down
6 changes: 3 additions & 3 deletions apps/encryption/lib/Crypto/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -449,13 +449,13 @@ public function shouldEncrypt($path) {
return false;
}

if ($parts[2] == 'files') {
if ($parts[2] === 'files') {
return true;
}
if ($parts[2] == 'files_versions') {
if ($parts[2] === 'files_versions') {
return true;
}
if ($parts[2] == 'files_trashbin') {
if ($parts[2] === 'files_trashbin') {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/files/ajax/download.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
setcookie('ocDownloadStarted', $_GET['downloadStartSecret'], time() + 20, '/');
}

$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() == 'HEAD' );
$server_params = array( 'head' => \OC::$server->getRequest()->getMethod() === 'HEAD' );

/**
* Http range requests support
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public static function populateTags(array $fileList, $fileIdentifier = 'fileid')

foreach ($filesById as $key => $fileWithTags) {
foreach($fileList as $key2 => $file){
if( $file[$fileIdentifier] == $key){
if( $file[$fileIdentifier] === $key){
$fileList[$key2] = $fileWithTags;
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/files/lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function __construct(IniGetWrapper $iniWrapper, IRequest $request) {
* @return TemplateResponse
*/
public function getForm() {
$htaccessWorking = (getenv('htaccessWorking') == 'true');
$htaccessWorking = (getenv('htaccessWorking') === 'true');
$htaccessWritable = is_writable(\OC::$SERVERROOT.'/.htaccess');
$userIniWritable = is_writable(\OC::$SERVERROOT.'/.user.ini');

Expand Down
6 changes: 3 additions & 3 deletions apps/files_external/ajax/oauth2.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
$client->setApprovalPrompt('force');
$client->setAccessType('offline');
if (isset($_POST['step'])) {
$step = $_POST['step'];
if ($step == 1) {
$step = (int) $_POST['step'];
if ($step === 1) {
try {
$authUrl = $client->createAuthUrl();
OCP\JSON::success(array('data' => array(
Expand All @@ -58,7 +58,7 @@
'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 {
$token = $client->authenticate((string)$_POST['code']);
OCP\JSON::success(array('data' => array(
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Command/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ protected function execute(InputInterface $input, OutputInterface $output) {
if (
$existingMount->getMountPoint() === $mount->getMountPoint() &&
$existingMount->getApplicableGroups() === $mount->getApplicableGroups() &&
$existingMount->getApplicableUsers() == $mount->getApplicableUsers() &&
$existingMount->getBackendOptions() == $mount->getBackendOptions()
$existingMount->getApplicableUsers() === $mount->getApplicableUsers() &&
$existingMount->getBackendOptions() === $mount->getBackendOptions()
) {
$output->writeln("<error>Duplicate mount (" . $mount->getMountPoint() . ")</error>");
return 1;
Expand Down
8 changes: 4 additions & 4 deletions apps/files_external/lib/Lib/Storage/Dropbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Dropbox extends \OC\Files\Storage\Common {
private $oauth;

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_secret'])
&& isset($params['token'])
Expand Down Expand Up @@ -187,12 +187,12 @@ public function stat($path) {
}

public function filetype($path) {
if ($path == '' || $path == '/') {
if ($path === '' || $path === '/') {
return 'dir';
} else {
$metaData = $this->getDropBoxMetaData($path);
if ($metaData) {
if ($metaData['is_dir'] == 'true') {
if ($metaData['is_dir'] === 'true') {
return 'dir';
} else {
return 'file';
Expand All @@ -203,7 +203,7 @@ public function filetype($path) {
}

public function file_exists($path) {
if ($path == '' || $path == '/') {
if ($path === '' || $path === '/') {
return true;
}
if ($this->getDropBoxMetaData($path)) {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_external/lib/Lib/Storage/FTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function __construct($params) {
$this->secure = false;
}
$this->root=isset($params['root'])?$params['root']:'/';
if ( ! $this->root || $this->root[0]!='/') {
if ( ! $this->root || $this->root[0]!=='/') {
$this->root='/'.$this->root;
}
if (substr($this->root, -1) !== '/') {
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Lib/Storage/OwnCloud.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public function __construct($params) {
// (owncloud install path on host)
$host = $params['host'];
// strip protocol
if (substr($host, 0, 8) == "https://") {
if (substr($host, 0, 8) === "https://") {
$host = substr($host, 8);
$params['secure'] = true;
} else if (substr($host, 0, 7) == "http://") {
} else if (substr($host, 0, 7) === "http://") {
$host = substr($host, 7);
$params['secure'] = false;
}
Expand Down
14 changes: 7 additions & 7 deletions apps/files_external/lib/Lib/Storage/SFTP.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public function __construct($params) {
$this->root
= isset($params['root']) ? $this->cleanPath($params['root']) : '/';

if ($this->root[0] != '/') {
if ($this->root[0] !== '/') {
$this->root = '/' . $this->root;
}

if (substr($this->root, -1, 1) != '/') {
if (substr($this->root, -1, 1) !== '/') {
$this->root .= '/';
}
}
Expand All @@ -128,7 +128,7 @@ public function getConnection() {
// The SSH Host Key MUST be verified before login().
$currentHostKey = $this->client->getServerPublicHostKey();
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');
}
} else {
Expand Down Expand Up @@ -248,7 +248,7 @@ protected function readHostKeys() {
if ($lines) {
foreach ($lines as $line) {
$hostKeyArray = explode("::", $line, 2);
if (count($hostKeyArray) == 2) {
if (count($hostKeyArray) === 2) {
$hosts[] = $hostKeyArray[0];
$keys[] = $hostKeyArray[1];
}
Expand Down Expand Up @@ -300,7 +300,7 @@ public function opendir($path) {
$id = md5('sftp:' . $path);
$dirStream = array();
foreach($list as $file) {
if ($file != '.' && $file != '..') {
if ($file !== '.' && $file !== '..') {
$dirStream[] = $file;
}
}
Expand All @@ -316,11 +316,11 @@ public function opendir($path) {
public function filetype($path) {
try {
$stat = $this->getConnection()->stat($this->absPath($path));
if ($stat['type'] == NET_SFTP_TYPE_REGULAR) {
if ((int) $stat['type'] === NET_SFTP_TYPE_REGULAR) {
return 'file';
}

if ($stat['type'] == NET_SFTP_TYPE_DIRECTORY) {
if ((int) $stat['type'] === NET_SFTP_TYPE_DIRECTORY) {
return 'dir';
}
} catch (\Exception $e) {
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public function __construct($params) {
$this->share = $this->server->getShare(trim($params['share'], '/'));

$this->root = isset($params['root']) ? $params['root'] : '/';
if (!$this->root || $this->root[0] != '/') {
if (!$this->root || $this->root[0] !== '/') {
$this->root = '/' . $this->root;
}
if (substr($this->root, -1, 1) != '/') {
if (substr($this->root, -1, 1) !== '/') {
$this->root .= '/';
}
} else {
Expand Down
4 changes: 2 additions & 2 deletions apps/files_external/lib/Lib/Storage/Swift.php
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ public function touch($path, $mtime = null) {
}
$metadata = array('timestamp' => $mtime);
if ($this->file_exists($path)) {
if ($this->is_dir($path) && $path != '.') {
if ($this->is_dir($path) && $path !== '.') {
$path .= '/';
}

Expand Down Expand Up @@ -640,7 +640,7 @@ public function hasUpdated($path, $time) {
}, $cachedContent);
sort($cachedNames);
sort($content);
return $cachedNames != $content;
return $cachedNames !== $content;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions apps/files_external/templates/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function writeParameterInput($parameter, $options, $classes = []) {

<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>
<?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)); ?>'>
<thead>
<tr>
Expand Down Expand Up @@ -169,10 +169,10 @@ function writeParameterInput($parameter, $options, $classes = []) {

<?php if ($_['visibilityType'] === BackendService::VISIBILITY_ADMIN): ?>
<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>

<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
$userBackends = array_filter($_['backends'], function($backend) {
Expand Down
2 changes: 1 addition & 1 deletion apps/files_sharing/lib/Controller/ShareController.php
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ public function downloadShare($token, $files = null, $path = '', $downloadStartS

$this->emitAccessShareHook($share);

$server_params = array( 'head' => $this->request->getMethod() == 'HEAD' );
$server_params = array( 'head' => $this->request->getMethod() === 'HEAD' );

/**
* Http range requests support
Expand Down
4 changes: 2 additions & 2 deletions apps/files_sharing/lib/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public static function getSharesFromItem($target) {
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;
Expand Down Expand Up @@ -183,7 +183,7 @@ public static function getUidAndFilename($filename) {
$uid = User::getUser();
}
Filesystem::initMountPoints($uid);
if ( $uid != User::getUser() ) {
if ( $uid !== User::getUser() ) {
$info = Filesystem::getFileInfo($filename);
$ownerView = new View('/'.$uid.'/files');
try {
Expand Down
8 changes: 4 additions & 4 deletions apps/files_sharing/lib/ShareBackend/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public function generateTarget($filePath, $shareWith, $exclude = null) {
}

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(
Expand All @@ -133,7 +133,7 @@ public function formatItems($items, $format, $parameters = null) {
'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();
Expand All @@ -156,13 +156,13 @@ public function formatItems($items, $format, $parameters = null) {
$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'];
Expand Down
Loading