From 29b6dd53a095fd4140bf68a5ba7a4fd57c04a82d Mon Sep 17 00:00:00 2001
From: Bart Visscher <bartv@thisnet.nl>
Date: Sat, 17 Aug 2013 12:58:10 +0200
Subject: [PATCH] Compare result are already true/false

---
 apps/files/ajax/download.php                |  2 +-
 apps/files/ajax/list.php                    |  2 +-
 apps/files_encryption/settings-personal.php |  2 +-
 apps/files_external/lib/amazons3.php        |  2 +-
 apps/files_external/lib/config.php          | 12 ++++++------
 apps/files_external/lib/sftp.php            |  2 +-
 apps/files_sharing/public.php               |  6 +++---
 settings/admin.php                          |  2 +-
 settings/ajax/getlog.php                    |  2 +-
 9 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/apps/files/ajax/download.php b/apps/files/ajax/download.php
index b2bfd53506d..6a34cbe4ef1 100644
--- a/apps/files/ajax/download.php
+++ b/apps/files/ajax/download.php
@@ -39,4 +39,4 @@ if (!is_array($files_list)) {
 	$files_list = array($files);
 }
 
-OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
+OC_Files::get($dir, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
diff --git a/apps/files/ajax/list.php b/apps/files/ajax/list.php
index 878e4cb2159..b2975790a10 100644
--- a/apps/files/ajax/list.php
+++ b/apps/files/ajax/list.php
@@ -10,7 +10,7 @@ OCP\JSON::checkLoggedIn();
 
 // Load the files
 $dir = isset( $_GET['dir'] ) ? $_GET['dir'] : '';
-$doBreadcrumb = isset( $_GET['breadcrumb'] ) ? true : false;
+$doBreadcrumb = isset( $_GET['breadcrumb'] );
 $data = array();
 
 // Make breadcrumb
diff --git a/apps/files_encryption/settings-personal.php b/apps/files_encryption/settings-personal.php
index fddc3ea5eee..589219f32ad 100644
--- a/apps/files_encryption/settings-personal.php
+++ b/apps/files_encryption/settings-personal.php
@@ -16,7 +16,7 @@ $view = new \OC_FilesystemView('/');
 $util = new \OCA\Encryption\Util($view, $user);
 $session = new \OCA\Encryption\Session($view);
 
-$privateKeySet = ($session->getPrivateKey() !== false) ? true : false;
+$privateKeySet = $session->getPrivateKey() !== false;
 
 $recoveryAdminEnabled = OC_Appconfig::getValue('files_encryption', 'recoveryAdminEnabled');
 $recoveryEnabledForUser = $util->recoveryEnabledForUser();
diff --git a/apps/files_external/lib/amazons3.php b/apps/files_external/lib/amazons3.php
index f4d1940b184..9363a350e27 100644
--- a/apps/files_external/lib/amazons3.php
+++ b/apps/files_external/lib/amazons3.php
@@ -79,7 +79,7 @@ class AmazonS3 extends \OC\Files\Storage\Common {
 
 		$this->bucket = $params['bucket'];
 		$scheme = ($params['use_ssl'] === 'false') ? 'http' : 'https';
-		$this->test = ( isset($params['test'])) ? true : false;
+		$this->test = isset($params['test']);
 		$this->timeout = ( ! isset($params['timeout'])) ? 15 : $params['timeout'];
 		$params['region'] = ( ! isset($params['region'])) ? 'eu-west-1' : $params['region'];
 		$params['hostname'] = ( !isset($params['hostname'])) ? 's3.amazonaws.com' : $params['hostname'];
diff --git a/apps/files_external/lib/config.php b/apps/files_external/lib/config.php
index 14e974d65ca..1935740cd2e 100755
--- a/apps/files_external/lib/config.php
+++ b/apps/files_external/lib/config.php
@@ -418,9 +418,9 @@ class OC_Mount_Config {
 	public static function checksmbclient() {
 		if(function_exists('shell_exec')) {
 			$output=shell_exec('which smbclient');
-			return (empty($output)?false:true);
+			return !empty($output);
 		}else{
-			return(false);
+			return false;
 		}
 	}
 
@@ -429,9 +429,9 @@ class OC_Mount_Config {
 	 */
 	public static function checkphpftp() {
 		if(function_exists('ftp_login')) {
-			return(true);
+			return true;
 		}else{
-			return(false);
+			return false;
 		}
 	}
 
@@ -439,7 +439,7 @@ class OC_Mount_Config {
 	 * check if curl is installed
 	 */
 	public static function checkcurl() {
-		return (function_exists('curl_init'));
+		return function_exists('curl_init');
 	}
 
 	/**
@@ -460,6 +460,6 @@ class OC_Mount_Config {
 			$txt.=$l->t('<b>Warning:</b> The Curl support in PHP is not enabled or installed. Mounting of ownCloud / WebDAV or GoogleDrive is not possible. Please ask your system administrator to install it.').'<br />';
 		}
 
-		return($txt);
+		return $txt;
 	}
 }
diff --git a/apps/files_external/lib/sftp.php b/apps/files_external/lib/sftp.php
index 4fd36096463..f7f329b8993 100644
--- a/apps/files_external/lib/sftp.php
+++ b/apps/files_external/lib/sftp.php
@@ -170,7 +170,7 @@ class SFTP extends \OC\Files\Storage\Common {
 
 	public function file_exists($path) {
 		try {
-			return $this->client->stat($this->abs_path($path)) === false ? false : true;
+			return $this->client->stat($this->abs_path($path)) !== false;
 		} catch (\Exception $e) {
 			return false;
 		}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 741ab145384..6dfe8a4bc00 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -112,9 +112,9 @@ if (isset($path)) {
 			if ($files_list === NULL ) {
 				$files_list = array($files);
 			}
-			OC_Files::get($path, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
+			OC_Files::get($path, $files_list, $_SERVER['REQUEST_METHOD'] == 'HEAD');
 		} else {
-			OC_Files::get($dir, $file, $_SERVER['REQUEST_METHOD'] == 'HEAD' ? true : false);
+			OC_Files::get($dir, $file, $_SERVER['REQUEST_METHOD'] == 'HEAD');
 		}
 		exit();
 	} else {
@@ -133,7 +133,7 @@ if (isset($path)) {
 		$tmpl->assign('mimetype', \OC\Files\Filesystem::getMimeType($path));
 		$tmpl->assign('fileTarget', basename($linkItem['file_target']));
 		$tmpl->assign('dirToken', $linkItem['token']);
-		$allowPublicUploadEnabled = (($linkItem['permissions'] & OCP\PERMISSION_CREATE) ? true : false );
+		$allowPublicUploadEnabled = ($linkItem['permissions'] & OCP\PERMISSION_CREATE) !== 0;
 		if (\OCP\App::isEnabled('files_encryption')) {
 			$allowPublicUploadEnabled = false;
 		}
diff --git a/settings/admin.php b/settings/admin.php
index 10e239204f2..6c01d4007de 100755
--- a/settings/admin.php
+++ b/settings/admin.php
@@ -18,7 +18,7 @@ $forms=OC_App::getForms('admin');
 $htaccessworking=OC_Util::ishtaccessworking();
 
 $entries=OC_Log_Owncloud::getEntries(3);
-$entriesremain=(count(OC_Log_Owncloud::getEntries(4)) > 3)?true:false;
+$entriesremain=count(OC_Log_Owncloud::getEntries(4)) > 3;
 
 $tmpl->assign('loglevel', OC_Config::getValue( "loglevel", 2 ));
 $tmpl->assign('entries', $entries);
diff --git a/settings/ajax/getlog.php b/settings/ajax/getlog.php
index e7151419286..f160512b6ad 100644
--- a/settings/ajax/getlog.php
+++ b/settings/ajax/getlog.php
@@ -16,6 +16,6 @@ $data = array();
 OC_JSON::success(
 	array(
 		"data" => $entries,
-		"remain"=>(count(OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0) ? true : false
+		"remain"=>count(OC_Log_Owncloud::getEntries(1, $offset + $count)) !== 0
 	)
 );
-- 
GitLab