Skip to content

Commit

Permalink
Dev: application/core code inspection - remove undefined things (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson authored and LouisGac committed Jun 23, 2017
1 parent cb1c725 commit 0495d24
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 30 deletions.
9 changes: 4 additions & 5 deletions application/core/LSHttpRequest.php
Expand Up @@ -127,11 +127,10 @@ public function updateNavigationStack()
}

/**
* Method to check if an url is part of the stack
* Returns true, when an url is saved in the stack
* @param string $referrerURL The URL that is checked against the stack
* @return bool
*/
* Method to check if an url is part of the stack
* @return bool Returns true, when an url is saved in the stack
* @param string $referrerURL The URL that is checked against the stack
*/
protected function checkLoopInNavigationStack($referrerURL)
{
$navStack = App()->session['LSNAVSTACK'];
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSYii_Application.php
Expand Up @@ -193,7 +193,7 @@ public function loadConfig($file)
*
* @access public
* @param string $name
* @param type $default Value to return when not found, default is false
* @param boolean|mixed $default Value to return when not found, default is false
* @return mixed
*/
public function getConfig($name, $default = false)
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSYii_ClientScript.php
Expand Up @@ -50,7 +50,7 @@ public function getCoreScripts()
* Remove a package from coreScript.
* It can be useful when mixing backend/frontend rendering (see: template editor)
*
* @var $name of the package to remove
* @var string $sName of the package to remove
*/
public function unregisterPackage($sName)
{
Expand Down
17 changes: 6 additions & 11 deletions application/core/Survey_Common_Action.php
Expand Up @@ -595,19 +595,15 @@ function _organizequestionbar($aData)
/**
* Shows admin menu for question
*
* @param int Survey id
* @param int Group id
* @param int Question id
* @param string action
* @param array $aData
*/
function _questionbar($aData)
public function _questionbar($aData)
{
if(isset($aData['questionbar']))
{
if (is_object($aData['oSurvey']))
{
if(isset($aData['questionbar'])) {
if (is_object($aData['oSurvey'])) {

$iSurveyID = $aData['surveyid'];
/** @var Survey $oSurvey */
$oSurvey = $aData['oSurvey'];
$gid = $aData['gid'];
$qid = $aData['qid'];
Expand Down Expand Up @@ -1090,8 +1086,7 @@ private function _listquestions($aData)

/**
* Show survey summary
* @param int Survey id
* @param string Action to be performed
* @param array $aData
*/
public function _surveysummary($aData)
{
Expand Down
2 changes: 1 addition & 1 deletion application/core/plugins/AuthLDAP/AuthLDAP.php
Expand Up @@ -127,7 +127,7 @@ public function init() {
/**
* Check availability of LDAP Apache Module
*
* @return unknown_type
* @return null
*/
public function beforeActivate()
{
Expand Down
11 changes: 4 additions & 7 deletions application/core/plugins/Authdb/Authdb.php
Expand Up @@ -33,15 +33,13 @@ public function init()
public function createNewUser()
{
// Do nothing if the user to be added is not DB type
if (flattenText(Yii::app()->request->getPost('user_type')) != 'DB')
{
if (flattenText(Yii::app()->request->getPost('user_type')) != 'DB') {
return;
}
$oEvent = $this->getEvent();
$new_user = flattenText(Yii::app()->request->getPost('new_user'), false, true);
$new_email = flattenText(Yii::app()->request->getPost('new_email'), false, true);
if (!validateEmailAddress($new_email))
{
if (!validateEmailAddress($new_email)) {
$oEvent->set('errorCode',self::ERROR_INVALID_EMAIL);
$oEvent->set('errorMessageTitle',gT("Failed to add user"));
$oEvent->set('errorMessageBody',gT("The email address is not valid."));
Expand All @@ -50,8 +48,7 @@ public function createNewUser()
$new_full_name = flattenText(Yii::app()->request->getPost('new_full_name'), false, true);
$new_pass = createPassword();
$iNewUID = User::model()->insertUser($new_user, $new_pass, $new_full_name, Yii::app()->session['loginID'], $new_email);
if (!$iNewUID)
{
if (!$iNewUID) {
$oEvent->set('errorCode',self::ERROR_ALREADY_EXISTING_USER);
$oEvent->set('errorMessageTitle','');
$oEvent->set('errorMessageBody',gT("Failed to add user"));
Expand Down Expand Up @@ -179,7 +176,7 @@ public function newUserSession()
/**
* Set the onetime password
*
* @param type $onepass
* @param string $onepass
* @return Authdb
*/
protected function setOnePass($onepass)
Expand Down
4 changes: 2 additions & 2 deletions application/core/plugins/ExportR/RDataWriter.php
Expand Up @@ -28,8 +28,8 @@ public function init(\SurveyObj $survey, $sLanguageCode, \FormattingOptions $oOp
/**
* Perform response transformation, for example F/M for female/male will be mapped to 1/2 values
*
* @param type $value
* @param type $fieldType
* @param string $value
* @param string $fieldType
* @param FormattingOptions $oOptions
* @return mixed
*/
Expand Down
Expand Up @@ -3,7 +3,7 @@
$list = "<div class='container'>";
$list .= "<div class='row'>";
$divideToggle = true;

/** @var Survey[] $publicSurveys */
foreach($publicSurveys as $survey)
{
$outputSurveys++;
Expand Down Expand Up @@ -153,9 +153,9 @@
"SURVEYLISTHEADING"=> $listheading,
"SURVEYLIST"=> $list,
);
// FIXME makeLanguageChanger() is not accessible from here??
$data['languagechanger'] = makeLanguageChanger(App()->language);
/* must register script if template don't do it */
App()->clientScript->registerScript("ExtendedStartpageToolTip","$('.surveytitle,.view-stats').tooltip()",CClientScript::POS_READY);
$oTemplate = Template::model()->getInstance("default");
echo templatereplace(file_get_contents($oTemplate->pstplPath."/surveylist.pstpl"),$aReplacementData,$data,'survey['.__LINE__.']');
?>

0 comments on commit 0495d24

Please sign in to comment.