Skip to content

Commit

Permalink
Scrutinizer Auto-Fixes
Browse files Browse the repository at this point in the history
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information
scrutinizer-auto-fixer committed Dec 15, 2017
1 parent 9c1876b commit 21ad384
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
3 changes: 1 addition & 2 deletions application/commands/FlushAssetsCommand.php
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/export.php
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/index.php
Expand Up @@ -17,7 +17,7 @@ class Index extends Survey_Common_Action
{

public function run()
{
{
App()->loadHelper('surveytranslator');
$aData = [];
$aData['issuperadmin'] = false;
Expand Down Expand Up @@ -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");
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -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.');
}
Expand All @@ -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(
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 3 additions & 4 deletions application/core/Survey_Common_Action.php
Expand Up @@ -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
Expand Down Expand Up @@ -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?")
Expand All @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Expand Up @@ -219,7 +219,7 @@ function getSurveyList($bReturnArray = false)
$inactivesurveys .= " class='mysurvey emphasis'";
}
$inactivesurveys .= " value='{$sv['sid']}'>{$surveylstitle}</option>\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 .= "<option ";
if (Yii::app()->user->getId() == $sv['owner_id']) {
$expiredsurveys .= " class='mysurvey emphasis'";
Expand Down
3 changes: 2 additions & 1 deletion application/helpers/expressions/em_core_helper.php
Expand Up @@ -2594,7 +2594,8 @@ function exprmgr_mktime($hour = null, $minute = null, $second = null, $month = n
$day = isset($day) ? $day : date("j");
$year = isset($year) ? $year : date("Y");
$hour = isset($hour) ? $hour : date("H");
$iInvalidArg = count(array_filter(array($hour, $minute, $second, $month, $day, $year), function($timeValue) {
$iInvalidArg = count(array_filter(array($hour, $minute, $second, $month, $day, $year), function($timeValue)
{
return !is_numeric($timeValue); /* This allow get by string like "01.000" , same than javascript with 2.72.6 and default PHP(5.6) function*/
}));
if ($iInvalidArg) {
Expand Down
4 changes: 2 additions & 2 deletions application/models/Participant.php
Expand Up @@ -950,7 +950,7 @@ public function deleteParticipantToken($sParticipantsIDs)
the participant from any tokens table they're in (using the survey_links table to find them)
and then all the participants attributes. */
$aParticipantsIDChunks = array_chunk(explode(",", $sParticipantsIDs), 100);
$iDeletedParticipants=0;
$iDeletedParticipants = 0;
foreach ($aParticipantsIDChunks as $aParticipantsIDs) {
$aParticipantsIDs = $this->filterParticipantIDs($aParticipantsIDs);
$aSurveyIDs = Yii::app()->db->createCommand()
Expand Down Expand Up @@ -985,7 +985,7 @@ public function deleteParticipantTokenAnswer($sParticipantsIDs)
{
$aParticipantsIDs = explode(",", $sParticipantsIDs);
$aParticipantsIDs = $this->filterParticipantIDs($aParticipantsIDs);
$iDeletedParticipants=0;
$iDeletedParticipants = 0;

foreach ($aParticipantsIDs as $row) {
/** @var SurveyLink[] $tokens */
Expand Down
6 changes: 3 additions & 3 deletions application/models/SurveysGroups.php
Expand Up @@ -208,9 +208,9 @@ public function getParentTitle()
}

/**
* Returns true if survey group has surveys
* @return boolean
*/
* Returns true if survey group has surveys
* @return boolean
*/
public function getHasSurveys()
{
$nbSurvey = Survey::model()->countByAttributes(array("gsid"=>$this->gsid));
Expand Down

0 comments on commit 21ad384

Please sign in to comment.