Skip to content

Commit

Permalink
Merge branch '2.1' of github.com:LimeSurvey/LimeSurvey into 2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Nov 6, 2012
2 parents 56a1793 + 795fbef commit bdae0ca
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 22 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
11 changes: 5 additions & 6 deletions application/controllers/admin/authentication.php
Expand Up @@ -298,17 +298,16 @@ private function _setSessionData($user)
*/
private function _setLanguageSettings($user)
{

if ($user->lang=='auto')
{
$sLanguage= getBrowserLanguage();
}
elseif (Yii::app()->request->getPost('loginlang') != 'default')
if (Yii::app()->request->getPost('loginlang') != 'default')
{
$user->lang = sanitize_languagecode(Yii::app()->request->getPost('loginlang'));
$user->save();
$sLanguage=$user->lang;
}
else if ($user->lang=='auto')
{
$sLanguage= getBrowserLanguage();
}
else
{
$sLanguage=$user->lang;
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/responses.php
Expand Up @@ -485,11 +485,11 @@ function browse($iSurveyID)

if (incompleteAnsFilterState() == "incomplete")
{
$oCriteria->addCondition("`submitdate` IS NULL");
$oCriteria->addCondition("submitdate IS NULL");
}
elseif (incompleteAnsFilterState() == "complete")
{
$oCriteria->addCondition("`submitdate` IS NOT NULL");
$oCriteria->addCondition("submitdate IS NOT NULL");
}

$dtcount = Survey_dynamic::model($iSurveyID)->count($oCriteria);// or die("Couldn't get response data<br />");
Expand Down
14 changes: 14 additions & 0 deletions application/controllers/admin/tokens.php
Expand Up @@ -380,6 +380,7 @@ function getTokens_json($iSurveyId)
{
self::_newtokentable($iSurveyId);
}
$clang = $this->getController()->lang;
$page = Yii::app()->request->getPost('page');
$sidx = Yii::app()->request->getPost('sidx');
$sidx = !empty($sidx) ? $sidx : "lastname";
Expand All @@ -399,11 +400,24 @@ function getTokens_json($iSurveyId)
}
$aData->total = ceil($aData->records / $limit);

Yii::app()->loadHelper("surveytranslator");

$format = getDateFormatData(Yii::app()->session['dateformat']);

for ($i = 0, $j = 0; $i < $limit && $j < $limit; $i++, $j++)
{
$token = $tokens[$j];
if ((int) $token['validfrom'])
$token['validfrom'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validfrom'])));
else
$token['validfrom'] = '';
if ((int) $token['validuntil'])
$token['validuntil'] = date($format['phpdate'] . ' H:i', strtotime(trim($token['validuntil'])));
else
$token['validuntil'] = '';

$aData->rows[$i]['id'] = $token['tid'];
$prow = Survey::model()->findByPk($iSurveyId)->getAttributes(); //Get survey settings

$action = $this->_tokenToActionRow($token, $iSurveyId);
$aData->rows[$i]['cell'] = array($token['tid'], $action, $token['firstname'], $token['lastname'], $token['email'], $token['emailstatus'], $token['token'], $token['language'], $token['sent'], $token['remindersent'], $token['remindercount'], $token['completed'], $token['usesleft'], $token['validfrom'], $token['validuntil']);
Expand Down
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Expand Up @@ -3190,7 +3190,7 @@ function HTMLEscape($str) {
*/
function dbQuoteAll($value)
{
return '\'' . addslashes($value) . '\'';
return Yii::app()->db->quoteValue($value);
}

// make a string safe to include in a JavaScript String parameter.
Expand Down
2 changes: 2 additions & 0 deletions application/helpers/frontend_helper.php
Expand Up @@ -2578,6 +2578,8 @@ function killSurveySession($iSurveyID)
{
// Unset the session
unset($_SESSION['survey_'.$iSurveyID]);
// Force EM to refresh
LimeExpressionManager::SetDirtyFlag();
}


Expand Down
8 changes: 4 additions & 4 deletions application/models/Tokens_dynamic.php
Expand Up @@ -448,19 +448,19 @@ 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 ));
}
}?>
Expand Up @@ -16,7 +16,7 @@
<a href='<?php echo $this->createUrl("/admin/responses/time/surveyid/$iSurveyId/start/$last/limit/$limit"); ?>' title='<?php $clang->eT("Show previous.."); ?>'>
<img name='DataBack' align='left' src='<?php echo $sImageURL; ?>/databack.png' alt='<?php $clang->eT("Show previous.."); ?>' />
</a>
<img src='<?php echo $imageurl; ?>/blank.gif' width='13' height='20' alt='' />
<img src='<?php echo $sImageURL; ?>/blank.gif' width='13' height='20' alt='' />
<a href='<?php echo $this->createUrl("/admin/responses/time/surveyid/$iSurveyId/start/$next/limit/$limit"); ?>' title='<?php $clang->eT("Show next..."); ?>'>
<img name='DataForward' align='left' src='<?php echo $sImageURL; ?>/dataforward.png' alt='<?php $clang->eT("Show next.."); ?>' />
</a>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/update/step4.php
Expand Up @@ -23,7 +23,7 @@
}
?>
<br>
<?
<?php
if (!$downloaderror)
{
echo sprintf($clang->gT('Buildnumber was successfully updated to %s.'),Yii::app()->session['updateinfo']['toversion']).'<br />';
Expand Down

0 comments on commit bdae0ca

Please sign in to comment.