Skip to content

Commit

Permalink
Merge pull request #13 from SamMousa/Yii
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jul 23, 2012
2 parents fed827e + e454acc commit 9bd682d
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions application/controllers/admin/export.php
Expand Up @@ -1085,12 +1085,12 @@ public function resources()
switch ( Yii::app()->request->getParam('export') )
{
case 'survey' :
$iSurveyID = sanitize_int(CHttpRequest::getParam('surveyid'));
$iSurveyID = sanitize_int(Yii::app()->getRequest()->getParam('surveyid'));
$resourcesdir = 'surveys/' . $iSurveyID;
$zipfilename = "resources-survey-$iSurveyID.zip";
break;
case 'label' :
$lid = sanitize_int(CHttpRequest::getParam('lid'));
$lid = sanitize_int(Yii::app()->getRequest()->getParam('lid'));
$resourcesdir = 'labels/' . $lid;
$zipfilename = "resources-labelset-$lid.zip";
break;
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/globalsettings.php
Expand Up @@ -58,7 +58,7 @@ private function _displaySettings()
Yii::app()->loadHelper('surveytranslator');

//save refurl from where global settings screen is called!
$refurl = CHttpRequest::getUrlReferrer();
$refurl = Yii::app()->getRequest()->getUrlReferrer();
Yii::app()->session['refurl'] = htmlspecialchars($refurl); //just to be safe!

$data['clang'] = $this->getController()->lang;
Expand Down Expand Up @@ -174,7 +174,7 @@ private function _saveSettings()
Yii::app()->session['flashmessage'] = $clang->gT("Global settings were saved.");

$url = htmlspecialchars_decode(Yii::app()->session['refurl']);
if($url){CController::redirect($url);}
if($url){Yii::app()->getController()->redirect($url);}
}

private function _checkSettings()
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/admin/labels.php
Expand Up @@ -384,9 +384,9 @@ public function getAllSets()

public function ajaxSets()
{
$lid = CHttpRequest::getPost('lid');
$answers = CHttpRequest::getPost('answers');
$code = CHttpRequest::getPost('code');
$lid = Yii::app()->getRequest()->getPost('lid');
$answers = Yii::app()->getRequest()->getPost('answers');
$code = Yii::app()->getRequest()->getPost('code');
//Create new label set
$language = "";
foreach ($answers as $lang => $answer) {
Expand All @@ -396,7 +396,7 @@ public function ajaxSets()
if ($lid == 0)
{
$lset = new Labelsets;
$lset->label_name = sanitize_xss_string(CHttpRequest::getPost('laname'));
$lset->label_name = sanitize_xss_string(Yii::app()->getRequest()->getPost('laname'));
$lset->languages = sanitize_xss_string($language);
$lset->save();

Expand Down
8 changes: 4 additions & 4 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -447,7 +447,7 @@ function storeUserControlValues()
$stg ->stg_value=Yii::app()->request->getPost('userideditable');
$stg->save();
}
CController::redirect(Yii::app()->getController()->createUrl('admin/participants/userControl'));
Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl('admin/participants/userControl'));
}

/**
Expand All @@ -470,7 +470,7 @@ function storeBlacklistValues()
$stg->save();
}
}
CController::redirect(Yii::app()->getController()->createUrl('admin/participants/blacklistControl'));
Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl('admin/participants/blacklistControl'));
}

/**
Expand Down Expand Up @@ -1315,7 +1315,7 @@ function saveAttribute()
);
ParticipantAttributeNames::saveAttributeValue($editattvalue);
}
CController::redirect(Yii::app()->getController()->createUrl('admin/participants/attributeControl'));
Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl('admin/participants/attributeControl'));
}

/*
Expand All @@ -1326,7 +1326,7 @@ function delAttributeValues()
$iAttributeId = Yii::app()->request->getQuery('aid');
$iValueId = Yii::app()->request->getQuery('vid');
ParticipantAttributeNames::delAttributeValues($iAttributeId, $iValueId);
CController::redirect(Yii::app()->getController()->createUrl('/admin/participants/viewAttribute/aid/' . $iAttributeId));
Yii::app()->getController()->redirect(Yii::app()->getController()->createUrl('/admin/participants/viewAttribute/aid/' . $iAttributeId));
}

/*
Expand Down
6 changes: 3 additions & 3 deletions application/controllers/admin/tokens.php
Expand Up @@ -592,7 +592,7 @@ function editToken($iSurveyId)
$this->getController()->error(sprintf($this->controller->lang->gT('%s cannot be empty'), $desc['description']));
$aData[$attr_name] = Yii::app()->request->getPost($attr_name);
}
$token = Tokens_dynamic::model()->find('tid=' . CHttpRequest::getPost('id'));
$token = Tokens_dynamic::model()->find('tid=' . Yii::app()->getRequest()->getPost('id'));

foreach ($aData as $k => $v)
$token->$k = $v;
Expand Down Expand Up @@ -724,10 +724,10 @@ function addnew($iSurveyId)
$attrfieldnames = Survey::model()->findByPk($iSurveyId)->tokenAttributes;
foreach ($attrfieldnames as $attr_name => $desc)
{
$value = CHttpRequest::getPost($attr_name);
$value = Yii::app()->getRequest()->getPost($attr_name);
if ($desc['mandatory'] == 'Y' && trim($value) == '')
$this->getController()->error(sprintf($clang->gT('%s cannot be empty'), $desc['description']));
$aData[$attr_name] = CHttpRequest::getPost($attr_name);
$aData[$attr_name] = Yii::app()->getRequest()->getPost($attr_name);
}

$udresult = Tokens_dynamic::model($iSurveyId)->findAll("token <> '' and token = '$sanitizedtoken'");
Expand Down
24 changes: 12 additions & 12 deletions application/controllers/admin/translate.php
Expand Up @@ -25,9 +25,9 @@ class translate extends Survey_Common_Action {
public function index()
{
$iSurveyID = sanitize_int($_REQUEST['surveyid']);
$tolang = CHttpRequest::getParam('lang');
$action = CHttpRequest::getParam('action');
$actionvalue = CHttpRequest::getPost('actionvalue');
$tolang = Yii::app()->getRequest()->getParam('lang');
$action = Yii::app()->getRequest()->getParam('action');
$actionvalue = Yii::app()->getRequest()->getPost('actionvalue');
//echo $this->query('title','querybase');
//die();

Expand Down Expand Up @@ -103,22 +103,22 @@ private function _translateSave($iSurveyID, $tolang, $baselang, $tab_names)

foreach( $tab_names_full as $type )
{
$size = (int) CHttpRequest::getPost("{$type}_size");
$size = (int) Yii::app()->getRequest()->getPost("{$type}_size");
// start a loop in order to update each record
$i = 0;
while ($i <= $size)
{
// define each variable
if ( CHttpRequest::getPost("{$type}_newvalue_{$i}") )
if ( Yii::app()->getRequest()->getPost("{$type}_newvalue_{$i}") )
{
$old = CHttpRequest::getPost("{$type}_oldvalue_{$i}");
$new = CHttpRequest::getPost("{$type}_newvalue_{$i}");
$old = Yii::app()->getRequest()->getPost("{$type}_oldvalue_{$i}");
$new = Yii::app()->getRequest()->getPost("{$type}_newvalue_{$i}");

// check if the new value is different from old, and then update database
if ( $new != $old )
{
$id1 = CHttpRequest::getPost("{$type}_id1_{$i}");
$id2 = CHttpRequest::getPost("{$type}_id2_{$i}");
$id1 = Yii::app()->getRequest()->getPost("{$type}_id1_{$i}");
$id2 = Yii::app()->getRequest()->getPost("{$type}_id2_{$i}");

$this->query($type, 'queryupdate', $iSurveyID, $tolang, $baselang, $id1, $id2, $new);
}
Expand Down Expand Up @@ -1023,9 +1023,9 @@ private function translate_google_api()
{
header('Content-type: application/json');

$sBaselang = CHttpRequest::getPost('baselang');
$sTolang = CHttpRequest::getPost('tolang');
$sToconvert = CHttpRequest::getPost('text');
$sBaselang = Yii::app()->getRequest()->getPost('baselang');
$sTolang = Yii::app()->getRequest()->getPost('tolang');
$sToconvert = Yii::app()->getRequest()->getPost('text');

$aSearch = array('zh-Hans','zh-Hant-HK','zh-Hant-TW',
'nl-informal','de-informal','it-formal','pt-BR','es-MX','nb','nn');
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/admin/label_helper.php
Expand Up @@ -139,7 +139,7 @@ function modlabelsetanswers($lid)
}

//unescape single quotes
$labeldata = CHttpRequest::getPost('dataToSend');
$labeldata = Yii::app()->getRequest()->getPost('dataToSend');
$labeldata = str_replace("\'","'",$labeldata);


Expand Down

0 comments on commit 9bd682d

Please sign in to comment.