Skip to content

Commit

Permalink
Fixed issue #6282: Error accessing a survey from a language that it h…
Browse files Browse the repository at this point in the history
…asn't
  • Loading branch information
c-schmitz committed Jul 6, 2012
1 parent d997153 commit 11342a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions admin/tokens.php
Expand Up @@ -2123,7 +2123,7 @@
while (($tkrow = $tkresult->FetchRow()) && $invalidtokencount<50)
{
$isvalidtoken = false;
while ($isvalidtoken == false && $invalidtokencount<50)
while ($isvalidtoken == false && $invalidtokencount<50)
{
$newtoken = sRandomChars($tokenlength);
if (!isset($existingtokens[$newtoken])) {
Expand All @@ -2144,7 +2144,7 @@
}
}
if(!$invalidtokencount){
$tokenoutput .= "<div class='successheader'>".sprintf($clang->gT("%s tokens have been created"),$newtokencount)."</div>\n";
$tokenoutput .= "<div class='successheader'>".sprintf($clang->gT("%s tokens have been created."),$newtokencount)."</div>\n";
}else{
$tokenoutput .= "\t\t<div class='errorheader'>".$clang->gT("Error")."</div>\n"
."\t\t<p>".sprintf($clang->gT("Only %s new tokens were added after %s trials."),$newtokencount,$invalidtokencount)."\n"
Expand Down
14 changes: 6 additions & 8 deletions index.php
Expand Up @@ -126,7 +126,7 @@
}
$languagechanger = makelanguagechanger();
//Find out if there are any publicly available surveys
$query = "SELECT a.sid, b.surveyls_title, a.publicstatistics
$query = "SELECT a.sid, b.surveyls_title, a.publicstatistics,a.language
FROM ".db_table_name('surveys')." AS a
INNER JOIN ".db_table_name('surveys_languagesettings')." AS b
ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language )
Expand All @@ -143,20 +143,18 @@
{
while($rows = $result->FetchRow())
{
$sLinkLanguage=$rows['language'];
$result2 = db_execute_assoc("Select surveyls_title from ".db_table_name('surveys_languagesettings')." where surveyls_survey_id={$rows['sid']} and surveyls_language='$baselang'");
if ($result2->RecordCount())
{
$languagedetails=$result2->FetchRow();
$rows['surveyls_title']=$languagedetails['surveyls_title'];
$sLinkLanguage=$baselang;
}
$link = "<li><a href='$rooturl/index.php?sid=".$rows['sid'];
if (isset($_GET['lang']))
{
$link .= "&lang=".sanitize_languagecode($_GET['lang']);
}
if (isset($_GET['lang']))
{
$link .= "&amp;lang=".sanitize_languagecode($_GET['lang']);
$link .= "&amp;lang=".$sLinkLanguage;
}
$link .= "' class='surveytitle'>".$rows['surveyls_title']."</a>\n";
if ($rows['publicstatistics'] == 'Y') $link .= "<a href='{$relativeurl}/statistics_user.php?sid={$rows['sid']}'>(".$clang->gT('View statistics').")</a>";
Expand Down Expand Up @@ -805,7 +803,7 @@
}
// done deleting uploaded files
}

// also delete a record from saved_control when there is one, we can allway do it.
$connect->query('DELETE FROM '.db_table_name('saved_control'). ' WHERE srid='.$_SESSION['srid'].' AND sid='.$surveyid);
}
Expand Down Expand Up @@ -878,7 +876,7 @@
if(($row['submitdate']=='' && $thissurvey['tokenanswerspersistence'] == 'Y' )|| ($row['submitdate']!='' && $thissurvey['alloweditaftercompletion'] == 'Y'))
{
$_SESSION['srid'] = $row['id'];
if (!is_null($row['lastpage']) && $row['submitdate']=='')
if (!is_null($row['lastpage']) && $row['submitdate']=='')
{
$_SESSION['LEMtokenResume'] = true;
$_SESSION['step'] = $row['lastpage'];
Expand Down

0 comments on commit 11342a0

Please sign in to comment.