Skip to content

Commit

Permalink
Fixed issue #6133: Race condition with concurrent upload of similar "…
Browse files Browse the repository at this point in the history
…survey structure"
  • Loading branch information
c-schmitz committed May 28, 2012
1 parent a8e40e3 commit 2087155
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions admin/http_importsurvey.php
Expand Up @@ -19,7 +19,7 @@
// Enable 'Convert resource links and INSERTANS fields?' if selected
if ( (isset($_POST['copysurveytranslinksfields']) && $_POST['copysurveytranslinksfields'] == "on") || (isset($_POST['translinksfields']) && $_POST['translinksfields'] == "on"))
{
$sTransLinks = true;
$sTransLinks = true;
}

// Start the HTML
Expand All @@ -40,14 +40,14 @@

if ($action == 'importsurvey')
{
$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name'];
$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['tmp_name'];
if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $the_full_file_path))
{
$importsurvey .= "<div class='errorheader'>".$clang->gT("Error")."</div>\n";
$importsurvey .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$tempdir)."<br /><br />\n";
$importsurvey .= "<input type='submit' value='".$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_top')\"><br /><br />\n";
$importerror=true;
}
}
else
{
$importsurvey .= "<div class='successheader'>".$clang->gT("Success")."</div>&nbsp;<br />\n";
Expand Down Expand Up @@ -145,29 +145,29 @@
$importsurvey .= "<br />\n<div class='successheader'>".$clang->gT("Success")."</div><br /><br />\n";
if ($action == 'importsurvey')
{
$importsurvey .= "<strong>".$clang->gT("Survey copy summary")."</strong><br />\n";
$importsurvey .= "<strong>".$clang->gT("Survey copy summary")."</strong><br />\n";
}
elseif($action == 'copysurvey')
{
$importsurvey .= "<strong>".$clang->gT("Survey import summary")."</strong><br />\n";
$importsurvey .= "<strong>".$clang->gT("Survey import summary")."</strong><br />\n";
}

$importsurvey .= "<ul style=\"text-align:left;\">\n\t<li>".$clang->gT("Surveys").": {$aImportResults['surveys']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Languages").": {$aImportResults['languages']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Question groups").": {$aImportResults['groups']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Questions").": {$aImportResults['questions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Answers").": {$aImportResults['answers']}</li>\n";
if (isset($aImportResults['subquestions']))
{
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Subquestions").": {$aImportResults['subquestions']}</li>\n";
}
if (isset($aImportResults['defaultvalues']))
{
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}</li>\n";
}
if (isset($aImportResults['conditions']))
{
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Conditions").": {$aImportResults['conditions']}</li>\n";
}
if (isset($aImportResults['labelsets']))
{
Expand All @@ -180,8 +180,8 @@
$importsurvey .= "\t<li>".$clang->gT("Question attributes").": {$aImportResults['question_attributes']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Assessments").": {$aImportResults['assessments']}</li>\n";
$importsurvey .= "\t<li>".$clang->gT("Quotas").": {$aImportResults['quota']} ({$aImportResults['quotamembers']} ".$clang->gT("quota members")." ".$clang->gT("and")." {$aImportResults['quotals']} ".$clang->gT("quota language settings").")</li>\n</ul><br />\n";
if (count($aImportResults['importwarnings'])>0)

if (count($aImportResults['importwarnings'])>0)
{
$importsurvey .= "<div class='warningheader'>".$clang->gT("Warnings").":</div><ul style=\"text-align:left;\">";
foreach ($aImportResults['importwarnings'] as $warning)
Expand All @@ -190,23 +190,23 @@
}
$importsurvey .= "</ul><br />\n";
}

if ($action == 'importsurvey')
{
$importsurvey .= "<strong>".$clang->gT("Import of Survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
elseif($action == 'copysurvey')
{
$importsurvey .= "<strong>".$clang->gT("Copy of survey is completed.")."</strong><br />\n"
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}
. "<a href='$scriptname?sid={$aImportResults['newsid']}'>".$clang->gT("Go to survey")."</a><br />\n";
}

if ($action == 'importsurvey')
{
unlink($sFullFilepath);
unlink($sFullFilepath);
}

}
// end of traitment an close message box
$importsurvey .= "</div><br />\n";
Expand Down

0 comments on commit 2087155

Please sign in to comment.