Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Scrutinizer Auto-Fixes
This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information
scrutinizer-auto-fixer committed Nov 27, 2017
1 parent d49ff2a commit 3e8431d
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 78 deletions.
2 changes: 1 addition & 1 deletion application/commands/InstallCommand.php
Expand Up @@ -60,7 +60,7 @@ public function run($aArguments)
case 'mssql':
case 'sqlsrv':
break;
default:
default:
throw new Exception(sprintf('Unknown database type "%s".', $this->connection->driverName));
}

Expand Down
26 changes: 13 additions & 13 deletions application/controllers/admin/questions.php
Expand Up @@ -140,13 +140,13 @@ public function view($surveyid, $gid, $qid)
*/
public function importView($groupid = null, $surveyid)
{
$iSurveyID = (int)$surveyid;
$iSurveyID = (int) $surveyid;
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'import')) {
Yii::app()->session['flashmessage'] = gT("We are sorry but you don't have permissions to do this.");
$this->getController()->redirect(array('admin/survey/sa/listquestions/surveyid/'.$iSurveyID));
}
$survey = Survey::model()->findByPk($iSurveyID);
$aData=[];
$aData = [];
$aData['sidemenu']['state'] = false;
$aData['sidemenu']['questiongroups'] = true;
$aData['surveybar']['closebutton']['url'] = '/admin/survey/sa/listquestiongroups/surveyid/'.$iSurveyID; // Close button
Expand All @@ -173,7 +173,7 @@ public function import()
$gid = returnGlobal('gid');
$aViewUrls = array();

$aData=[];
$aData = [];
$aData['display']['menu_bars']['surveysummary'] = 'viewquestion';
$aData['display']['menu_bars']['gid_action'] = 'viewgroup';

Expand Down Expand Up @@ -210,7 +210,7 @@ public function import()
// IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY
Yii::app()->loadHelper('admin/import');

$aImportResults=array();
$aImportResults = array();
if (strtolower($sExtension) == 'lsq') {
$aImportResults = XMLImportQuestion($sFullFilepath, $iSurveyID, $gid, array('autorename'=>Yii::app()->request->getPost('autorename') == '1' ?true:false));
} else {
Expand Down Expand Up @@ -462,9 +462,9 @@ public function answeroptions($surveyid, $gid, $qid)
public function _editansweroptions($surveyid, $gid, $qid)
{
Yii::app()->loadHelper('database');
$iSurveyID = (int)$surveyid;
$qid = (int)$qid;
$gid = (int)$gid;
$iSurveyID = (int) $surveyid;
$qid = (int) $qid;
$gid = (int) $gid;

// Get languages select on survey.
$anslangs = Survey::model()->findByPk($iSurveyID)->additionalLanguages;
Expand Down Expand Up @@ -619,10 +619,10 @@ public function _editansweroptions($surveyid, $gid, $qid)
*/
public function subquestions($surveyid, $gid, $qid)
{
$aData=[];
$aData['surveyid'] = $surveyid = (int)$surveyid;
$aData['gid'] = $gid = (int)$gid;
$aData['qid'] = $qid = (int)$qid;
$aData = [];
$aData['surveyid'] = $surveyid = (int) $surveyid;
$aData['gid'] = $gid = (int) $gid;
$aData['qid'] = $qid = (int) $qid;

// Abort if user lacks permission to update survey content
if (!Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'update')) {
Expand Down Expand Up @@ -675,7 +675,7 @@ public function _editsubquestion($surveyid, $gid, $qid)
$this->getController()->redirect(Yii::app()->request->urlReferrer);
}

$surveyid = (int)$surveyid;
$surveyid = (int) $surveyid;
$oSurvey = Survey::model()->findByPk($surveyid);
$qid = sanitize_int($qid);
$gid = sanitize_int($gid);
Expand Down Expand Up @@ -1951,7 +1951,7 @@ public function ajaxValidate($surveyid, $qid = false)
// TODO: Longterm, change 'other' to boolean; change the model rules
$_POST['other'] = (Yii::app()->request->getPost('other') == '1') ? 'Y' : 'N';

$iSurveyId = (int)$surveyid;
$iSurveyId = (int) $surveyid;
$iQid = $qid;
$oSurvey = Survey::model()->findByPk($surveyid);
if ($oSurvey) {
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/surveyadmin.php
Expand Up @@ -1828,11 +1828,11 @@ function getUrlParamsJSON($iSurveyID)
$aData = array(
'rows' => []
);
foreach($aSurveyParameters as $oSurveyParameter){
foreach($aSurveyParameters as $oSurveyParameter) {
$row = $oSurveyParameter->attributes;
$row['questionTitle'] = $oSurveyParameter->question->title;

if($oSurveyParameter->targetsqid != ''){
if($oSurveyParameter->targetsqid != '') {
$row['subQuestionTitle'] = $oSurveyParameter->subquestion->title;
}

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/surveypermission.php
Expand Up @@ -202,7 +202,7 @@ public function index($iSurveyID)
. "<li><label class='col-sm-1 col-md-offset-2 text-right control-label' for='uidselect'>".gT("User").": </label>
<div class='col-sm-4'>
<select id='uidselect' name='uid' class='form-control'>\n"
. getSurveyUserList( false, $iSurveyID)
. getSurveyUserList(false, $iSurveyID)
. "</select></div>\n"
. "<input style='width: 15em;' class='btn btn-default' type='submit' value='".gT("Add user")."' onclick=\"if (document.getElementById('uidselect').value == -1) { alert('".gT("Please select a user first", "js")."'); return false;}\"/>"
. "<input type='hidden' name='action' value='addsurveysecurity' />"
Expand Down
60 changes: 30 additions & 30 deletions application/controllers/admin/tokens.php
Expand Up @@ -33,8 +33,8 @@ class tokens extends Survey_Common_Action
public function index($surveyid)
{
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'tokens.js', LSYii_ClientScript::POS_BEGIN);
$iSurveyId=$surveyid;
$iSurveyId = (int)$iSurveyId;
$iSurveyId = $surveyid;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);

//// TODO : check if it does something different than the model function
Expand Down Expand Up @@ -75,7 +75,7 @@ public function index($surveyid)
*/
public function bounceprocessing($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!$survey->hasTokensTable) {
eT("No token table.");
Expand Down Expand Up @@ -176,7 +176,7 @@ public function bounceprocessing($iSurveyId)
}
foreach ($aMessageIDs as $sMessageID) {
$header = explode("\r\n", imap_body($mbox, $sMessageID, FT_UID & FT_PEEK)); // Don't mark messages as read
$iSurveyIdBounce='';
$iSurveyIdBounce = '';
foreach ($header as $item) {
if (preg_match('/^X-surveyid/', $item)) {
$iSurveyIdBounce = explode(": ", $item);
Expand Down Expand Up @@ -271,7 +271,7 @@ public function deleteToken()
*/
public function browse($iSurveyId, $limit = 50, $start = 0)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);

/* Check permissions */
Expand All @@ -288,7 +288,7 @@ public function browse($iSurveyId, $limit = 50, $start = 0)
}

/* build JS variable to hide buttons forbidden for the current user */
$aData=[];
$aData = [];
$aData['showDelButton'] = Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'delete') ? 'true' : 'false';
$aData['showInviteButton'] = Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') ? 'true' : 'false';
$aData['showBounceButton'] = Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') ? 'true' : 'false';
Expand Down Expand Up @@ -480,8 +480,8 @@ public function editMultiple()
*/
public function editToken($iSurveyId)
{
$iSurveyId=(int)$iSurveyId;
$aData=[];
$iSurveyId = (int) $iSurveyId;
$aData = [];
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'tokens.js', LSYii_ClientScript::POS_BEGIN);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'create')) {
eT("We are sorry but you don't have permissions to do this."); // return json ? error not treated in js.
Expand Down Expand Up @@ -596,7 +596,7 @@ public function addnew($iSurveyId)
{
$aData = array();
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'tokens.js', LSYii_ClientScript::POS_BEGIN);
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);

// Check permission
Expand Down Expand Up @@ -743,7 +743,7 @@ public function edit($iSurveyId, $iTokenId, $ajax = false)

Yii::import('application.helpers.admin.ajax_helper', true);
Yii::import('application.libraries.Date_Time_Converter', true);
$aTokenData=[];
$aTokenData = [];
if (trim($request->getPost('validfrom')) == '') {
$_POST['validfrom'] = null;
} else {
Expand Down Expand Up @@ -813,7 +813,7 @@ public function edit($iSurveyId, $iTokenId, $ajax = false)
public function delete($iSurveyID)
{
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'tokens.js', LSYii_ClientScript::POS_BEGIN);
$iSurveyID = (int)$iSurveyID;
$iSurveyID = (int) $iSurveyID;
$sTokenIDs = Yii::app()->request->getPost('tid');
$survey = Survey::model()->findByPk($iSurveyID);
/* Check permissions */
Expand Down Expand Up @@ -851,7 +851,7 @@ public function delete($iSurveyID)
*/
public function addDummies($iSurveyId, $subaction = '')
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'create')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down Expand Up @@ -914,8 +914,8 @@ public function addDummies($iSurveyId, $subaction = '')
$aData[$attr_name] = $value;
}

$amount = (int)Yii::app()->request->getPost('amount');
$iTokenLength = (int)Yii::app()->request->getPost('tokenlen');
$amount = (int) Yii::app()->request->getPost('amount');
$iTokenLength = (int) Yii::app()->request->getPost('tokenlen');

// Fill an array with all existing tokens
$existingtokens = array();
Expand Down Expand Up @@ -994,7 +994,7 @@ public function addDummies($iSurveyId, $subaction = '')
*/
public function managetokenattributes($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);

if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) {
Expand Down Expand Up @@ -1054,7 +1054,7 @@ public function managetokenattributes($iSurveyId)
*/
public function updatetokenattributes($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down Expand Up @@ -1092,7 +1092,7 @@ public function updatetokenattributes($iSurveyId)
*/
public function deletetokenattributes($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
if (!$survey->hasTokensTable) {
Expand Down Expand Up @@ -1153,7 +1153,7 @@ public function deletetokenattributes($iSurveyId)
*/
public function updatetokenattributedescriptions($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down Expand Up @@ -1201,7 +1201,7 @@ public function updatetokenattributedescriptions($iSurveyId)
*/
public function email($iSurveyId, $tokenids = null)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$aData = array();
$survey = Survey::model()->findByPk($iSurveyId);

Expand Down Expand Up @@ -1337,8 +1337,8 @@ public function email($iSurveyId, $tokenids = null)

foreach ($aSurveyLangs as $language) {
// See #08683 : this allow use of {TOKEN:ANYTHING}, directly replaced by {ANYTHING}
$sSubject[$language] = preg_replace("/{TOKEN:([A-Z0-9_]+)}/", "{"."$1"."}", Yii::app()->request->getPost('subject_'.$language,''));
$sMessage[$language] = preg_replace("/{TOKEN:([A-Z0-9_]+)}/", "{"."$1"."}", Yii::app()->request->getPost('message_'.$language,''));
$sSubject[$language] = preg_replace("/{TOKEN:([A-Z0-9_]+)}/", "{"."$1"."}", Yii::app()->request->getPost('subject_'.$language, ''));
$sMessage[$language] = preg_replace("/{TOKEN:([A-Z0-9_]+)}/", "{"."$1"."}", Yii::app()->request->getPost('message_'.$language, ''));
if ($bHtml) {
$sMessage[$language] = html_entity_decode($sMessage[$language], ENT_QUOTES, Yii::app()->getConfig("emailcharset"));
}
Expand Down Expand Up @@ -1445,13 +1445,13 @@ public function email($iSurveyId, $tokenids = null)
$event->set('token', $emrow);
App()->getPluginManager()->dispatchEvent($event);
$modsubject = $event->get('subject');
$modmessage = (string)$event->get('body'); // You never know what type you could get back here
$modmessage = (string) $event->get('body'); // You never know what type you could get back here
$to = $event->get('to');
$from = $event->get('from');
$bounce = $event->get('bounce');
if ($event->get('send', true) == false) {
// This is some ancient global used for error reporting instead of a return value from the actual mail function..
$maildebug = (string)$event->get('error', $maildebug);
$maildebug = (string) $event->get('error', $maildebug);
$success = $event->get('error') == null;
} else {
$success = SendEmailMessage($modmessage, $modsubject, $to, $from, Yii::app()->getConfig("sitename"), $bHtml, $bounce, $aRelevantAttachments, $customheaders);
Expand Down Expand Up @@ -1545,7 +1545,7 @@ public function email($iSurveyId, $tokenids = null)
*/
public function exportdialog($iSurveyId)
{
$iSurveyId=(int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
$aData = array();

Expand All @@ -1556,7 +1556,7 @@ public function exportdialog($iSurveyId)
$aData['token_bar']['closebutton']['url'] = 'admin/tokens/sa/index/surveyid/'.$iSurveyId; // Close button

// CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
$this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
Expand Down Expand Up @@ -1869,7 +1869,7 @@ public function importldap($iSurveyId)
$aData['sError'] = sprintf(gT("Can't bind to the LDAP directory. Error message: %s"), ldap_error($ds));
$this->_renderWrappedTemplate('token', array('ldapform'), $aData);
}
try {
try {
@ldap_close($ds);
} catch (Exception $e) {
// No handling needed
Expand Down Expand Up @@ -2110,7 +2110,7 @@ public function import($iSurveyId)
}
if (substr($value, 0, 1) == '"' && substr($value, -1) == '"') {
// Fix CSV quote
$aWriteArray[$key]= substr($value, 1, -1);
$aWriteArray[$key] = substr($value, 1, -1);
}
}
// Some default value : to be moved to Token model rules in future release ?
Expand Down Expand Up @@ -2193,7 +2193,7 @@ public function import($iSurveyId)
*/
public function tokenify($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down Expand Up @@ -2252,7 +2252,7 @@ public function tokenify($iSurveyId)
*/
public function kill($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'surveysettings', 'update') && !Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'delete')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down Expand Up @@ -2310,7 +2310,7 @@ public function kill($iSurveyId)
*/
public function bouncesettings($iSurveyId)
{
$iSurveyId = (int)$iSurveyId;
$iSurveyId = (int) $iSurveyId;
$survey = Survey::model()->findByPk($iSurveyId);
if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'update')) {
Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
Expand Down

0 comments on commit 3e8431d

Please sign in to comment.