Skip to content

Commit

Permalink
Fixed Issue #0NR: duplicate ipaddr and refurl fields are generated in…
Browse files Browse the repository at this point in the history
… the sql query while activating a survey (which eventually breaks the survey activation for surveys with ipaddr and/or refurl set to On)

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8600 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Amit Shanker committed Apr 15, 2010
1 parent b9077ee commit 2475abb
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions admin/activate.php
Expand Up @@ -271,26 +271,15 @@
//Check for any additional fields for this survey and create necessary fields (token and datestamp)
$pquery = "SELECT private, allowregister, datestamp, ipaddr, refurl FROM {$dbprefix}surveys WHERE sid={$postsid}";
$presult=db_execute_assoc($pquery);
while($prow=$presult->FetchRow())
$prow=$presult->FetchRow();
if ($prow['private'] == "N")
{
if ($prow['private'] == "N")
{
$createsurvey .= " token C(36),\n";
$surveynotprivate="TRUE";
}
if ($prow['allowregister'] == "Y")
{
$surveyallowsregistration="TRUE";
}
if ($prow['ipaddr'] == "Y")
{
$createsurvey .= " ipaddr X,\n";
}
//Check to see if 'refurl' field is required.
if ($prow['refurl'] == "Y")
{
$createsurvey .= " refurl X,\n";
}
$createsurvey .= " token C(36),\n";
$surveynotprivate="TRUE";
}
if ($prow['allowregister'] == "Y")
{
$surveyallowsregistration="TRUE";
}
//strip trailing comma and new line feed (if any)
$createsurvey = rtrim($createsurvey, ",\n");
Expand Down Expand Up @@ -363,6 +352,14 @@
case "I": //Language switch
$createsurvey .= " C(20)";
break;
case "ipaddress":
if ($prow['ipaddr'] == "Y")
$createsurvey .= " X";
break;
case "url":
if ($prow['refurl'] == "Y")
$createsurvey .= " X";
break;
default:
$createsurvey .= " C(5)";
}
Expand Down

0 comments on commit 2475abb

Please sign in to comment.