\n" ."\t\t\t".$clang->gT("ERROR")."
\n" ."\t\t\t".$clang->gT("We are sorry but your session has expired.")."
".$clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.")."
\n" ."\t\t\t".sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$siteadminname,$siteadminemail)."\n" ."\t\t
\n"; echo templatereplace(file_get_contents("$tpldir/default/endpage.pstpl")); doFooter(); exit; }; //Fin session time out $id=$_SESSION['srid']; //I want to see the answers with this id $clang = $_SESSION['s_lang']; //A little bit of debug to see in the noodles plate /*if ($debug==2) { echo "MonSurveyID $surveyid et ma langue ". $_SESSION['s_lang']. " et SRID = ". $_SESSION['srid'] ."
"; echo "session id".session_id()." \n"."
"; echo //"secanswer ". $_SESSION['secanswer'] "oldsid ". $_SESSION['oldsid']."
" ."step ". $_SESSION['step']."
" ."scid ". $_SESSION['scid'] ."srid ". $_SESSION['srid']."
" ."datestamp ". $_SESSION['datestamp']."
" ."insertarray ". $_SESSION['insertarray']."
" ."fieldarray ". $_SESSION['fieldarray']."
"; ."holdname". $_SESSION['holdname']; print " limit ". $limit."
"; //afficher les 50 derniéres réponses par ex. (pas nécessaire) print " surveyid ".$surveyid."
"; //sid print " id ".$id."
"; //identifiant de la réponses print " order ". $order ."
"; //ordre de tri (pas nécessaire) print " this survey ". $thissurvey['tablename']; }; */ //Ensure script is not run directly, avoid path disclosure if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die("browse - Cannot run this script directly");} //Select public language file $query = "SELECT language FROM ".db_table_name("surveys")." WHERE sid=$surveyid"; $result = db_execute_assoc($query) or safe_die("Error selecting language:
".$query."
".$connect->ErrorMsg()); //Checked // Set language for questions and labels to base language of this survey $language = GetBaseLanguageFromSurveyID($surveyid); $thissurvey = getSurveyInfo($surveyid); //SET THE TEMPLATE DIRECTORY if (!$thissurvey['templatedir']) {$thistpl=$tpldir."/default";} else {$thistpl=$tpldir."/{$thissurvey['templatedir']}";} if (!is_dir($thistpl)) {$thistpl=$tpldir."/default";} if ($thissurvey['printanswers']=='N') die(); //Die quietly if print answers is not permitted //CHECK IF SURVEY IS ACTIVATED AND EXISTS $actquery = "SELECT * FROM ".db_table_name('surveys')." as a inner join ".db_table_name('surveys_languagesettings')." as b on (b.surveyls_survey_id=a.sid and b.surveyls_language=a.language) WHERE a.sid=$surveyid"; $actresult = db_execute_assoc($actquery); //Checked $actcount = $actresult->RecordCount(); if ($actcount > 0) { while ($actrow = $actresult->FetchRow()) { $surveytable = db_table_name("survey_".$actrow['sid']); $surveyname = "{$actrow['surveyls_title']}"; } } //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK. require_once($rootdir.'/classes/core/language.php'); // has been secured if (isset($_SESSION['s_lang'])) { $clang = SetSurveyLanguage( $surveyid, $_SESSION['s_lang']); } else { $baselang = GetBaseLanguageFromSurveyID($surveyid); $clang = SetSurveyLanguage( $surveyid, $baselang); } //SHOW HEADER $printoutput = ''; if(isset($usepdfexport) && $usepdfexport == 1) { $printoutput .= "
\n
"; } if(isset($_POST['printableexport'])) { $pdf = new PDF('P'); $pdf->SetFont($pdfdefaultfont,'',$pdffontsize); $pdf->AddPage(); $pdf->titleintopdf("Survey Name: ".$surveyname,"SurveyID: ".$surveyid); } $printoutput .= "\t".$clang->gT("Survey Name (ID)").": $surveyname ($surveyid)
\n"; //FIRST LETS GET THE NAMES OF THE QUESTIONS AND MATCH THEM TO THE FIELD NAMES FOR THE DATABASE $fnquery = "SELECT * FROM ".db_table_name("questions").", ".db_table_name("groups").", ".db_table_name("surveys")." WHERE ".db_table_name("questions").".gid=".db_table_name("groups").".gid AND ".db_table_name("groups").".sid=".db_table_name("surveys").".sid AND ".db_table_name("questions").".sid='$surveyid' AND ".db_table_name("questions").".language='{$language}' AND ".db_table_name("groups").".language='{$language}' ORDER BY ".db_table_name("groups").".group_order, ".db_table_name("questions").".title"; $fnresult = db_execute_assoc($fnquery); //Checked $fncount = 0; $fnrows = array(); //Create an empty array in case fetch_array does not return any rows while ($fnrow = $fnresult->FetchRow()) {++$fncount; $fnrows[] = $fnrow; $private = $fnrow['private']; $datestamp=$fnrow['datestamp']; $ipaddr=$fnrow['ipaddr']; $refurl=$fnrow['refurl'];} // Get table output into array // Perform a case insensitive natural sort on group name then question title of a multidimensional array usort($fnrows, 'CompareGroupThenTitle'); $fnames[] = array("id", "id", "id"); if ($private == "N") //add token to top ofl ist is survey is not private { $fnames[] = array("token", "token", $clang->gT("Token ID")); } $fnames[] = array("submitdate", "submitdate", $clang->gT("Date Submitted")); if ($datestamp == "Y") //add datetime to list if survey is datestamped { $fnames[] = array("datestamp", "datestamp", $clang->gT("Date Stamp")); } if ($ipaddr == "Y") //add ipaddr to list if survey should save submitters IP address { $fnames[] = array("ipaddr", "ipaddr", $clang->gT("IP Address")); } if ($refurl == "Y") //add refer_URL to list if survey should save referring URL { $fnames[] = array("refurl", "refurl", $clang->gT("Referring URL")); } foreach ($fnrows as $fnrow) { $field = "{$fnrow['sid']}X{$fnrow['gid']}X{$fnrow['qid']}"; $ftitle = "Grp{$fnrow['gid']}Qst{$fnrow['title']}"; $fquestion = $fnrow['question']; if ($fnrow['type'] == "Q" || $fnrow['type'] == "M" || $fnrow['type'] == "A" || $fnrow['type'] == "B" || $fnrow['type'] == "C" || $fnrow['type'] == "E" || $fnrow['type'] == "F" || $fnrow['type'] == "H" || $fnrow['type'] == "J" || $fnrow['type'] == "K" || $fnrow['type'] == "P" || $fnrow['type'] == "^") { $fnrquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$fnrow['qid']} AND language='{$language}' ORDER BY sortorder, answer"; $fnrresult = db_execute_assoc($fnrquery); //Checked while ($fnrrow = $fnrresult->FetchRow()) { $fnames[] = array("$field{$fnrrow['code']}", "$ftitle ({$fnrrow['code']})", "{$fnrow['question']} ({$fnrrow['answer']})"); if ($fnrow['type'] == "P") {$fnames[] = array("$field{$fnrrow['code']}"."comment", "$ftitle"."comment", "{$fnrow['question']} (comment)");} } if ($fnrow['other'] == "Y" and ($fnrow['type']=="!" or $fnrow['type']=="L" or $fnrow['type']=="M" or $fnrow['type']=="P")) { $fnames[] = array("$field"."other", "$ftitle"."other", "{$fnrow['question']}(other)"); } } elseif ($fnrow['type'] == "R") { $fnrquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$fnrow['qid']} AND language='{$language}' ORDER BY sortorder, answer"; $fnrresult = $connect->Execute($fnrquery); //Checked $fnrcount = $fnrresult->RecordCount(); for ($i=1; $i<=$fnrcount; $i++) { $fnames[] = array("$field$i", "$ftitle ($i)", "{$fnrow['question']} ($i)"); } } elseif ($fnrow['type'] == "1") //Multi Scale { $field = "{$fnrow['sid']}X{$fnrow['gid']}X{$fnrow['qid']}"; $ftitle = "Grp{$fnrow['gid']}Qst{$fnrow['title']}"; $fquestion = $fnrow['question']; $aquery="SELECT * " ."FROM {$dbprefix}answers " ."WHERE qid={$fnrow['qid']} " ."AND {$dbprefix}answers.language='".GetBaseLanguageFromSurveyID($surveyid)."' " ."ORDER BY sortorder, " ."answer"; $aresult=db_execute_assoc($aquery) or safe_die ("Couldn't get answers to Array questions
$aquery
".$connect->ErrorMsg()); //Checked while ($arows = $aresult->FetchRow()) { $fnames[] = array("{$fnrow['sid']}X{$fnrow['gid']}X{$fnrow['qid']}{$arows['code']}#0", "$ftitle ", "{$fnrow['question']} {$arows['answer']}"); $fnames[] = array("{$fnrow['sid']}X{$fnrow['gid']}X{$fnrow['qid']}{$arows['code']}#1", "$ftitle ", "{$fnrow['question']} {$arows['answer']}"); } //while } elseif ($fnrow['type'] == "O") { $fnames[] = array("$field", "$ftitle", "{$fnrow['question']}"); $field2 = $field."comment"; $ftitle2 = $ftitle."[Comment]"; $longtitle = "{$fnrow['question']}
[Comment]"; $fnames[] = array("$field2", "$ftitle2", "$longtitle"); } else { $fnames[] = array("$field", "$ftitle", "{$fnrow['question']}"); if (($fnrow['type'] == "L" || $fnrow['type'] == "!") && $fnrow['other'] == "Y") { $fnames[] = array("$field"."other", "$ftitle"."other", "{$fnrow['question']}(other)"); } } } $nfncount = count($fnames)-1; //SHOW INDIVIDUAL RECORD $idquery = "SELECT * FROM $surveytable WHERE id=$id"; $idresult = db_execute_assoc($idquery) or safe_die ("Couldn't get entry
\n$idquery
\n".$connect->ErrorMsg()); //Checked while ($idrow = $idresult->FetchRow()) {$id=$idrow['id']; $rlangauge=$idrow['startlanguage'];} $next=$id+1; $last=$id-1; $printoutput .= "\n"; if(isset($_POST['printableexport'])) { $pdf->intopdf($clang->gT("Question").": ".$clang->gT("Your Answer")); } $printoutput .= "\n"; $idresult = db_execute_assoc($idquery) or safe_die ("Couldn't get entry
$idquery
".$connect->ErrorMsg()); //Checked while ($idrow = $idresult->FetchRow()) { $i=0; for ($i; $i<$nfncount+1; $i++) { $printoutput .= "\t\n" ."\t\t\n" ."\t\t\n" ."\t\n"; if(isset($_POST['printableexport'])) { $pdf->intopdf(strip_tags($fnames[$i][2]).": ".strip_tags(getextendedanswer($fnames[$i][0], $idrow[$fnames[$i][0]]))); $pdf->ln(2); } } } $printoutput .= "
".$clang->gT("Question")."".$clang->gT("Your Answer")."
{$fnames[$i][2]}" .getextendedanswer($fnames[$i][0], $idrow[$fnames[$i][0]]) ."
\n"; if(isset($_POST['printableexport'])) { $pdf->write_out($clang->gT($surveyname)." ".$surveyid.".pdf"); } //tadaaaaaaaaaaa : display the page with the answers of user sendcacheheaders(); doHeader(); echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); echo templatereplace(file_get_contents("$thistpl/printanswers.pstpl")); echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); echo ""; ?>