mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Updated Limesurvey to revision 11354
This commit is contained in:
@@ -79,8 +79,19 @@ class queXMLPDF extends TCPDF {
|
||||
*
|
||||
* @var bool Defaults to 138.
|
||||
* @since 2010-09-20
|
||||
* @deprecated
|
||||
* @see $barcodeMarginX
|
||||
*/
|
||||
protected $barcodeX = 138;
|
||||
//protected $barcodeX = 138;
|
||||
|
||||
/**
|
||||
* The distance between the right hand page border and
|
||||
* the end of the barcode in MM
|
||||
*
|
||||
* @var bool Defaults to 23.
|
||||
* @since 2011-10-25
|
||||
*/
|
||||
protected $barcodeMarginX = 23;
|
||||
|
||||
/**
|
||||
* Y position of barcode in mm
|
||||
@@ -173,7 +184,7 @@ class queXMLPDF extends TCPDF {
|
||||
protected $style = "<style>
|
||||
td.questionTitle {font-weight:bold; font-size:12pt;}
|
||||
td.questionText {font-weight:bold; font-size:12pt;}
|
||||
td.vasLabel {font-weright:bold; font-size:10pt; text-align:center;}
|
||||
td.vasLabel {font-weight:bold; font-size:10pt; text-align:center;}
|
||||
td.questionHelp {font-weight:normal; text-align:right; font-style:italic; font-size:8pt;}
|
||||
td.questionHelpAfter {text-align:center; font-weight:bold; font-size:10pt;}
|
||||
td.responseAboveText {font-weight:normal; font-style:normal; text-align:left; font-size:12pt;}
|
||||
@@ -300,16 +311,38 @@ class queXMLPDF extends TCPDF {
|
||||
*
|
||||
* @var mixed Defaults to 24.
|
||||
* @since 2010-09-20
|
||||
* @deprecated
|
||||
* @see $textResponseMarginX
|
||||
*/
|
||||
protected $textResponsesPerLine = 24;
|
||||
//protected $textResponsesPerLine = 24;
|
||||
|
||||
/**
|
||||
* The left hand margin of text responses to auto calculate responses
|
||||
* per line (mm)
|
||||
*
|
||||
* @var mixed Defaults to 13.
|
||||
* @since 2011-10-25
|
||||
*/
|
||||
protected $textResponseMarginX = 13;
|
||||
|
||||
/**
|
||||
* Maximum number of text responses boxes where the label should appear on the same line
|
||||
*
|
||||
* @var mixed Defaults to 16.
|
||||
* @since 2010-09-20
|
||||
* @deprecated
|
||||
* @see $labelTextResponsesSameLineMarginX
|
||||
*/
|
||||
protected $labelTextResponsesSameLine = 16;
|
||||
//protected $labelTextResponsesSameLine = 16;
|
||||
|
||||
/**
|
||||
* The left hand margin of text responses to auto calculated responses
|
||||
* per line where the label should appear on the same line (mm)
|
||||
*
|
||||
* @var mixed Defaults to 62.
|
||||
* @since 2011-10-25
|
||||
*/
|
||||
protected $labelTextResponsesSameLineMarginX = 62;
|
||||
|
||||
/**
|
||||
* The gap between multi line text responses
|
||||
@@ -1551,11 +1584,15 @@ class queXMLPDF extends TCPDF {
|
||||
{
|
||||
$this->SetDrawColor($this->lineColour[0],$this->lineColour[1],$this->lineColour[2]);
|
||||
|
||||
//calculate text responses per line
|
||||
$textResponsesPerLine = round(($this->getMainPageWidth() - $this->skipColumnWidth - $this->textResponseMarginX) / ($this->textResponseWidth + $this->textResponseBorder));
|
||||
$labelTextResponsesSameLine = round(($this->getMainPageWidth() - $this->skipColumnWidth - $this->labelTextResponsesSameLineMarginX) / ($this->textResponseWidth + $this->textResponseBorder));
|
||||
|
||||
//draw boxes - can draw up to $textResponsesPerLine for each line
|
||||
$lines = ceil($width / $this->textResponsesPerLine);
|
||||
$lines = ceil($width / $textResponsesPerLine);
|
||||
|
||||
//draw the text label on the top of this box
|
||||
if ($width > $this->labelTextResponsesSameLine && !empty($text))
|
||||
if ($width > $labelTextResponsesSameLine && !empty($text))
|
||||
{
|
||||
$this->setBackground('question');
|
||||
$html = "<table><tr><td width=\"{$this->questionTitleWidth}mm\"></td><td width=\"" . ($this->getMainPageWidth() - $this->skipColumnWidth - $this->questionTitleWidth) . "mm\" class=\"responseAboveText\">$text</td><td></td></tr></table>";
|
||||
@@ -1567,8 +1604,8 @@ class queXMLPDF extends TCPDF {
|
||||
for ($i = 0; $i < $lines; $i++)
|
||||
{
|
||||
if ($lines == 1) $cells = $width; //one line only
|
||||
else if (($i + 1 == $lines)) $cells = ($width - ($this->textResponsesPerLine * $i)); //last line
|
||||
else $cells = $this->textResponsesPerLine; //middle line
|
||||
else if (($i + 1 == $lines)) $cells = ($width - ($textResponsesPerLine * $i)); //last line
|
||||
else $cells = $textResponsesPerLine; //middle line
|
||||
|
||||
|
||||
$textwidth = ($this->getMainPageWidth() - $this->skipColumnWidth) - (($this->textResponseWidth + $this->textResponseBorder ) * $cells);
|
||||
@@ -1579,7 +1616,7 @@ class queXMLPDF extends TCPDF {
|
||||
$this->setBackground('question');
|
||||
$this->writeHTMLCell($this->getMainPageWidth(), $this->textResponseHeight, $this->getMainPageX(), $this->GetY() , $this->style . $html,0,1,true,false);
|
||||
|
||||
if ($lines == 1 && $cells <= $this->labelTextResponsesSameLine && !empty($text))
|
||||
if ($lines == 1 && $cells <= $labelTextResponsesSameLine && !empty($text))
|
||||
{
|
||||
$this->setDefaultFont($this->responseTextFontSize);
|
||||
|
||||
@@ -1652,8 +1689,10 @@ class queXMLPDF extends TCPDF {
|
||||
|
||||
//Add the box to the layout scheme
|
||||
$this->addBox($this->GetX(),$this->GetY(),$this->GetX() + $this->textResponseWidth,$this->GetY() + $this->textResponseHeight);
|
||||
|
||||
//Draw the box
|
||||
$this->Cell($this->textResponseWidth,$this->textResponseHeight,'',$border,0,'',true,'',0,false,'T','C');
|
||||
|
||||
}
|
||||
|
||||
//add some spacing for the bottom border
|
||||
@@ -2074,8 +2113,11 @@ class queXMLPDF extends TCPDF {
|
||||
|
||||
$barcodeValue = str_pad($this->questionnaireId,$this->idLength,"0",STR_PAD_LEFT) . str_pad($this->getPage(),$this->pageLength,"0",STR_PAD_LEFT);
|
||||
|
||||
$this->write1DBarcode($barcodeValue, $this->barcodeType, $this->barcodeX, $this->barcodeY, $this->barcodeW, $this->barcodeH,'', $barcodeStyle, 'N');
|
||||
//Calc X position of barcode from page width
|
||||
$barcodeX = $width - ($this->barcodeMarginX + $this->barcodeW);
|
||||
|
||||
$this->write1DBarcode($barcodeValue, $this->barcodeType, $barcodeX, $this->barcodeY, $this->barcodeW, $this->barcodeH,'', $barcodeStyle, 'N');
|
||||
|
||||
//Add this page to the layout system
|
||||
$b = $this->cornerBorder + ($this->cornerWidth / 2.0); //temp calc for middle of line
|
||||
$this->layout[$barcodeValue] = array( 'id' => $barcodeValue,
|
||||
|
||||
@@ -183,6 +183,12 @@ class MyPDF extends TCPDF
|
||||
else{$fill=0;}
|
||||
for($b=0;$b<sizeof($array[$a]);$b++)
|
||||
{
|
||||
$bEndOfCell=0;
|
||||
if ($b==sizeof($array[$a])-1)
|
||||
{
|
||||
$bEndOfCell=1;
|
||||
}
|
||||
|
||||
if($a==0)
|
||||
{
|
||||
$oldStyle = $this->FontStyle;
|
||||
@@ -190,7 +196,7 @@ class MyPDF extends TCPDF
|
||||
|
||||
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
|
||||
if ($maxwidth[$b] < 20) $maxwidth[$b]=20;
|
||||
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,0);
|
||||
$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',1,$bEndOfCell);
|
||||
|
||||
$this->SetFont($this->FontFamily, $oldStyle, $this->FontSizePt);
|
||||
}
|
||||
@@ -205,16 +211,15 @@ class MyPDF extends TCPDF
|
||||
if ($maxwidth[$b] > 140) $maxwidth[$b]=130;
|
||||
if ($b==0)
|
||||
{
|
||||
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,0);
|
||||
$iLines=$this->MultiCell($maxwidth[$b],6,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,0);
|
||||
$this->MultiCell($maxwidth[$b],$iLines,$this->delete_html($array[$a][$b]),0,'L',$fill,$bEndOfCell);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
$this->ln();
|
||||
}
|
||||
$this->ln(5);
|
||||
}
|
||||
|
||||
@@ -19,33 +19,15 @@
|
||||
* @param $string
|
||||
* @return $string
|
||||
*/
|
||||
function strip_tags_full($string, $is_csv=false ) {
|
||||
function strip_tags_full($string) {
|
||||
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
|
||||
//combining these into one mb_ereg_replace call ought to speed things up
|
||||
//$string = str_replace(array("\r\n","\r","\n",'-oth-'), '', $string);
|
||||
//The backslashes must be escaped twice, once for php, and again for the regexp
|
||||
//$string = str_replace("'|\\\\'", "'", $string);
|
||||
if($is_csv==true)
|
||||
return FlattenText($string,true);
|
||||
else
|
||||
return FlattenText($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Strips html tags
|
||||
*
|
||||
* @param $string
|
||||
* @return $string
|
||||
*/
|
||||
function strip_tags_full_save_newline($string) {
|
||||
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
|
||||
//combining these into one mb_ereg_replace call ought to speed things up
|
||||
//$string = str_replace(array("\r\n","\r","\n",'-oth-'), '', $string);
|
||||
//The backslashes must be escaped twice, once for php, and again for the regexp
|
||||
//$string = str_replace("'|\\\\'", "'", $string);
|
||||
return FlattenTextWithNewline($string);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if passed $value is numeric
|
||||
*
|
||||
@@ -64,7 +46,7 @@ function my_is_numeric($value) {
|
||||
return ($eng_or_world);
|
||||
}
|
||||
|
||||
function spss_export_data ($na = null, $is_csv = false) {
|
||||
function spss_export_data ($na = null) {
|
||||
global $length_data;
|
||||
|
||||
// Build array that has to be returned
|
||||
@@ -156,19 +138,9 @@ function spss_export_data ($na = null, $is_csv = false) {
|
||||
echo("'0'");
|
||||
}
|
||||
} elseif (!$field['hide']) {
|
||||
if($is_csv == true) {
|
||||
$strTmp=mb_substr(strip_tags_full($row[$fieldno],true), 0, $length_data);
|
||||
}
|
||||
else {
|
||||
$strTmp=mb_substr(strip_tags_full($row[$fieldno]), 0, $length_data);
|
||||
}
|
||||
if (trim($strTmp) != ''){
|
||||
if($is_csv == true) {
|
||||
$strTemp=str_replace(array("'"),array("''"),trim($strTmp));
|
||||
}
|
||||
else {
|
||||
$strTemp=str_replace(array("'","\n","\r"),array("''",' ',' '),trim($strTmp));
|
||||
}
|
||||
/*
|
||||
* Temp quick fix for replacing decimal dots with comma's
|
||||
if (my_is_numeric($strTemp)) {
|
||||
|
||||
@@ -148,7 +148,7 @@ if ($subaction=='dldata')
|
||||
header("Pragma: public");
|
||||
|
||||
$na=""; //change to empty string instead of two double quotes to fix warnings on NA
|
||||
spss_export_data($na, true); // this true indicates that the format is .csv
|
||||
spss_export_data($na);
|
||||
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ if (isset($surveyprintlang) && !empty($surveyprintlang))
|
||||
else
|
||||
$quexmllang=GetBaseLanguageFromSurveyID($surveyid);
|
||||
|
||||
$qlang = new limesurvey_lang($quexmllang);
|
||||
|
||||
if (!$surveyid)
|
||||
{
|
||||
@@ -119,7 +120,7 @@ function skipto($qid,$value,$cfieldname = "")
|
||||
global $connect ;
|
||||
global $dbprefix ;
|
||||
global $surveyid ;
|
||||
global $clang ;
|
||||
global $qlang ;
|
||||
|
||||
$zeros = $connect->qstr("0000000000");
|
||||
|
||||
@@ -172,19 +173,19 @@ function skipto($qid,$value,$cfieldname = "")
|
||||
return $Row['title'];
|
||||
}
|
||||
else
|
||||
return $clang->gT("End");
|
||||
return $qlang->gT("End");
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
|
||||
function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false,$varname="")
|
||||
{
|
||||
global $dom;
|
||||
global $connect ;
|
||||
global $dbprefix ;
|
||||
global $quexmllang;
|
||||
global $clang;
|
||||
global $qlang;
|
||||
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
|
||||
@@ -230,17 +231,11 @@ function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
|
||||
$category = $dom->create_element("category");
|
||||
|
||||
$label = $dom->create_element("label");
|
||||
$label->set_content(get_length($qid,"other_replace_text","Other"));
|
||||
$label->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
|
||||
|
||||
$value= $dom->create_element("value");
|
||||
|
||||
//Get next code
|
||||
if (is_numeric($nextcode))
|
||||
$nextcode++;
|
||||
else if (is_string($nextcode))
|
||||
$nextcode = chr(ord($nextcode) + 1);
|
||||
|
||||
$value->set_content($nextcode);
|
||||
$value->set_content('-oth-');
|
||||
|
||||
$category->append_child($label);
|
||||
$category->append_child($value);
|
||||
@@ -249,10 +244,11 @@ function create_fixed($qid,$rotate=false,$labels=true,$scale=0,$other=false)
|
||||
$length = $dom->create_element("length");
|
||||
$text = $dom->create_element("text");
|
||||
|
||||
$text->set_content($clang->gT("Please specify"));
|
||||
$text->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
|
||||
$length->set_content(24);
|
||||
$contingentQuestion->append_child($text);
|
||||
$contingentQuestion->append_child($length);
|
||||
$contingentQuestion->set_attribute("varName",$varname . 'other');
|
||||
|
||||
$category->append_child($contingentQuestion);
|
||||
|
||||
@@ -291,7 +287,7 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
|
||||
global $connect ;
|
||||
global $quexmllang ;
|
||||
global $surveyid;
|
||||
global $clang;
|
||||
global $qlang;
|
||||
|
||||
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
|
||||
|
||||
@@ -350,7 +346,7 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
|
||||
$category = $dom->create_element("category");
|
||||
|
||||
$label = $dom->create_element("label");
|
||||
$label->set_content(get_length($qid,"other_replace_text","Other"));
|
||||
$label->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
|
||||
|
||||
$value= $dom->create_element("value");
|
||||
|
||||
@@ -369,10 +365,11 @@ function create_multi(&$question,$qid,$varname,$scale_id = false,$free = false,$
|
||||
$length = $dom->create_element("length");
|
||||
$text = $dom->create_element("text");
|
||||
|
||||
$text->set_content($clang->gT("Please specify"));
|
||||
$text->set_content(get_length($qid,"other_replace_text",$qlang->gT("Other")));
|
||||
$length->set_content(24);
|
||||
$contingentQuestion->append_child($text);
|
||||
$contingentQuestion->append_child($length);
|
||||
$contingentQuestion->set_attribute("varName",$varname . 'other');
|
||||
|
||||
$category->append_child($contingentQuestion);
|
||||
|
||||
@@ -574,7 +571,8 @@ while ($Row = $QueryResult->FetchRow())
|
||||
}
|
||||
|
||||
$response = $dom->create_element("response");
|
||||
$response->set_attribute("varName",cleanup($RowQ['title']));
|
||||
$sgq = $surveyid . "X" . $gid . "X" . $qid;
|
||||
$response->set_attribute("varName",$sgq);
|
||||
|
||||
switch ($type)
|
||||
{
|
||||
@@ -590,20 +588,20 @@ while ($Row = $QueryResult->FetchRow())
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "L": //LIST drop-down/radio-button list
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other));
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "!": //List - dropdown
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other));
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "O": //LIST WITH COMMENT drop-down/radio-button list + textarea
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other));
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
//no comment - this should be a separate question
|
||||
break;
|
||||
case "R": //RANKING STYLE
|
||||
create_subQuestions($question,$qid,$RowQ['title'],true);
|
||||
create_subQuestions($question,$qid,$sgq,true);
|
||||
$Query = "SELECT COUNT(*) as sc FROM {$dbprefix}answers WHERE qid = $qid AND language='$quexmllang' ";
|
||||
$QRE = db_execute_assoc($Query);
|
||||
//$QRE = mysql_query($Query) or die ("ERROR: $QRE<br />".mysql_error());
|
||||
@@ -613,20 +611,20 @@ while ($Row = $QueryResult->FetchRow())
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "M": //Multiple choice checkbox
|
||||
create_multi($question,$qid,$RowQ['title'],false,false,$other);
|
||||
create_multi($question,$qid,$sgq,false,false,$other);
|
||||
break;
|
||||
case "P": //Multiple choice with comments checkbox + text
|
||||
//Not yet implemented
|
||||
create_multi($question,$qid,$RowQ['title'],false,false,$other);
|
||||
create_multi($question,$qid,$sgq,false,false,$other);
|
||||
//no comments added
|
||||
break;
|
||||
case "Q": //MULTIPLE SHORT TEXT
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(create_free("text",get_length($qid,"maximum_chars","10"),""));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "K": //MULTIPLE NUMERICAL
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(create_free("integer",get_length($qid,"maximum_chars","10"),""));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
@@ -647,73 +645,73 @@ while ($Row = $QueryResult->FetchRow())
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "Y": //YES/NO radio-buttons
|
||||
$response->append_child(fixed_array(array("Yes" => 1,"No" => 2)));
|
||||
$response->append_child(fixed_array(array($qlang->gT("Yes") => 'Y',$qlang->gT("No") => 'N')));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "G": //GENDER drop-down list
|
||||
$response->append_child(fixed_array(array("Female" => 1,"Male" => 2)));
|
||||
$response->append_child(fixed_array(array($qlang->gT("Female") => 'F',$qlang->gT("Male") => 'M')));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "A": //ARRAY (5 POINT CHOICE) radio-buttons
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5)));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "B": //ARRAY (10 POINT CHOICE) radio-buttons
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(fixed_array(array("1" => 1,"2" => 2,"3" => 3,"4" => 4,"5" => 5,"6" => 6,"7" => 7,"8" => 8,"9" => 9,"10" => 10)));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "C": //ARRAY (YES/UNCERTAIN/NO) radio-buttons
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
$response->append_child(fixed_array(array("Yes" => 1,"Uncertain" => 2,"No" => 3)));
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(fixed_array(array($qlang->gT("Yes") => 'Y',$qlang->gT("Uncertain") => 'U',$qlang->gT("No") => 'N')));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "E": //ARRAY (Increase/Same/Decrease) radio-buttons
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
$response->append_child(fixed_array(array("Increase" => 1,"Same" => 2,"Decrease" => 3)));
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(fixed_array(array($qlang->gT("Increase") => 'I',$qlang->gT("Same") => 'S',$qlang->gT("Decrease") => 'D')));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "F": //ARRAY (Flexible) - Row Format
|
||||
//select subQuestions from answers table where QID
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other));
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
//select fixed responses from
|
||||
break;
|
||||
case "H": //ARRAY (Flexible) - Column Format
|
||||
create_subQuestions($question,$RowQ['qid'],$RowQ['title']);
|
||||
$response->append_child(create_fixed($qid,true,false,0,$other));
|
||||
create_subQuestions($question,$RowQ['qid'],$sgq);
|
||||
$response->append_child(create_fixed($qid,true,false,0,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
break;
|
||||
case "1": //Dualscale multi-flexi array
|
||||
//select subQuestions from answers table where QID
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
$response = $dom->create_element("response");
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other));
|
||||
$response->append_child(create_fixed($qid,false,false,0,$other,$sgq));
|
||||
$response2 = $dom->create_element("response");
|
||||
$response2->set_attribute("varName",cleanup($RowQ['title']) . "_2");
|
||||
$response2->append_child(create_fixed($qid,false,false,1,$other));
|
||||
$response2->set_attribute("varName",cleanup($sgq) . "_2");
|
||||
$response2->append_child(create_fixed($qid,false,false,1,$other,$sgq));
|
||||
$question->append_child($response);
|
||||
$question->append_child($response2);
|
||||
break;
|
||||
case ":": //multi-flexi array numbers
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
//get multiflexible_checkbox - if set then each box is a checkbox (single fixed response)
|
||||
$mcb = get_length($qid,'multiflexible_checkbox',-1);
|
||||
if ($mcb != -1)
|
||||
create_multi($question,$qid,$RowQ['title'],1);
|
||||
create_multi($question,$qid,$sgq,1);
|
||||
else
|
||||
{
|
||||
//get multiflexible_max - if set then make boxes of max this width
|
||||
$mcm = strlen(get_length($qid,'multiflexible_max',1));
|
||||
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
|
||||
create_multi($question,$qid,$sgq,1,array('f' => 'integer', 'len' => $mcm, 'lab' => ''));
|
||||
}
|
||||
break;
|
||||
case ";": //multi-flexi array text
|
||||
create_subQuestions($question,$qid,$RowQ['title']);
|
||||
create_subQuestions($question,$qid,$sgq);
|
||||
//foreach question where scale_id = 1 this is a textbox
|
||||
create_multi($question,$qid,$RowQ['title'],1,array('f' => 'text', 'len' => 10, 'lab' => ''));
|
||||
create_multi($question,$qid,$sgq,1,array('f' => 'text', 'len' => 10, 'lab' => ''));
|
||||
break;
|
||||
case "^": //SLIDER CONTROL - not supported
|
||||
$response->append_child(fixed_array(array("NOT SUPPORTED:$type" => 1)));
|
||||
|
||||
@@ -676,7 +676,7 @@ if ($answers == "short") //Nice and easy. Just dump the data straight
|
||||
$rowcounter++;
|
||||
if ($type == "csv")
|
||||
{
|
||||
$exportoutput .= "\"".implode("\"$separator\"", str_replace("\"", "\"\"", str_replace("\r\n", " ", $drow))) . "\"\n"; //create dump from each row
|
||||
$exportoutput .= "\"".implode("\"$separator\"", str_replace("\"", "\"\"", $drow)) . "\"\n";
|
||||
}
|
||||
elseif ($type == "xls")
|
||||
{
|
||||
@@ -1130,11 +1130,6 @@ exit;
|
||||
|
||||
|
||||
function strip_tags_full($string) {
|
||||
$string=html_entity_decode($string, ENT_QUOTES, "UTF-8");
|
||||
mb_regex_encoding('utf-8');
|
||||
$pattern = array('\r', '\n', '-oth-');
|
||||
for ($i=0; $i<sizeof($pattern); $i++) {
|
||||
$string = mb_ereg_replace($pattern[$i], '', $string);
|
||||
}
|
||||
return strip_tags($string);
|
||||
$string=str_replace('-oth-','',$string);
|
||||
return FlattenText($string,true,'UTF-8',false);
|
||||
}
|
||||
|
||||
@@ -376,12 +376,12 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
|
||||
|
||||
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
|
||||
{
|
||||
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}'>"
|
||||
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}'>"
|
||||
. "<img src='{$imageurl}/print_30.png' name='ShowPrintableSurvey' /> ".$clang->gT("Printable version")."</a></li>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}'>"
|
||||
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}'>"
|
||||
. "<img src='{$imageurl}/print_30.png' name='ShowPrintableSurvey' /> ".$clang->gT("Printable version")."</a><ul>";
|
||||
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
|
||||
$baselang = GetBaseLanguageFromSurveyID($surveyid);
|
||||
@@ -389,7 +389,7 @@ $action!='vvimport' && $action!='vvexport' && $action!='exportresults')
|
||||
rsort($tmp_survlangs);
|
||||
foreach ($tmp_survlangs as $tmp_lang)
|
||||
{
|
||||
$surveysummary .= "<li><a href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}&lang={$tmp_lang}'><img src='{$imageurl}/print_30.png' /> ".getLanguageNameFromCode($tmp_lang,false)."</a></li>";
|
||||
$surveysummary .= "<li><a target='_blank' href='{$scriptname}?action=showprintablesurvey&sid={$surveyid}&lang={$tmp_lang}'><img src='{$imageurl}/print_30.png' /> ".getLanguageNameFromCode($tmp_lang,false)."</a></li>";
|
||||
}
|
||||
$surveysummary.='</ul></li>';
|
||||
}
|
||||
|
||||
@@ -710,6 +710,7 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid)
|
||||
if ($xml->LimeSurveyDocType!='Question') safe_die('This is not a valid LimeSurvey question structure XML file.');
|
||||
$dbversion = (int) $xml->DBVersion;
|
||||
$aQIDReplacements=array();
|
||||
$aSQIDReplacements=array(0=>0);
|
||||
$results['defaultvalues']=0;
|
||||
$results['answers']=0;
|
||||
$results['question_attributes']=0;
|
||||
|
||||
@@ -54,7 +54,7 @@ if ($subaction=='unfinalizeanswers')
|
||||
$updateqr = "UPDATE $surveytable SET submitdate=NULL, lastpage=NULL;\n";
|
||||
$updateres = $connect->Execute($updateqr) or safe_die("UnFinilize answers failed:<br />\n" . $connect->ErrorMsg() . "<br />$updateqr");
|
||||
// Finally, reset the token completed and sent status
|
||||
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N'";
|
||||
$updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N', usesleft=1";
|
||||
$updateres=$connect->Execute($updateqr) or safe_die ("Couldn't reset token completed state<br />$updateqr<br />".$connect->ErrorMsg());
|
||||
$iteratesurveyoutput .= "<br />\n";
|
||||
$iteratesurveyoutput .= "<div class='header ui-widget-header'>".$clang->gT("Iterate survey")."</div>\n";
|
||||
|
||||
@@ -21,7 +21,7 @@ sendcacheheaders();
|
||||
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
|
||||
if (!isset($column)) {$column=returnglobal('column');}
|
||||
if (!isset($order)) {$order=returnglobal('order');}
|
||||
if (!isset($sql)) {$sql=returnglobal('sql');}
|
||||
if (!isset($sql)) {$sql=$_SESSION['sql'];}
|
||||
|
||||
if (!$surveyid)
|
||||
{
|
||||
@@ -33,6 +33,8 @@ if (!$column)
|
||||
//NOCOLUMN
|
||||
exit;
|
||||
}
|
||||
$aColumnNames=$connect->MetaColumnNames("{$dbprefix}survey_{$surveyid}");
|
||||
if (!isset($aColumnNames[strtoupper($column)])) safe_die('Invalid column name');
|
||||
|
||||
if ($connect->databaseType == 'odbc_mssql' || $connect->databaseType == 'odbtp' || $connect->databaseType == 'mssql_n' || $connect->databaseType == 'mssqlnative')
|
||||
{ $query = "SELECT id, ".db_quote_id($column)." FROM {$dbprefix}survey_$surveyid WHERE (".db_quote_id($column)." NOT LIKE '')"; }
|
||||
@@ -59,6 +61,10 @@ if ($order == "alpha")
|
||||
{
|
||||
$query .= " ORDER BY ".db_quote_id($column);
|
||||
}
|
||||
else
|
||||
{
|
||||
$query .= " ORDER BY id";
|
||||
}
|
||||
|
||||
$result=db_execute_assoc($query) or safe_die("Error with query: ".$query."<br />".$connect->ErrorMsg());
|
||||
$listcolumnoutput= "<table width='98%' class='statisticstable' border='1' cellpadding='2' cellspacing='0'>\n";
|
||||
|
||||
@@ -623,6 +623,9 @@ while ($degrow = $degresult->FetchRow())
|
||||
{
|
||||
$conditions[]=$ansrow['answer'];
|
||||
}
|
||||
if($conrow['value'] == "-oth-") {
|
||||
$conditions[]=$clang->gT("Other");
|
||||
}
|
||||
$conditions = array_unique($conditions);
|
||||
break;
|
||||
case "M":
|
||||
|
||||
@@ -538,9 +538,9 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
|
||||
//$_POST['sql'] is a post field that is sent from the statistics script to the export script in order
|
||||
// to export just those results filtered by this statistics script. It can also be passed to the statistics
|
||||
// script to filter from external scripts.
|
||||
elseif (!empty($_POST['sql']) && !isset($_POST['id=']))
|
||||
elseif (isset($_SESSION['sql']) && $_SESSION['sql']!='NULL' && !isset($_POST['id=']))
|
||||
{
|
||||
$newsql=substr($_POST['sql'], strpos($_POST['sql'], "WHERE")+5, strlen($_POST['sql']));
|
||||
$newsql=substr($_SESSION['sql'], strpos($_SESSION['sql'], "WHERE")+5, strlen($_SESSION['sql']));
|
||||
|
||||
//for debugging only
|
||||
//$query = $_POST['sql'];
|
||||
@@ -638,12 +638,12 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
|
||||
{
|
||||
if($outputType=='html' && $browse === true)
|
||||
{
|
||||
$_SESSION['sql']=$sql;
|
||||
//add a buttons to browse results
|
||||
$statisticsoutput .= "<form action='$scriptname?action=browse' method='post' target='_blank'>\n"
|
||||
."\t\t<p>"
|
||||
."\t\t\t<input type='submit' value='".$statlang->gT("Browse")."' />\n"
|
||||
."\t\t\t<input type='hidden' name='sid' value='$surveyid' />\n"
|
||||
."\t\t\t<input type='hidden' name='sql' value=\"$sql\" />\n"
|
||||
."\t\t\t<input type='hidden' name='subaction' value='all' />\n"
|
||||
."\t\t</p>"
|
||||
."\t\t</form>\n";
|
||||
@@ -2121,7 +2121,7 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
|
||||
$TotalCompleted -=$row[0];
|
||||
}
|
||||
$fname="$al[1]";
|
||||
if ($browse===true) $fname .= " <input type='button' value='".$statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid=$surveyid&column=$ColumnName_RM&sql=".urlencode($sql)."', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
|
||||
if ($browse===true) $fname .= " <input type='button' value='".$statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid={$surveyid}&column={$ColumnName_RM}', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2142,8 +2142,7 @@ function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0,
|
||||
{
|
||||
$fname= "$al[1]";
|
||||
if ($browse===true) $fname .= " <input type='submit' value='"
|
||||
. $statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid=$surveyid&column=$al[2]&sql="
|
||||
. urlencode($sql)."', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
|
||||
. $statlang->gT("Browse")."' onclick=\"window.open('admin.php?action=listcolumn&sid=$surveyid&column=$al[2]', 'results', 'width=460, height=500, left=50, top=50, resizable=yes, scrollbars=yes, menubar=no, status=no, location=no, toolbar=no')\" />";
|
||||
}
|
||||
elseif ($al[0] == "NoAnswer")
|
||||
{
|
||||
|
||||
@@ -106,14 +106,19 @@ $tokenoutput = "";
|
||||
|
||||
if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'export')) )//EXPORT FEATURE SUBMITTED BY PIETERJAN HEYSE
|
||||
{
|
||||
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
|
||||
header("Content-type: text/comma-separated-values; charset=UTF-8");
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: cache");
|
||||
|
||||
|
||||
|
||||
$bquery = "SELECT * FROM ".db_table_name("tokens_$surveyid").' where 1=1';
|
||||
$bquery = "SELECT * FROM ".db_table_name("tokens_$surveyid").' t';
|
||||
if ($_POST['tokenstatus']==3 && $thissurvey['anonymized']=='N')
|
||||
{
|
||||
$bquery .= " JOIN ".db_table_name("survey_$surveyid")." s on t.token=s.token ";
|
||||
}
|
||||
if ($_POST['tokenstatus']==2 && $thissurvey['anonymized']=='N')
|
||||
{
|
||||
$bquery .= " LEFT JOIN ".db_table_name("survey_$surveyid")." s on t.token=s.token ";
|
||||
}
|
||||
$bquery.=' where 1=1';
|
||||
if (trim($_POST['filteremail'])!='')
|
||||
{
|
||||
if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $connect->databaseType == 'mssqlnative')
|
||||
@@ -134,14 +139,13 @@ if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'expor
|
||||
$bquery .= " and completed='N'";
|
||||
if ($thissurvey['anonymized']=='N')
|
||||
{
|
||||
$bquery .=" and token not in (select token from ".db_table_name("survey_$surveyid")." group by token)";
|
||||
$bquery .=" and s.token is null ";
|
||||
}
|
||||
}
|
||||
if ($_POST['tokenstatus']==3 && $thissurvey['anonymized']=='N')
|
||||
{
|
||||
$bquery .= " and completed='N' and token in (select token from ".db_table_name("survey_$surveyid")." group by token)";
|
||||
$bquery .= " and completed='N' and s.token is not null";
|
||||
}
|
||||
|
||||
if ($_POST['invitationstatus']==1)
|
||||
{
|
||||
$bquery .= " and sent<>'N'";
|
||||
@@ -166,6 +170,11 @@ if ($subaction == "export" && ( bHasSurveyPermission($surveyid, 'tokens', 'expor
|
||||
}
|
||||
$bquery .= " ORDER BY tid";
|
||||
|
||||
header("Content-Disposition: attachment; filename=tokens_".$surveyid.".csv");
|
||||
header("Content-type: text/comma-separated-values; charset=UTF-8");
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: cache");
|
||||
|
||||
$bresult = db_execute_assoc($bquery) or die ("$bquery<br />".htmlspecialchars($connect->ErrorMsg()));
|
||||
$bfieldcount=$bresult->FieldCount();
|
||||
// Export UTF8 WITH BOM
|
||||
@@ -1557,7 +1566,12 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
|
||||
while ($emrow = $emresult->FetchRow())
|
||||
{
|
||||
unset($fieldsarray);
|
||||
$to = $emrow['firstname']." ".$emrow['lastname']." <".$emrow['email'].">";
|
||||
$to=array();
|
||||
$aEmailaddresses=explode(';',$emrow['email']);
|
||||
foreach($aEmailaddresses as $sEmailaddress)
|
||||
{
|
||||
$to[]=$emrow['firstname']." ".$emrow['lastname']." <{$sEmailaddress}>";
|
||||
}
|
||||
$fieldsarray["{EMAIL}"]=$emrow['email'];
|
||||
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
|
||||
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
|
||||
@@ -1578,7 +1592,6 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
|
||||
|
||||
$from = $_POST['from_'.$emrow['language']];
|
||||
|
||||
|
||||
if ($ishtml === false)
|
||||
{
|
||||
$fieldsarray["{OPTOUTURL}"]="$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}";
|
||||
@@ -1628,7 +1641,7 @@ if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update'))
|
||||
."SET sent='$today' WHERE tid={$emrow['tid']}";
|
||||
//
|
||||
$uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens<br />$udequery<br />".$connect->ErrorMsg());
|
||||
$tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)<br />\n";
|
||||
$tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} (".htmlspecialchars(implode(',',$to)).")<br />\n";
|
||||
if ($emailsmtpdebug==2)
|
||||
{
|
||||
$tokenoutput .=$maildebug;
|
||||
@@ -1885,7 +1898,12 @@ if ($subaction == "remind" && bHasSurveyPermission($surveyid, 'tokens','update')
|
||||
while ($emrow = $emresult->FetchRow())
|
||||
{
|
||||
unset($fieldsarray);
|
||||
$to = $emrow['firstname']." ".$emrow['lastname']." <".$emrow['email'].">";
|
||||
$to=array();
|
||||
$aEmailaddresses=explode(';',$emrow['email']);
|
||||
foreach($aEmailaddresses as $sEmailaddress)
|
||||
{
|
||||
$to[]=$emrow['firstname']." ".$emrow['lastname']." <{$sEmailaddress}>";
|
||||
}
|
||||
$fieldsarray["{EMAIL}"]=$emrow['email'];
|
||||
$fieldsarray["{FIRSTNAME}"]=$emrow['firstname'];
|
||||
$fieldsarray["{LASTNAME}"]=$emrow['lastname'];
|
||||
@@ -3268,4 +3286,4 @@ function getLine($file)
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -89,7 +89,7 @@ function upgrade_survey_table145()
|
||||
$oLanguage = new limesurvey_lang($aSurveyRow['surveyls_language']);
|
||||
$aDefaultTexts=aTemplateDefaultTexts($oLanguage,'unescaped');
|
||||
unset($oLanguage);
|
||||
$aDefaultTexts['admin_detailed_notification_subject']=$aDefaultTexts['admin_detailed_notification'].$aDefaultTexts['admin_detailed_notification_css'];
|
||||
$aDefaultTexts['admin_detailed_notification']=$aDefaultTexts['admin_detailed_notification'].$aDefaultTexts['admin_detailed_notification_css'];
|
||||
$aDefaultTexts=array_map('db_quoteall',$aDefaultTexts);
|
||||
$sSurveyUpdateQuery= "update ".db_table_name('surveys_languagesettings')." set
|
||||
email_admin_responses_subj={$aDefaultTexts['admin_detailed_notification_subject']},
|
||||
|
||||
@@ -4224,7 +4224,7 @@ function ReplaceFields ($text,$fieldsarray, $bReplaceInsertans=false)
|
||||
* @param mixed $mail This is an PHPMailer object. If null, one will be created automatically and unset afterwards. If supplied it won't be unset.
|
||||
* @param string $body Body text of the email in plain text or HTML
|
||||
* @param mixed $subject Email subject
|
||||
* @param mixed $to
|
||||
* @param mixed $to Array with several email addresses or single string with one email address
|
||||
* @param mixed $from
|
||||
* @param mixed $sitename
|
||||
* @param mixed $ishtml
|
||||
@@ -4237,7 +4237,9 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml
|
||||
|
||||
global $emailmethod, $emailsmtphost, $emailsmtpuser, $emailsmtppassword, $defaultlang, $emailsmtpdebug;
|
||||
global $rootdir, $maildebug, $maildebugbody, $emailsmtpssl, $clang, $demoModeOnly, $emailcharset;
|
||||
|
||||
if (!is_array($to)){
|
||||
$to=array($to);
|
||||
}
|
||||
if (!is_array($customheaders) && $customheaders == '')
|
||||
{
|
||||
$customheaders=array();
|
||||
@@ -4302,7 +4304,7 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml
|
||||
$mail->IsSMTP();
|
||||
if ($emailsmtpdebug>0)
|
||||
{
|
||||
$mail->SMTPDebug = true;
|
||||
$mail->SMTPDebug = $emailsmtpdebug;
|
||||
}
|
||||
if (strpos($emailsmtphost,':')>0)
|
||||
{
|
||||
@@ -4330,8 +4332,7 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml
|
||||
|
||||
$mail->SetFrom($fromemail, $fromname);
|
||||
$mail->Sender = $senderemail; // Sets Return-Path for error notifications
|
||||
$toemails = explode(";", $to);
|
||||
foreach ($toemails as $singletoemail)
|
||||
foreach ($to as $singletoemail)
|
||||
{
|
||||
if (strpos($singletoemail, '<') )
|
||||
{
|
||||
@@ -4397,32 +4398,27 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml
|
||||
*
|
||||
* @return string Cleaned text
|
||||
*/
|
||||
function FlattenText($sTextToFlatten, $bDecodeHTMLEntities=false, $sCharset='UTF-8',$is_csv=false)
|
||||
function FlattenText($sTextToFlatten, $bDecodeHTMLEntities=false, $sCharset='UTF-8', $bStripNewLines=true)
|
||||
{
|
||||
$sNicetext = strip_javascript($sTextToFlatten);
|
||||
$sNicetext = strip_tags($sNicetext);
|
||||
if($is_csv==true)
|
||||
{
|
||||
$sNicetext = str_replace(array("\r\n","\r","\n"),array(PHP_EOL,PHP_EOL,PHP_EOL), $sNicetext);
|
||||
|
||||
if ($bStripNewLines ){
|
||||
$sNicetext = preg_replace('~\Ru~', '', $sNicetext);
|
||||
}
|
||||
elseif ($sCharset=='UTF-8')
|
||||
else // unify newlines
|
||||
{
|
||||
$sNicetext = preg_replace('/[\x0a\x0b\x0c\x0d\x85\x{2028}\x{2029}]/u', ' ', $sNicetext);
|
||||
$sNicetext = str_replace(array("\n","\r"),array('',''), $sNicetext);
|
||||
}
|
||||
else
|
||||
{
|
||||
$sNicetext = str_replace(array("\n","\r"),array('',''), $sNicetext);
|
||||
$sNicetext = preg_replace('~\Ru~', "\r\n", $sNicetext);
|
||||
}
|
||||
if ($bDecodeHTMLEntities==true)
|
||||
{
|
||||
$sNicetext = str_replace(' ',' ', $sNicetext); // html_entity_decode does not properly convert to spaces
|
||||
$sNicetext = str_replace(' ',' ', $sNicetext); // html_entity_decode does not convert to spaces
|
||||
$sNicetext = html_entity_decode($sNicetext, ENT_QUOTES, $sCharset);
|
||||
}
|
||||
$sNicetext = trim($sNicetext);
|
||||
return $sNicetext;
|
||||
return trim($sNicetext); ;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* getArrayFiltersForGroup() queries the database and produces a list of array_filter questions and targets with in the same group
|
||||
* @global string $surveyid
|
||||
@@ -5961,9 +5957,12 @@ function retrieve_Answer($code, $phpdateformat=null)
|
||||
//extracted from a "fieldname" - ie: 1X2X3a
|
||||
// also returns question type
|
||||
|
||||
if ($questiondetails['type'] == "M" ||
|
||||
$questiondetails['type'] == "P")
|
||||
if ($questiondetails['type'] == "M" || $questiondetails['type'] == "P")
|
||||
{
|
||||
if (strpos($code,'comment')>0 && isset($_SESSION[$code]))
|
||||
{
|
||||
return $_SESSION[$code];
|
||||
}
|
||||
$query="SELECT * FROM {$dbprefix}questions WHERE parent_qid='".$questiondetails['qid']."' AND language='".$_SESSION['s_lang']."'";
|
||||
$result=db_execute_assoc($query) or safe_die("Error getting answer<br />$query<br />".$connect->ErrorMsg()); //Checked
|
||||
while($row=$result->FetchRow())
|
||||
@@ -7641,8 +7640,9 @@ function SSL_mode()
|
||||
* @param mixed $iSurveyID
|
||||
* @param mixed $iResponseID
|
||||
* @param mixed $sLanguageCode
|
||||
* @param boolean $bHonorConditions Apply conditions
|
||||
*/
|
||||
function aGetFullResponseTable($iSurveyID,$iResponseID,$sLanguageCode)
|
||||
function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions=false)
|
||||
{
|
||||
global $connect;
|
||||
$aFieldMap = createFieldMap($iSurveyID,'full',false,false,$sLanguageCode);
|
||||
@@ -7671,14 +7671,27 @@ function aGetFullResponseTable($iSurveyID,$iResponseID,$sLanguageCode)
|
||||
if ($oldgid !== $fname['gid'])
|
||||
{
|
||||
$oldgid = $fname['gid'];
|
||||
if (!$bHonorConditions || checkgroupfordisplay($fname['gid']))
|
||||
{
|
||||
$aResultTable['gid_'.$fname['gid']]=array($fname['group_name']);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($fname['qid']) && !empty($fname['qid']))
|
||||
{
|
||||
if ($bHonorConditions)
|
||||
{
|
||||
$isQuestionVisible=checkquestionfordisplay($fname['qid'],null);
|
||||
}
|
||||
else
|
||||
{
|
||||
$isQuestionVisible=true;
|
||||
}
|
||||
if ($oldqid !== $fname['qid'])
|
||||
{
|
||||
$oldqid = $fname['qid'];
|
||||
if ($isQuestionVisible)
|
||||
{
|
||||
if (isset($fname['subquestion']) || isset($fname['subquestion1']) || isset($fname['subquestion2']))
|
||||
{
|
||||
$aResultTable['qid_'.$fname['sid'].'X'.$fname['gid'].'X'.$fname['qid']]=array($fname['question'],'','');
|
||||
@@ -7689,6 +7702,13 @@ function aGetFullResponseTable($iSurveyID,$iResponseID,$sLanguageCode)
|
||||
$aResultTable[$fname['fieldname']]=array($question,'',$answer);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -7705,10 +7725,13 @@ function aGetFullResponseTable($iSurveyID,$iResponseID,$sLanguageCode)
|
||||
|
||||
if (isset($fname['subquestion2']))
|
||||
$subquestion .= "[{$fname['subquestion2']}]";
|
||||
|
||||
if ($isQuestionVisible)
|
||||
{
|
||||
$answer=getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]);
|
||||
$aResultTable[$fname['fieldname']]=array('',$subquestion,$answer);
|
||||
}
|
||||
|
||||
}
|
||||
return $aResultTable;
|
||||
}
|
||||
|
||||
@@ -7754,40 +7777,79 @@ function aArrayInvert($aArr)
|
||||
*/
|
||||
function bCheckQuestionForAnswer($q, $aFieldnamesInfoInv)
|
||||
{
|
||||
if (@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'X')
|
||||
{
|
||||
// boilerplate have no answers
|
||||
return true;
|
||||
}
|
||||
else if (@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'M' || @$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'P' || @$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'] == 'O')
|
||||
{
|
||||
// multiple choice and list with comments question types - just one answer is required and comments are not required
|
||||
$bAnsw = false;
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
{
|
||||
if(!strstr($sField, 'comment') && isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='')
|
||||
{
|
||||
$bAnsw = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// all answers required for all other question types
|
||||
$bAnsw = true;
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
{
|
||||
if(!isset($_SESSION[$sField]) || trim($_SESSION[$sField])=='')
|
||||
{
|
||||
$bAnsw = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $bAnsw;
|
||||
}
|
||||
$qtype = @$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['type'];
|
||||
|
||||
switch ($qtype) {
|
||||
case 'X':
|
||||
return true;
|
||||
case 'M':
|
||||
case 'P':
|
||||
case 'O':
|
||||
// multiple choice and list with comments question types - just one answer is required and comments are not required
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
if(!strstr($sField, 'comment') && isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='')
|
||||
return true;
|
||||
return false;
|
||||
case 'L': // List questions only need one answer (including the 'other' option)
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
{
|
||||
if(isset($_SESSION[$sField]) && trim($_SESSION[$sField])!='')
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case 'F':
|
||||
case ':':
|
||||
case ';':
|
||||
case '1':
|
||||
case 'C':
|
||||
case 'B':
|
||||
case 'A':
|
||||
case 'E':
|
||||
// array question types - if filtered only displayed answer are required
|
||||
$qattr = getQuestionAttributes(@$_SESSION['fieldmap'][$aFieldnamesInfoInv[$q][0]]['qid'], $qtype);
|
||||
|
||||
$qcodefilter = @$qattr['array_filter'];
|
||||
|
||||
$sgqfilter = '';
|
||||
|
||||
foreach($_SESSION['fieldarray'] as $field)
|
||||
//look for the multiple choice filter
|
||||
if ($field[2] == $qcodefilter && $field[4] == 'M')
|
||||
{
|
||||
//filter SQG
|
||||
$sgqfilter = $field[1];
|
||||
break;
|
||||
}
|
||||
|
||||
//if filter not found checkall answers
|
||||
if ($sgqfilter == '')
|
||||
{
|
||||
// all answers required
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
if(!isset($_SESSION[$sField]) || trim($_SESSION[$sField])=='')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
{
|
||||
//keep only first subquestion code for multiple scale answer
|
||||
$aid = explode('_',$_SESSION['fieldmap'][$sField]['aid']);
|
||||
$aid = explode('#',$aid[0]);
|
||||
//if a checked answer in the multiple choice is not present
|
||||
if ($_SESSION[$sgqfilter.$aid[0]] == 'Y' && $_SESSION[$sField] == '')
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
// all answers required for all other question types
|
||||
foreach($aFieldnamesInfoInv[$q] as $sField)
|
||||
if(!isset($_SESSION[$sField]) || trim($_SESSION[$sField])=='')
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Include Keypad headers
|
||||
*/
|
||||
@@ -7850,4 +7912,63 @@ function fixSubquestions()
|
||||
}
|
||||
|
||||
|
||||
function checkgroupfordisplay($gid)
|
||||
{
|
||||
//This function checks all the questions in a group to see if they have
|
||||
//conditions, and if the do - to see if the conditions are met.
|
||||
//If none of the questions in the group are set to display, then
|
||||
//the function will return false, to indicate that the whole group
|
||||
//should not display at all.
|
||||
global $dbprefix, $connect;
|
||||
$countQuestionsInThisGroup=0;
|
||||
$countConditionalQuestionsInThisGroup=0;
|
||||
foreach ($_SESSION['fieldarray'] as $ia) //Run through all the questions
|
||||
|
||||
{
|
||||
if ($ia[5] == $gid) //If the question is in the group we are checking:
|
||||
|
||||
{
|
||||
// Check if this question is hidden
|
||||
$qidattributes=getQuestionAttributes($ia[0]);
|
||||
if ($qidattributes!==false && $qidattributes['hidden']==0)
|
||||
{
|
||||
$countQuestionsInThisGroup++;
|
||||
if ($ia[7] == "Y") //This question is conditional
|
||||
|
||||
{
|
||||
$countConditionalQuestionsInThisGroup++;
|
||||
$QuestionsWithConditions[]=$ia; //Create an array containing all the conditional questions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($countQuestionsInThisGroup===0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif ($countQuestionsInThisGroup != $countConditionalQuestionsInThisGroup || !isset($QuestionsWithConditions) )
|
||||
{
|
||||
//One of the questions in this group is NOT conditional, therefore
|
||||
//the group MUST be displayed
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//All of the questions in this group are conditional. Now we must
|
||||
//check every question, to see if the condition for each has been met.
|
||||
//If 1 or more have their conditions met, then the group should
|
||||
//be displayed.
|
||||
foreach ($QuestionsWithConditions as $cc)
|
||||
{
|
||||
if (checkquestionfordisplay($cc[0], $gid) === true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//Since we made it this far, there mustn't have been any conditions met.
|
||||
//Therefore the group should not be displayed.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Closing PHP tag intentionally omitted - yes, it is okay
|
||||
|
||||
@@ -129,7 +129,7 @@ $emailsmtpuser = ''; // SMTP authorisation username - only se
|
||||
$emailsmtppassword = ''; // SMTP authorisation password - empty password is not allowed
|
||||
$emailsmtpssl = ''; // Set this to 'ssl' or 'tls' to use SSL/TLS for SMTP connection
|
||||
|
||||
$emailsmtpdebug = 0; // Settings this to 1 activates SMTP debug mode
|
||||
$emailsmtpdebug = 0; // Settings this to 1 activates SMTP debug mode on errors, set to 2 to always show SMTP debug information
|
||||
|
||||
$maxemails = 50; // The maximum number of emails to send in one go (this is to prevent your mail server or script from timeouting when sending mass mail)
|
||||
|
||||
|
||||
@@ -77,16 +77,51 @@ HOW TO UPGRADE from a LimeSurvey 1.70(+) version to the latest 1.9x
|
||||
|
||||
Thank you to everyone who helped with this new release!
|
||||
|
||||
Changes from 1.91+ (build 11228) to 1.91+ (build 11343) Nov 8, 2011
|
||||
-Fixed issue #5126: CSV export - no new lines (c_schmitz)
|
||||
-Fixed issue #5455: INSERTANS not working in Multiple options with comments (c_schmitz)
|
||||
-Fixed issue #5508: $printanswershonorsconditions settings doesn't work - all questions are shown in Print Answers page (c_schmitz)
|
||||
-Fixed issue #5532: Problem with encoding Polish character "a" (c_schmitz)
|
||||
-Fixed issue #5536: Error when clicking "resume later" and token persistence enabled. (c_schmitz)
|
||||
-Fixed issue #5538: Further file uploads may fail after first upload processed following Next/Prev question group - patch by litotes (c_schmitz)
|
||||
-Fixed issue #5549: queXML: Yes/no and gender questions are not translated (azammitdcarf)
|
||||
-Fixed issue #5557: Basic admin notification and Detailed admin notification email templates are blank after upgrade from 1.90 (c_schmitz)
|
||||
-Fixed issue: Problems on exporting tokens (c_schmitz)
|
||||
-Fixed issue: Slow export of tokens (c_schmitz)
|
||||
|
||||
Changes from 1.91+ (build 11136) to 1.91+ (build 11228) Oct 20, 2011
|
||||
#Updated translation: Danish by Andreas Christoffersen (c_schmitz)
|
||||
#Updated translation: Czech (c_schmitz)
|
||||
#Updated translation: Polish (elisa-ls)
|
||||
-Fixed issue #5489: Survey Iteration changes value usesleft in user table to 0 instead of 1 (lemeur)
|
||||
-Fixed issue #5126: CSV export - no new lines (c_schmitz)
|
||||
-Fixed issue #5323: .missing class added in answered filtered array question "Show question index / allow jumping" modality - patch by flocs (c_schmitz)
|
||||
-Fixed issue #5418: Failing check on fieldnames POST variable (c_schmitz)
|
||||
-Fixed issue #5466: "List (radio)" question displayed always as unanswered when using question index and 'Other' option (c_schmitz)
|
||||
-Fixed issue #5474: Not possible to send a token to multiple email addresses (c_schmitz)
|
||||
-Fixed issue #5491: SMTP error messages though emails are sent fine (c_schmitz)
|
||||
-Fixed issue #5494: When exporting statistics to PDF format with more than 35 entries(answers) answers are overlapping on the following page (c_schmitz)
|
||||
-Fixed issue #5495: Error when importing questions (list type) with default value set (c_schmitz)
|
||||
-Fixed issue #5508: $printanswershonorsconditions settings doesn't work - all questions are shown in Print Answers page (c_schmitz)
|
||||
-Fixed issue #5515: File uploads fail if title or comment contains apostrophe (') (c_schmitz)
|
||||
-Fixed issue: Administration user could gain access to database information reserved for Super-administrators (c_schmitz)
|
||||
|
||||
Changes from 1.91+ (build 11110) to 1.91+ (build 11136)
|
||||
#Updated translation: Danish by Andreas Christoffersen (c_schmitz)
|
||||
#Updated translation: Czech (c_schmitz)
|
||||
-Fixed issue #5489: Survey Iteration changes value usesleft in user table to 0 instead of 1 (lemeur)
|
||||
-Fixed issue: Administration user could gain access to database information reserved for Super-administrators (c_schmitz)
|
||||
-Fixed issue: Integrity check reporting errors with subquestions due to invalid type or group id (c_schmitz)
|
||||
|
||||
Changes from 1.91+ (build 11026) to 1.91+ (build 11110)
|
||||
#Updated translation: Polish (elisa-ls)
|
||||
-Fixed issue: Re-implemented commit 10985 ("groups of "or"ed conditions were displaying multiple times") (maziminke)
|
||||
-Fied issue: Some single choice questions were missing answer codes for available answer options. Some questions using "other" text fields were missing correct IDs. (maziminke)
|
||||
-Fixed issue #05476: File upload questions hidden by condition with min file upload set prevent survey submission (lemeur)
|
||||
-Fixed issue #05477: Users with all rights unticked still see everyone in the system in the surveylist view (lemeur)
|
||||
-Fixed issue #05483: Conditions using previous answers as rightoperand do not work when both questions are on the same page (lemeur)
|
||||
-Fixed issue #05493: Conditions using previous answers (coded as @sgqa@) aren't translated when survey is imported. (lemeur)
|
||||
-Fixed issue 05488: multi numeric - slider, inital value dont register (tpartner)
|
||||
-Fixed issue #5476: File upload questions hidden by condition with min file upload set prevent survey submission (lemeur)
|
||||
-Fixed issue #5477: Users with all rights unticked still see everyone in the system in the surveylist view (lemeur)
|
||||
-Fixed issue #5483: Conditions using previous answers as rightoperand do not work when both questions are on the same page (lemeur)
|
||||
-Fixed issue #5493: Conditions using previous answers (coded as @sgqa@) aren't translated when survey is imported. (lemeur)
|
||||
-Fixed issue #5488: multi numeric - slider, inital value dont register (tpartner)
|
||||
-Fixed issue: slider layout multinumeric can't be answered without javascript (shnoulle)
|
||||
-Fixed issue: Path disclosure vulnerabilities (c_schmitz)
|
||||
-Fixed issue: Templates not editable in Chinese (c_schmitz)
|
||||
@@ -99,14 +134,13 @@ Changes from 1.91+ (build 11018) to 1.91+ (build 11026)
|
||||
Changes from 1.91+ (build 10951) to 1.91+ (build 11018)
|
||||
#Updated translation : French (b00z00)
|
||||
#Updated translation: German (c_schmitz)
|
||||
#Updated translation: German Informal (c_schmitz)
|
||||
#Updated translation: German informal (c_schmitz)
|
||||
-Fixed issue: Survey Name not displaying when $showsgqacode is false. (jcleeland)
|
||||
-Fixed issue: groups of "or"ed conditions were displaying multiple times. Removed additional "group by" entries in initial SQL that was causing the repeated processing of groups. (jcleeland)
|
||||
-Fixed issue #5426: default <option> tag redundant in language chooser (c_schmitz)
|
||||
-Fixed issue #5461: Arithmetic mean and deviation are not displayed even if showaggregateddata is set to 1- thanks to jpasquier (c_schmitz)
|
||||
-Fixed issue #5462: Survey crashes if the referrer URL contains a single quote (c_schmitz)
|
||||
-Fixed issue 05386: System still delete the user account even I cancel the deletion in confirmation box. (tpartner)
|
||||
-Fixed issue #5386: System still delete the user account even I cancel the deletion in confirmation box. (tpartner)
|
||||
-Fixed issue #5459: Conditions are not imported correctly for multiple choice questions (mennodekker)
|
||||
|
||||
Changes from 1.91+ (build 10859) to 1.91+ (build 10951)
|
||||
|
||||
@@ -1143,64 +1143,6 @@ function makelanguagechanger()
|
||||
}
|
||||
|
||||
|
||||
function checkgroupfordisplay($gid)
|
||||
{
|
||||
//This function checks all the questions in a group to see if they have
|
||||
//conditions, and if the do - to see if the conditions are met.
|
||||
//If none of the questions in the group are set to display, then
|
||||
//the function will return false, to indicate that the whole group
|
||||
//should not display at all.
|
||||
global $dbprefix, $connect;
|
||||
$countQuestionsInThisGroup=0;
|
||||
$countConditionalQuestionsInThisGroup=0;
|
||||
foreach ($_SESSION['fieldarray'] as $ia) //Run through all the questions
|
||||
|
||||
{
|
||||
if ($ia[5] == $gid) //If the question is in the group we are checking:
|
||||
|
||||
{
|
||||
// Check if this question is hidden
|
||||
$qidattributes=getQuestionAttributes($ia[0]);
|
||||
if ($qidattributes!==false && $qidattributes['hidden']==0)
|
||||
{
|
||||
$countQuestionsInThisGroup++;
|
||||
if ($ia[7] == "Y") //This question is conditional
|
||||
|
||||
{
|
||||
$countConditionalQuestionsInThisGroup++;
|
||||
$QuestionsWithConditions[]=$ia; //Create an array containing all the conditional questions
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($countQuestionsInThisGroup===0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
elseif ($countQuestionsInThisGroup != $countConditionalQuestionsInThisGroup || !isset($QuestionsWithConditions) )
|
||||
{
|
||||
//One of the questions in this group is NOT conditional, therefore
|
||||
//the group MUST be displayed
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//All of the questions in this group are conditional. Now we must
|
||||
//check every question, to see if the condition for each has been met.
|
||||
//If 1 or more have their conditions met, then the group should
|
||||
//be displayed.
|
||||
foreach ($QuestionsWithConditions as $cc)
|
||||
{
|
||||
if (checkquestionfordisplay($cc[0], $gid) === true)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//Since we made it this far, there mustn't have been any conditions met.
|
||||
//Therefore the group should not be displayed.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function checkconfield($value)
|
||||
{
|
||||
|
||||
Binary file not shown.
+10602
-10406
File diff suppressed because it is too large
Load Diff
Binary file not shown.
+11719
-8663
File diff suppressed because it is too large
Load Diff
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -174,8 +174,8 @@ if(isset($_POST['printableexport']))
|
||||
}
|
||||
$printoutput .= "\t<div class='printouttitle'><strong>".$clang->gT("Survey name (ID):")."</strong> $surveyname ($surveyid)</div><p> \n";
|
||||
|
||||
|
||||
$aFullResponseTable=aGetFullResponseTable($surveyid,$id,$language);
|
||||
$bHonorConditions=($printanswershonorsconditions==1);
|
||||
$aFullResponseTable=aGetFullResponseTable($surveyid,$id,$language,$bHonorConditions);
|
||||
|
||||
//Get the fieldmap @TODO: do we need to filter out some fields?
|
||||
unset ($aFullResponseTable['id']);
|
||||
|
||||
@@ -5077,7 +5077,7 @@ function do_longfreetext($ia)
|
||||
// ---------------------------------------------------------------
|
||||
function do_hugefreetext($ia)
|
||||
{
|
||||
global $clang, $thissurvey;
|
||||
global $clang, $js_header_includes, $thissurvey;
|
||||
|
||||
if ($thissurvey['nokeyboard']=='Y')
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ if (isset($_POST['fieldnames']) && $_POST['fieldnames'])
|
||||
// Remove invalid fieldnames from fieldnames array
|
||||
for($x=count($postedfieldnames)-1;$x>=0;$x--)
|
||||
{
|
||||
if (strpos($postedfieldnames[$x],$surveyid.'X')===false)
|
||||
if (!isset($_SESSION['fieldmap'][$postedfieldnames[$x]]))
|
||||
{
|
||||
array_remval($postedfieldnames[$x],$postedfieldnames);
|
||||
}
|
||||
@@ -220,7 +220,7 @@ if (isset($_POST['saveprompt'])) //Value submitted when clicking on 'Save Now'
|
||||
// Show 'SAVE FORM' only when click the 'Save so far' button the first time
|
||||
if ($thissurvey['allowsave'] == "Y" && isset($_POST['saveall']) && !isset($_SESSION['scid']))
|
||||
{
|
||||
if($thissurvey['tokenanswerspersistence'] != 'Y')
|
||||
if($thissurvey['tokenanswerspersistence'] != 'Y' || !tableExists('tokens_'.$surveyid))
|
||||
{
|
||||
//showsaveform();
|
||||
}
|
||||
@@ -516,20 +516,23 @@ function createinsertquery()
|
||||
// move the files from tmp to the files folder
|
||||
|
||||
$tmp = $tempdir.'/upload/';
|
||||
if (!is_null($phparray) && count($phparray) > 0 && file_exists($tmp.$phparray[0]->filename))
|
||||
if (!is_null($phparray) && count($phparray) > 0)
|
||||
{
|
||||
// move files from temp to files directory
|
||||
|
||||
// Move the (unmoved, temp) files from temp to files directory.
|
||||
// Check all possible file uploads
|
||||
for ($i = 0; $i < count($phparray); $i++)
|
||||
{
|
||||
if (file_exists($tmp.$phparray[$i]->filename))
|
||||
{
|
||||
$sDestinationFileName='fu_'.sRandomChars(15);
|
||||
if (!rename($tmp . $phparray[$i]->filename, $target . $sDestinationFileName))
|
||||
echo "Error moving file to its destination";
|
||||
$phparray[$i]->filename=$sDestinationFileName;
|
||||
}
|
||||
}
|
||||
$_SESSION[$value] = json_encode($phparray);
|
||||
}
|
||||
$values[] = $connect->qstr($_SESSION[$value], get_magic_quotes_gpc());
|
||||
$values[] = $connect->qstr($_SESSION[$value]);
|
||||
// filename is changed from undefined to a random value
|
||||
// update uses $_POST for saving responses
|
||||
$_POST[$value] = $_SESSION[$value];
|
||||
|
||||
Reference in New Issue
Block a user