Skip to content

Commit

Permalink
adding checks for the existence of token table for the data entry screen
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8665 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Amit Shanker committed May 1, 2010
1 parent c90da18 commit 5363d38
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions admin/browse.php
Expand Up @@ -96,6 +96,7 @@
while ($actrow = $actresult->FetchRow())
{
$surveytable = db_table_name("survey_".$actrow['sid']);
$tokentable = db_table_name("tokens_".$actrow['sid']);
/*
* DO NEVER EVER PUT VARIABLES AND FUNCTIONS WHICH GIVE BACK DIFFERENT QUOTES
* IN DOUBLE QUOTED(' and " and \" is used) JAVASCRIPT/HTML CODE!!! (except for: you know what you are doing)
Expand Down Expand Up @@ -169,8 +170,6 @@
$fnames[] = array("completed", $clang->gT("Completed"), "0");
if ($surveyinfo['private'] == "N") //add token to top of list if survey is not private
{
$tokentable = db_table_name('tokens_'.$surveyid);
//$fnames[] = array("token", $clang->gT("Token ID"));
$fnames[] = array("firstname", $clang->gT("First Name"));
$fnames[] = array("lastname", $clang->gT("Last Name"));
$fnames[] = array("email", $clang->gT("Email"));
Expand All @@ -182,7 +181,7 @@
$nfncount = count($fnames)-1;
//SHOW INDIVIDUAL RECORD
$idquery = "SELECT * FROM $surveytable ";
if ($surveyinfo['private'] == "N")
if ($surveyinfo['private'] == "N" && db_tables_exist($tokentable))
$idquery .= "LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
if (incompleteAnsFilterstate() == "inc")
$idquery .= " WHERE (submitdate = ".$connect->DBDate('1980-01-01'). " OR submitdate IS NULL) AND ";
Expand Down Expand Up @@ -331,7 +330,6 @@
//add token to top of list if survey is not private
if ($surveyinfo['private'] == "N")
{
$tokentable = db_table_name('tokens_'.$surveyid);
$fnames[] = array("token", "Token", $clang->gT("Token ID"), 0);
$fnames[] = array("firstname", "First Name", $clang->gT("First Name"), 0);
$fnames[] = array("lastname", "Last Name", $clang->gT("Last Name"), 0);
Expand Down Expand Up @@ -389,7 +387,7 @@
if (!isset($start) || $start =='') {$start = 0;}

//LETS COUNT THE DATA
if ($surveyinfo['private'] == "N")
if ($surveyinfo['private'] == "N" && db_tables_exist($tokentable))
{
$dtquery = "SELECT count(*) FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
} else
Expand All @@ -412,9 +410,9 @@
//NOW LETS SHOW THE DATA
if (isset($_POST['sql']))
{
if ($_POST['sql'] == "NULL")
if ($_POST['sql'] == "NULL" )
{
if ($surveyinfo['private'] == "N")
if ($surveyinfo['private'] == "N" && db_table_exists($tokentable))
$dtquery = "SELECT * FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
else
$dtquery = "SELECT * FROM $surveytable ";
Expand All @@ -430,7 +428,7 @@
}
else
{
if ($surveytable['private'] == "N")
if ($surveytable['private'] == "N" && db_table_exists($tokentable))
$dtquery = "SELECT * FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
else
$dtquery = "SELECT * FROM $surveytable ";
Expand Down Expand Up @@ -459,7 +457,7 @@
}
else
{
if ($surveyinfo['private'] == "N")
if ($surveyinfo['private'] == "N" && db_tables_exist($tokentable))
$dtquery = "SELECT * FROM $surveytable LEFT JOIN $tokentable ON $surveytable.token = $tokentable.token ";
else
$dtquery = "SELECT * FROM $surveytable ";
Expand Down

0 comments on commit 5363d38

Please sign in to comment.