From 888498cb085a97411d373c495f2435f73acb8529 Mon Sep 17 00:00:00 2001 From: Gaurav Narula Date: Fri, 23 Dec 2011 20:11:23 +0000 Subject: [PATCH] Dev: Make the frontend Optin and Optout accessible git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11742 b72ed6b6-b9f8-46b5-92b4-906544132732 --- .../{optin.php => OptinController.php} | 22 +++++++++---------- .../{optout.php => OptoutController.php} | 16 ++++++-------- application/models/Tokens_dynamic.php | 2 +- application/views/{admin => }/opt_view.php | 0 4 files changed, 18 insertions(+), 22 deletions(-) rename application/controllers/{optin.php => OptinController.php} (89%) rename application/controllers/{optout.php => OptoutController.php} (89%) rename application/views/{admin => }/opt_view.php (100%) diff --git a/application/controllers/optin.php b/application/controllers/OptinController.php similarity index 89% rename from application/controllers/optin.php rename to application/controllers/OptinController.php index 7f1aecd9d0d..be8c8e6ccca 100644 --- a/application/controllers/optin.php +++ b/application/controllers/OptinController.php @@ -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'); @@ -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.'); } @@ -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(); } } diff --git a/application/controllers/optout.php b/application/controllers/OptoutController.php similarity index 89% rename from application/controllers/optout.php rename to application/controllers/OptoutController.php index 229943e2f24..68f0054b019 100644 --- a/application/controllers/optout.php +++ b/application/controllers/OptoutController.php @@ -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'); @@ -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 @@ -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(); } diff --git a/application/models/Tokens_dynamic.php b/application/models/Tokens_dynamic.php index 6a5bb04bad7..58c91db8fc8 100644 --- a/application/models/Tokens_dynamic.php +++ b/application/models/Tokens_dynamic.php @@ -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 )); } } ?> diff --git a/application/views/admin/opt_view.php b/application/views/opt_view.php similarity index 100% rename from application/views/admin/opt_view.php rename to application/views/opt_view.php