Skip to content

Commit

Permalink
Dev More brace 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 authored and c-schmitz committed Nov 23, 2017
1 parent 38016cf commit e2f1040
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 381 deletions.
10 changes: 5 additions & 5 deletions application/controllers/admin/PluginHelper.php
@@ -1,4 +1,6 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}

/**
* @todo Better name?
Expand Down Expand Up @@ -77,8 +79,7 @@ protected function getPluginInstanceAndMethod($pluginName, $methodName)
// Get plugin class, abort if not found
try {
$refClass = new ReflectionClass($pluginName);
}
catch (ReflectionException $ex) {
} catch (ReflectionException $ex) {
throw new \CException("Can't find a plugin with class name $pluginName");
}

Expand All @@ -95,8 +96,7 @@ protected function getPluginInstanceAndMethod($pluginName, $methodName)
// Get plugin method, abort if not found
try {
$refMethod = $refClass->getMethod($methodName);
}
catch (ReflectionException $ex) {
} catch (ReflectionException $ex) {
throw new \CException("Plugin $pluginName has no method $methodName");
}

Expand Down
23 changes: 14 additions & 9 deletions application/controllers/admin/SurveysGroupsController.php
Expand Up @@ -13,8 +13,9 @@
* Surveys Groups Controller
*/

if (!defined('BASEPATH'))
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}


class SurveysGroupsController extends Survey_Common_Action
Expand Down Expand Up @@ -47,8 +48,9 @@ public function create()
$model->attributes = $_POST['SurveysGroups'];
$model->name = sanitize_paranoid_string($model->name);
$model->created_by = $model->owner_uid = Yii::app()->user->id;
if ($model->save())
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/listsurveys').'#surveygroups');
if ($model->save()) {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/listsurveys').'#surveygroups');
}
}

$aData['model'] = $model;
Expand All @@ -72,8 +74,9 @@ public function update($id)

if (isset($_POST['SurveysGroups'])) {
$model->attributes = $_POST['SurveysGroups'];
if ($model->save())
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/listsurveys').'#surveygroups');
if ($model->save()) {
$this->getController()->redirect($this->getController()->createUrl('admin/survey/sa/listsurveys').'#surveygroups');
}
}

$aData['model'] = $model;
Expand Down Expand Up @@ -132,8 +135,9 @@ public function admin()
{
$model = new SurveysGroups('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['SurveysGroups']))
$model->attributes = $_GET['SurveysGroups'];
if (isset($_GET['SurveysGroups'])) {
$model->attributes = $_GET['SurveysGroups'];
}

$this->render('admin', array(
'model'=>$model,
Expand All @@ -150,8 +154,9 @@ public function admin()
public function loadModel($id)
{
$model = SurveysGroups::model()->findByPk($id);
if ($model === null)
throw new CHttpException(404, 'The requested page does not exist.');
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}

Expand Down
38 changes: 23 additions & 15 deletions application/controllers/admin/assessments.php
@@ -1,4 +1,6 @@
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
<?php if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* LimeSurvey
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz
Expand Down Expand Up @@ -46,22 +48,25 @@ public function index($iSurveyID)
Yii::app()->setConfig("baselang", $surveyLanguage);
Yii::app()->setConfig("assessmentlangs", $languages);

if ($sAction == "assessmentadd")
$this->_add($iSurveyID);
if ($sAction == "assessmentadd") {
$this->_add($iSurveyID);
}

if ($sAction == "assessmentupdate")
$this->_update($iSurveyID);
if ($sAction == "assessmentupdate") {
$this->_update($iSurveyID);
}

if ($sAction == "assessmentdelete")
$this->_delete($iSurveyID, $_POST['id']);
if ($sAction == "assessmentdelete") {
$this->_delete($iSurveyID, $_POST['id']);
}

if ($sAction == "asessementactivate")
$this->_activateAsessement($iSurveyID);
if ($sAction == "asessementactivate") {
$this->_activateAsessement($iSurveyID);
}


$this->_showAssessments($iSurveyID, $sAction, $surveyLanguage);
}
else
} else
{
Yii::app()->setFlashMessage(gT("You do not have permission to access this page."), 'error');
$this->getController()->redirect(array("admin/"));
Expand Down Expand Up @@ -159,8 +164,10 @@ private function _collectGroupData($iSurveyID)
private function _collectEditData(array $aData)
{
$oAssessment = Assessment::model()->find("id=:id", array(':id' => App()->request->getParam('id')));
if (!$oAssessment)
throw new CHttpException(500); // 404 ?
if (!$oAssessment) {
throw new CHttpException(500);
}
// 404 ?
$editData = $oAssessment->attributes;
$aData['actiontitle'] = gT("Edit");
Expand Down Expand Up @@ -224,8 +231,9 @@ private function _delete($iSurveyID, $assessmentId)

private function _getAssessmentPostData($iSurveyID, $language)
{
if (!isset($_POST['gid']))
$_POST['gid'] = 0;
if (!isset($_POST['gid'])) {
$_POST['gid'] = 0;
}

return array(
'sid' => $iSurveyID,
Expand Down
18 changes: 7 additions & 11 deletions application/controllers/admin/authentication.php
Expand Up @@ -2,8 +2,9 @@
// see: https://scrutinizer-ci.com/g/LimeSurvey/LimeSurvey/issues/master/files/application/controllers/admin/authentication.php?selectedSeverities[0]=10&orderField=path&order=asc&honorSelectedPaths=0
// use LimeSurvey\PluginManager\PluginEvent;

if (!defined('BASEPATH'))
if (!defined('BASEPATH')) {
exit('No direct script access allowed');
}
/*
* LimeSurvey
* Copyright (C) 2007-2011 The LimeSurvey Project Team / Carsten Schmitz
Expand Down Expand Up @@ -56,8 +57,7 @@ public function index()
if ($succeeded) {
ls\ajax\AjaxHelper::outputSuccess(gT('Successful login'));
return;
}
else if ($failed) {
} else if ($failed) {
ls\ajax\AjaxHelper::outputError(gT('Incorrect username and/or password!'));
return;
}
Expand All @@ -66,8 +66,7 @@ public function index()
else {
if ($succeeded) {
self::doRedirect();
}
else if ($failed) {
} else if ($failed) {
$message = $result[1];
App()->user->setFlash('error', $message);
App()->getController()->redirect(array('/admin/authentication/sa/login'));
Expand Down Expand Up @@ -130,8 +129,7 @@ public static function prepareLogin()
// @see: http://img.memecdn.com/knees-weak-arms-are-heavy_c_3011277.jpg
if (!is_null($beforeLogin->get('default'))) {
$aData['defaultAuth'] = $beforeLogin->get('default');
}
else {
} else {
// THen, it checks if the the user set a different default plugin auth in application/config/config.php
// eg: 'config'=>array()'debug'=>2,'debugsql'=>0, 'default_displayed_auth_method'=>'muh_auth_method')
if (App()->getPluginManager()->isPluginActive(Yii::app()->getConfig('default_displayed_auth_method'))) {
Expand Down Expand Up @@ -294,8 +292,7 @@ private function _sendPasswordEmail($sEmailAddr, $aFields)
User::updatePassword($aFields[0]['uid'], $sNewPass);
// For security reasons, we don't show a successful message
$sMessage = gT('If the username and email address is valid and you are allowed to use the internal database authentication a new password has been sent to you');
}
else
} else
{
$sMessage = gT('Email failed');
}
Expand Down Expand Up @@ -361,8 +358,7 @@ private function _userCanLogin()
if ($failed_login_attempts->isLockedOut())
{
return $this->_getAuthenticationFailedErrorMessage();
}
else
} else
{
return true;
}
Expand Down

0 comments on commit e2f1040

Please sign in to comment.