Skip to content

Commit

Permalink
Fixed issue #6331: Opt-in and opt-out links not working
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Nov 5, 2012
1 parent b33300a commit 4b2d4e0
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions application/controllers/OptinController.php
Expand Up @@ -65,7 +65,7 @@ function actiontokens($surveyid, $token, $langcode = '')
}
else
{
$row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($iSurveyID, $sToken);
$row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken);

if ($row == false)
{
Expand All @@ -76,7 +76,7 @@ function actiontokens($surveyid, $token, $langcode = '')
$usresult = $row['emailstatus'];
if ($usresult=='OptOut')
{
$usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($iSurveyID, $sToken, 'OK');
$usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OK');
$html = $clang->gT('You have been successfully added back to this survey.');
}
else if ($usresult=='OK')
Expand Down
10 changes: 5 additions & 5 deletions application/controllers/OptoutController.php
Expand Up @@ -72,7 +72,7 @@ function actiontokens()
}
else
{
$row = Tokens_dynamic::model()->getEmailStatus($iSurveyID, $sToken);
$row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken);

if ($row == false)
{
Expand All @@ -83,7 +83,7 @@ function actiontokens()
$usresult = $row['emailstatus'];
if ($usresult == 'OK')
{
$usresult = Tokens_dynamic::model()->updateEmailStatus($iSurveyID, $sToken, 'OptOut');
$usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut');
$html = $clang->gT('You have been successfully removed from this survey.');
}
else
Expand Down Expand Up @@ -155,8 +155,8 @@ function actionparticipants()
}
else
{
$row = Tokens_dynamic::model()->getEmailStatus($iSurveyID, $sToken);
$datas = Tokens_dynamic::model()->model($iSurveyID)->find('token = :token', array(":token"=>$sToken));
$row = Tokens_dynamic::model($iSurveyID)->getEmailStatus($sToken);
$datas = Tokens_dynamic::model($iSurveyID)->find('token = :token', array(":token"=>$sToken));

if ($row == false)
{
Expand All @@ -167,7 +167,7 @@ function actionparticipants()
$usresult = $row['emailstatus'];
if ($usresult == 'OK')
{
$usresult = Tokens_dynamic::model()->updateEmailStatus($iSurveyID, $sToken, 'OptOut');
$usresult = Tokens_dynamic::model($iSurveyID)->updateEmailStatus($sToken, 'OptOut');
$html = $clang->gT('You have been successfully removed from this survey.');
}
else
Expand Down
8 changes: 4 additions & 4 deletions application/models/Tokens_dynamic.php
Expand Up @@ -450,20 +450,20 @@ function deleteRecords($iTokenIds)
return Yii::app()->db->createCommand($dlquery)->query();
}

function getEmailStatus($sid,$token)
function getEmailStatus($token)
{
$command = Yii::app()->db->createCommand()
->select('emailstatus')
->from('{{tokens_'.intval($sid).'}}')
->from('{{tokens_'.intval(self::$sid).'}}')
->where('token=:token')
->bindParam(':token', $token, PDO::PARAM_STR);

return $command->queryRow();
}

function updateEmailStatus($sid,$token,$status)
function updateEmailStatus($token,$status)
{
return Yii::app()->db->createCommand()->update('{{tokens_'.intval($sid).'}}',array('emailstatus' => $status),'token = :token',array(':token' => $token ));
return Yii::app()->db->createCommand()->update('{{tokens_'.intval(self::$sid).'}}',array('emailstatus' => $status),'token = :token',array(':token' => $token ));
}
}
?>

0 comments on commit 4b2d4e0

Please sign in to comment.