Skip to content

Commit

Permalink
Fixed import and export regarding line breaks.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2292 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Feb 9, 2007
1 parent 1e93773 commit 69a1c34
Show file tree
Hide file tree
Showing 7 changed files with 166 additions and 224 deletions.
2 changes: 1 addition & 1 deletion admin/activate.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

//Ensure script is not run directly, avoid path disclosure
if (empty($homedir)) {die ("Cannot run this script directly");}
include_once("login_check.php");




Expand Down
6 changes: 2 additions & 4 deletions admin/deletesurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@
if (isset($_GET['sid'])) {$surveyid = $_GET['sid'];}
if (isset($_GET['ok'])) {$ok = $_GET['ok'];}

require_once(dirname(__FILE__).'/../config.php');

include_once("login_check.php");
if (empty($homedir)) {die ("Cannot run this script directly");}

$actsurquery = "SELECT delete_survey FROM {$dbprefix}surveys_rights WHERE sid=$surveyid AND uid = ".$_SESSION['loginID']; //Getting rights for this survey
//$actsurresult = $connect->Execute($actsurquery) or die($connect->ErrorMsg());
Expand Down Expand Up @@ -91,7 +89,7 @@
$deletesurveyoutput .= "\t<tr>\n";
$deletesurveyoutput .= "\t\t<td align='center'><br />\n";
$deletesurveyoutput .= "\t\t\t<input type='submit' value='".html_escape($clang->gT("Cancel"))."' onClick=\"window.open('admin.php?sid=$surveyid', '_top')\" /><br />\n";
$deletesurveyoutput .= "\t\t\t<input type='submit' value='".html_escape($clang->gT("Delete"))."' onClick=\"window.open('{$_SERVER['PHP_SELF']}?sid=$surveyid&amp;ok=Y','_top')\" />\n";
$deletesurveyoutput .= "\t\t\t<input type='submit' value='".html_escape($clang->gT("Delete"))."' onClick=\"window.open('$scriptname?action=deletesurvey&amp;sid=$surveyid&amp;ok=Y','_top')\" />\n";
$deletesurveyoutput .= "\t\t</td>\n";
$deletesurveyoutput .= "\t</tr>\n";
$deletesurveyoutput .= "</table>\n";
Expand Down
4 changes: 1 addition & 3 deletions admin/importsurvey.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
*/
//Ensure script is not run directly, avoid path disclosure
if (empty($homedir)) {die ("Cannot run this script directly");}
include_once("login_check.php");


// array_combine function is PHP5 only so we have to provide
Expand Down Expand Up @@ -536,9 +535,8 @@ function array_combine($a, $b) {
if ($importversion>=111)
{
$fieldorders=convertCSVRowToArray($surveylsarray[0],',','"');
$count=0;
unset($surveylsarray[0]);
foreach ($surveylsarray as $slsrow) {
if ($count==0) {$count++; continue;}
$fieldcontents=convertCSVRowToArray($slsrow,',','"');
$surveylsrowdata=array_combine($fieldorders,$fieldcontents);
$surveylsrowdata['surveyls_survey_id']=$newsid;
Expand Down
6 changes: 4 additions & 2 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -2983,10 +2983,12 @@ function BuildCSVFromQuery($Query)
$ColumnValues = "";
foreach ($Row as $Key=>$Value)
{
$ColumnValues .= CSVEscape(str_replace("\r\n", "\n", $Value)) . ",";
$Value=str_replace("\r\n", "\n", $Value);
$Value=str_replace("\r", "\n", $Value);
$ColumnValues .= CSVEscape($Value) . ",";
}
$ColumnValues = substr($ColumnValues, 0, -1); //strip off last comma space
$Output .= "$ColumnValues\n";
$Output .= str_replace("\n","\\n","$ColumnValues")."\n";
}
return $Output;
}
Expand Down
204 changes: 76 additions & 128 deletions docs/demosurveys/sample_survey.csv
Original file line number Diff line number Diff line change
Expand Up @@ -8,96 +8,96 @@
# SURVEYS TABLE
#
"sid","owner_id","admin","active","expires","adminemail","private","faxto","format","template","url","language","additional_languages","datestamp","usecookie","notification","allowregister","attribute1","attribute2","allowsave","autonumber_start","autoredirect","allowprev","ipaddr","useexpiry","refurl","datecreated"
"40","1","Administratorname","N","0000-00-00","admin@localhost","Y","000-00000000","G","default","","en","","Y","N","0","N","","","Y","0","N","Y","N","N","N",""
"75311","1","Administratorname","N","0000-00-00","admin@localhost","Y","000-00000000","G","default","","en","","Y","N","0","N","","","Y","0","N","Y","N","N","N",""

#
# GROUPS TABLE
#
"gid","sid","group_name","group_code","group_order","description","language"
"1","40","Array Questions","","0","This is a group with the different array questions.","en"
"2","40","Text Questions","","4","","en"
"3","40","Mask Questions","","1","This is the group description.","en"
"4","40","Single Choice Questions","","3","","en"
"5","40","Multiple Choice Questions","","2","This group consist only of Multiple Choice questions.","en"
"20","75311","Multiple Choice Questions","","2","This group consist only of Multiple Choice questions.","en"
"18","75311","Mask Questions","","1","This is the group description.","en"
"19","75311","Single Choice Questions","","3","","en"
"17","75311","Text Questions","","4","","en"
"16","75311","Array Questions","","0","This is a group with the different array questions.","en"

#
# QUESTIONS TABLE
#
"qid","sid","gid","type","title","question","preg","help","other","mandatory","lid","question_order","language"
"1","40","1","A","A","Type A - Array 5 Point Choice Question","","","N","N","0","0","en"
"2","40","1","B","B","Type B - Array 10 point choice Question","","This is the help text for this question. ","N","N","0","1","en"
"3","40","1","C","C","Type C - Array Yes/No/Uncertain Question","","","N","N","0","2","en"
"4","40","1","E","E","Type E - Array Increase/Same/Decrease Question","","This is the questions help text.","N","N","0","3","en"
"5","40","1","F","F","Type F - Array using Flexible Labels question","","This is a array using a flexible label set. Flexible labels sets can be created with as many answer as you like to. We created only one for this survey that will be re-used over and over.","N","N","0","4","en"
"6","40","1","H","H","Type H - Array Flexible Labels by Column question","","This is the same question type as before just the orientation has changed","N","N","0","5","en"
"7","40","2","Q","Q","Type Q - Multiple Short Text Question","","This is a Multiple Short Text Question","N","N","0","0","en"
"8","40","2","T","T","Type T - Long Text Question?","","Helptext","N","N","0","1","en"
"9","40","2","S","S","Type S - Short Free Text?","","helptext","N","N","0","2","en"
"10","40","2","U","U","Type U - Huge Free text?","","Helptext","N","N","0","3","en"
"11","40","3","X","X","Type X - Boilerplate question","","This is the boilerplate question type. It's not so much a question but a simple text display.","N","Y","0","0","en"
"12","40","3","G","G","Type G - Gender question?","","This is a standard question aksing for the participiant's sex.","N","N","0","1","en"
"13","40","3","N","N","Type N - Numerical Input Question","","","N","N","0","2","en"
"14","40","3","R","R","Type R - Ranking Question","","","N","N","0","3","en"
"15","40","3","Y","Y","Type Y - Yes/No Question","","","N","N","0","4","en"
"16","40","3","D","D","Type D - Date question?","","Helptext","N","N","0","5","en"
"17","40","4","Z","Z","Type Z - List Flexible Labels Dropdown","","This question is reusing the same label set as some of the array questions.","N","N","0","0","en"
"18","40","4","W","W","Type W - List Flexible Labels Dropdown question type","","This question is reusing the same label set as some of the array questions.","N","N","0","1","en"
"19","40","4","O","O","Type O : List with Comment Question","","","N","N","0","2","en"
"20","40","4","L","L","Type L - List Radio qeustion","","","Y","N","0","3","en"
"21","40","4","5","5","Type 5 - 5 point choice","","Help2","N","N","0","4","en"
"22","40","4","!","!","Type ! - List Dropdown Question","","","Y","N","0","5","en"
"23","40","5","P","P","Type P: Multiple Options Question with Comments ","","This is a Multiple Options Question with the ability to comment it.","Y","N","0","0","en"
"24","40","5","M","M","Type M - Multiple Options Question","","This is a type M multiple Options questions.","Y","N","0","1","en"
"93","75311","19","5","5","Type 5 - 5 point choice","","Help2","N","N","0","4","en"
"94","75311","19","!","!","Type ! - List Dropdown Question","","","Y","N","0","5","en"
"95","75311","20","P","P","Type P: Multiple Options Question with Comments ","","This is a Multiple Options Question with the ability to comment it.","Y","N","0","0","en"
"96","75311","20","M","M","Type M - Multiple Options Question","","This is a type M multiple Options questions.","Y","N","0","1","en"
"87","75311","18","Y","Y","Type Y - Yes/No Question","","","N","N","0","4","en"
"88","75311","18","D","D","Type D - Date question?","","Helptext","N","N","0","5","en"
"89","75311","19","Z","Z","Type Z - List Flexible Labels Dropdown","","This question is reusing the same label set as some of the array questions.","N","N","0","0","en"
"90","75311","19","W","W","Type W - List Flexible Labels Dropdown question type","","This question is reusing the same label set as some of the array questions.","N","N","0","1","en"
"76","75311","16","E","E","Type E - Array Increase/Same/Decrease Question","","This is the questions help text.","N","N","0","3","en"
"91","75311","19","O","O","Type O : List with Comment Question","","","N","N","0","2","en"
"92","75311","19","L","L","Type L - List Radio qeustion","","","Y","N","0","3","en"
"84","75311","18","G","G","Type G - Gender question?","","This is a standard question aksing for the participiant's sex.","N","N","0","1","en"
"85","75311","18","N","N","Type N - Numerical Input Question","","","N","N","0","2","en"
"79","75311","17","Q","Q","Type Q - Multiple Short Text Question","","This is a Multiple Short Text Question","N","N","0","0","en"
"80","75311","17","T","T","Type T - Long Text Question?","","Helptext","N","N","0","1","en"
"81","75311","17","S","S","Type S - Short Free Text?","","helptext","N","N","0","2","en"
"82","75311","17","U","U","Type U - Huge Free text?","","Helptext","N","N","0","3","en"
"83","75311","18","X","X","Type X - Boilerplate question","","This is the boilerplate question type. It's not so much a question but a simple text display.","N","Y","0","0","en"
"78","75311","16","H","H","Type H - Array Flexible Labels by Column question","","This is the same question type as before just the orientation has changed","N","N","0","5","en"
"77","75311","16","F","F","Type F - Array using Flexible Labels question","","This is a array using a flexible label set. Flexible labels sets can be created with as many answer as you like to. We created only one for this survey that will be re-used over and over.","N","N","0","4","en"
"86","75311","18","R","R","Type R - Ranking Question","","","N","N","0","3","en"
"75","75311","16","C","C","Type C - Array Yes/No/Uncertain Question","","","N","N","0","2","en"
"73","75311","16","A","A","Type A - Array 5 Point Choice Question","","","N","N","0","0","en"
"74","75311","16","B","B","Type B - Array 10 point choice Question","","This is the help text for this question. ","N","N","0","1","en"

#
# ANSWERS TABLE
#
"qid","code","answer","default_value","sortorder","language"
"1","A1","FBI","N","0","en"
"1","A2","CIA","N","1","en"
"1","A3","G5","N","2","en"
"1","A4","NASA","N","3","en"
"2","B1","Darth Vader","N","0","en"
"2","B2","Luke Skywalker","N","1","en"
"2","B3","Princess Leia","N","2","en"
"2","B4","Jabba the Hut","N","3","en"
"3","C1","I am blonde","N","0","en"
"3","C2","I am blue","N","1","en"
"3","C3","I am pissed","N","2","en"
"3","C4","I am drunk","N","3","en"
"4","E1","Pain","N","0","en"
"4","E2","Pleasure","N","1","en"
"4","E3","Luck","N","2","en"
"4","E4","Happiness","N","3","en"
"5","F1","Deannan Troi","N","0","en"
"5","F2","Wesley Crusher","N","1","en"
"5","F3","Jean-Luc Picard","N","2","en"
"5","F4","Seven of Nine","N","3","en"
"6","H1","Deannan Troi","N","0","en"
"6","H2","Wesley Crusher","N","1","en"
"6","H3","Data","N","2","en"
"6","H4","Jean-Luc Picard","N","3","en"
"7","Q1","blue","N","0","en"
"7","Q2","red","N","1","en"
"7","Q3","green","N","2","en"
"14","R1","Red","N","0","en"
"14","R2","Green","N","1","en"
"14","R3","Blue","N","2","en"
"19","O1","Red","N","0","en"
"19","O2","Green","N","1","en"
"19","O3","Blue","N","2","en"
"20","L1"," Green","N","0","en"
"20","L2","Red","N","1","en"
"20","L3","Blue","N","2","en"
"22","EC1","Green","N","0","en"
"22","EC2","Red","N","1","en"
"22","EC3","Blue","N","2","en"
"23","P1","I am glad","N","0","en"
"23","P2","I don't care","N","1","en"
"23","P3","I am unhappy","N","2","en"
"24","M1","Yes","N","0","en"
"24","M2","No","N","1","en"
"24","M3","Maybe","N","2","en"
"94","EC1","Green","N","0","en"
"94","EC2","Red","N","1","en"
"94","EC3","Blue","N","2","en"
"95","P1","I am glad","N","0","en"
"95","P2","I don't care","N","1","en"
"95","P3","I am unhappy","N","2","en"
"96","M1","Yes","N","0","en"
"96","M2","No","N","1","en"
"96","M3","Maybe","N","2","en"
"76","E1","Pain","N","0","en"
"76","E2","Pleasure","N","1","en"
"76","E3","Luck","N","2","en"
"76","E4","Happiness","N","3","en"
"91","O1","Red","N","0","en"
"91","O2","Green","N","1","en"
"91","O3","Blue","N","2","en"
"92","L1"," Green","N","0","en"
"92","L2","Red","N","1","en"
"92","L3","Blue","N","2","en"
"79","Q1","blue","N","0","en"
"79","Q2","red","N","1","en"
"79","Q3","green","N","2","en"
"78","H1","Deannan Troi","N","0","en"
"78","H2","Wesley Crusher","N","1","en"
"78","H3","Data","N","2","en"
"78","H4","Jean-Luc Picard","N","3","en"
"77","F1","Deannan Troi","N","0","en"
"77","F2","Wesley Crusher","N","1","en"
"77","F3","Jean-Luc Picard","N","2","en"
"77","F4","Seven of Nine","N","3","en"
"86","R1","Red","N","0","en"
"86","R2","Green","N","1","en"
"86","R3","Blue","N","2","en"
"75","C1","I am blonde","N","0","en"
"75","C2","I am blue","N","1","en"
"75","C3","I am pissed","N","2","en"
"75","C4","I am drunk","N","3","en"
"73","A1","FBI","N","0","en"
"73","A2","CIA","N","1","en"
"73","A3","G5","N","2","en"
"73","A4","NASA","N","3","en"
"74","B1","Darth Vader","N","0","en"
"74","B2","Luke Skywalker","N","1","en"
"74","B3","Princess Leia","N","2","en"
"74","B4","Jabba the Hut","N","3","en"

#
# CONDITIONS TABLE
Expand Down Expand Up @@ -130,57 +130,5 @@
# SURVEYS_LANGUAGESETTINGS TABLE
#
"surveyls_survey_id","surveyls_language","surveyls_title","surveyls_description","surveyls_welcometext","surveyls_urldescription","surveyls_email_invite_subj","surveyls_email_invite","surveyls_email_remind_subj","surveyls_email_remind","surveyls_email_register_subj","surveyls_email_register","surveyls_email_confirm_subj","surveyls_email_confirm"
"40","en","Sample Survey","This is a sample survey showing of all the question types you can use in PHPSurveyor.","This is the welcome text for the survey!r<br />You can can edit it in the survey properties.","","Invitation to participate in survey","Dear {FIRSTNAME},

You have been invited to participate in a survey.

The survey is titled:
&quot;{SURVEYNAME}&quot;

&quot;{SURVEYDESCRIPTION}&quot;

To participate, please click on the link below.

Sincerely,

{ADMINNAME} ({ADMINEMAIL})

----------------------------------------------
Click here to do the survey:
{SURVEYURL}","Reminder to participate in survey","Dear {FIRSTNAME},

Recently we invited you to participate in a survey.

We note that you have not yet completed the survey, and wish to remind you that the survey is still available should you wish to take part.

The survey is titled:
&quot;{SURVEYNAME}&quot;

&quot;{SURVEYDESCRIPTION}&quot;

To participate, please click on the link below.

Sincerely,

{ADMINNAME} ({ADMINEMAIL})

----------------------------------------------
Click here to do the survey:
{SURVEYURL}","Survey Registration Confirmation","Dear {FIRSTNAME},

You, or someone using your email address, have registered to participate in an online survey titled {SURVEYNAME}.

To complete this survey, click on the following URL:

{SURVEYURL}

If you have any questions about this survey, or if you did not register to participate and believe this email is in error, please contact {ADMINNAME} at {ADMINEMAIL}.","Confirmation of completed survey","Dear {FIRSTNAME},

This email is to confirm that you have completed the survey titled {SURVEYNAME} and your response has been saved. Thank you for participating.

If you have any further questions about this email, please contact {ADMINNAME} on {ADMINEMAIL}.

Sincerely,

{ADMINNAME}"
"75311","en","Sample Survey","This is a sample survey showing of all the question types you can use in PHPSurveyor.","This is the welcome text for the survey!\n<br />You can can edit it in the survey properties.","","Invitation to participate in survey","Dear {FIRSTNAME},\n\nYou have been invited to participate in a survey.\n\nThe survey is titled:\n&quot;{SURVEYNAME}&quot;\n\n&quot;{SURVEYDESCRIPTION}&quot;\n\nTo participate, please click on the link below.\n\nSincerely,\n\n{ADMINNAME} ({ADMINEMAIL})\n\n----------------------------------------------\nClick here to do the survey:\n{SURVEYURL}","Reminder to participate in survey","Dear {FIRSTNAME},\n\nRecently we invited you to participate in a survey.\n\nWe note that you have not yet completed the survey, and wish to remind you that the survey is still available should you wish to take part.\n\nThe survey is titled:\n&quot;{SURVEYNAME}&quot;\n\n&quot;{SURVEYDESCRIPTION}&quot;\n\nTo participate, please click on the link below.\n\nSincerely,\n\n{ADMINNAME} ({ADMINEMAIL})\n\n----------------------------------------------\nClick here to do the survey:\n{SURVEYURL}","Survey Registration Confirmation","Dear {FIRSTNAME},\n\nYou, or someone using your email address, have registered to participate in an online survey titled {SURVEYNAME}.\n\nTo complete this survey, click on the following URL:\n\n{SURVEYURL}\n\nIf you have any questions about this survey, or if you did not register to participate and believe this email is in error, please contact {ADMINNAME} at {ADMINEMAIL}.","Confirmation of completed survey","Dear {FIRSTNAME},\n\nThis email is to confirm that you have completed the survey titled {SURVEYNAME} and your response has been saved. Thank you for participating.\n\nIf you have any further questions about this email, please contact {ADMINNAME} on {ADMINEMAIL}.\n\nSincerely,\n\n{ADMINNAME}"

Loading

0 comments on commit 69a1c34

Please sign in to comment.