diff --git a/data/CRMEntity.php b/data/CRMEntity.php index 3a096d823147af80441a22dc76328af30aa23191..472ca4710d8724aec36cc6790797fa94844c3a9d 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -177,7 +177,7 @@ class CRMEntity { } // Check 1 - $save_file = 'true'; + $save_file = true; //only images are allowed for Image Attachmenttype $mimeType = vtlib_mime_content_type($file_details['tmp_name']); $mimeTypeContents = explode('/', $mimeType); @@ -186,12 +186,12 @@ class CRMEntity { $save_file = validateImageFile($file_details); } $log->debug("File Validation status in Check1 save_file => $save_file"); - if ($save_file == 'false') { + if (!$save_file) { return false; } // Check 2 - $save_file = 'true'; + $save_file = true; //only images are allowed for these modules if ($module == 'Contacts' || $module == 'Products') { $save_file = validateImageFile($file_details); @@ -213,7 +213,7 @@ class CRMEntity { $upload_status = copy($filetmp_name, $upload_file_path . $current_id . "_" . $encryptFileName); // temporary file will be deleted at the end of request $log->debug("Upload status of file => $upload_status"); - if ($save_file == 'true' && $upload_status == 'true') { + if ($save_file && $upload_status == 'true') { if($attachmentType != 'Image' && $this->mode == 'edit') { //Only one Attachment per entity delete previous attachments $res = $adb->pquery('SELECT vtiger_seattachmentsrel.attachmentsid FROM vtiger_seattachmentsrel diff --git a/include/Webservices/Utils.php b/include/Webservices/Utils.php index 720e2c5f5af0780ba80a87c6bc5a88299d55d543..273196a5014a6181888c8dd11f16c63f0aad06c7 100644 --- a/include/Webservices/Utils.php +++ b/include/Webservices/Utils.php @@ -482,7 +482,7 @@ function vtws_CreateCompanyLogoFile($fieldname) { $uploaddir = $root_directory ."/test/logo/"; $binFile = $_FILES[$fieldname]['name']; $saveLogo = validateImageFile($_FILES[$fieldname]); - if($saveLogo == 'true') { + if($saveLogo) { move_uploaded_file($_FILES[$fieldname]["tmp_name"], $uploaddir.$binFile); copy($uploaddir.$binFile, $uploaddir.'application.ico'); return $binFile; diff --git a/modules/Users/Users.php b/modules/Users/Users.php index 21867f42c407657ff39ebb07af9edafed5fe878e..8149093b25cd471fc6ef76e847cd9fe11fab8c54 100755 --- a/modules/Users/Users.php +++ b/modules/Users/Users.php @@ -1042,12 +1042,12 @@ class Users extends CRMEntity { if(!isset($ownerid) || $ownerid=='') $ownerid = $current_user->id; - $save_file = 'true'; + $save_file = true; //only images are allowed for these modules if($module == 'Users') { $save_file = validateImageFile($file_details); } - if ($save_file == 'false') { + if (!$save_file) { return; }