".$clang->gT("Import survey")."\n"; $importingfrom = "http"; } elseif($action == 'copysurvey') { $importsurvey = "
".$clang->gT("Copy survey")."
\n"; $copyfunction= true; } // Start traitment and messagebox $importsurvey .= "
\n"; $importerror=false; // Put a var for continue if ($action == 'importsurvey') { $the_full_file_path = $tempdir . "/" . sRandomChars(20).'_'.$_FILES['the_file']['name']; if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $the_full_file_path)) { $importsurvey .= "
".$clang->gT("Error")."
\n"; $importsurvey .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$tempdir)."

\n"; $importsurvey .= "

\n"; $importerror=true; } else { $importsurvey .= "
".$clang->gT("Success")."
 
\n"; $importsurvey .= $clang->gT("File upload succeeded.")."

\n"; $importsurvey .= $clang->gT("Reading file..")."
\n"; $sFullFilepath=$the_full_file_path; $aPathInfo = pathinfo($sFullFilepath); if (isset($aPathInfo['extension'])) { $sExtension = $aPathInfo['extension']; } else { $sExtension = ""; } } if (!$importerror && (strtolower($sExtension)!='csv' && strtolower($sExtension)!='lss')) { $importsurvey .= "
".$clang->gT("Error")."
\n"; $importsurvey .= $clang->gT("Import failed. You specified an invalid file type.")."\n"; $importerror=true; } } elseif ($action == 'copysurvey') { $surveyid = sanitize_int($_POST['copysurveylist']); $exclude = array(); if (get_magic_quotes_gpc()) {$sNewSurveyName = stripslashes($_POST['copysurveyname']);} else{ $sNewSurveyName=$_POST['copysurveyname']; } require_once("../classes/inputfilter/class.inputfilter_clean.php"); $myFilter = new InputFilter('','',1,1,1); if ($filterxsshtml) { $sNewSurveyName = $myFilter->process($sNewSurveyName); } else { $sNewSurveyName = html_entity_decode($sNewSurveyName, ENT_QUOTES, "UTF-8"); } if (isset($_POST['copysurveyexcludequotas']) && $_POST['copysurveyexcludequotas'] == "on") { $exclude['quotas'] = true; } if (isset($_POST['copysurveyexcludeanswers']) && $_POST['copysurveyexcludeanswers'] == "on") { $exclude['answers'] = true; } if (isset($_POST['copysurveyresetconditions']) && $_POST['copysurveyresetconditions'] == "on") { $exclude['conditions'] = true; } include("export_structure_xml.php"); $copysurveydata = getXMLData($exclude); } // Now, we have the survey : start importing require_once('import_functions.php'); if ($action == 'importsurvey' && !$importerror) { if (isset($sExtension) && strtolower($sExtension)=='csv') { $aImportResults=CSVImportSurvey($sFullFilepath); } elseif (isset($sExtension) && strtolower($sExtension)=='lss') { $aImportResults=XMLImportSurvey($sFullFilepath,null,null, null,(isset($_POST['translinksfields']))); } else { $importerror = true; } } elseif ($action == 'copysurvey' && !$importerror) { $aImportResults=XMLImportSurvey('',$copysurveydata,$sNewSurveyName); } else { $importerror=true; } if (isset($aImportResults['error']) && $aImportResults['error']!=false) { $importsurvey .= "
".$clang->gT("Error")."

\n"; $importsurvey .= $aImportResults['error']."

\n"; $importsurvey .= "\n"; $importerror = true; } if (!$importerror) { $importsurvey .= "
\n
".$clang->gT("Success")."


\n"; if ($action == 'importsurvey') { $importsurvey .= "".$clang->gT("Survey copy summary")."
\n"; } elseif($action == 'copysurvey') { $importsurvey .= "".$clang->gT("Survey import summary")."
\n"; } $importsurvey .= "
\n"; if (count($aImportResults['importwarnings'])>0) { $importsurvey .= "
".$clang->gT("Warnings").":

\n"; } if ($action == 'importsurvey') { $importsurvey .= "".$clang->gT("Import of Survey is completed.")."
\n" . "".$clang->gT("Go to survey")."
\n"; } elseif($action == 'copysurvey') { $importsurvey .= "".$clang->gT("Copy of survey is completed.")."
\n" . "".$clang->gT("Go to survey")."
\n"; } if ($action == 'importsurvey') { unlink($sFullFilepath); } } // end of traitment an close message box $importsurvey .= "

\n"; ?>