From 21ad3840822d686b5608e6e2f39c64bc311e6d20 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Fri, 15 Dec 2017 15:06:36 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- application/commands/FlushAssetsCommand.php | 3 +-- application/controllers/admin/export.php | 2 +- application/controllers/admin/index.php | 4 ++-- application/controllers/admin/participantsaction.php | 10 +++++----- application/core/Survey_Common_Action.php | 7 +++---- application/helpers/common_helper.php | 2 +- application/helpers/expressions/em_core_helper.php | 3 ++- application/models/Participant.php | 4 ++-- application/models/SurveysGroups.php | 6 +++--- 9 files changed, 20 insertions(+), 21 deletions(-) diff --git a/application/commands/FlushAssetsCommand.php b/application/commands/FlushAssetsCommand.php index 129c4aa5bb7..e00c8ee5063 100644 --- a/application/commands/FlushAssetsCommand.php +++ b/application/commands/FlushAssetsCommand.php @@ -22,8 +22,7 @@ public function run($aArguments) { $sCurrentDir = dirname(__FILE__); $tmpFolder = realpath($sCurrentDir.'/../../tmp/'); - if ($tmpFolder === false) - { + if ($tmpFolder === false) { echo 'Tmp folder '.$sCurrentDir.'/../../tmp/ not found'; return; } diff --git a/application/controllers/admin/export.php b/application/controllers/admin/export.php index f57b389b6a1..2846439005f 100644 --- a/application/controllers/admin/export.php +++ b/application/controllers/admin/export.php @@ -744,7 +744,7 @@ public function resources() public function dumplabel() { if (!Permission::model()->hasGlobalPermission('labelsets', 'export')) { - safeDie ('No permission.'); + safeDie('No permission.'); } $lid = sanitize_int(Yii::app()->request->getParam('lid')); // DUMP THE RELATED DATA FOR A SINGLE QUESTION INTO A SQL FILE FOR IMPORTING LATER ON OR diff --git a/application/controllers/admin/index.php b/application/controllers/admin/index.php index 3999c452b3e..8adc7da9559 100644 --- a/application/controllers/admin/index.php +++ b/application/controllers/admin/index.php @@ -17,7 +17,7 @@ class Index extends Survey_Common_Action { public function run() - { + { App()->loadHelper('surveytranslator'); $aData = []; $aData['issuperadmin'] = false; @@ -71,7 +71,7 @@ public function run() $aData['showLastQuestion'] = false; } - $aData['countSurveyList'] = count((array)getSurveyList(true)); + $aData['countSurveyList'] = count((array) getSurveyList(true)); // We get the home page display setting $aData['bShowSurveyList'] = (getGlobalSetting('show_survey_list') == "show"); diff --git a/application/controllers/admin/participantsaction.php b/application/controllers/admin/participantsaction.php index 40c8184eae3..a5227202aee 100644 --- a/application/controllers/admin/participantsaction.php +++ b/application/controllers/admin/participantsaction.php @@ -677,14 +677,14 @@ public function attributeMapCSV() Yii::app()->end(); } - if ($bMoveFileResult===false) { + if ($bMoveFileResult === false) { Yii::app()->setFlashMessage(gT("An error occurred uploading your file. This may be caused by incorrect permissions for the application /tmp folder."), 'error'); Yii::app()->getController()->redirect(array('admin/participants/sa/importCSV')); Yii::app()->end(); } else { $regularfields = array('firstname', 'participant_id', 'lastname', 'email', 'language', 'blacklisted', 'owner_uid'); $oCSVFile = fopen($sFilePath, 'r'); - if ($oCSVFile===false) + if ($oCSVFile === false) { safeDie('File not found.'); } @@ -710,7 +710,7 @@ public function attributeMapCSV() } $fieldlist[] = $value; } - $iLineCount = count(array_filter(array_filter((array)file($sFilePath), 'trim'))); + $iLineCount = count(array_filter(array_filter((array) file($sFilePath), 'trim'))); $attributes = ParticipantAttributeName::model()->model()->getCPDBAttributes(); $aData = array( @@ -1692,7 +1692,7 @@ public function sharePanel() { $model = new ParticipantShare(); if (Yii::app()->request->getParam('ParticipantShare')) { - $model->setAttributes(Yii::app()->request->getParam('ParticipantShare'),false); + $model->setAttributes(Yii::app()->request->getParam('ParticipantShare'), false); } // data to be passed to view $aData = array( @@ -1930,7 +1930,7 @@ public function getParticipants_json($search = null) $iUserID = Yii::app()->session['loginID']; } $aData->records = Participant::model()->getParticipantsCount($attid, $search, $iUserID); - $aData->total = (int)ceil($aData->records / $limit); + $aData->total = (int) ceil($aData->records / $limit); if ($page > $aData->total) { $page = $aData->total; } diff --git a/application/core/Survey_Common_Action.php b/application/core/Survey_Common_Action.php index ee6134e5de8..2fd78c5d4d3 100644 --- a/application/core/Survey_Common_Action.php +++ b/application/core/Survey_Common_Action.php @@ -928,7 +928,7 @@ private function _listquestions($aData) // Global filter if (isset($_GET['Question'])) { - $model->setAttributes($_GET['Question'],false); + $model->setAttributes($_GET['Question'], false); } // Filter group @@ -1183,8 +1183,7 @@ protected function _filterImportedResources($extractdir, $destdir) } $dh = opendir($extractdir); - if (!$dh) - { + if (!$dh) { $aErrorFilesInfo[] = array( "filename" => '', "status" => gT("Extracted files not found - maybe a permission problem?") @@ -1195,7 +1194,7 @@ protected function _filterImportedResources($extractdir, $destdir) if ($direntry != "." && $direntry != "..") { if (is_file($extractdir."/".$direntry)) { // is a file - $extfile = (string)substr(strrchr($direntry, '.'), 1); + $extfile = (string) substr(strrchr($direntry, '.'), 1); if (!(stripos(','.Yii::app()->getConfig('allowedresourcesuploads').',', ','.$extfile.',') === false)) { // Extension allowed if (!copy($extractdir."/".$direntry, $destdir."/".$direntry)) { diff --git a/application/helpers/common_helper.php b/application/helpers/common_helper.php index 680b3814008..79b6e816c66 100644 --- a/application/helpers/common_helper.php +++ b/application/helpers/common_helper.php @@ -219,7 +219,7 @@ function getSurveyList($bReturnArray = false) $inactivesurveys .= " class='mysurvey emphasis'"; } $inactivesurveys .= " value='{$sv['sid']}'>{$surveylstitle}\n"; - } elseif ($sv['expires'] != '' && $sv['expires'] < dateShift((string)date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) { + } elseif ($sv['expires'] != '' && $sv['expires'] < dateShift((string) date("Y-m-d H:i:s"), "Y-m-d H:i:s", $timeadjust)) { $expiredsurveys .= "