Skip to content

Commit

Permalink
Fixed wrong URLs and #05585: Token export blocks database.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@12184 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
sachdeva-shubham committed Jan 24, 2012
1 parent 637474d commit 03efad4
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion application/helpers/admin/activate_helper.php
Expand Up @@ -509,7 +509,7 @@ function activateSurvey($surveyid, $simulate = false)

$activateoutput .= $clang->gT("This survey is now active, and responses can be recorded.")."<br /><br />\n";
$activateoutput .= "<strong>".$clang->gT("Open-access mode").":</strong> ".$clang->gT("No invitation code is needed to complete the survey.")."<br />".$clang->gT("You can switch to the closed-access mode by initialising a token table with the button below.")."<br /><br />\n";
$activateoutput .= "<input type='submit' value='".$clang->gT("Switch to closed-access mode")."' onclick=\"".convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/surveyid/".$surveyid))."\" />\n";
$activateoutput .= "<input type='submit' value='".$clang->gT("Switch to closed-access mode")."' onclick=\"".convertGETtoPOST(Yii::app()->getController()->createUrl("admin/tokens/index/surveyid/".$surveyid))."\" />\n";
$activateoutput .= "<input type='submit' value='".$clang->gT("No, thanks.")."' onclick=\"".convertGETtoPOST("$link")."\" />\n";
}
$activateoutput .= "</div><br />&nbsp;\n";
Expand Down
17 changes: 10 additions & 7 deletions application/helpers/export_helper.php
Expand Up @@ -1822,11 +1822,6 @@ function questionGetXMLStructure($xml,$gid,$qid)

function tokensExport($surveyid)
{
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache");

$bquery = "SELECT * FROM {{tokens_$surveyid}} where 1=1";
$databasetype = Yii::app()->db->getDriverName();
if (trim($_POST['filteremail'])!='')
Expand Down Expand Up @@ -1880,8 +1875,16 @@ function tokensExport($surveyid)
$bquery .= " and language=".dbQuoteAll($_POST['tokenlanguage']);
}
$bquery .= " ORDER BY tid";

$bresult = Yii::app()->db->createCommand($bquery)->query();
Yii::app()->loadHelper('database');

$bresult = Yii::app()->db->createCommand($bquery)->query(); //dbExecuteAssoc($bquery) is faster but deprecated!

//HEADERS should be after the above query else timeout errors in case there are lots of tokens!
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
header("Content-type: text/comma-separated-values; charset=UTF-8");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache");

$bfieldcount=$bresult->getRowCount();
// Export UTF8 WITH BOM
$tokenoutput = chr(hexdec('EF')).chr(hexdec('BB')).chr(hexdec('BF'));
Expand Down
4 changes: 2 additions & 2 deletions application/views/admin/survey/activateSurvey_view.php
Expand Up @@ -12,14 +12,14 @@
{
foreach ($failedcheck as $fc)
{ ?>
<li> Question qid-<?php echo $fc[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/'.$fc[3].'/'.$fc[0]); ?>'><?php echo $fc[1]; ?></a>")<?php echo $fc[2]; ?></li>
<li> Question qid-<?php echo $fc[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$fc[3].'/qid/'.$fc[0]); ?>'><?php echo $fc[1]; ?></a>")<?php echo $fc[2]; ?></li>
<?php }
}
if (isset($failedgroupcheck) && $failedgroupcheck)
{
foreach ($failedgroupcheck as $fg)
{ ?>
<li> Group gid-<?php echo $fg[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/'.$fg[0]); ?>'><?php echo $fg[1]; ?></a>")<?php echo $fg[2]; ?></li>
<li> Group gid-<?php echo $fg[0]; ?> ("<a href='<?php echo Yii::app()->getController()->createUrl('admin/survey/view/surveyid/'.$surveyid.'/gid/'.$fg[0]); ?>'><?php echo $fg[1]; ?></a>")<?php echo $fg[2]; ?></li>
<?php }
} ?>
</ul>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/exportdialog.php
@@ -1,4 +1,4 @@
<div class='header ui-widget-header'><?php $clang->eT("Token export options"); ?></div>
<div class='header ui-widget-header'><?php $clang->eT("Token export options"); ?></div><br />
<form id='exportdialog' name='exportdialog' action='<?php echo $this->createUrl("admin/tokens/exportdialog/surveyid/$surveyid"); ?>' method='post'>
<ul><li><label for='tokenstatus'><?php $clang->eT('Token status:'); ?></label><select id='tokenstatus' name='tokenstatus' >
<option selected='selected' value='0'><?php $clang->eT('All tokens'); ?></option>
Expand Down

0 comments on commit 03efad4

Please sign in to comment.