ErrorMsg()); //Checked if($result->RecordCount() > 0) { $listsurveys= "
"; $gbc = "evenrow"; while($rows = $result->FetchRow()) { $sidsecurityQ = "SELECT b.* FROM {$dbprefix}surveys AS a INNER JOIN {$dbprefix}surveys_rights AS b ON a.sid = b.sid WHERE a.sid='{$rows['sid']}' AND b.uid = ".$_SESSION['loginID']; //Getting rights for this survey and user $sidsecurityR = db_execute_assoc($sidsecurityQ); //Checked $sidsecurity = $sidsecurityR->FetchRow(); if($rows['private']=="Y") { $privacy=$clang->gT("Anonymous") ; } else $privacy =$clang->gT("Not Anonymous") ; if (bHasSurveyGotTokentable(null,$rows['sid'])) { $visibility = $clang->gT("Closed-access"); } else { $visibility = $clang->gT("Open-access"); } if($rows['active']=="Y") { if ($rows['useexpiry']=='Y' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust)) { $status=$clang->gT("Expired") ; } else { $status=$clang->gT("Active") ; } // Complete Survey Responses - added by DLR $gnquery = "SELECT count(id) FROM ".db_table_name("survey_".$rows['sid'])." WHERE submitdate IS NULL"; $gnresult = db_execute_num($gnquery); //Checked while ($gnrow = $gnresult->FetchRow()) { $partial_responses=$gnrow[0]; } $gnquery = "SELECT count(id) FROM ".db_table_name("survey_".$rows['sid']); $gnresult = db_execute_num($gnquery); //Checked while ($gnrow = $gnresult->FetchRow()) { $responses=$gnrow[0]; } } else $status =$clang->gT("Inactive") ; $datecreated=$rows['datecreated'] ; if (in_array($rows['owner_id'],getuserlist('onlyuidarray'))) { $ownername=$rows['users_name'] ; } else { $ownername="---"; } $questionsCount = 0; $questionsCountQuery = "SELECT * FROM ".db_table_name('questions')." WHERE sid={$rows['sid']} AND language='".$rows['language']."'"; //Getting a count of questions for this survey $questionsCountResult = $connect->Execute($questionsCountQuery); //Checked $questionsCount = $questionsCountResult->RecordCount(); if ($gbc == "oddrow") {$gbc = "evenrow";} else {$gbc = "oddrow";} $listsurveys.=""; if ($rows['active']=="Y") { if ($rows['useexpiry']=='Y' && $rows['expires'] < date_shift(date("Y-m-d H:i:s"), "Y-m-d", $timeadjust)) { $listsurveys .= "\n"; } else { $listsurveys .= "\n"; } } } else { if ( ($_SESSION['USER_RIGHT_SUPERADMIN'] ==1 || $sidsecurity['activate_survey']) && $questionsCount > 0) { $listsurveys .= "\n" ; } else { $listsurveys .= "\n"; } } $listsurveys.="". "". "". "" . "" . ""; if ($rows['active']=="Y") { $complete = $responses - $partial_responses; $listsurveys .= ""; $listsurveys .= ""; $listsurveys .= ""; }else{ $listsurveys .= ""; $listsurveys .= ""; $listsurveys .= ""; } $listsurveys .= "" ; } $listsurveys.="". ""; $listsurveys.="
  ".$clang->gT("Survey")." ".$clang->gT("Date Created")." ".$clang->gT("Owner")." ".$clang->gT("Access")." ".$clang->gT("Answer Privacy")." ".$clang->gT("Status")." ".$clang->gT("Full Responses")." ".$clang->gT("Partial Responses")." ".$clang->gT("Total Responses")."
gT("This survey is active but expired", "js")."');return false\" />\n"; } else { if ($_SESSION['USER_RIGHT_SUPERADMIN'] ==1 || $sidsecurity['activate_survey']) { $listsurveys .= "gTview("De-activate this Survey")."\" " . "onmouseover=\"showTooltip(event,'".$clang->gT("De-activate this Survey", "js")."');return false\">" . "gTview("This survey is currently active")."\"" . "onmouseover=\"showTooltip(event,'".$clang->gT("This survey is currently active", "js")."');return false\" />gTview("Activate this Survey")."\"" . "onmouseover=\"showTooltip(event,'".$clang->gT("Activate this Survey", "js")."');return false\">" . "".$clang->gT("Activate this Survey")."".$clang->gT("This survey is not currently active")."gT("This survey is not currently active", "js")."');return false\" />".$rows['surveyls_title']."".$datecreated."".$ownername."".$visibility."".$privacy."".$status."".$complete."".$partial_responses."".$responses."   
 

" ; } else $listsurveys="
".$clang->gT("No Surveys available - please create one.")."

" ; } if ($action == "checksettings" || $action == "changelang" || $action=="changehtmleditormode") { //GET NUMBER OF SURVEYS $query = "SELECT sid FROM ".db_table_name('surveys'); $result = $connect->Execute($query); //Checked $surveycount=$result->RecordCount(); $query = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y'"; $result = $connect->Execute($query); //Checked $activesurveycount=$result->RecordCount(); $query = "SELECT users_name FROM ".db_table_name('users'); $result = $connect->Execute($query); //Checked $usercount = $result->RecordCount(); // prepare data for the htmleditormode preference $edmod1=''; $edmod2=''; $edmod3=''; $edmod4=''; switch ($_SESSION['htmleditormode']) { case 'none': $edmod2="selected='selected'"; break; case 'inline': $edmod3="selected='selected'"; break; case 'popup': $edmod4="selected='selected'"; break; default: $edmod1="selected='selected'"; break; } $tablelist = $connect->MetaTables(); foreach ($tablelist as $table) { $stlength=strlen($dbprefix).strlen("old"); if (substr($table, 0, $stlength+strlen("_tokens")) == $dbprefix."old_tokens") { $oldtokenlist[]=$table; } elseif (substr($table, 0, strlen($dbprefix) + strlen("tokens")) == $dbprefix."tokens") { $tokenlist[]=$table; } elseif (substr($table, 0, $stlength) == $dbprefix."old") { $oldresultslist[]=$table; } } if(isset($oldresultslist) && is_array($oldresultslist)) {$deactivatedsurveys=count($oldresultslist);} else {$deactivatedsurveys=0;} if(isset($oldtokenlist) && is_array($oldtokenlist)) {$deactivatedtokens=count($oldtokenlist);} else {$deactivatedtokens=0;} if(isset($tokenlist) && is_array($tokenlist)) {$activetokens=count($tokenlist);} else {$activetokens=0;} $cssummary = "
\n" . "
" . "\n" . "\t\n" . "\t\t\n" . "\t\n"; // Database name & default language $cssummary .= "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n"; // Current language $cssummary .= "\t\n" . "\t\t\n" . "\t\n"; // Current htmleditormode $cssummary .= "\t\n" . "\t\t\n" . "\t\n"; // Other infos $cssummary .= "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n" . "\t\n" . "\t\t\n" . "\t\n" . "
\n" . "\t\t\t".$clang->gT("LimeSurvey System Summary")."\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Database Name").":\n" . "\t\t\n" . "\t\t\t$databasename\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Default Language").":\n" . "\t\t\n" . "\t\t\t".getLanguageNameFromCode($defaultlang)."\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Current Language").":\n" . "\t\t\n" . "\t\t\t\n" . "\t\t\t\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Preferred HTML editor mode").":\n" . "\t\t\n" . "\t\t\t\n" . "" . "\t\t
\n" . "\t\t\t".$clang->gT("Users").":\n" . "\t\t\n" . "\t\t\t$usercount\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Surveys").":\n" . "\t\t\n" . "\t\t\t$surveycount\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Active Surveys").":\n" . "\t\t\n" . "\t\t\t$activesurveycount\n" . "\t\t
\n" . "\t\t\t".$clang->gT("De-activated Surveys").":\n" . "\t\t\n" . "\t\t\t$deactivatedsurveys\n" . "\t\t
\n" . "\t\t\t".$clang->gT("Active Token Tables").":\n" . "\t\t\n" . "\t\t\t$activetokens\n" . "\t\t
\n" . "\t\t\t".$clang->gT("De-activated Token Tables").":\n" . "\t\t\n" . "\t\t\t$deactivatedtokens\n" . "\t\t
\n" . "
\n"; if ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1) { $cssummary .= "
"; } } if ($surveyid) { $query = "SELECT * FROM ".db_table_name('surveys_rights')." WHERE sid = {$surveyid} AND uid = ".$_SESSION['loginID']; $result = $connect->SelectLimit($query, 1); if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $result->RecordCount() > 0) { $baselang = GetBaseLanguageFromSurveyID($surveyid); $sumquery5 = "SELECT b.* FROM {$dbprefix}surveys AS a INNER JOIN {$dbprefix}surveys_rights AS b ON a.sid = b.sid WHERE a.sid=$surveyid AND b.uid = ".$_SESSION['loginID']; //Getting rights for this survey and user $sumresult5 = db_execute_assoc($sumquery5); //Checked $sumrows5 = $sumresult5->FetchRow(); $sumquery3 = "SELECT * FROM ".db_table_name('questions')." WHERE sid=$surveyid AND language='".$baselang."'"; //Getting a count of questions for this survey $sumresult3 = $connect->Execute($sumquery3); //Checked $sumcount3 = $sumresult3->RecordCount(); $sumquery6 = "SELECT * FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')."as q WHERE c.qid = q.qid AND q.sid=$surveyid"; //Getting a count of conditions for this survey $sumresult6 = $connect->Execute($sumquery6) or die("Can't coun't conditions"); //Checked $sumcount6 = $sumresult6->RecordCount(); $sumquery2 = "SELECT * FROM ".db_table_name('groups')." WHERE sid=$surveyid AND language='".$baselang."'"; //Getting a count of groups for this survey $sumresult2 = $connect->Execute($sumquery2); //Checked $sumcount2 = $sumresult2->RecordCount(); $sumquery1 = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$surveyid"; //Getting data for this survey $sumresult1 = db_select_limit_assoc($sumquery1, 1); //Checked // Output starts here... $surveysummary = "\n"; $s1row = $sumresult1->FetchRow(); $s1row = array_map('strip_tags', $s1row); //$s1row = array_map('htmlspecialchars', $s1row); $activated = $s1row['active']; //BUTTON BAR $surveysummary .= "\t\n" . "\t\t\n" . "\t\n"; //SURVEY SUMMARY if ($gid || $qid || $action=="deactivate"|| $action=="activate" || $action=="surveysecurity" || $action=="surveyrights" || $action=="addsurveysecurity" || $action=="addusergroupsurveysecurity" || $action=="setsurveysecurity" || $action=="setusergroupsurveysecurity" || $action=="delsurveysecurity" || $action=="editsurvey" || $action=="addgroup" || $action=="importgroup" || $action=="ordergroups" || $action=="updatesurvey" || $action=="deletesurvey" || $action=="resetsurveylogic" || $action=="importsurvresources" || $action=="exportstructure" || $action=="quotas" ) {$showstyle="style='display: none'";} if (!isset($showstyle)) {$showstyle="";} $additionnalLanguagesArray = GetAdditionalLanguagesFromSurveyID($surveyid); $surveysummary .= "\t
\n" . "\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t" . "\n" . "\t\t\t\n" . "\t\t
\n" . "\t\n"; $surveysummary2 = ""; if ($s1row['private'] != "N") {$surveysummary2 .= $clang->gT("Answers to this survey are anonymized.")."
\n";} else {$surveysummary2 .= $clang->gT("This survey is NOT anonymous.")."
\n";} if ($s1row['format'] == "S") {$surveysummary2 .= $clang->gT("It is presented question by question.")."
\n";} elseif ($s1row['format'] == "G") {$surveysummary2 .= $clang->gT("It is presented group by group.")."
\n";} else {$surveysummary2 .= $clang->gT("It is presented on one single page.")."
\n";} if ($s1row['datestamp'] == "Y") {$surveysummary2 .= $clang->gT("Responses will be date stamped")."
\n";} if ($s1row['ipaddr'] == "Y") {$surveysummary2 .= $clang->gT("IP Addresses will be logged")."
\n";} if ($s1row['refurl'] == "Y") {$surveysummary2 .= $clang->gT("Referer-URL will be saved")."
\n";} if ($s1row['usecookie'] == "Y") {$surveysummary2 .= $clang->gT("It uses cookies for access control.")."
\n";} if ($s1row['allowregister'] == "Y") {$surveysummary2 .= $clang->gT("If tokens are used, the public may register for this survey")."
\n";} if ($s1row['allowsave'] == "Y") {$surveysummary2 .= $clang->gT("Participants can save partially finished surveys")."
\n";} switch ($s1row['notification']) { case 0: $surveysummary2 .= $clang->gT("No email notification")."
\n"; break; case 1: $surveysummary2 .= $clang->gT("Basic email notification")."
\n"; break; case 2: $surveysummary2 .= $clang->gT("Detailed email notification with result codes")."
\n"; break; } if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['edit_survey_property']) { $surveysummary2 .= $clang->gT("Regenerate Question Codes:") // . " [gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=straight")."}\" " . ">".$clang->gT("Straight")."] " // . "[gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=bygroup")."}\" " . ">".$clang->gT("By Group")."]"; $surveysummary2 .= "\n"; } $surveysummary .= "\t" . "\n"; $tmp_url = $GLOBALS['publicurl'] . '/index.php?sid=' . $s1row['sid']; $surveysummary .= "\t\t\n" . "\t\n\t\t\n" . "\t\n" . "\t\t\n" . "\t\t\n" . "\t\n" . "\t\t\n" . "\t\n\t\t\n" . "\t\n"; if ($s1row['useexpiry']== "Y") { $expdate=$s1row['expires']; } else { $expdate="-"; } $surveysummary .= "\t\n" . "\t\n" . "\t\t\n" . "\t\n"; if (!$s1row['language']) {$language=getLanguageNameFromCode($currentadminlang);} else {$language=getLanguageNameFromCode($s1row['language']);} $surveysummary .= "\t\n"; // get the rowspan of the Additionnal languages row // is at least 1 even if no additionnal language is present $additionnalLanguagesCount = count($additionnalLanguagesArray); if ($additionnalLanguagesCount == 0) $additionnalLanguagesCount = 1; $surveysummary .= "\t\n"; $first=true; foreach ($additionnalLanguagesArray as $langname) { if ($langname) { if (!$first) {$surveysummary .= "\t\t\t";} $first=false; $surveysummary .= "\n"; } } if ($first) $surveysummary .= "\t"; if ($s1row['surveyls_urldescription']==""){$s1row['surveyls_urldescription']=$s1row['url'];} $surveysummary .= "\t\n" . "\t\t\n"; $surveysummary .= "\t\n"; $surveysummary .= "\t\n"; if ($activated == "Y") { $surveysummary .= "\t\n"; } $surveysummary .= "\t
" . "".$clang->gT("Title").":{$s1row['surveyls_title']} " . "(ID {$s1row['sid']})
" . $clang->gT("Survey URL") ." (".getLanguageNameFromCode($s1row['language'],false)."): $tmp_url&lang=".$s1row['language'].""; foreach ($additionnalLanguagesArray as $langname) { $surveysummary .= " ".getLanguageNameFromCode($langname,false)." ".$clang->gT("Flag").""; } $surveysummary .= "
" . $clang->gT("Description:").""; if (trim($s1row['surveyls_description'])!='') {$surveysummary .= " {$s1row['surveyls_description']}";} $surveysummary .= "
" . $clang->gT("Welcome:")." {$s1row['surveyls_welcometext']}
" . $clang->gT("Administrator:")." {$s1row['admin']} ({$s1row['adminemail']})
" . $clang->gT("Fax To:").""; if (trim($s1row['faxto'])!='') {$surveysummary .= " {$s1row['faxto']}";} $surveysummary .= "
" . $clang->gT("Expiry Date:")."$expdate
" . $clang->gT("Template:")." {$s1row['template']}
" . $clang->gT("Base Language:")."$language
" . $clang->gT("Additional Languages").":
".getLanguageNameFromCode($langname)."
" . $clang->gT("Exit Link").":"; if ($s1row['url']!="") {$surveysummary .=" {$s1row['surveyls_urldescription']}";} $surveysummary .="
" . $clang->gT("Number of questions/groups").":$sumcount3/$sumcount2
" . $clang->gT("Survey currently active").":"; if ($activated == "N") { $surveysummary .= $clang->gT("No"); } else { $surveysummary .= $clang->gT("Yes"); } $surveysummary .="
" . $clang->gT("Survey table name").":".$dbprefix."survey_$surveyid
" . $clang->gT("Hints").":\n"; if ($activated == "N" && $sumcount3 == 0) { $surveysummary .= $clang->gT("Survey cannot be activated yet.")."
\n"; if ($sumcount2 == 0 && ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['define_questions'])) { $surveysummary .= "\t[".$clang->gT("You need to add groups")."]
"; } if ($sumcount3 == 0 && ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 ||$sumrows5['define_questions'])) { $surveysummary .= "\t[".$clang->gT("You need to add questions")."]
"; } } $surveysummary .= $surveysummary2 . "
\n"; } else { include("access_denied.php"); } } if ($surveyid && $gid ) // Show the group toolbar { // TODO: check that surveyid and thus baselang are always set here $sumquery4 = "SELECT * FROM ".db_table_name('questions')." WHERE sid=$surveyid AND gid=$gid AND language='".$baselang."'"; //Getting a count of questions for this survey $sumresult4 = $connect->Execute($sumquery4); //Checked $sumcount4 = $sumresult4->RecordCount(); $grpquery ="SELECT * FROM ".db_table_name('groups')." WHERE gid=$gid AND language='".$baselang."' ORDER BY ".db_table_name('groups').".group_order"; $grpresult = db_execute_assoc($grpquery); //Checked // Check if other questions/groups are dependent upon this group $condarray=GetGroupDepsForConditions($surveyid,"all",$gid,"by-targgid"); $groupsummary = "\n"; while ($grow = $grpresult->FetchRow()) { $grow = array_map('strip_tags', $grow); //$grow = array_map('htmlspecialchars', $grow); $groupsummary .= "\t\n" . "\t\t\n" . "\t\n"; if ($qid || $action=='editgroup'|| $action=='addquestion') {$gshowstyle="style='display: none'";} else {$gshowstyle="";} $groupsummary .= "\t
\n" . "\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t\t\n" . "\t\t\t\t\t\n" . "\t\t\t\n" . "\t\t
\n" . "\t\n" . "\t\n\t\n"; if (!is_null($condarray)) { $groupsummary .= "\t\n" . "\t"; } } $groupsummary .= "\n
" . $clang->gT("Title").":" . "{$grow['group_name']} ({$grow['gid']})
" . $clang->gT("Description:").""; if (trim($grow['description'])!='') {$groupsummary .=$grow['description'];} $groupsummary .= "
" . $clang->gT("Questions with conditions to this group").":"; foreach ($condarray[$gid] as $depgid => $deprow) { foreach ($deprow['conditions'] as $depqid => $depcid) { //$groupsummary .= "[QID: ".$depqid."]"; $listcid=implode("-",$depcid); $groupsummary .= " [QID: ".$depqid."]"; } } $groupsummary .= "\t
\n"; } if ($surveyid && $gid && $qid) // Show the question toolbar { // TODO: check that surveyid is set and that so is $baselang //Show Question Details $qrq = "SELECT * FROM ".db_table_name('answers')." WHERE qid=$qid AND language='".$baselang."' ORDER BY sortorder, answer"; $qrr = $connect->Execute($qrq); //Checked $qct = $qrr->RecordCount(); $qrquery = "SELECT * FROM ".db_table_name('questions')." WHERE gid=$gid AND sid=$surveyid AND qid=$qid AND language='".$baselang."'"; $qrresult = db_execute_assoc($qrquery) or safe_die($qrquery."
".$connect->ErrorMsg()); //Checked $questionsummary = "\n"; // Check if other questions in the Survey are dependent upon this question $condarray=GetQuestDepsForConditions($surveyid,"all","all",$qid,"by-targqid","outsidegroup"); while ($qrrow = $qrresult->FetchRow()) { $qrrow = array_map('strip_tags', $qrrow); //$qrrow = array_map('htmlspecialchars', $qrrow); $questionsummary .= "\t\n" . "\t\t\n" . "\t\n"; if (returnglobal('viewanswer') || $action =="editquestion" || $action =="copyquestion") {$qshowstyle = "style='display: none'";} else {$qshowstyle = "";} $questionsummary .= "\t
\n" . "\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t\n" . "\t\t\t\t\t\n" . "\t\t\t\t\t\n" . "\t\t\t\n" . "\t\t
\n" . "\t\n" . "\t\n\t\n" . "\t\n\t\n"; if ($qrrow['preg']) { $questionsummary .= "\t\n\t\n"; } $qtypes = getqtypelist("", "array"); //qtypes = array(type code=>type description) $questionsummary .= "\t\n\t\n"; if ($qct == 0 && ($qrrow['type'] == "O" || $qrrow['type'] == "L" || $qrrow['type'] == "!" || $qrrow['type'] == "M" || $qrrow['type'] == "Q" || $qrrow['type'] == "K" || $qrrow['type'] == "A" || $qrrow['type'] == "B" || $qrrow['type'] == "C" || $qrrow['type'] == "E" || $qrrow['type'] == "P" || $qrrow['type'] == "R" || $qrrow['type'] == "F" || $qrrow['type'] == "1" ||$qrrow['type'] == "H")) { $questionsummary .= "\t\t\n"; } // For Labelset Questions show the label set and warn if there is no label set configured if (($qrrow['type'] == "1" || $qrrow['type'] == "F" || $qrrow['type'] == "H" || $qrrow['type'] == "W" || $qrrow['type'] == "Z")) { $questionsummary .= "\t\t"; if (!$qrrow['lid']) { $questionsummary .= ""; if ($qrrow['type'] == "1") // Second labelset for "multi scale" { $questionsummary .= ""; if (!$qrrow['lid1']) { $questionsummary .= ""; } } if ($qrrow['type'] == "M" or $qrrow['type'] == "P") { $questionsummary .= "\t" . "\n" . "\t\n"; } if (isset($qrrow['mandatory']) and ($qrrow['type'] != "X")) { $questionsummary .= "\t" . "\n" . "\t\n"; } if (!is_null($condarray)) { $questionsummary .= "\t" . "\n"; } $qid_attributes=getQuestionAttributes($qid); $questionsummary .= "
" . $clang->gT("Code:")."{$qrrow['title']}"; if ($qrrow['type'] != "X") { if ($qrrow['mandatory'] == "Y") {$questionsummary .= ": (".$clang->gT("Mandatory Question").")";} else {$questionsummary .= ": (".$clang->gT("Optional Question").")";} } $questionsummary .= "
" . $clang->gT("Question:")."".strip_tags($qrrow['question'])."
" . $clang->gT("Help:").""; if (trim($qrrow['help'])!=''){$questionsummary .= strip_tags($qrrow['help']);} $questionsummary .= "
" . $clang->gT("Validation:")."{$qrrow['preg']}" . "
" .$clang->gT("Type:")."{$qtypes[$qrrow['type']]}"; $questionsummary .="
" . "" . $clang->gT("Warning").": ". $clang->gT("You need to add answers to this question")." " . "
". $clang->gT("Label Set").":" . $clang->gT("Warning")." - ".$clang->gT("You need to choose a label set for this question!")."\n"; } else // If label set ID is configured show the labelset name and ID { $labelsetname=$connect->GetOne("SELECT label_name FROM ".db_table_name('labelsets')." WHERE lid = ".$qrrow['lid']); $questionsummary .= "".$labelsetname." (LID: {$qrrow['lid']}) "; } // If the user has the right to edit the label sets show the icon for the label set administration if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['define_questions']) { $questionsummary .= "\n"; } $questionsummary .= "
". $clang->gT("Second Label Set").":" . $clang->gT("Warning")." - ".$clang->gT("You need to choose a second label set for this question!")."\n"; } else // If label set ID is configured show the labelset name and ID { $labelsetname=$connect->GetOne("SELECT label_name FROM ".db_table_name('labelsets')." WHERE lid = ".$qrrow['lid1']); $questionsummary .= "".$labelsetname." (LID: {$qrrow['lid1']}) "; } // If the user has the right to edit the second label sets show the icon for the label set administration if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['define_questions']) { $questionsummary .= "\n"; } $questionsummary .= "
" . $clang->gT("Other:").""; $questionsummary .= ($qrrow['other'] == "Y") ? ($clang->gT("Yes")) : ($clang->gT("No")) ; $questionsummary .= "
" . $clang->gT("Mandatory:").""; $questionsummary .= ($qrrow['mandatory'] == "Y") ? ($clang->gT("Yes")) : ($clang->gT("No")) ; $questionsummary .= "
" . $clang->gT("Other questions having conditions on this question:") . "\t\n"; foreach ($condarray[$qid] as $depqid => $depcid) { $listcid=implode("-",$depcid); $questionsummary .= " [QID: ".$depqid."]"; } $questionsummary .= "
"; } $questionsummary .= "
"; } if (returnglobal('viewanswer')) { $_SESSION['FileManagerContext']="edit:answer:$surveyid"; // Get languages select on survey. $anslangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselang = GetBaseLanguageFromSurveyID($surveyid); // check that there are answers for every language supported by the survey foreach ($anslangs as $language) { $qquery = "SELECT count(*) as num_ans FROM ".db_table_name('answers')." WHERE qid=$qid AND language='".$language."'"; $qresult = db_execute_assoc($qquery); //Checked $qrow = $qresult->FetchRow(); if ($qrow["num_ans"] == 0) // means that no record for the language exists in the answers table { $qquery = "INSERT INTO ".db_table_name('answers')." (SELECT `qid`,`code`,`answer`,`default_value`,`sortorder`, '".$language."' FROM ".db_table_name('answers')." WHERE qid=$qid AND language='".$baselang."')"; $connect->Execute($qquery); //Checked } } array_unshift($anslangs,$baselang); // makes an array with ALL the languages supported by the survey -> $anslangs //delete the answers in languages not supported by the survey $qquery = "SELECT DISTINCT language FROM ".db_table_name('answers')." WHERE (qid = $qid) AND (language NOT IN ('".implode("','",$anslangs)."'))"; $qresult = db_execute_assoc($qquery); //Checked while ($qrow = $qresult->FetchRow()) { $qquery = "DELETE FROM ".db_table_name('answers')." WHERE (qid = $qid) AND (language = '".$qrow["language"]."')"; $connect->Execute($qquery); //Checked } // Check sort order for answers $qquery = "SELECT type FROM ".db_table_name('questions')." WHERE qid=$qid AND language='".$baselang."'"; $qresult = db_execute_assoc($qquery); //Checked while ($qrow=$qresult->FetchRow()) {$qtype=$qrow['type'];} if (!isset($_POST['ansaction'])) { //check if any nulls exist. If they do, redo the sortorders $caquery="SELECT * FROM ".db_table_name('answers')." WHERE qid=$qid AND sortorder is null AND language='".$baselang."'"; $caresult=$connect->Execute($caquery); //Checked $cacount=$caresult->RecordCount(); if ($cacount) { fixsortorderAnswers($qid); // !!Adjust this!! } } // Print Key Control JavaScript $vasummary = PrepareEditorScript("editanswer"); $query = "SELECT sortorder FROM ".db_table_name('answers')." WHERE qid='{$qid}' AND language='".GetBaseLanguageFromSurveyID($surveyid)."' ORDER BY sortorder desc"; $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked $anscount = $result->RecordCount(); $row=$result->FetchRow(); $maxsortorder=$row['sortorder']+1; $vasummary .= "\t\n" ."\n" ."\t\n" ."\n" ."\t
\n" .$clang->gT("Edit Answers") ."\t
gT("Error: You are trying to use duplicate answer codes.",'js')."');\">\n" . "\t\n" . "\t\n" . "\t\n" . "\t\n" . "\n" . "\t\n"; $vasummary .= "
"; $first=true; $sortorderids=''; $codeids=''; $vasummary .= "\t
\n"; foreach ($anslangs as $anslang) { $position=0; $query = "SELECT * FROM ".db_table_name('answers')." WHERE qid='{$qid}' AND language='{$anslang}' ORDER BY sortorder, code"; $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked $anscount = $result->RecordCount(); $vasummary .= "
" ."

".getLanguageNameFromCode($anslang, false); if ($anslang==GetBaseLanguageFromSurveyID($surveyid)) {$vasummary .= '('.$clang->gT("Base Language").')';} $vasummary .= "

\t\n" ."" ."\n" ."\t\n" ."\t\n" ."\t\n" ."\t\n" ."" .""; while ($row=$result->FetchRow()) { $row['code'] = htmlspecialchars($row['code']); $row['answer']=htmlspecialchars($row['answer']); $sortorderids=$sortorderids.' '.$row['language'].'_'.$row['sortorder']; if ($first) {$codeids=$codeids.' '.$row['sortorder'];} $vasummary .= "\n" ."\t\n" ."\t\n" ."\t\n"; $position++; } ++$anscount; if ($anscount > 0) { $vasummary .= "\t\n"; } $position=sprintf("%05d", $position); if ($activated != 'Y' || (($activated == 'Y') && (($qtype=='O' ) || ($qtype=='L' ) ||($qtype=='!' )))) { if ($first==true) { $vasummary .= "\n" ."\t\n" ."\t\n" ."\t\n" ."\n"; } } else { $vasummary .= "\n" ."\t\n" ."\n"; } $first=false; $vasummary .= "
\n" .$clang->gT("Code") ."\t\n" .$clang->gT("Answer") ."\t\n" .$clang->gT("Action") ."\t\n" .$clang->gT("Order") ."\t"; $vasummary .= "
\n"; if ($row['default_value'] == 'Y') { $vasummary .= "".$clang->gT("Default")."" ."\t"; } if (($activated != 'Y' && $first) || ($activated == 'Y' && $first && (($qtype=='O') || ($qtype=='L') || ($qtype=='!') ))) { $vasummary .= "\t"; $vasummary .= "\t"; } elseif (($activated != 'N' && $first) ) // If survey is activated and its not one of the above question types who allows modfying answers on active survey { $vasummary .= "\t{$row['code']}"; $vasummary .= "\t"; } else { $vasummary .= "\t{$row['code']}"; } $vasummary .= "\t\n" ."\t\n" . getEditor("editanswer","answer_".$row['language']."_".$row['sortorder'], "[".$clang->gT("Answer:", "js")."](".$row['language'].")",'','','','editanswer') ."\t\n"; // Deactivate delete button for active surveys if ($activated != 'Y' || ($activated == 'Y' && (($qtype=='O' ) || ($qtype=='L' ) ||($qtype=='!' )))) { $vasummary .= "\t\n"; } else { $vasummary .= "\t\n"; } // Don't show Default Button for array question types if ($qtype != "A" && $qtype != "B" && $qtype != "C" && $qtype != "E" && $qtype != "F" && $qtype != "H" && $qtype != "R" && $qtype != "Q" && $qtype != "1") $vasummary .= "\t\n"; $vasummary .= "\t\n"; if ($position > 0) { $vasummary .= "\t\n"; }; if ($position < $anscount-1) { // Fill the sortorder hiddenfield so we now what field is moved down $vasummary .= "\t\n"; } $vasummary .= "\t
" ."\n" ."

" ."".$clang->gT("New Answer").": "; if (!isset($_SESSION['nextanswercode'])) $_SESSION['nextanswercode']=''; $vasummary .= "\t"; unset($_SESSION['nextanswercode']); $first=false; $vasummary .= "\t\n" ."\t\n" . getEditor("addanswer","insertanswer", "[".$clang->gT("Answer:", "js")."]",'','','',$action) ."\t\n" ."\t\n" ."\t\n" ."\t\n" ."\n" ."\t
\n" ."" .$clang->gT("Warning").": ".$clang->gT("You cannot add answers or edit answer codes for this question type because the survey is active.")."\n" ."\t
\n"; $vasummary .= "\n"; $vasummary .= "\n"; $vasummary .= "
"; } $vasummary .= "
"; } // ************************************************* // Survey Rights Start **************************** // ************************************************* if($action == "addsurveysecurity") { $addsummary = "
".$clang->gT("Add User")."
\n"; $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']." AND owner_id != ".$postuserid; $result = db_execute_assoc($query); //Checked if( ($result->RecordCount() > 0 && in_array($postuserid,getuserlist('onlyuidarray'))) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { if($postuserid > 0){ $isrquery = "INSERT INTO {$dbprefix}surveys_rights VALUES($surveyid,". $postuserid.",0,0,0,0,0,0)"; $isrresult = $connect->Execute($isrquery); //Checked if($isrresult) { $addsummary .= "
".$clang->gT("User added.")."
\n"; $addsummary .= "
" ."" ."" ."" ."
\n"; } else { // Username already exists. $addsummary .= "
".$clang->gT("Failed to add User.")."
\n" . " " . $clang->gT("Username already exists.")."
\n"; } $addsummary .= "
".$clang->gT("Continue")."
 \n"; } else { $addsummary .= "
".$clang->gT("Failed to add User.")."
\n" . " " . $clang->gT("No Username selected.")."
\n"; $addsummary .= "
".$clang->gT("Continue")."
 \n"; } } else { include("access_denied.php"); } } if($action == "addusergroupsurveysecurity") { $addsummary = "
".$clang->gT("Add User Group")."
\n"; $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']; $result = db_execute_assoc($query); //Checked if( ($result->RecordCount() > 0 && in_array($postusergroupid,getsurveyusergrouplist('simpleugidarray')) ) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { if($postusergroupid > 0){ $query2 = "SELECT b.uid FROM (SELECT uid FROM ".db_table_name('surveys_rights')." WHERE sid = {$surveyid}) AS c RIGHT JOIN ".db_table_name('user_in_groups')." AS b ON b.uid = c.uid WHERE c.uid IS NULL AND b.ugid = {$postusergroupid}"; $result2 = db_execute_assoc($query2); //Checked if($result2->RecordCount() > 0) { while ($row2 = $result2->FetchRow()) { $uid_arr[] = $row2['uid']; $values[] = "($surveyid, {$row2['uid']},0,0,0,0,0,0)"; } $values_implode = implode(",", $values); $isrquery = "INSERT INTO {$dbprefix}surveys_rights VALUES ".$values_implode; $isrresult = $connect->Execute($isrquery); //Checked if($isrresult) { $addsummary .= "
".$clang->gT("User Group added.")."
\n"; $_SESSION['uids'] = $uid_arr; $addsummary .= "
" ."" ."" ."" ."
\n"; } } else { // no user to add $addsummary .= "
".$clang->gT("Failed to add User Group.")."
\n"; } $addsummary .= "
".$clang->gT("Continue")."
 \n"; } else { $addsummary .= "
".$clang->gT("Failed to add User.")."
\n" . " " . $clang->gT("No Username selected.")."
\n"; $addsummary .= "
".$clang->gT("Continue")."
 \n"; } } else { include("access_denied.php"); } } if($action == "delsurveysecurity"){ { $addsummary = "
".$clang->gT("Deleting User")."
\n"; $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']." AND owner_id != ".$postuserid; $result = db_execute_assoc($query); //Checked if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { if (isset($postuserid)) { $dquery="DELETE FROM {$dbprefix}surveys_rights WHERE uid={$postuserid} AND sid={$surveyid}"; // added by Dennis $dresult=$connect->Execute($dquery); //Checked $addsummary .= "
".$clang->gT("Username").": ".sanitize_xss_string($_POST['user'])."
\n"; } else { $addsummary .= "
".$clang->gT("Could not delete user. User was not supplied.")."
\n"; } } else { include("access_denied.php"); } $addsummary .= "

".$clang->gT("Continue")."
 \n"; } } if($action == "setsurveysecurity") { $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']." AND owner_id != ".$postuserid; $result = db_execute_assoc($query); //Checked if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { $query2 = "SELECT uid, edit_survey_property, define_questions, browse_response, export, delete_survey, activate_survey FROM ".db_table_name('surveys_rights')." WHERE sid = {$surveyid} AND uid = ".$postuserid; $result2 = db_execute_assoc($query2); //Checked if($result2->RecordCount() > 0) { $resul2row = $result2->FetchRow(); $usersummary = "\n\t\n"; $usersummary .= "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\n"; //content $usersummary .= "\t\t" ."" . "
\n" . "\t\t".$clang->gT("Set Survey Rights")."
".$clang->gT("Edit Survey Properties")."".$clang->gT("Define Questions")."".$clang->gT("Browse Responses")."".$clang->gT("Export")."".$clang->gT("Delete Survey")."".$clang->gT("Activate Survey")."
" ."" ."
\n"; } } else { include("access_denied.php"); } } if($action == "setusergroupsurveysecurity") { $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID'];//." AND owner_id != ".$postuserid; $result = db_execute_assoc($query); //Checked if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { $usersummary = "\n\t\n"; $usersummary .= "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\n"; //content $usersummary .= "\t\t" ."" . "
\n" . "\t\t".$clang->gT("Set Survey Rights")."
".$clang->gT("Edit Survey Property")."".$clang->gT("Define Questions")."".$clang->gT("Browse Response")."".$clang->gT("Export")."".$clang->gT("Delete Survey")."".$clang->gT("Activate Survey")."
" ."" ."
\n"; } else { include("access_denied.php"); } } // This is the action to export the structure of a complete survey if($action == "exportstructure") { if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['export']) { $xml_module_available=function_exists("domxml_new_doc"); $exportstructure = "
\n" ."\n\t\n" ."\t\n" ."\t\t\n" ."\t\n" ."\t\n" ."\t\n" ."\t\t\n" ."\t\n" ."\t
" .$clang->gT("Export Survey Structure")."\n
\n" ."\t\t\t
" ."
\n" ."\t\t\t" .$clang->gT("queXML Survey XML Format (*.xml)")." "; if (!$xml_module_available) { $exportstructure.= "".$clang->gT("(XML module only in PHP 4 available)").""; } $exportstructure.="\n" ."\t\t
 
\n" ."\t\t\t\n" ."\t\t\t\n" ."\t\t\t\n" ."\t\t

\n"; } } if($action == "surveysecurity") { $query = "SELECT sid FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']; $result = db_execute_assoc($query); //Checked if($result->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { $query2 = "SELECT a.uid, b.users_name FROM ".db_table_name('surveys_rights')." AS a INNER JOIN ".db_table_name('users')." AS b ON a.uid = b.uid WHERE a.sid = {$surveyid} AND b.uid != ".$_SESSION['loginID'] ." ORDER BY b.users_name"; $result2 = db_execute_assoc($query2); //Checked $surveysecurity = "\n\t\n" . "\t\n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t\n"; if (isset($usercontrolSameGroupPolicy) && $usercontrolSameGroupPolicy === true) { $authorizedGroupsList=getusergrouplist('simplegidarray'); } if($result2->RecordCount() > 0) { // output users $row = 0; while ($resul2row = $result2->FetchRow()) { $query3 = "SELECT a.ugid FROM ".db_table_name('user_in_groups')." AS a RIGHT OUTER JOIN ".db_table_name('users')." AS b ON a.uid = b.uid WHERE b.uid = ".$resul2row['uid']; $result3 = db_execute_assoc($query3); //Checked while ($resul3row = $result3->FetchRow()) { if (!isset($usercontrolSameGroupPolicy) || $usercontrolSameGroupPolicy === false || in_array($resul3row['ugid'],$authorizedGroupsList)) { $group_ids[] = $resul3row['ugid']; } } if(isset($group_ids) && $group_ids[0] != NULL) { $group_ids_query = implode(" OR ugid=", $group_ids); unset($group_ids); $query4 = "SELECT name FROM ".db_table_name('user_groups')." WHERE ugid = ".$group_ids_query; $result4 = db_execute_assoc($query4); //Checked while ($resul4row = $result4->FetchRow()) { $group_names[] = $resul4row['name']; } if(count($group_names) > 0) $group_names_query = implode(", ", $group_names); } // else {break;} //TODO Commented by lemeur if(($row % 2) == 0) $surveysecurity .= "\t\n"; else $surveysecurity .= "\t\n"; $surveysecurity .= "\t\n" . "\t\t\n" . "\t\n"; $row++; } } $surveysecurity .= "\t\t\n" . "\t\t\n" . "\t\t\t\t\t\n" . "\t\t\n" . "\t\n"; //. "\t
\n" . "\t\t".$clang->gT("Survey Security")."
".$clang->gT("Username")."".$clang->gT("User Group")."".$clang->gT("Action")."
{$resul2row['users_name']}\n" . "\t"; if(isset($group_names) > 0) { $surveysecurity .= $group_names_query; } else { $surveysecurity .= "---"; } unset($group_names); $surveysecurity .= "\n"; $surveysecurity .= "" ."" ."" ."" ."" .""; $surveysecurity .= "
" ."" ."" ."" ."" ."
\n"; $surveysecurity .= "\t\t
" . "\t\t\t\t\t".$clang->gT("User").": \n" . "\t\t\t\t" . "
\n"; $surveysecurity .= "\t\t
\n" . "\t\t\n" . "\t\t\t\t\t" . "\t\t\t\t\t".$clang->gT("Groups").": \n" . "\t\t\t\t\n" . "\t\t" . "
\n" . "\t\n" . "\t\n"; } else { include("access_denied.php"); } } elseif ($action == "surveyrights") { $addsummary = "
".$clang->gT("Set Survey Rights")."
\n"; if(isset($postuserid)){ $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} "; if ($_SESSION['USER_RIGHT_SUPERADMIN'] != 1) { $query.=" AND owner_id != ".$postuserid." AND owner_id = ".$_SESSION['loginID']; } } else{ $query = "SELECT sid, owner_id FROM ".db_table_name('surveys')." WHERE sid = {$surveyid} AND owner_id = ".$_SESSION['loginID']; } $result = db_execute_assoc($query); //Checked if($result->RecordCount() > 0) { $rights = array(); if(isset($_POST['edit_survey_property']))$rights['edit_survey_property']=1; else $rights['edit_survey_property']=0; if(isset($_POST['define_questions']))$rights['define_questions']=1; else $rights['define_questions']=0; if(isset($_POST['browse_response']))$rights['browse_response']=1; else $rights['browse_response']=0; if(isset($_POST['export']))$rights['export']=1; else $rights['export']=0; if(isset($_POST['delete_survey']))$rights['delete_survey']=1; else $rights['delete_survey']=0; if(isset($_POST['activate_survey']))$rights['activate_survey']=1; else $rights['activate_survey']=0; if(isset($postuserid)){ $uids[] = $postuserid; } else{ $uids = $_SESSION['uids']; unset($_SESSION['uids']); } if(setsurveyrights($uids, $rights)) { $addsummary .= "
".$clang->gT("Update survey rights successful.")."
\n"; } else { $addsummary .= "
".$clang->gT("Failed to update survey rights!")."
\n"; } $addsummary .= "

".$clang->gT("Continue")."
 \n"; } else { include("access_denied.php"); } } // ************************************************* // Survey Rights End **************************** // ************************************************* // Editing the survey if ($action == "editsurvey") { if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['edit_survey_property']) { $esquery = "SELECT * FROM {$dbprefix}surveys WHERE sid=$surveyid"; $esresult = db_execute_assoc($esquery); //Checked while ($esrow = $esresult->FetchRow()) { $esrow = array_map('htmlspecialchars', $esrow); $editsurvey = include2var('./scripts/addremove.js'); $editsurvey .= "
\n"; // header $editsurvey .= "\n\t
" . "\t\t".$clang->gT("Edit Survey - Step 1 of 2")."
\n"; // beginning TABs section $editsurvey .= "\t
\n"; // General & Contact TAB $editsurvey .= "\t

".$clang->gT("General")."

\n"; // Base Language $editsurvey .= "\t
".$clang->gT("Base Language:")."\n" . "\t\t\n".GetLanguageNameFromCode($esrow['language']) . "\t\t\t
\n" // Additional languages listbox . "\t
".$clang->gT("Additional Languages").":\n" . "\t\t" . "\n" // Available languages listbox . "\t\t" . "
gT("Add")."\" onclick=\"DoAdd()\" id=\"AddBtn\" />
gT("Remove")." >>\" onclick=\"DoRemove(0,'')\" id=\"RemoveBtn\" />
\n"; $editsurvey .= ""; // Administrator... $editsurvey .= "" . "\t
".$clang->gT("Administrator:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Admin Email:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Bounce Email:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Fax To:")."\n" . "\t\t
\n"; // End General TAB // Create Survey Button TIBO // $editsurvey .= "
\n"; $editsurvey .= "\t
\n"; // Presentation and navigation TAB $editsurvey .= "\t

".$clang->gT("Presentation & Navigation")."

\n"; //Format $editsurvey .= "\t
".$clang->gT("Format:")."\n" . "\t\t\n" . "\t
\n"; //TEMPLATES $editsurvey .= "\t
".$clang->gT("Template:")."\n" . "\t\t\n" . "\t\t\t\n" . "\t\t\n" . "\t\t\n" . "\t
\n"; //ALLOW PREV $editsurvey .= "\t
".$clang->gT("Show [<< Prev] button")."\n" . "\t\t\n" . "\t
\n"; //Result printing $editsurvey .= "\t
".$clang->gT("Participiants may print answers?")."\n" . "\t\t\n" . "\t
\n"; //Public Surveys $editsurvey .= "\t
".$clang->gT("List survey publicly:")."\n" . "\t\t\n" . "\t
\n"; // End URL block $editsurvey .= "" . "\t
".$clang->gT("End URL:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Automatically load URL when survey complete?")."\n" . "\t\t
"; // End Presention and navigation TAB // Create Survey Button TIBO // $editsurvey .= "
\n"; $editsurvey .= "\t
\n"; // Publication and access control TAB $editsurvey .= "\t

".$clang->gT("Publication & Access control")."

\n"; // Expiration $editsurvey .= "" . "\t
".$clang->gT("Expires?")."\n" . "\t\t\t
" . "
".$clang->gT("Expiry Date:")."\n" . "\t\t
\n"; //COOKIES $editsurvey .= "\t
".$clang->gT("Use Cookies?")."\n" . "\t\t\n" . "\t
\n"; // Auto registration $editsurvey .= "\t
".$clang->gT("Allow public registration?")."\n" . "\t\t\n\t
\n"; // Use Captcha $editsurvey .= "\t
".$clang->gT("Use CAPTCHA for").":\n" . "\t\t(".$clang->gT("Attribute 1").")
" . "(".$clang->gT("Attribute 2").")
\n\t
\n"; // Email format $editsurvey .= "\t
".$clang->gT("Use HTML format for token emails?")."\n" . "\t\t\n\t
\n"; // End Publication and access control TAB // Create Survey Button TIBO // $editsurvey .= "
\n"; $editsurvey .= "\t
\n"; // Notification and Data management TAB $editsurvey .= "\t

".$clang->gT("Notification & Data Management")."

\n"; //NOTIFICATION $editsurvey .= "\t
".$clang->gT("Admin Notification:")."\n" . "\t\t\n" . "\t
\n"; //ANONYMOUS $editsurvey .= "\t
".$clang->gT("Anonymous answers?")."\n"; // warning message if anonymous + tokens used $editsurvey .= "\n" . "\t\n"; if ($esrow['active'] == "Y") { $editsurvey .= "\t\t\n\t\t\t"; if ($esrow['private'] == "N") {$editsurvey .= " ".$clang->gT("This survey is NOT anonymous.");} else {$editsurvey .= $clang->gT("Answers to this survey are anonymized.");} $editsurvey .= " (".$clang->gT("Cannot be changed").")\n" . "\t\t\n"; $editsurvey .= "\n"; } else { $editsurvey .= "\t\t\n\t\t\n"; } $editsurvey .= "
\n"; // date stamp $editsurvey .= "\t
".$clang->gT("Date Stamp?")."\n"; if ($esrow['active'] == "Y") { $editsurvey .= "\t\t\n\t\t\t"; if ($esrow['datestamp'] != "Y") {$editsurvey .= " ".$clang->gT("Responses will not be date stamped.");} else {$editsurvey .= $clang->gT("Responses will be date stamped.");} $editsurvey .= " (".$clang->gT("Cannot be changed").")\n" . "\t\t\n"; $editsurvey .= "\n"; } else { $editsurvey .= "\t\t\n\t\t\n"; } $editsurvey .= "
\n"; // Ip Addr $editsurvey .= "\t
".$clang->gT("Save IP Address?")."\n"; if ($esrow['active'] == "Y") { $editsurvey .= "\t\t\n\t\t\t"; if ($esrow['ipaddr'] != "Y") {$editsurvey .= " ".$clang->gT("Responses will not have the IP address logged.");} else {$editsurvey .= $clang->gT("Responses will have the IP address logged");} $editsurvey .= " (".$clang->gT("Cannot be changed").")\n" . "\t\t\n"; $editsurvey .= "\n"; } else { $editsurvey .= "\t\t\n\t\t\n"; } $editsurvey .= "\t
\n"; // begin REF URL Block $editsurvey .= "\t
".$clang->gT("Save Referring URL?")."\n"; if ($esrow['active'] == "Y") { $editsurvey .= "\t\t\n\t\t\t"; if ($esrow['refurl'] != "Y") {$editsurvey .= " ".$clang->gT("Responses will not have their referring URL logged.");} else {$editsurvey .= $clang->gT("Responses will have their referring URL logged.");} $editsurvey .= " (".$clang->gT("Cannot be changed").")\n" . "\t\t\n"; $editsurvey .= "\n"; } else { $editsurvey .= "\t\t\n\t\t\n"; } $editsurvey .= "\t
\n"; // BENBUN - END REF URL Block // Token answers persistence $editsurvey .= "\t
".$clang->gT("Enable Token-based answers persistence?")."\n" . "\t\t\n\t
\n"; // End Notification and Data management TAB // Create Survey Button // $editsurvey .= "
\n"; $editsurvey .= "\t
\n"; // Ending First TABs Form $editsurvey .= "" . "\t\n" . "\t\n" . "\t\n" . "\t\n" ."\t"; // TAB Uploaded Resources Management $ZIPimportAction = " onclick='if (validatefilename(this.form,\"".$clang->gT('Please select a file to import!','js')."\")) {this.form.submit();}'"; if (!function_exists("zip_open")) { $ZIPimportAction = " onclick='alert(\"".$clang->gT("zip library not supported by PHP, Import ZIP Disabled","js")."\");'"; } $disabledIfNoResources = ''; if (hasResources($surveyid,'survey') === false) { $disabledIfNoResources = " disabled='disabled'"; } $editsurvey .= "\t

".$clang->gT("Uploaded Resources Management")."

\n" . "\t
\n" . "\t\n" . "\t\n" . "\t\n" . "\t" . "\t\t\n" . "\t\t\n" . "\t\t \n" . "\t\t\n" . "\t\t\n" . "\t\t\n" . "\t
\n" . "\t\tgT("Browse Uploaded Resources")."\" $disabledIfNoResources>
gT("Export Resources As ZIP Archive")."\" $disabledIfNoResources>
".$clang->gT("Select ZIP File:")."
\n"; // End TAB Uploaded Resources Management $editsurvey .= "\t
\n"; // End TAB pane $editsurvey .= "\t
\n"; // The external button to sumbit Survey edit changes $editsurvey .= "\t\n" . "
\n" . "\t
\n"; // Here we do the setup the date javascript $editsurvey .= "\n"; } } else { include("access_denied.php"); } } if ($action == "updatesurvey") // Edit survey step 2 - editing language dependent settings { if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['edit_survey_property']) { $grplangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselang = GetBaseLanguageFromSurveyID($surveyid); array_unshift($grplangs,$baselang); $editsurvey = PrepareEditorScript(); $editsurvey .="\n" . "\n\t
" . "\t\t".$clang->gT("Edit Survey - Step 2 of 2")."
\n"; $editsurvey .= "
\n" . '
'; foreach ($grplangs as $grouplang) { // this one is created to get the right default texts fo each language $bplang = new limesurvey_lang($grouplang); $esquery = "SELECT * FROM ".db_table_name("surveys_languagesettings")." WHERE surveyls_survey_id=$surveyid and surveyls_language='$grouplang'"; $esresult = db_execute_assoc($esquery); //Checked $esrow = $esresult->FetchRow(); $editsurvey .= '

'.getLanguageNameFromCode($esrow['surveyls_language'],false); if ($esrow['surveyls_language']==GetBaseLanguageFromSurveyID($surveyid)) {$editsurvey .= '('.$clang->gT("Base Language").')';} $editsurvey .= '

'; $esrow = array_map('htmlspecialchars', $esrow); $editsurvey .= "\t\t
".$clang->gT("Title").":\n" . "\t\t\n" . "\t
".$clang->gT("Description:")."\n" . "\t\t\n" . getEditor("survey-desc","description_".$esrow['surveyls_language'], "[".$clang->gT("Description:", "js")."](".$esrow['surveyls_language'].")",'','','',$action) . "\n" . "\t
".$clang->gT("Welcome:")."\n" . "\t\t\n" . getEditor("survey-welc","welcome_".$esrow['surveyls_language'], "[".$clang->gT("Welcome:", "js")."](".$esrow['surveyls_language'].")",'','','',$action) . "
\n" . "\t
".$clang->gT("URL Description:")."\n" . "\t\t\n" . "\t
"; } $editsurvey .= '
'; $editsurvey .= "\t

\n" . "\t\n" . "\t\n" . "\t\n" . "\t

\n" . "
\n"; } else { include("access_denied.php"); } } if($action == "quotas") { include("quota.php"); } // Show the screen to order groups if ($action == "ordergroups") { if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $sumrows5['edit_survey_property']) { // Check if one of the up/down buttons have been clicked if (isset($_POST['groupordermethod']) && isset($_POST['sortorder'])) { $postsortorder=sanitize_int($_POST['sortorder']); switch($_POST['groupordermethod']) { // Pressing the Up button case $clang->gT("Up", "unescaped"): $newsortorder=$postsortorder-1; $oldsortorder=$postsortorder; $cdquery = "UPDATE ".db_table_name('groups')." SET group_order=-1 WHERE sid=$surveyid AND group_order=$newsortorder"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); //Checked $cdquery = "UPDATE ".db_table_name('groups')." SET group_order=$newsortorder WHERE sid=$surveyid AND group_order=$oldsortorder"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); //Checked $cdquery = "UPDATE ".db_table_name('groups')." SET group_order='$oldsortorder' WHERE sid=$surveyid AND group_order=-1"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); //Checked break; // Pressing the Down button case $clang->gT("Dn", "unescaped"): $newsortorder=$postsortorder+1; $oldsortorder=$postsortorder; $cdquery = "UPDATE ".db_table_name('groups')." SET group_order=-1 WHERE sid=$surveyid AND group_order=$newsortorder"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());//Checked $cdquery = "UPDATE ".db_table_name('groups')." SET group_order='$newsortorder' WHERE sid=$surveyid AND group_order=$oldsortorder"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());//Checked $cdquery = "UPDATE ".db_table_name('groups')." SET group_order=$oldsortorder WHERE sid=$surveyid AND group_order=-1"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());//Checked break; } } $ordergroups = "\n\t" . "
" . "\t\t".$clang->gT("Change Group Order")."
\n"; // Get groups dependencies regarding conditions // => Get an array of groups containing questions with conditions outside the group // $groupdepsarray[dependent-gid][target-gid]['conditions'][qid-having-conditions]=Array(cids...) $groupdepsarray = GetGroupDepsForConditions($surveyid); if (!is_null($groupdepsarray)) { $ordergroups .= ""; } $ordergroups .= "
\n" . "\t" . "\t" . "
" ; $ordergroups .="
" ; } else { include("access_denied.php"); } } if ($action == "newsurvey") { if($_SESSION['USER_RIGHT_CREATE_SURVEY']) { $newsurvey = PrepareEditorScript(); $newsurvey .= "
gT("Error: You have to enter a title for this survey.",'js')."');\" >\n"; // header $newsurvey .= "\n\t
" . "\t\t".$clang->gT("Create or Import Survey")."
\n"; // begin Tabs section $newsurvey .= "\t
\n"; // General and Contact TAB $newsurvey .= "\t

".$clang->gT("General")."

\n"; // could be used to add a header // $newsurvey .= "\n\t
" // . "\t\t".$clang->gT("Create Survey")."
\n"; // * Survey Language $newsurvey .= "\t
".$clang->gT("Base Language:")."\n" . "\t\t ".$clang->gT("This setting cannot be changed later!")."\n" . "\t
\n"; $newsurvey .= "" . "\t\t
".$clang->gT("Title").":\n" . "\t\t ".$clang->gT("(This field is mandatory.)")."
\n" . "\t
".$clang->gT("Description:")."\n" . "\t\t" . getEditor("survey-desc","description", "[".$clang->gT("Description:", "js")."]",'','','',$action) . "
\n" . "\t
".$clang->gT("Welcome:")."\n" . "\t\t" . getEditor("survey-welc","welcome", "[".$clang->gT("Welcome:", "js")."]",'','','',$action) . "
\n" . "\t
".$clang->gT("Administrator:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Admin Email:")."\n" . "\t\t
\n" . "\t
".$clang->gT("Bounce Email:")."\n" . "\t\t
\n"; $newsurvey .= "\t
".$clang->gT("Fax To:")."\n" . "\t\t
\n"; // End General TAB // Create Survey Button TIBO $newsurvey .= "
\n"; $newsurvey .= "\t
\n"; // Presentation and navigation TAB $newsurvey .= "\t

".$clang->gT("Presentation & Navigation")."

\n"; $newsurvey .= "\t
".$clang->gT("Format:")."\n" . "\t\t\n" . "\t
\n"; $newsurvey .= "\t
".$clang->gT("Template:")."\n" . "\t\t\n" . "\t\t\t\n" . "\t\t\n" . "\t\t\n" . "\t
\n"; //ALLOW PREV $newsurvey .= "\t
".$clang->gT("Show [<< Prev] button")."\n" . "\t\t\n" . "\t
\n"; //Result printing $newsurvey .= "\t
".$clang->gT("Participiants may print answers?")."\n" . "\t\t\n" . "\t
\n"; //Public Surveys $newsurvey .= "\t
".$clang->gT("List survey publicly:")."\n" . "\t\t\n" . "\t
\n"; // End URL $newsurvey .= "" . "\t
".$clang->gT("End URL:")."\n" . "\t\t".$clang->gT("URL Description:")."\n" . "\t\t".$clang->gT("Automatically load URL when survey complete?")."\n" . "\t\t
"; // End Presention and navigation TAB // Create Survey Button TIBO $newsurvey .= "
\n"; $newsurvey .= "\t
\n"; // Publication and access control TAB $newsurvey .= "\t

".$clang->gT("Publication & Access control")."

\n"; // Expiration $newsurvey .= "\t
".$clang->gT("Expires?")."\n" . "\t\t\t
\n" . "
".$clang->gT("Expiry Date:")."\n" . "\t\t" . " ".$clang->gT("Date Format").": YYYY-MM-DD
\n"; //COOKIES $newsurvey .= "\t
".$clang->gT("Use Cookies?")."\n" . "\t\t\n" . "\t
\n"; // Public registration $newsurvey .= "\t
".$clang->gT("Allow public registration?")."\n" . "\t\t\n\t
\n"; // Use Captcha $newsurvey .= "\t
".$clang->gT("Use CAPTCHA for").":\n" . "\t\t\n\t
\n"; // Token attributes names $newsurvey .= "\t
".$clang->gT("Token Attribute Names:")."\n" . "\t\t(".$clang->gT("Attribute 1").")
" . "(".$clang->gT("Attribute 2").")
\n\t
\n"; // Email format $newsurvey .= "\t
".$clang->gT("Use HTML format for token emails?")."\n" . "\t\t\n\t
\n"; // End Publication and access control TAB // Create Survey Button TIBO $newsurvey .= "
\n"; $newsurvey .= "\t
\n"; // Notification and Data management TAB $newsurvey .= "\t

".$clang->gT("Notification & Data Management")."

\n"; //NOTIFICATIONS $newsurvey .= "\t
".$clang->gT("Admin Notification:")."\n" . "\t\t\n" . "\t
\n"; // ANONYMOUS $newsurvey .= "\t
".$clang->gT("Anonymous answers?")."\n"; // warning message if anonymous + datestamped anwsers $newsurvey .= "\n" . "\t\n"; $newsurvey .= "\t\t\n\t
\n"; // Datestamp $newsurvey .= "\t
".$clang->gT("Date Stamp?")."\n" . "\t\t\n\t
\n"; // IP Address $newsurvey .= "\t
".$clang->gT("Save IP Address?")."\n" . "\t\t\n\t
\n"; // Referring URL $newsurvey .= "\t
".$clang->gT("Save Referring URL?")."\n" . "\t\t\n\t
\n"; // Token answers persistence $newsurvey .= "\t
".$clang->gT("Enable Token-based answers persistence?")."\n" . "\t\t\n\t
\n"; // end of addnewsurvey form $newsurvey .= "" // . "\t
\n" // . "\t\n" . "\t\n" . "\n"; // End Notification and Data management TAB // Create Survey Button $newsurvey .= "
\n"; $newsurvey .= "\t
\n"; // Import TAB $newsurvey .= "\t

".$clang->gT("Import Survey")."

\n"; // Import Survey $newsurvey .= "
\n" . "\n" // . "\n" . "\t\t\t\n" . "\t\t\n" . "\t\t\t\t\n" . "\t\t\n" . "\t\n" . "\t\n" // . "" // end tab // . "" // end tab-pane . "
\n" // . "\t\t".$clang->gT("Import Survey")."
".$clang->gT("Select CSV/SQL File:")."
\n" . "\t
\n"; // . "\n"; // End Import TAB $newsurvey .= "\t
\n"; // End TAB pane $newsurvey .= "\t
\n"; // Here we do setup the date javascript $newsurvey .= "\n"; } else { include("access_denied.php"); } } function replacenewline ($texttoreplace) { $texttoreplace = str_replace( "\n", '
', $texttoreplace); // $texttoreplace = htmlentities( $texttoreplace, ENT_QUOTES, UTF-8); $new_str = ''; for($i = 0; $i < strlen($texttoreplace); $i++) { $new_str .= '\x' . dechex(ord(substr($texttoreplace, $i, 1))); } return $new_str; } /* function questionjavascript($type, $qattributes) { $newquestion = "\n"; } */ ?>