function upgrade_survey_tables133a() { global $dbprefix, $connect, $modifyoutput; mssql_drop_primary_index('assessments'); // add the new primary key modify_database("", "ALTER TABLE [prefix_assessments] ADD CONSTRAINT pk_assessments_id_lang PRIMARY KEY ([id],[language])"); echo $modifyoutput; flush(); ob_flush(); $surveyidquery = "SELECT sid,additional_languages FROM " . db_table_name('surveys'); $surveyidresult = db_execute_num($surveyidquery); while ($sv = $surveyidresult->FetchRow()) { FixLanguageConsistency($sv[0], $sv[1]); } }
function upgrade_survey_tables133() { global $modifyoutput; $surveyidquery = "SELECT sid, additional_languages FROM " . db_table_name('surveys'); $surveyidresult = db_execute_num($surveyidquery); while ($sv = $surveyidresult->FetchRow()) { FixLanguageConsistency($sv['0'], $sv['1']); } }
$_POST['expires'] = $datetimeobj->convert("Y-m-d H:i:s"); } if (trim($_POST['startdate']) == "") { $_POST['startdate'] = null; } else { $datetimeobj = new Date_Time_Converter($_POST['startdate'], $formatdata['phpdate'] . ' H:i'); $_POST['startdate'] = $datetimeobj->convert("Y-m-d H:i:s"); } //make sure only numbers are passed within the $_POST variable $_POST['tokenlength'] = (int) $_POST['tokenlength']; //token length has to be at least 5, otherwise set it to default (15) if ($_POST['tokenlength'] < 5) { $_POST['tokenlength'] = 15; } CleanLanguagesFromSurvey($postsid, $_POST['languageids']); FixLanguageConsistency($postsid, $_POST['languageids']); if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1 && $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] != 1 && !hasTemplateManageRights($_SESSION['loginID'], $_POST['template'])) { $_POST['template'] = "default"; } $sql = "SELECT * FROM {$dbprefix}surveys WHERE sid={$postsid}"; // We are using $dbrepfix here instead of db_table_name on purpose because GetUpdateSQL doesn't work correclty on Postfres with a quoted table name $rs = db_execute_assoc($sql); // Checked $updatearray = array('admin' => $_POST['admin'], 'expires' => $_POST['expires'], 'adminemail' => $_POST['adminemail'], 'startdate' => $_POST['startdate'], 'bounce_email' => $_POST['bounce_email'], 'anonymized' => $_POST['anonymized'], 'faxto' => $_POST['faxto'], 'format' => $_POST['format'], 'savetimings' => $_POST['savetimings'], 'template' => $_POST['template'], 'assessments' => $_POST['assessments'], 'language' => $_POST['language'], 'additional_languages' => $_POST['languageids'], 'datestamp' => $_POST['datestamp'], 'ipaddr' => $_POST['ipaddr'], 'refurl' => $_POST['refurl'], 'publicgraphs' => $_POST['publicgraphs'], 'usecookie' => $_POST['usecookie'], 'allowregister' => $_POST['allowregister'], 'allowsave' => $_POST['allowsave'], 'navigationdelay' => $_POST['navigationdelay'], 'printanswers' => $_POST['printanswers'], 'publicstatistics' => $_POST['publicstatistics'], 'autoredirect' => $_POST['autoredirect'], 'showxquestions' => $_POST['showxquestions'], 'showgroupinfo' => $_POST['showgroupinfo'], 'showqnumcode' => $_POST['showqnumcode'], 'shownoanswer' => $_POST['shownoanswer'], 'showwelcome' => $_POST['showwelcome'], 'allowprev' => $_POST['allowprev'], 'allowjumps' => $_POST['allowjumps'], 'nokeyboard' => $_POST['nokeyboard'], 'showprogress' => $_POST['showprogress'], 'listpublic' => $_POST['public'], 'htmlemail' => $_POST['htmlemail'], 'tokenanswerspersistence' => $_POST['tokenanswerspersistence'], 'alloweditaftercompletion' => $_POST['alloweditaftercompletion'], 'usecaptcha' => $_POST['usecaptcha'], 'emailresponseto' => trim($_POST['emailresponseto']), 'emailnotificationto' => trim($_POST['emailnotificationto']), 'googleanalyticsapikey' => trim($_POST['googleanalyticsapikey']), 'googleanalyticsstyle' => trim($_POST['googleanalyticsstyle']), 'tokenlength' => $_POST['tokenlength']); $usquery = $connect->GetUpdateSQL($rs, $updatearray, false, get_magic_quotes_gpc()); if ($usquery) { $usresult = $connect->Execute($usquery) or safe_die("Error updating<br />" . $usquery . "<br /><br /><strong>" . $connect->ErrorMsg()); // Checked } $sqlstring = ''; foreach (GetAdditionalLanguagesFromSurveyID($surveyid) as $langname) {
function fixLanguageConsistencyAllSurveys() { global $dbprefix, $connect, $modifyoutput; $surveyidquery = "SELECT sid,additional_languages FROM " . db_table_name('surveys'); $surveyidresult = db_execute_num($surveyidquery); while ($sv = $surveyidresult->FetchRow()) { FixLanguageConsistency($sv[0], $sv[1]); } }
$importgroup .= $fatalerror . "<br /><br />\n"; $importgroup .= "<input type='submit' value='" . $clang->gT("Main Admin Screen") . "' onclick=\"window.open('{$scriptname}', '_self')\" /><br /><br />\n"; $importgroup .= "</div>\n"; @unlink($sFullFilepath); return; } // IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY $importgroup .= "<div class='successheader'>" . $clang->gT("Success") . "</div> <br />\n" . $clang->gT("File upload succeeded.") . "<br /><br />\n" . $clang->gT("Reading file..") . "<br /><br />\n"; if (strtolower($sExtension) == 'csv') { $aImportResults = CSVImportGroup($sFullFilepath, $surveyid); } elseif (strtolower($sExtension) == 'lsg') { $aImportResults = XMLImportGroup($sFullFilepath, $surveyid); } else { die('Unknown file extension'); } FixLanguageConsistency($surveyid); if (isset($aImportResults['fatalerror'])) { $importgroup .= "<div class='warningheader'>" . $clang->gT("Error") . "</div><br />\n"; $importgroup .= $aImportResults['fatalerror'] . "<br /><br />\n"; $importgroup .= "<input type='submit' value='" . $clang->gT("Main Admin Screen") . "' onclick=\"window.open('{$scriptname}', '_self')\" />\n"; $importgroup .= "</div>\n"; unlink($sFullFilepath); return; } $importgroup .= "<div class='successheader'>" . $clang->gT("Success") . "</div><br />\n" . "<strong><u>" . $clang->gT("Question group import summary") . "</u></strong><br />\n" . "<ul style=\"text-align:left;\">\n" . "\t<li>" . $clang->gT("Groups") . ": " . $aImportResults['groups'] . "</li>\n" . "\t<li>" . $clang->gT("Questions") . ": " . $aImportResults['questions'] . "</li>\n" . "\t<li>" . $clang->gT("Subquestions") . ": " . $aImportResults['subquestions'] . "</li>\n" . "\t<li>" . $clang->gT("Answers") . ": " . $aImportResults['answers'] . "</li>\n" . "\t<li>" . $clang->gT("Conditions") . ": " . $aImportResults['conditions'] . "</li>\n"; if (strtolower($sExtension) == 'csv') { $importgroup .= "\t<li>" . $clang->gT("Label sets") . ": " . $aImportResults['labelsets'] . " (" . $aImportResults['labels'] . ")</li>\n"; } $importgroup .= "\t<li>" . $clang->gT("Question attributes:") . $aImportResults['question_attributes'] . "</li>" . "</ul>\n"; $importgroup .= "<strong>" . $clang->gT("Question group import is complete.") . "</strong><br /> \n"; $importgroup .= "<input type='submit' value='" . $clang->gT("Go to question group") . "' onclick=\"window.open('{$scriptname}?sid={$surveyid}&gid={$aImportResults['newgid']}', '_self')\" />\n";
function fixLanguageConsistencyAllSurveys() { $surveyidquery = "SELECT sid,additional_languages FROM " . db_table_name('surveys'); $surveyidresult = db_execute_num($surveyidquery); while ($sv = $surveyidresult->FetchRow()) { FixLanguageConsistency($sv[0]); } }