Skip to content

Commit

Permalink
Dev: Make the frontend Optin and Optout accessible
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11742 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Gaurav Narula committed Dec 23, 2011
1 parent b4212e1 commit 888498c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
Expand Up @@ -22,14 +22,9 @@
* @version $Id$
* @access public
*/
class optin extends LSYii_Controller {
class OptinController extends LSYii_Controller {

function __construct()
{
parent::__construct();
}

function local($langcode, $surveyid, $token)
function actionLocal($langcode, $surveyid, $token)
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
Expand Down Expand Up @@ -60,9 +55,11 @@ function local($langcode, $surveyid, $token)
$baselang = $sLanguageCode;
}

$thissurvey=getSurveyInfo($iSurveyID,$baselang);
Yii::app()->lang = $clang;

if ($thissurvey == false || Yii::app()->db->schema->getTable("tokens_{$iSurveyID}") == null)
$thissurvey=getSurveyInfo($iSurveyID,$baselang);

if ($thissurvey == false || Yii::app()->db->schema->getTable("{{tokens_{$iSurveyID}}}") == null)
{
$html = $clang->gT('This survey does not seem to exist.');
}
Expand Down Expand Up @@ -102,16 +99,17 @@ function local($langcode, $surveyid, $token)
{
$thistpl=sGetTemplatePath($thissurvey['templatedir']);
}
$this->_renderHtml($html,$thistpl);
$this->_renderHtml($html,$thistpl,$clang);
}

private function _renderHtml($html,$thistpl)
private function _renderHtml($html,$thistpl,$clang)
{
sendcacheheaders();
doHeader();
$data['html'] = $html;
$data['thistpl'] = $thistpl;
$this->getController()->render('/opt_view',$data);
$data['clang'] = $clang;
$this->render('/opt_view',$data);
doFooter();
}
}
Expand Up @@ -21,14 +21,9 @@
* @version $Id$
* @access public
*/
class optout extends LSYii_Controller {
class OptoutController extends LSYii_Controller {

function __construct()
{
parent::__construct();
}

function local($langcode, $surveyid, $token)
function actionLocal($langcode, $surveyid, $token)
{
Yii::app()->loadHelper('database');
Yii::app()->loadHelper('sanitize');
Expand Down Expand Up @@ -57,9 +52,12 @@ function local($langcode, $surveyid, $token)
$clang = new Limesurvey_lang(array('langcode' => $sLanguageCode));
$baselang = $sLanguageCode;
}

Yii::app()->lang = $clang;

$thissurvey=getSurveyInfo($iSurveyID,$baselang);

if ($thissurvey==false || !tableExists("tokens_{$iSurveyID}")){
if ($thissurvey==false || !tableExists("{{tokens_{$iSurveyID}}}")){
$html = $clang->gT('This survey does not seem to exist.');
}
else
Expand Down Expand Up @@ -104,7 +102,7 @@ private function _renderHtml($html,$thistpl)
doHeader();
$data['html'] = $html;
$data['thistpl'] = $thistpl;
$this->getController()->render('/opt_view',$data);
$this->render('/opt_view',$data);
doFooter();
}

Expand Down
2 changes: 1 addition & 1 deletion application/models/Tokens_dynamic.php
Expand Up @@ -472,7 +472,7 @@ function getEmailStatus($sid,$token)

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

0 comments on commit 888498c

Please sign in to comment.