diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index b85415e28fc..d078790b6f0 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -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 diff --git a/apps/dav/lib/CalDAV/Search/SearchPlugin.php b/apps/dav/lib/CalDAV/Search/SearchPlugin.php index d658a50437d..84e095da5f8 100644 --- a/apps/dav/lib/CalDAV/Search/SearchPlugin.php +++ b/apps/dav/lib/CalDAV/Search/SearchPlugin.php @@ -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')); } -} \ No newline at end of file +} diff --git a/apps/dav/lib/CardDAV/CardDavBackend.php b/apps/dav/lib/CardDAV/CardDavBackend.php index 9dccffc022b..7c275611951 100644 --- a/apps/dav/lib/CardDAV/CardDavBackend.php +++ b/apps/dav/lib/CardDAV/CardDavBackend.php @@ -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; } diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index 1a97d896469..6fe9d26614e 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -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); diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 63f10034ed6..478321d41f2 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -146,8 +146,8 @@ class File extends Node implements IFile { // 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); } } @@ -409,8 +409,8 @@ class File extends Node implements IFile { //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); diff --git a/apps/dav/lib/Connector/Sabre/ObjectTree.php b/apps/dav/lib/Connector/Sabre/ObjectTree.php index d298d6be842..3371c655f29 100644 --- a/apps/dav/lib/Connector/Sabre/ObjectTree.php +++ b/apps/dav/lib/Connector/Sabre/ObjectTree.php @@ -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 = ''; } diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php index f662d8e1b80..6cc5e3b6f50 100644 --- a/apps/dav/lib/DAV/Sharing/Backend.php +++ b/apps/dav/lib/DAV/Sharing/Backend.php @@ -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) ]; diff --git a/apps/encryption/lib/Crypto/Crypt.php b/apps/encryption/lib/Crypto/Crypt.php index 9a9ac27b96f..6e1b7387c88 100644 --- a/apps/encryption/lib/Crypto/Crypt.php +++ b/apps/encryption/lib/Crypto/Crypt.php @@ -605,7 +605,7 @@ class Crypt { $element = array_shift($exploded); - while ($element != self::HEADER_END) { + while ($element !== self::HEADER_END) { $result[$element] = array_shift($exploded); $element = array_shift($exploded); } diff --git a/apps/encryption/lib/Crypto/Encryption.php b/apps/encryption/lib/Crypto/Encryption.php index 1f8c8a8012e..4d20c103a5d 100644 --- a/apps/encryption/lib/Crypto/Encryption.php +++ b/apps/encryption/lib/Crypto/Encryption.php @@ -449,13 +449,13 @@ class Encryption implements IEncryptionModule { 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; } diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php index 17a7fd8b322..7c33cdec6dd 100644 --- a/apps/files/ajax/download.php +++ b/apps/files/ajax/download.php @@ -51,7 +51,7 @@ if(isset($_GET['downloadStartSecret']) 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 diff --git a/apps/files/lib/Helper.php b/apps/files/lib/Helper.php index d2cebce5ddc..4a5595999d2 100644 --- a/apps/files/lib/Helper.php +++ b/apps/files/lib/Helper.php @@ -227,7 +227,7 @@ class Helper { foreach ($filesById as $key => $fileWithTags) { foreach($fileList as $key2 => $file){ - if( $file[$fileIdentifier] == $key){ + if( $file[$fileIdentifier] === $key){ $fileList[$key2] = $fileWithTags; } } diff --git a/apps/files/lib/Settings/Admin.php b/apps/files/lib/Settings/Admin.php index da1d5deaf35..faaeb5b89c1 100644 --- a/apps/files/lib/Settings/Admin.php +++ b/apps/files/lib/Settings/Admin.php @@ -46,7 +46,7 @@ class Admin implements ISettings { * @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'); diff --git a/apps/files_external/ajax/oauth2.php b/apps/files_external/ajax/oauth2.php index db2570800af..8b257b77ef6 100644 --- a/apps/files_external/ajax/oauth2.php +++ b/apps/files_external/ajax/oauth2.php @@ -46,8 +46,8 @@ if (isset($_POST['client_id']) && isset($_POST['client_secret']) && isset($_POST $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( @@ -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())) ))); } - } 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( diff --git a/apps/files_external/lib/Command/Import.php b/apps/files_external/lib/Command/Import.php index 96afc86ba2c..712a8851c8a 100644 --- a/apps/files_external/lib/Command/Import.php +++ b/apps/files_external/lib/Command/Import.php @@ -161,8 +161,8 @@ class Import extends Base { 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("Duplicate mount (" . $mount->getMountPoint() . ")"); return 1; diff --git a/apps/files_external/lib/Lib/Storage/Dropbox.php b/apps/files_external/lib/Lib/Storage/Dropbox.php index d2ba1cca751..fad85650e9b 100644 --- a/apps/files_external/lib/Lib/Storage/Dropbox.php +++ b/apps/files_external/lib/Lib/Storage/Dropbox.php @@ -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']) @@ -187,12 +187,12 @@ class Dropbox extends \OC\Files\Storage\Common { } 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'; @@ -203,7 +203,7 @@ class Dropbox extends \OC\Files\Storage\Common { } public function file_exists($path) { - if ($path == '' || $path == '/') { + if ($path === '' || $path === '/') { return true; } if ($this->getDropBoxMetaData($path)) { diff --git a/apps/files_external/lib/Lib/Storage/FTP.php b/apps/files_external/lib/Lib/Storage/FTP.php index 22fe2090f30..1bbdfaba468 100644 --- a/apps/files_external/lib/Lib/Storage/FTP.php +++ b/apps/files_external/lib/Lib/Storage/FTP.php @@ -56,7 +56,7 @@ class FTP extends StreamWrapper{ $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) !== '/') { diff --git a/apps/files_external/lib/Lib/Storage/OwnCloud.php b/apps/files_external/lib/Lib/Storage/OwnCloud.php index 9669b5f3dad..34838b9891e 100644 --- a/apps/files_external/lib/Lib/Storage/OwnCloud.php +++ b/apps/files_external/lib/Lib/Storage/OwnCloud.php @@ -40,10 +40,10 @@ class OwnCloud extends \OC\Files\Storage\DAV{ // (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; } diff --git a/apps/files_external/lib/Lib/Storage/SFTP.php b/apps/files_external/lib/Lib/Storage/SFTP.php index a4dfea94bf7..8d489551264 100644 --- a/apps/files_external/lib/Lib/Storage/SFTP.php +++ b/apps/files_external/lib/Lib/Storage/SFTP.php @@ -102,11 +102,11 @@ class SFTP extends \OC\Files\Storage\Common { $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 .= '/'; } } @@ -128,7 +128,7 @@ class SFTP extends \OC\Files\Storage\Common { // 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 { @@ -248,7 +248,7 @@ class SFTP extends \OC\Files\Storage\Common { if ($lines) { foreach ($lines as $line) { $hostKeyArray = explode("::", $line, 2); - if (count($hostKeyArray) == 2) { + if (count($hostKeyArray) === 2) { $hosts[] = $hostKeyArray[0]; $keys[] = $hostKeyArray[1]; } @@ -300,7 +300,7 @@ class SFTP extends \OC\Files\Storage\Common { $id = md5('sftp:' . $path); $dirStream = array(); foreach($list as $file) { - if ($file != '.' && $file != '..') { + if ($file !== '.' && $file !== '..') { $dirStream[] = $file; } } @@ -316,11 +316,11 @@ class SFTP extends \OC\Files\Storage\Common { 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) { diff --git a/apps/files_external/lib/Lib/Storage/SMB.php b/apps/files_external/lib/Lib/Storage/SMB.php index 7afdb746a98..4af6df5d84a 100644 --- a/apps/files_external/lib/Lib/Storage/SMB.php +++ b/apps/files_external/lib/Lib/Storage/SMB.php @@ -81,10 +81,10 @@ class SMB extends Common implements INotifyStorage { $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 { diff --git a/apps/files_external/lib/Lib/Storage/Swift.php b/apps/files_external/lib/Lib/Storage/Swift.php index db5b5bf6d95..57df4aa01a5 100644 --- a/apps/files_external/lib/Lib/Storage/Swift.php +++ b/apps/files_external/lib/Lib/Storage/Swift.php @@ -435,7 +435,7 @@ class Swift extends \OC\Files\Storage\Common { } $metadata = array('timestamp' => $mtime); if ($this->file_exists($path)) { - if ($this->is_dir($path) && $path != '.') { + if ($this->is_dir($path) && $path !== '.') { $path .= '/'; } @@ -640,7 +640,7 @@ class Swift extends \OC\Files\Storage\Common { }, $cachedContent); sort($cachedNames); sort($content); - return $cachedNames != $content; + return $cachedNames !== $content; } /** diff --git a/apps/files_external/templates/settings.php b/apps/files_external/templates/settings.php index e463a0d3c37..1d703e0c1b3 100644 --- a/apps/files_external/templates/settings.php +++ b/apps/files_external/templates/settings.php @@ -89,7 +89,7 @@

t('External storages')); ?>

- '') and $canCreateMounts) print_unescaped(''.$_['dependencies'].''); ?> + '> @@ -169,10 +169,10 @@ /> + value="1" /> -

class="hidden"> +

class="hidden"> t('Allow users to mount the following external storage')); ?>
emitAccessShareHook($share); - $server_params = array( 'head' => $this->request->getMethod() == 'HEAD' ); + $server_params = array( 'head' => $this->request->getMethod() === 'HEAD' ); /** * Http range requests support diff --git a/apps/files_sharing/lib/Helper.php b/apps/files_sharing/lib/Helper.php index a659da9292f..c8f46fa8132 100644 --- a/apps/files_sharing/lib/Helper.php +++ b/apps/files_sharing/lib/Helper.php @@ -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 { diff --git a/apps/files_sharing/lib/ShareBackend/File.php b/apps/files_sharing/lib/ShareBackend/File.php index aecb63c60e4..83474546581 100644 --- a/apps/files_sharing/lib/ShareBackend/File.php +++ b/apps/files_sharing/lib/ShareBackend/File.php @@ -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']; diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index 07e353cc6a6..55c2eff6fe0 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -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']; } } diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php index 36b4dcdbe1c..f8d056ef93c 100644 --- a/apps/files_sharing/templates/public.php +++ b/apps/files_sharing/templates/public.php @@ -75,7 +75,7 @@ $maxUploadFilesize = min($upload_max_filesize, $post_max_size); - +