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 30, 2017
1 parent 13b4e08 commit 848bc26
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 33 deletions.
4 changes: 2 additions & 2 deletions application/commands/CompileAssetsCommand.php
Expand Up @@ -107,9 +107,9 @@ private function liveExecuteCommand($cmd, $logfile = false)
preg_match('/[0-9]+$/', $complete_output, $matches);

// return exit status and intended output
return array (
return array(
'exit_status' => intval($matches[0]),
'output' => str_replace("Exit status : " . $matches[0], '', $complete_output)
'output' => str_replace("Exit status : ".$matches[0], '', $complete_output)
);
}
}
3 changes: 2 additions & 1 deletion application/controllers/admin/TutorialsController.php
Expand Up @@ -141,7 +141,8 @@ public function delete($id)
}
}

public function triggerfinished($tid) {
public function triggerfinished($tid)
{
$oTutorial = Tutorials::model()->find($tid);
$oTutorial->setFinished(App()->user->id);
echo '{"success": true}';
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/participantsaction.php
Expand Up @@ -226,7 +226,7 @@ protected function csvExportCount($search = null)
$count = (int) Participant::model()->getParticipantsCount($attid, $search, $iUserID);
if ($count > 1) {
return sprintf(gT("Export %s participants to CSV"), $count);
} else if($count == 1) {
} else if ($count == 1) {
return gT("Export participant to CSV");
} else {
return $count;
Expand Down
3 changes: 2 additions & 1 deletion application/controllers/admin/themeoptions.php
Expand Up @@ -260,7 +260,8 @@ protected function performAjaxValidation($model)
}
}

public function getPreviewTag() {
public function getPreviewTag()
{
$templatename = Yii::app()->request->getPost('templatename');
$oTemplate = TemplateConfiguration::getInstanceFromTemplateName($templatename);
$previewTag = $oTemplate->getPreview();
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/tokens.php
Expand Up @@ -2358,7 +2358,7 @@ public function bouncesettings($iSurveyId)
public function prepExportToCPDB()
{
$exportedItems = Yii::app()->request->getPost('itemsid', []);
if(is_array($exportedItems)) { $_FILESexportedItems = json_encode($exportedItems); }
if (is_array($exportedItems)) { $_FILESexportedItems = json_encode($exportedItems); }
Yii::app()->session['participantid'] = $exportedItems;
return;
}
Expand Down
4 changes: 3 additions & 1 deletion application/core/Survey_Common_Action.php
Expand Up @@ -370,7 +370,9 @@ protected function _updatenotification()
private function _notifications()
{
$aMessage = App()->session['arrayNotificationMessages'];
if (!is_array($aMessage)) $aMessage = array();
if (!is_array($aMessage)) {
$aMessage = array();
}
unset(App()->session['arrayNotificationMessages']);
return $this->getController()->renderPartial("notifications/notifications", array('aMessage'=>$aMessage));
}
Expand Down
6 changes: 4 additions & 2 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -887,7 +887,8 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
*
* @return void
*/
function resetTutorials337($oDB) {
function resetTutorials337($oDB)
{
$oDB->createCommand()->truncateTable('{{tutorials}}');
$oDB->createCommand()->insert('{{tutorials}}', array(
'tid' => 1,
Expand Down Expand Up @@ -1514,7 +1515,8 @@ function resetTutorials337($oDB) {
* @param CDbConnection $oDB
* @return void
*/
function upgrade333($oDB) {
function upgrade333($oDB)
{

$oDB->createCommand()->createTable('{{map_tutorial_users}}', array(
'tid' => 'int NOT NULL',
Expand Down
3 changes: 3 additions & 0 deletions application/libraries/MersenneTwister.php
Expand Up @@ -110,6 +110,9 @@ public function __construct($seed = null)
$this->setSeed($seed);
}

/**
* @param integer $seed
*/
public function setSeed($seed)
{
$this->state[0] = $seed & 0xffffffff;
Expand Down
10 changes: 5 additions & 5 deletions application/models/MapTutorialUsers.php
Expand Up @@ -73,11 +73,11 @@ public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.

$criteria=new CDbCriteria;
$criteria = new CDbCriteria;

$criteria->compare('tid',$this->tid);
$criteria->compare('uid',$this->uid);
$criteria->compare('taken',$this->taken);
$criteria->compare('tid', $this->tid);
$criteria->compare('uid', $this->uid);
$criteria->compare('taken', $this->taken);

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
Expand All @@ -90,7 +90,7 @@ public function search()
* @param string $className active record class name.
* @return MapTutorialUsers the static model class
*/
public static function model($className=__CLASS__)
public static function model($className = __CLASS__)
{
return parent::model($className);
}
Expand Down
2 changes: 1 addition & 1 deletion application/models/Surveymenu.php
Expand Up @@ -341,7 +341,7 @@ public function restoreDefaults()
$headerArray = ['parent_id', 'survey_id', 'user_id', 'ordering', 'level', 'name', 'title', 'position', 'description', 'active', 'changed_at', 'changed_by', 'created_at', 'created_by'];
$oDB->createCommand()->insert("{{surveymenu}}", array_combine($headerArray, [null, null, null, 0, 0, 'mainmenu', 'Survey menu', 'side', 'Main survey menu', 1, date('Y-m-d H:i:s'), 0, date('Y-m-d H:i:s'), 0]));
$oDB->createCommand()->insert("{{surveymenu}}", array_combine($headerArray, [null, null, null, 0, 0, 'quickmenu', 'Quick menu', 'collapsed', 'Quick menu', 1, date('Y-m-d H:i:s'), 0, date('Y-m-d H:i:s'), 0]));
$oDB->createCommand()->insert("{{surveymenu}}", array_combine($headerArray, [1, NULL, NULL, 0, 1, 'pluginmenu', 'Plugin menu', 'side', 'Plugin menu', 1, date('Y-m-d H:i:s'), 0, date('Y-m-d H:i:s'), 0]));
$oDB->createCommand()->insert("{{surveymenu}}", array_combine($headerArray, [1, null, null, 0, 1, 'pluginmenu', 'Plugin menu', 'side', 'Plugin menu', 1, date('Y-m-d H:i:s'), 0, date('Y-m-d H:i:s'), 0]));

$oTransaction->commit();
} catch (Exception $e) {
Expand Down
4 changes: 2 additions & 2 deletions application/models/Template.php
Expand Up @@ -156,7 +156,7 @@ public static function templateNameFilter($sTemplateName)
/* Validate if template is OK in user dir, DIRECTORY_SEPARATOR not needed "/" is OK */
$oTemplate = self::model()->findByPk($sTemplateName);

if (is_object($oTemplate) && ( self::checkTemplateXML($oTemplate->folder) )) {
if (is_object($oTemplate) && (self::checkTemplateXML($oTemplate->folder))) {
self::$aNamesFiltered[$sTemplateName] = $sTemplateName;
return self::$aNamesFiltered[$sTemplateName];
}
Expand Down Expand Up @@ -189,7 +189,7 @@ public static function templateNameFilter($sTemplateName)
*/
public static function checkTemplateXML($sTemplateFolder)
{
return ( is_file(Yii::app()->getConfig("userthemerootdir").DIRECTORY_SEPARATOR.$sTemplateFolder.DIRECTORY_SEPARATOR.'config.xml') || is_file( Yii::app()->getConfig("standardthemerootdir").DIRECTORY_SEPARATOR.$sTemplateFolder.DIRECTORY_SEPARATOR.'config.xml'));
return (is_file(Yii::app()->getConfig("userthemerootdir").DIRECTORY_SEPARATOR.$sTemplateFolder.DIRECTORY_SEPARATOR.'config.xml') || is_file(Yii::app()->getConfig("standardthemerootdir").DIRECTORY_SEPARATOR.$sTemplateFolder.DIRECTORY_SEPARATOR.'config.xml'));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions application/models/TemplateConfiguration.php
Expand Up @@ -309,7 +309,7 @@ public static function getInstance($sTemplateName = null, $iSurveyGroupId = null

$oTemplateConfigurationModel = new TemplateConfiguration();

if ($sTemplateName != null && $iSurveyGroupId == null && $iSurveyId == null ) {
if ($sTemplateName != null && $iSurveyGroupId == null && $iSurveyId == null) {
$oTemplateConfigurationModel = TemplateConfiguration::getInstanceFromTemplateName($sTemplateName);
}

Expand Down Expand Up @@ -423,7 +423,7 @@ public function checkTemplate()
{
if (empty($this->bTemplateCheckResult)) {
$this->bTemplateCheckResult = true;
if ( ! is_object($this->template) || ( is_object($this->template) && ! Template::checkTemplateXML($this->template->folder) )) {
if (!is_object($this->template) || (is_object($this->template) && !Template::checkTemplateXML($this->template->folder))) {
$this->bTemplateCheckResult = false;
}
}
Expand Down Expand Up @@ -563,7 +563,7 @@ class="btn btn-danger btn-block">
class="btn btn-danger btn-block"
disabled
data-toggle="tooltip"
title="' . gT('You cannot uninstall the default template.') . '"
title="' . gT('You cannot uninstall the default template.').'"
>
<span class="icon-trash"></span>
'.gT('Uninstall').'
Expand Down
6 changes: 3 additions & 3 deletions application/models/TemplateManifest.php
Expand Up @@ -564,11 +564,11 @@ private function readManifest()
$oXMLConfig = simplexml_load_string($sXMLConfigFile);


foreach($oXMLConfig->config->xpath("//file") as $oFileName){
$oFileName[0] = get_absolute_path( $oFileName[0]);
foreach ($oXMLConfig->config->xpath("//file") as $oFileName) {
$oFileName[0] = get_absolute_path($oFileName[0]);
}

$this->config = $oXMLConfig; // Using PHP >= 5.4 then no need to decode encode + need attributes : then other function if needed :https://secure.php.net/manual/en/book.simplexml.php#108688 for example
$this->config = $oXMLConfig; // Using PHP >= 5.4 then no need to decode encode + need attributes : then other function if needed :https://secure.php.net/manual/en/book.simplexml.php#108688 for example
libxml_disable_entity_loader($bOldEntityLoaderState); // Put back entity loader to its original state, to avoid contagion to other applications on the server
} else {
throw new Exception(" Error: Can't find a manifest for $this->sTemplateName in ' $this->path ' ");
Expand Down
3 changes: 2 additions & 1 deletion application/models/TutorialEntry.php
Expand Up @@ -105,7 +105,8 @@ public static function model($className = __CLASS__)
return $model;
}

public function getStepFromEntry() {
public function getStepFromEntry()
{
$stepArray = json_decode($this->settings, true);
$stepArray['content'] = gT($this->content, 'unescaped');
$stepArray['title'] = gT($this->title, 'unescaped');
Expand Down
12 changes: 6 additions & 6 deletions application/models/TutorialEntryRelation.php
Expand Up @@ -77,12 +77,12 @@ public function search()
{
// @todo Please modify the following code to remove attributes that should not be searched.

$criteria=new CDbCriteria;
$criteria = new CDbCriteria;

$criteria->compare('teid',$this->teid);
$criteria->compare('tid',$this->tid);
$criteria->compare('uid',$this->uid);
$criteria->compare('sid',$this->sid);
$criteria->compare('teid', $this->teid);
$criteria->compare('tid', $this->tid);
$criteria->compare('uid', $this->uid);
$criteria->compare('sid', $this->sid);

return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
Expand All @@ -95,7 +95,7 @@ public function search()
* @param string $className active record class name.
* @return TutorialEntryRelation the static model class
*/
public static function model($className=__CLASS__)
public static function model($className = __CLASS__)
{
return parent::model($className);
}
Expand Down
9 changes: 6 additions & 3 deletions application/models/Tutorials.php
Expand Up @@ -75,7 +75,8 @@ public function attributeLabels()
);
}

public function getColumns() {
public function getColumns()
{
$cols = array(
array(
'name' => 'tid',
Expand Down Expand Up @@ -141,7 +142,8 @@ public function getActiveTutorials()
return self::model()->findAll('active=1');
}

public function setFinished($iUserId) {
public function setFinished($iUserId)
{
$oMapTutUser = MapTutorialUsers::model()->find('uid=:uid AND tid=:tid', [':uid' => $iUserId, 'tid' => $this->tid]);
if ($oMapTutUser == null) {
$oMapTutUser = new MapTutorialUsers();
Expand All @@ -153,7 +155,8 @@ public function setFinished($iUserId) {
}
}

public function getTutorialDataArray($tutorialName) {
public function getTutorialDataArray($tutorialName)
{

if ($this->tid === null) { return []; }
$aTutorialEntryRelations = TutorialEntryRelation::model()->findAll('tid=:tid', [':tid'=>$this->tid]);
Expand Down

0 comments on commit 848bc26

Please sign in to comment.