From 2475abb5aff9115400bb8e2233095dfd3ed7c559 Mon Sep 17 00:00:00 2001 From: Amit Shanker Date: Thu, 15 Apr 2010 13:11:33 +0000 Subject: [PATCH] Fixed Issue #0NR: duplicate ipaddr and refurl fields are generated in 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 --- admin/activate.php | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/admin/activate.php b/admin/activate.php index 6dfe8638f80..9a0ab678fe8 100644 --- a/admin/activate.php +++ b/admin/activate.php @@ -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"); @@ -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)"; }