diff --git a/admin/quotarow.php b/admin/quotarow.php index 7da99056..6d04510d 100755 --- a/admin/quotarow.php +++ b/admin/quotarow.php @@ -274,14 +274,19 @@ if ($questionnaire_id != false) print "

" . T_("Enter the details for creating the row quota:") . "

"; print "

" . T_("Pre defined values for this question:") . "

"; - $qid = explode("X", $sgqa); - $qid = $qid[2]; - - $sql = "SELECT l.code,l.answer as title - FROM `" . LIME_PREFIX . "answers` as l - WHERE l.qid = '$qid'"; - - $rs = $db->GetAll($sql); + $rs = ""; + + if ($sgqa != -2 && $sgqa != -1 && !empty($sgqa)) + { + $qid = explode("X", $sgqa); + $qid = $qid[2]; + + $sql = "SELECT l.code,l.answer as title + FROM `" . LIME_PREFIX . "answers` as l + WHERE l.qid = '$qid'"; + + $rs = $db->GetAll($sql); + } if (!isset($rs) || empty($rs)) print "

" . T_("No labels defined for this question") ."

"; diff --git a/appointmentlist.php b/appointmentlist.php index 9249886d..9a353039 100644 --- a/appointmentlist.php +++ b/appointmentlist.php @@ -53,7 +53,7 @@ $js = false; if (AUTO_LOGOUT_MINUTES !== false) $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Appointment List"),true,array("css/table.css"),$js,false,15); +xhtml_head(T_("Appointment List"),true,array("css/table.css"),$js,false,60); //List the case appointment // display in respondent time so that the operator will be able to diff --git a/callhistory.php b/callhistory.php index 0c4b08e2..b39f30cf 100644 --- a/callhistory.php +++ b/callhistory.php @@ -53,7 +53,7 @@ $js = false; if (AUTO_LOGOUT_MINUTES !== false) $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Case History List"),true,array("css/table.css"),$js,false,15); +xhtml_head(T_("Case History List"),true,array("css/table.css"),$js,false,60); //List the case call history // display in respondent time so that the operator will be able to diff --git a/calllist.php b/calllist.php index 81c7e119..6b9158e9 100644 --- a/calllist.php +++ b/calllist.php @@ -53,7 +53,7 @@ $js = false; if (AUTO_LOGOUT_MINUTES !== false) $js = array("include/jquery-ui/js/jquery-1.4.2.min.js","js/childnap.js"); -xhtml_head(T_("Call List"),true,array("css/table.css"),$js,false,15); +xhtml_head(T_("Call List"),true,array("css/table.css"),$js,false,60); //List the case call history // display in respondent time so that the operator will be able to diff --git a/config.default.php b/config.default.php index 7ac71363..14f6d13c 100644 --- a/config.default.php +++ b/config.default.php @@ -161,7 +161,7 @@ if (!defined('PHP_EXEC')) define('PHP_EXEC', "php"); /** * Path to ADODB */ -if (!defined('ADODB_PATH')) define('ADODB_PATH',dirname(__FILE__).'/../adodb/'); +if (!defined('ADODB_PATH')) define('ADODB_PATH',dirname(__FILE__).'/include/limesurvey/classes/adodb/'); /** * Path to the HTPASSWD file read/writable by the web server user for htpasswd integration diff --git a/config.inc.local.php.example b/config.inc.local.php.example index 1bdb5b7b..ab524fcd 100644 --- a/config.inc.local.php.example +++ b/config.inc.local.php.example @@ -63,11 +63,6 @@ define('AUTO_POPUP',false); */ define('QUEXS_PATH', '/quexs/'); -/** - * Path to ADODB - */ -define('ADODB_PATH',dirname(__FILE__).'/../adodb/'); - /** * Database configuration for queXS */ diff --git a/database/quexs.sql b/database/quexs.sql index bf42a939..6ec54504 100644 --- a/database/quexs.sql +++ b/database/quexs.sql @@ -3,9 +3,9 @@ -- http://www.phpmyadmin.net -- -- Host: localhost --- Generation Time: Sep 07, 2011 at 02:42 PM +-- Generation Time: Nov 16, 2012 at 12:35 PM -- Server version: 5.0.51 --- PHP Version: 5.2.6-1+lenny13 +-- PHP Version: 5.2.6-1+lenny16 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; @@ -18,7 +18,6 @@ SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `quexs` -- - -- -------------------------------------------------------- -- @@ -472,6 +471,31 @@ CREATE TABLE `lime_defaultvalues` ( -- +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_expression_errors` +-- + +CREATE TABLE `lime_expression_errors` ( + `id` int(9) NOT NULL auto_increment, + `errortime` varchar(50) collate utf8_unicode_ci default NULL, + `sid` int(11) default NULL, + `gid` int(11) default NULL, + `qid` int(11) default NULL, + `gseq` int(11) default NULL, + `qseq` int(11) default NULL, + `type` varchar(50) collate utf8_unicode_ci default NULL, + `eqn` text collate utf8_unicode_ci, + `prettyprint` text collate utf8_unicode_ci, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_expression_errors` +-- + + -- -------------------------------------------------------- -- @@ -504,6 +528,8 @@ CREATE TABLE `lime_groups` ( `group_order` int(11) NOT NULL default '0', `description` text collate utf8_unicode_ci, `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', + `randomization_group` varchar(20) collate utf8_unicode_ci NOT NULL default '', + `grelevance` text collate utf8_unicode_ci, PRIMARY KEY (`gid`,`language`), KEY `groups_idx2` (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -553,6 +579,119 @@ CREATE TABLE `lime_labelsets` ( -- +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participants` +-- + +CREATE TABLE `lime_participants` ( + `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `firstname` varchar(40) collate utf8_unicode_ci default NULL, + `lastname` varchar(40) collate utf8_unicode_ci default NULL, + `email` varchar(80) collate utf8_unicode_ci default NULL, + `language` varchar(40) collate utf8_unicode_ci default NULL, + `blacklisted` varchar(1) collate utf8_unicode_ci NOT NULL, + `owner_uid` int(20) NOT NULL, + PRIMARY KEY (`participant_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participants` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participant_attribute` +-- + +CREATE TABLE `lime_participant_attribute` ( + `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `attribute_id` int(11) NOT NULL, + `value` varchar(50) collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`participant_id`,`attribute_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participant_attribute` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participant_attribute_names` +-- + +CREATE TABLE `lime_participant_attribute_names` ( + `attribute_id` int(11) NOT NULL auto_increment, + `attribute_type` varchar(4) collate utf8_unicode_ci NOT NULL, + `visible` char(5) collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`attribute_id`,`attribute_type`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participant_attribute_names` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participant_attribute_names_lang` +-- + +CREATE TABLE `lime_participant_attribute_names_lang` ( + `attribute_id` int(11) NOT NULL, + `attribute_name` varchar(30) collate utf8_unicode_ci NOT NULL, + `lang` varchar(20) collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`attribute_id`,`lang`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participant_attribute_names_lang` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participant_attribute_values` +-- + +CREATE TABLE `lime_participant_attribute_values` ( + `value_id` int(11) NOT NULL auto_increment, + `attribute_id` int(11) NOT NULL, + `value` varchar(20) collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`value_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participant_attribute_values` +-- + + +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_participant_shares` +-- + +CREATE TABLE `lime_participant_shares` ( + `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `share_uid` int(11) NOT NULL, + `date_added` datetime NOT NULL, + `can_edit` varchar(5) collate utf8_unicode_ci NOT NULL, + PRIMARY KEY (`participant_id`,`share_uid`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_participant_shares` +-- + + -- -------------------------------------------------------- -- @@ -575,6 +714,7 @@ CREATE TABLE `lime_questions` ( `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en', `scale_id` tinyint(4) NOT NULL default '0', `same_default` tinyint(4) NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog', + `relevance` text collate utf8_unicode_ci, PRIMARY KEY (`qid`,`language`), KEY `questions_idx2` (`sid`), KEY `questions_idx3` (`gid`), @@ -598,8 +738,10 @@ CREATE TABLE `lime_question_attributes` ( `qid` int(11) NOT NULL default '0', `attribute` varchar(50) collate utf8_unicode_ci default NULL, `value` text collate utf8_unicode_ci, + `language` varchar(20) collate utf8_unicode_ci default NULL, PRIMARY KEY (`qaid`), - KEY `question_attributes_idx2` (`qid`) + KEY `question_attributes_idx2` (`qid`), + KEY `question_attributes_idx3` (`attribute`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; -- @@ -741,14 +883,9 @@ CREATE TABLE `lime_settings_global` ( -- Dumping data for table `lime_settings_global` -- -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('DBVersion', '146'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('force_ssl', ''); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('SessionName', 'ls28629164789259281352'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showgroupinfo', 'choose'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showqnumcode', 'choose'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('showXquestions', 'choose'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('updateavailable', '0'); -INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES('updatelastcheck', '2011-09-07 14:38:57'); +INSERT INTO `lime_settings_global` (`stg_name`, `stg_value`) VALUES +('DBVersion', '155.6'), +('SessionName', 'ls28629164789259281352'); -- -------------------------------------------------------- @@ -795,7 +932,7 @@ CREATE TABLE `lime_surveys` ( `emailresponseto` text collate utf8_unicode_ci, `emailnotificationto` text collate utf8_unicode_ci, `tokenlength` tinyint(2) default '15', - `showXquestions` char(1) collate utf8_unicode_ci default 'Y', + `showxquestions` char(1) collate utf8_unicode_ci default 'Y', `showgroupinfo` char(1) collate utf8_unicode_ci default 'B', `shownoanswer` char(1) collate utf8_unicode_ci default 'Y', `showqnumcode` char(1) collate utf8_unicode_ci default 'X', @@ -812,6 +949,8 @@ CREATE TABLE `lime_surveys` ( `navigationdelay` tinyint(2) default '0', `nokeyboard` char(1) collate utf8_unicode_ci default 'N', `alloweditaftercompletion` char(1) collate utf8_unicode_ci default 'N', + `googleanalyticsstyle` char(1) collate utf8_unicode_ci default NULL, + `googleanalyticsapikey` varchar(25) collate utf8_unicode_ci default NULL, PRIMARY KEY (`sid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -827,7 +966,7 @@ CREATE TABLE `lime_surveys` ( -- CREATE TABLE `lime_surveys_languagesettings` ( - `surveyls_survey_id` int(10) unsigned NOT NULL default '0', + `surveyls_survey_id` int(11) NOT NULL default '0', `surveyls_language` varchar(45) collate utf8_unicode_ci NOT NULL default 'en', `surveyls_title` varchar(200) collate utf8_unicode_ci NOT NULL, `surveyls_description` text collate utf8_unicode_ci, @@ -844,11 +983,11 @@ CREATE TABLE `lime_surveys_languagesettings` ( `surveyls_email_confirm_subj` varchar(255) collate utf8_unicode_ci default NULL, `surveyls_email_confirm` text collate utf8_unicode_ci, `surveyls_dateformat` int(10) unsigned NOT NULL default '1', - `surveyls_numberformat` int(11) NOT NULL default '0', `email_admin_notification_subj` varchar(255) collate utf8_unicode_ci default NULL, `email_admin_notification` text collate utf8_unicode_ci, `email_admin_responses_subj` varchar(255) collate utf8_unicode_ci default NULL, `email_admin_responses` text collate utf8_unicode_ci, + `surveyls_numberformat` int(11) NOT NULL default '0', PRIMARY KEY (`surveyls_survey_id`,`surveyls_language`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -857,6 +996,25 @@ CREATE TABLE `lime_surveys_languagesettings` ( -- +-- -------------------------------------------------------- + +-- +-- Table structure for table `lime_survey_links` +-- + +CREATE TABLE `lime_survey_links` ( + `participant_id` varchar(50) collate utf8_unicode_ci NOT NULL, + `token_id` int(11) NOT NULL, + `survey_id` int(11) NOT NULL, + `date_created` datetime NOT NULL, + PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; + +-- +-- Dumping data for table `lime_survey_links` +-- + + -- -------------------------------------------------------- -- @@ -864,8 +1022,8 @@ CREATE TABLE `lime_surveys_languagesettings` ( -- CREATE TABLE `lime_survey_permissions` ( - `sid` int(10) unsigned NOT NULL, - `uid` int(10) unsigned NOT NULL, + `sid` int(11) NOT NULL, + `uid` int(11) NOT NULL, `permission` varchar(20) collate utf8_unicode_ci NOT NULL, `create_p` tinyint(1) NOT NULL default '0', `read_p` tinyint(1) NOT NULL default '0', @@ -927,19 +1085,22 @@ CREATE TABLE `lime_users` ( `users_name` varchar(64) collate utf8_unicode_ci NOT NULL default '', `password` blob NOT NULL, `full_name` varchar(50) collate utf8_unicode_ci NOT NULL, - `parent_id` int(10) unsigned NOT NULL, + `parent_id` int(11) NOT NULL, `lang` varchar(20) collate utf8_unicode_ci default NULL, `email` varchar(320) collate utf8_unicode_ci default NULL, `create_survey` tinyint(1) NOT NULL default '0', `create_user` tinyint(1) NOT NULL default '0', + `participant_panel` tinyint(1) NOT NULL default '0', `delete_user` tinyint(1) NOT NULL default '0', `superadmin` tinyint(1) NOT NULL default '0', `configurator` tinyint(1) NOT NULL default '0', `manage_template` tinyint(1) NOT NULL default '0', `manage_label` tinyint(1) NOT NULL default '0', `htmleditormode` varchar(7) collate utf8_unicode_ci default 'default', + `templateeditormode` varchar(7) collate utf8_unicode_ci default 'default', + `questionselectormode` varchar(7) collate utf8_unicode_ci default 'default', `one_time_pw` blob, - `dateformat` int(10) unsigned NOT NULL default '1', + `dateformat` int(11) NOT NULL default '1', PRIMARY KEY (`uid`), UNIQUE KEY `users_name` (`users_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -948,7 +1109,8 @@ CREATE TABLE `lime_users` ( -- Dumping data for table `lime_users` -- -INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `one_time_pw`, `dateformat`) VALUES(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your@email.org', 1, 1, 1, 1, 1, 1, 1, 'default', NULL, 1); +INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_id`, `lang`, `email`, `create_survey`, `create_user`, `participant_panel`, `delete_user`, `superadmin`, `configurator`, `manage_template`, `manage_label`, `htmleditormode`, `templateeditormode`, `questionselectormode`, `one_time_pw`, `dateformat`) VALUES +(1, 'admin', 0x35653838343839386461323830343731353164306535366638646336323932373733363033643064366161626264643632613131656637323164313534326438, 'Your Name', 0, 'en', 'your-email@example.net', 1, 1, 0, 1, 1, 1, 1, 1, 'default', 'default', 'default', NULL, 1); -- -------------------------------------------------------- @@ -957,10 +1119,10 @@ INSERT INTO `lime_users` (`uid`, `users_name`, `password`, `full_name`, `parent_ -- CREATE TABLE `lime_user_groups` ( - `ugid` int(10) unsigned NOT NULL auto_increment, + `ugid` int(11) NOT NULL auto_increment, `name` varchar(20) collate utf8_unicode_ci NOT NULL, `description` text collate utf8_unicode_ci NOT NULL, - `owner_id` int(10) unsigned NOT NULL, + `owner_id` int(11) NOT NULL, PRIMARY KEY (`ugid`), UNIQUE KEY `name` (`name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; @@ -977,8 +1139,8 @@ CREATE TABLE `lime_user_groups` ( -- CREATE TABLE `lime_user_in_groups` ( - `ugid` int(10) unsigned NOT NULL, - `uid` int(10) unsigned NOT NULL, + `ugid` int(11) NOT NULL, + `uid` int(11) NOT NULL, PRIMARY KEY (`ugid`,`uid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; diff --git a/include/limesurvey/.gitignore b/include/limesurvey/.gitignore new file mode 100644 index 00000000..8a57a94c --- /dev/null +++ b/include/limesurvey/.gitignore @@ -0,0 +1,2 @@ + +/upload/surveys/* diff --git a/include/limesurvey/admin/access_denied.php b/include/limesurvey/admin/access_denied.php index 1b054925..2b064cfb 100644 --- a/include/limesurvey/admin/access_denied.php +++ b/include/limesurvey/admin/access_denied.php @@ -10,15 +10,15 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: access_denied.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: access_denied.php 11607 2011-12-06 23:19:52Z tmswhite $ */ -if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {die("Cannot run this script directly (access_denied)");} +include_once("login_check.php"); //Login Check dies also if the script is started directly if (isset($_SESSION['loginID'])) { - + include('html.php'); // For showadminmenu $accesssummary = "

".$clang->gT("Access denied!")."
\n"; $action=returnglobal('action'); diff --git a/include/limesurvey/admin/activate.php b/include/limesurvey/admin/activate.php index 85c87ed8..bdd48c15 100644 --- a/include/limesurvey/admin/activate.php +++ b/include/limesurvey/admin/activate.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: activate.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: activate.php 11607 2011-12-06 23:19:52Z tmswhite $ */ @@ -88,3 +88,4 @@ else include('tokens.php'); } } + diff --git a/include/limesurvey/admin/activate_functions.php b/include/limesurvey/admin/activate_functions.php index 1038dea4..2d5bcfc1 100644 --- a/include/limesurvey/admin/activate_functions.php +++ b/include/limesurvey/admin/activate_functions.php @@ -1,530 +1,549 @@ - $fixnumbering - */ -function fixNumbering($fixnumbering) -{ - - global $dbprefix, $connect, $clang; - //Fix a question id - requires renumbering a question - $oldqid = $fixnumbering; - $query = "SELECT qid FROM {$dbprefix}questions ORDER BY qid DESC"; - $result = db_select_limit_assoc($query, 1) or safe_die($query."
".$connect->ErrorMsg()); - while ($row=$result->FetchRow()) {$lastqid=$row['qid'];} - $newqid=$lastqid+1; - $query = "UPDATE {$dbprefix}questions SET qid=$newqid WHERE qid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); - // Update subquestions - $query = "UPDATE {$dbprefix}questions SET parent_qid=$newqid WHERE parent_qid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); - //Update conditions.. firstly conditions FOR this question - $query = "UPDATE {$dbprefix}conditions SET qid=$newqid WHERE qid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); - //Now conditions based upon this question - $query = "SELECT cqid, cfieldname FROM {$dbprefix}conditions WHERE cqid=$oldqid"; - $result = db_execute_assoc($query) or safe_die($query."
".$connect->ErrorMsg()); - while ($row=$result->FetchRow()) - { - $switcher[]=array("cqid"=>$row['cqid'], "cfieldname"=>$row['cfieldname']); - } - if (isset($switcher)) - { - foreach ($switcher as $switch) - { - $query = "UPDATE {$dbprefix}conditions - SET cqid=$newqid, - cfieldname='".str_replace("X".$oldqid, "X".$newqid, $switch['cfieldname'])."' - WHERE cqid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); - } - } - //Now question_attributes - $query = "UPDATE {$dbprefix}question_attributes SET qid=$newqid WHERE qid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); - //Now answers - $query = "UPDATE {$dbprefix}answers SET qid=$newqid WHERE qid=$oldqid"; - $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); -} -/** - * checks consistency of groups - * @global $dbprefix - * @global $connect - * @global $clang - * @return - */ -function checkGroup($postsid) -{ - global $dbprefix, $connect, $clang; - - $baselang = GetBaseLanguageFromSurveyID($postsid); - $groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid AND g.language=q.language WHERE g.sid=$postsid AND g.language='$baselang' group by g.gid,g.group_name;"; - $groupresult=db_execute_assoc($groupquery) or safe_die($groupquery."
".$connect->ErrorMsg()); - while ($row=$groupresult->FetchRow()) - { //TIBO - if ($row['count'] == 0) - { - $failedgroupcheck[]=array($row['gid'], $row['group_name'], ": ".$clang->gT("This group does not contain any question(s).")); - } - } - if(isset($failedgroupcheck)) - return $failedgroupcheck; - else - return false; - -} -/** - * checks questions in a survey for consistency - * @global $dbprefix - * @global $connect - * @global $clang - * @param $postsid - * @param $surveyid - * @return array $faildcheck - */ -function checkQuestions($postsid, $surveyid, $qtypes) -{ - global $dbprefix, $connect, $clang; - - - //CHECK TO MAKE SURE ALL QUESTION TYPES THAT REQUIRE ANSWERS HAVE ACTUALLY GOT ANSWERS - //THESE QUESTION TYPES ARE: - // # "L" -> LIST - // # "O" -> LIST WITH COMMENT - // # "M" -> Multiple choice - // # "P" -> Multiple choice with comments - // # "A", "B", "C", "E", "F", "H", "^" -> Various Array Types - // # "R" -> RANKING - // # "U" -> FILE CSV MORE - // # "I" -> LANGUAGE SWITCH - // # ":" -> Array Multi Flexi Numbers - // # ";" -> Array Multi Flexi Text - // # "1" -> MULTI SCALE - - $chkquery = "SELECT qid, question, gid, type FROM {$dbprefix}questions WHERE sid={$surveyid} and parent_qid=0"; - $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't get list of questions
$chkquery
".$connect->ErrorMsg()); - while ($chkrow = $chkresult->FetchRow()) - { - if ($qtypes[$chkrow['type']]['subquestions']>0) - { - $chaquery = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$chkrow['qid']} ORDER BY question_order"; - $charesult=$connect->Execute($chaquery); - $chacount=$charesult->RecordCount(); - if ($chacount == 0) - { - $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question is a subquestion type question but has no configured subquestions."), $chkrow['gid']); - } - } - if ($qtypes[$chkrow['type']]['answerscales']>0) - { - $chaquery = "SELECT * FROM {$dbprefix}answers WHERE qid = {$chkrow['qid']} ORDER BY sortorder, answer"; - $charesult=$connect->Execute($chaquery); - $chacount=$charesult->RecordCount(); - if ($chacount == 0) - { - $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question is a multiple answer type question but has no answers."), $chkrow['gid']); - } - } - } - - //NOW CHECK THAT ALL QUESTIONS HAVE A 'QUESTION TYPE' FIELD SET - $chkquery = "SELECT qid, question, gid FROM {$dbprefix}questions WHERE sid={$_GET['sid']} AND type = ''"; - $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing types
$chkquery
".$connect->ErrorMsg()); - while ($chkrow = $chkresult->FetchRow()) - { - $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question does not have a question 'type' set."), $chkrow['gid']); - } - - - - - //ChECK THAT certain array question types have answers set - $chkquery = "SELECT q.qid, question, gid FROM {$dbprefix}questions as q WHERE (select count(*) from {$dbprefix}answers as a where a.qid=q.qid and scale_id=0)=0 and sid={$_GET['sid']} AND type IN ('F', 'H', 'W', 'Z', '1') and q.parent_qid=0"; - $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing answers
$chkquery
".$connect->ErrorMsg()); - while($chkrow = $chkresult->FetchRow()){ - $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question requires answers, but none are set."), $chkrow['gid']); - } // while - - //CHECK THAT DUAL Array has answers set - $chkquery = "SELECT q.qid, question, gid FROM {$dbprefix}questions as q WHERE (select count(*) from {$dbprefix}answers as a where a.qid=q.qid and scale_id=1)=0 and sid={$_GET['sid']} AND type='1' and q.parent_qid=0"; - $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing 2nd answer set
$chkquery
".$connect->ErrorMsg()); - while($chkrow = $chkresult->FetchRow()){ - $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question requires a second answer set but none is set."), $chkrow['gid']); - } // while - - - //CHECK THAT ALL CONDITIONS SET ARE FOR QUESTIONS THAT PRECEED THE QUESTION CONDITION - //A: Make an array of all the qids in order of appearance - // $qorderquery="SELECT * FROM {$dbprefix}questions, {$dbprefix}groups WHERE {$dbprefix}questions.gid={$dbprefix}groups.gid AND {$dbprefix}questions.sid={$_GET['sid']} ORDER BY {$dbprefix}groups.sortorder, {$dbprefix}questions.title"; - // $qorderresult=$connect->Execute($qorderquery) or safe_die("Couldn't generate a list of questions in order
$qorderquery
".$connect->ErrorMsg()); - // $qordercount=$qorderresult->RecordCount(); - // $c=0; - // while ($qorderrow=$qorderresult->FetchRow()) - // { - // $qidorder[]=array($c, $qorderrow['qid']); - // $c++; - // } - //TO AVOID NATURAL SORT ORDER ISSUES, FIRST GET ALL QUESTIONS IN NATURAL SORT ORDER, AND FIND OUT WHICH NUMBER IN THAT ORDER THIS QUESTION IS - $qorderquery = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND type not in ('S', 'D', 'T', 'Q')"; - $qorderresult = db_execute_assoc($qorderquery) or safe_die ("$qorderquery
".$connect->ErrorMsg()); - $qrows = array(); //Create an empty array in case FetchRow does not return any rows - while ($qrow = $qorderresult->FetchRow()) {$qrows[] = $qrow;} // Get table output into array - usort($qrows, 'GroupOrderThenQuestionOrder'); // Perform a case insensitive natural sort on group name then question title of a multidimensional array - $c=0; - foreach ($qrows as $qr) - { - $qidorder[]=array($c, $qrow['qid']); - $c++; - } - $qordercount=""; - //1: Get each condition's question id - $conquery= "SELECT {$dbprefix}conditions.qid, cqid, {$dbprefix}questions.question, " - . "{$dbprefix}questions.gid " - . "FROM {$dbprefix}conditions, {$dbprefix}questions, {$dbprefix}groups " - . "WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid " - . "AND {$dbprefix}questions.gid={$dbprefix}groups.gid ORDER BY {$dbprefix}conditions.qid"; - $conresult=db_execute_assoc($conquery) or safe_die("Couldn't check conditions for relative consistency
$conquery
".$connect->ErrorMsg()); - //2: Check each conditions cqid that it occurs later than the cqid - while ($conrow=$conresult->FetchRow()) - { - $cqidfound=0; - $qidfound=0; - $b=0; - while ($b<$qordercount) - { - if ($conrow['cqid'] == $qidorder[$b][1]) - { - $cqidfound = 1; - $b=$qordercount; - } - if ($conrow['qid'] == $qidorder[$b][1]) - { - $qidfound = 1; - $b=$qordercount; - } - if ($qidfound == 1) - { - $failedcheck[]=array($conrow['qid'], $conrow['question'], ": ".$clang->gT("This question has a condition set, however the condition is based on a question that appears after it."), $conrow['gid']); - } - $b++; - } - } - //CHECK THAT ALL THE CREATED FIELDS WILL BE UNIQUE - $fieldmap=createFieldMap($surveyid, "full"); - if (isset($fieldmap)) - { - foreach($fieldmap as $fielddata) - { - $fieldlist[]=$fielddata['fieldname']; - } - $fieldlist=array_reverse($fieldlist); //let's always change the later duplicate, not the earlier one - } - $checkKeysUniqueComparison = create_function('$value','if ($value > 1) return true;'); - @$duplicates = array_keys (array_filter (array_count_values($fieldlist), $checkKeysUniqueComparison)); - if (isset($duplicates)) - { - foreach ($duplicates as $dup) - { - $badquestion=arraySearchByKey($dup, $fieldmap, "fieldname", 1); - $fix = "[Click Here to Fix]"; - $failedcheck[]=array($badquestion['qid'], $badquestion['question'], ": Bad duplicate fieldname $fix", $badquestion['gid']); - } - } - if(isset($failedcheck)) - return $failedcheck; - else - return false; -} -/** - * Function to activate a survey - * @global $dbprefix $dbprefix - * @global $connect $connect - * @global $clang $clang - * @param int $postsid - * @param int $surveyid - * @return string - */ -function activateSurvey($postsid,$surveyid, $scriptname='admin.php') -{ - global $dbprefix, $connect, $clang, $databasetype,$databasetabletype, $uploaddir; - - $createsurvey=''; - $activateoutput=''; - $createsurveytimings=''; - $createsurveydirectory=false; - //Check for any additional fields for this survey and create necessary fields (token and datestamp) - $pquery = "SELECT anonymized, allowregister, datestamp, ipaddr, refurl, savetimings FROM {$dbprefix}surveys WHERE sid={$postsid}"; - $presult=db_execute_assoc($pquery); - $prow=$presult->FetchRow(); - if ($prow['allowregister'] == "Y") - { - $surveyallowsregistration="TRUE"; - } - if ($prow['savetimings'] == "Y") - { - $savetimings="TRUE"; - } - //strip trailing comma and new line feed (if any) - $createsurvey = rtrim($createsurvey, ",\n"); - //strip trailing comma and new line feed (if any) - $createsurvey = rtrim($createsurvey, ",\n"); - - //Get list of questions for the base language - $fieldmap=createFieldMap($surveyid); - foreach ($fieldmap as $arow) //With each question, create the appropriate field(s) - { - if ($createsurvey!='') {$createsurvey .= ",\n";} - $createsurvey .= ' `'.$arow['fieldname'].'`'; - switch($arow['type']) - { - case 'startlanguage': - $createsurvey .= " C(20) NOTNULL"; - break; - case 'id': - $createsurvey .= " I NOTNULL AUTO PRIMARY"; - $createsurveytimings .= " `{$arow['fieldname']}` I NOTNULL PRIMARY,\n"; - break; - case "startdate": - case "datestamp": - $createsurvey .= " T NOTNULL"; - break; - case "submitdate": - $createsurvey .= " T"; - break; - case "lastpage": - $createsurvey .= " I"; - break; - case "N": //NUMERICAL - $createsurvey .= " F"; - break; - case "S": //SHORT TEXT - if ($databasetype=='mysql' || $databasetype=='mysqli') {$createsurvey .= " X";} - else {$createsurvey .= " C(255)";} - break; - case "L": //LIST (RADIO) - case "!": //LIST (DROPDOWN) - case "M": //Multiple choice - case "P": //Multiple choice with comment - case "O": //DROPDOWN LIST WITH COMMENT - if ($arow['aid'] != 'other' && strpos($arow['aid'],'comment')===false && strpos($arow['aid'],'othercomment')===false) - { - $createsurvey .= " C(5)"; - } - else - { - $createsurvey .= " X"; - } - break; - case "K": // Multiple Numerical - $createsurvey .= " F"; - break; - case "U": //Huge text - case "Q": //Multiple short text - case "T": //LONG TEXT - case ";": //Multi Flexi - case ":": //Multi Flexi - $createsurvey .= " X"; - break; - case "D": //DATE - $createsurvey .= " D"; - break; - case "5": //5 Point Choice - case "G": //Gender - case "Y": //YesNo - case "X": //Boilerplate - $createsurvey .= " C(1)"; - break; - case "I": //Language switch - $createsurvey .= " C(20)"; - break; - case "|": - $createsurveydirectory = true; - if (strpos($arow['fieldname'], "_")) - $createsurvey .= " I1"; - else - $createsurvey .= " X"; - break; - case "ipaddress": - if ($prow['ipaddr'] == "Y") - $createsurvey .= " X"; - break; - case "url": - if ($prow['refurl'] == "Y") - $createsurvey .= " X"; - break; - case "token": - if ($prow['anonymized'] == "N") - { - $createsurvey .= " C(36)"; - } - break; - default: - $createsurvey .= " C(5)"; - } - } - $timingsfieldmap = createTimingsFieldMap($surveyid); - $createsurveytimings .= '`'.implode("` F DEFAULT '0',\n`",array_keys($timingsfieldmap)) . "` F DEFAULT '0'"; - - // If last question is of type MCABCEFHP^QKJR let's get rid of the ending coma in createsurvey - $createsurvey = rtrim($createsurvey, ",\n")."\n"; // Does nothing if not ending with a comma - - $tabname = "{$dbprefix}survey_{$postsid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) - - $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', - 'mysqli'=> 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); - $dict = NewDataDictionary($connect); - $sqlarray = $dict->CreateTableSQL($tabname, $createsurvey, $taboptarray); - - if (isset($savetimings) && $savetimings=="TRUE") - { - $tabnametimings = $tabname .'_timings'; - $sqlarraytimings = $dict->CreateTableSQL($tabnametimings, $createsurveytimings, $taboptarray); - } - - $execresult=$dict->ExecuteSQLArray($sqlarray,1); - if ($execresult==0 || $execresult==1) - { - $activateoutput .= "
\n

\n" . - "
".$clang->gT("Activate Survey")." ($surveyid)
\n" . - "
".$clang->gT("Survey could not be actived.")."
\n" . - "

" . - $clang->gT("Database error:")."\n " . $connect->ErrorMsg() . "\n" . - "

$createsurvey
\n - ".$clang->gT("Main Admin Screen")."\n
" ; - } - if ($execresult != 0 && $execresult !=1) - { - $anquery = "SELECT autonumber_start FROM {$dbprefix}surveys WHERE sid={$postsid}"; - if ($anresult=db_execute_assoc($anquery)) - { - //if there is an autonumber_start field, start auto numbering here - while($row=$anresult->FetchRow()) - { - if ($row['autonumber_start'] > 0) - { - if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $databasetype=='mssqlnative') { - mssql_drop_primary_index('survey_'.$postsid); - mssql_drop_constraint('id','survey_'.$postsid); - $autonumberquery = "alter table {$dbprefix}survey_{$postsid} drop column id "; - $connect->Execute($autonumberquery); - $autonumberquery = "alter table {$dbprefix}survey_{$postsid} add [id] int identity({$row['autonumber_start']},1)"; - $connect->Execute($autonumberquery); - } - else - { - $autonumberquery = "ALTER TABLE {$dbprefix}survey_{$postsid} AUTO_INCREMENT = ".$row['autonumber_start']; - $result = @$connect->Execute($autonumberquery); - - } - } - } - if (isset($savetimings) && $savetimings=="TRUE") - { - $dict->ExecuteSQLArray($sqlarraytimings,1); // create a timings table for this survey - } - } - - $activateoutput .= "
\n
\n"; - $activateoutput .= "
".$clang->gT("Activate Survey")." ($surveyid)
\n"; - $activateoutput .= "
".$clang->gT("Survey has been activated. Results table has been successfully created.")."


\n"; - - // create the survey directory where the uploaded files can be saved - if ($createsurveydirectory) - if (!file_exists($uploaddir."/surveys/" . $postsid . "/files")) - { - if (!(mkdir($uploaddir."/surveys/" . $postsid . "/files", 0777, true))) - { - $activateoutput .= "
". - $clang->gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the limesurvey/upload/surveys directory.") . "
"; - - } - else - { - file_put_contents($uploaddir."/surveys/" . $postsid . "/files/index.html",''); - } - } - - $acquery = "UPDATE {$dbprefix}surveys SET active='Y' WHERE sid=".$surveyid; - $acresult = $connect->Execute($acquery); - - if (isset($surveyallowsregistration) && $surveyallowsregistration == "TRUE") - { - $activateoutput .= $clang->gT("This survey allows public registration. A token table must also be created.")."

\n"; - $activateoutput .= "\n"; - } - else - { - $activateoutput .= $clang->gT("This survey is now active, and responses can be recorded.")."

\n"; -//queXS removal -// $activateoutput .= "".$clang->gT("Open-access mode").": ".$clang->gT("No invitation code is needed to complete the survey.")."
".$clang->gT("You can switch to the closed-access mode by initialising a token table with the button below.")."

\n"; - // $activateoutput .= "\n"; - // $activateoutput .= "\n"; - } - $activateoutput .= "

 \n"; - $lsrcOutput = true; - } - - if($scriptname=='lsrc') - { - if($lsrcOutput==true) - return true; - else - return $activateoutput; - } - else - { - return $activateoutput; - } -} - -function mssql_drop_constraint($fieldname, $tablename) -{ - global $dbprefix, $connect, $modifyoutput; - // find out the name of the default constraint - // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? - $dfquery ="SELECT c_obj.name AS constraint_name - FROM sys.sysobjects AS c_obj INNER JOIN - sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN - sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN - sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid - WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='{$dbprefix}{$tablename}')"; - $defaultname=$connect->GetRow($dfquery); - if ($defaultname!=false) - { - modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname[0]}"); echo $modifyoutput; flush(); - } -} - - -function mssql_drop_primary_index($tablename) -{ - global $dbprefix, $connect, $modifyoutput; - // find out the constraint name of the old primary key - $pkquery = "SELECT CONSTRAINT_NAME " - ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " - ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; - - $primarykey=$connect->GetOne($pkquery); - if ($primarykey!=false) - { - modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush(); - } -} + $fixnumbering +*/ +function fixNumbering($fixnumbering) +{ + + global $dbprefix, $connect, $clang, $surveyid; + + LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid); + //Fix a question id - requires renumbering a question + $oldqid = sanitize_int($fixnumbering); + $query = "SELECT qid FROM {$dbprefix}questions ORDER BY qid DESC"; + $result = db_select_limit_assoc($query, 1) or safe_die($query."
".$connect->ErrorMsg()); + while ($row=$result->FetchRow()) {$lastqid=$row['qid'];} + $newqid=$lastqid+1; + $query = "UPDATE {$dbprefix}questions SET qid=$newqid WHERE qid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + // Update subquestions + $query = "UPDATE {$dbprefix}questions SET parent_qid=$newqid WHERE parent_qid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + //Update conditions.. firstly conditions FOR this question + $query = "UPDATE {$dbprefix}conditions SET qid=$newqid WHERE qid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + //Now conditions based upon this question + $query = "SELECT cqid, cfieldname FROM {$dbprefix}conditions WHERE cqid=$oldqid"; + $result = db_execute_assoc($query) or safe_die($query."
".$connect->ErrorMsg()); + while ($row=$result->FetchRow()) + { + $switcher[]=array("cqid"=>$row['cqid'], "cfieldname"=>$row['cfieldname']); + } + if (isset($switcher)) + { + foreach ($switcher as $switch) + { + $query = "UPDATE {$dbprefix}conditions + SET cqid=$newqid, + cfieldname='".str_replace("X".$oldqid, "X".$newqid, $switch['cfieldname'])."' + WHERE cqid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + } + } + //Now question_attributes + $query = "UPDATE {$dbprefix}question_attributes SET qid=$newqid WHERE qid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + //Now answers + $query = "UPDATE {$dbprefix}answers SET qid=$newqid WHERE qid=$oldqid"; + $result = $connect->Execute($query) or safe_die($query."
".$connect->ErrorMsg()); + + LimeExpressionManager::UpgradeConditionsToRelevance($surveyid); +} +/** +* checks consistency of groups +* @global $dbprefix +* @global $connect +* @global $clang +* @return +*/ +function checkGroup($postsid) +{ + global $dbprefix, $connect, $clang; + + $baselang = GetBaseLanguageFromSurveyID($postsid); + $groupquery = "SELECT g.gid,g.group_name,count(q.qid) as count from {$dbprefix}questions as q RIGHT JOIN {$dbprefix}groups as g ON q.gid=g.gid AND g.language=q.language WHERE g.sid=$postsid AND g.language='$baselang' group by g.gid,g.group_name;"; + $groupresult=db_execute_assoc($groupquery) or safe_die($groupquery."
".$connect->ErrorMsg()); + while ($row=$groupresult->FetchRow()) + { //TIBO + if ($row['count'] == 0) + { + $failedgroupcheck[]=array($row['gid'], $row['group_name'], ": ".$clang->gT("This group does not contain any question(s).")); + } + } + if(isset($failedgroupcheck)) + return $failedgroupcheck; + else + return false; + +} +/** +* checks questions in a survey for consistency +* @global $dbprefix +* @global $connect +* @global $clang +* @param $postsid +* @param $surveyid +* @return array $faildcheck +*/ +function checkQuestions($postsid, $surveyid, $qtypes) +{ + global $dbprefix, $connect, $clang; + + + //CHECK TO MAKE SURE ALL QUESTION TYPES THAT REQUIRE ANSWERS HAVE ACTUALLY GOT ANSWERS + //THESE QUESTION TYPES ARE: + // # "L" -> LIST + // # "O" -> LIST WITH COMMENT + // # "M" -> Multiple choice + // # "P" -> Multiple choice with comments + // # "A", "B", "C", "E", "F", "H", "^" -> Various Array Types + // # "R" -> RANKING + // # "U" -> FILE CSV MORE + // # "I" -> LANGUAGE SWITCH + // # ":" -> Array Multi Flexi Numbers + // # ";" -> Array Multi Flexi Text + // # "1" -> MULTI SCALE + + $chkquery = "SELECT qid, question, gid, type FROM {$dbprefix}questions WHERE sid={$surveyid} and parent_qid=0"; + $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't get list of questions
$chkquery
".$connect->ErrorMsg()); + while ($chkrow = $chkresult->FetchRow()) + { + if ($qtypes[$chkrow['type']]['subquestions']>0) + { + $chaquery = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$chkrow['qid']} ORDER BY question_order"; + $charesult=$connect->Execute($chaquery); + $chacount=$charesult->RecordCount(); + if ($chacount == 0) + { + $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question is a subquestion type question but has no configured subquestions."), $chkrow['gid']); + } + } + if ($qtypes[$chkrow['type']]['answerscales']>0) + { + $chaquery = "SELECT * FROM {$dbprefix}answers WHERE qid = {$chkrow['qid']} ORDER BY sortorder, answer"; + $charesult=$connect->Execute($chaquery); + $chacount=$charesult->RecordCount(); + if ($chacount == 0) + { + $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question is a multiple answer type question but has no answers."), $chkrow['gid']); + } + } + } + + //NOW CHECK THAT ALL QUESTIONS HAVE A 'QUESTION TYPE' FIELD SET + $chkquery = "SELECT qid, question, gid FROM {$dbprefix}questions WHERE sid={$surveyid} AND type = ''"; + $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing types
$chkquery
".$connect->ErrorMsg()); + while ($chkrow = $chkresult->FetchRow()) + { + $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question does not have a question 'type' set."), $chkrow['gid']); + } + + + + + //ChECK THAT certain array question types have answers set + $chkquery = "SELECT q.qid, question, gid FROM {$dbprefix}questions as q WHERE (select count(*) from {$dbprefix}answers as a where a.qid=q.qid and scale_id=0)=0 and sid={$surveyid} AND type IN ('F', 'H', 'W', 'Z', '1') and q.parent_qid=0"; + $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing answers
$chkquery
".$connect->ErrorMsg()); + while($chkrow = $chkresult->FetchRow()){ + $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question requires answers, but none are set."), $chkrow['gid']); + } // while + + //CHECK THAT DUAL Array has answers set + $chkquery = "SELECT q.qid, question, gid FROM {$dbprefix}questions as q WHERE (select count(*) from {$dbprefix}answers as a where a.qid=q.qid and scale_id=1)=0 and sid={$surveyid} AND type='1' and q.parent_qid=0"; + $chkresult = db_execute_assoc($chkquery) or safe_die ("Couldn't check questions for missing 2nd answer set
$chkquery
".$connect->ErrorMsg()); + while($chkrow = $chkresult->FetchRow()){ + $failedcheck[]=array($chkrow['qid'], $chkrow['question'], ": ".$clang->gT("This question requires a second answer set but none is set."), $chkrow['gid']); + } // while + + + //CHECK THAT ALL CONDITIONS SET ARE FOR QUESTIONS THAT PRECEED THE QUESTION CONDITION + //A: Make an array of all the qids in order of appearance + // $qorderquery="SELECT * FROM {$dbprefix}questions, {$dbprefix}groups WHERE {$dbprefix}questions.gid={$dbprefix}groups.gid AND {$dbprefix}questions.sid={$surveyid} ORDER BY {$dbprefix}groups.sortorder, {$dbprefix}questions.title"; + // $qorderresult=$connect->Execute($qorderquery) or safe_die("Couldn't generate a list of questions in order
$qorderquery
".$connect->ErrorMsg()); + // $qordercount=$qorderresult->RecordCount(); + // $c=0; + // while ($qorderrow=$qorderresult->FetchRow()) + // { + // $qidorder[]=array($c, $qorderrow['qid']); + // $c++; + // } + //TO AVOID NATURAL SORT ORDER ISSUES, FIRST GET ALL QUESTIONS IN NATURAL SORT ORDER, AND FIND OUT WHICH NUMBER IN THAT ORDER THIS QUESTION IS + $qorderquery = "SELECT * FROM {$dbprefix}questions WHERE sid=$surveyid AND type not in ('S', 'D', 'T', 'Q')"; + $qorderresult = db_execute_assoc($qorderquery) or safe_die ("$qorderquery
".$connect->ErrorMsg()); + $qrows = array(); //Create an empty array in case FetchRow does not return any rows + while ($qrow = $qorderresult->FetchRow()) {$qrows[] = $qrow;} // Get table output into array + usort($qrows, 'GroupOrderThenQuestionOrder'); // Perform a case insensitive natural sort on group name then question title of a multidimensional array + $c=0; + foreach ($qrows as $qr) + { + $qidorder[]=array($c, $qrow['qid']); + $c++; + } + $qordercount=""; + //1: Get each condition's question id + $conquery= "SELECT {$dbprefix}conditions.qid, cqid, {$dbprefix}questions.question, " + . "{$dbprefix}questions.gid " + . "FROM {$dbprefix}conditions, {$dbprefix}questions, {$dbprefix}groups " + . "WHERE {$dbprefix}conditions.qid={$dbprefix}questions.qid " + . "AND {$dbprefix}questions.gid={$dbprefix}groups.gid ORDER BY {$dbprefix}conditions.qid"; + $conresult=db_execute_assoc($conquery) or safe_die("Couldn't check conditions for relative consistency
$conquery
".$connect->ErrorMsg()); + //2: Check each conditions cqid that it occurs later than the cqid + while ($conrow=$conresult->FetchRow()) + { + $cqidfound=0; + $qidfound=0; + $b=0; + while ($b<$qordercount) + { + if ($conrow['cqid'] == $qidorder[$b][1]) + { + $cqidfound = 1; + $b=$qordercount; + } + if ($conrow['qid'] == $qidorder[$b][1]) + { + $qidfound = 1; + $b=$qordercount; + } + if ($qidfound == 1) + { + $failedcheck[]=array($conrow['qid'], $conrow['question'], ": ".$clang->gT("This question has a condition set, however the condition is based on a question that appears after it."), $conrow['gid']); + } + $b++; + } + } + //CHECK THAT ALL THE CREATED FIELDS WILL BE UNIQUE + $fieldmap=createFieldMap($surveyid, 'full', true,false, GetBaseLanguageFromSurveyID($surveyid));// createFieldMap($surveyid, $styl, $force_refresh,$questionid, $sQuestionLanguage); + $clang = new limesurvey_lang($_SESSION['adminlang']); + if (isset($fieldmap)) + { + foreach($fieldmap as $fielddata) + { + $fieldlist[]=$fielddata['fieldname']; + } + $fieldlist=array_reverse($fieldlist); //let's always change the later duplicate, not the earlier one + } + $checkKeysUniqueComparison = create_function('$value','if ($value > 1) return true;'); + @$duplicates = array_keys (array_filter (array_count_values($fieldlist), $checkKeysUniqueComparison)); + if (isset($duplicates)) + { + foreach ($duplicates as $dup) + { + $badquestion=arraySearchByKey($dup, $fieldmap, "fieldname", 1); + $fix = "[Click Here to Fix]"; + $failedcheck[]=array($badquestion['qid'], $badquestion['question'], ": Bad duplicate fieldname $fix", $badquestion['gid']); + } + } + if(isset($failedcheck)) + return $failedcheck; + else + return false; +} +/** +* Function to activate a survey +* @global $dbprefix $dbprefix +* @global $connect $connect +* @global $clang $clang +* @param int $postsid +* @param int $surveyid +* @return string +*/ +function activateSurvey($postsid,$surveyid, $scriptname='admin.php') +{ + global $dbprefix, $connect, $clang, $databasetype,$databasetabletype, $uploaddir; + + $createsurvey=''; + $activateoutput=''; + $createsurveytimings=''; + $createsurveydirectory=false; + //Check for any additional fields for this survey and create necessary fields (token and datestamp) + $pquery = "SELECT anonymized, allowregister, datestamp, ipaddr, refurl, savetimings FROM {$dbprefix}surveys WHERE sid={$postsid}"; + $presult=db_execute_assoc($pquery); + $prow=$presult->FetchRow(); + if ($prow['allowregister'] == "Y") + { + $surveyallowsregistration="TRUE"; + } + if ($prow['savetimings'] == "Y") + { + $savetimings="TRUE"; + } + + //Get list of questions for the base language + $fieldmap=createFieldMap($surveyid, 'full', true,false, GetBaseLanguageFromSurveyID($surveyid));// createFieldMap($surveyid, $styl, $force_refresh,$questionid, $sQuestionLanguage); + foreach ($fieldmap as $arow) //With each question, create the appropriate field(s) + { + if ($createsurvey!='') {$createsurvey .= ",\n";} + $createsurvey .= ' `'.$arow['fieldname'].'`'; + switch($arow['type']) + { + case 'startlanguage': + $createsurvey .= " C(20) NOTNULL"; + break; + case 'id': + $createsurvey .= " I NOTNULL AUTO PRIMARY"; + $createsurveytimings .= " `{$arow['fieldname']}` I NOTNULL PRIMARY,\n"; + break; + case "startdate": + case "datestamp": + $createsurvey .= " T NOTNULL"; + break; + case "submitdate": + $createsurvey .= " T"; + break; + case "lastpage": + $createsurvey .= " I"; + break; + case "N": //NUMERICAL + $createsurvey .= " F"; + break; + case "S": //SHORT TEXT + if ($databasetype=='mysql' || $databasetype=='mysqli') {$createsurvey .= " X";} + else {$createsurvey .= " C(255)";} + break; + case "L": //LIST (RADIO) + case "!": //LIST (DROPDOWN) + case "M": //Multiple choice + case "P": //Multiple choice with comment + case "O": //DROPDOWN LIST WITH COMMENT + if ($arow['aid'] != 'other' && strpos($arow['aid'],'comment')===false && strpos($arow['aid'],'othercomment')===false) + { + $createsurvey .= " C(5)"; + } + else + { + $createsurvey .= " X"; + } + break; + case "K": // Multiple Numerical + $createsurvey .= " F"; + break; + case "U": //Huge text + case "Q": //Multiple short text + case "T": //LONG TEXT + case ";": //Multi Flexi + case ":": //Multi Flexi + $createsurvey .= " X"; + break; + case "D": //DATE + if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $databasetype=='mssqlnative') { + $createsurvey .= " T"; + } + else + $createsurvey .= " D"; + break; + case "5": //5 Point Choice + case "G": //Gender + case "Y": //YesNo + case "X": //Boilerplate + $createsurvey .= " C(1)"; + break; + case "I": //Language switch + $createsurvey .= " C(20)"; + break; + case "|": + $createsurveydirectory = true; + if (strpos($arow['fieldname'], "_")) + $createsurvey .= " I1"; + else + $createsurvey .= " X"; + break; + case "ipaddress": + if ($prow['ipaddr'] == "Y") + $createsurvey .= " X"; + break; + case "url": + if ($prow['refurl'] == "Y") + $createsurvey .= " X"; + break; + case "token": + if ($prow['anonymized'] == "N") + { + $createsurvey .= " C(36)"; + } + break; + case '*': // Equation + $createsurvey .= " X"; // could be anything, from numeric to a long message, so default to text + break; + default: + $createsurvey .= " C(5)"; + } + } + $timingsfieldmap = createTimingsFieldMap($surveyid); + $createsurveytimings .= '`'.implode("` F DEFAULT '0',\n`",array_keys($timingsfieldmap)) . "` F DEFAULT '0'"; + + // If last question is of type MCABCEFHP^QKJR let's get rid of the ending coma in createsurvey + $createsurvey = rtrim($createsurvey, ",\n")."\n"; // Does nothing if not ending with a comma + + $tabname = "{$dbprefix}survey_{$postsid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) + + $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', + 'mysqli'=> 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); + $dict = NewDataDictionary($connect); + $sqlarray = $dict->CreateTableSQL($tabname, $createsurvey, $taboptarray); + + if (isset($savetimings) && $savetimings=="TRUE") + { + $tabnametimings = $tabname .'_timings'; + $sqlarraytimings = $dict->CreateTableSQL($tabnametimings, $createsurveytimings, $taboptarray); + } + + $execresult=$dict->ExecuteSQLArray($sqlarray,1); + if ($execresult==0 || $execresult==1) + { + $activateoutput .= "
\n
\n" . + "
".$clang->gT("Activate Survey")." ($surveyid)
\n" . + "
".$clang->gT("Survey could not be actived.")."
\n" . + "

" . + $clang->gT("Database error:")."\n " . $connect->ErrorMsg() . "\n" . + "

$createsurvey
\n + ".$clang->gT("Main Admin Screen")."\n
" ; + } + if ($execresult != 0 && $execresult !=1) + { + $anquery = "SELECT autonumber_start FROM {$dbprefix}surveys WHERE sid={$postsid}"; + if ($anresult=db_execute_assoc($anquery)) + { + //if there is an autonumber_start field, start auto numbering here + while($row=$anresult->FetchRow()) + { + if ($row['autonumber_start'] > 0) + { + if ($databasetype=='odbc_mssql' || $databasetype=='odbtp' || $databasetype=='mssql_n' || $databasetype=='mssqlnative') { + mssql_drop_primary_index('survey_'.$postsid); + mssql_drop_constraint('id','survey_'.$postsid); + $autonumberquery = "alter table {$dbprefix}survey_{$postsid} drop column id "; + $connect->Execute($autonumberquery); + $autonumberquery = "alter table {$dbprefix}survey_{$postsid} add [id] int identity({$row['autonumber_start']},1)"; + $connect->Execute($autonumberquery); + } + else + { + $autonumberquery = "ALTER TABLE {$dbprefix}survey_{$postsid} AUTO_INCREMENT = ".$row['autonumber_start']; + $result = @$connect->Execute($autonumberquery); + + } + } + } + if (isset($savetimings) && $savetimings=="TRUE") + { + $dict->ExecuteSQLArray($sqlarraytimings,1); // create a timings table for this survey + } + } + + $activateoutput .= "
\n
\n"; + $activateoutput .= "
".$clang->gT("Activate Survey")." ($surveyid)
\n"; + $activateoutput .= "
".$clang->gT("Survey has been activated. Results table has been successfully created.")."


\n"; + + // create the survey directory where the uploaded files can be saved + if ($createsurveydirectory) + if (!file_exists($uploaddir."/surveys/" . $postsid . "/files")) + { + if (!(mkdir($uploaddir."/surveys/" . $postsid . "/files", 0777, true))) + { + $activateoutput .= "
". + $clang->gT("The required directory for saving the uploaded files couldn't be created. Please check file premissions on the limesurvey/upload/surveys directory.") . "
"; + + } + else + { + file_put_contents($uploaddir."/surveys/" . $postsid . "/files/index.html",''); + } + } + + $acquery = "UPDATE {$dbprefix}surveys SET active='Y' WHERE sid=".$surveyid; + $acresult = $connect->Execute($acquery); + + $query=db_select_tables_like("{$dbprefix}old\_tokens\_".$surveyid."\_%"); + $result=db_execute_num($query) or safe_die("Couldn't get old table list
".$query."
".$connect->ErrorMsg()); + $tcount=$result->RecordCount(); + if ($tcount==0) + { + $sTokenActivationLink="$scriptname?action=tokens&sid={$postsid}&createtable=Y"; + } + else + { + $sTokenActivationLink="$scriptname?action=tokens&sid={$postsid}"; + } + + if (isset($surveyallowsregistration) && $surveyallowsregistration == "TRUE") + { + $activateoutput .= $clang->gT("This survey allows public registration. A token table must also be created.")."

\n"; + $activateoutput .= "\n"; + } + else + { + $activateoutput .= $clang->gT("This survey is now active, and responses can be recorded.")."

\n"; +//queXS Removal +// $activateoutput .= "".$clang->gT("Open-access mode").": ".$clang->gT("No invitation code is needed to complete the survey.")."
".$clang->gT("You can switch to the closed-access mode by initialising a token table with the button below.")."

\n"; + // $activateoutput .= "\n"; + // $activateoutput .= "\n"; + } + $activateoutput .= "

 \n"; + $lsrcOutput = true; + } + + if($scriptname=='lsrc') + { + if($lsrcOutput==true) + return true; + else + return $activateoutput; + } + else + { + return $activateoutput; + } +} + +function mssql_drop_constraint($fieldname, $tablename) +{ + global $dbprefix, $connect, $modifyoutput; + // find out the name of the default constraint + // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? + $dfquery ="SELECT c_obj.name AS constraint_name + FROM sys.sysobjects AS c_obj INNER JOIN + sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN + sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN + sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid + WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='{$dbprefix}{$tablename}')"; + $defaultname=$connect->GetRow($dfquery); + if ($defaultname!=false) + { + modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname[0]}"); echo $modifyoutput; flush(); + } +} + + +function mssql_drop_primary_index($tablename) +{ + global $dbprefix, $connect, $modifyoutput; + // find out the constraint name of the old primary key + $pkquery = "SELECT CONSTRAINT_NAME " + ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " + ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; + + $primarykey=$connect->GetOne($pkquery); + if ($primarykey!=false) + { + modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush(); + } +} diff --git a/include/limesurvey/admin/admin.php b/include/limesurvey/admin/admin.php index 3198e8e5..fdc14f8b 100644 --- a/include/limesurvey/admin/admin.php +++ b/include/limesurvey/admin/admin.php @@ -1,31 +1,22 @@ =')&& !(function_exists('domxml_new_doc'))) -{ - require_once(dirname(__FILE__).'/classes/core/domxml-php4-to-php5.php'); -} require_once(dirname(__FILE__).'/../config-defaults.php'); require_once(dirname(__FILE__).'/../common.php'); @@ -45,6 +36,19 @@ if (!isset($action)) {$action=returnglobal('action');} //Desired action if (!isset($subaction)) {$subaction=returnglobal('subaction');} //Desired subaction if (!isset($editedaction)) {$editedaction=returnglobal('editedaction');} // for html editor integration +if (isset($_SERVER['HTTP_REFERER'])) +{ + $refurl = $_SERVER['HTTP_REFERER']; //store referer. Can be used for other screens and not just GlobalSettings +} +else +{ + $refurl = ""; +} +LimeExpressionManager::SetSurveyId($surveyid); // must be called early - it clears internal cache if a new survey is being used +if (!is_null($surveyid)) { + $sinfo = getSurveyInfo($surveyid); + LimeExpressionManager::SetEMLanguage($sinfo['surveyls_language']); +} if ($action != 'showprintablesurvey' && substr($action,0,4)!= 'ajax') { @@ -85,15 +89,15 @@ if(isset($_SESSION['loginID'])) sendcacheheaders(); /* Check user right actions for validity - Currently existing user rights: - `configurator` - `create_survey` - `create_user` - `delete_user` - `manage_label` - `manage_template` - `superadmin` - */ + Currently existing user rights: + `configurator` + `create_survey` + `create_user` + `delete_user` + `manage_label` + `manage_template` + `superadmin` + */ if ($action == 'importsurvey' || $action == 'copysurvey') { @@ -102,7 +106,7 @@ if(isset($_SESSION['loginID'])) } elseif ($action == 'dumpdb') { - if ($_SESSION['USER_RIGHT_CONFIGURATOR']==1) {include('dumpdb.php');} + if ($_SESSION['USER_RIGHT_SUPERADMIN']==1) {include('dumpdb.php');} else { include('access_denied.php');} } elseif ($action == 'dumplabel') @@ -149,14 +153,14 @@ if(isset($_SESSION['loginID'])) /* Check survey right actions for validity - Currently existing survey rights: - `edit_survey_property` - `define_questions` - `browse_response` - `export` - `delete_survey` - `activate_survey` - */ + Currently existing survey rights: + `edit_survey_property` + `define_questions` + `browse_response` + `export` + `delete_survey` + `activate_survey` + */ if ($action == 'activate') { @@ -255,6 +259,25 @@ if(isset($_SESSION['loginID'])) exit; } + elseif ($action == 'showlogicfile') + { + if(bHasSurveyPermission($surveyid,'translations','read')) + { + $surveyid = sanitize_int($surveyid); + $thissurvey = getSurveyInfo($surveyid); + $_POST['sid'] = $surveyid . '|N'; + $_POST['LEM_PRETTY_PRINT_ALL_SYNTAX'] = 'Y'; + $_POST['surveyMode'] = 'survey'; + $_POST['LEMcalledFromAdmin'] = 'Y'; + $_POST['assessments'] = $thissurvey['assessments']; + LimeExpressionManager::SetDirtyFlag(); + if (isset($_GET['gid'])) { $_POST['gid'] = $_GET['gid']; } + if (isset($_GET['qid'])) { $_POST['qid'] = $_GET['qid']; } + include($rootdir . '/classes/expressions/test/survey_logic_file.php'); + exit; + } + else { include('access_denied.php');} + } elseif ($action=='addgroup' || $action=='editgroup' || $action=='ordergroups') { if(bHasSurveyPermission($surveyid,'surveycontent','read')) {$_SESSION['FileManagerContext']="edit:group:$surveyid"; include('questiongrouphandling.php');} @@ -265,13 +288,13 @@ if(isset($_SESSION['loginID'])) if(bHasSurveyPermission($surveyid,'responses','read')) {include('saved.php');} else { include('access_denied.php');} } -// + // elseif ($action == 'translate') { if(bHasSurveyPermission($surveyid,'translations','read')) {$_SESSION['FileManagerContext']="edit:translate:$surveyid"; include('translate.php');} else { include('access_denied.php'); } } -// + // elseif ($action == 'tokens') { if(bHasSurveyPermission($surveyid,'tokens','read')) @@ -437,11 +460,11 @@ if(isset($_SESSION['loginID'])) include('surveylist.php'); } if (!isset($assessmentsoutput) && !isset($statisticsoutput) && !isset($browseoutput) && - !isset($savedsurveyoutput) && !isset($listcolumnoutput) && !isset($conditionsoutput) && - !isset($importoldresponsesoutput) && !isset($exportroutput) && !isset($vvoutput) && - !isset($tokenoutput) && !isset($exportoutput) && !isset($templatesoutput) && !isset($translateoutput) && // - !isset($iteratesurveyoutput) && (substr($action,0,4)!= 'ajax') && ($action!='update') && - (isset($surveyid) || $action == "" || preg_match('/^(personalsettings|statistics|copysurvey|importsurvey|editsurveysettings|editsurveylocalesettings|updatesurveysettings|updatesurveysettingsandeditlocalesettings|updatedefaultvalues|ordergroups|dataentry|newsurvey|globalsettings|editusergroups|editusergroup|exportspss|surveyrights|quotas|editusers|login|browse|vvimport|vvexport|setuserrights|modifyuser|setusertemplates|deluser|adduser|userrights|usertemplates|moduser|addusertogroup|deleteuserfromgroup|globalsettingssave|savepersonalsettings|addusergroup|editusergroupindb|usergroupindb|finaldeluser|delusergroup|mailusergroup|mailsendusergroup)$/',$action))) + !isset($savedsurveyoutput) && !isset($listcolumnoutput) && !isset($conditionsoutput) && + !isset($importoldresponsesoutput) && !isset($exportroutput) && !isset($vvoutput) && + !isset($tokenoutput) && !isset($exportoutput) && !isset($templatesoutput) && !isset($translateoutput) && // + !isset($iteratesurveyoutput) && (substr($action,0,4)!= 'ajax') && ($action!='update') && + (isset($surveyid) || $action == "" || preg_match('/^(personalsettings|statistics|copysurvey|importsurvey|editsurveysettings|editsurveylocalesettings|updatesurveysettings|updatesurveysettingsandeditlocalesettings|updatedefaultvalues|ordergroups|dataentry|newsurvey|globalsettings|editusergroups|editusergroup|exportspss|surveyrights|quotas|editusers|login|browse|vvimport|vvexport|setuserrights|modifyuser|setusertemplates|deluser|adduser|userrights|usertemplates|moduser|addusertogroup|deleteuserfromgroup|globalsettingssave|savepersonalsettings|addusergroup|editusergroupindb|usergroupindb|finaldeluser|delusergroup|mailusergroup|mailsendusergroup)$/',$action))) { if ($action=='editsurveysettings' || $action=='editsurveylocalesettings') { @@ -520,8 +543,103 @@ if(isset($_SESSION['loginID'])) if(bHasSurveyPermission($surveyid,'responses','create')) {include('vvimport.php');} else { include('access_denied.php');} } + elseif ($action == 'EMtest') { + switch ($subaction) { + case 'functions': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/functions.php'); + } + else { + include('access_denied.php'); + } + break; + case 'stringsplit': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/stringsplit.php'); + } + else { + include('access_denied.php'); + } + break; + case 'tokenizer': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/tokenizer.php'); + } + else { + include('access_denied.php'); + } + break; + case 'unit': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/unit.php'); + } + else { + include('access_denied.php'); + } + break; + case 'strings_with_expressions': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/strings_with_expressions.php'); + } + else { + include('access_denied.php'); + } + break; + case 'relevance': + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/relevance.php'); + } + else { + include('access_denied.php'); + } + break; + case 'conditions2relevance': + if (bHasSurveyPermission($surveyid, 'surveycontent', 'read')) + { + include('../classes/expressions/test/conditions2relevance.php'); + } + else + { + include('access_denied.php'); + } + break; + case 'navigation_test': + if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) { + include('../classes/expressions/test/navigation_test.php'); + } + else { + include('access_denied.php'); + } + break; + case 'survey_logic_file': + if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) { + include('../classes/expressions/test/survey_logic_file.php'); + } + else { + include('access_denied.php'); + } + break; + case 'upgrade_conditions2relevance': + if($_SESSION['USER_RIGHT_CONFIGURATOR']==1) { + include('../classes/expressions/test/upgrade_conditions2relevance.php'); + } + else { + include('access_denied.php'); + } + break; + default: + if(bHasSurveyPermission($surveyid,'surveycontent','read')) { + include('../classes/expressions/test/test.php'); + } + else { + include('access_denied.php'); + } + break; + } + exit; + } if ($action=='addquestion' || $action=='copyquestion' || $action=='editquestion' || $action=='editdefaultvalues' || - $action=='orderquestions' || $action=='ajaxquestionattributes' || $action=='ajaxlabelsetpicker' || $action=='ajaxlabelsetdetails') + $action=='orderquestions' || $action=='ajaxquestionattributes' || $action=='ajaxlabelsetpicker' || $action=='ajaxlabelsetdetails') { if(bHasSurveyPermission($surveyid,'surveycontent','read')) { @@ -674,11 +792,11 @@ if(isset($_SESSION['loginID'])) else { //not logged in -sendcacheheaders(); -if (!isset($_SESSION['metaHeader'])) {$_SESSION['metaHeader']='';} -$adminoutput = getAdminHeader($_SESSION['metaHeader']).$adminoutput.$loginsummary; // All future output is written into this and then outputted at the end of file -unset($_SESSION['metaHeader']); -$adminoutput.= "\n".getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual")); + sendcacheheaders(); + if (!isset($_SESSION['metaHeader'])) {$_SESSION['metaHeader']='';} + $adminoutput = getAdminHeader($_SESSION['metaHeader']).$adminoutput.$loginsummary; // All future output is written into this and then outputted at the end of file + unset($_SESSION['metaHeader']); + $adminoutput.= "\n".getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual")); } if (($action=='showphpinfo') && ($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1)) { diff --git a/include/limesurvey/admin/admin_functions.php b/include/limesurvey/admin/admin_functions.php index c62c69ee..15389ac1 100644 --- a/include/limesurvey/admin/admin_functions.php +++ b/include/limesurvey/admin/admin_functions.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: admin_functions.php 9586 2010-12-06 03:08:07Z c_schmitz $ + * $Id: admin_functions.php 11664 2011-12-16 05:19:42Z tmswhite $ * Files Purpose: */ @@ -339,6 +339,7 @@ function getAdminHeader($meta=false) $strAdminHeader.= "\n" . "\n" . "\n" + . "\n" . "\n" . "\n" . "\n"; @@ -404,4 +405,4 @@ function getAdminHeader($meta=false) // Standard header $strAdminHeader .="
{$sitename}
\n"; return $strAdminHeader; -} +} \ No newline at end of file diff --git a/include/limesurvey/admin/assessments.php b/include/limesurvey/admin/assessments.php index 3e853af2..70bb06ea 100644 --- a/include/limesurvey/admin/assessments.php +++ b/include/limesurvey/admin/assessments.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: assessments.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: assessments.php 11664 2011-12-16 05:19:42Z tmswhite $ */ @@ -115,7 +115,7 @@ if (bHasSurveyPermission($surveyid, 'assessments','read')) $assessmentsoutput.= "\t\n" . "\t\n"; - return; - } - - // now read tempdir and copy authorized files only - $dh = opendir($extractdir); - while($direntry = readdir($dh)) - { - if (($direntry!=".")&&($direntry!="..")) - { - if (is_file($extractdir."/".$direntry)) - { // is a file - $extfile = substr(strrchr($direntry, '.'),1); - if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) - { //Extension allowed - if (!copy($extractdir."/".$direntry, $destdir.$direntry)) - { - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Copy failed") - ); - unlink($extractdir."/".$direntry); - - } - else - { - $aImportedFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("OK") - ); - unlink($extractdir."/".$direntry); - } - } - - else - { // Extension forbidden - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" - ); - unlink($extractdir."/".$direntry); - } - } // end if is_file - } // end if ! . or .. - } // end while read dir - - - //Delete the temporary file - unlink($zipfile); - //Delete temporary folder - rmdir($extractdir); - - // display summary - $okfiles = 0; - $errfiles= 0; - $ErrorListHeader = ""; - $ImportListHeader = ""; - if (is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) - { - $status=$clang->gT("Success"); - $statusClass='successheader'; - $okfiles = count($aImportedFilesInfo); - $ImportListHeader .= "
".$clang->gT("Imported Files List").":
\n"; - } - elseif (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo)) - { - $importsurveyresourcesoutput .= "
".$clang->gT("Error")."

\n"; - $importsurveyresourcesoutput .= $clang->gT("This ZIP archive contains no valid Resources files. Import failed.")."

\n"; - $importsurveyresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

\n"; - $importsurveyresourcesoutput .= "\n"; - $importsurveyresourcesoutput .= "\n"; - return; - - } - elseif (!is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) - { - $status=$clang->gT("Partial"); - $statusClass='partialheader'; - $okfiles = count($aImportedFilesInfo); - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
".$clang->gT("Error Files List").":
\n"; - $ImportListHeader .= "
".$clang->gT("Imported Files List").":
\n"; - } - else - { - $status=$clang->gT("Error"); - $statusClass='warningheader'; - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
".$clang->gT("Error Files List").":
\n"; - } - - $importsurveyresourcesoutput .= "".$clang->gT("Imported Resources for")." SID: $surveyid

\n"; - $importsurveyresourcesoutput .= "
".$status."

\n"; - $importsurveyresourcesoutput .= "".$clang->gT("Resources Import Summary")."
\n"; - $importsurveyresourcesoutput .= "".$clang->gT("Total Imported files").": $okfiles
\n"; - $importsurveyresourcesoutput .= "".$clang->gT("Total Errors").": $errfiles
\n"; - $importsurveyresourcesoutput .= $ImportListHeader; - foreach ($aImportedFilesInfo as $entry) - { - $importsurveyresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; - } - if (!is_null($aImportedFilesInfo)) - { - $importsurveyresourcesoutput .= "\t
    \n"; - } - $importsurveyresourcesoutput .= $ErrorListHeader; - foreach ($aErrorFilesInfo as $entry) - { - $importsurveyresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; - } - if (!is_null($aErrorFilesInfo)) - { - $importsurveyresourcesoutput .= "\t
    \n"; - } - } - else - { - $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importsurveyresourcesoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; - $importsurveyresourcesoutput .= "\n"; - $importsurveyresourcesoutput .= "\n"; - return; - } - $importsurveyresourcesoutput .= "\n"; - $importsurveyresourcesoutput .= "\n"; -} - - - -if ($action == "importlabelresources" && $lid) -{ - $importlabelresourcesoutput = "
    ".$clang->gT("Import Label Set")."
    \n"; - $importlabelresourcesoutput .= "
    "; - - if ($demoModeOnly === true) - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importlabelresourcesoutput .= sprintf ($clang->gT("Demo mode only: Uploading files is disabled in this system."),$basedestdir)."

    \n"; - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "
    \n"; - return; - } - - require("classes/phpzip/phpzip.inc.php"); - //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name']; - $zipfile=$_FILES['the_file']['tmp_name']; - $z = new PHPZip(); - // Create temporary directory - // If dangerous content is unzipped - // then no one will know the path - $extractdir=tempdir($tempdir); - $basedestdir = $publicdir."/upload/labels"; - $destdir=$basedestdir."/$lid/"; - - if (!is_writeable($basedestdir)) - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importlabelresourcesoutput .= sprintf ($clang->gT("Incorrect permissions in your %s folder."),$basedestdir)."

    \n"; - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "\n"; - return; - } - - if (!is_dir($destdir)) - { - mkdir($destdir); - } - - $aImportedFilesInfo=null; - $aErrorFilesInfo=null; - - - if (is_file($zipfile)) - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Success")."

    \n"; - $importlabelresourcesoutput .= $clang->gT("File upload succeeded.")."

    \n"; - $importlabelresourcesoutput .= $clang->gT("Reading file..")."

    \n"; - - if ($z->extract($extractdir,$zipfile) != 'OK') - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importlabelresourcesoutput .= $clang->gT("This file is not a valid ZIP file archive. Import failed.")."

    \n"; - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "\n"; - return; - } - - // now read tempdir and copy authorized files only - $dh = opendir($extractdir); - while($direntry = readdir($dh)) - { - if (($direntry!=".")&&($direntry!="..")) - { - if (is_file($extractdir."/".$direntry)) - { // is a file - $extfile = substr(strrchr($direntry, '.'),1); - if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) - { //Extension allowed - if (!copy($extractdir."/".$direntry, $destdir.$direntry)) - { - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Copy failed") - ); - unlink($extractdir."/".$direntry); - - } - else - { - $aImportedFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("OK") - ); - unlink($extractdir."/".$direntry); - } - } - - else - { // Extension forbidden - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" - ); - unlink($extractdir."/".$direntry); - } - } // end if is_file - } // end if ! . or .. - } // end while read dir - - - //Delete the temporary file - unlink($zipfile); - //Delete temporary folder - rmdir($extractdir); - - // display summary - $okfiles = 0; - $errfiles= 0; - $ErrorListHeader .= ""; - $ImportListHeader .= ""; - if (is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) - { - $status=$clang->gT("Success"); - $statusClass='successheader'; - $okfiles = count($aImportedFilesInfo); - $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; - } - elseif (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo)) - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importlabelresourcesoutput .= $clang->gT("This ZIP archive contains no valid Resources files. Import failed.")."

    \n"; - $importlabelresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

    \n"; - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "\n"; - return; - } - elseif (!is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) - { - $status=$clang->gT("Partial"); - $statusClass='partialheader'; - $okfiles = count($aImportedFilesInfo); - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; - $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; - } - else - { - $status=$clang->gT("Error"); - $statusClass='warningheader'; - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; - } - - $importlabelresourcesoutput .= "".$clang->gT("Imported Resources for")." LID: $lid

    \n"; - $importlabelresourcesoutput .= "
    ".$status."

    \n"; - $importlabelresourcesoutput .= "".$clang->gT("Resources Import Summary")."
    \n"; - $importlabelresourcesoutput .= "".$clang->gT("Total Imported files").": $okfiles
    \n"; - $importlabelresourcesoutput .= "".$clang->gT("Total Errors").": $errfiles
    \n"; - $importlabelresourcesoutput .= $ImportListHeader; - foreach ($aImportedFilesInfo as $entry) - { - $importlabelresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; - } - if (!is_null($aImportedFilesInfo)) - { - $importlabelresourcesoutput .= "\t
    \n"; - } - $importlabelresourcesoutput .= $ErrorListHeader; - foreach ($aErrorFilesInfo as $entry) - { - $importlabelresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; - } - if (!is_null($aErrorFilesInfo)) - { - $importlabelresourcesoutput .= "\t
    \n"; - } - } - else - { - $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importlabelresourcesoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "\n"; - return; - } - $importlabelresourcesoutput .= "\n"; - $importlabelresourcesoutput .= "\n"; -} - - - -if ($action == "templateupload") -{ - $importtemplateoutput = "
    ".$clang->gT("Import template")."
    \n"; - $importtemplateoutput .= "
    "; - - if ($demoModeOnly === true) - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= sprintf ($clang->gT("Demo mode: Uploading templates is disabled."),$basedestdir)."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "
    \n"; - return; - } - - require("classes/phpzip/phpzip.inc.php"); - //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name']; - $zipfile=$_FILES['the_file']['tmp_name']; - $z = new PHPZip(); - // Create temporary directory - // If dangerous content is unzipped - // then no one will know the path - $extractdir=tempdir($tempdir); - $basedestdir = $usertemplaterootdir; - $newdir=str_replace('.','',strip_ext(sanitize_paranoid_string($_FILES['the_file']['name']))); - $destdir=$basedestdir.'/'.$newdir.'/'; - - if (!is_writeable($basedestdir)) - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= sprintf ($clang->gT("Incorrect permissions in your %s folder."),$basedestdir)."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "\n"; - return; - } - - if (!is_dir($destdir)) - { - mkdir($destdir); - } - else - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= sprintf ($clang->gT("Template '%s' does already exist."),$newdir)."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "\n"; - return; - } - - $aImportedFilesInfo=array(); - $aErrorFilesInfo=array(); - - - if (is_file($zipfile)) - { - $importtemplateoutput .= "
    ".$clang->gT("Success")."

    \n"; - $importtemplateoutput .= $clang->gT("File upload succeeded.")."

    \n"; - $importtemplateoutput .= $clang->gT("Reading file..")."

    \n"; - - if ($z->extract($extractdir,$zipfile) != 'OK') - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= $clang->gT("This file is not a valid ZIP file archive. Import failed.")."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "\n"; - return; - } - - $ErrorListHeader = ""; - $ImportListHeader = ""; - - // now read tempdir and copy authorized files only - $dh = opendir($extractdir); - while($direntry = readdir($dh)) - { - if (($direntry!=".")&&($direntry!="..")) - { - if (is_file($extractdir."/".$direntry)) - { // is a file - $extfile = substr(strrchr($direntry, '.'),1); - if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) - { //Extension allowed - if (!copy($extractdir."/".$direntry, $destdir.$direntry)) - { - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Copy failed") - ); - unlink($extractdir."/".$direntry); - - } - else - { - $aImportedFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("OK") - ); - unlink($extractdir."/".$direntry); - } - } - - else - { // Extension forbidden - $aErrorFilesInfo[]=Array( - "filename" => $direntry, - "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" - ); - unlink($extractdir."/".$direntry); - } - } // end if is_file - } // end if ! . or .. - } // end while read dir - - - //Delete the temporary file - unlink($zipfile); - closedir($dh); - //Delete temporary folder - rmdir($extractdir); - - // display summary - $okfiles = 0; - $errfiles= 0; - if (count($aErrorFilesInfo)==0 && count($aImportedFilesInfo)>0) - { - $status=$clang->gT("Success"); - $statusClass='successheader'; - $okfiles = count($aImportedFilesInfo); - $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; - } - elseif (count($aErrorFilesInfo)==0 && count($aImportedFilesInfo)==0) - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= $clang->gT("This ZIP archive contains no valid template files. Import failed.")."

    \n"; - $importtemplateoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "\n"; - return; - - } - elseif (count($aErrorFilesInfo)>0 && count($aImportedFilesInfo)>0) - { - $status=$clang->gT("Partial"); - $statusClass='partialheader'; - $okfiles = count($aImportedFilesInfo); - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; - $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; - } - else - { - $status=$clang->gT("Error"); - $statusClass='warningheader'; - $errfiles = count($aErrorFilesInfo); - $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; - } - - $importtemplateoutput .= "".$clang->gT("Imported template files for")." $lid

    \n"; - $importtemplateoutput .= "
    ".$status."

    \n"; - $importtemplateoutput .= "".$clang->gT("Resources Import Summary")."
    \n"; - $importtemplateoutput .= "".$clang->gT("Total Imported files").": $okfiles
    \n"; - $importtemplateoutput .= "".$clang->gT("Total Errors").": $errfiles
    \n"; - $importtemplateoutput .= $ImportListHeader; - foreach ($aImportedFilesInfo as $entry) - { - $importtemplateoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; - } - if (!is_null($aImportedFilesInfo)) - { - $importtemplateoutput .= "\t
    \n"; - } - $importtemplateoutput .= $ErrorListHeader; - foreach ($aErrorFilesInfo as $entry) - { - $importtemplateoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; - } - if (!is_null($aErrorFilesInfo)) - { - $importtemplateoutput .= "\t
    \n"; - } - } - else - { - $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; - $importtemplateoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; - $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; - $importtemplateoutput .= "\n"; - return; - } - $importtemplateoutput .= "\n"; - $importtemplateoutput .= "\n"; -} - - -//--------------------- -// Comes from http://fr2.php.net/tempnam -function tempdir($dir, $prefix='', $mode=0700) -{ - if (substr($dir, -1) != '/') $dir .= '/'; - - do - { - $path = $dir.$prefix.mt_rand(0, 9999999); - } while (!mkdir($path, $mode)); - - return $path; -} - -/** - * Strips file extension - * - * @param string $name - * @return string - */ -function strip_ext($name) -{ - $ext = strrchr($name, '.'); - if($ext !== false) - { - $name = substr($name, 0, -strlen($ext)); - } - return $name; -} - -?> +".$clang->gT("Import survey resources")."\n"; + $importsurveyresourcesoutput .= "
    "; + + if ($demoModeOnly === true) + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("Demo Mode Only: Uploading file is disabled in this system.")."

    \n"; + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "
    \n"; + return; + } + + require("classes/phpzip/phpzip.inc.php"); + $zipfile=$_FILES['the_file']['tmp_name']; + $z = new PHPZip(); + + // Create temporary directory + // If dangerous content is unzipped + // then no one will know the path + $extractdir=tempdir($tempdir); + $basedestdir = $uploaddir."/surveys"; + $destdir=$basedestdir."/$surveyid/"; + + if (!is_writeable($basedestdir)) + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importsurveyresourcesoutput .= sprintf ($clang->gT("Incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "\n"; + return; + } + + if (!is_dir($destdir)) + { + mkdir($destdir); + } + + $aImportedFilesInfo=null; + $aErrorFilesInfo=null; + + + if (is_file($zipfile)) + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Success")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("File upload succeeded.")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("Reading file..")."

    \n"; + + if ($z->extract($extractdir,$zipfile) != 'OK') + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("This file is not a valid ZIP file archive. Import failed.")."

    \n"; + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "\n"; + return; + } + + // now read tempdir and copy authorized files only + $dh = opendir($extractdir); + while($direntry = readdir($dh)) + { + if (($direntry!=".")&&($direntry!="..")) + { + if (is_file($extractdir."/".$direntry)) + { // is a file + $extfile = substr(strrchr($direntry, '.'),1); + if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) + { //Extension allowed + if (!copy($extractdir."/".$direntry, $destdir.$direntry)) + { + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Copy failed") + ); + unlink($extractdir."/".$direntry); + + } + else + { + $aImportedFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("OK") + ); + unlink($extractdir."/".$direntry); + } + } + + else + { // Extension forbidden + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" + ); + unlink($extractdir."/".$direntry); + } + } // end if is_file + } // end if ! . or .. + } // end while read dir + + + //Delete the temporary file + unlink($zipfile); + //Delete temporary folder + rmdir($extractdir); + + // display summary + $okfiles = 0; + $errfiles= 0; + $ErrorListHeader = ""; + $ImportListHeader = ""; + if (is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) + { + $status=$clang->gT("Success"); + $statusClass='successheader'; + $okfiles = count($aImportedFilesInfo); + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + elseif (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo)) + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("This ZIP archive contains no valid Resources files. Import failed.")."

    \n"; + $importsurveyresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

    \n"; + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "\n"; + return; + + } + elseif (!is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) + { + $status=$clang->gT("Partial"); + $statusClass='partialheader'; + $okfiles = count($aImportedFilesInfo); + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + else + { + $status=$clang->gT("Error"); + $statusClass='warningheader'; + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + } + + $importsurveyresourcesoutput .= "".$clang->gT("Imported Resources for")." SID: $surveyid

    \n"; + $importsurveyresourcesoutput .= "
    ".$status."

    \n"; + $importsurveyresourcesoutput .= "".$clang->gT("Resources Import Summary")."
    \n"; + $importsurveyresourcesoutput .= "".$clang->gT("Total Imported files").": $okfiles
    \n"; + $importsurveyresourcesoutput .= "".$clang->gT("Total Errors").": $errfiles
    \n"; + $importsurveyresourcesoutput .= $ImportListHeader; + foreach ($aImportedFilesInfo as $entry) + { + $importsurveyresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; + } + if (!is_null($aImportedFilesInfo)) + { + $importsurveyresourcesoutput .= "\t
    \n"; + } + $importsurveyresourcesoutput .= $ErrorListHeader; + foreach ($aErrorFilesInfo as $entry) + { + $importsurveyresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; + } + if (!is_null($aErrorFilesInfo)) + { + $importsurveyresourcesoutput .= "\t
    \n"; + } + } + else + { + $importsurveyresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importsurveyresourcesoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "\n"; + return; + } + $importsurveyresourcesoutput .= "\n"; + $importsurveyresourcesoutput .= "\n"; +} + + + +if ($action == "importlabelresources" && $lid) +{ + $importlabelresourcesoutput = "
    ".$clang->gT("Import Label Set")."
    \n"; + $importlabelresourcesoutput .= "
    "; + + if ($demoModeOnly === true) + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importlabelresourcesoutput .= sprintf ($clang->gT("Demo mode only: Uploading files is disabled in this system."),$basedestdir)."

    \n"; + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "
    \n"; + return; + } + + require("classes/phpzip/phpzip.inc.php"); + //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name']; + $zipfile=$_FILES['the_file']['tmp_name']; + $z = new PHPZip(); + // Create temporary directory + // If dangerous content is unzipped + // then no one will know the path + $extractdir=tempdir($tempdir); + $basedestdir = $publicdir."/upload/labels"; + $destdir=$basedestdir."/$lid/"; + + if (!is_writeable($basedestdir)) + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importlabelresourcesoutput .= sprintf ($clang->gT("Incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "\n"; + return; + } + + if (!is_dir($destdir)) + { + mkdir($destdir); + } + + $aImportedFilesInfo=null; + $aErrorFilesInfo=null; + + + if (is_file($zipfile)) + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Success")."

    \n"; + $importlabelresourcesoutput .= $clang->gT("File upload succeeded.")."

    \n"; + $importlabelresourcesoutput .= $clang->gT("Reading file..")."

    \n"; + + if ($z->extract($extractdir,$zipfile) != 'OK') + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importlabelresourcesoutput .= $clang->gT("This file is not a valid ZIP file archive. Import failed.")."

    \n"; + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "\n"; + return; + } + + // now read tempdir and copy authorized files only + $dh = opendir($extractdir); + while($direntry = readdir($dh)) + { + if (($direntry!=".")&&($direntry!="..")) + { + if (is_file($extractdir."/".$direntry)) + { // is a file + $extfile = substr(strrchr($direntry, '.'),1); + if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) + { //Extension allowed + if (!copy($extractdir."/".$direntry, $destdir.$direntry)) + { + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Copy failed") + ); + unlink($extractdir."/".$direntry); + + } + else + { + $aImportedFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("OK") + ); + unlink($extractdir."/".$direntry); + } + } + + else + { // Extension forbidden + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" + ); + unlink($extractdir."/".$direntry); + } + } // end if is_file + } // end if ! . or .. + } // end while read dir + + + //Delete the temporary file + unlink($zipfile); + //Delete temporary folder + rmdir($extractdir); + + // display summary + $okfiles = 0; + $errfiles= 0; + $ErrorListHeader .= ""; + $ImportListHeader .= ""; + if (is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) + { + $status=$clang->gT("Success"); + $statusClass='successheader'; + $okfiles = count($aImportedFilesInfo); + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + elseif (is_null($aErrorFilesInfo) && is_null($aImportedFilesInfo)) + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importlabelresourcesoutput .= $clang->gT("This ZIP archive contains no valid Resources files. Import failed.")."

    \n"; + $importlabelresourcesoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

    \n"; + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "\n"; + return; + } + elseif (!is_null($aErrorFilesInfo) && !is_null($aImportedFilesInfo)) + { + $status=$clang->gT("Partial"); + $statusClass='partialheader'; + $okfiles = count($aImportedFilesInfo); + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + else + { + $status=$clang->gT("Error"); + $statusClass='warningheader'; + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + } + + $importlabelresourcesoutput .= "".$clang->gT("Imported Resources for")." LID: $lid

    \n"; + $importlabelresourcesoutput .= "
    ".$status."

    \n"; + $importlabelresourcesoutput .= "".$clang->gT("Resources Import Summary")."
    \n"; + $importlabelresourcesoutput .= "".$clang->gT("Total Imported files").": $okfiles
    \n"; + $importlabelresourcesoutput .= "".$clang->gT("Total Errors").": $errfiles
    \n"; + $importlabelresourcesoutput .= $ImportListHeader; + foreach ($aImportedFilesInfo as $entry) + { + $importlabelresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; + } + if (!is_null($aImportedFilesInfo)) + { + $importlabelresourcesoutput .= "\t
    \n"; + } + $importlabelresourcesoutput .= $ErrorListHeader; + foreach ($aErrorFilesInfo as $entry) + { + $importlabelresourcesoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; + } + if (!is_null($aErrorFilesInfo)) + { + $importlabelresourcesoutput .= "\t
    \n"; + } + } + else + { + $importlabelresourcesoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importlabelresourcesoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "\n"; + return; + } + $importlabelresourcesoutput .= "\n"; + $importlabelresourcesoutput .= "\n"; +} + + + +if ($action == "templateupload") +{ + $importtemplateoutput = "
    ".$clang->gT("Import template")."
    \n"; + $importtemplateoutput .= "
    "; + + if ($demoModeOnly === true) + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= sprintf ($clang->gT("Demo mode: Uploading templates is disabled."),$basedestdir)."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "
    \n"; + return; + } + + require("classes/phpzip/phpzip.inc.php"); + //$the_full_file_path = $tempdir . "/" . $_FILES['the_file']['name']; + $zipfile=$_FILES['the_file']['tmp_name']; + $z = new PHPZip(); + // Create temporary directory + // If dangerous content is unzipped + // then no one will know the path + $extractdir=tempdir($tempdir); + $basedestdir = $usertemplaterootdir; + $newdir=str_replace('.','',strip_ext(sanitize_paranoid_string($_FILES['the_file']['name']))); + $destdir=$basedestdir.'/'.$newdir.'/'; + + if (!is_writeable($basedestdir)) + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= sprintf ($clang->gT("Incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "\n"; + return; + } + + if (!is_dir($destdir)) + { + mkdir($destdir); + } + else + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= sprintf ($clang->gT("Template '%s' does already exist."),$newdir)."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "\n"; + return; + } + + $aImportedFilesInfo=array(); + $aErrorFilesInfo=array(); + + + if (is_file($zipfile)) + { + $importtemplateoutput .= "
    ".$clang->gT("Success")."

    \n"; + $importtemplateoutput .= $clang->gT("File upload succeeded.")."

    \n"; + $importtemplateoutput .= $clang->gT("Reading file..")."

    \n"; + + if ($z->extract($extractdir,$zipfile) != 'OK') + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= $clang->gT("This file is not a valid ZIP file archive. Import failed.")."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "\n"; + return; + } + + $ErrorListHeader = ""; + $ImportListHeader = ""; + + // now read tempdir and copy authorized files only + $dh = opendir($extractdir); + while($direntry = readdir($dh)) + { + if (($direntry!=".")&&($direntry!="..")) + { + if (is_file($extractdir."/".$direntry)) + { // is a file + $extfile = substr(strrchr($direntry, '.'),1); + if (!(stripos(','.$allowedresourcesuploads.',',','.$extfile.',') === false)) + { //Extension allowed + if (!copy($extractdir."/".$direntry, $destdir.$direntry)) + { + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Copy failed") + ); + unlink($extractdir."/".$direntry); + + } + else + { + $aImportedFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("OK") + ); + unlink($extractdir."/".$direntry); + } + } + + else + { // Extension forbidden + $aErrorFilesInfo[]=Array( + "filename" => $direntry, + "status" => $clang->gT("Error")." (".$clang->gT("Forbidden Extension").")" + ); + unlink($extractdir."/".$direntry); + } + } // end if is_file + } // end if ! . or .. + } // end while read dir + + + //Delete the temporary file + unlink($zipfile); + closedir($dh); + //Delete temporary folder + rmdir($extractdir); + + // display summary + $okfiles = 0; + $errfiles= 0; + if (count($aErrorFilesInfo)==0 && count($aImportedFilesInfo)>0) + { + $status=$clang->gT("Success"); + $statusClass='successheader'; + $okfiles = count($aImportedFilesInfo); + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + elseif (count($aErrorFilesInfo)==0 && count($aImportedFilesInfo)==0) + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= $clang->gT("This ZIP archive contains no valid template files. Import failed.")."

    \n"; + $importtemplateoutput .= $clang->gT("Remember that we do not support subdirectories in ZIP archives.")."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "\n"; + return; + + } + elseif (count($aErrorFilesInfo)>0 && count($aImportedFilesInfo)>0) + { + $status=$clang->gT("Partial"); + $statusClass='partialheader'; + $okfiles = count($aImportedFilesInfo); + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + $ImportListHeader .= "
    ".$clang->gT("Imported Files List").":
    \n"; + } + else + { + $status=$clang->gT("Error"); + $statusClass='warningheader'; + $errfiles = count($aErrorFilesInfo); + $ErrorListHeader .= "
    ".$clang->gT("Error Files List").":
    \n"; + } + + $importtemplateoutput .= "".$clang->gT("Imported template files for")." $lid

    \n"; + $importtemplateoutput .= "
    ".$status."

    \n"; + $importtemplateoutput .= "".$clang->gT("Resources Import Summary")."
    \n"; + $importtemplateoutput .= "".$clang->gT("Total Imported files").": $okfiles
    \n"; + $importtemplateoutput .= "".$clang->gT("Total Errors").": $errfiles
    \n"; + $importtemplateoutput .= $ImportListHeader; + foreach ($aImportedFilesInfo as $entry) + { + $importtemplateoutput .= "\t
  • ".$clang->gT("File").": ".$entry["filename"]."
  • \n"; + } + if (!is_null($aImportedFilesInfo)) + { + $importtemplateoutput .= "\t
    \n"; + } + $importtemplateoutput .= $ErrorListHeader; + foreach ($aErrorFilesInfo as $entry) + { + $importtemplateoutput .= "\t
  • ".$clang->gT("File").": ".$entry['filename']." (".$entry['status'].")
  • \n"; + } + if (!is_null($aErrorFilesInfo)) + { + $importtemplateoutput .= "\t
    \n"; + } + } + else + { + $importtemplateoutput .= "
    ".$clang->gT("Error")."

    \n"; + $importtemplateoutput .= sprintf ($clang->gT("An error occurred uploading your file. This may be caused by incorrect permissions in your %s folder."),$basedestdir)."

    \n"; + $importtemplateoutput .= "
    gT("Template Editor")."\"/>\n"; + $importtemplateoutput .= "\n"; + return; + } + $importtemplateoutput .= "\n"; + $importtemplateoutput .= "\n"; +} + + +//--------------------- +// Comes from http://fr2.php.net/tempnam +function tempdir($dir, $prefix='', $mode=0700) +{ + if (substr($dir, -1) != '/') $dir .= '/'; + + do + { + $path = $dir.$prefix.mt_rand(0, 9999999); + } while (!mkdir($path, $mode)); + + return $path; +} + +/** + * Strips file extension + * + * @param string $name + * @return string + */ +function strip_ext($name) +{ + $ext = strrchr($name, '.'); + if($ext !== false) + { + $name = substr($name, 0, -strlen($ext)); + } + return $name; +} + +?> diff --git a/include/limesurvey/admin/importgroup.php b/include/limesurvey/admin/importgroup.php index 78fba5e7..31d677b6 100644 --- a/include/limesurvey/admin/importgroup.php +++ b/include/limesurvey/admin/importgroup.php @@ -10,10 +10,10 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: importgroup.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: importgroup.php 11664 2011-12-16 05:19:42Z tmswhite $ */ -//Ensure script is not run directly, avoid path disclosure +//Ensure script is not run directly, avoid path disclosure include_once("login_check.php"); $importgroup = "
    ".$clang->gT("Import question group")."
    \n"; @@ -96,13 +96,13 @@ unlink($sFullFilepath); /** * This function imports an old-school question group file (*.csv,*.sql) -* +* * @param mixed $sFullFilepath Full file patch to the import file * @param mixed $newsid Survey ID to which the question is attached */ -function CSVImportGroup($sFullFilepath, $newsid) +function CSVImportGroup($sFullFilepath, $newsid) { - global $dbprefix, $connect, $clang; + global $dbprefix, $connect, $clang; $aLIDReplacements=array(); $aQIDReplacements = array(); // this array will have the "new qid" for the questions, the key will be the "old qid" $aGIDReplacements = array(); @@ -117,7 +117,7 @@ function CSVImportGroup($sFullFilepath, $newsid) if (substr($bigarray[0], 0, 23) != "# LimeSurvey Group Dump") { $results['fatalerror'] = $clang->gT("This file is not a LimeSurvey question file. Import failed."); - $importversion=0; + $importversion=0; } else { @@ -128,7 +128,7 @@ function CSVImportGroup($sFullFilepath, $newsid) { $results['fatalerror'] = $clang->gT("This file is too old. Only files from LimeSurvey version 1.50 (DBVersion 112) and newer are supported."); } - + for ($i=0; $i<9; $i++) //skipping the first lines that are not needed { unset($bigarray[$i]); @@ -337,7 +337,7 @@ function CSVImportGroup($sFullFilepath, $newsid) return $results; } - + } if (count($labelsetsarray) > 1) @@ -422,7 +422,7 @@ function CSVImportGroup($sFullFilepath, $newsid) $query2 = "SELECT code, title, sortorder, language, assessment_value FROM {$dbprefix}labels WHERE lid=".$newlid." - ORDER BY language, sortorder, code"; + ORDER BY language, sortorder, code"; $result2 = db_execute_num($query2) or safe_die("Died querying labelset $lid
    $query2
    ".$connect->ErrorMsg()); while($row2=$result2->FetchRow()) { @@ -527,7 +527,7 @@ function CSVImportGroup($sFullFilepath, $newsid) // GROUPS is DONE // Import questions - if (isset($questionarray) && $questionarray) + if (isset($questionarray) && $questionarray) { foreach ($questionarray as $qa) { @@ -578,9 +578,9 @@ function CSVImportGroup($sFullFilepath, $newsid) elseif ($questionrowdata['type']=='Z') { $questionrowdata['type']='L'; - } + } - if (!isset($questionrowdata["question_order"]) || $questionrowdata["question_order"]=='') {$questionrowdata["question_order"]=0;} + if (!isset($questionrowdata["question_order"]) || $questionrowdata["question_order"]=='') {$questionrowdata["question_order"]=0;} $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); @@ -591,7 +591,7 @@ function CSVImportGroup($sFullFilepath, $newsid) $newvalues=array_values($questionrowdata); $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - + if (isset($questionrowdata['qid'])) { db_switchIDInsert('questions',true); @@ -606,17 +606,17 @@ function CSVImportGroup($sFullFilepath, $newsid) //GET NEW QID .... if is not done before and we count a question if a new qid is required if (isset($questionrowdata['qid'])) { - $saveqid=$questionrowdata['qid']; + $saveqid=$questionrowdata['qid']; } else { $aQIDReplacements[$oldqid]=$connect->Insert_ID("{$dbprefix}questions",'qid'); $saveqid=$aQIDReplacements[$oldqid]; } - $qtypes = getqtypelist("" ,"array"); + $qtypes = getqtypelist("" ,"array"); $aSQIDReplacements=array(); - db_switchIDInsert('questions',false); - + db_switchIDInsert('questions',false); + // Now we will fix up old label sets where they are used as answers if ((isset($oldlid1) || isset($oldlid2)) && ($qtypes[$questionrowdata['type']]['answerscales']>0 || $qtypes[$questionrowdata['type']]['subquestions']>1)) { @@ -626,11 +626,11 @@ function CSVImportGroup($sFullFilepath, $newsid) { if (in_array($labelrow['language'],$aLanguagesSupported)) { - + if ($qtypes[$questionrowdata['type']]['subquestions']<2) { $qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value) - VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).")"; + VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).")"; $qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer (lid1)
    \n$qinsert
    \n".$connect->ErrorMsg()); } else @@ -638,19 +638,19 @@ function CSVImportGroup($sFullFilepath, $newsid) if (isset($aSQIDReplacements[$labelrow['code'].'_'.$saveqid])){ $fieldname='qid,'; $data=$aSQIDReplacements[$labelrow['code'].'_'.$saveqid].','; - } + } else { $fieldname='' ; $data=''; } - + $qinsert = "insert INTO ".db_table_name('questions')." ($fieldname parent_qid,title,question,question_order,language,scale_id,type, sid, gid) - VALUES ($data{$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,'{$questionrowdata['type']}',{$questionrowdata['sid']},{$questionrowdata['gid']})"; + VALUES ($data{$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,'{$questionrowdata['type']}',{$questionrowdata['sid']},{$questionrowdata['gid']})"; $qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert question
    \n$qinsert
    \n".$connect->ErrorMsg()); if ($fieldname=='') { - $aSQIDReplacements[$labelrow['code'].'_'.$saveqid]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $aSQIDReplacements[$labelrow['code'].'_'.$saveqid]=$connect->Insert_ID("{$dbprefix}questions","qid"); } } } @@ -662,12 +662,12 @@ function CSVImportGroup($sFullFilepath, $newsid) while($labelrow=$oldlabelsresult->FetchRow()) { $qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id) - VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)"; + VALUES ({$aQIDReplacements[$oldqid]},".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)"; $qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer (lid2)
    \n$qinsert
    \n".$connect->ErrorMsg()); } } } - } + } } //Do answers @@ -701,12 +701,12 @@ function CSVImportGroup($sFullFilepath, $newsid) $oldquestion['newtype']=$questiontemp['type']; $oldquestion['gid']=$questiontemp['gid']; if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='L' || $oldquestion['newtype']=='O' || $oldquestion['newtype']=='!')) - { - $insertdata=array(); + { + $insertdata=array(); $insertdata['qid']=$newqid; $insertdata['language']=$answerrowdata['language']; - $insertdata['defaultvalue']=$answerrowdata['answer']; - $query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata); + $insertdata['defaultvalue']=$answerrowdata['answer']; + $query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue
    {$query}
    \n".$connect->ErrorMsg()); } @@ -720,52 +720,52 @@ function CSVImportGroup($sFullFilepath, $newsid) $questionrowdata=array(); if (isset($aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']])){ $questionrowdata['qid']=$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]; - } + } $questionrowdata['parent_qid']=$answerrowdata['qid'];; $questionrowdata['sid']=$newsid; - $questionrowdata['gid']=$oldquestion['gid']; + $questionrowdata['gid']=$oldquestion['gid']; $questionrowdata['title']=$answerrowdata['code']; $questionrowdata['question']=$answerrowdata['answer']; $questionrowdata['question_order']=$answerrowdata['sortorder']; $questionrowdata['language']=$answerrowdata['language']; $questionrowdata['type']=$oldquestion['newtype']; - - $tablename=$dbprefix.'questions'; - $query=$connect->GetInsertSQL($tablename,$questionrowdata); + + $tablename=$dbprefix.'questions'; + $query=$connect->GetInsertSQL($tablename,$questionrowdata); if (isset($questionrowdata['qid'])) db_switchIDInsert('questions',true); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert subquestion
    {$query}
    ".$connect->ErrorMsg()); if (!isset($questionrowdata['qid'])) { - $aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid"); } else { - db_switchIDInsert('questions',false); + db_switchIDInsert('questions',false); } $results['subquestions']++; // also convert default values subquestions for multiple choice if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='M' || $oldquestion['newtype']=='P')) - { - $insertdata=array(); + { + $insertdata=array(); $insertdata['qid']=$newqid; $insertdata['sqid']=$aSQIDReplacements[$answerrowdata['code']]; $insertdata['language']=$answerrowdata['language']; $insertdata['defaultvalue']='Y'; - $tablename=$dbprefix.'defaultvalues'; - $query=$connect->GetInsertSQL($tablename,$insertdata); + $tablename=$dbprefix.'defaultvalues'; + $query=$connect->GetInsertSQL($tablename,$insertdata); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue
    {$query}
    \n".$connect->ErrorMsg()); } - + } else // insert answers { unset($answerrowdata['default_value']); - $tablename=$dbprefix.'answers'; - $query=$connect->GetInsertSQL($tablename,$answerrowdata); + $tablename=$dbprefix.'answers'; + $query=$connect->GetInsertSQL($tablename,$answerrowdata); $ares = $connect->Execute($query) or safe_die ("Error: Failed to insert answer
    {$query}
    \n".$connect->ErrorMsg()); - $results['answers']++; - } - + $results['answers']++; + } + } } // ANSWERS is DONE @@ -784,7 +784,7 @@ function CSVImportGroup($sFullFilepath, $newsid) $results['question_attributes']=0; // Finally the question attributes - it is called just once and only if there was a question - if (isset($question_attributesarray) && $question_attributesarray) + if (isset($question_attributesarray) && $question_attributesarray) {//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES $fieldorders=convertCSVRowToArray($question_attributesarray[0],',','"'); unset($question_attributesarray[0]); @@ -863,17 +863,20 @@ function CSVImportGroup($sFullFilepath, $newsid) $results['conditions']++; } } + LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid); + LimeExpressionManager::UpgradeConditionsToRelevance($newsid); + $results['groups']=1; $results['newgid']=$newgid; - return $results; + return $results; } /** * This function imports a LimeSurvey .lsg question group XML file -* +* * @param mixed $sFullFilepath The full filepath of the uploaded file -* @param mixed $newsid The new survey id - the group will always be added after the last group in the survey +* @param mixed $newsid The new survey id - the group will always be added after the last group in the survey */ function XMLImportGroup($sFullFilepath, $newsid) { @@ -883,28 +886,28 @@ function XMLImportGroup($sFullFilepath, $newsid) $sBaseLanguage = GetBaseLanguageFromSurveyID($newsid); $aLanguagesSupported[]=$sBaseLanguage; // adds the base language to the list of supported languages $aLanguagesSupported=array_merge($aLanguagesSupported,GetAdditionalLanguagesFromSurveyID($newsid)); - - $xml = @simplexml_load_file($sFullFilepath); + + $xml = @simplexml_load_file($sFullFilepath); if ($xml==false || $xml->LimeSurveyDocType!='Group') safe_die('This is not a valid LimeSurvey group structure XML file.'); - $dbversion = (int) $xml->DBVersion; - $aQIDReplacements=array(); + $dbversion = (float) $xml->DBVersion; + $aQIDReplacements=array(); $results['defaultvalues']=0; $results['answers']=0; $results['question_attributes']=0; $results['subquestions']=0; $results['conditions']=0; $results['groups']=0; - + $importlanguages=array(); foreach ($xml->languages->language as $language) { $importlanguages[]=(string)$language; - } + } if (!in_array($sBaseLanguage,$importlanguages)) { $results['fatalerror'] = $clang->gT("The languages of the imported group file must at least include the base language of this survey."); - return; + return $results; } // First get an overview of fieldnames - it's not useful for the moment but might be with newer versions /* @@ -913,14 +916,14 @@ function XMLImportGroup($sFullFilepath, $newsid) { $fieldnames[]=(string)$fieldname; };*/ - - + + // Import group table =================================================================================== $tablename=$dbprefix.'groups'; $newgrouporder=$connect->GetOne("SELECT MAX(group_order) AS maxqo FROM ".db_table_name('groups')." WHERE sid=$newsid"); - if (is_null($newgrouporder)) + if (is_null($newgrouporder)) { $newgrouporder=0; } @@ -929,7 +932,7 @@ function XMLImportGroup($sFullFilepath, $newsid) } foreach ($xml->groups->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -942,16 +945,16 @@ function XMLImportGroup($sFullFilepath, $newsid) // now translate any links $insertdata['group_name']=translink('survey', $oldsid, $newsid, $insertdata['group_name']); $insertdata['description']=translink('survey', $oldsid, $newsid, $insertdata['description']); - // Insert the new question + // Insert the new question if (isset($aGIDReplacements[$oldgid])) { - $insertdata['gid']=$aGIDReplacements[$oldgid]; + $insertdata['gid']=$aGIDReplacements[$oldgid]; db_switchIDInsert('groups',true); - } - $query=$connect->GetInsertSQL($tablename,$insertdata); + } + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $results['groups']++; - + if (!isset($aGIDReplacements[$oldgid])) { $newgid=$connect->Insert_ID($tablename,"gid"); // save this for later @@ -962,58 +965,61 @@ function XMLImportGroup($sFullFilepath, $newsid) db_switchIDInsert('groups',false); } } - - + + // Import questions table =================================================================================== // We have to run the question table data two times - first to find all main questions // then for subquestions (because we need to determine the new qids for the main questions first) $tablename=$dbprefix.'questions'; $results['questions']=0; - foreach ($xml->questions->rows->row as $row) + if (isset($xml->questions)) { - $insertdata=array(); - foreach ($row as $key=>$value) + foreach ($xml->questions->rows->row as $row) { - $insertdata[(string)$key]=(string)$value; - } - $oldsid=$insertdata['sid']; - $insertdata['sid']=$newsid; - if (!isset($aGIDReplacements[$insertdata['gid']]) || trim($insertdata['title'])=='') continue; // Skip questions with invalid group id - $insertdata['gid']=$aGIDReplacements[$insertdata['gid']]; - $oldqid=$insertdata['qid']; unset($insertdata['qid']); // save the old qid + $insertdata=array(); + foreach ($row as $key=>$value) + { + $insertdata[(string)$key]=(string)$value; + } + $oldsid=$insertdata['sid']; + $insertdata['sid']=$newsid; + if (!isset($aGIDReplacements[$insertdata['gid']]) || trim($insertdata['title'])=='') continue; // Skip questions with invalid group id + $insertdata['gid']=$aGIDReplacements[$insertdata['gid']]; + $oldqid=$insertdata['qid']; unset($insertdata['qid']); // save the old qid - // now translate any links - $insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']); - $insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']); - $insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']); - // Insert the new question - if (isset($aQIDReplacements[$oldqid])) - { - $insertdata['qid']=$aQIDReplacements[$oldqid]; - db_switchIDInsert('questions',true); - } - $query=$connect->GetInsertSQL($tablename,$insertdata); - $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); - if (!isset($aQIDReplacements[$oldqid])) - { - $newqid=$connect->Insert_ID($tablename,"qid"); // save this for later - $aQIDReplacements[$oldqid]=$newqid; // add old and new qid to the mapping array - $results['questions']++; - } - else - { - db_switchIDInsert('questions',false); + // now translate any links + $insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']); + $insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']); + $insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']); + // Insert the new question + if (isset($aQIDReplacements[$oldqid])) + { + $insertdata['qid']=$aQIDReplacements[$oldqid]; + db_switchIDInsert('questions',true); + } + $query=$connect->GetInsertSQL($tablename,$insertdata); + $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); + if (!isset($aQIDReplacements[$oldqid])) + { + $newqid=$connect->Insert_ID($tablename,"qid"); // save this for later + $aQIDReplacements[$oldqid]=$newqid; // add old and new qid to the mapping array + $results['questions']++; + } + else + { + db_switchIDInsert('questions',false); + } } } // Import subquestions -------------------------------------------------------------- if (isset($xml->subquestions)) { - + foreach ($xml->subquestions->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -1028,18 +1034,18 @@ function XMLImportGroup($sFullFilepath, $newsid) // now translate any links $insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']); $insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']); - $insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']); + $insertdata['help']=(isset($insertdata['help']) ? translink('survey', $oldsid, $newsid, $insertdata['help']) : ''); if (isset($aQIDReplacements[$oldsqid])){ $insertdata['qid']=$aQIDReplacements[$oldsqid]; db_switchIDInsert('questions',true); } - - $query=$connect->GetInsertSQL($tablename,$insertdata); + + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $newsqid=$connect->Insert_ID($tablename,"qid"); // save this for later if (!isset($insertdata['qid'])) { - $aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array + $aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array } else { @@ -1054,33 +1060,33 @@ function XMLImportGroup($sFullFilepath, $newsid) if(isset($xml->answers)) { $tablename=$dbprefix.'answers'; - + foreach ($xml->answers->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; } if (!isset($aQIDReplacements[(int)$insertdata['qid']])) continue; // Skip questions with invalid group id - + $insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $results['answers']++; - } + } } // Import questionattributes -------------------------------------------------------------- if(isset($xml->question_attributes)) { $tablename=$dbprefix.'question_attributes'; - + foreach ($xml->question_attributes->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -1090,44 +1096,51 @@ function XMLImportGroup($sFullFilepath, $newsid) $insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $results['question_attributes']++; - } + } } - - + + // Import defaultvalues -------------------------------------------------------------- if(isset($xml->defaultvalues)) { $tablename=$dbprefix.'defaultvalues'; - + $results['defaultvalues']=0; foreach ($xml->defaultvalues->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; } $insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the qid - $insertdata['sqid']=$aQIDReplacements[(int)$insertdata['sqid']]; // remap the subqeustion id + if (!isset($aQIDReplacements[(int)$insertdata['sqid']]) || is_null($aQIDReplacements[(int)$insertdata['sqid']])) + { + $insertdata['sqid'] = 0; // defaults for non-array types + } + else + { + $insertdata['sqid']=$aQIDReplacements[(int)$insertdata['sqid']]; // remap the subqeustion id + } // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); - $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    \$query
    \n".$connect->ErrorMsg()); + $query=$connect->GetInsertSQL($tablename,$insertdata); + $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    ". $query. "
    \n".$connect->ErrorMsg()); $results['defaultvalues']++; - } + } } // Import conditions -------------------------------------------------------------- if(isset($xml->conditions)) { $tablename=$dbprefix.'conditions'; - + foreach ($xml->conditions->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -1165,16 +1178,18 @@ function XMLImportGroup($sFullFilepath, $newsid) if (trim($insertdata["method"])=='') { $insertdata["method"]='=='; - } + } // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    \$query
    \n".$connect->ErrorMsg()); $results['conditions']++; - } + } } + LimeExpressionManager::RevertUpgradeConditionsToRelevance($newsid); + LimeExpressionManager::UpgradeConditionsToRelevance($newsid); + - $results['newgid']=$newgid; $results['labelsets']=0; $results['labels']=0; diff --git a/include/limesurvey/admin/importlabel.php b/include/limesurvey/admin/importlabel.php index 6e8ce380..14747f04 100644 --- a/include/limesurvey/admin/importlabel.php +++ b/include/limesurvey/admin/importlabel.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: importlabel.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: importlabel.php 11607 2011-12-06 23:19:52Z tmswhite $ */ //Ensure script is not run directly, avoid path disclosure @@ -57,39 +57,38 @@ elseif (strtolower($sExtension)=='lsl') $importlabeloutput .= "\n"; $importlabeloutput .= "
    \n"; } -unlink($sFullFilepath); +unlink($sFullFilepath); if (isset($aImportResults)) { -if (count($aImportResults['warnings'])>0) -{ - $importlabeloutput .= "
    \n
    ".$clang->gT("Warnings")."
      \n"; - foreach ($aImportResults['warnings'] as $warning) + if (isset($aImportResults['fatalerror'])) { - $importlabeloutput .= '
    • '.$warning.'
    • '; - } - $importlabeloutput .= "
    \n"; + $importlabeloutput .= "
    \n
    ".$clang->gT("Error")."
    +

    {$aImportResults['fatalerror']}
    "; + } + else + { + if (count($aImportResults['warnings'])>0) + { + $importlabeloutput .= "
    \n

    ".$clang->gT("Warnings")."
      \n"; + foreach ($aImportResults['warnings'] as $warning) + { + $importlabeloutput .= '
    • '.$warning.'
    • '; + } + $importlabeloutput .= "
    \n"; + } + + $importlabeloutput .= "
    \n
    ".$clang->gT("Success")."

    \n"; + $importlabeloutput .= "".$clang->gT("Label set import summary")."
    \n"; + $importlabeloutput .= "
      \n\t
    • ".$clang->gT("Label sets").": {$aImportResults['labelsets']}
    • \n"; + $importlabeloutput .= "\t
    • ".$clang->gT("Labels").": {$aImportResults['labels']}
    \n"; + $importlabeloutput .= "

    ".$clang->gT("Import of label set(s) is completed.")."

    \n"; + + } + $importlabeloutput .= "\n"; + $importlabeloutput .= "


    \n"; } -$importlabeloutput .= "
    \n
    ".$clang->gT("Success")."

    \n"; -$importlabeloutput .= "".$clang->gT("Label set import summary")."
    \n"; -$importlabeloutput .= "
      \n\t
    • ".$clang->gT("Label sets").": {$aImportResults['labelsets']}
    • \n"; -$importlabeloutput .= "\t
    • ".$clang->gT("Labels").": {$aImportResults['labels']}
    \n"; -$importlabeloutput .= "

    ".$clang->gT("Import of label set(s) is completed.")."

    \n"; -$importlabeloutput .= "\n"; -$importlabeloutput .= "
    \n"; -} - - -$importlabeloutput .= "
    \n

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

    \n"; -$importlabeloutput .= "".$clang->gT("Label set import summary")."
    \n"; -$importlabeloutput .= "
      \n\t
    • ".$clang->gT("Label sets").": {$aImportResults['labelsets']}
    • \n"; -$importlabeloutput .= "\t
    • ".$clang->gT("Labels").": {$aImportResults['labels']}
    \n"; -$importlabeloutput .= "

    ".$clang->gT("Import of label set(s) is completed.")."

    \n"; -$importlabeloutput .= "\n"; -$importlabeloutput .= "
    \n"; - - // IF WE GOT THIS FAR, THEN THE FILE HAS BEEN UPLOADED SUCCESFULLY function CSVImportLabelset($sFullFilepath, $options) @@ -110,7 +109,8 @@ function CSVImportLabelset($sFullFilepath, $options) fclose($handle); if (substr($bigarray[0], 0, 27) != "# LimeSurvey Label Set Dump" && substr($bigarray[0], 0, 28) != "# PHPSurveyor Label Set Dump") { - return $results['fatalerror']=$clang->gT("This file is not a LimeSurvey label set file. Import failed."); + $results['fatalerror']=$clang->gT("This file is not a LimeSurvey label set file. Import failed."); + return $results; } for ($i=0; $i<9; $i++) //skipping the first lines that are not needed @@ -178,7 +178,7 @@ function CSVImportLabelset($sFullFilepath, $options) $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly $lsainsert = "insert INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix $lsiresult=$connect->Execute($lsainsert); - $results['labelsets']++; + $results['labelsets']++; // Get the new insert id for the labels inside this labelset $newlid=$connect->Insert_ID("{$dbprefix}labelsets",'lid'); @@ -193,7 +193,7 @@ function CSVImportLabelset($sFullFilepath, $options) // Combine into one array with keys and values since its easier to handle $labelrowdata=array_combine($lfieldorders,$lfieldcontents); $labellid=$labelrowdata['lid']; - + if ($labellid == $oldlid) { $labelrowdata['lid']=$newlid; @@ -251,7 +251,7 @@ function CSVImportLabelset($sFullFilepath, $options) $result=$connect->Execute($query) or safe_die("Couldn't delete labelset
    $query
    ".$connect->ErrorMsg()); $newlid=$lsmatch; $results['warnings'][]=$clang->gT("Label set was not imported because the same label set already exists.")." ".sprintf($clang->gT("Existing LID: %s"),$newlid); - + } //END CHECK FOR DUPLICATES } @@ -265,23 +265,23 @@ function CSVImportLabelset($sFullFilepath, $options) function XMLImportLabelsets($sFullFilepath, $options) { global $connect, $dbprefix, $clang; - - $xml = simplexml_load_file($sFullFilepath); + + $xml = simplexml_load_file($sFullFilepath); if ($xml->LimeSurveyDocType!='Label set') safe_die('This is not a valid LimeSurvey label set structure XML file.'); - $dbversion = (int) $xml->DBVersion; + $dbversion = (float) $xml->DBVersion; $csarray=buildLabelSetCheckSumArray(); - $aLSIDReplacements=array(); + $aLSIDReplacements=array(); $results['labelsets']=0; $results['labels']=0; $results['warnings']=array(); - - + + // Import labels table =================================================================================== $tablename=$dbprefix.'labelsets'; foreach ($xml->labelsets->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -289,32 +289,33 @@ function XMLImportLabelsets($sFullFilepath, $options) $oldlsid=$insertdata['lid']; unset($insertdata['lid']); // save the old qid - // Insert the new question - $query=$connect->GetInsertSQL($tablename,$insertdata); + // Insert the new question + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $results['labelsets']++; $newlsid=$connect->Insert_ID($tablename,"lid"); // save this for later $aLSIDReplacements[$oldlsid]=$newlsid; // add old and new lsid to the mapping array } - - + + // Import labels table =================================================================================== $tablename=$dbprefix.'labels'; + if (isset($xml->labels->rows->row)) foreach ($xml->labels->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; } $insertdata['lid']=$aLSIDReplacements[$insertdata['lid']]; - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
    {$query}
    \n".$connect->ErrorMsg()); $results['labels']++; } - + //CHECK FOR DUPLICATE LABELSETS if (isset($_POST['checkforduplicates'])) @@ -356,12 +357,12 @@ function XMLImportLabelsets($sFullFilepath, $options) $results['labelsets']--; $newlid=$lsmatch; $results['warnings'][]=$clang->gT("Label set was not imported because the same label set already exists.")." ".sprintf($clang->gT("Existing LID: %s"),$newlid); - + } } //END CHECK FOR DUPLICATES - } + } return $results; } -// Closing PHP tag intentionall left out \ No newline at end of file +// Closing PHP tag intentionall left out diff --git a/include/limesurvey/admin/importoldresponses.php b/include/limesurvey/admin/importoldresponses.php index 7bd5393b..1d1c7dfc 100644 --- a/include/limesurvey/admin/importoldresponses.php +++ b/include/limesurvey/admin/importoldresponses.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: importoldresponses.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: importoldresponses.php 11664 2011-12-16 05:19:42Z tmswhite $ */ @@ -50,7 +50,7 @@ if (!$subaction == "import")

    ".$clang->gT("Import responses from a deactivated survey table")."
    - +
    • $surveyid @@ -89,9 +89,9 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable)) ); - $aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true)); - $aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true)); - + $aFieldsOldTable=array_values($connect->MetaColumnNames($oldtable, true)); + $aFieldsNewTable=array_values($connect->MetaColumnNames($activetable, true)); + // Only import fields where the fieldnames are matching $aValidFields=array_intersect($aFieldsOldTable,$aFieldsNewTable); @@ -113,17 +113,17 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable)) $aSRIDConversions[$iOldID]=$connect->Insert_Id($activetable,"id"); } - $_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount); + $_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) were successfully imported."),$iRecordCount); $sOldTimingsTable=substr($oldtable,0,strrpos($oldtable,'_')).'_timings'.substr($oldtable,strrpos($oldtable,'_')); $sNewTimingsTable=db_table_name_nq("survey_{$surveyid}_timings"); if (tableExists(sStripDBPrefix($sOldTimingsTable)) && tableExists(sStripDBPrefix($sNewTimingsTable)) && returnglobal('importtimings')=='Y') { // Import timings - $aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true)); - $aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true)); + $aFieldsOldTimingTable=array_values($connect->MetaColumnNames($sOldTimingsTable, true)); + $aFieldsNewTimingTable=array_values($connect->MetaColumnNames($sNewTimingsTable, true)); $aValidTimingFields=array_intersect($aFieldsOldTimingTable,$aFieldsNewTimingTable); - + $queryOldValues = "SELECT ".implode(", ",$aValidTimingFields)." FROM {$sOldTimingsTable} "; $resultOldValues = db_execute_assoc($queryOldValues) or safe_die("Error:
      $queryOldValues
      ".$connect->ErrorMsg()); $iRecordCountT=$resultOldValues->RecordCount(); @@ -132,12 +132,12 @@ elseif (isset($surveyid) && $surveyid && isset($oldtable)) { if (isset($aSRIDConversions[$row['id']])) { - $row['id']=$aSRIDConversions[$row['id']]; + $row['id']=$aSRIDConversions[$row['id']]; } $sInsertSQL="INSERT into {$sNewTimingsTable} (".implode(",",array_map("db_quote_id",array_keys($row))).") VALUES (".implode(",",array_map("db_quoteall",array_values($row))).")"; $result = $connect->Execute($sInsertSQL) or safe_die("Error:
      $sInsertSQL
      ".$connect->ErrorMsg()); } - $_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT); + $_SESSION['flashmessage'] = sprintf($clang->gT("%s old response(s) and according timings were successfully imported."),$iRecordCount,$iRecordCountT); } $importoldresponsesoutput = browsemenubar($clang->gT("Quick statistics")); } diff --git a/include/limesurvey/admin/importquestion.php b/include/limesurvey/admin/importquestion.php index d6873b4e..f67f2a3f 100644 --- a/include/limesurvey/admin/importquestion.php +++ b/include/limesurvey/admin/importquestion.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: importquestion.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: importquestion.php 11664 2011-12-16 05:19:42Z tmswhite $ */ //Ensure script is not run directly, avoid path disclosure @@ -21,7 +21,7 @@ $importquestion .= "
      \n"; $sFullFilepath = $tempdir . DIRECTORY_SEPARATOR . $_FILES['the_file']['name']; $aPathInfo = pathinfo($sFullFilepath); -$sExtension = $aPathInfo['extension']; +$sExtension = $aPathInfo['extension']; if (!@move_uploaded_file($_FILES['the_file']['tmp_name'], $sFullFilepath)) { @@ -105,7 +105,7 @@ unlink($sFullFilepath); /** * This function imports an old-school question file (*.csv,*.sql) -* +* * @param mixed $sFullFilepath Full file patch to the import file * @param mixed $newsid Survey ID to which the question is attached * @param mixed $newgid Group ID top which the question is attached @@ -115,10 +115,10 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) global $dbprefix, $connect, $clang; $aLIDReplacements=array(); $aQIDReplacements=array(); // this array will have the "new qid" for the questions, the key will be the "old qid" - $aSQIDReplacements=array(); + $aSQIDReplacements=array(); $results['labelsets']=0; $results['labels']=0; - + $handle = fopen($sFullFilepath, "r"); while (!feof($handle)) { @@ -141,7 +141,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $results['fatalerror'] = $clang->gT("This file is not a LimeSurvey question file. Import failed."); return $results; } - + if ((int)$importversion<112) { $results['fatalerror'] = $clang->gT("This file is too old. Only files from LimeSurvey version 1.50 (DBVersion 112) and newer are supported."); @@ -270,7 +270,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) // Let's check that imported objects support at least the survey's baselang - + if (isset($questionarray)) { $langfieldnum = array_search("language", $questionfieldnames); @@ -294,9 +294,9 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) { $results['fatalerror']=$clang->gT("You can't import answers which doesn't support at least the survey base language."); return $results; - + } - + } if ($countlabelsets > 0) @@ -374,7 +374,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $query2 = "SELECT code, title, sortorder, language, assessment_value FROM {$dbprefix}labels WHERE lid=".$newlid." - ORDER BY language, sortorder, code"; + ORDER BY language, sortorder, code"; $result2 = db_execute_num($query2) or safe_die("Died querying labelset $lid
      $query2
      ".$connect->ErrorMsg()); while($row2=$result2->FetchRow()) { @@ -423,16 +423,16 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) { $newquestionorder=0; } - else + else { $newquestionorder++; } - foreach ($questionarray as $qa) + foreach ($questionarray as $qa) { $qacfieldcontents=convertCSVRowToArray($qa,',','"'); $questionrowdata=array_combine($questionfieldnames,$qacfieldcontents); - + // Skip not supported languages if (!in_array($questionrowdata['language'],$aLanguagesSupported)) continue; @@ -467,7 +467,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $oldquestion['lid2']=(int)$questionrowdata['lid1']; } $oldquestion['oldtype']=$questionrowdata['type']; - + // Unset label set IDs and convert question types unset($questionrowdata['lid']); unset($questionrowdata['lid1']); @@ -478,16 +478,16 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) elseif ($questionrowdata['type']=='Z') { $questionrowdata['type']='L'; - } + } $oldquestion['newtype']=$questionrowdata['type']; - + $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); // translate internal links $questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']); $questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']); $questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']); - + $newvalues=array_values($questionrowdata); $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly $qinsert = "INSERT INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")"; @@ -502,13 +502,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) { db_switchIDInsert('questions',false); } - + } - $qtypes = getqtypelist("" ,"array"); + $qtypes = getqtypelist("" ,"array"); $results['answers']=0; $results['subquestions']=0; - - + + // Now we will fix up old label sets where they are used as answers if ((isset($oldquestion['lid1']) || isset($oldquestion['lid2'])) && ($qtypes[$oldquestion['newtype']]['answerscales']>0 || $qtypes[$oldquestion['newtype']]['subquestions']>1)) { @@ -517,13 +517,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) while($labelrow=$oldlabelsresult->FetchRow()) { if (in_array($labelrow['language'],$aLanguagesSupported)){ - + if ($qtypes[$oldquestion['newtype']]['subquestions']<2) { $qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id) - VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",0)"; + VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",0)"; $qres = $connect->Execute($qinsert) or safe_die ("Error: Failed to insert answer
      \n$qinsert
      \n".$connect->ErrorMsg()); - $results['answers']++; + $results['answers']++; } else { @@ -531,28 +531,28 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $fieldname='qid,'; $data=$aSQIDReplacements[$labelrow['code']].','; db_switchIDInsert('questions',true); - } + } else{ $fieldname='' ; $data=''; } - + $qinsert = "insert INTO ".db_table_name('questions')." ($fieldname sid,gid,parent_qid,title,question,question_order,language,scale_id,type) - VALUES ($data $newsid,$newgid,$newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,".db_quoteall($oldquestion['newtype']).")"; + VALUES ($data $newsid,$newgid,$newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",1,".db_quoteall($oldquestion['newtype']).")"; $qres = $connect->Execute($qinsert) or safe_die ("Error: Failed to insert subquestion
      \n$qinsert
      \n".$connect->ErrorMsg()); if ($fieldname=='') { - $aSQIDReplacements[$labelrow['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $aSQIDReplacements[$labelrow['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); } else - { + { db_switchIDInsert('questions',false); } - + } } } - + if (isset($oldquestion['lid2']) && $qtypes[$oldquestion['newtype']]['answerscales']>1) { $query="select * from ".db_table_name('labels')." where lid={$aLIDReplacements[$oldquestion['lid2']]}"; @@ -561,17 +561,17 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) { if (in_array($labelrow['language'],$aLanguagesSupported)){ $qinsert = "insert INTO ".db_table_name('answers')." (qid,code,answer,sortorder,language,assessment_value,scale_id) - VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)"; + VALUES ($newqid,".db_quoteall($labelrow['code']).",".db_quoteall($labelrow['title']).",".db_quoteall($labelrow['sortorder']).",".db_quoteall($labelrow['language']).",".db_quoteall($labelrow['assessment_value']).",1)"; $qres = $connect->Execute($qinsert) or safe_die ($clang->gT("Error").": Failed to insert answer
      \n$qinsert
      \n".$connect->ErrorMsg()); } } } - } + } //Do answers - if (isset($answerarray) && $answerarray) + if (isset($answerarray) && $answerarray) { - foreach ($answerarray as $aa) + foreach ($answerarray as $aa) { $answerfieldcontents=convertCSVRowToArray($aa,',','"'); $answerrowdata=array_combine($answerfieldnames,$answerfieldcontents); @@ -581,7 +581,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) } // Skip not supported languages if (!in_array($answerrowdata['language'],$aLanguagesSupported)) - continue; + continue; $code=$answerrowdata["code"]; $thisqid=$answerrowdata["qid"]; $answerrowdata["qid"]=$newqid; @@ -594,14 +594,14 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) // Convert default values for single select questions if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='L' || $oldquestion['newtype']=='O' || $oldquestion['newtype']=='!')) - { - $insertdata=array(); + { + $insertdata=array(); $insertdata['qid']=$newqid; $insertdata['language']=$answerrowdata['language']; - $insertdata['defaultvalue']=$answerrowdata['answer']; - $query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata); + $insertdata['defaultvalue']=$answerrowdata['answer']; + $query=$connect->GetInsertSQL($dbprefix.'defaultvalues',$insertdata); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue
      {$query}
      \n".$connect->ErrorMsg()); - + } // translate internal links $answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']); @@ -614,7 +614,7 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) if (isset($aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']])){ $questionrowdata['qid']=$aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]; db_switchIDInsert('questions',true); - } + } $questionrowdata['parent_qid']=$answerrowdata['qid']; $questionrowdata['sid']=$newsid; $questionrowdata['gid']=$newgid; @@ -623,13 +623,13 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $questionrowdata['question_order']=$answerrowdata['sortorder']; $questionrowdata['language']=$answerrowdata['language']; $questionrowdata['type']=$oldquestion['newtype']; - - $tablename=$dbprefix.'questions'; - $query=$connect->GetInsertSQL($tablename,$questionrowdata); + + $tablename=$dbprefix.'questions'; + $query=$connect->GetInsertSQL($tablename,$questionrowdata); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert question
      {$query}
      \n".$connect->ErrorMsg()); if (!isset($questionrowdata['qid'])) { - $aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $aSQIDReplacements[$answerrowdata['code'].$answerrowdata['qid']]=$connect->Insert_ID("{$dbprefix}questions","qid"); } else { @@ -638,32 +638,32 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $results['subquestions']++; // also convert default values subquestions for multiple choice if ($answerrowdata['default_value']=='Y' && ($oldquestion['newtype']=='M' || $oldquestion['newtype']=='P')) - { - $insertdata=array(); + { + $insertdata=array(); $insertdata['qid']=$newqid; $insertdata['sqid']=$aSQIDReplacements[$answerrowdata['code']]; $insertdata['language']=$answerrowdata['language']; $insertdata['defaultvalue']='Y'; - $tablename=$dbprefix.'defaultvalues'; - $query=$connect->GetInsertSQL($tablename,$insertdata); + $tablename=$dbprefix.'defaultvalues'; + $query=$connect->GetInsertSQL($tablename,$insertdata); $qres = $connect->Execute($query) or safe_die ("Error: Failed to insert defaultvalue
      {$query}
      \n".$connect->ErrorMsg()); } - + } else // insert answers { unset($answerrowdata['default_value']); - $tablename=$dbprefix.'answers'; - $query=$connect->GetInsertSQL($tablename,$answerrowdata); + $tablename=$dbprefix.'answers'; + $query=$connect->GetInsertSQL($tablename,$answerrowdata); $ares = $connect->Execute($query) or safe_die ("Error: Failed to insert answer
      {$query}
      \n".$connect->ErrorMsg()); - $results['answers']++; + $results['answers']++; } } } - + $results['question_attributes']=0; // Finally the question attributes - it is called just once and only if there was a question - if (isset($question_attributesarray) && $question_attributesarray) + if (isset($question_attributesarray) && $question_attributesarray) {//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES $fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"'); unset($question_attributesarray[0]); @@ -677,24 +677,26 @@ function CSVImportQuestion($sFullFilepath, $newsid, $newgid) $qainsert=$connect->GetInsertSQL($tablename,$qarowdata); $result=$connect->Execute($qainsert) or safe_die ("Couldn't insert question_attribute
      $qainsert
      ".$connect->ErrorMsg()); $results['question_attributes']++; - + } } } + LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting + $results['newqid']=$newqid; $results['questions']=1; $results['newqid']=$newqid; - return $results; + return $results; } /** * This function imports a LimeSurvey .lsq question XML file -* +* * @param mixed $sFullFilepath The full filepath of the uploaded file -* @param mixed $newsid The new survey id +* @param mixed $newsid The new survey id * @param mixed $newgid The new question group id -the question will always be added after the last question in the group */ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) @@ -705,22 +707,22 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $sBaseLanguage = GetBaseLanguageFromSurveyID($newsid); $aLanguagesSupported[]=$sBaseLanguage; // adds the base language to the list of supported languages $aLanguagesSupported=array_merge($aLanguagesSupported,GetAdditionalLanguagesFromSurveyID($newsid)); - - $xml = simplexml_load_file($sFullFilepath); + + $xml = simplexml_load_file($sFullFilepath); if ($xml->LimeSurveyDocType!='Question') safe_die('This is not a valid LimeSurvey question structure XML file.'); - $dbversion = (int) $xml->DBVersion; - $aQIDReplacements=array(); + $dbversion = (float) $xml->DBVersion; + $aQIDReplacements=array(); $aSQIDReplacements=array(0=>0); $results['defaultvalues']=0; $results['answers']=0; $results['question_attributes']=0; $results['subquestions']=0; - + $importlanguages=array(); foreach ($xml->languages->language as $language) { $importlanguages[]=(string)$language; - } + } if (!in_array($sBaseLanguage,$importlanguages)) { @@ -734,8 +736,8 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) { $fieldnames[]=(string)$fieldname; };*/ - - + + // Import questions table =================================================================================== // We have to run the question table data two times - first to find all main questions @@ -751,7 +753,7 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) } foreach ($xml->questions->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -766,13 +768,13 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $insertdata['title']=translink('survey', $oldsid, $newsid, $insertdata['title']); $insertdata['question']=translink('survey', $oldsid, $newsid, $insertdata['question']); $insertdata['help']=translink('survey', $oldsid, $newsid, $insertdata['help']); - // Insert the new question + // Insert the new question if (isset($aQIDReplacements[$oldqid])) { - $insertdata['qid']=$aQIDReplacements[$oldqid]; + $insertdata['qid']=$aQIDReplacements[$oldqid]; db_switchIDInsert('questions',true); - } - $query=$connect->GetInsertSQL($tablename,$insertdata); + } + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
      {$query}
      \n".$connect->ErrorMsg()); if (!isset($aQIDReplacements[$oldqid])) { @@ -788,10 +790,10 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) // Import subquestions -------------------------------------------------------------- if (isset($xml->subquestions)) { - + foreach ($xml->subquestions->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -809,13 +811,13 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $insertdata['qid']=$aQIDReplacements[$oldsqid]; db_switchIDInsert('questions',true); } - - $query=$connect->GetInsertSQL($tablename,$insertdata); + + $query=$connect->GetInsertSQL($tablename,$insertdata); $result = $connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
      {$query}
      \n".$connect->ErrorMsg()); $newsqid=$connect->Insert_ID($tablename,"qid"); // save this for later if (!isset($insertdata['qid'])) { - $aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array + $aQIDReplacements[$oldsqid]=$newsqid; // add old and new qid to the mapping array } else { @@ -828,10 +830,10 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) if(isset($xml->answers)) { $tablename=$dbprefix.'answers'; - + foreach ($xml->answers->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -839,21 +841,21 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $insertdata['qid']=$aQIDReplacements[(int)$insertdata['qid']]; // remap the parent_qid // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
      {$query}
      \n".$connect->ErrorMsg()); $results['answers']++; - } } - + } + // Import questionattributes -------------------------------------------------------------- if(isset($xml->question_attributes)) { $tablename=$dbprefix.'question_attributes'; - + foreach ($xml->question_attributes->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -862,22 +864,22 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $insertdata['qid']=$aQIDReplacements[(integer)$insertdata['qid']]; // remap the parent_qid // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
      {$query}
      \n".$connect->ErrorMsg()); $results['question_attributes']++; - } } - - + } + + // Import defaultvalues -------------------------------------------------------------- if(isset($xml->defaultvalues)) { $tablename=$dbprefix.'defaultvalues'; - + $results['defaultvalues']=0; foreach ($xml->defaultvalues->rows->row as $row) { - $insertdata=array(); + $insertdata=array(); foreach ($row as $key=>$value) { $insertdata[(string)$key]=(string)$value; @@ -886,12 +888,14 @@ function XMLImportQuestion($sFullFilepath, $newsid, $newgid) $insertdata['sqid']=$aSQIDReplacements[(int)$insertdata['sqid']]; // remap the subquestion id // now translate any links - $query=$connect->GetInsertSQL($tablename,$insertdata); + $query=$connect->GetInsertSQL($tablename,$insertdata); $result=$connect->Execute($query) or safe_die ($clang->gT("Error").": Failed to insert data
      \$query
      \n".$connect->ErrorMsg()); $results['defaultvalues']++; - } } - + } + + LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting + $results['newqid']=$newqid; $results['questions']=1; $results['labelsets']=0; diff --git a/include/limesurvey/admin/importsurvey.php b/include/limesurvey/admin/importsurvey.php index 7733af8d..743dc526 100644 --- a/include/limesurvey/admin/importsurvey.php +++ b/include/limesurvey/admin/importsurvey.php @@ -10,15 +10,13 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: importsurvey.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: importsurvey.php 11607 2011-12-06 23:19:52Z tmswhite $ */ //Ensure script is not run directly, avoid path disclosure //importsurvey.php should be called from cmdline_importsurvey.php or http_importsurvey.php, they set the $importingfrom variable -if ((!isset($importingfrom) && !isset($copyfunction)) || isset($_REQUEST['importingfrom'])) -{ - die("Cannot run this script directly"); -} +if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {safe_die("Cannot run this script directly");} + require_once('import_functions.php'); if (!isset($copyfunction)) @@ -27,8 +25,8 @@ if (!isset($copyfunction)) $aPathInfo = pathinfo($sFullFilepath); $sExtension = $aPathInfo['extension']; } - -$bImportFailed=false; + +$bImportFailed=false; if (isset($sExtension) && strtolower($sExtension)=='csv') { $aImportResults=CSVImportSurvey($sFullFilepath); @@ -46,18 +44,18 @@ else } // Create old fieldnames - - + + if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || isset($copyfunction)) { $importsurvey .= "
      \n
      ".$clang->gT("Success")."


      \n"; if (isset($copyfunction)) { - $importsurvey .= "".$clang->gT("Survey copy summary")."
      \n"; + $importsurvey .= "".$clang->gT("Survey copy summary")."
      \n"; } else { - $importsurvey .= "".$clang->gT("Survey import summary")."
      \n"; - } + $importsurvey .= "".$clang->gT("Survey import summary")."
      \n"; + } $importsurvey .= "
        \n\t
      • ".$clang->gT("Surveys").": {$aImportResults['surveys']}
      • \n"; $importsurvey .= "\t
      • ".$clang->gT("Languages").": {$aImportResults['languages']}
      • \n"; $importsurvey .= "\t
      • ".$clang->gT("Question groups").": {$aImportResults['groups']}
      • \n"; @@ -65,15 +63,15 @@ if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || is $importsurvey .= "\t
      • ".$clang->gT("Answers").": {$aImportResults['answers']}
      • \n"; if (isset($aImportResults['subquestions'])) { - $importsurvey .= "\t
      • ".$clang->gT("Subquestions").": {$aImportResults['subquestions']}
      • \n"; + $importsurvey .= "\t
      • ".$clang->gT("Subquestions").": {$aImportResults['subquestions']}
      • \n"; } if (isset($aImportResults['defaultvalues'])) { - $importsurvey .= "\t
      • ".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}
      • \n"; + $importsurvey .= "\t
      • ".$clang->gT("Default answers").": {$aImportResults['defaultvalues']}
      • \n"; } if (isset($aImportResults['conditions'])) { - $importsurvey .= "\t
      • ".$clang->gT("Conditions").": {$aImportResults['conditions']}
      • \n"; + $importsurvey .= "\t
      • ".$clang->gT("Conditions").": {$aImportResults['conditions']}
      • \n"; } if (isset($aImportResults['labelsets'])) { @@ -86,7 +84,7 @@ if ((!$bImportFailed && isset($importingfrom) && $importingfrom == "http") || is $importsurvey .= "\t
      • ".$clang->gT("Question attributes").": {$aImportResults['question_attributes']}
      • \n"; $importsurvey .= "\t
      • ".$clang->gT("Assessments").": {$aImportResults['assessments']}
      • \n"; $importsurvey .= "\t
      • ".$clang->gT("Quotas").": {$aImportResults['quota']} ({$aImportResults['quotamembers']} ".$clang->gT("quota members")." ".$clang->gT("and")." {$aImportResults['quotals']} ".$clang->gT("quota language settings").")
      • \n

      \n"; - if (count($aImportResults['importwarnings'])>0) + if (count($aImportResults['importwarnings'])>0) { $importsurvey .= "
      ".$clang->gT("Warnings").":

      \n"; if (!isset($copyfunction)) { - unlink($sFullFilepath); + unlink($sFullFilepath); } } elseif (isset($bImportFailed) && $bImportFailed==true) { echo "\n".$clang->gT("Error")."\n\n"; echo $clang->gT("Import failed. You specified an invalid file.")."\n"; - + } else { @@ -130,15 +128,15 @@ else echo $clang->gT("Answers").": {$aImportResults['answers']}\n"; if (isset($aImportResults['subquestions'])) { - echo $clang->gT("Subquestions").": {$aImportResults['subquestions']}\n"; + echo $clang->gT("Subquestions").": {$aImportResults['subquestions']}\n"; } if (isset($aImportResults['defaultvalues'])) { - echo $clang->gT("Default answers").": {$aImportResults['defaultvalues']}\n"; + echo $clang->gT("Default answers").": {$aImportResults['defaultvalues']}\n"; } if (isset($aImportResults['conditions'])) { - echo $clang->gT("Conditions").": {$aImportResults['conditions']}\n"; + echo $clang->gT("Conditions").": {$aImportResults['conditions']}\n"; } if (isset($aImportResults['labelsets'])) { diff --git a/include/limesurvey/admin/integritycheck.php b/include/limesurvey/admin/integritycheck.php index dee6053f..d9f04b70 100644 --- a/include/limesurvey/admin/integritycheck.php +++ b/include/limesurvey/admin/integritycheck.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: integritycheck.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: integritycheck.php 11664 2011-12-16 05:19:42Z tmswhite $ */ @@ -44,7 +44,7 @@ if($_SESSION['USER_RIGHT_CONFIGURATOR'] == 1) while ($aRow=$aResult->FetchRow()) { $tablename=substr($aRow[0],strlen($dbprefix)); - if ($tablename=='survey_permissions') continue; + if ($tablename=='survey_permissions' || $tablename=='survey_links') continue; $iSurveyID=substr($tablename,strpos($tablename,'_')+1); $qquery="SELECT sid FROM {$dbprefix}surveys WHERE sid='{$iSurveyID}'"; $qresult=$connect->Execute($qquery) or safe_die ("Couldn't check questions table for qids
      $qquery
      ".$connect->ErrorMsg()); diff --git a/include/limesurvey/admin/iterate_survey.php b/include/limesurvey/admin/iterate_survey.php index a0689b6c..30e456a1 100644 --- a/include/limesurvey/admin/iterate_survey.php +++ b/include/limesurvey/admin/iterate_survey.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: iterate_survey.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: iterate_survey.php 11664 2011-12-16 05:19:42Z tmswhite $ */ /* * Set completed answers to the incomplete state and reset the tokens to 'not used' so that @@ -54,13 +54,12 @@ if ($subaction=='unfinalizeanswers') $updateqr = "UPDATE $surveytable SET submitdate=NULL, lastpage=NULL;\n"; $updateres = $connect->Execute($updateqr) or safe_die("UnFinilize answers failed:
      \n" . $connect->ErrorMsg() . "
      $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', usesleft=1"; + $updateqr="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0, completed='N', usesleft=1 where usesleft=0"; $updateres=$connect->Execute($updateqr) or safe_die ("Couldn't reset token completed state
      $updateqr
      ".$connect->ErrorMsg()); $iteratesurveyoutput .= "
      \n"; $iteratesurveyoutput .= "
      ".$clang->gT("Iterate survey")."
      \n"; - $iteratesurveyoutput .= "

      \n" + $iteratesurveyoutput .= "

      \n" . "".$clang->gT("Success")."
      \n" . $clang->gT("Answers and tokens have been re-opened.")."
      \n" - . "

      \n" - . "\n" - ."\t\n" - ."\n"; - } - unset($_SESSION['nextlabelcode']); $first=false; - $tab_content[$i].="
      "; + . "

      \n"; } diff --git a/include/limesurvey/admin/labels.php b/include/limesurvey/admin/labels.php index 96d7ccb0..1913c64b 100644 --- a/include/limesurvey/admin/labels.php +++ b/include/limesurvey/admin/labels.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: labels.php 10934 2011-09-02 22:12:07Z c_schmitz $ + * $Id: labels.php 11675 2011-12-18 02:27:59Z tmswhite $ */ include_once("login_check.php"); //Login Check dies also if the script is started directly @@ -40,7 +40,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL //DO DATABASE UPDATESTUFF if ($action == "updateset") {updateset($lid);} if ($action == "insertlabelset") {$lid=insertlabelset();} - if ($action == "modlabelsetanswers") {modlabelsetanswers($lid);} + if (($action == "modlabelsetanswers")||($action == "ajaxmodlabelsetanswers")) {modlabelsetanswers($lid);} if ($action == "deletelabelset") {if (deletelabelset($lid)) {$lid=0;}} if ($action == "importlabels") { @@ -155,7 +155,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL ."\n"; if ($action == "newlabelset") {$labelsoutput.= $clang->gT("Create or import new label set(s)"); $langids=$_SESSION['adminlang']; $tabitem=$clang->gT("Create New Label Set");} - else {$labelsoutput.= $clang->gT("Edit label set"); $tabitem=$clang->gT("Edit label set");} + else {$labelsoutput.= $clang->gT("Edit Label Set"); $tabitem=$clang->gT("Edit label set");} $langidsarray=explode(" ",trim($langids)); //Make an array of it $labelsoutput.= "\n\t\n"; @@ -272,7 +272,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL "".$clang->gT("Export this label set")."" ."\t\n" ."\t\n" ."\t\n" @@ -283,6 +283,7 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL //LABEL ANSWERS - SHOW THE MASK FOR EDITING THE LABELS + $js_admin_includes[]='scripts/updateset.js'; $qulabelset = "SELECT * FROM ".db_table_name('labelsets')." WHERE lid=$lid"; $rslabelset = db_execute_assoc($qulabelset) or safe_die($connect->ErrorMsg()); @@ -296,9 +297,9 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL $msorow=$maxresult->FetchRow(); $maxsortorder=$msorow['maxsortorder']+1; - // KP + // labels table $labelsoutput.= "\t
      ".$clang->gT("Labels")."\t
      \n"; - $labelsoutput.= "gT("Error: You are trying to use duplicate label codes.",'js')."','".$clang->gT("Error: 'other' is a reserved keyword.",'js')."');\">\n" + $labelsoutput.= "gT("Error: You are trying to use duplicate label codes.",'js')."','".$clang->gT("Error: 'other' is a reserved keyword.",'js')."');\">\n" ."\n" ."\n" ."\n"; @@ -312,145 +313,82 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); $labelcount = $result->RecordCount(); $tab_title[$i] = getLanguageNameFromCode($lslanguage,false); - $tab_content[$i] = "\n" - ."" - ."\n" - ."\t\n"; - $tab_content[$i].="'; - $tab_content[$i].="\t\n" - ."\t\n" - ."\t\n" - ."" - .""; + + $tab_content[$i] = " + +
      \n" - .$clang->gT("Code") - ."\t".$clang->gT("Assessment value").'\n" - .$clang->gT("Title") - ."\t\n" - .$clang->gT("Action") - ."\t\n" - .$clang->gT("Order") - ."\t
      + + "; + + if ($first) + $tab_content[$i] .= ""; + + $tab_content[$i] .= " + + "; + + if ($first) + $tab_content[$i] .= ""; + + $tab_content[$i] .= " + + + "; + $alternate=false; while ($row=$result->FetchRow()) { $sortorderids=$sortorderids.' '.$row['language'].'_'.$row['sortorder']; if ($first) {$codeids=$codeids.' '.$row['sortorder'];} - $tab_content[$i].= "\n"; - $tab_content[$i].= "\t\n"; - } + $tab_content[$i].= " + + + + "; + $tab_content[$i].= " + "; + if ($first) + $tab_content[$i] .= " + + "; - $tab_content[$i].= "\t\n" - ."\t\n" - ."\t\n" - ."\t\n" - ."\t\n"; $position++; } - if ($labelcount>0) - { - $tab_content[$i].= "\t\n"; - } - $position=sprintf("%05d", $position); - if (!isset($_SESSION['nextlabelcode'])) $_SESSION['nextlabelcode']=''; - if ($first) - { $tab_content[$i].= "\n" - ."\n" - ."\t\n" - ."\t\n" - ."\n"; + $tab_content[$i] .= "
       {$clang->gT("Code")}{$clang->gT("Assessment value")}{$clang->gT("Title")}{$clang->gT("Action")}
      + + + + + + " + .getEditor("editlabel", "title_{$row['language']}_{$row['sortorder']}", "[".$clang->gT("Label:", "js")."](".$row['language'].")",'','','',$action) + ." + +
      \n"; - if ($first) - { - $tab_content[$i].= "\t"; - } - else - { - $tab_content[$i].= $row['assessment_value']; - - } - $tab_content[$i].= "\t\n" - ."\t\n" - . getEditor("editlabel", "title_{$row['language']}_{$row['sortorder']}", "[".$clang->gT("Label:", "js")."](".$row['language'].")",'','','',$action) - ."\t\n"; - $tab_content[$i].= "\t\n"; - - $tab_content[$i].= "\t\n"; - if ($position > 0) - { - $tab_content[$i].= "\t\n"; - }; - if ($position < $labelcount-1) - { - // Fill the sortorder hiddenfield so we know what field is moved down - $tab_content[$i].= "\t\n"; - } - $tab_content[$i].= "\t
      " - ."

      " - ."\n" - ."\n" - ."".$clang->gT("New label").": \n" - ."\t" - ."" - ."\t\n" - ."\t\n" - . getEditor("addlabel", "inserttitle", "[".$clang->gT("Label:", "js")."](".$lslanguage.")",'','','',$action) - ."\t\n" - ."\t\n" - ."\n" - ."\t
      "; + + $tab_content[$i] .= ""; + + $tab_content[$i].= "

      "; - } - else - { - $tab_content[$i].= "
      \n" - ."" - .$clang->gT("Note: Inserting new labels must be done on the first language tab.")."\n" - ."\t
      \n"; $i++; } @@ -466,6 +404,8 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL $labelsoutput .= "
      $eachcontent
      "; } $labelsoutput .=""; + + $disabledIfNoResources = ''; if (hasResources($lid,'label') === false) { @@ -495,6 +435,14 @@ if($_SESSION['USER_RIGHT_SUPERADMIN'] == 1 || $_SESSION['USER_RIGHT_MANAGE_LABEL $labelsoutput .= ""; + $labelsoutput .= "
      + +
      +
      + +
      +
      "; + } } @@ -638,174 +586,100 @@ function insertlabelset() } - - function modlabelsetanswers($lid) { + global $dbprefix, $connect, $clang, $labelsoutput, $databasetype, $filterxsshtml,$postsortorder; - - $qulabelset = "SELECT * FROM ".db_table_name('labelsets')." WHERE lid='$lid'"; - $rslabelset = db_execute_assoc($qulabelset) or safe_die($connect->ErrorMsg()); - $rwlabelset=$rslabelset->FetchRow(); - $lslanguages=explode(" ", trim($rwlabelset['languages'])); - + $ajax = false; + if (isset($_POST['ajax']) && $_POST['ajax'] == "1"){ + $ajax = true; + } if (!isset($_POST['method'])) { $_POST['method'] = $clang->gT("Save"); } - switch($_POST['method']) + + $sPostData=html_entity_decode($_POST['dataToSend'], ENT_QUOTES, "UTF-8"); + $sPostData=str_replace("\t", '', $sPostData); + if (get_magic_quotes_gpc()) { - case $clang->gT("Add new label", "unescaped"): - if (isset($_POST['insertcode']) && $_POST['insertcode']!='') - { - $_SESSION['nextlabelcode']=getNextCode($_POST['insertcode']); - $_POST['insertcode'] = db_quoteall($_POST['insertcode'],true); - // check that the code doesn't exist yet - $query = "SELECT code FROM ".db_table_name('labels')." WHERE lid='$lid' AND code=".$_POST['insertcode']; - $result = $connect->Execute($query); - $codeoccurences=$result->RecordCount(); - if ($codeoccurences == 0) - { - $query = "select max(sortorder) as maxorder from ".db_table_name('labels')." where lid='$lid'"; - $result = $connect->Execute($query); - $newsortorder=sprintf("%05d", $result->fields['maxorder']+1); - if ($filterxsshtml) - { - require_once("../classes/inputfilter/class.inputfilter_clean.php"); - $myFilter = new InputFilter('','',1,1,1); - $_POST['inserttitle']=$myFilter->process($_POST['inserttitle']); - } - else - { - $_POST['inserttitle'] = html_entity_decode($_POST['inserttitle'], ENT_QUOTES, "UTF-8"); - } - - // Fix bug with FCKEditor saving strange BR types - $_POST['inserttitle']=fix_FCKeditor_text($_POST['inserttitle']); - - $_POST['inserttitle'] = db_quoteall($_POST['inserttitle'],true); - $_POST['insertassessmentvalue']=(int)$_POST['insertassessmentvalue']; - foreach ($lslanguages as $lslanguage) - { - db_switchIDInsert('labels',true); - $query = "INSERT INTO ".db_table_name('labels')." (lid, code, title, sortorder,language, assessment_value) VALUES ($lid, {$_POST['insertcode']}, {$_POST['inserttitle']}, '$newsortorder','$lslanguage',{$_POST['insertassessmentvalue']})"; - if (!$result = $connect->Execute($query)) - { - $labelsoutput.= "\n"; - } - db_switchIDInsert('labels',false); - } - } - else - { - $labelsoutput.= "\n"; - } - } - break; - - // Save all labels with one button - case $clang->gT("Save Changes", "unescaped"): - //Determine autoids by evaluating the hidden field - $sortorderids=explode(' ', trim($_POST['sortorderids'])); - $codeids=explode(' ', trim($_POST['codeids'])); - $count=0; - - // Quote each code_codeid first - foreach ($codeids as $codeid) - { - $_POST['code_'.$codeid] = db_quoteall($_POST['code_'.$codeid],true); - if (isset($_POST['oldcode_'.$codeid])) $_POST['oldcode_'.$codeid] = db_quoteall($_POST['oldcode_'.$codeid],true); - // Get the code values to check for duplicates - $codevalues[] = $_POST['code_'.$codeid]; - } - - // Check that there is no code duplicate - if (count(array_unique($codevalues)) == count($codevalues)) - { - if ($filterxsshtml) - { - require_once("../classes/inputfilter/class.inputfilter_clean.php"); - $myFilter = new InputFilter('','',1,1,1); - } - - foreach ($sortorderids as $sortorderid) - { - $orderid=substr($sortorderid,strrpos($sortorderid,'_')+1,20); - foreach ($lslanguages as $langid) - { - $sortorderid = $langid . '_' . $orderid; - if ($filterxsshtml) - { - $_POST['title_'.$sortorderid]=$myFilter->process($_POST['title_'.$sortorderid]); - } - else - { - $_POST['title_'.$sortorderid] = html_entity_decode($_POST['title_'.$sortorderid], ENT_QUOTES, "UTF-8"); - } - - - // Fix bug with FCKEditor saving strange BR types - $_POST['title_'.$sortorderid]=fix_FCKeditor_text($_POST['title_'.$sortorderid]); - $_POST['title_'.$sortorderid] = db_quoteall($_POST['title_'.$sortorderid],true); - - $query = "UPDATE ".db_table_name('labels')." SET code=".$_POST['code_'.$codeids[$count]].", title={$_POST['title_'.$sortorderid]}, assessment_value={$_POST['assessmentvalue_'.$codeids[$count]]} WHERE lid=$lid AND sortorder=$orderid AND language='$langid'"; - - if (!$result = $connect->Execute($query)) - // if update didn't work we assume the label does not exist and insert it - { - - $query = "insert into ".db_table_name('labels')." (code,title,lid,sortorder,language) VALUES (".$_POST['code_'.$codeids[$count]].", {$_POST['title_'.$sortorderid]}, $lid , $orderid , '$langid')"; - if (!$result = $connect->Execute($query)) - { - $labelsoutput.= "\n"; - } - } - } - $count++; - if ($count>count($codeids)-1) {$count=0;} - } - fixorder($lid); - } - else - { - $labelsoutput.= "\n"; - } - - break; - - // Pressing the Up button - case $clang->gT("Up", "unescaped"): - $newsortorder=$postsortorder-1; - $oldsortorder=$postsortorder; - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=-1 WHERE lid=$lid AND sortorder=$newsortorder"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=$newsortorder WHERE lid=$lid AND sortorder=$oldsortorder"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder='$oldsortorder' WHERE lid=$lid AND sortorder=-1"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - break; - - // Pressing the Down button - case $clang->gT("Dn", "unescaped"): - $newsortorder=$postsortorder+1; - $oldsortorder=$postsortorder; - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=-1 WHERE lid=$lid AND sortorder='$newsortorder'"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder='$newsortorder' WHERE lid=$lid AND sortorder=$oldsortorder"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - $cdquery = "UPDATE ".db_table_name('labels')." SET sortorder=$oldsortorder WHERE lid=$lid AND sortorder=-1"; - $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); - break; - - // Delete Button - case $clang->gT("Del", "unescaped"): - $query = "DELETE FROM ".db_table_name('labels')." WHERE lid=$lid AND sortorder='{$postsortorder}'"; - if (!$result = $connect->Execute($query)) - { - $labelsoutput.= "\n"; - } - fixorder($lid); - break; + $data = json_decode(stripslashes($sPostData)); } + else + { + $data = json_decode($sPostData); + } + + + if ($ajax){ + $lid = insertlabelset(); + } + + + if (count(array_unique($data->{'codelist'})) == count($data->{'codelist'})) + { + if ($filterxsshtml) + { + require_once("../classes/inputfilter/class.inputfilter_clean.php"); + $myFilter = new InputFilter('','',1,1,1); + } + + $query = "DELETE FROM ".db_table_name('labels')." WHERE lid = {$lid}"; + + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + foreach($data->{'codelist'} as $index=>$codeid){ + + $codeObj = $data->$codeid; + + + $actualcode = db_quoteall($codeObj->{'code'},true); + $codeid = db_quoteall($codeid,true); + + $assessmentvalue = (int)($codeObj->{'assessmentvalue'}); + + foreach($data->{'langs'} as $lang){ + + $strTemp = 'text_'.$lang; + $title = $codeObj->$strTemp; + + if ($filterxsshtml) + $title=$myFilter->process($title); + else + $title = html_entity_decode($title, ENT_QUOTES, "UTF-8"); + + + // Fix bug with FCKEditor saving strange BR types + $title =fix_FCKeditor_text($title); + $title = db_quoteall($title,true); + + + $sort_order = db_quoteall($index); + $lang = db_quoteall($lang); + $title = trim($title, "'"); + + if (get_magic_quotes_gpc()) + { + $title = str_replace("'","\'",$title); + } + + $query = "INSERT INTO ".db_table_name('labels')." (lid,code,title,sortorder, assessment_value, language) + VALUES({$lid},{$actualcode},'".$title."',{$sort_order},{$assessmentvalue},{$lang})"; + + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + } + + } + + $_SESSION['flashmessage']=$clang->gT("Labels sucessfully updated"); + + } + else + { + $labelsoutput.= "\n"; + } + + if ($ajax){ die(); } + } /** diff --git a/include/limesurvey/admin/listcolumn.php b/include/limesurvey/admin/listcolumn.php index cdd0b105..b1910d79 100644 --- a/include/limesurvey/admin/listcolumn.php +++ b/include/limesurvey/admin/listcolumn.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: listcolumn.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: listcolumn.php 11664 2011-12-16 05:19:42Z tmswhite $ */ include_once("login_check.php"); diff --git a/include/limesurvey/admin/login_check.php b/include/limesurvey/admin/login_check.php index 8f61ce24..fe619694 100644 --- a/include/limesurvey/admin/login_check.php +++ b/include/limesurvey/admin/login_check.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: login_check.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: login_check.php 12211 2012-01-26 17:02:27Z shnoulle $ */ @@ -51,7 +51,7 @@ if(isset($_GET['user']) && isset($_GET['onepass'])) else { //check if user exists in DB - $query = "SELECT uid, users_name, password, one_time_pw, dateformat, full_name, htmleditormode FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($user); + $query = "SELECT uid, users_name, password, one_time_pw, dateformat, full_name, htmleditormode, questionselectormode, templateeditormode FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($user); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; //Checked $result = $connect->SelectLimit($query, 1) or safe_die ($query."
      ".$connect->ErrorMsg()); if(!$result) @@ -101,6 +101,8 @@ if(isset($_GET['user']) && isset($_GET['onepass'])) $_SESSION['loginID'] = $srow['uid']; $_SESSION['dateformat'] = $srow['dateformat']; $_SESSION['htmleditormode'] = $srow['htmleditormode']; + $_SESSION['questionselectormode'] = $srow['questionselectormode']; + $_SESSION['templateeditormode'] = $srow['templateeditormode']; $_SESSION['full_name'] = $srow['full_name']; GetSessionUserRights($_SESSION['loginID']); @@ -181,7 +183,7 @@ if(!isset($_SESSION['loginID']) && $action != "forgotpass" && ($action != "logou //include("database.php"); - $sIp = $_SERVER['REMOTE_ADDR']; + $sIp = getIPAddress(); $query = "SELECT * FROM ".db_table_name('failed_login_attempts'). " WHERE ip='$sIp';"; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $connect->query($query) or safe_die ($query."
      ".$connect->ErrorMsg()); diff --git a/include/limesurvey/admin/login_check_cas.php b/include/limesurvey/admin/login_check_cas.php index 9f664bf6..9027cd52 100644 --- a/include/limesurvey/admin/login_check_cas.php +++ b/include/limesurvey/admin/login_check_cas.php @@ -1,240 +1,241 @@ - intval($currentTime) + 60) { - echo ('QISSingleSignOn: Token was created in the future (Check your clocks):'.htmlspecialchars($token)); - return null; - } - if (intval($tokens[1]) + 60 < intval($currentTime)) { - echo ('QISSingleSignOn: Token expired:'.htmlspecialchars($token)); - return null; - } - - // check service name - if ($tokens[2] != $singleSignOnService) { - echo ('QISSingleSignOn: Wrong service:'.htmlspecialchars($token)); - return null; - } - - // check username name (using Title::newFormText as in User::newFromName) - $userinfo = explode('/', urldecode($tokens[3])); - - // Andere Methode wie bei tokens: find the _last_ '/' to split username and hash as the username may include '/'-chars. - // $temp_pos = strrpos($tokens[3], '/'); - // $userinfo[1] = substr($tokens[3], $temp_pos + 1); - // $userinfo[0] = substr($tokens[3], 0, $temp_pos); - - // echo ('QISSingleSignOn: userinfo-0:'.$userinfo[0]."\n"); - // echo ('QISSingleSignOn: userinfo-1:'.$userinfo[1]."\n"); - - //$t = Title::newFromText($userinfo[0]); - - $user = $userinfo[0]; - if ($user == null) { - echo ('QISSingleSignOn: Invalid character in user name: '.htmlspecialchars($userinfo[0])); - return null; - } - - // check hash - $toHash = $tokens[0].'/'.$tokens[1].'/'.$tokens[2].'/'.$tokens[3].'/'.$singleSignOnSharedSecret; - $hash = md5($toHash); - if ($hash != $tokens[4]) { - echo ('QISSingleSignOn: Hash verification failed:'.htmlspecialchars($token).' Should be: ' . $hash); - return null; - } - - // copy _ridlist to session for WikiRights (if present) - if (count($userinfo) > -1) { - //session_start(); - setUserRightsCas($user, $user); - //$_SESSION['_ridlist'] = $userinfo[1]; - } - - // welcome, you passed all tests. - return $user; -} - -function setUserRightsCas($user, $role="") -{ - include_once("../config-defaults.php"); - //include("../config.php"); //Not needed since config-defaults includes config.php - - $_SESSION['user'] = $user; - $_SESSION['loginID'] = 1; - $_SESSION['dateformat'] = 1; - - $_SESSION['adminlang'] = $defaultlang; - $_SESSION['htmleditormode'] = 'default'; - - $_SESSION['checksessionpost'] = sRandomChars(10); - $_SESSION['pw_notify']=false; - - switch ($role){ - case "admin": - //echo "hallo"; - $_SESSION['USER_RIGHT_CREATE_SURVEY'] = 1; - $_SESSION['USER_RIGHT_CONFIGURATOR'] = 1; - $_SESSION['USER_RIGHT_CREATE_USER'] = 1; - $_SESSION['USER_RIGHT_DELETE_USER'] = 1; - $_SESSION['USER_RIGHT_SUPERADMIN'] = 1; - $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = 1; - $_SESSION['USER_RIGHT_MANAGE_LABEL'] = 1; - break; - default: - //echo "default"; - $_SESSION['USER_RIGHT_CREATE_SURVEY'] = 1; - $_SESSION['USER_RIGHT_CONFIGURATOR'] = 1; - $_SESSION['USER_RIGHT_CREATE_USER'] = 0; - $_SESSION['USER_RIGHT_DELETE_USER'] = 0; - $_SESSION['USER_RIGHT_SUPERADMIN'] = 0; - $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = 1; - $_SESSION['USER_RIGHT_MANAGE_LABEL'] = 1; - - break; - } - -} - -?> \ No newline at end of file + intval($currentTime) + 60) { + echo ('QISSingleSignOn: Token was created in the future (Check your clocks):'.htmlspecialchars($token)); + return null; + } + if (intval($tokens[1]) + 60 < intval($currentTime)) { + echo ('QISSingleSignOn: Token expired:'.htmlspecialchars($token)); + return null; + } + + // check service name + if ($tokens[2] != $singleSignOnService) { + echo ('QISSingleSignOn: Wrong service:'.htmlspecialchars($token)); + return null; + } + + // check username name (using Title::newFormText as in User::newFromName) + $userinfo = explode('/', urldecode($tokens[3])); + + // Andere Methode wie bei tokens: find the _last_ '/' to split username and hash as the username may include '/'-chars. + // $temp_pos = strrpos($tokens[3], '/'); + // $userinfo[1] = substr($tokens[3], $temp_pos + 1); + // $userinfo[0] = substr($tokens[3], 0, $temp_pos); + + // echo ('QISSingleSignOn: userinfo-0:'.$userinfo[0]."\n"); + // echo ('QISSingleSignOn: userinfo-1:'.$userinfo[1]."\n"); + + //$t = Title::newFromText($userinfo[0]); + + $user = $userinfo[0]; + if ($user == null) { + echo ('QISSingleSignOn: Invalid character in user name: '.htmlspecialchars($userinfo[0])); + return null; + } + + // check hash + $toHash = $tokens[0].'/'.$tokens[1].'/'.$tokens[2].'/'.$tokens[3].'/'.$singleSignOnSharedSecret; + $hash = md5($toHash); + if ($hash != $tokens[4]) { + echo ('QISSingleSignOn: Hash verification failed:'.htmlspecialchars($token).' Should be: ' . $hash); + return null; + } + + // copy _ridlist to session for WikiRights (if present) + if (count($userinfo) > -1) { + //session_start(); + setUserRightsCas($user, $user); + //$_SESSION['_ridlist'] = $userinfo[1]; + } + + // welcome, you passed all tests. + return $user; +} + +function setUserRightsCas($user, $role="") +{ + include_once("../config-defaults.php"); + //include("../config.php"); //Not needed since config-defaults includes config.php + + $_SESSION['user'] = $user; + $_SESSION['loginID'] = 1; + $_SESSION['dateformat'] = 1; + + $_SESSION['adminlang'] = $defaultlang; + $_SESSION['htmleditormode'] = 'default'; + $_SESSION['questionselectormode'] = 'default'; + $_SESSION['templateeditormode'] = 'default'; + $_SESSION['checksessionpost'] = sRandomChars(10); + $_SESSION['pw_notify']=false; + + switch ($role){ + case "admin": + //echo "hallo"; + $_SESSION['USER_RIGHT_CREATE_SURVEY'] = 1; + $_SESSION['USER_RIGHT_CONFIGURATOR'] = 1; + $_SESSION['USER_RIGHT_CREATE_USER'] = 1; + $_SESSION['USER_RIGHT_DELETE_USER'] = 1; + $_SESSION['USER_RIGHT_SUPERADMIN'] = 1; + $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = 1; + $_SESSION['USER_RIGHT_MANAGE_LABEL'] = 1; + break; + default: + //echo "default"; + $_SESSION['USER_RIGHT_CREATE_SURVEY'] = 1; + $_SESSION['USER_RIGHT_CONFIGURATOR'] = 1; + $_SESSION['USER_RIGHT_CREATE_USER'] = 0; + $_SESSION['USER_RIGHT_DELETE_USER'] = 0; + $_SESSION['USER_RIGHT_SUPERADMIN'] = 0; + $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = 1; + $_SESSION['USER_RIGHT_MANAGE_LABEL'] = 1; + + break; + } + +} + +?> diff --git a/include/limesurvey/admin/preview.php b/include/limesurvey/admin/preview.php index 2ea12163..5fc1a53f 100644 --- a/include/limesurvey/admin/preview.php +++ b/include/limesurvey/admin/preview.php @@ -10,41 +10,37 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: preview.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: preview.php 12106 2012-01-19 05:35:48Z tmswhite $ */ //Ensure script is not run directly, avoid path disclosure +$LEMdebugLevel=0; + include_once("login_check.php"); require_once(dirname(__FILE__).'/sessioncontrol.php'); -require_once(dirname(__FILE__).'/../qanda.php'); if (!isset($surveyid)) {$surveyid=returnglobal('sid');} if (!isset($qid)) {$qid=returnglobal('qid');} if (empty($surveyid)) {die("No SID provided.");} if (empty($qid)) {die("No QID provided.");} +if (!isset($_SESSION['step'])) { $_SESSION['step'] = 0; } +if (!isset($_SESSION['prevstep'])) { $_SESSION['prevstep'] = 0; } +if (!isset($_SESSION['maxstep'])) { $_SESSION['maxstep'] = 0; } if (!isset($_GET['lang']) || $_GET['lang'] == "") { $language = GetBaseLanguageFromSurveyID($surveyid); } else { - $language = $_GET['lang']; + $language = sanitize_languagecode($_GET['lang']); } $_SESSION['s_lang'] = $language; -$_SESSION['fieldmap']=createFieldMap($surveyid,'full',true,$qid); -// Prefill question/answer from defaultvalues -foreach ($_SESSION['fieldmap'] as $field) -{ - if (isset($field['defaultvalue'])) - { - $_SESSION[$field['fieldname']]=$field['defaultvalue']; - } -} $clang = new limesurvey_lang($language); $thissurvey=getSurveyInfo($surveyid); $_SESSION['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']); +require_once(dirname(__FILE__).'/../qanda.php'); $qquery = 'SELECT * FROM '.db_table_name('questions')." WHERE sid='$surveyid' AND qid='$qid' AND language='{$language}'"; $qresult = db_execute_assoc($qquery); @@ -56,10 +52,19 @@ $ia = array(0 => $qid, 4 => $qrows['type'], 5 => $qrows['gid'], 6 => $qrows['mandatory'], -//7 => $qrows['other']); // ia[7] is conditionsexist not other 7 => 'N', 8 => 'N' ); // ia[8] is usedinconditions +$radix=getRadixPointData($thissurvey['surveyls_numberformat']); +$radix = $radix['seperator']; +$surveyOptions = array( + 'radix'=>$radix, + ); + +LimeExpressionManager::StartSurvey($thissurvey['sid'], 'question', $surveyOptions, false,$LEMdebugLevel); +$qseq = LimeExpressionManager::GetQuestionSeq($qid); +$moveResult = LimeExpressionManager::JumpTo($qseq+1,true,false,true); + $answers = retrieveAnswers($ia); if (!$thissurvey['template']) @@ -72,40 +77,105 @@ else } doHeader(); -$dummy_js = ' - - - '; +$showQuestion = "$('#question$qid').show();"; +$dummy_js = <<< EOD + +EOD; $answer=$answers[0][1]; -$help=$answers[0][2]; + +//GET HELP +$hquery="SELECT help FROM {$dbprefix}questions WHERE qid=$ia[0] AND language='".$_SESSION['s_lang']."'"; +$hresult=db_execute_num($hquery) or safe_die($connect->ErrorMsg()); //Checked +$help=""; +while ($hrow=$hresult->FetchRow()) {$help=$hrow[0];} $question = $answers[0][0]; $question['code']=$answers[0][5]; $question['class'] = question_class($qrows['type']); $question['essentials'] = 'id="question'.$qrows['qid'].'"'; $question['sgq']=$ia[1]; - -//Temporary fix for error condition arising from linked question via replacement fields -//@todo: find a consistent way to check and handle this - I guess this is already handled but the wrong values are entered into the DB - -$search_for = '{INSERTANS'; -if(strpos($question['text'],$search_for)!==false){ - $pattern_text = '/{([A-Z])*:([0-9])*X([0-9])*X([0-9])*}/'; - $replacement_text = $clang->gT('[Dependency on another question (ID $4)]'); - $text = preg_replace($pattern_text,$replacement_text,$question['text']); - $question['text']=$text; -} +$question['aid']='unknown'; +$question['sqid']='unknown'; +$question['type']= $qrows['type']; if ($qrows['mandatory'] == 'Y') { @@ -123,20 +193,33 @@ $content .= templatereplace(file_get_contents("$thistpl/startgroup.pstpl")); $question_template = file_get_contents("$thistpl/question.pstpl"); if(substr_count($question_template , '{QUESTION_ESSENTIALS}') > 0 ) // the following has been added for backwards compatiblity. {// LS 1.87 and newer templates - $content .= "\n".templatereplace($question_template)."\n"; + $content .= "\n".templatereplace($question_template,NULL,false,$qid)."\n"; } else {// LS 1.86 and older templates $content .= '
      '; - $content .= "\n".templatereplace($question_template)."\n"; + $content .= "\n".templatereplace($question_template,NULL,false,$qid)."\n"; $content .= "\n\t
      \n"; }; $content .= templatereplace(file_get_contents("$thistpl/endgroup.pstpl")).$dummy_js; +LimeExpressionManager::FinishProcessingGroup(); +$content .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript(); $content .= '

       '; -$content .= templatereplace(file_get_contents("$thistpl/endpage.pstpl")); + +LimeExpressionManager::FinishProcessingPage(); echo $content; + +if ($LEMdebugLevel >= 1) { + echo LimeExpressionManager::GetDebugTimingMessage(); +} +if ($LEMdebugLevel >= 2) { + echo "
      Group/Question Validation Results:".$moveResult['message']."
      \n"; +} + +$content .= templatereplace(file_get_contents("$thistpl/endpage.pstpl")); + echo "\n"; diff --git a/include/limesurvey/admin/printablesurvey.php b/include/limesurvey/admin/printablesurvey.php index 4297edfe..59c776d8 100644 --- a/include/limesurvey/admin/printablesurvey.php +++ b/include/limesurvey/admin/printablesurvey.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: printablesurvey.php 10929 2011-09-02 15:27:07Z c_schmitz $ + * $Id: printablesurvey.php 12418 2012-02-09 11:54:10Z mennodekker $ */ //Ensure script is not run directly, avoid path disclosure @@ -103,10 +103,10 @@ else define('PRINT_TEMPLATE_URL' , $standardtemplaterooturl.'/default/' , true); } +LimeExpressionManager::StartSurvey($surveyid, 'survey',NULL,false,LEM_PRETTY_PRINT_ALL_SYNTAX); +$moveResult = LimeExpressionManager::NavigateForwards(); -$fieldmap=createFieldMap($surveyid); - $degquery = "SELECT * FROM ".db_table_name("groups")." WHERE sid='{$surveyid}' AND language='{$surveyprintlang}' ORDER BY ".db_table_name("groups").".group_order"; $degresult = db_execute_assoc($degquery); @@ -136,7 +136,7 @@ if(isset($showsgqacode) && $showsgqacode == true) } else { - $surveyname = ""; + $surveyname = $surveyname; } $survey_output = array( @@ -411,7 +411,7 @@ while ($degrow = $degresult->FetchRow()) // START doing questions $qidattributes=getQuestionAttributes($deqrow['qid'],$deqrow['type']); - if ($qidattributes['hidden']==1) + if ($qidattributes['hidden']==1 && $deqrow['type'] != '*') { continue; } @@ -422,341 +422,15 @@ while ($degrow = $degresult->FetchRow()) $printablesurveyoutput = ''; $explanation = ''; //reset conditions explanation $s=0; - $scenarioquery="SELECT DISTINCT ".db_table_name("conditions").".scenario FROM ".db_table_name("conditions")." WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} ORDER BY scenario"; - $scenarioresult=db_execute_assoc($scenarioquery); - //Loop through distinct scenarios, thus grouping them together. - while ($scenariorow=$scenarioresult->FetchRow()) - { - if($s == 0 && $scenarioresult->RecordCount() > 1) - { - $explanation .= '

      '.try_debug(__LINE__)." -------- Scenario {$scenariorow['scenario']} --------

      \n\n"; - } - if($s > 0) - { - $explanation .= '

      '.try_debug(__LINE__).' -------- '.$clang->gT("or")." Scenario {$scenariorow['scenario']} --------

      \n\n"; - } + $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']); + $relevance = trim($qinfo['info']['relevance']); + $explanation = $qinfo['relEqn']; - $x=0; - $distinctquery="SELECT cqid, method, cfieldname, value - FROM ".db_table_name("conditions")." - WHERE ".db_table_name("conditions").".qid={$deqrow['qid']} - AND ".db_table_name("conditions").".scenario={$scenariorow['scenario']} - group by cqid, method - ORDER BY cqid"; - $distinctresult=db_execute_assoc($distinctquery); - //Loop through each condition for a particular scenario. - while ($distinctrow=$distinctresult->FetchRow()) - { - $subquery='select title, question from '.db_table_name("questions")." where qid={$distinctrow['cqid']} AND parent_qid=0 AND language='{$surveyprintlang}'"; - $subresult=$connect->GetRow($subquery); - - if($x > 0) - { - $explanation .= ' '.$clang->gT('and').' '; - } - if(trim($distinctrow['method'])=='') - { - $distinctrow['method']='=='; - } - - if($distinctrow['cqid']){ // cqid != 0 ==> previous answer match - if($distinctrow['method']=='==') - { - $explanation .= $clang->gT("Answer was")." "; - } - elseif($distinctrow['method']=='!=') - { - $explanation .= $clang->gT("Answer was NOT")." "; - } - elseif($distinctrow['method']=='<') - { - $explanation .= $clang->gT("Answer was less than")." "; - } - elseif($distinctrow['method']=='<=') - { - $explanation .= $clang->gT("Answer was less than or equal to")." "; - } - elseif($distinctrow['method']=='>=') - { - $explanation .= $clang->gT("Answer was greater than or equal to")." "; - } - elseif($distinctrow['method']=='>') - { - $explanation .= $clang->gT("Answer was greater than")." "; - } - elseif($distinctrow['method']=='RX') - { - $explanation .= $clang->gT("Answer matched (regexp)")." "; - } - else - { - $explanation .= $clang->gT("Answer was")." "; - } - $explanation .= " ".$distinctrow['value']; - } - if(!$distinctrow['cqid']) { // cqid == 0 ==> token attribute match - $tokenData = GetTokenFieldsAndNames($surveyid); - preg_match('/^{TOKEN:([^}]*)}$/',$distinctrow['cfieldname'],$extractedTokenAttr); - $explanation .= "Your ".$tokenData[strtolower($extractedTokenAttr[1])]." "; - if($distinctrow['method']=='==') - { - $explanation .= $clang->gT("is")." "; - } - elseif($distinctrow['method']=='!=') - { - $explanation .= $clang->gT("is NOT")." "; - } - elseif($distinctrow['method']=='<') - { - $explanation .= $clang->gT("is less than")." "; - } - elseif($distinctrow['method']=='<=') - { - $explanation .= $clang->gT("is less than or equal to")." "; - } - elseif($distinctrow['method']=='>=') - { - $explanation .= $clang->gT("is greater than or equal to")." "; - } - elseif($distinctrow['method']=='>') - { - $explanation .= $clang->gT("is greater than")." "; - } - elseif($distinctrow['method']=='RX') - { - $explanation .= $clang->gT("is matched (regexp)")." "; - } - else - { - $explanation .= $clang->gT("is")." "; - } - $answer_section = $distinctrow['value']; - } - - $conquery="SELECT cid, cqid, q.title,\n" - ."q.question, value, q.type, cfieldname\n" - ."FROM ".db_table_name("conditions")." c, ".db_table_name("questions")." q\n" - ."WHERE c.cqid=q.qid\n" - ."AND c.cqid={$distinctrow['cqid']}\n" - ."AND c.qid={$deqrow['qid']} \n" - ."AND c.scenario={$scenariorow['scenario']} \n" - ."AND language='{$surveyprintlang}'"; - $conresult=db_execute_assoc($conquery) or safe_die("$conquery
      ".htmlspecialchars($connect->ErrorMsg())); - $conditions=array(); - while ($conrow=$conresult->FetchRow()) - { - - $postans=""; - $value=$conrow['value']; - switch($conrow['type']) - { - case "Y": - switch ($conrow['value']) - { - case "Y": $conditions[]=$clang->gT("Yes"); break; - case "N": $conditions[]=$clang->gT("No"); break; - } - break; - case "G": - switch($conrow['value']) - { - case "M": $conditions[]=$clang->gT("Male"); break; - case "F": $conditions[]=$clang->gT("Female"); break; - } // switch - break; - case "A": - case "B": - case ":": - case ";": - $conditions[]=$conrow['value']; - break; - case "C": - switch($conrow['value']) - { - case "Y": $conditions[]=$clang->gT("Yes"); break; - case "U": $conditions[]=$clang->gT("Uncertain"); break; - case "N": $conditions[]=$clang->gT("No"); break; - } // switch - break; - case "E": - switch($conrow['value']) - { - case "I": $conditions[]=$clang->gT("Increase"); break; - case "D": $conditions[]=$clang->gT("Decrease"); break; - case "S": $conditions[]=$clang->gT("Same"); break; - } - case "1": - $labelIndex=preg_match("/^[^#]+#([01]{1})$/",$conrow['cfieldname']); - if ($labelIndex == 0) - { // TIBO - $fquery = "SELECT * FROM ".db_table_name("answers")."\n" - . "WHERE qid='{$conrow['cqid']}'\n" - . "AND code='{$conrow['value']}' and scale_id=0 AND language='{$surveyprintlang}'"; - $fresult=db_execute_assoc($fquery) or safe_die("$fquery
      ".htmlspecialchars($connect->ErrorMsg())); - while($frow=$fresult->FetchRow()) - { - $postans=$frow['answer']; - $conditions[]=$frow['answer']; - } // while - } - elseif ($labelIndex == 1) - { - $fquery = "SELECT * FROM ".db_table_name("answers")."\n" - . "WHERE qid='{$conrow['cqid']}'\n" - . "AND code='{$conrow['value']}' and scale_id=1 AND language='{$surveyprintlang}'"; - $fresult=db_execute_assoc($fquery) or safe_die("$fquery
      ".htmlspecialchars($connect->ErrorMsg())); - while($frow=$fresult->FetchRow()) - { - $postans=$frow['answer']; - $conditions[]=$frow['answer']; - } // while - } - break; - case "L": - case "!": - case "O": - case "R": - $ansquery="SELECT answer FROM ".db_table_name("answers")." WHERE qid='{$conrow['cqid']}' AND code='{$conrow['value']}' AND language='{$surveyprintlang}'"; - $ansresult=db_execute_assoc($ansquery); - while ($ansrow=$ansresult->FetchRow()) - { - $conditions[]=$ansrow['answer']; - } - if($conrow['value'] == "-oth-") { - $conditions[]=$clang->gT("Other"); - } - $conditions = array_unique($conditions); - break; - case "M": - case "P": - $ansquery="SELECT question FROM ".db_table_name("questions")." WHERE parent_qid='{$conrow['cqid']}' AND title='{$conrow['value']}' AND language='{$surveyprintlang}'"; - $ansresult=db_execute_assoc($ansquery); - while ($ansrow=$ansresult->FetchRow()) - { - $conditions[]=$ansrow['question']; - } - $conditions = array_unique($conditions); - break; - case "F": - case "H": - default: - $value=substr($conrow['cfieldname'], strpos($conrow['cfieldname'], "X".$conrow['cqid'])+strlen("X".$conrow['cqid']), strlen($conrow['cfieldname'])); - $fquery = "SELECT * FROM ".db_table_name("answers")."\n" - . "WHERE qid='{$conrow['cqid']}'\n" - . "AND code='{$conrow['value']}' AND language='{$surveyprintlang}'"; - $fresult=db_execute_assoc($fquery) or safe_die("$fquery
      ".htmlspecialchars($connect->ErrorMsg())); - while($frow=$fresult->FetchRow()) - { - $postans=$frow['answer']; - $conditions[]=$frow['answer']; - } // while - break; - } // switch - - // Now let's complete the answer text with the answer_section - $answer_section=""; - switch($conrow['type']) - { - case "A": - case "B": - case "C": - case "E": - case "F": - case "H": - case "K": - $thiscquestion=$fieldmap[$conrow['cfieldname']]; - $ansquery="SELECT question FROM ".db_table_name("questions")." WHERE parent_qid='{$conrow['cqid']}' AND title='{$thiscquestion['aid']}' AND language='{$surveyprintlang}'"; - //$ansquery="SELECT question FROM ".db_table_name("questions")." WHERE qid='{$conrow['cqid']}' AND language='{$surveyprintlang}'"; - $ansresult=db_execute_assoc($ansquery); - while ($ansrow=$ansresult->FetchRow()) - { - $answer_section=" (".$ansrow['question'].")"; - } - break; - - case "1": // dual: (Label 1), (Label 2) - $labelIndex=substr($conrow['cfieldname'],-1); - $thiscquestion=$fieldmap[$conrow['cfieldname']]; - $ansquery="SELECT question FROM ".db_table_name("questions")." WHERE parent_qid='{$conrow['cqid']}' AND title='{$thiscquestion['aid']}' AND language='{$surveyprintlang}'"; - //$ansquery="SELECT question FROM ".db_table_name("questions")." WHERE qid='{$conrow['cqid']}' AND language='{$surveyprintlang}'"; - $ansresult=db_execute_assoc($ansquery); - $cqidattributes = getQuestionAttributes($conrow['cqid'], $conrow['type']); - if ($labelIndex == 0) - { - if (trim($cqidattributes['dualscale_headerA']) != '') { - $header = $clang->gT($cqidattributes['dualscale_headerA']); - } else { - $header = '1'; - } - } - elseif ($labelIndex == 1) - { - if (trim($cqidattributes['dualscale_headerB']) != '') { - $header = $clang->gT($cqidattributes['dualscale_headerB']); - } else { - $header = '2'; - } - } - while ($ansrow=$ansresult->FetchRow()) - { - $answer_section=" (".$ansrow['question']." ".sprintf($clang->gT("Label %s"),$header).")"; - } - break; - case ":": - case ";": //multi flexi: ( answer [label] ) - $thiscquestion=$fieldmap[$conrow['cfieldname']]; - $ansquery="SELECT question FROM ".db_table_name("questions")." WHERE parent_qid='{$conrow['cqid']}' AND title='{$thiscquestion['aid']}' AND language='{$surveyprintlang}'"; - $ansresult=db_execute_assoc($ansquery); - while ($ansrow=$ansresult->FetchRow()) - { - $fquery = "SELECT * FROM ".db_table_name("answers")."\n" - . "WHERE qid='{$conrow['cqid']}'\n" - . "AND code='{$conrow['value']}' AND language='{$surveyprintlang}'"; - $fresult=db_execute_assoc($fquery) or safe_die("$fquery
      ".htmlspecialchars($connect->ErrorMsg())); - while($frow=$fresult->FetchRow()) - { - //$conditions[]=$frow['title']; - $answer_section=" (".$ansrow['question']."[".$frow['answer']."])"; - } // while - } - break; - case "R": // (Rank 1), (Rank 2)... TIBO - $thiscquestion=$fieldmap[$conrow['cfieldname']]; - $rankid=$thiscquestion['aid']; - $answer_section=" (".$clang->gT("RANK")." $rankid)"; - break; - default: // nothing to add - break; - } - } - - if (count($conditions) > 1) - { - $explanation .= "'".implode("' ".$clang->gT("or")." '", $conditions)."'"; - } - elseif (count($conditions) == 1) - { - $explanation .= "'".$conditions[0]."'"; - } - unset($conditions); - // Following line commented out because answer_section was lost, but is required for some question types - //$explanation .= " ".$clang->gT("to question")." '".$mapquestionsNumbers[$distinctrow['cqid']]."' $answer_section "; - if($distinctrow['cqid']){ - $explanation .= " ".$clang->gT("at question")." '".$mapquestionsNumbers[$distinctrow['cqid']]." [".$subresult['title']."]' (".strip_tags($subresult['question'])."$answer_section)" ; - } - else{ - $explanation .= " ".$distinctrow['value'] ; - } - //$distinctrow - $x++; - } - $s++; - } - if ($explanation) + if (trim($relevance) != '' && trim($relevance) != '1') { $explanation = "".$clang->gT('Only answer this question if the following conditions are met:')."" - ."
      ° ".$explanation;//"[".sprintf($clang->gT("Only answer this question %s"), $explanation)."]"; + ."
      ° ".$explanation; } else { @@ -787,7 +461,7 @@ while ($degrow = $degresult->FetchRow()) ,'QUESTION_MANDATORY' => '' // translated 'mandatory' identifier ,'QUESTION_ID' => $deqrow['qid'] // id to be added to wrapping question div ,'QUESTION_CLASS' => question_class( $deqrow['type']) // classes to be added to wrapping question div - ,'QUESTION_TYPE_HELP' => '' // instructions on how to complete the question + ,'QUESTION_TYPE_HELP' => $qinfo['validTip'] // '' // instructions on how to complete the question // prettyValidTip is too verbose; assuming printable surveys will use static values ,'QUESTION_MAN_MESSAGE' => '' // (not sure if this is used) mandatory error ,'QUESTION_VALID_MESSAGE' => '' // (not sure if this is used) validation error ,'QUESTION_FILE_VALID_MESSAGE' => ''// (not sure if this is used) file validation error @@ -795,6 +469,10 @@ while ($degrow = $degresult->FetchRow()) ,'ANSWER' => '' // contains formatted HTML answer ); + if($question['QUESTION_TYPE_HELP'] != "") { + $question['QUESTION_TYPE_HELP'] .= "
      \n"; + } + if ($deqrow['mandatory'] == 'Y') { @@ -833,7 +511,7 @@ while ($degrow = $degresult->FetchRow()) { // ================================================================== case "5": //5 POINT CHOICE - $question['QUESTION_TYPE_HELP'] = $clang->gT('Please choose *only one* of the following:'); + $question['QUESTION_TYPE_HELP'] .= $clang->gT('Please choose *only one* of the following:'); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *only one* of the following:"),"U");} $pdfoutput =''; $question['ANSWER'] .= "\n\t
        \n"; @@ -850,7 +528,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "D": //DATE - $question['QUESTION_TYPE_HELP'] = $clang->gT('Please enter a date:'); + $question['QUESTION_TYPE_HELP'] .= $clang->gT('Please enter a date:'); $question['ANSWER'] .= "\t".input_type_image('text',$question['QUESTION_TYPE_HELP'],30,1); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please enter a date:")." ___________");} @@ -858,7 +536,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "G": //GENDER - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *only one* of the following:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *only one* of the following:"); $question['ANSWER'] .= "\n\t
          \n"; $question['ANSWER'] .= "\t\t
        • \n\t\t\t".input_type_image('radio',$clang->gT("Female"))."\n\t\t\t".$clang->gT("Female")." ".addsgqacode("(F)")."\n\t\t
        • \n"; @@ -891,7 +569,7 @@ while ($degrow = $degresult->FetchRow()) unset($optCategorySeparator); } - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *only one* of the following:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *only one* of the following:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *only one* of the following:"));} @@ -920,11 +598,11 @@ while ($degrow = $degresult->FetchRow()) { $dearow['answer'] = $answer.addsgqacode(" (".$dearow['code'].")"); } - $question['ANSWER'] .= "\t".$wrapper['item-start']."\t\t".input_type_image('radio' , $dearow['answer'])."\n\t\t\t".$dearow['answer']."\n".$wrapper['item-end']; + $question['ANSWER'] .= "\t".$wrapper['item-start']."\t\t".input_type_image('radio' , $dearow['answer'])."\n\t\t\t".$dearow['answer']."\n".$wrapper['item-end']; } else { - $question['ANSWER'] .= "\t".$wrapper['item-start']."\t\t".input_type_image('radio' , $dearow['answer'])."\n\t\t\t".$dearow['answer'].addsgqacode(" (".$dearow['code'].")")."\n".$wrapper['item-end']; + $question['ANSWER'] .= "\t".$wrapper['item-start']."\t\t".input_type_image('radio' , $dearow['answer'])."\n\t\t\t".$dearow['answer'].addsgqacode(" (".$dearow['code'].")")."\n".$wrapper['item-end']; } if(isset($_POST['printableexport'])){$pdf->intopdf(" o ".$dearow['answer']);} @@ -958,7 +636,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "O": //LIST WITH COMMENT - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *only one* of the following:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *only one* of the following:"); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *only one* of the following:"),"U");} $deaquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY sortorder, answer "; $dearesult = db_execute_assoc($deaquery); @@ -985,7 +663,8 @@ while ($degrow = $degresult->FetchRow()) $reaquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY sortorder, answer"; $rearesult = db_execute_assoc($reaquery) or safe_die ("Couldn't get ranked answers
          ".$connect->ErrorMsg()); $reacount = $rearesult->RecordCount(); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please number each box in order of preference from 1 to")." $reacount"; + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please number each box in order of preference from 1 to")." $reacount"; + $question['QUESTION_TYPE_HELP'] .= min_max_answers_help($qidattributes, $surveyprintlang, $surveyid); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please number each box in order of preference from 1 to ").$reacount,"U");} $question['ANSWER'] = "\n
            \n"; while ($rearow = $rearesult->FetchRow()) @@ -1007,16 +686,9 @@ while ($degrow = $degresult->FetchRow()) { $dcols=0; } - if (trim($qidattributes['max_answers'])=='') { - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *all* that apply:"); - if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *all* that apply:"),"U");} - } - else - { - $maxansw=$qidattributes["max_answers"]; - $question['QUESTION_TYPE_HELP'] = sprintf($clang->gT('Please choose *at most* %s answers:' ),''.$maxansw.''); - if(isset($_POST['printableexport'])){$pdf->intopdf(sprintf($clang->gT('Please choose *at most* %s answers:' ),$maxansw),"U");} - } + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *all* that apply:"); + if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *all* that apply:"),"U");} + $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $mearesult = db_execute_assoc($meaquery); @@ -1065,16 +737,8 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "P": //Multiple choice with comments - if (trim($qidattributes['max_answers'])=='') { - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose all that apply and provide a comment:"); - if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose all that apply and provide a comment:"),"U");} - } - else - { - $maxansw=$qidattributes['max_answers']; - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *at most* ").''.$maxansw.' '.$clang->gT("answers and provide a comment:"); - if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose *at most* ").$maxansw.$clang->gT("answers and provide a comment:"),"U");} - } + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *all* that apply and provide a comment:"); + if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose all that apply and provide a comment:"),"U");} $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $mearesult = db_execute_assoc($meaquery); @@ -1110,26 +774,9 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "K": //MULTIPLE NUMERICAL - $question['QUESTION_TYPE_HELP'] = ""; $width=(isset($width))?$width:16; if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please write your answer(s) here:"),"U");} - if (!empty($qidattributes['equals_num_value'])) - { - $question['QUESTION_TYPE_HELP'] .= "* ".sprintf($clang->gT('Total of all entries must equal %d'),$qidattributes['equals_num_value'])."
            \n"; - } - if (!empty($qidattributes['max_num_value'])) - { - $question['QUESTION_TYPE_HELP'] .= sprintf($clang->gT('Total of all entries must not exceed %d'), $qidattributes['max_num_value'])."
            \n"; - } - if (!empty($qidattributes['min_num_value'])) - { - $question['QUESTION_TYPE_HELP'] .= sprintf($clang->gT('Total of all entries must be at least %s'),$qidattributes['min_num_value'])."
            \n"; - } - - if($question['QUESTION_TYPE_HELP'] != "") { - $question['QUESTION_TYPE_HELP'] .= "
            \n"; - } $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer(s) here:"); $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; @@ -1152,7 +799,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "S": //SHORT TEXT - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please write your answer here:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer here:"); $question['ANSWER'] = input_type_image('text',$question['QUESTION_TYPE_HELP'], 50); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please write your answer here:"),"U");} if(isset($_POST['printableexport'])){$pdf->intopdf("____________________");} @@ -1161,7 +808,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "T": //LONG TEXT - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please write your answer here:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer here:"); $question['ANSWER'] = input_type_image('textarea',$question['QUESTION_TYPE_HELP'], '100%' , 8); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please write your answer here:"),"U");} @@ -1174,7 +821,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "U": //HUGE TEXT - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please write your answer here:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer here:"); $question['ANSWER'] = input_type_image('textarea',$question['QUESTION_TYPE_HELP'], '100%' , 30); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please write your answer here:"),"U");} @@ -1187,8 +834,16 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "N": //NUMERICAL - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please write your answer here:"); - $question['ANSWER'] = input_type_image('text',$question['QUESTION_TYPE_HELP'],20); + $prefix=""; + $suffix=""; + if($qidattributes['prefix'] != "") { + $prefix=$qidattributes['prefix']; + } + if($qidattributes['suffix'] != "") { + $suffix=$qidattributes['suffix']; + } + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please write your answer here:"); + $question['ANSWER'] = "
              \n\t
            • \n\t\t$prefix\n\t\t".input_type_image('text',$question['QUESTION_TYPE_HELP'],20)."\n\t\t$suffix\n\t\t
            • \n\t
            "; if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please write your answer here:"),"U");} if(isset($_POST['printableexport'])){$pdf->intopdf("____________________");} @@ -1197,7 +852,7 @@ while ($degrow = $degresult->FetchRow()) // ================================================================== case "Y": //YES/NO - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose *only one* of the following:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose *only one* of the following:"); $question['ANSWER'] = "\n
              \n\t
            • \n\t\t".input_type_image('radio',$clang->gT('Yes'))."\n\t\t".$clang->gT('Yes').addsgqacode(" (Y)")."\n\t
            • \n"; $question['ANSWER'] .= "\n\t
            • \n\t\t".input_type_image('radio',$clang->gT('No'))."\n\t\t".$clang->gT('No').addsgqacode(" (N)")."\n\t
            • \n
            \n"; @@ -1211,7 +866,7 @@ while ($degrow = $degresult->FetchRow()) case "A": //ARRAY (5 POINT CHOICE) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] = " @@ -1275,7 +930,7 @@ while ($degrow = $degresult->FetchRow()) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] .= "\n\n\t\n\t\t\n\t\t\t\n"; @@ -1311,7 +966,7 @@ while ($degrow = $degresult->FetchRow()) case "C": //ARRAY (YES/UNCERTAIN/NO) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] = ' @@ -1352,7 +1007,7 @@ while ($degrow = $degresult->FetchRow()) case "E": //ARRAY (Increase/Same/Decrease) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] = ' @@ -1425,23 +1080,6 @@ while ($degrow = $degresult->FetchRow()) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND scale_id=0 AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - if ($checkboxlayout === false) - { - if ($stepvalue > 1) - { - $question['QUESTION_TYPE_HELP'] = sprintf($clang->gT("Please write a multiple of %d between %d and %d for each item:"),$stepvalue,$minvalue,$maxvalue); - if(isset($_POST['printableexport'])){$pdf->intopdf(sprintf($clang->gT("Please write a multiple of %d between %d and %d for each item:"),$stepvalue,$minvalue,$maxvalue),"U");} - } - else { - $question['QUESTION_TYPE_HELP'] = sprintf($clang->gT("Please enter a number between %d and %d for each item:"),$minvalue,$maxvalue); - if(isset($_POST['printableexport'])){$pdf->intopdf(sprintf($clang->gT("Please enter a number between %d and %d for each item:"),$minvalue,$maxvalue),"U");} - } - } - else - { - $question['QUESTION_TYPE_HELP'] = $clang->gT("Check any that apply").":"; - if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Check any that apply"),"U");} - } $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] .= "\n
             
            \n\t\n\t\t\n\t\t\t\n"; @@ -1515,7 +1153,7 @@ while ($degrow = $degresult->FetchRow()) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND scale_id=0 AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = array_filter_help($qidattributes, $surveyprintlang, $surveyid); + $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $question['ANSWER'] .= "\n
             
            \n\t\n\t\t\n\t\t\t\n"; $fquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND scale_id=1 AND language='{$surveyprintlang}' ORDER BY question_order"; @@ -1576,7 +1214,7 @@ while ($degrow = $degresult->FetchRow()) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); $fquery = "SELECT * FROM ".db_table_name("answers")." WHERE scale_id=0 and qid='{$deqrow['qid']}' AND language='{$surveyprintlang}' ORDER BY sortorder, code"; @@ -1680,7 +1318,7 @@ while ($degrow = $degresult->FetchRow()) $meaquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order"; $mearesult = db_execute_assoc($meaquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); $question['QUESTION_TYPE_HELP'] .= array_filter_help($qidattributes, $surveyprintlang, $surveyid); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose the appropriate response for each item:"),"U");} @@ -1787,7 +1425,7 @@ while ($degrow = $degresult->FetchRow()) $headstyle="style='padding-left: 20px; padding-right: 7px'"; $fquery = "SELECT * FROM ".db_table_name("questions")." WHERE parent_qid={$deqrow['qid']} AND language='{$surveyprintlang}' ORDER BY question_order, title"; $fresult = db_execute_assoc($fquery); - $question['QUESTION_TYPE_HELP'] = $clang->gT("Please choose the appropriate response for each item:"); + $question['QUESTION_TYPE_HELP'] .= $clang->gT("Please choose the appropriate response for each item:"); if(isset($_POST['printableexport'])){$pdf->intopdf($clang->gT("Please choose the appropriate response for each item:"),"U");} $question['ANSWER'] .= "\n
             
            \n\t\n\t\t\n\t\t\t\n"; $meaquery = "SELECT * FROM ".db_table_name("answers")." WHERE qid='{$deqrow['qid']}' AND scale_id=0 AND language='{$surveyprintlang}' ORDER BY sortorder, code"; @@ -1841,7 +1479,7 @@ while ($degrow = $degresult->FetchRow()) } if ($bGroupHasVisibleQuestions) { - $survey_output['GROUPS'] .= populate_template( 'group' , $group ); + $survey_output['GROUPS'] .= populate_template( 'group' , $group ); } } @@ -1930,12 +1568,23 @@ if(isset($_POST['printableexport'])) } $pdf->titleintopdf($clang->gT("Submit Your Survey."),$clang->gT("Thank you for completing this survey.")); $pdf->write_out($clang->gT($surveyname)." ".$surveyid.".pdf"); +} else { + echo populate_template( 'survey' , $survey_output ); } - -echo populate_template( 'survey' , $survey_output ); - exit; +function min_max_answers_help($qidattributes, $surveyprintlang, $surveyid) { + global $clang; + $output = ""; + if(!empty($qidattributes['min_answers'])) { + $output .= "\n

            ".sprintf($clang->gT("Please choose at least %s item(s)"), $qidattributes['min_answers'])."

            \n"; + } + if(!empty($qidattributes['max_answers'])) { + $output .= "\n

            ".sprintf($clang->gT("Please choose no more than %s item(s)"),$qidattributes['max_answers'])."

            \n"; + } + return $output; +} + function array_filter_help($qidattributes, $surveyprintlang, $surveyid) { global $clang; $output = ""; @@ -1945,7 +1594,7 @@ function array_filter_help($qidattributes, $surveyprintlang, $surveyid) { $newresult=db_execute_assoc($newquery); $newquestiontext=$newresult->fetchRow(); $output .= "\n

            - ".sprintf($clang->gT("Only answer this question for the items you selected in question %d ('%s')"),$qidattributes['array_filter'], br2nl($newquestiontext['question']))." + ".sprintf($clang->gT("Only answer this question for the items you selected in question *%s* ('%s')"),$qidattributes['array_filter'], FlattenText(br2nl($newquestiontext['question'])))."

            \n"; } if(!empty($qidattributes['array_filter_exclude'])) @@ -1954,7 +1603,7 @@ function array_filter_help($qidattributes, $surveyprintlang, $surveyid) { $newresult=db_execute_assoc($newquery); $newquestiontext=$newresult->fetchRow(); $output .= "\n

            - ".sprintf($clang->gT("Only answer this question for the items you did not select in question %d ('%s')"),$qidattributes['array_filter_exclude'], br2nl($newquestiontext['question']))." + ".sprintf($clang->gT("Only answer this question for the items you did not select in question *%s* ('%s')"),$qidattributes['array_filter_exclude'], br2nl($newquestiontext['question']))."

            \n"; } return $output; diff --git a/include/limesurvey/admin/questiongrouphandling.php b/include/limesurvey/admin/questiongrouphandling.php index df9f23eb..fa8cd11b 100644 --- a/include/limesurvey/admin/questiongrouphandling.php +++ b/include/limesurvey/admin/questiongrouphandling.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: questiongrouphandling.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: questiongrouphandling.php 11664 2011-12-16 05:19:42Z tmswhite $ */ @@ -36,7 +36,7 @@ if ($action == "addgroup") if (bHasSurveyPermission($surveyid,'surveycontent','import')) { $newgroupoutput .= '
          • '.$clang->gT("Import question group")."
          • \n"; - + } $newgroupoutput .= ""; @@ -61,6 +61,10 @@ if ($action == "addgroup") . "" . getEditor("group-desc","description_".$grouplang, "[".$clang->gT("Description:", "js")."](".$grouplang.")",$surveyid,'','',$action) . "\n" + // Group-Level Relevance + . "
          • " + . "" + . "
          • " . "" . "\t

            \n" . "\n"; @@ -89,12 +93,12 @@ if ($action == "addgroup") // End Import TABS $newgroupoutput.= ""; } - + // End of TABS $newgroupoutput.= ""; - + } @@ -118,7 +122,7 @@ if ($action == "editgroup") } else { $grplangs[$esrow['language']] = 99; } - if ($esrow['language'] == $baselang) $basesettings = array('group_name' => $esrow['group_name'],'description' => $esrow['description'],'group_order' => $esrow['group_order']); + if ($esrow['language'] == $baselang) $basesettings = array('group_name' => $esrow['group_name'],'description' => $esrow['description'],'group_order' => $esrow['group_order'], 'grelevance' => $esrow['grelevance']); } @@ -126,7 +130,7 @@ if ($action == "editgroup") { if ($value != 99) { - $egquery = "INSERT INTO ".db_table_name('groups')." (gid, sid, group_name, description,group_order,language) VALUES ('{$gid}', '{$surveyid}', '{$basesettings['group_name']}', '{$basesettings['description']}','{$basesettings['group_order']}', '{$key}')"; + $egquery = "INSERT INTO ".db_table_name('groups')." (gid, sid, group_name, description,group_order, grelevance, language) VALUES ('{$gid}', '{$surveyid}', '{$basesettings['group_name']}', '{$basesettings['description']}','{$basesettings['group_order']}', '{$basesettings['grelevance']}', '{$key}')"; $egresult = $connect->Execute($egquery); } } @@ -143,7 +147,11 @@ if ($action == "editgroup") . "

            \n" . "\n" . getEditor("group-desc","description_".$esrow['language'], "[".$clang->gT("Description:", "js")."](".$esrow['language'].")",$surveyid,$gid,'',$action) - . "\t
            "; + . "" + . "
            \n" + . "" + . "
            " + . "\n
            "; $egquery = "SELECT * FROM ".db_table_name('groups')." WHERE sid=$surveyid AND gid=$gid AND language!='$baselang'"; $egresult = db_execute_assoc($egquery); $i = 1; @@ -167,14 +175,14 @@ if ($action == "editgroup") foreach ($tab_title as $i=>$eachtitle){ $editgroup .= "\t
          • $eachtitle
          • \n"; - + } $editgroup.="\n"; foreach ($tab_content as $i=>$eachcontent){ $editgroup .= "\n
            $eachcontent
            "; } - + $editgroup .= "\n\t

            \n" . "\t\n" . "\t\n" @@ -220,6 +228,7 @@ if ($action == "ordergroups") $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg());//Checked break; } + LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting } // Move the question to specific position if ((!empty($_POST['groupmovefrom']) || (isset($_POST['groupmovefrom']) && $_POST['groupmovefrom'] == '0')) && (!empty($_POST['groupmoveto']) || (isset($_POST['groupmoveto']) && $_POST['groupmoveto'] == '0'))) @@ -251,35 +260,11 @@ if ($action == "ordergroups") $cdquery = "UPDATE ".db_table_name('groups')." SET group_order=".($newpos+1)." WHERE sid=$surveyid AND group_order=-1"; $cdresult=$connect->Execute($cdquery) or safe_die($connect->ErrorMsg()); } + LimeExpressionManager::SetDirtyFlag(); // so refreshes syntax highlighting } $ordergroups = "

            ".$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); - $nicegroupdeps=array(); - if (!is_null($groupdepsarray)) - { - $ordergroups .= "
            • ".$clang->gT("Warning").": ".$clang->gT("Current survey has questions with conditions outside their own group")."

              ".$clang->gT("Re-ordering groups is restricted to ensure that questions on which conditions are based aren't reordered after questions having the conditions set")."

              ".$clang->gT("The following groups are concerned").":
                \n"; - foreach ($groupdepsarray as $depgid => $depgrouprow) - { - foreach($depgrouprow as $targgid => $targrow) - { - $ordergroups .= "
              • ".sprintf($clang->gT("Group %s depends on group %s, see the marked conditions on:"), "".$targrow['depgpname']."", "".$targrow['targetgpname']." "); - $nicegroupdeps[$depgid]=$targgid; - foreach($targrow['conditions'] as $depqid => $depqrow) - { - $listcid=implode("-",$depqrow); - $ordergroups .= " [".$clang->gT("QID").": ".$depqid."]"; - } - $ordergroups .= "
              • \n"; - } - } - $ordergroups .= "
            "; - } - $ordergroups .= "
              "; //Get the groups from this survey $s_lang = GetBaseLanguageFromSurveyID($surveyid); @@ -318,18 +303,6 @@ if ($action == "ordergroups") { $downdisabled = ""; $updisabled = ""; - if ( !is_null($groupdepsarray) && $i < $groupcount-1 && - array_key_exists($ogarray[$i+1]['gid'],$groupdepsarray) && - array_key_exists($ogarray[$i]['gid'],$groupdepsarray[$ogarray[$i+1]['gid']]) ) - { - $downdisabled = "disabled=\"true\" class=\"disabledUpDnBtn\""; - } - if ( !is_null($groupdepsarray) && $i !=0 && - array_key_exists($ogarray[$i]['gid'],$groupdepsarray) && - array_key_exists($ogarray[$i-1]['gid'],$groupdepsarray[$ogarray[$i]['gid']]) ) - { - $updisabled = "disabled=\"true\" class=\"disabledUpDnBtn\""; - } $ordergroups.="
            • \n" ; @@ -347,41 +320,9 @@ if ($action == "ordergroups") } //Find out if there are any dependencies $max_start_order=0; - if ( !is_null($groupdepsarray) && $i!=0 && - array_key_exists($ogarray[$i]['gid'], $groupdepsarray)) //This should find out if there are any dependencies - { - foreach($groupdepsarray[$ogarray[$i]['gid']] as $key=>$val) - { - //qet the question_order value for each of the dependencies - foreach($miniogarray as $mo) - { - if($mo['gid'] == $key && $mo['group_order'] > $max_start_order) //If there is a matching condition, and the question order for that condition is higher than the one already set: - { - $max_start_order = $mo['group_order']; //Set the maximum question condition to this - } - } - } - } //Find out if any groups use this as a dependency $max_end_order=$groupcount+1; //By default, stop the list at the last group - if ( !is_null($nicegroupdeps)) - { - //to find which question has a dependence on this one - //then stop the list, so you can't move this group past the dependent one - foreach($nicegroupdeps as $gdarray) - { - if ($ogarray[$i]['gid'] == $gdarray) - { - //This group should never get higher than here ($gdarray)! - //Get the group_order for $gdarray; - $goquery="SELECT group_order FROM ".db_table_name('groups')." WHERE gid = $gdarray"; - $goresult=db_execute_assoc($goquery) or safe_die($connect->ErrorMsg()); - $gorow = $goresult->FetchRow(); - $max_end_order=$gorow['group_order']; - } - } - } $minipos=$miniogarray[0]['group_order']; //Start at the very first group_order foreach($miniogarray as $mo) { diff --git a/include/limesurvey/admin/questionhandling.php b/include/limesurvey/admin/questionhandling.php index f1ffc7c0..1cdb334b 100644 --- a/include/limesurvey/admin/questionhandling.php +++ b/include/limesurvey/admin/questionhandling.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: questionhandling.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: questionhandling.php 12217 2012-01-26 17:54:59Z tmswhite $ */ @@ -66,6 +66,12 @@ if ($action == "copyquestion") . "\n" . "
            • \n" + // Relevance + ."
            • " + . "" + . "" + . "
            • \n" + . "
            • \n" . ""; - foreach ($options as $value=>$label) + case 'L': + case 'M': + case 'O': + case 'P': + case '!': + $inputStyle='enum'; + break; + case 'K': + case 'Q': + $inputStyle='text'; + break; + } + if ($inputStyle == 'enum') + { + foreach ($sqrows as $aSubquestion) { - $editdefvalues.="
            • "; + $editdefvalues.="
            • \n"; } - $editdefvalues.=" "; } } } - if ($language==$baselang && count($questlangs)>1) - { + + if ($qtproperties[$questionrow['type']]['answerscales']==0 && $qtproperties[$questionrow['type']]['subquestions']==0) + { + /* + case 'D': + case 'N': + case 'S': + case 'T': + case 'U':* + */ + $defaultvalue=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid=$qid AND language='{$language}'"); + $editdefvalues.="
            • "; + $editdefvalues.="
            • \n"; + } + + if ($language==$baselang && count($questlangs)>1) + { $editdefvalues.="
             
            - - - - - - - - - - '; - - //NOTE: the footer always has to be put BEFORE the tbody tag! - $quotasoutput .=' - - - - - - - - - - - '; - - //if there are quotas let's proceed - if ($result->RecordCount() > 0) - { - //loop through all quotas - while ($quotalisting = $result->FetchRow()) - { - $quotasoutput .=' - - - - - - - - - - - '; - - //headline for quota sub-parts - $quotasoutput .=' - - - - - - - - '; - - //check how many sub-elements exist for a certain quota - $query = "SELECT id,code,qid FROM ".db_table_name('quota_members')." where quota_id='".$quotalisting['id']."'"; - $result2 = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); - - if ($result2->RecordCount() > 0) - { - //loop through all sub-parts - while ($quota_questions = $result2->FetchRow()) - { - $question_answers = getQuotaAnswers($quota_questions['qid'],$surveyid,$quotalisting['id']); - $quotasoutput .=' - - - - - - - - '; - } - } - - } - - } - else - { - $quotasoutput .=' - - - '; - } - - $quotasoutput .=' - - - - - - - - - -
            '.$clang->gT("Quota name").''.$clang->gT("Status").''.$clang->gT("Quota action").''.$clang->gT("Limit").''.$clang->gT("Completed").''.$clang->gT("Action").'
                 
            -
            '.$quotalisting['name'].''; - if ($quotalisting['active'] == 1) - { - $quotasoutput .= ''.$clang->gT("Active").''; - } else { - $quotasoutput .= ''.$clang->gT("Not Active").''; - } - $quotasoutput .=' - '; - if ($quotalisting['action'] == 1) - { - $quotasoutput .= $clang->gT("Terminate survey"); - } elseif ($quotalisting['action'] == 2) { - $quotasoutput .= $clang->gT("Terminate survey with warning"); - } - $totalquotas+=$quotalisting['qlimit']; - $completed=get_quotaCompletedCount($surveyid, $quotalisting['id']); - $highlight=($completed >= $quotalisting['qlimit']) ? "" : "style='color: red'"; //Incomplete quotas displayed in red - $totalcompleted=$totalcompleted+$completed; - $csvoutput[]=$quotalisting['name'].",".$quotalisting['qlimit'].",".$completed.",".($quotalisting['qlimit']-$completed)."\r\n"; - - $quotasoutput .=' - '.$quotalisting['qlimit'].''.$completed.''; - if (bHasSurveyPermission($surveyid, 'quotas','update')) - { - $quotasoutput .='
            - - - - - -
            '; - } - if (bHasSurveyPermission($surveyid, 'quotas','delete')) - { - $quotasoutput .='
            - - - - - -
            '; - } - $quotasoutput .='
             '.$clang->gT("Questions").''.$clang->gT("Answers").'  '; - if (bHasSurveyPermission($surveyid, 'quotas','update')) - { - $quotasoutput .='
            - - - - - -
            '; - } - $quotasoutput .='
             '.$question_answers[$quota_questions['code']]['Title'].''.$question_answers[$quota_questions['code']]['Display'].'   -
            - - - - - - - -
            -
            '.$clang->gT("No quotas have been set for this survey").'.
               '.$totalquotas.''.$totalcompleted.''; - if (bHasSurveyPermission($surveyid, 'quotas','create')) - { - $quotasoutput .='
            - - - - -
            '; - - } - $quotasoutput .='
            '; - } - - if(isset($_GET['quickreport']) && $_GET['quickreport']) - { - header("Content-Disposition: attachment; filename=results-survey".$surveyid.".csv"); - header("Content-type: text/comma-separated-values; charset=UTF-8"); - header("Pragma: public"); - echo $clang->gT("Quota name").",".$clang->gT("Limit").",".$clang->gT("Completed").",".$clang->gT("Remaining")."\r\n"; - foreach($csvoutput as $line) - { - echo $line; - } - die; - } - if(($subaction == "new_answer" || ($subaction == "new_answer_two" && !isset($_POST['quota_qid']))) && bHasSurveyPermission($surveyid,'quotas','create')) - { - if ($subaction == "new_answer_two") $_POST['quota_id'] = $_POST['quota_id']; - - $allowed_types = "(type ='G' or type ='M' or type ='Y' or type ='A' or type ='B' or type ='I' or type = 'L' or type='O' or type='!')"; - - $query = "SELECT name FROM ".db_table_name('quota')." WHERE id='".$_POST['quota_id']."'"; - $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); - while ($quotadetails = $result->FetchRow()) - { - $quota_name=$quotadetails['name']; - } - - $query = "SELECT qid, title, question FROM ".db_table_name('questions')." WHERE $allowed_types AND sid='$surveyid' AND language='{$baselang}' order by question_order"; - $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); - if ($result->RecordCount() == 0) - { - $quotasoutput .="
            ".$clang->gT("Add Answer").": ".$clang->gT("Question Selection")."

            -
            - ".$clang->gT("Sorry there are no supported question types in this survey.")." -

            gT("Continue")."\"/> -
            "; - } else - { - $quotasoutput .='
            '.$clang->gT("Survey Quota").': '.$clang->gT("Add Answer").'

            -
            -
            -
            '.sprintf($clang->gt("New Answer for Quota '%s'"), $quota_name).'
            -
              -
            • - - -
            • -
            -

            - - - - - - -

            -
            '; - } - } - - if($subaction == "new_answer_two" && isset($_POST['quota_qid']) && bHasSurveyPermission($surveyid, 'quotas','create')) - { - array_walk( $_POST, 'db_quote', true); - - $query = "SELECT name FROM ".db_table_name('quota')." WHERE id='".$_POST['quota_id']."'"; - $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); - while ($quotadetails = $result->FetchRow()) - { - $quota_name=$quotadetails['name']; - } - - $question_answers = getQuotaAnswers($_POST['quota_qid'],$surveyid,$_POST['quota_id']); - $x=0; - - foreach ($question_answers as $qacheck) - { - if (isset($qacheck['rowexists'])) $x++; - } - - reset($question_answers); - - if (count($question_answers) == $x) - { - $quotasoutput .="
            ".$clang->gT("Add Answer").": ".$clang->gT("Question Selection")."

            -
            - ".$clang->gT("All answers are already selected in this quota.")." -

            gT("Continue")."\"/> -
            "; - } else - { - $quotasoutput .='
            '.$clang->gT("Survey Quota").': '.$clang->gT("Add Answer").'

            -
            -
            -
            '.sprintf($clang->gt("New Answer for Quota '%s'"), $quota_name).'
            -
              -
            • - -
            • -
            • - - -
            • -

            - - - - - - -

            -
            '; - } - } - - if ($subaction == "new_quota" && bHasSurveyPermission($surveyid, 'quotas','create')) - { - $quotasoutput.="
            ".$clang->gT("New quota").'
            '; - $quotasoutput.='
            '; - $quotasoutput.='
              -
            • - - -
            • -
            • - - -
            • -
            - '; - - $langs = GetAdditionalLanguagesFromSurveyID($surveyid); - $baselang = GetBaseLanguageFromSurveyID($surveyid); - array_push($langs,$baselang); - - require_once("../classes/inputfilter/class.inputfilter_clean.php"); - $myFilter = new InputFilter('','',1,1,1); - - $thissurvey=getSurveyInfo($surveyid); - - $quotasoutput .= ' -
            '."\n\n"; - foreach ($langs as $lang) - { - $quotasoutput .= ' -
            -

            '.GetLanguageNameFromCode($lang,false); - if ($lang==$baselang) {$quotasoutput .= '('.$clang->gT("Base language").')';} - $quotasoutput .= "

            "; - $quotasoutput.=' -
              -
            • - - -
            • -
            -
            '; - }; - - $quotasoutput .= ' - - - -
            -

            -

            '; - } -} - -?> +ErrorMsg()); + $qtype = $result->FetchRow(); + + if ($qtype['type'] == 'G') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array('M' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Male"), 'code' => 'M'), + 'F' => array('Title' => $qtype['title'],'Display' => $clang->gT("Female"), 'code' => 'F')); + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if ($qtype['type'] == 'M') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $query = "SELECT title,question FROM ".db_table_name('questions')." WHERE parent_qid='{$qid}'"; + $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array(); + + while ($dbanslist = $ansresult->FetchRow()) + { + $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'],0,40), 'code' => $dbanslist['title']); + $answerlist[$dbanslist['title']] = $tmparrayans; + } + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if ($qtype['type'] == 'L' || $qtype['type'] == 'O' || $qtype['type'] == '!') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $query = "SELECT code,answer FROM ".db_table_name('answers')." WHERE qid='{$qid}' and language='{$baselang}'"; + $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array(); + + while ($dbanslist = $ansresult->FetchRow()) + { + $answerlist[$dbanslist['code']] = array('Title'=>$qtype['title'], + 'Display'=>substr($dbanslist['answer'],0,40), + 'code'=>$dbanslist['code']); + } + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + + } + + if ($qtype['type'] == 'A') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $query = "SELECT title,question FROM ".db_table_name('questions')." WHERE parent_qid='{$qid}'"; + $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array(); + + while ($dbanslist = $ansresult->FetchRow()) + { + for ($x=1; $x<6; $x++) + { + $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'],0,40).' ['.$x.']', 'code' => $dbanslist['title']); + $answerlist[$dbanslist['title']."-".$x] = $tmparrayans; + } + } + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if ($qtype['type'] == 'B') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $query = "SELECT code,answer FROM ".db_table_name('answers')." WHERE qid='{$qid}' and language='{$baselang}'"; + $ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array(); + + while ($dbanslist = $ansresult->FetchRow()) + { + for ($x=1; $x<11; $x++) + { + $tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['answer'],0,40).' ['.$x.']', 'code' => $dbanslist['code']); + $answerlist[$dbanslist['code']."-".$x] = $tmparrayans; + } + } + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if ($qtype['type'] == 'Y') + { + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + $answerlist = array('Y' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Yes"), 'code' => 'Y'), + 'N' => array('Title' => $qtype['title'],'Display' => $clang->gT("No"), 'code' => 'N')); + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if ($qtype['type'] == 'I') + { + + $slangs = GetAdditionalLanguagesFromSurveyID($surveyid); + array_unshift($slangs,$baselang); + + $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + while(list($key,$value) = each($slangs)) + { + $tmparrayans = array('Title' => $qtype['title'], 'Display' => getLanguageNameFromCode($value,false), $value); + $answerlist[$value] = $tmparrayans; + } + + if ($result->RecordCount() > 0) + { + while ($quotalist = $result->FetchRow()) + { + $answerlist[$quotalist['code']]['rowexists'] = '1'; + } + + } + } + + if (!isset($answerlist)) + { + return array(); + } + else + { + return $answerlist; + } + } + + $js_admin_includes[]='../scripts/jquery/jquery.tablesorter.min.js'; + $js_admin_includes[]='scripts/quotas.js'; + + if(bHasSurveyPermission($surveyid, 'quotas','read')) + { + if (isset($_POST['quotamax'])) $_POST['quotamax']=sanitize_int($_POST['quotamax']); + if (!isset($action)) $action=returnglobal('action'); + if (!isset($subaction)) $subaction=returnglobal('subaction'); + if (!isset($quotasoutput)) $quotasoutput = ""; + //if (!isset($_POST['autoload_url']) || empty($_POST['autoload_url'])) {$_POST['autoload_url']=0;} //queXS Removal + if($subaction == "insertquota" && bHasSurveyPermission($surveyid, 'quotas','create')) + { + if(!isset($_POST['quota_limit']) || $_POST['quota_limit'] < 0 || empty($_POST['quota_limit']) || !is_numeric($_POST['quota_limit'])) + { + $_POST['quota_limit'] = 0; + + } + + array_walk( $_POST, 'db_quote', true); + + $query = "INSERT INTO ".db_table_name('quota')." (sid,name,qlimit,action,autoload_url) + VALUES ('$surveyid','{$_POST['quota_name']}','{$_POST['quota_limit']}','1', '1')"; + $connect->Execute($query) or safe_die("Error inserting limit".$connect->ErrorMsg()); + $quotaid=$connect->Insert_Id(db_table_name_nq('quota'),"id"); + + //Get the languages used in this survey + $langs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + array_push($langs, $baselang); + //Iterate through each language, and make sure there is a quota message for it + $errorstring = ''; + foreach ($langs as $lang) + { + if (!$_POST['quotals_message_'.$lang]) { $errorstring.= GetLanguageNameFromCode($lang,false)."\\n";} + } + if ($errorstring!='') + { + $databaseoutput .= "\n"; + } + else + //All the required quota messages exist, now we can insert this info into the database + { + require_once("../classes/inputfilter/class.inputfilter_clean.php"); + $myFilter = new InputFilter('','',1,1,1); + + foreach ($langs as $lang) //Iterate through each language + { + //Clean XSS + if ($filterxsshtml) + { + $_POST['quotals_message_'.$lang]=$myFilter->process($_POST['quotals_message_'.$lang]); + } + else + { + $_POST['quotals_message_'.$lang] = html_entity_decode($_POST['quotals_message_'.$lang], ENT_QUOTES, "UTF-8"); + } + + // Fix bug with FCKEditor saving strange BR types + $_POST['quotals_message_'.$lang]=fix_FCKeditor_text($_POST['quotals_message_'.$lang]); + + include_once(dirname(__FILE__) . '/../quexs.php'); //queXS Addition + + //Now save the language to the database: + $query = "INSERT INTO ".db_table_name('quota_languagesettings')." (quotals_quota_id, quotals_language, quotals_name, quotals_message, quotals_url, quotals_urldescrip) + VALUES ('$quotaid', '$lang', '".db_quote($_POST['quota_name'],true)."', '".db_quote($_POST['quotals_message_'.$lang],true)."', '".QUEXS_URL."rs_quota_end.php"."', '".QUEXS_URL."rs_quota_end.php"."')"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + } + } //End insert language based components + $viewquota = "1"; + + } //End foreach $lang + + if($subaction == "modifyquota" && bHasSurveyPermission($surveyid, 'quotas','update')) + { + $query = "UPDATE ".db_table_name('quota')." + SET name=".db_quoteall($_POST['quota_name'],true).", + qlimit=".db_quoteall($_POST['quota_limit'],true)." + WHERE id=".db_quoteall($_POST['quota_id'],true); + $connect->Execute($query) or safe_die("Error modifying quota".$connect->ErrorMsg()); + + //Get the languages used in this survey + $langs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + array_push($langs, $baselang); + //Iterate through each language, and make sure there is a quota message for it + $errorstring = ''; + foreach ($langs as $lang) + { + if (!$_POST['quotals_message_'.$lang]) { $errorstring.= GetLanguageNameFromCode($lang,false)."\\n";} + } + if ($errorstring!='') + { + $quotasoutput .= "\n"; + } + else + //All the required quota messages exist, now we can insert this info into the database + { + require_once("../classes/inputfilter/class.inputfilter_clean.php"); + $myFilter = new InputFilter('','',1,1,1); + + foreach ($langs as $lang) //Iterate through each language + { + //Clean XSS + if ($filterxsshtml) + { + $_POST['quotals_message_'.$lang]=$myFilter->process($_POST['quotals_message_'.$lang]); + } + else + { + $_POST['quotals_message_'.$lang] = html_entity_decode($_POST['quotals_message_'.$lang], ENT_QUOTES, "UTF-8"); + } + + // Fix bug with FCKEditor saving strange BR types + $_POST['quotals_message_'.$lang]=fix_FCKeditor_text($_POST['quotals_message_'.$lang]); + + //Check to see if a matching language exists, and if not, INSERT one (no update possible) + $query = "SELECT * FROM ".db_table_name('quota_languagesettings')." + WHERE quotals_quota_id = ".db_quote($_POST['quota_id'], true)." + AND quotals_language = '$lang'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + if ($result->RecordCount() > 0) { + //Now save the language to the database: + $query = "UPDATE ".db_table_name('quota_languagesettings')." + SET quotals_name='".db_quote($_POST['quota_name'],true)."', + quotals_message='".db_quote($_POST['quotals_message_'.$lang],true)."' + WHERE quotals_quota_id =".db_quote($_POST['quota_id'],true)." + AND quotals_language = '$lang'"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + } else { + /* If there is no matching record for this language, create one */ + $query = "INSERT INTO ".db_table_name('quota_languagesettings')." + (quotals_quota_id,quotals_language,quotals_name,quotals_message,quotals_url,quotals_urldescrip) + VALUES ('".db_quote($_POST['quota_id'])."', '$lang', '".db_quote($_POST['quota_name'],true)."', + '".db_quote($_POST['quotals_message_'.$lang],true)."', '".QUEXS_URL."rs_quota_end.php"."', + '".QUEXS_URL."rs_quota_end.php"."')"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + } + } + } //End insert language based components + + + $viewquota = "1"; + } + + if($subaction == "insertquotaanswer" && bHasSurveyPermission($surveyid, 'quotas','create')) + { + array_walk( $_POST, 'db_quote', true); + $query = "INSERT INTO ".db_table_name('quota_members')." (sid,qid,quota_id,code) VALUES ('$surveyid','{$_POST['quota_qid']}','{$_POST['quota_id']}','{$_POST['quota_anscode']}')"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + if(isset($_POST['createanother']) && $_POST['createanother'] == "on") { + $_POST['action']="quotas"; + $_POST['subaction']="new_answer"; + $subaction="new_answer"; + } else { + $viewquota = "1"; + } + } + + if($subaction == "quota_delans" && bHasSurveyPermission($surveyid, 'quotas','delete')) + { + array_walk( $_POST, 'db_quote', true); + $query = "DELETE FROM ".db_table_name('quota_members')." + WHERE id = '{$_POST['quota_member_id']}' + AND qid='{$_POST['quota_qid']}' and code='{$_POST['quota_anscode']}'"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + $viewquota = "1"; + + } + + if($subaction == "quota_delquota" && bHasSurveyPermission($surveyid, 'quotas','delete')) + { + array_walk( $_POST, 'db_quote', true); + $query = "DELETE FROM ".db_table_name('quota')." WHERE id='{$_POST['quota_id']}'"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + + $query = "DELETE FROM ".db_table_name('quota_languagesettings')." WHERE quotals_quota_id='{$_POST['quota_id']}'"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + + $query = "DELETE FROM ".db_table_name('quota_members')." WHERE quota_id='{$_POST['quota_id']}'"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); + $viewquota = "1"; + } + + if ($subaction == "quota_editquota" && bHasSurveyPermission($surveyid, 'quotas','update')) + { + if (isset($_GET['quota_id'])) $_POST['quota_id'] = $_GET['quota_id']; //queXS Addition + array_walk( $_POST, 'db_quote', true); + $query = "SELECT * FROM ".db_table_name('quota')." + WHERE id='{$_POST['quota_id']}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + $quotainfo = $result->FetchRow(); + + $quotasoutput .="
            +
            ".$clang->gT("Edit quota")."
            +
              +
            • + +
            • +
            • + +
            "; + $langs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + array_push($langs,$baselang); + + require_once("../classes/inputfilter/class.inputfilter_clean.php"); + $myFilter = new InputFilter('','',1,1,1); + + $quotasoutput .= ' +
            '."\n\n"; + foreach ($langs as $lang) + { + //Get this one + $langquery = "SELECT * FROM ".db_table_name('quota_languagesettings')." WHERE quotals_quota_id='{$_POST['quota_id']}' AND quotals_language = '$lang'"; + $langresult = db_execute_assoc($langquery) or safe_die($connect->ErrorMsg()); + $langquotainfo = $langresult->FetchRow(); + $quotasoutput .= ' +
            +

            '.GetLanguageNameFromCode($lang,false); + if ($lang==$baselang) {$quotasoutput .= '('.$clang->gT("Base language").')';} + $quotasoutput .= "

            "; + + $quotasoutput.=' +
              +
            • + + +
            • +
            +
            '; + }; + $quotasoutput .= ' +

            + + + + + +

            '; + } + + $totalquotas=0; + $totalcompleted=0; + $csvoutput=array(); + if (($action == "quotas" && !isset($subaction)) || isset($viewquota)) + { + + $query = "SELECT * FROM ".db_table_name('quota')." , ".db_table_name('quota_languagesettings')." + WHERE ".db_table_name('quota').".id = ".db_table_name('quota_languagesettings').".quotals_quota_id + AND sid='".$surveyid."' + AND quotals_language = '".$baselang."' + ORDER BY name"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + //create main quota
            and headlines + $quotasoutput .='
            '.$clang->gT("Survey quotas").'
            +
            + + + + + + + + + + + '; + + //NOTE: the footer always has to be put BEFORE the tbody tag! + $quotasoutput .=' + + + + + + + + + + + '; + + //if there are quotas let's proceed + if ($result->RecordCount() > 0) + { + //loop through all quotas + while ($quotalisting = $result->FetchRow()) + { + $quotasoutput .=' + + + + + + + + + + + '; + + //headline for quota sub-parts + $quotasoutput .=' + + + + + + + + '; + + //check how many sub-elements exist for a certain quota + $query = "SELECT id,code,qid FROM ".db_table_name('quota_members')." where quota_id='".$quotalisting['id']."'"; + $result2 = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + + if ($result2->RecordCount() > 0) + { + //loop through all sub-parts + while ($quota_questions = $result2->FetchRow()) + { + $question_answers = getQuotaAnswers($quota_questions['qid'],$surveyid,$quotalisting['id']); + $quotasoutput .=' + + + + + + + + '; + } + } + + } + + } + else + { + $quotasoutput .=' + + + '; + } + + $quotasoutput .=' + + + + + + + + + +
            '.$clang->gT("Quota name").''.$clang->gT("Status").''.$clang->gT("Quota action").''.$clang->gT("Completed").''.$clang->gT("Limit").''.$clang->gT("Action").'
                 
            +
            '.$quotalisting['name'].''; + if ($quotalisting['active'] == 1) + { + $quotasoutput .= ''.$clang->gT("Active").''; + } else { + $quotasoutput .= ''.$clang->gT("Not Active").''; + } + $quotasoutput .=' + '; + if ($quotalisting['action'] == 1) + { + $quotasoutput .= $clang->gT("Terminate survey"); + } elseif ($quotalisting['action'] == 2) { + $quotasoutput .= $clang->gT("Terminate survey with warning"); + } + $totalquotas+=$quotalisting['qlimit']; + $completed=get_quotaCompletedCount($surveyid, $quotalisting['id']); + $highlight=($completed >= $quotalisting['qlimit']) ? "" : "style='color: orange'"; //Incomplete quotas displayed in red + $totalcompleted=$totalcompleted+$completed; + $csvoutput[]=$quotalisting['name'].",".$quotalisting['qlimit'].",".$completed.",".($quotalisting['qlimit']-$completed)."\r\n"; + + $quotasoutput .=' + '.$completed.''.$quotalisting['qlimit'].''; + if (bHasSurveyPermission($surveyid, 'quotas','update')) + { + $quotasoutput .='
            + + + + + +
            '; + } + if (bHasSurveyPermission($surveyid, 'quotas','delete')) + { + $quotasoutput .='
            + + + + + +
            '; + } + $quotasoutput .='
             '.$clang->gT("Question").''.$clang->gT("Answer").'  '; + if (bHasSurveyPermission($surveyid, 'quotas','update')) + { + $quotasoutput .='
            + + + + + +
            '; + } + $quotasoutput .='
             '.$question_answers[$quota_questions['code']]['Title'].''.$question_answers[$quota_questions['code']]['Display'].'   +
            + + + + + + + +
            +
            '.$clang->gT("No quotas have been set for this survey").'.
               '.$totalcompleted.''.$totalquotas.''; + if (bHasSurveyPermission($surveyid, 'quotas','create')) + { + $quotasoutput .='
            + + + + +
            '; + + } + $quotasoutput .='
            '; + } + + if(isset($_GET['quickreport']) && $_GET['quickreport']) + { + header("Content-Disposition: attachment; filename=results-survey".$surveyid.".csv"); + header("Content-type: text/comma-separated-values; charset=UTF-8"); + header("Pragma: public"); + echo $clang->gT("Quota name").",".$clang->gT("Limit").",".$clang->gT("Completed").",".$clang->gT("Remaining")."\r\n"; + foreach($csvoutput as $line) + { + echo $line; + } + die; + } + if(($subaction == "new_answer" || ($subaction == "new_answer_two" && !isset($_POST['quota_qid']))) && bHasSurveyPermission($surveyid,'quotas','create')) + { + if ($subaction == "new_answer_two") $_POST['quota_id'] = $_POST['quota_id']; + + $allowed_types = "(type ='G' or type ='M' or type ='Y' or type ='A' or type ='B' or type ='I' or type = 'L' or type='O' or type='!')"; + + $query = "SELECT name FROM ".db_table_name('quota')." WHERE id='".$_POST['quota_id']."'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + while ($quotadetails = $result->FetchRow()) + { + $quota_name=$quotadetails['name']; + } + + $query = "SELECT qid, title, question FROM ".db_table_name('questions')."q JOIN ".db_table_name('groups')."g on g.gid=q.gid WHERE {$allowed_types} AND g.sid={$surveyid} AND q.language='{$baselang}' AND g.language='{$baselang}' order by group_order, question_order"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + if ($result->RecordCount() == 0) + { + $quotasoutput .="
            ".$clang->gT("Add Answer").": ".$clang->gT("Question Selection")."

            +
            + ".$clang->gT("Sorry there are no supported question types in this survey.")." +

            gT("Continue")."\"/> +
            "; + } else + { + $quotasoutput .='
            '.$clang->gT("Survey Quota").': '.$clang->gT("Add Answer").'

            +
            +
            +
            '.sprintf($clang->gt("New Answer for Quota '%s'"), $quota_name).'
            +
              +
            • + + +
            • +
            +

            + + + + + + +

            +
            '; + } + } + + if($subaction == "new_answer_two" && isset($_POST['quota_qid']) && bHasSurveyPermission($surveyid, 'quotas','create')) + { + array_walk( $_POST, 'db_quote', true); + + $query = "SELECT name FROM ".db_table_name('quota')." WHERE id='".$_POST['quota_id']."'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + while ($quotadetails = $result->FetchRow()) + { + $quota_name=$quotadetails['name']; + } + + $question_answers = getQuotaAnswers($_POST['quota_qid'],$surveyid,$_POST['quota_id']); + $x=0; + + foreach ($question_answers as $qacheck) + { + if (isset($qacheck['rowexists'])) $x++; + } + + reset($question_answers); + + if (count($question_answers) == $x) + { + $quotasoutput .="
            ".$clang->gT("Add Answer").": ".$clang->gT("Question Selection")."

            +
            + ".$clang->gT("All answers are already selected in this quota.")." +

            gT("Continue")."\"/> +
            "; + } else + { + $quotasoutput .='
            '.$clang->gT("Survey Quota").': '.$clang->gT("Add Answer").'

            +
            +
            +
            '.sprintf($clang->gt("New Answer for Quota '%s'"), $quota_name).'
            +
              +
            • + +
            • +
            • + + +
            • +

            + + + + + + +

            +
            '; + } + } + + if ($subaction == "new_quota" && bHasSurveyPermission($surveyid, 'quotas','create')) + { + $quotasoutput.="
            ".$clang->gT("New quota").'
            '; + $quotasoutput.='
            '; + $quotasoutput.='
              +
            • + + +
            • +
            • + + +
            • +
            + '; + + $langs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + array_push($langs,$baselang); + + require_once("../classes/inputfilter/class.inputfilter_clean.php"); + $myFilter = new InputFilter('','',1,1,1); + + $thissurvey=getSurveyInfo($surveyid); + + $quotasoutput .= ' +
            '."\n\n"; + foreach ($langs as $lang) + { + $quotasoutput .= ' +
            +

            '.GetLanguageNameFromCode($lang,false); + if ($lang==$baselang) {$quotasoutput .= '('.$clang->gT("Base language").')';} + $quotasoutput .= "

            "; + $quotasoutput.=' +
              +
            • + + +
            • +
            +
            '; + }; + + $quotasoutput .= ' + + + +
            +

            +

            '; + } + } + +?> diff --git a/include/limesurvey/admin/remotecontrol/lsrc.client.php b/include/limesurvey/admin/remotecontrol/lsrc.client.php index 23c9b499..41258988 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc.client.php +++ b/include/limesurvey/admin/remotecontrol/lsrc.client.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: lsrc.client.php 9648 2011-01-07 13:06:39Z c_schmitz $ + * $Id: lsrc.client.php 9031 2010-08-05 15:07:08Z wahrendorff $ * */ class lsrcClient { diff --git a/include/limesurvey/admin/remotecontrol/lsrc.config.php b/include/limesurvey/admin/remotecontrol/lsrc.config.php index 04e81de1..11b1752c 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc.config.php +++ b/include/limesurvey/admin/remotecontrol/lsrc.config.php @@ -1,78 +1,78 @@ - \ No newline at end of file diff --git a/include/limesurvey/admin/remotecontrol/lsrc.helper.php b/include/limesurvey/admin/remotecontrol/lsrc.helper.php index 8c720b8f..d728d1d5 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc.helper.php +++ b/include/limesurvey/admin/remotecontrol/lsrc.helper.php @@ -1,2460 +1,2463 @@ -surveyExists($iVid)) - { - $query2num = "SELECT owner_id FROM {$dbprefix}surveys WHERE sid=".sanitize_int($iVid).""; - $rs = db_execute_assoc($query2num); - $field=$rs->FetchRow(); - return $field['owner_id']; - - }else{return false;} - } - - /** - * This function changes data in LS-DB, its very sensitive, because every table can be changed. - * - * @param unknown_type $table - * @param unknown_type $key - * @param unknown_type $value - * @param unknown_type $where - * @return String - */ - function changeTable($table, $key, $value, $where, $mode='0')//XXX - {//be aware that this function may be a security risk - - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - if($mode=='' || !isset($mode) || $mode=='0') - { - $where = str_replace("\\","",$where); - $query2num = "SELECT {$key} FROM {$dbprefix}{$table} WHERE {$where}"; - $rs = db_execute_assoc($query2num); - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2num)"); - - $query2update = "update ".$dbprefix.$table." set ".$key."='".$value."' where ".$where.""; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2update)"); - - if($connect->Execute($query2update)){ - return $rs->RecordCount()." Rows changed"; - } - else{ - return "nothing changed"; - } - } - if($mode==1 || $mode=='1') - { - $query2insert = "INSERT INTO {$dbprefix}{$table} ({$key}) VALUES ({$value});"; - $this->debugLsrc("wir sind in Line ".__LINE__.", inserting ($query2insert)"); - if($connect->Execute($query2insert)) - { - $this->debugLsrc("wir sind in Line ".__LINE__.", inserting OK"); - return true; - - } - else - { - return false; - } - } - - - } - - /** - * - * Enter description here... - * @param $surveyid - * @param $type - * @param $maxLsrcEmails - * @return unknown_type - */ - function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX - { - global $publicurl,$maxemails; - global $connect,$sitename ; - global $dbprefix ; - $surveyid = sanitize_int($surveyid); - include("lsrc.config.php"); - - - - // wenn maxmails ber den lsrc gegeben wird das nutzen, ansonsten die default werte aus der config.php - if($maxLsrcEmails!='') - $maxemails = $maxLsrcEmails; - - switch ($type){ - case "custom": - - break; - case "invite": - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START invite "); - - - - if(isset($surveyid) && getEmailFormat($surveyid) == 'html') - { - $ishtml=true; - } - else - { - $ishtml=false; - } - - //$tokenoutput .= ("Sending Invitations"); - //if (isset($tokenid)) {$tokenoutput .= " (".("Sending to Token ID").": {$tokenid})";} - //$tokenoutput .= "\n"; - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); - // Texte für Mails aus der Datenbank holen und in die POST Dinger schreiben. Nicht schön aber praktikabel - - $sql = "SELECT surveyls_language, surveyls_email_invite_subj, surveyls_email_invite ". - "FROM {$dbprefix}surveys_languagesettings ". - "WHERE surveyls_survey_id = ".$surveyid." "; - - //GET SURVEY DETAILS - $thissurvey=getSurveyInfo($surveyid); - - // $connect->SetFetchMode(ADODB_FETCH_ASSOC); - // $sqlResult=$connect->Execute($sql); - $sqlResult = db_execute_assoc($sql); - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - - while($languageRow = $sqlResult->FetchRow()) - { - $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite']; - $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite_subj']; - } - - // if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') - // { - // $SQLemailstatuscondition = " AND emailstatus = 'OK'"; - // } - // else - // { - // $SQLemailstatuscondition = ""; - // } - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND emailstatus = 'OK' "; - - if (isset($tokenid)) {$ctquery .= " AND tid='{$tokenid}'";} - //$tokenoutput .= "\n"; - $ctresult = $connect->Execute($ctquery); - $ctcount = $ctresult->RecordCount(); - $ctfieldcount = $ctresult->FieldCount(); - - $emquery = "SELECT * "; - //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - - $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND emailstatus = 'OK' "; - - if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} - //$tokenoutput .= "\n\n\n\n"; - $emresult = db_select_limit_assoc($emquery,$maxemails); - $emcount = $emresult->RecordCount(); - - //$tokenoutput .= "\n" - ////."\t\n" - //."\t\t
            \n"; - - $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); - $baselanguage = GetBaseLanguageFromSurveyID($surveyid); - array_unshift($surveylangs,$baselanguage); - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - - foreach ($surveylangs as $language) - { - $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); - $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); - if ($ishtml) $_POST['message_'.$language] = html_entity_decode($_POST['message_'.$language], ENT_QUOTES, $emailcharset); - - } - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - if ($emcount > 0) - { - $mailsSend = 0; - while ($emrow = $emresult->FetchRow()) - { - $c=1; - unset($fieldsarray); - $to = $emrow['email']; - $fieldsarray["{EMAIL}"]=$emrow['email']; - $fieldsarray["{FIRSTNAME}"]=$emrow['firstname']; - $fieldsarray["{LASTNAME}"]=$emrow['lastname']; - $fieldsarray["{TOKEN}"]=$emrow['token']; - $fieldsarray["{LANGUAGE}"]=$emrow['language']; - while(isset($emrow["attribute_$c"])) - { - $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; - ++$c; - } - $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; - $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; - $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; - $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; - $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; - - $emrow['language']=trim($emrow['language']); - if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default - $found = array_search($emrow['language'], $surveylangs); - if ($found==false) {$emrow['language']=$baselanguage;} - - $from = $thissurvey['adminemail']; - - - if ($ishtml === false) - { - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; - } - else - { - $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; - } - } - else - { - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; - } - else - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; - } - } - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - $modsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); - $modmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); - - if (SendEmailMessage($modmessage, $modsubject, $to , $from, $sitename, $ishtml, getBounceEmail($surveyid))) - { - // Put date into sent - //$timeadjust = 0; - $today = date("Y-m-d H:i"); - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite Today:".$today); - $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" - ."SET sent='$today' WHERE tid={$emrow['tid']}"; - // - $uderesult = $connect->Execute($udequery); - $mailsSend++; - //$tokenoutput .= "[".("Invitation sent to:")."{$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; - } - else - { - //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); - if($n==1) - $failedAddresses .= ",".$to; - else - { - $failedAddresses = $to; - $n=1; - } - } - } - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - if ($ctcount > $emcount) - { - $lefttosend = $ctcount-$maxemails; - - }else{$lefttosend = 0;} - } - else - { - return "No Mails to send"; - } - - if($maxemails>0 && $maxemails!='') - { - $returnValue = "".$mailsSend." Mails send. ".$lefttosend." Mails left to send"; - if(isset($failedAddresses)) - $returnValue .= "\nCould not send to: ".$failedAddresses; - return $returnValue; - } - - if(isset($mailsSend)) - { - $returnValue = "".$mailsSend." Mails send. "; - if(isset($failedAddresses)) - $returnValue .= "\nCould not send to: ".$failedAddresses; - return $returnValue; - } - - - - - break; - case "remind": - // XXX: - // TODO: - // if (!isset($_POST['ok']) || !$_POST['ok']) - // { - - /* - * look if there were reminders send in the past, and if some tokens got lesser reminders than others - * - * - if so: send reminders to the unremindet participants until they got the same remindcount than the others - * - if not: send reminders normally - */ - - $remSQL = "SELECT tid, remindercount " - . "FROM ".db_table_name("tokens_{$surveyid}")." " - . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' " - . "ORDER BY remindercount desc LIMIT 1"; - - $this->debugLsrc("Executing SQL: ".$remSQL); - - $remResult = db_execute_assoc($remSQL); - $remRow = $remResult->FetchRow(); - - /* Get the reminder count from the row, if we have a row. If - * we don't have a row then we set reminderCount to 0 to prevent - * queries down below from bombing out. */ - $reminderCount = $remRow['remindercount']; - if(empty($reminderCount)) { - $this->debugLsrc("There are no reminders to send."); - $reminderCount = 0; - } - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$remRow['tid']."; ".$reminderCount." "); - - $sendOnlySQL = "SELECT tid, remindercount " - . "FROM ".db_table_name("tokens_{$surveyid}")." " - . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' AND remindercount < ".$reminderCount." " - . "ORDER BY tid asc LIMIT 1"; - - $this->debugLsrc("Executing SQL: ".$sendOnlySQL); - - if($sendOnlyResult->RecordCount()>0) - { - $sendOnlyRow = $sendOnlyResult->FetchRow(); - $starttokenid = $sendOnlyRow['tid']; - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$sendOnlyRow['tid']."; ".$sendOnlyRow['remindercount']." "); - } - - if(isset($surveyid) && getEmailFormat($surveyid) == 'html') - { - $ishtml=true; - } - else - { - $ishtml=false; - } - - //GET SURVEY DETAILS - $thissurvey=getSurveyInfo($surveyid); - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); - // Texte für Mails aus der Datenbank holen. - - $sql = "SELECT surveyls_language, surveyls_email_remind_subj, surveyls_email_remind ". - "FROM {$dbprefix}surveys_languagesettings ". - "WHERE surveyls_survey_id = ".$surveyid." "; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); - - $sqlResult = db_execute_assoc($sql); - - while($languageRow = $sqlResult->FetchRow()) - { - $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind']; - $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind_subj']; - } - - //$tokenoutput .= ("Sending Reminders")."\n"; - - $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); - $baselanguage = GetBaseLanguageFromSurveyID($surveyid); - array_unshift($surveylangs,$baselanguage); - - foreach ($surveylangs as $language) - { - $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); - $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); - - } - - $SQLemailstatuscondition = " AND emailstatus = 'OK'"; - - if (isset($_POST['maxremindercount']) && - $_POST['maxremindercount'] != '' && - intval($_POST['maxremindercount']) != 0) - { - $SQLremindercountcondition = " AND remindercount < ".intval($_POST['maxremindercount']); - } - else - { - $SQLremindercountcondition = ""; - } - - if (isset($_POST['minreminderdelay']) && - $_POST['minreminderdelay'] != '' && - intval($_POST['minreminderdelay']) != 0) - { - // $_POST['minreminderdelay'] in days (86400 seconds per day) - $compareddate = date_shift(date("Y-m-d H:i:s",time() - 86400 * intval($_POST['minreminderdelay'])), - "Y-m-d H:i",$timeadjust); - $SQLreminderdelaycondition = " AND ( " - . " (remindersent = 'N' AND sent < '".$compareddate."') " - . " OR " - . " (remindersent < '".$compareddate."'))"; - } - else - { - $SQLreminderdelaycondition = ""; - } - - $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed ='N' or completed ='') AND sent<>'' AND sent<>'N' AND token <>'' AND email <> '' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; - - if (isset($starttokenid)) {$ctquery .= " AND tid >= '{$starttokenid}'";} - // if (isset($tokenid) && $tokenid) {$ctquery .= " AND tid = '{$tokenid}'";} - // //$tokenoutput .= "\n"; - - $ctresult = $connect->Execute($ctquery) or $this->debugLsrc ("Database error!\n" . $connect->ErrorMsg()); - $ctcount = $ctresult->RecordCount(); - $ctfieldcount = $ctresult->FieldCount(); - $emquery = "SELECT * "; - //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} - - // TLR change to put date into sent - $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; - - if (isset($starttokenid)) {$emquery .= " AND tid >= '{$starttokenid}'";} - if (isset($tokenid) && $tokenid) {$emquery .= " AND tid = '{$tokenid}'";} - $emquery .= " ORDER BY tid "; - $emresult = db_select_limit_assoc($emquery, $maxemails); - //$emresult = db_execute_assoc($emquery); - $emcount = $emresult->RecordCount(); - - if ($emcount > 0) - { - while ($emrow = $emresult->FetchRow()) - { - $c=1; - unset($fieldsarray); - $to = $emrow['email']; - $fieldsarray["{EMAIL}"]=$emrow['email']; - $fieldsarray["{FIRSTNAME}"]=$emrow['firstname']; - $fieldsarray["{LASTNAME}"]=$emrow['lastname']; - $fieldsarray["{TOKEN}"]=$emrow['token']; - $fieldsarray["{LANGUAGE}"]=$emrow['language']; - while(isset($emrow["attribute_$c"])) - { - $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; - ++$c; - } - - $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; - $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; - $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; - $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; - $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; - - $emrow['language']=trim($emrow['language']); - if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default - if(!in_array($emrow['language'], $surveylangs)) {$emrow['language']=$baselanguage;} // if given language is not available use default - $found = array_search($emrow['language'], $surveylangs); - if ($found==false) {$emrow['language']=$baselanguage;} - - $from = $thissurvey['adminemail']; - - if (getEmailFormat($surveyid) == 'html') - { - $ishtml=true; - } - else - { - $ishtml=false; - } - - if ($ishtml == false) - { - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; - } - else - { - $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; - } - } - else - { - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; - } - else - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; - $_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset); - } - } - - $msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); - $sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); - - if (SendEmailMessage($sendmessage, $msgsubject, $to, $from, $sitename, $ishtml, getBounceEmail($surveyid))) - { - - // Put date into remindersent - $today = date("Y-m-d H:i"); - $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" - ."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}"; - // - $uderesult = $connect->Execute($udequery) or $this->debugLsrc ("Could not update tokens$udequery".$connect->ErrorMsg()); - //orig: $tokenoutput .= "\t\t\t({$emrow['tid']})[".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]\n"; - //$tokenoutput .= "\t\t\t({$emrow['tid']}) [".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; - $mailsSend++; - } - else - { - //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); - if($n==1) - $failedAddresses .= ",".$to; - else - { - $failedAddresses = $to; - $n=1; - } - - } - //$lasttid = $emrow['tid']; - - } - if ($ctcount > $emcount) - { - $lefttosend = $ctcount-$maxemails; - }else{$lefttosend = 0;} - } - else - { - return "No Reminders to send"; - } - - if($maxemails>0) - { - $returnValue = "".$mailsSend." Reminders send. ".$lefttosend." Reminders left to send"; - if(isset($failedAddresses)) - $returnValue .= "\nCould not send to: ".$failedAddresses; - return $returnValue; - } - - if(isset($mailsSend)) - { - $returnValue = "".$mailsSend." Reminders send. "; - if(isset($failedAddresses)) - $returnValue .= "\nCould not send to: ".$failedAddresses; - return $returnValue; - } - - - break; - default: - - break; - } - } - - /** - * loginCheck for Lsrc, checks if the user with given password exists in LS Database and - * sets the SESSION rights for this user - * @param String $sUser - * @param String $sPass - * @return boolean - */ - function checkUser($sUser, $sPass) // XXX - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - require(dirname(__FILE__)."/../classes/core/sha256.php"); - - $query="SELECT uid, password, lang, superadmin FROM {$dbprefix}users WHERE users_name=".$connect->qstr(sanitize_user($sUser)); - // echo $query; - $result = db_execute_assoc($query); - $gv = $result->FetchRow(); - if($result->RecordCount() < 1) - { - return false; - } - else - { - if((SHA256::hashing($sPass)==$gv['password'])) - { - $_SESSION['loginID']=$gv['uid']; - $_SESSION['lang']=$gv['lang']; - - $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$gv['uid']}"; - $sresult = db_execute_assoc($squery); //Checked - if ($sresult->RecordCount()>0) - { - $fields = $sresult->FetchRow(); - $_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey']; - $_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator']; - $_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user']; - $_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user']; - $_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin']; - $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template']; - $_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label']; - } - return true; - } - else - { - return false; - } - } - } - - /** - * Lsrc checks the existence of Surveys more than one time, so this makes sense to be DRY - * - * @param int $sid - * @return boolean - */ - function surveyExists($sid)//XXX - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - - $query="SELECT * FROM {$dbprefix}surveys WHERE sid = ".$sid; - // echo $query; - $result = db_execute_assoc($query); - if($result->RecordCount() < 1) - { - return false; - } - else - { - return true; - } - } - - /** - * function to import surveys - * - * @param $iVid - desired survey id - * @param $importFile - name of the file to import in core(survey) dir - * @return boolean - */ - function importSurvey($iVid, $importFile) - { - global $connect ; - global $dbprefix ; - global $clang; - - include("lsrc.config.php"); - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK "); - // HINT FOR IMPORTERS: go to Line 714 to manipulate the Survey, while it's imported - - $the_full_file_path = $coreDir.$importFile; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",the_full_file_path ='$the_full_file_path' OK "); - - include("../import_functions.php"); - include("../admin_functions.php"); - if (!isset($copyfunction)) - { - $sFullFilepath=$the_full_file_path; - $aPathInfo = pathinfo($sFullFilepath); - $sExtension = $aPathInfo['extension']; - } - - if (isset($sExtension) && strtolower($sExtension)=='csv') - { - $aImportResults=CSVImportSurvey($sFullFilepath,$iVid); - } - elseif (isset($sExtension) && strtolower($sExtension)=='lss') - { - $aImportResults=XMLImportSurvey($sFullFilepath,NULL,NULL,$iVid); - } elseif (isset($copyfunction)) - { - $aImportResults=XMLImportSurvey('',$copysurveydata,$sNewSurveyName,$iVid); - } - - //CANNOT BE USED BY LSRC RIGHT NOW - // Translate INSERTANS codes if chosen -// if (isset($aImportResults['fieldnames']) && $sTransLinks === true) -// { -// transInsertAns($aImportResults['newsid'],$aImportResults['oldsid'],$aImportResults['fieldnames']); -// } - - return $aImportResults['newsid']; - } - - /** - * function to activate surveys based on new activate.php 5771 2008-10-13 02:28:40Z jcleeland $ - * - * @param unknown_type $surveyid - * @return boolean - */ - function activateSurvey($surveyid)//XXX activateSurvey - { - global $dbprefix, $connect, $clang, $databasetype,$databasetabletype; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - include('../admin_functions.php'); - include('../activate_functions.php'); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - $returnOutput = activateSurvey($surveyid,$surveyid,'lsrc'); - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", $returnOutput "); - - return $returnOutput; - } // end activateSurvey(); - - /** - * not used, a test, thought this could maybe enhance security, may be deleted - * - * @return Error 404 fake - */ - function fake404()// XXX - { - return ' - - - Objekt nicht gefunden! - - - - - -

            Objekt nicht gefunden!

            -

            - - - Der angeforderte URL konnte auf dem Server nicht gefunden werden. - - - - Sofern Sie den URL manuell eingegeben haben, - überprüfen Sie bitte die Schreibweise und versuchen Sie es erneut. - - - -

            -

            - Sofern Sie dies für eine Fehlfunktion des Servers halten, - informieren Sie bitte den - Webmaster - hierüber. - -

            - -

            Error 404

            -
            - - '.$_SERVER["SERVER_NAME"].' - - '.date("m/d/Y H:i:s").' - Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6 mod_jk/1.2.26 -
            - - - - '; - } - - /** - * importing a group into an existing survey - * - * @param int $iVid SurveyID - * @param string $sMod Group that should be loaded into the Survey - */ - function importGroup($surveyid, $sMod) //XXX - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $newsid = $surveyid; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - - $the_full_file_path = $modDir.$sMod.".csv"; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK $the_full_file_path "); - - $handle = fopen($the_full_file_path, "r"); - while (!feof($handle)) - { - $buffer = fgets($handle); - $bigarray[] = $buffer; - } - fclose($handle); - - if (substr($bigarray[0], 0, 23) != "# LimeSurvey Group Dump" && substr($bigarray[0], 0, 24) != "# PHPSurveyor Group Dump") - { - //$importgroup .= "".("Error")."\n"; - //$importgroup .= ("This file is not a LimeSurvey group file. Import failed.")."\n"; - //$importgroup .= "\n"; - //$importgroup .= "
            \n"; - //unlink($the_full_file_path); - return false; - } - - for ($i=0; $i<9; $i++) - { - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - - //GROUPS - if (array_search("# QUESTIONS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# QUESTIONS TABLE\n", $bigarray); - } - elseif (array_search("# QUESTIONS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# QUESTIONS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$grouparray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //QUESTIONS - if (array_search("# ANSWERS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# ANSWERS TABLE\n", $bigarray); - } - elseif (array_search("# ANSWERS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# ANSWERS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$questionarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //ANSWERS - if (array_search("# CONDITIONS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# CONDITIONS TABLE\n", $bigarray); - } - elseif (array_search("# CONDITIONS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# CONDITIONS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$answerarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //CONDITIONS - if (array_search("# LABELSETS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# LABELSETS TABLE\n", $bigarray); - } - elseif (array_search("# LABELSETS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# LABELSETS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray); - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$conditionsarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //LABELSETS - if (array_search("# LABELS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# LABELS TABLE\n", $bigarray); - } - elseif (array_search("# LABELS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# LABELS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$labelsetsarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //LABELS - if (array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray)) - { - $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray); - } - elseif (array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$labelsarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //LAST LOT (now question_attributes) - if (!isset($noconditions) || $noconditions != "Y") - { - // stoppoint is the last line number - // this is an empty line after the QA CSV lines - $stoppoint = count($bigarray)-1; - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<=$stoppoint-1) {$question_attributesarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - } - $bigarray = array_values($bigarray); - - $countgroups=0; - if (isset($questionarray)) - { - $questionfieldnames=convertCSVRowToArray($questionarray[0],',','"'); - unset($questionarray[0]); - $countquestions = 0; - } - - if (isset($answerarray)) - { - $answerfieldnames=convertCSVRowToArray($answerarray[0],',','"'); - unset($answerarray[0]); - $countanswers = 0; - } - - $countconditions = 0; - $countlabelsets=0; - $countlabels=0; - $countquestion_attributes = 0; - $countanswers = 0; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // first check that imported group, questions and labels support the - // current survey's baselang - $langcode = GetBaseLanguageFromSurveyID($newsid); - if (isset($grouparray)) - { - $groupfieldnames = convertCSVRowToArray($grouparray[0],',','"'); - $langfieldnum = array_search("language", $groupfieldnames); - $gidfieldnum = array_search("gid", $groupfieldnames); - $groupssupportbaselang = bDoesImportarraySupportsLanguage($grouparray,Array($gidfieldnum),$langfieldnum,$langcode,true); - if (!$groupssupportbaselang) - { - //$importgroup .= "".("Error")."\n"; - //$importgroup .= ("You can't import a group which doesn't support the current survey's base language.")."\n"; - //$importgroup .= "\n"; - //$importgroup .= "\n"; - //unlink($the_full_file_path); - return "Group does not support Surveys Baselanguage ($langcode)"; - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - if (isset($questionarray)) - { - $langfieldnum = array_search("language", $questionfieldnames); - $qidfieldnum = array_search("qid", $questionfieldnames); - $questionssupportbaselang = bDoesImportarraySupportsLanguage($questionarray,Array($qidfieldnum), $langfieldnum,$langcode,false); - if (!$questionssupportbaselang) - { - //$importgroup .= "".("Error")."\n"; - //$importgroup .= ("You can't import a question which doesn't support the current survey's base language.")."\n"; - //$importgroup .= "\n"; - //$importgroup .= "\n"; - //unlink($the_full_file_path); - return "Group does not support Surveys Baselanguage ($langcode)"; - } - } - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - if (isset($labelsetsarray)) - { - $labelsetfieldname = convertCSVRowToArray($labelsetsarray[0],',','"'); - $langfieldnum = array_search("languages", $labelsetfieldname); - $lidfilednum = array_search("lid", $labelsetfieldname); - $labelsetssupportbaselang = bDoesImportarraySupportsLanguage($labelsetsarray,Array($lidfilednum),$langfieldnum,$langcode,true); - if (!$labelsetssupportbaselang) - { - $importquestion .= "".("Error")."\n" - .("You can't import label sets which don't support the current survey's base language")."\n" - ."\n"; - //unlink($the_full_file_path); - return "Group does not support Surveys Baselanguage ($langcode)"; - } - } - - $newlids = array(); // this array will have the "new lid" for the label sets, the key will be the "old lid" - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //DO ANY LABELSETS FIRST, SO WE CAN KNOW WHAT THEIR NEW LID IS FOR THE QUESTIONS - if (isset($labelsetsarray) && $labelsetsarray) { - $csarray=buildLabelSetCheckSumArray(); // build checksums over all existing labelsets - $count=0; - foreach ($labelsetsarray as $lsa) { - $fieldorders =convertCSVRowToArray($labelsetsarray[0],',','"'); - $fieldcontents=convertCSVRowToArray($lsa,',','"'); - if ($count==0) {$count++; continue;} - - $countlabelsets++; - - $labelsetrowdata=array_combine($fieldorders,$fieldcontents); - - // Save old labelid - $oldlid=$labelsetrowdata['lid']; - // set the new language - unset($labelsetrowdata['lid']); - $newvalues=array_values($labelsetrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $lsainsert = "INSERT INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix - $lsiresult=$connect->Execute($lsainsert); - - // Get the new insert id for the labels inside this labelset - $newlid=$connect->Insert_ID("{$dbprefix}labelsets",'lid'); - - if ($labelsarray) { - $count=0; - foreach ($labelsarray as $la) { - $lfieldorders =convertCSVRowToArray($labelsarray[0],',','"'); - $lfieldcontents=convertCSVRowToArray($la,',','"'); - if ($count==0) {$count++; continue;} - - // Combine into one array with keys and values since its easier to handle - $labelrowdata=array_combine($lfieldorders,$lfieldcontents); - $labellid=$labelrowdata['lid']; - if ($labellid == $oldlid) { - $labelrowdata['lid']=$newlid; - - // translate internal links - $labelrowdata['title']=translink('label', $oldlid, $newlid, $labelrowdata['title']); - - $newvalues=array_values($labelrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $lainsert = "INSERT INTO {$dbprefix}labels (".implode(',',array_keys($labelrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix - $liresult=$connect->Execute($lainsert); - $countlabels++; - } - } - } - - //CHECK FOR DUPLICATE LABELSETS - $thisset=""; - $query2 = "SELECT code, title, sortorder, language - FROM {$dbprefix}labels - WHERE lid=".$newlid." - ORDER BY language, sortorder, code"; - $result2 = db_execute_num($query2) or $this->debugLsrc("Died querying labelset $lid$query2".$connect->ErrorMsg()); - while($row2=$result2->FetchRow()) - { - $thisset .= implode('.', $row2); - } // while - $newcs=dechex(crc32($thisset)*1); - unset($lsmatch); - if (isset($csarray)) - { - foreach($csarray as $key=>$val) - { - if ($val == $newcs) - { - $lsmatch=$key; - } - } - } - if (isset($lsmatch)) - { - //There is a matching labelset. So, we will delete this one and refer - //to the matched one. - $query = "DELETE FROM {$dbprefix}labels WHERE lid=$newlid"; - $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labels$query".$connect->ErrorMsg()); - $query = "DELETE FROM {$dbprefix}labelsets WHERE lid=$newlid"; - $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labelset$query".$connect->ErrorMsg()); - $newlid=$lsmatch; - } - else - { - //There isn't a matching labelset, add this checksum to the $csarray array - $csarray[$newlid]=$newcs; - } - //END CHECK FOR DUPLICATES - $labelreplacements[]=array($oldlid, $newlid); - $newlids[$oldlid] = $newlid; - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //these arrays will aloud to insert correctly groups an questions multi languague survey imports correctly, and will eliminate the need to "searh" the imported data - //$newgids = array(); // this array will have the "new gid" for the groups, the kwy will be the "old gid" <-- not needed when importing groups - $newqids = array(); // this array will have the "new qid" for the questions, the kwy will be the "old qid" - - // DO GROUPS, QUESTIONS FOR GROUPS, THEN ANSWERS FOR QUESTIONS IN A __NOT__ NESTED FORMAT! - if (isset($grouparray) && $grouparray) - { - $surveylanguages=GetAdditionalLanguagesFromSurveyID($surveyid); - $surveylanguages[]=GetBaseLanguageFromSurveyID($surveyid); - - // do GROUPS - $gafieldorders=convertCSVRowToArray($grouparray[0],',','"'); - unset($grouparray[0]); - $newgid = 0; - $group_order = 0; // just to initialize this variable - foreach ($grouparray as $ga) - { - //GET ORDER OF FIELDS - $gacfieldcontents=convertCSVRowToArray($ga,',','"'); - $grouprowdata=array_combine($gafieldorders,$gacfieldcontents); - - // Skip not supported languages - if (!in_array($grouprowdata['language'],$surveylanguages)) - { - $skippedlanguages[]=$grouprowdata['language']; // this is for the message in the end. - continue; - } - - // replace the sid - $oldsid=$grouprowdata['sid']; - $grouprowdata['sid']=$newsid; - - // replace the gid or remove it if needed (it also will calculate the group order if is a new group) - $oldgid=$grouprowdata['gid']; - if ($newgid == 0) - { - unset($grouprowdata['gid']); - - // find the maximum group order and use this grouporder+1 to assign it to the new group - $qmaxgo = "select max(group_order) as maxgo from ".db_table_name('groups')." where sid=$newsid"; - $gres = db_execute_assoc($qmaxgo) or $this->debugLsrc (("Error")." Failed to find out maximum group order value\n$qmaxqo\n".$connect->ErrorMsg()); - $grow=$gres->FetchRow(); - $group_order = $grow['maxgo']+1; - } - else - $grouprowdata['gid'] = $newgid; - - $grouprowdata["group_order"]= $group_order; - - // Everything set - now insert it - $grouprowdata=array_map('convertCsvreturn2return', $grouprowdata); - - - // translate internal links - $grouprowdata['group_name']=translink('survey', $oldsid, $newsid, $grouprowdata['group_name']); - $grouprowdata['description']=translink('survey', $oldsid, $newsid, $grouprowdata['description']); - - $newvalues=array_values($grouprowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $ginsert = "insert INTO {$dbprefix}groups (".implode(',',array_keys($grouprowdata)).") VALUES (".implode(',',$newvalues).")"; - $gres = $connect->Execute($ginsert) or $this->debugLsrc("Error: ".": Failed to insert group\n$ginsert\n".$connect->ErrorMsg()); - - //GET NEW GID .... if is not done before and we count a group if a new gid is required - if ($newgid == 0) - { - $newgid = $connect->Insert_ID("{$dbprefix}groups",'gid'); - $countgroups++; - } - } - // GROUPS is DONE - - // do QUESTIONS - if (isset($questionarray) && $questionarray) - { - foreach ($questionarray as $qa) - { - $qacfieldcontents=convertCSVRowToArray($qa,',','"'); - $questionrowdata=array_combine($questionfieldnames,$qacfieldcontents); - - // Skip not supported languages - if (!in_array($questionrowdata['language'],$surveylanguages)) - continue; - - // replace the sid - $questionrowdata["sid"] = $newsid; - - // replace the gid (if the gid is not in the oldgid it means there is a problem with the exported record, so skip it) - if ($questionrowdata['gid'] == $oldgid) - $questionrowdata['gid'] = $newgid; - else - continue; // a problem with this question record -> don't consider - - // replace the qid or remove it if needed - $oldqid = $questionrowdata['qid']; - if (isset($newqids[$oldqid])) - $questionrowdata['qid'] = $newqids[$oldqid]; - else - unset($questionrowdata['qid']); - - // replace the lid for the new one (if there is no new lid in the $newlids array it mean that was not imported -> error, skip this record) - if (in_array($questionrowdata["type"], array("F","W","Z","H", "1", ":", ";"))) // only fot the questions that uses a label set. - if (isset($newlids[$questionrowdata["lid"]])) - { - $questionrowdata["lid"] = $newlids[$questionrowdata["lid"]]; - if(isset($newlids[$questionrowdata["lid1"]])) - { - $questionrowdata["lid1"] = $newlids[$questionrowdata["lid1"]]; - } - } - else - { - continue; // a problem with this question record -> don't consider - } - // $other = $questionrowdata["other"]; //Get 'other' field value - // $oldlid = $questionrowdata['lid']; - - // Everything set - now insert it - $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); - - // translate internal links ///XXX rakete may change question data here - // $questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']); - // $questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']); - // $questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']); - - $newvalues=array_values($questionrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $qinsert = "insert INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")"; - $qres = $connect->Execute($qinsert) or $this->debugLsrc ("Error: "."Failed to insert question\n$qinsert\n".$connect->ErrorMsg()); - - //GET NEW QID .... if is not done before and we count a question if a new qid is required - if (!isset($newqids[$oldqid])) - { - $newqids[$oldqid] = $connect->Insert_ID("{$dbprefix}questions",'qid'); - $myQid=$newqids[$oldqid]; - $countquestions++; - } - else - { - $myQid=$newqids[$oldqid]; - } - } - } - // QESTIONS is DONE - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // do ANSWERS - if (isset($answerarray) && $answerarray) - { - foreach ($answerarray as $aa) - { - $aacfieldcontents=convertCSVRowToArray($aa,',','"'); - $answerrowdata=array_combine($answerfieldnames,$aacfieldcontents); - - // Skip not supported languages - if (!in_array($answerrowdata['language'],$surveylanguages)) - continue; - - // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this answer is orphan -> error, skip this record) - if (isset($newqids[$answerrowdata["qid"]])) - $answerrowdata["qid"] = $newqids[$answerrowdata["qid"]]; - else - continue; // a problem with this answer record -> don't consider - - // Everything set - now insert it - $answerrowdata = array_map('convertCsvreturn2return', $answerrowdata); - - // translate internal links - $answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']); - - $newvalues=array_values($answerrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $ainsert = "insert INTO {$dbprefix}answers (".implode(',',array_keys($answerrowdata)).") VALUES (".implode(',',$newvalues).")"; - $ares = $connect->Execute($ainsert) or $this->debugLsrc ("Error: "."Failed to insert answer\n$ainsert\n".$connect->ErrorMsg()); - $countanswers++; - } - } - // ANSWERS is DONE - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // Fix question group sortorder - fixSortOrderGroups($surveyid); - $baselang = GetBaseLanguageFromSurveyID($surveyid); - $cdresult = db_execute_assoc("SELECT gid FROM ".db_table_name('groups')." WHERE sid='{$surveyid}' AND language='{$baselang}' ORDER BY group_order, group_name"); - $position=0; - while ($cdrow=$cdresult->FetchRow()) - { - $cd2query="UPDATE ".db_table_name('groups')." SET group_order='{$position}' WHERE gid='{$cdrow['gid']}' "; - $cd2result = $connect->Execute($cd2query) or $this->debugLsrc ("Couldn't update group_order$cd2query".$connect->ErrorMsg()); //Checked - $position++; - } - - - //... and for the questions inside the groups - // get all group ids and fix questions inside each group - $gquery = "SELECT gid FROM {$dbprefix}groups where sid=$newsid group by gid ORDER BY gid"; //Get last question added (finds new qid) - $gres = db_execute_assoc($gquery); - while ($grow = $gres->FetchRow()) - { - //fixsortorderQuestions(0,$grow['gid']); - $qid=sanitize_int(0); - $gid=sanitize_int($grow['gid']); - $baselang = GetBaseLanguageFromSurveyID($surveyid); - if ($gid == 0) - { - $result = db_execute_assoc("SELECT gid FROM ".db_table_name('questions')." WHERE qid='{$qid}' and language='{$baselang}'"); //Checked - $row=$result->FetchRow(); - $gid=$row['gid']; - } - $cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$gid}' and language='{$baselang}' ORDER BY question_order, title ASC"); //Checked - $position=0; - while ($cdrow=$cdresult->FetchRow()) - { - $cd2query="UPDATE ".db_table_name('questions')." SET question_order='{$position}' WHERE qid='{$cdrow['qid']}' "; - $cd2result = $connect->Execute($cd2query) or $this->debugLsrc ("Couldn't update question_order$cd2query".$connect->ErrorMsg()); //Checked - $position++; - } - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // do ATTRIBUTES - if (isset($question_attributesarray) && $question_attributesarray) - { - $fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"'); - unset($question_attributesarray[0]); - foreach ($question_attributesarray as $qar) { - $fieldcontents=convertCSVRowToArray($qar,',','"'); - $qarowdata=array_combine($fieldorders,$fieldcontents); - - // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this attribute is orphan -> error, skip this record) - if (isset($newqids[$qarowdata["qid"]])) - $qarowdata["qid"] = $newqids[$qarowdata["qid"]]; - else - continue; // a problem with this answer record -> don't consider - - unset($qarowdata["qaid"]); - - // Everything set - now insert it - $newvalues=array_values($qarowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $qainsert = "insert INTO {$dbprefix}question_attributes (".implode(',',array_keys($qarowdata)).") VALUES (".implode(',',$newvalues).")"; - $result=$connect->Execute($qainsert) or $this->debugLsrc ("Couldn't insert question_attribute$qainsert".$connect->ErrorMsg()); - $countquestion_attributes++; - } - } - // ATTRIBUTES is DONE - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // do CONDITIONS - if (isset($conditionsarray) && $conditionsarray) - { - $fieldorders=convertCSVRowToArray($conditionsarray[0],',','"'); - unset($conditionsarray[0]); - foreach ($conditionsarray as $car) { - $fieldcontents=convertCSVRowToArray($car,',','"'); - $conditionrowdata=array_combine($fieldorders,$fieldcontents); - - $oldqid = $conditionrowdata["qid"]; - $oldcqid = $conditionrowdata["cqid"]; - - // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this condition is orphan -> error, skip this record) - if (isset($newqids[$oldqid])) - $conditionrowdata["qid"] = $newqids[$oldqid]; - else - continue; // a problem with this answer record -> don't consider - - // replace the cqid for the new one (if there is no new qid in the $newqids array it mean that this condition is orphan -> error, skip this record) - if (isset($newqids[$oldcqid])) - $conditionrowdata["cqid"] = $newqids[$oldcqid]; - else - continue; // a problem with this answer record -> don't consider - - list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$conditionrowdata["cfieldname"],3); - - if ($oldcgid != $oldgid) // this means that the condition is in another group (so it should not have to be been exported -> skip it - continue; - - unset($conditionrowdata["cid"]); - - // recreate the cfieldname with the new IDs - $newcfieldname = $newsid . "X" . $newgid . "X" . $conditionrowdata["cqid"] .substr($oldqidanscode,strlen($oldqid)); - - $conditionrowdata["cfieldname"] = $newcfieldname; - if (!isset($conditionrowdata["method"]) || trim($conditionrowdata["method"])=='') - { - $conditionrowdata["method"]='=='; - } - $newvalues=array_values($conditionrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $conditioninsert = "insert INTO {$dbprefix}conditions (".implode(',',array_keys($conditionrowdata)).") VALUES (".implode(',',$newvalues).")"; - $result=$connect->Execute($conditioninsert) or $this->debugLsrc ("Couldn't insert condition$conditioninsert".$connect->ErrorMsg()); - $countconditions++; - } - } - $this->debugLsrc("wir sind in - ".__FUNCTION__." Line ".__LINE__.", FERTIG "); - // CONDITIONS is DONE - return array('gid'=>$newgid,'qid'=>$myQid); - //return $newgid; - } - - /** - * - * Enter description here... - * @param $surveyid - * @param $sMod - * @param $newGroup - * @return unknown_type - */ - function importQuestion($surveyid, $sMod, $newGroup=false) //XXX - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $newsid = $surveyid; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK $dbprefix "); - - //$getGidSql = "SELECT gid FROM {$dbprefix} "; - $getGidSql = "SELECT gid - FROM {$dbprefix}groups - WHERE sid=".$surveyid." AND language='".GetBaseLanguageFromSurveyID($surveyid)."' - ORDER BY gid desc "; - $getGidRs = db_execute_num($getGidSql); - $gidRow=$getGidRs->FetchRow(); - $gid = $gidRow[0]; - - if($gid=='')# - { - $this->debugLsrc("No Group for importing the question, available!"); - return "No Group for importing the question, available! Import failed."; - } - - if($newGroup===true) - ++$gid; - - $the_full_file_path = $queDir.$sMod.".csv"; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK $the_full_file_path "); - - $handle = fopen($the_full_file_path, "r"); - while (!feof($handle)) - { - $buffer = fgets($handle, 10240); //To allow for very long survey welcomes (up to 10k) - $bigarray[] = $buffer; - } - fclose($handle); - - // Now we try to determine the dataformat of the survey file. - if ((substr($bigarray[1], 0, 24) == "# SURVEYOR QUESTION DUMP")&& (substr($bigarray[4], 0, 29) == "# http://www.phpsurveyor.org/")) - { - $importversion = 100; // version 1.0 file - } - elseif - ((substr($bigarray[1], 0, 24) == "# SURVEYOR QUESTION DUMP")&& (substr($bigarray[4], 0, 37) == "# http://phpsurveyor.sourceforge.net/")) - { - $importversion = 99; // Version 0.99 file or older - carries a different URL - } - elseif - (substr($bigarray[0], 0, 26) == "# LimeSurvey Question Dump" || substr($bigarray[0], 0, 27) == "# PHPSurveyor Question Dump") - { // Wow.. this seems to be a >1.0 version file - these files carry the version information to read in line two - $importversion=substr($bigarray[1], 12, 3); - } - else // unknown file - show error message - { - // $importquestion .= "".("Error")."\n"; - // $importquestion .= ("This file is not a LimeSurvey question file. Import failed.")."\n"; - // $importquestion .= "\n"; - // $importquestion .= "\n\n"; - // unlink($the_full_file_path); - return "This is not a Limesurvey question file. Import failed"; - } - - // if ($importversion != $dbversionnumber) - // { - //// $importquestion .= "".("Error")."\n"; - //// $importquestion .= ("Sorry, importing questions is limited to the same version. Import failed.")."\n"; - //// $importquestion .= "\n"; - //// $importquestion .= "\n\n"; - //// unlink($the_full_file_path); - // return; - // } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - for ($i=0; $i<9; $i++) //skipping the first lines that are not needed - { - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //QUESTIONS - if (array_search("# ANSWERS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# ANSWERS TABLE\n", $bigarray); - } - elseif (array_search("# ANSWERS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# ANSWERS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$questionarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //ANSWERS - if (array_search("# LABELSETS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# LABELSETS TABLE\n", $bigarray); - } - elseif (array_search("# LABELSETS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# LABELSETS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$answerarray[] = str_replace("`default`", "`default_value`", $bigarray[$i]);} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //LABELSETS - if (array_search("# LABELS TABLE\n", $bigarray)) - { - $stoppoint = array_search("# LABELS TABLE\n", $bigarray); - } - elseif (array_search("# LABELS TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# LABELS TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$labelsetsarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //LABELS - if (array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray)) - { - $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray); - } - elseif (array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray)) - { - $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray); - } - else - { - $stoppoint = count($bigarray)-1; - } - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-2) {$labelsarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - $bigarray = array_values($bigarray); - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //Question_attributes - if (!isset($noconditions) || $noconditions != "Y") - { - $stoppoint = count($bigarray); - for ($i=0; $i<=$stoppoint+1; $i++) - { - if ($i<$stoppoint-1) {$question_attributesarray[] = $bigarray[$i];} - unset($bigarray[$i]); - } - } - $bigarray = array_values($bigarray); - - if (isset($questionarray)) {$countquestions = count($questionarray)-1;} else {$countquestions=0;} - if (isset($answerarray)) - { - $answerfieldnames=convertCSVRowToArray($answerarray[0],',','"'); - unset($answerarray[0]); - $countanswers = count($answerarray); - } - else {$countanswers=0;} - if (isset($labelsetsarray)) {$countlabelsets = count($labelsetsarray)-1;} else {$countlabelsets=0;} - if (isset($labelsarray)) {$countlabels = count($labelsarray)-1;} else {$countlabels=0;} - if (isset($question_attributesarray)) {$countquestion_attributes = count($question_attributesarray)-1;} else {$countquestion_attributes=0;} - - $languagesSupported = array(); // this array will keep all the languages supported for the survey - - // Let's check that imported objects support at least the survey's baselang - $langcode = GetBaseLanguageFromSurveyID($surveyid); - - $languagesSupported[$langcode] = 1; // adds the base language to the list of supported languages - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - if ($countquestions > 0) - { - $questionfieldnames = convertCSVRowToArray($questionarray[0],',','"'); - $langfieldnum = array_search("language", $questionfieldnames); - $qidfieldnum = array_search("qid", $questionfieldnames); - $questionssupportbaselang = bDoesImportarraySupportsLanguage($questionarray,Array($qidfieldnum), $langfieldnum,$langcode,true); - if (!$questionssupportbaselang) - { - // $importquestion .= "".("Error")."\n" - // .("You can't import a question which doesn't support the current survey's base language")."\n" - // ."\n"; - // unlink($the_full_file_path); - return "You can't import a question which doesn't support the current survey's base language"; - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - foreach (GetAdditionalLanguagesFromSurveyID($surveyid) as $language) - { - $languagesSupported[$language] = 1; - } - - // Let's assume that if the questions do support tye baselang - // Then the answers do support it as well. - // ==> So the following section is commented for now - //if ($countanswers > 0) - //{ - // $langfieldnum = array_search("language", $answerfieldnames); - // $answercodefilednum1 = array_search("qid", $answerfieldnames); - // $answercodefilednum2 = array_search("code", $answerfieldnames); - // $answercodekeysarr = Array($answercodefilednum1,$answercodefilednum2); - // $answerssupportbaselang = bDoesImportarraySupportsLanguage($answerarray,$answercodekeysarr,$langfieldnum,$langcode); - // if (!$answerssupportbaselang) - // { - // $importquestion .= "".("Error")."\n" - // .("You can't import answers which don't support current survey's base language")."\n" - // ."\n"; - // return; - // } - // - //} - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - if ($countlabelsets > 0) - { - $labelsetfieldname = convertCSVRowToArray($labelsetsarray[0],',','"'); - $langfieldnum = array_search("languages", $labelsetfieldname); - $lidfilednum = array_search("lid", $labelsetfieldname); - $labelsetssupportbaselang = bDoesImportarraySupportsLanguage($labelsetsarray,Array($lidfilednum),$langfieldnum,$langcode,true); - if (!$labelsetssupportbaselang) - { - // $importquestion .= "".("Error")."\n" - // .("You can't import label sets which don't support the current survey's base language")."\n" - // ."\n"; - // unlink($the_full_file_path); - return "You can't import label sets which don't support the current survey's base language"; - } - } - // I assume that if a labelset supports the survey's baselang, - // then it's labels do support it as well - - // GET SURVEY AND GROUP DETAILS - //$surveyid=$postsid; - //$gid=$postgid; - $newsid=$surveyid; - $newgid=$gid; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - - //DO ANY LABELSETS FIRST, SO WE CAN KNOW WHAT THEIR NEW LID IS FOR THE QUESTIONS - if (isset($labelsetsarray) && $labelsetsarray) { - $csarray=buildLabelSetCheckSumArray(); // build checksums over all existing labelsets - $count=0; - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - foreach ($labelsetsarray as $lsa) { - $fieldorders =convertCSVRowToArray($labelsetsarray[0],',','"'); - $fieldcontents=convertCSVRowToArray($lsa,',','"'); - if ($count==0) {$count++; continue;} - - $labelsetrowdata=array_combine($fieldorders,$fieldcontents); - - // Save old labelid - $oldlid=$labelsetrowdata['lid']; - // set the new language - unset($labelsetrowdata['lid']); - $newvalues=array_values($labelsetrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $lsainsert = "INSERT INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix - $lsiresult=$connect->Execute($lsainsert); - - // Get the new insert id for the labels inside this labelset - $newlid=$connect->Insert_ID("{$dbprefix}labelsets","lid"); - - if ($labelsarray) { - $count=0; - foreach ($labelsarray as $la) { - $lfieldorders =convertCSVRowToArray($labelsarray[0],',','"'); - $lfieldcontents=convertCSVRowToArray($la,',','"'); - if ($count==0) {$count++; continue;} - - // Combine into one array with keys and values since its easier to handle - $labelrowdata=array_combine($lfieldorders,$lfieldcontents); - $labellid=$labelrowdata['lid']; - if ($labellid == $oldlid) { - $labelrowdata['lid']=$newlid; - - // translate internal links - $labelrowdata['title']=translink('label', $oldlid, $newlid, $labelrowdata['title']); - - $newvalues=array_values($labelrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $lainsert = "INSERT INTO {$dbprefix}labels (".implode(',',array_keys($labelrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix - $liresult=$connect->Execute($lainsert); - } - } - } - - //CHECK FOR DUPLICATE LABELSETS - $thisset=""; - $query2 = "SELECT code, title, sortorder, language - FROM {$dbprefix}labels - WHERE lid=".$newlid." - ORDER BY language, sortorder, code"; - $result2 = db_execute_num($query2) or $this->debugLsrc("Died querying labelset $lid$query2".$connect->ErrorMsg()); - while($row2=$result2->FetchRow()) - { - $thisset .= implode('.', $row2); - } // while - $newcs=dechex(crc32($thisset)*1); - unset($lsmatch); - if (isset($csarray)) - { - foreach($csarray as $key=>$val) - { - if ($val == $newcs) - { - $lsmatch=$key; - } - } - } - if (isset($lsmatch)) - { - //There is a matching labelset. So, we will delete this one and refer - //to the matched one. - $query = "DELETE FROM {$dbprefix}labels WHERE lid=$newlid"; - $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labels$query".$connect->ErrorMsg()); - $query = "DELETE FROM {$dbprefix}labelsets WHERE lid=$newlid"; - $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labelset$query".$connect->ErrorMsg()); - $newlid=$lsmatch; - } - else - { - //There isn't a matching labelset, add this checksum to the $csarray array - $csarray[$newlid]=$newcs; - } - //END CHECK FOR DUPLICATES - $labelreplacements[]=array($oldlid, $newlid); - } - } - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - - // QUESTIONS, THEN ANSWERS FOR QUESTIONS IN A NESTED FORMAT! - if (isset($questionarray) && $questionarray) { - $qafieldorders=convertCSVRowToArray($questionarray[0],',','"'); - unset($questionarray[0]); - - //Assuming we will only import one question at a time we will now find out the maximum question order in this group - //and save it for later - $qmaxqo = "SELECT MAX(question_order) AS maxqo FROM ".db_table_name('questions')." WHERE sid=$newsid AND gid=$newgid"; - $qres = db_execute_assoc($qmaxqo) or $this->debugLsrc ("Error: ".": Failed to find out maximum question order value\n$qmaxqo\n".$connect->ErrorMsg()); - $qrow=$qres->FetchRow(); - $newquestionorder=$qrow['maxqo']+1; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - - foreach ($questionarray as $qa) { - $qacfieldcontents=convertCSVRowToArray($qa,',','"'); - $newfieldcontents=$qacfieldcontents; - $questionrowdata=array_combine($qafieldorders,$qacfieldcontents); - if (isset($languagesSupported[$questionrowdata["language"]])) - { - $oldqid = $questionrowdata['qid']; - $oldsid = $questionrowdata['sid']; - $oldgid = $questionrowdata['gid']; - - // Remove qid field if there is no newqid; and set it to newqid if it's set - if (!isset($newqid)) - unset($questionrowdata['qid']); - else - $questionrowdata['qid'] = $newqid; - - $questionrowdata["sid"] = $newsid; - $questionrowdata["gid"] = $newgid; - $questionrowdata["question_order"] = $newquestionorder; - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // Now we will fix up the label id - $type = $questionrowdata["type"]; //Get the type - if ($type == "F" || $type == "H" || $type == "1" || $type == ":" || $type == ";" ) - {//IF this is a flexible label array, update the lid entry - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - - if (isset($labelreplacements)) { - foreach ($labelreplacements as $lrp) { - if ($lrp[0] == $questionrowdata["lid"]) { - $questionrowdata["lid"]=$lrp[1]; - } - if ($lrp[0] == $questionrowdata["lid1"]) { - $questionrowdata["lid1"]=$lrp[1]; - } - } - } - } - $other = $questionrowdata["other"]; //Get 'other' field value - $oldlid = $questionrowdata["lid"]; - $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); - - // translate internal links - $questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']); - $questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']); - $questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']); - - $newvalues=array_values($questionrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $qinsert = "INSERT INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")"; - $qres = $connect->Execute($qinsert) or $this->debugLsrc ("Error: ".": Failed to insert question\n$qinsert\n".$connect->ErrorMsg()); - - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // set the newqid only if is not set - if (!isset($newqid)) - $newqid=$connect->Insert_ID("{$dbprefix}questions","qid"); - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - //NOW DO ANSWERS FOR THIS QID - Is called just once and only if there was a question - if (isset($answerarray) && $answerarray) { - foreach ($answerarray as $aa) { - $answerfieldcontents=convertCSVRowToArray($aa,',','"'); - $answerrowdata=array_combine($answerfieldnames,$answerfieldcontents); - if ($answerrowdata===false) - { - $importquestion.=''.("Faulty line in import - fields and data don't match").":".implode(',',$answerfieldcontents); - } - if (isset($languagesSupported[$answerrowdata["language"]])) - { - $code=$answerrowdata["code"]; - $thisqid=$answerrowdata["qid"]; - $answerrowdata["qid"]=$newqid; - - // translate internal links - $answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']); - - $newvalues=array_values($answerrowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $ainsert = "INSERT INTO {$dbprefix}answers (".implode(',',array_keys($answerrowdata)).") VALUES (".implode(',',$newvalues).")"; - $ares = $connect->Execute($ainsert) or $this->debugLsrc ("Error: ".": Failed to insert answer\n$ainsert\n".$connect->ErrorMsg()); - } - } - } - $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); - // Finally the question attributes - Is called just once and only if there was a question - if (isset($question_attributesarray) && $question_attributesarray) {//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES - $fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"'); - unset($question_attributesarray[0]); - foreach ($question_attributesarray as $qar) { - $fieldcontents=convertCSVRowToArray($qar,',','"'); - $qarowdata=array_combine($fieldorders,$fieldcontents); - $qarowdata["qid"]=$newqid; - unset($qarowdata["qaid"]); - - $newvalues=array_values($qarowdata); - $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly - $qainsert = "INSERT INTO {$dbprefix}question_attributes (".implode(',',array_keys($qarowdata)).") VALUES (".implode(',',$newvalues).")"; - $result=$connect->Execute($qainsert) or $this->debugLsrc ("Couldn't insert question_attribute$qainsert".$connect->ErrorMsg()); - } - } - - } - $this->debugLsrc("wir sind in - ".__FUNCTION__." Line ".__LINE__.", FERTIG "); - // CONDITIONS is DONE - return array('gid'=>$newgid,'qid'=>$newqid); - //return $newgid; - } - - /** - * function to delete a Survey with all questions and answersand Tokentable.... - * - * @param int $surveyid - * @return boolean - */ - function deleteSurvey($surveyid) - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK "); - - $tablelist = $connect->MetaTables(); - $dict = NewDataDictionary($connect); - - if (in_array("{$dbprefix}survey_$surveyid", $tablelist)) //delete the survey_$surveyid table - { - $dsquery = $dict->DropTableSQL("{$dbprefix}survey_$surveyid"); - //$dict->ExecuteSQLArray($sqlarray); - $dsresult = $dict->ExecuteSQLArray($dsquery); - } - - if (in_array("{$dbprefix}tokens_$surveyid", $tablelist)) //delete the tokens_$surveyid table - { - $dsquery = $dict->DropTableSQL("{$dbprefix}tokens_$surveyid"); - $dsresult = $dict->ExecuteSQLArray($dsquery) or $this->debugLsrc ("Couldn't \"$dsquery\" because ".$connect->ErrorMsg()); - } - - $dsquery = "SELECT qid FROM {$dbprefix}questions WHERE sid=$surveyid"; - $dsresult = db_execute_assoc($dsquery) or $this->debugLsrc ("Couldn't find matching survey to delete: \n $dsquery \n".$connect->ErrorMsg()); - while ($dsrow = $dsresult->FetchRow()) - { - $asdel = "DELETE FROM {$dbprefix}answers WHERE qid={$dsrow['qid']}"; - $asres = $connect->Execute($asdel); - $cddel = "DELETE FROM {$dbprefix}conditions WHERE qid={$dsrow['qid']}"; - $cdres = $connect->Execute($cddel) or die(); - $qadel = "DELETE FROM {$dbprefix}question_attributes WHERE qid={$dsrow['qid']}"; - $qares = $connect->Execute($qadel); - } - - $qdel = "DELETE FROM {$dbprefix}questions WHERE sid=$surveyid"; - $qres = $connect->Execute($qdel); - - $scdel = "DELETE FROM {$dbprefix}assessments WHERE sid=$surveyid"; - $scres = $connect->Execute($scdel); - - $gdel = "DELETE FROM {$dbprefix}groups WHERE sid=$surveyid"; - $gres = $connect->Execute($gdel); - - $slsdel = "DELETE FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=$surveyid"; - $slsres = $connect->Execute($slsdel); - - $srdel = "DELETE FROM {$dbprefix}surveys_permissions WHERE sid=$surveyid"; - $srres = $connect->Execute($srdel); - - $srdel = "DELETE FROM {$dbprefix}saved_control WHERE sid=$surveyid"; - $srres = $connect->Execute($srdel); - - $sdel = "DELETE FROM {$dbprefix}surveys WHERE sid=$surveyid"; - $sres = $connect->Execute($sdel); - $surveyid=false; - - return true; - - } - - /** - * This function pulls a CSV representation of the Field map - * - * @param mixed $surveyid - the survey ID you want the Fieldmap for - * @return String $fieldmap - */ - function FieldMap2CSV($surveyid) - { - $fields=array("fieldname", "type", "sid", "gid", "qid", "aid",'title','question','group_name','lid','lid1'); - $fieldmap=createFieldMap($surveyid,'full'); - - $result='"'.implode('","',$fields).'"'."\n"; - foreach ($fieldmap as $entry) - { - - $destfieldmap=array(); - foreach ($fields as $field) - { - if (isset($entry[$field])) - { - $destfieldmap[$field]=$entry[$field]; - } - else - { - $destfieldmap[$field]=''; - } - } - $entry=array_map('CSVEscape',array_values($destfieldmap)); - $result.=implode(',',$entry)."\n"; - } - return $result; - } - - function sendStatistic($surveyid, $to, $tempFile, $html=null) - { - include("lsrc.config.php"); - global $sitename; - global $clang; - - - if($tempFile==null && isset($html)) - { - $css = ""; - - $message = sprintf($clang->gT("This is your personal statistic sheet for survey #%s"),$css."
            ".$message.$surveyid."
            ".$html."
            "); - return SendEmailMessage($message, sprintf($clang->gT("Statistics Survey #%s"),$surveyid), $to, getBounceEmail($surveyid), $sitename, true); - } - else - { - $message = sprintf($clang->gT("This is your personal statistic sheet for survey #%s"),$surveyid); - return SendEmailMessage($message, sprintf($clang->gT("Statistics Survey #%s"),$surveyid), $to , getBounceEmail($surveyid), $sitename, $ishtml, getBounceEmail($surveyid), $tempFile); - } - - } - private function getqtypelist($SelectedCode = "T", $ReturnType = "array") - { - include("lsrc.config.php"); - global $publicurl; - //global $sourcefrom, $clang; - - - $qtypes = array( - "1"=>"Array (Flexible Labels) Dual Scale", - "5"=>"5 Point Choice", - "A"=>"Array (5 Point Choice)", - "B"=>"Array (10 Point Choice)", - "C"=>"Array (Yes/No/Uncertain)", - "D"=>"Date", - "E"=>"Array (Increase, Same, Decrease)", - "F"=>"Array (Flexible Labels)", - "G"=>"Gender", - "H"=>"Array (Flexible Labels) by Column", - "I"=>"Language Switch", - "K"=>"Multiple Numerical Input", - "L"=>"List (Radio)", - "M"=>"Multiple choice", - "N"=>"Numerical Input", - "O"=>"List With Comment", - "P"=>"Multiple choice with comments", - "Q"=>"Multiple Short Text", - "R"=>"Ranking", - "S"=>"Short Free Text", - "T"=>"Long Free Text", - "U"=>"Huge Free Text", - "W"=>"List (Flexible Labels) (Dropdown)", - "X"=>"Boilerplate Question", - "Y"=>"Yes/No", - "Z"=>"List (Flexible Labels) (Radio)", - "!"=>"List (Dropdown)", - ":"=>"Array (Multi Flexible) (Numbers)", - ";"=>"Array (Multi Flexible) (Text)", - ); - asort($qtypes); - if ($ReturnType == "array") - {return $qtypes;} - - - } - /** - * This function removes the UTF-8 Byte Order Mark from a string - * - * @param string $str - * @return string - */ - private function removeBOM($str=""){ - if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { - $str=substr($str, 3); - } - return $str; - } - /** - * create a token table for the given survey id - * @param $iVid - * @return unknown_type - */ - function createTokenTable($iVid, $att=0) - { - global $connect; - global $dbprefix; - - global $databasetabletype; - global $databasetype; - - global $rootdir; - - global $defaultlang; - - include("lsrc.config.php"); - - require_once($rootdir.'/classes/core/language.php'); - $clang = new limesurvey_lang($defaultlang); - // check if the Token table already exists, if not, create it... - if(!db_tables_exist("{$dbprefix}tokens_".$iVid)) - { - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Token Table existiert nicht "); - $createtokentable = - "tid int I NOT NULL AUTO PRIMARY,\n " - . "firstname C(40) ,\n " - . "lastname C(40) ,\n "; - //MSSQL needs special treatment because of some strangeness in ADODB - if ($databasetype == 'odbc_mssql' || $databasetype == 'odbtp' || $databasetype == 'mssql_n' || $databasetype == 'mssqlnative') - { - $createtokentable.= "email text ,\n " - ."emailstatus text ,\n "; - } - else - { - $createtokentable.= "email text ,\n " - ."emailstatus text ,\n "; - } - - $createtokentable.= "token C(36) ,\n " - . "language C(25) ,\n " - . "sent C(17) DEFAULT 'N',\n " - . "remindersent C(17) DEFAULT 'N',\n " - . "remindercount int I DEFAULT 0,\n " - . "completed C(17) DEFAULT 'N',\n " - . "validfrom date ,\n " - . "validuntil date ,\n " - . "mpid I "; - - $tabname = "{$dbprefix}tokens_{$iVid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) - $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', - 'mysqli' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); - $dict = NewDataDictionary($connect); - $sqlarray = $dict->CreateTableSQL($tabname, $createtokentable, $taboptarray); - $execresult = $dict->ExecuteSQLArray($sqlarray, false); - - $createtokentableindex = $dict->CreateIndexSQL("{$tabname}_idx", $tabname, array('token')); - $dict->ExecuteSQLArray($createtokentableindex, false); - if($execresult!=0) - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", token table created "); - else - { - $this->debugLsrc("WARNING: ".__FUNCTION__." Line ".__LINE__.", token table NOT created "); - $this->debugLsrc($createtokentable); - while(list($key, $value)= each($sqlarray) ) - { - $this->debugLsrc("$key - $value"); - } - } - $n=1; - while($att>=$n) - { - $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n anlegen ,sql: $sql"); - //modify_database("","$sql"); - $connect->Execute($sql); - ++$n; - } - } - return; - } - /** - * The new one... - * * Function to insert Participant data while auto creating token if non is supported... - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sParticipantData (FIRSTNAME;LASTNAME;EMAIL;LANG;TOKEN;VALIDFROM;VALIDTO;attrib1,attrib2,attrib3,attrib4,attrib5::) - * @return unknown_type - */ - function insertParticipants($iVid, $sParticipantData) - { - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - //$this = new lsrcHelper(); - // check for appropriate rights - // if(!$this->checkUser($sUser, $sPass)) - // { - // throw new SoapFault("Authentication: ", "User or password wrong"); - // exit; - // } - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $iVid, $sParticipantData "); - - // check if there is a $iVid, else abort - if(!isset($iVid) || $iVid=='' || $iVid==0 ) - { - return 0; - } - - // check if the Survey we want to populate with data and tokens already exists, else -> Fault - if(!$this->surveyExists($iVid)) - { - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", survey does not exist "); - return 0; - } - - $this->createTokenTable($iVid); - - //set the Seperators to default if nothing is set in the lsrc.config.php - if(!isset($sDatasetSeperator) || $sDatasetSeperator=='') - {$sDatasetSeperator = "::";} - if(!isset($sDatafieldSeperator) || $sDatafieldSeperator=='') - {$sDatafieldSeperator = ";";} - - // prepare to fill the table lime_tokens_* - // this is sensitiv, if the Seperator is not the defined one, almost everything could happen, BE AWARE OF YOUR SEPERATOR!... - $asDataset = explode($sDatasetSeperator, $sParticipantData); - // write the tokens to the token_table - $iCountParticipants = count($asDataset); - $iInsertedParticipants=0; - - foreach($asDataset as $sData) - { - //some extra sql statement comes in here later - $attributes=''; - $attributesData=''; - $validity=''; - $validityData=''; - if($sData!='') - { - $asDatafield = explode($sDatafieldSeperator, $sData); - $checkCnt=1; - - $iDataLength = count($asDatafield); - for($n=0;$n>=$iDataLength;++$n) - { - if($asDatafield[$n]=='') - { - $asDatafield[$n]=null; - } - } - - // token generieren - - - while($checkCnt>0) - { - $value = sRandomChars(10); //change sRandomChars value for different tokenlength (up to 36 chars max.) - $cQuery= "select token from ".$dbprefix."tokens_".$iVid." where token = '".$value."'; "; - $result = db_execute_assoc($cQuery); - $checkCnt = $result->RecordCount(); - } - if(!isset($asDatafield[4]) || $asDatafield[4]=='') - { - $asDatafield[4]= $value; - } - - //set session language if no language is set - if(!isset($asDatafield[3]) || $asDatafield[3]=='') - { - $asDatafield[3] = $_SESSION['lang']; - } - - //Begin to prepare our statement here. One array for the columns to insert and a parallel array with the values. - $insertColumns = array('firstname', 'lastname', 'email', 'language', 'token'); - $insertValues = array($asDatafield[0], $asDatafield[1], $asDatafield[2], $asDatafield[3], $asDatafield[4]); - - if(isset($asDatafield[5]) && $asDatafield[5]!=null) - { - //$validity .= ',validfrom'; - //$validityData .=",'$asDatafield[5]'"; - $insertColumns[] = 'validfrom'; - $insertValues[] = $asDatafield[5]; - } - if(isset($asDatafield[6]) && $asDatafield[5]!=null) - { - //$validity .= ',validuntil'; - //$validityData .=",'$asDatafield[6]'"; - $insertColumns[] = 'validuntil'; - $insertValues[] = $asDatafield[6]; - } - - if(isset($asDatafield[7]) && $asDatafield[7]!='') - { - $asAttributes = explode(",", $asDatafield[7]); - $n=0; - foreach($asAttributes as $attribute) - { - - ++$n; - //$check = "SELECT attribute_$n FROM {$dbprefix}_tokens_$iVid "; - - $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; - //$attributes.=",attribute_$n"; - //$attributesData.= ",'$attribute'"; - $insertColumns[] = "attribute_$n"; - $insertValues[] = $attribute; - - $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n mit $attribute anlegen ,sql: $sql"); - //modify_database("","$sql"); - $connect->Execute($sql); - - } - } - - - /*$sInsertParti = "INSERT INTO ".$dbprefix."tokens_".$iVid - ."(firstname,lastname,email,token," - ."language $validity $attributes) " - ."VALUES ('{$asDatafield[0]}', '{$asDatafield[1]}' , '{$asDatafield[2]}', '{$asDatafield[4]}' , " - ."'{$asDatafield[3]}' $validityData $attributesData) ";*/ - - $sInsertParti = "INSERT INTO {$dbprefix}tokens_$iVid (".implode(',', $insertColumns).") VALUES (".trim(str_repeat('?,', count($insertColumns)), ',').");"; - - - - $this->debugLsrc("$sInsertParti"); - - - // $sInsertParti = "INSERT INTO ".$dbprefix."tokens_".$iVid - // ."(firstname,lastname,email,emailstatus,token," - // ."language,sent,completed,attribute_1,attribute_2,mpid)" - // ."VALUES ('".$asDatafield[0]."' , - // '".$asDatafield[1]."' , '".$asDatafield[2]."' , 'OK' , '".$asDatafield[5]."', - // '".$_SESSION['lang']."', 'N', 'N', '".$asDatafield[3]."' , '".$asDatafield[4]."' , NULL); "; - // - if($connect->Execute($sInsertParti, $insertValues)) - { - ++$iInsertedParticipants; - // check participants eMail status and set it - // see http://data.iana.org/TLD/tlds-alpha-by-domain.txt - $maxrootdomainlength = 32; - if(1==preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $asDatafield[2])) - $this->changeTable("tokens_".$iVid,"emailstatus","OK","email='{$asDatafield[2]}'"); - - // if(isset($asDatafield[7]) && $asDatafield[7]!='') - // { - // $asAttributes = explode(",", $asDatafield[7]); - // $n=0; - // foreach($asAttributes as $attribute) - // { - // - // ++$n; - // //$check = "SELECT attribute_$n FROM {$dbprefix}_tokens_$iVid "; - // - // $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; - // $attributes.=",attribute_$n"; - // $attributesData.= ",'$attribute'"; - // - // $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n mit $attribute anlegen ,sql: $sql"); - // //modify_database("","$sql"); - // $connect->Execute($sql); - // - // - // $insert = "UPDATE {$dbprefix}tokens_$iVid " - // . " SET attribute_$n='$attribute' WHERE token='$asDatafield[4]' "; - // - // $this->debugLsrc("$insert"); - // $connect->Execute($insert); - // } - // } - } - - } - - } - return "".$iCountParticipants."Datasets given, ".$iInsertedParticipants." rows inserted. "; - } +surveyExists($iVid)) + { + $query2num = "SELECT owner_id FROM {$dbprefix}surveys WHERE sid=".sanitize_int($iVid).""; + $rs = db_execute_assoc($query2num); + $field=$rs->FetchRow(); + return $field['owner_id']; + + }else{return false;} + } + + /** + * This function changes data in LS-DB, its very sensitive, because every table can be changed. + * + * @param unknown_type $table + * @param unknown_type $key + * @param unknown_type $value + * @param unknown_type $where + * @return String + */ + function changeTable($table, $key, $value, $where, $mode='0')//XXX + {//be aware that this function may be a security risk + + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + if($mode=='' || !isset($mode) || $mode=='0') + { + $where = str_replace("\\","",$where); + $query2num = "SELECT {$key} FROM {$dbprefix}{$table} WHERE {$where}"; + $rs = db_execute_assoc($query2num); + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2num)"); + + $query2update = "update ".$dbprefix.$table." set ".$key."='".$value."' where ".$where.""; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK ($query2update)"); + + if($connect->Execute($query2update)){ + return $rs->RecordCount()." Rows changed"; + } + else{ + return "nothing changed"; + } + } + if($mode==1 || $mode=='1') + { + $query2insert = "INSERT INTO {$dbprefix}{$table} ({$key}) VALUES ({$value});"; + $this->debugLsrc("wir sind in Line ".__LINE__.", inserting ($query2insert)"); + if($connect->Execute($query2insert)) + { + $this->debugLsrc("wir sind in Line ".__LINE__.", inserting OK"); + return true; + + } + else + { + return false; + } + } + + + } + + /** + * + * Enter description here... + * @param $surveyid + * @param $type + * @param $maxLsrcEmails + * @return unknown_type + */ + function emailSender($surveyid, $type, $maxLsrcEmails='') //XXX + { + global $publicurl,$maxemails; + global $connect,$sitename ; + global $dbprefix ; + $surveyid = sanitize_int($surveyid); + include("lsrc.config.php"); + + + + // wenn maxmails ber den lsrc gegeben wird das nutzen, ansonsten die default werte aus der config.php + if($maxLsrcEmails!='') + $maxemails = $maxLsrcEmails; + + switch ($type){ + case "custom": + + break; + case "invite": + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START invite "); + + + + if(isset($surveyid) && getEmailFormat($surveyid) == 'html') + { + $ishtml=true; + } + else + { + $ishtml=false; + } + + //$tokenoutput .= ("Sending Invitations"); + //if (isset($tokenid)) {$tokenoutput .= " (".("Sending to Token ID").": {$tokenid})";} + //$tokenoutput .= "\n"; + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); + // Texte für Mails aus der Datenbank holen und in die POST Dinger schreiben. Nicht schön aber praktikabel + + $sql = "SELECT surveyls_language, surveyls_email_invite_subj, surveyls_email_invite ". + "FROM {$dbprefix}surveys_languagesettings ". + "WHERE surveyls_survey_id = ".$surveyid." "; + + //GET SURVEY DETAILS + $thissurvey=getSurveyInfo($surveyid); + + // $connect->SetFetchMode(ADODB_FETCH_ASSOC); + // $sqlResult=$connect->Execute($sql); + $sqlResult = db_execute_assoc($sql); + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + + while($languageRow = $sqlResult->FetchRow()) + { + $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite']; + $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_invite_subj']; + } + + // if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') + // { + // $SQLemailstatuscondition = " AND emailstatus = 'OK'"; + // } + // else + // { + // $SQLemailstatuscondition = ""; + // } + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND emailstatus = 'OK' "; + + if (isset($tokenid)) {$ctquery .= " AND tid='{$tokenid}'";} + //$tokenoutput .= "\n"; + $ctresult = $connect->Execute($ctquery); + $ctcount = $ctresult->RecordCount(); + $ctfieldcount = $ctresult->FieldCount(); + + $emquery = "SELECT * "; + //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + + $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND emailstatus = 'OK' "; + + if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} + //$tokenoutput .= "\n\n\n\n"; + $emresult = db_select_limit_assoc($emquery,$maxemails); + $emcount = $emresult->RecordCount(); + + //$tokenoutput .= "\n" + ////."\t\n" + //."\t\t
            \n"; + + $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselanguage = GetBaseLanguageFromSurveyID($surveyid); + array_unshift($surveylangs,$baselanguage); + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + + foreach ($surveylangs as $language) + { + $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); + $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); + if ($ishtml) $_POST['message_'.$language] = html_entity_decode($_POST['message_'.$language], ENT_QUOTES, $emailcharset); + + } + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + if ($emcount > 0) + { + $mailsSend = 0; + while ($emrow = $emresult->FetchRow()) + { + $c=1; + unset($fieldsarray); + $to = $emrow['email']; + $fieldsarray["{EMAIL}"]=$emrow['email']; + $fieldsarray["{FIRSTNAME}"]=$emrow['firstname']; + $fieldsarray["{LASTNAME}"]=$emrow['lastname']; + $fieldsarray["{TOKEN}"]=$emrow['token']; + $fieldsarray["{LANGUAGE}"]=$emrow['language']; + while(isset($emrow["attribute_$c"])) + { + $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; + $fieldsarray["{TOKEN:ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; + ++$c; + } + $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; + $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; + $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; + $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; + $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; + + $emrow['language']=trim($emrow['language']); + if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default + $found = array_search($emrow['language'], $surveylangs); + if ($found==false) {$emrow['language']=$baselanguage;} + + $from = $thissurvey['adminemail']; + + + if ($ishtml === false) + { + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + } + else + { + $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + } + } + else + { + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; + } + else + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + } + } + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + $modsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); + $modmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); + + if (SendEmailMessage($modmessage, $modsubject, $to , $from, $sitename, $ishtml, getBounceEmail($surveyid))) + { + // Put date into sent + //$timeadjust = 0; + $today = date("Y-m-d H:i"); + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite Today:".$today); + $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" + ."SET sent='$today' WHERE tid={$emrow['tid']}"; + // + $uderesult = $connect->Execute($udequery); + $mailsSend++; + //$tokenoutput .= "[".("Invitation sent to:")."{$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; + } + else + { + //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); + if($n==1) + $failedAddresses .= ",".$to; + else + { + $failedAddresses = $to; + $n=1; + } + } + } + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + if ($ctcount > $emcount) + { + $lefttosend = $ctcount-$maxemails; + + }else{$lefttosend = 0;} + } + else + { + return "No Mails to send"; + } + + if($maxemails>0 && $maxemails!='') + { + $returnValue = "".$mailsSend." Mails send. ".$lefttosend." Mails left to send"; + if(isset($failedAddresses)) + $returnValue .= "\nCould not send to: ".$failedAddresses; + return $returnValue; + } + + if(isset($mailsSend)) + { + $returnValue = "".$mailsSend." Mails send. "; + if(isset($failedAddresses)) + $returnValue .= "\nCould not send to: ".$failedAddresses; + return $returnValue; + } + + + + + break; + case "remind": + // XXX: + // TODO: + // if (!isset($_POST['ok']) || !$_POST['ok']) + // { + + /* + * look if there were reminders send in the past, and if some tokens got lesser reminders than others + * + * - if so: send reminders to the unremindet participants until they got the same remindcount than the others + * - if not: send reminders normally + */ + + $remSQL = "SELECT tid, remindercount " + . "FROM ".db_table_name("tokens_{$surveyid}")." " + . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' " + . "ORDER BY remindercount desc LIMIT 1"; + + $this->debugLsrc("Executing SQL: ".$remSQL); + + $remResult = db_execute_assoc($remSQL); + $remRow = $remResult->FetchRow(); + + /* Get the reminder count from the row, if we have a row. If + * we don't have a row then we set reminderCount to 0 to prevent + * queries down below from bombing out. */ + $reminderCount = $remRow['remindercount']; + if(empty($reminderCount)) { + $this->debugLsrc("There are no reminders to send."); + $reminderCount = 0; + } + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$remRow['tid']."; ".$reminderCount." "); + + $sendOnlySQL = "SELECT tid, remindercount " + . "FROM ".db_table_name("tokens_{$surveyid}")." " + . "WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' AND remindercount < ".$reminderCount." " + . "ORDER BY tid asc LIMIT 1"; + + $this->debugLsrc("Executing SQL: ".$sendOnlySQL); + + if($sendOnlyResult->RecordCount()>0) + { + $sendOnlyRow = $sendOnlyResult->FetchRow(); + $starttokenid = $sendOnlyRow['tid']; + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", remind ".$sendOnlyRow['tid']."; ".$sendOnlyRow['remindercount']." "); + } + + if(isset($surveyid) && getEmailFormat($surveyid) == 'html') + { + $ishtml=true; + } + else + { + $ishtml=false; + } + + //GET SURVEY DETAILS + $thissurvey=getSurveyInfo($surveyid); + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $surveyid, $type"); + // Texte für Mails aus der Datenbank holen. + + $sql = "SELECT surveyls_language, surveyls_email_remind_subj, surveyls_email_remind ". + "FROM {$dbprefix}surveys_languagesettings ". + "WHERE surveyls_survey_id = ".$surveyid." "; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", invite "); + + $sqlResult = db_execute_assoc($sql); + + while($languageRow = $sqlResult->FetchRow()) + { + $_POST['message_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind']; + $_POST['subject_'.$languageRow['surveyls_language']] = $languageRow['surveyls_email_remind_subj']; + } + + //$tokenoutput .= ("Sending Reminders")."\n"; + + $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselanguage = GetBaseLanguageFromSurveyID($surveyid); + array_unshift($surveylangs,$baselanguage); + + foreach ($surveylangs as $language) + { + $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); + $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); + + } + + $SQLemailstatuscondition = " AND emailstatus = 'OK'"; + + if (isset($_POST['maxremindercount']) && + $_POST['maxremindercount'] != '' && + intval($_POST['maxremindercount']) != 0) + { + $SQLremindercountcondition = " AND remindercount < ".intval($_POST['maxremindercount']); + } + else + { + $SQLremindercountcondition = ""; + } + + if (isset($_POST['minreminderdelay']) && + $_POST['minreminderdelay'] != '' && + intval($_POST['minreminderdelay']) != 0) + { + // $_POST['minreminderdelay'] in days (86400 seconds per day) + $compareddate = date_shift(date("Y-m-d H:i:s",time() - 86400 * intval($_POST['minreminderdelay'])), + "Y-m-d H:i",$timeadjust); + $SQLreminderdelaycondition = " AND ( " + . " (remindersent = 'N' AND sent < '".$compareddate."') " + . " OR " + . " (remindersent < '".$compareddate."'))"; + } + else + { + $SQLreminderdelaycondition = ""; + } + + $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed ='N' or completed ='') AND sent<>'' AND sent<>'N' AND token <>'' AND email <> '' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; + + if (isset($starttokenid)) {$ctquery .= " AND tid >= '{$starttokenid}'";} + // if (isset($tokenid) && $tokenid) {$ctquery .= " AND tid = '{$tokenid}'";} + // //$tokenoutput .= "\n"; + + $ctresult = $connect->Execute($ctquery) or $this->debugLsrc ("Database error!\n" . $connect->ErrorMsg()); + $ctcount = $ctresult->RecordCount(); + $ctfieldcount = $ctresult->FieldCount(); + $emquery = "SELECT * "; + //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} + + // TLR change to put date into sent + $emquery .= " FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; + + if (isset($starttokenid)) {$emquery .= " AND tid >= '{$starttokenid}'";} + if (isset($tokenid) && $tokenid) {$emquery .= " AND tid = '{$tokenid}'";} + $emquery .= " ORDER BY tid "; + $emresult = db_select_limit_assoc($emquery, $maxemails); + //$emresult = db_execute_assoc($emquery); + $emcount = $emresult->RecordCount(); + + if ($emcount > 0) + { + while ($emrow = $emresult->FetchRow()) + { + $c=1; + unset($fieldsarray); + $to = $emrow['email']; + $fieldsarray["{EMAIL}"]=$emrow['email']; + $fieldsarray["{FIRSTNAME}"]=$emrow['firstname']; + $fieldsarray["{LASTNAME}"]=$emrow['lastname']; + $fieldsarray["{TOKEN}"]=$emrow['token']; + $fieldsarray["{LANGUAGE}"]=$emrow['language']; + while(isset($emrow["attribute_$c"])) + { + $fieldsarray["{ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; + $fieldsarray["{TOKEN:ATTRIBUTE_$c}"]=$emrow["attribute_$c"]; + ++$c; + } + + $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; + $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; + $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; + $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; + $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; + + $emrow['language']=trim($emrow['language']); + if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default + if(!in_array($emrow['language'], $surveylangs)) {$emrow['language']=$baselanguage;} // if given language is not available use default + $found = array_search($emrow['language'], $surveylangs); + if ($found==false) {$emrow['language']=$baselanguage;} + + $from = $thissurvey['adminemail']; + + if (getEmailFormat($surveyid) == 'html') + { + $ishtml=true; + } + else + { + $ishtml=false; + } + + if ($ishtml == false) + { + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + } + else + { + $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + } + } + else + { + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; + } + else + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + $_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset); + } + } + + $msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); + $sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); + + if (SendEmailMessage($sendmessage, $msgsubject, $to, $from, $sitename, $ishtml, getBounceEmail($surveyid))) + { + + // Put date into remindersent + $today = date("Y-m-d H:i"); + $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" + ."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}"; + // + $uderesult = $connect->Execute($udequery) or $this->debugLsrc ("Could not update tokens$udequery".$connect->ErrorMsg()); + //orig: $tokenoutput .= "\t\t\t({$emrow['tid']})[".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]\n"; + //$tokenoutput .= "\t\t\t({$emrow['tid']}) [".("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)]\n"; + $mailsSend++; + } + else + { + //$tokenoutput .= ReplaceFields(("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."", $fieldsarray); + if($n==1) + $failedAddresses .= ",".$to; + else + { + $failedAddresses = $to; + $n=1; + } + + } + //$lasttid = $emrow['tid']; + + } + if ($ctcount > $emcount) + { + $lefttosend = $ctcount-$maxemails; + }else{$lefttosend = 0;} + } + else + { + return "No Reminders to send"; + } + + if($maxemails>0) + { + $returnValue = "".$mailsSend." Reminders send. ".$lefttosend." Reminders left to send"; + if(isset($failedAddresses)) + $returnValue .= "\nCould not send to: ".$failedAddresses; + return $returnValue; + } + + if(isset($mailsSend)) + { + $returnValue = "".$mailsSend." Reminders send. "; + if(isset($failedAddresses)) + $returnValue .= "\nCould not send to: ".$failedAddresses; + return $returnValue; + } + + + break; + default: + + break; + } + } + + /** + * loginCheck for Lsrc, checks if the user with given password exists in LS Database and + * sets the SESSION rights for this user + * @param String $sUser + * @param String $sPass + * @return boolean + */ + function checkUser($sUser, $sPass) // XXX + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + require(dirname(__FILE__)."/../classes/core/sha256.php"); + + $query="SELECT uid, password, lang, superadmin FROM {$dbprefix}users WHERE users_name=".$connect->qstr(sanitize_user($sUser)); + // echo $query; + $result = db_execute_assoc($query); + $gv = $result->FetchRow(); + if($result->RecordCount() < 1) + { + return false; + } + else + { + if((SHA256::hashing($sPass)==$gv['password'])) + { + $_SESSION['loginID']=$gv['uid']; + $_SESSION['lang']=$gv['lang']; + + $squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$gv['uid']}"; + $sresult = db_execute_assoc($squery); //Checked + if ($sresult->RecordCount()>0) + { + $fields = $sresult->FetchRow(); + $_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey']; + $_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator']; + $_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user']; + $_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user']; + $_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin']; + $_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template']; + $_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label']; + } + return true; + } + else + { + return false; + } + } + } + + /** + * Lsrc checks the existence of Surveys more than one time, so this makes sense to be DRY + * + * @param int $sid + * @return boolean + */ + function surveyExists($sid)//XXX + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + + $query="SELECT * FROM {$dbprefix}surveys WHERE sid = ".$sid; + // echo $query; + $result = db_execute_assoc($query); + if($result->RecordCount() < 1) + { + return false; + } + else + { + return true; + } + } + + /** + * function to import surveys + * + * @param $iVid - desired survey id + * @param $importFile - name of the file to import in core(survey) dir + * @return boolean + */ + function importSurvey($iVid, $importFile) + { + global $connect ; + global $dbprefix ; + global $clang; + + include("lsrc.config.php"); + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK "); + // HINT FOR IMPORTERS: go to Line 714 to manipulate the Survey, while it's imported + + $the_full_file_path = $coreDir.$importFile; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",the_full_file_path ='$the_full_file_path' OK "); + + include("../import_functions.php"); + include("../admin_functions.php"); + if (!isset($copyfunction)) + { + $sFullFilepath=$the_full_file_path; + $aPathInfo = pathinfo($sFullFilepath); + $sExtension = $aPathInfo['extension']; + } + + if (isset($sExtension) && strtolower($sExtension)=='csv') + { + $aImportResults=CSVImportSurvey($sFullFilepath,$iVid); + } + elseif (isset($sExtension) && strtolower($sExtension)=='lss') + { + $aImportResults=XMLImportSurvey($sFullFilepath,NULL,NULL,$iVid); + } elseif (isset($copyfunction)) + { + $aImportResults=XMLImportSurvey('',$copysurveydata,$sNewSurveyName,$iVid); + } + + //CANNOT BE USED BY LSRC RIGHT NOW + // Translate INSERTANS codes if chosen +// if (isset($aImportResults['fieldnames']) && $sTransLinks === true) +// { +// transInsertAns($aImportResults['newsid'],$aImportResults['oldsid'],$aImportResults['fieldnames']); +// } + + return $aImportResults['newsid']; + } + + /** + * function to activate surveys based on new activate.php 5771 2008-10-13 02:28:40Z jcleeland $ + * + * @param unknown_type $surveyid + * @return boolean + */ + function activateSurvey($surveyid)//XXX activateSurvey + { + global $dbprefix, $connect, $clang, $databasetype,$databasetabletype; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + include('../admin_functions.php'); + include('../activate_functions.php'); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + $returnOutput = activateSurvey($surveyid,$surveyid,'lsrc'); + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", $returnOutput "); + + return $returnOutput; + } // end activateSurvey(); + + /** + * not used, a test, thought this could maybe enhance security, may be deleted + * + * @return Error 404 fake + */ + function fake404()// XXX + { + return ' + + + Objekt nicht gefunden! + + + + + +

            Objekt nicht gefunden!

            +

            + + + Der angeforderte URL konnte auf dem Server nicht gefunden werden. + + + + Sofern Sie den URL manuell eingegeben haben, + überprüfen Sie bitte die Schreibweise und versuchen Sie es erneut. + + + +

            +

            + Sofern Sie dies für eine Fehlfunktion des Servers halten, + informieren Sie bitte den + Webmaster + hierüber. + +

            + +

            Error 404

            +
            + + '.$_SERVER["SERVER_NAME"].' + + '.date("m/d/Y H:i:s").' + Apache/2.2.9 (Win32) DAV/2 mod_ssl/2.2.9 OpenSSL/0.9.8i mod_autoindex_color PHP/5.2.6 mod_jk/1.2.26 +
            + + + + '; + } + + /** + * importing a group into an existing survey + * + * @param int $iVid SurveyID + * @param string $sMod Group that should be loaded into the Survey + */ + function importGroup($surveyid, $sMod) //XXX + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $newsid = $surveyid; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + + $the_full_file_path = $modDir.$sMod.".csv"; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK $the_full_file_path "); + + $handle = fopen($the_full_file_path, "r"); + while (!feof($handle)) + { + $buffer = fgets($handle); + $bigarray[] = $buffer; + } + fclose($handle); + + if (substr($bigarray[0], 0, 23) != "# LimeSurvey Group Dump" && substr($bigarray[0], 0, 24) != "# PHPSurveyor Group Dump") + { + //$importgroup .= "".("Error")."\n"; + //$importgroup .= ("This file is not a LimeSurvey group file. Import failed.")."\n"; + //$importgroup .= "\n"; + //$importgroup .= "
            \n"; + //unlink($the_full_file_path); + return false; + } + + for ($i=0; $i<9; $i++) + { + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + + //GROUPS + if (array_search("# QUESTIONS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# QUESTIONS TABLE\n", $bigarray); + } + elseif (array_search("# QUESTIONS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# QUESTIONS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$grouparray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //QUESTIONS + if (array_search("# ANSWERS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# ANSWERS TABLE\n", $bigarray); + } + elseif (array_search("# ANSWERS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# ANSWERS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$questionarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //ANSWERS + if (array_search("# CONDITIONS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# CONDITIONS TABLE\n", $bigarray); + } + elseif (array_search("# CONDITIONS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# CONDITIONS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$answerarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //CONDITIONS + if (array_search("# LABELSETS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# LABELSETS TABLE\n", $bigarray); + } + elseif (array_search("# LABELSETS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# LABELSETS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray); + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$conditionsarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //LABELSETS + if (array_search("# LABELS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# LABELS TABLE\n", $bigarray); + } + elseif (array_search("# LABELS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# LABELS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$labelsetsarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //LABELS + if (array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray)) + { + $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray); + } + elseif (array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$labelsarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //LAST LOT (now question_attributes) + if (!isset($noconditions) || $noconditions != "Y") + { + // stoppoint is the last line number + // this is an empty line after the QA CSV lines + $stoppoint = count($bigarray)-1; + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<=$stoppoint-1) {$question_attributesarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + } + $bigarray = array_values($bigarray); + + $countgroups=0; + if (isset($questionarray)) + { + $questionfieldnames=convertCSVRowToArray($questionarray[0],',','"'); + unset($questionarray[0]); + $countquestions = 0; + } + + if (isset($answerarray)) + { + $answerfieldnames=convertCSVRowToArray($answerarray[0],',','"'); + unset($answerarray[0]); + $countanswers = 0; + } + + $countconditions = 0; + $countlabelsets=0; + $countlabels=0; + $countquestion_attributes = 0; + $countanswers = 0; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // first check that imported group, questions and labels support the + // current survey's baselang + $langcode = GetBaseLanguageFromSurveyID($newsid); + if (isset($grouparray)) + { + $groupfieldnames = convertCSVRowToArray($grouparray[0],',','"'); + $langfieldnum = array_search("language", $groupfieldnames); + $gidfieldnum = array_search("gid", $groupfieldnames); + $groupssupportbaselang = bDoesImportarraySupportsLanguage($grouparray,Array($gidfieldnum),$langfieldnum,$langcode,true); + if (!$groupssupportbaselang) + { + //$importgroup .= "".("Error")."\n"; + //$importgroup .= ("You can't import a group which doesn't support the current survey's base language.")."\n"; + //$importgroup .= "\n"; + //$importgroup .= "\n"; + //unlink($the_full_file_path); + return "Group does not support Surveys Baselanguage ($langcode)"; + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + if (isset($questionarray)) + { + $langfieldnum = array_search("language", $questionfieldnames); + $qidfieldnum = array_search("qid", $questionfieldnames); + $questionssupportbaselang = bDoesImportarraySupportsLanguage($questionarray,Array($qidfieldnum), $langfieldnum,$langcode,false); + if (!$questionssupportbaselang) + { + //$importgroup .= "".("Error")."\n"; + //$importgroup .= ("You can't import a question which doesn't support the current survey's base language.")."\n"; + //$importgroup .= "\n"; + //$importgroup .= "\n"; + //unlink($the_full_file_path); + return "Group does not support Surveys Baselanguage ($langcode)"; + } + } + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + if (isset($labelsetsarray)) + { + $labelsetfieldname = convertCSVRowToArray($labelsetsarray[0],',','"'); + $langfieldnum = array_search("languages", $labelsetfieldname); + $lidfilednum = array_search("lid", $labelsetfieldname); + $labelsetssupportbaselang = bDoesImportarraySupportsLanguage($labelsetsarray,Array($lidfilednum),$langfieldnum,$langcode,true); + if (!$labelsetssupportbaselang) + { + $importquestion .= "".("Error")."\n" + .("You can't import label sets which don't support the current survey's base language")."\n" + ."\n"; + //unlink($the_full_file_path); + return "Group does not support Surveys Baselanguage ($langcode)"; + } + } + + $newlids = array(); // this array will have the "new lid" for the label sets, the key will be the "old lid" + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //DO ANY LABELSETS FIRST, SO WE CAN KNOW WHAT THEIR NEW LID IS FOR THE QUESTIONS + if (isset($labelsetsarray) && $labelsetsarray) { + $csarray=buildLabelSetCheckSumArray(); // build checksums over all existing labelsets + $count=0; + foreach ($labelsetsarray as $lsa) { + $fieldorders =convertCSVRowToArray($labelsetsarray[0],',','"'); + $fieldcontents=convertCSVRowToArray($lsa,',','"'); + if ($count==0) {$count++; continue;} + + $countlabelsets++; + + $labelsetrowdata=array_combine($fieldorders,$fieldcontents); + + // Save old labelid + $oldlid=$labelsetrowdata['lid']; + // set the new language + unset($labelsetrowdata['lid']); + $newvalues=array_values($labelsetrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $lsainsert = "INSERT INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix + $lsiresult=$connect->Execute($lsainsert); + + // Get the new insert id for the labels inside this labelset + $newlid=$connect->Insert_ID("{$dbprefix}labelsets",'lid'); + + if ($labelsarray) { + $count=0; + foreach ($labelsarray as $la) { + $lfieldorders =convertCSVRowToArray($labelsarray[0],',','"'); + $lfieldcontents=convertCSVRowToArray($la,',','"'); + if ($count==0) {$count++; continue;} + + // Combine into one array with keys and values since its easier to handle + $labelrowdata=array_combine($lfieldorders,$lfieldcontents); + $labellid=$labelrowdata['lid']; + if ($labellid == $oldlid) { + $labelrowdata['lid']=$newlid; + + // translate internal links + $labelrowdata['title']=translink('label', $oldlid, $newlid, $labelrowdata['title']); + + $newvalues=array_values($labelrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $lainsert = "INSERT INTO {$dbprefix}labels (".implode(',',array_keys($labelrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix + $liresult=$connect->Execute($lainsert); + $countlabels++; + } + } + } + + //CHECK FOR DUPLICATE LABELSETS + $thisset=""; + $query2 = "SELECT code, title, sortorder, language + FROM {$dbprefix}labels + WHERE lid=".$newlid." + ORDER BY language, sortorder, code"; + $result2 = db_execute_num($query2) or $this->debugLsrc("Died querying labelset $lid$query2".$connect->ErrorMsg()); + while($row2=$result2->FetchRow()) + { + $thisset .= implode('.', $row2); + } // while + $newcs=dechex(crc32($thisset)*1); + unset($lsmatch); + if (isset($csarray)) + { + foreach($csarray as $key=>$val) + { + if ($val == $newcs) + { + $lsmatch=$key; + } + } + } + if (isset($lsmatch)) + { + //There is a matching labelset. So, we will delete this one and refer + //to the matched one. + $query = "DELETE FROM {$dbprefix}labels WHERE lid=$newlid"; + $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labels$query".$connect->ErrorMsg()); + $query = "DELETE FROM {$dbprefix}labelsets WHERE lid=$newlid"; + $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labelset$query".$connect->ErrorMsg()); + $newlid=$lsmatch; + } + else + { + //There isn't a matching labelset, add this checksum to the $csarray array + $csarray[$newlid]=$newcs; + } + //END CHECK FOR DUPLICATES + $labelreplacements[]=array($oldlid, $newlid); + $newlids[$oldlid] = $newlid; + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //these arrays will aloud to insert correctly groups an questions multi languague survey imports correctly, and will eliminate the need to "searh" the imported data + //$newgids = array(); // this array will have the "new gid" for the groups, the kwy will be the "old gid" <-- not needed when importing groups + $newqids = array(); // this array will have the "new qid" for the questions, the kwy will be the "old qid" + + // DO GROUPS, QUESTIONS FOR GROUPS, THEN ANSWERS FOR QUESTIONS IN A __NOT__ NESTED FORMAT! + if (isset($grouparray) && $grouparray) + { + $surveylanguages=GetAdditionalLanguagesFromSurveyID($surveyid); + $surveylanguages[]=GetBaseLanguageFromSurveyID($surveyid); + + // do GROUPS + $gafieldorders=convertCSVRowToArray($grouparray[0],',','"'); + unset($grouparray[0]); + $newgid = 0; + $group_order = 0; // just to initialize this variable + foreach ($grouparray as $ga) + { + //GET ORDER OF FIELDS + $gacfieldcontents=convertCSVRowToArray($ga,',','"'); + $grouprowdata=array_combine($gafieldorders,$gacfieldcontents); + + // Skip not supported languages + if (!in_array($grouprowdata['language'],$surveylanguages)) + { + $skippedlanguages[]=$grouprowdata['language']; // this is for the message in the end. + continue; + } + + // replace the sid + $oldsid=$grouprowdata['sid']; + $grouprowdata['sid']=$newsid; + + // replace the gid or remove it if needed (it also will calculate the group order if is a new group) + $oldgid=$grouprowdata['gid']; + if ($newgid == 0) + { + unset($grouprowdata['gid']); + + // find the maximum group order and use this grouporder+1 to assign it to the new group + $qmaxgo = "select max(group_order) as maxgo from ".db_table_name('groups')." where sid=$newsid"; + $gres = db_execute_assoc($qmaxgo) or $this->debugLsrc (("Error")." Failed to find out maximum group order value\n$qmaxqo\n".$connect->ErrorMsg()); + $grow=$gres->FetchRow(); + $group_order = $grow['maxgo']+1; + } + else + $grouprowdata['gid'] = $newgid; + + $grouprowdata["group_order"]= $group_order; + + // Everything set - now insert it + $grouprowdata=array_map('convertCsvreturn2return', $grouprowdata); + + + // translate internal links + $grouprowdata['group_name']=translink('survey', $oldsid, $newsid, $grouprowdata['group_name']); + $grouprowdata['description']=translink('survey', $oldsid, $newsid, $grouprowdata['description']); + + $newvalues=array_values($grouprowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $ginsert = "insert INTO {$dbprefix}groups (".implode(',',array_keys($grouprowdata)).") VALUES (".implode(',',$newvalues).")"; + $gres = $connect->Execute($ginsert) or $this->debugLsrc("Error: ".": Failed to insert group\n$ginsert\n".$connect->ErrorMsg()); + + //GET NEW GID .... if is not done before and we count a group if a new gid is required + if ($newgid == 0) + { + $newgid = $connect->Insert_ID("{$dbprefix}groups",'gid'); + $countgroups++; + } + } + // GROUPS is DONE + + // do QUESTIONS + if (isset($questionarray) && $questionarray) + { + foreach ($questionarray as $qa) + { + $qacfieldcontents=convertCSVRowToArray($qa,',','"'); + $questionrowdata=array_combine($questionfieldnames,$qacfieldcontents); + + // Skip not supported languages + if (!in_array($questionrowdata['language'],$surveylanguages)) + continue; + + // replace the sid + $questionrowdata["sid"] = $newsid; + + // replace the gid (if the gid is not in the oldgid it means there is a problem with the exported record, so skip it) + if ($questionrowdata['gid'] == $oldgid) + $questionrowdata['gid'] = $newgid; + else + continue; // a problem with this question record -> don't consider + + // replace the qid or remove it if needed + $oldqid = $questionrowdata['qid']; + if (isset($newqids[$oldqid])) + $questionrowdata['qid'] = $newqids[$oldqid]; + else + unset($questionrowdata['qid']); + + // replace the lid for the new one (if there is no new lid in the $newlids array it mean that was not imported -> error, skip this record) + if (in_array($questionrowdata["type"], array("F","W","Z","H", "1", ":", ";"))) // only fot the questions that uses a label set. + if (isset($newlids[$questionrowdata["lid"]])) + { + $questionrowdata["lid"] = $newlids[$questionrowdata["lid"]]; + if(isset($newlids[$questionrowdata["lid1"]])) + { + $questionrowdata["lid1"] = $newlids[$questionrowdata["lid1"]]; + } + } + else + { + continue; // a problem with this question record -> don't consider + } + // $other = $questionrowdata["other"]; //Get 'other' field value + // $oldlid = $questionrowdata['lid']; + + // Everything set - now insert it + $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); + + // translate internal links ///XXX rakete may change question data here + // $questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']); + // $questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']); + // $questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']); + + $newvalues=array_values($questionrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $qinsert = "insert INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")"; + $qres = $connect->Execute($qinsert) or $this->debugLsrc ("Error: "."Failed to insert question\n$qinsert\n".$connect->ErrorMsg()); + + //GET NEW QID .... if is not done before and we count a question if a new qid is required + if (!isset($newqids[$oldqid])) + { + $newqids[$oldqid] = $connect->Insert_ID("{$dbprefix}questions",'qid'); + $myQid=$newqids[$oldqid]; + $countquestions++; + } + else + { + $myQid=$newqids[$oldqid]; + } + } + } + // QESTIONS is DONE + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // do ANSWERS + if (isset($answerarray) && $answerarray) + { + foreach ($answerarray as $aa) + { + $aacfieldcontents=convertCSVRowToArray($aa,',','"'); + $answerrowdata=array_combine($answerfieldnames,$aacfieldcontents); + + // Skip not supported languages + if (!in_array($answerrowdata['language'],$surveylanguages)) + continue; + + // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this answer is orphan -> error, skip this record) + if (isset($newqids[$answerrowdata["qid"]])) + $answerrowdata["qid"] = $newqids[$answerrowdata["qid"]]; + else + continue; // a problem with this answer record -> don't consider + + // Everything set - now insert it + $answerrowdata = array_map('convertCsvreturn2return', $answerrowdata); + + // translate internal links + $answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']); + + $newvalues=array_values($answerrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $ainsert = "insert INTO {$dbprefix}answers (".implode(',',array_keys($answerrowdata)).") VALUES (".implode(',',$newvalues).")"; + $ares = $connect->Execute($ainsert) or $this->debugLsrc ("Error: "."Failed to insert answer\n$ainsert\n".$connect->ErrorMsg()); + $countanswers++; + } + } + // ANSWERS is DONE + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // Fix question group sortorder + fixSortOrderGroups($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + $cdresult = db_execute_assoc("SELECT gid FROM ".db_table_name('groups')." WHERE sid='{$surveyid}' AND language='{$baselang}' ORDER BY group_order, group_name"); + $position=0; + while ($cdrow=$cdresult->FetchRow()) + { + $cd2query="UPDATE ".db_table_name('groups')." SET group_order='{$position}' WHERE gid='{$cdrow['gid']}' "; + $cd2result = $connect->Execute($cd2query) or $this->debugLsrc ("Couldn't update group_order$cd2query".$connect->ErrorMsg()); //Checked + $position++; + } + + + //... and for the questions inside the groups + // get all group ids and fix questions inside each group + $gquery = "SELECT gid FROM {$dbprefix}groups where sid=$newsid group by gid ORDER BY gid"; //Get last question added (finds new qid) + $gres = db_execute_assoc($gquery); + while ($grow = $gres->FetchRow()) + { + //fixsortorderQuestions(0,$grow['gid']); + $qid=sanitize_int(0); + $gid=sanitize_int($grow['gid']); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + if ($gid == 0) + { + $result = db_execute_assoc("SELECT gid FROM ".db_table_name('questions')." WHERE qid='{$qid}' and language='{$baselang}'"); //Checked + $row=$result->FetchRow(); + $gid=$row['gid']; + } + $cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$gid}' and language='{$baselang}' ORDER BY question_order, title ASC"); //Checked + $position=0; + while ($cdrow=$cdresult->FetchRow()) + { + $cd2query="UPDATE ".db_table_name('questions')." SET question_order='{$position}' WHERE qid='{$cdrow['qid']}' "; + $cd2result = $connect->Execute($cd2query) or $this->debugLsrc ("Couldn't update question_order$cd2query".$connect->ErrorMsg()); //Checked + $position++; + } + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // do ATTRIBUTES + if (isset($question_attributesarray) && $question_attributesarray) + { + $fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"'); + unset($question_attributesarray[0]); + foreach ($question_attributesarray as $qar) { + $fieldcontents=convertCSVRowToArray($qar,',','"'); + $qarowdata=array_combine($fieldorders,$fieldcontents); + + // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this attribute is orphan -> error, skip this record) + if (isset($newqids[$qarowdata["qid"]])) + $qarowdata["qid"] = $newqids[$qarowdata["qid"]]; + else + continue; // a problem with this answer record -> don't consider + + unset($qarowdata["qaid"]); + + // Everything set - now insert it + $newvalues=array_values($qarowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $qainsert = "insert INTO {$dbprefix}question_attributes (".implode(',',array_keys($qarowdata)).") VALUES (".implode(',',$newvalues).")"; + $result=$connect->Execute($qainsert) or $this->debugLsrc ("Couldn't insert question_attribute$qainsert".$connect->ErrorMsg()); + $countquestion_attributes++; + } + } + // ATTRIBUTES is DONE + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // do CONDITIONS + if (isset($conditionsarray) && $conditionsarray) + { + $fieldorders=convertCSVRowToArray($conditionsarray[0],',','"'); + unset($conditionsarray[0]); + foreach ($conditionsarray as $car) { + $fieldcontents=convertCSVRowToArray($car,',','"'); + $conditionrowdata=array_combine($fieldorders,$fieldcontents); + + $oldqid = $conditionrowdata["qid"]; + $oldcqid = $conditionrowdata["cqid"]; + + // replace the qid for the new one (if there is no new qid in the $newqids array it mean that this condition is orphan -> error, skip this record) + if (isset($newqids[$oldqid])) + $conditionrowdata["qid"] = $newqids[$oldqid]; + else + continue; // a problem with this answer record -> don't consider + + // replace the cqid for the new one (if there is no new qid in the $newqids array it mean that this condition is orphan -> error, skip this record) + if (isset($newqids[$oldcqid])) + $conditionrowdata["cqid"] = $newqids[$oldcqid]; + else + continue; // a problem with this answer record -> don't consider + + list($oldcsid, $oldcgid, $oldqidanscode) = explode("X",$conditionrowdata["cfieldname"],3); + + if ($oldcgid != $oldgid) // this means that the condition is in another group (so it should not have to be been exported -> skip it + continue; + + unset($conditionrowdata["cid"]); + + // recreate the cfieldname with the new IDs + $newcfieldname = $newsid . "X" . $newgid . "X" . $conditionrowdata["cqid"] .substr($oldqidanscode,strlen($oldqid)); + + $conditionrowdata["cfieldname"] = $newcfieldname; + if (!isset($conditionrowdata["method"]) || trim($conditionrowdata["method"])=='') + { + $conditionrowdata["method"]='=='; + } + $newvalues=array_values($conditionrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $conditioninsert = "insert INTO {$dbprefix}conditions (".implode(',',array_keys($conditionrowdata)).") VALUES (".implode(',',$newvalues).")"; + $result=$connect->Execute($conditioninsert) or $this->debugLsrc ("Couldn't insert condition$conditioninsert".$connect->ErrorMsg()); + $countconditions++; + } + } + $this->debugLsrc("wir sind in - ".__FUNCTION__." Line ".__LINE__.", FERTIG "); + // CONDITIONS is DONE + return array('gid'=>$newgid,'qid'=>$myQid); + //return $newgid; + } + + /** + * + * Enter description here... + * @param $surveyid + * @param $sMod + * @param $newGroup + * @return unknown_type + */ + function importQuestion($surveyid, $sMod, $newGroup=false) //XXX + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $newsid = $surveyid; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK $dbprefix "); + + //$getGidSql = "SELECT gid FROM {$dbprefix} "; + $getGidSql = "SELECT gid + FROM {$dbprefix}groups + WHERE sid=".$surveyid." AND language='".GetBaseLanguageFromSurveyID($surveyid)."' + ORDER BY gid desc "; + $getGidRs = db_execute_num($getGidSql); + $gidRow=$getGidRs->FetchRow(); + $gid = $gidRow[0]; + + if($gid=='')# + { + $this->debugLsrc("No Group for importing the question, available!"); + return "No Group for importing the question, available! Import failed."; + } + + if($newGroup===true) + ++$gid; + + $the_full_file_path = $queDir.$sMod.".csv"; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK $the_full_file_path "); + + $handle = fopen($the_full_file_path, "r"); + while (!feof($handle)) + { + $buffer = fgets($handle, 10240); //To allow for very long survey welcomes (up to 10k) + $bigarray[] = $buffer; + } + fclose($handle); + + // Now we try to determine the dataformat of the survey file. + if ((substr($bigarray[1], 0, 24) == "# SURVEYOR QUESTION DUMP")&& (substr($bigarray[4], 0, 29) == "# http://www.phpsurveyor.org/")) + { + $importversion = 100; // version 1.0 file + } + elseif + ((substr($bigarray[1], 0, 24) == "# SURVEYOR QUESTION DUMP")&& (substr($bigarray[4], 0, 37) == "# http://phpsurveyor.sourceforge.net/")) + { + $importversion = 99; // Version 0.99 file or older - carries a different URL + } + elseif + (substr($bigarray[0], 0, 26) == "# LimeSurvey Question Dump" || substr($bigarray[0], 0, 27) == "# PHPSurveyor Question Dump") + { // Wow.. this seems to be a >1.0 version file - these files carry the version information to read in line two + $importversion=substr($bigarray[1], 12, 3); + } + else // unknown file - show error message + { + // $importquestion .= "".("Error")."\n"; + // $importquestion .= ("This file is not a LimeSurvey question file. Import failed.")."\n"; + // $importquestion .= "\n"; + // $importquestion .= "\n\n"; + // unlink($the_full_file_path); + return "This is not a Limesurvey question file. Import failed"; + } + + // if ($importversion != $dbversionnumber) + // { + //// $importquestion .= "".("Error")."\n"; + //// $importquestion .= ("Sorry, importing questions is limited to the same version. Import failed.")."\n"; + //// $importquestion .= "\n"; + //// $importquestion .= "\n\n"; + //// unlink($the_full_file_path); + // return; + // } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + for ($i=0; $i<9; $i++) //skipping the first lines that are not needed + { + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //QUESTIONS + if (array_search("# ANSWERS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# ANSWERS TABLE\n", $bigarray); + } + elseif (array_search("# ANSWERS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# ANSWERS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$questionarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //ANSWERS + if (array_search("# LABELSETS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# LABELSETS TABLE\n", $bigarray); + } + elseif (array_search("# LABELSETS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# LABELSETS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$answerarray[] = str_replace("`default`", "`default_value`", $bigarray[$i]);} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //LABELSETS + if (array_search("# LABELS TABLE\n", $bigarray)) + { + $stoppoint = array_search("# LABELS TABLE\n", $bigarray); + } + elseif (array_search("# LABELS TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# LABELS TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$labelsetsarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //LABELS + if (array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray)) + { + $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\n", $bigarray); + } + elseif (array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray)) + { + $stoppoint = array_search("# QUESTION_ATTRIBUTES TABLE\r\n", $bigarray); + } + else + { + $stoppoint = count($bigarray)-1; + } + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-2) {$labelsarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + $bigarray = array_values($bigarray); + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //Question_attributes + if (!isset($noconditions) || $noconditions != "Y") + { + $stoppoint = count($bigarray); + for ($i=0; $i<=$stoppoint+1; $i++) + { + if ($i<$stoppoint-1) {$question_attributesarray[] = $bigarray[$i];} + unset($bigarray[$i]); + } + } + $bigarray = array_values($bigarray); + + if (isset($questionarray)) {$countquestions = count($questionarray)-1;} else {$countquestions=0;} + if (isset($answerarray)) + { + $answerfieldnames=convertCSVRowToArray($answerarray[0],',','"'); + unset($answerarray[0]); + $countanswers = count($answerarray); + } + else {$countanswers=0;} + if (isset($labelsetsarray)) {$countlabelsets = count($labelsetsarray)-1;} else {$countlabelsets=0;} + if (isset($labelsarray)) {$countlabels = count($labelsarray)-1;} else {$countlabels=0;} + if (isset($question_attributesarray)) {$countquestion_attributes = count($question_attributesarray)-1;} else {$countquestion_attributes=0;} + + $languagesSupported = array(); // this array will keep all the languages supported for the survey + + // Let's check that imported objects support at least the survey's baselang + $langcode = GetBaseLanguageFromSurveyID($surveyid); + + $languagesSupported[$langcode] = 1; // adds the base language to the list of supported languages + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + if ($countquestions > 0) + { + $questionfieldnames = convertCSVRowToArray($questionarray[0],',','"'); + $langfieldnum = array_search("language", $questionfieldnames); + $qidfieldnum = array_search("qid", $questionfieldnames); + $questionssupportbaselang = bDoesImportarraySupportsLanguage($questionarray,Array($qidfieldnum), $langfieldnum,$langcode,true); + if (!$questionssupportbaselang) + { + // $importquestion .= "".("Error")."\n" + // .("You can't import a question which doesn't support the current survey's base language")."\n" + // ."\n"; + // unlink($the_full_file_path); + return "You can't import a question which doesn't support the current survey's base language"; + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + foreach (GetAdditionalLanguagesFromSurveyID($surveyid) as $language) + { + $languagesSupported[$language] = 1; + } + + // Let's assume that if the questions do support tye baselang + // Then the answers do support it as well. + // ==> So the following section is commented for now + //if ($countanswers > 0) + //{ + // $langfieldnum = array_search("language", $answerfieldnames); + // $answercodefilednum1 = array_search("qid", $answerfieldnames); + // $answercodefilednum2 = array_search("code", $answerfieldnames); + // $answercodekeysarr = Array($answercodefilednum1,$answercodefilednum2); + // $answerssupportbaselang = bDoesImportarraySupportsLanguage($answerarray,$answercodekeysarr,$langfieldnum,$langcode); + // if (!$answerssupportbaselang) + // { + // $importquestion .= "".("Error")."\n" + // .("You can't import answers which don't support current survey's base language")."\n" + // ."\n"; + // return; + // } + // + //} + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + if ($countlabelsets > 0) + { + $labelsetfieldname = convertCSVRowToArray($labelsetsarray[0],',','"'); + $langfieldnum = array_search("languages", $labelsetfieldname); + $lidfilednum = array_search("lid", $labelsetfieldname); + $labelsetssupportbaselang = bDoesImportarraySupportsLanguage($labelsetsarray,Array($lidfilednum),$langfieldnum,$langcode,true); + if (!$labelsetssupportbaselang) + { + // $importquestion .= "".("Error")."\n" + // .("You can't import label sets which don't support the current survey's base language")."\n" + // ."\n"; + // unlink($the_full_file_path); + return "You can't import label sets which don't support the current survey's base language"; + } + } + // I assume that if a labelset supports the survey's baselang, + // then it's labels do support it as well + + // GET SURVEY AND GROUP DETAILS + //$surveyid=$postsid; + //$gid=$postgid; + $newsid=$surveyid; + $newgid=$gid; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + + //DO ANY LABELSETS FIRST, SO WE CAN KNOW WHAT THEIR NEW LID IS FOR THE QUESTIONS + if (isset($labelsetsarray) && $labelsetsarray) { + $csarray=buildLabelSetCheckSumArray(); // build checksums over all existing labelsets + $count=0; + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + foreach ($labelsetsarray as $lsa) { + $fieldorders =convertCSVRowToArray($labelsetsarray[0],',','"'); + $fieldcontents=convertCSVRowToArray($lsa,',','"'); + if ($count==0) {$count++; continue;} + + $labelsetrowdata=array_combine($fieldorders,$fieldcontents); + + // Save old labelid + $oldlid=$labelsetrowdata['lid']; + // set the new language + unset($labelsetrowdata['lid']); + $newvalues=array_values($labelsetrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $lsainsert = "INSERT INTO {$dbprefix}labelsets (".implode(',',array_keys($labelsetrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix + $lsiresult=$connect->Execute($lsainsert); + + // Get the new insert id for the labels inside this labelset + $newlid=$connect->Insert_ID("{$dbprefix}labelsets","lid"); + + if ($labelsarray) { + $count=0; + foreach ($labelsarray as $la) { + $lfieldorders =convertCSVRowToArray($labelsarray[0],',','"'); + $lfieldcontents=convertCSVRowToArray($la,',','"'); + if ($count==0) {$count++; continue;} + + // Combine into one array with keys and values since its easier to handle + $labelrowdata=array_combine($lfieldorders,$lfieldcontents); + $labellid=$labelrowdata['lid']; + if ($labellid == $oldlid) { + $labelrowdata['lid']=$newlid; + + // translate internal links + $labelrowdata['title']=translink('label', $oldlid, $newlid, $labelrowdata['title']); + + $newvalues=array_values($labelrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $lainsert = "INSERT INTO {$dbprefix}labels (".implode(',',array_keys($labelrowdata)).") VALUES (".implode(',',$newvalues).")"; //handle db prefix + $liresult=$connect->Execute($lainsert); + } + } + } + + //CHECK FOR DUPLICATE LABELSETS + $thisset=""; + $query2 = "SELECT code, title, sortorder, language + FROM {$dbprefix}labels + WHERE lid=".$newlid." + ORDER BY language, sortorder, code"; + $result2 = db_execute_num($query2) or $this->debugLsrc("Died querying labelset $lid$query2".$connect->ErrorMsg()); + while($row2=$result2->FetchRow()) + { + $thisset .= implode('.', $row2); + } // while + $newcs=dechex(crc32($thisset)*1); + unset($lsmatch); + if (isset($csarray)) + { + foreach($csarray as $key=>$val) + { + if ($val == $newcs) + { + $lsmatch=$key; + } + } + } + if (isset($lsmatch)) + { + //There is a matching labelset. So, we will delete this one and refer + //to the matched one. + $query = "DELETE FROM {$dbprefix}labels WHERE lid=$newlid"; + $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labels$query".$connect->ErrorMsg()); + $query = "DELETE FROM {$dbprefix}labelsets WHERE lid=$newlid"; + $result=$connect->Execute($query) or $this->debugLsrc("Couldn't delete labelset$query".$connect->ErrorMsg()); + $newlid=$lsmatch; + } + else + { + //There isn't a matching labelset, add this checksum to the $csarray array + $csarray[$newlid]=$newcs; + } + //END CHECK FOR DUPLICATES + $labelreplacements[]=array($oldlid, $newlid); + } + } + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + + // QUESTIONS, THEN ANSWERS FOR QUESTIONS IN A NESTED FORMAT! + if (isset($questionarray) && $questionarray) { + $qafieldorders=convertCSVRowToArray($questionarray[0],',','"'); + unset($questionarray[0]); + + //Assuming we will only import one question at a time we will now find out the maximum question order in this group + //and save it for later + $qmaxqo = "SELECT MAX(question_order) AS maxqo FROM ".db_table_name('questions')." WHERE sid=$newsid AND gid=$newgid"; + $qres = db_execute_assoc($qmaxqo) or $this->debugLsrc ("Error: ".": Failed to find out maximum question order value\n$qmaxqo\n".$connect->ErrorMsg()); + $qrow=$qres->FetchRow(); + $newquestionorder=$qrow['maxqo']+1; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + + foreach ($questionarray as $qa) { + $qacfieldcontents=convertCSVRowToArray($qa,',','"'); + $newfieldcontents=$qacfieldcontents; + $questionrowdata=array_combine($qafieldorders,$qacfieldcontents); + if (isset($languagesSupported[$questionrowdata["language"]])) + { + $oldqid = $questionrowdata['qid']; + $oldsid = $questionrowdata['sid']; + $oldgid = $questionrowdata['gid']; + + // Remove qid field if there is no newqid; and set it to newqid if it's set + if (!isset($newqid)) + unset($questionrowdata['qid']); + else + $questionrowdata['qid'] = $newqid; + + $questionrowdata["sid"] = $newsid; + $questionrowdata["gid"] = $newgid; + $questionrowdata["question_order"] = $newquestionorder; + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // Now we will fix up the label id + $type = $questionrowdata["type"]; //Get the type + if ($type == "F" || $type == "H" || $type == "1" || $type == ":" || $type == ";" ) + {//IF this is a flexible label array, update the lid entry + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + + if (isset($labelreplacements)) { + foreach ($labelreplacements as $lrp) { + if ($lrp[0] == $questionrowdata["lid"]) { + $questionrowdata["lid"]=$lrp[1]; + } + if ($lrp[0] == $questionrowdata["lid1"]) { + $questionrowdata["lid1"]=$lrp[1]; + } + } + } + } + $other = $questionrowdata["other"]; //Get 'other' field value + $oldlid = $questionrowdata["lid"]; + $questionrowdata=array_map('convertCsvreturn2return', $questionrowdata); + + // translate internal links + $questionrowdata['title']=translink('survey', $oldsid, $newsid, $questionrowdata['title']); + $questionrowdata['question']=translink('survey', $oldsid, $newsid, $questionrowdata['question']); + $questionrowdata['help']=translink('survey', $oldsid, $newsid, $questionrowdata['help']); + + $newvalues=array_values($questionrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $qinsert = "INSERT INTO {$dbprefix}questions (".implode(',',array_keys($questionrowdata)).") VALUES (".implode(',',$newvalues).")"; + $qres = $connect->Execute($qinsert) or $this->debugLsrc ("Error: ".": Failed to insert question\n$qinsert\n".$connect->ErrorMsg()); + + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // set the newqid only if is not set + if (!isset($newqid)) + $newqid=$connect->Insert_ID("{$dbprefix}questions","qid"); + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + //NOW DO ANSWERS FOR THIS QID - Is called just once and only if there was a question + if (isset($answerarray) && $answerarray) { + foreach ($answerarray as $aa) { + $answerfieldcontents=convertCSVRowToArray($aa,',','"'); + $answerrowdata=array_combine($answerfieldnames,$answerfieldcontents); + if ($answerrowdata===false) + { + $importquestion.=''.("Faulty line in import - fields and data don't match").":".implode(',',$answerfieldcontents); + } + if (isset($languagesSupported[$answerrowdata["language"]])) + { + $code=$answerrowdata["code"]; + $thisqid=$answerrowdata["qid"]; + $answerrowdata["qid"]=$newqid; + + // translate internal links + $answerrowdata['answer']=translink('survey', $oldsid, $newsid, $answerrowdata['answer']); + + $newvalues=array_values($answerrowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $ainsert = "INSERT INTO {$dbprefix}answers (".implode(',',array_keys($answerrowdata)).") VALUES (".implode(',',$newvalues).")"; + $ares = $connect->Execute($ainsert) or $this->debugLsrc ("Error: ".": Failed to insert answer\n$ainsert\n".$connect->ErrorMsg()); + } + } + } + $this->debugLsrc("wir sind in ".__FILE__." - ".__FUNCTION__." Line ".__LINE__.", OK "); + // Finally the question attributes - Is called just once and only if there was a question + if (isset($question_attributesarray) && $question_attributesarray) {//ONLY DO THIS IF THERE ARE QUESTION_ATTRIBUES + $fieldorders =convertCSVRowToArray($question_attributesarray[0],',','"'); + unset($question_attributesarray[0]); + foreach ($question_attributesarray as $qar) { + $fieldcontents=convertCSVRowToArray($qar,',','"'); + $qarowdata=array_combine($fieldorders,$fieldcontents); + $qarowdata["qid"]=$newqid; + unset($qarowdata["qaid"]); + + $newvalues=array_values($qarowdata); + $newvalues=array_map(array(&$connect, "qstr"),$newvalues); // quote everything accordingly + $qainsert = "INSERT INTO {$dbprefix}question_attributes (".implode(',',array_keys($qarowdata)).") VALUES (".implode(',',$newvalues).")"; + $result=$connect->Execute($qainsert) or $this->debugLsrc ("Couldn't insert question_attribute$qainsert".$connect->ErrorMsg()); + } + } + + } + $this->debugLsrc("wir sind in - ".__FUNCTION__." Line ".__LINE__.", FERTIG "); + // CONDITIONS is DONE + return array('gid'=>$newgid,'qid'=>$newqid); + //return $newgid; + } + + /** + * function to delete a Survey with all questions and answersand Tokentable.... + * + * @param int $surveyid + * @return boolean + */ + function deleteSurvey($surveyid) + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", OK "); + + $tablelist = $connect->MetaTables(); + $dict = NewDataDictionary($connect); + + if (in_array("{$dbprefix}survey_$surveyid", $tablelist)) //delete the survey_$surveyid table + { + $dsquery = $dict->DropTableSQL("{$dbprefix}survey_$surveyid"); + //$dict->ExecuteSQLArray($sqlarray); + $dsresult = $dict->ExecuteSQLArray($dsquery); + } + + if (in_array("{$dbprefix}tokens_$surveyid", $tablelist)) //delete the tokens_$surveyid table + { + $dsquery = $dict->DropTableSQL("{$dbprefix}tokens_$surveyid"); + $dsresult = $dict->ExecuteSQLArray($dsquery) or $this->debugLsrc ("Couldn't \"$dsquery\" because ".$connect->ErrorMsg()); + } + + $dsquery = "SELECT qid FROM {$dbprefix}questions WHERE sid=$surveyid"; + $dsresult = db_execute_assoc($dsquery) or $this->debugLsrc ("Couldn't find matching survey to delete: \n $dsquery \n".$connect->ErrorMsg()); + while ($dsrow = $dsresult->FetchRow()) + { + $asdel = "DELETE FROM {$dbprefix}answers WHERE qid={$dsrow['qid']}"; + $asres = $connect->Execute($asdel); + $cddel = "DELETE FROM {$dbprefix}conditions WHERE qid={$dsrow['qid']}"; + $cdres = $connect->Execute($cddel) or die(); + $qadel = "DELETE FROM {$dbprefix}question_attributes WHERE qid={$dsrow['qid']}"; + $qares = $connect->Execute($qadel); + } + + $qdel = "DELETE FROM {$dbprefix}questions WHERE sid=$surveyid"; + $qres = $connect->Execute($qdel); + + $scdel = "DELETE FROM {$dbprefix}assessments WHERE sid=$surveyid"; + $scres = $connect->Execute($scdel); + + $gdel = "DELETE FROM {$dbprefix}groups WHERE sid=$surveyid"; + $gres = $connect->Execute($gdel); + + $slsdel = "DELETE FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id=$surveyid"; + $slsres = $connect->Execute($slsdel); + + $srdel = "DELETE FROM {$dbprefix}surveys_permissions WHERE sid=$surveyid"; + $srres = $connect->Execute($srdel); + + $srdel = "DELETE FROM {$dbprefix}saved_control WHERE sid=$surveyid"; + $srres = $connect->Execute($srdel); + + $sdel = "DELETE FROM {$dbprefix}surveys WHERE sid=$surveyid"; + $sres = $connect->Execute($sdel); + $surveyid=false; + + return true; + + } + + /** + * This function pulls a CSV representation of the Field map + * + * @param mixed $surveyid - the survey ID you want the Fieldmap for + * @return String $fieldmap + */ + function FieldMap2CSV($surveyid) + { + $fields=array("fieldname", "type", "sid", "gid", "qid", "aid",'title','question','group_name','lid','lid1'); + $fieldmap=createFieldMap($surveyid,'full'); + + $result='"'.implode('","',$fields).'"'."\n"; + foreach ($fieldmap as $entry) + { + + $destfieldmap=array(); + foreach ($fields as $field) + { + if (isset($entry[$field])) + { + $destfieldmap[$field]=$entry[$field]; + } + else + { + $destfieldmap[$field]=''; + } + } + $entry=array_map('CSVEscape',array_values($destfieldmap)); + $result.=implode(',',$entry)."\n"; + } + return $result; + } + + function sendStatistic($surveyid, $to, $tempFile, $html=null) + { + include("lsrc.config.php"); + global $sitename; + global $clang; + + + if($tempFile==null && isset($html)) + { + $css = ""; + + $message = sprintf($clang->gT("This is your personal statistic sheet for survey #%s"),$css."
            ".$message.$surveyid."
            ".$html."
            "); + return SendEmailMessage($message, sprintf($clang->gT("Statistics Survey #%s"),$surveyid), $to, getBounceEmail($surveyid), $sitename, true); + } + else + { + $message = sprintf($clang->gT("This is your personal statistic sheet for survey #%s"),$surveyid); + return SendEmailMessage($message, sprintf($clang->gT("Statistics Survey #%s"),$surveyid), $to , getBounceEmail($surveyid), $sitename, $ishtml, getBounceEmail($surveyid), $tempFile); + } + + } + private function getqtypelist($SelectedCode = "T", $ReturnType = "array") + { + include("lsrc.config.php"); + global $publicurl; + //global $sourcefrom, $clang; + + + $qtypes = array( + "1"=>"Array (Flexible Labels) Dual Scale", + "5"=>"5 Point Choice", + "A"=>"Array (5 Point Choice)", + "B"=>"Array (10 Point Choice)", + "C"=>"Array (Yes/No/Uncertain)", + "D"=>"Date", + "E"=>"Array (Increase, Same, Decrease)", + "F"=>"Array (Flexible Labels)", + "G"=>"Gender", + "H"=>"Array (Flexible Labels) by Column", + "I"=>"Language Switch", + "K"=>"Multiple Numerical Input", + "L"=>"List (Radio)", + "M"=>"Multiple choice", + "N"=>"Numerical Input", + "O"=>"List With Comment", + "P"=>"Multiple choice with comments", + "Q"=>"Multiple Short Text", + "R"=>"Ranking", + "S"=>"Short Free Text", + "T"=>"Long Free Text", + "U"=>"Huge Free Text", + "W"=>"List (Flexible Labels) (Dropdown)", + "X"=>"Boilerplate Question", + "Y"=>"Yes/No", + "Z"=>"List (Flexible Labels) (Radio)", + "!"=>"List (Dropdown)", + ":"=>"Array (Multi Flexible) (Numbers)", + ";"=>"Array (Multi Flexible) (Text)", + ); + asort($qtypes); + if ($ReturnType == "array") + {return $qtypes;} + + + } + /** + * This function removes the UTF-8 Byte Order Mark from a string + * + * @param string $str + * @return string + */ + private function removeBOM($str=""){ + if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { + $str=substr($str, 3); + } + return $str; + } + /** + * create a token table for the given survey id + * @param $iVid + * @return unknown_type + */ + function createTokenTable($iVid, $att=0) + { + global $connect; + global $dbprefix; + + global $databasetabletype; + global $databasetype; + + global $rootdir; + + global $defaultlang; + + include("lsrc.config.php"); + + require_once($rootdir.'/classes/core/language.php'); + $clang = new limesurvey_lang($defaultlang); + // check if the Token table already exists, if not, create it... + if(!db_tables_exist("{$dbprefix}tokens_".$iVid)) + { + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Token Table existiert nicht "); + $createtokentable = + "tid int I NOT NULL AUTO PRIMARY,\n " + . "firstname C(40) ,\n " + . "lastname C(40) ,\n "; + //MSSQL needs special treatment because of some strangeness in ADODB + if ($databasetype == 'odbc_mssql' || $databasetype == 'odbtp' || $databasetype == 'mssql_n' || $databasetype == 'mssqlnative') + { + $createtokentable.= "email text ,\n " + ."emailstatus text ,\n "; + } + else + { + $createtokentable.= "email text ,\n " + ."emailstatus text ,\n "; + } + + $createtokentable.= "token C(36) ,\n " + . "language C(25) ,\n " + . "sent C(17) DEFAULT 'N',\n " + . "remindersent C(17) DEFAULT 'N',\n " + . "remindercount int I DEFAULT 0,\n " + . "completed C(17) DEFAULT 'N',\n " + . "usesleft I DEFAULT 1,\n" + . "validfrom date ,\n " + . "validuntil date ,\n " + . "mpid I "; + + $tabname = "{$dbprefix}tokens_{$iVid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) + $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', + 'mysqli' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); + $dict = NewDataDictionary($connect); + $sqlarray = $dict->CreateTableSQL($tabname, $createtokentable, $taboptarray); + $execresult = $dict->ExecuteSQLArray($sqlarray, false); + + $createtokentableindex = $dict->CreateIndexSQL("{$tabname}_idx", $tabname, array('token')); + $dict->ExecuteSQLArray($createtokentableindex, false); + if($execresult!=0) + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", token table created "); + else + { + $this->debugLsrc("WARNING: ".__FUNCTION__." Line ".__LINE__.", token table NOT created "); + $this->debugLsrc($createtokentable); + while(list($key, $value)= each($sqlarray) ) + { + $this->debugLsrc("$key - $value"); + } + } + $n=1; + while($att>=$n) + { + $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n anlegen ,sql: $sql"); + //modify_database("","$sql"); + $connect->Execute($sql); + ++$n; + } + } + return; + } + /** + * The new one... + * * Function to insert Participant data while auto creating token if non is supported... + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sParticipantData (FIRSTNAME;LASTNAME;EMAIL;LANG;TOKEN;VALIDFROM;VALIDTO;attrib1,attrib2,attrib3,attrib4,attrib5::) + * @return unknown_type + */ + function insertParticipants($iVid, $sParticipantData) + { + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + //$this = new lsrcHelper(); + // check for appropriate rights + // if(!$this->checkUser($sUser, $sPass)) + // { + // throw new SoapFault("Authentication: ", "User or password wrong"); + // exit; + // } + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", $iVid, $sParticipantData "); + + // check if there is a $iVid, else abort + if(!isset($iVid) || $iVid=='' || $iVid==0 ) + { + return 0; + } + + // check if the Survey we want to populate with data and tokens already exists, else -> Fault + if(!$this->surveyExists($iVid)) + { + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", survey does not exist "); + return 0; + } + + $this->createTokenTable($iVid); + + //set the Seperators to default if nothing is set in the lsrc.config.php + if(!isset($sDatasetSeperator) || $sDatasetSeperator=='') + {$sDatasetSeperator = "::";} + if(!isset($sDatafieldSeperator) || $sDatafieldSeperator=='') + {$sDatafieldSeperator = ";";} + + // prepare to fill the table lime_tokens_* + // this is sensitiv, if the Seperator is not the defined one, almost everything could happen, BE AWARE OF YOUR SEPERATOR!... + $asDataset = explode($sDatasetSeperator, $sParticipantData); + // write the tokens to the token_table + $iCountParticipants = count($asDataset); + $iInsertedParticipants=0; + + foreach($asDataset as $sData) + { + //some extra sql statement comes in here later + $attributes=''; + $attributesData=''; + $validity=''; + $validityData=''; + if($sData!='') + { + $asDatafield = explode($sDatafieldSeperator, $sData); + $checkCnt=1; + + $iDataLength = count($asDatafield); + for($n=0;$n>=$iDataLength;++$n) + { + if($asDatafield[$n]=='') + { + $asDatafield[$n]=null; + } + } + + // token generieren + + + while($checkCnt>0) + { + $value = sRandomChars(10); //change sRandomChars value for different tokenlength (up to 36 chars max.) + $cQuery= "select token from ".$dbprefix."tokens_".$iVid." where token = '".$value."'; "; + $result = db_execute_assoc($cQuery); + $checkCnt = $result->RecordCount(); + } + if(!isset($asDatafield[4]) || $asDatafield[4]=='') + { + $asDatafield[4]= $value; + } + + //set session language if no language is set + if(!isset($asDatafield[3]) || $asDatafield[3]=='') + { + $asDatafield[3] = $_SESSION['lang']; + } + + //Begin to prepare our statement here. One array for the columns to insert and a parallel array with the values. + $insertColumns = array('firstname', 'lastname', 'email', 'language', 'token'); + $insertValues = array($asDatafield[0], $asDatafield[1], $asDatafield[2], $asDatafield[3], $asDatafield[4]); + + if(isset($asDatafield[5]) && $asDatafield[5]!=null) + { + //$validity .= ',validfrom'; + //$validityData .=",'$asDatafield[5]'"; + $insertColumns[] = 'validfrom'; + $insertValues[] = $asDatafield[5]; + } + if(isset($asDatafield[6]) && $asDatafield[5]!=null) + { + //$validity .= ',validuntil'; + //$validityData .=",'$asDatafield[6]'"; + $insertColumns[] = 'validuntil'; + $insertValues[] = $asDatafield[6]; + } + + if(isset($asDatafield[7]) && $asDatafield[7]!='') + { + $asAttributes = explode(",", $asDatafield[7]); + $n=0; + foreach($asAttributes as $attribute) + { + + ++$n; + //$check = "SELECT attribute_$n FROM {$dbprefix}_tokens_$iVid "; + + $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; + //$attributes.=",attribute_$n"; + //$attributesData.= ",'$attribute'"; + $insertColumns[] = "attribute_$n"; + $insertValues[] = $attribute; + + $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n mit $attribute anlegen ,sql: $sql"); + //modify_database("","$sql"); + $connect->Execute($sql); + + } + } + + + /*$sInsertParti = "INSERT INTO ".$dbprefix."tokens_".$iVid + ."(firstname,lastname,email,token," + ."language $validity $attributes) " + ."VALUES ('{$asDatafield[0]}', '{$asDatafield[1]}' , '{$asDatafield[2]}', '{$asDatafield[4]}' , " + ."'{$asDatafield[3]}' $validityData $attributesData) ";*/ + + $sInsertParti = "INSERT INTO {$dbprefix}tokens_$iVid (".implode(',', $insertColumns).") VALUES (".trim(str_repeat('?,', count($insertColumns)), ',').");"; + + + + $this->debugLsrc("$sInsertParti"); + + + // $sInsertParti = "INSERT INTO ".$dbprefix."tokens_".$iVid + // ."(firstname,lastname,email,emailstatus,token," + // ."language,sent,completed,attribute_1,attribute_2,mpid)" + // ."VALUES ('".$asDatafield[0]."' , + // '".$asDatafield[1]."' , '".$asDatafield[2]."' , 'OK' , '".$asDatafield[5]."', + // '".$_SESSION['lang']."', 'N', 'N', '".$asDatafield[3]."' , '".$asDatafield[4]."' , NULL); "; + // + if($connect->Execute($sInsertParti, $insertValues)) + { + ++$iInsertedParticipants; + // check participants eMail status and set it + // see http://data.iana.org/TLD/tlds-alpha-by-domain.txt + $maxrootdomainlength = 32; + if(1==preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $asDatafield[2])) + $this->changeTable("tokens_".$iVid,"emailstatus","OK","email='{$asDatafield[2]}'"); + + // if(isset($asDatafield[7]) && $asDatafield[7]!='') + // { + // $asAttributes = explode(",", $asDatafield[7]); + // $n=0; + // foreach($asAttributes as $attribute) + // { + // + // ++$n; + // //$check = "SELECT attribute_$n FROM {$dbprefix}_tokens_$iVid "; + // + // $sql = "ALTER TABLE {$dbprefix}tokens_$iVid ADD COLUMN attribute_$n VARCHAR(255); "; + // $attributes.=",attribute_$n"; + // $attributesData.= ",'$attribute'"; + // + // $this->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Attribute_$n mit $attribute anlegen ,sql: $sql"); + // //modify_database("","$sql"); + // $connect->Execute($sql); + // + // + // $insert = "UPDATE {$dbprefix}tokens_$iVid " + // . " SET attribute_$n='$attribute' WHERE token='$asDatafield[4]' "; + // + // $this->debugLsrc("$insert"); + // $connect->Execute($insert); + // } + // } + } + + } + + } + return "".$iCountParticipants."Datasets given, ".$iInsertedParticipants." rows inserted. "; + } } \ No newline at end of file diff --git a/include/limesurvey/admin/remotecontrol/lsrc.server.php b/include/limesurvey/admin/remotecontrol/lsrc.server.php index 8a4bace4..ff871b96 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc.server.php +++ b/include/limesurvey/admin/remotecontrol/lsrc.server.php @@ -1,1216 +1,1216 @@ - array( - 'verify_peer' => false, - 'allow_self_signed' => true, - 'local_cert' => $sslCert, - 'passphrase' => 'hisuser', - 'capture_peer_cert' => true - - ) - ); - - $stream_context = stream_context_create($context); - - $server = new SoapServer($wsdl, array('soap_version' => SOAP_1_1, - 'stream_context' => $stream_context)); -} -else{ - $server = new SoapServer($wsdl, array('soap_version' => SOAP_1_1)); -} - -/** - * adds the functions to the SoapServer Object, - * - * the sChangeSurvey function should be commented out for productive Use - */ -//$server->addFunction("sChangeSurvey"); -$server->addFunction("sDeleteSurvey"); -$server->addFunction("sActivateSurvey"); -$server->addFunction("sCreateSurvey"); -$server->addFunction("sInsertToken"); -$server->addFunction("sTokenReturn"); -$server->addFunction("sInsertParticipants"); -$server->addFunction("sImportGroup"); -$server->addFunction("sAvailableModules"); -$server->addFunction("sImportQuestion"); -$server->addFunction("sImportMatrix"); -$server->addFunction("sImportFreetext"); -$server->addFunction("sSendEmail"); -$server->addFunction("sGetFieldmap"); -$server->addFunction("fSendStatistic"); -// handle the soap request! -if($enableLsrc===true) -{ - $server->handle(); -} -/** - * - * Function to change tables in Limesurvey Database, this is too sensitive for productive use, but useful for development and testing - * @param $sUser - * @param $sPass - * @param $table - * @param $key - * @param $value - * @param $where - * @param $mode - * @return unknown_type - */ -function sChangeSurvey($sUser, $sPass, $table, $key, $value, $where, $mode='0') -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - //check for Surveyowner. Only owners and superadmins can change and activate surveys - if(!$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Databasetables"); - exit; - } - - return $lsrcHelper->changeTable($table, $key, $value, $where, $mode); -} -/** - * - * Function to send reminder, invitation or custom mails to participants of a specific survey - * @param $sUser - * @param $sPass - * @param $iVid - * @param $type - * @param $maxLsrcEmails - * @param $subject - * @param $emailText - * @return unknown_type - */ -function sSendEmail($sUser, $sPass, $iVid, $type, $maxLsrcEmails='', $subject='', $emailText='') -{ - global $sitename, $siteadminemail; - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - // wenn maxmails ber den lsrc gegeben wird das nurtzen, ansonsten die default werte aus der config.php - if($maxLsrcEmails!='') - $maxemails = $maxLsrcEmails; - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - // Check if all mandatory parameters are present, else abort... - if(!is_int($iVid) || $iVid==0 || $type=='') - { - throw new SoapFault("Server: ", "Mandatory Parameters missing"); - exit; - } - - if($type=='custom' && $subject!='' && $emailText!='') - { - //GET SURVEY DETAILS not working here... don't know why... - //$thissurvey=getSurveyInfo($iVid); - $from = $siteadminemail; - - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Admin Email: $from ; survey: $iVid ; dump: ".print_r($thissurvey).""); - $emquery = "SELECT firstname, lastname, email, token, tid, language"; - //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} - - $emquery .= " FROM ".db_table_name("tokens_{$iVid}")." WHERE email != '' "; - - if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} - $tokenoutput .= "\n\n\n\n"; - //$emresult = db_select_limit_assoc($emquery,$maxemails); - $emresult = db_execute_assoc($emquery); - $emcount = $emresult->RecordCount(); - - if ($emcount > 0) - { - $mailsSend = 0; - while ($emrow = $emresult->FetchRow()) - { - if (SendEmailMessage($emailText, $subject, $emrow['email'] , $from, $sitename, $ishtml=false, getBounceEmail($iVid))) - { - $mailsSend++; - } - else - { - //$tokenoutput .= ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
            ", $fieldsarray); - if($n==1) - $failedAddresses .= ",".$emrow['email']; - else - { - $failedAddresses = $emrow['email']; - $n=1; - } - - } - } - - } - else - { - return "No Mails to send"; - } - // if ($ctcount > $emcount) - // { - // $lefttosend = $ctcount-$maxemails; - // - // }else{$lefttosend = 0;} - - // if($maxemails>0) - // { - // $returnValue = "".$mailsSend." Mails send. ".$lefttosend." Mails left to send"; - // if(isset($failedAddresses)) - // $returnValue .= "\nCould not send to: ".$failedAddresses; - // return $returnValue; - // } - - if(isset($mailsSend)) - { - $returnValue = "".$mailsSend." Mails send. "; - if(isset($failedAddresses)) - $returnValue .= "\nCould not send to: ".$failedAddresses; - return $returnValue; - } - } - - if($type=='invite' || $type=='remind') - { - $emailSenderReturn = $lsrcHelper->emailSender($iVid, $type, $maxLsrcEmails); - - return $emailSenderReturn; - - } - else - { - throw new SoapFault("Type: ", "Wrong send Type given. Possible types are: custom, invite or remind"); - exit; - } - -} - -/** - * - * Function to activate a survey in the database and change some Values (starttime, endtime. Required parameters are: - * @param $sUser - * @param $sPass - * @param $iVid - * @param $dStart - * @param $dEnd - * @return unknown_type - */ -function sActivateSurvey($sUser, $sPass, $iVid, $dStart, $dEnd) -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - // check for apropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - // Check if all mandatory parameters are present, else abort... - if(!is_int($iVid) || $iVid==0) - { - throw new SoapFault("Server: ", "Mandatory Parameters missing"); - exit; - } - - // Check if the survey to create already exists. If not, abort with Fault. - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey you want to activate does not exists"); - exit; - } - - //check for Surveyowner. Only owners and superadmins can change and activate surveys - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); - exit; - } - $activateResult = $lsrcHelper->activateSurvey($iVid); - if($activateResult!=true) - { - throw new SoapFault("Server: ", "Import went wrong. Check lsrc.log."); - exit; - } - - if($dStart!='' && substr($dStart,0,10)!='1980-01-01') - { - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", CHANGE start "); - $lsrcHelper->changeTable('surveys','startdate',$dStart,'sid='.$iVid); - } - if($dEnd!='' && substr($dEnd,0,10)!='1980-01-01') - { - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", CHANGE end "); - $lsrcHelper->changeTable('surveys','expires',$dEnd,'sid='.$iVid); - } - - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", aktivierung OK "); - return $iVid; -} - -/** - * - * Function to import a survey into the database and change some Values. Required parameters are: - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sVtit - * @param $sVbes - * @param $sVwel - * @param $sMail - * @param $sName - * @param $sUrl - * @param $sUbes - * @param $sVtyp - * @param $autoRd - * @return unknown_type - */ -function sCreateSurvey($sUser, $sPass, $iVid, $sVtit, $sVbes, $sVwel, $sVend, $sMail, $sName, $sUrl, $sUbes, $sVtyp, $autoRd='N' ) -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",surveyid=$iVid START OK "); - - - if($sVwel=='') - {//if no welcometext is given, set this one - $sVwel = "Herzlich Willkommen zur Evaluation von \"".$sVtit."\""; - } - // if($sVend=='') - // {//if no endtext is given, set this one - // $sVend = "Vielen Dank für Ihre Teilnahme an der Umfrage!"; - // } - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - {// check for appropriate rights - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - if((!is_int($iVid) || $iVid==0) || $sVtit=='' || $sVbes=='') - {// Check if mandatory parameters are empty, if so-> abort - throw new SoapFault("Server: ", "Mandatory Parameters missing"); - exit; - } - - if($lsrcHelper->surveyExists($iVid)) - {// Check if the survey to create already exists. If so, abort with Fault. - throw new SoapFault("Database: ", "Survey already exists"); - exit; - } - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",vor import OK "); - - - $iNewSid = $lsrcHelper->importSurvey($iVid, $sVtyp); - if($iNewSid==NULL) - { - throw new SoapFault("Server: ", "Import went wrong somehow"); - exit; - } - -// if import of survey went ok it returns true, else nothing - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",surveyid=$iNewSid nach import OK "); - - //get the optional data into db - if($sMail!='') - { - $lsrcHelper->changeTable("surveys", "adminemail", $sMail, "sid='$iNewSid'"); - $lsrcHelper->changeTable("surveys", "bounce_email", $sMail, "sid='$iNewSid'"); - } - if($sName!='') - $lsrcHelper->changeTable("surveys", "admin", $sName, "sid='$iNewSid'"); - if($sUrl!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_url", $sUrl, "surveyls_survey_id='$iNewSid'"); - if($sUbes!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_urldescription", $sUbes, "surveyls_survey_id='$iNewSid'"); - if($autoRd=='Y') - $lsrcHelper->changeTable("surveys", "autoredirect", "Y", "sid='$iNewSid'"); - if($sVtit!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_title", $sVtit, "surveyls_survey_id='$iNewSid'"); - if($sVbes!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_description", $sVbes, "surveyls_survey_id='$iNewSid'"); - if($sVwel!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_welcometext", $sVwel, "surveyls_survey_id='$iNewSid'"); - if($sVend!='') - $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_endtext", $sVend, "surveyls_survey_id='$iNewSid'"); - - $lsrcHelper->changeTable("surveys", "datecreated", date("Y-m-d"), "sid='$iNewSid'"); - - return $iNewSid; - -}//end of function sCreateSurvey - - -/** - * - * Function to insert Tokens to an existing Survey, makes it "closed" - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sToken - * @return unknown_type - */ -function sInsertToken($sUser, $sPass, $iVid, $sToken) -{ - global $connect ; - global $dbprefix ; - //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - // check for apropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - // check if there is a $iVid, else abort - if(!isset($iVid) || $iVid=='' || $iVid==0 ) - { - throw new SoapFault("Server: ", "No SurveyId given"); - exit; - } - - // check if the Survey we want to populate with tokens already exists, else -> Fault - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey does not exists"); - exit; - } - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", ckecks ueberstanden "); - - // check if the Token table already exists, if not, create it... - if(!db_tables_exist("{$dbprefix}tokens_".$iVid)) - { - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", TOken Table existiert nicht "); - $createtokentable= - "tid int I NOTNULL AUTO PRIMARY,\n " - . "firstname C(40) ,\n " - . "lastname C(40) ,\n "; - //MSSQL needs special treatment because of some strangeness in ADODB - if ($databasetype == 'odbc_mssql' || $databasetype == 'odbtp' || $databasetype == 'mssql_n' || $databasetype == 'mssqlnative') - { - $createtokentable.= "email C(320) ,\n " - ."emailstatus C(300) DEFAULT 'OK',\n "; - } - else - { - $createtokentable.= "email X(320) ,\n " - ."emailstatus X(300) DEFAULT 'OK',\n "; - } - - $createtokentable.= "token C(36) ,\n " - . "language C(25) ,\n " - . "sent C(17) DEFAULT 'N',\n " - . "remindersent C(17) DEFAULT 'N',\n " - . "remindercount int I DEFAULT 0,\n " - . "completed C(17) DEFAULT 'N',\n " - . "attribute_1 C(100) ,\n" - . "attribute_2 C(100) ,\n" - . "mpid I "; - - $tabname = "{$dbprefix}tokens_{$iVid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) - $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', - 'mysqli' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); - $dict = NewDataDictionary($connect); - $sqlarray = $dict->CreateTableSQL($tabname, $createtokentable, $taboptarray); - $execresult=$dict->ExecuteSQLArray($sqlarray, false); - - $createtokentableindex = $dict->CreateIndexSQL("{$tabname}_idx", $tabname, array('token')); - $dict->ExecuteSQLArray($createtokentableindex, false); - } - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Token tabelle sollte erstellt sein "); - ################# - - //if the lsrcSeperator is not set, set the default seperator, a comma... - if($sLsrcSeparator=='') - { - $sLsrcSeparator = ","; - } - - // prepare to fill the table lime_tokens_* - // this is sensitiv, if the Seperator is not the defined one, almost everything could happen, BE AWARE OF YOUR SEPERATOR!... - $asTokens = explode($sLsrcSeparator, $sToken); - $givenTokenCount = count($asTokens); - // write the tokens in the token_table - $insertedTokenCount=0; - - foreach($asTokens as $value) - { - if($value!='') - { - $sInsertToken = "INSERT INTO {$dbprefix}tokens_".$iVid." - (token,language) VALUES ('".$value."' , '".$_SESSION['lang']."'); "; - if(!$connect->Execute($sInsertToken)) - { - throw new SoapFault("Server: ", "Token could not be inserted"); - exit; - } - else - { - ++$insertedTokenCount; - } - } - } - return "".$givenTokenCount." Token given, ".$insertedTokenCount." Token inserted."; - -} //end of function sInsertToken - - -/** - * The new one... - * * Function to insert Participant data while auto creating token if non is supported... - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sParticipantData (FIRSTNAME;LASTNAME;EMAIL;LANG;TOKEN;VALIDFROM;VALIDTO;attrib1,attrib2,attrib3,attrib4,attrib5::) - * @return unknown_type - */ -function sInsertParticipants($sUser, $sPass, $iVid, $sParticipantData) -{ - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - - - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - // check if there is a $iVid, else abort - if(!isset($iVid) || $iVid=='' || $iVid==0 ) - { - throw new SoapFault("Server: ", "No SurveyId given"); - exit; - } - - // check if the Survey we want to populate with data and tokens already exists, else -> Fault - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey does not exists"); - exit; - } - - return $lsrcHelper->insertParticipants($iVid, $sParticipantData); - - //return "".$iCountParticipants."Datasets given, ".$iInsertedParticipants." rows inserted. "; - -} - -/** - * - * function to return unused Tokens as String, seperated by commas, to get the people who did not complete the Survey - * @param $sUser - * @param $sPass - * @param $iVid - * @return unknown_type - */ -function sTokenReturn($sUser, $sPass, $iVid) -{ - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - // check if there is a $iVid, else abort - if(!isset($iVid) || $iVid=='' || $iVid==0 ) - { - throw new SoapFault("Server: ", "No SurveyId given"); - exit; - } - - // check if the Survey exists, else -> Fault - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey does not exists"); - exit; - } - - // check if the token table exists, else throw fault message - if(db_tables_exist($dbprefix."tokens_".$iVid)) - { - // select all the tokens that did not complete the Survey - $query2select_token = "SELECT token from {$dbprefix}tokens_".$iVid." WHERE completed = 'N'; "; - $rs = db_execute_assoc($query2select_token); - if($rs->RecordCount()<1) - { - throw new SoapFault("Database: ", "No unused Tokens found"); - exit; - } - - $n=0; - while($row = $rs->FetchRow()) - { - if($n == 0) - { - $sReturn = $row['token']; - } - else - { - $sReturn .= ",".$row['token']; - } - $n++; - } - // return Response: array([iVid],[return]) on the client side, you get this as an Array resp. list - // the keys in the array, containing the values, are named as defined in the wsdl under the response Message, in this case: array(iVid =>$iVid, return=>$sReturn) - - return $sReturn; - exit; - } - else - { - throw new SoapFault("Database: ", "Token table for this Survey does not exists"); - exit; - } -}//end of function sTokenReturn - -/** - * - * function to import an exported group of questions into a survey - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sMod - * @param $gName - * @param $gDesc - * @return unknown_type - */ -function sImportGroup($sUser, $sPass, $iVid, $sMod, $gName='', $gDesc='') -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or Password wrong"); - exit; - } - - //check for Surveyowner - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); - exit; - } - - if(!is_file($modDir.$sMod.".csv")) - { - throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); - exit; - } - - $checkImport = $lsrcHelper->importGroup($iVid, $sMod); - if(is_array($checkImport)) - { - if($gName!='') - $lsrcHelper->changeTable("groups", "group_name", $gName, "gid='".$checkImport['gid']."'"); - if($gDesc!='') - $lsrcHelper->changeTable("groups", "description", $gDesc, "gid='".$checkImport['gid']."'"); - - return "Import OK"; - } - else - { - throw new SoapFault("Server: ", $checkImport); - exit; - } - -} - -/** - * - * function to import a fixed question - * @param $sUser - * @param $sPass - * @param $iVid - * @param $sMod - * @param $mandatory - * @return unknown_type - */ -function sImportQuestion($sUser, $sPass, $iVid, $sMod, $mandatory='N') -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - //check for Surveyowner - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); - exit; - } - // Check if the file to import exists - if(!is_file($queDir.$sMod.".csv")) - { - throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); - exit; - } - - //import the module - $lastId = $lsrcHelper->importQuestion($iVid,$sMod); - if(is_array($lastId)) - { - // $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); - // $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); - // $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); - return "OK"; - } - else - { - throw new SoapFault("Server: ", $lastId); - exit; - } -} - -/** - * - * function to import one freetext question and change it - * @param $sUser - * @param $sPass - * @param $iVid - * @param $qTitle - * @param $qText - * @param $qHelp - * @param $sMod - * @param $mandatory - * @return unknown_type - */ -function sImportFreetext($sUser, $sPass, $iVid, $qTitle, $qText, $qHelp, $sMod='Freitext', $mandatory='N') -{ - /* - * this var maybe added later to constructor, - * to determine if a new group should be build for the question - * or if the question should be added to the last group in survey - */ - if($sMod=='') - $sMod='Freitext'; - if($mandatory=='') - $mandatory='N'; - - $newGroup=0; - - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); - - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - //check for Surveyowner - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); - exit; - } - // Check if the file to import exists - if(!is_file($queDir.$sMod.".csv")) - { - throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); - exit; - } - - //import the module - $lastId = $lsrcHelper->importQuestion($iVid,$sMod,0); - if(is_array($lastId)) - { - $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); - return "OK"; - } - else - { - throw new SoapFault("Server: ", $lastId); - exit; - } -} - -/** - * - * function to import a five scale Matrix question and set 1 to n items - * @param $sUser - * @param $sPass - * @param $iVid - * @param $qTitle - * @param $qText - * @param $qHelp - * @param $sItems - * @param $sMod - * @param $mandatory - * @return unknown_type - */ -function sImportMatrix($sUser, $sPass, $iVid, $qTitle, $qText, $qHelp, $sItems, $sMod='Matrix5', $mandatory='N') -{ - /* - * this var maybe added later to constructor, - * to determine if a new group should be build for the question - * or if the question should be added to the last group in survey - */ - if($sMod=='') - $sMod='Matrix5'; - if($mandatory=='') - $mandatory='N'; - - $newGroup=0; - - global $connect ; - global $dbprefix ; - //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK"); - - // check for appropriate rights - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - //check for surveyOwner - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); - exit; - } - // Check if the file to import exists - if(!is_file($queDir.$sMod.".csv")) - { - throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); - exit; - } - $lastId = $lsrcHelper->importQuestion($iVid,$sMod,$newGroup); - if(is_array($lastId)) - { - $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); - $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); - if($mandatory==''){$mandatory='N';} - $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); - - $aItems = explode(",", $sItems); - $n=0; - foreach($aItems as $item) - { - ++$n; - $lsrcHelper->changeTable("answers", "qid,code,answer,default_value,sortorder,language", "'".$lastId['qid']."', '$n','$item','N','$n','".GetBaseLanguageFromSurveyID($iVid)."' " , "", 1); - } - return "OK"; - } - else - { - throw new SoapFault("Server: ", $lastId); - exit; - } - -} - -/** - * - * function to collect all available Modules and send them comma seperated to the client - * @param String $sUser - * @param String $sPass - * @param String $mode ("mod" or "core") - * @return commma seperated list of available Modules (groups) - */ -function sAvailableModules($sUser, $sPass, $mode='mod') -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",mode=$mode START OK "); - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - switch($mode){ - case ('mod'): - - $mDir = opendir($modDir); - $n=0; - while(false !== ($file = readdir($mDir))) - { - if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") - { - //$file = basename ($file, ".csv"); - //$file = str_replace("mod_", "", $file); - - if($n == 0) - { - $return = $file; - $n=1; - } - else - { - $return .= ",".$file; - } - } - - } - return $return; - break; - case ('core'): - - $cDir = opendir($coreDir); - $n=0; - while(false !== ($file = readdir($cDir))) - { - if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") - { - //$file = basename ($file, ".csv"); - //$file = str_replace("mod_", "", $file); - if($n == 0) - { - $return = $file; - $n=1; - - } - else - { - $return .= ",".$file; - } - } - } - return $return; - break; - case ('que'): - - $cDir = opendir($queDir); - $n=0; - while(false !== ($file = readdir($cDir))) - { - if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") - { - //$file = basename ($file, ".csv"); - //$file = str_replace("mod_", "", $file); - if($n == 0) - { - $return = $file; - $n=1; - - } - else - { - $return .= ",".$file; - } - } - } - return $return; - break; - } -} - -/** - * - * function to delete a survey - * @param unknown_type $sUser - * @param unknown_type $sPass - * @param unknown_type $iVid - */ -function sDeleteSurvey($sUser, $sPass, $iVid) -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid START OK "); - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to delete Surveys from other people"); - exit; - } - // check if the Survey exists, else -> Fault - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey $iVid does not exist"); - exit; - } - - if($lsrcHelper->deleteSurvey($iVid)) - { - return "Survey $iVid deleted"; - } - else - { - throw new SoapFault("Server: ", "Survey $iVid was not deleted"); - exit; - } - - -} -/** - * - * Enter description here... - * @param $sUser Limesurvey user - * @param $sPass Password - * @param $iVid surveyid - * @param $email e-mail adress of the recipient - * @param $docType pdf, xls or html - * @param $graph with 1 it includes graphs in pdf files - * @return "OK" or SoapFault - */ -function fSendStatistic($sUser, $sPass, $iVid, $email, $docType='pdf', $graph='0') -{ - global $connect ; - global $dbprefix ; - $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - - // Check if all mandatory parameters are present, else abort... - if(!is_int($iVid) || $iVid==0 || $email=='') - { - throw new SoapFault("Server: ", "Mandatory Parameters missing"); - exit; - } - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to send statistics from other peoples Surveys"); - exit; - } - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey $iVid does not exists"); - exit; - } - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid email=$email doctype=$docType graph=$graph START OK "); - - /** - * Build up the fields to generate statistics from - */ - $summarySql=" SELECT gid, lid, qid, type " - ." FROM {$dbprefix}questions " - ." WHERE sid=$surveyid "; - - $summaryRs = $connect->Execute($summarySql); - $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid OK "); - foreach($summaryRs as $field) - { - $myField = $surveyid."X".$field['gid']."X".$field['qid']; - - // Multiple choice get special treatment - if ($field['type'] == "M" || $field['type'] == "P") {$myField = "M$myField";} - //numerical input will get special treatment (arihtmetic mean, standard derivation, ...) - if ($field['type'] == "N") {$myField = "N$myField";} - - if ($field['type'] == "Q") {$myField = "Q$myField";} - // textfields get special treatment - if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U"){$myField = "T$myField";} - //statistics for Date questions are not implemented yet. - if ($field['type'] == "D") {$myField = "D$myField";} - if ($field['type'] == "F" || $field['type'] == "H") - { - $ADODB_FETCH_MODE = ADODB_FETCH_NUM; - //Get answers. We always use the answer code because the label might be too long elsewise - $query = "SELECT code, answer FROM ".db_table_name("answers")." WHERE qid='".$field['qid']."' AND language='{$language}' ORDER BY sortorder, answer"; - $result = $connect->Execute($query) or safe_die ("Couldn't get answers!
            $query
            ".$connect->ErrorMsg()); - $counter2=0; - - //check all the answers - while ($row=$result->FetchRow()) - { - $myField = "$myField{$row[0]}"; - } - //$myField = "{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]"; - - - } - $summary[]=$myField; - - } - - //$lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",".print_r($summary)." "); - switch ($docType) - { - case 'pdf': - $tempFile = generate_statistics($iVid,$summary,'all',$graph,$docType,'F'); - - if($lsrcHelper->sendStatistic($iVid, $email, $tempFile)) - { - unlink($tempFile); - return 'PDF send'; - } - else - { - unlink($tempFile); - throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); - exit; - } - break; - case 'xls': - $tempFile = generate_statistics($iVid,$summary,'all',0,$docType, 'F'); - - if($lsrcHelper->sendStatistic($iVid, $email, $tempFile)) - { - unlink($tempFile); - return 'XLS send'; - } - else - { - unlink($tempFile); - throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); - exit; - } - break; - case 'html': - $html = generate_statistics($iVid,$summary,'all',0,$docType, 'F'); - - if($lsrcHelper->sendStatistic($iVid, $email, null, $html)) - { - return 'HTML send'; - } - else - { - throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); - exit; - } - break; - } - - - - -} -/** - * - * This function pulls a CSV representation of the Field map - * @param $sUser - * @param $sPass - * @param $iVid - * @return unknown_type - */ -function sGetFieldmap($sUser, $sPass, $iVid) -{ - include("lsrc.config.php"); - $lsrcHelper = new lsrcHelper(); - - if(!$lsrcHelper->checkUser($sUser, $sPass)) - { - throw new SoapFault("Authentication: ", "User or password wrong"); - exit; - } - if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') - { - throw new SoapFault("Authentication: ", "You have no right to get fieldmaps from other peoples Surveys"); - exit; - } - if(!$lsrcHelper->surveyExists($iVid)) - { - throw new SoapFault("Database: ", "Survey $iVid does not exists"); - exit; - } - - $returnCSV = "".$lsrcHelper->FieldMap2CSV($iVid); - return $returnCSV; - -} - + array( + 'verify_peer' => false, + 'allow_self_signed' => true, + 'local_cert' => $sslCert, + 'passphrase' => 'hisuser', + 'capture_peer_cert' => true + + ) + ); + + $stream_context = stream_context_create($context); + + $server = new SoapServer($wsdl, array('soap_version' => SOAP_1_1, + 'stream_context' => $stream_context)); +} +else{ + $server = new SoapServer($wsdl, array('soap_version' => SOAP_1_1)); +} + +/** + * adds the functions to the SoapServer Object, + * + * the sChangeSurvey function should be commented out for productive Use + */ +//$server->addFunction("sChangeSurvey"); +$server->addFunction("sDeleteSurvey"); +$server->addFunction("sActivateSurvey"); +$server->addFunction("sCreateSurvey"); +$server->addFunction("sInsertToken"); +$server->addFunction("sTokenReturn"); +$server->addFunction("sInsertParticipants"); +$server->addFunction("sImportGroup"); +$server->addFunction("sAvailableModules"); +$server->addFunction("sImportQuestion"); +$server->addFunction("sImportMatrix"); +$server->addFunction("sImportFreetext"); +$server->addFunction("sSendEmail"); +$server->addFunction("sGetFieldmap"); +$server->addFunction("fSendStatistic"); +// handle the soap request! +if($enableLsrc===true) +{ + $server->handle(); +} +/** + * + * Function to change tables in Limesurvey Database, this is too sensitive for productive use, but useful for development and testing + * @param $sUser + * @param $sPass + * @param $table + * @param $key + * @param $value + * @param $where + * @param $mode + * @return unknown_type + */ +function sChangeSurvey($sUser, $sPass, $table, $key, $value, $where, $mode='0') +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + //check for Surveyowner. Only owners and superadmins can change and activate surveys + if(!$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Databasetables"); + exit; + } + + return $lsrcHelper->changeTable($table, $key, $value, $where, $mode); +} +/** + * + * Function to send reminder, invitation or custom mails to participants of a specific survey + * @param $sUser + * @param $sPass + * @param $iVid + * @param $type + * @param $maxLsrcEmails + * @param $subject + * @param $emailText + * @return unknown_type + */ +function sSendEmail($sUser, $sPass, $iVid, $type, $maxLsrcEmails='', $subject='', $emailText='') +{ + global $sitename, $siteadminemail; + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + // wenn maxmails ber den lsrc gegeben wird das nurtzen, ansonsten die default werte aus der config.php + if($maxLsrcEmails!='') + $maxemails = $maxLsrcEmails; + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + // Check if all mandatory parameters are present, else abort... + if(!is_int($iVid) || $iVid==0 || $type=='') + { + throw new SoapFault("Server: ", "Mandatory Parameters missing"); + exit; + } + + if($type=='custom' && $subject!='' && $emailText!='') + { + //GET SURVEY DETAILS not working here... don't know why... + //$thissurvey=getSurveyInfo($iVid); + $from = $siteadminemail; + + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Admin Email: $from ; survey: $iVid ; dump: ".print_r($thissurvey).""); + $emquery = "SELECT firstname, lastname, email, token, tid, language"; + //if ($ctfieldcount > 7) {$emquery .= ", attribute_1, attribute_2";} + + $emquery .= " FROM ".db_table_name("tokens_{$iVid}")." WHERE email != '' "; + + if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} + $tokenoutput .= "\n\n\n\n"; + //$emresult = db_select_limit_assoc($emquery,$maxemails); + $emresult = db_execute_assoc($emquery); + $emcount = $emresult->RecordCount(); + + if ($emcount > 0) + { + $mailsSend = 0; + while ($emrow = $emresult->FetchRow()) + { + if (SendEmailMessage($emailText, $subject, $emrow['email'] , $from, $sitename, $ishtml=false, getBounceEmail($iVid))) + { + $mailsSend++; + } + else + { + //$tokenoutput .= ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
            ", $fieldsarray); + if($n==1) + $failedAddresses .= ",".$emrow['email']; + else + { + $failedAddresses = $emrow['email']; + $n=1; + } + + } + } + + } + else + { + return "No Mails to send"; + } + // if ($ctcount > $emcount) + // { + // $lefttosend = $ctcount-$maxemails; + // + // }else{$lefttosend = 0;} + + // if($maxemails>0) + // { + // $returnValue = "".$mailsSend." Mails send. ".$lefttosend." Mails left to send"; + // if(isset($failedAddresses)) + // $returnValue .= "\nCould not send to: ".$failedAddresses; + // return $returnValue; + // } + + if(isset($mailsSend)) + { + $returnValue = "".$mailsSend." Mails send. "; + if(isset($failedAddresses)) + $returnValue .= "\nCould not send to: ".$failedAddresses; + return $returnValue; + } + } + + if($type=='invite' || $type=='remind') + { + $emailSenderReturn = $lsrcHelper->emailSender($iVid, $type, $maxLsrcEmails); + + return $emailSenderReturn; + + } + else + { + throw new SoapFault("Type: ", "Wrong send Type given. Possible types are: custom, invite or remind"); + exit; + } + +} + +/** + * + * Function to activate a survey in the database and change some Values (starttime, endtime. Required parameters are: + * @param $sUser + * @param $sPass + * @param $iVid + * @param $dStart + * @param $dEnd + * @return unknown_type + */ +function sActivateSurvey($sUser, $sPass, $iVid, $dStart, $dEnd) +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + // check for apropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + // Check if all mandatory parameters are present, else abort... + if(!is_int($iVid) || $iVid==0) + { + throw new SoapFault("Server: ", "Mandatory Parameters missing"); + exit; + } + + // Check if the survey to create already exists. If not, abort with Fault. + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey you want to activate does not exists"); + exit; + } + + //check for Surveyowner. Only owners and superadmins can change and activate surveys + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); + exit; + } + $activateResult = $lsrcHelper->activateSurvey($iVid); + if($activateResult!=true) + { + throw new SoapFault("Server: ", "Import went wrong. Check lsrc.log."); + exit; + } + + if($dStart!='' && substr($dStart,0,10)!='1980-01-01') + { + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", CHANGE start "); + $lsrcHelper->changeTable('surveys','startdate',$dStart,'sid='.$iVid); + } + if($dEnd!='' && substr($dEnd,0,10)!='1980-01-01') + { + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", CHANGE end "); + $lsrcHelper->changeTable('surveys','expires',$dEnd,'sid='.$iVid); + } + + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", aktivierung OK "); + return $iVid; +} + +/** + * + * Function to import a survey into the database and change some Values. Required parameters are: + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sVtit + * @param $sVbes + * @param $sVwel + * @param $sMail + * @param $sName + * @param $sUrl + * @param $sUbes + * @param $sVtyp + * @param $autoRd + * @return unknown_type + */ +function sCreateSurvey($sUser, $sPass, $iVid, $sVtit, $sVbes, $sVwel, $sVend, $sMail, $sName, $sUrl, $sUbes, $sVtyp, $autoRd='N' ) +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",surveyid=$iVid START OK "); + + + if($sVwel=='') + {//if no welcometext is given, set this one + $sVwel = "Herzlich Willkommen zur Evaluation von \"".$sVtit."\""; + } + // if($sVend=='') + // {//if no endtext is given, set this one + // $sVend = "Vielen Dank für Ihre Teilnahme an der Umfrage!"; + // } + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + {// check for appropriate rights + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + if((!is_int($iVid) || $iVid==0) || $sVtit=='' || $sVbes=='') + {// Check if mandatory parameters are empty, if so-> abort + throw new SoapFault("Server: ", "Mandatory Parameters missing"); + exit; + } + + if($lsrcHelper->surveyExists($iVid)) + {// Check if the survey to create already exists. If so, abort with Fault. + throw new SoapFault("Database: ", "Survey already exists"); + exit; + } + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",vor import OK "); + + + $iNewSid = $lsrcHelper->importSurvey($iVid, $sVtyp); + if($iNewSid==NULL) + { + throw new SoapFault("Server: ", "Import went wrong somehow"); + exit; + } + +// if import of survey went ok it returns true, else nothing + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",surveyid=$iNewSid nach import OK "); + + //get the optional data into db + if($sMail!='') + { + $lsrcHelper->changeTable("surveys", "adminemail", $sMail, "sid='$iNewSid'"); + $lsrcHelper->changeTable("surveys", "bounce_email", $sMail, "sid='$iNewSid'"); + } + if($sName!='') + $lsrcHelper->changeTable("surveys", "admin", $sName, "sid='$iNewSid'"); + if($sUrl!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_url", $sUrl, "surveyls_survey_id='$iNewSid'"); + if($sUbes!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_urldescription", $sUbes, "surveyls_survey_id='$iNewSid'"); + if($autoRd=='Y') + $lsrcHelper->changeTable("surveys", "autoredirect", "Y", "sid='$iNewSid'"); + if($sVtit!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_title", $sVtit, "surveyls_survey_id='$iNewSid'"); + if($sVbes!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_description", $sVbes, "surveyls_survey_id='$iNewSid'"); + if($sVwel!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_welcometext", $sVwel, "surveyls_survey_id='$iNewSid'"); + if($sVend!='') + $lsrcHelper->changeTable("surveys_languagesettings", "surveyls_endtext", $sVend, "surveyls_survey_id='$iNewSid'"); + + $lsrcHelper->changeTable("surveys", "datecreated", date("Y-m-d"), "sid='$iNewSid'"); + + return $iNewSid; + +}//end of function sCreateSurvey + + +/** + * + * Function to insert Tokens to an existing Survey, makes it "closed" + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sToken + * @return unknown_type + */ +function sInsertToken($sUser, $sPass, $iVid, $sToken) +{ + global $connect ; + global $dbprefix ; + //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + // check for apropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + // check if there is a $iVid, else abort + if(!isset($iVid) || $iVid=='' || $iVid==0 ) + { + throw new SoapFault("Server: ", "No SurveyId given"); + exit; + } + + // check if the Survey we want to populate with tokens already exists, else -> Fault + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey does not exists"); + exit; + } + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", ckecks ueberstanden "); + + // check if the Token table already exists, if not, create it... + if(!db_tables_exist("{$dbprefix}tokens_".$iVid)) + { + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", TOken Table existiert nicht "); + $createtokentable= + "tid int I NOTNULL AUTO PRIMARY,\n " + . "firstname C(40) ,\n " + . "lastname C(40) ,\n "; + //MSSQL needs special treatment because of some strangeness in ADODB + if ($databasetype == 'odbc_mssql' || $databasetype == 'odbtp' || $databasetype == 'mssql_n' || $databasetype == 'mssqlnative') + { + $createtokentable.= "email C(320) ,\n " + ."emailstatus C(300) DEFAULT 'OK',\n "; + } + else + { + $createtokentable.= "email X(320) ,\n " + ."emailstatus X(300) DEFAULT 'OK',\n "; + } + + $createtokentable.= "token C(36) ,\n " + . "language C(25) ,\n " + . "sent C(17) DEFAULT 'N',\n " + . "remindersent C(17) DEFAULT 'N',\n " + . "remindercount int I DEFAULT 0,\n " + . "completed C(17) DEFAULT 'N',\n " + . "attribute_1 C(100) ,\n" + . "attribute_2 C(100) ,\n" + . "mpid I "; + + $tabname = "{$dbprefix}tokens_{$iVid}"; # not using db_table_name as it quotes the table name (as does CreateTableSQL) + $taboptarray = array('mysql' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci', + 'mysqli' => 'ENGINE='.$databasetabletype.' CHARACTER SET utf8 COLLATE utf8_unicode_ci'); + $dict = NewDataDictionary($connect); + $sqlarray = $dict->CreateTableSQL($tabname, $createtokentable, $taboptarray); + $execresult=$dict->ExecuteSQLArray($sqlarray, false); + + $createtokentableindex = $dict->CreateIndexSQL("{$tabname}_idx", $tabname, array('token')); + $dict->ExecuteSQLArray($createtokentableindex, false); + } + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", Token tabelle sollte erstellt sein "); + ################# + + //if the lsrcSeperator is not set, set the default seperator, a comma... + if($sLsrcSeparator=='') + { + $sLsrcSeparator = ","; + } + + // prepare to fill the table lime_tokens_* + // this is sensitiv, if the Seperator is not the defined one, almost everything could happen, BE AWARE OF YOUR SEPERATOR!... + $asTokens = explode($sLsrcSeparator, $sToken); + $givenTokenCount = count($asTokens); + // write the tokens in the token_table + $insertedTokenCount=0; + + foreach($asTokens as $value) + { + if($value!='') + { + $sInsertToken = "INSERT INTO {$dbprefix}tokens_".$iVid." + (token,language) VALUES ('".$value."' , '".$_SESSION['lang']."'); "; + if(!$connect->Execute($sInsertToken)) + { + throw new SoapFault("Server: ", "Token could not be inserted"); + exit; + } + else + { + ++$insertedTokenCount; + } + } + } + return "".$givenTokenCount." Token given, ".$insertedTokenCount." Token inserted."; + +} //end of function sInsertToken + + +/** + * The new one... + * * Function to insert Participant data while auto creating token if non is supported... + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sParticipantData (FIRSTNAME;LASTNAME;EMAIL;LANG;TOKEN;VALIDFROM;VALIDTO;attrib1,attrib2,attrib3,attrib4,attrib5::) + * @return unknown_type + */ +function sInsertParticipants($sUser, $sPass, $iVid, $sParticipantData) +{ + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + + + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + // check if there is a $iVid, else abort + if(!isset($iVid) || $iVid=='' || $iVid==0 ) + { + throw new SoapFault("Server: ", "No SurveyId given"); + exit; + } + + // check if the Survey we want to populate with data and tokens already exists, else -> Fault + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey does not exists"); + exit; + } + + return $lsrcHelper->insertParticipants($iVid, $sParticipantData); + + //return "".$iCountParticipants."Datasets given, ".$iInsertedParticipants." rows inserted. "; + +} + +/** + * + * function to return unused Tokens as String, seperated by commas, to get the people who did not complete the Survey + * @param $sUser + * @param $sPass + * @param $iVid + * @return unknown_type + */ +function sTokenReturn($sUser, $sPass, $iVid) +{ + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + // check if there is a $iVid, else abort + if(!isset($iVid) || $iVid=='' || $iVid==0 ) + { + throw new SoapFault("Server: ", "No SurveyId given"); + exit; + } + + // check if the Survey exists, else -> Fault + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey does not exists"); + exit; + } + + // check if the token table exists, else throw fault message + if(db_tables_exist($dbprefix."tokens_".$iVid)) + { + // select all the tokens that did not complete the Survey + $query2select_token = "SELECT token from {$dbprefix}tokens_".$iVid." WHERE completed = 'N'; "; + $rs = db_execute_assoc($query2select_token); + if($rs->RecordCount()<1) + { + throw new SoapFault("Database: ", "No unused Tokens found"); + exit; + } + + $n=0; + while($row = $rs->FetchRow()) + { + if($n == 0) + { + $sReturn = $row['token']; + } + else + { + $sReturn .= ",".$row['token']; + } + $n++; + } + // return Response: array([iVid],[return]) on the client side, you get this as an Array resp. list + // the keys in the array, containing the values, are named as defined in the wsdl under the response Message, in this case: array(iVid =>$iVid, return=>$sReturn) + + return $sReturn; + exit; + } + else + { + throw new SoapFault("Database: ", "Token table for this Survey does not exists"); + exit; + } +}//end of function sTokenReturn + +/** + * + * function to import an exported group of questions into a survey + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sMod + * @param $gName + * @param $gDesc + * @return unknown_type + */ +function sImportGroup($sUser, $sPass, $iVid, $sMod, $gName='', $gDesc='') +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or Password wrong"); + exit; + } + + //check for Surveyowner + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); + exit; + } + + if(!is_file($modDir.$sMod.".csv")) + { + throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); + exit; + } + + $checkImport = $lsrcHelper->importGroup($iVid, $sMod); + if(is_array($checkImport)) + { + if($gName!='') + $lsrcHelper->changeTable("groups", "group_name", $gName, "gid='".$checkImport['gid']."'"); + if($gDesc!='') + $lsrcHelper->changeTable("groups", "description", $gDesc, "gid='".$checkImport['gid']."'"); + + return "Import OK"; + } + else + { + throw new SoapFault("Server: ", $checkImport); + exit; + } + +} + +/** + * + * function to import a fixed question + * @param $sUser + * @param $sPass + * @param $iVid + * @param $sMod + * @param $mandatory + * @return unknown_type + */ +function sImportQuestion($sUser, $sPass, $iVid, $sMod, $mandatory='N') +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + //check for Surveyowner + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); + exit; + } + // Check if the file to import exists + if(!is_file($queDir.$sMod.".csv")) + { + throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); + exit; + } + + //import the module + $lastId = $lsrcHelper->importQuestion($iVid,$sMod); + if(is_array($lastId)) + { + // $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); + // $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); + // $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); + return "OK"; + } + else + { + throw new SoapFault("Server: ", $lastId); + exit; + } +} + +/** + * + * function to import one freetext question and change it + * @param $sUser + * @param $sPass + * @param $iVid + * @param $qTitle + * @param $qText + * @param $qHelp + * @param $sMod + * @param $mandatory + * @return unknown_type + */ +function sImportFreetext($sUser, $sPass, $iVid, $qTitle, $qText, $qHelp, $sMod='Freitext', $mandatory='N') +{ + /* + * this var maybe added later to constructor, + * to determine if a new group should be build for the question + * or if the question should be added to the last group in survey + */ + if($sMod=='') + $sMod='Freitext'; + if($mandatory=='') + $mandatory='N'; + + $newGroup=0; + + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK "); + + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + //check for Surveyowner + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); + exit; + } + // Check if the file to import exists + if(!is_file($queDir.$sMod.".csv")) + { + throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); + exit; + } + + //import the module + $lastId = $lsrcHelper->importQuestion($iVid,$sMod,0); + if(is_array($lastId)) + { + $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); + return "OK"; + } + else + { + throw new SoapFault("Server: ", $lastId); + exit; + } +} + +/** + * + * function to import a five scale Matrix question and set 1 to n items + * @param $sUser + * @param $sPass + * @param $iVid + * @param $qTitle + * @param $qText + * @param $qHelp + * @param $sItems + * @param $sMod + * @param $mandatory + * @return unknown_type + */ +function sImportMatrix($sUser, $sPass, $iVid, $qTitle, $qText, $qHelp, $sItems, $sMod='Matrix5', $mandatory='N') +{ + /* + * this var maybe added later to constructor, + * to determine if a new group should be build for the question + * or if the question should be added to the last group in survey + */ + if($sMod=='') + $sMod='Matrix5'; + if($mandatory=='') + $mandatory='N'; + + $newGroup=0; + + global $connect ; + global $dbprefix ; + //$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.", START OK"); + + // check for appropriate rights + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + //check for surveyOwner + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to change Surveys from other people"); + exit; + } + // Check if the file to import exists + if(!is_file($queDir.$sMod.".csv")) + { + throw new SoapFault("Server: ", "Survey Module $sMod does not exist"); + exit; + } + $lastId = $lsrcHelper->importQuestion($iVid,$sMod,$newGroup); + if(is_array($lastId)) + { + $lsrcHelper->changeTable("questions", "title", $qTitle, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "question", $qText, "qid='".$lastId['qid']."'"); + $lsrcHelper->changeTable("questions", "help", $qHelp, "qid='".$lastId['qid']."'"); + if($mandatory==''){$mandatory='N';} + $lsrcHelper->changeTable("questions", "mandatory", $mandatory, "qid='".$lastId['qid']."'"); + + $aItems = explode(",", $sItems); + $n=0; + foreach($aItems as $item) + { + ++$n; + $lsrcHelper->changeTable("answers", "qid,code,answer,default_value,sortorder,language", "'".$lastId['qid']."', '$n','$item','N','$n','".GetBaseLanguageFromSurveyID($iVid)."' " , "", 1); + } + return "OK"; + } + else + { + throw new SoapFault("Server: ", $lastId); + exit; + } + +} + +/** + * + * function to collect all available Modules and send them comma seperated to the client + * @param String $sUser + * @param String $sPass + * @param String $mode ("mod" or "core") + * @return commma seperated list of available Modules (groups) + */ +function sAvailableModules($sUser, $sPass, $mode='mod') +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",mode=$mode START OK "); + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + switch($mode){ + case ('mod'): + + $mDir = opendir($modDir); + $n=0; + while(false !== ($file = readdir($mDir))) + { + if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") + { + //$file = basename ($file, ".csv"); + //$file = str_replace("mod_", "", $file); + + if($n == 0) + { + $return = $file; + $n=1; + } + else + { + $return .= ",".$file; + } + } + + } + return $return; + break; + case ('core'): + + $cDir = opendir($coreDir); + $n=0; + while(false !== ($file = readdir($cDir))) + { + if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") + { + //$file = basename ($file, ".csv"); + //$file = str_replace("mod_", "", $file); + if($n == 0) + { + $return = $file; + $n=1; + + } + else + { + $return .= ",".$file; + } + } + } + return $return; + break; + case ('que'): + + $cDir = opendir($queDir); + $n=0; + while(false !== ($file = readdir($cDir))) + { + if(substr($file,-4,4)==".lss" || substr($file,-4,4)==".csv") + { + //$file = basename ($file, ".csv"); + //$file = str_replace("mod_", "", $file); + if($n == 0) + { + $return = $file; + $n=1; + + } + else + { + $return .= ",".$file; + } + } + } + return $return; + break; + } +} + +/** + * + * function to delete a survey + * @param unknown_type $sUser + * @param unknown_type $sPass + * @param unknown_type $iVid + */ +function sDeleteSurvey($sUser, $sPass, $iVid) +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid START OK "); + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to delete Surveys from other people"); + exit; + } + // check if the Survey exists, else -> Fault + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey $iVid does not exist"); + exit; + } + + if($lsrcHelper->deleteSurvey($iVid)) + { + return "Survey $iVid deleted"; + } + else + { + throw new SoapFault("Server: ", "Survey $iVid was not deleted"); + exit; + } + + +} +/** + * + * Enter description here... + * @param $sUser Limesurvey user + * @param $sPass Password + * @param $iVid surveyid + * @param $email e-mail adress of the recipient + * @param $docType pdf, xls or html + * @param $graph with 1 it includes graphs in pdf files + * @return "OK" or SoapFault + */ +function fSendStatistic($sUser, $sPass, $iVid, $email, $docType='pdf', $graph='0') +{ + global $connect ; + global $dbprefix ; + $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + + // Check if all mandatory parameters are present, else abort... + if(!is_int($iVid) || $iVid==0 || $email=='') + { + throw new SoapFault("Server: ", "Mandatory Parameters missing"); + exit; + } + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to send statistics from other peoples Surveys"); + exit; + } + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey $iVid does not exists"); + exit; + } + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid email=$email doctype=$docType graph=$graph START OK "); + + /** + * Build up the fields to generate statistics from + */ + $summarySql=" SELECT gid, lid, qid, type " + ." FROM {$dbprefix}questions " + ." WHERE sid=$surveyid "; + + $summaryRs = $connect->Execute($summarySql); + $lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",sid=$iVid OK "); + foreach($summaryRs as $field) + { + $myField = $surveyid."X".$field['gid']."X".$field['qid']; + + // Multiple choice get special treatment + if ($field['type'] == "M" || $field['type'] == "P") {$myField = "M$myField";} + //numerical input will get special treatment (arihtmetic mean, standard derivation, ...) + if ($field['type'] == "N") {$myField = "N$myField";} + + if ($field['type'] == "Q") {$myField = "Q$myField";} + // textfields get special treatment + if ($field['type'] == "S" || $field['type'] == "T" || $field['type'] == "U"){$myField = "T$myField";} + //statistics for Date questions are not implemented yet. + if ($field['type'] == "D") {$myField = "D$myField";} + if ($field['type'] == "F" || $field['type'] == "H") + { + $ADODB_FETCH_MODE = ADODB_FETCH_NUM; + //Get answers. We always use the answer code because the label might be too long elsewise + $query = "SELECT code, answer FROM ".db_table_name("answers")." WHERE qid='".$field['qid']."' AND language='{$language}' ORDER BY sortorder, answer"; + $result = $connect->Execute($query) or safe_die ("Couldn't get answers!
            $query
            ".$connect->ErrorMsg()); + $counter2=0; + + //check all the answers + while ($row=$result->FetchRow()) + { + $myField = "$myField{$row[0]}"; + } + //$myField = "{$surveyid}X{$flt[1]}X{$flt[0]}{$row[0]}[]"; + + + } + $summary[]=$myField; + + } + + //$lsrcHelper->debugLsrc("wir sind in ".__FUNCTION__." Line ".__LINE__.",".print_r($summary)." "); + switch ($docType) + { + case 'pdf': + $tempFile = generate_statistics($iVid,$summary,'all',$graph,$docType,'F'); + + if($lsrcHelper->sendStatistic($iVid, $email, $tempFile)) + { + unlink($tempFile); + return 'PDF send'; + } + else + { + unlink($tempFile); + throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); + exit; + } + break; + case 'xls': + $tempFile = generate_statistics($iVid,$summary,'all',0,$docType, 'F'); + + if($lsrcHelper->sendStatistic($iVid, $email, $tempFile)) + { + unlink($tempFile); + return 'XLS send'; + } + else + { + unlink($tempFile); + throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); + exit; + } + break; + case 'html': + $html = generate_statistics($iVid,$summary,'all',0,$docType, 'F'); + + if($lsrcHelper->sendStatistic($iVid, $email, null, $html)) + { + return 'HTML send'; + } + else + { + throw new SoapFault("Mail System", "Mail could not be send! Check LimeSurveys E-Mail Settings."); + exit; + } + break; + } + + + + +} +/** + * + * This function pulls a CSV representation of the Field map + * @param $sUser + * @param $sPass + * @param $iVid + * @return unknown_type + */ +function sGetFieldmap($sUser, $sPass, $iVid) +{ + include("lsrc.config.php"); + $lsrcHelper = new lsrcHelper(); + + if(!$lsrcHelper->checkUser($sUser, $sPass)) + { + throw new SoapFault("Authentication: ", "User or password wrong"); + exit; + } + if($lsrcHelper->getSurveyOwner($iVid)!=$_SESSION['loginID'] && !$_SESSION['USER_RIGHT_SUPERADMIN']=='1') + { + throw new SoapFault("Authentication: ", "You have no right to get fieldmaps from other peoples Surveys"); + exit; + } + if(!$lsrcHelper->surveyExists($iVid)) + { + throw new SoapFault("Database: ", "Survey $iVid does not exists"); + exit; + } + + $returnCSV = "".$lsrcHelper->FieldMap2CSV($iVid); + return $returnCSV; + +} + ?> \ No newline at end of file diff --git a/include/limesurvey/admin/remotecontrol/lsrc.testclient.php b/include/limesurvey/admin/remotecontrol/lsrc.testclient.php index cc34570d..06ec128f 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc.testclient.php +++ b/include/limesurvey/admin/remotecontrol/lsrc.testclient.php @@ -1,635 +1,635 @@ -prepare($_POST['sid']); -} -else -{ - $iVid=''; - $testclient->prepare(); -} -/** - * set user and password - */ -//$testclient->user = 'admin'; -//$testclient->pass = 'hisuser'; - -/** - * set the path2wsdl to what ever is set by the user - */ -//if(isset($_POST['wsdl'])) -// $testclient->path2wsdl = $_POST['wsdl']; - -$sReturn = ''; - -/** call the desired function */ -reset($_POST); -while (list($key, $value) = each($_POST)) { - switch ($key) { - case "sendStatistic": - - try { - $sReturn = $testclient->sendStatistics($_REQUEST['type'], $_REQUEST['email'], $_REQUEST['graph']); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - - break; - case "delsurvey": - try { - $sReturn = $testclient->deleteSurvey(); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - case "sendMail": - - $sType = $_REQUEST['type']; - $maxemails = $_REQUEST['maxemails']; - $subject = $_REQUEST['subject']; - $mailText = $_REQUEST['mailText']; - - try { - $sReturn = $testclient->sendMail($sType, $maxemails, $subject, $mailText); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - case "getField": - - try { - $sReturn = $testclient->getFieldmap(); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - case "delsurvey": - - try { - $sReturn = $testclient->deleteSurvey(); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - case "impMatrix": - - $qText = $_REQUEST['quest']; - $mandatory = $_REQUEST['mandatory']; - for ($n = 1; $n < 10; ++$n) { - if ($_REQUEST['item' . $n] != '') { - if ($n == 1) { - $items = $_REQUEST['item' . $n]; - } else { - $items .= "," . $_REQUEST['item' . $n]; - } - } - } - - $qHelp = $_REQUEST['help']; - - try { - - $sReturn = $testclient->importMatrix($qTitle, $qText, $qHelp, $items, "Matrix5", $mandatory); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - - - case "impFree": - - $qTitle = $_REQUEST['title']; - $qText = $_REQUEST['quest']; - $qHelp = $_REQUEST['help']; - $mandatory = $_REQUEST['mandatory']; - - try { - - $sReturn = $testclient->sImportFreetext($qTitle, $qText, $qHelp, "Freitext", $mandatory); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - - case "impQuest": - - $sMod = $_REQUEST['mod']; - $mandatory = $_REQUEST['mandatory']; - - try { - - $sReturn = $testclient->importQuestion($sMod, $mandatory); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - break; - - case "impGroup": - - $sMod = $_REQUEST['mod']; - $sGroupName = $_REQUEST['groupName']; - $sGroupDescription = $_REQUEST['groupDescription']; - try { - $sReturn = $client->sImportGroup($sMod, $sGroupName, $sGroupDescription); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - - break; - - case "activate": - $dStart = $_REQUEST['start']; - $dEnd = $_REQUEST['end']; - try { - $sReturn = $testclient->activateSurvey($dStart, $dEnd); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - - - break; - - case "createSurvey": - $sVbes = $_REQUEST['sdes']; - $sVtit = $_REQUEST['stit']; - $sVwel = $_REQUEST['sVwel']; - $sVend = $_REQUEST['sVend']; - $sMail = $_REQUEST['sEmail']; - $sName = $_REQUEST['sName']; - $sUrl = $_REQUEST['sUrl']; - $sUbes = $_REQUEST['sUdes']; - $sVtyp = $_REQUEST['core']; - - try { - $sReturn = $testclient->createSurvey($sVtit, $sVbes, $sVwel, $sVend, $sMail, $sName, $sUrl, $sUbes, $sVtyp); - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - $sOutput .= "

            Return: " . $sReturn; - - - break; - - case "change": - - $table = $_REQUEST['table']; - $key = $_REQUEST['key']; - $value = $_REQUEST['value']; - $where = $_REQUEST['whereKey']; - $mode = $_REQUEST['mode']; - //$whereValue = $_REQUEST['whereValue']; - - try { - $sReturn = $testclient->changeSurvey($table, $key, $value, $where, $mode); - $sOutput .= "

            Return: " . $sReturn; - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - - - break; - - case "tokens": - - $sToken = $_REQUEST['token']; - try { - $sReturn = $testclient->insertToken($sToken); - $sOutput .= "

            Return: " . $sReturn; - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - - break; - - case "tokRet": - - try { - $sReturn = $testclient->tokenReturn(); - $sOutput .= "

            Return: " . $sReturn; - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - - break; - - case "insPar": - - $sParticipantData = $_REQUEST['sParticipantData']; - try { - $sReturn = $testclient->insertParticipants($sParticipantData); - - $sOutput .= "

            Return: " . $sReturn; - } catch (SoapFault $fault) { - $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; - } - //these are just outputs for testing - - - break; - } -} - -## -##################################################################### - -/** - * begin with output (some css first) - */ -?> - - - - - LimeSurvey RC Testclient - - - - -soapCheck(); -/** - * if there is an return, output request and response for debugging - */ -if (isset($sReturn) && $sReturn != '') { - echo $testclient->getResponse(); -} - -// we dump the client object functions (which are functions of the server defined in the wsdl) -if (!isset($sReturn) || $sReturn == '') { - echo $testclient->getServerFunctions(); -} - -if (isset($sOutput)) { - - echo '
            '; - echo '

            testing output:

            '; - if (isset($testclient->sid)) { - echo "test Survey"; - } - echo $sOutput; - echo '
            '; -} -?> -
            -

            sCreateSurvey function

            -
            ' method='post'>* VeranstaltungsTyp:
            -
            - * VeranstaltungsID / SurveyID (have to be - Integer):
            -
            - * Veranstaltungs Titel / Survey Title (used - as part of the welcome message, if welcome Message is left blank):
            -
            - * VeranstaltungsBeschreibung / - SurveyDescription (used as part of the welcome message, if welcome - Message is left blank):
            -
            - Willkommenstext / Welcome Message:
            -
            - Endtext / endtext:
            -
            - Admin Name:
            -
            - Admin Email:
            -
            - End Url:
            -
            - Url Description:
            -
            - " ?> -
            -
            - - -
            -

            sActivateSurvey function

            -
            ' method='post'>* VeranstaltungsID / SurveyID:
            -
            - Startdate (YYYY-MM-DD):
            -
            - Enddate (YYYY-MM-DD):
            -
            - " ?> -
            -
            - -
            -

            sDeleteSurvey function

            - (attention: no safetyquestion is asked!)
            -
            ' method='post'>* VeranstaltungsID / SurveyID:
            -
            - " ?> -
            -
            - -
            -

            sImportGroup function

            -
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): -
            -
            - * Question group to add (INF,BIO,BWL is - there for testing):
            -
            - Name of the group:
            -
            - groupDescription:
            - -
            -" ?> -
            -
            - -
            -

            sImportFreetext

            -
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): -
            -
            - Mandatory
            - * Question Title :
            -
            - * Question:
            -
            - Helptext:
            -
            -" ?> -
            -
            - -
            -

            sImportQuestion

            -
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): -
            -
            - Mandatory
            - * Question csv to import:
            -
            -" ?> -
            -
            - - -
            -

            sImportMatrix

            -
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): -
            -
            - Mandatory
            - * Question :
            -
            -Item {$n} :
            ", - "", - "
            "; - } -?> Helptext:
            -
            -" ?> -
            -
            - - -
            -

            sChangeSurvey function

            - ( this is not part of the lsrc, it just shows the power of it,
            - it has to be activated in server.php on line ~60 ) -
            ' method='post'> update insert
            - Table to change
            -
            - Key
            -
            - Value
            -
            - where Condition
            -
            -
            - -
            - - "; - echo "

            sInsertToken function

            "; - echo "

            Makes the Survey closed.
            Means: It's only available to people who have an unused token

            "; - echo "
            "; - echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; - echo ""; - echo "
            "; - echo "Tokens seperated by comma (,) :
            "; - echo ""; - echo "
            "; - echo ""; - echo ""; - echo "
            "; - echo "
            "; - - - echo "
            "; - echo "

            sTokenReturn function

            "; - echo "
            "; - echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; - echo "
            "; - echo ""; - echo ""; - echo "
            "; - - echo "
            "; - echo "

            sInsertParticipants function

            "; - echo "

            Makes the Survey closed. Means: It's only available to people who have an unused token

            "; - echo "
            "; - echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; - echo ""; - echo "
            "; - echo "* Data in this Format [params in square brackets are optional]:
            \"FIRSTNAME;LASTNAME;EMAIL;LANG[;TOKEN;VALIDFROM;VALIDUNTIL;attrib1,attrib2,attrib3,attrib4,attrib5] -
            ::FIRSTNAME;LASTNAME;EMAIL;LANG[;TOKEN;VALIDFROM;VALIDUNTIL;attrib1,attrib2,attrib3,attrib4,attrib5]\" and so on :

            "; - echo " "; - echo "
            "; - echo ""; - echo ""; - echo "
            "; - echo "
            "; - - echo "
            "; - echo "

            sSendEmail function

            "; - echo "

            Sends an Email to users of a specific survey. Invite, Remind and custom emails are possible

            "; - echo "
            "; - echo "* SurveyID (have to be Integer):
            "; - echo ""; - echo "
            "; - echo "* Email Type:
            "; - echo " invite"; - echo " remind"; - echo " custom
            "; - echo "Maxemails (have to be Integer):
            "; - echo ""; - echo "
            "; -//echo "* Data in this Format [params in square brackets are optional]:
            \"FIRSTNAME;LASTNAME;EMAIL[;[ATTRIB1];[ATTRIB2]]::FIRSTNAME;LASTNAME;EMAIL[;[ATTRIB1];[ATTRIB2]]\" and so on :

            "; - echo "Subject for custom cails
            "; - echo "
            "; - echo "Mailtext for custom cails
            "; - echo " "; - echo "
            "; - echo ""; - echo ""; - echo "
            "; - echo "
            "; - - echo "
            "; - echo "

            sGetFieldmap function

            "; - echo "

            Gets you the fieldmap from a survey as csv

            "; - echo "
            "; - echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; - echo "
            "; - echo ""; - echo ""; - echo "
            "; - - echo "
            "; - echo "

            fSendStatistic function

            "; - echo "

            Gets statistic from a survey and sends it to an E-Mail recipient

            "; - echo "
            "; - echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; - echo "
            "; - echo "* E-Mail Adress:
            "; - echo "
            "; - echo "Include graphs (only with pdf generation)
            "; - echo "PDF attachement"; - echo "Excel attachement"; - echo "HTML Mail
            "; - - echo ""; - echo ""; - echo "
            "; -//phpinfo(); - ?> - - - +prepare($_POST['sid']); +} +else +{ + $iVid=''; + $testclient->prepare(); +} +/** + * set user and password + */ +//$testclient->user = 'admin'; +//$testclient->pass = 'hisuser'; + +/** + * set the path2wsdl to what ever is set by the user + */ +//if(isset($_POST['wsdl'])) +// $testclient->path2wsdl = $_POST['wsdl']; + +$sReturn = ''; + +/** call the desired function */ +reset($_POST); +while (list($key, $value) = each($_POST)) { + switch ($key) { + case "sendStatistic": + + try { + $sReturn = $testclient->sendStatistics($_REQUEST['type'], $_REQUEST['email'], $_REQUEST['graph']); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + + break; + case "delsurvey": + try { + $sReturn = $testclient->deleteSurvey(); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + case "sendMail": + + $sType = $_REQUEST['type']; + $maxemails = $_REQUEST['maxemails']; + $subject = $_REQUEST['subject']; + $mailText = $_REQUEST['mailText']; + + try { + $sReturn = $testclient->sendMail($sType, $maxemails, $subject, $mailText); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + case "getField": + + try { + $sReturn = $testclient->getFieldmap(); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + case "delsurvey": + + try { + $sReturn = $testclient->deleteSurvey(); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + case "impMatrix": + + $qText = $_REQUEST['quest']; + $mandatory = $_REQUEST['mandatory']; + for ($n = 1; $n < 10; ++$n) { + if ($_REQUEST['item' . $n] != '') { + if ($n == 1) { + $items = $_REQUEST['item' . $n]; + } else { + $items .= "," . $_REQUEST['item' . $n]; + } + } + } + + $qHelp = $_REQUEST['help']; + + try { + + $sReturn = $testclient->importMatrix($qTitle, $qText, $qHelp, $items, "Matrix5", $mandatory); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + + + case "impFree": + + $qTitle = $_REQUEST['title']; + $qText = $_REQUEST['quest']; + $qHelp = $_REQUEST['help']; + $mandatory = $_REQUEST['mandatory']; + + try { + + $sReturn = $testclient->sImportFreetext($qTitle, $qText, $qHelp, "Freitext", $mandatory); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + + case "impQuest": + + $sMod = $_REQUEST['mod']; + $mandatory = $_REQUEST['mandatory']; + + try { + + $sReturn = $testclient->importQuestion($sMod, $mandatory); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + break; + + case "impGroup": + + $sMod = $_REQUEST['mod']; + $sGroupName = $_REQUEST['groupName']; + $sGroupDescription = $_REQUEST['groupDescription']; + try { + $sReturn = $client->sImportGroup($sMod, $sGroupName, $sGroupDescription); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + + break; + + case "activate": + $dStart = $_REQUEST['start']; + $dEnd = $_REQUEST['end']; + try { + $sReturn = $testclient->activateSurvey($dStart, $dEnd); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + + + break; + + case "createSurvey": + $sVbes = $_REQUEST['sdes']; + $sVtit = $_REQUEST['stit']; + $sVwel = $_REQUEST['sVwel']; + $sVend = $_REQUEST['sVend']; + $sMail = $_REQUEST['sEmail']; + $sName = $_REQUEST['sName']; + $sUrl = $_REQUEST['sUrl']; + $sUbes = $_REQUEST['sUdes']; + $sVtyp = $_REQUEST['core']; + + try { + $sReturn = $testclient->createSurvey($sVtit, $sVbes, $sVwel, $sVend, $sMail, $sName, $sUrl, $sUbes, $sVtyp); + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + $sOutput .= "

            Return: " . $sReturn; + + + break; + + case "change": + + $table = $_REQUEST['table']; + $key = $_REQUEST['key']; + $value = $_REQUEST['value']; + $where = $_REQUEST['whereKey']; + $mode = $_REQUEST['mode']; + //$whereValue = $_REQUEST['whereValue']; + + try { + $sReturn = $testclient->changeSurvey($table, $key, $value, $where, $mode); + $sOutput .= "

            Return: " . $sReturn; + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + + + break; + + case "tokens": + + $sToken = $_REQUEST['token']; + try { + $sReturn = $testclient->insertToken($sToken); + $sOutput .= "

            Return: " . $sReturn; + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + + break; + + case "tokRet": + + try { + $sReturn = $testclient->tokenReturn(); + $sOutput .= "

            Return: " . $sReturn; + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + + break; + + case "insPar": + + $sParticipantData = $_REQUEST['sParticipantData']; + try { + $sReturn = $testclient->insertParticipants($sParticipantData); + + $sOutput .= "

            Return: " . $sReturn; + } catch (SoapFault $fault) { + $sOutput .= "

            SOAP Error: " . $fault->faultcode . " : " . $fault->faultstring . ""; + } + //these are just outputs for testing + + + break; + } +} + +## +##################################################################### + +/** + * begin with output (some css first) + */ +?> + + + + + LimeSurvey RC Testclient + + + + +soapCheck(); +/** + * if there is an return, output request and response for debugging + */ +if (isset($sReturn) && $sReturn != '') { + echo $testclient->getResponse(); +} + +// we dump the client object functions (which are functions of the server defined in the wsdl) +if (!isset($sReturn) || $sReturn == '') { + echo $testclient->getServerFunctions(); +} + +if (isset($sOutput)) { + + echo '
            '; + echo '

            testing output:

            '; + if (isset($testclient->sid)) { + echo "test Survey"; + } + echo $sOutput; + echo '
            '; +} +?> +
            +

            sCreateSurvey function

            +
            ' method='post'>* VeranstaltungsTyp:
            +
            + * VeranstaltungsID / SurveyID (have to be + Integer):
            +
            + * Veranstaltungs Titel / Survey Title (used + as part of the welcome message, if welcome Message is left blank):
            +
            + * VeranstaltungsBeschreibung / + SurveyDescription (used as part of the welcome message, if welcome + Message is left blank):
            +
            + Willkommenstext / Welcome Message:
            +
            + Endtext / endtext:
            +
            + Admin Name:
            +
            + Admin Email:
            +
            + End Url:
            +
            + Url Description:
            +
            + " ?> +
            +
            + + +
            +

            sActivateSurvey function

            +
            ' method='post'>* VeranstaltungsID / SurveyID:
            +
            + Startdate (YYYY-MM-DD):
            +
            + Enddate (YYYY-MM-DD):
            +
            + " ?> +
            +
            + +
            +

            sDeleteSurvey function

            + (attention: no safetyquestion is asked!)
            +
            ' method='post'>* VeranstaltungsID / SurveyID:
            +
            + " ?> +
            +
            + +
            +

            sImportGroup function

            +
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): +
            +
            + * Question group to add (INF,BIO,BWL is + there for testing):
            +
            + Name of the group:
            +
            + groupDescription:
            + +
            +" ?> +
            +
            + +
            +

            sImportFreetext

            +
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): +
            +
            + Mandatory
            + * Question Title :
            +
            + * Question:
            +
            + Helptext:
            +
            +" ?> +
            +
            + +
            +

            sImportQuestion

            +
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): +
            +
            + Mandatory
            + * Question csv to import:
            +
            +" ?> +
            +
            + + +
            +

            sImportMatrix

            +
            ' method='post'>* VeranstaltungsID / SurveyID (have to be Integer): +
            +
            + Mandatory
            + * Question :
            +
            +Item {$n} :
            ", + "", + "
            "; + } +?> Helptext:
            +
            +" ?> +
            +
            + + +
            +

            sChangeSurvey function

            + ( this is not part of the lsrc, it just shows the power of it,
            + it has to be activated in server.php on line ~60 ) +
            ' method='post'> update insert
            + Table to change
            +
            + Key
            +
            + Value
            +
            + where Condition
            +
            +
            + +
            + + "; + echo "

            sInsertToken function

            "; + echo "

            Makes the Survey closed.
            Means: It's only available to people who have an unused token

            "; + echo "
            "; + echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; + echo ""; + echo "
            "; + echo "Tokens seperated by comma (,) :
            "; + echo ""; + echo "
            "; + echo ""; + echo ""; + echo "
            "; + echo ""; + + + echo "
            "; + echo "

            sTokenReturn function

            "; + echo "
            "; + echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; + echo "
            "; + echo ""; + echo ""; + echo "
            "; + + echo "
            "; + echo "

            sInsertParticipants function

            "; + echo "

            Makes the Survey closed. Means: It's only available to people who have an unused token

            "; + echo "
            "; + echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; + echo ""; + echo "
            "; + echo "* Data in this Format [params in square brackets are optional]:
            \"FIRSTNAME;LASTNAME;EMAIL;LANG[;TOKEN;VALIDFROM;VALIDUNTIL;attrib1,attrib2,attrib3,attrib4,attrib5] +
            ::FIRSTNAME;LASTNAME;EMAIL;LANG[;TOKEN;VALIDFROM;VALIDUNTIL;attrib1,attrib2,attrib3,attrib4,attrib5]\" and so on :

            "; + echo " "; + echo "
            "; + echo ""; + echo ""; + echo "
            "; + echo "
            "; + + echo "
            "; + echo "

            sSendEmail function

            "; + echo "

            Sends an Email to users of a specific survey. Invite, Remind and custom emails are possible

            "; + echo "
            "; + echo "* SurveyID (have to be Integer):
            "; + echo ""; + echo "
            "; + echo "* Email Type:
            "; + echo " invite"; + echo " remind"; + echo " custom
            "; + echo "Maxemails (have to be Integer):
            "; + echo ""; + echo "
            "; +//echo "* Data in this Format [params in square brackets are optional]:
            \"FIRSTNAME;LASTNAME;EMAIL[;[ATTRIB1];[ATTRIB2]]::FIRSTNAME;LASTNAME;EMAIL[;[ATTRIB1];[ATTRIB2]]\" and so on :

            "; + echo "Subject for custom cails
            "; + echo "
            "; + echo "Mailtext for custom cails
            "; + echo " "; + echo "
            "; + echo ""; + echo ""; + echo "
            "; + echo "
            "; + + echo "
            "; + echo "

            sGetFieldmap function

            "; + echo "

            Gets you the fieldmap from a survey as csv

            "; + echo "
            "; + echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; + echo "
            "; + echo ""; + echo ""; + echo "
            "; + + echo "
            "; + echo "

            fSendStatistic function

            "; + echo "

            Gets statistic from a survey and sends it to an E-Mail recipient

            "; + echo "
            "; + echo "* VeranstaltungsID / SurveyID (have to be Integer):
            "; + echo "
            "; + echo "* E-Mail Adress:
            "; + echo "
            "; + echo "Include graphs (only with pdf generation)
            "; + echo "PDF attachement"; + echo "Excel attachement"; + echo "HTML Mail
            "; + + echo ""; + echo ""; + echo "
            "; +//phpinfo(); + ?> + + + diff --git a/include/limesurvey/admin/remotecontrol/lsrc_orig.wsdl b/include/limesurvey/admin/remotecontrol/lsrc_orig.wsdl index e15ec3cc..a381d8db 100644 --- a/include/limesurvey/admin/remotecontrol/lsrc_orig.wsdl +++ b/include/limesurvey/admin/remotecontrol/lsrc_orig.wsdl @@ -1,731 +1,731 @@ - - - - - - - - - - Function to start Surveys in LimeSurvey... - - - Admin or Superadmin Account in Limesurvey needed - - - - Correct password for the Superadmin in - Limesurvey - - - - This is the "VeranstaltungsID" similar to the SurveyID... Integer expected... - - - titel of the event, put together from NR and NAME from LSF. veranstaltung - - This is the "Veranstaltungsbeschreibung", the Surveydescription. - String expected. Put together from TYP, DOZENTEN- TITLE, -NAME, - - - - - - The E-Mail Adress of the Person who to contact in matters of evaluation. Limesurvey uses this to send notifications of Surveyparticipation, if wante - The Name of the Administrator, resp. the Person whos email Adress was given - - The URL to wich will be redirected when completing the Survey - - The text for the Link, if not loaded automatically - - - - - - - - This is the return Value of sCreateSurvey, if everything went fine it's the sid(SurveyID) resp. vid(VeranstaltungsID) of the newly imported Survey - - - - - - - Admin or Superadmin Account in Limesurvey needed - - - - Correct password for the Superadmin in Limesurvey - - - - SurveyID of existing Survey, which gets the Token table - - - - String of tokens seperated by a comma (default)... You have the possibility to change the desired seperator in LimeSurveys config.php - - - - - - - - This is the return Value of InsertToken, if everything went fine it's "Token table populated successfully" - - - - - - - Admin or Superadmin Account in Limesurvey needed - - - - Correct password for the Superadmin in Limesurvey - - - - SurveyID of existing Survey, which gets the Token table - - - - Data for Participant expected in this format: [Firstname];[Lastname];[email@email.de]::[Firstname];[Lastname];[email@email.de]::[Firstname];[Lastname];[email@email.de] and so on... seperate the Datasets with :: and the Datafields in the Sets with ; - - - - - - - This is the return Value of sInsertParticipants, if everything went fine it's "Token table populated successfully" - - - - - - - Admin or Superadmin Account in Limesurvey needed - - - - Correct password for the Superadmin in Limesurvey - - - - SurveyID of existing Survey, which has a Token table - - - - - - - - - String of unused Tokens seperated by comma - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Creates (Import and activate) a Survey in LimeSurvey - - - - - - Create Token-Table and populate it for closed LimeSurvey Surveys - - - - - - Create Token-Table and populate it with personal data for closed Surveys - - - - - - Returns unused Tokens from closed LimeSurvey Surveys - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is the LsrcService - for remote starting surveys and registering tokens in LimeSurvey. - Make sure to modify the soap:address to the current Location of the lsrcserver.php - It has to be like this: 'http://servername/[limesurveydir]/lsrcservice/lsrcserver.php' - NOTE: http for normal mode, begin the url with https for a SSL Webservice, it's just that easy. - - - - - - + + + + + + + + + + Function to start Surveys in LimeSurvey... + + + Admin or Superadmin Account in Limesurvey needed + + + + Correct password for the Superadmin in + Limesurvey + + + + This is the "VeranstaltungsID" similar to the SurveyID... Integer expected... + + + titel of the event, put together from NR and NAME from LSF. veranstaltung + + This is the "Veranstaltungsbeschreibung", the Surveydescription. + String expected. Put together from TYP, DOZENTEN- TITLE, -NAME, + + + + + + The E-Mail Adress of the Person who to contact in matters of evaluation. Limesurvey uses this to send notifications of Surveyparticipation, if wante + The Name of the Administrator, resp. the Person whos email Adress was given + + The URL to wich will be redirected when completing the Survey + + The text for the Link, if not loaded automatically + + + + + + + + This is the return Value of sCreateSurvey, if everything went fine it's the sid(SurveyID) resp. vid(VeranstaltungsID) of the newly imported Survey + + + + + + + Admin or Superadmin Account in Limesurvey needed + + + + Correct password for the Superadmin in Limesurvey + + + + SurveyID of existing Survey, which gets the Token table + + + + String of tokens seperated by a comma (default)... You have the possibility to change the desired seperator in LimeSurveys config.php + + + + + + + + This is the return Value of InsertToken, if everything went fine it's "Token table populated successfully" + + + + + + + Admin or Superadmin Account in Limesurvey needed + + + + Correct password for the Superadmin in Limesurvey + + + + SurveyID of existing Survey, which gets the Token table + + + + Data for Participant expected in this format: [Firstname];[Lastname];[email@email.de]::[Firstname];[Lastname];[email@email.de]::[Firstname];[Lastname];[email@email.de] and so on... seperate the Datasets with :: and the Datafields in the Sets with ; + + + + + + + This is the return Value of sInsertParticipants, if everything went fine it's "Token table populated successfully" + + + + + + + Admin or Superadmin Account in Limesurvey needed + + + + Correct password for the Superadmin in Limesurvey + + + + SurveyID of existing Survey, which has a Token table + + + + + + + + + String of unused Tokens seperated by comma + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Creates (Import and activate) a Survey in LimeSurvey + + + + + + Create Token-Table and populate it for closed LimeSurvey Surveys + + + + + + Create Token-Table and populate it with personal data for closed Surveys + + + + + + Returns unused Tokens from closed LimeSurvey Surveys + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is the LsrcService + for remote starting surveys and registering tokens in LimeSurvey. + Make sure to modify the soap:address to the current Location of the lsrcserver.php + It has to be like this: 'http://servername/[limesurveydir]/lsrcservice/lsrcserver.php' + NOTE: http for normal mode, begin the url with https for a SSL Webservice, it's just that easy. + + + + + + \ No newline at end of file diff --git a/include/limesurvey/admin/remotecontrol/surveys/limesurvey_survey_29846.lss b/include/limesurvey/admin/remotecontrol/surveys/limesurvey_survey_29846.lss deleted file mode 100644 index 71523449..00000000 --- a/include/limesurvey/admin/remotecontrol/surveys/limesurvey_survey_29846.lss +++ /dev/null @@ -1,3529 +0,0 @@ - - - Survey - 145 - - en - - - - qid - code - answer - assessment_value - sortorder - language - scale_id - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - gid - sid - group_name - group_order - description - language - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - qid - parent_qid - sid - gid - type - title - question - preg - help - other - mandatory - question_order - language - scale_id - same_default - - - - - - - - - <![CDATA[A]]> - - - - - - - - - - - - - - - - - <![CDATA[B]]> - - - - - - - - - - - - - - - - - <![CDATA[C]]> - - - - - - - - - - - - - - - - - <![CDATA[E]]> - - - - - - - - - - - - - - - - - <![CDATA[F]]> - - - - - - - - - - - - - - - - - <![CDATA[H]]> - - - - - - - - - - - - - - - - - <![CDATA[Semantic]]> - ]]> - - ]]> - - - - - - - - - - - - - - <![CDATA[DualScale-radio]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[:]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[;]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[DualScale-dropdown]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[:]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[F]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[Q]]> - - - - - - - - - - - - - - - - - <![CDATA[T]]> - - - - - - - - - - - - - - - - - <![CDATA[S]]> - - - - - - - - - - - - - - - - - <![CDATA[U]]> - - - - - - - - - - - - - - - - - <![CDATA[Q]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[Q]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[X]]> - - - - - - - - - - - - - - - - - <![CDATA[G]]> - - - - - - - - - - - - - - - - - <![CDATA[N]]> - - - - - - - - - - - - - - - - - <![CDATA[R]]> - - - - - - - - - - - - - - - - - <![CDATA[Y]]> - - - - - - - - - - - - - - - - - <![CDATA[D]]> - - - - - - - - - - - - - - - - - <![CDATA[K]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[K]]> - ]]> - - ]]> - - - - - - - - - - - - - - <![CDATA[D]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[K]]> - ]]> - - ]]> - - - - - - - - - - - - - - <![CDATA[K]]> - ]]> - - - - - - - - - - - - - - - - <![CDATA[Z]]> - - - - - - - - - - - - - - - - - <![CDATA[W]]> - - - - - - - - - - - - - - - - - <![CDATA[O]]> - - - - - - - - - - - - - - - - - <![CDATA[L]]> - - - - - - - - - - - - - - - - - <![CDATA[5]]> - - - - - - - - - - - - - - - - - <![CDATA[!]]> - - - - - - - - - - - - - - - - - <![CDATA[P]]> - - - - - - - - - - - - - - - - - <![CDATA[M]]> - - - - - - - - - - - - - - - - - <![CDATA[Semantic-Slider]]> - ]]> - - - - - - - - - - - - - - qid - parent_qid - sid - gid - type - title - question - preg - help - other - mandatory - question_order - language - scale_id - same_default - - - - - - - - - <![CDATA[SPD]]> - - - - - - - - - - - - - - - - - <![CDATA[DSN]]> - - - - - - - - - - - - - - - - - <![CDATA[ACC]]> - - - - - - - - - - - - - - - - - <![CDATA[SPD]]> - - - - - - - - - - - - - - - - - <![CDATA[DSN]]> - - - - - - - - - - - - - - - - - <![CDATA[ACC]]> - - - - - - - - - - - - - - - - - <![CDATA[SPD]]> - - - - - - - - - - - - - - - - - <![CDATA[DSN]]> - - - - - - - - - - - - - - - - - <![CDATA[ACC]]> - - - - - - - - - - - - - - - - - <![CDATA[A1]]> - - - - - - - - - - - - - - - - - <![CDATA[A2]]> - - - - - - - - - - - - - - - - - <![CDATA[A3]]> - - - - - - - - - - - - - - - - - <![CDATA[A4]]> - - - - - - - - - - - - - - - - - <![CDATA[B1]]> - - - - - - - - - - - - - - - - - <![CDATA[B2]]> - - - - - - - - - - - - - - - - - <![CDATA[B3]]> - - - - - - - - - - - - - - - - - <![CDATA[B4]]> - - - - - - - - - - - - - - - - - <![CDATA[C1]]> - - - - - - - - - - - - - - - - - <![CDATA[C2]]> - - - - - - - - - - - - - - - - - <![CDATA[C3]]> - - - - - - - - - - - - - - - - - <![CDATA[C4]]> - - - - - - - - - - - - - - - - - <![CDATA[E1]]> - - - - - - - - - - - - - - - - - <![CDATA[E2]]> - - - - - - - - - - - - - - - - - <![CDATA[E3]]> - - - - - - - - - - - - - - - - - <![CDATA[E4]]> - - - - - - - - - - - - - - - - - <![CDATA[F1]]> - - - - - - - - - - - - - - - - - <![CDATA[F2]]> - - - - - - - - - - - - - - - - - <![CDATA[F3]]> - - - - - - - - - - - - - - - - - <![CDATA[F4]]> - - - - - - - - - - - - - - - - - <![CDATA[H1]]> - - - - - - - - - - - - - - - - - <![CDATA[H2]]> - - - - - - - - - - - - - - - - - <![CDATA[H3]]> - - - - - - - - - - - - - - - - - <![CDATA[H4]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[4]]> - - - - - - - - - - - - - - - - - <![CDATA[5]]> - - - - - - - - - - - - - - - - - <![CDATA[6]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[F1]]> - - - - - - - - - - - - - - - - - <![CDATA[F2]]> - - - - - - - - - - - - - - - - - <![CDATA[F3]]> - - - - - - - - - - - - - - - - - <![CDATA[F4]]> - - - - - - - - - - - - - - - - - <![CDATA[Q1]]> - - - - - - - - - - - - - - - - - <![CDATA[Q2]]> - - - - - - - - - - - - - - - - - <![CDATA[Q3]]> - - - - - - - - - - - - - - - - - <![CDATA[Q1]]> - - - - - - - - - - - - - - - - - <![CDATA[Q2]]> - - - - - - - - - - - - - - - - - <![CDATA[Q3]]> - - - - - - - - - - - - - - - - - <![CDATA[Q1]]> - - - - - - - - - - - - - - - - - <![CDATA[Q2]]> - - - - - - - - - - - - - - - - - <![CDATA[Q3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[P1]]> - - - - - - - - - - - - - - - - - <![CDATA[P2]]> - - - - - - - - - - - - - - - - - <![CDATA[P3]]> - - - - - - - - - - - - - - - - - <![CDATA[M1]]> - - - - - - - - - - - - - - - - - <![CDATA[M2]]> - - - - - - - - - - - - - - - - - <![CDATA[M3]]> - - - - - - - - - - - - - - - - - <![CDATA[1]]> - - - - - - - - - - - - - - - - - <![CDATA[2]]> - - - - - - - - - - - - - - - - - <![CDATA[3]]> - - - - - - - - - - - - - - - - - <![CDATA[4]]> - - - - - - - - - - - - - - - - - <![CDATA[5]]> - - - - - - - - - - - - - - - - - <![CDATA[6]]> - - - - - - - - - - - - - - - qaid - qid - attribute - value - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - sid - admin - expires - startdate - adminemail - private - faxto - format - template - language - additional_languages - datestamp - usecookie - notification - allowregister - allowsave - autonumber_start - autoredirect - showXquestions - showgroupinfo - shownoanswer - showqnumcode - allowprev - printanswers - ipaddr - refurl - bouncetime - bounceprocessing - bounceaccounttype - bounceaccounthost - bounceaccountuser - bounceaccountpass - bounceaccountencryption - publicstatistics - publicgraphs - listpublic - htmlemail - tokenanswerspersistence - assessments - usecaptcha - usetokens - bounce_email - attributedescriptions - emailresponseto - tokenlength - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - surveyls_survey_id - surveyls_language - surveyls_title - surveyls_description - surveyls_welcometext - surveyls_endtext - surveyls_url - 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 - surveyls_dateformat - - - - - - - -It also shows some of the options available for each question.
            ]]>
            - -You can can edit it in the survey properties.]]> - -You can can edit it in the survey properties.
            ]]>
            - - - - - - - - - - - -
            -
            -
            -
            diff --git a/include/limesurvey/admin/resetsurveylogic.php b/include/limesurvey/admin/resetsurveylogic.php index f65230a7..7f5f72b5 100644 --- a/include/limesurvey/admin/resetsurveylogic.php +++ b/include/limesurvey/admin/resetsurveylogic.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: resetsurveylogic.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: resetsurveylogic.php 11664 2011-12-16 05:19:42Z tmswhite $ */ //Ensure script is not run directly, avoid path disclosure @@ -55,6 +55,7 @@ if (!isset($ok) || !$ok) else //delete conditions in the survey { $dict = NewDataDictionary($connect); + LimeExpressionManager::RevertUpgradeConditionsToRelevance($surveyid); $resetlogicquery = "DELETE FROM {$dbprefix}conditions WHERE qid in (select qid from {$dbprefix}questions where sid=$surveyid)"; $resetlogicresult = $connect->Execute($resetlogicquery) or safe_die ("Couldn't delete conditions
            $resetlogicquery
            ".$connect->ErrorMsg()); diff --git a/include/limesurvey/admin/results.php b/include/limesurvey/admin/results.php index 9b3083e1..34d830e5 100644 --- a/include/limesurvey/admin/results.php +++ b/include/limesurvey/admin/results.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: results.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: results.php 11607 2011-12-06 23:19:52Z tmswhite $ */ diff --git a/include/limesurvey/admin/saved.php b/include/limesurvey/admin/saved.php index 48390634..c60ca235 100644 --- a/include/limesurvey/admin/saved.php +++ b/include/limesurvey/admin/saved.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: saved.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: saved.php 11607 2011-12-06 23:19:52Z tmswhite $ */ include_once("login_check.php"); diff --git a/include/limesurvey/admin/scripts/admin_core.js b/include/limesurvey/admin/scripts/admin_core.js index 604bcc9c..f8217433 100644 --- a/include/limesurvey/admin/scripts/admin_core.js +++ b/include/limesurvey/admin/scripts/admin_core.js @@ -1,644 +1,716 @@ -//$Id: admin_core.js 10855 2011-08-26 13:30:41Z mot3 $ - -$(document).ready(function(){ - setupAllTabs(); - if(typeof(userdateformat) !== 'undefined') - { - $(".popupdate").datepicker({ dateFormat: userdateformat, - showOn: 'button', - changeYear: true, - changeMonth: true, - duration: 'fast' - }, $.datepicker.regional[userlanguage]); - $(".popupdatetime").datepicker({ dateFormat: userdateformat+' 00:00', - showOn: 'button', - changeYear: true, - changeMonth: true, - duration: 'fast' - }, $.datepicker.regional[userlanguage]); - } - - $('button,input[type=submit],input[type=button],input[type=reset]').addClass("limebutton ui-state-default ui-corner-all"); - $('button,input[type=submit],input[type=button],input[type=reset]').hover( - function(){ - $(this).addClass("ui-state-hover"); - }, - function(){ - $(this).removeClass("ui-state-hover"); - } - ) - - - // Loads the tooltips for the toolbars except the surveybar - $('img[alt],input[src]').not('.surveybar img').each(function() { - if($(this).attr('alt') != '') - { - $(this).qtip({ - style: { name: 'cream', - tip:true, - color:'#1D2D45', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomRight'} - }, - show: {effect: { length:50}}, - hide: { when: 'mouseout' } - }); - } - }); - - - $('label[title]').each(function() { - if($(this).attr('title') != '') - { - $(this).qtip({ - style: { name: 'cream', - tip:true, - color:'#1D2D45', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomRight'} - }, - show: {effect: { length:50}} - }); - } - }); - - $('.dosurvey').qtip({ - content:{ - text:$('#dosurveylangpopup') - }, - style: { name: 'cream', - tip:true, - color:'#1D2D45', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomMiddle', - tooltip: 'topMiddle'} - }, - show: {effect: { length:50}, - when: { - event:'click' - }}, - hide: {fixed:true, - when: { - event:'unfocus' - }} - }); - - $('#previewquestion').qtip({ - content:{ - text:$('#previewquestionpopup') - }, - style: { name: 'cream', - tip:true, - color:'#111111', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomMiddle', - tooltip: 'topMiddle'} - }, - show: {effect: { length:50}, - when: { - event:'click' - }}, - hide: {fixed:true, - when: { - event:'unfocus' - }} - }); - - $('.tipme').each(function() { - if($(this).attr('alt') != '') - { - $(this).qtip({ - style: { name: 'cream', - tip:true, - color:'#111111', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'topRight', - tooltip: 'bottomLeft' - } - }, - show: {effect: { length:100}} - - }); - } - }); - - - if ($('#showadvancedattributes').length>0) updatequestionattributes(); - - $('#showadvancedattributes').click(function(){ - $('#showadvancedattributes').hide(); - $('#hideadvancedattributes').show(); - $('#advancedquestionsettingswrapper').animate({ - "height": "toggle", "opacity": "toggle" - }); - - }) - $('#hideadvancedattributes').click(function(){ - $('#showadvancedattributes').show(); - $('#hideadvancedattributes').hide(); - $('#advancedquestionsettingswrapper').animate({ - "height": "toggle", "opacity": "toggle" - }); - - }) - $('#question_type').change(updatequestionattributes); - - $('#MinimizeGroupWindow').click(function(){ - $('#groupdetails').hide(); - }); - $('#MaximizeGroupWindow').click(function(){ - $('#groupdetails').show(); - }); - $('#tabs').tabs(); - $("#flashmessage").notify().notify('create','themeroller',{},{custom:true, - speed: 500, - expires: 5000 -}); - - var old_owner = ''; - - $(".ownername_edit").live('click',function(){ - var oldThis = this; - var ownername_edit_id = $(this).attr('id'); - var survey_id = ownername_edit_id.slice(15); - var translate_to = $(this).attr('translate_to'); - var initial_text = $(this).html(); - $.getJSON('admin.php', { - action: 'ajaxgetusers' - },function(oData) - { - old_owner = $($(oldThis).parent()).html(); - - old_owner = (old_owner.split("("))[0]; - $($(oldThis).parent()).html('' - + ''); - $(oData).each(function(key,value){ - $('#ownername_select_'+survey_id). - append($(""). - attr("value",value[0]). - text(value[1])); - }); - $("#ownername_select_"+survey_id+ " option[id=opt_"+old_owner+"]").attr("selected","selected"); - }); - }); - - $(".ownername_button").live('click',function(){ - var oldThis = this; - var initial_text = $(this).attr('initial_text'); - var ownername_select_id = $(this).attr('id'); - var survey_id = ownername_select_id.slice(17); - var newowner = $("#ownername_select_"+survey_id).val(); - var translate_to = $(this).attr('value'); - - $.getJSON('admin.php',{ - action: 'ajaxowneredit', - newowner: newowner, - survey_id : survey_id - }, function (data){ - - var objToUpdate = $($(oldThis).parent()); - - if (data.record_count>0) - $(objToUpdate).html(data.newowner); - else - $(objToUpdate).html(old_owner); - - $(objToUpdate).html($(objToUpdate).html() + '('+initial_text+')' ); - }); - }); - - if ($("#question_type").length > 0 && $("#question_type").attr('type')!='hidden'){ - $("#question_type").msDropDown({onInit:qTypeDropdownInit}); - - $("#question_type").change(function(event){ - var selected_value = qDescToCode[''+$("#question_type_child .selected").text()]; - OtherSelection(selected_value); - }); - } - - - -}); - -function qTypeDropdownInit() -{ - $("#question_type_child a").each(function(index,element){ - - $(element).qtip({ - style: { - 'margin' : '15px', - 'width': '450px', - 'height':'auto', - 'border':{ - width: 4, - radius: 2 - } - }, - content: getToolTip($(element).text()), - position: { - corner:{ - target: 'leftMiddle', - tooltip:'rightMiddle' - } - }, - show: 'mouseover', - hide: 'mouseout' - }); - - }); -} - - - - -var aToolTipData = { - -}; - -var qDescToCode; -var qCodeToInfo; - -function getToolTip(type){ - var code = qDescToCode[''+type]; - var multiple = 0; - if (code=='S') multiple = 2; - - if (code == ":") code = "COLON"; - else if(code == "|") code = "PIPE"; - - if (multiple > 0){ - returnval = ''; - for(i=1;i<=multiple;i++){ - returnval = returnval + "

            "; - } - return returnval; - } - return ""; -} - -//We have form validation and other stuff.. - -function updatequestionattributes() -{ - $('.loader').show(); - $('#advancedquestionsettings').html(''); - var selected_value = qDescToCode[''+$("#question_type_child .selected").text()]; - if (selected_value==undefined) selected_value = $("#question_type").val(); - $('#advancedquestionsettings').load('admin.php?action=ajaxquestionattributes',{qid:$('#qid').val(), - question_type:selected_value, - sid:$('#sid').val() - }, function(){ - // Loads the tooltips for the toolbars - - // Loads the tooltips for the toolbars - $('.loader').hide(); - $('label[title]').qtip({ - style: { name: 'cream', - tip: true, - color:'#111111', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomRight'} - }, - show: {effect: { length:50}} - });} - ); -} - -function validatefilename (form, strmessage ) -{ - if (form.the_file.value == "") { - alert( strmessage ); - form.the_file.focus(); - return false ; - } - return true ; -} - - -// If the length of the element's string is 0 then display helper message -function isEmpty(elem, helperMsg) -{ - if(elem.value.length == 0){ - alert(helperMsg); - elem.focus(); // set the focus to this input - return false; - } - return true; -} - -function codeCheck(prefix, elementcount, helperMsg, reservedKeywordMsg) -{ - var i, j; - var X = new Array(); - - for (i=0; i<=elementcount; i++) { - j = document.getElementById(prefix+i); - if (j != undefined) - { - j.value=trim(j.value); - if (j.value == "other") - { - alert(reservedKeywordMsg); - return false; - } - X.push(j.value); - } - } - if (arrHasDupes(X)) - { - alert(helperMsg); - return false; - } - return true; -} - - -function arrHasDupes( A ) { // finds any duplicate array elements using the fewest possible comparison - var i, j, n; - n=A.length; - // to ensure the fewest possible comparisons - for (i=0; i-1) - { - var strText = document.getElementById("available_languages").options[document.getElementById("available_languages").selectedIndex].text; - var strId = document.getElementById("available_languages").options[document.getElementById("available_languages").selectedIndex].value; - AddItem(document.getElementById("additional_languages"), strText, strId); - RemoveItem(document.getElementById("available_languages"), document.getElementById("available_languages").selectedIndex); - sortSelect(document.getElementById("additional_languages")); - UpdateLanguageIDs(); - } -} - -function DoRemove(minItems,strmsg) -{ - var strText = document.getElementById("additional_languages").options[document.getElementById("additional_languages").selectedIndex].text; - var strId = document.getElementById("additional_languages").options[document.getElementById("additional_languages").selectedIndex].value; - if (document.getElementById("additional_languages").options.length>minItems) - { - AddItem(document.getElementById("available_languages"), strText, strId); - RemoveItem(document.getElementById("additional_languages"), document.getElementById("additional_languages").selectedIndex); - sortSelect(document.getElementById("available_languages")); - UpdateLanguageIDs(); - } - else - if (strmsg!=''){alert(strmsg);} -} - - - -function AddItem(objListBox, strText, strId) -{ - var newOpt; - newOpt = document.createElement("OPTION"); - newOpt = new Option(strText,strId); - newOpt.id = strId; - objListBox.options[objListBox.length]=newOpt; -} - -function RemoveItem(objListBox, strId) -{ - if (strId > -1) - objListBox.options[strId]=null; -} - -function GetItemIndex(objListBox, strId) -{ - for (var i = 0; i < objListBox.children.length; i++) - { - var strCurrentValueId = objListBox.children[i].id; - if (strId == strCurrentValueId) - { - return i; - } - } - return -1; -} - - -function UpdateLanguageIDs(mylangs,confirmtxt) -{ - document.getElementById("languageids").value = ''; - - var lbBox = document.getElementById("additional_languages"); - for (var i = 0; i < lbBox.options.length; i++) - { - document.getElementById("languageids").value = document.getElementById("languageids").value + lbBox.options[i].value+ ' '; - } - if (mylangs) - { - if (checklangs(mylangs)) - { - return true; - } else - { - return confirm(confirmtxt); - } - } -} - -function compareText (option1, option2) { - return option1.text < option2.text ? -1 : - option1.text > option2.text ? 1 : 0; -} - -function compareValue (option1, option2) { - return option1.value < option2.value ? -1 : - option1.value > option2.value ? 1 : 0; -} - -function compareTextAsFloat (option1, option2) { - var value1 = parseFloat(option1.text); - var value2 = parseFloat(option2.text); - return value1 < value2 ? -1 : - value1 > value2 ? 1 : 0; -} - -function compareValueAsFloat (option1, option2) { - var value1 = parseFloat(option1.value); - var value2 = parseFloat(option2.value); - return value1 < value2 ? -1 : - value1 > value2 ? 1 : 0; -} - -function sortSelect (select, compareFunction) { - if (!compareFunction) - compareFunction = compareText; - var options = new Array (select.options.length); - for (var i = 0; i < options.length; i++) - options[i] = - new Option ( - select.options[i].text, - select.options[i].value, - select.options[i].defaultSelected, - select.options[i].selected - ); - options.sort(compareFunction); - select.options.length = 0; - for (var i = 0; i < options.length; i++) - select.options[i] = options[i]; -} - -function checklangs(mylangs) -{ - selObject=document.getElementById("additional_languages"); - var found; - - for (x = 0; x < mylangs.length; x++) - { - found = 0; - for (i=0;i= 0; x--) { - if (foo[x].replace(/"\s+$/, '"').charAt(foo[x].length - 1) == '"') { - if ((tl = foo[x].replace(/^\s+"/, '"')).length > 1 && tl.charAt(0) == '"') { - foo[x] = foo[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"'); - } else if (x) { - foo.splice(x - 1, 2, [foo[x - 1], foo[x]].join(sep)); - } else foo = foo.shift().split(sep).concat(foo); - } else foo[x].replace(/""/g, '"'); - } return foo; -}; - -// This is a helper function to extract the question ID from a DOM ID element -function removechars(strtoconvert){ - return strtoconvert.replace(/[-a-zA-Z_]/g,""); -} - - -function htmlspecialchars(str) { - if (typeof(str) == "string") { - str = str.replace(/&/g, "&"); /* must do & first */ - str = str.replace(/"/g, """); - str = str.replace(/'/g, "'"); - str = str.replace(//g, ">"); - } - return str; -} - - - - +//$Id: admin_core.js 12275 2012-02-01 13:18:38Z ssachdeva $ + +$(document).ready(function(){ + setupAllTabs(); + if(typeof(userdateformat) !== 'undefined') + { + $(".popupdate").datepicker({ dateFormat: userdateformat, + showOn: 'button', + changeYear: true, + changeMonth: true, + duration: 'fast' + }, $.datepicker.regional[userlanguage]); + $(".popupdatetime").datepicker({ dateFormat: userdateformat+' 00:00', + showOn: 'button', + changeYear: true, + changeMonth: true, + duration: 'fast' + }, $.datepicker.regional[userlanguage]); + } + + $('button,input[type=submit],input[type=button],input[type=reset]').addClass("limebutton ui-state-default ui-corner-all"); + $('button,input[type=submit],input[type=button],input[type=reset]').hover( + function(){ + $(this).addClass("ui-state-hover"); + }, + function(){ + $(this).removeClass("ui-state-hover"); + } + ) + + + // Loads the tooltips for the toolbars except the surveybar + $('img[alt],input[src]').not('.surveybar img').each(function() { + if($(this).attr('alt') != '') + { + $(this).qtip({ + style: { name: 'cream', + tip:true, + color:'#1D2D45', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomRight'} + }, + show: {effect: { length:50}}, + hide: { when: 'mouseout' } + }); + } + }); + + + $('label[title]').each(function() { + if($(this).attr('title') != '') + { + $(this).qtip({ + style: { name: 'cream', + tip:true, + color:'#1D2D45', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomRight'} + }, + show: {effect: { length:50}} + }); + } + }); + + $('.dosurvey').qtip({ + content:{ + text:$('#dosurveylangpopup') + }, + style: { name: 'cream', + tip:true, + color:'#1D2D45', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomMiddle', + tooltip: 'topMiddle'} + }, + show: {effect: { length:50}, + when: { + event:'click' + }}, + hide: {fixed:true, + when: { + event:'unfocus' + }} + }); + + $('#previewquestion').qtip({ + content:{ + text:$('#previewquestionpopup') + }, + style: { name: 'cream', + tip:true, + color:'#111111', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomMiddle', + tooltip: 'topMiddle'} + }, + show: {effect: { length:50}, + when: { + event:'click' + }}, + hide: {fixed:true, + when: { + event:'unfocus' + }} + }); + + $('.tipme').each(function() { + if($(this).attr('alt') != '') + { + $(this).qtip({ + style: { name: 'cream', + tip:true, + color:'#111111', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'topRight', + tooltip: 'bottomLeft' + } + }, + show: {effect: { length:100}} + + }); + } + }); + + + if ($('#showadvancedattributes').length>0) updatequestionattributes(); + + $('#showadvancedattributes').click(function(){ + $('#showadvancedattributes').hide(); + $('#hideadvancedattributes').show(); + $('#advancedquestionsettingswrapper').animate({ + "height": "toggle", "opacity": "toggle" + }); + + }) + $('#hideadvancedattributes').click(function(){ + $('#showadvancedattributes').show(); + $('#hideadvancedattributes').hide(); + $('#advancedquestionsettingswrapper').animate({ + "height": "toggle", "opacity": "toggle" + }); + + }) + $('#question_type').change(updatequestionattributes); + + $('#MinimizeGroupWindow').click(function(){ + $('#groupdetails').hide(); + }); + $('#MaximizeGroupWindow').click(function(){ + $('#groupdetails').show(); + }); + $('#tabs').tabs(); + $("#flashmessage").notify().notify('create','themeroller',{},{custom:true, + speed: 500, + expires: 5000 +}); + + var old_owner = ''; + + $(".ownername_edit").live('click',function(){ + var oldThis = this; + var ownername_edit_id = $(this).attr('id'); + var survey_id = ownername_edit_id.slice(15); + var translate_to = $(this).attr('translate_to'); + var initial_text = $(this).html(); + $.getJSON('admin.php', { + action: 'ajaxgetusers' + },function(oData) + { + old_owner = $($(oldThis).parent()).html(); + + old_owner = (old_owner.split("("))[0]; + $($(oldThis).parent()).html('' + + ''); + $(oData).each(function(key,value){ + $('#ownername_select_'+survey_id). + append($(""). + attr("value",value[0]). + text(value[1])); + }); + $("#ownername_select_"+survey_id+ " option[id=opt_"+old_owner+"]").attr("selected","selected"); + }); + }); + + $(".ownername_button").live('click',function(){ + var oldThis = this; + var initial_text = $(this).attr('initial_text'); + var ownername_select_id = $(this).attr('id'); + var survey_id = ownername_select_id.slice(17); + var newowner = $("#ownername_select_"+survey_id).val(); + var translate_to = $(this).attr('value'); + + $.getJSON('admin.php',{ + action: 'ajaxowneredit', + newowner: newowner, + survey_id : survey_id + }, function (data){ + + var objToUpdate = $($(oldThis).parent()); + + if (data.record_count>0) + $(objToUpdate).html(data.newowner); + else + $(objToUpdate).html(old_owner); + + $(objToUpdate).html($(objToUpdate).html() + '('+initial_text+')' ); + }); + }); + + if ($("#question_type:not(.none)").length > 0 && $("#question_type").attr('type')!='hidden'){ + $("#question_type").msDropDown({onInit:qTypeDropdownInit}); + + $("#question_type").change(function(event){ + var selected_value = qDescToCode[''+$("#question_type_child .selected").text()]; + OtherSelection(selected_value); + }); + } + + + +}); + +function qTypeDropdownInit() +{ + $("#question_type_child a").each(function(index,element){ + + $(element).qtip({ + style: { + margin : 15, + width: 450, + height: 'auto', + border:{ + width: 4, + radius: 2 + } + }, + content: getToolTip($(element).text()), + position: { + corner:{ + target: 'leftMiddle', + tooltip:'rightMiddle' + } + }, + show: 'mouseover', + hide: 'mouseout' + }); + + }); +} + + + + +var aToolTipData = { + +}; + +var qDescToCode; +var qCodeToInfo; + +function getToolTip(type){ + var code = qDescToCode[''+type]; + var multiple = 0; + if (code=='S') multiple = 2; + + if (code == ":") code = "COLON"; + else if(code == "|") code = "PIPE"; + else if(code == "*") code = "EQUATION"; + + if (multiple > 0){ + returnval = ''; + for(i=1;i<=multiple;i++){ + returnval = returnval + "

            "; + } + return returnval; + } + return ""; +} + +//We have form validation and other stuff.. + +function updatequestionattributes() +{ + $('.loader').show(); + $('#advancedquestionsettings').html(''); + var selected_value = qDescToCode[''+$("#question_type_child .selected").text()]; + if (selected_value==undefined) selected_value = $("#question_type").val(); + $('#advancedquestionsettings').load('admin.php?action=ajaxquestionattributes',{qid:$('#qid').val(), + question_type:selected_value, + sid:$('#sid').val() + }, function(){ + // Loads the tooltips for the toolbars + + // Loads the tooltips for the toolbars + $('.loader').hide(); + $('label[title]').qtip({ + style: { name: 'cream', + tip: true, + color:'#111111', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomRight'} + }, + show: {effect: { length:50}} + });} + ); +} + +function validatefilename (form, strmessage ) +{ + if (form.the_file.value == "") { + alert( strmessage ); + form.the_file.focus(); + return false ; + } + return true ; +} + + +// If the length of the element's string is 0 then display helper message +function isEmpty(elem, helperMsg) +{ + if($.trim(elem.value).length == 0){ + alert(helperMsg); + elem.focus(); // set the focus to this input + return false; + } + return true; +} + +function codeCheck(prefix, elementcount, helperMsg, reservedKeywordMsg) +{ + var i, j; + var X = new Array(); + + for (i=0; i<=elementcount; i++) { + j = document.getElementById(prefix+i); + if (j != undefined) + { + j.value=trim(j.value); + if (j.value == "other") + { + alert(reservedKeywordMsg); + return false; + } + X.push(j.value); + } + } + if (arrHasDupes(X)) + { + alert(helperMsg); + return false; + } + return true; +} + + +function arrHasDupes( A ) { // finds any duplicate array elements using the fewest possible comparison + var i, j, n; + n=A.length; + // to ensure the fewest possible comparisons + for (i=0; i-1) + { + var strText = document.getElementById("available_languages").options[document.getElementById("available_languages").selectedIndex].text; + var strId = document.getElementById("available_languages").options[document.getElementById("available_languages").selectedIndex].value; + AddItem(document.getElementById("additional_languages"), strText, strId); + RemoveItem(document.getElementById("available_languages"), document.getElementById("available_languages").selectedIndex); + sortSelect(document.getElementById("additional_languages")); + UpdateLanguageIDs(); + } +} + +function DoRemove(minItems,strmsg) +{ + var strText = document.getElementById("additional_languages").options[document.getElementById("additional_languages").selectedIndex].text; + var strId = document.getElementById("additional_languages").options[document.getElementById("additional_languages").selectedIndex].value; + if (document.getElementById("additional_languages").options.length>minItems) + { + AddItem(document.getElementById("available_languages"), strText, strId); + RemoveItem(document.getElementById("additional_languages"), document.getElementById("additional_languages").selectedIndex); + sortSelect(document.getElementById("available_languages")); + UpdateLanguageIDs(); + } + else + if (strmsg!=''){alert(strmsg);} +} + + + +function AddItem(objListBox, strText, strId) +{ + var newOpt; + newOpt = document.createElement("OPTION"); + newOpt = new Option(strText,strId); + newOpt.id = strId; + objListBox.options[objListBox.length]=newOpt; +} + +function RemoveItem(objListBox, strId) +{ + if (strId > -1) + objListBox.options[strId]=null; +} + +function GetItemIndex(objListBox, strId) +{ + for (var i = 0; i < objListBox.children.length; i++) + { + var strCurrentValueId = objListBox.children[i].id; + if (strId == strCurrentValueId) + { + return i; + } + } + return -1; +} + + +function UpdateLanguageIDs(mylangs,confirmtxt) +{ + document.getElementById("languageids").value = ''; + + var lbBox = document.getElementById("additional_languages"); + for (var i = 0; i < lbBox.options.length; i++) + { + document.getElementById("languageids").value = document.getElementById("languageids").value + lbBox.options[i].value+ ' '; + } + if (mylangs) + { + if (checklangs(mylangs)) + { + return true; + } else + { + return confirm(confirmtxt); + } + } +} + +function compareText (option1, option2) { + return option1.text < option2.text ? -1 : + option1.text > option2.text ? 1 : 0; +} + +function compareValue (option1, option2) { + return option1.value < option2.value ? -1 : + option1.value > option2.value ? 1 : 0; +} + +function compareTextAsFloat (option1, option2) { + var value1 = parseFloat(option1.text); + var value2 = parseFloat(option2.text); + return value1 < value2 ? -1 : + value1 > value2 ? 1 : 0; +} + +function compareValueAsFloat (option1, option2) { + var value1 = parseFloat(option1.value); + var value2 = parseFloat(option2.value); + return value1 < value2 ? -1 : + value1 > value2 ? 1 : 0; +} + +function sortSelect (select, compareFunction) { + if (!compareFunction) + compareFunction = compareText; + var options = new Array (select.options.length); + for (var i = 0; i < options.length; i++) + options[i] = + new Option ( + select.options[i].text, + select.options[i].value, + select.options[i].defaultSelected, + select.options[i].selected + ); + options.sort(compareFunction); + select.options.length = 0; + for (var i = 0; i < options.length; i++) + select.options[i] = options[i]; +} + +function checklangs(mylangs) +{ + selObject=document.getElementById("additional_languages"); + var found; + + for (x = 0; x < mylangs.length; x++) + { + found = 0; + for (i=0;i= 0; x--) { + if (foo[x].replace(/"\s+$/, '"').charAt(foo[x].length - 1) == '"') { + if ((tl = foo[x].replace(/^\s+"/, '"')).length > 1 && tl.charAt(0) == '"') { + foo[x] = foo[x].replace(/^\s*"|"\s*$/g, '').replace(/""/g, '"'); + } else if (x) { + foo.splice(x - 1, 2, [foo[x - 1], foo[x]].join(sep)); + } else foo = foo.shift().split(sep).concat(foo); + } else foo[x].replace(/""/g, '"'); + } return foo; +}; + +// This is a helper function to extract the question ID from a DOM ID element +function removechars(strtoconvert){ + return strtoconvert.replace(/[-a-zA-Z_]/g,""); +} + + +function htmlspecialchars(str) { + if (typeof(str) == "string") { + str = str.replace(/&/g, "&"); /* must do & first */ + str = str.replace(/"/g, """); + str = str.replace(/'/g, "'"); + str = str.replace(//g, ">"); + } + return str; +} + +function saveaslabelset() +{ + var lang = langs.split(";"); + + dataToSend = {}; + dataToSend['langs'] = lang; + dataToSend['codelist'] = []; + $(".answertable:first tbody tr").each(function(i,e){ + code = $(".code",e).attr('id'); + code = code.split("_"); + code = code[1]; + + dataToSend['codelist'].push(code); + var assessment_val = '0'; + if ($("#assessment_"+code+"_0").length != 0 ){ + assessment_val = $("#assessment_"+code+"_0").val(); + } + dataToSend[code] = { + code: $("#code_"+code+"_0").val(), + assessmentvalue: assessment_val + }; + $(lang).each(function(index,element){ + dataToSend[code]['text_'+element] = $("#answer_"+element+"_"+code+"_0").val(); + + }); + }); + + var label_name = prompt("Enter new label name", ""); + + var data = { + action: 'ajaxmodlabelsetanswers', + lid:'1', + dataToSend:js2php(dataToSend), + ajax:'1', + label_name:label_name, + languageids: dataToSend['langs'].join(" "), + checksessionbypost: $("[name=checksessionbypost]").val() + } + + $.ajax({ + type: 'POST', + url: 'admin.php', + data: data, + success: function(){ + alert("Label successfully created"); + } + }); +} + + +function js2php(object){ + var json = "{"; + for (property in object){ + var value = object[property]; + if (typeof(value)=="string"){ + //escape double quotes! + value = value.replace(/"/g, '\\"'); //.replace(/'/g, '\\\'') + json += '"'+property+'":"'+value+'",'; + } + else{ + if (!value[0]){ + json += '"'+property + '":'+js2php(value)+','; + } + else{ + json += '"' + property + '":['; + for (prop in value) json += '"'+value[prop]+'",'; + json = json.substr(0,json.length-1)+"],"; + } + } + } + return json.substr(0,json.length-1)+ "}"; +} + + diff --git a/include/limesurvey/admin/scripts/answers.js b/include/limesurvey/admin/scripts/answers.js index 0b314181..248cb027 100644 --- a/include/limesurvey/admin/scripts/answers.js +++ b/include/limesurvey/admin/scripts/answers.js @@ -1,4 +1,4 @@ -// $Id: answers.js 10065 2011-05-15 09:28:52Z c_schmitz $ +// $Id: answers.js 12442 2012-02-11 00:07:00Z shnoulle $ var labelcache=[]; $(document).ready(function(){ $('.tab-page:first .answertable tbody').sortable({ containment:'parent', @@ -97,6 +97,12 @@ function addinput() newposition=Number(position)+1; languages=langs.split(';'); + sNextCode=getNextCode($(this).parent().parent().find('.code').val()); + while ($(this).parent().parent().parent().find('input[value="'+sNextCode+'"]').length>0 && sNextCode!=$(this).parent().parent().find('.code').val()) + { + sNextCode=getNextCode(sNextCode); + } + for (x in languages) { tablerow=$('#tabpage_'+languages[x]).find('#answers_'+languages[x]+'_'+scale_id+' .row_'+position); @@ -110,7 +116,6 @@ function addinput() assessment_style='style="display:none;"'; assessment_type='hidden'; } - sNextCode=getNextCode($(this).parent().parent().find('.code').val()); if (x==0) { inserthtml='' } @@ -314,8 +319,11 @@ function lsbrowser() } else { + $("#labelsetpreview").html("

            "+strNoLabelSet+"

            "); $('#btnlsreplace').addClass('ui-state-disabled'); $('#btnlsinsert').addClass('ui-state-disabled'); + $('#btnlsreplace').attr('disabled','disabled'); + $('#btnlsinsert').attr('disabled','disabled'); } }); diff --git a/include/limesurvey/admin/scripts/assessments.js b/include/limesurvey/admin/scripts/assessments.js index e575418b..92394c4f 100644 --- a/include/limesurvey/admin/scripts/assessments.js +++ b/include/limesurvey/admin/scripts/assessments.js @@ -1,60 +1,60 @@ -function jquery_goodchars(e, goods) -{ - var key, keychar; - key = e.which; - if (key == null) return true; - - // get character - keychar = String.fromCharCode(key); - keychar = keychar.toLowerCase(); - goods = goods.toLowerCase(); - - // check goodkeys - if (goods.indexOf(keychar) != -1) - return true; - - // control keys - if ( key==null || key==0 || key==8 || key==9 || key==27 ) - return true; - - // else return false - return false; -} - - -$(document).ready(function(){ - $('#languagetabs').tabs(); - if ($(".assessmentlist tbody tr").size()>0) - { - $(".assessmentlist").tablesorter({sortList: [[0,0]] }); - } - $('#radiototal,#radiogroup').change( - function() - { - if ($('#radiototal').attr('checked')==true) - { - $('#gid').attr('disabled','disabled'); - } - else - { - if ($('#gid>option').length==0){ - $('#radiototal').attr('checked',true); - alert (strnogroup); - } - else - { - $('#gid').attr('disabled',false); - } - } - } - ) - $('#radiototal,#radiogroup').change(); - $('.numbersonly').keypress( - function(e){ - return jquery_goodchars(e,'1234567890-'); - } - ) - } -); - - +function jquery_goodchars(e, goods) +{ + var key, keychar; + key = e.which; + if (key == null) return true; + + // get character + keychar = String.fromCharCode(key); + keychar = keychar.toLowerCase(); + goods = goods.toLowerCase(); + + // check goodkeys + if (goods.indexOf(keychar) != -1) + return true; + + // control keys + if ( key==null || key==0 || key==8 || key==9 || key==27 ) + return true; + + // else return false + return false; +} + + +$(document).ready(function(){ + $('#languagetabs').tabs(); + if ($(".assessmentlist tbody tr").size()>0) + { + $(".assessmentlist").tablesorter({sortList: [[0,0]] }); + } + $('#radiototal,#radiogroup').change( + function() + { + if ($('#radiototal').attr('checked')==true) + { + $('#gid').attr('disabled','disabled'); + } + else + { + if ($('#gid>option').length==0){ + $('#radiototal').attr('checked',true); + alert (strnogroup); + } + else + { + $('#gid').attr('disabled',false); + } + } + } + ) + $('#radiototal,#radiogroup').change(); + $('.numbersonly').keypress( + function(e){ + return jquery_goodchars(e,'1234567890-'); + } + ) + } +); + + diff --git a/include/limesurvey/admin/scripts/browse.js b/include/limesurvey/admin/scripts/browse.js index 5843240f..d5b7793d 100644 --- a/include/limesurvey/admin/scripts/browse.js +++ b/include/limesurvey/admin/scripts/browse.js @@ -1,132 +1,189 @@ -/* -* LimeSurvey -* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz -* All rights reserved. -* License: GNU/GPL License v2 or later, see LICENSE.php -* LimeSurvey is free software. This version may have been modified pursuant -* to the GNU General Public License, and as distributed it includes or -* is derivative of works licensed under the GNU General Public License or -* other free or open source software licenses. -* See COPYRIGHT.php for copyright notices and details. -* -* $Id: browse.js 10251 2011-06-10 17:33:49Z tpartner $ -*/ - -$(document).ready(function(){ - // Delete individual file - $(".deleteresponse").click(function(){ - thisid=removechars($(this).attr('id')); - answer = confirm(strdeleteconfirm); - if (answer==true) - { - $('#deleteanswer').val(thisid); - $('.cbResponseMarker').attr('checked',false); - $('#resulttableform').submit(); - } - }); - - // Delete all marked responses - $("#imgDeleteMarkedResponses").click(function(){ - if ($('.cbResponseMarker:checked').size()>0) - { - thisid=removechars($(this).attr('id')); - answer = confirm(strDeleteAllConfirm); - if (answer==true) - { - $('#deleteanswer').val('marked'); - $('#resulttableform').submit(); - } - } - else - alert(noFilesSelectedForDeletion) - }); - - // Download individual file bundle - $(".downloadfile").click(function() { - thisid = removechars($(this).attr('id')); - $('#downloadfile').val(thisid); - $('.cbResponseMarker').attr('checked', false); - $('#resulttableform').submit(); - }); - - // Download all marked files - $("#imgDownloadMarkedFiles").click(function() { - if ($('.cbResponseMarker:checked').size() > 0) - { - $('#downloadfile').val('marked'); - $('#resulttableform').submit(); - } - else - alert(noFilesSelectedForDnld) - }); - - $("#selectall").click(function(){ - $('.cbResponseMarker').attr('checked',$(this).attr('checked')); - }); - - $('#browseresponses').qtip({ - content:{ - text:$('#browselangpopup') - }, - style: { name: 'cream', - tip:true, - color:'#111111', - border: { - width: 1, - radius: 5, - color: '#EADF95'} - }, - position: { adjust: { - screen: true, scroll:true }, - corner: { - target: 'bottomMiddle', - tooltip: 'topMiddle'} - }, - show: {effect: { length:50}, - when: { - event:'click' - }}, - hide: {fixed:true, - when: { - event:'unfocus' - }} - }); - - // Fix the heigh of the cell - $('.browsetable td').each(function(){ - if ($(this).text().length> 30){ - $(this).html(""+$(this).html()+""); - } - }); - $('.browsetable th strong').each(function(){ - if ($(this).text().length> 30){ - $(this).addClass("content"); - $(this).attr("title",$(this).text()); - } - }); - - $('.browsetable td span.content').qtip({ - hide: { - fixed: true, - delay: 500 - }, - position: { - corner: { - target: 'leftMiddle', - tooltip: 'topRight' - } - } - }); - $('.browsetable th strong.content').qtip({ - hide: { - fixed: true, - delay: 500 - }, - position: { - corner: { - target: 'leftMiddle', - tooltip: 'topRight' - } - } - }); -}); +/* +* LimeSurvey +* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz +* All rights reserved. +* License: GNU/GPL License v2 or later, see LICENSE.php +* LimeSurvey is free software. This version may have been modified pursuant +* to the GNU General Public License, and as distributed it includes or +* is derivative of works licensed under the GNU General Public License or +* other free or open source software licenses. +* See COPYRIGHT.php for copyright notices and details. +* +* $Id: browse.js 11664 2011-12-16 05:19:42Z tmswhite $ +*/ + +$(document).ready(function(){ + // Delete individual file + $(".deleteresponse").click(function(){ + thisid=removechars($(this).attr('id')); + answer = confirm(strdeleteconfirm); + if (answer==true) + { + $('#deleteanswer').val(thisid); + $('.cbResponseMarker').attr('checked',false); + $('#resulttableform').submit(); + } + }); + + // Delete all marked responses + $("#imgDeleteMarkedResponses").click(function(){ + if ($('.cbResponseMarker:checked').size()>0) + { + thisid=removechars($(this).attr('id')); + answer = confirm(strDeleteAllConfirm); + if (answer==true) + { + $('#deleteanswer').val('marked'); + $('#resulttableform').submit(); + } + } + else + alert(noFilesSelectedForDeletion) + }); + + // Download individual file bundle + $(".downloadfile").click(function() { + thisid = removechars($(this).attr('id')); + $('#downloadfile').val(thisid); + $('.cbResponseMarker').attr('checked', false); + $('#resulttableform').submit(); + }); + + // Download all marked files + $("#imgDownloadMarkedFiles").click(function() { + if ($('.cbResponseMarker:checked').size() > 0) + { + $('#downloadfile').val('marked'); + $('#resulttableform').submit(); + } + else + alert(noFilesSelectedForDnld) + }); + + $("#selectall").click(function(){ + $('.cbResponseMarker').attr('checked',$(this).attr('checked')); + }); + + $('#browseresponses').qtip({ + content:{ + text:$('#browselangpopup') + }, + style: { name: 'cream', + tip:true, + color:'#111111', + border: { + width: 1, + radius: 5, + color: '#EADF95'} + }, + position: { adjust: { + screen: true, scroll:true }, + corner: { + target: 'bottomMiddle', + tooltip: 'topMiddle'} + }, + show: {effect: { length:50}, + when: { + event:'click' + }}, + hide: {fixed:true, + when: { + event:'unfocus' + }} + }); + + // Fix the heigh of the cell + $('.browsetable td').each(function(){ + if ($(this).text().length> 30){ + $(this).html(""+$(this).html()+""); + } + }); + $('.browsetable th strong').each(function(){ + if ($(this).text().length> 30){ + $(this).addClass("content"); + $(this).attr("title",$(this).text()); + } + }); + + $('.browsetable td span.content').qtip({ + hide: { + fixed: true, + delay: 500 + }, + position: { + corner: { + target: 'leftMiddle', + tooltip: 'topRight' + } + } + }); + $('.browsetable th strong.content').qtip({ + hide: { + fixed: true, + delay: 500 + }, + position: { + corner: { + target: 'leftMiddle', + tooltip: 'topRight' + } + } + }); +}); + +function htmlspecialchars (string, quote_style, charset, double_encode) { + // Convert special characters to HTML entities + // + // version: 1109.2015 + // discuss at: http://phpjs.org/functions/htmlspecialchars // + original by: Mirek Slugen + // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) + // + bugfixed by: Nathan + // + bugfixed by: Arno + // + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) // + bugfixed by: Brett Zamir (http://brett-zamir.me) + // + input by: Ratheous + // + input by: Mailfaker (http://www.weedem.fr/) + // + reimplemented by: Brett Zamir (http://brett-zamir.me) + // + input by: felix // + bugfixed by: Brett Zamir (http://brett-zamir.me) + // % note 1: charset argument not supported + // * example 1: htmlspecialchars("Test", 'ENT_QUOTES'); + // * returns 1: '<a href='test'>Test</a>' + // * example 2: htmlspecialchars("ab\"c'd", ['ENT_NOQUOTES', 'ENT_QUOTES']); // * returns 2: 'ab"c'd' + // * example 3: htmlspecialchars("my "&entity;" is still here", null, null, false); + // * returns 3: 'my "&entity;" is still here' + var optTemp = 0, + i = 0, noquotes = false; + if (typeof quote_style === 'undefined' || quote_style === null) { + quote_style = 2; + } + string = string.toString(); if (double_encode !== false) { // Put this first to avoid double-encoding + string = string.replace(/&/g, '&'); + } + string = string.replace(//g, '>'); + var OPTS = { + 'ENT_NOQUOTES': 0, + 'ENT_HTML_QUOTE_SINGLE': 1, + 'ENT_HTML_QUOTE_DOUBLE': 2, + 'ENT_COMPAT': 2, 'ENT_QUOTES': 3, + 'ENT_IGNORE': 4 + }; + if (quote_style === 0) { + noquotes = true; } + if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags + quote_style = [].concat(quote_style); + for (i = 0; i < quote_style.length; i++) { + // Resolve string input to bitwise e.g. 'ENT_IGNORE' becomes 4 + if (OPTS[quote_style[i]] === 0) { + noquotes = true; + } + else if (OPTS[quote_style[i]]) { + optTemp = optTemp | OPTS[quote_style[i]]; } + } + quote_style = optTemp; + } + if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) { string = string.replace(/'/g, '''); + } + if (!noquotes) { + string = string.replace(/"/g, '"'); + } + return string; +} \ No newline at end of file diff --git a/include/limesurvey/admin/scripts/ckeditor.36/.htaccess b/include/limesurvey/admin/scripts/ckeditor.36/.htaccess index 94d69cdd..1427d97f 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/.htaccess +++ b/include/limesurvey/admin/scripts/ckeditor.36/.htaccess @@ -1,24 +1,24 @@ -# -# Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -# For licensing, see LICENSE.html or http://ckeditor.com/license -# - -# -# On some specific Linux installations you could face problems with Firefox. -# It could give you errors when loading the editor saying that some illegal -# characters were found (three strange chars in the beginning of the file). -# This could happen if you map the .js or .css files to PHP, for example. -# -# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files. -# All FCKeditor files are Unicode encoded. -# - -AddType application/x-javascript .js -AddType text/css .css - -# -# If PHP is mapped to handle XML files, you could have some issues. The -# following will disable it. -# - -AddType text/xml .xml +# +# Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +# For licensing, see LICENSE.html or http://ckeditor.com/license +# + +# +# On some specific Linux installations you could face problems with Firefox. +# It could give you errors when loading the editor saying that some illegal +# characters were found (three strange chars in the beginning of the file). +# This could happen if you map the .js or .css files to PHP, for example. +# +# Those characters are the Byte Order Mask (BOM) of the Unicode encoded files. +# All FCKeditor files are Unicode encoded. +# + +AddType application/x-javascript .js +AddType text/css .css + +# +# If PHP is mapped to handle XML files, you could have some issues. The +# following will disable it. +# + +AddType text/xml .xml diff --git a/include/limesurvey/admin/scripts/ckeditor.36/CHANGES.html b/include/limesurvey/admin/scripts/ckeditor.36/CHANGES.html index d015d2e3..16be7d58 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/CHANGES.html +++ b/include/limesurvey/admin/scripts/ckeditor.36/CHANGES.html @@ -1,1295 +1,1295 @@ - - - - - Changelog — CKEditor - - - - -

            - CKEditor Changelog -

            -

            - CKEditor 3.6

            -

            - New features:

            -
              -
            • #7044 : New BBCode sample plugin that makes the editor output (one dialect of) BBCode format.
            • -
            • #5647 : Accessibility enhancements to the structure of the toolbar.
            • -
            • #5647 : The Kama skin now presents separators for the toolbar items, making it easier to group buttons and have a cleaner layout.
            • -
            • #5647 : Usability enhancements to keyboard navigation on the toolbar. The Tab key is now used to jump between toolbar groups, while the Arrow keys can be used to cycle within the group. The new toolbarGroupCycling setting can be used to change the Arrow keys behavior.
            • -
            • #1376 : It is now possible to put the editor in the "read-only" state, so that the users would not be able to introduce changes to the contents. Check out the new CKEDITOR.editor::setReadOnly method, the CKEDITOR.editor::readOnly property, the CKEDITOR.editor::readOnly event, and the readOnly setting.
            • -
            • #3582 : New presentation of anchor elements in the WYSIWYG mode.
            • -
            • #6737 : The Format drop-down list will now display the preview of its contents exactly as defined in their style configurations.
            • -
            • #6654 : A new autoParagraph configuration setting is added to disable the auto paragraphing feature.
            • -
            • #901 : New Stylesheet Parser (stylesheetparser) plugin that fills the Styles drop-down list based on the CSS classes available for the content. Check the new sample to learn how to use it.
            • -
            • #2988 : New Document Properties (docprops) plugin that sets the metadata of the page in the Full Page mode.
            • -
            • #7240 : New Developer Tools (devtools) plugin that shows information about dialog window UI elements to allow for easier customization.
            • -
            • #6841 : Pressing the Enter key at the end of a pre-formatted block will now exit from it.
            • -
            • #6850 : The About CKEditor dialog window now contains a link to CKEditor User's Guide.
            • -
            • #5745 : Extra configuration options for the iframeDialog can now be passed.
            • -
            • #6589 : The onDialogEvent function will now be used automatically in the iframeDialog contents if no callback is used on creation.
            • -
            • #7757 : Georgian localization added.
            • -
            -

            - Fixed issues:

            -
              -
            • #6774 : Internal styles are not included in the contents.css sample.
            • -
            • #6521 : Added sample for the TableResize plugin.
            • -
            • #6664 : Page break is sometimes merged into block-level elements.
            • -
            • #7594 : Toolbar keyboard navigation is not possible after recreating the editor.
            • -
            • #6657 : Allow to style the entire dialog window field when the input element is disabled.
            • -
            • Updated the following language files:
                -
              • Hebrew;
              • -
              • Polish;
              • -
            • -
            -

            - CKEditor 3.5.4

            -

            - Fixed issues:

            -
              -
            • Added protection against XSS attacks in PHP samples when displaying element names.
            • -
            • #7347 : The Enter key will no longer be caught by the dialog window covering the editor.
            • -
            • #6718 : Paste from Word command overrides the Force Paste as Plain Text configuration.
            • -
            • #6629 : Padding body is no longer needed when the last block is pre-formatted.
            • -
            • #4844 : [IE] Dialog windows fail to load if there are too many editor instances on the page.
            • -
            • #5788 : HTML parser trims empty spaces following <br> elements.
            • -
            • #7513 : Invalid markup could cause the editor to hang.
            • -
            • #6109 : Paste and Paste as Plain Text dialog windows now use the standard commitContent and setupContent methods.
            • -
            • #7588 : The editor code now has a protection system to avoid issues when including ckeditor.js more than once in the page.
            • -
            • #7322 : Text font plugin now recognizes font family names that contain quotes.
            • -
            • #7540 : Paste from Word introduces wrong spaces.
            • -
            • #7697 : Successive calls of the replace() method did not work after SCAYT context menu initialization.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.5.3

            -

            - New features:

            -
              -
            • #4890 : Added the possibility to edit the rel attribute for links.
            • -
            • #7004 : Allow loading plugin translations even if they are not present in the plugin definition.
            • -
            • #7315 : Firing the resize event on dialog window instances is now possible.
            • -
            • #7259 : Dialog window definition allows to specify initial width and height values.
            • -
            • #7131 : List item numbering is now supported on pasting from Microsoft Word.
            • -
            -

            - Fixed issues:

            -
              -
            • #1272 : [WebKit] It is now possible to apply styles to collapsed selections in Safari and Chrome.
            • -
            • #7054 : The tooltips for special characters are now lowercased, making them more readable.
            • -
            • #7102 : "Replace DIV" sample did not work when double-clicking inside the formatted text.
            • -
            • #7088 : Loading of plugins failed on new instances of the editor after the Insert Special Character dialog window was used.
            • -
            • #6215 : Removal of inline styles now also removes overrides.
            • -
            • #6144 : Rich text drop-down lists have wrong height when toolbar is wrapped.
            • -
            • #6387 : AutoGrow may cause an error when editor instance is destroyed too quickly after a height change.
            • -
            • #6901 : Mixed direction content was not properly respected in a shared toolbar setting.
            • -
            • #4809 : Table-related tags are output in wrong order.
            • -
            • #7092 : Corrupted toolbar button state for inline style after switching to Source.
            • -
            • #6921 : Pasted text marked by SCAYT in one language is not re-checked if another spellchecking language is selected in the editor.
            • -
            • #6614 : Enhancement of the resize handle in RTL.
            • -
            • #5924 : Flash plugin now recognizes Flash content without an embed tag.
            • -
            • #4475 : Protected source in attributes and inline CSS text is not handled correctly.
            • -
            • #6984 : [FF] Trailing line breaks are lost in ENTER_BR.
            • -
            • #6987 : [IE] Text selection lost when calling editor::insertHtml from a dialog window in some situations.
            • -
            • #6865 : BiDi mirroring does not work when a text direction change is done through a dialog window.
            • -
            • #6966 : [IE] Unintended paragraph is created in an empty document in enterMode set for BR and DIV.
            • -
            • #7084 : SCAYT dialog window is now working properly with more than one editor instance in a page.
            • -
            • #6662 : [FF] List structure pasting error caused by a regression from FF3.5.x is now fixed.
            • -
            • #7300 : Link dialog window now loads numeric values correctly.
            • -
            • #7330 : New list items no longer inherit the value attribute from their sibling.
            • -
            • #7293 : The "Automatic" color button is now presented correctly without focus inside the editor.
            • -
            • #7018 : [IE] Toolbar drop-down lists did not have a border around them.
            • -
            • #7073 : Image dialog window no longer allows zero height and width value to be entered.
            • -
            • #7316 : [FF] Clicking on "Paste" button incorrectly breaks the line at the cursor position.
            • -
            • #6751 : Inline whitespaces are incorrectly stripped when pasting from Word.
            • -
            • #6236 : [IE] Fixing malformed nested list structure which was introduced by the Backspace key.
            • -
            • #6649 : [IE] Selection of the full table sometimes does not work.
            • -
            • #6946 : HTML parser is now able to fix orphan list items.
            • -
            • #6861 : Indenting a list item should retain the text direction.
            • -
            • #6938 : Outdenting a list item should retain the text direction.
            • -
            • #6849 : Correct Enter key behavior on list item.
            • -
            • #7113 : [WebKit] Undesired document scroll on click after scrolling.
            • -
            • #6491 : Undesired Image dialog window dimension lock reset on URL change.
            • -
            • #7284 : [FF Quirks] Maximize now works correctly.
            • -
            • #6609 : [IE9] Browser in high contrast mode is not properly detected.
            • -
            • #7222 : [WebKit] Impossible to apply a single style to a collapsed selection without giving the editor focus.
            • -
            • #7180 : [IE9] When using Kama skin and RTL layout dialog window buttons were not being displayed correctly.
            • -
            • #7182 : [IE9] When using Office2003/v2 skin and RTL layout dialog window shadows were corrupted.
            • -
            • #6913 : Invalid escape sequence (\b) was used in the PHP integration.
            • -
            • #5757 : [IE6] Text was not wrapping in the accessibility instructions dialog window.
            • -
            • [6604] : Xml.js and Ajax.js are now available as plugins ('xml' and 'ajax').
            • -
            • #7304 : Microsoft Word cleanup function is not always invoked when clicking on the "Paste From Word" button.
            • -
            • #6658 : [IE] Pasting text from Microsoft Word with one or more tabs between list items was failing.
            • -
            • #7433 : [IE9] ENTER_BR at the end of a block breaks due to an IE9 regression.
            • -
            • #7432 : [WebKit] Unable to create a new list in an empty document.
            • -
            • #4880 : CKEditor changes tag style inside HTML comment with cke_protected.
            • -
            • #7023 : [IE] JavaScript error when a Selection Field is inserted into a page.
            • -
            • #7034 : Inserting special characters into styled text.
            • -
            • #7132 : Paste toolbar buttons are becoming disabled.
            • -
            • #7138 : The api.html sample in Opera does not work as expected.
            • -
            • #7160 : Cannot paste the form element on top of the page.
            • -
            • #7171 : Double-clicking an image in non-editable content opens the editing dialog window.
            • -
            • #7455 : Extra line break is added automatically to the preformatted element.
            • -
            • #7467 : [Firefox] Extra br element is added in a nested list.
            • -
            • Updated the following language files:
                -
              • #7124 : Czech;
              • -
              • #7126 : French;
              • -
              • #7140 : Catalan;
              • -
              • #7215 : Faroese;
              • -
              • #7177 : Finnish;
              • -
              • #7163 : Norwegian (no and nb);
              • -
              • #7219 : Swedish;
              • -
              • #7183 : Afrikaans;
              • -
              • Hebrew;
              • -
              • Spanish;
              • -
              • Polish;
              • -
              • German;
              • -
            • -
            -

            - CKEditor 3.5.2

            -

            - Fixed issues:

            -
              -
            • #7168 : [IE9] Destroying an editor instance throws an error.
            • -
            • #7169 : [IE9] Menu item has incorrect height.
            • -
            • #7178 : [IE9] Read-only attributes do not work in IE9.
            • -
            • #7181 : [IE9] Toolbar items are not aligned in v2 and Office2003 skins.
            • -
            • #7174 : [IE9] Elements path does not load correctly when the editor is switched back from Source to WYSIWYG.
            • -
            -

            - CKEditor 3.5.1

            -

            - New features:

            -
              -
            • #6107 : It is now possible to remove block styles using Styles and Paragraph Format drop-down lists.
            • -
            • #5590 : Remove Format command works in collapsed selections.
            • -
            • #5755 : The dialog_buttonsOrder option now works in Internet Explorer.
            • -
            • #6869 : The data-cke-nostyle attribute (which was introduced for escaping the element from been influenced by the style system since 3.5) is deprecated in favor of the new data-nostyle attribute.
            • -
            • Revised sample pages with code examples and clarifications.
            • -
            -

            - Fixed issues:

            -
              -
            • #5855 : Updating a link multiple times generates wrong href attribute.
            • -
            • #6166 : Error on Maximize command, when the toolbar button is not shown.
            • -
            • #6607 : Table cell "merge down" and "merge right" commands work only once.
            • -
            • #6228 : Merge down does not work, throwing a JavasSript error.
            • -
            • #6625 : BIDI: Mixed LTR/RTL direction causes incorrect behavior.
            • -
            • #6881 : IFrame capitalization is now consistent throughout labels.
            • -
            • #6686 : BIDI: [FF] When we apply explicit language direction to a numbered/bulleted list, the corresponding language direction toolbar icon is not highlighted.
            • -
            • #6566 : It is now possible to exit a blockquote using ENTER_BR.
            • -
            • #6868 : Partial (invalid) list structure crashes the editor on load.
            • -
            • #6804 : Buggy behavior when editing the legend element inside a fieldset.
            • -
            • #6724 : [IE7] Nested list display bug on empty list item.
            • -
            • #6715 : List items do not create paragraphs after the list placed in a table cell is removed.
            • -
            • #6695 : [Webkit] Display bug after the editor is restored from the full screen mode.
            • -
            • #6661 : [IE] Pre-formatted style does not preserve applied text direction.
            • -
            • #6655 : Using the editor resize grip causes small visual offsets.
            • -
            • #6604 : The div element should be used as a formatting block in ENTER_BR.
            • -
            • #6249 : BIDI: List item bullets are off viewport with RTL text direction.
            • -
            • #6610 : BIDI: ENTER_BR change direction in one line out of multiple.
            • -
            • #6872 : [IE] Link target field is not populated properly when no target is set.
            • -
            • #6880 : Samples: Added a user-friendly message for users on servers without PHP support.
            • -
            • #6628 : Setting config.enterMode from PHP fails.
            • -
            • #6278 : Comments were moved above the br tags.
            • -
            • #6687 : Empty tag should be removed in inline-style format.
            • -
            • #6645 : Allow to configure whether " (double quotes) characters should be encoded in the contents.
            • -
            • #6336 : IE: (double)clicking an input type="submit" button submitted the form.
            • -
            • #6646 : Context menu was not working for text inputs present in the initial content.
            • -
            • #6641 : Copying and pasting links inside the editor was not working.
            • -
            • #4208 : The disableObjectResizing setting now works in IE.
            • -
            • #6242 : [IE] Editing existing links with href of a relative path mangles containing text.
            • -
            • #5930 : [IE] Style definitions are no longer lowercased.
            • -
            • #5361 : Preview window's title should reflect the title tag in full page mode.
            • -
            • #5522 : [IE] In versions < 8 or compatibility mode, type="text" was missing in text fields.
            • -
            • #6126 : [IE] Avoid problems if there are two buttons named "submit".
            • -
            • #6791 : [IE7] Editor did not show up when the name of a replaced textarea matched the name of a meta tag in the page.
            • -
            • #5684 : [FF] When forcePasteAsPlainText is used, the cursor disappears after paste.
            • -
            • #6390 : Prevent toolbar dialog window buttons from being clicked twice.
            • -
            • #6684 : [Webkit] Toolbar buttons are not wrapping correctly when the editor is displayed inside a table.
            • -
            • #6703 : [IE] editor focus event not fired in an instance, when a dialog window closes.
            • -
            • #6873 : Difficult to drag the resize grip of the spell checker dialog window.
            • -
            • #6896 : [Webkit] Unable to paste into source area when the editor is maximized.
            • -
            • #6020 : The state of the Cut, Copy, and Paste toolbar now matches the state of the context menu buttons.
            • -
            • #5256 : JavaScript error thrown when percent (%) sign is used in image URL.
            • -
            • #6577 : [FF] Selection error when an element containing the editor instance is hidden.
            • -
            • #5500 : [IE] value attribute of text input dialog window field was missing.
            • -
            • #6665 : [IE] name field of Link dialog window was missing.
            • -
            • #6639 : Line-breaks inside pasted list item from Microsoft Word break the list structure.
            • -
            • #6909 : [IE] GIF icons of toolbar button from custom plugins are not diplayed in zoom level 100%.
            • -
            • #6860 : [FF] Double-clicking the placeholder element in order to open a Placeholder dialog window throws a JavaScript error.
            • -
            • #6630 : Empty pre elements are output differently in various browsers.
            • -
            • #6568 : Insert table row/column does not work with spanning.
            • -
            • #6735 : Inaccurate read-only selection detection.
            • -
            • #6728 : BIDI: Change direction does not work with list nested inside a blockquote.
            • -
            • #6432 : Inserting a table in place of a fully selected list results in a JavaScript error.
            • -
            • #6438 : [IE] Performance enhancement when typing inside an element with many child nodes.
            • -
            • #6970 : [IE] Dialog window shadows were presented inaccurately.
            • -
            • #6672 : [IE] Unnecessary br element is no longer inserted after a form.
            • -
            • #7087 : [FF] Sometimes it was not possible to move cursor out of link at the end of block.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.5

            -

            - New features:

            -
              -
            • #4090 : Full Adobe AIR support.
            • -
            • #5084 : Dialog windows are now resizable with a grip located in the footer.
            • -
            • #5755 : Introduced the dialog_buttonsOrder setting, making it possible to control the buttons order.
            • -
            • #4648 : Added the new iFrame plugin.
            • -
            • #6010 : The Automatic option of the font/background color panel now represents the real color.
            • -
            • #5654 : New "placeholder" plugin.
            • -
            • #6334 : CKEditor now uses HTML5's data-* attributes for its internal attributes.
            • -
            • #6103 : It's now possible to control the styling of inline read-only elements with the disableReadonlyStyling setting. It's also possible to avoid inline-styling any element by setting its "data-cke-nostyle" attribute to "1".
            • -
            • #5404 : fillEmptyBlocks configuration option of v2 is now available.
            • -
            • #5367 : New CKEDITOR.editor#insertText method (check api.html sample page for usages) is now provided to insert plain text into editor.
            • -
            • #5915 : New removeDialogTabs configuration option to hide certain dialog tabs.
            • -
            -

            - Fixed issues:

            -
              -
            • #4821 : Icons in the toolbar were distorted with IE and zoom != 100%.
            • -
            • #5587 : Visual improvements in dialogs, reinforce field label on separate line.
            • -
            • #4652 : Now it's able to disable editor context menu by simply removing the "contextmenu" plugin.
            • -
            • #5599 : Labels of "specialchar" dialog are now translated.
            • -
            • #6419 : [IE] List creation by merging problem.
            • -
            • #6502 : Removed IE6 image preloading, which was used to defect the duplicate request of background images.
            • -
            • #6822 : Added labels to fake objects.
            • -
            • #6898 : [IE6] Toolbar icons becomes invisible in RTL.
            • -
            • Updated the following language files:
                -
              • Hebrew
              • -
            • -
            -

            - CKEditor 3.4.3

            -

            - Fixed issues:

            -
              -
            • #6554 : [Webkit] cannot type after inserting Page Break.
            • -
            • #6569 : Indentation now complies with text direction of the only item.
            • -
            • #6579 : The jQuery adapter was not working properly and was turned on in incompatible environments.
            • -
            • #6644 : Restrict onmousedown handler to the toolbar area.
            • -
            • #6656 : Panelbutton's buttons became active when clicking on Source.
            • -
            • #6248 : Whitespaces (nbsp elements) were incorrectly added into empty table cells and list items.
            • -
            • #6575 : Tabs disappearing in Link dialog window after a specific sequence of actions.
            • -
            • #6510 : Margin mirroring does not respect style configuration.
            • -
            • #6471 : BIDI: Pressing Decrease Indent in an RTL bulleted list causes incorrect behaviour.
            • -
            • #6479 : BIDI: Language direction is not being preserved when pressing Enter after a Paragraph Format was applied.
            • -
            • #6670 : BIDI: Indent & List icons are not reversed when we apply RTL direction to a paragraph with any of Paragraph Formatting options.
            • -
            • #6640 : Floating panels are now being closed when switching modes.
            • -
            • #4790 : Remove list with multiple items in enterBr doesnot preserve line breaks.
            • -
            • #6297 : Floated inline elements are not taking part in behavior of blocks anymore.
            • -
            • #6171 : [Firefox] Opening rich content drop-down list scrolls host page to the top when editor has a vertical scrollbar.
            • -
            • #6330 : List markers from MS Word with Roman numbering are not preserved.
            • -
            • #6720 : Attribute protection might detect wrong elements.
            • -
            • #6580 : [IE9] Flash dialog window does not get filled up.
            • -
            • #6447 : Decreasing indentation of a list with indentClasses config does not work.
            • -
            • #5894 : Adding custom buttons at the bottom of a dialog window does not cause it to expand to include its contents.
            • -
            • #6513 : Wrong ARIA attributes created on list options of Styles drop-down list.
            • -
            • #6150 : [Safari] Color dialog window was broken.
            • -
            • #6747 : Full screen layout issue caused by page element focus outside editor.
            • -
            • #6779 : Clicking the body element on elements path turns the selection on and off immediately.
            • -
            • #6781 : [IE7] Dialog windows are broken with RTL, Office 2003 and v2 skins.
            • -
            • #6798 : [IE7] Dialog window buttons disappearing in RTL after dragging.
            • -
            • #6806 : [IE7] Dialog window buttons invisible on focus.
            • -
            • #6588 : Copy and paste adds <span> if SCAYT is enabled.
            • -
            • #6673 : IE Target combo for Image Link shown as blank even when we select <not set> as an option.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.4.2

            -

            - New features:

            -
              -
            • #5024 : Added a sample that shows how to output HTML that is valid for Flash.
            • -
            -

            - Fixed issues:

            -
              -
            • #5237 : English text in dialogs' title was flipped when using RTL language (office2003 and v2 skins).
            • -
            • #6289 : Deleting nested table removed the parent cell.
            • -
            • #6341 : The editor contents now have the text cursor.
            • -
            • #6153 : Chrome: tab focus is wrong.
            • -
            • #6261 : Focus and infinite loop between multiple editors.
            • -
            • #6170 : Dedicated class names are removed from floating panels when opening another panel.
            • -
            • #6339 : Autogrow plugin now doesn't work on maximized editors.
            • -
            • #6237 : BIDI: Applying same language direction to all paragraphs not working.
            • -
            • #6353 : [IE] Resize was broken with office2003 and v2 skins.
            • -
            • #6375 : Avoiding errors when hiding the editor after the blur event.
            • -
            • #6133 : Styled paragraphs result on buggy list creation.
            • -
            • #5074 : Link target is not removed when changing to popup.
            • -
            • #6408 : [IE] Autogrow now works correctly on Quirks.
            • -
            • #6420 : [IE] The table properties dialog now correctly retrieves the caption text.
            • -
            • #6141 : It was impossible to outdent a list when indentOffset was set to 0.
            • -
            • #6377 : FF width and height are not shown for smiley in Image properties dialog.
            • -
            • #5399 : Lists pasted from Word do not maintain their nesting.
            • -
            • #6225 : [FF] Cannot transform several lines to list with enterMode BR.
            • -
            • #6467 : [FF] It is now possible to disable the plugin command on "mode" event.
            • -
            • #6461 : Attributes are now being kept when changing block formatting.
            • -
            • #6226 : BIDI: Language direction applied to a Paragraph is removed when we apply one of Paragraph formatting options.
            • -
            • #5395 : [Opera] Native context menu incorrectly opened after Opera 10.2.
            • -
            • #6444 : [Opera] Close panels and dialogs don't return focus to wysiwyg frame.
            • -
            • #6332 : IE: V2 skin bottom dialog's border broken.
            • -
            • #5646 : Parser incorrectly removes inline element when there's only one comment node enclosed.
            • -
            • #6189 : Minor code size reduction.
            • -
            • #5045 : uiColor behaved wrong if multiple editors were used with period in their names.
            • -
            • #5766 : Config entry "ignoreEmptyParagraph" should only remove one single empty paragraph in document.
            • -
            • #5931 : Unable to apply inline style because of nested elements with same style name.
            • -
            • #6083 : Dialog close sometimes cause collapsed editor selection before the insertion.
            • -
            • #6253 : BIDI: creating a Numbered/Bulleted list causing improper behavior on bidi.
            • -
            • #4023 : [Opera] Maximize plugin.
            • -
            • #6403 : [Opera] Font name options are not correctly marked in dropdown list.
            • -
            • #4534 : [Opera] Arrow key to navigate through combo list has side effects of window scrolling.
            • -
            • #6534 : [Opera] Menu key brings up both CKEditor and browser context menu.
            • -
            • #6534 : [Opera] Menu key brings up both CKEditor and browser context menu.
            • -
            • #6416 : [IE9] Unable to make text selection with mouse in source area.
            • -
            • #6417 : [IE9] Context menu opens at the upper-left corner always.
            • -
            • #6501 : [IE9] Context menu item layout is broken.
            • -
            • #6099 : BIDI: when we apply explicit language direction to Numbered/Bulleted List the corresponding BIDI Tool bar icon is not highlighted in the Toolbar.
            • -
            • #6100 : BIDI: when we change Table language direction indentation of text in Table cells is not applied correctly.
            • -
            • #6376 : BIDI: buttons should not toggle the base language direction.
            • -
            • #6235 : BIDI: Applying direction to multi-paragraph selection within a div.
            • -
            • #6187 : [IE6] Multi-instance loading produces 404s on background images.
            • -
            • #5446 : Setting config.filebrowserImageBrowseUrl results in displaying also Browser Server on links.
            • -
            • #5626 : CKeditor 3.2.1 : html content attached makes ckeditor crash the browser FF/IE.
            • -
            • #6508 : BiDi: Margin mirroring logic doesn't honor CSS direction.
            • -
            • #6043 : BIDI: When we apply RTL direction to a right aligned Paragraph, Paragraph is not moved to the left & Alignment of Paragraph is not changed.
            • -
            • #6485 : BIDI: When direction is applied on partial selected list, the style is been incorrectly applied to the entire list.
            • -
            • #6087 : Cursor of input fields in dialog isn't visible in RTL.
            • -
            • #5595 : Extra leading spaces added in preformatted block.
            • -
            • #6094 : Match full word option doesn't stop on block boundaries.
            • -
            • #5730 : [Safari] Continual pastes (holding paste key) breaks document contents.
            • -
            • #5850 : [IE] Inline style misbehaviors at the beginning of numbered/bulleted list.
            • -
            • Updated the following language files:
                -
              • #6427 : Ukrainian;
              • -
              • #6464 : Finnish;
              • -
              • Hebrew;
              • -
            • -
            -

            - CKEditor 3.4.1

            -

            - New features:

            - -

            - Fixed issues:

            -
              -
            • #6027 : Modifying Table Properties by selecting more than one cell caused issues.
            • -
            • #6146 : IE: Floating panels were being opened in the wrong place in RTL pages with horizontal scrollbars.
            • -
            • #6055 : The timestamp is now added only once to each loaded file.
            • -
            • #6097 : The bookmarks now use the right name.
            • -
            • #5717 : Removed the scayt_contextMenuOntop setting and the SCAYT context menu options are always on top.
            • -
            • #5956 : [FF] It was impossible to create an editor inside an hidden container.
            • -
            • #5753 : It was impossible to have a default value for the name field in the select dialog.
            • -
            • #6041 : BIDI: Direction of Increase Indent & Decrease Indent icons are not reversed after changing Lang direction to RTL.
            • -
            • #6138 : List indentation is not working.
            • -
            • #5649 : Image dialog too wide when many styles are set.
            • -
            • #5715 : Cell color picker dialog returns focus to document.
            • -
            • #6108 : Fixed div style.
            • -
            • #5336 : Remove object style.
            • -
            • #6155 : [[FF]] Modifying Table Header Properties by selecting first Row, causing several issues.
            • -
            • #6163 : Focus not going to Tabs in Image dialog when we went to Edit the Image.
            • -
            • #6177 : IE we can't start Numbered/Bulleted list on a Empty page.
            • -
            • #5413 : Browser error after pasting html table in CKEditor.
            • -
            • #6034 : Horizontal Alignment applied to Table cell is not updated correctly in the Toolbar.
            • -
            • #6112 : BIDI: Alignment set to text in Table cell is not shown in the Tool bar when we press Enter to start a new Paragraph.
            • -
            • #6117 : BIDI: Language direction is changing when we come out of Numbered/Bulleted list.
            • -
            • #6182 : Language Direction field on the Advanced tab of Table Properties dialog has a fixed pixel width.
            • -
            • #5487 : Fullpage writer problem with line-break.
            • -
            • #6197 : The CKEDITOR.loader base path auto-detection was not working with the _source folder.
            • -
            • #6240 : Font Names & Font Sizes should be shown Left Align even for RTL Languages.
            • -
            • #5975 : Page-break should have proper Alt Text instead of Unknown object. so that JAWS reads it properly.
            • -
            • #6255 : Inserting a page break as the first node triggered an error.
            • -
            • #6188 : [IE7] Automatic color button had the wrong cursor.
            • -
            • #6129 : The show blocks' labels are now shown in the right for RTL languages.
            • -
            • #5421 : &shy; entity not converted when config.entities=false.
            • -
            • #5769 : xhtml code generation problem &nbsp; instead of &#160; (htmlentities, entities,entities_additional,..., configuration).
            • -
            • #4472 : [FF3] Browser window scrolls to loaded CKEditor.
            • -
            • #6230 : Fixed invalid parameter count for setTimeout function call.
            • -
            • #5335 : Several lines' formatted data will be merged to one line when we apply Numbers/Bullets.
            • -
            • #5353 : wrong width of editor after resize() called in Firefox 3.6.
            • -
            • #5778 : [IE] Unwanted scroll on first mouse right-click.
            • -
            • #5218 : [FF] Copy/paste of an image from same domain changed URL to relative URL.
            • -
            • #6265 : Popup window properties were visible in the link dialog's target tab when nothing was selected.
            • -
            • #6075 : [FF] Newly created links didn't fill in information on edit.
            • -
            • #6183 : The toolbar panels options sometimes had the contents' link color.
            • -
            • #6192 : [WebKit] Inserting smileys was not working because of editor focus issues.
            • -
            • #6178 : [WebKit] Inserting elements by code was failing if the editor didn't receive the focus first.
            • -
            • #6179 : [WebKit] The Image dialog was not working if the editor didn't receive the focus first.
            • -
            • #4657 : [Opera] Styles where not working with collapsed selections.
            • -
            • #5839 : "Insert row after" was removing the ids of the elements from the clicked row.
            • -
            • #6315 : DIV plugin TT #2885 regression.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.4

            -

            - Fixed issues:

            -
              -
            • #6118 : Initial focus is now set to the tabs in the table properties dialog.
            • -
            • #6135 : The dialogadvtab plugin now uses the correct label.
            • -
            • #6125 : Focus was lost after applying commands in Opera.
            • -
            • #6137 : The table dialog was missing the default width value on second opening.
            • -
            -

            - CKEditor 3.4 Beta

            -

            - New features:

            -
              -
            • #5909 : New BiDi feature, making it possible to switch the base language direction of block elements.
            • -
            • #5268 : Introducing the "tableresize" plugin, which makes it possible to resize tables columns by mouse drag. It's not enabled by default, so it must be enabled in the configurations file.
            • -
            • #979 : New enableTabKeyTools configuration to allow using the TAB key to navigate through table cells.
            • -
            • #4606 : Introduce the "autogrow" plugin, which makes the editor resize automatically, based on the contents size.
            • -
            • #5737 : Added support for the HTML5 contenteditable attribute, making it possible to define read only regions into the editor contents.
            • -
            • #5418 : New "Advanced" tab introduced on the Table Properties dialog. It's based on the new dialogadvtab plugin.
            • -
            • #6082 : Introduced the useComputedState setting, making it possible to control whether toolbar features, like alignment and direction, should reflect the "computed" selection states, even when the effective feature value is not applied.
            • -
            -

            - Fixed issues:

            -
              -
            • #5911 : BiDi: List items should support and retain correct base language direction
            • -
            • #5689 : Make it possible to run CKEditor inside of Firefox chrome.
            • -
            • #6042 : It wasn't possible to align a paragraph with the dir attribute to the opposite direction.
            • -
            • #6058 : Fixed a small style glitch with file upload fields in IE+Quirks.
            • -
            -

            - CKEditor 3.3.2

            -

            - New features:

            -
              -
            • #5882 : Introduce the dialog#selectPage event, replicating the OnDialogTabChange feature available in FCKeditor 2.
            • -
            • #5927 : The native controls in ui.dialog.elements can be styled with the controlStyle definition.
            • -
            -

            - Fixed issues:

            -
              -
            • #1644 : Removed references to cursor:hand in the stylesheets.
            • -
            • #5411 : Anchor, hidden fields and Page-Break objects can no longer be resized.
            • -
            • #5456 : Initial focus incorect in api_dialog sample page.
            • -
            • #5628 : Incorrect <pre> siblings merging.
            • -
            • #5829 : Adding validation for start number field in list style dialog.
            • -
            • #5845 : Context menu on empty list item loses selection.
            • -
            • #5860 : [IE] > in attribute values are incorrectly escaped.
            • -
            • #5905 : SCAYT is not any more enabled by default.
            • -
            • #5736 : Improved the text generated for mailto: links if no text was selected.
            • -
            • #4779 : Adjust resize_minWidth and resize_minHeight if smaller than actual dimensions.
            • -
            • #5687 : Navigation through colors is now compatible with RTL.
            • -
            • #4615 : [IE] Text fields are no longer disrupted in dialog with RTL.
            • -
            • #5887 : The number of columns in the smileys table is now configurable via the smiley_columns setting.
            • -
            • #5100 : It was possible to drag&drop some elements like context menu items or dropdown entries.
            • -
            • #5933 : Text color and background color panels don't have scrollbars anymore under office2003 and v2 skins.
            • -
            • #5943 : An error is no longer generated when using percent or pixel values in the image dialog.
            • -
            • #5951 : Avoid problems with security systems due to the usage of UniversalXPConnect.
            • -
            • #5441 : Avoid errors if the editor instance is removed from the DOM before calling its destroy() method.
            • -
            • #4997 : Provide better access to the native input in the ui.dialog.file element.
            • -
            • #5914 : Modified the Smileys dialog to make active only the images and not their borders.
            • -
            • #5565 : The scrollbar does not behaves erratically when opening a rich combo in RTL page.
            • -
            • #5843 : In CKEditor 3.3: When we set the focus in the 'instanceReady' event, FF3.6 is giving js error.
            • -
            • #5902 : paste and pastetext dialogs cannot be skinned easily.
            • -
            • #5959 : Dialog auto focus does not check for hidden tabs.
            • -
            • #5415 : Undo not working when we change the Table Properties for the table on a saved page.
            • -
            • #5435 : IE: we can't start Numbered/Bulleted list in Tables by Clicking on Insert/Remove Numbers/Bullets Icon.
            • -
            • #5832 : The JQuery adapter sample is not working properly with SSL.
            • -
            • #5728 : Text field & Upload Button in Upload Tab of Image Properties dialog are not shown Properly in Arabic.
            • -
            • #5436 : IE: Cursor goes to next Table Cell after we insert a Smiley in the Table Cell.
            • -
            • #5580 : Maximize does not work properly in the Office 2003 and V2 skins.
            • -
            • #5495 : The link dialog was breaking the undo system on some situations.
            • -
            • #5775 : Required field's label to contain a CSS class to allow it to be styled differently.
            • -
            • #5999 : Table dialog rows and columns fields are now marked as required.
            • -
            • #5693 : baseHref detection in the flash dialog now works correctly.
            • -
            • #5690 : Table cell's width attribute is now respected properly.
            • -
            • #5819 : Introducing the new removeFormatCleanup event and making sure remove format doesn't break the showborder plugin.
            • -
            • #5558 : After pasting on WebKit based browsers the editor now scrolls to the end of the pasted content.
            • -
            • #5799 : Correct plugin dependencies for the liststyle plugin with contextMenu and dialog.
            • -
            • #5436 : IE: The cursor was moving to the wrong position when inserting inline elements at the end of cells on tables.
            • -
            • #5984 : Firefox: CTRL+HOME was creating an unwanted empty paragraph at the start of the document.
            • -
            • #5634 : IE: It was needed to click twice in the editor to make it editable on some situations.
            • -
            • #5338 : Pasting from Open Office could lead on error.
            • -
            • #5224 : Some invalid markup could break the editor.
            • -
            • #5455 : It was not possible to remove formatting from pasted content on specific cases.
            • -
            • #5735 : IE: The editor was having focus issues when the previous selection got hidden by scroll operations.
            • -
            • #5563 : Firefox: The disableObjectResizing and disableNativeTableHandles settings stopped working.
            • -
            • #5781 : Firefox: Editing was not possible in an empty document.
            • -
            • #5293 : Firefox: Unwanted BR tags were being left in the editor output when it should be empty.
            • -
            • #5280 : IE: Scrollbars where reacting improperly when clicking in the bar space.
            • -
            • #5840 : Some dialog access keys are conflicting with "Ctrl + A", select all text behavior on text input.
            • -
            • #6059 : Changing list type didn't preserve the list's attributes.
            • -
            • #5193 : In Firefox, the element path options had the text cursor instead of the arrow.
            • -
            • #6073 : The list context menu was showing the wrong option when in a mixed list hierarchy.
            • -
            • #6074 : The Insert Table Column command was duplicating the selected column cells ids.
            • -
            • #6066 : The toolbar combos had the text cursor instead of the arrow.
            • -
            • #6062 : The toolbar buttons had the text cursor instead of the arrow.
            • -
            • #6068 : [IE7] A few labels were hidden in a RTL language.
            • -
            • #6000 : Safari and Chrome where scrolling the contents to the top when moving the focus to the editor.
            • -
            • #6090 : IE: Textarea with selection inside causes Link dialog issues.
            • -
            • #5079 : Page break in lists move to above the list when you switch from WYSIWYG to HTML mode and back.
            • -
            • Updated the following language files:
                -
              • Chinese Simplified;
              • -
              • Hebrew;
              • -
              • #5962 : German;
              • -
              • #5645 : Portuguese;
              • -
              • #5797 : Turkish;
              • -
            • -
            -

            - CKEditor 3.3.1

            -

            - Fixed issues:

            -
              -
            • #5780 : Text selection lost when opening some of the dialogs.
            • -
            • #5787 : Liststyle plugin wasn't packaged into the core (CKEDITOR.resourceManager.load exception).
            • -
            • #5637 : Fix wrong nesting that generated "<head> must be a child of <html>" warning in Webkit.
            • -
            • #5790 : Internal only attributes output on fullpage <html> tag.
            • -
            • #5761 : [IE] Color dialog matrix buttons are barely clickable in quirks mode.
            • -
            • #5759 : [IE] Clicking on the scrollbar and then on the host page causes error.
            • -
            • #5772 : List style dialog is missing tab page ids.
            • -
            • #5782 : [FF] Wysiwyg mode is broken by 'display' style changes on editor's parent DOM tree.
            • -
            • #5801 : [IE] contentEditable="false" doesn't apply in effect on inline-elements.
            • -
            • #5794 : Empty find matching twice results in JavaScript error.
            • -
            • #5732 : If it isn't possible to connect to the SCAYT servers the dialogs might hang in Firefox. Fix for Firefox>=3.6.
            • -
            • #5807 : [FF2] New page command results in uneditable document.
            • -
            • #5807 : [FF2] SCAYT plugin is disabled in Firefox2 due to selection interference.
            • -
            • #5772 : [IE] Some numbered list style types are not supported by IE6/7 and causes JavaScript error.
            • -
            -

            - CKEditor 3.3

            -

            - New features:

            -
              -
            • #635 : The properties dialog will now open when double clicking on objects.
            • -
            • #3893 : It's now possible to indent/outdent lists when selecting the first list item.
            • -
            • #4968 : The contentsLangDirection setting now has a default value 'ui' which inherit language direction from the editor UI language.
            • -
            • #4649 : The color picker dialog is now accessible.
            • -
            • #3593 : The editing area is now enabled by contentEditable="true" instead of designMode="on" to allow creating uneditable content elements in all browsers.
            • -
            • #4056 : Hidden fields will now be displayed as fake element just like in FCKeditor 2.
            • -
            -

            - CKEditor 3.2.2

            -

            - New features:

            -
              -
            • The SCAYT spell checker is now enabled by default through the autoStartup setting.
            • -
            • #5631 : The SCAYT context menu options can now be reorganized through the scayt_contextMenuItemsOrder setting.
            • -
            • #4231 : Introducing the resize_dir setting, to be able to restrict manual resizing of the editor to only one direction (horizontal/vertical).
            • -
            • #5479 : Introducing the classic ASP integration files and samples.
            • -
            • #5024 : Added samples (HTML and XHTML) to show how to output HTML using fonts and other attributes instead of styles.
            • -
            • #4358 : Introduced the List Properties dialog.
            • -
            • #5485 : Adding the contentsLanguage configuration option to be able to set the language for the editor contents.
            • -
            -

            - Fixed issues:

            -
              -
            • #5330 : Corrected detection of CTRL and META keys in Macs for the context menu.
            • -
            • #5434 : Fixed access denied issues with IE when accessing web sites through IPv6 IP addresses.
            • -
            • #4476 : [IE] Inaccessible empty list item contains sub list.
            • -
            • #4881 : [IE] Selection range broken because of cutting a single control type element from it.
            • -
            • #5505 : Image dialog throw JavaScript error when click close dialog before preview area is loading.
            • -
            • #5144 : [Chrome] Paste in Webkit sometimes leaves extra 'div' element.
            • -
            • #5021 : [Firefox] Typing in empty document start from second line when enterMode = CKEDITOR.ENTER_BR.
            • -
            • #5416 : [IE] Delete table throws a error when enterMode = CKEDITOR.ENTER_BR.
            • -
            • #4459 : [IE] Select element is penetrating the maximized editor in IE6.
            • -
            • #5559 : [IE] The first call to setData is affected by iframe cache when loading the wysiwyg mode.
            • -
            • #5567 : [IE] Remove inline styles in some case doesn't join identical siblings.
            • -
            • #5450 : [FireFox] Press ENTER on 'replace' button result wrong.
            • -
            • #5121 : Recognizes the <br /> tag as a separator when apply block styles and enterMode = CKEDITOR.ENTER_BR.
            • -
            • #5575 : CKEDITOR.replaceAll should consider all kind of white spaces between class names.
            • -
            • #5582 : Prevent the default behavior when click the 'x' button to close dialog box.
            • -
            • #5584 : ENTER key with forceEnterMode turns on doesn't inherit current block attributes.
            • -
            • #4797 : [Opera] Press ENTER key in dialog fields to close throws JavaScript error.
            • -
            • #5578 : Add flash fake element align property when switch mode (source to wysiwyg).
            • -
            • #5577 : Update delete column behavior when choose multiple cells in the same column.
            • -
            • #5512 : Open context menu with SHIFT+F10 doesn't get correct editor selection.
            • -
            • #5433 : English protocol text directions in Link dialog are not incorrect in 'rtl' UI languages.
            • -
            • #5553 : Paste dialog clipboard area text direction is incorrect for 'rtl' content languages.
            • -
            • #4734 : Font size resets when font name is changed in an empty numbered list.
            • -
            • #5237 : English text in dialogs' title is flipped when using RTL language.
            • -
            • #3257 : Create list doesn't keep blocks as headings.
            • -
            • #5111 : [Firefox] JAWS doesn't respect PC cursor mode (application role) on toolbar.
            • -
            • #5530 : Page break for printing can't be removed with undo.
            • -
            • #5381 : Unable to place cursor between two paragraphs in body.
            • -
            • #5568 : [IE6/7] Selecting a entire table cell changes the original range.
            • -
            • #5623 : [Firefox] Apply style that edges another inline style result incorrect.
            • -
            • #5586 : [Firefox] Maximize the second editor ruins full screen mode.
            • -
            • #5617 : HTML filter system does not allow two 'text' filter rules.
            • -
            • #5663 : General memory clean up after destroying last instance.
            • -
            • #5461 : [IE] Fix Paste from Word dialog doesn't accept imput problem.
            • -
            • #5676 : Make color buttons use RRGGBB instead of RGB for better compatibility with IE.
            • -
            • #4948 : [Safari] Select the first/last cell of table to open context menu may lead to undetected table.
            • -
            • #5591 : [Firefox] Select a list item makes selected element broken.
            • -
            • #5667 : Pasting in a RTL page content causes shows up the horizontal scrollbar.
            • -
            • #5688 : Duplicate ids are used in dialog definition.
            • -
            • #5719 : [IE] 'change' dialog event should not be triggered when dialog is already closed.
            • -
            • #5747 : [IE] Error thrown when IE input field editing mode is turned on.
            • -
            • #5516 : IE8: Toolbar buttons have higher bottom padding.
            • -
            • #5402 : SHIFT-ENTER could now be used to exit from preformat block.
            • -
            • SCAYT plugin related:
                -
              • #4836 : Using SCAYT result in fragile elements when applying inline styles.
              • -
              • #5425 : [Opera] Disable SCAYT plugin for Opera browser.
              • -
              • #5632 : SCAYT word marker is not visible on text with background-color set.
              • -
              • #4125 : Remove Format command incorrectly removes SCAYT word markers.
              • -
              • #5671 : SCAYT bootstrap script could be added multiple times unnecessarily.
              • -
              • #5573 : SCAYT move cursor position after insert element into marked word text.
              • -
              • #5546 : SCAYT interferes with undo/redo commands.
              • -
              • #5570 : [IE] First enabling SCAYT blind cursor in editor.
              • -
              • #5741 : Enable SCAYT cause error in multiple editor instances.
              • -
              • #5744 : Remove editor with SCAYT enabled in source mode throws error.
              • -
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.2.1

            -

            - New features:

            -
              -
            • #4478 : Enable the SelectAll command in source mode.
            • -
            • #5150 : Allow names in the CKEDITOR.config.colorButton_colors setting.
            • -
            • #4810 : Adding configuration option for image dialog preview area filling text.
            • -
            • #536 : Object style now could be applied on any parent element of current selection.
            • -
            • #5290 : Unified stylesSet loading removing dependencies from the styles combo. - Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location - is under the 'styles' plugin instead of 'stylescombo'.
            • -
            • #5352 : Allow to define the stylesSet array in the config object for the editor.
            • -
            • #5302 : Adding config option "forceEnterMode".
            • -
            • #5216 : Extend CKEDITOR.appendTo to allow a data parameter for the initial value.
            • -
            • #5024 : Added sample to show how to output XHTML and avoid deprecated tags.
            • -
            -

            - Fixed issues:

            -
              -
            • #5152 : Indentation using class attribute doesn't work properly.
            • -
            • #4682 : It wasn't possible to edit block elements in IE that had styles like width, height or float.
            • -
            • #4750 : Correcting default order of buttons layout in dialogs on Mac.
            • -
            • #4932 : Fixed collapse button not clickable on simple toolbar.
            • -
            • #5228 : Link dialog is automatically changes protocol when URLs that starts with '?'.
            • -
            • #4877 : Fixed CKEditor displays source code in one long line (IE quirks mode + office2003 skin).
            • -
            • #5132 : Apply inline style leaks into sibling words which are seperated spaces.
            • -
            • #3599 : Background color style on sized text displayed as narrow band behind.
            • -
            • #4661 : Translation missing in link dialog.
            • -
            • #5240 : Flash alignment property is not presented visually on fake element.
            • -
            • #4910 : Pasting in IE scrolls document to the end.
            • -
            • #5041 : Table summary attribute can't be removed with dialog.
            • -
            • #5124 : All inline styles cannot be applied on empty spaces.
            • -
            • #3570 : SCAYT marker shouldn't appear inside elements path bar.
            • -
            • #4553 : Dirty check result incorrect when editor document is empty.
            • -
            • #4555 : Unreleased memory when editor is created and destroyed.
            • -
            • #5118 : Arrow keys navigation in RTL languages is incorrect.
            • -
            • #4721 : Remove attribute 'value' of checkbox in IE.
            • -
            • #5278 : IE: Add validation to check for bad window names of popup window.
            • -
            • #5171 : Dialogs contains lists don't have proper voice labels.
            • -
            • #4791 : Can't place cursor inside a form that end with a checkbox/radio.
            • -
            • #4479 : StylesCombo doesn't reflect the selection state until it's first opened.
            • -
            • #4717 : 'Unlink' and 'Outdent' command buttons should be disabled on editor startup.
            • -
            • #5119 : Disabled command buttons are not being properly styled when focused.
            • -
            • #5307 : Hide dialog page cause problem when there's two tab pages remain.
            • -
            • #5343 : Active list item ARIA role is wrongly placed.
            • -
            • #3599 : Background color style applying to text with font size style has been narrowly rendered.
            • -
            • #4711 : Line break character inside preformatted text makes it unable to type text at the end of previous line.
            • -
            • #4829 : [IE] Apply style from combo has wrong result on manually created selection.
            • -
            • #4830 : Retrieving selected element isn't always right, especially selecting using keyboard (SHIFT+ARROW).
            • -
            • #5128 : Element attribute inside preformatted text is corrupted when converting to other blocks.
            • -
            • #5190 : Template list entry shouldn't gain initial focus open templates list dialog opens.
            • -
            • #5238 : Menu button doesn't display arrow icon in high-contrast mode.
            • -
            • #3576 : Non-attributed element of the same name with the applied style is incorrectly removed.
            • -
            • #5221 : Insert table into empty document cause JavaScript error thrown.
            • -
            • #5242 : Apply 'automatic' color option of text color incorrectly removes background-color style.
            • -
            • #4719 : IE does not escape attribute values properly.
            • -
            • #5170 : Firefox does not insert text into styled element properly.
            • -
            • #4026 : Office2003 skin has no toolbar button borders in High Contrast in IE7.
            • -
            • #4348 : There should have exception thrown when 'CKEDITOR_BASEPATH' couldn't be figured out automatically.
            • -
            • #5364 : Focus may not be put into dialog correctly when dialog skin file is loading slow.
            • -
            • #4016 : Justify the layout of forms select dialog in Chrome and IE7.
            • -
            • #5373 : Variable 'pathBlockElements' defines wrong items in CKEDITOR.dom.elementPath.
            • -
            • #5082 : Ctrl key should be described as Cmd key on Mac.
            • -
            • #5182 : Context menu is not been announced correctly by ATs.
            • -
            • #4898 : Can't navigate outside table under the last paragraph of document.
            • -
            • #4950 : List commands could compromise list item attribute and styles.
            • -
            • #5018 : Find result highlighting remove normal font color styles unintentionally.
            • -
            • #5376 : Unable to exit list from within a empty block under list item.
            • -
            • #5145 : Various SCAYT fixes.
            • -
            • #5319 : Match whole word doesn't work anymore after replacement has happened.
            • -
            • #5363 : 'title' attribute now presents on all editor iframes.
            • -
            • #5374 : Unable to toggle inline style when the selection starts at the linefeed of the previous paragraph.
            • -
            • #4513 : Selected link element is not always correctly detected when using keyboard arrows to perform such selection.
            • -
            • #5372 : Newly created sub list should inherit nothing from the original (parent) list, except the list type.
            • -
            • #5274 : [IE6] Templates preview image is displayed in wrong size.
            • -
            • #5292 : Preview in font size and family doesn't work with custom styles.
            • -
            • #5396 : Selection is lost when use cell properties dialog to change cell type to header.
            • -
            • #4082 : [IE+Quirks] Preview text in the image dialog is not wrapping.
            • -
            • #4197 : Fixing format combo don't hide when editor blur on Safari.
            • -
            • #5401 : The context menu break layout with Office2003 and V2 skin on IE quirks mode.
            • -
            • #4825 : Fixing browser context menu is opened when clicking right mouse button twice.
            • -
            • #5356 : The SCAYT dialog had issues with Prototype enabled pages.
            • -
            • #5266 : SCAYT was disturbing the rendering of TH elements.
            • -
            • #4688 : SCAYT was interfering on checkDirty.
            • -
            • #5429 : High Contrast mode was being mistakenly detected when loading the editor through Dojo's xhrGet.
            • -
            • #5221 : Range is mangled when making collapsed selection in an empty paragraph.
            • -
            • #5261 : Config option 'scayt_autoStartup' slow down editor loading.
            • -
            • #3846 : Google Chrome - No Img properties after inserting.
            • -
            • #5465 : ShiftEnter=DIV doesn't respect list item when pressing ENTER at end of list item.
            • -
            • #5454 : After replaced success, the popup window couldn't be closed and a js error occured.
            • -
            • #4784 : Incorrect cursor position after delete table cells.
            • -
            • #5149 : [FF] Cursor disappears after maximize when the editor has focus.
            • -
            • #5220 : DTD now shows tolerance to <style> appear inside content.
            • -
            • #5440 : Mobile browsers (iPhone, Android...) are marked as incompatible as they don't support editing features.
            • -
            • #5504 : [IE6/7] 'Paste' dialog will always get opened even when user allows the clipboard access dialog when using 'Paste' button.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.2

            -

            - New features:

            -
              -
            • Several accessibility enhancements:
                -
              • #4502 : The editor accessibility is now totally based on WAI-ARIA.
              • -
              • #5015 : Adding accessibility help dialog plugin.
              • -
              • #5014 : Keyboard navigation compliance with screen reader suggested keys.
              • -
              • #4595 : Better accessibility in the Templates dialog.
              • -
              • #3389 : Esc/Arrow Key now works for closing sub menu.
              • -
            • -
            • #4973 : The Style field in the Div Container dialog is now loading the styles defined in the default styleset used by the Styles toolbar combo.
            • -
            -

            - Fixed issues:

            -
              -
            • #5049 : Form Field list command in JAWS incorrectly lists extra fields.
            • -
            • #5008 : Lock/Unlock ratio buttons in the Image dialog was poorly designed in High Contrast mode.
            • -
            • #3980 : All labels in dialogs now use <label> instead of <div>.
            • -
            • #5213 : Reorganization of some entries in the language files to make it more consistent.
            • -
            • #5199 : In IE, single row toolbars didn't have the bottom padding.
            • -
            -

            - CKEditor 3.1.1

            -

            - New features:

            -
              -
            • #4399 : Improved support for external file browsers by allowing executing a callback function.
            • -
            • #4612 : The text of links is now updated if it matches the URL to which it points to.
            • -
            • #4936 : New localization support for the Welsh language.
            • -
            -

            - Fixed issues:

            -
              -
            • #4272 : Kama skin toolbar was broken in IE+Quirks+RTL.
            • -
            • #4987 : Changed the url which is called by the Browser Server button in the Link tab of Image Properties dialog.
            • -
            • #5030 : The CKEDITOR.timestamp wasn't been appended to the skin.js file.
            • -
            • #4993 : Removed the float style from images when the user selects 'not set' for alignment.
            • -
            • #4944 : Fixed a bug where nested list structures with inconsequent levels were not being pasted correctly from MS Word.
            • -
            • #4637 : Table cells' 'nowrap' attribute was not being loaded by the cell property dialog. Thanks to pomu0325.
            • -
            • #4724 : Using the mouse to insert a link in IE might create incorrect results.
            • -
            • #4640 : Small optimizations for the fileBrowser plugin.
            • -
            • #4583 : The "Target Frame Name" field is now visible when target is set to 'frame' only.
            • -
            • #4863 : Fixing iframedialog's height doesn't stretch to 100% (except IE Quirks).
            • -
            • #4964 : The BACKSPACE key positioning was not correct in some cases with Firefox.
            • -
            • #4980 : Setting border, vspace and hspace of images to zero was not working.
            • -
            • #4773 : The fileBrowser plugin was overwriting onClick functions eventually defined on fileButton elements.
            • -
            • #4731 : The clipboard plugin was missing a reference to the dialog plugin.
            • -
            • #5051 : The about plugin was missing a reference to the dialog plugin.
            • -
            • #5146 : The wsc plugin was missing a reference to the dialog plugin.
            • -
            • #4632 : The print command will now properly break on the insertion point of page break for printing.
            • -
            • #4862 : The English (United Kingdom) language file has been renamed to en-gb.js.
            • -
            • #4618 : Selecting an emoticon or the lock and reset buttons in the image dialog fired the onBeforeUnload event in IE.
            • -
            • #4678 : It was not possible to set tables' width to empty value.
            • -
            • #5012 : Fixed dependency issues with the menu plugin.
            • -
            • #5040 : The editor will not properly ignore font related settings that have extra item separators (semi-colons).
            • -
            • #4046 : Justify should respect config.enterMode = CKEDITOR.ENTER_BR.
            • -
            • #4622 : Inserting tables multiple times was corrupting the undo system.
            • -
            • #4647 : [IE] Selection on an element within positioned container is lost after open context-menu then click one menu item.
            • -
            • #4683 : Double-quote character in attribute values was not escaped in the editor output.
            • -
            • #4762 : [IE] Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor in source mode.
            • -
            • #4772 : Text color was not being applied properly on links.
            • -
            • #4795 : [IE] Press 'Del' key on horizontal line or table result in error.
            • -
            • #4824 : [IE] <br/> at the very first table cell breaks the editor selection.
            • -
            • #4851 : [IE] Delete table rows with context-menu may cause error.
            • -
            • #4951 : Replacing text with empty string was throwing errors.
            • -
            • #4963 : Link dialog was not opening properly for e-mail type links.
            • -
            • #5043 : Removed the possibility of having an unwanted script tag being outputted with the editor contents.
            • -
            • #3678 : There were issues when editing links inside floating divs with IE.
            • -
            • #4763 : Pressing ENTER key with text selected was not deleting the text in some situations.
            • -
            • #5096 : Simple ampersand attribute value doesn't work for more than one occurrence.
            • -
            • #3494 : Context menu is too narrow in some translations.
            • -
            • #5005 : Fixed HTML errors in PHP samples.
            • -
            • #5123 : Fixed broken XHTML in User Interface Languages sample.
            • -
            • #4893 : Editor now understands table cell inline styles.
            • -
            • #4611 : Selection around <select> in editor doesn't cause error anymore.
            • -
            • #4886 : Extra BR tags were being created in the output HTML.
            • -
            • #4933 : Empty tags with BR were being left in the DOM.
            • -
            • #5127 : There were errors when removing dialog definition pages through code.
            • -
            • #4767 : CKEditor was not working when ckeditor_source.js is loaded in the <body> .
            • -
            • #5062 : Avoided security warning message when loading the wysiwyg area in IE6 under HTTPS.
            • -
            • #5135 : The TAB key will now behave properly when in Source mode.
            • -
            • #4988 : It wasn't possible to use forcePasteAsPlainText with Safari on Mac.
            • -
            • #5095 : Safari on Mac deleted the current selection in the editor when Edit menu was clicked.
            • -
            • #5140 : In High Contrast mode, arrows were now been displayed for menus with submenus.
            • -
            • #5163 : The undo system was not working on some specific cases.
            • -
            • #5162 : The ajax sample was throwing errors when loading data.
            • -
            • #4999 : The Template dialog was not generating an undo snapshot.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.1

            -

            - New features:

            -
              -
            • #4067 : Introduced the full page editing support (from <html> to </html>).
            • -
            • #4228 : Introduced the Shared Spaces feature.
            • -
            • #4379 : Introduced the new powerful pasting system and word cleanup procedure, including enhancements to the paste as plain text feature.
            • -
            • #2872 : Introduced the new native PHP API, the first standardized server side support.
            • -
            • #4210 : Added CKEditor plugin for jQuery.
            • -
            • #2885 : Added 'div' dialog and corresponding context menu options.
            • -
            • #4574 : Added the table merging tools and corresponding context menu options.
            • -
            • #4340 : Added the email protection option for link dialog.
            • -
            • #4463 : Added inline CSS support in all places where custom stylesheet could apply.
            • -
            • #3881 : Added color dialog for 'more color' option in color buttons.
            • -
            • #4341 : Added the 'showborder' plugin.
            • -
            • #4549 : Make the anti-cache query string configurable.
            • -
            • #4708 : Added the 'htmlEncodeOutput' config option.
            • -
            • #4342 : Introduced the bodyId and bodyClass settings to specify the id and class. to be used in the editing area at runtime.
            • -
            • #3401 : Introduced the baseHref setting so it's possible to set the URL to be used to resolve absolute and relative URLs in the contents.
            • -
            • #4729 : Added support to fake elements for comments.
            • -
            -

            - Fixed issues:

            -
              -
            • #4707 : Fixed invalid link is requested in image preview.
            • -
            • #4461 : Fixed toolbar separator line along side combo enlarging the toolbar height.
            • -
            • #4596 : Fixed image re-size lock buttons aren't accessible in high-contrast mode.
            • -
            • #4676 : Fixed editing tables using table properties dialog overwrites original style values.
            • -
            • #4714 : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.
            • -
            • #3905 : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.
            • -
            • #4768 : Fixed open context menu in IE throws js error when focus is not inside document.
            • -
            • #4822 : Fixed applying 'Headers' to existing table does not work in IE.
            • -
            • #4855 : Fixed toolbar doesn't wrap well for 'v2' skin in all browsers.
            • -
            • #4882 : Fixed auto detect paste from MS-Word is not working for Safari.
            • -
            • #4882 : Fixed unexpected margin style left behind on content cleaning up from MS-Word.
            • -
            • #4896 : Fixed paste nested list from MS-Word with measurement units set to cm is broken.
            • -
            • #4899 : Fixed unable to undo pre-formatted style.
            • -
            • #4900 : Fixed ratio-lock inconsistent between browsers.
            • -
            • #4901 : Fixed unable to edit any link with popup window's features in Firefox.
            • -
            • #4904 : Fixed when paste happen from dialog, it always throw JavaScript error.
            • -
            • #4905 : Fixed paste plain text result incorrect when content from dialog.
            • -
            • #4889 : Fixed unable to undo 'New Page' command after typing inside editor.
            • -
            • #4892 : Fixed table alignment style is not properly represented by the wrapping div.
            • -
            • #4918 : Fixed switching mode when maximized is showing background page contents.
            • -
            -

            - CKEditor 3.0.2

            -

            - New features:

            -
              -
            • #4343 : Added the configuration option 'browserContextMenuOnCtrl' so it's possible to enable the default browser context menu by holding the CTRL key.
            • -
            -

            - Fixed issues:

            -
              -
            • #4552 : Fixed float panel doesn't show up since editor instanced been destroyed once.
            • -
            • #3918 : Fixed fake object is editable with Image dialog.
            • -
            • #4053 : Fixed 'Form Properties' missing from context menu when selection collapsed inside form.
            • -
            • #4401 : Fixed customized by removing 'upload' tab page from 'Link dialog' cause JavaScript error.
            • -
            • #4477 : Adding missing tag names in object style elements.
            • -
            • #4567 : Fixed IE throw error when pressing BACKSPACE in source mode.
            • -
            • #4573 : Fixed 'IgnoreEmptyPargraph' config doesn't work with the config 'entities' is set to 'false'.
            • -
            • #4614 : Fixed attribute protection fails because of line-break.
            • -
            • #4546 : Fixed UIColor plugin doesn't work when editor id contains CSS selector preserved keywords.
            • -
            • #4609 : Fixed flash object is lost when loading data from outside editor.
            • -
            • #4625 : Fixed editor stays visible in a div with style 'visibility:hidden'.
            • -
            • #4621 : Fixed clicking below table caused an empty table been generated.
            • -
            • #3373 : Fixed empty context menu when there's no menu item at all.
            • -
            • #4473 : Fixed setting rules on the same element tag name throws error.
            • -
            • #4514 : Fixed press 'Back' button breaks wysiwyg editing mode is Firefox.
            • -
            • #4542 : Fixed unable to access buttons using tab key in Safari and Opera.
            • -
            • #4577 : Fixed relative link url is broken after opening 'Link' dialog.
            • -
            • #4597 : Fixed custom style with same attribute name but different attribute value doesn't work.
            • -
            • #4651 : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.
            • -
            • #4654 : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.
            • -
            • #3950 : Fixed table column insertion incorrect when selecting empty cell area.
            • -
            • #3912 : Fixed UIColor not working in IE when page has more than 30+ editors.
            • -
            • #4031 : Fixed mouse cursor on toolbar combo has more than 3 shapes.
            • -
            • #4041 : Fixed open context menu on multiple cells to remove them result in only one removed.
            • -
            • #4185 : Fixed resize handler effect doesn't affect flash object on output.
            • -
            • #4196 : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.
            • -
            • #4200 : Fixed unable to insert 'password' type filed with attributes.
            • -
            • #4530 : Fixed context menu couldn't open in Opera.
            • -
            • #4536 : Fixed keyboard navigation doesn't work at all in IE quirks mode.
            • -
            • #4584 : Fixed updated link Target field is not updating when updating to certain values.
            • -
            • #4603 : Fixed unable to disable submenu items in contextmenu.
            • -
            • #4672 : Fixed unable to redo the insertion of horizontal line.
            • -
            • #4677 : Fixed 'Tab' key is trapped by hidden dialog elements.
            • -
            • #4073 : Fixed insert template with replace option could result in empty document.
            • -
            • #4455 : Fixed unable to start editing when image inside document not loaded.
            • -
            • #4517 : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.
            • -
            • #3165 : Fixed enter key in empty list item before nested one result in collapsed line.
            • -
            • #4527 : Fixed checkbox generate invalid 'checked' attribute.
            • -
            • #1659 : Fixed unable to click below content to start editing in IE with 'config.docType' setting to standard compliant.
            • -
            • #3933 : Fixed extra <br> left at the end of document when the last element is a table.
            • -
            • #4736 : Fixed PAGE UP and PAGE DOWN keys in standards mode are not working.
            • -
            • #4725 : Fixed hitting 'enter' before html comment node produces a JavaScript error.
            • -
            • #4522 : Fixed unable to redo when typing after insert an image with relative url.
            • -
            • #4594 : Fixed context menu goes off-screen when mouse is at right had side of screen.
            • -
            • #4673 : Fixed undo not available straight away if shift key is used to enter first character.
            • -
            • #4690 : Fixed the parsing of nested inline elements.
            • -
            • #4450 : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.
            • -
            • #4733 : Fixed dialog opening sometimes hang up Firefox and Safari.
            • -
            • #4498 : Fixed toolbar collapse button missing tooltip.
            • -
            • #4738 : Fixed inserting table inside bold/italic/underline generates error on ENTER_BR mode.
            • -
            • #4246 : Fixed avoid XHTML deprecated attributes for image styling.
            • -
            • #4543 : Fixed unable to move cursor between table and hr.
            • -
            • #4764 : Fixed wrong exception message when CKEDITOR.editor.append() to non-existing elements.
            • -
            • #4521 : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.
            • -
            • #4709 : Fixed inconsistent scroll-bar behavior on IE.
            • -
            • #4776 : Fixed preview page failed to open when relative URl contains in document.
            • -
            • #4812 : Fixed 'Esc' key not working on dialogs in Opera.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.0.1

            -

            - New features:

            -
              -
            • #4219 : Added fallback mechanism for config.language.
            • -
            • #4194 : Added support for using multiple css style sheets within the editor.
            • -
            -

            - Fixed issues:

            -
              -
            • #3898 : Added validation for URL value in Image dialog.
            • -
            • #3528 : Fixed Context Menu issue when triggered using Shift+F10.
            • -
            • #4028 : Maximize control's tool tip was wrong once it is maximized.
            • -
            • #4237 : Toolbar is chopped off in Safari browser 3.x.
            • -
            • #4241 : Float panels are left on screen while editor is destroyed.
            • -
            • #4274 : Double click event is incorrect handled in 'divreplace' sample.
            • -
            • #4354 : Fixed TAB key on toolbar to not focus disabled buttons.
            • -
            • #3856 : Fixed focus and blur events in source view mode.
            • -
            • #3438 : Floating panels are off by (-1px, 0px) in RTL mode.
            • -
            • #3370 : Refactored use of CKEDITOR.env.isCustomDomain().
            • -
            • #4230 : HC detection caused js error.
            • -
            • #3978 : Fixed setStyle float on IE7 strict.
            • -
            • #4262 : Tab and Shift+Tab was not working to cycle through CTRL+SHIFT+F10 context menu in IE.
            • -
            • #3633 : Default context menu isn't disabled in toolbar, status bar, panels...
            • -
            • #3897 : Now there is no image previews when the URL is empty in image dialog.
            • -
            • #4048 : Context submenu was lacking uiColor.
            • -
            • #3568 : Dialogs now select all text when tabbing to text inputs.
            • -
            • #3727 : Cell Properties dialog was missing color selection option.
            • -
            • #3517 : Fixed "Match cyclic" field in Find & Replace dialog.
            • -
            • #4368 : borderColor table cell attribute haven't worked for none-IE
            • -
            • #4203 : In IE quirks mode + toolbar collapsed + source mode editing block height was incorrect.
            • -
            • #4387 : Fixed: right clicking in Kama skin can lead to a javascript error.
            • -
            • #4397 : Wysiwyg mode caused the host page scroll.
            • -
            • #4385 : Fixed editor's auto adjusting on DOM structure were confusing the dirty checking mechanism.
            • -
            • #4397 : Fixed regression of [3816] where turn on design mode was causing Firefox3 to scroll the host page.
            • -
            • #4254 : Added basic API sample.
            • -
            • #4107 : Normalize css font-family style text for correct comparision.
            • -
            • #3664 : Insert block element in empty editor document should not create new paragraph.
            • -
            • #4037 : 'id' attribute is missing with Flash dialog advanced page.
            • -
            • #4047 : Delete selected control type element when 'Backspace' is pressed on it.
            • -
            • #4191 : Fixed: dialog changes confirmation on image dialog appeared even when no changes have been made.
            • -
            • #4351 : Dash and dot could appear in attribute names.
            • -
            • #4355 : 'maximize' and 'showblock' commands shouldn't take editor focus.
            • -
            • #4504 : Fixed 'Enter'/'Esc' key is not working on dialog button.
            • -
            • #4245 : 'Strange Template' now come with a style attribute for width.
            • -
            • #4512 : Fixed styles plugin incorrectly adding semicolons to style text.
            • -
            • #3855 : Fixed loading unminified _source files when ckeditor_source.js is used.
            • -
            • #3717 : Dialog settings defaults can now be overridden in-page through the CKEDITOR.config object.
            • -
            • #4481 : The 'stylesCombo_stylesSet' configuration entry didn't work for full URLs.
            • -
            • #4480 : Fixed scope attribute in th.
            • -
            • #4467 : Fixed bug to use custom icon in context menus. Thanks to george.
            • -
            • #4190 : Fixed select field dialog layout in Safari.
            • -
            • #4518 : Fixed unable to open dialog without editor focus in IE.
            • -
            • #4519 : Fixed maximize without editor focus throw error in IE.
            • -
            • Updated the following language files:
            • -
            -

            - CKEditor 3.0

            -

            - New features:

            -
              -
            • #3188 : Introduce - <pre> formatting feature when converting from other blocks.
            • -
            • #4445 : editor::setData now support an optional callback parameter.
            • -
            -

            - Fixed issues:

            -
              -
            • #2856 : Fixed problem with inches in Paste From Word plugin.
            • -
            • #3929 : Using Paste dialog, - the text is pasted into current selection
            • -
            • #3920 : Mouse cursor over characters in - Special Character dialog now is correct
            • -
            • #3882 : Fixed an issue - with PasteFromWord dialog in which default values was ignored
            • -
            • #3859 : Fixed Flash dialog layout in Webkit
            • -
            • #3852 : Disabled textarea resizing in dialogs
            • -
            • #3831 : The attempt to remove the contextmenu plugin - will not anymore break the editor
            • -
            • #3781 : Colorbutton is now disabled in 'source' mode
            • -
            • #3848 : Fixed an issue with Webkit in witch - elements in the Image and Link dialogs had wrong dimensions.
            • -
            • #3808 : Fixed UI Color Picker dialog size in example page.
            • -
            • #3658 : Editor had horizontal scrollbar in IE6.
            • -
            • #3819 : The cursor was not visible - when applying style to collapsed selections in Firefox 2.
            • -
            • #3809 : Fixed beam cursor - when mouse cursor is over text-only buttons in IE.
            • -
            • #3815 : Fixed an issue - with the form dialog in which the "enctype" attribute is outputted as "encoding".
            • -
            • #3785 : Fixed an issue - in CKEDITOR.tools.htmlEncode() which incorrectly outputs &nbsp; in IE8.
            • -
            • #3820 : Fixed an issue in - bullet list command in which a list created at the bottom of another gets merged to the top. -
            • -
            • #3830 : Table cell properties dialog - doesn't apply to all selected cells.
            • -
            • #3835 : Element path is not refreshed - after click on 'newpage'; and safari is not putting focus on document also. -
            • -
            • #3821 : Fixed an issue with JAWS in which - toolbar items are read inconsistently between virtual cursor modes.
            • -
            • #3789 : The "src" attribute - was getting duplicated in some situations.
            • -
            • #3591 : Protecting flash related elements - including '<object>', '<embed>' and '<param>'. -
            • -
            • #3759 : Fixed CKEDITOR.dom.element::scrollIntoView - logic bug which scroll even element is inside viewport. -
            • -
            • #3773 : Fixed remove list will merge lines. -
            • -
            • #3829 : Fixed remove empty link on output data.
            • -
            • #3730 : Indent is performing on the whole - block instead of selected lines in enterMode = BR.
            • -
            • #3844 : Fixed UndoManager register keydown on obsoleted document
            • -
            • #3805 : Enabled SCAYT plugin for IE.
            • -
            • #3834 : Context menu on table caption was incorrect.
            • -
            • #3812 : Fixed an issue in which the editor - may show up empty or uneditable in IE7, 8 and Firefox 3.
            • -
            • #3825 : Fixed JS error when opening spellingcheck.
            • -
            • #3862 : Fixed html parser infinite loop on certain malformed - source code.
            • -
            • #3639 : Button size was inconsistent.
            • -
            • #3874 : Paste as plain text in Safari loosing lines.
            • -
            • #3849 : Fixed IE8 crashes when applying lists and indenting.
            • -
            • #3876 : Changed dialog checkbox and radio labels to explicit labels.
            • -
            • #3843 : Fixed context submenu position in IE 6 & 7 RTL.
            • -
            • #3864 : [FF]Document is not editable after inserting element on a fresh page.
            • -
            • #3883 : Fixed removing inline style logic incorrect on Firefox2.
            • -
            • #3884 : Empty "href" attribute was duplicated on output data.
            • -
            • #3858 : Fixed the issue where toolbars - break up in IE6 and IE7 after the browser is resized.
            • -
            • #3868 : [chrome] SCAYT toolbar options was in reversed order.
            • -
            • #3875 : Fixed an issue in Safari where - table row/column/cell menus are not useable when table cells are selected.
            • -
            • #3896 : The editing area was - flashing when switching forth and back to source view.
            • -
            • #3894 : Fixed an issue where editor failed to initialize when using the on-demand loading way.
            • -
            • #3903 : Color button plugin doesn't read config entry from editor instance correctly.
            • -
            • #3801 : Comments at the start of the document was lost in IE.
            • -
            • #3871 : Unable to redo when undos to the front of snapshots stack.
            • -
            • #3909 : Move focus from editor into a text input control is broken.
            • -
            • #3870 : The empty paragraph - desappears when hitting ENTER after "New Page".
            • -
            • #3887 : Fixed an issue in which the create - list command may leak outside of a selected table cell and into the rest of document.
            • -
            • #3916 : Fixed maximize does not enlarge editor width when width is set.
            • -
            • #3879 : [webkit] Color button panel had incorrect size on first open.
            • -
            • #3839 : Update Scayt plugin to reflect the latest change from SpellChecker.net.
            • -
            • #3742 : Fixed wrong dialog layout for dialogs without tab bar in IE RTL mode .
            • -
            • #3671 : Fixed body fixing should be applied to the real type under fake elements.
            • -
            • #3836 : Fixed remove list in enterMode=BR will merge sibling text to one line.
            • -
            • #3949 : Fixed enterKey within pre-formatted text introduce wrong line-break.
            • -
            • #3878 : Whenever possible, - dialogs will not present scrollbars if the content is too big for its standard - size.
            • -
            • #3782 : Remove empty list in table cell result in collapsed cell.
            • -
            • Updated the following language files:
            • -
            • #3984 : [IE]The pre-formatted style is generating error.
            • -
            • #3946 : Fixed unable to hide contextmenu.
            • -
            • #3956 : Fixed About dialog in Source Mode for IE.
            • -
            • #3953 : Fixed keystroke for close Paste dialog.
            • -
            • #3951 : Reset size and lock ratio options were not accessible in Image dialog.
            • -
            • #3921 : Fixed Container scroll issue on IE7.
            • -
            • #3940 : Fixed list operation doesn't stop at table.
            • -
            • #3891 : [IE] Fixed 'automatic' font color doesn't work.
            • -
            • #3972 : Fixed unable to remove a single empty list in document in Firefox with enterMode=BR.
            • -
            • #3973 : Fixed list creation error at the end of document.
            • -
            • #3959 : Pasting styled text from word result in content lost.
            • -
            • #3793 : Combined images into sprites.
            • -
            • #3783 : Fixed indenting command in table cells create collapsed paragraph.
            • -
            • #3968 : About dialog layout was broken with IE+Standards+RTL.
            • -
            • #3991 : In IE quirks, text was not visible in v2 and office2003 skins.
            • -
            • #3983 : In IE, we'll now - silently ignore wrong toolbar definition settings which have extra commas being - left around.
            • -
            • Fixed the following test cases:
                -
              • #3992 : core/ckeditor2.html
              • -
              • #4138 : core/plugins.html
              • -
              • #3801 : plugins/htmldataprocessor/htmldataprocessor.html
              • -
            • -
            • #3989 : Host page horizontal scrolling a lot when on having righ-to-left direction.
            • -
            • #4001 : Create link around existing image result incorrect.
            • -
            • #3988 : Destroy editor on form submit event cause error.
            • -
            • #3994 : Insert horizontal line at end of document cause error.
            • -
            • #4074 : Indent error with 'indentClasses' config specified.
            • -
            • #4057 : Fixed anchor is lost after switch between editing modes.
            • -
            • #3644 : Image dialog was missin radio lock.
            • -
            • #4014 : Firefox2 had no dialog button backgrounds.
            • -
            • #4018 : Firefox2 had no richcombo text visible.
            • -
            • #4035 : [IE6] Paste dialog size was too small.
            • -
            • #4049 : Kama skin was too wide with config.width.
            • -
            • The following released files now doesn't require the _source folder
                -
              • #4086 : _samples/ui_languages.html
              • -
              • #4093 : _tests/core/dom/document.html
              • -
              • #4094 : Smiley plugin file
              • -
              • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
              • -
            • -
            • #4085 : Paste and Paste from Word dialogs were not well styled in IE+RTL.
            • -
            • #3982 : Fixed enterKey on empty list item result in weird dom structure.
            • -
            • #4101 : Now it is possible to close dialog before gets focus.
            • -
            • #4075 : [IE6/7]Fixed apply custom inline style with "class" attribute failed.
            • -
            • #4087 : [Firefox]Fixed extra blocks created on create list when full document selected.
            • -
            • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
            • -
            • #4111 : Fixed apply block style after inline style applied on full document error.
            • -
            • #3622 : Fixed shift enter with selection not deleting highlighted text.
            • -
            • #4092 : [IE6] Close button was missing for dialog without multiple tabs.
            • -
            • #4003 : Markup on the image dialog was disrupted when removing the border input.
            • -
            • #4096 : Editor content area was pushed down in IE RTL quirks.
            • -
            • #4112 : [FF] Paste dialog had scrollbars in quirks.
            • -
            • #4118 : Dialog dragging was - occasionally behaving strangely .
            • -
            • #4077 : The toolbar combos - were rendering incorrectly in some languages, like Chinese.
            • -
            • #3622 : The toolbar in the v2 - skin was wrapping improperly in some languages.
            • -
            • #4119 : Unable to edit image link with image dialog.
            • -
            • #4117 : Fixed dialog error when transforming image into button.
            • -
            • #4058 : [FF] wysiwyg mode is sometimes not been activated.
            • -
            • #4114 : [IE] RTE + IE6/IE7 Quirks = dialog mispositoned.
            • -
            • #4123 : Some dialog buttons were broken in IE7 quirks.
            • -
            • #4122 : [IE] The image dialog - was being rendered improperly when loading an image with long URL.
            • -
            • #4144 : Fixed the white-spaces at the end of <pre> is incorrectly removed.
            • -
            • #4143 : Fixed element id is lost when extracting contents from the range.
            • -
            • #4007 : [IE] Source area overflow from editor chrome.
            • -
            • #4145 : Fixed the on demand - ("basic") loading model of the editor.
            • -
            • #4139 : Fixed list plugin regression of [3903].
            • -
            • #4147 : Unify style text normalization logic when comparing styles.
            • -
            • #4150 : Fixed enlarge list result incorrect at the inner boundary of block.
            • -
            • #4164 : Now it is possible to paste text - in Source mode even if forcePasteAsPlainText = true.
            • -
            • #4129 : [FF]Unable to remove list with Ctrl-A.
            • -
            • #4172 : [Safari] The trailing - <br> was not been always added to blank lines ending with &nbsp;.
            • -
            • #4178 : It's now possible to - copy and paste Flash content among different editor instances.
            • -
            • #4193 : Automatic font color produced empty span on Firefox 3.5.
            • -
            • #4186 : [FF] Fixed First open float panel cause host page scrollbar blinking.
            • -
            • #4227 : Fixed destroy editor instance created on textarea which is not within form cause error.
            • -
            • #4240 : Fixed editor name containing hyphen break editor completely.
            • -
            • #3828 : Malformed nested list is now corrected by the parser.
            • -
            -

            - CKEditor 3.0 RC

            -

            - Changelog starts at this release.

            - - - + + + + + Changelog — CKEditor + + + + +

            + CKEditor Changelog +

            +

            + CKEditor 3.6

            +

            + New features:

            +
              +
            • #7044 : New BBCode sample plugin that makes the editor output (one dialect of) BBCode format.
            • +
            • #5647 : Accessibility enhancements to the structure of the toolbar.
            • +
            • #5647 : The Kama skin now presents separators for the toolbar items, making it easier to group buttons and have a cleaner layout.
            • +
            • #5647 : Usability enhancements to keyboard navigation on the toolbar. The Tab key is now used to jump between toolbar groups, while the Arrow keys can be used to cycle within the group. The new toolbarGroupCycling setting can be used to change the Arrow keys behavior.
            • +
            • #1376 : It is now possible to put the editor in the "read-only" state, so that the users would not be able to introduce changes to the contents. Check out the new CKEDITOR.editor::setReadOnly method, the CKEDITOR.editor::readOnly property, the CKEDITOR.editor::readOnly event, and the readOnly setting.
            • +
            • #3582 : New presentation of anchor elements in the WYSIWYG mode.
            • +
            • #6737 : The Format drop-down list will now display the preview of its contents exactly as defined in their style configurations.
            • +
            • #6654 : A new autoParagraph configuration setting is added to disable the auto paragraphing feature.
            • +
            • #901 : New Stylesheet Parser (stylesheetparser) plugin that fills the Styles drop-down list based on the CSS classes available for the content. Check the new sample to learn how to use it.
            • +
            • #2988 : New Document Properties (docprops) plugin that sets the metadata of the page in the Full Page mode.
            • +
            • #7240 : New Developer Tools (devtools) plugin that shows information about dialog window UI elements to allow for easier customization.
            • +
            • #6841 : Pressing the Enter key at the end of a pre-formatted block will now exit from it.
            • +
            • #6850 : The About CKEditor dialog window now contains a link to CKEditor User's Guide.
            • +
            • #5745 : Extra configuration options for the iframeDialog can now be passed.
            • +
            • #6589 : The onDialogEvent function will now be used automatically in the iframeDialog contents if no callback is used on creation.
            • +
            • #7757 : Georgian localization added.
            • +
            +

            + Fixed issues:

            +
              +
            • #6774 : Internal styles are not included in the contents.css sample.
            • +
            • #6521 : Added sample for the TableResize plugin.
            • +
            • #6664 : Page break is sometimes merged into block-level elements.
            • +
            • #7594 : Toolbar keyboard navigation is not possible after recreating the editor.
            • +
            • #6657 : Allow to style the entire dialog window field when the input element is disabled.
            • +
            • Updated the following language files:
                +
              • Hebrew;
              • +
              • Polish;
              • +
            • +
            +

            + CKEditor 3.5.4

            +

            + Fixed issues:

            +
              +
            • Added protection against XSS attacks in PHP samples when displaying element names.
            • +
            • #7347 : The Enter key will no longer be caught by the dialog window covering the editor.
            • +
            • #6718 : Paste from Word command overrides the Force Paste as Plain Text configuration.
            • +
            • #6629 : Padding body is no longer needed when the last block is pre-formatted.
            • +
            • #4844 : [IE] Dialog windows fail to load if there are too many editor instances on the page.
            • +
            • #5788 : HTML parser trims empty spaces following <br> elements.
            • +
            • #7513 : Invalid markup could cause the editor to hang.
            • +
            • #6109 : Paste and Paste as Plain Text dialog windows now use the standard commitContent and setupContent methods.
            • +
            • #7588 : The editor code now has a protection system to avoid issues when including ckeditor.js more than once in the page.
            • +
            • #7322 : Text font plugin now recognizes font family names that contain quotes.
            • +
            • #7540 : Paste from Word introduces wrong spaces.
            • +
            • #7697 : Successive calls of the replace() method did not work after SCAYT context menu initialization.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.5.3

            +

            + New features:

            +
              +
            • #4890 : Added the possibility to edit the rel attribute for links.
            • +
            • #7004 : Allow loading plugin translations even if they are not present in the plugin definition.
            • +
            • #7315 : Firing the resize event on dialog window instances is now possible.
            • +
            • #7259 : Dialog window definition allows to specify initial width and height values.
            • +
            • #7131 : List item numbering is now supported on pasting from Microsoft Word.
            • +
            +

            + Fixed issues:

            +
              +
            • #1272 : [WebKit] It is now possible to apply styles to collapsed selections in Safari and Chrome.
            • +
            • #7054 : The tooltips for special characters are now lowercased, making them more readable.
            • +
            • #7102 : "Replace DIV" sample did not work when double-clicking inside the formatted text.
            • +
            • #7088 : Loading of plugins failed on new instances of the editor after the Insert Special Character dialog window was used.
            • +
            • #6215 : Removal of inline styles now also removes overrides.
            • +
            • #6144 : Rich text drop-down lists have wrong height when toolbar is wrapped.
            • +
            • #6387 : AutoGrow may cause an error when editor instance is destroyed too quickly after a height change.
            • +
            • #6901 : Mixed direction content was not properly respected in a shared toolbar setting.
            • +
            • #4809 : Table-related tags are output in wrong order.
            • +
            • #7092 : Corrupted toolbar button state for inline style after switching to Source.
            • +
            • #6921 : Pasted text marked by SCAYT in one language is not re-checked if another spellchecking language is selected in the editor.
            • +
            • #6614 : Enhancement of the resize handle in RTL.
            • +
            • #5924 : Flash plugin now recognizes Flash content without an embed tag.
            • +
            • #4475 : Protected source in attributes and inline CSS text is not handled correctly.
            • +
            • #6984 : [FF] Trailing line breaks are lost in ENTER_BR.
            • +
            • #6987 : [IE] Text selection lost when calling editor::insertHtml from a dialog window in some situations.
            • +
            • #6865 : BiDi mirroring does not work when a text direction change is done through a dialog window.
            • +
            • #6966 : [IE] Unintended paragraph is created in an empty document in enterMode set for BR and DIV.
            • +
            • #7084 : SCAYT dialog window is now working properly with more than one editor instance in a page.
            • +
            • #6662 : [FF] List structure pasting error caused by a regression from FF3.5.x is now fixed.
            • +
            • #7300 : Link dialog window now loads numeric values correctly.
            • +
            • #7330 : New list items no longer inherit the value attribute from their sibling.
            • +
            • #7293 : The "Automatic" color button is now presented correctly without focus inside the editor.
            • +
            • #7018 : [IE] Toolbar drop-down lists did not have a border around them.
            • +
            • #7073 : Image dialog window no longer allows zero height and width value to be entered.
            • +
            • #7316 : [FF] Clicking on "Paste" button incorrectly breaks the line at the cursor position.
            • +
            • #6751 : Inline whitespaces are incorrectly stripped when pasting from Word.
            • +
            • #6236 : [IE] Fixing malformed nested list structure which was introduced by the Backspace key.
            • +
            • #6649 : [IE] Selection of the full table sometimes does not work.
            • +
            • #6946 : HTML parser is now able to fix orphan list items.
            • +
            • #6861 : Indenting a list item should retain the text direction.
            • +
            • #6938 : Outdenting a list item should retain the text direction.
            • +
            • #6849 : Correct Enter key behavior on list item.
            • +
            • #7113 : [WebKit] Undesired document scroll on click after scrolling.
            • +
            • #6491 : Undesired Image dialog window dimension lock reset on URL change.
            • +
            • #7284 : [FF Quirks] Maximize now works correctly.
            • +
            • #6609 : [IE9] Browser in high contrast mode is not properly detected.
            • +
            • #7222 : [WebKit] Impossible to apply a single style to a collapsed selection without giving the editor focus.
            • +
            • #7180 : [IE9] When using Kama skin and RTL layout dialog window buttons were not being displayed correctly.
            • +
            • #7182 : [IE9] When using Office2003/v2 skin and RTL layout dialog window shadows were corrupted.
            • +
            • #6913 : Invalid escape sequence (\b) was used in the PHP integration.
            • +
            • #5757 : [IE6] Text was not wrapping in the accessibility instructions dialog window.
            • +
            • [6604] : Xml.js and Ajax.js are now available as plugins ('xml' and 'ajax').
            • +
            • #7304 : Microsoft Word cleanup function is not always invoked when clicking on the "Paste From Word" button.
            • +
            • #6658 : [IE] Pasting text from Microsoft Word with one or more tabs between list items was failing.
            • +
            • #7433 : [IE9] ENTER_BR at the end of a block breaks due to an IE9 regression.
            • +
            • #7432 : [WebKit] Unable to create a new list in an empty document.
            • +
            • #4880 : CKEditor changes tag style inside HTML comment with cke_protected.
            • +
            • #7023 : [IE] JavaScript error when a Selection Field is inserted into a page.
            • +
            • #7034 : Inserting special characters into styled text.
            • +
            • #7132 : Paste toolbar buttons are becoming disabled.
            • +
            • #7138 : The api.html sample in Opera does not work as expected.
            • +
            • #7160 : Cannot paste the form element on top of the page.
            • +
            • #7171 : Double-clicking an image in non-editable content opens the editing dialog window.
            • +
            • #7455 : Extra line break is added automatically to the preformatted element.
            • +
            • #7467 : [Firefox] Extra br element is added in a nested list.
            • +
            • Updated the following language files:
                +
              • #7124 : Czech;
              • +
              • #7126 : French;
              • +
              • #7140 : Catalan;
              • +
              • #7215 : Faroese;
              • +
              • #7177 : Finnish;
              • +
              • #7163 : Norwegian (no and nb);
              • +
              • #7219 : Swedish;
              • +
              • #7183 : Afrikaans;
              • +
              • Hebrew;
              • +
              • Spanish;
              • +
              • Polish;
              • +
              • German;
              • +
            • +
            +

            + CKEditor 3.5.2

            +

            + Fixed issues:

            +
              +
            • #7168 : [IE9] Destroying an editor instance throws an error.
            • +
            • #7169 : [IE9] Menu item has incorrect height.
            • +
            • #7178 : [IE9] Read-only attributes do not work in IE9.
            • +
            • #7181 : [IE9] Toolbar items are not aligned in v2 and Office2003 skins.
            • +
            • #7174 : [IE9] Elements path does not load correctly when the editor is switched back from Source to WYSIWYG.
            • +
            +

            + CKEditor 3.5.1

            +

            + New features:

            +
              +
            • #6107 : It is now possible to remove block styles using Styles and Paragraph Format drop-down lists.
            • +
            • #5590 : Remove Format command works in collapsed selections.
            • +
            • #5755 : The dialog_buttonsOrder option now works in Internet Explorer.
            • +
            • #6869 : The data-cke-nostyle attribute (which was introduced for escaping the element from been influenced by the style system since 3.5) is deprecated in favor of the new data-nostyle attribute.
            • +
            • Revised sample pages with code examples and clarifications.
            • +
            +

            + Fixed issues:

            +
              +
            • #5855 : Updating a link multiple times generates wrong href attribute.
            • +
            • #6166 : Error on Maximize command, when the toolbar button is not shown.
            • +
            • #6607 : Table cell "merge down" and "merge right" commands work only once.
            • +
            • #6228 : Merge down does not work, throwing a JavasSript error.
            • +
            • #6625 : BIDI: Mixed LTR/RTL direction causes incorrect behavior.
            • +
            • #6881 : IFrame capitalization is now consistent throughout labels.
            • +
            • #6686 : BIDI: [FF] When we apply explicit language direction to a numbered/bulleted list, the corresponding language direction toolbar icon is not highlighted.
            • +
            • #6566 : It is now possible to exit a blockquote using ENTER_BR.
            • +
            • #6868 : Partial (invalid) list structure crashes the editor on load.
            • +
            • #6804 : Buggy behavior when editing the legend element inside a fieldset.
            • +
            • #6724 : [IE7] Nested list display bug on empty list item.
            • +
            • #6715 : List items do not create paragraphs after the list placed in a table cell is removed.
            • +
            • #6695 : [Webkit] Display bug after the editor is restored from the full screen mode.
            • +
            • #6661 : [IE] Pre-formatted style does not preserve applied text direction.
            • +
            • #6655 : Using the editor resize grip causes small visual offsets.
            • +
            • #6604 : The div element should be used as a formatting block in ENTER_BR.
            • +
            • #6249 : BIDI: List item bullets are off viewport with RTL text direction.
            • +
            • #6610 : BIDI: ENTER_BR change direction in one line out of multiple.
            • +
            • #6872 : [IE] Link target field is not populated properly when no target is set.
            • +
            • #6880 : Samples: Added a user-friendly message for users on servers without PHP support.
            • +
            • #6628 : Setting config.enterMode from PHP fails.
            • +
            • #6278 : Comments were moved above the br tags.
            • +
            • #6687 : Empty tag should be removed in inline-style format.
            • +
            • #6645 : Allow to configure whether " (double quotes) characters should be encoded in the contents.
            • +
            • #6336 : IE: (double)clicking an input type="submit" button submitted the form.
            • +
            • #6646 : Context menu was not working for text inputs present in the initial content.
            • +
            • #6641 : Copying and pasting links inside the editor was not working.
            • +
            • #4208 : The disableObjectResizing setting now works in IE.
            • +
            • #6242 : [IE] Editing existing links with href of a relative path mangles containing text.
            • +
            • #5930 : [IE] Style definitions are no longer lowercased.
            • +
            • #5361 : Preview window's title should reflect the title tag in full page mode.
            • +
            • #5522 : [IE] In versions < 8 or compatibility mode, type="text" was missing in text fields.
            • +
            • #6126 : [IE] Avoid problems if there are two buttons named "submit".
            • +
            • #6791 : [IE7] Editor did not show up when the name of a replaced textarea matched the name of a meta tag in the page.
            • +
            • #5684 : [FF] When forcePasteAsPlainText is used, the cursor disappears after paste.
            • +
            • #6390 : Prevent toolbar dialog window buttons from being clicked twice.
            • +
            • #6684 : [Webkit] Toolbar buttons are not wrapping correctly when the editor is displayed inside a table.
            • +
            • #6703 : [IE] editor focus event not fired in an instance, when a dialog window closes.
            • +
            • #6873 : Difficult to drag the resize grip of the spell checker dialog window.
            • +
            • #6896 : [Webkit] Unable to paste into source area when the editor is maximized.
            • +
            • #6020 : The state of the Cut, Copy, and Paste toolbar now matches the state of the context menu buttons.
            • +
            • #5256 : JavaScript error thrown when percent (%) sign is used in image URL.
            • +
            • #6577 : [FF] Selection error when an element containing the editor instance is hidden.
            • +
            • #5500 : [IE] value attribute of text input dialog window field was missing.
            • +
            • #6665 : [IE] name field of Link dialog window was missing.
            • +
            • #6639 : Line-breaks inside pasted list item from Microsoft Word break the list structure.
            • +
            • #6909 : [IE] GIF icons of toolbar button from custom plugins are not diplayed in zoom level 100%.
            • +
            • #6860 : [FF] Double-clicking the placeholder element in order to open a Placeholder dialog window throws a JavaScript error.
            • +
            • #6630 : Empty pre elements are output differently in various browsers.
            • +
            • #6568 : Insert table row/column does not work with spanning.
            • +
            • #6735 : Inaccurate read-only selection detection.
            • +
            • #6728 : BIDI: Change direction does not work with list nested inside a blockquote.
            • +
            • #6432 : Inserting a table in place of a fully selected list results in a JavaScript error.
            • +
            • #6438 : [IE] Performance enhancement when typing inside an element with many child nodes.
            • +
            • #6970 : [IE] Dialog window shadows were presented inaccurately.
            • +
            • #6672 : [IE] Unnecessary br element is no longer inserted after a form.
            • +
            • #7087 : [FF] Sometimes it was not possible to move cursor out of link at the end of block.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.5

            +

            + New features:

            +
              +
            • #4090 : Full Adobe AIR support.
            • +
            • #5084 : Dialog windows are now resizable with a grip located in the footer.
            • +
            • #5755 : Introduced the dialog_buttonsOrder setting, making it possible to control the buttons order.
            • +
            • #4648 : Added the new iFrame plugin.
            • +
            • #6010 : The Automatic option of the font/background color panel now represents the real color.
            • +
            • #5654 : New "placeholder" plugin.
            • +
            • #6334 : CKEditor now uses HTML5's data-* attributes for its internal attributes.
            • +
            • #6103 : It's now possible to control the styling of inline read-only elements with the disableReadonlyStyling setting. It's also possible to avoid inline-styling any element by setting its "data-cke-nostyle" attribute to "1".
            • +
            • #5404 : fillEmptyBlocks configuration option of v2 is now available.
            • +
            • #5367 : New CKEDITOR.editor#insertText method (check api.html sample page for usages) is now provided to insert plain text into editor.
            • +
            • #5915 : New removeDialogTabs configuration option to hide certain dialog tabs.
            • +
            +

            + Fixed issues:

            +
              +
            • #4821 : Icons in the toolbar were distorted with IE and zoom != 100%.
            • +
            • #5587 : Visual improvements in dialogs, reinforce field label on separate line.
            • +
            • #4652 : Now it's able to disable editor context menu by simply removing the "contextmenu" plugin.
            • +
            • #5599 : Labels of "specialchar" dialog are now translated.
            • +
            • #6419 : [IE] List creation by merging problem.
            • +
            • #6502 : Removed IE6 image preloading, which was used to defect the duplicate request of background images.
            • +
            • #6822 : Added labels to fake objects.
            • +
            • #6898 : [IE6] Toolbar icons becomes invisible in RTL.
            • +
            • Updated the following language files:
                +
              • Hebrew
              • +
            • +
            +

            + CKEditor 3.4.3

            +

            + Fixed issues:

            +
              +
            • #6554 : [Webkit] cannot type after inserting Page Break.
            • +
            • #6569 : Indentation now complies with text direction of the only item.
            • +
            • #6579 : The jQuery adapter was not working properly and was turned on in incompatible environments.
            • +
            • #6644 : Restrict onmousedown handler to the toolbar area.
            • +
            • #6656 : Panelbutton's buttons became active when clicking on Source.
            • +
            • #6248 : Whitespaces (nbsp elements) were incorrectly added into empty table cells and list items.
            • +
            • #6575 : Tabs disappearing in Link dialog window after a specific sequence of actions.
            • +
            • #6510 : Margin mirroring does not respect style configuration.
            • +
            • #6471 : BIDI: Pressing Decrease Indent in an RTL bulleted list causes incorrect behaviour.
            • +
            • #6479 : BIDI: Language direction is not being preserved when pressing Enter after a Paragraph Format was applied.
            • +
            • #6670 : BIDI: Indent & List icons are not reversed when we apply RTL direction to a paragraph with any of Paragraph Formatting options.
            • +
            • #6640 : Floating panels are now being closed when switching modes.
            • +
            • #4790 : Remove list with multiple items in enterBr doesnot preserve line breaks.
            • +
            • #6297 : Floated inline elements are not taking part in behavior of blocks anymore.
            • +
            • #6171 : [Firefox] Opening rich content drop-down list scrolls host page to the top when editor has a vertical scrollbar.
            • +
            • #6330 : List markers from MS Word with Roman numbering are not preserved.
            • +
            • #6720 : Attribute protection might detect wrong elements.
            • +
            • #6580 : [IE9] Flash dialog window does not get filled up.
            • +
            • #6447 : Decreasing indentation of a list with indentClasses config does not work.
            • +
            • #5894 : Adding custom buttons at the bottom of a dialog window does not cause it to expand to include its contents.
            • +
            • #6513 : Wrong ARIA attributes created on list options of Styles drop-down list.
            • +
            • #6150 : [Safari] Color dialog window was broken.
            • +
            • #6747 : Full screen layout issue caused by page element focus outside editor.
            • +
            • #6779 : Clicking the body element on elements path turns the selection on and off immediately.
            • +
            • #6781 : [IE7] Dialog windows are broken with RTL, Office 2003 and v2 skins.
            • +
            • #6798 : [IE7] Dialog window buttons disappearing in RTL after dragging.
            • +
            • #6806 : [IE7] Dialog window buttons invisible on focus.
            • +
            • #6588 : Copy and paste adds <span> if SCAYT is enabled.
            • +
            • #6673 : IE Target combo for Image Link shown as blank even when we select <not set> as an option.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.4.2

            +

            + New features:

            +
              +
            • #5024 : Added a sample that shows how to output HTML that is valid for Flash.
            • +
            +

            + Fixed issues:

            +
              +
            • #5237 : English text in dialogs' title was flipped when using RTL language (office2003 and v2 skins).
            • +
            • #6289 : Deleting nested table removed the parent cell.
            • +
            • #6341 : The editor contents now have the text cursor.
            • +
            • #6153 : Chrome: tab focus is wrong.
            • +
            • #6261 : Focus and infinite loop between multiple editors.
            • +
            • #6170 : Dedicated class names are removed from floating panels when opening another panel.
            • +
            • #6339 : Autogrow plugin now doesn't work on maximized editors.
            • +
            • #6237 : BIDI: Applying same language direction to all paragraphs not working.
            • +
            • #6353 : [IE] Resize was broken with office2003 and v2 skins.
            • +
            • #6375 : Avoiding errors when hiding the editor after the blur event.
            • +
            • #6133 : Styled paragraphs result on buggy list creation.
            • +
            • #5074 : Link target is not removed when changing to popup.
            • +
            • #6408 : [IE] Autogrow now works correctly on Quirks.
            • +
            • #6420 : [IE] The table properties dialog now correctly retrieves the caption text.
            • +
            • #6141 : It was impossible to outdent a list when indentOffset was set to 0.
            • +
            • #6377 : FF width and height are not shown for smiley in Image properties dialog.
            • +
            • #5399 : Lists pasted from Word do not maintain their nesting.
            • +
            • #6225 : [FF] Cannot transform several lines to list with enterMode BR.
            • +
            • #6467 : [FF] It is now possible to disable the plugin command on "mode" event.
            • +
            • #6461 : Attributes are now being kept when changing block formatting.
            • +
            • #6226 : BIDI: Language direction applied to a Paragraph is removed when we apply one of Paragraph formatting options.
            • +
            • #5395 : [Opera] Native context menu incorrectly opened after Opera 10.2.
            • +
            • #6444 : [Opera] Close panels and dialogs don't return focus to wysiwyg frame.
            • +
            • #6332 : IE: V2 skin bottom dialog's border broken.
            • +
            • #5646 : Parser incorrectly removes inline element when there's only one comment node enclosed.
            • +
            • #6189 : Minor code size reduction.
            • +
            • #5045 : uiColor behaved wrong if multiple editors were used with period in their names.
            • +
            • #5766 : Config entry "ignoreEmptyParagraph" should only remove one single empty paragraph in document.
            • +
            • #5931 : Unable to apply inline style because of nested elements with same style name.
            • +
            • #6083 : Dialog close sometimes cause collapsed editor selection before the insertion.
            • +
            • #6253 : BIDI: creating a Numbered/Bulleted list causing improper behavior on bidi.
            • +
            • #4023 : [Opera] Maximize plugin.
            • +
            • #6403 : [Opera] Font name options are not correctly marked in dropdown list.
            • +
            • #4534 : [Opera] Arrow key to navigate through combo list has side effects of window scrolling.
            • +
            • #6534 : [Opera] Menu key brings up both CKEditor and browser context menu.
            • +
            • #6534 : [Opera] Menu key brings up both CKEditor and browser context menu.
            • +
            • #6416 : [IE9] Unable to make text selection with mouse in source area.
            • +
            • #6417 : [IE9] Context menu opens at the upper-left corner always.
            • +
            • #6501 : [IE9] Context menu item layout is broken.
            • +
            • #6099 : BIDI: when we apply explicit language direction to Numbered/Bulleted List the corresponding BIDI Tool bar icon is not highlighted in the Toolbar.
            • +
            • #6100 : BIDI: when we change Table language direction indentation of text in Table cells is not applied correctly.
            • +
            • #6376 : BIDI: buttons should not toggle the base language direction.
            • +
            • #6235 : BIDI: Applying direction to multi-paragraph selection within a div.
            • +
            • #6187 : [IE6] Multi-instance loading produces 404s on background images.
            • +
            • #5446 : Setting config.filebrowserImageBrowseUrl results in displaying also Browser Server on links.
            • +
            • #5626 : CKeditor 3.2.1 : html content attached makes ckeditor crash the browser FF/IE.
            • +
            • #6508 : BiDi: Margin mirroring logic doesn't honor CSS direction.
            • +
            • #6043 : BIDI: When we apply RTL direction to a right aligned Paragraph, Paragraph is not moved to the left & Alignment of Paragraph is not changed.
            • +
            • #6485 : BIDI: When direction is applied on partial selected list, the style is been incorrectly applied to the entire list.
            • +
            • #6087 : Cursor of input fields in dialog isn't visible in RTL.
            • +
            • #5595 : Extra leading spaces added in preformatted block.
            • +
            • #6094 : Match full word option doesn't stop on block boundaries.
            • +
            • #5730 : [Safari] Continual pastes (holding paste key) breaks document contents.
            • +
            • #5850 : [IE] Inline style misbehaviors at the beginning of numbered/bulleted list.
            • +
            • Updated the following language files:
                +
              • #6427 : Ukrainian;
              • +
              • #6464 : Finnish;
              • +
              • Hebrew;
              • +
            • +
            +

            + CKEditor 3.4.1

            +

            + New features:

            + +

            + Fixed issues:

            +
              +
            • #6027 : Modifying Table Properties by selecting more than one cell caused issues.
            • +
            • #6146 : IE: Floating panels were being opened in the wrong place in RTL pages with horizontal scrollbars.
            • +
            • #6055 : The timestamp is now added only once to each loaded file.
            • +
            • #6097 : The bookmarks now use the right name.
            • +
            • #5717 : Removed the scayt_contextMenuOntop setting and the SCAYT context menu options are always on top.
            • +
            • #5956 : [FF] It was impossible to create an editor inside an hidden container.
            • +
            • #5753 : It was impossible to have a default value for the name field in the select dialog.
            • +
            • #6041 : BIDI: Direction of Increase Indent & Decrease Indent icons are not reversed after changing Lang direction to RTL.
            • +
            • #6138 : List indentation is not working.
            • +
            • #5649 : Image dialog too wide when many styles are set.
            • +
            • #5715 : Cell color picker dialog returns focus to document.
            • +
            • #6108 : Fixed div style.
            • +
            • #5336 : Remove object style.
            • +
            • #6155 : [[FF]] Modifying Table Header Properties by selecting first Row, causing several issues.
            • +
            • #6163 : Focus not going to Tabs in Image dialog when we went to Edit the Image.
            • +
            • #6177 : IE we can't start Numbered/Bulleted list on a Empty page.
            • +
            • #5413 : Browser error after pasting html table in CKEditor.
            • +
            • #6034 : Horizontal Alignment applied to Table cell is not updated correctly in the Toolbar.
            • +
            • #6112 : BIDI: Alignment set to text in Table cell is not shown in the Tool bar when we press Enter to start a new Paragraph.
            • +
            • #6117 : BIDI: Language direction is changing when we come out of Numbered/Bulleted list.
            • +
            • #6182 : Language Direction field on the Advanced tab of Table Properties dialog has a fixed pixel width.
            • +
            • #5487 : Fullpage writer problem with line-break.
            • +
            • #6197 : The CKEDITOR.loader base path auto-detection was not working with the _source folder.
            • +
            • #6240 : Font Names & Font Sizes should be shown Left Align even for RTL Languages.
            • +
            • #5975 : Page-break should have proper Alt Text instead of Unknown object. so that JAWS reads it properly.
            • +
            • #6255 : Inserting a page break as the first node triggered an error.
            • +
            • #6188 : [IE7] Automatic color button had the wrong cursor.
            • +
            • #6129 : The show blocks' labels are now shown in the right for RTL languages.
            • +
            • #5421 : &shy; entity not converted when config.entities=false.
            • +
            • #5769 : xhtml code generation problem &nbsp; instead of &#160; (htmlentities, entities,entities_additional,..., configuration).
            • +
            • #4472 : [FF3] Browser window scrolls to loaded CKEditor.
            • +
            • #6230 : Fixed invalid parameter count for setTimeout function call.
            • +
            • #5335 : Several lines' formatted data will be merged to one line when we apply Numbers/Bullets.
            • +
            • #5353 : wrong width of editor after resize() called in Firefox 3.6.
            • +
            • #5778 : [IE] Unwanted scroll on first mouse right-click.
            • +
            • #5218 : [FF] Copy/paste of an image from same domain changed URL to relative URL.
            • +
            • #6265 : Popup window properties were visible in the link dialog's target tab when nothing was selected.
            • +
            • #6075 : [FF] Newly created links didn't fill in information on edit.
            • +
            • #6183 : The toolbar panels options sometimes had the contents' link color.
            • +
            • #6192 : [WebKit] Inserting smileys was not working because of editor focus issues.
            • +
            • #6178 : [WebKit] Inserting elements by code was failing if the editor didn't receive the focus first.
            • +
            • #6179 : [WebKit] The Image dialog was not working if the editor didn't receive the focus first.
            • +
            • #4657 : [Opera] Styles where not working with collapsed selections.
            • +
            • #5839 : "Insert row after" was removing the ids of the elements from the clicked row.
            • +
            • #6315 : DIV plugin TT #2885 regression.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.4

            +

            + Fixed issues:

            +
              +
            • #6118 : Initial focus is now set to the tabs in the table properties dialog.
            • +
            • #6135 : The dialogadvtab plugin now uses the correct label.
            • +
            • #6125 : Focus was lost after applying commands in Opera.
            • +
            • #6137 : The table dialog was missing the default width value on second opening.
            • +
            +

            + CKEditor 3.4 Beta

            +

            + New features:

            +
              +
            • #5909 : New BiDi feature, making it possible to switch the base language direction of block elements.
            • +
            • #5268 : Introducing the "tableresize" plugin, which makes it possible to resize tables columns by mouse drag. It's not enabled by default, so it must be enabled in the configurations file.
            • +
            • #979 : New enableTabKeyTools configuration to allow using the TAB key to navigate through table cells.
            • +
            • #4606 : Introduce the "autogrow" plugin, which makes the editor resize automatically, based on the contents size.
            • +
            • #5737 : Added support for the HTML5 contenteditable attribute, making it possible to define read only regions into the editor contents.
            • +
            • #5418 : New "Advanced" tab introduced on the Table Properties dialog. It's based on the new dialogadvtab plugin.
            • +
            • #6082 : Introduced the useComputedState setting, making it possible to control whether toolbar features, like alignment and direction, should reflect the "computed" selection states, even when the effective feature value is not applied.
            • +
            +

            + Fixed issues:

            +
              +
            • #5911 : BiDi: List items should support and retain correct base language direction
            • +
            • #5689 : Make it possible to run CKEditor inside of Firefox chrome.
            • +
            • #6042 : It wasn't possible to align a paragraph with the dir attribute to the opposite direction.
            • +
            • #6058 : Fixed a small style glitch with file upload fields in IE+Quirks.
            • +
            +

            + CKEditor 3.3.2

            +

            + New features:

            +
              +
            • #5882 : Introduce the dialog#selectPage event, replicating the OnDialogTabChange feature available in FCKeditor 2.
            • +
            • #5927 : The native controls in ui.dialog.elements can be styled with the controlStyle definition.
            • +
            +

            + Fixed issues:

            +
              +
            • #1644 : Removed references to cursor:hand in the stylesheets.
            • +
            • #5411 : Anchor, hidden fields and Page-Break objects can no longer be resized.
            • +
            • #5456 : Initial focus incorect in api_dialog sample page.
            • +
            • #5628 : Incorrect <pre> siblings merging.
            • +
            • #5829 : Adding validation for start number field in list style dialog.
            • +
            • #5845 : Context menu on empty list item loses selection.
            • +
            • #5860 : [IE] > in attribute values are incorrectly escaped.
            • +
            • #5905 : SCAYT is not any more enabled by default.
            • +
            • #5736 : Improved the text generated for mailto: links if no text was selected.
            • +
            • #4779 : Adjust resize_minWidth and resize_minHeight if smaller than actual dimensions.
            • +
            • #5687 : Navigation through colors is now compatible with RTL.
            • +
            • #4615 : [IE] Text fields are no longer disrupted in dialog with RTL.
            • +
            • #5887 : The number of columns in the smileys table is now configurable via the smiley_columns setting.
            • +
            • #5100 : It was possible to drag&drop some elements like context menu items or dropdown entries.
            • +
            • #5933 : Text color and background color panels don't have scrollbars anymore under office2003 and v2 skins.
            • +
            • #5943 : An error is no longer generated when using percent or pixel values in the image dialog.
            • +
            • #5951 : Avoid problems with security systems due to the usage of UniversalXPConnect.
            • +
            • #5441 : Avoid errors if the editor instance is removed from the DOM before calling its destroy() method.
            • +
            • #4997 : Provide better access to the native input in the ui.dialog.file element.
            • +
            • #5914 : Modified the Smileys dialog to make active only the images and not their borders.
            • +
            • #5565 : The scrollbar does not behaves erratically when opening a rich combo in RTL page.
            • +
            • #5843 : In CKEditor 3.3: When we set the focus in the 'instanceReady' event, FF3.6 is giving js error.
            • +
            • #5902 : paste and pastetext dialogs cannot be skinned easily.
            • +
            • #5959 : Dialog auto focus does not check for hidden tabs.
            • +
            • #5415 : Undo not working when we change the Table Properties for the table on a saved page.
            • +
            • #5435 : IE: we can't start Numbered/Bulleted list in Tables by Clicking on Insert/Remove Numbers/Bullets Icon.
            • +
            • #5832 : The JQuery adapter sample is not working properly with SSL.
            • +
            • #5728 : Text field & Upload Button in Upload Tab of Image Properties dialog are not shown Properly in Arabic.
            • +
            • #5436 : IE: Cursor goes to next Table Cell after we insert a Smiley in the Table Cell.
            • +
            • #5580 : Maximize does not work properly in the Office 2003 and V2 skins.
            • +
            • #5495 : The link dialog was breaking the undo system on some situations.
            • +
            • #5775 : Required field's label to contain a CSS class to allow it to be styled differently.
            • +
            • #5999 : Table dialog rows and columns fields are now marked as required.
            • +
            • #5693 : baseHref detection in the flash dialog now works correctly.
            • +
            • #5690 : Table cell's width attribute is now respected properly.
            • +
            • #5819 : Introducing the new removeFormatCleanup event and making sure remove format doesn't break the showborder plugin.
            • +
            • #5558 : After pasting on WebKit based browsers the editor now scrolls to the end of the pasted content.
            • +
            • #5799 : Correct plugin dependencies for the liststyle plugin with contextMenu and dialog.
            • +
            • #5436 : IE: The cursor was moving to the wrong position when inserting inline elements at the end of cells on tables.
            • +
            • #5984 : Firefox: CTRL+HOME was creating an unwanted empty paragraph at the start of the document.
            • +
            • #5634 : IE: It was needed to click twice in the editor to make it editable on some situations.
            • +
            • #5338 : Pasting from Open Office could lead on error.
            • +
            • #5224 : Some invalid markup could break the editor.
            • +
            • #5455 : It was not possible to remove formatting from pasted content on specific cases.
            • +
            • #5735 : IE: The editor was having focus issues when the previous selection got hidden by scroll operations.
            • +
            • #5563 : Firefox: The disableObjectResizing and disableNativeTableHandles settings stopped working.
            • +
            • #5781 : Firefox: Editing was not possible in an empty document.
            • +
            • #5293 : Firefox: Unwanted BR tags were being left in the editor output when it should be empty.
            • +
            • #5280 : IE: Scrollbars where reacting improperly when clicking in the bar space.
            • +
            • #5840 : Some dialog access keys are conflicting with "Ctrl + A", select all text behavior on text input.
            • +
            • #6059 : Changing list type didn't preserve the list's attributes.
            • +
            • #5193 : In Firefox, the element path options had the text cursor instead of the arrow.
            • +
            • #6073 : The list context menu was showing the wrong option when in a mixed list hierarchy.
            • +
            • #6074 : The Insert Table Column command was duplicating the selected column cells ids.
            • +
            • #6066 : The toolbar combos had the text cursor instead of the arrow.
            • +
            • #6062 : The toolbar buttons had the text cursor instead of the arrow.
            • +
            • #6068 : [IE7] A few labels were hidden in a RTL language.
            • +
            • #6000 : Safari and Chrome where scrolling the contents to the top when moving the focus to the editor.
            • +
            • #6090 : IE: Textarea with selection inside causes Link dialog issues.
            • +
            • #5079 : Page break in lists move to above the list when you switch from WYSIWYG to HTML mode and back.
            • +
            • Updated the following language files:
                +
              • Chinese Simplified;
              • +
              • Hebrew;
              • +
              • #5962 : German;
              • +
              • #5645 : Portuguese;
              • +
              • #5797 : Turkish;
              • +
            • +
            +

            + CKEditor 3.3.1

            +

            + Fixed issues:

            +
              +
            • #5780 : Text selection lost when opening some of the dialogs.
            • +
            • #5787 : Liststyle plugin wasn't packaged into the core (CKEDITOR.resourceManager.load exception).
            • +
            • #5637 : Fix wrong nesting that generated "<head> must be a child of <html>" warning in Webkit.
            • +
            • #5790 : Internal only attributes output on fullpage <html> tag.
            • +
            • #5761 : [IE] Color dialog matrix buttons are barely clickable in quirks mode.
            • +
            • #5759 : [IE] Clicking on the scrollbar and then on the host page causes error.
            • +
            • #5772 : List style dialog is missing tab page ids.
            • +
            • #5782 : [FF] Wysiwyg mode is broken by 'display' style changes on editor's parent DOM tree.
            • +
            • #5801 : [IE] contentEditable="false" doesn't apply in effect on inline-elements.
            • +
            • #5794 : Empty find matching twice results in JavaScript error.
            • +
            • #5732 : If it isn't possible to connect to the SCAYT servers the dialogs might hang in Firefox. Fix for Firefox>=3.6.
            • +
            • #5807 : [FF2] New page command results in uneditable document.
            • +
            • #5807 : [FF2] SCAYT plugin is disabled in Firefox2 due to selection interference.
            • +
            • #5772 : [IE] Some numbered list style types are not supported by IE6/7 and causes JavaScript error.
            • +
            +

            + CKEditor 3.3

            +

            + New features:

            +
              +
            • #635 : The properties dialog will now open when double clicking on objects.
            • +
            • #3893 : It's now possible to indent/outdent lists when selecting the first list item.
            • +
            • #4968 : The contentsLangDirection setting now has a default value 'ui' which inherit language direction from the editor UI language.
            • +
            • #4649 : The color picker dialog is now accessible.
            • +
            • #3593 : The editing area is now enabled by contentEditable="true" instead of designMode="on" to allow creating uneditable content elements in all browsers.
            • +
            • #4056 : Hidden fields will now be displayed as fake element just like in FCKeditor 2.
            • +
            +

            + CKEditor 3.2.2

            +

            + New features:

            +
              +
            • The SCAYT spell checker is now enabled by default through the autoStartup setting.
            • +
            • #5631 : The SCAYT context menu options can now be reorganized through the scayt_contextMenuItemsOrder setting.
            • +
            • #4231 : Introducing the resize_dir setting, to be able to restrict manual resizing of the editor to only one direction (horizontal/vertical).
            • +
            • #5479 : Introducing the classic ASP integration files and samples.
            • +
            • #5024 : Added samples (HTML and XHTML) to show how to output HTML using fonts and other attributes instead of styles.
            • +
            • #4358 : Introduced the List Properties dialog.
            • +
            • #5485 : Adding the contentsLanguage configuration option to be able to set the language for the editor contents.
            • +
            +

            + Fixed issues:

            +
              +
            • #5330 : Corrected detection of CTRL and META keys in Macs for the context menu.
            • +
            • #5434 : Fixed access denied issues with IE when accessing web sites through IPv6 IP addresses.
            • +
            • #4476 : [IE] Inaccessible empty list item contains sub list.
            • +
            • #4881 : [IE] Selection range broken because of cutting a single control type element from it.
            • +
            • #5505 : Image dialog throw JavaScript error when click close dialog before preview area is loading.
            • +
            • #5144 : [Chrome] Paste in Webkit sometimes leaves extra 'div' element.
            • +
            • #5021 : [Firefox] Typing in empty document start from second line when enterMode = CKEDITOR.ENTER_BR.
            • +
            • #5416 : [IE] Delete table throws a error when enterMode = CKEDITOR.ENTER_BR.
            • +
            • #4459 : [IE] Select element is penetrating the maximized editor in IE6.
            • +
            • #5559 : [IE] The first call to setData is affected by iframe cache when loading the wysiwyg mode.
            • +
            • #5567 : [IE] Remove inline styles in some case doesn't join identical siblings.
            • +
            • #5450 : [FireFox] Press ENTER on 'replace' button result wrong.
            • +
            • #5121 : Recognizes the <br /> tag as a separator when apply block styles and enterMode = CKEDITOR.ENTER_BR.
            • +
            • #5575 : CKEDITOR.replaceAll should consider all kind of white spaces between class names.
            • +
            • #5582 : Prevent the default behavior when click the 'x' button to close dialog box.
            • +
            • #5584 : ENTER key with forceEnterMode turns on doesn't inherit current block attributes.
            • +
            • #4797 : [Opera] Press ENTER key in dialog fields to close throws JavaScript error.
            • +
            • #5578 : Add flash fake element align property when switch mode (source to wysiwyg).
            • +
            • #5577 : Update delete column behavior when choose multiple cells in the same column.
            • +
            • #5512 : Open context menu with SHIFT+F10 doesn't get correct editor selection.
            • +
            • #5433 : English protocol text directions in Link dialog are not incorrect in 'rtl' UI languages.
            • +
            • #5553 : Paste dialog clipboard area text direction is incorrect for 'rtl' content languages.
            • +
            • #4734 : Font size resets when font name is changed in an empty numbered list.
            • +
            • #5237 : English text in dialogs' title is flipped when using RTL language.
            • +
            • #3257 : Create list doesn't keep blocks as headings.
            • +
            • #5111 : [Firefox] JAWS doesn't respect PC cursor mode (application role) on toolbar.
            • +
            • #5530 : Page break for printing can't be removed with undo.
            • +
            • #5381 : Unable to place cursor between two paragraphs in body.
            • +
            • #5568 : [IE6/7] Selecting a entire table cell changes the original range.
            • +
            • #5623 : [Firefox] Apply style that edges another inline style result incorrect.
            • +
            • #5586 : [Firefox] Maximize the second editor ruins full screen mode.
            • +
            • #5617 : HTML filter system does not allow two 'text' filter rules.
            • +
            • #5663 : General memory clean up after destroying last instance.
            • +
            • #5461 : [IE] Fix Paste from Word dialog doesn't accept imput problem.
            • +
            • #5676 : Make color buttons use RRGGBB instead of RGB for better compatibility with IE.
            • +
            • #4948 : [Safari] Select the first/last cell of table to open context menu may lead to undetected table.
            • +
            • #5591 : [Firefox] Select a list item makes selected element broken.
            • +
            • #5667 : Pasting in a RTL page content causes shows up the horizontal scrollbar.
            • +
            • #5688 : Duplicate ids are used in dialog definition.
            • +
            • #5719 : [IE] 'change' dialog event should not be triggered when dialog is already closed.
            • +
            • #5747 : [IE] Error thrown when IE input field editing mode is turned on.
            • +
            • #5516 : IE8: Toolbar buttons have higher bottom padding.
            • +
            • #5402 : SHIFT-ENTER could now be used to exit from preformat block.
            • +
            • SCAYT plugin related:
                +
              • #4836 : Using SCAYT result in fragile elements when applying inline styles.
              • +
              • #5425 : [Opera] Disable SCAYT plugin for Opera browser.
              • +
              • #5632 : SCAYT word marker is not visible on text with background-color set.
              • +
              • #4125 : Remove Format command incorrectly removes SCAYT word markers.
              • +
              • #5671 : SCAYT bootstrap script could be added multiple times unnecessarily.
              • +
              • #5573 : SCAYT move cursor position after insert element into marked word text.
              • +
              • #5546 : SCAYT interferes with undo/redo commands.
              • +
              • #5570 : [IE] First enabling SCAYT blind cursor in editor.
              • +
              • #5741 : Enable SCAYT cause error in multiple editor instances.
              • +
              • #5744 : Remove editor with SCAYT enabled in source mode throws error.
              • +
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.2.1

            +

            + New features:

            +
              +
            • #4478 : Enable the SelectAll command in source mode.
            • +
            • #5150 : Allow names in the CKEDITOR.config.colorButton_colors setting.
            • +
            • #4810 : Adding configuration option for image dialog preview area filling text.
            • +
            • #536 : Object style now could be applied on any parent element of current selection.
            • +
            • #5290 : Unified stylesSet loading removing dependencies from the styles combo. + Now the configuration entry is named 'config.stylesSet' instead of config.stylesCombo_stylesSet and the default location + is under the 'styles' plugin instead of 'stylescombo'.
            • +
            • #5352 : Allow to define the stylesSet array in the config object for the editor.
            • +
            • #5302 : Adding config option "forceEnterMode".
            • +
            • #5216 : Extend CKEDITOR.appendTo to allow a data parameter for the initial value.
            • +
            • #5024 : Added sample to show how to output XHTML and avoid deprecated tags.
            • +
            +

            + Fixed issues:

            +
              +
            • #5152 : Indentation using class attribute doesn't work properly.
            • +
            • #4682 : It wasn't possible to edit block elements in IE that had styles like width, height or float.
            • +
            • #4750 : Correcting default order of buttons layout in dialogs on Mac.
            • +
            • #4932 : Fixed collapse button not clickable on simple toolbar.
            • +
            • #5228 : Link dialog is automatically changes protocol when URLs that starts with '?'.
            • +
            • #4877 : Fixed CKEditor displays source code in one long line (IE quirks mode + office2003 skin).
            • +
            • #5132 : Apply inline style leaks into sibling words which are seperated spaces.
            • +
            • #3599 : Background color style on sized text displayed as narrow band behind.
            • +
            • #4661 : Translation missing in link dialog.
            • +
            • #5240 : Flash alignment property is not presented visually on fake element.
            • +
            • #4910 : Pasting in IE scrolls document to the end.
            • +
            • #5041 : Table summary attribute can't be removed with dialog.
            • +
            • #5124 : All inline styles cannot be applied on empty spaces.
            • +
            • #3570 : SCAYT marker shouldn't appear inside elements path bar.
            • +
            • #4553 : Dirty check result incorrect when editor document is empty.
            • +
            • #4555 : Unreleased memory when editor is created and destroyed.
            • +
            • #5118 : Arrow keys navigation in RTL languages is incorrect.
            • +
            • #4721 : Remove attribute 'value' of checkbox in IE.
            • +
            • #5278 : IE: Add validation to check for bad window names of popup window.
            • +
            • #5171 : Dialogs contains lists don't have proper voice labels.
            • +
            • #4791 : Can't place cursor inside a form that end with a checkbox/radio.
            • +
            • #4479 : StylesCombo doesn't reflect the selection state until it's first opened.
            • +
            • #4717 : 'Unlink' and 'Outdent' command buttons should be disabled on editor startup.
            • +
            • #5119 : Disabled command buttons are not being properly styled when focused.
            • +
            • #5307 : Hide dialog page cause problem when there's two tab pages remain.
            • +
            • #5343 : Active list item ARIA role is wrongly placed.
            • +
            • #3599 : Background color style applying to text with font size style has been narrowly rendered.
            • +
            • #4711 : Line break character inside preformatted text makes it unable to type text at the end of previous line.
            • +
            • #4829 : [IE] Apply style from combo has wrong result on manually created selection.
            • +
            • #4830 : Retrieving selected element isn't always right, especially selecting using keyboard (SHIFT+ARROW).
            • +
            • #5128 : Element attribute inside preformatted text is corrupted when converting to other blocks.
            • +
            • #5190 : Template list entry shouldn't gain initial focus open templates list dialog opens.
            • +
            • #5238 : Menu button doesn't display arrow icon in high-contrast mode.
            • +
            • #3576 : Non-attributed element of the same name with the applied style is incorrectly removed.
            • +
            • #5221 : Insert table into empty document cause JavaScript error thrown.
            • +
            • #5242 : Apply 'automatic' color option of text color incorrectly removes background-color style.
            • +
            • #4719 : IE does not escape attribute values properly.
            • +
            • #5170 : Firefox does not insert text into styled element properly.
            • +
            • #4026 : Office2003 skin has no toolbar button borders in High Contrast in IE7.
            • +
            • #4348 : There should have exception thrown when 'CKEDITOR_BASEPATH' couldn't be figured out automatically.
            • +
            • #5364 : Focus may not be put into dialog correctly when dialog skin file is loading slow.
            • +
            • #4016 : Justify the layout of forms select dialog in Chrome and IE7.
            • +
            • #5373 : Variable 'pathBlockElements' defines wrong items in CKEDITOR.dom.elementPath.
            • +
            • #5082 : Ctrl key should be described as Cmd key on Mac.
            • +
            • #5182 : Context menu is not been announced correctly by ATs.
            • +
            • #4898 : Can't navigate outside table under the last paragraph of document.
            • +
            • #4950 : List commands could compromise list item attribute and styles.
            • +
            • #5018 : Find result highlighting remove normal font color styles unintentionally.
            • +
            • #5376 : Unable to exit list from within a empty block under list item.
            • +
            • #5145 : Various SCAYT fixes.
            • +
            • #5319 : Match whole word doesn't work anymore after replacement has happened.
            • +
            • #5363 : 'title' attribute now presents on all editor iframes.
            • +
            • #5374 : Unable to toggle inline style when the selection starts at the linefeed of the previous paragraph.
            • +
            • #4513 : Selected link element is not always correctly detected when using keyboard arrows to perform such selection.
            • +
            • #5372 : Newly created sub list should inherit nothing from the original (parent) list, except the list type.
            • +
            • #5274 : [IE6] Templates preview image is displayed in wrong size.
            • +
            • #5292 : Preview in font size and family doesn't work with custom styles.
            • +
            • #5396 : Selection is lost when use cell properties dialog to change cell type to header.
            • +
            • #4082 : [IE+Quirks] Preview text in the image dialog is not wrapping.
            • +
            • #4197 : Fixing format combo don't hide when editor blur on Safari.
            • +
            • #5401 : The context menu break layout with Office2003 and V2 skin on IE quirks mode.
            • +
            • #4825 : Fixing browser context menu is opened when clicking right mouse button twice.
            • +
            • #5356 : The SCAYT dialog had issues with Prototype enabled pages.
            • +
            • #5266 : SCAYT was disturbing the rendering of TH elements.
            • +
            • #4688 : SCAYT was interfering on checkDirty.
            • +
            • #5429 : High Contrast mode was being mistakenly detected when loading the editor through Dojo's xhrGet.
            • +
            • #5221 : Range is mangled when making collapsed selection in an empty paragraph.
            • +
            • #5261 : Config option 'scayt_autoStartup' slow down editor loading.
            • +
            • #3846 : Google Chrome - No Img properties after inserting.
            • +
            • #5465 : ShiftEnter=DIV doesn't respect list item when pressing ENTER at end of list item.
            • +
            • #5454 : After replaced success, the popup window couldn't be closed and a js error occured.
            • +
            • #4784 : Incorrect cursor position after delete table cells.
            • +
            • #5149 : [FF] Cursor disappears after maximize when the editor has focus.
            • +
            • #5220 : DTD now shows tolerance to <style> appear inside content.
            • +
            • #5440 : Mobile browsers (iPhone, Android...) are marked as incompatible as they don't support editing features.
            • +
            • #5504 : [IE6/7] 'Paste' dialog will always get opened even when user allows the clipboard access dialog when using 'Paste' button.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.2

            +

            + New features:

            +
              +
            • Several accessibility enhancements:
                +
              • #4502 : The editor accessibility is now totally based on WAI-ARIA.
              • +
              • #5015 : Adding accessibility help dialog plugin.
              • +
              • #5014 : Keyboard navigation compliance with screen reader suggested keys.
              • +
              • #4595 : Better accessibility in the Templates dialog.
              • +
              • #3389 : Esc/Arrow Key now works for closing sub menu.
              • +
            • +
            • #4973 : The Style field in the Div Container dialog is now loading the styles defined in the default styleset used by the Styles toolbar combo.
            • +
            +

            + Fixed issues:

            +
              +
            • #5049 : Form Field list command in JAWS incorrectly lists extra fields.
            • +
            • #5008 : Lock/Unlock ratio buttons in the Image dialog was poorly designed in High Contrast mode.
            • +
            • #3980 : All labels in dialogs now use <label> instead of <div>.
            • +
            • #5213 : Reorganization of some entries in the language files to make it more consistent.
            • +
            • #5199 : In IE, single row toolbars didn't have the bottom padding.
            • +
            +

            + CKEditor 3.1.1

            +

            + New features:

            +
              +
            • #4399 : Improved support for external file browsers by allowing executing a callback function.
            • +
            • #4612 : The text of links is now updated if it matches the URL to which it points to.
            • +
            • #4936 : New localization support for the Welsh language.
            • +
            +

            + Fixed issues:

            +
              +
            • #4272 : Kama skin toolbar was broken in IE+Quirks+RTL.
            • +
            • #4987 : Changed the url which is called by the Browser Server button in the Link tab of Image Properties dialog.
            • +
            • #5030 : The CKEDITOR.timestamp wasn't been appended to the skin.js file.
            • +
            • #4993 : Removed the float style from images when the user selects 'not set' for alignment.
            • +
            • #4944 : Fixed a bug where nested list structures with inconsequent levels were not being pasted correctly from MS Word.
            • +
            • #4637 : Table cells' 'nowrap' attribute was not being loaded by the cell property dialog. Thanks to pomu0325.
            • +
            • #4724 : Using the mouse to insert a link in IE might create incorrect results.
            • +
            • #4640 : Small optimizations for the fileBrowser plugin.
            • +
            • #4583 : The "Target Frame Name" field is now visible when target is set to 'frame' only.
            • +
            • #4863 : Fixing iframedialog's height doesn't stretch to 100% (except IE Quirks).
            • +
            • #4964 : The BACKSPACE key positioning was not correct in some cases with Firefox.
            • +
            • #4980 : Setting border, vspace and hspace of images to zero was not working.
            • +
            • #4773 : The fileBrowser plugin was overwriting onClick functions eventually defined on fileButton elements.
            • +
            • #4731 : The clipboard plugin was missing a reference to the dialog plugin.
            • +
            • #5051 : The about plugin was missing a reference to the dialog plugin.
            • +
            • #5146 : The wsc plugin was missing a reference to the dialog plugin.
            • +
            • #4632 : The print command will now properly break on the insertion point of page break for printing.
            • +
            • #4862 : The English (United Kingdom) language file has been renamed to en-gb.js.
            • +
            • #4618 : Selecting an emoticon or the lock and reset buttons in the image dialog fired the onBeforeUnload event in IE.
            • +
            • #4678 : It was not possible to set tables' width to empty value.
            • +
            • #5012 : Fixed dependency issues with the menu plugin.
            • +
            • #5040 : The editor will not properly ignore font related settings that have extra item separators (semi-colons).
            • +
            • #4046 : Justify should respect config.enterMode = CKEDITOR.ENTER_BR.
            • +
            • #4622 : Inserting tables multiple times was corrupting the undo system.
            • +
            • #4647 : [IE] Selection on an element within positioned container is lost after open context-menu then click one menu item.
            • +
            • #4683 : Double-quote character in attribute values was not escaped in the editor output.
            • +
            • #4762 : [IE] Unexpected vertical-scrolling behavior happens whenever focus is moving out of editor in source mode.
            • +
            • #4772 : Text color was not being applied properly on links.
            • +
            • #4795 : [IE] Press 'Del' key on horizontal line or table result in error.
            • +
            • #4824 : [IE] <br/> at the very first table cell breaks the editor selection.
            • +
            • #4851 : [IE] Delete table rows with context-menu may cause error.
            • +
            • #4951 : Replacing text with empty string was throwing errors.
            • +
            • #4963 : Link dialog was not opening properly for e-mail type links.
            • +
            • #5043 : Removed the possibility of having an unwanted script tag being outputted with the editor contents.
            • +
            • #3678 : There were issues when editing links inside floating divs with IE.
            • +
            • #4763 : Pressing ENTER key with text selected was not deleting the text in some situations.
            • +
            • #5096 : Simple ampersand attribute value doesn't work for more than one occurrence.
            • +
            • #3494 : Context menu is too narrow in some translations.
            • +
            • #5005 : Fixed HTML errors in PHP samples.
            • +
            • #5123 : Fixed broken XHTML in User Interface Languages sample.
            • +
            • #4893 : Editor now understands table cell inline styles.
            • +
            • #4611 : Selection around <select> in editor doesn't cause error anymore.
            • +
            • #4886 : Extra BR tags were being created in the output HTML.
            • +
            • #4933 : Empty tags with BR were being left in the DOM.
            • +
            • #5127 : There were errors when removing dialog definition pages through code.
            • +
            • #4767 : CKEditor was not working when ckeditor_source.js is loaded in the <body> .
            • +
            • #5062 : Avoided security warning message when loading the wysiwyg area in IE6 under HTTPS.
            • +
            • #5135 : The TAB key will now behave properly when in Source mode.
            • +
            • #4988 : It wasn't possible to use forcePasteAsPlainText with Safari on Mac.
            • +
            • #5095 : Safari on Mac deleted the current selection in the editor when Edit menu was clicked.
            • +
            • #5140 : In High Contrast mode, arrows were now been displayed for menus with submenus.
            • +
            • #5163 : The undo system was not working on some specific cases.
            • +
            • #5162 : The ajax sample was throwing errors when loading data.
            • +
            • #4999 : The Template dialog was not generating an undo snapshot.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.1

            +

            + New features:

            +
              +
            • #4067 : Introduced the full page editing support (from <html> to </html>).
            • +
            • #4228 : Introduced the Shared Spaces feature.
            • +
            • #4379 : Introduced the new powerful pasting system and word cleanup procedure, including enhancements to the paste as plain text feature.
            • +
            • #2872 : Introduced the new native PHP API, the first standardized server side support.
            • +
            • #4210 : Added CKEditor plugin for jQuery.
            • +
            • #2885 : Added 'div' dialog and corresponding context menu options.
            • +
            • #4574 : Added the table merging tools and corresponding context menu options.
            • +
            • #4340 : Added the email protection option for link dialog.
            • +
            • #4463 : Added inline CSS support in all places where custom stylesheet could apply.
            • +
            • #3881 : Added color dialog for 'more color' option in color buttons.
            • +
            • #4341 : Added the 'showborder' plugin.
            • +
            • #4549 : Make the anti-cache query string configurable.
            • +
            • #4708 : Added the 'htmlEncodeOutput' config option.
            • +
            • #4342 : Introduced the bodyId and bodyClass settings to specify the id and class. to be used in the editing area at runtime.
            • +
            • #3401 : Introduced the baseHref setting so it's possible to set the URL to be used to resolve absolute and relative URLs in the contents.
            • +
            • #4729 : Added support to fake elements for comments.
            • +
            +

            + Fixed issues:

            +
              +
            • #4707 : Fixed invalid link is requested in image preview.
            • +
            • #4461 : Fixed toolbar separator line along side combo enlarging the toolbar height.
            • +
            • #4596 : Fixed image re-size lock buttons aren't accessible in high-contrast mode.
            • +
            • #4676 : Fixed editing tables using table properties dialog overwrites original style values.
            • +
            • #4714 : Fixed IE6 JavaScript error when editing flash by commit 'Flash' dialog.
            • +
            • #3905 : Fixed 'wysiwyg' mode causes unauthenticated content warnings over SSL in FF 3.5.
            • +
            • #4768 : Fixed open context menu in IE throws js error when focus is not inside document.
            • +
            • #4822 : Fixed applying 'Headers' to existing table does not work in IE.
            • +
            • #4855 : Fixed toolbar doesn't wrap well for 'v2' skin in all browsers.
            • +
            • #4882 : Fixed auto detect paste from MS-Word is not working for Safari.
            • +
            • #4882 : Fixed unexpected margin style left behind on content cleaning up from MS-Word.
            • +
            • #4896 : Fixed paste nested list from MS-Word with measurement units set to cm is broken.
            • +
            • #4899 : Fixed unable to undo pre-formatted style.
            • +
            • #4900 : Fixed ratio-lock inconsistent between browsers.
            • +
            • #4901 : Fixed unable to edit any link with popup window's features in Firefox.
            • +
            • #4904 : Fixed when paste happen from dialog, it always throw JavaScript error.
            • +
            • #4905 : Fixed paste plain text result incorrect when content from dialog.
            • +
            • #4889 : Fixed unable to undo 'New Page' command after typing inside editor.
            • +
            • #4892 : Fixed table alignment style is not properly represented by the wrapping div.
            • +
            • #4918 : Fixed switching mode when maximized is showing background page contents.
            • +
            +

            + CKEditor 3.0.2

            +

            + New features:

            +
              +
            • #4343 : Added the configuration option 'browserContextMenuOnCtrl' so it's possible to enable the default browser context menu by holding the CTRL key.
            • +
            +

            + Fixed issues:

            +
              +
            • #4552 : Fixed float panel doesn't show up since editor instanced been destroyed once.
            • +
            • #3918 : Fixed fake object is editable with Image dialog.
            • +
            • #4053 : Fixed 'Form Properties' missing from context menu when selection collapsed inside form.
            • +
            • #4401 : Fixed customized by removing 'upload' tab page from 'Link dialog' cause JavaScript error.
            • +
            • #4477 : Adding missing tag names in object style elements.
            • +
            • #4567 : Fixed IE throw error when pressing BACKSPACE in source mode.
            • +
            • #4573 : Fixed 'IgnoreEmptyPargraph' config doesn't work with the config 'entities' is set to 'false'.
            • +
            • #4614 : Fixed attribute protection fails because of line-break.
            • +
            • #4546 : Fixed UIColor plugin doesn't work when editor id contains CSS selector preserved keywords.
            • +
            • #4609 : Fixed flash object is lost when loading data from outside editor.
            • +
            • #4625 : Fixed editor stays visible in a div with style 'visibility:hidden'.
            • +
            • #4621 : Fixed clicking below table caused an empty table been generated.
            • +
            • #3373 : Fixed empty context menu when there's no menu item at all.
            • +
            • #4473 : Fixed setting rules on the same element tag name throws error.
            • +
            • #4514 : Fixed press 'Back' button breaks wysiwyg editing mode is Firefox.
            • +
            • #4542 : Fixed unable to access buttons using tab key in Safari and Opera.
            • +
            • #4577 : Fixed relative link url is broken after opening 'Link' dialog.
            • +
            • #4597 : Fixed custom style with same attribute name but different attribute value doesn't work.
            • +
            • #4651 : Fixed 'Deleted' and 'Inserted' text style is not rendering in wysiwyg mode and is wrong is source mode.
            • +
            • #4654 : Fixed 'CKEDITOR.config.font_defaultLabel(fontSize_defaultLabel)' is not working.
            • +
            • #3950 : Fixed table column insertion incorrect when selecting empty cell area.
            • +
            • #3912 : Fixed UIColor not working in IE when page has more than 30+ editors.
            • +
            • #4031 : Fixed mouse cursor on toolbar combo has more than 3 shapes.
            • +
            • #4041 : Fixed open context menu on multiple cells to remove them result in only one removed.
            • +
            • #4185 : Fixed resize handler effect doesn't affect flash object on output.
            • +
            • #4196 : Fixed 'Remove Numbered/Bulleted List' on nested list doesn't work well on nested list.
            • +
            • #4200 : Fixed unable to insert 'password' type filed with attributes.
            • +
            • #4530 : Fixed context menu couldn't open in Opera.
            • +
            • #4536 : Fixed keyboard navigation doesn't work at all in IE quirks mode.
            • +
            • #4584 : Fixed updated link Target field is not updating when updating to certain values.
            • +
            • #4603 : Fixed unable to disable submenu items in contextmenu.
            • +
            • #4672 : Fixed unable to redo the insertion of horizontal line.
            • +
            • #4677 : Fixed 'Tab' key is trapped by hidden dialog elements.
            • +
            • #4073 : Fixed insert template with replace option could result in empty document.
            • +
            • #4455 : Fixed unable to start editing when image inside document not loaded.
            • +
            • #4517 : Fixed 'dialog_backgroundCoverColor' doesn't work on IE6.
            • +
            • #3165 : Fixed enter key in empty list item before nested one result in collapsed line.
            • +
            • #4527 : Fixed checkbox generate invalid 'checked' attribute.
            • +
            • #1659 : Fixed unable to click below content to start editing in IE with 'config.docType' setting to standard compliant.
            • +
            • #3933 : Fixed extra <br> left at the end of document when the last element is a table.
            • +
            • #4736 : Fixed PAGE UP and PAGE DOWN keys in standards mode are not working.
            • +
            • #4725 : Fixed hitting 'enter' before html comment node produces a JavaScript error.
            • +
            • #4522 : Fixed unable to redo when typing after insert an image with relative url.
            • +
            • #4594 : Fixed context menu goes off-screen when mouse is at right had side of screen.
            • +
            • #4673 : Fixed undo not available straight away if shift key is used to enter first character.
            • +
            • #4690 : Fixed the parsing of nested inline elements.
            • +
            • #4450 : Fixed selecting multiple table cells before apply justify commands generates spurious paragraph in Firefox.
            • +
            • #4733 : Fixed dialog opening sometimes hang up Firefox and Safari.
            • +
            • #4498 : Fixed toolbar collapse button missing tooltip.
            • +
            • #4738 : Fixed inserting table inside bold/italic/underline generates error on ENTER_BR mode.
            • +
            • #4246 : Fixed avoid XHTML deprecated attributes for image styling.
            • +
            • #4543 : Fixed unable to move cursor between table and hr.
            • +
            • #4764 : Fixed wrong exception message when CKEDITOR.editor.append() to non-existing elements.
            • +
            • #4521 : Fixed dialog layout in IE6/7 may have scroll-bar and other weird effects.
            • +
            • #4709 : Fixed inconsistent scroll-bar behavior on IE.
            • +
            • #4776 : Fixed preview page failed to open when relative URl contains in document.
            • +
            • #4812 : Fixed 'Esc' key not working on dialogs in Opera.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.0.1

            +

            + New features:

            +
              +
            • #4219 : Added fallback mechanism for config.language.
            • +
            • #4194 : Added support for using multiple css style sheets within the editor.
            • +
            +

            + Fixed issues:

            +
              +
            • #3898 : Added validation for URL value in Image dialog.
            • +
            • #3528 : Fixed Context Menu issue when triggered using Shift+F10.
            • +
            • #4028 : Maximize control's tool tip was wrong once it is maximized.
            • +
            • #4237 : Toolbar is chopped off in Safari browser 3.x.
            • +
            • #4241 : Float panels are left on screen while editor is destroyed.
            • +
            • #4274 : Double click event is incorrect handled in 'divreplace' sample.
            • +
            • #4354 : Fixed TAB key on toolbar to not focus disabled buttons.
            • +
            • #3856 : Fixed focus and blur events in source view mode.
            • +
            • #3438 : Floating panels are off by (-1px, 0px) in RTL mode.
            • +
            • #3370 : Refactored use of CKEDITOR.env.isCustomDomain().
            • +
            • #4230 : HC detection caused js error.
            • +
            • #3978 : Fixed setStyle float on IE7 strict.
            • +
            • #4262 : Tab and Shift+Tab was not working to cycle through CTRL+SHIFT+F10 context menu in IE.
            • +
            • #3633 : Default context menu isn't disabled in toolbar, status bar, panels...
            • +
            • #3897 : Now there is no image previews when the URL is empty in image dialog.
            • +
            • #4048 : Context submenu was lacking uiColor.
            • +
            • #3568 : Dialogs now select all text when tabbing to text inputs.
            • +
            • #3727 : Cell Properties dialog was missing color selection option.
            • +
            • #3517 : Fixed "Match cyclic" field in Find & Replace dialog.
            • +
            • #4368 : borderColor table cell attribute haven't worked for none-IE
            • +
            • #4203 : In IE quirks mode + toolbar collapsed + source mode editing block height was incorrect.
            • +
            • #4387 : Fixed: right clicking in Kama skin can lead to a javascript error.
            • +
            • #4397 : Wysiwyg mode caused the host page scroll.
            • +
            • #4385 : Fixed editor's auto adjusting on DOM structure were confusing the dirty checking mechanism.
            • +
            • #4397 : Fixed regression of [3816] where turn on design mode was causing Firefox3 to scroll the host page.
            • +
            • #4254 : Added basic API sample.
            • +
            • #4107 : Normalize css font-family style text for correct comparision.
            • +
            • #3664 : Insert block element in empty editor document should not create new paragraph.
            • +
            • #4037 : 'id' attribute is missing with Flash dialog advanced page.
            • +
            • #4047 : Delete selected control type element when 'Backspace' is pressed on it.
            • +
            • #4191 : Fixed: dialog changes confirmation on image dialog appeared even when no changes have been made.
            • +
            • #4351 : Dash and dot could appear in attribute names.
            • +
            • #4355 : 'maximize' and 'showblock' commands shouldn't take editor focus.
            • +
            • #4504 : Fixed 'Enter'/'Esc' key is not working on dialog button.
            • +
            • #4245 : 'Strange Template' now come with a style attribute for width.
            • +
            • #4512 : Fixed styles plugin incorrectly adding semicolons to style text.
            • +
            • #3855 : Fixed loading unminified _source files when ckeditor_source.js is used.
            • +
            • #3717 : Dialog settings defaults can now be overridden in-page through the CKEDITOR.config object.
            • +
            • #4481 : The 'stylesCombo_stylesSet' configuration entry didn't work for full URLs.
            • +
            • #4480 : Fixed scope attribute in th.
            • +
            • #4467 : Fixed bug to use custom icon in context menus. Thanks to george.
            • +
            • #4190 : Fixed select field dialog layout in Safari.
            • +
            • #4518 : Fixed unable to open dialog without editor focus in IE.
            • +
            • #4519 : Fixed maximize without editor focus throw error in IE.
            • +
            • Updated the following language files:
            • +
            +

            + CKEditor 3.0

            +

            + New features:

            +
              +
            • #3188 : Introduce + <pre> formatting feature when converting from other blocks.
            • +
            • #4445 : editor::setData now support an optional callback parameter.
            • +
            +

            + Fixed issues:

            +
              +
            • #2856 : Fixed problem with inches in Paste From Word plugin.
            • +
            • #3929 : Using Paste dialog, + the text is pasted into current selection
            • +
            • #3920 : Mouse cursor over characters in + Special Character dialog now is correct
            • +
            • #3882 : Fixed an issue + with PasteFromWord dialog in which default values was ignored
            • +
            • #3859 : Fixed Flash dialog layout in Webkit
            • +
            • #3852 : Disabled textarea resizing in dialogs
            • +
            • #3831 : The attempt to remove the contextmenu plugin + will not anymore break the editor
            • +
            • #3781 : Colorbutton is now disabled in 'source' mode
            • +
            • #3848 : Fixed an issue with Webkit in witch + elements in the Image and Link dialogs had wrong dimensions.
            • +
            • #3808 : Fixed UI Color Picker dialog size in example page.
            • +
            • #3658 : Editor had horizontal scrollbar in IE6.
            • +
            • #3819 : The cursor was not visible + when applying style to collapsed selections in Firefox 2.
            • +
            • #3809 : Fixed beam cursor + when mouse cursor is over text-only buttons in IE.
            • +
            • #3815 : Fixed an issue + with the form dialog in which the "enctype" attribute is outputted as "encoding".
            • +
            • #3785 : Fixed an issue + in CKEDITOR.tools.htmlEncode() which incorrectly outputs &nbsp; in IE8.
            • +
            • #3820 : Fixed an issue in + bullet list command in which a list created at the bottom of another gets merged to the top. +
            • +
            • #3830 : Table cell properties dialog + doesn't apply to all selected cells.
            • +
            • #3835 : Element path is not refreshed + after click on 'newpage'; and safari is not putting focus on document also. +
            • +
            • #3821 : Fixed an issue with JAWS in which + toolbar items are read inconsistently between virtual cursor modes.
            • +
            • #3789 : The "src" attribute + was getting duplicated in some situations.
            • +
            • #3591 : Protecting flash related elements + including '<object>', '<embed>' and '<param>'. +
            • +
            • #3759 : Fixed CKEDITOR.dom.element::scrollIntoView + logic bug which scroll even element is inside viewport. +
            • +
            • #3773 : Fixed remove list will merge lines. +
            • +
            • #3829 : Fixed remove empty link on output data.
            • +
            • #3730 : Indent is performing on the whole + block instead of selected lines in enterMode = BR.
            • +
            • #3844 : Fixed UndoManager register keydown on obsoleted document
            • +
            • #3805 : Enabled SCAYT plugin for IE.
            • +
            • #3834 : Context menu on table caption was incorrect.
            • +
            • #3812 : Fixed an issue in which the editor + may show up empty or uneditable in IE7, 8 and Firefox 3.
            • +
            • #3825 : Fixed JS error when opening spellingcheck.
            • +
            • #3862 : Fixed html parser infinite loop on certain malformed + source code.
            • +
            • #3639 : Button size was inconsistent.
            • +
            • #3874 : Paste as plain text in Safari loosing lines.
            • +
            • #3849 : Fixed IE8 crashes when applying lists and indenting.
            • +
            • #3876 : Changed dialog checkbox and radio labels to explicit labels.
            • +
            • #3843 : Fixed context submenu position in IE 6 & 7 RTL.
            • +
            • #3864 : [FF]Document is not editable after inserting element on a fresh page.
            • +
            • #3883 : Fixed removing inline style logic incorrect on Firefox2.
            • +
            • #3884 : Empty "href" attribute was duplicated on output data.
            • +
            • #3858 : Fixed the issue where toolbars + break up in IE6 and IE7 after the browser is resized.
            • +
            • #3868 : [chrome] SCAYT toolbar options was in reversed order.
            • +
            • #3875 : Fixed an issue in Safari where + table row/column/cell menus are not useable when table cells are selected.
            • +
            • #3896 : The editing area was + flashing when switching forth and back to source view.
            • +
            • #3894 : Fixed an issue where editor failed to initialize when using the on-demand loading way.
            • +
            • #3903 : Color button plugin doesn't read config entry from editor instance correctly.
            • +
            • #3801 : Comments at the start of the document was lost in IE.
            • +
            • #3871 : Unable to redo when undos to the front of snapshots stack.
            • +
            • #3909 : Move focus from editor into a text input control is broken.
            • +
            • #3870 : The empty paragraph + desappears when hitting ENTER after "New Page".
            • +
            • #3887 : Fixed an issue in which the create + list command may leak outside of a selected table cell and into the rest of document.
            • +
            • #3916 : Fixed maximize does not enlarge editor width when width is set.
            • +
            • #3879 : [webkit] Color button panel had incorrect size on first open.
            • +
            • #3839 : Update Scayt plugin to reflect the latest change from SpellChecker.net.
            • +
            • #3742 : Fixed wrong dialog layout for dialogs without tab bar in IE RTL mode .
            • +
            • #3671 : Fixed body fixing should be applied to the real type under fake elements.
            • +
            • #3836 : Fixed remove list in enterMode=BR will merge sibling text to one line.
            • +
            • #3949 : Fixed enterKey within pre-formatted text introduce wrong line-break.
            • +
            • #3878 : Whenever possible, + dialogs will not present scrollbars if the content is too big for its standard + size.
            • +
            • #3782 : Remove empty list in table cell result in collapsed cell.
            • +
            • Updated the following language files:
            • +
            • #3984 : [IE]The pre-formatted style is generating error.
            • +
            • #3946 : Fixed unable to hide contextmenu.
            • +
            • #3956 : Fixed About dialog in Source Mode for IE.
            • +
            • #3953 : Fixed keystroke for close Paste dialog.
            • +
            • #3951 : Reset size and lock ratio options were not accessible in Image dialog.
            • +
            • #3921 : Fixed Container scroll issue on IE7.
            • +
            • #3940 : Fixed list operation doesn't stop at table.
            • +
            • #3891 : [IE] Fixed 'automatic' font color doesn't work.
            • +
            • #3972 : Fixed unable to remove a single empty list in document in Firefox with enterMode=BR.
            • +
            • #3973 : Fixed list creation error at the end of document.
            • +
            • #3959 : Pasting styled text from word result in content lost.
            • +
            • #3793 : Combined images into sprites.
            • +
            • #3783 : Fixed indenting command in table cells create collapsed paragraph.
            • +
            • #3968 : About dialog layout was broken with IE+Standards+RTL.
            • +
            • #3991 : In IE quirks, text was not visible in v2 and office2003 skins.
            • +
            • #3983 : In IE, we'll now + silently ignore wrong toolbar definition settings which have extra commas being + left around.
            • +
            • Fixed the following test cases:
                +
              • #3992 : core/ckeditor2.html
              • +
              • #4138 : core/plugins.html
              • +
              • #3801 : plugins/htmldataprocessor/htmldataprocessor.html
              • +
            • +
            • #3989 : Host page horizontal scrolling a lot when on having righ-to-left direction.
            • +
            • #4001 : Create link around existing image result incorrect.
            • +
            • #3988 : Destroy editor on form submit event cause error.
            • +
            • #3994 : Insert horizontal line at end of document cause error.
            • +
            • #4074 : Indent error with 'indentClasses' config specified.
            • +
            • #4057 : Fixed anchor is lost after switch between editing modes.
            • +
            • #3644 : Image dialog was missin radio lock.
            • +
            • #4014 : Firefox2 had no dialog button backgrounds.
            • +
            • #4018 : Firefox2 had no richcombo text visible.
            • +
            • #4035 : [IE6] Paste dialog size was too small.
            • +
            • #4049 : Kama skin was too wide with config.width.
            • +
            • The following released files now doesn't require the _source folder
                +
              • #4086 : _samples/ui_languages.html
              • +
              • #4093 : _tests/core/dom/document.html
              • +
              • #4094 : Smiley plugin file
              • +
              • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
              • +
            • +
            • #4085 : Paste and Paste from Word dialogs were not well styled in IE+RTL.
            • +
            • #3982 : Fixed enterKey on empty list item result in weird dom structure.
            • +
            • #4101 : Now it is possible to close dialog before gets focus.
            • +
            • #4075 : [IE6/7]Fixed apply custom inline style with "class" attribute failed.
            • +
            • #4087 : [Firefox]Fixed extra blocks created on create list when full document selected.
            • +
            • #4097 : No undo/redo support for fontColor and backgroundColor buttons.
            • +
            • #4111 : Fixed apply block style after inline style applied on full document error.
            • +
            • #3622 : Fixed shift enter with selection not deleting highlighted text.
            • +
            • #4092 : [IE6] Close button was missing for dialog without multiple tabs.
            • +
            • #4003 : Markup on the image dialog was disrupted when removing the border input.
            • +
            • #4096 : Editor content area was pushed down in IE RTL quirks.
            • +
            • #4112 : [FF] Paste dialog had scrollbars in quirks.
            • +
            • #4118 : Dialog dragging was + occasionally behaving strangely .
            • +
            • #4077 : The toolbar combos + were rendering incorrectly in some languages, like Chinese.
            • +
            • #3622 : The toolbar in the v2 + skin was wrapping improperly in some languages.
            • +
            • #4119 : Unable to edit image link with image dialog.
            • +
            • #4117 : Fixed dialog error when transforming image into button.
            • +
            • #4058 : [FF] wysiwyg mode is sometimes not been activated.
            • +
            • #4114 : [IE] RTE + IE6/IE7 Quirks = dialog mispositoned.
            • +
            • #4123 : Some dialog buttons were broken in IE7 quirks.
            • +
            • #4122 : [IE] The image dialog + was being rendered improperly when loading an image with long URL.
            • +
            • #4144 : Fixed the white-spaces at the end of <pre> is incorrectly removed.
            • +
            • #4143 : Fixed element id is lost when extracting contents from the range.
            • +
            • #4007 : [IE] Source area overflow from editor chrome.
            • +
            • #4145 : Fixed the on demand + ("basic") loading model of the editor.
            • +
            • #4139 : Fixed list plugin regression of [3903].
            • +
            • #4147 : Unify style text normalization logic when comparing styles.
            • +
            • #4150 : Fixed enlarge list result incorrect at the inner boundary of block.
            • +
            • #4164 : Now it is possible to paste text + in Source mode even if forcePasteAsPlainText = true.
            • +
            • #4129 : [FF]Unable to remove list with Ctrl-A.
            • +
            • #4172 : [Safari] The trailing + <br> was not been always added to blank lines ending with &nbsp;.
            • +
            • #4178 : It's now possible to + copy and paste Flash content among different editor instances.
            • +
            • #4193 : Automatic font color produced empty span on Firefox 3.5.
            • +
            • #4186 : [FF] Fixed First open float panel cause host page scrollbar blinking.
            • +
            • #4227 : Fixed destroy editor instance created on textarea which is not within form cause error.
            • +
            • #4240 : Fixed editor name containing hyphen break editor completely.
            • +
            • #3828 : Malformed nested list is now corrected by the parser.
            • +
            +

            + CKEditor 3.0 RC

            +

            + Changelog starts at this release.

            + + + diff --git a/include/limesurvey/admin/scripts/ckeditor.36/INSTALL.html b/include/limesurvey/admin/scripts/ckeditor.36/INSTALL.html index fd2440ed..565ed261 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/INSTALL.html +++ b/include/limesurvey/admin/scripts/ckeditor.36/INSTALL.html @@ -1,92 +1,92 @@ - - - - - Installation Guide - CKEditor - - - - -

            - CKEditor Installation Guide

            -

            - What's CKEditor?

            -

            - CKEditor is a text editor to be used inside web pages. It's not a replacement - for desktop text editors like Word or OpenOffice, but a component to be used as - part of web applications and web sites.

            -

            - Installation

            -

            - Installing CKEditor is an easy task. Just follow these simple steps:

            -
              -
            1. Download the latest version of the editor from our web site: http://ckeditor.com. You should have already completed - this step, but be sure you have the very latest version.
            2. -
            3. Extract (decompress) the downloaded file into the root of your - web site.
            4. -
            -

            - Note: CKEditor is by default installed in the "ckeditor" - folder. You can place the files in whichever you want though.

            -

            - Checking Your Installation -

            -

            - The editor comes with a few sample pages that can be used to verify that installation - proceeded properly. Take a look at the _samples directory.

            -

            - To test your installation, just call the following page at your web site:

            -
            -http://<your site>/<CKEditor installation path>/_samples/index.html
            -
            -For example:
            -http://www.example.com/ckeditor/_samples/index.html
            -

            - Documentation

            -

            - The full editor documentation is available online at the following address:
            - http://docs.cksource.com/ckeditor

            - - - + + + + + Installation Guide - CKEditor + + + + +

            + CKEditor Installation Guide

            +

            + What's CKEditor?

            +

            + CKEditor is a text editor to be used inside web pages. It's not a replacement + for desktop text editors like Word or OpenOffice, but a component to be used as + part of web applications and web sites.

            +

            + Installation

            +

            + Installing CKEditor is an easy task. Just follow these simple steps:

            +
              +
            1. Download the latest version of the editor from our web site: http://ckeditor.com. You should have already completed + this step, but be sure you have the very latest version.
            2. +
            3. Extract (decompress) the downloaded file into the root of your + web site.
            4. +
            +

            + Note: CKEditor is by default installed in the "ckeditor" + folder. You can place the files in whichever you want though.

            +

            + Checking Your Installation +

            +

            + The editor comes with a few sample pages that can be used to verify that installation + proceeded properly. Take a look at the _samples directory.

            +

            + To test your installation, just call the following page at your web site:

            +
            +http://<your site>/<CKEditor installation path>/_samples/index.html
            +
            +For example:
            +http://www.example.com/ckeditor/_samples/index.html
            +

            + Documentation

            +

            + The full editor documentation is available online at the following address:
            + http://docs.cksource.com/ckeditor

            + + + diff --git a/include/limesurvey/admin/scripts/ckeditor.36/LICENSE.html b/include/limesurvey/admin/scripts/ckeditor.36/LICENSE.html index b049b251..0529c9f4 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/LICENSE.html +++ b/include/limesurvey/admin/scripts/ckeditor.36/LICENSE.html @@ -1,1334 +1,1334 @@ - - - - - License - CKEditor - - -

            - Software License Agreement -

            -

            - CKEditor™ - The text editor for Internet™ - - http://ckeditor.com
            - Copyright © 2003-2011, CKSource - Frederico Knabben. All rights reserved. -

            -

            - Licensed under the terms of any of the following licenses at your choice: -

            - -

            - You are not required to, but if you want to explicitly declare the license you have - chosen to be bound to when using, reproducing, modifying and distributing this software, - just include a text file titled "LEGAL" in your version of this software, indicating - your license choice. In any case, your choice will not restrict any recipient of - your version of this software to use, reproduce, modify and distribute this software - under any of the above licenses. -

            -

            - Sources of Intellectual Property Included in CKEditor -

            -

            - Where not otherwise indicated, all CKEditor content is authored by CKSource engineers - and consists of CKSource-owned intellectual property. In some specific instances, - CKEditor will incorporate work done by developers outside of CKSource with their - express permission. -

            -

            - YUI Test: At _source/tests/yuitest.js - can be found part of the source code of YUI, which is licensed under the terms of - the BSD License. YUI is - Copyright © 2008, Yahoo! Inc. -

            -

            - Trademarks -

            -

            - CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product - names are trademarks, registered trademarks or service marks of their respective - holders. -

            - - + + + + + License - CKEditor + + +

            + Software License Agreement +

            +

            + CKEditor™ - The text editor for Internet™ - + http://ckeditor.com
            + Copyright © 2003-2011, CKSource - Frederico Knabben. All rights reserved. +

            +

            + Licensed under the terms of any of the following licenses at your choice: +

            + +

            + You are not required to, but if you want to explicitly declare the license you have + chosen to be bound to when using, reproducing, modifying and distributing this software, + just include a text file titled "LEGAL" in your version of this software, indicating + your license choice. In any case, your choice will not restrict any recipient of + your version of this software to use, reproduce, modify and distribute this software + under any of the above licenses. +

            +

            + Sources of Intellectual Property Included in CKEditor +

            +

            + Where not otherwise indicated, all CKEditor content is authored by CKSource engineers + and consists of CKSource-owned intellectual property. In some specific instances, + CKEditor will incorporate work done by developers outside of CKSource with their + express permission. +

            +

            + YUI Test: At _source/tests/yuitest.js + can be found part of the source code of YUI, which is licensed under the terms of + the BSD License. YUI is + Copyright © 2008, Yahoo! Inc. +

            +

            + Trademarks +

            +

            + CKEditor is a trademark of CKSource - Frederico Knabben. All other brand and product + names are trademarks, registered trademarks or service marks of their respective + holders. +

            + + diff --git a/include/limesurvey/admin/scripts/ckeditor.36/adapters/jquery.js b/include/limesurvey/admin/scripts/ckeditor.36/adapters/jquery.js index 289de410..5f13c756 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/adapters/jquery.js +++ b/include/limesurvey/admin/scripts/ckeditor.36/adapters/jquery.js @@ -1,6 +1,6 @@ -/* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function(){CKEDITOR.config.jqueryOverrideVal=typeof CKEDITOR.config.jqueryOverrideVal=='undefined'?true:CKEDITOR.config.jqueryOverrideVal;var a=window.jQuery;if(typeof a=='undefined')return;a.extend(a.fn,{ckeditorGet:function(){var b=this.eq(0).data('ckeditorInstance');if(!b)throw 'CKEditor not yet initialized, use ckeditor() with callback.';return b;},ckeditor:function(b,c){if(!CKEDITOR.env.isCompatible)return this;if(!a.isFunction(b)){var d=c;c=b;b=d;}c=c||{};this.filter('textarea, div, p').each(function(){var e=a(this),f=e.data('ckeditorInstance'),g=e.data('_ckeditorInstanceLock'),h=this;if(f&&!g){if(b)b.apply(f,[this]);}else if(!g){if(c.autoUpdateElement||typeof c.autoUpdateElement=='undefined'&&CKEDITOR.config.autoUpdateElement)c.autoUpdateElementJquery=true;c.autoUpdateElement=false;e.data('_ckeditorInstanceLock',true);f=CKEDITOR.replace(h,c);e.data('ckeditorInstance',f);f.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}i.removeListener('instanceReady',this.callee);j.on('dataReady',function(){e.trigger('setData.ckeditor',[j]);});j.on('getData',function(l){e.trigger('getData.ckeditor',[j,l.data]);},999);j.on('destroy',function(){e.trigger('destroy.ckeditor',[j]);});if(j.config.autoUpdateElementJquery&&e.is('textarea')&&e.parents('form').length){var k=function(){e.ckeditor(function(){j.updateElement();});};e.parents('form').submit(k);e.parents('form').bind('form-pre-serialize',k);e.bind('destroy.ckeditor',function(){e.parents('form').unbind('submit',k);e.parents('form').unbind('form-pre-serialize',k);});}j.on('destroy',function(){e.data('ckeditorInstance',null);});e.data('_ckeditorInstanceLock',null);e.trigger('instanceReady.ckeditor',[j]);if(b)b.apply(j,[h]);},0);},null,null,9999);}else CKEDITOR.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}if(j.element.$==h)if(b)b.apply(j,[h]);},0);},null,null,9999);});return this;}});if(CKEDITOR.config.jqueryOverrideVal)a.fn.val=CKEDITOR.tools.override(a.fn.val,function(b){return function(c,d){var e=typeof c!='undefined',f;this.each(function(){var g=a(this),h=g.data('ckeditorInstance');if(!d&&g.is('textarea')&&h){if(e)h.setData(c);else{f=h.getData();return null;}}else if(e)b.call(g,c);else{f=b.call(g);return null;}return true;});return e?this:f;};});})(); +/* +Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. +For licensing, see LICENSE.html or http://ckeditor.com/license +*/ + +(function(){CKEDITOR.config.jqueryOverrideVal=typeof CKEDITOR.config.jqueryOverrideVal=='undefined'?true:CKEDITOR.config.jqueryOverrideVal;var a=window.jQuery;if(typeof a=='undefined')return;a.extend(a.fn,{ckeditorGet:function(){var b=this.eq(0).data('ckeditorInstance');if(!b)throw 'CKEditor not yet initialized, use ckeditor() with callback.';return b;},ckeditor:function(b,c){if(!CKEDITOR.env.isCompatible)return this;if(!a.isFunction(b)){var d=c;c=b;b=d;}c=c||{};this.filter('textarea, div, p').each(function(){var e=a(this),f=e.data('ckeditorInstance'),g=e.data('_ckeditorInstanceLock'),h=this;if(f&&!g){if(b)b.apply(f,[this]);}else if(!g){if(c.autoUpdateElement||typeof c.autoUpdateElement=='undefined'&&CKEDITOR.config.autoUpdateElement)c.autoUpdateElementJquery=true;c.autoUpdateElement=false;e.data('_ckeditorInstanceLock',true);f=CKEDITOR.replace(h,c);e.data('ckeditorInstance',f);f.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}i.removeListener('instanceReady',this.callee);j.on('dataReady',function(){e.trigger('setData.ckeditor',[j]);});j.on('getData',function(l){e.trigger('getData.ckeditor',[j,l.data]);},999);j.on('destroy',function(){e.trigger('destroy.ckeditor',[j]);});if(j.config.autoUpdateElementJquery&&e.is('textarea')&&e.parents('form').length){var k=function(){e.ckeditor(function(){j.updateElement();});};e.parents('form').submit(k);e.parents('form').bind('form-pre-serialize',k);e.bind('destroy.ckeditor',function(){e.parents('form').unbind('submit',k);e.parents('form').unbind('form-pre-serialize',k);});}j.on('destroy',function(){e.data('ckeditorInstance',null);});e.data('_ckeditorInstanceLock',null);e.trigger('instanceReady.ckeditor',[j]);if(b)b.apply(j,[h]);},0);},null,null,9999);}else CKEDITOR.on('instanceReady',function(i){var j=i.editor;setTimeout(function(){if(!j.element){setTimeout(arguments.callee,100);return;}if(j.element.$==h)if(b)b.apply(j,[h]);},0);},null,null,9999);});return this;}});if(CKEDITOR.config.jqueryOverrideVal)a.fn.val=CKEDITOR.tools.override(a.fn.val,function(b){return function(c,d){var e=typeof c!='undefined',f;this.each(function(){var g=a(this),h=g.data('ckeditorInstance');if(!d&&g.is('textarea')&&h){if(e)h.setData(c);else{f=h.getData();return null;}}else if(e)b.call(g,c);else{f=b.call(g);return null;}return true;});return e?this:f;};});})(); diff --git a/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.asp b/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.asp deleted file mode 100644 index aef85c9f..00000000 --- a/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.asp +++ /dev/null @@ -1,955 +0,0 @@ -<% - ' - ' Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. - ' For licensing, see LICENSE.html or http://ckeditor.com/license - -' Shared variable for all instances ("static") -dim CKEDITOR_initComplete -dim CKEDITOR_returnedEvents - - '' - ' \brief CKEditor class that can be used to create editor - ' instances in ASP pages on server side. - ' @see http://ckeditor.com - ' - ' Sample usage: - ' @code - ' editor = new CKEditor - ' editor.editor "editor1", "

            Initial value.

            ", empty, empty - ' @endcode - -Class CKEditor - - '' - ' The version of %CKEditor. - private version - - '' - ' A constant string unique for each release of %CKEditor. - private mTimeStamp - - '' - ' URL to the %CKEditor installation directory (absolute or relative to document root). - ' If not set, CKEditor will try to guess it's path. - ' - ' Example usage: - ' @code - ' editor.basePath = "/ckeditor/" - ' @endcode - Public basePath - - '' - ' A boolean variable indicating whether CKEditor has been initialized. - ' Set it to true only if you have already included - ' <script> tag loading ckeditor.js in your website. - Public initialized - - '' - ' Boolean variable indicating whether created code should be printed out or returned by a function. - ' - ' Example 1: get the code creating %CKEditor instance and print it on a page with the "echo" function. - ' @code - ' editor = new CKEditor - ' editor.returnOutput = true - ' code = editor.editor("editor1", "

            Initial value.

            ", empty, empty) - ' response.write "

            Editor 1:

            " - ' response.write code - ' @endcode - Public returnOutput - - '' - ' A Dictionary with textarea attributes. - ' - ' When %CKEditor is created with the editor() method, a HTML <textarea> element is created, - ' it will be displayed to anyone with JavaScript disabled or with incompatible browser. - public textareaAttributes - - '' - ' A string indicating the creation date of %CKEditor. - ' Do not change it unless you want to force browsers to not use previously cached version of %CKEditor. - public timestamp - - '' - ' A dictionary that holds the instance configuration. - private oInstanceConfig - - '' - ' A dictionary that holds the configuration for all the instances. - private oAllInstancesConfig - - '' - ' A dictionary that holds event listeners for the instance. - private oInstanceEvents - - '' - ' A dictionary that holds event listeners for all the instances. - private oAllInstancesEvents - - '' - ' A Dictionary that holds global event listeners (CKEDITOR object) - private oGlobalEvents - - - Private Sub Class_Initialize() - version = "3.6" - timeStamp = "B49E5BQ" - mTimeStamp = "B49E5BQ" - - Set oInstanceConfig = CreateObject("Scripting.Dictionary") - Set oAllInstancesConfig = CreateObject("Scripting.Dictionary") - - Set oInstanceEvents = CreateObject("Scripting.Dictionary") - Set oAllInstancesEvents = CreateObject("Scripting.Dictionary") - Set oGlobalEvents = CreateObject("Scripting.Dictionary") - - Set textareaAttributes = CreateObject("Scripting.Dictionary") - textareaAttributes.Add "rows", 8 - textareaAttributes.Add "cols", 60 - End Sub - - '' - ' Creates a %CKEditor instance. - ' In incompatible browsers %CKEditor will downgrade to plain HTML <textarea> element. - ' - ' @param name (string) Name of the %CKEditor instance (this will be also the "name" attribute of textarea element). - ' @param value (string) Initial value. - ' - ' Example usage: - ' @code - ' set editor = New CKEditor - ' editor.editor "field1", "

            Initial value.

            " - ' @endcode - ' - ' Advanced example: - ' @code - ' set editor = new CKEditor - ' set config = CreateObject("Scripting.Dictionary") - ' config.Add "toolbar", Array( _ - ' Array( "Source", "-", "Bold", "Italic", "Underline", "Strike" ), _ - ' Array( "Image", "Link", "Unlink", "Anchor" ) _ - ' ) - ' set events = CreateObject("Scripting.Dictionary") - ' events.Add "instanceReady", "function (evt) { alert('Loaded second editor: ' + evt.editor.name );}" - - ' editor.editor "field1", "

            Initial value.

            ", config, events - ' @endcode - ' - public function editor(name, value) - dim attr, out, js, customConfig, extraConfig - dim attribute - - attr = "" - - for each attribute in textareaAttributes - attr = attr & " " & attribute & "=""" & replace( textareaAttributes( attribute ), """", """ ) & """" - next - - out = "" & vbcrlf - - if not(initialized) then - out = out & init() - end if - - set customConfig = configSettings() - js = returnGlobalEvents() - - extraConfig = (new JSON)( empty, customConfig, false ) - if extraConfig<>"" then extraConfig = ", " & extraConfig - js = js & "CKEDITOR.replace('" & name & "'" & extraConfig & ");" - - out = out & script(js) - - if not(returnOutput) then - response.write out - out = "" - end if - - editor = out - - oInstanceConfig.RemoveAll - oInstanceEvents.RemoveAll - end function - - '' - ' Replaces a <textarea> with a %CKEditor instance. - ' - ' @param id (string) The id or name of textarea element. - ' - ' Example 1: adding %CKEditor to <textarea name="article"></textarea> element: - ' @code - ' set editor = New CKEditor - ' editor.replace "article" - ' @endcode - ' - public function replaceInstance(id) - dim out, js, customConfig, extraConfig - - out = "" - if not(initialized) then - out = out & init() - end if - - set customConfig = configSettings() - js = returnGlobalEvents() - - extraConfig = (new JSON)( empty, customConfig, false ) - if extraConfig<>"" then extraConfig = ", " & extraConfig - js = js & "CKEDITOR.replace('" & id & "'" & extraConfig & ");" - - out = out & script(js) - - if not(returnOutput) then - response.write out - out = "" - end if - - replaceInstance = out - - oInstanceConfig.RemoveAll - oInstanceEvents.RemoveAll - end function - - '' - ' Replace all <textarea> elements available in the document with editor instances. - ' - ' @param className (string) If set, replace all textareas with class className in the page. - ' - ' Example 1: replace all <textarea> elements in the page. - ' @code - ' editor = new CKEditor - ' editor.replaceAll empty - ' @endcode - ' - ' Example 2: replace all <textarea class="myClassName"> elements in the page. - ' @code - ' editor = new CKEditor - ' editor.replaceAll 'myClassName' - ' @endcode - ' - function replaceAll(className) - dim out, js, customConfig - - out = "" - if not(initialized) then - out = out & init() - end if - - set customConfig = configSettings() - js = returnGlobalEvents() - - if (customConfig.Count=0) then - if (isEmpty(className)) then - js = js & "CKEDITOR.replaceAll();" - else - js = js & "CKEDITOR.replaceAll('" & className & "');" - end if - else - js = js & "CKEDITOR.replaceAll( function(textarea, config) {\n" - if not(isEmpty(className)) then - js = js & " var classRegex = new RegExp('(?:^| )' + '" & className & "' + '(?:$| )');\n" - js = js & " if (!classRegex.test(textarea.className))\n" - js = js & " return false;\n" - end if - js = js & " CKEDITOR.tools.extend(config, " & (new JSON)( empty, customConfig, false ) & ", true);" - js = js & "} );" - end if - - out = out & script(js) - - if not(returnOutput) then - response.write out - out = "" - end if - - replaceAll = out - - oInstanceConfig.RemoveAll - oInstanceEvents.RemoveAll - end function - - - '' - ' A Dictionary that holds the %CKEditor configuration for all instances - ' For the list of available options, see http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.config.html - ' - ' Example usage: - ' @code - ' editor.config("height") = 400 - ' // Use @@ at the beggining of a string to ouput it without surrounding quotes. - ' editor.config("width") = "@@screen.width * 0.8" - ' @endcode - Public Property Let Config( configKey, configValue ) - oAllInstancesConfig.Add configKey, configValue - End Property - - '' - ' Configuration options for the next instance - ' - Public Property Let instanceConfig( configKey, configValue ) - oInstanceConfig.Add configKey, configValue - End Property - - '' - ' Adds event listener. - ' Events are fired by %CKEditor in various situations. - ' - ' @param eventName (string) Event name. - ' @param javascriptCode (string) Javascript anonymous function or function name. - ' - ' Example usage: - ' @code - ' editor.addEventHandler "instanceReady", "function (ev) { " & _ - ' " alert('Loaded: ' + ev.editor.name); " & _ - ' "}" - ' @endcode - ' - public sub addEventHandler(eventName, javascriptCode) - if not(oAllInstancesEvents.Exists( eventName ) ) then - oAllInstancesEvents.Add eventName, Array() - end if - - dim listeners, size - listeners = oAllInstancesEvents( eventName ) - size = ubound(listeners) + 1 - redim preserve listeners(size) - listeners(size) = javascriptCode - - oAllInstancesEvents( eventName ) = listeners -' '' Avoid duplicates. fixme... -' if (!in_array($javascriptCode, $this->_events[$event])) { -' $this->_events[$event][] = $javascriptCode; -' } - end sub - - '' - ' Clear registered event handlers. - ' Note: this function will have no effect on already created editor instances. - ' - ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed. - ' - public sub clearEventHandlers( eventName ) - if not(isEmpty( eventName )) then - oAllInstancesEvents.Remove eventName - else - oAllInstancesEvents.RemoveAll - end if - end sub - - - '' - ' Adds event listener only for the next instance. - ' Events are fired by %CKEditor in various situations. - ' - ' @param eventName (string) Event name. - ' @param javascriptCode (string) Javascript anonymous function or function name. - ' - ' Example usage: - ' @code - ' editor.addInstanceEventHandler "instanceReady", "function (ev) { " & _ - ' " alert('Loaded: ' + ev.editor.name); " & _ - ' "}" - ' @endcode - ' - public sub addInstanceEventHandler(eventName, javascriptCode) - if not(oInstanceEvents.Exists( eventName ) ) then - oInstanceEvents.Add eventName, Array() - end if - - dim listeners, size - listeners = oInstanceEvents( eventName ) - size = ubound(listeners) + 1 - redim preserve listeners(size) - listeners(size) = javascriptCode - - oInstanceEvents( eventName ) = listeners -' '' Avoid duplicates. fixme... -' if (!in_array($javascriptCode, $this->_events[$event])) { -' $this->_events[$event][] = $javascriptCode; -' } - end sub - - '' - ' Clear registered event handlers. - ' Note: this function will have no effect on already created editor instances. - ' - ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed. - ' - public sub clearInstanceEventHandlers( eventName ) - if not(isEmpty( eventName )) then - oInstanceEvents.Remove eventName - else - oInstanceEvents.RemoveAll - end if - end sub - - '' - ' Adds global event listener. - ' - ' @param event (string) Event name. - ' @param javascriptCode (string) Javascript anonymous function or function name. - ' - ' Example usage: - ' @code - ' editor.addGlobalEventHandler "dialogDefinition", "function (ev) { " & _ - ' " alert('Loading dialog: ' + ev.data.name); " & _ - ' "}" - ' @endcode - ' - public sub addGlobalEventHandler( eventName, javascriptCode) - if not(oGlobalEvents.Exists( eventName ) ) then - oGlobalEvents.Add eventName, Array() - end if - - dim listeners, size - listeners = oGlobalEvents( eventName ) - size = ubound(listeners) + 1 - redim preserve listeners(size) - listeners(size) = javascriptCode - - oGlobalEvents( eventName ) = listeners - -' // Avoid duplicates. -' if (!in_array($javascriptCode, $this->_globalEvents[$event])) { -' $this->_globalEvents[$event][] = $javascriptCode; -' } - end sub - - '' - ' Clear registered global event handlers. - ' Note: this function will have no effect if the event handler has been already printed/returned. - ' - ' @param eventName (string) Event name, if set to 'empty' all event handlers will be removed . - ' - public sub clearGlobalEventHandlers( eventName ) - if not(isEmpty( eventName )) then - oGlobalEvents.Remove eventName - else - oGlobalEvents.RemoveAll - end if - end sub - - '' - ' Prints javascript code. - ' - ' @param string js - ' - private function script(js) - script = "" & vbcrlf - end function - - '' - ' Returns the configuration array (global and instance specific settings are merged into one array). - ' - ' @param instanceConfig (Dictionary) The specific configurations to apply to editor instance. - ' @param instanceEvents (Dictionary) Event listeners for editor instance. - ' - private function configSettings() - dim mergedConfig, mergedEvents - set mergedConfig = cloneDictionary(oAllInstancesConfig) - set mergedEvents = cloneDictionary(oAllInstancesEvents) - - if not(isEmpty(oInstanceConfig)) then - set mergedConfig = mergeDictionary(mergedConfig, oInstanceConfig) - end if - - if not(isEmpty(oInstanceEvents)) then - for each eventName in oInstanceEvents - code = oInstanceEvents( eventName ) - - if not(mergedEvents.Exists( eventName)) then - mergedEvents.Add eventName, code - else - - dim listeners, size - listeners = mergedEvents( eventName ) - size = ubound(listeners) - if isArray( code ) then - addedCount = ubound(code) - redim preserve listeners( size + addedCount + 1 ) - for i = 0 to addedCount - listeners(size + i + 1) = code (i) - next - else - size = size + 1 - redim preserve listeners(size) - listeners(size) = code - end if - - mergedEvents( eventName ) = listeners - end if - next - - end if - - dim i, eventName, handlers, configON, ub, code - - if mergedEvents.Count>0 then - if mergedConfig.Exists( "on" ) then - set configON = mergedConfig.items( "on" ) - else - set configON = CreateObject("Scripting.Dictionary") - mergedConfig.Add "on", configOn - end if - - for each eventName in mergedEvents - handlers = mergedEvents( eventName ) - code = "" - - if isArray(handlers) then - uB = ubound(handlers) - if (uB = 0) then - code = handlers(0) - else - code = "function (ev) {" - for i=0 to uB - code = code & "(" & handlers(i) & ")(ev);" - next - code = code & "}" - end if - else - code = handlers - end if - ' Using @@ at the beggining to signal JSON that we don't want this quoted. - configON.Add eventName, "@@" & code - next - -' set mergedConfig.Item("on") = configOn - end if - - set configSettings = mergedConfig - end function - - '' - ' Returns a copy of a scripting.dictionary object - ' - private function cloneDictionary( base ) - dim newOne, tmpKey - - Set newOne = CreateObject("Scripting.Dictionary") - for each tmpKey in base - newOne.Add tmpKey , base( tmpKey ) - next - - set cloneDictionary = newOne - end function - - '' - ' Combines two scripting.dictionary objects - ' The base object isn't modified, and extra gets all the properties in base - ' - private function mergeDictionary(base, extra) - dim newOne, tmpKey - - for each tmpKey in base - if not(extra.Exists( tmpKey )) then - extra.Add tmpKey, base( tmpKey ) - end if - next - - set mergeDictionary = extra - end function - - '' - ' Return global event handlers. - ' - private function returnGlobalEvents() - dim out, eventName, handlers - dim handlersForEvent, handler, code, i - out = "" - - if (isempty(CKEDITOR_returnedEvents)) then - set CKEDITOR_returnedEvents = CreateObject("Scripting.Dictionary") - end if - - for each eventName in oGlobalEvents - handlers = oGlobalEvents( eventName ) - - if not(CKEDITOR_returnedEvents.Exists(eventName)) then - CKEDITOR_returnedEvents.Add eventName, CreateObject("Scripting.Dictionary") - end if - - set handlersForEvent = CKEDITOR_returnedEvents.Item( eventName ) - - ' handlersForEvent is another dictionary - ' and handlers is an array - - for i = 0 to ubound(handlers) - code = handlers( i ) - - ' Return only new events - if not(handlersForEvent.Exists( code )) then - if (out <> "") then out = out & vbcrlf - out = out & "CKEDITOR.on('" & eventName & "', " & code & ");" - handlersForEvent.Add code, code - end if - next - next - - returnGlobalEvents = out - end function - - '' - ' Initializes CKEditor (executed only once). - ' - private function init() - dim out, args, path, extraCode, file - out = "" - - if (CKEDITOR_initComplete) then - init = "" - exit function - end if - - if (initialized) then - CKEDITOR_initComplete = true - init = "" - exit function - end if - - args = "" - path = ckeditorPath() - - if (timestamp <> "") and (timestamp <> "%" & "TIMESTAMP%") then - args = "?t=" & timestamp - end if - - ' Skip relative paths... - if (instr(path, "..") <> 0) then - out = out & script("window.CKEDITOR_BASEPATH='" & path & "';") - end if - - out = out & "" & vbcrlf - - extraCode = "" - if (timestamp <> mTimeStamp) then - extraCode = extraCode & "CKEDITOR.timestamp = '" & timestamp & "';" - end if - if (extraCode <> "") then - out = out & script(extraCode) - end if - - CKEDITOR_initComplete = true - initialized = true - - init = out - end function - - private function ckeditorFileName() - ckeditorFileName = "ckeditor.js" - end function - - '' - ' Return path to ckeditor.js. - ' - private function ckeditorPath() - if (basePath <> "") then - ckeditorPath = basePath - else - ' In classic ASP we can't get the location of this included script - ckeditorPath = "/ckeditor/" - end if - - ' Try to check if that folder contains the CKEditor files: - ' If it's a full URL avoid checking it as it might point to an external server. - if (instr(ckeditorPath, "://") <> 0) then exit function - - dim filename, oFSO, exists - filename = server.mapPath(basePath & ckeditorFileName()) - set oFSO = Server.CreateObject("Scripting.FileSystemObject") - exists = oFSO.FileExists(filename) - set oFSO = nothing - - if not(exists) then - response.clear - response.write "

            CKEditor path validation failed

            " - response.write "

            The path "" & ckeditorPath & "" doesn't include the CKEditor main file (" & ckeditorFileName() & ")

            " - response.write "

            Please, verify that you have set it correctly and/or adjust the 'basePath' property

            " - response.write "

            Checked for physical file: "" & filename & ""

            " - response.end - end if - end function - -End Class - - - -' URL: http://www.webdevbros.net/2007/04/26/generate-json-from-asp-datatypes/ -'************************************************************************************************************** -'' @CLASSTITLE: JSON -'' @CREATOR: Michal Gabrukiewicz (gabru at grafix.at), Michael Rebec -'' @CONTRIBUTORS: - Cliff Pruitt (opensource at crayoncowboy.com) -'' - Sylvain Lafontaine -'' - Jef Housein -'' - Jeremy Brown -'' @CREATEDON: 2007-04-26 12:46 -'' @CDESCRIPTION: Comes up with functionality for JSON (http://json.org) to use within ASP. -'' Correct escaping of characters, generating JSON Grammer out of ASP datatypes and structures -'' Some examples (all use the toJSON() method but as it is the class' default method it can be left out): -'' -'' <% -'' 'simple number -'' output = (new JSON)("myNum", 2, false) -'' 'generates {"myNum": 2} -'' -'' 'array with different datatypes -'' output = (new JSON)("anArray", array(2, "x", null), true) -'' 'generates "anArray": [2, "x", null] -'' '(note: the last parameter was true, thus no surrounding brackets in the result) -'' % > -'' -'' @REQUIRES: - -'' @OPTIONEXPLICIT: yes -'' @VERSION: 1.5.1 - -'************************************************************************************************************** -class JSON - - 'private members - private output, innerCall - - '********************************************************************************************************** - '* constructor - '********************************************************************************************************** - public sub class_initialize() - newGeneration() - end sub - - '****************************************************************************************** - '' @SDESCRIPTION: STATIC! takes a given string and makes it JSON valid - '' @DESCRIPTION: all characters which needs to be escaped are beeing replaced by their - '' unicode representation according to the - '' RFC4627#2.5 - http://www.ietf.org/rfc/rfc4627.txt?number=4627 - '' @PARAM: val [string]: value which should be escaped - '' @RETURN: [string] JSON valid string - '****************************************************************************************** - public function escape(val) - dim cDoubleQuote, cRevSolidus, cSolidus - cDoubleQuote = &h22 - cRevSolidus = &h5C - cSolidus = &h2F - dim i, currentDigit - for i = 1 to (len(val)) - currentDigit = mid(val, i, 1) - if ascw(currentDigit) > &h00 and ascw(currentDigit) < &h1F then - currentDigit = escapequence(currentDigit) - elseif ascw(currentDigit) >= &hC280 and ascw(currentDigit) <= &hC2BF then - currentDigit = "\u00" + right(padLeft(hex(ascw(currentDigit) - &hC200), 2, 0), 2) - elseif ascw(currentDigit) >= &hC380 and ascw(currentDigit) <= &hC3BF then - currentDigit = "\u00" + right(padLeft(hex(ascw(currentDigit) - &hC2C0), 2, 0), 2) - else - select case ascw(currentDigit) - case cDoubleQuote: currentDigit = escapequence(currentDigit) - case cRevSolidus: currentDigit = escapequence(currentDigit) - case cSolidus: currentDigit = escapequence(currentDigit) - end select - end if - escape = escape & currentDigit - next - end function - - '****************************************************************************************************************** - '' @SDESCRIPTION: generates a representation of a name value pair in JSON grammer - '' @DESCRIPTION: It generates a name value pair which is represented as {"name": value} in JSON. - '' the generation is fully recursive. Thus the value can also be a complex datatype (array in dictionary, etc.) e.g. - '' - '' <% - '' set j = new JSON - '' j.toJSON "n", array(RS, dict, false), false - '' j.toJSON "n", array(array(), 2, true), false - '' % > - '' - '' @PARAM: name [string]: name of the value (accessible with javascript afterwards). leave empty to get just the value - '' @PARAM: val [variant], [int], [float], [array], [object], [dictionary]: value which needs - '' to be generated. Conversation of the data types is as follows:
            - '' - ASP datatype -> JavaScript datatype - '' - NOTHING, NULL -> null - '' - INT, DOUBLE -> number - '' - STRING -> string - '' - BOOLEAN -> bool - '' - ARRAY -> array - '' - DICTIONARY -> Represents it as name value pairs. Each key is accessible as property afterwards. json will look like "name": {"key1": "some value", "key2": "other value"} - '' - multidimensional array -> Generates a 1-dimensional array (flat) with all values of the multidimensional array - '' - request object -> every property and collection (cookies, form, querystring, etc) of the asp request object is exposed as an item of a dictionary. Property names are lowercase. e.g. servervariables. - '' - OBJECT -> name of the type (if unknown type) or all its properties (if class implements reflect() method) - '' Implement a reflect() function if you want your custom classes to be recognized. The function must return - '' a dictionary where the key holds the property name and the value its value. Example of a reflect function within a User class which has firstname and lastname properties - '' - '' <% - '' function reflect() - '' . set reflect = server.createObject("scripting.dictionary") - '' . reflect.add "firstname", firstname - '' . reflect.add "lastname", lastname - '' end function - '' % > - '' - '' Example of how to generate a JSON representation of the asp request object and access the HTTP_HOST server variable in JavaScript: - '' - '' - '' - '' @PARAM: nested [bool]: indicates if the name value pair is already nested within another? if yes then the {} are left out. - '' @RETURN: [string] returns a JSON representation of the given name value pair - '****************************************************************************************************************** - public default function toJSON(name, val, nested) - if not nested and not isEmpty(name) then write("{") - if not isEmpty(name) then write("""" & escape(name) & """: ") - generateValue(val) - if not nested and not isEmpty(name) then write("}") - toJSON = output - - if innerCall = 0 then newGeneration() - end function - - '****************************************************************************************************************** - '* generate - '****************************************************************************************************************** - private function generateValue(val) - if isNull(val) then - write("null") - elseif isArray(val) then - generateArray(val) - elseif isObject(val) then - dim tName : tName = typename(val) - if val is nothing then - write("null") - elseif tName = "Dictionary" or tName = "IRequestDictionary" then - generateDictionary(val) - elseif tName = "IRequest" then - set req = server.createObject("scripting.dictionary") - req.add "clientcertificate", val.ClientCertificate - req.add "cookies", val.cookies - req.add "form", val.form - req.add "querystring", val.queryString - req.add "servervariables", val.serverVariables - req.add "totalbytes", val.totalBytes - generateDictionary(req) - elseif tName = "IStringList" then - if val.count = 1 then - toJSON empty, val(1), true - else - generateArray(val) - end if - else - generateObject(val) - end if - else - 'bool - dim varTyp - varTyp = varType(val) - if varTyp = 11 then - if val then write("true") else write("false") - 'int, long, byte - elseif varTyp = 2 or varTyp = 3 or varTyp = 17 or varTyp = 19 then - write(cLng(val)) - 'single, double, currency - elseif varTyp = 4 or varTyp = 5 or varTyp = 6 or varTyp = 14 then - write(replace(cDbl(val), ",", ".")) - else - ' Using @@ at the beggining to signal JSON that we don't want this quoted. - if left(val, 2) = "@@" then - write( mid( val, 3 ) ) - else - write("""" & escape(val & "") & """") - end if - end if - end if - generateValue = output - end function - - '****************************************************************************************************************** - '* generateArray - '****************************************************************************************************************** - private sub generateArray(val) - dim item, i - write("[") - i = 0 - 'the for each allows us to support also multi dimensional arrays - for each item in val - if i > 0 then write(",") - generateValue(item) - i = i + 1 - next - write("]") - end sub - - '****************************************************************************************************************** - '* generateDictionary - '****************************************************************************************************************** - private sub generateDictionary(val) - innerCall = innerCall + 1 - if val.count = 0 then - toJSON empty, null, true - exit sub - end if - dim key, i - write("{") - i = 0 - for each key in val - if i > 0 then write(",") - toJSON key, val(key), true - i = i + 1 - next - write("}") - innerCall = innerCall - 1 - end sub - - '****************************************************************************************************************** - '* generateObject - '****************************************************************************************************************** - private sub generateObject(val) - dim props - on error resume next - set props = val.reflect() - if err = 0 then - on error goto 0 - innerCall = innerCall + 1 - toJSON empty, props, true - innerCall = innerCall - 1 - else - on error goto 0 - write("""" & escape(typename(val)) & """") - end if - end sub - - '****************************************************************************************************************** - '* newGeneration - '****************************************************************************************************************** - private sub newGeneration() - output = empty - innerCall = 0 - end sub - - '****************************************************************************************** - '* JsonEscapeSquence - '****************************************************************************************** - private function escapequence(digit) - escapequence = "\u00" + right(padLeft(hex(ascw(digit)), 2, 0), 2) - end function - - '****************************************************************************************** - '* padLeft - '****************************************************************************************** - private function padLeft(value, totalLength, paddingChar) - padLeft = right(clone(paddingChar, totalLength) & value, totalLength) - end function - - '****************************************************************************************** - '* clone - '****************************************************************************************** - private function clone(byVal str, n) - dim i - for i = 1 to n : clone = clone & str : next - end function - - '****************************************************************************************** - '* write - '****************************************************************************************** - private sub write(val) - output = output & val - end sub - -end class -%> diff --git a/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.js b/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.js index 4e804d84..e73921b8 100644 --- a/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.js +++ b/include/limesurvey/admin/scripts/ckeditor.36/ckeditor.js @@ -1,146 +1,146 @@ -/* -Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved. -For licensing, see LICENSE.html or http://ckeditor.com/license -*/ - -(function(){if(window.CKEDITOR&&window.CKEDITOR.dom)return;if(!window.CKEDITOR)window.CKEDITOR=(function(){var a={timestamp:'B49E5BQ',version:'3.6',revision:'6902',_:{},status:'unloaded',basePath:(function(){var d=window.CKEDITOR_BASEPATH||'';if(!d){var e=document.getElementsByTagName('script');for(var f=0;f=0?'&':'?')+'t='+this.timestamp;return d;}},b=window.CKEDITOR_GETURL;if(b){var c=a.getUrl;a.getUrl=function(d){return b.call(a,d)||c.call(a,d);};}return a;})();var a=CKEDITOR;if(!a.event){a.event=function(){};a.event.implementOn=function(b){var c=a.event.prototype;for(var d in c){if(b[d]==undefined)b[d]=c[d];}};a.event.prototype=(function(){var b=function(d){var e=d.getPrivate&&d.getPrivate()||d._||(d._={});return e.events||(e.events={});},c=function(d){this.name=d;this.listeners=[];};c.prototype={getListenerIndex:function(d){for(var e=0,f=this.listeners;e=0;n--){if(k[n].priority<=h){k.splice(n+1,0,m);return;}}k.unshift(m);}},fire:(function(){var d=false,e=function(){d=true;},f=false,g=function(){f=true;};return function(h,i,j){var k=b(this)[h],l=d,m=f;d=f=false;if(k){var n=k.listeners;if(n.length){n=n.slice(0);for(var o=0;o=0)f.listeners.splice(g,1); -}},hasListeners:function(d){var e=b(this)[d];return e&&e.listeners.length>0;}};})();}if(!a.editor){a.ELEMENT_MODE_NONE=0;a.ELEMENT_MODE_REPLACE=1;a.ELEMENT_MODE_APPENDTO=2;a.editor=function(b,c,d,e){var f=this;f._={instanceConfig:b,element:c,data:e};f.elementMode=d||0;a.event.call(f);f._init();};a.editor.replace=function(b,c){var d=b;if(typeof d!='object'){d=document.getElementById(b);if(d&&d.tagName.toLowerCase() in {style:1,script:1,base:1,link:1,meta:1,title:1})d=null;if(!d){var e=0,f=document.getElementsByName(b);while((d=f[e++])&&d.tagName.toLowerCase()!='textarea'){}}if(!d)throw '[CKEDITOR.editor.replace] The element with id or name "'+b+'" was not found.';}d.style.visibility='hidden';return new a.editor(c,d,1);};a.editor.appendTo=function(b,c,d){var e=b;if(typeof e!='object'){e=document.getElementById(b);if(!e)throw '[CKEDITOR.editor.appendTo] The element with id "'+b+'" was not found.';}return new a.editor(c,e,2,d);};a.editor.prototype={_init:function(){var b=a.editor._pending||(a.editor._pending=[]);b.push(this);},fire:function(b,c){return a.event.prototype.fire.call(this,b,c,this);},fireOnce:function(b,c){return a.event.prototype.fireOnce.call(this,b,c,this);}};a.event.implementOn(a.editor.prototype,true);}if(!a.env)a.env=(function(){var b=navigator.userAgent.toLowerCase(),c=window.opera,d={ie:/*@cc_on!@*/false,opera:!!c&&c.version,webkit:b.indexOf(' applewebkit/')>-1,air:b.indexOf(' adobeair/')>-1,mac:b.indexOf('macintosh')>-1,quirks:document.compatMode=='BackCompat',mobile:b.indexOf('mobile')>-1,isCustomDomain:function(){if(!this.ie)return false;var g=document.domain,h=window.location.hostname;return g!=h&&g!='['+h+']';}};d.gecko=navigator.product=='Gecko'&&!d.webkit&&!d.opera;var e=0;if(d.ie){e=parseFloat(b.match(/msie (\d+)/)[1]);d.ie8=!!document.documentMode;d.ie8Compat=document.documentMode==8;d.ie9Compat=document.documentMode==9;d.ie7Compat=e==7&&!document.documentMode||document.documentMode==7;d.ie6Compat=e<7||d.quirks;}if(d.gecko){var f=b.match(/rv:([\d\.]+)/);if(f){f=f[1].split('.');e=f[0]*10000+(f[1]||0)*100+ +(f[2]||0);}}if(d.opera)e=parseFloat(c.version());if(d.air)e=parseFloat(b.match(/ adobeair\/(\d+)/)[1]);if(d.webkit)e=parseFloat(b.match(/ applewebkit\/(\d+)/)[1]);d.version=e;d.isCompatible=!d.mobile&&(d.ie&&e>=6||d.gecko&&e>=10801||d.opera&&e>=9.5||d.air&&e>=1||d.webkit&&e>=522||false);d.cssClass='cke_browser_'+(d.ie?'ie':d.gecko?'gecko':d.opera?'opera':d.webkit?'webkit':'unknown')+ ' cke_minimized';if(d.quirks)d.cssClass+=' cke_browser_quirks'; -if(d.ie){d.cssClass+=' cke_browser_ie'+(d.version<7?'6':d.version>=8?document.documentMode:'7');if(d.quirks)d.cssClass+=' cke_browser_iequirks';}if(d.gecko&&e<10900)d.cssClass+=' cke_browser_gecko18';if(d.air)d.cssClass+=' cke_browser_air';return d;})();var b=a.env;var c=b.ie;if(a.status=='unloaded')(function(){a.event.implementOn(a);a.loadFullCore=function(){if(a.status!='basic_ready'){a.loadFullCore._load=1;return;}delete a.loadFullCore;var e=document.createElement('script');e.type='text/javascript';e.src=a.basePath+'ckeditor.js';document.getElementsByTagName('head')[0].appendChild(e);};a.loadFullCoreTimeout=0;a.replaceClass='ckeditor';a.replaceByClassEnabled=1;var d=function(e,f,g,h){if(b.isCompatible){if(a.loadFullCore)a.loadFullCore();var i=g(e,f,h);a.add(i);return i;}return null;};a.replace=function(e,f){return d(e,f,a.editor.replace);};a.appendTo=function(e,f,g){return d(e,f,a.editor.appendTo,g);};a.add=function(e){var f=this._.pending||(this._.pending=[]);f.push(e);};a.replaceAll=function(){var e=document.getElementsByTagName('textarea');for(var f=0;f'+g+'');else h.push('');}return h.join('');},htmlEncode:function(f){var g=function(k){var l=new d.element('span');l.setText(k);return l.getHtml();},h=g('\n').toLowerCase()=='
            '?function(k){return g(k).replace(/
            /gi,'\n');}:g,i=g('>')=='>'?function(k){return h(k).replace(/>/g,'>');}:h,j=g(' ')=='  '?function(k){return i(k).replace(/ /g,' ');}:i;this.htmlEncode=j;return this.htmlEncode(f);},htmlEncodeAttr:function(f){return f.replace(/"/g,'"').replace(//g,'>');},getNextNumber:(function(){var f=0;return function(){return++f;};})(),getNextId:function(){return 'cke_'+this.getNextNumber();},override:function(f,g){return g(f);},setTimeout:function(f,g,h,i,j){if(!j)j=window;if(!h)h=j;return j.setTimeout(function(){if(i)f.apply(h,[].concat(i));else f.apply(h);},g||0);},trim:(function(){var f=/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g;return function(g){return g.replace(f,'');};})(),ltrim:(function(){var f=/^[ \t\n\r]+/g;return function(g){return g.replace(f,'');};})(),rtrim:(function(){var f=/[ \t\n\r]+$/g;return function(g){return g.replace(f,'');};})(),indexOf:Array.prototype.indexOf?function(f,g){return f.indexOf(g);}:function(f,g){for(var h=0,i=f.length;h8))&&i)h=i+':'+h;return new d.nodeList(this.$.getElementsByTagName(h));},getHead:function(){var h=this.$.getElementsByTagName('head')[0];if(!h)h=this.getDocumentElement().append(new d.element('head'),true);else h=new d.element(h);return(this.getHead=function(){return h;})();},getBody:function(){var h=new d.element(this.$.body);return(this.getBody=function(){return h;})();},getDocumentElement:function(){var h=new d.element(this.$.documentElement);return(this.getDocumentElement=function(){return h;})();},getWindow:function(){var h=new d.window(this.$.parentWindow||this.$.defaultView);return(this.getWindow=function(){return h; -})();},write:function(h){var i=this;i.$.open('text/html','replace');b.isCustomDomain()&&(i.$.domain=document.domain);i.$.write(h);i.$.close();}});d.node=function(h){if(h){switch(h.nodeType){case 9:return new g(h);case 1:return new d.element(h);case 3:return new d.text(h);}d.domObject.call(this,h);}return this;};d.node.prototype=new d.domObject();a.NODE_ELEMENT=1;a.NODE_DOCUMENT=9;a.NODE_TEXT=3;a.NODE_COMMENT=8;a.NODE_DOCUMENT_FRAGMENT=11;a.POSITION_IDENTICAL=0;a.POSITION_DISCONNECTED=1;a.POSITION_FOLLOWING=2;a.POSITION_PRECEDING=4;a.POSITION_IS_CONTAINED=8;a.POSITION_CONTAINS=16;e.extend(d.node.prototype,{appendTo:function(h,i){h.append(this,i);return h;},clone:function(h,i){var j=this.$.cloneNode(h),k=function(l){if(l.nodeType!=1)return;if(!i)l.removeAttribute('id',false);l.removeAttribute('data-cke-expando',false);if(h){var m=l.childNodes;for(var n=0;n]*>/g,''):i;},getOuterHtml:function(){var j=this;if(j.$.outerHTML)return j.$.outerHTML.replace(/<\?[^>]*>/,'');var i=j.$.ownerDocument.createElement('div');i.appendChild(j.$.cloneNode(true));return i.innerHTML;},setHtml:function(i){return this.$.innerHTML=i;},setText:function(i){h.prototype.setText=this.$.innerText!=undefined?function(j){return this.$.innerText=j;}:function(j){return this.$.textContent=j;};return this.setText(i);},getAttribute:(function(){var i=function(j){return this.$.getAttribute(j,2);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){var n=this;switch(j){case 'class':j='className';break;case 'http-equiv':j='httpEquiv';break;case 'name':return n.$.name;case 'tabindex':var k=i.call(n,j);if(k!==0&&n.$.tabIndex===0)k=null;return k;break;case 'checked':var l=n.$.attributes.getNamedItem(j),m=l.specified?l.nodeValue:n.$.checked;return m?'checked':null;case 'hspace':case 'value':return n.$[j];case 'style':return n.$.style.cssText;}return i.call(n,j);};else return i;})(),getChildren:function(){return new d.nodeList(this.$.childNodes);},getComputedStyle:c?function(i){return this.$.currentStyle[e.cssStyleToDomStyle(i)];}:function(i){return this.getWindow().$.getComputedStyle(this.$,'').getPropertyValue(i);},getDtd:function(){var i=f[this.getName()];this.getDtd=function(){return i;};return i;},getElementsByTag:g.prototype.getElementsByTag,getTabIndex:c?function(){var i=this.$.tabIndex;if(i===0&&!f.$tabIndex[this.getName()]&&parseInt(this.getAttribute('tabindex'),10)!==0)i=-1;return i;}:b.webkit?function(){var i=this.$.tabIndex;if(i==undefined){i=parseInt(this.getAttribute('tabindex'),10);if(isNaN(i))i=-1;}return i;}:function(){return this.$.tabIndex;},getText:function(){return this.$.textContent||this.$.innerText||'';},getWindow:function(){return this.getDocument().getWindow();},getId:function(){return this.$.id||null;},getNameAtt:function(){return this.$.name||null;},getName:function(){var i=this.$.nodeName.toLowerCase();if(c&&!(document.documentMode>8)){var j=this.$.scopeName;if(j!='HTML')i=j.toLowerCase()+':'+i;}return(this.getName=function(){return i; -})();},getValue:function(){return this.$.value;},getFirst:function(i){var j=this.$.firstChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getNext(i);return k;},getLast:function(i){var j=this.$.lastChild,k=j&&new d.node(j);if(k&&i&&!i(k))k=k.getPrevious(i);return k;},getStyle:function(i){return this.$.style[e.cssStyleToDomStyle(i)];},is:function(){var i=this.getName();for(var j=0;j0&&(j>2||!k[i[0].nodeName]||j==2&&!k[i[1].nodeName]);},hasAttribute:(function(){function i(j){var k=this.$.attributes.getNamedItem(j);return!!(k&&k.specified);};return c&&b.version<8?function(j){if(j=='name')return!!this.$.name;return i.call(this,j);}:i;})(),hide:function(){this.setStyle('display','none');},moveChildren:function(i,j){var k=this.$;i=i.$;if(k==i)return;var l;if(j)while(l=k.lastChild)i.insertBefore(k.removeChild(l),i.firstChild);else while(l=k.firstChild)i.appendChild(k.removeChild(l));},mergeSiblings:(function(){function i(j,k,l){if(k&&k.type==1){var m=[]; -while(k.data('cke-bookmark')||k.isEmptyInlineRemoveable()){m.push(k);k=l?k.getNext():k.getPrevious();if(!k||k.type!=1)return;}if(j.isIdentical(k)){var n=l?j.getLast():j.getFirst();while(m.length)m.shift().move(j,!l);k.moveChildren(j,!l);k.remove();if(n&&n.type==1)n.mergeSiblings();}}};return function(j){var k=this;if(!(j===false||f.$removeEmpty[k.getName()]||k.is('a')))return;i(k,k.getNext(),true);i(k,k.getPrevious());};})(),show:function(){this.setStyles({display:'',visibility:''});},setAttribute:(function(){var i=function(j,k){this.$.setAttribute(j,k);return this;};if(c&&(b.ie7Compat||b.ie6Compat))return function(j,k){var l=this;if(j=='class')l.$.className=k;else if(j=='style')l.$.style.cssText=k;else if(j=='tabindex')l.$.tabIndex=k;else if(j=='checked')l.$.checked=k;else i.apply(l,arguments);return l;};else return i;})(),setAttributes:function(i){for(var j in i)this.setAttribute(j,i[j]);return this;},setValue:function(i){this.$.value=i;return this;},removeAttribute:(function(){var i=function(j){this.$.removeAttribute(j);};if(c&&(b.ie7Compat||b.ie6Compat))return function(j){if(j=='class')j='className';else if(j=='tabindex')j='tabIndex';i.call(this,j);};else return i;})(),removeAttributes:function(i){if(e.isArray(i))for(var j=0;j=100?'':'progid:DXImageTransform.Microsoft.Alpha(opacity='+i+')');}else this.setStyle('opacity',i);},unselectable:b.gecko?function(){this.$.style.MozUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:b.webkit?function(){this.$.style.KhtmlUserSelect='none';this.on('dragstart',function(i){i.data.preventDefault();});}:function(){if(c||b.opera){var i=this.$,j,k=0;i.unselectable='on';while(j=i.all[k++])switch(j.tagName.toLowerCase()){case 'iframe':case 'textarea':case 'input':case 'select':break;default:j.unselectable='on';}}},getPositionedAncestor:function(){var i=this;while(i.getName()!='html'){if(i.getComputedStyle('position')!='static')return i;i=i.getParent();}return null;},getDocumentPosition:function(i){var D=this; -var j=0,k=0,l=D.getDocument().getBody(),m=D.getDocument().$.compatMode=='BackCompat',n=D.getDocument();if(document.documentElement.getBoundingClientRect){var o=D.$.getBoundingClientRect(),p=n.$,q=p.documentElement,r=q.clientTop||l.$.clientTop||0,s=q.clientLeft||l.$.clientLeft||0,t=true;if(c){var u=n.getDocumentElement().contains(D),v=n.getBody().contains(D);t=m&&v||!m&&u;}if(t){j=o.left+(!m&&q.scrollLeft||l.$.scrollLeft);j-=s;k=o.top+(!m&&q.scrollTop||l.$.scrollTop);k-=r;}}else{var w=D,x=null,y;while(w&&!(w.getName()=='body'||w.getName()=='html')){j+=w.$.offsetLeft-w.$.scrollLeft;k+=w.$.offsetTop-w.$.scrollTop;if(!w.equals(D)){j+=w.$.clientLeft||0;k+=w.$.clientTop||0;}var z=x;while(z&&!z.equals(w)){j-=z.$.scrollLeft;k-=z.$.scrollTop;z=z.getParent();}x=w;w=(y=w.$.offsetParent)?new h(y):null;}}if(i){var A=D.getWindow(),B=i.getWindow();if(!A.equals(B)&&A.$.frameElement){var C=new h(A.$.frameElement).getDocumentPosition(i);j+=C.x;k+=C.y;}}if(!document.documentElement.getBoundingClientRect)if(b.gecko&&!m){j+=D.$.clientLeft?1:0;k+=D.$.clientTop?1:0;}return{x:j,y:k};},scrollIntoView:function(i){var o=this;var j=o.getWindow(),k=j.getViewPaneSize().height,l=k*-1;if(i)l+=k;else{l+=o.$.offsetHeight||0;l+=parseInt(o.getComputedStyle('marginBottom')||0,10)||0;}var m=o.getDocumentPosition();l+=m.y;l=l<0?0:l;var n=j.getScrollPosition().y;if(l>n||lwindow.setTimeout(function(){window.close();},50);")');}return i&&new g(i.contentWindow.document);},copyAttributes:function(i,j){var p=this;var k=p.$.attributes;j=j||{};for(var l=0;l0&&j)j=j.childNodes[i.shift()];return j?new d.node(j):null;},getChildCount:function(){return this.$.childNodes.length;},disableContextMenu:function(){this.on('contextmenu',function(i){if(!i.data.getTarget().hasClass('cke_enable_context_menu'))i.data.preventDefault();});},getDirection:function(i){return i?this.getComputedStyle('direction'):this.getStyle('direction')||this.getAttribute('dir');},data:function(i,j){i='data-'+i;if(j===undefined)return this.getAttribute(i);else if(j===false)this.removeAttribute(i);else this.setAttribute(i,j);return null;}});(function(){var i={width:['border-left-width','border-right-width','padding-left','padding-right'],height:['border-top-width','border-bottom-width','padding-top','padding-bottom']};function j(k){var l=0;for(var m=0,n=i[k].length;m',bodyId:'',bodyClass:'',fullPage:false,height:200,plugins:'about,a11yhelp,basicstyles,bidi,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,dialogadvtab,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,iframe,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',extraPlugins:'',removePlugins:'',protectedSource:[],tabIndex:0,theme:'default',skin:'kama',width:'',baseFloatZIndex:10000}; -var i=a.config;a.focusManager=function(j){if(j.focusManager)return j.focusManager;this.hasFocus=false;this._={editor:j};return this;};a.focusManager.prototype={focus:function(){var k=this;if(k._.timer)clearTimeout(k._.timer);if(!k.hasFocus){if(a.currentInstance)a.currentInstance.focusManager.forceBlur();var j=k._.editor;j.container.getChild(1).addClass('cke_focus');k.hasFocus=true;j.fire('focus');}},blur:function(){var j=this;if(j._.timer)clearTimeout(j._.timer);j._.timer=setTimeout(function(){delete j._.timer;j.forceBlur();},100);},forceBlur:function(){if(this.hasFocus){var j=this._.editor;j.container.getChild(1).removeClass('cke_focus');this.hasFocus=false;j.fire('blur');}}};(function(){var j={};a.lang={languages:{af:1,ar:1,bg:1,bn:1,bs:1,ca:1,cs:1,cy:1,da:1,de:1,el:1,'en-au':1,'en-ca':1,'en-gb':1,en:1,eo:1,es:1,et:1,eu:1,fa:1,fi:1,fo:1,'fr-ca':1,fr:1,gl:1,gu:1,he:1,hi:1,hr:1,hu:1,is:1,it:1,ja:1,ka:1,km:1,ko:1,lt:1,lv:1,mn:1,ms:1,nb:1,nl:1,no:1,pl:1,'pt-br':1,pt:1,ro:1,ru:1,sk:1,sl:1,'sr-latn':1,sr:1,sv:1,th:1,tr:1,uk:1,vi:1,'zh-cn':1,zh:1},load:function(k,l,m){if(!k||!a.lang.languages[k])k=this.detect(l,k);if(!this[k])a.scriptLoader.load(a.getUrl('lang/'+k+'.js'),function(){m(k,this[k]);},this);else m(k,this[k]);},detect:function(k,l){var m=this.languages;l=l||navigator.userLanguage||navigator.language;var n=l.toLowerCase().match(/([a-z]+)(?:-([a-z]+))?/),o=n[1],p=n[2];if(m[o+'-'+p])o=o+'-'+p;else if(!m[o])o=null;a.lang.detect=o?function(){return o;}:function(q){return q;};return o||k;}};})();a.scriptLoader=(function(){var j={},k={};return{load:function(l,m,n,o){var p=typeof l=='string';if(p)l=[l];if(!n)n=a;var q=l.length,r=[],s=[],t=function(y){if(m)if(p)m.call(n,y);else m.call(n,r,s);};if(q===0){t(true);return;}var u=function(y,z){(z?r:s).push(y);if(--q<=0){o&&a.document.getDocumentElement().removeStyle('cursor');t(z);}},v=function(y,z){j[y]=1;var A=k[y];delete k[y];for(var B=0;B1)return;var A=new h('script');A.setAttributes({type:'text/javascript',src:y});if(m)if(c)A.$.onreadystatechange=function(){if(A.$.readyState=='loaded'||A.$.readyState=='complete'){A.$.onreadystatechange=null;v(y,true);}};else{A.$.onload=function(){setTimeout(function(){v(y,true);},0);};A.$.onerror=function(){v(y,false);};}A.appendTo(a.document.getHead());};o&&a.document.getDocumentElement().setStyle('cursor','wait');for(var x=0;x1)return;var w=!p.css||!p.css.length,x=!p.js||!p.js.length,y=function(){if(w&&x){p._isLoaded=1;for(var B=0;B=0?x.langCode:J[0];if(!I.langEntries||!I.langEntries[L])G.push(a.getUrl(K+'lang/'+L+'.js'));else{e.extend(x.lang,I.langEntries[L]);L=null;}}F.push(L);E.push(I);}a.scriptLoader.load(G,function(){var M=['beforeInit','init','afterInit'];for(var N=0;N]+)>)|(?:!--([\\S|\\s]*?)-->)|(?:([^\\s>]+)\\s*((?:(?:\"[^\"]*\")|(?:'[^']*')|[^\"'>])*)\\/?>))",'g')};};(function(){var l=/([\w\-:.]+)(?:(?:\s*=\s*(?:(?:"([^"]*)")|(?:'([^']*)')|([^\s>]+)))|(?=\s|$))/g,m={checked:1,compact:1,declare:1,defer:1,disabled:1,ismap:1,multiple:1,nohref:1,noresize:1,noshade:1,nowrap:1,readonly:1,selected:1};a.htmlParser.prototype={onTagOpen:function(){},onTagClose:function(){},onText:function(){},onCDATA:function(){},onComment:function(){},parse:function(n){var A=this;var o,p,q=0,r;while(o=A._.htmlPartsRegex.exec(n)){var s=o.index;if(s>q){var t=n.substring(q,s);if(r)r.push(t);else A.onText(t);}q=A._.htmlPartsRegex.lastIndex;if(p=o[1]){p=p.toLowerCase();if(r&&f.$cdata[p]){A.onCDATA(r.join(''));r=null;}if(!r){A.onTagClose(p);continue;}}if(r){r.push(o[0]);continue;}if(p=o[3]){p=p.toLowerCase();if(/="/.test(p))continue;var u={},v,w=o[4],x=!!(w&&w.charAt(w.length-1)=='/');if(w)while(v=l.exec(w)){var y=v[1].toLowerCase(),z=v[2]||v[3]||v[4]||''; -if(!z&&m[y])u[y]=y;else u[y]=z;}A.onTagOpen(p,u,x);if(!r&&f.$cdata[p])r=[];continue;}if(p=o[2])A.onComment(p);}if(n.length>q)A.onText(n.substring(q,n.length));}};})();a.htmlParser.comment=function(l){this.value=l;this._={isBlockLike:false};};a.htmlParser.comment.prototype={type:8,writeHtml:function(l,m){var n=this.value;if(m){if(!(n=m.onComment(n,this)))return;if(typeof n!='string'){n.parent=this.parent;n.writeHtml(l,m);return;}}l.comment(n);}};(function(){var l=/[\t\r\n ]{2,}|[\t\r\n]/g;a.htmlParser.text=function(m){this.value=m;this._={isBlockLike:false};};a.htmlParser.text.prototype={type:3,writeHtml:function(m,n){var o=this.value;if(n&&!(o=n.onText(o,this)))return;m.text(o);}};})();(function(){a.htmlParser.cdata=function(l){this.value=l;};a.htmlParser.cdata.prototype={type:3,writeHtml:function(l){l.write(this.value);}};})();a.htmlParser.fragment=function(){this.children=[];this.parent=null;this._={isBlockLike:true,hasInlineStarted:false};};(function(){var l=e.extend({table:1,ul:1,ol:1,dl:1},f.table,f.ul,f.ol,f.dl),m={ol:1,ul:1},n=e.extend({},{html:1},f.html,f.body,f.head,{style:1,script:1});a.htmlParser.fragment.fromHtml=function(o,p,q){var r=new a.htmlParser(),s=q||new a.htmlParser.fragment(),t=[],u=[],v=s,w=false;function x(A){var B;if(t.length>0)for(var C=0;C=0;B--){if(A==t[B].name){t.splice(B,1);return;}}var C=[],D=[],E=v;while(E!=s&&E.name!=A){if(!E._.isBlockLike)D.unshift(E);C.push(E);E=E.returnPoint||E.parent;}if(E!=s){for(B=0;B0&&r.children[p-1]||null;if(q){if(o._.isBlockLike&&q.type==3){q.value=e.rtrim(q.value);if(q.value.length===0){r.children.pop();r.add(o);return;}}q.next=o;}o.previous=q;o.parent=r;r.children.push(o);r._.hasInlineStarted=o.type==3||o.type==1&&!o._.isBlockLike;},writeHtml:function(o,p){var q;this.filterChildren=function(){var r=new a.htmlParser.basicWriter();this.writeChildrenHtml.call(this,r,p,true);var s=r.getHtml();this.children=new a.htmlParser.fragment.fromHtml(s).children;q=1;};!this.name&&p&&p.onFragment(this);this.writeChildrenHtml(o,q?null:p);},writeChildrenHtml:function(o,p){for(var q=0;qn?1:0;};a.htmlParser.element.prototype={type:1,add:a.htmlParser.fragment.prototype.add,clone:function(){return new a.htmlParser.element(this.name,this.attributes); -},writeHtml:function(m,n){var o=this.attributes,p=this,q=p.name,r,s,t,u;p.filterChildren=function(){if(!u){var z=new a.htmlParser.basicWriter();a.htmlParser.fragment.prototype.writeChildrenHtml.call(p,z,n);p.children=new a.htmlParser.fragment.fromHtml(z.getHtml(),0,p.clone()).children;u=1;}};if(n){for(;;){if(!(q=n.onElementName(q)))return;p.name=q;if(!(p=n.onElement(p)))return;p.parent=this.parent;if(p.name==q)break;if(p.type!=1){p.writeHtml(m,n);return;}q=p.name;if(!q){this.writeChildrenHtml.call(p,m,u?null:n);return;}}o=p.attributes;}m.openTag(q,o);var v=[];for(var w=0;w<2;w++)for(r in o){s=r;t=o[r];if(w==1)v.push([r,t]);else if(n){for(;;){if(!(s=n.onAttributeName(r))){delete o[r];break;}else if(s!=r){delete o[r];r=s;continue;}else break;}if(s)if((t=n.onAttribute(p,s,t))===false)delete o[s];else o[s]=t;}}if(m.sortAttributes)v.sort(l);var x=v.length;for(w=0;w=0;u--){var x=r[u];if(x){x.pri=s;q.splice(t,0,x);}}}};function n(q,r,s){if(r)for(var t in r){var u=q[t];q[t]=o(u,r[t],s);if(!u)q.$length++;}};function o(q,r,s){if(r){r.pri=s;if(q){if(!q.splice){if(q.pri>s)q=[r,q];else q=[q,r];q.filter=p;}else m(q,r,s);return q;}else{r.filter=r;return r;}}};function p(q){var r=q.type||q instanceof a.htmlParser.fragment;for(var s=0;s');else this._.output.push('>');},attribute:function(l,m){if(typeof m=='string')m=e.htmlEncodeAttr(m);this._.output.push(' ',l,'="',m,'"');},closeTag:function(l){this._.output.push('');},text:function(l){this._.output.push(l);},comment:function(l){this._.output.push('');},write:function(l){this._.output.push(l);},reset:function(){this._.output=[];this._.indent=false;},getHtml:function(l){var m=this._.output.join('');if(l)this.reset();return m;}}});delete a.loadFullCore;a.instances={};a.document=new g(document);a.add=function(l){a.instances[l.name]=l;l.on('focus',function(){if(a.currentInstance!=l){a.currentInstance=l;a.fire('currentInstance');}});l.on('blur',function(){if(a.currentInstance==l){a.currentInstance=null;a.fire('currentInstance');}});};a.remove=function(l){delete a.instances[l.name];};a.on('instanceDestroyed',function(){if(e.isEmpty(this.instances))a.fire('reset');});a.TRISTATE_ON=1;a.TRISTATE_OFF=2;a.TRISTATE_DISABLED=0;d.comment=e.createClass({base:d.node,$:function(l,m){if(typeof l=='string')l=(m?m.$:document).createComment(l);this.base(l);},proto:{type:8,getOuterHtml:function(){return '';}}});(function(){var l={address:1,blockquote:1,dl:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,p:1,pre:1,li:1,dt:1,dd:1,legend:1},m={body:1,div:1,table:1,tbody:1,tr:1,td:1,th:1,caption:1,form:1,fieldset:1},n=function(o){var p=o.getChildren();for(var q=0,r=p.count();q0&&C.getChild(v.startOffset-1);this._.guardRTL=function(F,G){return(!G||!C.equals(F))&&(!D||!F.equals(D))&&(F.type!=1||!G||F.getName()!='body');};}var E=s?this._.guardRTL:this._.guardLTR;if(x)w=function(F,G){if(E(F,G)===false)return false; -return x(F,G);};else w=E;if(this.current)u=this.current[z](false,y,w);else if(s){u=v.endContainer;if(v.endOffset>0){u=u.getChild(v.endOffset-1);if(w(u)===false)u=null;}else u=w(u,true)===false?null:u.getPreviousSourceNode(true,y,w);}else{u=v.startContainer;u=u.getChild(v.startOffset);if(u){if(w(u)===false)u=null;}else u=w(v.startContainer,true)===false?null:v.startContainer.getNextSourceNode(true,y,w);}while(u&&!this._.end){this.current=u;if(!this.evaluator||this.evaluator(u)!==false){if(!t)return u;}else if(t&&this.evaluator)return false;u=u[z](false,y,w);}this.end();return this.current=null;};function m(s){var t,u=null;while(t=l.call(this,s))u=t;return u;};d.walker=e.createClass({$:function(s){this.range=s;this._={};},proto:{end:function(){this._.end=1;},next:function(){return l.call(this);},previous:function(){return l.call(this,1);},checkForward:function(){return l.call(this,0,1)!==false;},checkBackward:function(){return l.call(this,1,1)!==false;},lastForward:function(){return m.call(this);},lastBackward:function(){return m.call(this,1);},reset:function(){delete this.current;this._={};}}});var n={block:1,'list-item':1,table:1,'table-row-group':1,'table-header-group':1,'table-footer-group':1,'table-row':1,'table-column-group':1,'table-column':1,'table-cell':1,'table-caption':1};h.prototype.isBlockBoundary=function(s){var t=s?e.extend({},f.$block,s||{}):f.$block;return this.getComputedStyle('float')=='none'&&n[this.getComputedStyle('display')]||t[this.getName()];};d.walker.blockBoundary=function(s){return function(t,u){return!(t.type==1&&t.isBlockBoundary(s));};};d.walker.listItemBoundary=function(){return this.blockBoundary({br:1});};d.walker.bookmark=function(s,t){function u(v){return v&&v.getName&&v.getName()=='span'&&v.data('cke-bookmark');};return function(v){var w,x;w=v&&!v.getName&&(x=v.getParent())&&u(x);w=s?w:w||u(v);return!!(t^w);};};d.walker.whitespaces=function(s){return function(t){var u=t&&t.type==3&&!e.trim(t.getText());return!!(s^u);};};d.walker.invisible=function(s){var t=d.walker.whitespaces();return function(u){var v=t(u)||u.is&&!u.$.offsetHeight;return!!(s^v);};};d.walker.nodeType=function(s,t){return function(u){return!!(t^u.type==s);};};var o=/^[\t\r\n ]*(?: |\xa0)$/,p=d.walker.whitespaces(),q=d.walker.bookmark(),r=function(s){return q(s)||p(s)||s.type==1&&s.getName() in f.$inline&&!(s.getName() in f.$empty);};h.prototype.getBogus=function(){var s=this;do s=s.getPreviousSourceNode();while(r(s));if(s&&(!c?s.is&&s.is('br'):s.getText&&o.test(s.getText())))return s; -return false;};})();d.range=function(l){var m=this;m.startContainer=null;m.startOffset=null;m.endContainer=null;m.endOffset=null;m.collapsed=true;m.document=l;};(function(){var l=function(t){t.collapsed=t.startContainer&&t.endContainer&&t.startContainer.equals(t.endContainer)&&t.startOffset==t.endOffset;},m=function(t,u,v,w){t.optimizeBookmark();var x=t.startContainer,y=t.endContainer,z=t.startOffset,A=t.endOffset,B,C;if(y.type==3)y=y.split(A);else if(y.getChildCount()>0)if(A>=y.getChildCount()){y=y.append(t.document.createText(''));C=true;}else y=y.getChild(A);if(x.type==3){x.split(z);if(x.equals(y))y=x.getNext();}else if(!z){x=x.getFirst().insertBeforeMe(t.document.createText(''));B=true;}else if(z>=x.getChildCount()){x=x.append(t.document.createText(''));B=true;}else x=x.getChild(z).getPrevious();var D=x.getParents(),E=y.getParents(),F,G,H;for(F=0;F0&&!J.equals(y))K=I.append(J.clone());if(!D[O]||J.$.parentNode!=D[O].$.parentNode){L=J.getPrevious();while(L){if(L.equals(D[O])||L.equals(x))break;M=L.getPrevious();if(u==2)I.$.insertBefore(L.$.cloneNode(true),I.$.firstChild);else{L.remove();if(u==1)I.$.insertBefore(L.$,I.$.firstChild);}L=M;}}if(I)I=K;}if(u==2){var P=t.startContainer;if(P.type==3){P.$.data+=P.$.nextSibling.data;P.$.parentNode.removeChild(P.$.nextSibling);}var Q=t.endContainer;if(Q.type==3&&Q.$.nextSibling){Q.$.data+=Q.$.nextSibling.data;Q.$.parentNode.removeChild(Q.$.nextSibling);}}else{if(G&&H&&(x.$.parentNode!=G.$.parentNode||y.$.parentNode!=H.$.parentNode)){var R=H.getIndex();if(B&&H.$.parentNode==x.$.parentNode)R--;if(w&&G.type==1){var S=h.createFromHtml(' ',t.document);S.insertAfter(G);G.mergeSiblings(false);t.moveToBookmark({startNode:S});}else t.setStart(H.getParent(),R);}t.collapse(true);}if(B)x.remove();if(C&&y.$.parentNode)y.remove();},n={abbr:1,acronym:1,b:1,bdo:1,big:1,cite:1,code:1,del:1,dfn:1,em:1,font:1,i:1,ins:1,label:1,kbd:1,q:1,samp:1,small:1,span:1,strike:1,strong:1,sub:1,sup:1,tt:1,u:1,'var':1};function o(t){var u=false,v=d.walker.bookmark(true);return function(w){if(v(w))return true;if(w.type==3){if(w.hasAscendant('pre')||e.trim(w.getText()).length)return false; -}else if(w.type==1)if(!n[w.getName()])if(!t&&!c&&w.getName()=='br'&&!u)u=true;else return false;return true;};};function p(t){return t.type!=3&&t.getName() in f.$removeEmpty||!e.trim(t.getText())||!!t.getParent().data('cke-bookmark');};var q=new d.walker.whitespaces(),r=new d.walker.bookmark();function s(t){return!q(t)&&!r(t);};d.range.prototype={clone:function(){var u=this;var t=new d.range(u.document);t.startContainer=u.startContainer;t.startOffset=u.startOffset;t.endContainer=u.endContainer;t.endOffset=u.endOffset;t.collapsed=u.collapsed;return t;},collapse:function(t){var u=this;if(t){u.endContainer=u.startContainer;u.endOffset=u.startOffset;}else{u.startContainer=u.endContainer;u.startOffset=u.endOffset;}u.collapsed=true;},cloneContents:function(){var t=new d.documentFragment(this.document);if(!this.collapsed)m(this,2,t);return t;},deleteContents:function(t){if(this.collapsed)return;m(this,0,null,t);},extractContents:function(t){var u=new d.documentFragment(this.document);if(!this.collapsed)m(this,1,u,t);return u;},createBookmark:function(t){var z=this;var u,v,w,x,y=z.collapsed;u=z.document.createElement('span');u.data('cke-bookmark',1);u.setStyle('display','none');u.setHtml(' ');if(t){w='cke_bm_'+e.getNextNumber();u.setAttribute('id',w+'S');}if(!y){v=u.clone();v.setHtml(' ');if(t)v.setAttribute('id',w+'E');x=z.clone();x.collapse();x.insertNode(v);}x=z.clone();x.collapse(true);x.insertNode(u);if(v){z.setStartAfter(u);z.setEndBefore(v);}else z.moveToPosition(u,4);return{startNode:t?w+'S':u,endNode:t?w+'E':v,serializable:t,collapsed:y};},createBookmark2:function(t){var B=this;var u=B.startContainer,v=B.endContainer,w=B.startOffset,x=B.endOffset,y=B.collapsed,z,A;if(!u||!v)return{start:0,end:0};if(t){if(u.type==1){z=u.getChild(w);if(z&&z.type==3&&w>0&&z.getPrevious().type==3){u=z;w=0;}if(z&&z.type==1)w=z.getIndex(1);}while(u.type==3&&(A=u.getPrevious())&&A.type==3){u=A;w+=A.getLength();}if(!y){if(v.type==1){z=v.getChild(x);if(z&&z.type==3&&x>0&&z.getPrevious().type==3){v=z;x=0;}if(z&&z.type==1)x=z.getIndex(1);}while(v.type==3&&(A=v.getPrevious())&&A.type==3){v=A;x+=A.getLength();}}}return{start:u.getAddress(t),end:y?null:v.getAddress(t),startOffset:w,endOffset:x,normalized:t,collapsed:y,is2:true};},moveToBookmark:function(t){var B=this;if(t.is2){var u=B.document.getByAddress(t.start,t.normalized),v=t.startOffset,w=t.end&&B.document.getByAddress(t.end,t.normalized),x=t.endOffset;B.setStart(u,v);if(w)B.setEnd(w,x);else B.collapse(true);}else{var y=t.serializable,z=y?B.document.getById(t.startNode):t.startNode,A=y?B.document.getById(t.endNode):t.endNode; -B.setStartBefore(z);z.remove();if(A){B.setEndBefore(A);A.remove();}else B.collapse(true);}},getBoundaryNodes:function(){var y=this;var t=y.startContainer,u=y.endContainer,v=y.startOffset,w=y.endOffset,x;if(t.type==1){x=t.getChildCount();if(x>v)t=t.getChild(v);else if(x<1)t=t.getPreviousSourceNode();else{t=t.$;while(t.lastChild)t=t.lastChild;t=new d.node(t);t=t.getNextSourceNode()||t;}}if(u.type==1){x=u.getChildCount();if(x>w)u=u.getChild(w).getPreviousSourceNode(true);else if(x<1)u=u.getPreviousSourceNode();else{u=u.$;while(u.lastChild)u=u.lastChild;u=new d.node(u);}}if(t.getPosition(u)&2)t=u;return{startNode:t,endNode:u};},getCommonAncestor:function(t,u){var y=this;var v=y.startContainer,w=y.endContainer,x;if(v.equals(w)){if(t&&v.type==1&&y.startOffset==y.endOffset-1)x=v.getChild(y.startOffset);else x=v;}else x=v.getCommonAncestor(w);return u&&!x.is?x.getParent():x;},optimize:function(){var v=this;var t=v.startContainer,u=v.startOffset;if(t.type!=1)if(!u)v.setStartBefore(t);else if(u>=t.getLength())v.setStartAfter(t);t=v.endContainer;u=v.endOffset;if(t.type!=1)if(!u)v.setEndBefore(t);else if(u>=t.getLength())v.setEndAfter(t);},optimizeBookmark:function(){var v=this;var t=v.startContainer,u=v.endContainer;if(t.is&&t.is('span')&&t.data('cke-bookmark'))v.setStartAt(t,3);if(u&&u.is&&u.is('span')&&u.data('cke-bookmark'))v.setEndAt(u,4);},trim:function(t,u){var B=this;var v=B.startContainer,w=B.startOffset,x=B.collapsed;if((!t||x)&&v&&v.type==3){if(!w){w=v.getIndex();v=v.getParent();}else if(w>=v.getLength()){w=v.getIndex()+1;v=v.getParent();}else{var y=v.split(w);w=v.getIndex()+1;v=v.getParent();if(B.startContainer.equals(B.endContainer))B.setEnd(y,B.endOffset-B.startOffset);else if(v.equals(B.endContainer))B.endOffset+=1;}B.setStart(v,w);if(x){B.collapse(true);return;}}var z=B.endContainer,A=B.endOffset;if(!(u||x)&&z&&z.type==3){if(!A){A=z.getIndex();z=z.getParent();}else if(A>=z.getLength()){A=z.getIndex()+1;z=z.getParent();}else{z.split(A);A=z.getIndex()+1;z=z.getParent();}B.setEnd(z,A);}},enlarge:function(t,u){switch(t){case 1:if(this.collapsed)return;var v=this.getCommonAncestor(),w=this.document.getBody(),x,y,z,A,B,C=false,D,E,F=this.startContainer,G=this.startOffset;if(F.type==3){if(G){F=!e.trim(F.substring(0,G)).length&&F;C=!!F;}if(F)if(!(A=F.getPrevious()))z=F.getParent();}else{if(G)A=F.getChild(G-1)||F.getLast();if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)x=z; -else this.setStartBefore(z);}A=z.getPrevious();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/[\s\ufeff]$/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{var H=A.$.all||A.$.getElementsByTagName('*');for(var I=0,J;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C){if(B)x=z;else if(z)this.setStartBefore(z);}else C=true;if(A){var K=A.getPrevious();if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}F=this.endContainer;G=this.endOffset;z=A=null;B=C=false;if(F.type==3){F=!e.trim(F.substring(G)).length&&F;C=!(F&&F.getLength());if(F)if(!(A=F.getNext()))z=F.getParent();}else{A=F.getChild(G);if(!A)z=F;}while(z||A){if(z&&!A){if(!B&&z.equals(v))B=true;if(!w.contains(z))break;if(!C||z.getComputedStyle('display')!='inline'){C=false;if(B)y=z;else if(z)this.setEndAfter(z);}A=z.getNext();}while(A){D=false;if(A.type==3){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;D=/^[\s\ufeff]/.test(E);}else if((A.$.offsetWidth>0||u&&A.is('br'))&&!A.data('cke-bookmark'))if(C&&f.$removeEmpty[A.getName()]){E=A.getText();if(/[^\s\ufeff]/.test(E))A=null;else{H=A.$.all||A.$.getElementsByTagName('*');for(I=0;J=H[I++];){if(!f.$removeEmpty[J.nodeName.toLowerCase()]){A=null;break;}}}if(A)D=!!E.length;}else A=null;if(D)if(C)if(B)y=z;else this.setEndAfter(z);if(A){K=A.getNext();if(!z&&!K){z=A;A=null;break;}A=K;}else z=null;}if(z)z=z.getParent();}if(x&&y){v=x.contains(y)?y:x;this.setStartBefore(v);this.setEndAfter(v);}break;case 2:case 3:var L=new d.range(this.document);w=this.document.getBody();L.setStartAt(w,1);L.setEnd(this.startContainer,this.startOffset);var M=new d.walker(L),N,O,P=d.walker.blockBoundary(t==3?{br:1}:null),Q=function(S){var T=P(S);if(!T)N=S;return T;},R=function(S){var T=Q(S);if(!T&&S.is&&S.is('br'))O=S;return T;};M.guard=Q;z=M.lastBackward();N=N||w;this.setStartAt(N,!N.is('br')&&(!z&&this.checkStartOfBlock()||z&&N.contains(z))?1:4);L=this.clone();L.collapse();L.setEndAt(w,2);M=new d.walker(L);M.guard=t==3?R:Q;N=null;z=M.lastForward();N=N||w;this.setEndAt(N,!z&&this.checkEndOfBlock()||z&&N.contains(z)?2:3);if(O)this.setEndAfter(O);}},shrink:function(t,u){if(!this.collapsed){t=t||2;var v=this.clone(),w=this.startContainer,x=this.endContainer,y=this.startOffset,z=this.endOffset,A=this.collapsed,B=1,C=1;if(w&&w.type==3)if(!y)v.setStartBefore(w);else if(y>=w.getLength())v.setStartAfter(w); -else{v.setStartBefore(w);B=0;}if(x&&x.type==3)if(!z)v.setEndBefore(x);else if(z>=x.getLength())v.setEndAfter(x);else{v.setEndAfter(x);C=0;}var D=new d.walker(v),E=d.walker.bookmark();D.evaluator=function(I){return I.type==(t==1?1:3);};var F;D.guard=function(I,J){if(E(I))return true;if(t==1&&I.type==3)return false;if(J&&I.equals(F))return false;if(!J&&I.type==1)F=I;return true;};if(B){var G=D[t==1?'lastForward':'next']();G&&this.setStartAt(G,u?1:3);}if(C){D.reset();var H=D[t==1?'lastBackward':'previous']();H&&this.setEndAt(H,u?2:4);}return!!(B||C);}},insertNode:function(t){var x=this;x.optimizeBookmark();x.trim(false,true);var u=x.startContainer,v=x.startOffset,w=u.getChild(v);if(w)t.insertBefore(w);else u.append(t);if(t.getParent().equals(x.endContainer))x.endOffset++;x.setStartBefore(t);},moveToPosition:function(t,u){this.setStartAt(t,u);this.collapse(true);},selectNodeContents:function(t){this.setStart(t,0);this.setEnd(t,t.type==3?t.getLength():t.getChildCount());},setStart:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex(),t=t.getParent();v.startContainer=t;v.startOffset=u;if(!v.endContainer){v.endContainer=t;v.endOffset=u;}l(v);},setEnd:function(t,u){var v=this;if(t.type==1&&f.$empty[t.getName()])u=t.getIndex()+1,t=t.getParent();v.endContainer=t;v.endOffset=u;if(!v.startContainer){v.startContainer=t;v.startOffset=u;}l(v);},setStartAfter:function(t){this.setStart(t.getParent(),t.getIndex()+1);},setStartBefore:function(t){this.setStart(t.getParent(),t.getIndex());},setEndAfter:function(t){this.setEnd(t.getParent(),t.getIndex()+1);},setEndBefore:function(t){this.setEnd(t.getParent(),t.getIndex());},setStartAt:function(t,u){var v=this;switch(u){case 1:v.setStart(t,0);break;case 2:if(t.type==3)v.setStart(t,t.getLength());else v.setStart(t,t.getChildCount());break;case 3:v.setStartBefore(t);break;case 4:v.setStartAfter(t);}l(v);},setEndAt:function(t,u){var v=this;switch(u){case 1:v.setEnd(t,0);break;case 2:if(t.type==3)v.setEnd(t,t.getLength());else v.setEnd(t,t.getChildCount());break;case 3:v.setEndBefore(t);break;case 4:v.setEndAfter(t);}l(v);},fixBlock:function(t,u){var x=this;var v=x.createBookmark(),w=x.document.createElement(u);x.collapse(t);x.enlarge(2);x.extractContents().appendTo(w);w.trim();if(!c)w.appendBogus();x.insertNode(w);x.moveToBookmark(v);return w;},splitBlock:function(t){var D=this;var u=new d.elementPath(D.startContainer),v=new d.elementPath(D.endContainer),w=u.blockLimit,x=v.blockLimit,y=u.block,z=v.block,A=null; -if(!w.equals(x))return null;if(t!='br'){if(!y){y=D.fixBlock(true,t);z=new d.elementPath(D.endContainer).block;}if(!z)z=D.fixBlock(false,t);}var B=y&&D.checkStartOfBlock(),C=z&&D.checkEndOfBlock();D.deleteContents();if(y&&y.equals(z))if(C){A=new d.elementPath(D.startContainer);D.moveToPosition(z,4);z=null;}else if(B){A=new d.elementPath(D.startContainer);D.moveToPosition(y,3);y=null;}else{z=D.splitElement(y);if(!c&&!y.is('ul','ol'))y.appendBogus();}return{previousBlock:y,nextBlock:z,wasStartOfBlock:B,wasEndOfBlock:C,elementPath:A};},splitElement:function(t){var w=this;if(!w.collapsed)return null;w.setEndAt(t,2);var u=w.extractContents(),v=t.clone(false);u.appendTo(v);v.insertAfter(t);w.moveToPosition(t,4);return v;},checkBoundaryOfElement:function(t,u){var v=u==1,w=this.clone();w.collapse(v);w[v?'setStartAt':'setEndAt'](t,v?1:2);var x=new d.walker(w);x.evaluator=p;return x[v?'checkBackward':'checkForward']();},checkStartOfBlock:function(){var z=this;var t=z.startContainer,u=z.startOffset;if(u&&t.type==3){var v=e.ltrim(t.substring(0,u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.startContainer),x=z.clone();x.collapse(true);x.setStartAt(w.block||w.blockLimit,1);var y=new d.walker(x);y.evaluator=o(true);return y.checkBackward();},checkEndOfBlock:function(){var z=this;var t=z.endContainer,u=z.endOffset;if(t.type==3){var v=e.rtrim(t.substring(u));if(v.length)return false;}z.trim();var w=new d.elementPath(z.endContainer),x=z.clone();x.collapse(false);x.setEndAt(w.block||w.blockLimit,2);var y=new d.walker(x);y.evaluator=o(false);return y.checkForward();},checkReadOnly:(function(){function t(u,v){while(u){if(u.type==1)if(u.getAttribute('contentEditable')=='false'&&!u.data('cke-editable'))return 0;else if(u.is('html')||u.getAttribute('contentEditable')=='true'&&(u.contains(v)||u.equals(v)))break;u=u.getParent();}return 1;};return function(){var u=this.startContainer,v=this.endContainer;return!(t(u,v)&&t(v,u));};})(),moveToElementEditablePosition:function(t,u){var v;if(f.$empty[t.getName()])return false;while(t&&t.type==1){v=t.isEditable();if(v)this.moveToPosition(t,u?2:1);else if(f.$inline[t.getName()]){this.moveToPosition(t,u?4:3);return true;}if(f.$empty[t.getName()])t=t[u?'getPrevious':'getNext'](s);else t=t[u?'getLast':'getFirst'](s);if(t&&t.type==3){this.moveToPosition(t,u?4:3);return true;}}return v;},moveToElementEditStart:function(t){return this.moveToElementEditablePosition(t);},moveToElementEditEnd:function(t){return this.moveToElementEditablePosition(t,true); -},getEnclosedNode:function(){var t=this.clone();t.optimize();if(t.startContainer.type!=1||t.endContainer.type!=1)return null;var u=new d.walker(t),v=d.walker.bookmark(true),w=d.walker.whitespaces(true),x=function(z){return w(z)&&v(z);};t.evaluator=x;var y=u.next();u.reset();return y&&y.equals(u.previous())?y:null;},getTouchedStartNode:function(){var t=this.startContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.startOffset)||t;},getTouchedEndNode:function(){var t=this.endContainer;if(this.collapsed||t.type!=1)return t;return t.getChild(this.endOffset-1)||t;}};})();a.POSITION_AFTER_START=1;a.POSITION_BEFORE_END=2;a.POSITION_BEFORE_START=3;a.POSITION_AFTER_END=4;a.ENLARGE_ELEMENT=1;a.ENLARGE_BLOCK_CONTENTS=2;a.ENLARGE_LIST_ITEM_CONTENTS=3;a.START=1;a.END=2;a.STARTEND=3;a.SHRINK_ELEMENT=1;a.SHRINK_TEXT=2;(function(){d.rangeList=function(n){if(n instanceof d.rangeList)return n;if(!n)n=[];else if(n instanceof d.range)n=[n];return e.extend(n,l);};var l={createIterator:function(){var n=this,o=d.walker.bookmark(),p=function(s){return!(s.is&&s.is('tr'));},q=[],r;return{getNextRange:function(s){r=r==undefined?0:r+1;var t=n[r];if(t&&n.length>1){if(!r)for(var u=n.length-1;u>=0;u--)q.unshift(n[u].createBookmark(true));if(s){var v=0;while(n[r+v+1]){var w=t.document,x=0,y=w.getById(q[v].endNode),z=w.getById(q[v+1].startNode),A;while(1){A=y.getNextSourceNode(false);if(!z.equals(A)){if(o(A)||A.type==1&&A.isBlockBoundary()){y=A;continue;}}else x=1;break;}if(!x)break;v++;}}t.moveToBookmark(q.shift());while(v--){A=n[++r];A.moveToBookmark(q.shift());t.setEnd(A.endContainer,A.endOffset);}}return t;}};},createBookmarks:function(n){var s=this;var o=[],p;for(var q=0;q',a.document);l.appendTo(a.document.getHead());try{b.hc=l.getComputedStyle('border-top-color')==l.getComputedStyle('border-right-color');}catch(m){b.hc=false;}if(b.hc)b.cssClass+=' cke_hc';l.remove();})();j.load(i.corePlugins.split(','),function(){a.status='loaded';a.fire('loaded');var l=a._.pending;if(l){delete a._.pending;for(var m=0;m0){z=A.shift();while(!z.getParent().equals(D))z=z.getParent();if(!z.equals(H))E.push(z);H=z;}while(E.length>0){z=E.shift();if(z.getName()=='blockquote'){var I=new d.documentFragment(q.document);while(z.getFirst()){I.append(z.getFirst().remove());A.push(I.getLast());}I.replace(z);}else A.push(z);}var J=q.document.createElement('blockquote');J.insertBefore(A[0]);while(A.length>0){z=A.shift();J.append(z);}}else if(r==1){var K=[],L={};while(z=y.getNextParagraph()){var M=null,N=null;while(z.getParent()){if(z.getParent().getName()=='blockquote'){M=z.getParent();N=z;break;}z=z.getParent();}if(M&&N&&!N.getCustomData('blockquote_moveout')){K.push(N);h.setMarker(L,N,'blockquote_moveout',true);}}h.clearAllMarkers(L);var O=[],P=[];L={};while(K.length>0){var Q=K.shift();J=Q.getParent();if(!Q.getPrevious())Q.remove().insertBefore(J);else if(!Q.getNext())Q.remove().insertAfter(J);else{Q.breakParent(Q.getParent());P.push(Q.getNext());}if(!J.getCustomData('blockquote_processed')){P.push(J);h.setMarker(L,J,'blockquote_processed',true);}O.push(Q);}h.clearAllMarkers(L);for(F=P.length-1;F>=0;F--){J=P[F];if(o(J))J.remove();}if(q.config.enterMode==2){var R=true;while(O.length){Q=O.shift();if(Q.getName()=='div'){I=new d.documentFragment(q.document);var S=R&&Q.getPrevious()&&!(Q.getPrevious().type==1&&Q.getPrevious().isBlockBoundary());if(S)I.append(q.document.createElement('br'));var T=Q.getNext()&&!(Q.getNext().type==1&&Q.getNext().isBlockBoundary());while(Q.getFirst())Q.getFirst().remove().appendTo(I);if(T)I.append(q.document.createElement('br'));I.replace(Q);R=false;}}}}s.selectBookmarks(u);q.focus();}};j.add('blockquote',{init:function(q){q.addCommand('blockquote',p);q.ui.addButton('Blockquote',{label:q.lang.blockquote,command:'blockquote'});q.on('selectionChange',n);},requires:['domiterator']});})();j.add('button',{beforeInit:function(m){m.ui.addHandler('button',k.button.handler);}});a.UI_BUTTON='button';k.button=function(m){e.extend(this,m,{title:m.label,className:m.className||m.command&&'cke_button_'+m.command||'',click:m.click||(function(n){n.execCommand(m.command);})});this._={};};k.button.handler={create:function(m){return new k.button(m);}};(function(){k.button.prototype={render:function(m,n){var o=b,p=this._.id=e.getNextId(),q='',r=this.command,s; -this._.editor=m;var t={id:p,button:this,editor:m,focus:function(){var z=a.document.getById(p);z.focus();},execute:function(){this.button.click(m);}},u=e.addFunction(function(z){if(t.onkey){z=new d.event(z);return t.onkey(t,z.getKeystroke())!==false;}}),v=e.addFunction(function(z){var A;if(t.onfocus)A=t.onfocus(t,new d.event(z))!==false;if(b.gecko&&b.version<10900)z.preventBubble();return A;});t.clickFn=s=e.addFunction(t.execute,t);if(this.modes){var w={};function x(){var z=m.mode;if(z){var A=this.modes[z]?w[z]!=undefined?w[z]:2:0;this.setState(m.readOnly&&!this.readOnly?0:A);}};m.on('beforeModeUnload',function(){if(m.mode&&this._.state!=0)w[m.mode]=this._.state;},this);m.on('mode',x,this);!this.readOnly&&m.on('readOnly',x,this);}else if(r){r=m.getCommand(r);if(r){r.on('state',function(){this.setState(r.state);},this);q+='cke_'+(r.state==1?'on':r.state==0?'disabled':'off');}}if(!r)q+='cke_off';if(this.className)q+=' '+this.className;n.push('','=10900&&!o.hc?'':'" href="javascript:void(\''+(this.title||'').replace("'",'')+"')\"",' title="',this.title,'" tabindex="-1" hidefocus="true" role="button" aria-labelledby="'+p+'_label"'+(this.hasArrow?' aria-haspopup="true"':''));if(o.opera||o.gecko&&o.mac)n.push(' onkeypress="return false;"');if(o.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="return CKEDITOR.tools.callFunction(',u,', event);" onfocus="return CKEDITOR.tools.callFunction(',v,', event);" onclick="CKEDITOR.tools.callFunction(',s,', this); return false;"> ',this.label,'');if(this.hasArrow)n.push(''+(b.hc?'▼':' ')+'');n.push('','');if(this.onRender)this.onRender();return t;},setState:function(m){if(this._.state==m)return false;this._.state=m;var n=a.document.getById(this._.id);if(n){n.setState(m);m==0?n.setAttribute('aria-disabled',true):n.removeAttribute('aria-disabled');m==1?n.setAttribute('aria-pressed',true):n.removeAttribute('aria-pressed');return true;}else return false;}};})();k.prototype.addButton=function(m,n){this.add(m,'button',n);};(function(){var m=function(y,z){var A=y.document,B=A.getBody(),C=0,D=function(){C=1; -};B.on(z,D);(b.version>7?A.$:A.$.selection.createRange()).execCommand(z);B.removeListener(z,D);return C;},n=c?function(y,z){return m(y,z);}:function(y,z){try{return y.document.$.execCommand(z,false,null);}catch(A){return false;}},o=function(y){var z=this;z.type=y;z.canUndo=z.type=='cut';z.startDisabled=true;};o.prototype={exec:function(y,z){this.type=='cut'&&t(y);var A=n(y,this.type);if(!A)alert(y.lang.clipboard[this.type+'Error']);return A;}};var p={canUndo:false,exec:c?function(y){y.focus();if(!y.document.getBody().fire('beforepaste')&&!m(y,'paste')){y.fire('pasteDialog');return false;}}:function(y){try{if(!y.document.getBody().fire('beforepaste')&&!y.document.$.execCommand('Paste',false,null))throw 0;}catch(z){setTimeout(function(){y.fire('pasteDialog');},0);return false;}}},q=function(y){if(this.mode!='wysiwyg')return;switch(y.data.keyCode){case 1000+86:case 2000+45:var z=this.document.getBody();if(!c&&z.fire('beforepaste'))y.cancel();else if(b.opera||b.gecko&&b.version<10900)z.fire('paste');return;case 1000+88:case 2000+46:var A=this;this.fire('saveSnapshot');setTimeout(function(){A.fire('saveSnapshot');},0);}};function r(y){y.cancel();};function s(y,z,A){var B=this.document;if(B.getById('cke_pastebin'))return;if(z=='text'&&y.data&&y.data.$.clipboardData){var C=y.data.$.clipboardData.getData('text/plain');if(C){y.data.preventDefault();A(C);return;}}var D=this.getSelection(),E=new d.range(B),F=new h(z=='text'?'textarea':b.webkit?'body':'div',B);F.setAttribute('id','cke_pastebin');b.webkit&&F.append(B.createText('\xa0'));B.getBody().append(F);F.setStyles({position:'absolute',top:D.getStartElement().getDocumentPosition().y+'px',width:'1px',height:'1px',overflow:'hidden'});F.setStyle(this.config.contentsLangDirection=='ltr'?'left':'right','-1000px');var G=D.createBookmarks();this.on('selectionChange',r,null,null,0);if(z=='text')F.$.focus();else{E.setStartAt(F,1);E.setEndAt(F,2);E.select(true);}var H=this;window.setTimeout(function(){z=='text'&&b.gecko&&H.focusGrabber.focus();F.remove();H.removeListener('selectionChange',r);var I;F=b.webkit&&(I=F.getFirst())&&I.is&&I.hasClass('Apple-style-span')?I:F;D.selectBookmarks(G);A(F['get'+(z=='text'?'Value':'Html')]());},0);};function t(y){if(!c||b.quirks)return;var z=y.getSelection(),A;if(z.getType()==3&&(A=z.getSelectedElement())){var B=z.getRanges()[0],C=y.document.createText('');C.insertBefore(A);B.setStartBefore(C);B.setEndAfter(A);z.selectRanges([B]);setTimeout(function(){if(A.getParent()){C.remove();z.selectElement(A); -}},0);}};var u;function v(y,z){c&&(u=1);var A=2;try{A=z.document.$.queryCommandEnabled(y)?2:0;}catch(B){}u=0;return A;};var w;function x(){var z=this;if(z.mode!='wysiwyg')return;z.getCommand('cut').setState(w?0:v('Cut',z));z.getCommand('copy').setState(v('Copy',z));var y=w?0:b.webkit?2:v('Paste',z);z.fire('pasteState',y);};j.add('clipboard',{requires:['dialog','htmldataprocessor'],init:function(y){y.on('paste',function(A){var B=A.data;if(B.html)y.insertHtml(B.html);else if(B.text)y.insertText(B.text);setTimeout(function(){y.fire('afterPaste');},0);},null,null,1000);y.on('pasteDialog',function(A){setTimeout(function(){y.openDialog('paste');},0);});y.on('pasteState',function(A){y.getCommand('paste').setState(A.data);});function z(A,B,C,D){var E=y.lang[B];y.addCommand(B,C);y.ui.addButton(A,{label:E,command:B});if(y.addMenuItems)y.addMenuItem(B,{label:E,command:B,group:'clipboard',order:D});};z('Cut','cut',new o('cut'),1);z('Copy','copy',new o('copy'),4);z('Paste','paste',p,8);a.dialog.add('paste',a.getUrl(this.path+'dialogs/paste.js'));y.on('key',q,y);y.on('contentDom',function(){var A=y.document.getBody();A.on(b.webkit?'paste':'beforepaste',function(B){if(u)return;var C={mode:'html'};y.fire('beforePaste',C);s.call(y,B,C.mode,function(D){if(!(D=e.trim(D.replace(/]+data-cke-bookmark[^<]*?<\/span>/ig,''))))return;var E={};E[C.mode]=D;y.fire('paste',E);});});A.on('beforecut',function(){!u&&t(y);});A.on('mouseup',function(){setTimeout(function(){x.call(y);},0);},y);A.on('keyup',x,y);});y.on('selectionChange',function(A){w=A.data.selection.getRanges()[0].checkReadOnly();x.call(y);});if(y.contextMenu)y.contextMenu.addListener(function(A,B){var C=B.getRanges()[0].checkReadOnly();return{cut:!C&&v('Cut',y),copy:v('Copy',y),paste:!C&&(b.webkit?2:v('Paste',y))};});}});})();j.add('colorbutton',{requires:['panelbutton','floatpanel','styles'],init:function(m){var n=m.config,o=m.lang.colorButton,p;if(!b.hc){q('TextColor','fore',o.textColorTitle);q('BGColor','back',o.bgColorTitle);}function q(t,u,v){var w=e.getNextId()+'_colorBox';m.ui.add(t,'panelbutton',{label:v,title:v,className:'cke_button_'+t.toLowerCase(),modes:{wysiwyg:1},panel:{css:m.skin.editor.css,attributes:{role:'listbox','aria-label':o.panelTitle}},onBlock:function(x,y){y.autoSize=true;y.element.addClass('cke_colorblock');y.element.setHtml(r(x,u,w));y.element.getDocument().getBody().setStyle('overflow','hidden');k.fire('ready',this);var z=y.keys,A=m.lang.dir=='rtl';z[A?37:39]='next';z[40]='next';z[9]='next'; -z[A?39:37]='prev';z[38]='prev';z[2000+9]='prev';z[32]='click';},onOpen:function(){var x=m.getSelection(),y=x&&x.getStartElement(),z=new d.elementPath(y),A;y=z.block||z.blockLimit||m.document.getBody();do A=y&&y.getComputedStyle(u=='back'?'background-color':'color')||'transparent';while(u=='back'&&A=='transparent'&&y&&(y=y.getParent()));if(!A||A=='transparent')A='#ffffff';this._.panel._.iframe.getFrameDocument().getById(w).setStyle('background-color',A);}});};function r(t,u,v){var w=[],x=n.colorButton_colors.split(','),y=x.length+(n.colorButton_enableMore?2:1),z=e.addFunction(function(F,G){if(F=='?'){var H=arguments.callee;function I(K){this.removeListener('ok',I);this.removeListener('cancel',I);K.name=='ok'&&H(this.getContentElement('picker','selectedColor').getValue(),G);};m.openDialog('colordialog',function(){this.on('ok',I);this.on('cancel',I);});return;}m.focus();t.hide();m.fire('saveSnapshot');new a.style(n['colorButton_'+G+'Style'],{color:'inherit'}).remove(m.document);if(F){var J=n['colorButton_'+G+'Style'];J.childRule=G=='back'?function(K){return s(K);}:function(K){return K.getName()!='a'||s(K);};new a.style(J,{color:F}).apply(m.document);}m.fire('saveSnapshot');});w.push('
            ',o.auto,'
            ');for(var A=0;A');var B=x[A].split('/'),C=B[0],D=B[1]||C;if(!B[1])C='#'+C.replace(/^(.)(.)(.)$/,'$1$1$2$2$3$3');var E=m.lang.colors[D]||D;w.push('');}if(n.colorButton_enableMore===undefined||n.colorButton_enableMore)w.push(''); -w.push('
            ',o.more,'
            ');return w.join('');};function s(t){return t.getAttribute('contentEditable')=='false'||t.getAttribute('data-nostyle');};}});i.colorButton_colors='000,800000,8B4513,2F4F4F,008080,000080,4B0082,696969,B22222,A52A2A,DAA520,006400,40E0D0,0000CD,800080,808080,F00,FF8C00,FFD700,008000,0FF,00F,EE82EE,A9A9A9,FFA07A,FFA500,FFFF00,00FF00,AFEEEE,ADD8E6,DDA0DD,D3D3D3,FFF0F5,FAEBD7,FFFFE0,F0FFF0,F0FFFF,F0F8FF,E6E6FA,FFF';i.colorButton_foreStyle={element:'span',styles:{color:'#(color)'},overrides:[{element:'font',attributes:{color:null}}]};i.colorButton_backStyle={element:'span',styles:{'background-color':'#(color)'}};j.colordialog={init:function(m){m.addCommand('colordialog',new a.dialogCommand('colordialog'));a.dialog.add('colordialog',this.path+'dialogs/colordialog.js');}};j.add('colordialog',j.colordialog);j.add('contextmenu',{requires:['menu'],onLoad:function(){j.contextMenu=e.createClass({base:a.menu,$:function(m){this.base.call(this,m,{panel:{className:m.skinClass+' cke_contextmenu',attributes:{'aria-label':m.lang.contextmenu.options}}});},proto:{addTarget:function(m,n){if(b.opera&&!('oncontextmenu' in document.body)){var o;m.on('mousedown',function(s){s=s.data;if(s.$.button!=2){if(s.getKeystroke()==1000+1)m.fire('contextmenu',s);return;}if(n&&(b.mac?s.$.metaKey:s.$.ctrlKey))return;var t=s.getTarget();if(!o){var u=t.getDocument();o=u.createElement('input');o.$.type='button';u.getBody().append(o);}o.setAttribute('style','position:absolute;top:'+(s.$.clientY-2)+'px;left:'+(s.$.clientX-2)+'px;width:5px;height:5px;opacity:0.01');});m.on('mouseup',function(s){if(o){o.remove();o=undefined;m.fire('contextmenu',s.data);}});}m.on('contextmenu',function(s){var t=s.data;if(n&&(b.webkit?p:b.mac?t.$.metaKey:t.$.ctrlKey))return;t.preventDefault();var u=t.getTarget().getDocument().getDocumentElement(),v=t.$.clientX,w=t.$.clientY;e.setTimeout(function(){this.open(u,null,v,w);},0,this);},this);if(b.opera)m.on('keypress',function(s){var t=s.data;if(t.$.keyCode===0)t.preventDefault();});if(b.webkit){var p,q=function(s){p=b.mac?s.data.$.metaKey:s.data.$.ctrlKey;},r=function(){p=0;};m.on('keydown',q);m.on('keyup',r);m.on('contextmenu',r);}},open:function(m,n,o,p){this.editor.focus();m=m||a.document.getDocumentElement();this.show(m,n,o,p);}}});},beforeInit:function(m){m.contextMenu=new j.contextMenu(m);m.addCommand('contextMenu',{exec:function(){m.contextMenu.open(m.document.getBody());}});}});(function(){function m(o){var p=this.att,q=o&&o.hasAttribute(p)&&o.getAttribute(p)||''; -if(q!==undefined)this.setValue(q);};function n(){var o;for(var p=0;p ';j.add('elementspath',{requires:['selection'],init:function(o){var p='cke_path_'+o.name,q,r=function(){if(!q)q=a.document.getById(p);return q;},s='cke_elementspath_'+e.getNextNumber()+'_';o._.elementsPath={idBase:s,filters:[]};o.on('themeSpace',function(x){if(x.data.space=='bottom')x.data.html+=''+o.lang.elementsPath.eleLabel+''+'
            '+n+'
            ';});function t(x){o.focus();var y=o._.elementsPath.list[x];if(y.is('body')){var z=new d.range(o.document);z.selectNodeContents(y);z.select();}else o.getSelection().selectElement(y);};var u=e.addFunction(t),v=e.addFunction(function(x,y){var z=o._.elementsPath.idBase,A;y=new d.event(y);var B=o.lang.dir=='rtl';switch(y.getKeystroke()){case B?39:37:case 9:A=a.document.getById(z+(x+1));if(!A)A=a.document.getById(z+'0');A.focus();return false;case B?37:39:case 2000+9:A=a.document.getById(z+(x-1));if(!A)A=a.document.getById(z+(o._.elementsPath.list.length-1));A.focus();return false;case 27:o.focus();return false;case 13:case 32:t(x);return false;}return true;});o.on('selectionChange',function(x){var y=b,z=x.data.selection,A=z.getStartElement(),B=[],C=x.editor,D=C._.elementsPath.list=[],E=C._.elementsPath.filters;while(A){var F=0,G;if(A.data('cke-display-name'))G=A.data('cke-display-name');else if(A.data('cke-real-element-type'))G=A.data('cke-real-element-type');else G=A.getName();for(var H=0;H',G,''+L+'',''); -}if(G=='body')break;A=A.getParent();}var M=r();M.setHtml(B.join('')+n);C.fire('elementsPathUpdate',{space:M});});function w(){q&&q.setHtml(n);delete o._.elementsPath.list;};o.on('readOnly',w);o.on('contentDomUnload',w);o.addCommand('elementsPathFocus',m.toolbarFocus);}});})();(function(){j.add('enterkey',{requires:['keystrokes','indent'],init:function(t){t.addCommand('enter',{modes:{wysiwyg:1},editorFocus:false,exec:function(v){r(v);}});t.addCommand('shiftEnter',{modes:{wysiwyg:1},editorFocus:false,exec:function(v){q(v);}});var u=t.keystrokeHandler.keystrokes;u[13]='enter';u[2000+13]='shiftEnter';}});j.enterkey={enterBlock:function(t,u,v,w){v=v||s(t);if(!v)return;var x=v.document,y=v.checkStartOfBlock(),z=v.checkEndOfBlock(),A=new d.elementPath(v.startContainer),B=A.block;if(y&&z){if(B&&(B.is('li')||B.getParent().is('li'))){t.execCommand('outdent');return;}}else if(!z&&B&&B.is('pre'))n(t,u,v,w);var C=u==3?'div':'p',D=v.splitBlock(C);if(!D)return;var E=D.previousBlock,F=D.nextBlock,G=D.wasStartOfBlock,H=D.wasEndOfBlock,I;if(F){I=F.getParent();if(I.is('li')){F.breakParent(I);F.move(F.getNext(),1);}}else if(E&&(I=E.getParent())&&I.is('li')){E.breakParent(I);I=E.getNext();v.moveToElementEditStart(I);E.move(E.getPrevious());}if(!G&&!H){if(F.is('li')&&(I=F.getFirst(d.walker.invisible(true)))&&I.is&&I.is('ul','ol'))(c?x.createText('\xa0'):x.createElement('br')).insertBefore(I);if(F)v.moveToElementEditStart(F);}else{var J,K;if(E){if(E.is('li')||!(p.test(E.getName())||E.is('pre'))){J=E.clone();J.is('li')&&J.removeAttribute('value');}}else if(F)J=F.clone();if(!J){if(I&&I.is('li'))J=I;else{J=x.createElement(C);if(E&&(K=E.getDirection()))J.setAttribute('dir',K);}}else if(w&&!J.is('li'))J.renameNode(C);var L=D.elementPath;if(L)for(var M=0,N=L.elements.length;M0;v--)u[v].deleteContents();return u[0];};})();(function(){var m='nbsp,gt,lt,amp',n='quot,iexcl,cent,pound,curren,yen,brvbar,sect,uml,copy,ordf,laquo,not,shy,reg,macr,deg,plusmn,sup2,sup3,acute,micro,para,middot,cedil,sup1,ordm,raquo,frac14,frac12,frac34,iquest,times,divide,fnof,bull,hellip,prime,Prime,oline,frasl,weierp,image,real,trade,alefsym,larr,uarr,rarr,darr,harr,crarr,lArr,uArr,rArr,dArr,hArr,forall,part,exist,empty,nabla,isin,notin,ni,prod,sum,minus,lowast,radic,prop,infin,ang,and,or,cap,cup,int,there4,sim,cong,asymp,ne,equiv,le,ge,sub,sup,nsub,sube,supe,oplus,otimes,perp,sdot,lceil,rceil,lfloor,rfloor,lang,rang,loz,spades,clubs,hearts,diams,circ,tilde,ensp,emsp,thinsp,zwnj,zwj,lrm,rlm,ndash,mdash,lsquo,rsquo,sbquo,ldquo,rdquo,bdquo,dagger,Dagger,permil,lsaquo,rsaquo,euro',o='Agrave,Aacute,Acirc,Atilde,Auml,Aring,AElig,Ccedil,Egrave,Eacute,Ecirc,Euml,Igrave,Iacute,Icirc,Iuml,ETH,Ntilde,Ograve,Oacute,Ocirc,Otilde,Ouml,Oslash,Ugrave,Uacute,Ucirc,Uuml,Yacute,THORN,szlig,agrave,aacute,acirc,atilde,auml,aring,aelig,ccedil,egrave,eacute,ecirc,euml,igrave,iacute,icirc,iuml,eth,ntilde,ograve,oacute,ocirc,otilde,ouml,oslash,ugrave,uacute,ucirc,uuml,yacute,thorn,yuml,OElig,oelig,Scaron,scaron,Yuml',p='Alpha,Beta,Gamma,Delta,Epsilon,Zeta,Eta,Theta,Iota,Kappa,Lambda,Mu,Nu,Xi,Omicron,Pi,Rho,Sigma,Tau,Upsilon,Phi,Chi,Psi,Omega,alpha,beta,gamma,delta,epsilon,zeta,eta,theta,iota,kappa,lambda,mu,nu,xi,omicron,pi,rho,sigmaf,sigma,tau,upsilon,phi,chi,psi,omega,thetasym,upsih,piv'; -function q(r,s){var t={},u=[],v={nbsp:'\xa0',shy:'­',gt:'>',lt:'<',amp:'&'};r=r.replace(/\b(nbsp|shy|gt|lt|amp)(?:,|$)/g,function(A,B){var C=s?'&'+B+';':v[B],D=s?v[B]:'&'+B+';';t[C]=D;u.push(C);return '';});if(!s&&r){r=r.split(',');var w=document.createElement('div'),x;w.innerHTML='&'+r.join(';&')+';';x=w.innerHTML;w=null;for(var y=0;y0;case 'checked':return!!q.$.checked;case 'value':var p=q.getAttribute('type');return p=='checkbox'||p=='radio'?q.$.value!='on':q.$.value;}return m.apply(q,arguments);};});(function(){var m={canUndo:false,exec:function(o){o.insertElement(o.document.createElement('hr'));}},n='horizontalrule';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('HorizontalRule',{label:o.lang.horizontalrule,command:n});}});})();(function(){var m=/^[\t\r\n ]*(?: |\xa0)$/,n='{cke_protected}';function o(T){var U=T.children.length,V=T.children[U-1];while(V&&V.type==3&&!e.trim(V.value))V=T.children[--U];return V;};function p(T,U){var V=T.children,W=o(T);if(W){if((U||!c)&&W.type==1&&W.name=='br')V.pop();if(W.type==3&&m.test(W.value))V.pop();}};function q(T,U,V){if(!U&&(!V||typeof V=='function'&&V(T)===false))return false;if(U&&c&&(document.documentMode>7||T.name in f.tr||T.name in f.$listItem))return false;var W=o(T);return!W||W&&(W.type==1&&W.name=='br'||T.name=='form'&&W.name=='input');};function r(T,U){return function(V){p(V,!T);if(q(V,!T,U))if(T||c)V.add(new a.htmlParser.text('\xa0'));else V.add(new a.htmlParser.element('br',{}));};};var s=f,t=['caption','colgroup','col','thead','tfoot','tbody'],u=e.extend({},s.$block,s.$listItem,s.$tableContent);for(var v in u){if(!('br' in s[v]))delete u[v];}delete u.pre;var w={elements:{},attributeNames:[[/^on/,'data-cke-pa-on']]},x={elements:{}};for(v in u)x.elements[v]=r();var y={elementNames:[[/^cke:/,''],[/^\?xml:namespace$/,'']],attributeNames:[[/^data-cke-(saved|pa)-/,''],[/^data-cke-.*/,''],['hidefocus','']],elements:{$:function(T){var U=T.attributes;if(U){if(U['data-cke-temp'])return false;var V=['name','href','src'],W;for(var X=0;Xe.indexOf(t,W.name)?1:-1:0;});},embed:function(T){var U=T.parent;if(U&&U.name=='object'){var V=U.attributes.width,W=U.attributes.height;V&&(T.attributes.width=V);W&&(T.attributes.height=W);}},param:function(T){T.children=[];T.isEmpty=true;return T;},a:function(T){if(!(T.children.length||T.attributes.name||T.attributes['data-cke-saved-name']))return false;},span:function(T){if(T.attributes['class']=='Apple-style-span')delete T.name;},pre:function(T){c&&p(T);},html:function(T){delete T.attributes.contenteditable;delete T.attributes['class'];},body:function(T){delete T.attributes.spellcheck;delete T.attributes.contenteditable;},style:function(T){var U=T.children[0];U&&U.value&&(U.value=e.trim(U.value));if(!T.attributes.type)T.attributes.type='text/css';},title:function(T){var U=T.children[0];U&&(U.value=T.attributes['data-cke-title']||'');}},attributes:{'class':function(T,U){return e.ltrim(T.replace(/(?:^|\s+)cke_[^\s]*/g,''))||false;}}};if(c)y.attributes.style=function(T,U){return T.replace(/(^|;)([^\:]+)/g,function(V){return V.toLowerCase();});};function z(T){var U=T.attributes;if(U.contenteditable!='false')U['data-cke-editable']=U.contenteditable?'true':1;U.contenteditable='false';};function A(T){var U=T.attributes;switch(U['data-cke-editable']){case 'true':U.contenteditable='true';break;case '1':delete U.contenteditable;break;}};for(v in {input:1,textarea:1}){w.elements[v]=z;y.elements[v]=A;}var B=/<(a|area|img|input)\b([^>]*)>/gi,C=/\b(href|src|name)\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|(?:[^ "'>]+))/gi,D=/(?:])[^>]*>[\s\S]*<\/style>)|(?:<(:?link|meta|base)[^>]*>)/gi,E=/([^<]*)<\/cke:encoded>/gi,F=/(<\/?)((?:object|embed|param|html|body|head|title)[^>]*>)/gi,G=/(<\/?)cke:((?:html|body|head|title)[^>]*>)/gi,H=/]*?)\/?>(?!\s*<\/cke:\1)/gi;function I(T){return T.replace(B,function(U,V,W){return '<'+V+W.replace(C,function(X,Y){if(W.indexOf('data-cke-saved-'+Y)==-1)return ' data-cke-saved-'+X+' '+X;return X;})+'>';});};function J(T){return T.replace(D,function(U){return ''+encodeURIComponent(U)+'';});};function K(T){return T.replace(E,function(U,V){return decodeURIComponent(V);});};function L(T){return T.replace(F,'$1cke:$2');};function M(T){return T.replace(G,'$1$2');};function N(T){return T.replace(H,'');};function O(T){return T.replace(/(]*>)(\r\n|\n)/g,'$1$2$2'); -};function P(T){return T.replace(//g,function(U){return '';});};function Q(T){return T.replace(//g,function(U,V){return decodeURIComponent(V);});};function R(T,U){var V=U._.dataStore;return T.replace(//g,function(W,X){return decodeURIComponent(X);}).replace(/\{cke_protected_(\d+)\}/g,function(W,X){return V&&V[X]||'';});};function S(T,U){var V=[],W=U.config.protectedSource,X=U._.dataStore||(U._.dataStore={id:1}),Y=/<\!--\{cke_temp(comment)?\}(\d*?)-->/g,Z=[//gi,//gi].concat(W);T=T.replace(//g,function(ab){return '';});for(var aa=0;aa';});T=T.replace(Y,function(ab,ac,ad){return '';});return T.replace(/(['"]).*?\1/g,function(ab){return ab.replace(//g,function(ac,ad){X[X.id]=decodeURIComponent(ad);return '{cke_protected_'+X.id++ +'}';});});};j.add('htmldataprocessor',{requires:['htmlwriter'],init:function(T){var U=T.dataProcessor=new a.htmlDataProcessor(T);U.writer.forceSimpleAmpersand=T.config.forceSimpleAmpersand;U.dataFilter.addRules(w);U.dataFilter.addRules(x);U.htmlFilter.addRules(y);var V={elements:{}};for(v in u)V.elements[v]=r(true,T.config.fillEmptyBlocks);U.htmlFilter.addRules(V);},onLoad:function(){!('fillEmptyBlocks' in i)&&(i.fillEmptyBlocks=1);}});a.htmlDataProcessor=function(T){var U=this;U.editor=T;U.writer=new a.htmlWriter();U.dataFilter=new a.htmlParser.filter();U.htmlFilter=new a.htmlParser.filter();};a.htmlDataProcessor.prototype={toHtml:function(T,U){T=S(T,this.editor);T=I(T);T=J(T);T=L(T);T=N(T);T=O(T);var V=new h('div');V.setHtml('a'+T);T=V.getHtml().substr(1);T=M(T);T=K(T);T=Q(T);var W=a.htmlParser.fragment.fromHtml(T,U),X=new a.htmlParser.basicWriter();W.writeHtml(X,this.dataFilter);T=X.getHtml(true);T=P(T);return T;},toDataFormat:function(T,U){var V=this.writer,W=a.htmlParser.fragment.fromHtml(T,U);V.reset();W.writeHtml(V,this.htmlFilter);var X=V.getHtml(true);X=Q(X);X=R(X,this.editor);return X;}};})();(function(){function m(n,o){var p=n.createFakeParserElement(o,'cke_iframe','iframe',true),q=p.attributes.style||'',r=o.attributes.width,s=o.attributes.height; -if(typeof r!='undefined')q+='width:'+e.cssLength(r)+';';if(typeof s!='undefined')q+='height:'+e.cssLength(s)+';';p.attributes.style=q;return p;};j.add('iframe',{requires:['dialog','fakeobjects'],init:function(n){var o='iframe',p=n.lang.iframe;a.dialog.add(o,this.path+'dialogs/iframe.js');n.addCommand(o,new a.dialogCommand(o));n.addCss('img.cke_iframe{background-image: url('+a.getUrl(this.path+'images/placeholder.png')+');'+'background-position: center center;'+'background-repeat: no-repeat;'+'border: 1px solid #a9a9a9;'+'width: 80px;'+'height: 80px;'+'}');n.ui.addButton('Iframe',{label:p.toolbar,command:o});n.on('doubleclick',function(q){var r=q.data.element;if(r.is('img')&&r.data('cke-real-element-type')=='iframe')q.data.dialog='iframe';});if(n.addMenuItems)n.addMenuItems({iframe:{label:p.title,command:'iframe',group:'image'}});if(n.contextMenu)n.contextMenu.addListener(function(q,r){if(q&&q.is('img')&&q.data('cke-real-element-type')=='iframe')return{iframe:2};});},afterInit:function(n){var o=n.dataProcessor,p=o&&o.dataFilter;if(p)p.addRules({elements:{iframe:function(q){return m(n,q);}}});}});})();j.add('image',{init:function(m){var n='image';a.dialog.add(n,this.path+'dialogs/image.js');m.addCommand(n,new a.dialogCommand(n));m.ui.addButton('Image',{label:m.lang.common.image,command:n});m.on('doubleclick',function(o){var p=o.data.element;if(p.is('img')&&!p.data('cke-realelement')&&!p.isReadOnly())o.data.dialog='image';});if(m.addMenuItems)m.addMenuItems({image:{label:m.lang.image.menu,command:'image',group:'image'}});if(m.contextMenu)m.contextMenu.addListener(function(o,p){if(!o||!o.is('img')||o.data('cke-realelement')||o.isReadOnly())return null;return{image:2};});}});i.image_removeLinkByEmptyURL=true;(function(){var m={ol:1,ul:1},n=d.walker.whitespaces(true),o=d.walker.bookmark(false,true);function p(t){var B=this;if(t.editor.readOnly)return null;var u=t.editor,v=t.data.path,w=v&&v.contains(m),x=v.block||v.blockLimit;if(w)return B.setState(2);if(!B.useIndentClasses&&B.name=='indent')return B.setState(2);if(!x)return B.setState(0);if(B.useIndentClasses){var y=x.$.className.match(B.classNameRegex),z=0;if(y){y=y[1];z=B.indentClassMap[y];}if(B.name=='outdent'&&!z||B.name=='indent'&&z==u.config.indentClasses.length)return B.setState(0);return B.setState(2);}else{var A=parseInt(x.getStyle(r(x)),10);if(isNaN(A))A=0;if(A<=0)return B.setState(0);return B.setState(2);}};function q(t,u){var w=this;w.name=u;w.useIndentClasses=t.config.indentClasses&&t.config.indentClasses.length>0; -if(w.useIndentClasses){w.classNameRegex=new RegExp('(?:^|\\s+)('+t.config.indentClasses.join('|')+')(?=$|\\s)');w.indentClassMap={};for(var v=0;vY;T++)X[T].indent+=U;var aa=j.list.arrayToList(X,v,null,t.config.enterMode,M.getDirection());if(u.name=='outdent'){var ab;if((ab=M.getParent())&&ab.is('li')){var ac=aa.listNode.getChildren(),ad=[],ae=ac.count(),af;for(T=ae-1;T>=0;T--){if((af=ac.getItem(T))&&af.is&&af.is('li'))ad.push(af);}}}if(aa)aa.listNode.replace(M);if(ad&&ad.length)for(T=0;T0)M.addClass(t.config.indentClasses[P-1]);}else{var Q=r(M,N),R=parseInt(M.getStyle(Q),10);if(isNaN(R))R=0;var S=t.config.indentOffset||40;R+=(u.name=='indent'?1:-1)*S;if(R<0)return false;R=Math.max(R,0);R=Math.ceil(R/S)*S;M.setStyle(Q,R?R+(t.config.indentUnit||'px'):''); -if(M.getAttribute('style')==='')M.removeAttribute('style');}h.setMarker(v,M,'indent_processed',1);return true;};var z=t.getSelection(),A=z.createBookmarks(1),B=z&&z.getRanges(1),C,D=B.createIterator();while(C=D.getNextRange()){var E=C.getCommonAncestor(),F=E;while(F&&!(F.type==1&&m[F.getName()]))F=F.getParent();if(!F){var G=C.getEnclosedNode();if(G&&G.type==1&&G.getName() in m){C.setStartAt(G,1);C.setEndAt(G,2);F=G;}}if(F&&C.startContainer.type==1&&C.startContainer.getName() in m){var H=new d.walker(C);H.evaluator=s;C.startContainer=H.next();}if(F&&C.endContainer.type==1&&C.endContainer.getName() in m){H=new d.walker(C);H.evaluator=s;C.endContainer=H.previous();}if(F){var I=F.getFirst(s),J=!!I.getNext(s),K=C.startContainer,L=I.equals(K)||I.contains(K);if(!(L&&(u.name=='indent'||u.useIndentClasses||parseInt(F.getStyle(r(F)),10))&&y(F,!J&&I.getDirection())))w(F);}else x();}h.clearAllMarkers(v);t.forceNextSelectionCheck();z.selectBookmarks(A);}};j.add('indent',{init:function(t){var u=t.addCommand('indent',new q(t,'indent')),v=t.addCommand('outdent',new q(t,'outdent'));t.ui.addButton('Indent',{label:t.lang.indent,command:'indent'});t.ui.addButton('Outdent',{label:t.lang.outdent,command:'outdent'});t.on('selectionChange',e.bind(p,u));t.on('selectionChange',e.bind(p,v));if(b.ie6Compat||b.ie7Compat)t.addCss('ul,ol{\tmargin-left: 0px;\tpadding-left: 40px;}');t.on('dirChanged',function(w){var x=new d.range(t.document);x.setStartBefore(w.data.node);x.setEndAfter(w.data.node);var y=new d.walker(x),z;while(z=y.next()){if(z.type==1){if(!z.equals(w.data.node)&&z.getDirection()){x.setStartAfter(z);y=new d.walker(x);continue;}var A=t.config.indentClasses;if(A){var B=w.data.dir=='ltr'?['_rtl','']:['','_rtl'];for(var C=0;C=0;A--){x=v[A].createIterator();x.enlargeBr=t!=2;while(y=x.getNextParagraph(t==1?'p':'div')){y.removeAttribute('align');y.removeStyle('text-align');var B=w&&(y.$.className=e.ltrim(y.$.className.replace(D.cssClassRegex,''))),C=D.state==2&&(!z||n(y,true)!=D.value);if(w){if(C)y.addClass(w);else if(!B)y.removeAttribute('class');}else if(C)y.setStyle('text-align',D.value);}}r.focus();r.forceNextSelectionCheck();s.selectBookmarks(u);}};j.add('justify',{init:function(r){var s=new p(r,'justifyleft','left'),t=new p(r,'justifycenter','center'),u=new p(r,'justifyright','right'),v=new p(r,'justifyblock','justify');r.addCommand('justifyleft',s);r.addCommand('justifycenter',t);r.addCommand('justifyright',u);r.addCommand('justifyblock',v);r.ui.addButton('JustifyLeft',{label:r.lang.justify.left,command:'justifyleft'});r.ui.addButton('JustifyCenter',{label:r.lang.justify.center,command:'justifycenter'});r.ui.addButton('JustifyRight',{label:r.lang.justify.right,command:'justifyright'});r.ui.addButton('JustifyBlock',{label:r.lang.justify.block,command:'justifyblock'});r.on('selectionChange',e.bind(o,s));r.on('selectionChange',e.bind(o,u));r.on('selectionChange',e.bind(o,t));r.on('selectionChange',e.bind(o,v)); -r.on('dirChanged',q);},requires:['domiterator']});})();j.add('keystrokes',{beforeInit:function(m){m.keystrokeHandler=new a.keystrokeHandler(m);m.specialKeys={};},init:function(m){var n=m.config.keystrokes,o=m.config.blockedKeystrokes,p=m.keystrokeHandler.keystrokes,q=m.keystrokeHandler.blockedKeystrokes;for(var r=0;r7))O.append(J.createText('\xa0'));O.append(V.listNode);M=V.nextIndex;}else if(R.indent==-1&&!G&&R.grandparent){if(m[R.grandparent.getName()]){O=R.element.clone(false,true);P=R.element.getDirection(1);R.grandparent.getDirection(1)!=P&&O.setAttribute('dir',P);}else if(I||R.element.hasAttributes()||H!=2){O=J.createElement(Q);R.element.copyAttributes(O,{type:1,value:1});P=R.element.getDirection()||I;P&&O.setAttribute('dir',P);if(!I&&H==2&&!O.hasAttributes())O=new d.documentFragment(J);}else O=new d.documentFragment(J);for(S=0;SH[J-1].indent+1){var N=H[J-1].indent+1-H[J].indent,O=H[J].indent;while(H[J]&&H[J].indent>=O){H[J].indent+=N;J++;}J--;}}var P=j.list.arrayToList(H,G,null,E.config.enterMode,F.root.getAttribute('dir')),Q=P.listNode,R,S;function T(U){if((R=Q[U?'getFirst':'getLast']())&&!(R.is&&R.isBlockBoundary())&&(S=F.root[U?'getPrevious':'getNext'](d.walker.whitespaces(true)))&&!(S.is&&S.isBlockBoundary({br:1})))E.document.createElement('br')[U?'insertBefore':'insertAfter'](R);};T(true);T();Q.replace(F.root);};function w(E,F){this.name=E;this.type=F;};w.prototype={exec:function(E){var F=E.document,G=E.config,H=E.getSelection(),I=H&&H.getRanges(true);if(!I||I.length<1)return;if(this.state==2){var J=F.getBody();if(!J.getFirst(q)){G.enterMode==2?J.appendBogus():I[0].fixBlock(1,G.enterMode==1?'p':'div');H.selectRanges(I);}else{var K=I.length==1&&I[0],L=K&&K.getEnclosedNode();if(L&&L.is&&this.type==L.getName())this.setState(1);}}var M=H.createBookmarks(true),N=[],O={},P=I.createIterator(),Q=0;while((K=P.getNextRange())&&++Q){var R=K.getBoundaryNodes(),S=R.startNode,T=R.endNode;if(S.type==1&&S.getName()=='td')K.setStartAt(R.startNode,1);if(T.type==1&&T.getName()=='td')K.setEndAt(R.endNode,2);var U=K.createIterator(),V;U.forceBrBreak=this.state==2;while(V=U.getNextParagraph()){if(V.getCustomData('list_block'))continue;else h.setMarker(O,V,'list_block',1);var W=new d.elementPath(V),X=W.elements,Y=X.length,Z=null,aa=0,ab=W.blockLimit,ac;for(var ad=Y-1;ad>=0&&(ac=X[ad]);ad--){if(m[ac.getName()]&&ab.contains(ac)){ab.removeCustomData('list_group_object_'+Q);var ae=ac.getCustomData('list_group_object');if(ae)ae.contents.push(V);else{ae={root:ac,contents:[V]};N.push(ae);h.setMarker(O,ac,'list_group_object',ae);}aa=1;break;}}if(aa)continue;var af=ab;if(af.getCustomData('list_group_object_'+Q))af.getCustomData('list_group_object_'+Q).contents.push(V);else{ae={root:af,contents:[V]};h.setMarker(O,af,'list_group_object_'+Q,ae);N.push(ae);}}}var ag=[];while(N.length>0){ae=N.shift();if(this.state==2){if(m[ae.root.getName()])s.call(this,E,ae,O,ag);else u.call(this,E,ae,ag);}else if(this.state==1&&m[ae.root.getName()])v.call(this,E,ae,O);}for(ad=0;ad0)for(var u=t.length-1;u>=0;u--){var v=t[u][0],w=t[u][1];if(w)v.insertBefore(w);else v.appendTo(s);}};function o(s,t){var u=m(s),v={},w=s.$;if(!t){v['class']=w.className||''; -w.className='';}v.inline=w.style.cssText||'';if(!t)w.style.cssText='position: static; overflow: visible';n(u);return v;};function p(s,t){var u=m(s),v=s.$;if('class' in t)v.className=t['class'];if('inline' in t)v.style.cssText=t.inline;n(u);};function q(s){var t=a.instances;for(var u in t){var v=t[u];if(v.mode=='wysiwyg'&&!v.readOnly){var w=v.document.getBody();w.setAttribute('contentEditable',false);w.setAttribute('contentEditable',true);}}if(s.focusManager.hasFocus){s.toolbox.focus();s.focus();}};function r(s){if(!c||b.version>6)return null;var t=h.createFromHtml('');return s.append(t,true);};j.add('maximize',{init:function(s){var t=s.lang,u=a.document,v=u.getWindow(),w,x,y,z;function A(){var C=v.getViewPaneSize();z&&z.setStyles({width:C.width+'px',height:C.height+'px'});s.resize(C.width,C.height,null,true);};var B=2;s.addCommand('maximize',{modes:{wysiwyg:1,source:1},readOnly:1,editorFocus:false,exec:function(){var C=s.container.getChild(1),D=s.getThemeSpace('contents');if(s.mode=='wysiwyg'){var E=s.getSelection();w=E&&E.getRanges();x=v.getScrollPosition();}else{var F=s.textarea.$;w=!c&&[F.selectionStart,F.selectionEnd];x=[F.scrollLeft,F.scrollTop];}if(this.state==2){v.on('resize',A);y=v.getScrollPosition();var G=s.container;while(G=G.getParent()){G.setCustomData('maximize_saved_styles',o(G));G.setStyle('z-index',s.config.baseFloatZIndex-1);}D.setCustomData('maximize_saved_styles',o(D,true));C.setCustomData('maximize_saved_styles',o(C,true));var H={overflow:b.webkit?'':'hidden',width:0,height:0};u.getDocumentElement().setStyles(H);!b.gecko&&u.getDocumentElement().setStyle('position','fixed');!(b.gecko&&b.quirks)&&u.getBody().setStyles(H);c?setTimeout(function(){v.$.scrollTo(0,0);},0):v.$.scrollTo(0,0);C.setStyle('position',b.gecko&&b.quirks?'fixed':'absolute');C.$.offsetLeft;C.setStyles({'z-index':s.config.baseFloatZIndex-1,left:'0px',top:'0px'});z=r(C);C.removeClass('cke_minimized');C.addClass('cke_maximized');A();var I=C.getDocumentPosition();C.setStyles({left:-1*I.x+'px',top:-1*I.y+'px'});b.gecko&&q(s);}else if(this.state==1){v.removeListener('resize',A);var J=[D,C];for(var K=0;K ');s.children.length=0;s.add(u);var v=s.attributes;delete v['aria-label'];delete v.contenteditable;delete v.title; -}return t;}}},5);if(p)p.addRules({elements:{div:function(r){var s=r.attributes,t=s&&s.style,u=t&&r.children.length==1&&r.children[0],v=u&&u.name=='span'&&u.attributes.style;if(v&&/page-break-after\s*:\s*always/i.test(t)&&/display\s*:\s*none/i.test(v)){s.contenteditable='false';s['class']='cke_pagebreak';s['data-cke-display-name']='pagebreak';s['aria-label']=n;s.title=n;r.children.length=0;}}}});},requires:['fakeobjects']});j.pagebreakCmd={exec:function(m){var n=m.lang.pagebreakAlt,o=h.createFromHtml('
            '+'
            '),p=m.getSelection().getRanges(true);m.fire('saveSnapshot');for(var q,r=p.length-1;r>=0;r--){q=p[r];if(r1&&n.substr(n.length-1,1)=='%')n=parseInt(window.screen.width*parseInt(n,10)/100,10);if(typeof o=='string'&&o.length>1&&o.substr(o.length-1,1)=='%')o=parseInt(window.screen.height*parseInt(o,10)/100,10);if(n<640)n=640;if(o<420)o=420;var q=parseInt((window.screen.height-o)/2,10),r=parseInt((window.screen.width-n)/2,10);p=(p||'location=no,menubar=no,toolbar=no,dependent=yes,minimizable=no,modal=yes,alwaysRaised=yes,resizable=yes,scrollbars=yes')+',width='+n+',height='+o+',top='+q+',left='+r;var s=window.open('',null,p,true);if(!s)return false;try{s.moveTo(r,q);s.resizeTo(n,o);s.focus();s.location.href=m;}catch(t){s=window.open(m,null,p,true);}return true;}});(function(){var m={modes:{wysiwyg:1,source:1},canUndo:false,readOnly:1,exec:function(o){var p,q=o.config,r=q.baseHref?'':'',s=b.isCustomDomain();if(q.fullPage)p=o.getData().replace(//,'$&'+r).replace(/[^>]*(?=<\/title>)/,'$& — '+o.lang.preview);else{var t=''+''+r+''+o.lang.preview+''+e.buildStyleHtml(o.config.contentsCss)+''+t+o.getData()+'';}var v=640,w=420,x=80;try{var y=window.screen;v=Math.round(y.width*0.8);w=Math.round(y.height*0.7);x=Math.round(y.width*0.1);}catch(B){}var z='';if(s){window._cke_htmlToLoad=p;z='javascript:void( (function(){document.open();document.domain="'+document.domain+'";'+'document.write( window.opener._cke_htmlToLoad );'+'document.close();'+'window.opener._cke_htmlToLoad = null;'+'})() )';}var A=window.open(z,null,'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width='+v+',height='+w+',left='+x);if(!s){A.document.open();A.document.write(p); -A.document.close();}}},n='preview';j.add(n,{init:function(o){o.addCommand(n,m);o.ui.addButton('Preview',{label:o.lang.preview,command:n});}});})();j.add('print',{init:function(m){var n='print',o=m.addCommand(n,j.print);m.ui.addButton('Print',{label:m.lang.print,command:n});}});j.print={exec:function(m){if(b.opera)return;else if(b.gecko)m.window.$.print();else m.document.$.execCommand('Print');},canUndo:false,readOnly:1,modes:{wysiwyg:!b.opera}};j.add('removeformat',{requires:['selection'],init:function(m){m.addCommand('removeFormat',j.removeformat.commands.removeformat);m.ui.addButton('RemoveFormat',{label:m.lang.removeFormat,command:'removeFormat'});m._.removeFormat={filters:[]};}});j.removeformat={commands:{removeformat:{exec:function(m){var n=m._.removeFormatRegex||(m._.removeFormatRegex=new RegExp('^(?:'+m.config.removeFormatTags.replace(/,/g,'|')+')$','i')),o=m._.removeAttributes||(m._.removeAttributes=m.config.removeFormatAttributes.split(',')),p=j.removeformat.filter,q=m.getSelection().getRanges(1),r=q.createIterator(),s;while(s=r.getNextRange()){if(!s.collapsed)s.enlarge(1);var t=s.createBookmark(),u=t.startNode,v=t.endNode,w,x=function(z){var A=new d.elementPath(z),B=A.elements;for(var C=1,D;D=B[C];C++){if(D.equals(A.block)||D.equals(A.blockLimit))break;if(n.test(D.getName())&&p(m,D))z.breakParent(D);}};x(u);if(v){x(v);w=u.getNextSourceNode(true,1);while(w){if(w.equals(v))break;var y=w.getNextSourceNode(false,1);if(!(w.getName()=='img'&&w.data('cke-realelement'))&&p(m,w))if(n.test(w.getName()))w.remove(1);else{w.removeAttributes(o);m.fire('removeFormatCleanup',w);}w=y;}}s.moveToBookmark(t);}m.getSelection().selectRanges(q);}}},filter:function(m,n){var o=m._.removeFormat.filters;for(var p=0;pr.width&&(n.resize_minWidth=r.width);n.resize_minHeight>r.height&&(n.resize_minHeight=r.height);a.document.on('mousemove',u);a.document.on('mouseup',v);if(m.document){m.document.on('mousemove',u);m.document.on('mouseup',v);}});m.on('destroy',function(){e.removeFunction(w);});m.on('themeSpace',function(x){if(x.data.space=='bottom'){var y='';if(s&&!t)y=' cke_resizer_horizontal';if(!s&&t)y=' cke_resizer_vertical';var z='
            ';o=='ltr'&&y=='ltr'?x.data.html+=z:x.data.html=z+x.data.html;}},m,null,100);}}});(function(){var m={modes:{wysiwyg:1,source:1},readOnly:1,exec:function(o){var p=o.element.$.form;if(p)try{p.submit();}catch(q){if(p.submit.click)p.submit.click();}}},n='save';j.add(n,{init:function(o){var p=o.addCommand(n,m);p.modes={wysiwyg:!!o.element.$.form};o.ui.addButton('Save',{label:o.lang.save,command:n});}});})();(function(){var m='scaytcheck',n='';function o(t,u){var v=0,w;for(w in u){if(u[w]==t){v=1;break;}}return v;};var p=function(){var t=this,u=function(){var y=t.config,z={};z.srcNodeRef=t.document.getWindow().$.frameElement;z.assocApp='CKEDITOR.'+a.version+'@'+a.revision;z.customerid=y.scayt_customerid||'1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';z.customDictionaryIds=y.scayt_customDictionaryIds||'';z.userDictionaryName=y.scayt_userDictionaryName||'';z.sLang=y.scayt_sLang||'en_US';z.onLoad=function(){if(!(c&&b.version<8))this.addStyle(this.selectorCss(),'padding-bottom: 2px !important;');if(t.focusManager.hasFocus&&!q.isControlRestored(t))this.focus();};z.onBeforeChange=function(){if(q.getScayt(t)&&!t.checkDirty())setTimeout(function(){t.resetDirty();},0);};var A=window.scayt_custom_params;if(typeof A=='object')for(var B in A)z[B]=A[B];if(q.getControlId(t))z.id=q.getControlId(t); -var C=new window.scayt(z);C.afterMarkupRemove.push(function(E){new h(E,C.document).mergeSiblings();});var D=q.instances[t.name];if(D){C.sLang=D.sLang;C.option(D.option());C.paused=D.paused;}q.instances[t.name]=C;try{C.setDisabled(q.isPaused(t)===false);}catch(E){}t.fire('showScaytState');};t.on('contentDom',u);t.on('contentDomUnload',function(){var y=a.document.getElementsByTag('script'),z=/^dojoIoScript(\d+)$/i,A=/^https?:\/\/svc\.spellchecker\.net\/spellcheck\/script\/ssrv\.cgi/i;for(var B=0;B=0){this.setState(0);q.loadEngine(t);}}};j.add('scayt',{requires:['menubutton'],beforeInit:function(t){var u=t.config.scayt_contextMenuItemsOrder||'suggest|moresuggest|control',v=''; -u=u.split('|');if(u&&u.length)for(var w=0;w tr > td, .%1 table.%2 > tr > th,','.%1 table.%2 > tbody > tr > td, .%1 table.%2 > tbody > tr > th,','.%1 table.%2 > thead > tr > td, .%1 table.%2 > thead > tr > th,','.%1 table.%2 > tfoot > tr > td, .%1 table.%2 > tfoot > tr > th','{','border : #d3d3d3 1px dotted','}']).join('');n=o.replace(/%2/g,m).replace(/%1/g,'cke_show_borders ');var p={preserveState:true,editorFocus:false,readOnly:1,exec:function(q){this.toggleState();this.refresh(q);},refresh:function(q){if(q.document){var r=this.state==1?'addClass':'removeClass';q.document.getBody()[r]('cke_show_borders');}}};j.add('showborders',{requires:['wysiwygarea'],modes:{wysiwyg:1},init:function(q){var r=q.addCommand('showborders',p);r.canUndo=false;if(q.config.startupShowBorders!==false)r.setState(1);q.addCss(n);q.on('mode',function(){if(r.state!=0)r.refresh(q);},null,null,100);q.on('contentDom',function(){if(r.state!=0)r.refresh(q);});q.on('removeFormatCleanup',function(s){var t=s.data;if(q.getCommand('showborders').state==1&&t.is('table')&&(!t.hasAttribute('border')||parseInt(t.getAttribute('border'),10)<=0))t.addClass(m);});},afterInit:function(q){var r=q.dataProcessor,s=r&&r.dataFilter,t=r&&r.htmlFilter;if(s)s.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'],x=parseInt(v.border,10);if(!x||x<=0)v['class']=(w||'')+' '+m;}}});if(t)t.addRules({elements:{table:function(u){var v=u.attributes,w=v['class'];w&&(v['class']=w.replace(m,'').replace(/\s{2}/,' ').replace(/^\s+|\s+$/,''));}}});}});a.on('dialogDefinition',function(q){var r=q.data.name;if(r=='table'||r=='tableProperties'){var s=q.data.definition,t=s.getContents('info'),u=t.get('txtBorder'),v=u.commit;u.commit=e.override(v,function(y){return function(z,A){y.apply(this,arguments); -var B=parseInt(this.getValue(),10);A[!B||B<=0?'addClass':'removeClass'](m);};});var w=s.getContents('advanced'),x=w&&w.get('advCSSClasses');if(x){x.setup=e.override(x.setup,function(y){return function(){y.apply(this,arguments);this.setValue(this.getValue().replace(/cke_show_border/,''));};});x.commit=e.override(x.commit,function(y){return function(z,A){y.apply(this,arguments);if(!parseInt(A.getAttribute('border'),10))A.addClass('cke_show_border');};});}}});})();j.add('sourcearea',{requires:['editingblock'],init:function(m){var n=j.sourcearea,o=a.document.getWindow();m.on('editingBlockReady',function(){var p,q;m.addMode('source',{load:function(r,s){if(c&&b.version<8)r.setStyle('position','relative');m.textarea=p=new h('textarea');p.setAttributes({dir:'ltr',tabIndex:b.webkit?-1:m.tabIndex,role:'textbox','aria-label':m.lang.editorTitle.replace('%1',m.name)});p.addClass('cke_source');p.addClass('cke_enable_context_menu');m.readOnly&&p.setAttribute('readOnly','readonly');var t={width:b.ie7Compat?'99%':'100%',height:'100%',resize:'none',outline:'none','text-align':'left'};if(c){q=function(){p.hide();p.setStyle('height',r.$.clientHeight+'px');p.setStyle('width',r.$.clientWidth+'px');p.show();};m.on('resize',q);o.on('resize',q);setTimeout(q,0);}r.setHtml('');r.append(p);p.setStyles(t);m.fire('ariaWidget',p);p.on('blur',function(){m.focusManager.blur();});p.on('focus',function(){m.focusManager.focus();});m.mayBeDirty=true;this.loadData(s);var u=m.keystrokeHandler;if(u)u.attach(p);setTimeout(function(){m.mode='source';m.fire('mode');},b.gecko||b.webkit?100:0);},loadData:function(r){p.setValue(r);m.fire('dataReady');},getData:function(){return p.getValue();},getSnapshotData:function(){return p.getValue();},unload:function(r){p.clearCustomData();m.textarea=p=null;if(q){m.removeListener('resize',q);o.removeListener('resize',q);}if(c&&b.version<8)r.removeStyle('position');},focus:function(){p.focus();}});});m.on('readOnly',function(){if(m.mode=='source')if(m.readOnly)m.textarea.setAttribute('readOnly','readonly');else m.textarea.removeAttribute('readOnly');});m.addCommand('source',n.commands.source);if(m.ui.addButton)m.ui.addButton('Source',{label:m.lang.source,command:'source'});m.on('mode',function(){m.getCommand('source').setState(m.mode=='source'?1:2);});}});j.sourcearea={commands:{source:{modes:{wysiwyg:1,source:1},editorFocus:false,readOnly:1,exec:function(m){if(m.mode=='wysiwyg')m.fire('saveSnapshot');m.getCommand('source').setState(0);m.setMode(m.mode=='source'?'wysiwyg':'source'); -},canUndo:false}}};(function(){j.add('stylescombo',{requires:['richcombo','styles'],init:function(n){var o=n.config,p=n.lang.stylesCombo,q={},r=[],s;function t(u){n.getStylesSet(function(v){if(!r.length){var w,x;for(var y=0,z=v.length;y0)return;if(T.type==1&&m.test(T.getName())&&!T.getCustomData('selected_cell')){h.setMarker(K,T,'selected_cell',true);J.push(T);}};for(var M=0;M1&&V&&U[Y]==V[Y]){Z=U[Y];Z.rowSpan+=1;}else{Z=new h(U[Y]).clone();Z.removeAttribute('rowSpan');!c&&Z.appendBogus();X.append(Z);Z=Z.$;}Y+=Z.colSpan-1;}H?X.insertBefore(S):X.insertAfter(S);};function q(G){if(G instanceof d.selection){var H=n(G),I=H[0],J=I.getAscendant('table'),K=e.buildTableMap(J),L=H[0].getParent(),M=L.$.rowIndex,N=H[H.length-1],O=N.getParent().$.rowIndex+N.$.rowSpan-1,P=[];for(var Q=M;Q<=O;Q++){var R=K[Q],S=new h(J.$.rows[Q]);for(var T=0;T=0;Q--)q(P[Q]);return Y;}else if(G instanceof h){J=G.getAscendant('table');if(J.$.rows.length==1)J.remove();else G.remove(); -}return null;};function r(G,H){var I=G.getParent(),J=I.$.cells,K=0;for(var L=0;LI)I=K;}return I;};function t(G,H){var I=n(G),J=I[0],K=J.getAscendant('table'),L=s(I,1),M=s(I),N=H?L:M,O=e.buildTableMap(K),P=[],Q=[],R=O.length;for(var S=0;S1&&Q.length&&Q[S]==P[S]){U=P[S];U.colSpan+=1;}else{U=new h(P[S]).clone();U.removeAttribute('colSpan');!c&&U.appendBogus();U[H?'insertBefore':'insertAfter'].call(U,new h(P[S]));U=U.$;}S+=U.rowSpan-1;}};function u(G){var H=n(G),I=H[0],J=H[H.length-1],K=I.getAscendant('table'),L=e.buildTableMap(K),M,N,O=[];for(var P=0,Q=L.length;P1){L=H[J-1]+1;break;}}if(!L)L=H[0]>0?H[0]-1:H[H.length-1]+1;var N=I.$.rows;for(J=0,K=N.length;J=0;K--)x(H[K]);if(J)z(J,true);else if(I)I.remove();}else if(G instanceof h){var L=G.getParent();if(L.getChildCount()==1)L.remove();else G.remove();}};function y(G){var H=G.getBogus();H&&H.remove();G.trim();};function z(G,H){var I=new d.range(G.getDocument());if(!I['moveToElementEdit'+(H?'End':'Start')](G)){I.selectNodeContents(G);I.collapse(H?false:true);}I.select(true);};function A(G,H,I){var J=G[H];if(typeof I=='undefined')return J;for(var K=0;J&&K=Q)M.removeAttribute('rowSpan');else M.$.rowSpan=Y;if(Y>=P)M.removeAttribute('colSpan');else M.$.colSpan=Z;var ak=new d.nodeList(N.$.rows),al=ak.count();for(ac=al-1;ac>=0;ac--){var am=ak.getItem(ac);if(!am.$.cells.length){am.remove();al++;continue;}}return M;}else return Y*Z==ab;};function D(G,H){var I=n(G);if(I.length>1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.rowSpan,Q,R,S,T;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);T=N+R;var U=new h(L.$.rows[T]),V=A(M,T),W;Q=J.clone();for(var X=0;XO){Q.insertBefore(new h(W));break;}else W=null;}if(!W)U.append(Q,true);}else{S=R=1;U=K.clone();U.insertAfter(K);U.append(Q=J.clone());var Y=A(M,N);for(var Z=0;Z1)return false;else if(H)return true;var J=I[0],K=J.getParent(),L=K.getAscendant('table'),M=e.buildTableMap(L),N=K.$.rowIndex,O=A(M,N,J),P=J.$.colSpan,Q,R,S;if(P>1){R=Math.ceil(P/2);S=Math.floor(P/2);}else{S=R=1;var T=B(M,O);for(var U=0;U0?2:0};}},tablecell_insertBefore:{label:H.cell.insertBefore,group:'tablecell',command:'cellInsertBefore',order:5},tablecell_insertAfter:{label:H.cell.insertAfter,group:'tablecell',command:'cellInsertAfter',order:10},tablecell_delete:{label:H.cell.deleteCell,group:'tablecell',command:'cellDelete',order:15},tablecell_merge:{label:H.cell.merge,group:'tablecell',command:'cellMerge',order:16},tablecell_merge_right:{label:H.cell.mergeRight,group:'tablecell',command:'cellMergeRight',order:17},tablecell_merge_down:{label:H.cell.mergeDown,group:'tablecell',command:'cellMergeDown',order:18},tablecell_split_horizontal:{label:H.cell.splitHorizontal,group:'tablecell',command:'cellHorizontalSplit',order:19},tablecell_split_vertical:{label:H.cell.splitVertical,group:'tablecell',command:'cellVerticalSplit',order:20},tablecell_properties:{label:H.cell.title,group:'tablecellproperties',command:'cellProperties',order:21},tablerow:{label:H.row.menu,group:'tablerow',order:1,getItems:function(){return{tablerow_insertBefore:2,tablerow_insertAfter:2,tablerow_delete:2}; -}},tablerow_insertBefore:{label:H.row.insertBefore,group:'tablerow',command:'rowInsertBefore',order:5},tablerow_insertAfter:{label:H.row.insertAfter,group:'tablerow',command:'rowInsertAfter',order:10},tablerow_delete:{label:H.row.deleteRow,group:'tablerow',command:'rowDelete',order:15},tablecolumn:{label:H.column.menu,group:'tablecolumn',order:1,getItems:function(){return{tablecolumn_insertBefore:2,tablecolumn_insertAfter:2,tablecolumn_delete:2};}},tablecolumn_insertBefore:{label:H.column.insertBefore,group:'tablecolumn',command:'columnInsertBefore',order:5},tablecolumn_insertAfter:{label:H.column.insertAfter,group:'tablecolumn',command:'columnInsertAfter',order:10},tablecolumn_delete:{label:H.column.deleteColumn,group:'tablecolumn',command:'columnDelete',order:15}});if(G.contextMenu)G.contextMenu.addListener(function(I,J){if(!I||I.isReadOnly())return null;while(I){if(I.getName() in F)return{tablecell:2,tablerow:2,tablecolumn:2};I=I.getParent();}return null;});},getSelectedCells:n};j.add('tabletools',j.tabletools);})();e.buildTableMap=function(m){var n=m.$.rows,o=-1,p=[];for(var q=0;qp&&(!s||!t||vt){s=v;t=u;}}else{if(q&&u==p){s=v;break;}if(ut)){s=v;t=u;}}}if(s)s.focus();};(function(){j.add('templates',{requires:['dialog'],init:function(o){a.dialog.add('templates',a.getUrl(this.path+'dialogs/templates.js'));o.addCommand('templates',new a.dialogCommand('templates'));o.ui.addButton('Templates',{label:o.lang.templates.button,command:'templates'});}});var m={},n={};a.addTemplates=function(o,p){m[o]=p;};a.getTemplates=function(o){return m[o];};a.loadTemplates=function(o,p){var q=[];for(var r=0,s=o.length;r':' style="display:none">');t.push('',o.lang.toolbars,'');var w=o.toolbox.toolbars,x=o.config.toolbar instanceof Array?o.config.toolbar:o.config['toolbar_'+o.config.toolbar];for(var y=0;y');v=0;}if(C==='/'){t.push('
            ');continue;}D=C.items||C;for(var E=0;E');B&&t.push('',B,'');t.push('');var I=w.push(A)-1;if(I>0){A.previous=w[I-1];A.previous.next=A;}}if(H){if(!v){t.push('');v=1;}}else if(v){t.push('');v=0;}var J=F.render(o,t);I=A.items.push(J)-1;if(I>0){J.previous=A.items[I-1];J.previous.next=J;}J.toolbar=A;J.onkey=q;J.onfocus=function(){if(!o.toolbox.focusCommandExecuted)o.focus();};}}if(v){t.push('');v=0;}if(A)t.push('');}t.push('');if(o.config.toolbarCanCollapse){var K=e.addFunction(function(){o.execCommand('toolbarCollapse');});o.on('destroy',function(){e.removeFunction(K);});var L=e.getNextId();o.addCommand('toolbarCollapse',{readOnly:1,exec:function(M){var N=a.document.getById(L),O=N.getPrevious(),P=M.getThemeSpace('contents'),Q=O.getParent(),R=parseInt(P.$.style.height,10),S=Q.$.offsetHeight,T=!O.isVisible();if(!T){O.hide();N.addClass('cke_toolbox_collapser_min');N.setAttribute('title',M.lang.toolbarExpand);}else{O.show();N.removeClass('cke_toolbox_collapser_min');N.setAttribute('title',M.lang.toolbarCollapse);}N.getFirst().setText(T?'â–²':'â—€');var U=Q.$.offsetHeight-S;P.setStyle('height',R-U+'px');M.fire('resize');},modes:{wysiwyg:1,source:1}});t.push('','','');}r.data.html+=t.join('');}});o.on('destroy',function(){var r,s=0,t,u,v;r=this.toolbox.toolbars;for(;s');return{};}};}});}});})();a.UI_SEPARATOR='separator';i.toolbarLocation='top';i.toolbar_Basic=[['Bold','Italic','-','NumberedList','BulletedList','-','Link','Unlink','-','About']];i.toolbar_Full=[{name:'document',items:['Source','-','Save','NewPage','DocProps','Preview','Print','-','Templates']},{name:'clipboard',items:['Cut','Copy','Paste','PasteText','PasteFromWord','-','Undo','Redo']},{name:'editing',items:['Find','Replace','-','SelectAll','-','SpellChecker','Scayt']},{name:'forms',items:['Form','Checkbox','Radio','TextField','Textarea','Select','Button','ImageButton','HiddenField']},'/',{name:'basicstyles',items:['Bold','Italic','Underline','Strike','Subscript','Superscript','-','RemoveFormat']},{name:'paragraph',items:['NumberedList','BulletedList','-','Outdent','Indent','-','Blockquote','CreateDiv','-','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','-','BidiLtr','BidiRtl']},{name:'links',items:['Link','Unlink','Anchor']},{name:'insert',items:['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak','Iframe']},'/',{name:'styles',items:['Styles','Format','Font','FontSize']},{name:'colors',items:['TextColor','BGColor']},{name:'tools',items:['Maximize','ShowBlocks','-','About']}];i.toolbar='Full';i.toolbarCanCollapse=true;(function(){j.add('undo',{requires:['selection','wysiwygarea'],init:function(s){var t=new o(s),u=s.addCommand('undo',{exec:function(){if(t.undo()){s.selectionChange();this.fire('afterUndo');}},state:0,canUndo:false}),v=s.addCommand('redo',{exec:function(){if(t.redo()){s.selectionChange();this.fire('afterRedo');}},state:0,canUndo:false});t.onChange=function(){u.setState(t.undoable()?2:0);v.setState(t.redoable()?2:0);};function w(x){if(t.enabled&&x.data.command.canUndo!==false)t.save();};s.on('beforeCommandExec',w);s.on('afterCommandExec',w);s.on('saveSnapshot',function(){t.save();});s.on('contentDom',function(){s.document.on('keydown',function(x){if(!x.data.$.ctrlKey&&!x.data.$.metaKey)t.type(x);});});s.on('beforeModeUnload',function(){s.mode=='wysiwyg'&&t.save(true);});s.on('mode',function(){t.enabled=s.readOnly?false:s.mode=='wysiwyg';t.onChange();});s.ui.addButton('Undo',{label:s.lang.undo,command:'undo'});s.ui.addButton('Redo',{label:s.lang.redo,command:'redo'});s.resetUndo=function(){t.reset(); -s.fire('saveSnapshot');};s.on('updateSnapshot',function(){if(t.currentImage&&new m(s).equals(t.currentImage))setTimeout(function(){t.update();},0);});}});j.undo={};var m=j.undo.Image=function(s){this.editor=s;s.fire('beforeUndoImage');var t=s.getSnapshot(),u=t&&s.getSelection();c&&t&&(t=t.replace(/\s+data-cke-expando=".*?"/g,''));this.contents=t;this.bookmarks=u&&u.createBookmarks2(true);s.fire('afterUndoImage');},n=/\b(?:href|src|name)="[^"]*?"/gi;m.prototype={equals:function(s,t){var u=this.contents,v=s.contents;if(c&&(b.ie7Compat||b.ie6Compat)){u=u.replace(n,'');v=v.replace(n,'');}if(u!=v)return false;if(t)return true;var w=this.bookmarks,x=s.bookmarks;if(w||x){if(!w||!x||w.length!=x.length)return false;for(var y=0;y25){this.save(false,null,false);this.modifiersCount=1;}}else if(!y){this.modifiersCount=0;this.typesCount++;if(this.typesCount>25){this.save(false,null,false);this.typesCount=1;}}},reset:function(){var s=this;s.lastKeystroke=0;s.snapshots=[];s.index=-1;s.limit=s.editor.config.undoStackSize||20;s.currentImage=null;s.hasUndo=false;s.hasRedo=false;s.resetType();},resetType:function(){var s=this;s.typing=false;delete s.lastKeystroke;s.typesCount=0;s.modifiersCount=0;},fireChange:function(){var s=this;s.hasUndo=!!s.getNextImage(true);s.hasRedo=!!s.getNextImage(false);s.resetType();s.onChange();},save:function(s,t,u){var w=this;var v=w.snapshots;if(!t)t=new m(w.editor);if(t.contents===false)return false;if(w.currentImage&&t.equals(w.currentImage,s))return false;v.splice(w.index+1,v.length-w.index-1);if(v.length==w.limit)v.shift(); -w.index=v.push(t)-1;w.currentImage=t;if(u!==false)w.fireChange();return true;},restoreImage:function(s){var u=this;u.editor.loadSnapshot(s.contents);if(s.bookmarks)u.editor.getSelection().selectBookmarks(s.bookmarks);else if(c){var t=u.editor.document.getBody().$.createTextRange();t.collapse(true);t.select();}u.index=s.index;u.update();u.fireChange();},getNextImage:function(s){var x=this;var t=x.snapshots,u=x.currentImage,v,w;if(u)if(s)for(w=x.index-1;w>=0;w--){v=t[w];if(!u.equals(v,true)){v.index=w;return v;}}else for(w=x.index+1;w]*>)\s*<(p|div|address|h\d|center|pre)[^>]*>\s*(?:]*>| |\u00A0| )?\s*(:?<\/\2>)?\s*(?=$|<\/body>)/gi,n=d.walker.whitespaces(true);function o(C){return C.isBlockBoundary()&&f.$empty[C.getName()];};function p(C){return function(D){if(this.mode=='wysiwyg'){this.focus();this.fire('saveSnapshot');C.call(this,D.data);e.setTimeout(function(){this.fire('saveSnapshot');},0,this);}};};function q(C){var I=this;if(I.dataProcessor)C=I.dataProcessor.toHtml(C);var D=I.getSelection(),E=D.getRanges()[0];if(E.checkReadOnly())return;if(c){var F=D.isLocked;if(F)D.unlock();var G=D.getNative();if(G.type=='Control')G.clear();else if(D.getType()==2){E=D.getRanges()[0];var H=E&&E.endContainer;if(H&&H.type==1&&H.getAttribute('contenteditable')=='false'&&E.checkBoundaryOfElement(H,2)){E.setEndAfter(E.endContainer);E.deleteContents();}}try{G.createRange().pasteHTML(C);}catch(J){}if(F)I.getSelection().lock();}else I.document.$.execCommand('inserthtml',false,C);if(b.webkit){D=I.getSelection();D.scrollIntoView();}};function r(C){var D=this.getSelection(),E=D.getStartElement().hasAscendant('pre',true)?2:this.config.enterMode,F=E==2,G=e.htmlEncode(C.replace(/\r\n|\r/g,'\n'));G=G.replace(/^[ \t]+|[ \t]+$/g,function(M,N,O){if(M.length==1)return ' ';else if(!N)return e.repeat(' ',M.length-1)+' ';else return ' '+e.repeat(' ',M.length-1); -});G=G.replace(/[ \t]{2,}/g,function(M){return e.repeat(' ',M.length-1)+' ';});var H=E==1?'p':'div';if(!F)G=G.replace(/(\n{2})([\s\S]*?)(?:$|\1)/g,function(M,N,O){return '<'+H+'>'+O+'';});G=G.replace(/\n/g,'
            ');if(!(F||c))G=G.replace(new RegExp('
            (?=)'),function(M){return e.repeat(M,2);});if(b.gecko||b.webkit){var I=new d.elementPath(D.getStartElement()),J=[];for(var K=0;K/));else if(L in f.$block)break;}G=J.join('')+G;}q.call(this,G);};function s(C){var D=this.getSelection(),E=D.getRanges(),F=C.getName(),G=f.$block[F],H=D.isLocked;if(H)D.unlock();var I,J,K,L;for(var M=E.length-1;M>=0;M--){I=E[M];if(!I.checkReadOnly()){I.deleteContents(1);J=!M&&C||C.clone(1);var N,O;if(G)while((N=I.getCommonAncestor(0,1))&&(O=f[N.getName()])&&!(O&&O[F])){if(N.getName() in f.span)I.splitElement(N);else if(I.checkStartOfBlock()&&I.checkEndOfBlock()){I.setStartBefore(N);I.collapse(true);N.remove();}else I.splitBlock();}I.insertNode(J);if(!K)K=J;}}if(K){I.moveToPosition(K,4);if(G){var P=K.getNext(n),Q=P&&P.type==1&&P.getName();if(Q&&f.$block[Q]&&f[Q]['#'])I.moveToElementEditStart(P);}}D.selectRanges([I]);if(H)this.getSelection().lock();};function t(C){if(!C.checkDirty())setTimeout(function(){C.resetDirty();},0);};var u=d.walker.whitespaces(true),v=d.walker.bookmark(false,true);function w(C){return u(C)&&v(C);};function x(C){return C.type==3&&e.trim(C.getText()).match(/^(?: |\xa0)$/);};function y(C){if(C.isLocked){C.unlock();setTimeout(function(){C.lock();},0);}};function z(C){return C.getOuterHtml().match(m);};u=d.walker.whitespaces(true);function A(C){var D=C.window,E=C.document,F=C.document.getBody(),G=F.getFirst(),H=F.getChildren().count();if(!H||H==1&&G.type==1&&G.hasAttribute('_moz_editor_bogus_node')){t(C);var I=C.element.getDocument(),J=I.getDocumentElement(),K=J.$.scrollTop,L=J.$.scrollLeft,M=E.$.createEvent('KeyEvents');M.initKeyEvent('keypress',true,true,D.$,false,false,false,false,0,32);E.$.dispatchEvent(M);if(K!=J.$.scrollTop||L!=J.$.scrollLeft)I.getWindow().$.scrollTo(L,K);H&&F.getFirst().remove();E.getBody().appendBogus();var N=new d.range(E);N.setStartAt(F,1);N.select();}};function B(C){var D=C.editor,E=C.data.path,F=E.blockLimit,G=C.data.selection,H=G.getRanges()[0],I=D.document.getBody(),J=D.config.enterMode;if(b.gecko){A(D);var K=E.block||E.blockLimit,L=K&&K.getLast(w);if(K&&K.isBlockBoundary()&&!(L&&L.type==1&&L.isBlockBoundary())&&!K.is('pre')&&!K.getBogus()){D.fire('updateSnapshot'); -t(D);K.appendBogus();}}if(D.config.autoParagraph!==false&&J!=2&&H.collapsed&&F.getName()=='body'&&!E.block){D.fire('updateSnapshot');t(D);c&&y(G);var M=H.fixBlock(true,D.config.enterMode==3?'div':'p');if(c){var N=M.getFirst(w);N&&x(N)&&N.remove();}if(z(M)){var O=M.getNext(u);if(O&&O.type==1&&!o(O)){H.moveToElementEditStart(O);M.remove();}else{O=M.getPrevious(u);if(O&&O.type==1&&!o(O)){H.moveToElementEditEnd(O);M.remove();}}}H.select();C.cancel();}var P=new d.range(D.document);P.moveToElementEditEnd(D.document.getBody());var Q=new d.elementPath(P.startContainer);if(!Q.blockLimit.is('body')){D.fire('updateSnapshot');t(D);c&&y(G);var R;if(J!=2)R=I.append(D.document.createElement(J==1?'p':'div'));else R=I;if(!c)R.appendBogus();}};j.add('wysiwygarea',{requires:['editingblock'],init:function(C){var D=C.config.enterMode!=2&&C.config.autoParagraph!==false?C.config.enterMode==3?'div':'p':false,E=C.lang.editorTitle.replace('%1',C.name),F;C.on('editingBlockReady',function(){var L,M,N,O,P,Q,R=b.isCustomDomain(),S=function(V){if(M)M.remove();var W='document.open();'+(R?'document.domain="'+document.domain+'";':'')+'document.close();';W=b.air?'javascript:void(0)':c?'javascript:void(function(){'+encodeURIComponent(W)+'}())':'';M=h.createFromHtml('');if(document.location.protocol=='chrome:')a.event.useCapture=true;M.on('load',function(aa){P=1;aa.removeListener();var ab=M.getFrameDocument();ab.write(V);b.air&&U(ab.getWindow().$);});if(document.location.protocol=='chrome:')a.event.useCapture=false;var X=C.element,Y=b.gecko&&!X.isVisible(),Z={};if(Y){X.show();Z={position:X.getStyle('position'),top:X.getStyle('top')};X.setStyles({position:'absolute',top:'-3000px'});}L.append(M);if(Y)setTimeout(function(){X.hide();X.setStyles(Z);},1000);};F=e.addFunction(U);var T='';function U(V){if(!P)return;P=0;C.fire('ariaWidget',M);var W=V.document,X=W.body,Y=W.getElementById('cke_actscrpt');Y&&Y.parentNode.removeChild(Y);X.spellcheck=!C.config.disableNativeSpellChecker;var Z=!C.readOnly;if(c){X.hideFocus=true;X.disabled=true;X.contentEditable=Z;X.removeAttribute('disabled');}else setTimeout(function(){if(b.gecko&&b.version>=10900||b.opera)W.$.body.contentEditable=Z; -else if(b.webkit)W.$.body.parentNode.contentEditable=Z;else W.$.designMode=Z?'off':'on';},0);Z&&b.gecko&&e.setTimeout(A,0,null,C);V=C.window=new d.window(V);W=C.document=new g(W);Z&&W.on('dblclick',function(af){var ag=af.data.getTarget(),ah={element:ag,dialog:''};C.fire('doubleclick',ah);ah.dialog&&C.openDialog(ah.dialog);});c&&W.on('click',function(af){var ag=af.data.getTarget();if(ag.is('input')){var ah=ag.getAttribute('type');if(ah=='submit'||ah=='reset')af.data.preventDefault();}});if(!(c||b.opera))W.on('mousedown',function(af){var ag=af.data.getTarget();if(ag.is('img','hr','input','textarea','select'))C.getSelection().selectElement(ag);});if(b.gecko)W.on('mouseup',function(af){if(af.data.$.button==2){var ag=af.data.getTarget();if(!ag.getOuterHtml().replace(m,'')){var ah=new d.range(W);ah.moveToElementEditStart(ag);ah.select(true);}}});W.on('click',function(af){af=af.data;if(af.getTarget().is('a')&&af.$.button!=2)af.preventDefault();});if(b.webkit){W.on('mousedown',function(){ac=1;});W.on('click',function(af){if(af.data.getTarget().is('input','select'))af.data.preventDefault();});W.on('mouseup',function(af){if(af.data.getTarget().is('input','textarea'))af.data.preventDefault();});}if(Z&&c&&W.$.compatMode=='CSS1Compat'||b.gecko||b.opera){var aa=W.getDocumentElement();aa.on('mousedown',function(af){if(af.data.getTarget().equals(aa)){if(b.gecko&&b.version>=10900)J();K.focus();}});}var ab=c?M:V;ab.on('blur',function(){C.focusManager.blur();});var ac;ab.on('focus',function(){var af=C.document;if(Z&&b.gecko&&b.version>=10900)J();else if(b.opera)af.getBody().focus();else if(b.webkit)if(!ac){C.document.getDocumentElement().focus();ac=1;}C.focusManager.focus();});var ad=C.keystrokeHandler;ad.blockedKeystrokes[8]=!Z;ad.attach(W);if(c){W.getDocumentElement().addClass(W.$.compatMode);Z&&W.on('keydown',function(af){var ag=af.data.getKeystroke();if(ag in {8:1,46:1}){var ah=C.getSelection(),ai=ah.getSelectedElement();if(ai){C.fire('saveSnapshot');var aj=ah.getRanges()[0].createBookmark();ai.remove();ah.selectBookmarks([aj]);C.fire('saveSnapshot');af.data.preventDefault();}}});if(W.$.compatMode=='CSS1Compat'){var ae={33:1,34:1};W.on('keydown',function(af){if(af.data.getKeystroke() in ae)setTimeout(function(){C.getSelection().scrollIntoView();},0);});}C.config.enterMode!=1&&W.on('selectionchange',function(){var af=W.getBody(),ag=C.getSelection().getRanges()[0];if(af.getHtml().match(/^

             <\/p>$/i)&&ag.startContainer.equals(af))setTimeout(function(){ag=C.getSelection().getRanges()[0]; -if(!ag.startContainer.equals('body')){af.getFirst().remove(1);ag.moveToElementEditEnd(af);ag.select(1);}},0);});}if(C.contextMenu)C.contextMenu.addTarget(W,C.config.browserContextMenuOnCtrl!==false);setTimeout(function(){C.fire('contentDom');if(Q){C.mode='wysiwyg';C.fire('mode');Q=false;}N=false;if(O){C.focus();O=false;}setTimeout(function(){C.fire('dataReady');},0);try{C.document.$.execCommand('enableInlineTableEditing',false,!C.config.disableNativeTableHandles);}catch(af){}if(C.config.disableObjectResizing)try{C.document.$.execCommand('enableObjectResizing',false,false);}catch(ag){C.document.getBody().on(c?'resizestart':'resize',function(ah){ah.data.preventDefault();});}if(c)setTimeout(function(){if(C.document){var ah=C.document.$.body;ah.runtimeStyle.marginBottom='0px';ah.runtimeStyle.marginBottom='';}},1000);},0);};C.addMode('wysiwyg',{load:function(V,W,X){L=V;if(c&&b.quirks)V.setStyle('position','relative');C.mayBeDirty=true;Q=true;if(X)this.loadSnapshotData(W);else this.loadData(W);},loadData:function(V){N=true;C._.dataStore={id:1};var W=C.config,X=W.fullPage,Y=W.docType,Z='';!X&&(Z=e.buildStyleHtml(C.config.contentsCss)+Z);var aa=W.baseHref?'':'';if(X)V=V.replace(/]*>/i,function(ab){C.docType=Y=ab;return '';}).replace(/<\?xml\s[^\?]*\?>/i,function(ab){C.xmlDeclaration=ab;return '';});if(C.dataProcessor)V=C.dataProcessor.toHtml(V,D);if(X){if(!/]/.test(V))V=''+V;if(!/]/.test(V))V=''+V+'';if(!/]/.test(V))V=V.replace(/]*>/,'$&');else if(!/]/.test(V))V=V.replace(/]*>/,'$&');aa&&(V=V.replace(//,'$&'+aa));V=V.replace(/<\/head\s*>/,Z+'$&');V=Y+V;}else V=W.docType+''+''+''+E+''+aa+Z+''+''+V+'';if(b.gecko)V=V.replace(/
            (?=\s*<\/(:?html|body)>)/,'$&
            ');V+=T;this.onDispose();S(V);},getData:function(){var V=C.config,W=V.fullPage,X=W&&C.docType,Y=W&&C.xmlDeclaration,Z=M.getFrameDocument(),aa=W?Z.getDocumentElement().getOuterHtml():Z.getBody().getHtml();if(b.gecko)aa=aa.replace(/
            (?=\s*(:?$|<\/body>))/,'');if(C.dataProcessor)aa=C.dataProcessor.toDataFormat(aa,D);if(V.ignoreEmptyParagraph)aa=aa.replace(m,function(ab,ac){return ac; -});if(Y)aa=Y+'\n'+aa;if(X)aa=X+'\n'+aa;return aa;},getSnapshotData:function(){return M.getFrameDocument().getBody().getHtml();},loadSnapshotData:function(V){M.getFrameDocument().getBody().setHtml(V);},onDispose:function(){if(!C.document)return;C.document.getDocumentElement().clearCustomData();C.document.getBody().clearCustomData();C.window.clearCustomData();C.document.clearCustomData();M.clearCustomData();M.remove();},unload:function(V){this.onDispose();C.window=C.document=M=L=O=null;C.fire('contentDomUnload');},focus:function(){var V=C.window;if(N)O=true;else if(b.opera&&C.document){var W=C.window.$.frameElement;W.blur(),W.focus();C.document.getBody().focus();C.selectionChange();}else if(!b.opera&&V){b.air?setTimeout(function(){V.focus();},0):V.focus();C.selectionChange();}}});C.on('insertHtml',p(q),null,null,20);C.on('insertElement',p(s),null,null,20);C.on('insertText',p(r),null,null,20);C.on('selectionChange',B,null,null,1);});var G;C.on('contentDom',function(){var L=C.document.getElementsByTag('title').getItem(0);L.data('cke-title',C.document.$.title);C.document.$.title=E;});C.on('readOnly',function(){if(C.mode=='wysiwyg'){var L=C.getMode();L.loadData(L.getData());}});if(a.document.$.documentMode>=8){C.addCss('html.CSS1Compat [contenteditable=false]{ min-height:0 !important;}');var H=[];for(var I in f.$removeEmpty)H.push('html.CSS1Compat '+I+'[contenteditable=false]');C.addCss(H.join(',')+'{ display:inline-block;}');}else if(b.gecko){C.addCss('html { height: 100% !important; }');C.addCss('img:-moz-broken { -moz-force-broken-image-icon : 1;\twidth : 24px; height : 24px; }');}C.addCss('html {\t_overflow-y: scroll; cursor: text;\t*cursor:auto;}');C.addCss('img, input, textarea { cursor: default;}');function J(L){if(C.readOnly)return;e.tryThese(function(){C.document.$.designMode='on';setTimeout(function(){C.document.$.designMode='off';if(a.currentInstance==C)C.document.getBody().focus();},50);},function(){C.document.$.designMode='off';var M=C.document.getBody();M.setAttribute('contentEditable',false);M.setAttribute('contentEditable',true);!L&&J(1);});};if(b.gecko||c||b.opera){var K;C.on('uiReady',function(){K=C.container.append(h.createFromHtml(''));K.on('focus',function(){C.focus();});C.focusGrabber=K;});C.on('destroy',function(){e.removeFunction(F);K.clearCustomData();delete C.focusGrabber;});}C.on('insertElement',function(L){var M=L.data;if(M.type==1&&(M.is('input')||M.is('textarea'))){if(!M.isReadOnly())M.data('cke-editable',M.hasAttribute('contenteditable')?'true':'1'); -M.setAttribute('contentEditable',false);}});}});if(b.gecko)(function(){var C=document.body;if(!C)window.addEventListener('load',arguments.callee,false);else{var D=C.getAttribute('onpageshow');C.setAttribute('onpageshow',(D?D+';':'')+'event.persisted && (function(){'+'var allInstances = CKEDITOR.instances, editor, doc;'+'for ( var i in allInstances )'+'{'+'\teditor = allInstances[ i ];'+'\tdoc = editor.document;'+'\tif ( doc )'+'\t{'+'\t\tdoc.$.designMode = "off";'+'\t\tdoc.$.designMode = "on";'+'\t}'+'}'+'})();');}})();})();i.disableObjectResizing=false;i.disableNativeTableHandles=true;i.disableNativeSpellChecker=true;i.ignoreEmptyParagraph=true;j.add('wsc',{requires:['dialog'],init:function(m){var n='checkspell',o=m.addCommand(n,new a.dialogCommand(n));o.modes={wysiwyg:!b.opera&&!b.air&&document.domain==window.location.hostname};m.ui.addButton('SpellChecker',{label:m.lang.spellCheck.toolbar,command:n});a.dialog.add(n,this.path+'dialogs/wsc.js');}});i.wsc_customerId=i.wsc_customerId||'1:ua3xw1-2XyGJ3-GWruD3-6OFNT1-oXcuB1-nR6Bp4-hgQHc-EcYng3-sdRXG3-NOfFk';i.wsc_customLoaderScript=i.wsc_customLoaderScript||null;a.DIALOG_RESIZE_NONE=0;a.DIALOG_RESIZE_WIDTH=1;a.DIALOG_RESIZE_HEIGHT=2;a.DIALOG_RESIZE_BOTH=3;(function(){var m=e.cssLength;function n(Q){return!!this._.tabs[Q][0].$.offsetHeight;};function o(){var U=this;var Q=U._.currentTabId,R=U._.tabIdList.length,S=e.indexOf(U._.tabIdList,Q)+R;for(var T=S-1;T>S-R;T--){if(n.call(U,U._.tabIdList[T%R]))return U._.tabIdList[T%R];}return null;};function p(){var U=this;var Q=U._.currentTabId,R=U._.tabIdList.length,S=e.indexOf(U._.tabIdList,Q);for(var T=S+1;T1){ad._.tabBarMode=true;ad._.tabs[ad._.currentTabId][0].focus();ah=1;}else if((aq==37||aq==39)&&ad._.tabBarMode){at=aq==(ar?39:37)?o.call(ad):p.call(ad);ad.selectPage(at);ad._.tabs[at][0].focus();ah=1;}else if((aq==13||aq==32)&&ad._.tabBarMode){au.selectPage(au._.currentTabId);au._.tabBarMode=false;au._.currentFocusIndex=-1;ag(true);ah=1;}if(ah){ap.stop();ap.data.preventDefault();}};function aj(ap){ah&&ap.data.preventDefault();};var ak=this._.element;this.on('show',function(){ak.on('keydown',ai,this,null,0);if(b.opera||b.gecko&&b.mac)ak.on('keypress',aj,this);});this.on('hide',function(){ak.removeListener('keydown',ai);if(b.opera||b.gecko&&b.mac)ak.removeListener('keypress',aj);});this.on('iframeAdded',function(ap){var aq=new g(ap.data.iframe.$.contentWindow.document);aq.on('keydown',ai,this,null,0);});this.on('show',function(){var at=this;af();if(Q.config.dialog_startupFocusTab&&ad._.pageCount>1){ad._.tabBarMode=true;ad._.tabs[ad._.currentTabId][0].focus();}else if(!at._.hasFocus){at._.currentFocusIndex=-1;if(S.onFocus){var ap=S.onFocus.call(at);ap&&ap.focus();}else ag(true);if(at._.editor.mode=='wysiwyg'&&c){var aq=Q.document.$.selection,ar=aq.createRange();if(ar)if(ar.parentElement&&ar.parentElement().ownerDocument==Q.document.$||ar.item&&ar.item(0).ownerDocument==Q.document.$){var as=document.body.createTextRange();as.moveToElementText(at.getElement().getFirst().$);as.collapse(true);as.select();}}}},this,null,4294967295);if(b.ie6Compat)this.on('load',function(ap){var aq=this.getElement(),ar=aq.getFirst();ar.remove();ar.appendTo(aq);},this);y(this);z(this);new d.text(S.title,a.document).appendTo(this.parts.title);for(var al=0;al0?S:0)+'px'};Z[V?'right':'left']=(R>0?R:0)+'px';U.setStyles(Z);T&&(aa._.moved=1);};})(),getPosition:function(){return e.extend({},this._.position);},show:function(){var Q=this._.element,R=this.definition;if(!(Q.getParent()&&Q.getParent().equals(a.document.getBody())))Q.appendTo(a.document.getBody());else Q.setStyle('display','block');if(b.gecko&&b.version<10900){var S=this.parts.dialog;S.setStyle('position','absolute');setTimeout(function(){S.setStyle('position','fixed');},0);}this.resize(this._.contentSize&&this._.contentSize.width||R.width||R.minWidth,this._.contentSize&&this._.contentSize.height||R.height||R.minHeight);this.reset();this.selectPage(this.definition.contents[0].id);if(a.dialog._.currentZIndex===null)a.dialog._.currentZIndex=this._.editor.config.baseFloatZIndex;this._.element.getFirst().setStyle('z-index',a.dialog._.currentZIndex+=10);if(a.dialog._.currentTop===null){a.dialog._.currentTop=this;this._.parentDialog=null;E(this._.editor);Q.on('keydown',I);Q.on(b.opera?'keypress':'keyup',J);for(var T in {keyup:1,keydown:1,keypress:1})Q.on(T,P);}else{this._.parentDialog=a.dialog._.currentTop; -var U=this._.parentDialog.getElement().getFirst();U.$.style.zIndex-=Math.floor(this._.editor.config.baseFloatZIndex/2);a.dialog._.currentTop=this;}K(this,this,'\x1b',null,function(){this.getButton('cancel')&&this.getButton('cancel').click();});this._.hasFocus=false;e.setTimeout(function(){this.layout();this.parts.dialog.setStyle('visibility','');this.fireOnce('load',{});k.fire('ready',this);this.fire('show',{});this._.editor.fire('dialogShow',this);this.foreach(function(V){V.setInitValue&&V.setInitValue();});},100,this);},layout:function(){var S=this;var Q=a.document.getWindow().getViewPaneSize(),R=S.getSize();S.move(S._.moved?S._.position.x:(Q.width-R.width)/2,S._.moved?S._.position.y:(Q.height-R.height)/2);},foreach:function(Q){var T=this;for(var R in T._.contents)for(var S in T._.contents[R])Q(T._.contents[R][S]);return T;},reset:(function(){var Q=function(R){if(R.reset)R.reset(1);};return function(){this.foreach(Q);return this;};})(),setupContent:function(){var Q=arguments;this.foreach(function(R){if(R.setup)R.setup.apply(R,Q);});},commitContent:function(){var Q=arguments;this.foreach(function(R){if(R.commit)R.commit.apply(R,Q);});},hide:function(){if(!this.parts.dialog.isVisible())return;this.fire('hide',{});this._.editor.fire('dialogHide',this);var Q=this._.element;Q.setStyle('display','none');this.parts.dialog.setStyle('visibility','hidden');L(this);while(a.dialog._.currentTop!=this)a.dialog._.currentTop.hide();if(!this._.parentDialog)F();else{var R=this._.parentDialog.getElement().getFirst();R.setStyle('z-index',parseInt(R.$.style.zIndex,10)+Math.floor(this._.editor.config.baseFloatZIndex/2));}a.dialog._.currentTop=this._.parentDialog;if(!this._.parentDialog){a.dialog._.currentZIndex=null;Q.removeListener('keydown',I);Q.removeListener(b.opera?'keypress':'keyup',J);for(var S in {keyup:1,keydown:1,keypress:1})Q.removeListener(S,P);var T=this._.editor;T.focus();if(T.mode=='wysiwyg'&&c){var U=T.getSelection();U&&U.unlock(true);}}else a.dialog._.currentZIndex-=10;delete this._.parentDialog;this.foreach(function(V){V.resetInitValue&&V.resetInitValue();});},addPage:function(Q){var ac=this;var R=[],S=Q.label?' title="'+e.htmlEncode(Q.label)+'"':'',T=Q.elements,U=a.dialog._.uiElementBuilders.vbox.build(ac,{type:'vbox',className:'cke_dialog_page_contents',children:Q.elements,expand:!!Q.expand,padding:Q.padding,style:Q.style||'width: 100%;height:100%'},R),V=h.createFromHtml(R.join(''));V.setAttribute('role','tabpanel');var W=b,X='cke_'+Q.id+'_'+e.getNextNumber(),Y=h.createFromHtml(['0?' cke_last':'cke_first',S,!!Q.hidden?' style="display:none"':'',' id="',X,'"',W.gecko&&W.version>=10900&&!W.hc?'':' href="javascript:void(0)"',' tabIndex="-1"',' hidefocus="true"',' role="tab">',Q.label,''].join('')); -V.setAttribute('aria-labelledby',X);ac._.tabs[Q.id]=[Y,V];ac._.tabIdList.push(Q.id);!Q.hidden&&ac._.pageCount++;ac._.lastTab=Y;ac.updateStyle();var Z=ac._.contents[Q.id]={},aa,ab=U.getChild();while(aa=ab.shift()){Z[aa.id]=aa;if(typeof aa.getChild=='function')ab.push.apply(ab,aa.getChild());}V.setAttribute('name',Q.id);V.appendTo(ac.parts.contents);Y.unselectable();ac.parts.tabs.append(Y);if(Q.accessKey){K(ac,ac,'CTRL+'+Q.accessKey,N,M);ac._.accessKeyMap['CTRL+'+Q.accessKey]=Q.id;}},selectPage:function(Q){if(this._.currentTabId==Q)return;if(this.fire('selectPage',{page:Q,currentPage:this._.currentTabId})===true)return;for(var R in this._.tabs){var S=this._.tabs[R][0],T=this._.tabs[R][1];if(R!=Q){S.removeClass('cke_dialog_tab_selected');T.hide();}T.setAttribute('aria-hidden',R!=Q);}var U=this._.tabs[Q];U[0].addClass('cke_dialog_tab_selected');if(b.ie6Compat||b.ie7Compat){q(U[1]);U[1].show();setTimeout(function(){q(U[1],1);},0);}else U[1].show();this._.currentTabId=Q;this._.currentTabIndex=e.indexOf(this._.tabIdList,Q);},updateStyle:function(){this.parts.dialog[(this._.pageCount===1?'add':'remove')+'Class']('cke_single_page');},hidePage:function(Q){var S=this;var R=S._.tabs[Q]&&S._.tabs[Q][0];if(!R||S._.pageCount==1||!R.isVisible())return;else if(Q==S._.currentTabId)S.selectPage(o.call(S));R.hide();S._.pageCount--;S.updateStyle();},showPage:function(Q){var S=this;var R=S._.tabs[Q]&&S._.tabs[Q][0];if(!R)return;R.show();S._.pageCount++;S.updateStyle();},getElement:function(){return this._.element;},getName:function(){return this._.name;},getContentElement:function(Q,R){var S=this._.contents[Q];return S&&S[R];},getValueOf:function(Q,R){return this.getContentElement(Q,R).getValue();},setValueOf:function(Q,R,S){return this.getContentElement(Q,R).setValue(S);},getButton:function(Q){return this._.buttons[Q];},click:function(Q){return this._.buttons[Q].click();},disableButton:function(Q){return this._.buttons[Q].disable();},enableButton:function(Q){return this._.buttons[Q].enable();},getPageCount:function(){return this._.pageCount;},getParentEditor:function(){return this._.editor;},getSelectedElement:function(){return this.getParentEditor().getSelection().getSelectedElement();},addFocusable:function(Q,R){var T=this;if(typeof R=='undefined'){R=T._.focusList.length;T._.focusList.push(new r(T,Q,R));}else{T._.focusList.splice(R,0,new r(T,Q,R));for(var S=R+1;Sab.width-aa.width-V)ag=ab.width-aa.width+(U.lang.dir=='rtl'?0:W[1]);else ag=S.x;if(S.y+W[0]ab.height-aa.height-V)ah=ab.height-aa.height+W[2];else ah=S.y;Q.move(ag,ah,1);Z.data.preventDefault();};function Y(Z){a.document.removeListener('mousemove',X);a.document.removeListener('mouseup',Y);if(b.ie6Compat){var aa=C.getChild(0).getFrameDocument();aa.removeListener('mousemove',X);aa.removeListener('mouseup',Y);}};Q.parts.title.on('mousedown',function(Z){R={x:Z.data.$.screenX,y:Z.data.$.screenY};a.document.on('mousemove',X);a.document.on('mouseup',Y);S=Q.getPosition();if(b.ie6Compat){var aa=C.getChild(0).getFrameDocument();aa.on('mousemove',X);aa.on('mouseup',Y);}Z.data.preventDefault();},Q);};function z(Q){var R=Q.definition,S=R.resizable;if(S==0)return;var T=Q.getParentEditor(),U,V,W,X,Y,Z,aa=e.addFunction(function(ad){Y=Q.getSize();var ae=Q.parts.contents,af=ae.$.getElementsByTagName('iframe').length;if(af){Z=h.createFromHtml('

            ');ae.append(Z);}V=Y.height-Q.parts.contents.getSize('height',!(b.gecko||b.opera||c&&b.quirks));U=Y.width-Q.parts.contents.getSize('width',1);X={x:ad.screenX,y:ad.screenY};W=a.document.getWindow().getViewPaneSize();a.document.on('mousemove',ab);a.document.on('mouseup',ac);if(b.ie6Compat){var ag=C.getChild(0).getFrameDocument();ag.on('mousemove',ab);ag.on('mouseup',ac);}ad.preventDefault&&ad.preventDefault();});Q.on('load',function(){var ad='';if(S==1)ad=' cke_resizer_horizontal';else if(S==2)ad=' cke_resizer_vertical';var ae=h.createFromHtml('
            ');Q.parts.footer.append(ae,1);});T.on('destroy',function(){e.removeFunction(aa);});function ab(ad){var ae=T.lang.dir=='rtl',af=(ad.data.$.screenX-X.x)*(ae?-1:1),ag=ad.data.$.screenY-X.y,ah=Y.width,ai=Y.height,aj=ah+af*(Q._.moved?1:2),ak=ai+ag*(Q._.moved?1:2),al=Q._.element.getFirst(),am=ae&&al.getComputedStyle('right'),an=Q.getPosition();if(an.y+ak>W.height)ak=W.height-an.y;if((ae?am:an.x)+aj>W.width)aj=W.width-(ae?am:an.x);if(S==1||S==3)ah=Math.max(R.minWidth||0,aj-U);if(S==2||S==3)ai=Math.max(R.minHeight||0,ak-V);Q.resize(ah,ai);if(!Q._.moved)Q.layout();ad.data.preventDefault();};function ac(){a.document.removeListener('mouseup',ac);a.document.removeListener('mousemove',ab); -if(Z){Z.remove();Z=null;}if(b.ie6Compat){var ad=C.getChild(0).getFrameDocument();ad.removeListener('mouseup',ac);ad.removeListener('mousemove',ab);}};};var A,B={},C;function D(Q){Q.data.preventDefault(1);};function E(Q){var R=a.document.getWindow(),S=Q.config,T=S.dialog_backgroundCoverColor||'white',U=S.dialog_backgroundCoverOpacity,V=S.baseFloatZIndex,W=e.genKey(T,U,V),X=B[W];if(!X){var Y=['
            '];if(b.ie6Compat){var Z=b.isCustomDomain(),aa="";Y.push('');}Y.push('
            ');X=h.createFromHtml(Y.join(''));X.setOpacity(U!=undefined?U:0.5);X.on('keydown',D);X.on('keypress',D);X.on('keyup',D);X.appendTo(a.document.getBody());B[W]=X;}else X.show();C=X;var ab=function(){var ae=R.getViewPaneSize();X.setStyles({width:ae.width+'px',height:ae.height+'px'});},ac=function(){var ae=R.getScrollPosition(),af=a.dialog._.currentTop;X.setStyles({left:ae.x+'px',top:ae.y+'px'});if(af)do{var ag=af.getPosition();af.move(ag.x,ag.y);}while(af=af._.parentDialog)};A=ab;R.on('resize',ab);ab();if(!(b.mac&&b.webkit))X.focus();if(b.ie6Compat){var ad=function(){ac();arguments.callee.prevScrollHandler.apply(this,arguments);};R.$.setTimeout(function(){ad.prevScrollHandler=window.onscroll||(function(){});window.onscroll=ad;},0);ac();}};function F(){if(!C)return;var Q=a.document.getWindow();C.hide();Q.removeListener('resize',A);if(b.ie6Compat)Q.$.setTimeout(function(){var R=window.onscroll&&window.onscroll.prevScrollHandler;window.onscroll=R||null;},0);A=null;};function G(){for(var Q in B)B[Q].remove();B={};};var H={},I=function(Q){var R=Q.data.$.ctrlKey||Q.data.$.metaKey,S=Q.data.$.altKey,T=Q.data.$.shiftKey,U=String.fromCharCode(Q.data.$.keyCode),V=H[(R?'CTRL+':'')+(S?'ALT+':'')+(T?'SHIFT+':'')+U];if(!V||!V.length)return;V=V[V.length-1];V.keydown&&V.keydown.call(V.uiElement,V.dialog,V.key);Q.data.preventDefault();},J=function(Q){var R=Q.data.$.ctrlKey||Q.data.$.metaKey,S=Q.data.$.altKey,T=Q.data.$.shiftKey,U=String.fromCharCode(Q.data.$.keyCode),V=H[(R?'CTRL+':'')+(S?'ALT+':'')+(T?'SHIFT+':'')+U]; -if(!V||!V.length)return;V=V[V.length-1];if(V.keyup){V.keyup.call(V.uiElement,V.dialog,V.key);Q.data.preventDefault();}},K=function(Q,R,S,T,U){var V=H[S]||(H[S]=[]);V.push({uiElement:Q,dialog:R,key:S,keyup:U||Q.accessKeyUp,keydown:T||Q.accessKeyDown});},L=function(Q){for(var R in H){var S=H[R];for(var T=S.length-1;T>=0;T--){if(S[T].dialog==Q||S[T].uiElement==Q)S.splice(T,1);}if(S.length===0)delete H[R];}},M=function(Q,R){if(Q._.accessKeyMap[R])Q.selectPage(Q._.accessKeyMap[R]);},N=function(Q,R){},O={27:1,13:1},P=function(Q){if(Q.data.getKeystroke() in O)Q.data.stopPropagation();};(function(){k.dialog={uiElement:function(Q,R,S,T,U,V,W){if(arguments.length<4)return;var X=(T.call?T(R):T)||'div',Y=['<',X,' '],Z=(U&&U.call?U(R):U)||{},aa=(V&&V.call?V(R):V)||{},ab=(W&&W.call?W.call(this,Q,R):W)||'',ac=this.domId=aa.id||e.getNextId()+'_uiElement',ad=this.id=R.id,ae;aa.id=ac;var af={};if(R.type)af['cke_dialog_ui_'+R.type]=1;if(R.className)af[R.className]=1;if(R.disabled)af.cke_disabled=1;var ag=aa['class']&&aa['class'].split?aa['class'].split(' '):[];for(ae=0;ae=0;ae--){if(ai[ae]==='')ai.splice(ae,1);}if(ai.length>0)aa.style=(aa.style?aa.style+'; ':'')+ai.join('; ');for(ae in aa)Y.push(ae+'="'+e.htmlEncode(aa[ae])+'" ');Y.push('>',ab,'');S.push(Y.join(''));(this._||(this._={})).dialog=Q;if(typeof R.isChanged=='boolean')this.isChanged=function(){return R.isChanged;};if(typeof R.isChanged=='function')this.isChanged=R.isChanged;a.event.implementOn(this);this.registerEvents(R);if(this.accessKeyUp&&this.accessKeyDown&&R.accessKey)K(this,Q,'CTRL+'+R.accessKey);var aj=this;Q.on('load',function(){if(aj.getInputElement())aj.getInputElement().on('focus',function(){Q._.tabBarMode=false;Q._.hasFocus=true;aj.fire('focus');},aj);});if(this.keyboardFocusable){this.tabIndex=R.tabIndex||0;this.focusIndex=Q._.focusList.push(this)-1;this.on('focus',function(){Q._.currentFocusIndex=aj.focusIndex;});}e.extend(this,R);},hbox:function(Q,R,S,T,U){if(arguments.length<4)return;this._||(this._={});var V=this._.children=R,W=U&&U.widths||null,X=U&&U.height||null,Y={},Z,aa=function(){var ac=[''];for(Z=0;Z0)ac.push('style="'+ae.join('; ')+'" ');ac.push('>',S[Z],'');}ac.push('');return ac.join('');},ab={role:'presentation'};U&&U.align&&(ab.align=U.align);k.dialog.uiElement.call(this,Q,U||{type:'hbox'},T,'table',Y,ab,aa);},vbox:function(Q,R,S,T,U){if(arguments.length<3)return;this._||(this._={});var V=this._.children=R,W=U&&U.width||null,X=U&&U.heights||null,Y=function(){var Z=['');for(var aa=0;aa');}Z.push('
            0)Z.push('style="',ab.join('; '),'" ');Z.push(' class="cke_dialog_ui_vbox_child">',S[aa],'
            ');return Z.join('');};k.dialog.uiElement.call(this,Q,U||{type:'vbox'},T,'div',null,{role:'presentation'},Y);}};})();k.dialog.uiElement.prototype={getElement:function(){return a.document.getById(this.domId);},getInputElement:function(){return this.getElement();},getDialog:function(){return this._.dialog;},setValue:function(Q,R){this.getInputElement().setValue(Q);!R&&this.fire('change',{value:Q});return this;},getValue:function(){return this.getInputElement().getValue();},isChanged:function(){return false;},selectParentTab:function(){var T=this;var Q=T.getInputElement(),R=Q,S;while((R=R.getParent())&&R.$.className.search('cke_dialog_page_contents')==-1){}if(!R)return T;S=R.getAttribute('name');if(T._.dialog._.currentTabId!=S)T._.dialog.selectPage(S);return T;},focus:function(){this.selectParentTab().getInputElement().focus();return this;},registerEvents:function(Q){var R=/^on([A-Z]\w+)/,S,T=function(V,W,X,Y){W.on('load',function(){V.getInputElement().on(X,Y,V);});};for(var U in Q){if(!(S=U.match(R)))continue;if(this.eventProcessors[U])this.eventProcessors[U].call(this,this._.dialog,Q[U]);else T(this,this._.dialog,S[1].toLowerCase(),Q[U]);}return this; -},eventProcessors:{onLoad:function(Q,R){Q.on('load',R,this);},onShow:function(Q,R){Q.on('show',R,this);},onHide:function(Q,R){Q.on('hide',R,this);}},accessKeyDown:function(Q,R){this.focus();},accessKeyUp:function(Q,R){},disable:function(){var Q=this.getElement();Q.setAttribute('disabled','true');Q.addClass('cke_disabled');},enable:function(){var Q=this.getElement();Q.removeAttribute('disabled');Q.removeClass('cke_disabled');},isEnabled:function(){return!this.getInputElement().getAttribute('disabled');},isVisible:function(){return this.getInputElement().isVisible();},isFocusable:function(){if(!this.isEnabled()||!this.isVisible())return false;return true;}};k.dialog.hbox.prototype=e.extend(new k.dialog.uiElement(),{getChild:function(Q){var R=this;if(arguments.length<1)return R._.children.concat();if(!Q.splice)Q=[Q];if(Q.length<2)return R._.children[Q[0]];else return R._.children[Q[0]]&&R._.children[Q[0]].getChild?R._.children[Q[0]].getChild(Q.slice(1,Q.length)):null;}},true);k.dialog.vbox.prototype=new k.dialog.hbox();(function(){var Q={build:function(R,S,T){var U=S.children,V,W=[],X=[];for(var Y=0;Y',T||U.name,'');return V.join('');}};a.style.getStyleText=function(T){var U=T._ST;if(U)return U;U=T.styles;var V=T.attributes&&T.attributes.style||'',W='';if(V.length)V=V.replace(o,';');for(var X in U){var Y=U[X],Z=(X+':'+Y).replace(o,';');if(Y=='inherit')W+=Z;else V+=Z;}if(V.length)V=P(V);V+=W;return T._ST=V;};function s(T){var U,V;while(T=T.getParent()){if(T.getName()=='body')break;if(T.getAttribute('data-nostyle'))U=T;else if(!V){var W=T.getAttribute('contentEditable');if(W=='false')U=T;else if(W=='true')V=1;}}return U;};function t(T){var ax=this;var U=T.document;if(T.collapsed){var V=J(ax,U);T.insertNode(V);T.moveToPosition(V,2);return;}var W=ax.element,X=ax._.definition,Y,Z=X.includeReadonly;if(Z==undefined)Z=U.getCustomData('cke_includeReadonly');var aa=f[W]||(Y=true,f.span);T.enlarge(1,1);T.trim();var ab=T.createBookmark(),ac=ab.startNode,ad=ab.endNode,ae=ac,af,ag=s(ac),ah=s(ad);if(ag)ae=ag.getNextSourceNode(true);if(ah)ad=ah;if(ae.getPosition(ad)==2)ae=0;while(ae){var ai=false;if(ae.equals(ad)){ae=null;ai=true;}else{var aj=ae.type,ak=aj==1?ae.getName():null,al=ak&&ae.getAttribute('contentEditable')=='false',am=ak&&ae.getAttribute('data-nostyle'); -if(ak&&ae.data('cke-bookmark')){ae=ae.getNextSourceNode(true);continue;}if(!ak||aa[ak]&&!am&&(!al||Z)&&(ae.getPosition(ad)|4|0|8)==4+0+8&&(!X.childRule||X.childRule(ae))){var an=ae.getParent();if(an&&((an.getDtd()||f.span)[W]||Y)&&(!X.parentRule||X.parentRule(an))){if(!af&&(!ak||!f.$removeEmpty[ak]||(ae.getPosition(ad)|4|0|8)==4+0+8)){af=new d.range(U);af.setStartBefore(ae);}if(aj==3||al||aj==1&&!ae.getChildCount()){var ao=ae,ap;while((ai=!ao.getNext(q))&&(ap=ao.getParent(),aa[ap.getName()])&&(ap.getPosition(ac)|2|0|8)==2+0+8&&(!X.childRule||X.childRule(ap)))ao=ap;af.setEndAfter(ao);}}else ai=true;}else ai=true;ae=ae.getNextSourceNode(am||al);}if(ai&&af&&!af.collapsed){var aq=J(ax,U),ar=aq.hasAttributes(),as=af.getCommonAncestor(),at={styles:{},attrs:{},blockedStyles:{},blockedAttrs:{}},au,av,aw;while(aq&&as){if(as.getName()==W){for(au in X.attributes){if(at.blockedAttrs[au]||!(aw=as.getAttribute(av)))continue;if(aq.getAttribute(au)==aw)at.attrs[au]=1;else at.blockedAttrs[au]=1;}for(av in X.styles){if(at.blockedStyles[av]||!(aw=as.getStyle(av)))continue;if(aq.getStyle(av)==aw)at.styles[av]=1;else at.blockedStyles[av]=1;}}as=as.getParent();}for(au in at.attrs)aq.removeAttribute(au);for(av in at.styles)aq.removeStyle(av);if(ar&&!aq.hasAttributes())aq=null;if(aq){af.extractContents().appendTo(aq);G(ax,aq);af.insertNode(aq);aq.mergeSiblings();if(!c)aq.$.normalize();}else{aq=new h('span');af.extractContents().appendTo(aq);af.insertNode(aq);G(ax,aq);aq.remove(true);}af=null;}}T.moveToBookmark(ab);T.shrink(2);};function u(T){T.enlarge(1,1);var U=T.createBookmark(),V=U.startNode;if(T.collapsed){var W=new d.elementPath(V.getParent()),X;for(var Y=0,Z;Y'+V+'';else T.setHtml(V);U.remove();};function B(T){var U=/(\S\s*)\n(?:\s|(]+data-cke-bookmark.*?\/span>))*\n(?!$)/gi,V=T.getName(),W=C(T.getOuterHtml(),U,function(Y,Z,aa){return Z+''+aa+'
            ';}),X=[];W.replace(/([\s\S]*?)<\/pre>/gi,function(Y,Z){X.push(Z);});return X;};function C(T,U,V){var W='',X='';T=T.replace(/(^]+data-cke-bookmark.*?\/span>)|(]+data-cke-bookmark.*?\/span>$)/gi,function(Y,Z,aa){Z&&(W=Z);aa&&(X=aa);return '';});return W+T.replace(U,V)+X;};function D(T,U){var V;if(T.length>1)V=new d.documentFragment(U.getDocument());for(var W=0;
            -W');X=X.replace(/[ \t]{2,}/g,function(Z){return e.repeat(' ',Z.length-1)+' ';});if(V){var Y=U.clone();Y.setHtml(X);V.append(Y);}else U.setHtml(X);}return V||U;};function E(T,U){var V=T.getBogus();V&&V.remove();var W=T.getHtml();W=C(W,/(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g,'');W=W.replace(/[ \t\r\n]*(]*>)[ \t\r\n]*/gi,'$1');W=W.replace(/([ \t\n\r]+| )/g,' ');W=W.replace(/]*>/gi,'\n');if(c){var X=T.getDocument().createElement('div');X.append(U);U.$.outerHTML='
            '+W+'
            ';U.copyAttributes(X.getFirst());U=X.getFirst().remove();}else U.setHtml(W);return U;};function F(T,U){var V=T._.definition,W=e.extend({},V.attributes,N(T)[U.getName()]),X=V.styles,Y=e.isEmpty(W)&&e.isEmpty(X);for(var Z in W){if((Z=='class'||T._.definition.fullMatch)&&U.getAttribute(Z)!=O(Z,W[Z]))continue;Y=U.hasAttribute(Z);U.removeAttribute(Z);}for(var aa in X){if(T._.definition.fullMatch&&U.getStyle(aa)!=O(aa,X[aa],true))continue;Y=Y||!!U.getStyle(aa);U.removeStyle(aa);}if(Y)!f.$block[U.getName()]||T._.enterMode==2&&!U.hasAttributes()?I(U):U.renameNode(T._.enterMode==1?'p':'div');};function G(T,U){var V=T._.definition,W=V.attributes,X=V.styles,Y=N(T),Z=U.getElementsByTag(T.element);for(var aa=Z.count();--aa>=0;)F(T,Z.getItem(aa));for(var ab in Y){if(ab!=T.element){Z=U.getElementsByTag(ab);for(aa=Z.count()-1;aa>=0;aa--){var ac=Z.getItem(aa);H(ac,Y[ab]);}}}};function H(T,U){var V=U&&U.attributes;if(V)for(var W=0;W0)H+=(F.$.offsetWidth||0)-(F.$.clientWidth||0);H+=4;F.setStyle('width',H+'px');v.element.addClass('cke_frameLoaded');var I=v.element.$.scrollHeight;if(c&&b.quirks&&I>0)I+=(F.$.offsetHeight||0)-(F.$.clientHeight||0);F.setStyle('height',I+'px');u._.currentBlock.element.setStyle('display','none').removeStyle('display');}else F.removeStyle('height');var J=u.element,K=J.getWindow(),L=K.getScrollPosition(),M=K.getViewPaneSize(),N={height:J.$.offsetHeight,width:J.$.offsetWidth};if(A?B<0:B+N.width>M.width+L.x)B+=N.width*(A?1:-1);if(C+N.height>M.height+L.y)C-=N.height;if(c){var O=new h(w.$.offsetParent),P=O;if(P.getName()=='html')P=P.getDocument().getBody();if(P.getComputedStyle('direction')=='rtl')if(b.ie8Compat)B-=w.getDocument().getDocumentElement().$.scrollLeft*2;else B-=O.$.scrollWidth-O.$.clientWidth; -}var Q=w.getFirst(),R;if(R=Q.getCustomData('activePanel'))R.onHide&&R.onHide.call(this,1);Q.setCustomData('activePanel',this);w.setStyles({top:C+'px',left:B+'px'});w.setOpacity(1);},this);u.isLoaded?E():u.onLoad=E;e.setTimeout(function(){x.$.contentWindow.focus();this.allowBlur(true);},0,this);},b.air?200:0,this);this.visible=1;if(this.onShow)this.onShow.call(this);n=0;},hide:function(){var p=this;if(p.visible&&(!p.onHide||p.onHide.call(p)!==true)){p.hideChild();p.element.setStyle('display','none');p.visible=0;p.element.getFirst().removeCustomData('activePanel');}},allowBlur:function(p){var q=this._.panel;if(p!=undefined)q.allowBlur=p;return q.allowBlur;},showAsChild:function(p,q,r,s,t,u){if(this._.activeChild==p&&p._.panel._.offsetParentId==r.getId())return;this.hideChild();p.onHide=e.bind(function(){e.setTimeout(function(){if(!this._.focused)this.hide();},0,this);},this);this._.activeChild=p;this._.focused=false;p.showBlock(q,r,s,t,u);if(b.ie7Compat||b.ie8&&b.ie6Compat)setTimeout(function(){p.element.getChild(0).$.style.cssText+='';},100);},hideChild:function(){var p=this._.activeChild;if(p){delete p.onHide;delete this._.activeChild;p.hide();}}}});a.on('instanceDestroyed',function(){var p=e.isEmpty(a.instances);for(var q in m){var r=m[q];if(p)r.destroy();else r.element.hide();}p&&(m={});});})();j.add('menu',{beforeInit:function(m){var n=m.config.menu_groups.split(','),o=m._.menuGroups={},p=m._.menuItems={};for(var q=0;q'],B=r.length,C=B&&r[0].group;for(var D=0;D');C=E.group;}E.render(this,D,A);}A.push('');u.setHtml(A.join('')); -k.fire('ready',this);if(this.parent)this.parent._.panel.showAsChild(t,this.id,n,o,p,q);else t.showBlock(this.id,n,o,p,q);s.fire('menuShow',[t]);},addListener:function(n){this._.listeners.push(n);},hide:function(){var n=this;n._.onHide&&n._.onHide();n._.panel&&n._.panel.hide();}}});function m(n){n.sort(function(o,p){if(o.groupp.group)return 1;return o.orderp.order?1:0;});};a.menuItem=e.createClass({$:function(n,o,p){var q=this;e.extend(q,p,{order:0,className:'cke_button_'+o});q.group=n._.menuGroups[q.group];q.editor=n;q.name=o;},proto:{render:function(n,o,p){var w=this;var q=n.id+String(o),r=typeof w.state=='undefined'?2:w.state,s=' cke_'+(r==1?'on':r==0?'disabled':'off'),t=w.label;if(w.className)s+=' '+w.className;var u=w.getItems;p.push(''+''+'');if(u)p.push('','&#',w.editor.lang.dir=='rtl'?'9668':'9658',';','');p.push(t,'');}}});})();i.menu_groups='clipboard,form,tablecell,tablecellproperties,tablerow,tablecolumn,table,anchor,link,image,flash,checkbox,radio,textfield,hiddenfield,imagebutton,button,select,textarea,div';(function(){var m;j.add('editingblock',{init:function(n){if(!n.config.editingBlock)return;n.on('themeSpace',function(o){if(o.data.space=='contents')o.data.html+='
            ';});n.on('themeLoaded',function(){n.fireOnce('editingBlockReady');});n.on('uiReady',function(){n.setMode(n.config.startupMode);});n.on('afterSetData',function(){if(!m){function o(){m=true;n.getMode().loadData(n.getData());m=false;};if(n.mode)o(); -else n.on('mode',function(){if(n.mode){o();n.removeListener('mode',arguments.callee);}});}});n.on('beforeGetData',function(){if(!m&&n.mode){m=true;n.setData(n.getMode().getData(),null,1);m=false;}});n.on('getSnapshot',function(o){if(n.mode)o.data=n.getMode().getSnapshotData();});n.on('loadSnapshot',function(o){if(n.mode)n.getMode().loadSnapshotData(o.data);});n.on('mode',function(o){o.removeListener();b.webkit&&n.container.on('focus',function(){n.focus();});if(n.config.startupFocus)n.focus();setTimeout(function(){n.fireOnce('instanceReady');a.fire('instanceReady',null,n);},0);});n.on('destroy',function(){var o=this;if(o.mode)o._.modes[o.mode].unload(o.getThemeSpace('contents'));});}});a.editor.prototype.mode='';a.editor.prototype.addMode=function(n,o){o.name=n;(this._.modes||(this._.modes={}))[n]=o;};a.editor.prototype.setMode=function(n){this.fire('beforeSetMode',{newMode:n});var o,p=this.getThemeSpace('contents'),q=this.checkDirty();if(this.mode){if(n==this.mode)return;this.fire('beforeModeUnload');var r=this.getMode();o=r.getData();r.unload(p);this.mode='';}p.setHtml('');var s=this.getMode(n);if(!s)throw '[CKEDITOR.editor.setMode] Unknown mode "'+n+'".';if(!q)this.on('mode',function(){this.resetDirty();this.removeListener('mode',arguments.callee);});s.load(p,typeof o!='string'?this.getData():o);};a.editor.prototype.getMode=function(n){return this._.modes&&this._.modes[n||this.mode];};a.editor.prototype.focus=function(){this.forceNextSelectionCheck();var n=this.getMode();if(n)n.focus();};})();i.startupMode='wysiwyg';i.editingBlock=true;(function(){function m(){var B=this;try{var y=B.getSelection();if(!y||!y.document.getWindow().$)return;var z=y.getStartElement(),A=new d.elementPath(z);if(!A.compare(B._.selectionPreviousPath)){B._.selectionPreviousPath=A;B.fire('selectionChange',{selection:y,path:A,element:z});}}catch(C){}};var n,o;function p(){o=true;if(n)return;q.call(this);n=e.setTimeout(q,200,this);};function q(){n=null;if(o){e.setTimeout(m,0,this);o=false;}};function r(y){function z(C){return C&&C.type==1&&C.getName() in f.$removeEmpty;};var A=y.startContainer,B=y.startOffset;if(A.type==3)return false;return!e.trim(A.getHtml())?z(A):z(A.getChild(B-1))||z(A.getChild(B));};var s={modes:{wysiwyg:1,source:1},readOnly:c||b.webkit,exec:function(y){switch(y.mode){case 'wysiwyg':y.document.$.execCommand('SelectAll',false,null);y.forceNextSelectionCheck();y.selectionChange();break;case 'source':var z=y.textarea.$;if(c)z.createTextRange().execCommand('SelectAll'); -else{z.selectionStart=0;z.selectionEnd=z.value.length;}z.focus();}},canUndo:false};function t(y){w(y);var z=y.createText('​');y.setCustomData('cke-fillingChar',z);return z;};function u(y){return y&&y.getCustomData('cke-fillingChar');};function v(y){var z=y&&u(y);if(z)if(z.getCustomData('ready'))w(y);else z.setCustomData('ready',1);};function w(y){var z=y&&y.removeCustomData('cke-fillingChar');if(z){z.setText(z.getText().replace(/\u200B/g,''));z=0;}};j.add('selection',{init:function(y){if(b.webkit){y.on('selectionChange',function(){v(y.document);});y.on('beforeSetMode',function(){w(y.document);});y.on('key',function(D){switch(D.data.keyCode){case 13:case 2000+13:case 37:case 39:case 8:w(y.document);}},null,null,10);var z,A;function B(){var D=y.document,E=u(D);if(E){var F=D.$.defaultView.getSelection();if(F.type=='Caret'&&F.anchorNode==E.$)A=1;z=E.getText();E.setText(z.replace(/\u200B/g,''));}};function C(){var D=y.document,E=u(D);if(E){E.setText(z);if(A){D.$.defaultView.getSelection().setPosition(E.$,E.getLength());A=0;}}};y.on('beforeUndoImage',B);y.on('afterUndoImage',C);y.on('beforeGetData',B,null,null,0);y.on('getData',C);}y.on('contentDom',function(){var D=y.document,E=D.getBody(),F=D.getDocumentElement();if(c){var G,H,I=1;E.on('focusin',function(M){if(M.data.$.srcElement.nodeName!='BODY')return;if(G){if(I){try{G.select();}catch(O){}var N=D.getCustomData('cke_locked_selection');if(N){N.unlock();N.lock();}}G=null;}});E.on('focus',function(){H=1;L();});E.on('beforedeactivate',function(M){if(M.data.$.toElement)return;H=0;I=1;});if(c&&b.version<8)y.on('blur',function(M){try{y.document&&y.document.$.selection.empty();}catch(N){}});F.on('mousedown',function(){I=0;});F.on('mouseup',function(){I=1;});if(c&&(b.ie7Compat||b.version<8||b.quirks))F.on('click',function(M){if(M.data.getTarget().getName()=='html')y.getSelection().getRanges()[0].select();});var J;E.on('mousedown',function(M){if(M.data.$.button==2){var N=y.document.$.selection;if(N.type=='None')J=y.window.getScrollPosition();}K();});E.on('mouseup',function(M){if(M.data.$.button==2&&J){y.document.$.documentElement.scrollLeft=J.x;y.document.$.documentElement.scrollTop=J.y;}J=null;H=1;setTimeout(function(){L(true);},0);});E.on('keydown',K);E.on('keyup',function(){H=1;L();});D.on('selectionchange',L);function K(){H=0;};function L(M){if(H){var N=y.document,O=y.getSelection(),P=O&&O.getNative();if(M&&P&&P.type=='None')if(!N.$.queryCommandEnabled('InsertImage')){e.setTimeout(L,50,this,true);return;}var Q;if(P&&P.type&&P.type!='Control'&&(Q=P.createRange())&&(Q=Q.parentElement())&&(Q=Q.nodeName)&&Q.toLowerCase() in {input:1,textarea:1})return; -G=P&&O.getRanges()[0];p.call(y);}};}else{D.on('mouseup',p,y);D.on('keyup',p,y);}});y.on('contentDomUnload',y.forceNextSelectionCheck,y);y.addCommand('selectAll',s);y.ui.addButton('SelectAll',{label:y.lang.selectAll,command:'selectAll'});y.selectionChange=p;}});a.editor.prototype.getSelection=function(){return this.document&&this.document.getSelection();};a.editor.prototype.forceNextSelectionCheck=function(){delete this._.selectionPreviousPath;};g.prototype.getSelection=function(){var y=new d.selection(this);return!y||y.isInvalid?null:y;};a.SELECTION_NONE=1;a.SELECTION_TEXT=2;a.SELECTION_ELEMENT=3;d.selection=function(y){var B=this;var z=y.getCustomData('cke_locked_selection');if(z)return z;B.document=y;B.isLocked=0;B._={cache:{}};if(c){var A=B.getNative().createRange();if(!A||A.item&&A.item(0).ownerDocument!=B.document.$||A.parentElement&&A.parentElement().ownerDocument!=B.document.$)B.isInvalid=true;}return B;};var x={img:1,hr:1,li:1,table:1,tr:1,td:1,th:1,embed:1,object:1,ol:1,ul:1,a:1,input:1,form:1,select:1,textarea:1,button:1,fieldset:1,thead:1,tfoot:1};d.selection.prototype={getNative:c?function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.$.selection);}:function(){return this._.cache.nativeSel||(this._.cache.nativeSel=this.document.getWindow().$.getSelection());},getType:c?function(){var y=this._.cache;if(y.type)return y.type;var z=1;try{var A=this.getNative(),B=A.type;if(B=='Text')z=2;if(B=='Control')z=3;if(A.createRange().parentElement)z=2;}catch(C){}return y.type=z;}:function(){var y=this._.cache;if(y.type)return y.type;var z=2,A=this.getNative();if(!A)z=1;else if(A.rangeCount==1){var B=A.getRangeAt(0),C=B.startContainer;if(C==B.endContainer&&C.nodeType==1&&B.endOffset-B.startOffset==1&&x[C.childNodes[B.startOffset].nodeName.toLowerCase()])z=3;}return y.type=z;},getRanges:(function(){var y=c?(function(){function z(B){return new d.node(B).getIndex();};var A=function(B,C){B=B.duplicate();B.collapse(C);var D=B.parentElement(),E=D.ownerDocument;if(!D.hasChildNodes())return{container:D,offset:0};var F=D.children,G,H,I=B.duplicate(),J=0,K=F.length-1,L=-1,M,N;while(J<=K){L=Math.floor((J+K)/2);G=F[L];I.moveToElementText(G);M=I.compareEndPoints('StartToStart',B);if(M>0)K=L-1;else if(M<0)J=L+1;else if(b.ie9Compat&&G.tagName=='BR'){var O='cke_range_marker';B.execCommand('CreateBookmark',false,O);G=E.getElementsByName(O)[0];var P=z(G);D.removeChild(G);return{container:D,offset:P};}else return{container:D,offset:z(G)};}if(L==-1||L==F.length-1&&M<0){I.moveToElementText(D); -I.setEndPoint('StartToStart',B);N=I.text.replace(/(\r\n|\r)/g,'\n').length;F=D.childNodes;if(!N){G=F[F.length-1];if(G.nodeType==1)return{container:D,offset:F.length};else return{container:G,offset:G.nodeValue.length};}var Q=F.length;while(N>0)N-=F[--Q].nodeValue.length;return{container:F[Q],offset:-N};}else{I.collapse(M>0?true:false);I.setEndPoint(M>0?'StartToStart':'EndToStart',B);N=I.text.replace(/(\r\n|\r)/g,'\n').length;if(!N)return{container:D,offset:z(G)+(M>0?0:1)};while(N>0)try{H=G[M>0?'previousSibling':'nextSibling'];N-=H.nodeValue.length;G=H;}catch(R){return{container:D,offset:z(G)};}return{container:G,offset:M>0?-N:G.nodeValue.length+N};}};return function(){var L=this;var B=L.getNative(),C=B&&B.createRange(),D=L.getType(),E;if(!B)return[];if(D==2){E=new d.range(L.document);var F=A(C,true);E.setStart(new d.node(F.container),F.offset);F=A(C);E.setEnd(new d.node(F.container),F.offset);if(E.endContainer.getPosition(E.startContainer)&4&&E.endOffset<=E.startContainer.getIndex())E.collapse();return[E];}else if(D==3){var G=[];for(var H=0;H=F.getLength())J.setStartAfter(F);else J.setStartBefore(F);if(G&&G.type==3)if(!I)J.setEndBefore(G);else J.setEndAfter(G);var L=new d.walker(J);L.evaluator=function(M){if(M.type==1&&M.isReadOnly()){var N=D.clone();D.setEndBefore(M);if(D.collapsed)B.splice(C--,1);if(!(M.getPosition(J.endContainer)&16)){N.setStartAfter(M);if(!N.collapsed)B.splice(C+1,0,N);}return true;}return false;};L.next();}}return A.ranges;};})(),getStartElement:function(){var F=this;var y=F._.cache; -if(y.startElement!==undefined)return y.startElement;var z,A=F.getNative();switch(F.getType()){case 3:return F.getSelectedElement();case 2:var B=F.getRanges()[0];if(B){if(!B.collapsed){B.optimize();while(1){var C=B.startContainer,D=B.startOffset;if(D==(C.getChildCount?C.getChildCount():C.getLength())&&!C.isBlockBoundary())B.setStartAfter(C);else break;}z=B.startContainer;if(z.type!=1)return z.getParent();z=z.getChild(B.startOffset);if(!z||z.type!=1)z=B.startContainer;else{var E=z.getFirst();while(E&&E.type==1){z=E;E=E.getFirst();}}}else{z=B.startContainer;if(z.type!=1)z=z.getParent();}z=z.$;}}return y.startElement=z?new h(z):null;},getSelectedElement:function(){var y=this._.cache;if(y.selectedElement!==undefined)return y.selectedElement;var z=this,A=e.tryThese(function(){return z.getNative().createRange().item(0);},function(){var B=z.getRanges()[0],C,D;for(var E=2;E&&!((C=B.getEnclosedNode())&&C.type==1&&x[C.getName()]&&(D=C));E--)B.shrink(1);return D.$;});return y.selectedElement=A?new h(A):null;},lock:function(){var y=this;y.getRanges();y.getStartElement();y.getSelectedElement();y._.cache.nativeSel={};y.isLocked=1;y.document.setCustomData('cke_locked_selection',y);},unlock:function(y){var D=this;var z=D.document,A=z.getCustomData('cke_locked_selection');if(A){z.setCustomData('cke_locked_selection',null);if(y){var B=A.getSelectedElement(),C=!B&&A.getRanges();D.isLocked=0;D.reset();z.getBody().focus();if(B)D.selectElement(B);else D.selectRanges(C);}}if(!A||!y){D.isLocked=0;D.reset();}},reset:function(){this._.cache={};},selectElement:function(y){var A=this;if(A.isLocked){var z=new d.range(A.document);z.setStartBefore(y);z.setEndAfter(y);A._.cache.selectedElement=y;A._.cache.startElement=y;A._.cache.ranges=new d.rangeList(z);A._.cache.type=3;return;}z=new d.range(y.getDocument());z.setStartBefore(y);z.setEndAfter(y);z.select();A.document.fire('selectionchange');A.reset();},selectRanges:function(y){var M=this;if(M.isLocked){M._.cache.selectedElement=null;M._.cache.startElement=y[0]&&y[0].getTouchedStartNode();M._.cache.ranges=new d.rangeList(y);M._.cache.type=2;return;}if(c){if(y.length>1){var z=y[y.length-1];y[0].setEnd(z.endContainer,z.endOffset);y.length=1;}if(y[0])y[0].select();M.reset();}else{var A=M.getNative();if(!A)return;if(y.length){A.removeAllRanges();b.webkit&&w(M.document);}for(var B=0;B=0){H.collapse(1);I.setEnd(H.endContainer.$,H.endOffset);}else throw N;}A.addRange(I);}M.reset();}},createBookmarks:function(y){return this.getRanges().createBookmarks(y);},createBookmarks2:function(y){return this.getRanges().createBookmarks2(y);},selectBookmarks:function(y){var z=[];for(var A=0;A','','',this.label,'','=10900&&!o.hc?'':" href=\"javascript:void('"+this.label+"')\"",' role="button" aria-labelledby="',p,'_label" aria-describedby="',p,'_text" aria-haspopup="true"');if(b.opera||b.gecko&&b.mac)n.push(' onkeypress="return false;"');if(b.gecko)n.push(' onblur="this.style.cssText = this.style.cssText;"');n.push(' onkeydown="CKEDITOR.tools.callFunction( ',t,', event, this );" onclick="CKEDITOR.tools.callFunction(',q,', this); return false;">'+this.label+''+''+''+(b.hc?'▼':b.air?' ':'')+''+''+''+'');if(this.onRender)this.onRender();return r;},createPanel:function(m){if(this._.panel)return;var n=this._.panelDefinition,o=this._.panelDefinition.block,p=n.parent||a.document.getBody(),q=new k.floatPanel(m,p,n),r=q.addListBlock(this.id,o),s=this;q.onShow=function(){if(s.className)this.element.getFirst().addClass(s.className+'_panel');s.setState(1);r.focus(!s.multiSelect&&s.getValue());s._.on=1;if(s.onOpen)s.onOpen();};q.onHide=function(t){if(s.className)this.element.getFirst().removeClass(s.className+'_panel');s.setState(s.modes&&s.modes[m.mode]?2:0);s._.on=0;if(!t&&s.onClose)s.onClose();};q.onEscape=function(){q.hide();s.document.getById('cke_'+s.id).getFirst().getNext().focus();};r.onClick=function(t,u){s.document.getWindow().focus();if(s.onClick)s.onClick.call(s,t,u);if(u)s.setValue(t,s._.items[t]);else s.setValue('');q.hide();};this._.panel=q;this._.list=r;q.getBlock(this.id).onHide=function(){s._.on=0;s.setState(2);};if(this.init)this.init(); -},setValue:function(m,n){var p=this;p._.value=m;var o=p.document.getById('cke_'+p.id+'_text');if(o){if(!(m||n)){n=p.label;o.addClass('cke_inline_label');}else o.removeClass('cke_inline_label');o.setHtml(typeof n!='undefined'?n:m);}},getValue:function(){return this._.value||'';},unmarkAll:function(){this._.list.unmarkAll();},mark:function(m){this._.list.mark(m);},hideItem:function(m){this._.list.hideItem(m);},hideGroup:function(m){this._.list.hideGroup(m);},showAll:function(){this._.list.showAll();},add:function(m,n,o){this._.items[m]=o||m;this._.list.add(m,n,o);},startGroup:function(m){this._.list.startGroup(m);},commit:function(){var m=this;if(!m._.committed){m._.list.commit();m._.committed=1;k.fire('ready',m);}m._.committed=1;},setState:function(m){var n=this;if(n._.state==m)return;n.document.getById('cke_'+n.id).setState(m);n._.state=m;}}});k.prototype.addRichCombo=function(m,n){this.add(m,'richcombo',n);};j.add('htmlwriter');a.htmlWriter=e.createClass({base:a.htmlParser.basicWriter,$:function(){var o=this;o.base();o.indentationChars='\t';o.selfClosingEnd=' />';o.lineBreakChars='\n';o.forceSimpleAmpersand=0;o.sortAttributes=1;o._.indent=0;o._.indentation='';o._.inPre=0;o._.rules={};var m=f;for(var n in e.extend({},m.$nonBodyContent,m.$block,m.$listItem,m.$tableContent))o.setRules(n,{indent:1,breakBeforeOpen:1,breakAfterOpen:1,breakBeforeClose:!m[n]['#'],breakAfterClose:1});o.setRules('br',{breakAfterOpen:1});o.setRules('title',{indent:0,breakAfterOpen:0});o.setRules('style',{indent:0,breakBeforeClose:1});o.setRules('pre',{indent:0});},proto:{openTag:function(m,n){var p=this;var o=p._.rules[m];if(p._.indent)p.indentation();else if(o&&o.breakBeforeOpen){p.lineBreak();p.indentation();}p._.output.push('<',m);},openTagClose:function(m,n){var p=this;var o=p._.rules[m];if(n)p._.output.push(p.selfClosingEnd);else{p._.output.push('>');if(o&&o.indent)p._.indentation+=p.indentationChars;}if(o&&o.breakAfterOpen)p.lineBreak();m=='pre'&&(p._.inPre=1);},attribute:function(m,n){if(typeof n=='string'){this.forceSimpleAmpersand&&(n=n.replace(/&/g,'&'));n=e.htmlEncodeAttr(n);}this._.output.push(' ',m,'="',n,'"');},closeTag:function(m){var o=this;var n=o._.rules[m];if(n&&n.indent)o._.indentation=o._.indentation.substr(o.indentationChars.length);if(o._.indent)o.indentation();else if(n&&n.breakBeforeClose){o.lineBreak();o.indentation();}o._.output.push('');m=='pre'&&(o._.inPre=0);if(n&&n.breakAfterClose)o.lineBreak();},text:function(m){var n=this;if(n._.indent){n.indentation(); -!n._.inPre&&(m=e.ltrim(m));}n._.output.push(m);},comment:function(m){if(this._.indent)this.indentation();this._.output.push('');},lineBreak:function(){var m=this;if(!m._.inPre&&m._.output.length>0)m._.output.push(m.lineBreakChars);m._.indent=1;},indentation:function(){var m=this;if(!m._.inPre)m._.output.push(m._.indentation);m._.indent=0;},setRules:function(m,n){var o=this._.rules[m];if(o)e.extend(o,n,true);else this._.rules[m]=n;}}});j.add('menubutton',{requires:['button','menu'],beforeInit:function(m){m.ui.addHandler('menubutton',k.menuButton.handler);}});a.UI_MENUBUTTON='menubutton';(function(){var m=function(n){var o=this._;if(o.state===0)return;o.previousState=o.state;var p=o.menu;if(!p){p=o.menu=new a.menu(n,{panel:{className:n.skinClass+' cke_contextmenu',attributes:{'aria-label':n.lang.common.options}}});p.onHide=e.bind(function(){this.setState(this.modes&&this.modes[n.mode]?o.previousState:0);},this);if(this.onMenu)p.addListener(this.onMenu);}if(o.on){p.hide();return;}this.setState(1);p.show(a.document.getById(this._.id),4);};k.menuButton=e.createClass({base:k.button,$:function(n){var o=n.panel;delete n.panel;this.base(n);this.hasArrow=true;this.click=m;},statics:{handler:{create:function(n){return new k.menuButton(n);}}}});})();j.add('dialogui');(function(){var m=function(u){var x=this;x._||(x._={});x._['default']=x._.initValue=u['default']||'';x._.required=u.required||false;var v=[x._];for(var w=1;w',v.label,'','');else{var D={type:'hbox',widths:v.widths,padding:0,children:[{type:'html',html:'
          ');delete this._.started;}},getClick:function(){if(!this._.click)this._.click=e.addFunction(function(m){var o=this;var n=true;if(o.multiSelect)n=o.toggle(m);else o.mark(m);if(o.onClick)o.onClick(m,n);},this);return this._.click;}},proto:{add:function(m,n,o){var r=this;var p=r._.pendingHtml,q=e.getNextId();if(!r._.started){p.push('');delete this._.started;}},getClick:function(){if(!this._.click)this._.click=e.addFunction(function(m){var o=this;var n=true;if(o.multiSelect)n=o.toggle(m);else o.mark(m);if(o.onClick)o.onClick(m,n);},this);return this._.click;}},proto:{add:function(m,n,o){var r=this;var p=r._.pendingHtml,q=e.getNextId();if(!r._.started){p.push('\n"; // End Language Tab Div - - } - //$tokenoutput .= ""; // TIBO: commenting this unexpected end div - /* - if (isset($tokenid)) - { - $tokenoutput .= "
        • ".$tokenid - ."
        • "; - } - if (isset($tokenids) && count($tokenids) > 0) - { - $tokenoutput .= "
        • ".implode(", ", $tokenids) - ."
        • "; - } else { - $tokenoutput .= "
        • " - .$clang->gT("All tokens who have not yet been sent an invitation") - ."
        • "; - } - */ - $tokenoutput .="\t

          \n" - ."\t

          \n" - ."\t\n" - ."\t\n" - ."\t\n" - ."\t\n"; - if (isset($tokenid)) {$tokenoutput .= "\t\n";} - if (isset($tokenids)) {$tokenoutput .= "\n\n";} - $tokenoutput .= "\n"; + $tokenoutput.=" " + ."

        • " + ."
        •  
        • " + // ."
        • " + ."
        " + ."

        " + ."" + ."" + ."" + ."

        "; } - else + + $tokenoutput .= ""; + + if($subaction=="surveysettingsave") { - $tokenoutput .= "
        \n" - ."\t
        \n"; - $tokenoutput .= $clang->gT("Sending invitations..."); - $tokenoutput .= "\n\t
        \n"; - if (isset($tokenid)) {$tokenoutput .= " (".$clang->gT("Sending to Token ID").": {$tokenid})";} - if (isset($tokenids)) {$tokenoutput .= " (".$clang->gT("Sending to Token IDs").": ".implode(", ", $tokenids).")";} - $tokenoutput .= "
        \n"; + global $connect; + @$fieldvalue = array("bounceprocessing"=>$_POST['bounceprocessing'], + "bounce_email"=>$_POST['bounce_email'], + ); - if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') + if(@$_POST['bounceprocessing']=='L') { - $SQLemailstatuscondition = " AND emailstatus = 'OK'"; - } - else - { - $SQLemailstatuscondition = " AND emailstatus <> 'OptOut'"; + $fieldvalue['bounceaccountencryption']=$_POST['bounceaccountencryption']; + $fieldvalue['bounceaccountuser']=$_POST['bounceaccountuser']; + $fieldvalue['bounceaccountpass']=$_POST['bounceaccountpass']; + $fieldvalue['bounceaccounttype']=$_POST['bounceaccounttype']; + $fieldvalue['bounceaccounthost']=$_POST['bounceaccounthost']; } - $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' $SQLemailstatuscondition"; + $connect->AutoExecute("{$dbprefix}surveys", $fieldvalue, 2,"sid=$surveyid",get_magic_quotes_gpc()); + $tokenoutput .= "
        ".$clang->gT("Bounce settings")."
        \n" + ."
        " + ."\t
        ".$clang->gT("Bounce settings have been saved.")."
        \n" + ."
        "; - if (isset($tokenid)) {$ctquery .= " AND tid='{$tokenid}'";} - if (isset($tokenids)) {$ctquery .= " AND tid IN ('".implode("', '", $tokenids)."')";} - $tokenoutput .= "\n"; - $ctresult = $connect->Execute($ctquery) or safe_die("Database error!
        \n" . $connect->ErrorMsg()); - $ctcount = $ctresult->RecordCount(); - $ctfieldcount = $ctresult->FieldCount(); + } - $emquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' $SQLemailstatuscondition"; + if ($subaction=='bouncesettings'){ - if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} - if (isset($tokenids)) {$emquery .= " AND tid IN ('".implode("', '", $tokenids)."')";} - $tokenoutput .= "\n\n\n\n"; - $emresult = db_select_limit_assoc($emquery,$maxemails) or safe_die ("Couldn't do query.
        \n$emquery
        \n".$connect->ErrorMsg()); - $emcount = $emresult->RecordCount(); + $settings=getSurveyInfo($surveyid); + $tokenoutput .= "\t
        ".$clang->gT("Bounce settings")."
        \n"; + $tokenoutput .= "
        \n" + ."
        " - $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + ."\t\n
      • \n" + ."\t\t
      • \n" + + ."\t
      • \n" + ."\t\t
      • \n" + . "\t
      • \n" + . "\t\t
      • \n" + + . "\t
      • \n" + . "\t\t\n"."".$clang->gT("Enter your hostname and port, e.g.: imap.gmail.com:995")."\n" + . "\t
      • \n" + . "\t\t
      • \n" + . "\t
      • \n" + . "\t\t
      • \n"; + $tokenoutput.= "\t
      • \n" + . "\t\t
      • \n
        ".""; + $tokenoutput .= "\t


        \n"; + + } + + + if ($subaction == "deleteall" && bHasSurveyPermission($surveyid, 'tokens', 'delete')){ + $query="DELETE FROM ".db_table_name("tokens_$surveyid"); + $result=$connect->Execute($query) or safe_die ("Couldn't update sent field
        $query
        ".$connect->ErrorMsg()); + $tokenoutput .= "
        ".$clang->gT("Delete all token entries")."
        \n" + ."
        ".$clang->gT("All token entries have been deleted.")."

        \n"; + $subaction=""; + } + + if ($subaction == "clearinvites" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $query="UPDATE ".db_table_name("tokens_$surveyid")." SET sent='N', remindersent='N', remindercount=0"; + $result=$connect->Execute($query) or safe_die ("Couldn't update sent field
        $query
        ".$connect->ErrorMsg()); + $tokenoutput .= "
        ".$clang->gT("Reset token invitation status")."
        \n" + ."
        ".$clang->gT("All token entries have been set to 'Not invited'.")."

        \n"; + $subaction=""; + } + + if ($subaction == "cleartokens" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $query="UPDATE ".db_table_name("tokens_$surveyid")." SET token=''"; + $result=$connect->Execute($query) or safe_die("Couldn't reset the tokens field
        $query
        ".$connect->ErrorMsg()); + $tokenoutput .= "
        ".$clang->gT("Remove unique token numbers")."
        \n" + ."
        ".$clang->gT("All unique token numbers have been removed.")."

        \n"; + $subaction=""; + } + + + if (!$subaction && (bHasSurveyPermission($surveyid, 'tokens', 'update') || bHasSurveyPermission($surveyid, 'tokens', 'delete'))) + { + $tokenoutput .= "\t
        ".$clang->gT("Token database administration options")."
        \n" + ."
        "; + + if (bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $tokenoutput .="
        \n"; + } + + + if ($subaction == "browse" || $subaction == "search") + { + if (!isset($limit)) {$limit = 100;} + if (!isset($start)) {$start = 0;} + + if ($limit > $tkcount) {$limit=$tkcount;} + $next=$start+$limit; + $last=$start-$limit; + $end=$tkcount-$limit; + if ($end < 0) {$end=0;} + if ($last <0) {$last=0;} + if ($next >= $tkcount) {$next=$tkcount-$limit;} + if ($end < 0) {$end=0;} $baselanguage = GetBaseLanguageFromSurveyID($surveyid); - array_unshift($surveylangs,$baselanguage); - foreach ($surveylangs as $language) + //ALLOW SELECTION OF NUMBER OF RECORDS SHOWN + if($subaction != 'bounceprocessing') { - $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); - $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); - if ($ishtml) $_POST['message_'.$language] = html_entity_decode($_POST['message_'.$language], ENT_QUOTES, $emailcharset); - } - - - $attributes=GetTokenFieldsAndNames($surveyid); - if ($emcount > 0) - { - $tokenoutput .= "
          \n"; - $oMail = new PHPMailer; - while ($emrow = $emresult->FetchRow()) + $tokenoutput .="\t\n"; + + $tokenoutput .= "\n"; + //COLUMN HEADINGS + $tokenoutput .= "\t\n" + ."\n" //Checkbox + + ."\n" // ID + + ."\n" //Actions + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n" + + ."\n"; + + $attrfieldnames=GetTokenFieldsAndNames($surveyid,true); + foreach ($attrfieldnames as $attr_name=>$attr_translation) + { + $tokenoutput .= "\n"; + } + $tokenoutput .="\t\n"; + + $tokenfieldorder=array('tid', + 'firstname', + 'lastname', + 'email', + 'emailstatus', + 'token', + 'language', + 'sent', + 'remindersent', + 'remindercount', + 'completed', + 'usesleft', + 'validfrom', + 'validuntil'); + foreach ($attrfieldnames as $attr_name=>$attr_translation) + { + $tokenfieldorder[]=$attr_name; + } + + while ($brow = $bresult->FetchRow()) + { + $brow['token'] = trim($brow['token']); + if (trim($brow['validfrom'])!=''){ + $datetimeobj = new Date_Time_Converter($brow['validfrom'] , "Y-m-d H:i:s"); + $brow['validfrom']=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i'); + }; + if (trim($brow['validuntil'])!=''){ + $datetimeobj = new Date_Time_Converter($brow['validuntil'] , "Y-m-d H:i:s"); + $brow['validuntil']=$datetimeobj->convert($dateformatdetails['phpdate'].' H:i'); + }; + + if ($bgc == "evenrow") {$bgc = "oddrow";} else {$bgc = "evenrow";} + $tokenoutput .= "\t\n"; + + $tokenoutput .= "\n"; + + foreach ($tokenfieldorder as $tokenfieldname) + { + + if ($tokenfieldname =='email' && $brow['emailstatus'] != 'OK') + { + if ($brow['emailstatus']!='OptOut') { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; - $fieldsarray["@@SURVEYURL@@"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + $tokenoutput .= "\n"; } else { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; - $fieldsarray["@@SURVEYURL@@"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + $tokenoutput .= "\n"; } } - $customheaders = array( '1' => "X-surveyid: ".$surveyid, - '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]); - $modsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); - $modmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); - - if (trim($emrow['validfrom'])!='' && convertDateTimeFormat($emrow['validfrom'],'Y-m-d H:i:s','U')*1>date('U')*1) - { - $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.")."
          ", $fieldsarray); - } - elseif (trim($emrow['validuntil'])!='' && convertDateTimeFormat($emrow['validuntil'],'Y-m-d H:i:s','U')*1gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.")."
          ", $fieldsarray); - } - elseif (SendEmailMessage($oMail, $modmessage, $modsubject, $to , $from, $sitename, $ishtml, getBounceEmail($surveyid),null,$customheaders)) - { - // Put date into sent - $today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust); - $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" - ."SET sent='$today' WHERE tid={$emrow['tid']}"; - // - $uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens
          $udequery
          ".$connect->ErrorMsg()); - $tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} (".htmlspecialchars(implode(',',$to)).")
          \n"; - if ($emailsmtpdebug==2) - { - $tokenoutput .=$maildebug; - } - } + // elseif ($tokenfieldname != 'emailstatus') else { - $tokenoutput .= '
        • '.ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
          ", $fieldsarray).'
        • '; - if ($debug>0) + if ($tokenfieldname=='tid') { - $tokenoutput .= "
          Subject : $modsubject

          ".htmlspecialchars($maildebugbody)."
          "; + $tokenoutput.="
          "; + } + else + { + $tokenoutput .= '\n"; } } + if ($tokenfieldname=='tid') + { + $tokenoutput .= "\n"; + } } - if ($ctcount > $emcount) + $tokenoutput .= "\t\n"; + } + + // Multiple item actions + if ($bresult->rowCount() > 0) { + $tokenoutput .= "\n" + . "\n" + . "\n"; } + //End multiple item actions + + $tokenoutput .= "
          " + ."" + .""
+        .$clang->gT("Sort by: ")
+        ."ID"."ID".$clang->gT("Actions")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("First name")
+        ."".$clang->gT("First name")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Last name")
+        ."".$clang->gT("Last name")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Email address")
+        ."".$clang->gT("Email address")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Email status")
+        ."".$clang->gT("Email status")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Token")
+        ."".$clang->gT("Token")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Language")
+        ."".$clang->gT("Language")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Invitation sent?")
+        ."".$clang->gT("Invitation sent?")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Reminder sent?")
+        ."".$clang->gT("Reminder sent?")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Reminder count")
+        ."".$clang->gT("Reminder count")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Completed?")
+        ."".$clang->gT("Completed?")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Uses left")
+        ."".$clang->gT("Uses left")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Valid from")
+        ."".$clang->gT("Valid from")."" + ."" + .""
+        .$clang->gT("Sort by: ")
+        .$clang->gT("Valid until")
+        ."".$clang->gT("Valid until")."" + ."" + ."".htmlspecialchars($attr_translation,ENT_QUOTES,'utf-8')."
          " + ."" + ."$brow[$tokenfieldname]" + ."" + ."$brow[$tokenfieldname]".$brow[$tokenfieldname]."'.htmlspecialchars($brow[$tokenfieldname])."\n"; + if (bHasSurveyPermission($surveyid, 'tokens','update')) + { + if ((($brow['completed'] == "N" || $brow['completed'] == "") && $brow['token']) || $thissurvey['alloweditaftercompletion']=='Y') + { + $toklang = ($brow['language'] == '') ? $baselanguage : $brow['language']; + $tokenoutput .= "\n"; + } + else + { + $tokenoutput .= ""; + } + $tokenoutput .=" "; + } + if (bHasSurveyPermission($surveyid, 'tokens','delete')) + { + $tokenoutput .="gT("Are you sure you want to delete this entry?","js")." (".$brow['tid'].")')) {".get2post("$scriptname?action=tokens&sid=$surveyid&subaction=delete&tid=".$brow['tid']."&limit=$limit&start=$start&order=$order")."}\" />"; + } + + if ($brow['completed'] != "N" && $brow['completed']!="" && $surveyprivate == "N" && $thissurvey['active']=='Y') + { + // Get response Id + $query="SELECT id FROM ".db_table_name('survey_'.$surveyid)." WHERE token='{$brow['token']}' ORDER BY id desc"; + $result=db_execute_num($query) or safe_die ("
          Could not find token!
          \n" .$connect->ErrorMsg()); + list($id) = $result->FetchRow(); + + // UPDATE button to the tokens display in the MPID Actions column + if ($id) + { + $tokenoutput .= "\n"; + } + } + elseif ($brow['completed'] == "N" && $brow['token'] && $brow['sent'] == "N" && trim($brow['email'])!='' && bHasSurveyPermission($surveyid, 'tokens','update')) + { + $tokenoutput .= ""; + } + elseif ($brow['completed'] == "N" && $brow['token'] && $brow['sent'] != "N" && trim($brow['email'])!='') // reminder button + { + $tokenoutput .= ""; + } + $tokenoutput .= "\n
          "; + + if (bHasSurveyPermission($surveyid, 'tokens','delete')) { - $i = 0; - if (isset($tokenids)) - { - while($i < $maxemails) - { array_shift($tokenids); $i++; } - $tids = '|'.implode('|',$tokenids); - } - $lefttosend = $ctcount-$maxemails; - $tokenoutput .= "\n" - ."
          ".$clang->gT("Warning")."

          \n" - ."
          " - .$clang->gT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below.")."

          \n"; - $tokenoutput .= str_replace("{EMAILCOUNT}", "$lefttosend", $clang->gT("There are {EMAILCOUNT} emails still to be sent.")); - $tokenoutput .= "

          \n"; - $tokenoutput .= "\n" - ."\n" - ."\n" - ."\n" - ."\n" - ."\n"; - if (isset($tokenids)) - { - $tokenoutput .= "\n"; - } - foreach ($surveylangs as $language) - { - $message = html_escape($_POST['message_'.$language]); - $subject = html_escape($_POST['subject_'.$language]); - $tokenoutput .="\n" - ."\n" - ."\n"; - } - $tokenoutput .="
          \n"; + $tokenoutput .= "" + . "gT("Are you sure you want to delete the selected entries?","js") + ."')) {".get2post("{$scriptname}?action=tokens&sid={$surveyid}&subaction=delete&tids=document.getElementById('tokenboxeschecked').value&limit={$limit}&start={$start}&order={$order}")."}}else{alert('".$clang->gT("No tokens selected",'js')."');}\" />"; + } - $oMail->SmtpClose(); - } - else - { - $tokenoutput .= "
          ".$clang->gT("Warning")."
          \n".$clang->gT("There were no eligible emails to send. This will be because none satisfied the criteria of:") - ."
           
          • ".$clang->gT("having a valid email address")."
          • " - ."
          • ".$clang->gT("not having been sent an invitation already")."
          • " - ."
          • ".$clang->gT("having already completed the survey")."
          • " - ."
          • ".$clang->gT("having a token")."
          "; + + if (bHasSurveyPermission($surveyid, 'tokens','update')) + { + $tokenoutput .= " " + . "" + . " " + . ""; + } + $tokenoutput .= "\n"; + $tokenoutput .= "
          \n
          \n"; } - //$tokenoutput .= "
        \n\n"; - $tokenoutput .= "\n"; // TIBO only close on div, cause dialog-modal will cklose wrapper -} -if ($subaction == "remind" && bHasSurveyPermission($surveyid, 'tokens','update')) -{ - $tokenoutput .= PrepareEditorScript(); - $tokenoutput .= "\t
        " - .$clang->gT("Send email reminder")."

        \n"; - if (!isset($_POST['ok']) || !$_POST['ok']) + if ($subaction == "kill" && bHasSurveyPermission($surveyid, 'surveyactivation', 'update')) { - if ($thissurvey['active']!='Y') + $date = date('YmdHis'); + $tokenoutput .= "
        ".$clang->gT("Delete Tokens Table")."
        \n" + ."
        \n"; + // ToDo: Just delete it if there is no token in the table + if (!isset($_POST['ok']) || !$_POST['ok']) { - $tokenoutput .="
        ".$clang->gT('Warning!')."
        ".$clang->gT("This survey is not yet activated and so your participants won't be able to fill out the survey.")."
        "; + $tokenoutput .= "
        ".$clang->gT("Warning")."

        \n" + .$clang->gT("If you delete this table tokens will no longer be required to access this survey.")."
        ".$clang->gT("A backup of this table will be made if you proceed. Your system administrator will be able to access this table.")."
        \n" + ."( \"old_tokens_{$surveyid}_$date\" )

        \n" + ."\n" + ."\n"; } - //GET SURVEY DETAILS - $tokenoutput .= "
        "; - $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); - $baselang = GetBaseLanguageFromSurveyID($surveyid); - array_unshift($surveylangs,$baselang); - - $tokenoutput .= "
        "; - foreach ($surveylangs as $language) + elseif (isset($_POST['ok']) && $_POST['ok'] == "surething") { - //GET SURVEY DETAILS - $thissurvey=getSurveyInfo($surveyid,$language); - if (!$thissurvey['email_remind']) {$thissurvey['email_remind']=str_replace("\n", "\r\n", $clang->gT("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\"{SURVEYNAME}\"\n\n\"{SURVEYDESCRIPTION}\"\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}")."\n\n".$clang->gT("If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:\n{OPTOUTURL}"));} - $tokenoutput .= '

        '.getLanguageNameFromCode($language,false); - if ($language==$baselang) + $oldtable = "tokens_$surveyid"; + $newtable = "old_tokens_{$surveyid}_$date"; + $deactivatequery = db_rename_table( db_table_name_nq($oldtable), db_table_name_nq($newtable)); + + if ($databasetype=='postgres') { - $tokenoutput .= "(".$clang->gT("Base language").")"; + // If you deactivate a postgres table you have to rename the according sequence too and alter the id field to point to the changed sequence + $oldTableJur = db_table_name_nq($oldtable); + $deactivatequery = db_rename_table(db_table_name_nq($oldtable),db_table_name_nq($newtable).'_tid_seq'); + $deactivateresult = $connect->Execute($deactivatequery) or die ("oldtable : ".$oldtable. " / oldtableJur : ". $oldTableJur . " / ".htmlspecialchars($deactivatequery)." / Could not rename the old sequence for this token table. The database reported the following error:
        ".htmlspecialchars($connect->ErrorMsg())."

        ".$clang->gT("Main Admin Screen").""); + $setsequence="ALTER TABLE ".db_table_name_nq($newtable)."_tid_seq ALTER COLUMN tid SET DEFAULT nextval('".db_table_name_nq($newtable)."_tid_seq'::regclass);"; + $deactivateresult = $connect->Execute($setsequence) or die (htmlspecialchars($setsequence)." Could not alter the field tid to point to the new sequence name for this token table. The database reported the following error:
        ".htmlspecialchars($connect->ErrorMsg())."

        Survey was not deactivated either.

        ".$clang->gT("Main Admin Screen").""); + $setidx="ALTER INDEX ".db_table_name_nq($oldtable)."_idx RENAME TO ".db_table_name_nq($newtable)."_idx;"; + $deactivateresult = $connect->Execute($setidx) or die (htmlspecialchars($setidx)." Could not alter the index for this token table. The database reported the following error:
        ".htmlspecialchars($connect->ErrorMsg())."

        Survey was not deactivated either.

        ".$clang->gT("Main Admin Screen").""); + } else { + $deactivateresult = $connect->Execute($deactivatequery) or die ("Couldn't deactivate because:
        \n".htmlspecialchars($connect->ErrorMsg())." - Query: ".htmlspecialchars($deactivatequery)."

        \nAdmin\n"); } - $tokenoutput .= "

          \n" - ."
        • \n" - ."\" />
        • \n" + LimeExpressionManager::SetDirtyFlag(); // so that knows that token tables have changed - ."
        • \n"; - - $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; - $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; - $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; - $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; - $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; - - $subject=Replacefields($thissurvey['email_remind_subj'], $fieldsarray); - $textarea=Replacefields($thissurvey['email_remind'], $fieldsarray); - if ($ishtml!==true){$textarea=str_replace(array('',''),array(''),$textarea);} - - $tokenoutput .= "
        • \n"; - - $tokenoutput .= "\t
        • \n" - ."\n" - ."\n" - . getEditor("email-rem","message_$language","[".$clang->gT("Reminder Email:", "js")."](".$language.")",$surveyid,'','',$action) - ."
        • \n" - ."
        "; - } - - $tokenoutput .= "
          \n"; - - if (isset($tokenids)) { - $tokenoutput .= "\t
        • \n" - . "\n" - . implode(", ", $tokenids)."
        • \n"; - } elseif (!isset($tokenid)) { - $tokenoutput .= "
        • " - .$clang->gT("All token entries to whom a reminder email would apply") - ."
        • "; - $tokenoutput .= "\t
        • \n" - ."\n" - ."\n" - ."\t
        • \n"; - } elseif (isset($tokenid)) { - $tokenoutput .= "\t
        • \n" - ."\n" - ."{$tokenid}
        • \n"; - } - $tokenoutput .="
        • \n" - ."
        • \n" - . "
        • \n" - ."
        • \n" - - . "
        • \n" - . "
        • \n" - . "

        \n" - ."\n" - ."\t\n" - ."\t\n" - ."\t\n"; - if (isset($tokenid)) {$tokenoutput .= "\t\n";} - if (isset($tokenids)) {$tokenoutput .= "\n\n";} - $tokenoutput .= "

        \n"; - } - else - { - - $tokenoutput .= "
        \n" - . "
        "; - $tokenoutput .= $clang->gT("Sending Reminders") - ."

        \n"; - - $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); - $baselanguage = GetBaseLanguageFromSurveyID($surveyid); - array_unshift($surveylangs,$baselanguage); - - foreach ($surveylangs as $language) - { - $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); - $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); - - } - - if (isset($starttokenid)) {$tokenoutput .= " (".$clang->gT("From Token ID").": {$starttokenid})";} - if (isset($tokenid)) {$tokenoutput .= " (".$clang->gT("Sending to Token ID").": {$tokenid})";} - if (isset($tokenids)) {$tokenoutput .= " (".$clang->gT("Sending to Token IDs").": ".implode("|", $tokenids).")";} - - if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') - { - $SQLemailstatuscondition = " AND emailstatus = 'OK'"; - } - else - { - $SQLemailstatuscondition = ""; - } - - if (isset($_POST['maxremindercount']) && - $_POST['maxremindercount'] != '' && - intval($_POST['maxremindercount']) != 0) - { - $SQLremindercountcondition = " AND remindercount < ".intval($_POST['maxremindercount']); - } - else - { - $SQLremindercountcondition = ""; - } - - if (isset($_POST['minreminderdelay']) && - $_POST['minreminderdelay'] != '' && - intval($_POST['minreminderdelay']) != 0) - { - // $_POST['minreminderdelay'] in days (86400 seconds per day) - $compareddate = date_shift( - date("Y-m-d H:i:s",time() - 86400 * intval($_POST['minreminderdelay'])), - "Y-m-d H:i", - $timeadjust); - $SQLreminderdelaycondition = " AND ( " - . " (remindersent = 'N' AND sent < '".$compareddate."') " - . " OR " - . " (remindersent < '".$compareddate."'))"; - } - else - { - $SQLreminderdelaycondition = ""; - } - - $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed ='N' or completed ='') AND sent<>'' AND sent<>'N' AND token <>'' AND email <> '' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; - - if (isset($starttokenid)) {$ctquery .= " AND tid > '{$starttokenid}'";} - if (isset($tokenid) && $tokenid) {$ctquery .= " AND tid = '{$tokenid}'";} - if (isset($tokenids)) {$ctquery .= " AND tid IN (".implode(", ", $tokenids).")";} - $tokenoutput .= "\n"; - $ctresult = $connect->Execute($ctquery) or safe_die ("Database error!
        \n" . $connect->ErrorMsg()); - $ctcount = $ctresult->RecordCount(); - $ctfieldcount = $ctresult->FieldCount(); - $emquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; - - if (isset($starttokenid)) {$emquery .= " AND tid > '{$starttokenid}'";} - if (isset($tokenid) && $tokenid) {$emquery .= " AND tid = '{$tokenid}'";} - if (isset($tokenids)) {$emquery .= " AND tid IN (".implode(", ", $tokenids).")";} - $emquery .= " ORDER BY tid "; - $emresult = db_select_limit_assoc($emquery, $maxemails) or safe_die ("Couldn't do query.
        $emquery
        ".$connect->ErrorMsg()); - $emcount = $emresult->RecordCount(); - - - $attributes=GetTokenFieldsAndNames($surveyid); - if ($emcount > 0) - { - $tokenoutput .= "\n" - ."\t\n" - ."\n" - ."\t\n" - ."\t" - ."\n" - ."\t\n" - ."\t\n" - ."\t\n" - ."\t\n" - ."\t\n"; - //Include values for constraints minreminderdelay and maxremindercount if they exist - if (isset($_POST['minreminderdelay']) && - $_POST['minreminderdelay'] != '' && - intval($_POST['minreminderdelay']) != 0) - { - $tokenoutput .= "\t\n"; - } - if (isset($_POST['maxremindercount']) && - $_POST['maxremindercount'] != '' && - intval($_POST['maxremindercount']) != 0) - { - $tokenoutput .= "\t\n"; - } - // - foreach ($surveylangs as $language) - { - $message = html_escape($_POST['message_'.$language]); - $tokenoutput .="\n" - ."\n" - ."\n"; - } - $tokenoutput.="\t\n" - ."\t\n"; - } - $tokenoutput .= "\t\n" - ."
        \n"; - $oMail = new PHPMailer; - while ($emrow = $emresult->FetchRow()) - { - unset($fieldsarray); - $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']; - $fieldsarray["{TOKEN}"]=$emrow['token']; - $fieldsarray["{LANGUAGE}"]=$emrow['language']; - $fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$surveyid; - $fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"]; - - foreach ($attributes as $attributefield=>$attributedescription) - { - $fieldsarray['{'.strtoupper($attributefield).'}']=$emrow[$attributefield]; - } - - $emrow['language']=trim($emrow['language']); - if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default - $found = array_search($emrow['language'], $surveylangs); - if ($found==false) {$emrow['language']=$baselanguage;} - - $from = $_POST['from_'.$emrow['language']]; - - if (getEmailFormat($surveyid) == 'html') - { - $ishtml=true; - } - else - { - $ishtml=false; - } - - if ($ishtml == false) - { - $fieldsarray["{OPTOUTURL}"]="$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; - } - else - { - $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; - } - } - else - { - $fieldsarray["{OPTOUTURL}"]="".htmlspecialchars("$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; - if ( $modrewrite ) - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; - $fieldsarray["@@SURVEYURL@@"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; - } - else - { - $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; - $fieldsarray["@@SURVEYURL@@"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; - $_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset); - } - } - - $msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); - $sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); - $customheaders = array( '1' => "X-surveyid: ".$surveyid, - '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]); - - if (trim($emrow['validfrom'])!='' && convertDateTimeFormat($emrow['validfrom'],'Y-m-d H:i:s','U')*1>date('U')*1) - { - $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.")."
        ", $fieldsarray); - } - elseif (trim($emrow['validuntil'])!='' && convertDateTimeFormat($emrow['validuntil'],'Y-m-d H:i:s','U')*1gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.")."
        ", $fieldsarray); - } - elseif (SendEmailMessage($oMail, $sendmessage, $msgsubject, $to, $from, $sitename,$ishtml,getBounceEmail($surveyid),null,$customheaders)) - { - - // Put date into remindersent - $today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust); - $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" - ."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}"; - // - $uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens
        $udequery
        ".$connect->ErrorMsg()); - //orig: $tokenoutput .= "({$emrow['tid']})[".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]
        \n"; - $tokenoutput .= "({$emrow['tid']}) [".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} ($to)]
        \n"; - } - else - { - $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
        ", $fieldsarray); - if ($debug>0) - { - $tokenoutput .= "
        Subject : $msgsubject

        ".htmlspecialchars($maildebugbody)."
        "; - } - - } - $lasttid = $emrow['tid']; - } - $oMail->SmtpClose(); - if ($ctcount > $emcount) - { - $lefttosend = $ctcount-$maxemails; - $tokenoutput .= "
        \n" - ."".$clang->gT("Warning")."

        \n" - .$clang->gT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below.")."

        \n" - .str_replace("{EMAILCOUNT}", $lefttosend, $clang->gT("There are {EMAILCOUNT} emails still to be sent.")) - ."
        \n" - ."\n" - ."
        \n"; - } - else - { - $tokenoutput .= "
        ".$clang->gT("Warning")."
        \n" - .$clang->gT("There were no eligible emails to send. This will be because none satisfied the criteria of:")."\n" - ."
         
        • ".$clang->gT("having a valid email address")."
        • " - ."
        • ".$clang->gT("not having been sent an invitation already")."
        • " - ."
        • ".$clang->gT("but not having already completed the survey")."
        • " - ."

        \n"; + $tokenoutput .= '
        '.$clang->gT("The tokens table has now been removed and tokens are no longer required to access this survey.")."
        ".$clang->gT("A backup of this table has been made and can be accessed by your system administrator.")."
        \n" + ."(\"{$dbprefix}old_tokens_{$surveyid}_$date\")"."

        \n" + ."\n"; } $tokenoutput .= "
        \n"; } -} -if ($subaction == "tokenify" && bHasSurveyPermission($surveyid, 'tokens', 'update')) -{ - $tokenoutput .= "
        ".$clang->gT("Create tokens")."
        \n"; - $tokenoutput .= "
        \n"; - if (!isset($_POST['ok']) || !$_POST['ok']) + + if ($subaction == "email" && bHasSurveyPermission($surveyid, 'tokens','update')) { - $tokenoutput .= "".$clang->gT("Clicking yes will generate tokens for all those in this token list that have not been issued one. Is this OK?")."

        \n" - ."\n" - .$clang->gT("Yes")."' onclick=\"".get2post("$scriptname?action=tokens&sid=$surveyid&subaction=tokenify&ok=Y")."\" />\n" - ."\n" - ."
        \n"; + if (getEmailFormat($surveyid) == 'html') + { + $ishtml=true; + } + else + { + $ishtml=false; + } + + $tokenoutput .= PrepareEditorScript(); + $tokenoutput .= "\t
        " + .$clang->gT("Send email invitations")."
        \n" + ."\t

        \n"; // Wrapping Div + if (!isset($_POST['ok']) || !$_POST['ok']) + { + if ($thissurvey['active']!='Y') + { + $tokenoutput .="
        ".$clang->gT('Warning!')."
        ".$clang->gT("This survey is not yet activated and so your participants won't be able to fill out the survey.")."
        "; + } + $tokenoutput .= "\n
        \n" // Tabs Div + . "\n"; + $tokenoutput .= "
        "; // Form + + + foreach ($surveylangs as $language) + { + //GET SURVEY DETAILS + $thissurvey=getSurveyInfo($surveyid,$language); + $bplang = new limesurvey_lang($language); + + if ($ishtml===true) + { + $aDefaultTexts=aTemplateDefaultTexts($bplang); + } + else + { + $aDefaultTexts=aTemplateDefaultTexts($bplang,'unescaped'); + } + if (!$thissurvey['email_invite']) + { + if ($ishtml===true) + { + $thissurvey['email_invite']=html_escape($aDefaultTexts['invitation']); + } + else + { + $thissurvey['email_invite']=$aDefaultTexts['invitation']; + } + } + if (!$thissurvey['email_invite_subj']) + { + $thissurvey['email_invite_subj']=$aDefaultTexts['invitation_subject']; + } + $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; + $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; + $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; + $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; + $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; + + $subject=Replacefields($thissurvey['email_invite_subj'], $fieldsarray,false); + $textarea=Replacefields($thissurvey['email_invite'], $fieldsarray,false); + if ($ishtml!==true){$textarea=str_replace(array('',''),array(''),$textarea);} + $tokenoutput .= '
        '."\n"; // Language Tab Div + + $tokenoutput .= "\t
          \n" + ."
        • \n" + ."\" />
        • \n" + + ."
        • \n" + ."
        • \n" + + ."
        • \n" + ."\n" + . getEditor("email-inv","message_$language","[".$clang->gT("Invitation email:", "js")."](".$language.")",$surveyid,'','',$action) + ."
        • \n" + ."\t
        \n"; // End Language Tab Div + + } + //$tokenoutput .= "
        "; // TIBO: commenting this unexpected end div + /* + if (isset($tokenid)) + { + $tokenoutput .= "
      • ".$tokenid + ."
      • "; + } + if (isset($tokenids) && count($tokenids) > 0) + { + $tokenoutput .= "
      • ".implode(", ", $tokenids) + ."
      • "; + } else { + $tokenoutput .= "
      • " + .$clang->gT("All tokens who have not yet been sent an invitation") + ."
      • "; + } + */ + $tokenoutput .="\t

        \n" + ."\t

        \n" + ."\t\n" + ."\t\n" + ."\t\n" + ."\t\n"; + if (isset($tokenid)) {$tokenoutput .= "\t\n";} + if (isset($tokenids)) {$tokenoutput .= "\n\n";} + $tokenoutput .= "

        \n"; + + } + else + { + $tokenoutput .= "
        \n" + ."\t
        \n"; + $tokenoutput .= $clang->gT("Sending invitations..."); + $tokenoutput .= "\n\t
        \n"; + if (isset($tokenid)) {$tokenoutput .= " (".$clang->gT("Sending to Token ID").": {$tokenid})";} + if (isset($tokenids)) {$tokenoutput .= " (".$clang->gT("Sending to Token IDs").": ".implode(", ", $tokenids).")";} + $tokenoutput .= "
        \n"; + + if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') + { + $SQLemailstatuscondition = " AND emailstatus = 'OK'"; + } + else + { + $SQLemailstatuscondition = " AND emailstatus <> 'OptOut'"; + } + + $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' $SQLemailstatuscondition"; + + if (isset($tokenid)) {$ctquery .= " AND tid='{$tokenid}'";} + if (isset($tokenids)) {$ctquery .= " AND tid IN ('".implode("', '", $tokenids)."')";} + $tokenoutput .= "\n"; + $ctresult = $connect->Execute($ctquery) or safe_die("Database error!
        \n" . $connect->ErrorMsg()); + $ctcount = $ctresult->RecordCount(); + $ctfieldcount = $ctresult->FieldCount(); + + $emquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE ((completed ='N') or (completed='')) AND ((sent ='N') or (sent='')) AND token !='' AND email != '' $SQLemailstatuscondition"; + + if (isset($tokenid)) {$emquery .= " and tid='{$tokenid}'";} + if (isset($tokenids)) {$emquery .= " AND tid IN ('".implode("', '", $tokenids)."')";} + $tokenoutput .= "\n\n\n\n"; + $emresult = db_select_limit_assoc($emquery,$maxemails) or safe_die ("Couldn't do query.
        \n$emquery
        \n".$connect->ErrorMsg()); + $emcount = $emresult->RecordCount(); + + $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselanguage = GetBaseLanguageFromSurveyID($surveyid); + array_unshift($surveylangs,$baselanguage); + + foreach ($surveylangs as $language) + { + $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); + $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); + if ($ishtml) $_POST['message_'.$language] = html_entity_decode($_POST['message_'.$language], ENT_QUOTES, $emailcharset); + } + + + $attributes=GetTokenFieldsAndNames($surveyid); + if ($emcount > 0) + { + $tokenoutput .= "
          \n"; + $oMail = new PHPMailer; + while ($emrow = $emresult->FetchRow()) + { + unset($fieldsarray); + $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']; + $fieldsarray["{TOKEN}"]=$emrow['token']; + $fieldsarray["{LANGUAGE}"]=$emrow['language']; + $fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$surveyid; + $fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"]; + + foreach ($attributes as $attributefield=>$attributedescription) + { + $fieldsarray['{'.strtoupper($attributefield).'}']=$emrow[$attributefield]; + $fieldsarray['{TOKEN:'.strtoupper($attributefield).'}']=$emrow[$attributefield]; + } + + $emrow['language']=trim($emrow['language']); + if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not given use default + $found = array_search($emrow['language'], $surveylangs); + if ($found==false) {$emrow['language']=$baselanguage;} + + $from = $_POST['from_'.$emrow['language']]; + + if ($ishtml === false) + { + $fieldsarray["{OPTOUTURL}"]="$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + $barebone_link=$fieldsarray["{SURVEYURL}"]; + } + else + { + $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + $barebone_link=$fieldsarray["{SURVEYURL}"]; + } + } + else + { + $fieldsarray["{OPTOUTURL}"]="".htmlspecialchars("$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; + $barebone_link="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + } + else + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + $barebone_link="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + } + } + $customheaders = array( '1' => "X-surveyid: ".$surveyid, + '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]); + + $modsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); + $modmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); + + $modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject); + $modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage); + + if (trim($emrow['validfrom'])!='' && convertDateTimeFormat($emrow['validfrom'],'Y-m-d H:i:s','U')*1>date('U')*1) + { + $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.")."
          ", $fieldsarray); + } + elseif (trim($emrow['validuntil'])!='' && convertDateTimeFormat($emrow['validuntil'],'Y-m-d H:i:s','U')*1gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.")."
          ", $fieldsarray); + } + elseif (SendEmailMessage($oMail, $modmessage, $modsubject, $to , $from, $sitename, $ishtml, getBounceEmail($surveyid),null,$customheaders)) + { + // Put date into sent + $today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust); + $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" + ."SET sent='$today' WHERE tid={$emrow['tid']}"; + // + $uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens
          $udequery
          ".$connect->ErrorMsg()); + $tokenoutput .= $clang->gT("Invitation sent to:")." {$emrow['firstname']} {$emrow['lastname']} (".htmlspecialchars(implode(',',$to)).")
          \n"; + if ($emailsmtpdebug==2) + { + $tokenoutput .=$maildebug; + } + } + else + { + unset($oMail); + $oMail = new PHPMailer; + $tokenoutput .= '
        • '.ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
          ", $fieldsarray).'
        • '; + if ($debug>0) + { + $tokenoutput .= "
          Subject : $modsubject

          ".htmlspecialchars($maildebugbody)."
          "; + } + } + } + if ($ctcount > $emcount) + { + $i = 0; + if (isset($tokenids)) + { + while($i < $maxemails) + { array_shift($tokenids); $i++; } + $tids = '|'.implode('|',$tokenids); + } + $lefttosend = $ctcount-$maxemails; + $tokenoutput .= "
        \n" + ."
        ".$clang->gT("Warning")."

        \n" + ."
        " + .$clang->gT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below.")."

        \n"; + $tokenoutput .= str_replace("{EMAILCOUNT}", "$lefttosend", $clang->gT("There are {EMAILCOUNT} emails still to be sent.")); + $tokenoutput .= "

        \n"; + $tokenoutput .= "\n" + ."\n" + ."\n" + ."\n" + ."\n" + ."\n"; + if (isset($tokenids)) + { + $tokenoutput .= "\n"; + } + foreach ($surveylangs as $language) + { + $message = html_escape($_POST['message_'.$language]); + $subject = html_escape($_POST['subject_'.$language]); + $tokenoutput .="\n" + ."\n" + ."\n"; + } + $tokenoutput .="
        \n"; + } + $oMail->SmtpClose(); + } + else + { + $tokenoutput .= "
        ".$clang->gT("Warning")."
        \n".$clang->gT("There were no eligible emails to send. This will be because none satisfied the criteria of:") + ."
         
        • ".$clang->gT("having a valid email address")."
        • " + ."
        • ".$clang->gT("not having been sent an invitation already")."
        • " + ."
        • ".$clang->gT("having already completed the survey")."
        • " + ."
        • ".$clang->gT("having a token")."
        "; + } + } + //$tokenoutput .= "
        \n
        \n"; + $tokenoutput .= "
        \n"; // TIBO only close on div, cause dialog-modal will cklose wrapper } - else + + if ($subaction == "remind" && bHasSurveyPermission($surveyid, 'tokens','update')) + { + $tokenoutput .= PrepareEditorScript(); + $tokenoutput .= "\t
        " + .$clang->gT("Send email reminder")."

        \n"; + if (!isset($_POST['ok']) || !$_POST['ok']) + { + if ($thissurvey['active']!='Y') + { + $tokenoutput .="
        ".$clang->gT('Warning!')."
        ".$clang->gT("This survey is not yet activated and so your participants won't be able to fill out the survey.")."
        "; + } + //GET SURVEY DETAILS + $tokenoutput .= "
        "; + $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselang = GetBaseLanguageFromSurveyID($surveyid); + array_unshift($surveylangs,$baselang); + + $tokenoutput .= "
        "; + foreach ($surveylangs as $language) + { + //GET SURVEY DETAILS + $thissurvey=getSurveyInfo($surveyid,$language); + if (!$thissurvey['email_remind']) {$thissurvey['email_remind']=str_replace("\n", "\r\n", $clang->gT("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\"{SURVEYNAME}\"\n\n\"{SURVEYDESCRIPTION}\"\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}")."\n\n".$clang->gT("If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:\n{OPTOUTURL}"));} + $tokenoutput .= '

        '.getLanguageNameFromCode($language,false); + if ($language==$baselang) + { + $tokenoutput .= "(".$clang->gT("Base language").")"; + } + $tokenoutput .= "

          \n" + ."
        • \n" + ."\" />
        • \n" + + ."
        • \n"; + + $fieldsarray["{ADMINNAME}"]= $thissurvey['adminname']; + $fieldsarray["{ADMINEMAIL}"]=$thissurvey['adminemail']; + $fieldsarray["{SURVEYNAME}"]=$thissurvey['name']; + $fieldsarray["{SURVEYDESCRIPTION}"]=$thissurvey['description']; + $fieldsarray["{EXPIRY}"]=$thissurvey["expiry"]; + + $subject=Replacefields($thissurvey['email_remind_subj'], $fieldsarray, false); + $textarea=Replacefields($thissurvey['email_remind'], $fieldsarray, false); + if ($ishtml!==true){$textarea=str_replace(array('',''),array(''),$textarea);} + + $tokenoutput .= "
        • \n"; + + $tokenoutput .= "\t
        • \n" + ."\n" + ."\n" + . getEditor("email-rem","message_$language","[".$clang->gT("Reminder Email:", "js")."](".$language.")",$surveyid,'','',$action) + ."
        • \n" + ."
        "; + } + + $tokenoutput .= "
          \n"; + + if (isset($tokenids)) { + $tokenoutput .= "\t
        • \n" + . "\n" + . implode(", ", $tokenids)."
        • \n"; + } elseif (!isset($tokenid)) { + $tokenoutput .= "
        • " + .$clang->gT("All token entries to whom a reminder email would apply") + ."
        • "; + $tokenoutput .= "\t
        • \n" + ."\n" + ."\n" + ."\t
        • \n"; + } elseif (isset($tokenid)) { + $tokenoutput .= "\t
        • \n" + ."\n" + ."{$tokenid}
        • \n"; + } + $tokenoutput .="
        • \n" + ."
        • \n" + . "
        • \n" + ."
        • \n" + + . "
        • \n" + . "
        • \n" + . "

        \n" + ."\n" + ."\t\n" + ."\t\n" + ."\t\n"; + if (isset($tokenid)) {$tokenoutput .= "\t\n";} + if (isset($tokenids)) {$tokenoutput .= "\n\n";} + $tokenoutput .= "

        \n"; + } + else + { + + $tokenoutput .= "
        \n" + . "
        "; + $tokenoutput .= $clang->gT("Sending Reminders") + ."

        \n"; + + $surveylangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $baselanguage = GetBaseLanguageFromSurveyID($surveyid); + array_unshift($surveylangs,$baselanguage); + + foreach ($surveylangs as $language) + { + $_POST['message_'.$language]=auto_unescape($_POST['message_'.$language]); + $_POST['subject_'.$language]=auto_unescape($_POST['subject_'.$language]); + + } + + if (isset($starttokenid)) {$tokenoutput .= " (".$clang->gT("From Token ID").": {$starttokenid})";} + if (isset($tokenid)) {$tokenoutput .= " (".$clang->gT("Sending to Token ID").": {$tokenid})";} + if (isset($tokenids)) {$tokenoutput .= " (".$clang->gT("Sending to Token IDs").": ".implode("|", $tokenids).")";} + + if (isset($_POST['bypassbademails']) && $_POST['bypassbademails'] == 'Y') + { + $SQLemailstatuscondition = " AND emailstatus = 'OK'"; + } + else + { + $SQLemailstatuscondition = " AND emailstatus <> 'OptOut'"; + } + + if (isset($_POST['maxremindercount']) && + $_POST['maxremindercount'] != '' && + intval($_POST['maxremindercount']) != 0) + { + $SQLremindercountcondition = " AND remindercount < ".intval($_POST['maxremindercount']); + } + else + { + $SQLremindercountcondition = ""; + } + + if (isset($_POST['minreminderdelay']) && + $_POST['minreminderdelay'] != '' && + intval($_POST['minreminderdelay']) != 0) + { + // $_POST['minreminderdelay'] in days (86400 seconds per day) + $compareddate = date_shift( + date("Y-m-d H:i:s",time() - 86400 * intval($_POST['minreminderdelay'])), + "Y-m-d H:i", + $timeadjust); + $SQLreminderdelaycondition = " AND ( " + . " (remindersent = 'N' AND sent < '".$compareddate."') " + . " OR " + . " (remindersent < '".$compareddate."'))"; + } + else + { + $SQLreminderdelaycondition = ""; + } + + $ctquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed ='N' or completed ='') AND sent<>'' AND sent<>'N' AND token <>'' AND email <> '' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; + + if (isset($starttokenid)) {$ctquery .= " AND tid > '{$starttokenid}'";} + if (isset($tokenid) && $tokenid) {$ctquery .= " AND tid = '{$tokenid}'";} + if (isset($tokenids)) {$ctquery .= " AND tid IN (".implode(", ", $tokenids).")";} + $tokenoutput .= "\n"; + $ctresult = $connect->Execute($ctquery) or safe_die ("Database error!
        \n" . $connect->ErrorMsg()); + $ctcount = $ctresult->RecordCount(); + $ctfieldcount = $ctresult->FieldCount(); + $emquery = "SELECT * FROM ".db_table_name("tokens_{$surveyid}")." WHERE (completed = 'N' or completed = '') AND sent <> 'N' and sent <>'' AND token <>'' AND EMAIL <>'' $SQLemailstatuscondition $SQLremindercountcondition $SQLreminderdelaycondition"; + + if (isset($starttokenid)) {$emquery .= " AND tid > '{$starttokenid}'";} + if (isset($tokenid) && $tokenid) {$emquery .= " AND tid = '{$tokenid}'";} + if (isset($tokenids)) {$emquery .= " AND tid IN (".implode(", ", $tokenids).")";} + $emquery .= " ORDER BY tid "; + $emresult = db_select_limit_assoc($emquery, $maxemails) or safe_die ("Couldn't do query.
        $emquery
        ".$connect->ErrorMsg()); + $emcount = $emresult->RecordCount(); + + + $attributes=GetTokenFieldsAndNames($surveyid); + if ($emcount > 0) + { + $tokenoutput .= "\n" + ."\t\n" + ."\n" + ."\t\n" + ."\t" + ."\n" + ."\t\n" + ."\t\n" + ."\t\n" + ."\t\n" + ."\t\n"; + //Include values for constraints minreminderdelay and maxremindercount if they exist + if (isset($_POST['minreminderdelay']) && + $_POST['minreminderdelay'] != '' && + intval($_POST['minreminderdelay']) != 0) + { + $tokenoutput .= "\t\n"; + } + if (isset($_POST['maxremindercount']) && + $_POST['maxremindercount'] != '' && + intval($_POST['maxremindercount']) != 0) + { + $tokenoutput .= "\t\n"; + } + // + foreach ($surveylangs as $language) + { + $message = html_escape($_POST['message_'.$language]); + $tokenoutput .="\n" + ."\n" + ."\n"; + } + $tokenoutput.="\t\n" + ."\t\n"; + } + $tokenoutput .= "\t\n" + ."
        \n"; + $oMail = new PHPMailer; + while ($emrow = $emresult->FetchRow()) + { + unset($fieldsarray); + $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']; + $fieldsarray["{TOKEN}"]=$emrow['token']; + $fieldsarray["{LANGUAGE}"]=$emrow['language']; + $fieldsarray["{SID}"]=$fieldsarray["{SURVEYID}"]=$surveyid; + $fieldsarray["{SURVEYNAME}"]=$thissurvey["surveyls_title"]; + + foreach ($attributes as $attributefield=>$attributedescription) + { + $fieldsarray['{'.strtoupper($attributefield).'}']=$emrow[$attributefield]; + $fieldsarray['{TOKEN:'.strtoupper($attributefield).'}']=$emrow[$attributefield]; + } + + $emrow['language']=trim($emrow['language']); + if ($emrow['language']=='') {$emrow['language']=$baselanguage;} //if language is not give use default + $found = array_search($emrow['language'], $surveylangs); + if ($found==false) {$emrow['language']=$baselanguage;} + + $from = $_POST['from_'.$emrow['language']]; + + if (getEmailFormat($surveyid) == 'html') + { + $ishtml=true; + } + else + { + $ishtml=false; + } + + if ($ishtml == false) + { + $fieldsarray["{OPTOUTURL}"]="$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + $barebone_link=$fieldsarray["{SURVEYURL}"]; + } + else + { + $fieldsarray["{SURVEYURL}"]="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + $barebone_link=$fieldsarray["{SURVEYURL}"]; + } + } + else + { + $fieldsarray["{OPTOUTURL}"]="".htmlspecialchars("$publicurl/optout.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + if ( $modrewrite ) + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}").""; + $barebone_link="$publicurl/$surveyid/lang-".trim($emrow['language'])."/tk-{$emrow['token']}"; + } + else + { + $fieldsarray["{SURVEYURL}"]="".htmlspecialchars("$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}").""; + $barebone_link="$publicurl/index.php?lang=".trim($emrow['language'])."&sid=$surveyid&token={$emrow['token']}"; + $_POST['message_'.$emrow['language']] = html_entity_decode($_POST['message_'.$emrow['language']], ENT_QUOTES, $emailcharset); + } + } + + $msgsubject=Replacefields($_POST['subject_'.$emrow['language']], $fieldsarray); + $sendmessage=Replacefields($_POST['message_'.$emrow['language']], $fieldsarray); + + $msgsubject = str_replace("@@SURVEYURL@@", $barebone_link, $msgsubject); + $sendmessage = str_replace("@@SURVEYURL@@", $barebone_link, $sendmessage); + + $customheaders = array( '1' => "X-surveyid: ".$surveyid, + '2' => "X-tokenid: ".$fieldsarray["{TOKEN}"]); + + if (trim($emrow['validfrom'])!='' && convertDateTimeFormat($emrow['validfrom'],'Y-m-d H:i:s','U')*1>date('U')*1) + { + $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) delayed: Token is not yet valid.")."
        ", $fieldsarray); + } + elseif (trim($emrow['validuntil'])!='' && convertDateTimeFormat($emrow['validuntil'],'Y-m-d H:i:s','U')*1gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) skipped: Token is not valid anymore.")."
        ", $fieldsarray); + } + elseif (SendEmailMessage($oMail, $sendmessage, $msgsubject, $to, $from, $sitename,$ishtml,getBounceEmail($surveyid),null,$customheaders)) + { + + // Put date into remindersent + $today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust); + $udequery = "UPDATE ".db_table_name("tokens_{$surveyid}")."\n" + ."SET remindersent='$today',remindercount = remindercount+1 WHERE tid={$emrow['tid']}"; + // + $uderesult = $connect->Execute($udequery) or safe_die ("Could not update tokens
        $udequery
        ".$connect->ErrorMsg()); + //orig: $tokenoutput .= "({$emrow['tid']})[".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']}]
        \n"; + $tokenoutput .= "({$emrow['tid']}) [".$clang->gT("Reminder sent to:")." {$emrow['firstname']} {$emrow['lastname']} (".htmlspecialchars($to[0]).")]
        \n"; + } + else + { + unset($oMail); + $oMail = new PHPMailer; + $tokenoutput .= $emrow['tid'] ." ".ReplaceFields($clang->gT("Email to {FIRSTNAME} {LASTNAME} ({EMAIL}) failed. Error Message:")." ".$maildebug."
        ", $fieldsarray); + if ($debug>0) + { + $tokenoutput .= "
        Subject : $msgsubject

        ".htmlspecialchars($maildebugbody)."
        "; + } + + } + $lasttid = $emrow['tid']; + } + $oMail->SmtpClose(); + if ($ctcount > $emcount) + { + $lefttosend = $ctcount-$maxemails; + $tokenoutput .= "
        \n" + ."".$clang->gT("Warning")."

        \n" + .$clang->gT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below.")."

        \n" + .str_replace("{EMAILCOUNT}", $lefttosend, $clang->gT("There are {EMAILCOUNT} emails still to be sent.")) + ."
        \n" + ."\n" + ."
        \n"; + } + else + { + $tokenoutput .= "
        ".$clang->gT("Warning")."
        \n" + .$clang->gT("There were no eligible emails to send. This will be because none satisfied the criteria of:")."\n" + ."
         
        • ".$clang->gT("having a valid email address")."
        • " + ."
        • ".$clang->gT("having a token")."
        • " + ."
        • ".$clang->gT("not having been sent an invitation already")."
        • " + ."
        • ".$clang->gT("but not having already completed the survey")."
        • " + ."

        \n"; + } + $tokenoutput .= "
        \n"; + } + } + + if ($subaction == "tokenify" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $tokenoutput .= "
        ".$clang->gT("Create tokens")."
        \n"; + $tokenoutput .= "
        \n"; + if (!isset($_POST['ok']) || !$_POST['ok']) + { + $tokenoutput .= "".$clang->gT("Clicking yes will generate tokens for all those in this token list that have not been issued one. Is this OK?")."

        \n" + ."\n" + .$clang->gT("Yes")."' onclick=\"".get2post("$scriptname?action=tokens&sid=$surveyid&subaction=tokenify&ok=Y")."\" />\n" + ."\n" + ."
        \n"; + } + else + { + //get token length from survey settings + $tlquery = "SELECT tokenlength FROM ".db_table_name("surveys")." WHERE sid=$surveyid"; + $tlresult = db_execute_assoc($tlquery); + while ($tlrow = $tlresult->FetchRow()) + { + $tokenlength = $tlrow['tokenlength']; + } + + //if tokenlength is not set or there are other problems use the default value (15) + if(!isset($tokenlength) || $tokenlength == '') + { + $tokenlength = 15; + } + // select all existing tokens + $ntquery = "SELECT token FROM ".db_table_name("tokens_$surveyid")." group by token"; + $ntresult = db_execute_assoc($ntquery); + while ($tkrow = $ntresult->FetchRow()) + { + $existingtokens[$tkrow['token']]=true; + } + $newtokencount = 0; + $invalidtokencount=0; + $tkquery = "SELECT tid FROM ".db_table_name("tokens_$surveyid")." WHERE token IS NULL OR token=''"; + $tkresult = db_execute_assoc($tkquery) or safe_die ("Mucked up!
        $tkquery
        ".$connect->ErrorMsg()); + while (($tkrow = $tkresult->FetchRow()) && $invalidtokencount<50) + { + $isvalidtoken = false; + while ($isvalidtoken == false && $invalidtokencount<50) + { + $newtoken = sRandomChars($tokenlength); + if (!isset($existingtokens[$newtoken])) { + $isvalidtoken = true; + $existingtokens[$newtoken]=true; + $invalidtokencount=0; + } + else + { + $invalidtokencount ++; + } + } + if(!$invalidtokencount) + { + $itquery = "UPDATE ".db_table_name("tokens_$surveyid")." SET token='$newtoken' WHERE tid={$tkrow['tid']}"; + $itresult = $connect->Execute($itquery); + $newtokencount++; + } + } + if(!$invalidtokencount){ + $tokenoutput .= "
        ".sprintf($clang->gT("%s tokens have been created."),$newtokencount)."
        \n"; + }else{ + $tokenoutput .= "\t\t
        ".$clang->gT("Error")."
        \n" + ."\t\t

        ".sprintf($clang->gT("Only %s new tokens were added after %s trials."),$newtokencount,$invalidtokencount)."\n" + ."\t\t".$clang->gT("Try with a bigger token length.")."

        \n"; + } + } + $tokenoutput .= "
        \n"; + } + + if ($subaction == "delete" && bHasSurveyPermission($surveyid, 'tokens','delete')) + { + $tokenoutput .= "
        \n" + ."\t
        " + .$clang->gT("Delete") + ."\t
        \n" + ."\t


        "; + if(isset($tokenids) && count($tokenids)>0) { + if(implode(", ", $tokenids) != "") { + $dlquery = "DELETE FROM ".db_table_name("tokens_$surveyid")." WHERE tid IN (".implode(", ", $tokenids).")"; + $dlresult = $connect->Execute($dlquery) or safe_die ("Couldn't delete record {$tokenid}
        ".$connect->ErrorMsg()."\n\n$dlquery"); + $tokenoutput .= $clang->gT("Marked tokens have been deleted."); + } else { + $tokenoutput .= $clang->gT("No tokens were selected for deletion"); + } + } elseif (isset($tokenid)) { + $dlquery = "DELETE FROM ".db_table_name("tokens_$surveyid")." WHERE tid={$tokenid}"; + $dlresult = $connect->Execute($dlquery) or safe_die ("Couldn't delete record {$tokenid}
        ".$connect->ErrorMsg()); + $tokenoutput .= $clang->gT("Token has been deleted."); + } + $tokenoutput .= "

        ".$clang->gT("Reloading Screen. Please wait.")."

        \n" + ."

        \n
        \n"; + } + + if ($subaction == "managetokenattributes" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $tokenoutput .= "
        ".$clang->gT("Manage token attribute fields")."
        \n"; + $tokenfields=GetTokenFieldsAndNames($surveyid,true); + $nrofattributes=0; + $tokenoutput.='
        ' + .""; + + $exampledataquery = "SELECT * FROM ".db_table_name("tokens_$surveyid"); + $exampledata = db_select_limit_assoc($exampledataquery,1) or safe_die ("Could not get example data!
        $exampledataquery
        ".$connect->ErrorMsg()); + $examplerow = $exampledata->FetchRow(); + + + foreach ($tokenfields as $tokenfield=>$tokendescription) + { + $nrofattributes++; + $tokenoutput.=""; + } + $tokenoutput.="
        ".$clang->gT("Attribute field")."".$clang->gT("Field description")."".$clang->gT("Example data")."
        $tokenfield"; + if ($examplerow!==false) + { + $tokenoutput.=htmlspecialchars($examplerow[$tokenfield]); + } + else + { + $tokenoutput.=$clang->gT(''); + } + $tokenoutput.="

        " + .'' + ."\n" + ."\n" + ."

        \n" + .'


        '; + + $tokenoutput .= "
        ".$clang->gT("Add token attributes")."

        \n"; + + $tokenoutput .=sprintf($clang->gT('There are %s user attribute fields in this token table'),$nrofattributes).'

        ' + .'
        ' + .'

        ' + .'' + .'' + .'

        ' + .'

        ' + .'' + ."" + ."" + ."" + ."

        " + .'
        ' + .'

        '; + } + + if ($subaction == "updatetokenattributedescriptions" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + // find out the existing token attribute fieldnames + $tokenattributefieldnames=GetAttributeFieldNames($surveyid); + $fieldcontents=''; + foreach ($tokenattributefieldnames as $fieldname) + { + $fieldcontents.=$fieldname.'='.strip_tags($_POST['description_'.$fieldname])."\n"; + } + $updatequery = "update ".db_table_name('surveys').' set attributedescriptions='.db_quoteall($fieldcontents,true)." where sid=$surveyid"; + $execresult=db_execute_assoc($updatequery); + + $tokenoutput .= "\t
        ".$clang->gT("Update token attribute descriptions")."
        \n" + ."\t
        "; + if ($execresult===false) + { + $tokenoutput.="\t\t
        ".$clang->gT("Updating token attribute descriptions failed:")."".htmlspecialchars($connect->ErrorMsg())."
        " + ."\t\t
        \n"; + } + else + { + $tokenoutput.="\t\t
        ".$clang->gT("Token attribute descriptions were successfully updated.")."
        " + ."\t\t
        \n"; + } + $tokenoutput .= "\t
        "; + } + $tokenoutput .= "
        "; + if ($subaction == "updatetokenattributes" && bHasSurveyPermission($surveyid, 'tokens', 'update')) + { + $number2add=sanitize_int($_POST['addnumber'],1,100); + // find out the existing token attribute fieldnames + $tokenfieldnames = array_values($connect->MetaColumnNames("{$dbprefix}tokens_$surveyid", true)); + $tokenattributefieldnames=array_filter($tokenfieldnames,'filterforattributes'); + $i=1; + for ($b=0;$b<$number2add;$b++) + { + while (in_array('attribute_'.$i,$tokenattributefieldnames)!==false) { + $i++; + } + $tokenattributefieldnames[]='attribute_'.$i; + $fields[]=array('attribute_'.$i,'C','255'); + } + $dict = NewDataDictionary($connect); + $sqlarray = $dict->ChangeTableSQL("{$dbprefix}tokens_$surveyid", $fields); + $execresult=$dict->ExecuteSQLArray($sqlarray, false); + + $tokenoutput .= "\t
        ".$clang->gT("Update token attributes")."
        \n" + ."\t
        "; + if ($execresult==0) + { + $tokenoutput.="\t\t
        ".$clang->gT("Adding attribute fields failed:")."".htmlspecialchars($connect->ErrorMsg())."
        " + ."\t\t
        \n"; + } + else + { + $tokenoutput.="\t\t
        ".sprintf($clang->gT("%s field(s) were successfully added."),$number2add)."
        " + ."\t\t
        \n"; + } + $tokenoutput .= "\t
        "; + + LimeExpressionManager::SetDirtyFlag(); // so that knows that token tables have changed + } + + + if (($subaction == "edit" && bHasSurveyPermission($surveyid, 'tokens','update')) || + ($subaction == "addnew" && bHasSurveyPermission($surveyid, 'tokens','create'))) + { + if ($subaction == "edit") + { + $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid")." WHERE tid={$tokenid}"; + $edresult = db_execute_assoc($edquery); + $edfieldcount = $edresult->FieldCount(); + while($edrow = $edresult->FetchRow()) + { + //Create variables with the same names as the database column names and fill in the value + foreach ($edrow as $Key=>$Value) {$$Key = $Value;} + } + } + if ($subaction != "edit") + { + $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid"); + $edresult = db_select_limit_assoc($edquery, 1); + $edfieldcount = $edresult->FieldCount(); + } + + $tokenoutput .= "
        "; + if ($subaction == "edit") + { + $tokenoutput .=$clang->gT("Edit token entry"); + } + else + { + $tokenoutput .=$clang->gT("Add token entry"); + } + + $tokenoutput .="
        " + ."
        \n" + ."
          \n" + ."\t
        • \n"; + if ($subaction == "edit") + {$tokenoutput .=$tokenid;} else {$tokenoutput .=$clang->gT("Auto");} + $tokenoutput .= "
        • \n" + ."
        • \n" + ."
        • \n" + ."
        • \n" + ."
        • \n" + ."\t
        • \n" + ."\t
        • \n" + ."
        • \n" + ."
        • \n" + ."
        • \n" + ."\n"; + if ($subaction == "addnew") + { + $tokenoutput .= "".$clang->gT("You can leave this blank, and automatically generate tokens using 'Generate Tokens'")."\n"; + } + $tokenoutput .= "\t
        • \n" + ."
        • \n"; + if (isset($language)) {$tokenoutput .= languageDropdownClean($surveyid,$language);} + else { + $tokenoutput .= languageDropdownClean($surveyid,GetBaseLanguageFromSurveyID($surveyid)); + } + $tokenoutput .= "
        • \n" + + ."\t
        • \n" + ."\t
        • \n" + + ."\t
        • \n" + ."\t
        • \n"; + + if ($subaction == "edit") + { + $tokenoutput.="\t
        • \n" + ."\t
        • \n"; + } + + $tokenoutput.="\t
        • \n" + ."\t
        • \n" + + ."\t
        • \n" + ."\t
        • \n" + + ."\t
        • \n" + ."\tconvert($dateformatdetails['phpdate'].' H:i'); + } + $tokenoutput .= "\" />\n convert($dateformatdetails['phpdate'].' H:i'); + } + $tokenoutput .= "\" /> ".sprintf($clang->gT('Format: %s'),$dateformatdetails['dateformat'].' '.$clang->gT('hh:mm')).'' + ."
        • \n"; + + // now the attribute fieds + $attrfieldnames=GetTokenFieldsAndNames($surveyid,true); + foreach ($attrfieldnames as $attr_name=>$attr_description) + { + $tokenoutput .= "
        • " + ."\n" + ."\tgT("Update token entry")."' />\n" + ."\n" + ."\n"; + break; + case "addnew": + $tokenoutput .= "\n" + ."\n"; + break; + } + $tokenoutput .= "

          \n" + ."
        • \n"; + } + + if ($subaction == "adddummys" && bHasSurveyPermission($surveyid, 'tokens','create')) { //get token length from survey settings $tlquery = "SELECT tokenlength FROM ".db_table_name("surveys")." WHERE sid=$surveyid"; @@ -2086,1204 +2456,904 @@ if ($subaction == "tokenify" && bHasSurveyPermission($surveyid, 'tokens', 'updat $tokenlength = 15; } + $tokenoutput .= "
          "; + $tokenoutput .=$clang->gT("Create dummy tokens"); + $tokenoutput .="
          " + ."
          \n" + ."
            \n" + ."\t
          • \n"; + $tokenoutput .=$clang->gT("Auto"); + $tokenoutput .= "
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."
          • \n" + ."\t
          • \n" + ."\t
          • \n"; + $tokenoutput .= "\t\n" + ."
          • \n"; + $tokenoutput .= languageDropdownClean($surveyid,GetBaseLanguageFromSurveyID($surveyid)); + $tokenoutput .= "
          • \n" + ."\t
          • \n" + ."\t
          • \n" + ."\t
          • \n" + ."\tconvert($dateformatdetails['phpdate'].' H:i'); + } + $tokenoutput .= "\" />\n convert($dateformatdetails['phpdate'].' H:i'); + } + $tokenoutput .= "\" /> ".sprintf($clang->gT('Format: %s'),$dateformatdetails['dateformat'].' '.$clang->gT('hh:mm')).'' + ."
          • \n"; + + // now the attribute fieds + $attrfieldnames=GetTokenFieldsAndNames($surveyid,true); + foreach ($attrfieldnames as $attr_name=>$attr_description) + { + $tokenoutput .= "
          • " + ."\n" + ."\tgT("Add dummy tokens")."' />\n" + ."\n"; + $tokenoutput .= "

            \n" + ."
          • \n"; + } + + if ($subaction == "updatetoken" && bHasSurveyPermission($surveyid, 'tokens','update')) + { + $tokenoutput .= "\t
            ".$clang->gT("Edit token entry")."
            \n" + ."\t
            \n"; + if (trim($_POST['validfrom'])=='') { + $_POST['validfrom']=null; + } + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + $data = array(); + $data[] = $_POST['firstname']; + $data[] = $_POST['lastname']; + $data[] = sanitize_email($_POST['email']); + $data[] = $_POST['emailstatus']; + $santitizedtoken=sanitize_token($_POST['token']); + $data[] = $santitizedtoken; + $data[] = sanitize_languagecode($_POST['language']); + $data[] = $_POST['sent']; + $data[] = $_POST['completed']; + $data[] = $_POST['usesleft']; + // $db->DBTimeStamp("$year-$month-$day $hr:$min:$secs"); + $data[] = $_POST['validfrom']; + $data[] = $_POST['validuntil']; + $data[] = $_POST['remindersent']; + $data[] = intval($_POST['remindercount']); + + $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where tid<>{$tokenid} and token<>'' and token='{$santitizedtoken}'") or safe_die ("Update record {$tokenid} failed:
            \n$udquery
            \n".$connect->ErrorMsg()); + if ($udresult->RecordCount()==0) + { + $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where tid={$tokenid} and email='".sanitize_email($_POST['email'])."'") or safe_die ("Update record {$tokenid} failed:
            \n$udquery
            \n".$connect->ErrorMsg()); + + + // Using adodb Execute with blinding method so auto-dbquote is done + $udquery = "UPDATE ".db_table_name("tokens_$surveyid")." SET firstname=?, " + . "lastname=?, email=?, emailstatus=?, " + . "token=?, language=?, sent=?, completed=?, usesleft=?, validfrom=?, validuntil=?, remindersent=?, remindercount=?"; + $attrfieldnames=GetAttributeFieldnames($surveyid); + foreach ($attrfieldnames as $attr_name) + { + $udquery.= ", $attr_name=?"; + $data[].=$_POST[$attr_name]; + } + + $udquery .= " WHERE tid={$tokenid}"; + $udresult = $connect->Execute($udquery, $data) or safe_die ("Update record {$tokenid} failed:
            \n$udquery
            \n".$connect->ErrorMsg()); + $tokenoutput .= "\t\t
            ".$clang->gT("Success")."
            \n" + ."\t\t
            ".$clang->gT("The token entry was successfully updated.")."

            \n" + ."\t\t\n"; + } + else + { + $tokenoutput .= "\t\t
            ".$clang->gT("Failed")."
            \n" + ."\t\t
            ".$clang->gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries.")."

            \n" + ."\t\t\n"; + } + $tokenoutput .= "\t
            "; + } + + if ($subaction == "inserttoken" && (bHasSurveyPermission($surveyid, 'tokens','create'))) + { + //Fix up dates and match to database format + if (trim($_POST['validfrom'])=='') { + $_POST['validfrom']=null; + } + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + + $santitizedtoken=sanitize_token($_POST['token']); + + $tokenoutput .= "\t
            ".$clang->gT("Add token entry")."
            \n" + ."\t
            \n"; + $data = array('firstname' => $_POST['firstname'], + 'lastname' => $_POST['lastname'], + 'email' => sanitize_email($_POST['email']), + 'emailstatus' => $_POST['emailstatus'], + 'token' => $santitizedtoken, + 'language' => sanitize_languagecode($_POST['language']), + 'sent' => $_POST['sent'], + 'remindersent' => $_POST['remindersent'], + 'completed' => $_POST['completed'], + 'usesleft' => $_POST['usesleft'], + 'validfrom' => $_POST['validfrom'], + 'validuntil' => $_POST['validuntil']); + // add attributes + $attrfieldnames=GetAttributeFieldnames($surveyid); + foreach ($attrfieldnames as $attr_name) + { + $data[$attr_name]=$_POST[$attr_name]; + } + $tblInsert=db_table_name('tokens_'.$surveyid); + $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where token<>'' and token='{$santitizedtoken}'"); + if ($udresult->RecordCount()==0) + { + // AutoExecute + $inresult = $connect->AutoExecute($tblInsert, $data, 'INSERT') or safe_die ("Add new record failed:
            \n$inquery
            \n".$connect->ErrorMsg()); + $tokenoutput .= "\t\t
            ".$clang->gT("Success")."
            \n" + ."\t\t
            ".$clang->gT("New token was added.")."

            \n" + ."\t\t
            \n" + ."\t\t
            \n"; + } + else + { + $tokenoutput .= "\t\t
            ".$clang->gT("Failed")."
            \n" + ."\t\t
            ".$clang->gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries.")."

            \n" + ."\t\t
            \n" + ."\t\t
            \n"; + } + $tokenoutput .= "\t
            "; + } + + if ($subaction == "insertdummys" && (bHasSurveyPermission($surveyid, 'tokens','create'))) + { + //Fix up dates and match to database format + if (trim($_POST['validfrom'])=='') { + $_POST['validfrom']=null; + } + + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} + else + { + $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); + $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); + } + + $santitizedtoken=''; + + $tokenoutput .= "\t
            ".$clang->gT("Add dummy tokens")."
            \n" + ."\t
            \n"; + $data = array('firstname' => $_POST['firstname'], + 'lastname' => $_POST['lastname'], + 'email' => sanitize_email($_POST['email']), + 'emailstatus' => 'OK', + 'token' => $santitizedtoken, + 'language' => sanitize_languagecode($_POST['language']), + 'sent' => 'N', + 'remindersent' => 'N', + 'completed' => 'N', + 'usesleft' => $_POST['usesleft'], + 'validfrom' => $_POST['validfrom'], + 'validuntil' => $_POST['validuntil']); + + // add attributes + $attrfieldnames=GetAttributeFieldnames($surveyid); + foreach ($attrfieldnames as $attr_name) + { + $data[$attr_name]=$_POST[$attr_name]; + } + $tblInsert=db_table_name('tokens_'.$surveyid); + $amount = sanitize_int($_POST['amount']); + $tokenlength = sanitize_int($_POST['tokenlen']); + $invalidtokencount=0; + $newdummytoken = 0; // select all existing tokens $ntquery = "SELECT token FROM ".db_table_name("tokens_$surveyid")." group by token"; $ntresult = db_execute_assoc($ntquery); + $existingtokens=array(); while ($tkrow = $ntresult->FetchRow()) { - $existingtokens[$tkrow['token']]=null; + $existingtokens[$tkrow['token']]=true; } - $newtokencount = 0; - $tkquery = "SELECT tid FROM ".db_table_name("tokens_$surveyid")." WHERE token IS NULL OR token=''"; - $tkresult = db_execute_assoc($tkquery) or safe_die ("Mucked up!
            $tkquery
            ".$connect->ErrorMsg()); - while ($tkrow = $tkresult->FetchRow()) - { + $tblInsert=db_table_name('tokens_'.$surveyid); + $amount = sanitize_int($_POST['amount']); + $tokenlength = sanitize_int($_POST['tokenlen']); + $invalidtokencount=0; + $newdummytoken = 0; + while ($newdummytoken<$amount && $invalidtokencount<50){ + $dataToInsert = $data; + $dataToInsert['firstname'] = str_replace('{TOKEN_COUNTER}',"$newdummytoken",$dataToInsert['firstname']); + $dataToInsert['lastname'] = str_replace('{TOKEN_COUNTER}',"$newdummytoken",$dataToInsert['lastname']); + $dataToInsert['email'] = str_replace('{TOKEN_COUNTER}',"$newdummytoken",$dataToInsert['email']); $isvalidtoken = false; - while ($isvalidtoken == false) + $invalidtokencount=0; + while ($isvalidtoken == false && $invalidtokencount<50) { $newtoken = sRandomChars($tokenlength); if (!isset($existingtokens[$newtoken])) { $isvalidtoken = true; - $existingtokens[$newtoken]=null; + $existingtokens[$newtoken]=true; + $invalidtokencount=0; + } + else + { + $invalidtokencount ++; } } - $itquery = "UPDATE ".db_table_name("tokens_$surveyid")." SET token='$newtoken' WHERE tid={$tkrow['tid']}"; - $itresult = $connect->Execute($itquery); - $newtokencount++; + if(!$invalidtokencount){ + $dataToInsert['token'] = $newtoken; + $tblInsert=db_table_name('tokens_'.$surveyid); + $inresult = $connect->AutoExecute($tblInsert, $dataToInsert, 'INSERT') or safe_die ("Add new record failed:
            \n$inquery
            \n".$connect->ErrorMsg()); + $newdummytoken++; + } } - $message=str_replace("{TOKENCOUNT}", $newtokencount, $clang->gT("{TOKENCOUNT} tokens have been created")); - $tokenoutput .= "
            $message
            \n"; - } - $tokenoutput .= "
            \n"; -} - -if ($subaction == "delete" && bHasSurveyPermission($surveyid, 'tokens','delete')) -{ - $tokenoutput .= "
            \n" - ."\t
            " - .$clang->gT("Delete") - ."\t
            \n" - ."\t


            "; - if(isset($tokenids) && count($tokenids)>0) { - if(implode(", ", $tokenids) != "") { - $dlquery = "DELETE FROM ".db_table_name("tokens_$surveyid")." WHERE tid IN (".implode(", ", $tokenids).")"; - $dlresult = $connect->Execute($dlquery) or safe_die ("Couldn't delete record {$tokenid}
            ".$connect->ErrorMsg()."\n\n$dlquery"); - $tokenoutput .= $clang->gT("Marked tokens have been deleted."); - } else { - $tokenoutput .= $clang->gT("No tokens were selected for deletion"); - } - } elseif (isset($tokenid)) { - $dlquery = "DELETE FROM ".db_table_name("tokens_$surveyid")." WHERE tid={$tokenid}"; - $dlresult = $connect->Execute($dlquery) or safe_die ("Couldn't delete record {$tokenid}
            ".$connect->ErrorMsg()); - $tokenoutput .= $clang->gT("Token has been deleted."); - } - $tokenoutput .= "

            ".$clang->gT("Reloading Screen. Please wait.")."

            \n" - ."

            \n
            \n"; -} - -if ($subaction == "managetokenattributes" && bHasSurveyPermission($surveyid, 'tokens', 'update')) -{ - $tokenoutput .= "
            ".$clang->gT("Manage token attribute fields")."
            \n"; - $tokenfields=GetTokenFieldsAndNames($surveyid,true); - $nrofattributes=0; - $tokenoutput.='
            ' - .""; - - $exampledataquery = "SELECT * FROM ".db_table_name("tokens_$surveyid"); - $exampledata = db_select_limit_assoc($exampledataquery,1) or safe_die ("Could not get example data!
            $exampledataquery
            ".$connect->ErrorMsg()); - $examplerow = $exampledata->FetchRow(); - - - foreach ($tokenfields as $tokenfield=>$tokendescription) - { - $nrofattributes++; - $tokenoutput.=""; - } - $tokenoutput.="
            ".$clang->gT("Attribute field")."".$clang->gT("Field description")."".$clang->gT("Example data")."
            $tokenfield"; - if ($examplerow!==false) + if(!$invalidtokencount) { - $tokenoutput.=htmlspecialchars($examplerow[$tokenfield]); + $tokenoutput .= "\t\t
            ".$clang->gT("Success")."
            \n" + ."\t\t
            ".$clang->gT("New dummy tokens were added.")."

            \n" + ."\t\t
            \n"; + $tokenoutput .= "\t"; } else { - $tokenoutput.=$clang->gT(''); - } - $tokenoutput.="

            " - .'' - ."\n" - ."\n" - ."

            \n" - .'


            '; - - $tokenoutput .= "
            ".$clang->gT("Add token attributes")."

            \n"; - - $tokenoutput .=sprintf($clang->gT('There are %s user attribute fields in this token table'),$nrofattributes).'

            ' - .'
            ' - .'

            ' - .'' - .'' - .'

            ' - .'

            ' - .'' - ."" - ."" - ."" - ."

            " - .'
            ' - .'

            '; -} - -if ($subaction == "updatetokenattributedescriptions" && bHasSurveyPermission($surveyid, 'tokens', 'update')) -{ - // find out the existing token attribute fieldnames - $tokenattributefieldnames=GetAttributeFieldNames($surveyid); - $fieldcontents=''; - foreach ($tokenattributefieldnames as $fieldname) - { - $fieldcontents.=$fieldname.'='.strip_tags($_POST['description_'.$fieldname])."\n"; - } - $updatequery = "update ".db_table_name('surveys').' set attributedescriptions='.db_quoteall($fieldcontents,true)." where sid=$surveyid"; - $execresult=db_execute_assoc($updatequery); - - $tokenoutput .= "\t
            ".$clang->gT("Update token attribute descriptions")."
            \n" - ."\t
            "; - if ($execresult===false) - { - $tokenoutput.="\t\t
            ".$clang->gT("Updating token attribute descriptions failed:")."".htmlspecialchars($connect->ErrorMsg())."
            " - ."\t\t
            \n"; - } - else - { - $tokenoutput.="\t\t
            ".$clang->gT("Token attribute descriptions were successfully updated.")."
            " - ."\t\t
            \n"; - } - $tokenoutput .= "\t
            "; -} -$tokenoutput .= "
            "; -if ($subaction == "updatetokenattributes" && bHasSurveyPermission($surveyid, 'tokens', 'update')) -{ - $number2add=sanitize_int($_POST['addnumber'],1,100); - // find out the existing token attribute fieldnames - $tokenfieldnames = array_values($connect->MetaColumnNames("{$dbprefix}tokens_$surveyid", true)); - $tokenattributefieldnames=array_filter($tokenfieldnames,'filterforattributes'); - $i=1; - for ($b=0;$b<$number2add;$b++) - { - while (in_array('attribute_'.$i,$tokenattributefieldnames)!==false) { - $i++; - } - $tokenattributefieldnames[]='attribute_'.$i; - $fields[]=array('attribute_'.$i,'C','255'); - } - $dict = NewDataDictionary($connect); - $sqlarray = $dict->ChangeTableSQL("{$dbprefix}tokens_$surveyid", $fields); - $execresult=$dict->ExecuteSQLArray($sqlarray, false); - - $tokenoutput .= "\t
            ".$clang->gT("Update token attributes")."
            \n" - ."\t
            "; - if ($execresult==0) - { - $tokenoutput.="\t\t
            ".$clang->gT("Adding attribute fields failed:")."".htmlspecialchars($connect->ErrorMsg())."
            " - ."\t\t
            \n"; - } - else - { - $tokenoutput.="\t\t
            ".sprintf($clang->gT("%s field(s) were successfully added."),$number2add)."
            " - ."\t\t
            \n"; - } - $tokenoutput .= "\t
            "; -} - - -if (($subaction == "edit" && bHasSurveyPermission($surveyid, 'tokens','update')) || - ($subaction == "addnew" && bHasSurveyPermission($surveyid, 'tokens','create'))) -{ - if ($subaction == "edit") - { - $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid")." WHERE tid={$tokenid}"; - $edresult = db_execute_assoc($edquery); - $edfieldcount = $edresult->FieldCount(); - while($edrow = $edresult->FetchRow()) - { - //Create variables with the same names as the database column names and fill in the value - foreach ($edrow as $Key=>$Value) {$$Key = $Value;} + $tokenoutput .= "\t\t
            ".$clang->gT("Error")."
            \n" + ."\t\t

            ".sprintf($clang->gT("Only %s new dummy tokens were added after %s trials."),$newdummytoken,$invalidtokencount)."\n" + ."\t\t".$clang->gT("Try with a bigger token length.")."

            \n" + ."\t\t
            \n"; + $tokenoutput .= "\t"; } } - if ($subaction != "edit") + + if ($subaction == "import" && bHasSurveyPermission($surveyid, 'tokens','import')) { - $edquery = "SELECT * FROM ".db_table_name("tokens_$surveyid"); - $edresult = db_select_limit_assoc($edquery, 1); - $edfieldcount = $edresult->FieldCount(); + $tokenoutput .= "\t
            ".$clang->gT("Upload CSV File")."
            \n"; + form_csv_upload(); + $tokenoutput .= "
            \n" + ."
            ".$clang->gT("CSV input format")."
            \n" + ."

            ".$clang->gT("File should be a standard CSV (comma delimited) file with optional double quotes around values (default for OpenOffice and Excel). The first line must contain the field names. The fields can be in any order.").'

            '.$clang->gT("Mandatory fields:")." firstname,lastname,email
            " + .''.$clang->gT('Optional fields:')." emailstatus, token, language, validfrom, validuntil, attribute_1, attribute_2, attribute_3, usesleft, ... ." + ."
            \n"; } - $tokenoutput .= "
            "; - if ($subaction == "edit") + if ($subaction == "importldap" && bHasSurveyPermission($surveyid, 'tokens','import')) { - $tokenoutput .=$clang->gT("Edit token entry"); + $tokenoutput .= "\t
            ".$clang->gT("Upload LDAP entries")."
            \n"; + formldap(); + $tokenoutput .= "
            \n" + ."\t
            ".$clang->gT("Note:")."

            \n" + .$clang->gT("LDAP queries are defined by the administrator in the config-ldap.php file")."\n" + ."
            \n"; } - else + + if ($subaction == "upload" && bHasSurveyPermission($surveyid, 'tokens','import')) { - $tokenoutput .=$clang->gT("Add token entry"); - } - - $tokenoutput .="
            " - ."
            \n" - ."
              \n" - ."\t
            • \n"; - if ($subaction == "edit") - {$tokenoutput .=$tokenid;} else {$tokenoutput .=$clang->gT("Auto");} - $tokenoutput .= "
            • \n" - ."
            • \n" - ."
            • \n" - ."
            • \n" - ."
            • \n" - ."\t
            • \n" - ."\t
            • \n" - ."
            • \n" - ."
            • \n" - ."
            • \n" - ."\n"; - if ($subaction == "addnew") - { - $tokenoutput .= "".$clang->gT("You can leave this blank, and automatically generate tokens using 'Generate Tokens'")."\n"; - } - $tokenoutput .= "\t
            • \n" - ."
            • \n"; - if (isset($language)) {$tokenoutput .= languageDropdownClean($surveyid,$language);} - else { - $tokenoutput .= languageDropdownClean($surveyid,GetBaseLanguageFromSurveyID($surveyid)); - } - $tokenoutput .= "
            • \n" - - ."\t
            • \n" - ."\t
            • \n" - - ."\t
            • \n" - ."\t
            • \n"; - - if ($subaction == "edit") - { - $tokenoutput.="\t
            • \n" - ."\t
            • \n"; - } - - $tokenoutput.="\t
            • \n" - ."\t
            • \n" - - ."\t
            • \n" - ."\t
            • \n" - - ."\t
            • \n" - ."\tconvert($dateformatdetails['phpdate'].' H:i'); - } - $tokenoutput .= "\" />\n convert($dateformatdetails['phpdate'].' H:i'); - } - $tokenoutput .= "\" /> ".sprintf($clang->gT('Format: %s'),$dateformatdetails['dateformat'].' '.$clang->gT('hh:mm')).'' - ."
            • \n"; - - // now the attribute fieds - $attrfieldnames=GetTokenFieldsAndNames($surveyid,true); - foreach ($attrfieldnames as $attr_name=>$attr_description) - { - $tokenoutput .= "
            • " - ."\n" - ."\tgT("Update token entry")."' />\n" - ."\n" - ."\n"; - break; - case "addnew": - $tokenoutput .= "\n" - ."\n"; - break; - } - $tokenoutput .= "

              \n" - ."
            • \n"; -} - -if ($subaction == "adddummys" && bHasSurveyPermission($surveyid, 'tokens','create')) -{ - //get token length from survey settings - $tlquery = "SELECT tokenlength FROM ".db_table_name("surveys")." WHERE sid=$surveyid"; - $tlresult = db_execute_assoc($tlquery); - while ($tlrow = $tlresult->FetchRow()) - { - $tokenlength = $tlrow['tokenlength']; - } - - //if tokenlength is not set or there are other problems use the default value (15) - if(!isset($tokenlength) || $tokenlength == '') - { - $tokenlength = 15; - } - - $tokenoutput .= "
              "; - $tokenoutput .=$clang->gT("Create dummy tokens"); - $tokenoutput .="
              " - ."
              \n" - ."
                \n" - ."\t
              • \n"; - $tokenoutput .=$clang->gT("Auto"); - $tokenoutput .= "
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."
              • \n" - ."\t
              • \n" - ."\t
              • \n"; - $tokenoutput .= "\t\n" - ."
              • \n"; - $tokenoutput .= languageDropdownClean($surveyid,GetBaseLanguageFromSurveyID($surveyid)); - $tokenoutput .= "
              • \n" - ."\t
              • \n" - ."\t
              • \n" - ."\t
              • \n" - ."\tconvert($dateformatdetails['phpdate'].' H:i'); - } - $tokenoutput .= "\" />\n convert($dateformatdetails['phpdate'].' H:i'); - } - $tokenoutput .= "\" /> ".sprintf($clang->gT('Format: %s'),$dateformatdetails['dateformat'].' '.$clang->gT('hh:mm')).'' - ."
              • \n"; - - // now the attribute fieds - $attrfieldnames=GetTokenFieldsAndNames($surveyid,true); - foreach ($attrfieldnames as $attr_name=>$attr_description) - { - $tokenoutput .= "
              • " - ."\n" - ."\tgT("Add dummy tokens")."' />\n" - ."\n"; - $tokenoutput .= "

                \n" - ."
              • \n"; -} - -if ($subaction == "updatetoken" && bHasSurveyPermission($surveyid, 'tokens','update')) -{ - $tokenoutput .= "\t
                ".$clang->gT("Edit token entry")."
                \n" - ."\t
                \n"; - if (trim($_POST['validfrom'])=='') { - $_POST['validfrom']=null; - } - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - $data = array(); - $data[] = $_POST['firstname']; - $data[] = $_POST['lastname']; - $data[] = sanitize_email($_POST['email']); - $data[] = $_POST['emailstatus']; - $santitizedtoken=sanitize_token($_POST['token']); - $data[] = $santitizedtoken; - $data[] = sanitize_languagecode($_POST['language']); - $data[] = $_POST['sent']; - $data[] = $_POST['completed']; - $data[] = $_POST['usesleft']; - // $db->DBTimeStamp("$year-$month-$day $hr:$min:$secs"); - $data[] = $_POST['validfrom']; - $data[] = $_POST['validuntil']; - $data[] = $_POST['remindersent']; - $data[] = intval($_POST['remindercount']); - - $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where tid<>{$tokenid} and token<>'' and token='{$santitizedtoken}'") or safe_die ("Update record {$tokenid} failed:
                \n$udquery
                \n".$connect->ErrorMsg()); - if ($udresult->RecordCount()==0) - { - $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where tid={$tokenid} and email='".sanitize_email($_POST['email'])."'") or safe_die ("Update record {$tokenid} failed:
                \n$udquery
                \n".$connect->ErrorMsg()); - - - // Using adodb Execute with blinding method so auto-dbquote is done - $udquery = "UPDATE ".db_table_name("tokens_$surveyid")." SET firstname=?, " - . "lastname=?, email=?, emailstatus=?, " - . "token=?, language=?, sent=?, completed=?, usesleft=?, validfrom=?, validuntil=?, remindersent=?, remindercount=?"; $attrfieldnames=GetAttributeFieldnames($surveyid); - foreach ($attrfieldnames as $attr_name) + $duplicatelist=array(); + $invalidemaillist=array(); + $invalidformatlist=array(); + $tokenoutput .= "\t
                ".$clang->gT("Token file upload")."
                \n" + ."\t
                \n"; + if (!isset($tempdir)) { - $udquery.= ", $attr_name=?"; - $data[].=$_POST[$attr_name]; + $the_path = $homedir; } - - $udquery .= " WHERE tid={$tokenid}"; - $udresult = $connect->Execute($udquery, $data) or safe_die ("Update record {$tokenid} failed:
                \n$udquery
                \n".$connect->ErrorMsg()); - $tokenoutput .= "\t\t
                ".$clang->gT("Success")."
                \n" - ."\t\t
                ".$clang->gT("The token entry was successfully updated.")."

                \n" - ."\t\t\n"; - } - else - { - $tokenoutput .= "\t\t
                ".$clang->gT("Failed")."
                \n" - ."\t\t
                ".$clang->gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries.")."

                \n" - ."\t\t\n"; - } - $tokenoutput .= "\t
                "; -} - -if ($subaction == "inserttoken" && (bHasSurveyPermission($surveyid, 'tokens','create'))) -{ - //Fix up dates and match to database format - if (trim($_POST['validfrom'])=='') { - $_POST['validfrom']=null; - } - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - - $santitizedtoken=sanitize_token($_POST['token']); - - $tokenoutput .= "\t
                ".$clang->gT("Add token entry")."
                \n" - ."\t
                \n"; - $data = array('firstname' => $_POST['firstname'], - 'lastname' => $_POST['lastname'], - 'email' => sanitize_email($_POST['email']), - 'emailstatus' => $_POST['emailstatus'], - 'token' => $santitizedtoken, - 'language' => sanitize_languagecode($_POST['language']), - 'sent' => $_POST['sent'], - 'remindersent' => $_POST['remindersent'], - 'completed' => $_POST['completed'], - 'usesleft' => $_POST['usesleft'], - 'validfrom' => $_POST['validfrom'], - 'validuntil' => $_POST['validuntil']); - // add attributes - $attrfieldnames=GetAttributeFieldnames($surveyid); - foreach ($attrfieldnames as $attr_name) - { - $data[$attr_name]=$_POST[$attr_name]; - } - $tblInsert=db_table_name('tokens_'.$surveyid); - $udresult = $connect->Execute("Select * from ".db_table_name("tokens_$surveyid")." where token<>'' and token='{$santitizedtoken}'"); - if ($udresult->RecordCount()==0) - { - // AutoExecute - $inresult = $connect->AutoExecute($tblInsert, $data, 'INSERT') or safe_die ("Add new record failed:
                \n$inquery
                \n".$connect->ErrorMsg()); - $tokenoutput .= "\t\t
                ".$clang->gT("Success")."
                \n" - ."\t\t
                ".$clang->gT("New token was added.")."

                \n" - ."\t\t
                \n" - ."\t\t
                \n"; - } - else - { - $tokenoutput .= "\t\t
                ".$clang->gT("Failed")."
                \n" - ."\t\t
                ".$clang->gT("There is already an entry with that exact token in the table. The same token cannot be used in multiple entries.")."

                \n" - ."\t\t
                \n" - ."\t\t
                \n"; - } - $tokenoutput .= "\t
                "; -} - -if ($subaction == "insertdummys" && (bHasSurveyPermission($surveyid, 'tokens','create'))) -{ - //Fix up dates and match to database format - if (trim($_POST['validfrom'])=='') { - $_POST['validfrom']=null; - } - - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validfrom']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validfrom'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - if (trim($_POST['validuntil'])=='') {$_POST['validuntil']=null;} - else - { - $datetimeobj = new Date_Time_Converter(trim($_POST['validuntil']), $dateformatdetails['phpdate'].' H:i'); - $_POST['validuntil'] =$datetimeobj->convert('Y-m-d H:i:s'); - } - - $santitizedtoken=''; - - $tokenoutput .= "\t
                ".$clang->gT("Add dummy tokens")."
                \n" - ."\t
                \n"; - $data = array('firstname' => $_POST['firstname'], - 'lastname' => $_POST['lastname'], - 'email' => sanitize_email($_POST['email']), - 'emailstatus' => 'OK', - 'token' => $santitizedtoken, - 'language' => sanitize_languagecode($_POST['language']), - 'sent' => 'N', - 'remindersent' => 'N', - 'completed' => 'N', - 'usesleft' => $_POST['usesleft'], - 'validfrom' => $_POST['validfrom'], - 'validuntil' => $_POST['validuntil']); - - // add attributes - $attrfieldnames=GetAttributeFieldnames($surveyid); - foreach ($attrfieldnames as $attr_name) - { - $data[$attr_name]=$_POST[$attr_name]; - } - $tblInsert=db_table_name('tokens_'.$surveyid); - $amount = sanitize_int($_POST['amount']); - $tokenlength = sanitize_int($_POST['tokenlen']); - - for ($i=0; $i<$amount;$i++){ - $dataToInsert = $data; - $dataToInsert['firstname'] = str_replace('{TOKEN_COUNTER}',"$i",$dataToInsert['firstname']); - $dataToInsert['lastname'] = str_replace('{TOKEN_COUNTER}',"$i",$dataToInsert['lastname']); - $dataToInsert['email'] = str_replace('{TOKEN_COUNTER}',"$i",$dataToInsert['email']); - - $isvalidtoken = false; - while ($isvalidtoken == false) + else { - $newtoken = sRandomChars($tokenlength); - if (!isset($existingtokens[$newtoken])) { - $isvalidtoken = true; - $existingtokens[$newtoken]=null; - } + $the_path = $tempdir; } - $dataToInsert['token'] = $newtoken; - $tblInsert=db_table_name('tokens_'.$surveyid); - $inresult = $connect->AutoExecute($tblInsert, $dataToInsert, 'INSERT') or safe_die ("Add new record failed:
                \n$inquery
                \n".$connect->ErrorMsg()); - - } - - $tokenoutput .= "\t\t
                ".$clang->gT("Success")."
                \n" - ."\t\t
                ".$clang->gT("New dummy tokens were added.")."

                \n" - ."\t\t
                \n"; - $tokenoutput .= "\t
                "; -} - -if ($subaction == "import" && bHasSurveyPermission($surveyid, 'tokens','import')) -{ - $tokenoutput .= "\t
                ".$clang->gT("Upload CSV File")."
                \n"; - form_csv_upload(); - $tokenoutput .= "
                \n" - ."
                ".$clang->gT("CSV input format")."
                \n" - ."

                ".$clang->gT("File should be a standard CSV (comma delimited) file with optional double quotes around values (default for OpenOffice and Excel). The first line must contain the field names. The fields can be in any order.").'

                '.$clang->gT("Mandatory fields:")." firstname,lastname,email
                " - .''.$clang->gT('Optional fields:')." emailstatus, token, language, validfrom, validuntil, attribute_1, attribute_2, attribute_3, usesleft, ... ." - ."
                \n"; -} - -if ($subaction == "importldap" && bHasSurveyPermission($surveyid, 'tokens','import')) -{ - $tokenoutput .= "\t
                ".$clang->gT("Upload LDAP entries")."
                \n"; - formldap(); - $tokenoutput .= "
                \n" - ."\t
                ".$clang->gT("Note:")."

                \n" - .$clang->gT("LDAP queries are defined by the administrator in the config-ldap.php file")."\n" - ."
                \n"; -} - -if ($subaction == "upload" && bHasSurveyPermission($surveyid, 'tokens','import')) -{ - $attrfieldnames=GetAttributeFieldnames($surveyid); - $duplicatelist=array(); - $invalidemaillist=array(); - $invalidformatlist=array(); - $tokenoutput .= "\t
                ".$clang->gT("Token file upload")."
                \n" - ."\t
                \n"; - if (!isset($tempdir)) - { - $the_path = $homedir; - } - else - { - $the_path = $tempdir; - } - $the_file_name = $_FILES['the_file']['name']; - $the_file = $_FILES['the_file']['tmp_name']; - $the_full_file_path = $the_path."/".$the_file_name; - if (!@move_uploaded_file($the_file, $the_full_file_path)) - { - $errormessage="
                ".$clang->gT("Error")."

                ".$clang->gT("Upload file not found. Check your permissions and path ({$the_full_file_path}) for the upload directory")."

                \n"; - form_csv_upload($errormessage); - } - else - { - $tokenoutput .= "
                ".$clang->gT("Uploaded CSV file successfully")."

                \n"; - $xz = 0; $recordcount = 0; $xv = 0; - // This allows to read file with MAC line endings too - @ini_set('auto_detect_line_endings', true); - // open it and trim the ednings - $tokenlistarray = file($the_full_file_path); - $baselanguage=GetBaseLanguageFromSurveyID($surveyid); - if (!isset($tokenlistarray)) + $the_file_name = $_FILES['the_file']['name']; + $the_file = $_FILES['the_file']['tmp_name']; + $the_full_file_path = $the_path."/".$the_file_name; + if (!@move_uploaded_file($the_file, $the_full_file_path)) { - $tokenoutput .= "
                ".$clang->gT("Failed to open the uploaded file!")."

                \n"; + $errormessage="
                ".$clang->gT("Error")."

                ".$clang->gT("Upload file not found. Check your permissions and path ({$the_full_file_path}) for the upload directory")."

                \n"; + form_csv_upload($errormessage); } - if (!isset($_POST['filterduplicatefields']) || (isset($_POST['filterduplicatefields']) && count($_POST['filterduplicatefields'])==0)) + else { - $filterduplicatefields=array('firstname','lastname','email'); - } else { - $filterduplicatefields=$_POST['filterduplicatefields']; - } - $separator = returnglobal('separator'); - foreach ($tokenlistarray as $buffer) - { - $buffer=@mb_convert_encoding($buffer,"UTF-8",$uploadcharset); - $firstname = ""; $lastname = ""; $email = ""; $emailstatus="OK"; $token = ""; $language=""; $attribute1=""; $attribute2=""; //Clear out values from the last path, in case the next line is missing a value - if ($recordcount==0) + $tokenoutput .= "
                ".$clang->gT("Uploaded CSV file successfully")."

                \n"; + $xz = 0; $recordcount = 0; $xv = 0; + // This allows to read file with MAC line endings too + @ini_set('auto_detect_line_endings', true); + // open it and trim the ednings + $tokenlistarray = file($the_full_file_path); + $baselanguage=GetBaseLanguageFromSurveyID($surveyid); + if (!isset($tokenlistarray)) { - // Pick apart the first line - $buffer=removeBOM($buffer); - $allowedfieldnames=array('firstname','lastname','email','emailstatus','token','language', 'validfrom', 'validuntil', 'usesleft'); - $allowedfieldnames=array_merge($attrfieldnames,$allowedfieldnames); - - switch ($separator) { - case 'comma': - $separator = ','; - break; - case 'semicolon': - $separator = ';'; - break; - default: - $comma = substr_count($buffer,','); - $semicolon = substr_count($buffer,';'); - if ($semicolon>$comma) $separator = ';'; else $separator = ','; - } - $firstline = convertCSVRowToArray($buffer,$separator,'"'); - $firstline=array_map('trim',$firstline); - $ignoredcolumns=array(); - //now check the first line for invalid fields - foreach ($firstline as $index=>$fieldname) + $tokenoutput .= "
                ".$clang->gT("Failed to open the uploaded file!")."

                \n"; + } + if (!isset($_POST['filterduplicatefields']) || (isset($_POST['filterduplicatefields']) && count($_POST['filterduplicatefields'])==0)) + { + $filterduplicatefields=array('firstname','lastname','email'); + } else { + $filterduplicatefields=$_POST['filterduplicatefields']; + } + $separator = returnglobal('separator'); + foreach ($tokenlistarray as $buffer) + { + $buffer=@mb_convert_encoding($buffer,"UTF-8",$uploadcharset); + $firstname = ""; $lastname = ""; $email = ""; $emailstatus="OK"; $token = ""; $language=""; $attribute1=""; $attribute2=""; //Clear out values from the last path, in case the next line is missing a value + if ($recordcount==0) { - $firstline[$index] = preg_replace("/(.*) <[^,]*>$/","$1",$fieldname); - $fieldname = $firstline[$index]; - if (!in_array($fieldname,$allowedfieldnames)) - { - $ignoredcolumns[]=$fieldname; + // Pick apart the first line + $buffer=removeBOM($buffer); + $allowedfieldnames=array('firstname','lastname','email','emailstatus','token','language', 'validfrom', 'validuntil', 'usesleft'); + $allowedfieldnames=array_merge($attrfieldnames,$allowedfieldnames); + + switch ($separator) { + case 'comma': + $separator = ','; + break; + case 'semicolon': + $separator = ';'; + break; + default: + $comma = substr_count($buffer,','); + $semicolon = substr_count($buffer,';'); + if ($semicolon>$comma) $separator = ';'; else $separator = ','; } - } - if (!in_array('firstname',$firstline) || !in_array('lastname',$firstline) || !in_array('email',$firstline)) - { - $tokenoutput .= "
                ".$clang->gT("Error: Your uploaded file is missing one or more of the mandatory columns: 'firstname', 'lastname' or 'email'")."

                "; - $recordcount=count($tokenlistarray); - break; - } - - } - else - { - - $line = convertCSVRowToArray($buffer,$separator,'"'); - - if (count($firstline)!=count($line)) - { - $invalidformatlist[]=$recordcount; - $recordcount++; - continue; - } - $writearray=array_combine($firstline,$line); - - //kick out ignored columns - foreach ($ignoredcolumns as $column) - { - unset($writearray[$column]); - } - $dupfound=false; - $invalidemail=false; - - if ($filterduplicatetoken!=false) - { - $dupquery = "SELECT tid from ".db_table_name("tokens_$surveyid")." where 1=1"; - foreach($filterduplicatefields as $field) + $firstline = convertCSVRowToArray($buffer,$separator,'"'); + $firstline=array_map('trim',$firstline); + $ignoredcolumns=array(); + //now check the first line for invalid fields + foreach ($firstline as $index=>$fieldname) { - if (isset($writearray[$field])) { - $dupquery.=' and '.db_quote_id($field).' = '.db_quoteall($writearray[$field]); + $firstline[$index] = preg_replace("/(.*) <[^,]*>$/","$1",$fieldname); + $fieldname = $firstline[$index]; + if (!in_array($fieldname,$allowedfieldnames)) + { + $ignoredcolumns[]=$fieldname; } } - $dupresult = $connect->Execute($dupquery) or safe_die ("Invalid field in duplicate check
                $dupquery

                ".$connect->ErrorMsg()); - if ( $dupresult->RecordCount() > 0) + if (!in_array('firstname',$firstline) || !in_array('lastname',$firstline) || !in_array('email',$firstline)) { - $dupfound = true; - $duplicatelist[]=$writearray['firstname']." ".$writearray['lastname']." (".$writearray['email'].")"; + $tokenoutput .= "
                ".$clang->gT("Error: Your uploaded file is missing one or more of the mandatory columns: 'firstname', 'lastname' or 'email'")."

                "; + $recordcount=count($tokenlistarray); + break; } + } - - - $writearray['email'] = trim($writearray['email']); - - //treat blank emails - if ($filterblankemail && $writearray['email']=='') + else { - $invalidemail=true; - $invalidemaillist[]=$line[0]." ".$line[1]." ( )"; - } - if ($writearray['email']!='') - { - $aEmailAddresses=explode(';',$writearray['email']); - foreach ($aEmailAddresses as $sEmailaddress) + + $line = convertCSVRowToArray($buffer,$separator,'"'); + + if (count($firstline)!=count($line)) { - if (!validate_email($sEmailaddress)) + $invalidformatlist[]=$recordcount; + $recordcount++; + continue; + } + $writearray=array_combine($firstline,$line); + + //kick out ignored columns + foreach ($ignoredcolumns as $column) + { + unset($writearray[$column]); + } + $dupfound=false; + $invalidemail=false; + + if ($filterduplicatetoken!=false) + { + $dupquery = "SELECT tid from ".db_table_name("tokens_$surveyid")." where 1=1"; + foreach($filterduplicatefields as $field) { - $invalidemail=true; - $invalidemaillist[]=$line[0]." ".$line[1]." (".$line[2].")"; - } - } - } - - if (!isset($writearray['token'])) { - $writearray['token'] = ''; - } else { - $writearray['token']=sanitize_token($writearray['token']); - } - - if (!$dupfound && !$invalidemail) - { - if (!isset($writearray['emailstatus']) || $writearray['emailstatus']=='') $writearray['emailstatus'] = "OK"; - if (!isset($writearray['language']) || $writearray['language'] == "") $writearray['language'] = $baselanguage; - if (isset($writearray['validfrom']) && trim($writearray['validfrom']=='')){ unset($writearray['validfrom']);} - if (isset($writearray['validuntil']) && trim($writearray['validuntil']=='')){ unset($writearray['validuntil']);} - - // sanitize it before writing into table - $sanitizedArray = array_map('db_quote',array_values($writearray)); - - $iq = "INSERT INTO ".db_table_name("tokens_$surveyid")." \n" - . "(".implode(',',array_keys($writearray)).") \n" - . "VALUES ('".implode("','",$sanitizedArray)."')"; - $ir = $connect->Execute($iq); - - if (!$ir) - { - $duplicatelist[]=$writearray['firstname']." ".$writearray['lastname']." (".$writearray['email'].")"; - } else { - $xz++; - } - } - $xv++; - } - $recordcount++; - } - $recordcount = $recordcount-1; - if ($xz != 0) - { - $tokenoutput .= "
                ".$clang->gT("Successfully created token entries")."

                \n"; - } else { - $tokenoutput .= "
                ".$clang->gT("Failed to create token entries")."
                \n"; - } - $message = '
                • '.sprintf($clang->gT("%s records in CSV"),$recordcount)."
                • \n"; - $message .= '
                • '.sprintf($clang->gT("%s records met minumum requirements"),$xv)."
                • \n"; - $message .= '
                • '.sprintf($clang->gT("%s records imported"),$xz)."
                \n"; - - - if (count($duplicatelist)>0 || count($invalidformatlist)>0 || count($invalidemaillist)>0) - { - - $message .="
                ".$clang->gT('Warnings')."
                  "; - if (count($duplicatelist)>0) - { - $message .= '
                • '.sprintf($clang->gT("%s duplicate records removed"),count($duplicatelist)); - $message .= " [".$clang->gT("List")."]"; - $message .= ""; - $message .= "
                • \n"; - } - - if (count($invalidformatlist)>0) - { - $message .= '
                • '.sprintf($clang->gT("%s lines had a mismatching number of fields."),count($invalidformatlist)); - $message .= " [".$clang->gT("List")."]"; - $message .= "\n"; -} - -if ($subaction == "uploadldap" && bHasSurveyPermission($surveyid, 'tokens','create')) -{ - $duplicatelist=array(); - $invalidemaillist=array(); - $tokenoutput .= "\t" - .$clang->gT("Uploading LDAP Query")."\n" - ."\t\n"; - $ldapq=$_POST['ldapQueries']; // the ldap query id - - $ldap_server_id=$ldap_queries[$ldapq]['ldapServerId']; - $ldapserver=$ldap_server[$ldap_server_id]['server']; - $ldapport=$ldap_server[$ldap_server_id]['port']; - if (isset($ldap_server[$ldap_server_id]['encoding']) && - $ldap_server[$ldap_server_id]['encoding'] != 'utf-8' && - $ldap_server[$ldap_server_id]['encoding'] != 'UTF-8') - { - $ldapencoding=$ldap_server[$ldap_server_id]['encoding']; - } - else - { - $ldapencoding=''; - } - - // define $attrlist: list of attributes to read from users' entries - $attrparams = array('firstname_attr','lastname_attr', - 'email_attr','token_attr', 'language'); - - $aTokenAttr=GetAttributeFieldNames($surveyid); - foreach ($aTokenAttr as $thisattrfieldname) - { - $attridx=substr($thisattrfieldname,10); // the 'attribute_' prefix is 10 chars long - $attrparams[] = "attr".$attridx; - } - - foreach ($attrparams as $id => $attr) { - if (array_key_exists($attr,$ldap_queries[$ldapq]) && - $ldap_queries[$ldapq][$attr] != '') { - $attrlist[]=$ldap_queries[$ldapq][$attr]; - } - } - - // Open connection to server - $ds = ldap_getCnx($ldap_server_id); - - if ($ds) { - // bind to server - $resbind=ldap_bindCnx($ds, $ldap_server_id); - - if ($resbind) { - $ResArray=array(); - $resultnum=ldap_doTokenSearch($ds, $ldapq, $ResArray); - $xz = 0; // imported token count - $xv = 0; // meet minim requirement count - $xy = 0; // check for duplicates - $duplicatecount = 0; // duplicate tokens skipped count - $invalidemailcount = 0; - - if ($resultnum >= 1) { - foreach ($ResArray as $responseGroupId => $responseGroup) { - for($j = 0;$j < $responseGroup['count']; $j++) { - // first let's initialize everything to '' - $myfirstname=''; - $mylastname=''; - $myemail=''; - $mylanguage=''; - $mytoken=''; - $myattrArray=array(); - - // The first 3 attrs MUST exist in the ldap answer - // ==> send PHP notice msg to apache logs otherwise - $meetminirequirements=true; - if (isset($responseGroup[$j][$ldap_queries[$ldapq]['firstname_attr']]) && - isset($responseGroup[$j][$ldap_queries[$ldapq]['lastname_attr']]) - ) - { - // minimum requirement for ldap - // * at least a firstanme - // * at least a lastname - // * if filterblankemail is set (default): at least an email address - $myfirstname = ldap_readattr($responseGroup[$j][$ldap_queries[$ldapq]['firstname_attr']]); - $mylastname = ldap_readattr($responseGroup[$j][$ldap_queries[$ldapq]['lastname_attr']]); - if (isset($responseGroup[$j][$ldap_queries[$ldapq]['email_attr']])) - { - $myemail = ldap_readattr($responseGroup[$j][$ldap_queries[$ldapq]['email_attr']]); - $myemail= sanitize_email($myemail); - ++$xv; + if (isset($writearray[$field])) { + $dupquery.=' and '.db_quote_id($field).' = '.db_quoteall($writearray[$field]); } - elseif ($filterblankemail !==true) + } + $dupresult = $connect->Execute($dupquery) or safe_die ("Invalid field in duplicate check
                  $dupquery

                  ".$connect->ErrorMsg()); + if ( $dupresult->RecordCount() > 0) + { + $dupfound = true; + $duplicatelist[]=$writearray['firstname']." ".$writearray['lastname']." (".$writearray['email'].")"; + } + } + + + $writearray['email'] = trim($writearray['email']); + + //treat blank emails + if ($filterblankemail && $writearray['email']=='') + { + $invalidemail=true; + $invalidemaillist[]=$line[0]." ".$line[1]." ( )"; + } + if ($writearray['email']!='') + { + $aEmailAddresses=explode(';',$writearray['email']); + foreach ($aEmailAddresses as $sEmailaddress) + { + if (!validate_email($sEmailaddress)) { - $myemail = ''; - ++$xv; + $invalidemail=true; + $invalidemaillist[]=$line[0]." ".$line[1]." (".$line[2].")"; + } + } + } + + if (!isset($writearray['token'])) { + $writearray['token'] = ''; + } else { + $writearray['token']=sanitize_token($writearray['token']); + } + + if (!$dupfound && !$invalidemail) + { + if (!isset($writearray['emailstatus']) || $writearray['emailstatus']=='') $writearray['emailstatus'] = "OK"; + if (!isset($writearray['usesleft']) || $writearray['usesleft']=='') $writearray['usesleft'] = 1; + if (!isset($writearray['language']) || $writearray['language'] == "") $writearray['language'] = $baselanguage; + if (isset($writearray['validfrom']) && trim($writearray['validfrom']=='')){ unset($writearray['validfrom']);} + if (isset($writearray['validuntil']) && trim($writearray['validuntil']=='')){ unset($writearray['validuntil']);} + + // sanitize it before writing into table + $sanitizedArray = array_map('db_quote',array_values($writearray)); + + $iq = "INSERT INTO ".db_table_name("tokens_$surveyid")." \n" + . "(".implode(',',array_keys($writearray)).") \n" + . "VALUES ('".implode("','",$sanitizedArray)."')"; + $ir = $connect->Execute($iq); + + if (!$ir) + { + $duplicatelist[]=$writearray['firstname']." ".$writearray['lastname']." (".$writearray['email'].")"; + } else { + $xz++; + } + } + $xv++; + } + $recordcount++; + } + $recordcount = $recordcount-1; + if ($xz != 0) + { + $tokenoutput .= "
                  ".$clang->gT("Successfully created token entries")."

                  \n"; + } else { + $tokenoutput .= "
                  ".$clang->gT("Failed to create token entries")."
                  \n"; + } + $message = '
                  • '.sprintf($clang->gT("%s records in CSV"),$recordcount)."
                  • \n"; + $message .= '
                  • '.sprintf($clang->gT("%s records met minumum requirements"),$xv)."
                  • \n"; + $message .= '
                  • '.sprintf($clang->gT("%s records imported"),$xz)."
                  \n"; + + + if (count($duplicatelist)>0 || count($invalidformatlist)>0 || count($invalidemaillist)>0) + { + + $message .="
                  ".$clang->gT('Warnings')."
                    "; + if (count($duplicatelist)>0) + { + $message .= '
                  • '.sprintf($clang->gT("%s duplicate records removed"),count($duplicatelist)); + $message .= " [".$clang->gT("List")."]"; + $message .= ""; + $message .= "
                  • \n"; + } + + if (count($invalidformatlist)>0) + { + $message .= '
                  • '.sprintf($clang->gT("%s lines had a mismatching number of fields."),count($invalidformatlist)); + $message .= " [".$clang->gT("List")."]"; + $message .= ""; + $message .= "
                    \n"; + $message .= sprintf($clang->gT("%s records with invalid email address removed"),$invalidemailcount); + $message .= " [".$clang->gT("List")."]"; + $message .= "
                  • $data
                  • \n"; + } + $message .= "
                "; + $message .= "
                \n"; + $tokenoutput .= "$message
                \n"; } - else - { - $tokenoutput .= "".$clang->gT("Failed")."

                \n"; + else { + $errormessage="".$clang->gT("Error").": ".$clang->gT("Can't bind to the LDAP directory")."\n"; + formldap($errormessage); } - $message = "$resultnum ".$clang->gT("Results from LDAP Query").".
                \n"; - $message .= "$xv ".$clang->gT("Records met minumum requirements").".
                \n"; - $message .= "$xz ".$clang->gT("Records imported").".
                \n"; - $message .= "$xy ".$clang->gT("Duplicate records removed"); - $message .= " [".$clang->gT("List")."]"; - $message .= ""; - $message .= "
                \n"; - $message .= sprintf($clang->gT("%s records with invalid email address removed"),$invalidemailcount); - $message .= " [".$clang->gT("List")."]"; - $message .= ""; - $message .= "
                \n"; - $tokenoutput .= "$message
                \n"; + @ldap_close($ds); } else { - $errormessage="".$clang->gT("Error").": ".$clang->gT("Can't bind to the LDAP directory")."\n"; + $errormessage="".$clang->gT("Error").": ".$clang->gT("Can't connect to the LDAP directory")."\n"; formldap($errormessage); } - @ldap_close($ds); } - else { - $errormessage="".$clang->gT("Error").": ".$clang->gT("Can't connect to the LDAP directory")."\n"; - formldap($errormessage); - } -} -// Now for the function -function form_csv_upload($error=false) -{ - global $surveyid, $tokenoutput,$scriptname, $clang, $encodingsarray; - - if ($error) {$tokenoutput .= $error . "

                \n";} - asort($encodingsarray); - $charsetsout=''; - foreach ($encodingsarray as $charset=>$title) + // Now for the function + function form_csv_upload($error=false) { - $charsetsout.=""; - if ($separator == 'comma') $selected = " selected = 'selected'"; else $selected = ''; - $separatorout .= ""; - if ($separator == 'semicolon') $selected = " selected = 'selected'"; else $selected = ''; - $separatorout .= ""; - $tokenoutput .= "
                  \n" - . "
                • \n" - . "
                • \n" - . "
                • \n" - . "
                • \n" - . "
                • " - . "
                • " - . " " - . "
                \n" - . "

                \n" - . "\n" - . "\n" - . "

                \n\n"; -} # END form - -function formldap($error=false) -{ - global $surveyid, $tokenoutput, $ldap_queries, $clang, $scriptname; - - if ($error) {$tokenoutput .= $error . "

                \n";} - - if (!function_exists('ldap_connect')) - { - $tokenoutput .= '

                '; - $tokenoutput .= $clang->gT('Sorry, but the LDAP module is missing in your PHP configuration.'); - $tokenoutput .= '
                '; - } - - elseif (! isset($ldap_queries) || ! is_array($ldap_queries) || count($ldap_queries) == 0) { - $tokenoutput .= '
                '; - $tokenoutput .= $clang->gT('LDAP is disabled or no LDAP query defined.'); - $tokenoutput .= '


                '; - } - else { - $tokenoutput .= "

                "; - $tokenoutput .= '

                '; - $tokenoutput .= $clang->gT("Select the LDAP query you want to run:")."
                "; - $tokenoutput .= "
                "; - $tokenoutput .= '

                '; - $tokenoutput .= "

                \n" - . "

                \n"; - $tokenoutput .= ""; - $tokenoutput .= ""; - $tokenoutput .= "

                "; - $tokenoutput .= '
                '; - } -} - -function getLine($file) -{ - $buffer=""; - // iterate over each character in line. - while (!feof($file)) - { - // append the character to the buffer. - $character = fgetc($file); - $buffer .= $character; - // check for end of line. - if (($character == "\n") or ($character == "\r")) + if ($error) {$tokenoutput .= $error . "

                \n";} + asort($encodingsarray); + $charsetsout=''; + foreach ($encodingsarray as $charset=>$title) { - // checks if the next character is part of the line ending, as in - // the case of windows '\r\n' files, or not as in the case of - // mac classic '\r', and unix/os x '\n' files. - $character = fgetc($file); - if ($character == "\n") - { - // part of line ending, append to buffer. - $buffer .= $character; + $charsetsout.=""; + if ($separator == 'comma') $selected = " selected = 'selected'"; else $selected = ''; + $separatorout .= ""; + if ($separator == 'semicolon') $selected = " selected = 'selected'"; else $selected = ''; + $separatorout .= ""; + $tokenoutput .= "
                  \n" + . "
                • \n" + . "
                • \n" + . "
                • \n" + . "
                • \n" + . "
                • " + . "
                • " + . " " + . "
                \n" + . "

                \n" + . "\n" + . "\n" + . "

                \n\n"; + } # END form + + function formldap($error=false) + { + global $surveyid, $tokenoutput, $ldap_queries, $clang, $scriptname; + + if ($error) {$tokenoutput .= $error . "

                \n";} + + if (!function_exists('ldap_connect')) + { + $tokenoutput .= '

                '; + $tokenoutput .= $clang->gT('Sorry, but the LDAP module is missing in your PHP configuration.'); + $tokenoutput .= '
                '; + } + + elseif (! isset($ldap_queries) || ! is_array($ldap_queries) || count($ldap_queries) == 0) { + $tokenoutput .= '
                '; + $tokenoutput .= $clang->gT('LDAP is disabled or no LDAP query defined.'); + $tokenoutput .= '


                '; + } + else { + $tokenoutput .= "

                "; + $tokenoutput .= '

                '; + $tokenoutput .= $clang->gT("Select the LDAP query you want to run:")."
                "; + $tokenoutput .= "
                "; + $tokenoutput .= '

                '; + $tokenoutput .= "

                \n" + . "

                \n"; + $tokenoutput .= ""; + $tokenoutput .= ""; + $tokenoutput .= "

                "; + $tokenoutput .= '
                '; } } - // return the line buffer. - return $buffer; -} + + function getLine($file) + { + $buffer=""; + // iterate over each character in line. + while (!feof($file)) + { + // append the character to the buffer. + $character = fgetc($file); + $buffer .= $character; + // check for end of line. + if (($character == "\n") or ($character == "\r")) + { + // checks if the next character is part of the line ending, as in + // the case of windows '\r\n' files, or not as in the case of + // mac classic '\r', and unix/os x '\n' files. + $character = fgetc($file); + if ($character == "\n") + { + // part of line ending, append to buffer. + $buffer .= $character; + } + else + { + // not part of line ending, roll back file pointer. + fseek($file, -1, SEEK_CUR); + } + // end of line, so stop reading. + break; + } + } + // return the line buffer. + return $buffer; + } ?> diff --git a/include/limesurvey/admin/translate.php b/include/limesurvey/admin/translate.php index a5c956d4..f7b19e0b 100644 --- a/include/limesurvey/admin/translate.php +++ b/include/limesurvey/admin/translate.php @@ -1,280 +1,278 @@ -"; - $translateoutput .= showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname); - $translateoutput .= ""; - - $translateoutput .= "

                 

                \n"; //CSS Firefox 2 transition fix - - $translateoutput .= "
                ".$clang->gT("Translate survey")."
                \n"; - -// $tab_names=array("title", "description", "welcome", "end", "group", "group_desc", "question", "question_help", "answer"); -// $tab_names=array("title", "description", "invitation", "reminder"); - $tab_names=array("title", "welcome", "group", "question", "subquestion", "answer", "emailinvite", "emailreminder", "emailconfirmation", "emailregistration"); - - - if ($tolang != "" && $actionvalue=="translateSave") - // Saves translated values to database - { - $tab_names_full = ""; - foreach($tab_names as $type) - { - $tab_names_full[] = $type; - $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); - $type2 = $amTypeOptions["associated"]; - if ($type2 != "") - { - $tab_names_full[] = $type2; - } - } - foreach($tab_names_full as $type) - { - $size = 0; - if(isset($_POST["{$type}_size"])) - { - $size = $_POST["{$type}_size"]; - } - // start a loop in order to update each record - $i = 0; - while ($i < $size) - { - // define each variable - if (isset($_POST["{$type}_newvalue_{$i}"])) - { - $old = $_POST["{$type}_oldvalue_{$i}"]; - $new = $_POST["{$type}_newvalue_{$i}"]; - // check if the new value is different from old, and then update database - if ($new != $old) - { - $id1 = $_POST["{$type}_id1_{$i}"]; - $id2 = $_POST["{$type}_id2_{$i}"]; - $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang, $id1, $id2, $new); - $query = $amTypeOptions["queryupdate"]; - $connect->execute($query); - } - } - ++$i; - } // end while - } // end foreach - $actionvalue = ""; - } // end if - - - - if ($tolang != "") - // Display tabs with fields to translate, as well as input fields for translated values - { - - $sGoogleApiError = $clang->gT("There was an error using the Google API."); - $sDetailedError = $clang->gT("Detailed Error"); - - $translateoutput .= "

                ".$clang->gT("Loading translations")."...

                "; - - $translateoutput .= "
                \n" - ."\n" - ."\n" - ."\n" - ."\n" - ."\n" - ."\n"; - $translateoutput.=<< - sGoogleApiError = "$sGoogleApiError"; - sDetailedError = "$sDetailedError"; - -END; - // set up tabs - $translateoutput .= "" - ."
                \n" - ."\t
                  \n"; - foreach($tab_names as $type) - { - $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); - $translateoutput .= "" - ."\t\t
                • ".$amTypeOptions["description"]."
                • \n"; - } - $translateoutput .= "" - ."\t
                \n"; - - // Define content of each tab - foreach($tab_names as $type) - { - $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); - - $type2 = $amTypeOptions["associated"]; - if ($type2 != "") - { - $associated = TRUE; - $amTypeOptions2 = setupTranslateFields($surveyid, $type2, $tolang, $baselang); - } - else - { - $associated = FALSE; - } - - // Create tab names and heading - $translateoutput .= "\t
                \n"; - $translateoutput .= PrepareEditorScript(); - // Setup form - // start a counter in order to number the input fields for each record - $i = 0; - $evenRow = FALSE; - $all_fields_empty = TRUE; - - $querybase = $amTypeOptions["querybase"]; - $resultbase = db_execute_assoc($querybase); - if ($associated) - { - $querybase2 = $amTypeOptions2["querybase"]; - $resultbase2 = db_execute_assoc($querybase2); - } - - $queryto = $amTypeOptions["queryto"]; - $resultto = db_execute_assoc($queryto); - if ($associated) - { - $queryto2 = $amTypeOptions2["queryto"]; - $resultto2 = db_execute_assoc($queryto2); - } - - $translateoutput .="
                \n"; - $translateoutput .=""; - $translateoutput .="\n"; - $translateoutput .= displayTranslateFieldsHeader($baselangdesc, $tolangdesc); - while ($rowfrom = $resultbase->FetchRow()) - { - $textfrom = htmlspecialchars_decode($rowfrom[$amTypeOptions["dbColumn"]]); - - if ($associated) - { - $rowfrom2 = $resultbase2->FetchRow(); - $textfrom2 = htmlspecialchars_decode($rowfrom2[$amTypeOptions2["dbColumn"]]); - } - - $gid = NULL; - if($amTypeOptions["gid"]==TRUE) $gid = $rowfrom['gid']; - - $qid = NULL; - if($amTypeOptions["qid"]==TRUE) $qid = $rowfrom['qid']; - - $rowto = $resultto->FetchRow(); - $textto = $rowto[$amTypeOptions["dbColumn"]]; - - if ($associated) - { - $rowto2 = $resultto2->FetchRow(); - $textto2 = $rowto2[$amTypeOptions2["dbColumn"]]; - } - - if (strlen(trim((string)$textfrom)) > 0) - { - $all_fields_empty = FALSE; - $evenRow = !($evenRow); - // Display translation fields - $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type, - $amTypeOptions, $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow); - if ($associated && strlen(trim((string)$textfrom2)) > 0) - { - $evenRow = !($evenRow); - $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type2, - $amTypeOptions2, $baselangdesc, $tolangdesc, $textfrom2, $textto2, $i, $rowfrom2, $evenRow); - } - } - else - { - $translateoutput .= ""; - } - ++$i; - } // end while - $translateoutput .= displayTranslateFieldsFooter(); - $translateoutput .= "
                "; - if ($all_fields_empty) - { - $translateoutput .= "

                ".$clang->gT("Nothing to translate on this page")."


                "; - } - $translateoutput .= ""; - if ($associated) - { - $translateoutput .= ""; - } - $translateoutput .= "
                \n"; // tab-page - - } // end foreach - - // Submit button - $translateoutput .= "

                " - ."\n"; - - - $translateoutput .= "
                \n"; - $translateoutput .= "\n"; - } // end if - - - +"; + $translateoutput .= showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname); + $translateoutput .= ""; + + $translateoutput .= "

                 

                \n"; //CSS Firefox 2 transition fix + + $translateoutput .= "
                ".$clang->gT("Translate survey")."
                \n"; + +// $tab_names=array("title", "description", "welcome", "end", "group", "group_desc", "question", "question_help", "answer"); +// $tab_names=array("title", "description", "invitation", "reminder"); + $tab_names=array("title", "welcome", "group", "question", "subquestion", "answer", "emailinvite", "emailreminder", "emailconfirmation", "emailregistration"); + + + if ($tolang != "" && $actionvalue=="translateSave") + // Saves translated values to database + { + $tab_names_full = ""; + foreach($tab_names as $type) + { + $tab_names_full[] = $type; + $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); + $type2 = $amTypeOptions["associated"]; + if ($type2 != "") + { + $tab_names_full[] = $type2; + } + } + foreach($tab_names_full as $type) + { + $size = 0; + if(isset($_POST["{$type}_size"])) + { + $size = $_POST["{$type}_size"]; + } + // start a loop in order to update each record + $i = 0; + while ($i < $size) + { + // define each variable + if (isset($_POST["{$type}_newvalue_{$i}"])) + { + $old = $_POST["{$type}_oldvalue_{$i}"]; + $new = $_POST["{$type}_newvalue_{$i}"]; + // check if the new value is different from old, and then update database + if ($new != $old) + { + $id1 = $_POST["{$type}_id1_{$i}"]; + $id2 = $_POST["{$type}_id2_{$i}"]; + $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang, $id1, $id2, $new); + $query = $amTypeOptions["queryupdate"]; + $connect->execute($query); + } + } + ++$i; + } // end while + } // end foreach + $actionvalue = ""; + } // end if + + + + if ($tolang != "") + // Display tabs with fields to translate, as well as input fields for translated values + { + + $sGoogleApiError = $clang->gT("There was an error using the Google API."); + $sDetailedError = $clang->gT("Detailed Error"); + + $translateoutput .= "

                ".$clang->gT("Loading translations")."...

                "; + + $translateoutput .= "
                \n" + ."\n" + ."\n" + ."\n" + ."\n" + ."\n" + ."\n"; + $translateoutput.=<< + sGoogleApiError = "$sGoogleApiError"; + sDetailedError = "$sDetailedError"; + +END; + // set up tabs + $translateoutput .= "" + ."
                \n" + ."\t
                  \n"; + foreach($tab_names as $type) + { + $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); + $translateoutput .= "" + ."\t\t
                • ".$amTypeOptions["description"]."
                • \n"; + } + $translateoutput .= "" + ."\t
                \n"; + + // Define content of each tab + foreach($tab_names as $type) + { + $amTypeOptions = setupTranslateFields($surveyid, $type, $tolang, $baselang); + + $type2 = $amTypeOptions["associated"]; + if ($type2 != "") + { + $associated = TRUE; + $amTypeOptions2 = setupTranslateFields($surveyid, $type2, $tolang, $baselang); + } + else + { + $associated = FALSE; + } + + // Create tab names and heading + $translateoutput .= "\t
                \n"; + $translateoutput .= PrepareEditorScript(); + // Setup form + // start a counter in order to number the input fields for each record + $i = 0; + $evenRow = FALSE; + $all_fields_empty = TRUE; + + $querybase = $amTypeOptions["querybase"]; + $resultbase = db_execute_assoc($querybase); + if ($associated) + { + $querybase2 = $amTypeOptions2["querybase"]; + $resultbase2 = db_execute_assoc($querybase2); + } + + $queryto = $amTypeOptions["queryto"]; + $resultto = db_execute_assoc($queryto); + if ($associated) + { + $queryto2 = $amTypeOptions2["queryto"]; + $resultto2 = db_execute_assoc($queryto2); + } + + $translateoutput .="
                \n"; + $translateoutput .=""; + $translateoutput .="\n"; + $translateoutput .= displayTranslateFieldsHeader($baselangdesc, $tolangdesc, $type); + while ($rowfrom = $resultbase->FetchRow()) + { + $textfrom = htmlspecialchars_decode($rowfrom[$amTypeOptions["dbColumn"]]); + + if ($associated) + { + $rowfrom2 = $resultbase2->FetchRow(); + $textfrom2 = htmlspecialchars_decode($rowfrom2[$amTypeOptions2["dbColumn"]]); + } + + $gid = NULL; + if($amTypeOptions["gid"]==TRUE) $gid = $rowfrom['gid']; + + $qid = NULL; + if($amTypeOptions["qid"]==TRUE) $qid = $rowfrom['qid']; + + $rowto = $resultto->FetchRow(); + $textto = $rowto[$amTypeOptions["dbColumn"]]; + + if ($associated) + { + $rowto2 = $resultto2->FetchRow(); + $textto2 = $rowto2[$amTypeOptions2["dbColumn"]]; + } + + if (strlen(trim((string)$textfrom)) > 0) + { + $all_fields_empty = FALSE; + $evenRow = !($evenRow); + // Display translation fields + $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type, + $amTypeOptions, $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow); + if ($associated && strlen(trim((string)$textfrom2)) > 0) + { + $evenRow = !($evenRow); + $translateoutput .= displayTranslateFields($surveyid, $gid, $qid, $type2, + $amTypeOptions2, $baselangdesc, $tolangdesc, $textfrom2, $textto2, $i, $rowfrom2, $evenRow); + } + } + else + { + $translateoutput .= ""; + } + ++$i; + } // end while + $translateoutput .= displayTranslateFieldsFooter(); + $translateoutput .= "
                "; + if ($all_fields_empty) + { + $translateoutput .= "

                ".$clang->gT("Nothing to translate on this page")."


                "; + } + $translateoutput .= ""; + if ($associated) + { + $translateoutput .= ""; + } + $translateoutput .= "
                \n"; // tab-page + + } // end foreach + + // Submit button + $translateoutput .= "

                " + ."\n"; + + + $translateoutput .= "
                \n"; + $translateoutput .= "\n"; + } // end if + + + ?> \ No newline at end of file diff --git a/include/limesurvey/admin/translate_functions.php b/include/limesurvey/admin/translate_functions.php index 466559f8..6fddf51a 100644 --- a/include/limesurvey/admin/translate_functions.php +++ b/include/limesurvey/admin/translate_functions.php @@ -1,846 +1,857 @@ -" - .""
-          .$jsMenuText."\n" - ."\n"; - return $menu; -} - -/** - * menuSeparator() creates a separator bar in the admin screen menus - * @global string $imageurl - * @return string - */ -function menuSeparator() -{ - global $imageurl; - return ("\n"); -} - -/** - * showTranslateAdminmenu() creates the main menu options for the survey translation page - * @param string $surveyid The survey ID - * @param string $survey_title - * @param string $tolang - * @param string $activated - * @param string $scriptname - * @global string $imageurl, $clang, $publicurl - * @return string - */ - function showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname) -{ - global $imageurl, $clang, $publicurl; - - $baselang = GetBaseLanguageFromSurveyID($surveyid); - $supportedLanguages = getLanguageData(false); - $langs = GetAdditionalLanguagesFromSurveyID($surveyid); - - $adminmenu = "" - ."\n"; - - return($adminmenu); -} - - -/** - * setupTranslateFields() creates a customised array with database query - * information for use by survey translation - * @global $dbprefix, $clang; - * @param string $surveyid Survey id - * @param string $type Type of database field that is being translated, e.g. title, question, etc. - * @param string $baselang The source translation language code, e.g. "En" - * @param string $tolang The target translation language code, e.g. "De" - * @param string $new The new value of the translated string - * @param string $id1 An index variable used in the database select and update query - * @param string $id2 An index variable used in the database select and update query - * @return array - */ - -function setupTranslateFields($surveyid, $type, $tolang, $baselang, $id1="", $id2="", $new="") -{ - global $dbprefix, $clang; - - switch ( $type ) - { - case 'title': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ." WHERE surveyls_survey_id=".db_quoteall($surveyid) - ." AND surveyls_language=".db_quoteall($baselang), - "queryto" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ." WHERE surveyls_survey_id=".db_quoteall($surveyid) - ." AND surveyls_language=".db_quoteall($tolang), - "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') - ." SET surveyls_title = ".db_quoteall($new) - ." WHERE surveyls_survey_id=".db_quoteall($surveyid) - ." AND surveyls_language=".db_quoteall($tolang), - "id1" => "", - "id2" => "", - "gid" => FALSE, - "qid" => FALSE, - "dbColumn" => 'surveyls_title', - "description" => $clang->gT("Survey title and description"), - "HTMLeditorType" => "title", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None - "associated" => "description" - ); - break; - - case 'description': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$baselang}' ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}' ", - "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') - ."SET surveyls_description = ".db_quoteall($new) - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}'", - "id1" => "", - "id2" => "", - "gid" => FALSE, - "qid" => FALSE, - "dbColumn" => 'surveyls_description', - "description" => $clang->gT("Description:"), - "HTMLeditorType" => "description", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None - "associated" => "" - ); - break; - - case 'welcome': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$baselang}' ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}' ", - "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') - ."SET surveyls_welcometext = ".db_quoteall($new) - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}'", - "id1" => "", - "id2" => "", - "gid" => FALSE, - "qid" => FALSE, - "dbColumn" => 'surveyls_welcometext', - "description" => $clang->gT("Welcome and end text"), - "HTMLeditorType" => "welcome", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None - "associated" => "end" - ); - break; - - case 'end': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$baselang}' ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('surveys_languagesettings') - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}' ", - "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') - ."SET surveyls_endtext = ".db_quoteall($new) - ."WHERE surveyls_survey_id=".db_quoteall($surveyid) - ."AND surveyls_language='{$tolang}'", - "id1" => "", - "id2" => "", - "gid" => FALSE, - "qid" => FALSE, - "dbColumn" => 'surveyls_endtext', - "description" => $clang->gT("End message:"), - "HTMLeditorType" => "end", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None - "associated" => "" - ); - break; - - case 'group': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('groups') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$baselang}' " - ."ORDER BY gid ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('groups') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language=".db_quoteall($tolang) - ."ORDER BY gid ", - "queryupdate" => "UPDATE ".db_table_name('groups') - ."SET group_name = ".db_quoteall($new) - ."WHERE gid = '{$id1}' " - ."AND sid=".db_quoteall($surveyid) - ."AND language='{$tolang}'", - "id1" => "gid", - "id2" => "", - "gid" => TRUE, - "qid" => FALSE, - "dbColumn" => "group_name", - "description" => $clang->gT("Question groups"), - "HTMLeditorType" => "group", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None - "associated" => "group_desc" - ); - break; - - case 'group_desc': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('groups') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$baselang}' " - ."ORDER BY gid ", - "queryto" => "SELECT *" - ."FROM ".db_table_name('groups') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language=".db_quoteall($tolang) - ."ORDER BY gid ", - "queryupdate" => "UPDATE ".db_table_name('groups') - ."SET description = ".db_quoteall($new) - ."WHERE gid = '{$id1}' " - ."AND sid=".db_quoteall($surveyid) - ."AND language='{$tolang}'", - "id1" => "gid", - "id2" => "", - "gid" => TRUE, - "qid" => FALSE, - "dbColumn" => "description", - "description" => $clang->gT("Group description"), - "HTMLeditorType" => "group_desc", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None - "associated" => "" - ); - break; - -// case 'label': -// $amTypeOptions = array( -// "querybase" => "SELECT * " -// ."FROM ".db_table_name('labels') -// ."WHERE language='{$baselang}' " -// . "AND lid='$code' ", -// "queryto" => "SELECT * " -// ."FROM ".db_table_name('labels') -// ."WHERE language=".db_quoteall($tolang) -// . "AND lid='$code' ", -// "queryupdate" => "UPDATE ".db_table_name('labels') -// ."SET title = ".db_quoteall($new) -// ."WHERE lid = '{$id1}' " -// ."AND code='{$id2}' " -// ."AND language='{$tolang}' LIMIT 1", -// "dbColumn" => 'title', -// "id1" => 'lid', -// "id2" => 'code', -// "description" => $clang->gT("Label sets") -// ); -// break; - - case 'question': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$baselang}' " - ."AND parent_qid=0 " - ."ORDER BY qid ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$tolang}' " - ." AND parent_qid=0 " - ."ORDER BY qid ", - "queryupdate" => "UPDATE ".db_table_name('questions') - ."SET question = ".db_quoteall($new) - ."WHERE qid = '{$id1}' " - ."AND sid=".db_quoteall($surveyid) - ." AND parent_qid=0 " - ."AND language='{$tolang}'", - "dbColumn" => 'question', - "id1" => 'qid', - "id2" => "", - "gid" => TRUE, - "qid" => TRUE, - "description" => $clang->gT("Questions"), - "HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or "" - "associated" => "question_help" - ); - break; - - case 'question_help': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$baselang}' " - ."AND parent_qid=0 " - ."ORDER BY qid ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$tolang}' " - ." AND parent_qid=0 " - ."ORDER BY qid ", - "queryupdate" => "UPDATE ".db_table_name('questions') - ."SET help = ".db_quoteall($new) - ."WHERE qid = '{$id1}' " - ."AND sid=".db_quoteall($surveyid) - ." AND parent_qid=0 " - ."AND language='{$tolang}'", - "dbColumn" => 'help', - "id1" => 'qid', - "id2" => "", - "gid" => TRUE, - "qid" => TRUE, - "description" => "", - "HTMLeditorType" => "question_help", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - case 'subquestion': - $amTypeOptions = array( - "querybase" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language='{$baselang}' AND parent_qid>0 " - ."ORDER BY parent_qid,qid ", - "queryto" => "SELECT * " - ."FROM ".db_table_name('questions') - ."WHERE sid=".db_quoteall($surveyid) - ."AND language=".db_quoteall($tolang) - ." AND parent_qid>0 ORDER BY parent_qid,qid ", - "queryupdate" => "UPDATE ".db_table_name('questions') - ."SET question = ".db_quoteall($new) - ."WHERE qid = '{$id1}' " - ."AND sid=".db_quoteall($surveyid) - ."AND language='{$tolang}'", - "dbColumn" => 'question', - "id1" => 'qid', - "id2" => "", - "gid" => TRUE, - "qid" => TRUE, - "description" => $clang->gT("Subquestions"), - "HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None - "associated" => "" - ); - break; - - case 'answer': - $amTypeOptions = array( - "querybase" => "SELECT".db_table_name('answers').".*, ".db_table_name('questions').".gid " - ." FROM ".db_table_name('answers').", ".db_table_name('questions') - ." WHERE ".db_table_name('questions').".sid ='{$surveyid}' " - ." AND ".db_table_name('questions').".qid = ".db_table_name('answers').".qid " - ." AND ".db_table_name('questions').".language = ".db_table_name('answers').".language " - ." AND ".db_table_name('questions').".language='{$baselang}' " - ." ORDER BY qid,code,sortorder" , - "queryto" => "SELECT".db_table_name('answers').".*, ".db_table_name('questions').".gid " - ." FROM ".db_table_name('answers').", ".db_table_name('questions') - ." WHERE ".db_table_name('questions').".sid ='{$surveyid}' " - ." AND ".db_table_name('questions').".qid = ".db_table_name('answers').".qid " - ." AND ".db_table_name('questions').".language = ".db_table_name('answers').".language " - ." AND ".db_table_name('questions').".language=".db_quoteall($tolang) - ."ORDER BY qid,code,sortorder" , - "queryupdate" => "UPDATE ".db_table_name('answers') - ."SET answer = ".db_quoteall($new) - ."WHERE qid = '{$id1}' " - ."AND code='{$id2}' " - ."AND language='{$tolang}'", - "dbColumn" => 'answer', - "id1" => 'qid', - "id2" => 'code', - "gid" => FALSE, - "qid" => TRUE, - "description" => $clang->gT("Answer options"), - "HTMLeditorType" => "subquestion", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None - "associated" => "" - ); - break; - - case 'emailinvite': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_invite_subj = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_invite_subj', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => $clang->gT("Invitation email"), - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "emailinvitebody" - ); - break; - - case 'emailinvitebody': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_invite = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_invite', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => "", - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - case 'emailreminder': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_remind_subj = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_remind_subj', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => $clang->gT("Reminder email"), - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "emailreminderbody" - ); - break; - - case 'emailreminderbody': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_remind = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_remind', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => "", - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - case 'emailconfirmation': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_confirm_subj = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_confirm_subj', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => $clang->gT("Confirmation email"), - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "emailconfirmationbody" - ); - break; - - case 'emailconfirmationbody': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_confirm = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_confirm', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => "", - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - case 'emailregistration': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_register_subj = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_register_subj', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => $clang->gT("Registration email"), - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "emailregistrationbody" - ); - break; - - case 'emailregistrationbody': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_register = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_register', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => "", - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - case 'email_confirm': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_confirm_subj = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_confirm_subj', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => $clang->gT("Confirmation email"), - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "email_confirmbody" - ); - break; - - case 'email_confirmbody': - $amTypeOptions = array( - "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , - "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") - ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , - "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") - ."SET surveyls_email_confirm = ".db_quoteall($new) - ." WHERE surveyls_survey_id=$surveyid " - ."AND surveyls_language='$tolang'", - "dbColumn" => 'surveyls_email_confirm', - "id1" => '', - "id2" => '', - "gid" => FALSE, - "qid" => FALSE, - "description" => "", - "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields - "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" - "associated" => "" - ); - break; - - } - return($amTypeOptions); -} - - -/** - * displayTranslateFieldsHeader() Formats and displays header of translation fields table - * @param string $baselangdesc The source translation language, e.g. "English" - * @param string $tolangdesc The target translation language, e.g. "German" - * @return string $translateoutput - */ -function displayTranslateFieldsHeader($baselangdesc, $tolangdesc) -{ - $translateoutput = '' - . '' - . '' - . "\n" - . "\n" - . "\n" - . "\n"; - return($translateoutput); -} - - -/** - * displayTranslateFieldsFooter() Formats and displays footer of translation fields table - * @return string $translateoutput - */ -function displayTranslateFieldsFooter() -{ - $translateoutput = "" - . "
                $baselangdesc$tolangdesc
                \n"; - return($translateoutput); -} - - -/** - * displayTranslateFields() Formats and displays translation fields (base language as well as to language) - * @global $dbprefix, $clang; - * @param string $surveyid Survey id - * @param string $gid Group id - * @param string $qid Question id - * @param string $type Type of database field that is being translated, e.g. title, question, etc. - * @param array $amTypeOptions Array containing options associated with each $type - * @param string $baselangdesc The source translation language, e.g. "English" - * @param string $tolangdesc The target translation language, e.g. "German" - * @param string $textfrom The text to be translated in source language - * @param string $textto The text to be translated in target language - * @param integer $i Counter - * @param string $rowfrom Contains current row of database query - * @param boolean $evenRow True for even rows, false for odd rows - * @return string $translateoutput - */ - -function displayTranslateFields($surveyid, $gid, $qid, $type, $amTypeOptions, - $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow) - -{ - $translateoutput = ""; - if ($evenRow) - { - $translateoutput .= ""; - } - else - { - $translateoutput .= ""; - } - $value1 = ""; - if ($amTypeOptions["id1"] != "") $value1 = $rowfrom[$amTypeOptions["id1"]]; - $value2 = ""; - if ($amTypeOptions["id2"] != "") $value2 = $rowfrom[$amTypeOptions["id2"]]; - - - // Display text in original language - // Display text in foreign language. Save a copy in type_oldvalue_i to identify changes before db update - $translateoutput .= "" - . "$textfrom\n" - . "\n"; - $translateoutput .= "\n"; - $translateoutput .= "\n"; - $nrows = max(calc_nrows($textfrom), calc_nrows($textto)); - $translateoutput .= "\n"; - $translateoutput .= "\n"; - - if ($amTypeOptions["HTMLeditorDisplay"]=="Inline") - { - $translateoutput .= "" - .getEditor("edit".$type , $type."_newvalue_".$i, htmlspecialchars($textto), $surveyid, $gid, $qid, "translate".$amTypeOptions["HTMLeditorType"]); - } - if ($amTypeOptions["HTMLeditorDisplay"]=="Popup") - { - $translateoutput .= "" - .getPopupEditor("edit".$type , $type."_newvalue_".$i, urlencode($amTypeOptions['description']), $surveyid, $gid, $qid, "translate".$amTypeOptions["HTMLeditorType"]); - } - $translateoutput .= "\n\n" - . "\n"; - return($translateoutput); -} - -/** - * calc_nrows($subject) calculates the vertical size of textbox for survey translation. - * The function adds the number of line breaks
                to the number of times a string wrap occurs. - * @param string $subject The text string that is being translated - * @return integer - */ -function calc_nrows( $subject ) -{ - // Determines the size of the text box - // A proxy for box sixe is string length divided by 80 - $pattern = "()"; - //$pattern = "/\n/"; - $pattern = '[()|(/\n/)]'; - $nrows_newline = preg_match_all($pattern, $subject, $matches); - - $nrows_char = ceil(strlen((string)$subject)/80); - - return $nrows_newline + $nrows_char; -} - - -?> \ No newline at end of file +" + .""
+          .$jsMenuText."\n" + ."\n"; + return $menu; +} + +/** + * menuSeparator() creates a separator bar in the admin screen menus + * @global string $imageurl + * @return string + */ +function menuSeparator() +{ + global $imageurl; + return ("\n"); +} + +/** + * showTranslateAdminmenu() creates the main menu options for the survey translation page + * @param string $surveyid The survey ID + * @param string $survey_title + * @param string $tolang + * @param string $activated + * @param string $scriptname + * @global string $imageurl, $clang, $publicurl + * @return string + */ + function showTranslateAdminmenu($surveyid, $survey_title, $tolang, $scriptname) +{ + global $imageurl, $clang, $publicurl; + + $baselang = GetBaseLanguageFromSurveyID($surveyid); + $supportedLanguages = getLanguageData(false); + $langs = GetAdditionalLanguagesFromSurveyID($surveyid); + + $adminmenu = "" + ."\n"; + + return($adminmenu); +} + + +/** + * setupTranslateFields() creates a customised array with database query + * information for use by survey translation + * @global $dbprefix, $clang; + * @param string $surveyid Survey id + * @param string $type Type of database field that is being translated, e.g. title, question, etc. + * @param string $baselang The source translation language code, e.g. "En" + * @param string $tolang The target translation language code, e.g. "De" + * @param string $new The new value of the translated string + * @param string $id1 An index variable used in the database select and update query + * @param string $id2 An index variable used in the database select and update query + * @return array + */ + +function setupTranslateFields($surveyid, $type, $tolang, $baselang, $id1="", $id2="", $new="") +{ + global $dbprefix, $clang; + + switch ( $type ) + { + case 'title': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language=".db_quoteall($baselang,true), + "queryto" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language=".db_quoteall($tolang,true), + "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') + ." SET surveyls_title = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language=".db_quoteall($tolang,true), + "id1" => "", + "id2" => "", + "gid" => FALSE, + "qid" => FALSE, + "dbColumn" => 'surveyls_title', + "description" => $clang->gT("Survey title and description"), + "HTMLeditorType" => "title", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None + "associated" => "description" + ); + break; + + case 'description': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$baselang}' ", + "queryto" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$tolang}' ", + "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') + ." SET surveyls_description = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$tolang}'", + "id1" => "", + "id2" => "", + "gid" => FALSE, + "qid" => FALSE, + "dbColumn" => 'surveyls_description', + "description" => $clang->gT("Description:"), + "HTMLeditorType" => "description", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None + "associated" => "" + ); + break; + + case 'welcome': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$baselang}' ", + "queryto" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$tolang}' ", + "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') + ." SET surveyls_welcometext = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ."AND surveyls_language='{$tolang}'", + "id1" => "", + "id2" => "", + "gid" => FALSE, + "qid" => FALSE, + "dbColumn" => 'surveyls_welcometext', + "description" => $clang->gT("Welcome and end text"), + "HTMLeditorType" => "welcome", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None + "associated" => "end" + ); + break; + + case 'end': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$baselang}' ", + "queryto" => "SELECT * " + ."FROM ".db_table_name('surveys_languagesettings') + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$tolang}' ", + "queryupdate" => "UPDATE ".db_table_name('surveys_languagesettings') + ." SET surveyls_endtext = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=".db_quoteall($surveyid,true) + ." AND surveyls_language='{$tolang}'", + "id1" => "", + "id2" => "", + "gid" => FALSE, + "qid" => FALSE, + "dbColumn" => 'surveyls_endtext', + "description" => $clang->gT("End message:"), + "HTMLeditorType" => "end", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Inline", // Allowed values: Inline, Popup or None + "associated" => "" + ); + break; + + case 'group': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('groups') + ." WHERE sid=".db_quoteall($surveyid,true) + ." AND language='{$baselang}' " + ." ORDER BY group_order ", + "queryto" => "SELECT * " + ."FROM ".db_table_name('groups') + ." WHERE sid=".db_quoteall($surveyid,true) + ." AND language=".db_quoteall($tolang,true) + ." ORDER BY group_order ", + "queryupdate" => "UPDATE ".db_table_name('groups') + ." SET group_name = ".db_quoteall($new,true) + ." WHERE gid = '{$id1}' " + ." AND sid=".db_quoteall($surveyid,true) + ." AND language='{$tolang}'", + "id1" => "gid", + "id2" => "", + "gid" => TRUE, + "qid" => FALSE, + "dbColumn" => "group_name", + "description" => $clang->gT("Question groups"), + "HTMLeditorType" => "group", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None + "associated" => "group_desc" + ); + break; + + case 'group_desc': + $amTypeOptions = array( + "querybase" => "SELECT * " + ." FROM ".db_table_name('groups') + ." WHERE sid=".db_quoteall($surveyid,true) + ." AND language='{$baselang}' " + ."ORDER BY group_order ", + "queryto" => "SELECT *" + ." FROM ".db_table_name('groups') + ." WHERE sid=".db_quoteall($surveyid,true) + ."AND language=".db_quoteall($tolang,true) + ."ORDER BY group_order ", + "queryupdate" => "UPDATE ".db_table_name('groups') + ."SET description = ".db_quoteall($new,true) + ."WHERE gid = '{$id1}' " + ."AND sid=".db_quoteall($surveyid,true) + ."AND language='{$tolang}'", + "id1" => "gid", + "id2" => "", + "gid" => TRUE, + "qid" => FALSE, + "dbColumn" => "description", + "description" => $clang->gT("Group description"), + "HTMLeditorType" => "group_desc", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None + "associated" => "" + ); + break; + + case 'question': + $amTypeOptions = array( + "querybase" => "SELECT q.qid as questionid, q.title, q.question, q.qid, q.gid " + ." FROM ".db_table_name('questions')." q " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE q.sid=".db_quoteall($surveyid,true) + ." AND q.language='{$baselang}' " + ." AND g.language='{$baselang}' " + ." AND q.parent_qid=0 " + ." ORDER BY g.group_order,q.question_order, q.scale_id ", + "queryto" => "SELECT q.qid as questionid, q.title, q.question, q.qid, q.gid " + ." FROM ".db_table_name('questions')." q " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE q.sid=".db_quoteall($surveyid,true) + ." AND q.language='{$tolang}' " + ." AND g.language='{$tolang}' " + ." AND q.parent_qid=0 " + ." ORDER BY g.group_order,q.question_order, q.scale_id ", + "queryupdate" => "UPDATE ".db_table_name('questions') + ." SET question = ".db_quoteall($new,true) + ." WHERE qid = '{$id1}' " + ." AND sid=".db_quoteall($surveyid,true) + ." AND parent_qid=0 " + ." AND language='{$tolang}'", + "dbColumn" => 'question', + "id1" => 'qid', + "id2" => "", + "gid" => TRUE, + "qid" => TRUE, + "description" => $clang->gT("Questions"), + "HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or "" + "associated" => "question_help" + ); + break; + + case 'question_help': + $amTypeOptions = array( + "querybase" => "SELECT q.qid as questionid, q.help, q.qid, q.title " + ." FROM ".db_table_name('questions')." q " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE g.sid=".db_quoteall($surveyid,true) + ." AND q.language='{$baselang}' " + ." AND g.language='{$baselang}' " + ." AND parent_qid=0 " + ." ORDER BY g.group_order,q.question_order ", + "queryto" => "SELECT q.qid as questionid, q.help, q.qid, q.title " + ." FROM ".db_table_name('questions')." q " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE g.sid=".db_quoteall($surveyid,true) + ." AND q.language='{$tolang}' " + ." AND g.language='{$tolang}' " + ." AND parent_qid=0 " + ." ORDER BY g.group_order,q.question_order ", + "queryupdate" => "UPDATE ".db_table_name('questions') + ." SET help = ".db_quoteall($new,true) + ." WHERE qid = '{$id1}' " + ." AND sid=".db_quoteall($surveyid,true) + ." AND parent_qid=0 " + ." AND language='{$tolang}'", + "dbColumn" => 'help', + "id1" => 'qid', + "id2" => "", + "gid" => TRUE, + "qid" => TRUE, + "description" => "", + "HTMLeditorType" => "question_help", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + case 'subquestion': + $amTypeOptions = array( + "querybase" => "SELECT q.qid as questionid, q.title, sq.qid, sq.question, sq.gid " + ." FROM ".db_table_name('questions')." sq " + ." JOIN ".db_table_name('questions')." q ON sq.parent_qid=q.qid " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE sq.sid=".db_quoteall($surveyid,true) + ." AND sq.language='{$baselang}' AND q.language='{$baselang}' AND g.language='{$baselang}' AND sq.parent_qid>0 " + ." ORDER BY g.group_order, q.question_order,q.scale_id, sq.scale_id, sq.question_order ", + "queryto" => "SELECT sq.question " + ." FROM ".db_table_name('questions')." sq " + ." JOIN ".db_table_name('questions')." q ON sq.parent_qid=q.qid " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE sq.sid=".db_quoteall($surveyid,true) + ." AND sq.language=".db_quoteall($tolang,true)." AND q.language=".db_quoteall($tolang,true)." AND g.language=".db_quoteall($tolang,true)." AND sq.parent_qid>0 " + ." ORDER BY g.group_order, q.question_order,q.scale_id, sq.scale_id, sq.question_order ", + "queryupdate" => "UPDATE ".db_table_name('questions') + ." SET question = ".db_quoteall($new,true) + ." WHERE qid = '{$id1}' " + ." AND sid=".db_quoteall($surveyid,true) + ." AND language='{$tolang}'", + "dbColumn" => 'question', + "id1" => 'qid', + "id2" => "", + "gid" => TRUE, + "qid" => TRUE, + "description" => $clang->gT("Subquestions"), + "HTMLeditorType" => "question", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None + "associated" => "" + ); + break; + + case 'answer': + $amTypeOptions = array( + "querybase" => "SELECT q.qid as questionid, a.code, a.answer, q.qid, q.title " + ." FROM ".db_table_name('answers')." a " + ." JOIN ".db_table_name('questions')." q ON a.qid=q.qid " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE q.sid ='{$surveyid}' " + ." AND q.qid = q.qid " + ." AND a.language = '{$baselang}'" + ." AND q.language = '{$baselang}'" + ." AND g.language = '{$baselang}'" + ." ORDER BY g.group_order, q.question_order, a.scale_id, a.sortorder", + "queryto" => "SELECT a.code, a.answer, q.qid, q.title " + ." FROM ".db_table_name('answers')." a " + ." JOIN ".db_table_name('questions')." q ON a.qid=q.qid " + ." JOIN ".db_table_name('groups')." g ON g.gid=q.gid " + ." WHERE q.sid ='{$surveyid}' " + ." AND q.qid = q.qid " + ." AND a.language = ".db_quoteall($tolang,true) + ." AND q.language = ".db_quoteall($tolang,true) + ." AND g.language = ".db_quoteall($tolang,true) + ." ORDER BY g.group_order, q.question_order, a.sortorder, a.scale_id", + "queryupdate" => "UPDATE ".db_table_name('answers') + ." SET answer = ".db_quoteall($new,true) + ." WHERE qid = '{$id1}' " + ." AND code='{$id2}' " + ." AND language='{$tolang}'", + "dbColumn" => 'answer', + "id1" => 'qid', + "id2" => 'code', + "gid" => FALSE, + "qid" => TRUE, + "description" => $clang->gT("Answer options"), + "HTMLeditorType" => "subquestion", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "Popup", // Allowed values: Inline, Popup or None + "associated" => "" + ); + break; + + case 'emailinvite': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_invite_subj = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_invite_subj', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => $clang->gT("Invitation email"), + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "emailinvitebody" + ); + break; + + case 'emailinvitebody': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_invite = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_invite', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => "", + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + case 'emailreminder': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_remind_subj = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_remind_subj', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => $clang->gT("Reminder email"), + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "emailreminderbody" + ); + break; + + case 'emailreminderbody': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_remind = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_remind', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => "", + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + case 'emailconfirmation': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_confirm_subj = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_confirm_subj', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => $clang->gT("Confirmation email"), + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "emailconfirmationbody" + ); + break; + + case 'emailconfirmationbody': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_confirm = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_confirm', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => "", + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + case 'emailregistration': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_register_subj = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_register_subj', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => $clang->gT("Registration email"), + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "emailregistrationbody" + ); + break; + + case 'emailregistrationbody': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_register = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_register', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => "", + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + case 'email_confirm': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_confirm_subj = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_confirm_subj', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => $clang->gT("Confirmation email"), + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "email_confirmbody" + ); + break; + + case 'email_confirmbody': + $amTypeOptions = array( + "querybase" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$baselang'" , + "queryto" => "SELECT * FROM ".db_table_name("surveys_languagesettings") + ." WHERE surveyls_survey_id=$surveyid and surveyls_language='$tolang'" , + "queryupdate" => "UPDATE ".db_table_name("surveys_languagesettings") + ." SET surveyls_email_confirm = ".db_quoteall($new,true) + ." WHERE surveyls_survey_id=$surveyid " + ." AND surveyls_language='$tolang'", + "dbColumn" => 'surveyls_email_confirm', + "id1" => '', + "id2" => '', + "gid" => FALSE, + "qid" => FALSE, + "description" => "", + "HTMLeditorType" => "email", // This value is passed to HTML editor and determines LimeReplacementFields + "HTMLeditorDisplay" => "", // Allowed values: Inline, Popup or "" + "associated" => "" + ); + break; + + } + return($amTypeOptions); +} + + +/** + * displayTranslateFieldsHeader() Formats and displays header of translation fields table + * @param string $baselangdesc The source translation language, e.g. "English" + * @param string $tolangdesc The target translation language, e.g. "German" + * @param string $type The target translation language, e.g. "German" + * @return string $translateoutput + */ + function displayTranslateFieldsHeader($baselangdesc, $tolangdesc, $type) +{ + global $clang; + $translateoutput = ''; + if ($type=='question' || $type=='subquestion' || $type=='question_help' || $type=='answer') + { + $translateoutput.=''; + } + $translateoutput.='' + . '' + . "\n"; + if ($type=='question' || $type=='subquestion' || $type=='question_help' || $type=='answer') + { + $translateoutput.="\n"; + } + $translateoutput.="\n" + . "\n" + . "\n"; + return($translateoutput); +} + + +/** + * displayTranslateFieldsFooter() Formats and displays footer of translation fields table + * @return string $translateoutput + */ +function displayTranslateFieldsFooter() +{ + $translateoutput = "" + . "
                {$clang->gT('Question code / ID')}{$baselangdesc}{$tolangdesc}
                \n"; + return($translateoutput); +} + + +/** + * displayTranslateFields() Formats and displays translation fields (base language as well as to language) + * @global $dbprefix, $clang; + * @param string $surveyid Survey id + * @param string $gid Group id + * @param string $qid Question id + * @param string $type Type of database field that is being translated, e.g. title, question, etc. + * @param array $amTypeOptions Array containing options associated with each $type + * @param string $baselangdesc The source translation language, e.g. "English" + * @param string $tolangdesc The target translation language, e.g. "German" + * @param string $textfrom The text to be translated in source language + * @param string $textto The text to be translated in target language + * @param integer $i Counter + * @param string $rowfrom Contains current row of database query + * @param boolean $evenRow True for even rows, false for odd rows + * @return string $translateoutput + */ + +function displayTranslateFields($surveyid, $gid, $qid, $type, $amTypeOptions, + $baselangdesc, $tolangdesc, $textfrom, $textto, $i, $rowfrom, $evenRow) + +{ + $translateoutput = ""; + if ($evenRow) + { + $translateoutput .= ""; + } + else + { + $translateoutput .= ""; + } + $value1 = ""; + if ($amTypeOptions["id1"] != "") $value1 = $rowfrom[$amTypeOptions["id1"]]; + $value2 = ""; + if ($amTypeOptions["id2"] != "") $value2 = $rowfrom[$amTypeOptions["id2"]]; + + + // Display text in original language + // Display text in foreign language. Save a copy in type_oldvalue_i to identify changes before db update + if ($type=='question' || $type=='subquestion' || $type=='question_help' || $type=='answer') + { + $translateoutput .= "" + . "".htmlspecialchars($rowfrom['title'])." ({$rowfrom['questionid']})\n"; + } + + $translateoutput .= "$textfrom\n" + . "\n"; + $translateoutput .= "\n"; + $translateoutput .= "\n"; + $nrows = max(calc_nrows($textfrom), calc_nrows($textto)); + $translateoutput .= "\n"; + $translateoutput .= "\n"; + + if ($amTypeOptions["HTMLeditorDisplay"]=="Inline") + { + $translateoutput .= "" + .getEditor("edit".$type , $type."_newvalue_".$i, htmlspecialchars($textto), $surveyid, $gid, $qid, "translate".$amTypeOptions["HTMLeditorType"]); + } + if ($amTypeOptions["HTMLeditorDisplay"]=="Popup") + { + $translateoutput .= "" + .getPopupEditor("edit".$type , $type."_newvalue_".$i, urlencode($amTypeOptions['description']), $surveyid, $gid, $qid, "translate".$amTypeOptions["HTMLeditorType"]); + } + $translateoutput .= "\n\n" + . "\n"; + return($translateoutput); +} + +/** + * calc_nrows($subject) calculates the vertical size of textbox for survey translation. + * The function adds the number of line breaks
                to the number of times a string wrap occurs. + * @param string $subject The text string that is being translated + * @return integer + */ +function calc_nrows( $subject ) +{ + // Determines the size of the text box + // A proxy for box sixe is string length divided by 80 + $pattern = "()"; + //$pattern = "/\n/"; + $pattern = '[()|(/\n/)]'; + $nrows_newline = preg_match_all($pattern, $subject, $matches); + + $nrows_char = ceil(strlen((string)$subject)/80); + + return $nrows_newline + $nrows_char; +} + + +?> diff --git a/include/limesurvey/admin/translate_google_api.php b/include/limesurvey/admin/translate_google_api.php index 3944aa3f..bafc8df4 100644 --- a/include/limesurvey/admin/translate_google_api.php +++ b/include/limesurvey/admin/translate_google_api.php @@ -1,58 +1,64 @@ -. Text within <> act as a placeholder and are - // not translated by Google Translate - $sToNewconvert = preg_replace("/\{(\w+)\}/", "<$1>",$sToconvert); - $bDoNotConvertBack = false; - if ($sToNewconvert == $sToconvert) - $bDoNotConvertBack = true; - $sToconvert = $sToNewconvert; - $sConverted = $objGt->$sProcedure($sToconvert); - $sConverted = str_replace("
                ","\r\n",$sConverted); - if (!$bDoNotConvertBack) - $sConverted = preg_replace("/\<(\w+)\>/", '{$1}',$sConverted); - $sConverted = html_entity_decode(stripcslashes($sConverted)); - - $aOutput = array( - 'error' => false, - 'baselang' => $sBaselang, - 'tolang' => $sTolang, - 'converted' => $sConverted - ); - -} catch (GTranslateException $ge){ - - // Get the error message and build the ouput array - $sError = $ge->getMessage(); - $aOutput = array( - 'error' => true, - 'baselang' => $sBaselang, - 'tolang' => $sTolang, - 'error' => $sError - ); - -} - -$ajaxoutput = json_encode($aOutput). "\n"; +$sProcedure($part[0]); + $convertedPart = str_replace("
                ","\r\n",$convertedPart); + $convertedPart = html_entity_decode(stripcslashes($convertedPart)); + $sparts[] = $convertedPart; + } + } + $sConverted = implode(' ', $sparts); + + $aOutput = array( + 'error' => false, + 'baselang' => $sBaselang, + 'tolang' => $sTolang, + 'converted' => $sConverted + ); + +} catch (GTranslateException $ge){ + + // Get the error message and build the ouput array + $sError = $ge->getMessage(); + $aOutput = array( + 'error' => true, + 'baselang' => $sBaselang, + 'tolang' => $sTolang, + 'error' => $sError + ); + +} + +$ajaxoutput = ls_json_encode($aOutput). "\n"; diff --git a/include/limesurvey/admin/update/updater.php b/include/limesurvey/admin/update/updater.php index 0227fbf4..8cc63396 100644 --- a/include/limesurvey/admin/update/updater.php +++ b/include/limesurvey/admin/update/updater.php @@ -1,664 +1,664 @@ -timeout=0; - /* Data transfer timeout */ - $http->data_timeout=0; - $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; - $http->GetRequestArguments("http://update.limesurvey.org?updaterbuild=$updaterversion",$arguments); - - $updateinfo=false; - $error=$http->Open($arguments); - $error=$http->SendRequest($arguments); - - $http->ReadReplyHeaders($headers); - - - if($error=="") { - $body=''; $full_body=''; - for(;;){ - $error = $http->ReadReplyBody($body,10000); - if($error != "" || strlen($body)==0) break; - $full_body .= $body; - } - $updateinfo=json_decode($full_body,true); - if ($http->response_status!='200') - { - $updateinfo['errorcode']=$http->response_status; - $updateinfo['errorhtml']=$full_body; - } - } - else - { - $updateinfo['errorcode']=$error; - $updateinfo['errorhtml']=$error; - } - unset( $http ); - if ((int)$updateinfo['UpdaterRevision']<=$updaterversion) - { - return true; - } - - if (!is_writable($tempdir)) - { - echo "
              • ".sprintf($clang->gT("Tempdir %s is not writable"),$tempdir)."
              • "; - $error=true; - } - if (!is_writable($homedir.DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'updater.php')) - { - echo "
              • ".sprintf($clang->gT("Updater file is not writable (%s). Please set according file permissions."),$homedir.DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'updater.php')."
              • "; - $error=true; - } - - // Download the zip file, unpack it and replace the updater file accordingly - // Create DB and file backups now - require_once("classes/pclzip/pclzip.lib.php"); - - // require_once('classes/pclzip/pcltrace.lib.php'); - // require_once('classes/pclzip/pclzip-trace.lib.php'); - // PclTraceOn(2); - - require_once($homedir."/classes/http/http.php"); - - $downloaderror=false; - $http=new http_class; - - // Allow redirects - $http->follow_redirect=1; - /* Connection timeout */ - $http->timeout=0; - /* Data transfer timeout */ - $http->data_timeout=0; - $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; - $http->GetRequestArguments("http://update.limesurvey.org/updates/downloadupdater/$updaterversion",$arguments); - - $httperror=$http->Open($arguments); - $httperror=$http->SendRequest($arguments); - $http->ReadReplyHeaders($headers); - if ($headers['content-type']=='text/html') - { - @unlink($tempdir.'/updater.zip'); - } - elseif($httperror=='') { - $body=''; $full_body=''; - for(;;){ - $httperror = $http->ReadReplyBody($body,100000); - if($httperror != "" || strlen($body)==0) break; - $full_body .= $body; - } - file_put_contents($tempdir.'/updater.zip',$full_body); - } - else - { - print( $httperror ); - } - - //Now unzip the new updater over the existing ones. - if (file_exists($tempdir.'/updater.zip')){ - $archive = new PclZip($tempdir.'/updater.zip'); - if ($archive->extract(PCLZIP_OPT_PATH, $homedir.'/update/', PCLZIP_OPT_REPLACE_NEWER)== 0) { - die("Error : ".$archive->errorInfo(true)); - } - else - { - unlink($tempdir.'/updater.zip'); - } - } - else - { - echo $clang->gT('There was a problem downloading the updater file. Please try to restart the update process.').'
                '; - $error=true; - } - - -} - -function UpdateStep1() -{ - global $clang, $scriptname, $updatekey, $subaction, $updatebuild, $homedir, $buildnumber, $tempdir, $rootdir; - - - if ($subaction=='keyupdate') - { - setGlobalSetting('updatekey',sanitize_paranoid_string($_POST['updatekey'])); - } - $error=false; - echo '
                '.$clang->gT('Welcome to the ComfortUpdate').'

                '; - echo $clang->gT('The LimeSurvey ComfortUpdate is an easy procedure to quickly update to the latest version of LimeSurvey.').'
                '; - echo $clang->gT('The following steps will be done by this update:').'
                  '; - echo '
                • '.$clang->gT('Your LimeSurvey installation is checked if the update can be run successfully.').'
                • '; - echo '
                • '.$clang->gT('Your DB and any changed files will be backed up.').'
                • '; - echo '
                • '.$clang->gT('New files will be downloaded and installed.').'
                • '; - echo '
                • '.$clang->gT('If necessary the database will be updated.').'
                '; - echo '

                '.$clang->gT('Checking basic requirements...').'

                '; - if ($updatekey==''){ - echo $clang->gT('You need an update key to run the comfort update. During the beta test of this update feature the key "LIMESURVEYUPDATE" can be used.'); - echo "
                '; - echo '
                '; - } - else { - echo "
                • ".$clang->gT('Update key: Valid')."
                • "; - - if (!is_writable($tempdir)) - { - echo "
                • ".sprintf($clang->gT("Tempdir %s is not writable"),$tempdir)."
                • "; - $error=true; - } - if (!is_writable($rootdir.DIRECTORY_SEPARATOR.'version.php')) - { - echo "
                • ".sprintf($clang->gT("Version file is not writable (%s). Please set according file permissions."),$rootdir.DIRECTORY_SEPARATOR.'version.php')."
                • "; - $error=true; - } - echo '

                '.$clang->gT('Change log').'

                '; - require_once($homedir."/classes/http/http.php"); - $updatekey=getGlobalSetting('updatekey'); - - $http=new http_class; - /* Connection timeout */ - $http->timeout=0; - /* Data transfer timeout */ - $http->data_timeout=0; - $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; - $http->GetRequestArguments("http://update.limesurvey.org/updates/changelog/$buildnumber/$updatebuild/$updatekey",$arguments); - - $updateinfo=false; - $httperror=$http->Open($arguments); - $httperror=$http->SendRequest($arguments); - - if($httperror=="") { - $body=''; $full_body=''; - for(;;){ - $httperror = $http->ReadReplyBody($body,10000); - if($httperror != "" || strlen($body)==0) break; - $full_body .= $body; - } - $changelog=json_decode($full_body,true); - echo ''; - } - else - { - print( $httperror ); - } - } - - - if ($error) - { - echo '

                '.$clang->gT('When checking your installation we found one or more problems. Please check for any error messages above and fix these before you can proceed.'); - echo "

                "; - } - else - { - echo '

                '.$clang->gT('Everything looks alright. Please proceed to the next step.'); - echo "

                "; - } - echo '
                '; -} - - -function UpdateStep2() -{ - global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir; - - // Request the list with changed files from the server - - require_once($homedir."/classes/http/http.php"); - $updatekey=getGlobalSetting('updatekey'); - - echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'2').'

                '; - - $http=new http_class; - /* Connection timeout */ - $http->timeout=0; - /* Data transfer timeout */ - $http->data_timeout=0; - $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; - $http->GetRequestArguments("http://update.limesurvey.org/updates/update/$buildnumber/$updatebuild/$updatekey",$arguments); - - $updateinfo=false; - $error=$http->Open($arguments); - $error=$http->SendRequest($arguments); - - if($error=="") { - $body=''; $full_body=''; - for(;;){ - $error = $http->ReadReplyBody($body,10000); - if($error != "" || strlen($body)==0) break; - $full_body .= $body; - } - $updateinfo=json_decode($full_body,true); - $http->SaveCookies($site_cookies); - } - else - { - print( $error ); - } - - if (isset($updateinfo['error'])) - { - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - - if ($updateinfo['error']==1) - { - setGlobalSetting('updatekey',''); - echo $clang->gT('Your update key is invalid and was removed. ').'
                '; - } - else - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - } - // okay, updateinfo now contains all necessary updateinformation - // Now check if the existing files have the mentioned checksum - $existingfiles=array(); - $modifiedfiles=array(); - $readonlyfiles=array(); - if (!isset($updateinfo['files'])) - { - echo "
                -
                ".$clang->gT('Update server busy')."
                -

                ".$clang->gT('The update server is currently busy. This usually happens when the update files for a new version are being prepared.')."

                - ".$clang->gT('Please be patient and try again in about 10 minutes.')."

                -

                "; - - } - else - { - - foreach ($updateinfo['files'] as $afile) - { - if ($afile['type']=='A' && !file_exists($rootdir.$afile['file'])) - { - $searchpath=$rootdir.$afile['file']; - $is_writable=is_writable(dirname($searchpath)); - while (!$is_writable && strlen($searchpath)>strlen($rootdir)) - { - $searchpath=dirname($searchpath); - if (file_exists($searchpath)) - { - $is_writable=is_writable($searchpath); - break; - - } - } - if (!$is_writable) - { - $readonlyfiles[]=$searchpath; - } - } - elseif (file_exists($rootdir.$afile['file']) && !is_writable($rootdir.$afile['file'])) { - $readonlyfiles[]=$rootdir.$afile['file']; - } - - - if ($afile['type']=='A' && file_exists($rootdir.$afile['file'])) - { - //A new file, check if this already exists - $existingfiles[]=$afile; - } - elseif (($afile['type']=='D' || $afile['type']=='M') && is_file($rootdir.$afile['file']) && sha1_file($rootdir.$afile['file'])!=$afile['checksum']) // A deleted or modified file - check if it is unmodified - { - $modifiedfiles[]=$afile; - } - } - - echo '

                '.$clang->gT('Checking existing LimeSurvey files...').'

                '; - if (count($readonlyfiles)>0) - { - echo ''.$clang->gT('Warning: The following files/directories need to be updated but their permissions are set to read-only.').'
                '; - echo $clang->gT('You must set according write permissions on these filese before you can proceed. If you are unsure what to do please contact your system administrator for advice.').'
                '; - echo '
                  '; - $readonlyfiles=array_unique($readonlyfiles); - sort($readonlyfiles); - foreach ($readonlyfiles as $readonlyfile) - { - echo '
                • '.htmlspecialchars($readonlyfile).'
                • '; - } - echo '
                '; - } - if (count($existingfiles)>0) - { - echo $clang->gT('The following files would be added by the update but already exist. This is very unusual and may be co-incidental.').'
                '; - echo $clang->gT('We recommend that these files should be replaced by the update procedure.').'
                '; - echo '
                  '; - sort($existingfiles); - foreach ($existingfiles as $existingfile) - { - echo '
                • '.htmlspecialchars($existingfile['file']).'
                • '; - } - echo '
                '; - } - - if (count($modifiedfiles)>0) - { - echo $clang->gT('The following files will be modified or deleted but were already modified by someone else.').'
                '; - echo $clang->gT('We recommend that these files should be replaced by the update procedure.').'
                '; - echo '
                  '; - sort($modifiedfiles); - foreach ($modifiedfiles as $modifiedfile) - { - echo '
                • '.htmlspecialchars($modifiedfile['file']).'
                • '; - } - echo '
                '; - } - - if (count($readonlyfiles)>0) - { - echo '
                '.$clang->gT('When checking your file permissions we found one or more problems. Please check for any error messages above and fix these before you can proceed.'); - echo "

                "; - } - else - { - echo $clang->gT('Please check any problems above and then proceed to the next step.').'
                '; - echo "

                "; - - } - } - $_SESSION['updateinfo']=$updateinfo; - $_SESSION['updatesession']=$site_cookies; -} - - -function UpdateStep3() -{ - global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir, $publicdir, $tempdir, $database_exists, $databasetype, $action, $demoModeOnly; - - echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'3').'
                '; - echo '

                '.$clang->gT('Creating DB & file backup').'

                '; - if (!isset( $_SESSION['updateinfo'])) - { - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - - if ($updateinfo['error']==1) - { - setGlobalSetting('updatekey',''); - echo $clang->gT('Your update key is invalid and was removed. ').'
                '; - } - else - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - } - else - { - $updateinfo=$_SESSION['updateinfo']; - } - - // okay, updateinfo now contains all necessary updateinformation - // Create DB and file backups now - - $basefilename = date("YmdHis-").md5(uniqid(rand(), true)); - //Now create a backup of the files to be delete or modified - - Foreach ($updateinfo['files'] as $file) - { - if (is_file($publicdir.$file['file'])===true) // Sort out directories - { - $filestozip[]=$publicdir.$file['file']; - } - } - - require_once("classes/pclzip/pclzip.lib.php"); - // require_once('classes/pclzip/pcltrace.lib.php'); - // require_once('classes/pclzip/pclzip-trace.lib.php'); - - //PclTraceOn(1); - - $archive = new PclZip($tempdir.DIRECTORY_SEPARATOR.'files-'.$basefilename.'.zip'); - - - $v_list = $archive->add($filestozip, PCLZIP_OPT_REMOVE_PATH, $publicdir); - - echo $clang->gT('Creating file backup... ').'
                '; - - if ($v_list == 0) { - die("Error : ".$archive->errorInfo(true)); - } - else - { - echo "".$clang->gT('File backup created:').' '.htmlspecialchars($tempdir.DIRECTORY_SEPARATOR.'files-'.$basefilename.'.zip').'

                '; - - } - - require_once("dumpdb.php"); - - if ($databasetype=='mysql' || $databasetype=='mysqli') - { - echo $clang->gT('Creating database backup... ').'
                '; - $byteswritten=file_put_contents($tempdir.DIRECTORY_SEPARATOR.'db-'.$basefilename.'.sql',completedump()); - if ($byteswritten>5000) - { - echo "".$clang->gT('DB backup created:')." ".htmlspecialchars($tempdir.DIRECTORY_SEPARATOR.'db-'.$basefilename.'.sql').'

                '; - } - } - else - { - echo "".$clang->gT('No DB backup created:').'
                '.$clang->gT('Database backup functionality is currently not available for your database type. Before proceeding please backup your database using a backup tool!').'


                '; - } - - echo $clang->gT('Please check any problems above and then proceed to the final step.'); - echo "

                "; - echo '
                '; -} - - -function UpdateStep4() -{ - global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir, $publicdir, $tempdir, $database_exists, $databasetype, $action, $demoModeOnly; - - echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'4').'

                '; - if (!isset( $_SESSION['updateinfo'])) - { - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - - if ($updateinfo['error']==1) - { - setGlobalSetting('updatekey',''); - echo $clang->gT('Your update key is invalid and was removed. ').'
                '; - } - else - echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; - } - else - { - $updateinfo=$_SESSION['updateinfo']; - } - // this is the last step - Download the zip file, unpack it and replace files accordingly - // Create DB and file backups now - require_once("classes/pclzip/pclzip.lib.php"); - - // require_once('classes/pclzip/pcltrace.lib.php'); - // require_once('classes/pclzip/pclzip-trace.lib.php'); - - // PclTraceOn(2); - require_once($homedir."/classes/http/http.php"); - - $downloaderror=false; - $http=new http_class; - - // Allow redirects - $http->follow_redirect=1; - /* Connection timeout */ - $http->timeout=0; - /* Data transfer timeout */ - $http->data_timeout=0; - $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; - $http->GetRequestArguments("http://update.limesurvey.org/updates/download/{$updateinfo['downloadid']}",$arguments); - $http->RestoreCookies($_SESSION['updatesession']); - - $error=$http->Open($arguments); - $error=$http->SendRequest($arguments); - $http->ReadReplyHeaders($headers); - if ($headers['content-type']=='text/html') - { - @unlink($tempdir.'/update.zip'); - } - elseif($error=='') { - $body=''; - $pFile = fopen($tempdir.'/update.zip', 'w'); - for(;;){ - $error = $http->ReadReplyBody($body,100000); - if($error != "" || strlen($body)==0) break; - fwrite($pFile, $body); - } - fclose($pFile); - } - else - { - print( $error ); - } - - // Now remove all files that are to be deleted according to update process - foreach ($updateinfo['files'] as $afile) - { - if ($afile['type']=='D' && file_exists($rootdir.$afile['file'])) - { - if (is_file($rootdir.$afile['file'])) - { - unlink($rootdir.$afile['file']); - } - else{ - rmdirr($rootdir.$afile['file']); - } - echo sprintf($clang->gT('File deleted: %s'),$afile['file']).'
                '; - } - } - - //Now unzip the new files over the existing ones. - if (file_exists($tempdir.'/update.zip')){ - $archive = new PclZip($tempdir.'/update.zip'); - if ($archive->extract(PCLZIP_OPT_PATH, $rootdir.'/', PCLZIP_OPT_REPLACE_NEWER)== 0) { - die("Error : ".$archive->errorInfo(true)); - } - else - { - echo $clang->gT('New files were successfully installed.').'
                '; - unlink($tempdir.'/update.zip'); - } - } - else - { - echo $clang->gT('There was a problem downloading the update file. Please try to restart the update process.').'
                '; - $downloaderror=true; - } - // PclTraceDisplay(); - - // Now we have to update version.php - if (!$downloaderror) - { - @ini_set('auto_detect_line_endings', true); - $versionlines=file($rootdir.'/version.php'); - $handle = fopen($rootdir.'/version.php', "w"); - foreach ($versionlines as $line) - { - if(strpos($line,'$buildnumber')!==false) - { - $line='$buildnumber'." = '{$_SESSION['updateinfo']['toversion']}';\r\n"; - } - fwrite($handle,$line); - } - fclose($handle); - echo sprintf($clang->gT('Buildnumber was successfully updated to %s.'),$_SESSION['updateinfo']['toversion']).'
                '; - echo $clang->gT('Please check any problems above - update was done.').'
                '; - } - - - echo "

                "; - echo '
                '; - setGlobalSetting('updatelastcheck','1980-01-01 00:00'); - setGlobalSetting('updateavailable','0'); -} - -/** - * This functions checks if the databaseversion in the settings table is the same one as required - * If not then the necessary upgrade procedures are run - */ -function CheckForDBUpgrades() -{ - global $connect, $databasetype, $dbprefix, $dbversionnumber, $clang; - $currentDBVersion=GetGlobalSetting('DBVersion'); - if (intval($dbversionnumber)>intval($currentDBVersion)) - { - if(isset($_GET['continue']) && $_GET['continue']==1) - { - echo "
                "; - $upgradedbtype=$databasetype; - if ($upgradedbtype=='mssql_n' || $upgradedbtype=='odbc_mssql' || $upgradedbtype=='odbtp') $upgradedbtype='mssql'; - if ($upgradedbtype=='mssqlnative') $upgradedbtype = 'mssqlnative'; - if ($upgradedbtype=='mysqli') $upgradedbtype='mysql'; - include ('upgrade-'.$upgradedbtype.'.php'); - include ('upgrade-all.php'); - $tables = $connect->MetaTables(); - db_upgrade_all(intval($currentDBVersion)); - db_upgrade(intval($currentDBVersion)); - echo "
                ".sprintf($clang->gT("Database has been successfully upgraded to version %s"),$dbversionnumber); - } - else { - ShowDBUpgradeNotice(); - } - } -} - -function ShowDBUpgradeNotice() { - global $databasetype, $dbprefix, $databasename, $sitename, $rooturl,$clang; - $error=false; - echo "
                ".$clang->gT('Database upgrade').'

                '; - echo $clang->gT('Please verify the following information before continuing with the database upgrade:').'

                  '; - echo "
                • " .$clang->gT('Database type') . ": " . $databasetype . "
                • "; - echo "
                • " .$clang->gT('Database name') . ": " . $databasename . "
                • "; - echo "
                • " .$clang->gT('Table prefix') . ": " . $dbprefix . "
                • "; - echo "
                • " .$clang->gT('Site name') . ": " . $sitename . "
                • "; - echo "
                • " .$clang->gT('Root URL') . ": " . $rooturl . "
                • "; - echo '
                '; - echo "
                "; - echo "" . $clang->gT('Click here to continue') . ""; - echo "
                "; -} - -?> +timeout=0; + /* Data transfer timeout */ + $http->data_timeout=0; + $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; + $http->GetRequestArguments("http://update.limesurvey.org?updaterbuild=$updaterversion",$arguments); + + $updateinfo=false; + $error=$http->Open($arguments); + $error=$http->SendRequest($arguments); + + $http->ReadReplyHeaders($headers); + + + if($error=="") { + $body=''; $full_body=''; + for(;;){ + $error = $http->ReadReplyBody($body,10000); + if($error != "" || strlen($body)==0) break; + $full_body .= $body; + } + $updateinfo=json_decode($full_body,true); + if ($http->response_status!='200') + { + $updateinfo['errorcode']=$http->response_status; + $updateinfo['errorhtml']=$full_body; + } + } + else + { + $updateinfo['errorcode']=$error; + $updateinfo['errorhtml']=$error; + } + unset( $http ); + if ((int)$updateinfo['UpdaterRevision']<=$updaterversion) + { + return true; + } + + if (!is_writable($tempdir)) + { + echo "
              • ".sprintf($clang->gT("Tempdir %s is not writable"),$tempdir)."
              • "; + $error=true; + } + if (!is_writable($homedir.DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'updater.php')) + { + echo "
              • ".sprintf($clang->gT("Updater file is not writable (%s). Please set according file permissions."),$homedir.DIRECTORY_SEPARATOR.'update'.DIRECTORY_SEPARATOR.'updater.php')."
              • "; + $error=true; + } + + // Download the zip file, unpack it and replace the updater file accordingly + // Create DB and file backups now + require_once("classes/pclzip/pclzip.lib.php"); + + // require_once('classes/pclzip/pcltrace.lib.php'); + // require_once('classes/pclzip/pclzip-trace.lib.php'); + // PclTraceOn(2); + + require_once($homedir."/classes/http/http.php"); + + $downloaderror=false; + $http=new http_class; + + // Allow redirects + $http->follow_redirect=1; + /* Connection timeout */ + $http->timeout=0; + /* Data transfer timeout */ + $http->data_timeout=0; + $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; + $http->GetRequestArguments("http://update.limesurvey.org/updates/downloadupdater/$updaterversion",$arguments); + + $httperror=$http->Open($arguments); + $httperror=$http->SendRequest($arguments); + $http->ReadReplyHeaders($headers); + if ($headers['content-type']=='text/html') + { + @unlink($tempdir.'/updater.zip'); + } + elseif($httperror=='') { + $body=''; $full_body=''; + for(;;){ + $httperror = $http->ReadReplyBody($body,100000); + if($httperror != "" || strlen($body)==0) break; + $full_body .= $body; + } + file_put_contents($tempdir.'/updater.zip',$full_body); + } + else + { + print( $httperror ); + } + + //Now unzip the new updater over the existing ones. + if (file_exists($tempdir.'/updater.zip')){ + $archive = new PclZip($tempdir.'/updater.zip'); + if ($archive->extract(PCLZIP_OPT_PATH, $homedir.'/update/', PCLZIP_OPT_REPLACE_NEWER)== 0) { + die("Error : ".$archive->errorInfo(true)); + } + else + { + unlink($tempdir.'/updater.zip'); + } + } + else + { + echo $clang->gT('There was a problem downloading the updater file. Please try to restart the update process.').'
                '; + $error=true; + } + + +} + +function UpdateStep1() +{ + global $clang, $scriptname, $updatekey, $subaction, $updatebuild, $homedir, $buildnumber, $tempdir, $rootdir; + + + if ($subaction=='keyupdate') + { + setGlobalSetting('updatekey',sanitize_paranoid_string($_POST['updatekey'])); + } + $error=false; + echo '
                '.$clang->gT('Welcome to the ComfortUpdate').'

                '; + echo $clang->gT('The LimeSurvey ComfortUpdate is an easy procedure to quickly update to the latest version of LimeSurvey.').'
                '; + echo $clang->gT('The following steps will be done by this update:').'
                  '; + echo '
                • '.$clang->gT('Your LimeSurvey installation is checked if the update can be run successfully.').'
                • '; + echo '
                • '.$clang->gT('Your DB and any changed files will be backed up.').'
                • '; + echo '
                • '.$clang->gT('New files will be downloaded and installed.').'
                • '; + echo '
                • '.$clang->gT('If necessary the database will be updated.').'
                '; + echo '

                '.$clang->gT('Checking basic requirements...').'

                '; + if ($updatekey==''){ + echo $clang->gT('You need an update key to run the comfort update. During the beta test of this update feature the key "LIMESURVEYUPDATE" can be used.'); + echo "
                '; + echo '
                '; + } + else { + echo "
                • ".$clang->gT('Update key: Valid')."
                • "; + + if (!is_writable($tempdir)) + { + echo "
                • ".sprintf($clang->gT("Tempdir %s is not writable"),$tempdir)."
                • "; + $error=true; + } + if (!is_writable($rootdir.DIRECTORY_SEPARATOR.'version.php')) + { + echo "
                • ".sprintf($clang->gT("Version file is not writable (%s). Please set according file permissions."),$rootdir.DIRECTORY_SEPARATOR.'version.php')."
                • "; + $error=true; + } + echo '

                '.$clang->gT('Change log').'

                '; + require_once($homedir."/classes/http/http.php"); + $updatekey=getGlobalSetting('updatekey'); + + $http=new http_class; + /* Connection timeout */ + $http->timeout=0; + /* Data transfer timeout */ + $http->data_timeout=0; + $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; + $http->GetRequestArguments("http://update.limesurvey.org/updates/changelog/$buildnumber/$updatebuild/$updatekey",$arguments); + + $updateinfo=false; + $httperror=$http->Open($arguments); + $httperror=$http->SendRequest($arguments); + + if($httperror=="") { + $body=''; $full_body=''; + for(;;){ + $httperror = $http->ReadReplyBody($body,10000); + if($httperror != "" || strlen($body)==0) break; + $full_body .= $body; + } + $changelog=json_decode($full_body,true); + echo ''; + } + else + { + print( $httperror ); + } + } + + + if ($error) + { + echo '

                '.$clang->gT('When checking your installation we found one or more problems. Please check for any error messages above and fix these before you can proceed.'); + echo "

                "; + } + else + { + echo '

                '.$clang->gT('Everything looks alright. Please proceed to the next step.'); + echo "

                "; + } + echo '
                '; +} + + +function UpdateStep2() +{ + global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir; + + // Request the list with changed files from the server + + require_once($homedir."/classes/http/http.php"); + $updatekey=getGlobalSetting('updatekey'); + + echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'2').'

                '; + + $http=new http_class; + /* Connection timeout */ + $http->timeout=0; + /* Data transfer timeout */ + $http->data_timeout=0; + $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; + $http->GetRequestArguments("http://update.limesurvey.org/updates/update/$buildnumber/$updatebuild/$updatekey",$arguments); + + $updateinfo=false; + $error=$http->Open($arguments); + $error=$http->SendRequest($arguments); + + if($error=="") { + $body=''; $full_body=''; + for(;;){ + $error = $http->ReadReplyBody($body,10000); + if($error != "" || strlen($body)==0) break; + $full_body .= $body; + } + $updateinfo=json_decode($full_body,true); + $http->SaveCookies($site_cookies); + } + else + { + print( $error ); + } + + if (isset($updateinfo['error'])) + { + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + + if ($updateinfo['error']==1) + { + setGlobalSetting('updatekey',''); + echo $clang->gT('Your update key is invalid and was removed. ').'
                '; + } + else + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + } + // okay, updateinfo now contains all necessary updateinformation + // Now check if the existing files have the mentioned checksum + $existingfiles=array(); + $modifiedfiles=array(); + $readonlyfiles=array(); + if (!isset($updateinfo['files'])) + { + echo "
                +
                ".$clang->gT('Update server busy')."
                +

                ".$clang->gT('The update server is currently busy. This usually happens when the update files for a new version are being prepared.')."

                + ".$clang->gT('Please be patient and try again in about 10 minutes.')."

                +

                "; + + } + else + { + + foreach ($updateinfo['files'] as $afile) + { + if ($afile['type']=='A' && !file_exists($rootdir.$afile['file'])) + { + $searchpath=$rootdir.$afile['file']; + $is_writable=is_writable(dirname($searchpath)); + while (!$is_writable && strlen($searchpath)>strlen($rootdir)) + { + $searchpath=dirname($searchpath); + if (file_exists($searchpath)) + { + $is_writable=is_writable($searchpath); + break; + + } + } + if (!$is_writable) + { + $readonlyfiles[]=$searchpath; + } + } + elseif (file_exists($rootdir.$afile['file']) && !is_writable($rootdir.$afile['file'])) { + $readonlyfiles[]=$rootdir.$afile['file']; + } + + + if ($afile['type']=='A' && file_exists($rootdir.$afile['file'])) + { + //A new file, check if this already exists + $existingfiles[]=$afile; + } + elseif (($afile['type']=='D' || $afile['type']=='M') && is_file($rootdir.$afile['file']) && sha1_file($rootdir.$afile['file'])!=$afile['checksum']) // A deleted or modified file - check if it is unmodified + { + $modifiedfiles[]=$afile; + } + } + + echo '

                '.$clang->gT('Checking existing LimeSurvey files...').'

                '; + if (count($readonlyfiles)>0) + { + echo ''.$clang->gT('Warning: The following files/directories need to be updated but their permissions are set to read-only.').'
                '; + echo $clang->gT('You must set according write permissions on these filese before you can proceed. If you are unsure what to do please contact your system administrator for advice.').'
                '; + echo '
                  '; + $readonlyfiles=array_unique($readonlyfiles); + sort($readonlyfiles); + foreach ($readonlyfiles as $readonlyfile) + { + echo '
                • '.htmlspecialchars($readonlyfile).'
                • '; + } + echo '
                '; + } + if (count($existingfiles)>0) + { + echo $clang->gT('The following files would be added by the update but already exist. This is very unusual and may be co-incidental.').'
                '; + echo $clang->gT('We recommend that these files should be replaced by the update procedure.').'
                '; + echo '
                  '; + sort($existingfiles); + foreach ($existingfiles as $existingfile) + { + echo '
                • '.htmlspecialchars($existingfile['file']).'
                • '; + } + echo '
                '; + } + + if (count($modifiedfiles)>0) + { + echo $clang->gT('The following files will be modified or deleted but were already modified by someone else.').'
                '; + echo $clang->gT('We recommend that these files should be replaced by the update procedure.').'
                '; + echo '
                  '; + sort($modifiedfiles); + foreach ($modifiedfiles as $modifiedfile) + { + echo '
                • '.htmlspecialchars($modifiedfile['file']).'
                • '; + } + echo '
                '; + } + + if (count($readonlyfiles)>0) + { + echo '
                '.$clang->gT('When checking your file permissions we found one or more problems. Please check for any error messages above and fix these before you can proceed.'); + echo "

                "; + } + else + { + echo $clang->gT('Please check any problems above and then proceed to the next step.').'
                '; + echo "

                "; + + } + } + $_SESSION['updateinfo']=$updateinfo; + $_SESSION['updatesession']=$site_cookies; +} + + +function UpdateStep3() +{ + global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir, $publicdir, $tempdir, $database_exists, $databasetype, $action, $demoModeOnly; + + echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'3').'
                '; + echo '

                '.$clang->gT('Creating DB & file backup').'

                '; + if (!isset( $_SESSION['updateinfo'])) + { + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + + if ($updateinfo['error']==1) + { + setGlobalSetting('updatekey',''); + echo $clang->gT('Your update key is invalid and was removed. ').'
                '; + } + else + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + } + else + { + $updateinfo=$_SESSION['updateinfo']; + } + + // okay, updateinfo now contains all necessary updateinformation + // Create DB and file backups now + + $basefilename = date("YmdHis-").md5(uniqid(rand(), true)); + //Now create a backup of the files to be delete or modified + + $filestozip=array(); + Foreach ($updateinfo['files'] as $file) + { + if (is_file($publicdir.$file['file'])===true) // Sort out directories + { + $filestozip[]=$publicdir.$file['file']; + } + } + + require_once("classes/pclzip/pclzip.lib.php"); + // require_once('classes/pclzip/pcltrace.lib.php'); + // require_once('classes/pclzip/pclzip-trace.lib.php'); + + //PclTraceOn(1); + + $archive = new PclZip($tempdir.DIRECTORY_SEPARATOR.'files-'.$basefilename.'.zip'); + + $v_list = $archive->add($filestozip, PCLZIP_OPT_REMOVE_PATH, $publicdir); + + echo $clang->gT('Creating file backup... ').'
                '; + + if ($v_list == 0) { + die("Error : ".$archive->errorInfo(true)); + } + else + { + echo "".$clang->gT('File backup created:').' '.htmlspecialchars($tempdir.DIRECTORY_SEPARATOR.'files-'.$basefilename.'.zip').'

                '; + + } + + require_once("dumpdb.php"); + + if ($databasetype=='mysql' || $databasetype=='mysqli') + { + echo $clang->gT('Creating database backup... ').'
                '; + $byteswritten=file_put_contents($tempdir.DIRECTORY_SEPARATOR.'db-'.$basefilename.'.sql',completedump()); + if ($byteswritten>5000) + { + echo "".$clang->gT('DB backup created:')." ".htmlspecialchars($tempdir.DIRECTORY_SEPARATOR.'db-'.$basefilename.'.sql').'

                '; + } + } + else + { + echo "".$clang->gT('No DB backup created:').'
                '.$clang->gT('Database backup functionality is currently not available for your database type. Before proceeding please backup your database using a backup tool!').'


                '; + } + + echo $clang->gT('Please check any problems above and then proceed to the final step.'); + echo "

                "; + echo '
                '; +} + + +function UpdateStep4() +{ + global $clang, $scriptname, $homedir, $buildnumber, $updatebuild, $debug, $rootdir, $publicdir, $tempdir, $database_exists, $databasetype, $action, $demoModeOnly; + + echo '
                '.sprintf($clang->gT('ComfortUpdate step %s'),'4').'

                '; + if (!isset( $_SESSION['updateinfo'])) + { + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + + if ($updateinfo['error']==1) + { + setGlobalSetting('updatekey',''); + echo $clang->gT('Your update key is invalid and was removed. ').'
                '; + } + else + echo $clang->gT('On requesting the update information from limesurvey.org there has been an error:').'
                '; + } + else + { + $updateinfo=$_SESSION['updateinfo']; + } + // this is the last step - Download the zip file, unpack it and replace files accordingly + // Create DB and file backups now + require_once("classes/pclzip/pclzip.lib.php"); + + // require_once('classes/pclzip/pcltrace.lib.php'); + // require_once('classes/pclzip/pclzip-trace.lib.php'); + + // PclTraceOn(2); + require_once($homedir."/classes/http/http.php"); + + $downloaderror=false; + $http=new http_class; + + // Allow redirects + $http->follow_redirect=1; + /* Connection timeout */ + $http->timeout=0; + /* Data transfer timeout */ + $http->data_timeout=0; + $http->user_agent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)"; + $http->GetRequestArguments("http://update.limesurvey.org/updates/download/{$updateinfo['downloadid']}",$arguments); + $http->RestoreCookies($_SESSION['updatesession']); + + $error=$http->Open($arguments); + $error=$http->SendRequest($arguments); + $http->ReadReplyHeaders($headers); + if ($headers['content-type']=='text/html') + { + @unlink($tempdir.'/update.zip'); + } + elseif($error=='') { + $body=''; + $pFile = fopen($tempdir.'/update.zip', 'w'); + for(;;){ + $error = $http->ReadReplyBody($body,100000); + if($error != "" || strlen($body)==0) break; + fwrite($pFile, $body); + } + fclose($pFile); + } + else + { + print( $error ); + } + + // Now remove all files that are to be deleted according to update process + foreach ($updateinfo['files'] as $afile) + { + if ($afile['type']=='D' && file_exists($rootdir.$afile['file'])) + { + if (is_file($rootdir.$afile['file'])) + { + unlink($rootdir.$afile['file']); + } + else{ + rmdirr($rootdir.$afile['file']); + } + echo sprintf($clang->gT('File deleted: %s'),$afile['file']).'
                '; + } + } + + //Now unzip the new files over the existing ones. + if (file_exists($tempdir.'/update.zip')){ + $archive = new PclZip($tempdir.'/update.zip'); + if ($archive->extract(PCLZIP_OPT_PATH, $rootdir.'/', PCLZIP_OPT_REPLACE_NEWER)== 0) { + die("Error : ".$archive->errorInfo(true)); + } + else + { + echo $clang->gT('New files were successfully installed.').'
                '; + unlink($tempdir.'/update.zip'); + } + } + else + { + echo $clang->gT('There was a problem downloading the update file. Please try to restart the update process.').'
                '; + $downloaderror=true; + } + // PclTraceDisplay(); + + // Now we have to update version.php + if (!$downloaderror) + { + @ini_set('auto_detect_line_endings', true); + $versionlines=file($rootdir.'/version.php'); + $handle = fopen($rootdir.'/version.php', "w"); + foreach ($versionlines as $line) + { + if(strpos($line,'$buildnumber')!==false) + { + $line='$buildnumber'." = '{$_SESSION['updateinfo']['toversion']}';\r\n"; + } + fwrite($handle,$line); + } + fclose($handle); + echo sprintf($clang->gT('Buildnumber was successfully updated to %s.'),$_SESSION['updateinfo']['toversion']).'
                '; + echo $clang->gT('Please check any problems above - update was done.').'
                '; + } + + + echo "

                "; + echo '
                '; + setGlobalSetting('updatelastcheck','1980-01-01 00:00'); + setGlobalSetting('updateavailable','0'); +} + +/** + * This functions checks if the databaseversion in the settings table is the same one as required + * If not then the necessary upgrade procedures are run + */ +function CheckForDBUpgrades() +{ + global $connect, $databasetype, $dbprefix, $dbversionnumber, $clang; + $currentDBVersion=GetGlobalSetting('DBVersion'); + if (floatval($dbversionnumber)>intval($currentDBVersion)) + { + if(isset($_GET['continue']) && $_GET['continue']==1) + { + echo "
                "; + $upgradedbtype=$databasetype; + if ($upgradedbtype=='mssql_n' || $upgradedbtype=='odbc_mssql' || $upgradedbtype=='odbtp') $upgradedbtype='mssql'; + if ($upgradedbtype=='mssqlnative') $upgradedbtype = 'mssqlnative'; + if ($upgradedbtype=='mysqli') $upgradedbtype='mysql'; + include ('upgrade-'.$upgradedbtype.'.php'); + include ('upgrade-all.php'); + $tables = $connect->MetaTables(); + db_upgrade_all(floatval($currentDBVersion)); + db_upgrade(floatval($currentDBVersion)); + echo "
                ".sprintf($clang->gT("Database has been successfully upgraded to version %s"),$dbversionnumber); + } + else { + ShowDBUpgradeNotice(); + } + } +} + +function ShowDBUpgradeNotice() { + global $databasetype, $dbprefix, $databasename, $sitename, $rooturl,$clang; + $error=false; + echo "
                ".$clang->gT('Database upgrade').'

                '; + echo $clang->gT('Please verify the following information before continuing with the database upgrade:').'

                  '; + echo "
                • " .$clang->gT('Database type') . ": " . $databasetype . "
                • "; + echo "
                • " .$clang->gT('Database name') . ": " . $databasename . "
                • "; + echo "
                • " .$clang->gT('Table prefix') . ": " . $dbprefix . "
                • "; + echo "
                • " .$clang->gT('Site name') . ": " . $sitename . "
                • "; + echo "
                • " .$clang->gT('Root URL') . ": " . $rooturl . "
                • "; + echo '
                '; + echo "
                "; + echo "" . $clang->gT('Click here to continue') . ""; + echo "
                "; +} + +?> diff --git a/include/limesurvey/admin/update/upgrade-all.php b/include/limesurvey/admin/update/upgrade-all.php index e23c0a00..c9012a8b 100644 --- a/include/limesurvey/admin/update/upgrade-all.php +++ b/include/limesurvey/admin/update/upgrade-all.php @@ -1,204 +1,233 @@ -gT('The LimeSurvey database is being upgraded').' ('.date('Y-m-d H:i:s').')',14096).".". $clang->gT('Please be patient...')."

                \n"; - - if ($oldversion < 143) - { - // Move all user templates to the new user template directory - echo sprintf($clang->gT("Moving user templates to new location at %s..."),$usertemplaterootdir)."
                "; - $myDirectory = opendir($standardtemplaterootdir); - $aFailedTemplates=array(); - // get each entry - while($entryName = readdir($myDirectory)) { - if (!in_array($entryName,array('.','..','.svn')) && is_dir($standardtemplaterootdir.DIRECTORY_SEPARATOR.$entryName) && !isStandardTemplate($entryName)) - { - if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$entryName,$usertemplaterootdir.DIRECTORY_SEPARATOR.$entryName)) - { - $aFailedTemplates[]=$entryName; - }; - } - } - if (count($aFailedTemplates)>0) - { - echo "The following templates at {$standardtemplaterootdir} could not be moved to the new location at {$usertemplaterootdir}:
                  "; - foreach ($aFailedTemplates as $sFailedTemplate) - { - echo "
                • {$sFailedTemplate}
                • "; - } - echo "
                Please move these templates manually after the upgrade has finished.
                "; - } - // close directory - closedir($myDirectory); - - } -} - -function upgrade_survey_table145() -{ - global $modifyoutput, $connect; - $sSurveyQuery = "SELECT * FROM ".db_table_name('surveys')." where notification<>'0'"; - $oSurveyResult = db_execute_assoc($sSurveyQuery); - while ( $aSurveyRow = $oSurveyResult->FetchRow() ) - { - if ($aSurveyRow['notification']=='1' && trim($aSurveyRow['adminemail'])!='') - { - $aEmailAddresses=explode(';',$aSurveyRow['adminemail']); - $sAdminEmailAddress=$aEmailAddresses[0]; - $sEmailnNotificationAddresses=implode(';',$aEmailAddresses); - $sSurveyUpdateQuery= "update ".db_table_name('surveys')." set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailnNotificationAddresses}' where sid=".$aSurveyRow['sid']; - $connect->execute($sSurveyUpdateQuery); - } - else - { - $aEmailAddresses=explode(';',$aSurveyRow['adminemail']); - $sAdminEmailAddress=$aEmailAddresses[0]; - $sEmailDetailedNotificationAddresses=implode(';',$aEmailAddresses); - if (trim($aSurveyRow['emailresponseto'])!='') - { - $sEmailDetailedNotificationAddresses=$sEmailDetailedNotificationAddresses.';'.trim($aSurveyRow['emailresponseto']); - } - $sSurveyUpdateQuery= "update ".db_table_name('surveys')." set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailDetailedNotificationAddresses}' where sid=".$aSurveyRow['sid']; - $connect->execute($sSurveyUpdateQuery); - } - } - $sSurveyQuery = "SELECT * FROM ".db_table_name('surveys_languagesettings'); - $oSurveyResult = db_execute_assoc($sSurveyQuery); - while ( $aSurveyRow = $oSurveyResult->FetchRow() ) - { - $oLanguage = new limesurvey_lang($aSurveyRow['surveyls_language']); - $aDefaultTexts=aTemplateDefaultTexts($oLanguage,'unescaped'); - unset($oLanguage); - $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']}, - email_admin_responses={$aDefaultTexts['admin_detailed_notification']}, - email_admin_notification_subj={$aDefaultTexts['admin_notification_subject']}, - email_admin_notification={$aDefaultTexts['admin_notification']} - where surveyls_survey_id=".$aSurveyRow['surveyls_survey_id']; - $connect->execute($sSurveyUpdateQuery); - } - -} - - -function upgrade_surveypermissions_table145() -{ - global $modifyoutput, $connect; - $sPermissionQuery = "SELECT * FROM ".db_table_name('surveys_rights'); - $oPermissionResult = db_execute_assoc($sPermissionQuery); - if (!$oPermissionResult) {return "Database Error";} - else - { - $tablename=db_table_name_nq('survey_permissions'); - while ( $aPermissionRow = $oPermissionResult->FetchRow() ) - { - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'assessments', - 'create_p'=>$aPermissionRow['define_questions'], - 'read_p'=>$aPermissionRow['define_questions'], - 'update_p'=>$aPermissionRow['define_questions'], - 'delete_p'=>$aPermissionRow['define_questions'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'quotas', - 'create_p'=>$aPermissionRow['define_questions'], - 'read_p'=>$aPermissionRow['define_questions'], - 'update_p'=>$aPermissionRow['define_questions'], - 'delete_p'=>$aPermissionRow['define_questions'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'responses', - 'create_p'=>$aPermissionRow['browse_response'], - 'read_p'=>$aPermissionRow['browse_response'], - 'update_p'=>$aPermissionRow['browse_response'], - 'delete_p'=>$aPermissionRow['delete_survey'], - 'export_p'=>$aPermissionRow['export'], - 'import_p'=>$aPermissionRow['browse_response'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'statistics', - 'read_p'=>$aPermissionRow['browse_response'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'survey', - 'read_p'=>1, - 'delete_p'=>$aPermissionRow['delete_survey'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveyactivation', - 'update_p'=>$aPermissionRow['activate_survey'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveycontent', - 'create_p'=>$aPermissionRow['define_questions'], - 'read_p'=>$aPermissionRow['define_questions'], - 'update_p'=>$aPermissionRow['define_questions'], - 'delete_p'=>$aPermissionRow['define_questions'], - 'export_p'=>$aPermissionRow['export'], - 'import_p'=>$aPermissionRow['define_questions'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveylocale', - 'read_p'=>$aPermissionRow['edit_survey_property'], - 'update_p'=>$aPermissionRow['edit_survey_property'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveysettings', - 'read_p'=>$aPermissionRow['edit_survey_property'], - 'update_p'=>$aPermissionRow['edit_survey_property'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid'])); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - - $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'tokens', - 'create_p'=>$aPermissionRow['activate_survey'], - 'read_p'=>$aPermissionRow['activate_survey'], - 'update_p'=>$aPermissionRow['activate_survey'], - 'delete_p'=>$aPermissionRow['activate_survey'], - 'export_p'=>$aPermissionRow['export'], - 'import_p'=>$aPermissionRow['activate_survey'], - 'sid'=>$aPermissionRow['sid'], - 'uid'=>$aPermissionRow['uid']) - ); - modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();ob_flush(); - } - } -} +gT('The LimeSurvey database is being upgraded').' ('.date('Y-m-d H:i:s').')',14096).".". $clang->gT('Please be patient...')."

                \n"; + + if ($oldversion < 143) + { + // Move all user templates to the new user template directory + echo sprintf($clang->gT("Moving user templates to new location at %s..."),$usertemplaterootdir)."
                "; + $myDirectory = opendir($standardtemplaterootdir); + $aFailedTemplates=array(); + // get each entry + while($entryName = readdir($myDirectory)) { + if (!in_array($entryName,array('.','..','.svn')) && is_dir($standardtemplaterootdir.DIRECTORY_SEPARATOR.$entryName) && !isStandardTemplate($entryName)) + { + if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$entryName,$usertemplaterootdir.DIRECTORY_SEPARATOR.$entryName)) + { + $aFailedTemplates[]=$entryName; + }; + } + } + if (count($aFailedTemplates)>0) + { + echo "The following templates at {$standardtemplaterootdir} could not be moved to the new location at {$usertemplaterootdir}:
                  "; + foreach ($aFailedTemplates as $sFailedTemplate) + { + echo "
                • {$sFailedTemplate}
                • "; + } + echo "
                Please move these templates manually after the upgrade has finished.
                "; + } + // close directory + closedir($myDirectory); + + } +} + +function upgrade_question_attributes148() +{ + global $modifyoutput, $dbprefix; + $sDBPrefix=$dbprefix; + $sSurveyQuery = "SELECT sid FROM {$sDBPrefix}surveys"; + $oSurveyResult = db_execute_assoc($sSurveyQuery); + while ( $aSurveyRow = $oSurveyResult->FetchRow() ) + { + $surveyid=$aSurveyRow['sid']; + $languages=array_merge(array(GetBaseLanguageFromSurveyID($surveyid)), GetAdditionalLanguagesFromSurveyID($surveyid)); + + $sAttributeQuery = "select q.qid,attribute,value from {$sDBPrefix}question_attributes qa , {$sDBPrefix}questions q where q.qid=qa.qid and sid={$surveyid}"; + $oAttributeResult = db_execute_assoc($sAttributeQuery); + $aAllAttributes = questionAttributes(true); + while ( $aAttributeRow = $oAttributeResult->FetchRow() ) + { + if (isset($aAllAttributes[$aAttributeRow['attribute']]['i18n']) && $aAllAttributes[$aAttributeRow['attribute']]['i18n']) + { + modify_database("delete from {$sDBPrefix}question_attributes where qid={$aAttributeRow['qid']} and attribute='{$aAttributeRow['attribute']}'"); echo $modifyoutput; flush();@ob_flush(); + foreach ($languages as $language) + { + $sAttributeInsertQuery="insert into {$sDBPrefix}question_attributes (qid,attribute,value,language) VALUES({$aAttributeRow['qid']},'{$aAttributeRow['attribute']}','{$aAttributeRow['value']}','{$language}' )"; + modify_database("",$sAttributeInsertQuery); echo $modifyoutput; flush();@ob_flush(); + } + } + } + } +} + +function upgrade_survey_table145() +{ + global $modifyoutput, $connect; + $sSurveyQuery = "SELECT * FROM ".db_table_name('surveys')." where notification<>'0'"; + $oSurveyResult = db_execute_assoc($sSurveyQuery); + while ( $aSurveyRow = $oSurveyResult->FetchRow() ) + { + if ($aSurveyRow['notification']=='1' && trim($aSurveyRow['adminemail'])!='') + { + $aEmailAddresses=explode(';',$aSurveyRow['adminemail']); + $sAdminEmailAddress=$aEmailAddresses[0]; + $sEmailnNotificationAddresses=implode(';',$aEmailAddresses); + $sSurveyUpdateQuery= "update ".db_table_name('surveys')." set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailnNotificationAddresses}' where sid=".$aSurveyRow['sid']; + $connect->execute($sSurveyUpdateQuery); + } + else + { + $aEmailAddresses=explode(';',$aSurveyRow['adminemail']); + $sAdminEmailAddress=$aEmailAddresses[0]; + $sEmailDetailedNotificationAddresses=implode(';',$aEmailAddresses); + if (trim($aSurveyRow['emailresponseto'])!='') + { + $sEmailDetailedNotificationAddresses=$sEmailDetailedNotificationAddresses.';'.trim($aSurveyRow['emailresponseto']); + } + $sSurveyUpdateQuery= "update ".db_table_name('surveys')." set adminemail='{$sAdminEmailAddress}', emailnotificationto='{$sEmailDetailedNotificationAddresses}' where sid=".$aSurveyRow['sid']; + $connect->execute($sSurveyUpdateQuery); + } + } + $sSurveyQuery = "SELECT * FROM ".db_table_name('surveys_languagesettings'); + $oSurveyResult = db_execute_assoc($sSurveyQuery); + while ( $aSurveyRow = $oSurveyResult->FetchRow() ) + { + $oLanguage = new limesurvey_lang($aSurveyRow['surveyls_language']); + $aDefaultTexts=aTemplateDefaultTexts($oLanguage,'unescaped'); + unset($oLanguage); + $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']}, + email_admin_responses={$aDefaultTexts['admin_detailed_notification']}, + email_admin_notification_subj={$aDefaultTexts['admin_notification_subject']}, + email_admin_notification={$aDefaultTexts['admin_notification']} + where surveyls_survey_id=".$aSurveyRow['surveyls_survey_id']; + $connect->execute($sSurveyUpdateQuery); + } + +} + + +function upgrade_surveypermissions_table145() +{ + global $modifyoutput, $connect; + $sPermissionQuery = "SELECT * FROM ".db_table_name('surveys_rights'); + $oPermissionResult = db_execute_assoc($sPermissionQuery); + if (!$oPermissionResult) {return "Database Error";} + else + { + $tablename=db_table_name_nq('survey_permissions'); + while ( $aPermissionRow = $oPermissionResult->FetchRow() ) + { + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'assessments', + 'create_p'=>$aPermissionRow['define_questions'], + 'read_p'=>$aPermissionRow['define_questions'], + 'update_p'=>$aPermissionRow['define_questions'], + 'delete_p'=>$aPermissionRow['define_questions'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'quotas', + 'create_p'=>$aPermissionRow['define_questions'], + 'read_p'=>$aPermissionRow['define_questions'], + 'update_p'=>$aPermissionRow['define_questions'], + 'delete_p'=>$aPermissionRow['define_questions'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'responses', + 'create_p'=>$aPermissionRow['browse_response'], + 'read_p'=>$aPermissionRow['browse_response'], + 'update_p'=>$aPermissionRow['browse_response'], + 'delete_p'=>$aPermissionRow['delete_survey'], + 'export_p'=>$aPermissionRow['export'], + 'import_p'=>$aPermissionRow['browse_response'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'statistics', + 'read_p'=>$aPermissionRow['browse_response'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'survey', + 'read_p'=>1, + 'delete_p'=>$aPermissionRow['delete_survey'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveyactivation', + 'update_p'=>$aPermissionRow['activate_survey'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveycontent', + 'create_p'=>$aPermissionRow['define_questions'], + 'read_p'=>$aPermissionRow['define_questions'], + 'update_p'=>$aPermissionRow['define_questions'], + 'delete_p'=>$aPermissionRow['define_questions'], + 'export_p'=>$aPermissionRow['export'], + 'import_p'=>$aPermissionRow['define_questions'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveylocale', + 'read_p'=>$aPermissionRow['edit_survey_property'], + 'update_p'=>$aPermissionRow['edit_survey_property'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'surveysettings', + 'read_p'=>$aPermissionRow['edit_survey_property'], + 'update_p'=>$aPermissionRow['edit_survey_property'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid'])); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + + $sPermissionInsertQuery=$connect->GetInsertSQL($tablename,array('permission'=>'tokens', + 'create_p'=>$aPermissionRow['activate_survey'], + 'read_p'=>$aPermissionRow['activate_survey'], + 'update_p'=>$aPermissionRow['activate_survey'], + 'delete_p'=>$aPermissionRow['activate_survey'], + 'export_p'=>$aPermissionRow['export'], + 'import_p'=>$aPermissionRow['activate_survey'], + 'sid'=>$aPermissionRow['sid'], + 'uid'=>$aPermissionRow['uid']) + ); + modify_database("",$sPermissionInsertQuery); echo $modifyoutput; flush();@ob_flush(); + } + } +} diff --git a/include/limesurvey/admin/update/upgrade-mssql.php b/include/limesurvey/admin/update/upgrade-mssql.php index 18287040..f1b4a6d4 100644 --- a/include/limesurvey/admin/update/upgrade-mssql.php +++ b/include/limesurvey/admin/update/upgrade-mssql.php @@ -1,815 +1,928 @@ -'german-informal', - 'cns'=>'cn-Hans', - 'cnt'=>'cn-Hant', - 'pt_br'=>'pt-BR', - 'gr'=>'el', - 'jp'=>'ja', - 'si'=>'sl', - 'se'=>'sv', - 'vn'=>'vi'); - - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update [prefix_answers] set [language]='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_questions] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_groups] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_labels] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_surveys] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_users] set [lang]='$newlang where lang='$oldlang'");echo $modifyoutput; flush();ob_flush(); - } - - - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update [prefix_labelsets] set [languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush(); - } - - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update [prefix_surveys] set [additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush(); - } - modify_database("","update [prefix_settings_global] set [stg_value]='111' where stg_name='DBVersion'"); echo $modifyoutput; - - } - - if ($oldversion < 112) { - //The size of the users_name field is now 64 char (20 char before version 112) - modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [users_name] VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 113) { - //No action needed - modify_database("","update [prefix_settings_global] set [stg_value]='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 114) { - modify_database("","ALTER TABLE [prefix_saved_control] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [adminemail] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("",'INSERT INTO [prefix_settings_global] VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 126) { - modify_database("","ALTER TABLE [prefix_surveys] ADD [printanswers] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [listpublic] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_tables117(); - upgrade_survey_tables118(); - //119 - modify_database("","CREATE TABLE [prefix_quota] ( - [id] int NOT NULL IDENTITY (1,1), - [sid] int, - [name] varchar(255) , - [qlimit] int , - [action] int , - [active] int NOT NULL default '1', - PRIMARY KEY ([id]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_quota_members] ( - [id] int NOT NULL IDENTITY (1,1), - [sid] int , - [qid] int , - [quota_id] int , - [code] varchar(5) , - PRIMARY KEY ([id]) - );");echo $modifyoutput; flush();ob_flush(); - - // Rename Norwegian language code from NO to NB - $oldnewlanguages=array('no'=>'nb'); - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update [prefix_answers] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_questions] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_groups] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_labels] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_surveys] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_users] set [lang]='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update [prefix_labelsets] set [languages]='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush();} - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update [prefix_surveys] set [additional_languages]='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush();} - } - - modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_templates_rights] ( - [uid] int NOT NULL, - [folder] varchar(255) NOT NULL, - [use] int NOT NULL, - PRIMARY KEY ([uid],[folder]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_templates] ( - [folder] varchar(255) NOT NULL, - [creator] int NOT NULL, - PRIMARY KEY ([folder]) - );");echo $modifyoutput; flush();ob_flush(); - //123 - modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [value] VARCHAR(255)"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('title','labels'); - modify_database("","ALTER TABLE [prefix_labels] ALTER COLUMN [title] varchar(4000)"); echo $modifyoutput; flush();ob_flush(); - //124 - modify_database("","ALTER TABLE [prefix_surveys] ADD [bounce_email] text"); echo $modifyoutput; flush();ob_flush(); - //125 - upgrade_token_tables125(); - modify_database("","EXEC sp_rename 'prefix_users.move_user','superadmin'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_users] SET [superadmin]=1 where ([create_survey]=1 AND [create_user]=1 AND [delete_user]=1 AND [configurator]=1)"); echo $modifyoutput; flush();ob_flush(); - //126 - modify_database("","ALTER TABLE [prefix_questions] ADD [lid1] int NOT NULL DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_conditions] SET [method]='==' where ( [method] is null) or [method]='' or [method]='0'"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update [prefix_settings_global] set [stg_value]='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 127) { - modify_database("","create index [answers_idx2] on [prefix_answers] ([sortorder])"); echo $modifyoutput; - modify_database("","create index [assessments_idx2] on [prefix_assessments] ([sid])"); echo $modifyoutput; - modify_database("","create index [assessments_idx3] on [prefix_assessments] ([gid])"); echo $modifyoutput; - modify_database("","create index [conditions_idx2] on [prefix_conditions] ([qid])"); echo $modifyoutput; - modify_database("","create index [conditions_idx3] on [prefix_conditions] ([cqid])"); echo $modifyoutput; - modify_database("","create index [groups_idx2] on [prefix_groups] ([sid])"); echo $modifyoutput; - modify_database("","create index [question_attributes_idx2] on [prefix_question_attributes] ([qid])"); echo $modifyoutput; - modify_database("","create index [questions_idx2] on [prefix_questions] ([sid])"); echo $modifyoutput; - modify_database("","create index [questions_idx3] on [prefix_questions] ([gid])"); echo $modifyoutput; - modify_database("","create index [questions_idx4] on [prefix_questions] ([type])"); echo $modifyoutput; - modify_database("","create index [quota_idx2] on [prefix_quota] ([sid])"); echo $modifyoutput; - modify_database("","create index [saved_control_idx2] on [prefix_saved_control] ([sid])"); echo $modifyoutput; - modify_database("","create index [user_in_groups_idx1] on [prefix_user_in_groups] ([ugid], [uid])"); echo $modifyoutput; - modify_database("","update [prefix_settings_global] set [stg_value]='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 128) { - upgrade_token_tables128(); - modify_database("","update [prefix_settings_global] set [stg_value]='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 129) { - //128 - modify_database("","ALTER TABLE [prefix_surveys] ADD [startdate] DATETIME"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [usestartdate] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 130) - { - modify_database("","ALTER TABLE [prefix_conditions] ADD [scenario] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_conditions] SET [scenario]=1 where ( [scenario] is null) or [scenario]='' or [scenario]=0"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 131) - { - modify_database("","ALTER TABLE [prefix_surveys] ADD [publicstatistics] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 132) - { - modify_database("","ALTER TABLE [prefix_surveys] ADD [publicgraphs] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 133) - { - modify_database("","ALTER TABLE [prefix_users] ADD [one_time_pw] text"); echo $modifyoutput; flush();ob_flush(); - // Add new assessment setting - modify_database("","ALTER TABLE [prefix_surveys] ADD [assessments] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - // add new assessment value fields to answers & labels - modify_database("","ALTER TABLE [prefix_answers] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_labels] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - // copy any valid codes from code field to assessment field - modify_database("","update [prefix_answers] set [assessment_value]=CAST([code] as int)");// no output here is intended - modify_database("","update [prefix_labels] set [assessment_value]=CAST([code] as int)");// no output here is intended - // activate assessment where assesment rules exist - modify_database("","update [prefix_surveys] set [assessments]='Y' where [sid] in (SELECT [sid] FROM [prefix_assessments] group by [sid])"); echo $modifyoutput; flush();ob_flush(); - // add language field to assessment table - modify_database("","ALTER TABLE [prefix_assessments] ADD [language] varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();ob_flush(); - // update language field with default language of that particular survey - modify_database("","update [prefix_assessments] set [language]=(select [language] from [prefix_surveys] where [sid]=[prefix_assessments].[sid])"); echo $modifyoutput; flush();ob_flush(); - // copy assessment link to message since from now on we will have HTML assignment messages - modify_database("","update [prefix_assessments] set [message]=cast([message] as varchar) +'
                '+[link]+''"); echo $modifyoutput; flush();ob_flush(); - // drop the old link field - modify_database("","ALTER TABLE [prefix_assessments] DROP COLUMN [link]"); echo $modifyoutput; flush();ob_flush(); - // change the primary index to include language - // and fix missing translations for assessments - upgrade_survey_tables133a(); - - // Add new fields to survey language settings - modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_url] varchar(255)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_endtext] text"); echo $modifyoutput; flush();ob_flush(); - // copy old URL fields ot language specific entries - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_url]=(select [url] from [prefix_surveys] where [sid]=[prefix_surveys_languagesettings].[surveyls_survey_id])"); echo $modifyoutput; flush();ob_flush(); - // drop old URL field - mssql_drop_constraint('url','surveys'); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [url]"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update [prefix_settings_global] set [stg_value]='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 134) - { - // Add new assessment setting - modify_database("","ALTER TABLE [prefix_surveys] ADD [usetokens] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('attribute1','surveys'); - mssql_drop_constraint('attribute2','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] ADD [attributedescriptions] TEXT;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute1]"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute2]"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables134(); - modify_database("","update [prefix_settings_global] set [stg_value]='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 135) - { - mssql_drop_constraint('value','question_attributes'); - modify_database("","ALTER TABLE [prefix_question_attributes] ALTER COLUMN [value] text"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_answers] ALTER COLUMN [answer] varchar(8000)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 136) //New quota functions - { - modify_database("", "ALTER TABLE[prefix_quota] ADD [autoload_url] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_quota_languagesettings] ( - [quotals_id] int NOT NULL IDENTITY (1,1), - [quotals_quota_id] int, - [quotals_language] varchar(45) NOT NULL default 'en', - [quotals_name] varchar(255), - [quotals_message] text, - [quotals_url] varchar(255), - [quotals_urldescrip] varchar(255), - PRIMARY KEY ([quotals_id]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 137) //New date format specs - { - modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_users] ADD [dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update [prefix_surveys] set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update [prefix_surveys] set expires=null where useexpiry='N'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('usestartdate','surveys'); - mssql_drop_constraint('useexpiry','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN usestartdate"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN useexpiry"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 138) //Modify quota field - { - modify_database("", "ALTER TABLE [prefix_quota_members] ALTER COLUMN [code] VARCHAR(11) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 139) //Modify quota field - { - upgrade_survey_tables139(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 140) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD [emailresponseto] text"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 141) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD [tokenlength] tinyint NOT NULL default '15'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 142) //Modify surveys table - { - upgrade_question_attributes142(); - modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [startdate] datetime NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [expires] datetime NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_question_attributes] SET [value]='0' WHERE cast([value] as varchar)='false'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_question_attributes] SET [value]='1' WHERE cast([value] as varchar)='true'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 143) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_questions] ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_answers] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_questions] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_questions] ADD same_default tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_primary_index('answers'); - modify_database("","ALTER TABLE [prefix_answers] ADD CONSTRAINT pk_answers_qcls PRIMARY KEY ([qid],[code],[language],[scale_id])"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_defaultvalues] ( - [qid] integer NOT NULL default '0', - [scale_id] tinyint NOT NULL default '0', - [sqid] integer NOT NULL default '0', - [language] varchar(20) NOT NULL, - [specialtype] varchar(20) NOT NULL default '', - [defaultvalue] text, - CONSTRAINT pk_defaultvalues_qlss PRIMARY KEY ([qid] , [scale_id], [language], [specialtype], [sqid]))"); echo $modifyoutput; flush();ob_flush(); - - // -Move all 'answers' that are subquestions to the questions table - // -Move all 'labels' that are answers to the answers table - // -Transscribe the default values where applicable - // -Move default values from answers to questions - upgrade_tables143(); - - mssql_drop_constraint('default_value','answers'); - modify_database("", "ALTER TABLE [prefix_answers] DROP COLUMN [default_value]"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('lid','questions'); - modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('lid1','questions'); - modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid1"); echo $modifyoutput; flush();ob_flush(); - // add field for timings and table for extended conditions - modify_database("", "ALTER TABLE [prefix_surveys] ADD savetimings char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_sessions( - sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', - expiry DATETIME NOT NULL , - expireref VARCHAR( 250 ) DEFAULT '', - created DATETIME NOT NULL , - modified DATETIME NOT NULL , - sessdata text, - CONSTRAINT pk_sessions_sesskey PRIMARY KEY ( [sesskey] ))"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "create index [idx_expiry] on [prefix_sessions] ([expiry])"); echo $modifyoutput; - modify_database("", "create index [idx_expireref] on [prefix_sessions] ([expireref])"); echo $modifyoutput; - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - - - - - } - - if ($oldversion < 145) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD showXquestions CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showgroupinfo CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD shownoanswer CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bouncetime BIGINT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceprocessing VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounttype VARCHAR(4) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounthost VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountpass VARCHAR(100) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountencryption VARCHAR(3) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountuser VARCHAR(200) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showwelcome CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD navigationdelay tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD nokeyboard CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD alloweditaftercompletion CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_survey_permissions] ( - [sid] INT NOT NULL, - [uid] INT NOT NULL, - [permission] VARCHAR(20) NOT NULL, - [create_p] TINYINT NOT NULL default '0', - [read_p] TINYINT NOT NULL default '0', - [update_p] TINYINT NOT NULL default '0', - [delete_p] TINYINT NOT NULL default '0', - [import_p] TINYINT NOT NULL default '0', - [export_p] TINYINT NOT NULL default '0', - PRIMARY KEY ([sid], [uid],[permission]) - );"); echo $modifyoutput; flush();ob_flush(); - upgrade_surveypermissions_table145(); - modify_database("", "DROP TABLE [prefix_surveys_rights]"); echo $modifyoutput; flush();ob_flush(); - - // Add new fields for email templates - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD - email_admin_notification_subj VARCHAR(255) NULL, - email_admin_notification TEXT NULL, - email_admin_responses_subj VARCHAR(255) NULL, - email_admin_responses TEXT NULL"); - - //Add index to questions table to speed up subquestions - modify_database("", "create index [parent_qid_idx] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto text DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_table145(); - mssql_drop_constraint('notification','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN [notification]"); echo $modifyoutput; flush();ob_flush(); - - // modify length of method in conditions - modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [method] CHAR( 5 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - //Add index to questions table to speed up subquestions - modify_database("", "create index [parent_qid] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE prefix_surveys set [private]='N' where [private] is NULL;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","EXEC sp_rename 'prefix_surveys.private','anonymized'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [anonymized] char(1) NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('anonymized','surveys'); - modify_database("","ALTER TABLE [prefix_surveys] ADD CONSTRAINT DF_surveys_anonymized DEFAULT 'N' FOR [anonymized];"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_failed_login_attempts] ( - [id] INT NOT NULL IDENTITY (1,1) PRIMARY KEY, - [ip] varchar(37) NOT NULL, - [last_attempt] varchar(20) NOT NULL, - [number_attempts] int NOT NULL );"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_numberformat] INT default 0 NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - upgrade_token_tables145(); - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - } - if ($oldversion < 146) //Modify surveys table - { - upgrade_timing_tables146(); - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - - echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; - return true; -} - -function upgrade_survey_tables117() -{ - global $modifyoutput; - $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD [startdate] datetime"); echo $modifyoutput; flush();ob_flush(); - } - } -} - - -function upgrade_survey_tables118() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ALTER COLUMN [token] VARCHAR(36)"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_token_tables125() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [emailstatus] VARCHAR(300) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_token_tables128() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [remindersent] VARCHAR(17) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv." ADD [remindercount] int DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_survey_tables133a() -{ - global $dbprefix, $connect, $modifyoutput; - mssql_drop_primary_index('assessments'); - // add the new primary key - modify_database("","ALTER TABLE [prefix_assessments] ADD CONSTRAINT pk_assessments_id_lang PRIMARY KEY ([id],[language])"); echo $modifyoutput; flush();ob_flush(); - $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); - $surveyidresult = db_execute_num($surveyidquery); - while ( $sv = $surveyidresult->FetchRow() ) - { - FixLanguageConsistency($sv[0],$sv[1]); - } -} - - -function upgrade_token_tables134() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [validfrom] DATETIME"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv." ADD [validuntil] DATETIME"); echo $modifyoutput; flush();ob_flush(); - } -} - -// Add the usesleft field to all existing token tables -function upgrade_token_tables145() -{ - global $modifyoutput, $dbprefix, $connect; - $surveyidquery = db_select_tables_like($dbprefix."tokens%"); - $surveyidresult = db_execute_num($surveyidquery); - $tokentables=$connect->MetaTables('TABLES',false, $dbprefix."tokens%"); - foreach ($tokentables as $sv) { - modify_database("","ALTER TABLE ".$sv." ADD [usesleft] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE ".$sv." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function mssql_drop_primary_index($tablename) -{ - global $dbprefix, $connect, $modifyoutput; - // find out the constraint name of the old primary key - $pkquery = "SELECT CONSTRAINT_NAME " - ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " - ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; - - $primarykey=$connect->GetOne($pkquery); - if ($primarykey!=false) - { - modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function mssql_drop_constraint($fieldname, $tablename) -{ - global $dbprefix, $connect, $modifyoutput; - $connect->SetFetchMode(ADODB_FETCH_ASSOC); - - // find out the name of the default constraint - // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? - $dfquery ="SELECT c_obj.name AS constraint_name - FROM sys.sysobjects AS c_obj INNER JOIN - sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN - sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN - sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid - WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='$dbprefix$tablename')"; - $defaultname=$connect->GetRow($dfquery); - if ($defaultname!=false) - { - modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname['constraint_name']}"); echo $modifyoutput; flush();ob_flush(); - } - - -} - -function upgrade_survey_tables139() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD [lastpage] int"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_question_attributes142() -{ - global $modifyoutput,$dbprefix, $connect; - $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; - $questionids = db_select_column($attributequery); - foreach ($questionids as $questionid) - { - //Select all affected question attributes - $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); - modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); - $record['value']=implode(';',$attributevalues); - $record['attribute']='exclude_all_other'; - $record['qid']=$questionid; - $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); - } -} - -function upgrade_tables143() -{ - global $modifyoutput,$dbprefix, $connect; - - - $aQIDReplacements=array(); - $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); - } - } - - // Convert answers to subquestions - - $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - db_switchIDInsert('questions',true); - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['type']=$row['type']; - $insertarray['title']=$row['code']; - $insertarray['question']=$row['answer']; - $insertarray['question_order']=$row['sortorder']; - $insertarray['language']=$row['language']; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (!isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); - $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - else - { - $iSaveSQID=$insertarray['qid']; - db_switchIDInsert('questions',false); - } - if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); - } - } - } - modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();ob_flush(); - - // Convert labels to answers - $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - //$labelids[] - } - if ($row['type']=='1') - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - } - } - } - } - - // Convert labels to subquestions - $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; - db_switchIDInsert('questions',true); - - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['type']=$row['type']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['title']=$lrow['code']; - $insertarray['question']=$lrow['title']; - $insertarray['question_order']=$lrow['sortorder']; - $insertarray['language']=$lrow['language']; - $insertarray['scale_id']=1; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); - db_switchIDInsert('questions',false); - - } - } - } - } - - - $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - - // Now move all non-standard templates to the /upload dir - global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; - - if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} - if ($handle = opendir($standardtemplaterootdir)) - { - while (false !== ($file = readdir($handle))) - { - if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) - { - if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) - { - echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; - }; - } - } - closedir($handle); - } - -} - -function upgrade_timing_tables146() -{ - global $modifyoutput,$dbprefix, $connect; - $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); - foreach ($aTimingTables as $sTable) { - modify_database("","EXEC sp_rename '{$sTable}.interviewTime','interviewtime'"); echo $modifyoutput; flush(); ob_flush(); - } -} \ No newline at end of file +'german-informal', + 'cns'=>'cn-Hans', + 'cnt'=>'cn-Hant', + 'pt_br'=>'pt-BR', + 'gr'=>'el', + 'jp'=>'ja', + 'si'=>'sl', + 'se'=>'sv', + 'vn'=>'vi'); + + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update [prefix_answers] set [language]='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_questions] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_groups] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_labels] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_surveys] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_users] set [lang]='$newlang where lang='$oldlang'");echo $modifyoutput; flush();ob_flush(); + } + + + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update [prefix_labelsets] set [languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush(); + } + + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update [prefix_surveys] set [additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush(); + } + modify_database("","update [prefix_settings_global] set [stg_value]='111' where stg_name='DBVersion'"); echo $modifyoutput; + + } + + if ($oldversion < 112) { + //The size of the users_name field is now 64 char (20 char before version 112) + modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [users_name] VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 113) { + //No action needed + modify_database("","update [prefix_settings_global] set [stg_value]='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 114) { + modify_database("","ALTER TABLE [prefix_saved_control] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [adminemail] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("",'INSERT INTO [prefix_settings_global] VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 126) { + modify_database("","ALTER TABLE [prefix_surveys] ADD [printanswers] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [listpublic] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + upgrade_survey_tables117(); + upgrade_survey_tables118(); + //119 + modify_database("","CREATE TABLE [prefix_quota] ( + [id] int NOT NULL IDENTITY (1,1), + [sid] int, + [name] varchar(255) , + [qlimit] int , + [action] int , + [active] int NOT NULL default '1', + PRIMARY KEY ([id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_quota_members] ( + [id] int NOT NULL IDENTITY (1,1), + [sid] int , + [qid] int , + [quota_id] int , + [code] varchar(5) , + PRIMARY KEY ([id]) + );");echo $modifyoutput; flush();ob_flush(); + + // Rename Norwegian language code from NO to NB + $oldnewlanguages=array('no'=>'nb'); + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update [prefix_answers] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_questions] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_groups] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_labels] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_surveys] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_users] set [lang]='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update [prefix_labelsets] set [languages]='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush();} + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update [prefix_surveys] set [additional_languages]='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush();} + } + + modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_templates_rights] ( + [uid] int NOT NULL, + [folder] varchar(255) NOT NULL, + [use] int NOT NULL, + PRIMARY KEY ([uid],[folder]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_templates] ( + [folder] varchar(255) NOT NULL, + [creator] int NOT NULL, + PRIMARY KEY ([folder]) + );");echo $modifyoutput; flush();ob_flush(); + //123 + modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [value] VARCHAR(255)"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('title','labels'); + modify_database("","ALTER TABLE [prefix_labels] ALTER COLUMN [title] varchar(4000)"); echo $modifyoutput; flush();ob_flush(); + //124 + modify_database("","ALTER TABLE [prefix_surveys] ADD [bounce_email] text"); echo $modifyoutput; flush();ob_flush(); + //125 + upgrade_token_tables125(); + modify_database("","EXEC sp_rename 'prefix_users.move_user','superadmin'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_users] SET [superadmin]=1 where ([create_survey]=1 AND [create_user]=1 AND [delete_user]=1 AND [configurator]=1)"); echo $modifyoutput; flush();ob_flush(); + //126 + modify_database("","ALTER TABLE [prefix_questions] ADD [lid1] int NOT NULL DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_conditions] SET [method]='==' where ( [method] is null) or [method]='' or [method]='0'"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","update [prefix_settings_global] set [stg_value]='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 127) { + modify_database("","create index [answers_idx2] on [prefix_answers] ([sortorder])"); echo $modifyoutput; + modify_database("","create index [assessments_idx2] on [prefix_assessments] ([sid])"); echo $modifyoutput; + modify_database("","create index [assessments_idx3] on [prefix_assessments] ([gid])"); echo $modifyoutput; + modify_database("","create index [conditions_idx2] on [prefix_conditions] ([qid])"); echo $modifyoutput; + modify_database("","create index [conditions_idx3] on [prefix_conditions] ([cqid])"); echo $modifyoutput; + modify_database("","create index [groups_idx2] on [prefix_groups] ([sid])"); echo $modifyoutput; + modify_database("","create index [question_attributes_idx2] on [prefix_question_attributes] ([qid])"); echo $modifyoutput; + modify_database("","create index [questions_idx2] on [prefix_questions] ([sid])"); echo $modifyoutput; + modify_database("","create index [questions_idx3] on [prefix_questions] ([gid])"); echo $modifyoutput; + modify_database("","create index [questions_idx4] on [prefix_questions] ([type])"); echo $modifyoutput; + modify_database("","create index [quota_idx2] on [prefix_quota] ([sid])"); echo $modifyoutput; + modify_database("","create index [saved_control_idx2] on [prefix_saved_control] ([sid])"); echo $modifyoutput; + modify_database("","create index [user_in_groups_idx1] on [prefix_user_in_groups] ([ugid], [uid])"); echo $modifyoutput; + modify_database("","update [prefix_settings_global] set [stg_value]='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 128) { + upgrade_token_tables128(); + modify_database("","update [prefix_settings_global] set [stg_value]='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 129) { + //128 + modify_database("","ALTER TABLE [prefix_surveys] ADD [startdate] DATETIME"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [usestartdate] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 130) + { + modify_database("","ALTER TABLE [prefix_conditions] ADD [scenario] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_conditions] SET [scenario]=1 where ( [scenario] is null) or [scenario]='' or [scenario]=0"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 131) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [publicstatistics] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 132) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [publicgraphs] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 133) + { + modify_database("","ALTER TABLE [prefix_users] ADD [one_time_pw] text"); echo $modifyoutput; flush();ob_flush(); + // Add new assessment setting + modify_database("","ALTER TABLE [prefix_surveys] ADD [assessments] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + // add new assessment value fields to answers & labels + modify_database("","ALTER TABLE [prefix_answers] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_labels] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + // copy any valid codes from code field to assessment field + modify_database("","update [prefix_answers] set [assessment_value]=CAST([code] as int)");// no output here is intended + modify_database("","update [prefix_labels] set [assessment_value]=CAST([code] as int)");// no output here is intended + // activate assessment where assessment rules exist + modify_database("","update [prefix_surveys] set [assessments]='Y' where [sid] in (SELECT [sid] FROM [prefix_assessments] group by [sid])"); echo $modifyoutput; flush();ob_flush(); + // add language field to assessment table + modify_database("","ALTER TABLE [prefix_assessments] ADD [language] varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();ob_flush(); + // update language field with default language of that particular survey + modify_database("","update [prefix_assessments] set [language]=(select [language] from [prefix_surveys] where [sid]=[prefix_assessments].[sid])"); echo $modifyoutput; flush();ob_flush(); + // copy assessment link to message since from now on we will have HTML assignment messages + modify_database("","update [prefix_assessments] set [message]=cast([message] as varchar) +'
                '+[link]+''"); echo $modifyoutput; flush();ob_flush(); + // drop the old link field + modify_database("","ALTER TABLE [prefix_assessments] DROP COLUMN [link]"); echo $modifyoutput; flush();ob_flush(); + // change the primary index to include language + mssql_drop_primary_index('assessments'); + // add the new primary key + modify_database("","ALTER TABLE [prefix_assessments] ADD CONSTRAINT pk_assessments_id_lang PRIMARY KEY ([id],[language])"); echo $modifyoutput; flush();ob_flush(); + + // Add new fields to survey language settings + modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_url] varchar(255)"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_endtext] text"); echo $modifyoutput; flush();ob_flush(); + // copy old URL fields ot language specific entries + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_url]=(select [url] from [prefix_surveys] where [sid]=[prefix_surveys_languagesettings].[surveyls_survey_id])"); echo $modifyoutput; flush();ob_flush(); + // drop old URL field + mssql_drop_constraint('url','surveys'); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [url]"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","update [prefix_settings_global] set [stg_value]='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 134) + { + // Add new assessment setting + modify_database("","ALTER TABLE [prefix_surveys] ADD [usetokens] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('attribute1','surveys'); + mssql_drop_constraint('attribute2','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] ADD [attributedescriptions] TEXT;"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute1]"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute2]"); echo $modifyoutput; flush();ob_flush(); + upgrade_token_tables134(); + modify_database("","update [prefix_settings_global] set [stg_value]='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 135) + { + mssql_drop_constraint('value','question_attributes'); + modify_database("","ALTER TABLE [prefix_question_attributes] ALTER COLUMN [value] text"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_answers] ALTER COLUMN [answer] varchar(8000)"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 136) //New quota functions + { + modify_database("", "ALTER TABLE[prefix_quota] ADD [autoload_url] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_quota_languagesettings] ( + [quotals_id] int NOT NULL IDENTITY (1,1), + [quotals_quota_id] int, + [quotals_language] varchar(45) NOT NULL default 'en', + [quotals_name] varchar(255), + [quotals_message] text, + [quotals_url] varchar(255), + [quotals_urldescrip] varchar(255), + PRIMARY KEY ([quotals_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 137) //New date format specs + { + modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD [dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "update [prefix_surveys] set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "update [prefix_surveys] set expires=null where useexpiry='N'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('usestartdate','surveys'); + mssql_drop_constraint('useexpiry','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN usestartdate"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN useexpiry"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 138) //Modify quota field + { + modify_database("", "ALTER TABLE [prefix_quota_members] ALTER COLUMN [code] VARCHAR(11) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 139) //Modify quota field + { + upgrade_survey_tables139(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 140) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD [emailresponseto] text"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 141) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD [tokenlength] tinyint NOT NULL default '15'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 142) //Modify surveys table + { + upgrade_question_attributes142(); + modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [startdate] datetime NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [expires] datetime NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_question_attributes] SET [value]='0' WHERE cast([value] as varchar)='false'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_question_attributes] SET [value]='1' WHERE cast([value] as varchar)='true'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 143) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_questions] ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_answers] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_questions] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_questions] ADD same_default tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_primary_index('answers'); + modify_database("","ALTER TABLE [prefix_answers] ADD CONSTRAINT pk_answers_qcls PRIMARY KEY ([qid],[code],[language],[scale_id])"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE [prefix_defaultvalues] ( + [qid] integer NOT NULL default '0', + [scale_id] tinyint NOT NULL default '0', + [sqid] integer NOT NULL default '0', + [language] varchar(20) NOT NULL, + [specialtype] varchar(20) NOT NULL default '', + [defaultvalue] text, + CONSTRAINT pk_defaultvalues_qlss PRIMARY KEY ([qid] , [scale_id], [language], [specialtype], [sqid]))"); echo $modifyoutput; flush();ob_flush(); + + // -Move all 'answers' that are subquestions to the questions table + // -Move all 'labels' that are answers to the answers table + // -Transscribe the default values where applicable + // -Move default values from answers to questions + upgrade_tables143(); + + mssql_drop_constraint('default_value','answers'); + modify_database("", "ALTER TABLE [prefix_answers] DROP COLUMN [default_value]"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('lid','questions'); + modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('lid1','questions'); + modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid1"); echo $modifyoutput; flush();ob_flush(); + // add field for timings and table for extended conditions + modify_database("", "ALTER TABLE [prefix_surveys] ADD savetimings char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE prefix_sessions( + sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', + expiry DATETIME NOT NULL , + expireref VARCHAR( 250 ) DEFAULT '', + created DATETIME NOT NULL , + modified DATETIME NOT NULL , + sessdata text, + CONSTRAINT pk_sessions_sesskey PRIMARY KEY ( [sesskey] ))"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "create index [idx_expiry] on [prefix_sessions] ([expiry])"); echo $modifyoutput; + modify_database("", "create index [idx_expireref] on [prefix_sessions] ([expireref])"); echo $modifyoutput; + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + + + + + + + } + + if ($oldversion < 145) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD showxquestions CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showgroupinfo CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD shownoanswer CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bouncetime BIGINT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceprocessing VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounttype VARCHAR(4) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounthost VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountpass VARCHAR(100) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountencryption VARCHAR(3) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountuser VARCHAR(200) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showwelcome CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD navigationdelay tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD nokeyboard CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD alloweditaftercompletion CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE [prefix_survey_permissions] ( + [sid] INT NOT NULL, + [uid] INT NOT NULL, + [permission] VARCHAR(20) NOT NULL, + [create_p] TINYINT NOT NULL default '0', + [read_p] TINYINT NOT NULL default '0', + [update_p] TINYINT NOT NULL default '0', + [delete_p] TINYINT NOT NULL default '0', + [import_p] TINYINT NOT NULL default '0', + [export_p] TINYINT NOT NULL default '0', + PRIMARY KEY ([sid], [uid],[permission]) + );"); echo $modifyoutput; flush();ob_flush(); + upgrade_surveypermissions_table145(); + modify_database("", "DROP TABLE [prefix_surveys_rights]"); echo $modifyoutput; flush();ob_flush(); + + // Add new fields for email templates + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD + email_admin_notification_subj VARCHAR(255) NULL, + email_admin_notification TEXT NULL, + email_admin_responses_subj VARCHAR(255) NULL, + email_admin_responses TEXT NULL"); + + //Add index to questions table to speed up subquestions + modify_database("", "create index [parent_qid_idx] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto text DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); + upgrade_survey_table145(); + mssql_drop_constraint('notification','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN [notification]"); echo $modifyoutput; flush();ob_flush(); + + // modify length of method in conditions + modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [method] CHAR( 5 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + + //Add index to questions table to speed up subquestions + modify_database("", "create index [parent_qid] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","UPDATE prefix_surveys set [private]='N' where [private] is NULL;"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","EXEC sp_rename 'prefix_surveys.private','anonymized'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [anonymized] char(1) NOT NULL;"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('anonymized','surveys'); + modify_database("","ALTER TABLE [prefix_surveys] ADD CONSTRAINT DF_surveys_anonymized DEFAULT 'N' FOR [anonymized];"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "CREATE TABLE [prefix_failed_login_attempts] ( + [id] INT NOT NULL IDENTITY (1,1) PRIMARY KEY, + [ip] varchar(37) NOT NULL, + [last_attempt] varchar(20) NOT NULL, + [number_attempts] int NOT NULL );"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_numberformat] INT default 0 NOT NULL"); echo $modifyoutput; flush();ob_flush(); + + upgrade_token_tables145(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + + + } + if ($oldversion < 146) //Modify surveys table + { + upgrade_timing_tables146(); + modify_database("", "INSERT into [prefix_survey_permissions] (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from [prefix_surveys]"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 147) + { + modify_database("", "ALTER TABLE [prefix_users] ADD templateeditormode VARCHAR(7) NOT NULL default 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD questionselectormode VARCHAR(7) NOT NULL default 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='147' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 148) + { + modify_database("","CREATE TABLE [prefix_participants] ( + [participant_id] varchar(50) NOT NULL, + [firstname] varchar(40) NOT NULL, + [lastname] varchar(40) NOT NULL, + [email] varchar(80) NOT NULL, + [language] varchar(2) NOT NULL, + [blacklisted] varchar(1) NOT NULL, + [owner_uid] integer NOT NULL, + PRIMARY KEY ([participant_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute] ( + [participant_id] varchar(50) NOT NULL, + [attribute_id] integer NOT NULL, + [value] varchar(50) NOT NULL, + PRIMARY KEY ([participant_id],[attribute_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_names] ( + [attribute_id] integer NOT NULL IDENTITY (1,1), + [attribute_type] varchar(4) NOT NULL, + [visible] char(5) NOT NULL, + PRIMARY KEY ([attribute_id],[attribute_type]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_names_lang] ( + [attribute_id] integer NOT NULL, + [attribute_name] varchar(30) NOT NULL, + [lang] varchar(20) NOT NULL, + PRIMARY KEY ([attribute_id],[lang]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_values] ( + [attribute_id] integer NOT NULL, + [value_id] integer NOT NULL IDENTITY (1,1), + [value] varchar(20) NOT NULL, + PRIMARY KEY ([value_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_shares] ( + [participant_id] varchar(50) NOT NULL, + [share_uid] integer NOT NULL, + [date_added] datetime, + [can_edit] text NOT NULL, + PRIMARY KEY ([participant_id],[share_uid]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_survey_links] ( + [participant_id] varchar(50) NOT NULL, + [token_id] integer NOT NULL, + [survey_id] integer NOT NULL, + [date_created] datetime, + PRIMARY KEY ([participant_id],[token_id],[survey_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD [participant_panel] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + + // Add language field to question_attributes table + modify_database("","ALTER TABLE [prefix_question_attributes] ADD [language] varchar(20)"); echo $modifyoutput; flush();ob_flush(); + upgrade_question_attributes148(); + fixSubquestions(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='148' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 150) + { + modify_database("","ALTER TABLE [prefix_questions] ADD [relevance] varchar(max);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='150' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 151) + { + modify_database("","ALTER TABLE [prefix_groups] ADD [randomization_group] VARCHAR(20) NOT NULL DEFAULT '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='151' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 152) + { + modify_database("","CREATE INDEX [question_attributes_idx3] ON [prefix_question_attributes] ([attribute]);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='152' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 153) + { + modify_database("","CREATE TABLE [prefix_expression_errors] ( + [id] integer NOT NULL IDENTITY (1,1), + [errortime] varchar(50) DEFAULT NULL, + [sid] integer DEFAULT NULL, + [gid] integer DEFAULT NULL, + [qid] integer DEFAULT NULL, + [gseq] integer DEFAULT NULL, + [qseq] integer DEFAULT NULL, + [type] varchar(50) , + [eqn] text, + [prettyprint] text, + PRIMARY KEY ([id]) + );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='153' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 154) + { + modify_database("","ALTER TABLE [prefix_groups] ADD [grelevance] text DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='154' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 155) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [googleanalyticsstyle] char(1) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [googleanalyticsapikey] varchar(25) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","EXEC sp_rename 'prefix_surveys.showXquestions','showxquestions'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='155' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 155.6) + { + LimeExpressionManager::UpgradeConditionsToRelevance(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='155.6' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; + return true; +} + +function upgrade_survey_tables117() +{ + global $modifyoutput; + $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD [startdate] datetime"); echo $modifyoutput; flush();ob_flush(); + } + } +} + + +function upgrade_survey_tables118() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ALTER COLUMN [token] VARCHAR(36)"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function upgrade_token_tables125() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [emailstatus] VARCHAR(300) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function upgrade_token_tables128() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [remindersent] VARCHAR(17) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE ".$sv." ADD [remindercount] int DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function fixLanguageConsistencyAllSurveys() +{ + global $dbprefix, $connect, $modifyoutput; + $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); + $surveyidresult = db_execute_num($surveyidquery); + while ( $sv = $surveyidresult->FetchRow() ) + { + FixLanguageConsistency($sv[0],$sv[1]); + } +} + + +function upgrade_token_tables134() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [validfrom] DATETIME"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE ".$sv." ADD [validuntil] DATETIME"); echo $modifyoutput; flush();ob_flush(); + } +} + +// Add the usesleft field to all existing token tables +function upgrade_token_tables145() +{ + global $modifyoutput, $dbprefix, $connect; + $surveyidquery = db_select_tables_like($dbprefix."tokens%"); + $surveyidresult = db_execute_num($surveyidquery); + $tokentables=$connect->MetaTables('TABLES',false, $dbprefix."tokens%"); + foreach ($tokentables as $sv) { + modify_database("","ALTER TABLE ".$sv." ADD [usesleft] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE ".$sv." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function mssql_drop_primary_index($tablename) +{ + global $dbprefix, $connect, $modifyoutput; + // find out the constraint name of the old primary key + $pkquery = "SELECT CONSTRAINT_NAME " + ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " + ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; + + $primarykey=$connect->GetOne($pkquery); + if ($primarykey!=false) + { + modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function mssql_drop_constraint($fieldname, $tablename) +{ + global $dbprefix, $connect, $modifyoutput; + $connect->SetFetchMode(ADODB_FETCH_ASSOC); + + // find out the name of the default constraint + // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? + $dfquery ="SELECT c_obj.name AS constraint_name + FROM sys.sysobjects AS c_obj INNER JOIN + sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN + sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN + sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid + WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='$dbprefix$tablename')"; + $defaultname=$connect->GetRow($dfquery); + if ($defaultname!=false) + { + modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname['constraint_name']}"); echo $modifyoutput; flush();ob_flush(); + } + + +} + +function upgrade_survey_tables139() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD [lastpage] int"); echo $modifyoutput; flush();ob_flush(); + } + } +} + +function upgrade_question_attributes142() +{ + global $modifyoutput,$dbprefix, $connect; + $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; + $questionids = db_select_column($attributequery); + foreach ($questionids as $questionid) + { + //Select all affected question attributes + $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); + modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); + $record['value']=implode(';',$attributevalues); + $record['attribute']='exclude_all_other'; + $record['qid']=$questionid; + $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); + } +} + +function upgrade_tables143() +{ + global $modifyoutput,$dbprefix, $connect; + + + $aQIDReplacements=array(); + $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); + } + } + + // Convert answers to subquestions + + $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + db_switchIDInsert('questions',true); + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$row['code']; + $insertarray['question']=$row['answer']; + $insertarray['question_order']=$row['sortorder']; + $insertarray['language']=$row['language']; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();ob_flush(); + if (!isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + else + { + $iSaveSQID=$insertarray['qid']; + db_switchIDInsert('questions',false); + } + if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); + } + } + } + modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();ob_flush(); + + // Convert labels to answers + $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); + //$labelids[] + } + if ($row['type']=='1') + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); + } + } + } + } + + // Convert labels to subquestions + $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; + db_switchIDInsert('questions',true); + + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['type']=$row['type']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['title']=$lrow['code']; + $insertarray['question']=$lrow['title']; + $insertarray['question_order']=$lrow['sortorder']; + $insertarray['language']=$lrow['language']; + $insertarray['scale_id']=1; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();ob_flush(); + if (isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); + db_switchIDInsert('questions',false); + + } + } + } + } + + + $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; + modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); + $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; + modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); + + // Now move all non-standard templates to the /upload dir + global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; + + if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} + if ($handle = opendir($standardtemplaterootdir)) + { + while (false !== ($file = readdir($handle))) + { + if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) + { + if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) + { + echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; + }; + } + } + closedir($handle); + } + +} + +function upgrade_timing_tables146() +{ + global $modifyoutput,$dbprefix, $connect; + $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); + foreach ($aTimingTables as $sTable) { + modify_database("","EXEC sp_rename '{$sTable}.interviewTime','interviewtime'"); echo $modifyoutput; flush(); ob_flush(); + } +} diff --git a/include/limesurvey/admin/update/upgrade-mssqlnative.php b/include/limesurvey/admin/update/upgrade-mssqlnative.php index 5ef5409e..e18676d5 100644 --- a/include/limesurvey/admin/update/upgrade-mssqlnative.php +++ b/include/limesurvey/admin/update/upgrade-mssqlnative.php @@ -1,815 +1,929 @@ -'german-informal', - 'cns'=>'cn-Hans', - 'cnt'=>'cn-Hant', - 'pt_br'=>'pt-BR', - 'gr'=>'el', - 'jp'=>'ja', - 'si'=>'sl', - 'se'=>'sv', - 'vn'=>'vi'); - - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update [prefix_answers] set [language]='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_questions] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_groups] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_labels] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_surveys] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_users] set [lang]='$newlang where lang='$oldlang'");echo $modifyoutput; flush();ob_flush(); - } - - - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update [prefix_labelsets] set [languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush(); - } - - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update [prefix_surveys] set [additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush(); - } - modify_database("","update [prefix_settings_global] set [stg_value]='111' where stg_name='DBVersion'"); echo $modifyoutput; - - } - - if ($oldversion < 112) { - //The size of the users_name field is now 64 char (20 char before version 112) - modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [users_name] VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 113) { - //No action needed - modify_database("","update [prefix_settings_global] set [stg_value]='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 114) { - modify_database("","ALTER TABLE [prefix_saved_control] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [adminemail] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("",'INSERT INTO [prefix_settings_global] VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 126) { - modify_database("","ALTER TABLE [prefix_surveys] ADD [printanswers] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [listpublic] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_tables117(); - upgrade_survey_tables118(); - //119 - modify_database("","CREATE TABLE [prefix_quota] ( - [id] int NOT NULL IDENTITY (1,1), - [sid] int, - [name] varchar(255) , - [qlimit] int , - [action] int , - [active] int NOT NULL default '1', - PRIMARY KEY ([id]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_quota_members] ( - [id] int NOT NULL IDENTITY (1,1), - [sid] int , - [qid] int , - [quota_id] int , - [code] varchar(5) , - PRIMARY KEY ([id]) - );");echo $modifyoutput; flush();ob_flush(); - - // Rename Norwegian language code from NO to NB - $oldnewlanguages=array('no'=>'nb'); - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update [prefix_answers] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_questions] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_groups] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_labels] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_surveys] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update [prefix_users] set [lang]='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update [prefix_labelsets] set [languages]='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush();} - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update [prefix_surveys] set [additional_languages]='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush();} - } - - modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_templates_rights] ( - [uid] int NOT NULL, - [folder] varchar(255) NOT NULL, - [use] int NOT NULL, - PRIMARY KEY ([uid],[folder]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_templates] ( - [folder] varchar(255) NOT NULL, - [creator] int NOT NULL, - PRIMARY KEY ([folder]) - );");echo $modifyoutput; flush();ob_flush(); - //123 - modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [value] VARCHAR(255)"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('title','labels'); - modify_database("","ALTER TABLE [prefix_labels] ALTER COLUMN [title] varchar(4000)"); echo $modifyoutput; flush();ob_flush(); - //124 - modify_database("","ALTER TABLE [prefix_surveys] ADD [bounce_email] varchar(max)"); echo $modifyoutput; flush();ob_flush(); - //125 - upgrade_token_tables125(); - modify_database("","EXEC sp_rename 'prefix_users.move_user','superadmin'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_users] SET [superadmin]=1 where ([create_survey]=1 AND [create_user]=1 AND [delete_user]=1 AND [configurator]=1)"); echo $modifyoutput; flush();ob_flush(); - //126 - modify_database("","ALTER TABLE [prefix_questions] ADD [lid1] int NOT NULL DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_conditions] SET [method]='==' where ( [method] is null) or [method]='' or [method]='0'"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update [prefix_settings_global] set [stg_value]='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 127) { - modify_database("","create index [answers_idx2] on [prefix_answers] ([sortorder])"); echo $modifyoutput; - modify_database("","create index [assessments_idx2] on [prefix_assessments] ([sid])"); echo $modifyoutput; - modify_database("","create index [assessments_idx3] on [prefix_assessments] ([gid])"); echo $modifyoutput; - modify_database("","create index [conditions_idx2] on [prefix_conditions] ([qid])"); echo $modifyoutput; - modify_database("","create index [conditions_idx3] on [prefix_conditions] ([cqid])"); echo $modifyoutput; - modify_database("","create index [groups_idx2] on [prefix_groups] ([sid])"); echo $modifyoutput; - modify_database("","create index [question_attributes_idx2] on [prefix_question_attributes] ([qid])"); echo $modifyoutput; - modify_database("","create index [questions_idx2] on [prefix_questions] ([sid])"); echo $modifyoutput; - modify_database("","create index [questions_idx3] on [prefix_questions] ([gid])"); echo $modifyoutput; - modify_database("","create index [questions_idx4] on [prefix_questions] ([type])"); echo $modifyoutput; - modify_database("","create index [quota_idx2] on [prefix_quota] ([sid])"); echo $modifyoutput; - modify_database("","create index [saved_control_idx2] on [prefix_saved_control] ([sid])"); echo $modifyoutput; - modify_database("","create index [user_in_groups_idx1] on [prefix_user_in_groups] ([ugid], [uid])"); echo $modifyoutput; - modify_database("","update [prefix_settings_global] set [stg_value]='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 128) { - upgrade_token_tables128(); - modify_database("","update [prefix_settings_global] set [stg_value]='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 129) { - //128 - modify_database("","ALTER TABLE [prefix_surveys] ADD [startdate] DATETIME"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ADD [usestartdate] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 130) - { - modify_database("","ALTER TABLE [prefix_conditions] ADD [scenario] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE [prefix_conditions] SET [scenario]=1 where ( [scenario] is null) or [scenario]='' or [scenario]=0"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 131) - { - modify_database("","ALTER TABLE [prefix_surveys] ADD [publicstatistics] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 132) - { - modify_database("","ALTER TABLE [prefix_surveys] ADD [publicgraphs] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 133) - { - modify_database("","ALTER TABLE [prefix_users] ADD [one_time_pw] varchar(max)"); echo $modifyoutput; flush();ob_flush(); - // Add new assessment setting - modify_database("","ALTER TABLE [prefix_surveys] ADD [assessments] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - // add new assessment value fields to answers & labels - modify_database("","ALTER TABLE [prefix_answers] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_labels] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - // copy any valid codes from code field to assessment field - modify_database("","update [prefix_answers] set [assessment_value]=CAST([code] as int)");// no output here is intended - modify_database("","update [prefix_labels] set [assessment_value]=CAST([code] as int)");// no output here is intended - // activate assessment where assesment rules exist - modify_database("","update [prefix_surveys] set [assessments]='Y' where [sid] in (SELECT [sid] FROM [prefix_assessments] group by [sid])"); echo $modifyoutput; flush();ob_flush(); - // add language field to assessment table - modify_database("","ALTER TABLE [prefix_assessments] ADD [language] varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();ob_flush(); - // update language field with default language of that particular survey - modify_database("","update [prefix_assessments] set [language]=(select [language] from [prefix_surveys] where [sid]=[prefix_assessments].[sid])"); echo $modifyoutput; flush();ob_flush(); - // copy assessment link to message since from now on we will have HTML assignment messages - modify_database("","update [prefix_assessments] set [message]=cast([message] as varchar) +'
                '+[link]+''"); echo $modifyoutput; flush();ob_flush(); - // drop the old link field - modify_database("","ALTER TABLE [prefix_assessments] DROP COLUMN [link]"); echo $modifyoutput; flush();ob_flush(); - // change the primary index to include language - // and fix missing translations for assessments - upgrade_survey_tables133a(); - - // Add new fields to survey language settings - modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_url] varchar(255)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_endtext] varchar(max)"); echo $modifyoutput; flush();ob_flush(); - // copy old URL fields ot language specific entries - modify_database("","update [prefix_surveys_languagesettings] set [surveyls_url]=(select [url] from [prefix_surveys] where [sid]=[prefix_surveys_languagesettings].[surveyls_survey_id])"); echo $modifyoutput; flush();ob_flush(); - // drop old URL field - mssql_drop_constraint('url','surveys'); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [url]"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update [prefix_settings_global] set [stg_value]='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 134) - { - // Add new assessment setting - modify_database("","ALTER TABLE [prefix_surveys] ADD [usetokens] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('attribute1','surveys'); - mssql_drop_constraint('attribute2','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] ADD [attributedescriptions] varchar(max);"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute1]"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute2]"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables134(); - modify_database("","update [prefix_settings_global] set [stg_value]='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 135) - { - mssql_drop_constraint('value','question_attributes'); - modify_database("","ALTER TABLE [prefix_question_attributes] ALTER COLUMN [value] varchar(max)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_answers] ALTER COLUMN [answer] varchar(8000)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 136) //New quota functions - { - modify_database("", "ALTER TABLE[prefix_quota] ADD [autoload_url] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE [prefix_quota_languagesettings] ( - [quotals_id] int NOT NULL IDENTITY (1,1), - [quotals_quota_id] int, - [quotals_language] varchar(45) NOT NULL default 'en', - [quotals_name] varchar(255), - [quotals_message] varchar(max), - [quotals_url] varchar(255), - [quotals_urldescrip] varchar(255), - PRIMARY KEY ([quotals_id]) - );");echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 137) //New date format specs - { - modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_users] ADD [dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update [prefix_surveys] set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update [prefix_surveys] set expires=null where useexpiry='N'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('usestartdate','surveys'); - mssql_drop_constraint('useexpiry','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN usestartdate"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN useexpiry"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update [prefix_settings_global] set [stg_value]='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 138) //Modify quota field - { - modify_database("", "ALTER TABLE [prefix_quota_members] ALTER COLUMN [code] VARCHAR(11) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 139) //Modify quota field - { - upgrade_survey_tables139(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 140) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD [emailresponseto] varchar(max)"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 141) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD [tokenlength] tinyint NOT NULL default '15'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 142) //Modify surveys table - { - upgrade_question_attributes142(); - modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [startdate] datetime NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [expires] datetime NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_question_attributes] SET [value]='0' WHERE cast([value] as varchar)='false'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_question_attributes] SET [value]='1' WHERE cast([value] as varchar)='true'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 143) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_questions] ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_answers] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_questions] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_questions] ADD same_default tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_primary_index('answers'); - modify_database("","ALTER TABLE [prefix_answers] ADD CONSTRAINT pk_answers_qcls PRIMARY KEY ([qid],[code],[language],[scale_id])"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_defaultvalues] ( - [qid] integer NOT NULL default '0', - [scale_id] tinyint NOT NULL default '0', - [sqid] integer NOT NULL default '0', - [language] varchar(20) NOT NULL, - [specialtype] varchar(20) NOT NULL default '', - [defaultvalue] varchar(max), - CONSTRAINT pk_defaultvalues_qlss PRIMARY KEY ([qid] , [scale_id], [language], [specialtype], [sqid]))"); echo $modifyoutput; flush();ob_flush(); - - // -Move all 'answers' that are subquestions to the questions table - // -Move all 'labels' that are answers to the answers table - // -Transscribe the default values where applicable - // -Move default values from answers to questions - upgrade_tables143(); - - mssql_drop_constraint('default_value','answers'); - modify_database("", "ALTER TABLE [prefix_answers] DROP COLUMN [default_value]"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('lid','questions'); - modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('lid1','questions'); - modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid1"); echo $modifyoutput; flush();ob_flush(); - // add field for timings and table for extended conditions - modify_database("", "ALTER TABLE [prefix_surveys] ADD savetimings char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_sessions( - sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', - expiry DATETIME NOT NULL , - expireref VARCHAR( 250 ) DEFAULT '', - created DATETIME NOT NULL , - modified DATETIME NOT NULL , - sessdata varchar(max), - CONSTRAINT pk_sessions_sesskey PRIMARY KEY ( [sesskey] ))"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "create index [idx_expiry] on [prefix_sessions] ([expiry])"); echo $modifyoutput; - modify_database("", "create index [idx_expireref] on [prefix_sessions] ([expireref])"); echo $modifyoutput; - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - - - - - } - - if ($oldversion < 145) //Modify surveys table - { - modify_database("", "ALTER TABLE [prefix_surveys] ADD showXquestions CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showgroupinfo CHAR(1) NULL default 'B' "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD shownoanswer CHAR(1) NULL default 'Y' "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bouncetime BIGINT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceprocessing VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounttype VARCHAR(4) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounthost VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountpass VARCHAR(100) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountencryption VARCHAR(3) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountuser VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showwelcome CHAR(1) NULL default 'Y' "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD navigationdelay tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD nokeyboard CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE [prefix_surveys] ADD alloweditaftercompletion CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_survey_permissions] ( - [sid] INT NOT NULL, - [uid] INT NOT NULL, - [permission] VARCHAR(20) NOT NULL, - [create_p] TINYINT NOT NULL default '0', - [read_p] TINYINT NOT NULL default '0', - [update_p] TINYINT NOT NULL default '0', - [delete_p] TINYINT NOT NULL default '0', - [import_p] TINYINT NOT NULL default '0', - [export_p] TINYINT NOT NULL default '0', - PRIMARY KEY ([sid], [uid],[permission]) - );"); echo $modifyoutput; flush();ob_flush(); - upgrade_surveypermissions_table145(); - modify_database("", "DROP TABLE [prefix_surveys_rights]"); echo $modifyoutput; flush();ob_flush(); - - // Add new fields for email templates - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD - email_admin_notification_subj VARCHAR(255) NULL, - email_admin_notification varchar(max) NULL, - email_admin_responses_subj VARCHAR(255) NULL, - email_admin_responses varchar(max) NULL"); - - //Add index to questions table to speed up subquestions - modify_database("", "create index [parent_qid_idx] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto text DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_table145(); - mssql_drop_constraint('notification','surveys'); - modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN [notification]"); echo $modifyoutput; flush();ob_flush(); - - // modify length of method in conditions - modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [method] CHAR(5) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - //Add index to questions table to speed up subquestions - modify_database("", "create index [parent_qid] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE prefix_surveys set [private]='N' where [private] is NULL;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","EXEC sp_rename 'prefix_surveys.private','anonymized'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [anonymized] char(1) NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - mssql_drop_constraint('anonymized','surveys'); - modify_database("","ALTER TABLE [prefix_surveys] ADD CONSTRAINT DF_surveys_anonymized DEFAULT 'N' FOR [anonymized];"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE [prefix_failed_login_attempts] ( - [id] INT NOT NULL IDENTITY (1,1) PRIMARY KEY, - [ip] varchar(37) NOT NULL, - [last_attempt] varchar(20) NOT NULL, - [number_attempts] int NOT NULL );"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_numberformat] INT default 0 NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - upgrade_token_tables145(); - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - } - if ($oldversion < 146) //Modify surveys table - { - upgrade_timing_tables146(); - modify_database("", "UPDATE [prefix_settings_global] SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - - echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; - return true; -} - -function upgrade_survey_tables117() -{ - global $modifyoutput; - $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD [startdate] datetime"); echo $modifyoutput; flush();ob_flush(); - } - } -} - - -function upgrade_survey_tables118() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ALTER COLUMN [token] VARCHAR(36)"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_token_tables125() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [emailstatus] VARCHAR(300) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_token_tables128() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [remindersent] VARCHAR(17) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv." ADD [remindercount] int DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function upgrade_survey_tables133a() -{ - global $dbprefix, $connect, $modifyoutput; - mssql_drop_primary_index('assessments'); - // add the new primary key - modify_database("","ALTER TABLE [prefix_assessments] ADD CONSTRAINT pk_assessments_id_lang PRIMARY KEY ([id],[language])"); echo $modifyoutput; flush();ob_flush(); - $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); - $surveyidresult = db_execute_num($surveyidquery); - while ( $sv = $surveyidresult->FetchRow() ) - { - FixLanguageConsistency($sv[0],$sv[1]); - } -} - - -function upgrade_token_tables134() -{ - global $connect,$modifyoutput,$dbprefix; - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) - { - modify_database("","ALTER TABLE ".$sv." ADD [validfrom] DATETIME"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv." ADD [validuntil] DATETIME"); echo $modifyoutput; flush();ob_flush(); - } -} - -// Add the usesleft field to all existing token tables -function upgrade_token_tables145() -{ - global $modifyoutput, $dbprefix, $connect; - $surveyidquery = db_select_tables_like($dbprefix."tokens%"); - $surveyidresult = db_execute_num($surveyidquery); - $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); - foreach ($tokentables as $sv) { - modify_database("","ALTER TABLE ".$sv." ADD [usesleft] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE ".$sv." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function mssql_drop_primary_index($tablename) -{ - global $dbprefix, $connect, $modifyoutput; - // find out the constraint name of the old primary key - $pkquery = "SELECT CONSTRAINT_NAME " - ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " - ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; - - $primarykey=$connect->GetOne($pkquery); - if ($primarykey!=false) - { - modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush();ob_flush(); - } -} - - -function mssql_drop_constraint($fieldname, $tablename) -{ - global $dbprefix, $connect, $modifyoutput; - $connect->SetFetchMode(ADODB_FETCH_ASSOC); - - // find out the name of the default constraint - // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? - $dfquery ="SELECT c_obj.name AS constraint_name - FROM sys.sysobjects AS c_obj INNER JOIN - sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN - sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN - sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid - WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='$dbprefix$tablename')"; - $defaultname=$connect->GetRow($dfquery); - if ($defaultname!=false) - { - modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname['constraint_name']}"); echo $modifyoutput; flush();ob_flush(); - } - - -} - -function upgrade_survey_tables139() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD [lastpage] int"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_question_attributes142() -{ - global $modifyoutput,$dbprefix, $connect; - $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; - $questionids = db_select_column($attributequery); - foreach ($questionids as $questionid) - { - //Select all affected question attributes - $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); - modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); - $record['value']=implode(';',$attributevalues); - $record['attribute']='exclude_all_other'; - $record['qid']=$questionid; - $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); - } -} - -function upgrade_tables143() -{ - global $modifyoutput,$dbprefix, $connect; - - - $aQIDReplacements=array(); - $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); - } - } - - // Convert answers to subquestions - - $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - db_switchIDInsert('questions',true); - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['type']=$row['type']; - $insertarray['title']=$row['code']; - $insertarray['question']=$row['answer']; - $insertarray['question_order']=$row['sortorder']; - $insertarray['language']=$row['language']; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (!isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); - $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - else - { - $iSaveSQID=$insertarray['qid']; - db_switchIDInsert('questions',false); - } - if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); - } - } - } - modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();ob_flush(); - - // Convert labels to answers - $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - //$labelids[] - } - if ($row['type']=='1') - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - } - } - } - } - - // Convert labels to subquestions - $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; - db_switchIDInsert('questions',true); - - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['type']=$row['type']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['title']=$lrow['code']; - $insertarray['question']=$lrow['title']; - $insertarray['question_order']=$lrow['sortorder']; - $insertarray['language']=$lrow['language']; - $insertarray['scale_id']=1; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); - db_switchIDInsert('questions',false); - - } - } - } - } - - - $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - - // Now move all non-standard templates to the /upload dir - global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; - - if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} - if ($handle = opendir($standardtemplaterootdir)) - { - while (false !== ($file = readdir($handle))) - { - if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) - { - if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) - { - echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; - }; - } - } - closedir($handle); - } - -} - -function upgrade_timing_tables146() -{ - global $modifyoutput,$dbprefix, $connect; - $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); - foreach ($aTimingTables as $sTable) { - modify_database("","EXEC sp_rename '{$sTable}.interviewTime','interviewtime'"); echo $modifyoutput; flush(); ob_flush(); - } -} +'german-informal', + 'cns'=>'cn-Hans', + 'cnt'=>'cn-Hant', + 'pt_br'=>'pt-BR', + 'gr'=>'el', + 'jp'=>'ja', + 'si'=>'sl', + 'se'=>'sv', + 'vn'=>'vi'); + + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update [prefix_answers] set [language]='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_questions] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_groups] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_labels] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_surveys] set [language]='$newlang' where language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_users] set [lang]='$newlang where lang='$oldlang'");echo $modifyoutput; flush();ob_flush(); + } + + + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update [prefix_labelsets] set [languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush(); + } + + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update [prefix_surveys] set [additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush(); + } + modify_database("","update [prefix_settings_global] set [stg_value]='111' where stg_name='DBVersion'"); echo $modifyoutput; + + } + + if ($oldversion < 112) { + //The size of the users_name field is now 64 char (20 char before version 112) + modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [users_name] VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 113) { + //No action needed + modify_database("","update [prefix_settings_global] set [stg_value]='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 114) { + modify_database("","ALTER TABLE [prefix_saved_control] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [adminemail] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_users] ALTER COLUMN [email] VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("",'INSERT INTO [prefix_settings_global] VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 126) { + modify_database("","ALTER TABLE [prefix_surveys] ADD [printanswers] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [listpublic] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + upgrade_survey_tables117(); + upgrade_survey_tables118(); + //119 + modify_database("","CREATE TABLE [prefix_quota] ( + [id] int NOT NULL IDENTITY (1,1), + [sid] int, + [name] varchar(255) , + [qlimit] int , + [action] int , + [active] int NOT NULL default '1', + PRIMARY KEY ([id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_quota_members] ( + [id] int NOT NULL IDENTITY (1,1), + [sid] int , + [qid] int , + [quota_id] int , + [code] varchar(5) , + PRIMARY KEY ([id]) + );");echo $modifyoutput; flush();ob_flush(); + + // Rename Norwegian language code from NO to NB + $oldnewlanguages=array('no'=>'nb'); + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update [prefix_answers] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_questions] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_groups] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_labels] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_surveys] set [language]='$newlang' where [language]='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_language]='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); + modify_database("","update [prefix_users] set [lang]='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update [prefix_labelsets] set [languages]='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush();} + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update [prefix_surveys] set [additional_languages]='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush();} + } + + modify_database("","ALTER TABLE [prefix_surveys] ADD [htmlemail] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [usecaptcha] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [tokenanswerspersistence] CHAR(1) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_users] ADD [htmleditormode] CHAR(7) DEFAULT 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_templates_rights] ( + [uid] int NOT NULL, + [folder] varchar(255) NOT NULL, + [use] int NOT NULL, + PRIMARY KEY ([uid],[folder]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_templates] ( + [folder] varchar(255) NOT NULL, + [creator] int NOT NULL, + PRIMARY KEY ([folder]) + );");echo $modifyoutput; flush();ob_flush(); + //123 + modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [value] VARCHAR(255)"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('title','labels'); + modify_database("","ALTER TABLE [prefix_labels] ALTER COLUMN [title] varchar(4000)"); echo $modifyoutput; flush();ob_flush(); + //124 + modify_database("","ALTER TABLE [prefix_surveys] ADD [bounce_email] varchar(max)"); echo $modifyoutput; flush();ob_flush(); + //125 + upgrade_token_tables125(); + modify_database("","EXEC sp_rename 'prefix_users.move_user','superadmin'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_users] SET [superadmin]=1 where ([create_survey]=1 AND [create_user]=1 AND [delete_user]=1 AND [configurator]=1)"); echo $modifyoutput; flush();ob_flush(); + //126 + modify_database("","ALTER TABLE [prefix_questions] ADD [lid1] int NOT NULL DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_conditions] SET [method]='==' where ( [method] is null) or [method]='' or [method]='0'"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","update [prefix_settings_global] set [stg_value]='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 127) { + modify_database("","create index [answers_idx2] on [prefix_answers] ([sortorder])"); echo $modifyoutput; + modify_database("","create index [assessments_idx2] on [prefix_assessments] ([sid])"); echo $modifyoutput; + modify_database("","create index [assessments_idx3] on [prefix_assessments] ([gid])"); echo $modifyoutput; + modify_database("","create index [conditions_idx2] on [prefix_conditions] ([qid])"); echo $modifyoutput; + modify_database("","create index [conditions_idx3] on [prefix_conditions] ([cqid])"); echo $modifyoutput; + modify_database("","create index [groups_idx2] on [prefix_groups] ([sid])"); echo $modifyoutput; + modify_database("","create index [question_attributes_idx2] on [prefix_question_attributes] ([qid])"); echo $modifyoutput; + modify_database("","create index [questions_idx2] on [prefix_questions] ([sid])"); echo $modifyoutput; + modify_database("","create index [questions_idx3] on [prefix_questions] ([gid])"); echo $modifyoutput; + modify_database("","create index [questions_idx4] on [prefix_questions] ([type])"); echo $modifyoutput; + modify_database("","create index [quota_idx2] on [prefix_quota] ([sid])"); echo $modifyoutput; + modify_database("","create index [saved_control_idx2] on [prefix_saved_control] ([sid])"); echo $modifyoutput; + modify_database("","create index [user_in_groups_idx1] on [prefix_user_in_groups] ([ugid], [uid])"); echo $modifyoutput; + modify_database("","update [prefix_settings_global] set [stg_value]='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 128) { + upgrade_token_tables128(); + modify_database("","update [prefix_settings_global] set [stg_value]='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 129) { + //128 + modify_database("","ALTER TABLE [prefix_surveys] ADD [startdate] DATETIME"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [usestartdate] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 130) + { + modify_database("","ALTER TABLE [prefix_conditions] ADD [scenario] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE [prefix_conditions] SET [scenario]=1 where ( [scenario] is null) or [scenario]='' or [scenario]=0"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 131) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [publicstatistics] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 132) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [publicgraphs] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 133) + { + modify_database("","ALTER TABLE [prefix_users] ADD [one_time_pw] varchar(max)"); echo $modifyoutput; flush();ob_flush(); + // Add new assessment setting + modify_database("","ALTER TABLE [prefix_surveys] ADD [assessments] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + // add new assessment value fields to answers & labels + modify_database("","ALTER TABLE [prefix_answers] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_labels] ADD [assessment_value] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + // copy any valid codes from code field to assessment field + modify_database("","update [prefix_answers] set [assessment_value]=CAST([code] as int)");// no output here is intended + modify_database("","update [prefix_labels] set [assessment_value]=CAST([code] as int)");// no output here is intended + // activate assessment where assessment rules exist + modify_database("","update [prefix_surveys] set [assessments]='Y' where [sid] in (SELECT [sid] FROM [prefix_assessments] group by [sid])"); echo $modifyoutput; flush();ob_flush(); + // add language field to assessment table + modify_database("","ALTER TABLE [prefix_assessments] ADD [language] varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();ob_flush(); + // update language field with default language of that particular survey + modify_database("","update [prefix_assessments] set [language]=(select [language] from [prefix_surveys] where [sid]=[prefix_assessments].[sid])"); echo $modifyoutput; flush();ob_flush(); + // copy assessment link to message since from now on we will have HTML assignment messages + modify_database("","update [prefix_assessments] set [message]=cast([message] as varchar) +'
                '+[link]+''"); echo $modifyoutput; flush();ob_flush(); + // drop the old link field + modify_database("","ALTER TABLE [prefix_assessments] DROP COLUMN [link]"); echo $modifyoutput; flush();ob_flush(); + // change the primary index to include language + mssql_drop_primary_index('assessments'); + // add the new primary key + modify_database("","ALTER TABLE [prefix_assessments] ADD CONSTRAINT pk_assessments_id_lang PRIMARY KEY ([id],[language])"); echo $modifyoutput; flush();ob_flush(); + + // Add new fields to survey language settings + modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_url] varchar(255)"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_endtext] varchar(max)"); echo $modifyoutput; flush();ob_flush(); + // copy old URL fields ot language specific entries + modify_database("","update [prefix_surveys_languagesettings] set [surveyls_url]=(select [url] from [prefix_surveys] where [sid]=[prefix_surveys_languagesettings].[surveyls_survey_id])"); echo $modifyoutput; flush();ob_flush(); + // drop old URL field + mssql_drop_constraint('url','surveys'); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [url]"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","update [prefix_settings_global] set [stg_value]='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 134) + { + // Add new assessment setting + modify_database("","ALTER TABLE [prefix_surveys] ADD [usetokens] char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('attribute1','surveys'); + mssql_drop_constraint('attribute2','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] ADD [attributedescriptions] varchar(max);"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute1]"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] DROP COLUMN [attribute2]"); echo $modifyoutput; flush();ob_flush(); + upgrade_token_tables134(); + modify_database("","update [prefix_settings_global] set [stg_value]='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 135) + { + mssql_drop_constraint('value','question_attributes'); + modify_database("","ALTER TABLE [prefix_question_attributes] ALTER COLUMN [value] varchar(max)"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_answers] ALTER COLUMN [answer] varchar(8000)"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 136) //New quota functions + { + modify_database("", "ALTER TABLE[prefix_quota] ADD [autoload_url] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_quota_languagesettings] ( + [quotals_id] int NOT NULL IDENTITY (1,1), + [quotals_quota_id] int, + [quotals_language] varchar(45) NOT NULL default 'en', + [quotals_name] varchar(255), + [quotals_message] varchar(max), + [quotals_url] varchar(255), + [quotals_urldescrip] varchar(255), + PRIMARY KEY ([quotals_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 137) //New date format specs + { + modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD [dateformat] int NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "update [prefix_surveys] set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "update [prefix_surveys] set expires=null where useexpiry='N'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('usestartdate','surveys'); + mssql_drop_constraint('useexpiry','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN usestartdate"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN useexpiry"); echo $modifyoutput; flush();ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 138) //Modify quota field + { + modify_database("", "ALTER TABLE [prefix_quota_members] ALTER COLUMN [code] VARCHAR(11) NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 139) //Modify quota field + { + upgrade_survey_tables139(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 140) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD [emailresponseto] varchar(max)"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 141) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD [tokenlength] tinyint NOT NULL default '15'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 142) //Modify surveys table + { + upgrade_question_attributes142(); + modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [startdate] datetime NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ALTER COLUMN [expires] datetime NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_question_attributes] SET [value]='0' WHERE cast([value] as varchar)='false'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_question_attributes] SET [value]='1' WHERE cast([value] as varchar)='true'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 143) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_questions] ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_answers] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_questions] ADD scale_id tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_questions] ADD same_default tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_primary_index('answers'); + modify_database("","ALTER TABLE [prefix_answers] ADD CONSTRAINT pk_answers_qcls PRIMARY KEY ([qid],[code],[language],[scale_id])"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE [prefix_defaultvalues] ( + [qid] integer NOT NULL default '0', + [scale_id] tinyint NOT NULL default '0', + [sqid] integer NOT NULL default '0', + [language] varchar(20) NOT NULL, + [specialtype] varchar(20) NOT NULL default '', + [defaultvalue] varchar(max), + CONSTRAINT pk_defaultvalues_qlss PRIMARY KEY ([qid] , [scale_id], [language], [specialtype], [sqid]))"); echo $modifyoutput; flush();ob_flush(); + + // -Move all 'answers' that are subquestions to the questions table + // -Move all 'labels' that are answers to the answers table + // -Transscribe the default values where applicable + // -Move default values from answers to questions + upgrade_tables143(); + + mssql_drop_constraint('default_value','answers'); + modify_database("", "ALTER TABLE [prefix_answers] DROP COLUMN [default_value]"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('lid','questions'); + modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('lid1','questions'); + modify_database("", "ALTER TABLE [prefix_questions] DROP COLUMN lid1"); echo $modifyoutput; flush();ob_flush(); + // add field for timings and table for extended conditions + modify_database("", "ALTER TABLE [prefix_surveys] ADD savetimings char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE prefix_sessions( + sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', + expiry DATETIME NOT NULL , + expireref VARCHAR( 250 ) DEFAULT '', + created DATETIME NOT NULL , + modified DATETIME NOT NULL , + sessdata varchar(max), + CONSTRAINT pk_sessions_sesskey PRIMARY KEY ( [sesskey] ))"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "create index [idx_expiry] on [prefix_sessions] ([expiry])"); echo $modifyoutput; + modify_database("", "create index [idx_expireref] on [prefix_sessions] ([expireref])"); echo $modifyoutput; + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + + + + + + + } + + if ($oldversion < 145) //Modify surveys table + { + modify_database("", "ALTER TABLE [prefix_surveys] ADD showxquestions CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showgroupinfo CHAR(1) NULL default 'B' "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD shownoanswer CHAR(1) NULL default 'Y' "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bouncetime BIGINT NULL"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceprocessing VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounttype VARCHAR(4) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccounthost VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountpass VARCHAR(100) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountencryption VARCHAR(3) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD bounceaccountuser VARCHAR(200) NULL "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showwelcome CHAR(1) NULL default 'Y' "); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD navigationdelay tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD nokeyboard CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_surveys] ADD alloweditaftercompletion CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "CREATE TABLE [prefix_survey_permissions] ( + [sid] INT NOT NULL, + [uid] INT NOT NULL, + [permission] VARCHAR(20) NOT NULL, + [create_p] TINYINT NOT NULL default '0', + [read_p] TINYINT NOT NULL default '0', + [update_p] TINYINT NOT NULL default '0', + [delete_p] TINYINT NOT NULL default '0', + [import_p] TINYINT NOT NULL default '0', + [export_p] TINYINT NOT NULL default '0', + PRIMARY KEY ([sid], [uid],[permission]) + );"); echo $modifyoutput; flush();ob_flush(); + upgrade_surveypermissions_table145(); + modify_database("", "DROP TABLE [prefix_surveys_rights]"); echo $modifyoutput; flush();ob_flush(); + + // Add new fields for email templates + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD + email_admin_notification_subj VARCHAR(255) NULL, + email_admin_notification varchar(max) NULL, + email_admin_responses_subj VARCHAR(255) NULL, + email_admin_responses varchar(max) NULL"); + + //Add index to questions table to speed up subquestions + modify_database("", "create index [parent_qid_idx] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto varchar(max) DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); + upgrade_survey_table145(); + mssql_drop_constraint('notification','surveys'); + modify_database("", "ALTER TABLE [prefix_surveys] DROP COLUMN [notification]"); echo $modifyoutput; flush();ob_flush(); + + // modify length of method in conditions + modify_database("","ALTER TABLE [prefix_conditions] ALTER COLUMN [method] CHAR(5) NOT NULL"); echo $modifyoutput; flush();ob_flush(); + + //Add index to questions table to speed up subquestions + modify_database("", "create index [parent_qid] on [prefix_questions] ([parent_qid])"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","UPDATE prefix_surveys set [private]='N' where [private] is NULL;"); echo $modifyoutput; flush();ob_flush(); + + modify_database("","EXEC sp_rename 'prefix_surveys.private','anonymized'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ALTER COLUMN [anonymized] char(1) NOT NULL;"); echo $modifyoutput; flush();ob_flush(); + mssql_drop_constraint('anonymized','surveys'); + modify_database("","ALTER TABLE [prefix_surveys] ADD CONSTRAINT DF_surveys_anonymized DEFAULT 'N' FOR [anonymized];"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "CREATE TABLE [prefix_failed_login_attempts] ( + [id] INT NOT NULL IDENTITY (1,1) PRIMARY KEY, + [ip] varchar(37) NOT NULL, + [last_attempt] varchar(20) NOT NULL, + [number_attempts] int NOT NULL );"); echo $modifyoutput; flush();ob_flush(); + + modify_database("", "ALTER TABLE [prefix_surveys_languagesettings] ADD [surveyls_numberformat] INT default 0 NOT NULL"); echo $modifyoutput; flush();ob_flush(); + + upgrade_token_tables145(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + + + } + if ($oldversion < 146) //Modify surveys table + { + upgrade_timing_tables146(); + modify_database("", "INSERT into [prefix_survey_permissions] (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from [prefix_surveys]"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 147) + { + modify_database("", "ALTER TABLE [prefix_users] ADD templateeditormode VARCHAR( 7 ) NOT NULL default 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD questionselectormode VARCHAR( 7 ) NOT NULL default 'default'"); echo $modifyoutput; flush();ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='147' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 148) + { + modify_database("","CREATE TABLE [prefix_participants] ( + [participant_id] varchar(50) NOT NULL, + [firstname] varchar(40) NOT NULL, + [lastname] varchar(40) NOT NULL, + [email] varchar(80) NOT NULL, + [language] varchar(2) NOT NULL, + [blacklisted] varchar(1) NOT NULL, + [owner_uid] integer NOT NULL, + PRIMARY KEY ([participant_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute] ( + [participant_id] varchar(50) NOT NULL, + [attribute_id] integer NOT NULL, + [value] varchar(50) NOT NULL, + PRIMARY KEY ([participant_id],[attribute_id]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_names] ( + [attribute_id] integer NOT NULL IDENTITY (1,1), + [attribute_type] varchar(4) NOT NULL, + [visible] char(5) NOT NULL, + PRIMARY KEY ([attribute_id],[attribute_type]) + );");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_names_lang] ( + [attribute_id] integer NOT NULL, + [attribute_name] varchar(30) NOT NULL, + [lang] varchar(20) NOT NULL, + PRIMARY KEY ([attribute_id],[lang]) + ); ");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_attribute_values] ( + [attribute_id] integer NOT NULL, + [value_id] integer NOT NULL IDENTITY (1,1), + [value] varchar(20) NOT NULL, + PRIMARY KEY ([value_id]) + ); ");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_participant_shares] ( + [participant_id] varchar(50) NOT NULL, + [share_uid] integer NOT NULL, + [date_added] datetime, + [can_edit] varchar(max) NOT NULL, + PRIMARY KEY ([participant_id],[share_uid]) + ); ");echo $modifyoutput; flush();ob_flush(); + modify_database("","CREATE TABLE [prefix_survey_links] ( + [participant_id] varchar(50) NOT NULL, + [token_id] integer NOT NULL, + [survey_id] integer NOT NULL, + [date_created] datetime, + PRIMARY KEY ([participant_id],[token_id],[survey_id]) + ); ");echo $modifyoutput; flush();ob_flush(); + modify_database("", "ALTER TABLE [prefix_users] ADD [participant_panel] int NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); + + // Add language field to question_attributes table + modify_database("","ALTER TABLE [prefix_question_attributes] ADD [language] varchar(20)"); echo $modifyoutput; flush();ob_flush(); + upgrade_question_attributes148(); + fixSubquestions(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='148' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + if ($oldversion < 150) + { + modify_database("","ALTER TABLE [prefix_questions] ADD [relevance] varchar(max);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='150' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 151) + { + modify_database("","ALTER TABLE [prefix_groups] ADD [randomization_group] VARCHAR(20) NOT NULL DEFAULT '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='151' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 152) + { + modify_database("","CREATE INDEX [question_attributes_idx3] ON [prefix_question_attributes] ([attribute]);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='152' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 153) + { + modify_database("","CREATE TABLE [prefix_expression_errors] ( + [id] integer NOT NULL IDENTITY (1,1), + [errortime] varchar(50) DEFAULT NULL, + [sid] integer DEFAULT NULL, + [gid] integer DEFAULT NULL, + [qid] integer DEFAULT NULL, + [gseq] integer DEFAULT NULL, + [qseq] integer DEFAULT NULL, + [type] varchar(50) , + [eqn] varchar(max), + [prettyprint] varchar(max), + PRIMARY KEY ([id]) + );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET stg_value='153' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 154) + { + modify_database("","ALTER TABLE [prefix_groups] ADD [grelevance] varchar(max) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update [prefix_settings_global] set [stg_value]='154' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 155) + { + modify_database("","ALTER TABLE [prefix_surveys] ADD [googleanalyticsstyle] char(1) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE [prefix_surveys] ADD [googleanalyticsapikey] varchar(25) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","EXEC sp_rename 'prefix_surveys.showXquestions','showxquestions'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='155' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 155.6) + { + LimeExpressionManager::UpgradeConditionsToRelevance(); + modify_database("", "UPDATE [prefix_settings_global] SET [stg_value]='155.6' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + + echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; + return true; +} + +function upgrade_survey_tables117() +{ + global $modifyoutput; + $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD [startdate] datetime"); echo $modifyoutput; flush();ob_flush(); + } + } +} + + +function upgrade_survey_tables118() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ALTER COLUMN [token] VARCHAR(36)"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function upgrade_token_tables125() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [emailstatus] VARCHAR(300) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function upgrade_token_tables128() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [remindersent] VARCHAR(17) DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE ".$sv." ADD [remindercount] int DEFAULT '0'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function fixLanguageConsistencyAllSurveys() +{ + global $dbprefix, $connect, $modifyoutput; + $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); + $surveyidresult = db_execute_num($surveyidquery); + while ( $sv = $surveyidresult->FetchRow() ) + { + FixLanguageConsistency($sv[0],$sv[1]); + } +} + + +function upgrade_token_tables134() +{ + global $connect,$modifyoutput,$dbprefix; + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) + { + modify_database("","ALTER TABLE ".$sv." ADD [validfrom] DATETIME"); echo $modifyoutput; flush();ob_flush(); + modify_database("","ALTER TABLE ".$sv." ADD [validuntil] DATETIME"); echo $modifyoutput; flush();ob_flush(); + } +} + +// Add the usesleft field to all existing token tables +function upgrade_token_tables145() +{ + global $modifyoutput, $dbprefix, $connect; + $surveyidquery = db_select_tables_like($dbprefix."tokens%"); + $surveyidresult = db_execute_num($surveyidquery); + $tokentables=$connect->MetaTables('TABLES',false,$dbprefix."tokens%"); + foreach ($tokentables as $sv) { + modify_database("","ALTER TABLE ".$sv." ADD [usesleft] int NOT NULL DEFAULT '1'"); echo $modifyoutput; flush();ob_flush(); + modify_database("","UPDATE ".$sv." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function mssql_drop_primary_index($tablename) +{ + global $dbprefix, $connect, $modifyoutput; + // find out the constraint name of the old primary key + $pkquery = "SELECT CONSTRAINT_NAME " + ."FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS " + ."WHERE (TABLE_NAME = '{$dbprefix}{$tablename}') AND (CONSTRAINT_TYPE = 'PRIMARY KEY')"; + + $primarykey=$connect->GetOne($pkquery); + if ($primarykey!=false) + { + modify_database("","ALTER TABLE [prefix_{$tablename}] DROP CONSTRAINT {$primarykey}"); echo $modifyoutput; flush();ob_flush(); + } +} + + +function mssql_drop_constraint($fieldname, $tablename) +{ + global $dbprefix, $connect, $modifyoutput; + $connect->SetFetchMode(ADODB_FETCH_ASSOC); + + // find out the name of the default constraint + // Did I already mention that this is the most suckiest thing I have ever seen in MSSQL database? + $dfquery ="SELECT c_obj.name AS constraint_name + FROM sys.sysobjects AS c_obj INNER JOIN + sys.sysobjects AS t_obj ON c_obj.parent_obj = t_obj.id INNER JOIN + sys.sysconstraints AS con ON c_obj.id = con.constid INNER JOIN + sys.syscolumns AS col ON t_obj.id = col.id AND con.colid = col.colid + WHERE (c_obj.xtype = 'D') AND (col.name = '$fieldname') AND (t_obj.name='$dbprefix$tablename')"; + $defaultname=$connect->GetRow($dfquery); + if ($defaultname!=false) + { + modify_database("","ALTER TABLE [prefix_$tablename] DROP CONSTRAINT {$defaultname['constraint_name']}"); echo $modifyoutput; flush();ob_flush(); + } + + +} + +function upgrade_survey_tables139() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD [lastpage] int"); echo $modifyoutput; flush();ob_flush(); + } + } +} + +function upgrade_question_attributes142() +{ + global $modifyoutput,$dbprefix, $connect; + $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; + $questionids = db_select_column($attributequery); + foreach ($questionids as $questionid) + { + //Select all affected question attributes + $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); + modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); + $record['value']=implode(';',$attributevalues); + $record['attribute']='exclude_all_other'; + $record['qid']=$questionid; + $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); + } +} + +function upgrade_tables143() +{ + global $modifyoutput,$dbprefix, $connect; + + + $aQIDReplacements=array(); + $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); + } + } + + // Convert answers to subquestions + + $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + db_switchIDInsert('questions',true); + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$row['code']; + $insertarray['question']=$row['answer']; + $insertarray['question_order']=$row['sortorder']; + $insertarray['language']=$row['language']; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();ob_flush(); + if (!isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + else + { + $iSaveSQID=$insertarray['qid']; + db_switchIDInsert('questions',false); + } + if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); + } + } + } + modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();ob_flush(); + + // Convert labels to answers + $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); + //$labelids[] + } + if ($row['type']=='1') + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); + } + } + } + } + + // Convert labels to subquestions + $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; + db_switchIDInsert('questions',true); + + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['type']=$row['type']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['title']=$lrow['code']; + $insertarray['question']=$lrow['title']; + $insertarray['question_order']=$lrow['sortorder']; + $insertarray['language']=$lrow['language']; + $insertarray['scale_id']=1; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();ob_flush(); + if (isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); + db_switchIDInsert('questions',false); + + } + } + } + } + + + $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; + modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); + $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; + modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); + + // Now move all non-standard templates to the /upload dir + global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; + + if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} + if ($handle = opendir($standardtemplaterootdir)) + { + while (false !== ($file = readdir($handle))) + { + if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) + { + if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) + { + echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; + }; + } + } + closedir($handle); + } + +} + +function upgrade_timing_tables146() +{ + global $modifyoutput,$dbprefix, $connect; + $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); + foreach ($aTimingTables as $sTable) { + modify_database("","EXEC sp_rename '{$sTable}.interviewTime','interviewtime'"); echo $modifyoutput; flush(); ob_flush(); + } +} diff --git a/include/limesurvey/admin/update/upgrade-mysql.php b/include/limesurvey/admin/update/upgrade-mysql.php index 547d5ceb..dc713608 100644 --- a/include/limesurvey/admin/update/upgrade-mysql.php +++ b/include/limesurvey/admin/update/upgrade-mysql.php @@ -1,954 +1,1074 @@ -'german-informal', - 'cns'=>'cn-Hans', - 'cnt'=>'cn-Hant', - 'pt_br'=>'pt-BR', - 'gr'=>'el', - 'jp'=>'ja', - 'si'=>'sl', - 'se'=>'sv', - 'vn'=>'vi'); - - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update `prefix_answers` set `language`='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_questions` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_groups` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_labels` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_surveys` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_surveys_languagesettings` set `surveyls_language`='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_users` set `lang`='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); - } - - - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update `prefix_labelsets` set `languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush(); - } - - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace=str_replace('german_informal','german-informal',$toreplace); - $toreplace=str_replace('cns','cn-Hans',$toreplace); - $toreplace=str_replace('cnt','cn-Hant',$toreplace); - $toreplace=str_replace('pt_br','pt-BR',$toreplace); - $toreplace=str_replace('gr','el',$toreplace); - $toreplace=str_replace('jp','ja',$toreplace); - $toreplace=str_replace('si','sl',$toreplace); - $toreplace=str_replace('se','sv',$toreplace); - $toreplace=str_replace('vn','vi',$toreplace); - modify_database("","update `prefix_surveys` set `additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush(); - } - modify_database("","update `prefix_settings_global` set `stg_value`='111' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - } - - - if ($oldversion < 112) { - //The size of the users_name field is now 64 char (20 char before version 112) - modify_database("","ALTER TABLE `prefix_users` CHANGE `users_name` `users_name` VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 113) { - //Fixes the collation for the complete DB, tables and columns - echo "Attention:The following upgrades will update your MySQL Database collations. This may take some time.
                If for any reason you should get a timeout just re-run the upgrade procedure. The updating will continue where it left off.

                "; flush();ob_flush(); - fix_mysql_collation(); - modify_database("","ALTER DATABASE `$databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;");echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 114) { - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `email` `email` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `adminemail` `adminemail` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `email` `email` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("",'INSERT INTO `prefix_settings_global` VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 126) { - //Adds new "public" field - modify_database("","ALTER TABLE `prefix_surveys` ADD `printanswers` CHAR(1) default 'N' AFTER allowsave"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` ADD `listpublic` CHAR(1) default 'N' AFTER `datecreated`"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_tables117(); - upgrade_survey_tables118(); - // 119 - modify_database("","CREATE TABLE `prefix_quota` ( - `id` int(11) NOT NULL auto_increment, - `sid` int(11) default NULL, - `qlimit` int(8) default NULL, - `name` varchar(255) collate utf8_unicode_ci default NULL, - `action` int(2) default NULL, - `active` int(1) NOT NULL default '1', - PRIMARY KEY (`id`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE `prefix_quota_members` ( - `id` int(11) NOT NULL auto_increment, - `sid` int(11) default NULL, - `qid` int(11) default NULL, - `quota_id` int(11) default NULL, - `code` varchar(5) collate utf8_unicode_ci default NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `sid` (`sid`,`qid`,`quota_id`,`code`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - - // Rename Norwegian language code from NO to NB - $oldnewlanguages=array('no'=>'nb'); - foreach ($oldnewlanguages as $oldlang=>$newlang) - { - modify_database("","update `prefix_answers` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_questions` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_groups` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_labels` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_surveys` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_surveys_languagesettings` set `surveyls_language`='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();ob_flush(); - modify_database("","update `prefix_users` set `lang`='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();ob_flush(); - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update `prefix_labelsets` set `languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();ob_flush();} - } - - $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); - while ($datarow = $resultdata->FetchRow()){ - $toreplace=$datarow['additional_languages']; - $toreplace2=str_replace('no','nb',$toreplace); - if ($toreplace2!=$toreplace) {modify_database("","update `prefix_surveys` set `additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();ob_flush();} - } - - - modify_database("","ALTER TABLE `prefix_surveys` ADD `htmlemail` CHAR(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` ADD `tokenanswerspersistence` CHAR(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` ADD `usecaptcha` CHAR(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` ADD `htmleditormode` CHAR(7) default 'default'"); echo $modifyoutput; flush();ob_flush(); - //122 - modify_database("","CREATE TABLE `prefix_templates_rights` ( - `uid` int(11) NOT NULL, - `folder` varchar(255) NOT NULL, - `use` int(1) NOT NULL, - PRIMARY KEY (`uid`,`folder`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE `prefix_templates` ( - `folder` varchar(255) NOT NULL, - `creator` int(11) NOT NULL, - PRIMARY KEY (`folder`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - - //123 - modify_database("","ALTER TABLE `prefix_conditions` CHANGE `value` `value` VARCHAR(255) NOT NULL default ''"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_labels` CHANGE `title` `title` text"); echo $modifyoutput; flush();ob_flush(); - //124 - modify_database("","ALTER TABLE `prefix_surveys` ADD `bounce_email` text"); echo $modifyoutput; flush();ob_flush(); - //125 - upgrade_token_tables125(); - modify_database("","ALTER TABLE `prefix_users` ADD `superadmin` tinyint(1) NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_users` SET `superadmin`=1 where (create_survey=1 AND create_user=1 AND move_user=1 AND delete_user=1 AND configurator=1)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` DROP COLUMN `move_user`"); echo $modifyoutput; flush();ob_flush(); - //126 - modify_database("","ALTER TABLE `prefix_questions` ADD `lid1` integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_conditions` SET `method`='==' where (`method` is null) or `method`='' or `method`='0'"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update `prefix_settings_global` set `stg_value`='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 127) { - modify_database("","create index `assessments_idx2` on `prefix_assessments` (`sid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `assessments_idx3` on `prefix_assessments` (`gid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `conditions_idx2` on `prefix_conditions` (`qid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `groups_idx2` on `prefix_groups` (`sid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `questions_idx2` on `prefix_questions` (`sid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `questions_idx3` on `prefix_questions` (`gid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `question_attributes_idx2` on `prefix_question_attributes` (`qid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `quota_idx2` on `prefix_quota` (`sid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `saved_control_idx2` on `prefix_saved_control` (`sid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `user_in_groups_idx1` on `prefix_user_in_groups` (`ugid`, `uid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `answers_idx2` on `prefix_answers` (`sortorder`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `conditions_idx3` on `prefix_conditions` (`cqid`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","create index `questions_idx4` on `prefix_questions` (`type`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 128) { - //128 - upgrade_token_tables128(); - modify_database("","update `prefix_settings_global` set `stg_value`='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 129) { - //129 - modify_database("","ALTER TABLE `prefix_surveys` ADD `startdate` DATETIME"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` ADD `usestartdate` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 130) - { - modify_database("","ALTER TABLE `prefix_conditions` ADD `scenario` integer NOT NULL default '1' AFTER `qid`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_conditions` SET `scenario`=1 where (`scenario` is null) or `scenario`='' or `scenario`=0"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 131) - { - modify_database("","ALTER TABLE `prefix_surveys` ADD `publicstatistics` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 132) - { - modify_database("","ALTER TABLE `prefix_surveys` ADD `publicgraphs` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 133) - { - modify_database("","ALTER TABLE `prefix_users` ADD `one_time_pw` blob"); echo $modifyoutput; flush();ob_flush(); - // Add new assessment setting - modify_database("","ALTER TABLE `prefix_surveys` ADD `assessments` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - // add new assessment value fields to answers & labels - modify_database("","ALTER TABLE `prefix_answers` ADD `assessment_value` int(11) NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_labels` ADD `assessment_value` int(11) NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - // copy any valid codes from code field to assessment field - modify_database("","update `prefix_answers` set `assessment_value`=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'");echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_labels` set `assessment_value`=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'");echo $modifyoutput; flush();ob_flush(); - // activate assessment where assesment rules exist - modify_database("","update `prefix_surveys` set `assessments`='Y' where `sid` in (SELECT `sid` FROM `prefix_assessments` group by `sid`)"); echo $modifyoutput; flush();ob_flush(); - // add language field to assessment table - modify_database("","ALTER TABLE `prefix_assessments` ADD `language` varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();ob_flush(); - // update language field with default language of that particular survey - modify_database("","update `prefix_assessments` set `language`=(select `language` from `prefix_surveys` where `sid`=`prefix_assessments`.`sid`)"); echo $modifyoutput; flush();ob_flush(); - // copy assessment link to message since from now on we will have HTML assignment messages - modify_database("","update `prefix_assessments` set `message`=concat(replace(`message`,'/''',''''),'
                ',`link`,'')"); echo $modifyoutput; flush();ob_flush(); - // drop the old link field - modify_database("","ALTER TABLE `prefix_assessments` DROP COLUMN `link`"); echo $modifyoutput; flush();ob_flush(); - // change the primary index to include language - modify_database("","ALTER TABLE `prefix_assessments` DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(`id`, `language`)"); echo $modifyoutput; flush();ob_flush(); - //finally fix missing translations for assessments - upgrade_survey_tables133(); - // Add new fields to survey language settings - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_url` varchar(255)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_endtext` text"); echo $modifyoutput; flush();ob_flush(); - // copy old URL fields ot language specific entries - modify_database("","update `prefix_surveys_languagesettings` set `surveyls_url`=(select `url` from `prefix_surveys` where `sid`=`prefix_surveys_languagesettings`.`surveyls_survey_id`)"); echo $modifyoutput; flush();ob_flush(); - // drop old URL field - modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `url`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update `prefix_settings_global` set `stg_value`='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 134) - { - // Add new tokens setting - modify_database("","ALTER TABLE `prefix_surveys` ADD `usetokens` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` ADD `attributedescriptions` TEXT;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `attribute1`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `attribute2`"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables134(); - modify_database("","update `prefix_settings_global` set `stg_value`='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 135) - { - modify_database("","ALTER TABLE `prefix_question_attributes` MODIFY `value` text"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='135' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 136) //New Quota Functions - { - modify_database("","ALTER TABLE `prefix_quota` ADD `autoload_url` int(1) NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE `prefix_quota_languagesettings` ( - `quotals_id` int(11) NOT NULL auto_increment, - `quotals_quota_id` int(11) NOT NULL default '0', - `quotals_language` varchar(45) NOT NULL default 'en', - `quotals_name` varchar(255) collate utf8_unicode_ci default NULL, - `quotals_message` text NOT NULL, - `quotals_url` varchar(255), - `quotals_urldescrip` varchar(255), - PRIMARY KEY (`quotals_id`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='136' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 137) //New Quota Functions - { - modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_dateformat` int(1) NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_users` ADD `dateformat` int(1) NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_surveys` set `startdate`=null where `usestartdate`='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_surveys` set `expires`=null where `useexpiry`='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `useexpiry`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `usestartdate`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='137' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 138) //Modify quota field - { - modify_database("", "ALTER TABLE `prefix_quota_members` CHANGE `code` `code` VARCHAR(11) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 139) //Modify quota field - { - upgrade_survey_tables139(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 140) //Modify surveys table - { - modify_database("", "ALTER TABLE `prefix_surveys` ADD `emailresponseto` text DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 141) //Modify surveys table - { - modify_database("", "ALTER TABLE `prefix_surveys` ADD `tokenlength` tinyint(2) NOT NULL default '15'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 142) //Modify surveys table - { - upgrade_question_attributes142(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `expires` `expires` datetime"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `startdate` `startdate` datetime"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_question_attributes` SET `value`='0' WHERE `value`='false'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_question_attributes` SET `value`='1' WHERE `value`='true'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 143) //Modify surveys table - { - modify_database("", "ALTER TABLE `prefix_questions` ADD `parent_qid` integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_answers` ADD `scale_id` tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_questions` ADD `scale_id` tinyint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_questions` ADD `same_default` tinyint NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_answers` DROP PRIMARY KEY, ADD PRIMARY KEY (`qid`,`code`,`language`,`scale_id`)"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE `prefix_defaultvalues` ( - `qid` int(11) NOT NULL default '0', - `scale_id` int(11) NOT NULL default '0', - `sqid` int(11) NOT NULL default '0', - `language` varchar(20) NOT NULL, - `specialtype` varchar(20) NOT NULL default '', - `defaultvalue` text, - PRIMARY KEY (`qid` , `scale_id`, `language`, `specialtype`, `sqid` ) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - - // -Move all 'answers' that are subquestions to the questions table - // -Move all 'labels' that are answers to the answers table - // -Transscribe the default values where applicable - // -Move default values from answers to questions - upgrade_tables143(); - - modify_database("", "ALTER TABLE `prefix_answers` DROP COLUMN `default_value`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_questions` DROP COLUMN `lid`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_questions` DROP COLUMN `lid1`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_sessions( - sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', - expiry DATETIME NOT NULL , - expireref VARCHAR( 250 ) DEFAULT '', - created DATETIME NOT NULL , - modified DATETIME NOT NULL , - sessdata LONGTEXT, - PRIMARY KEY ( sesskey ) , - INDEX sess2_expiry( expiry ), - INDEX sess2_expireref( expireref )) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - - - - } - - if ($oldversion < 145) - { - modify_database("", "ALTER TABLE `prefix_surveys` ADD `savetimings` CHAR(1) NULL default 'N' AFTER `format`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `showXquestions` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `showgroupinfo` CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `shownoanswer` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `showqnumcode` CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bouncetime` BIGINT(20) NULL "); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceprocessing` VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccounttype` VARCHAR(4) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccounthost` VARCHAR(200) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountpass` VARCHAR(100) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountencryption` VARCHAR(3) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountuser` VARCHAR(200) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `showwelcome` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `showprogress` char(1) default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `allowjumps` char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `navigationdelay` tinyint(2) default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `nokeyboard` char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE `prefix_surveys` ADD `alloweditaftercompletion` char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE `prefix_survey_permissions` ( - `sid` int(10) unsigned NOT NULL, - `uid` int(10) unsigned NOT NULL, - `permission` varchar(20) NOT NULL, - `create_p` tinyint(1) NOT NULL default '0', - `read_p` tinyint(1) NOT NULL default '0', - `update_p` tinyint(1) NOT NULL default '0', - `delete_p` tinyint(1) NOT NULL default '0', - `import_p` tinyint(1) NOT NULL default '0', - `export_p` tinyint(1) NOT NULL default '0', - PRIMARY KEY (sid, uid, permission) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - - upgrade_surveypermissions_table145(); - - // drop the old survey rights table - modify_database("", "DROP TABLE `prefix_surveys_rights`"); echo $modifyoutput; flush();ob_flush(); - - // Add new fields for email templates - modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD - (`email_admin_notification_subj` VARCHAR(255) NULL, - `email_admin_notification` TEXT NULL, - `email_admin_responses_subj` VARCHAR(255) NULL, - `email_admin_responses` TEXT NULL)"); - - //Add index to questions table to speed up subquestions - modify_database("", "create INDEX parent_qid_idx on prefix_questions( parent_qid );"); echo $modifyoutput; flush();ob_flush(); - - - modify_database("", "ALTER TABLE `prefix_surveys` ADD `emailnotificationto` text DEFAULT NULL AFTER `emailresponseto`"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_table145(); - modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `notification`"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_conditions` CHANGE `method` `method` CHAR( 5 ) NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_surveys` set `private`='N' where `private` is NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `private` `anonymized` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();ob_flush(); - - - //now we clean up things that were not properly set in previous DB upgrades - - modify_database("","UPDATE `prefix_answers` SET `answer`='' where `answer` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_answers` CHANGE `answer` `answer` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_answers` CHANGE `assessment_value` `assessment_value` int(11) NOT NULL default '0' AFTER `answer`;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_assessments` SET `scope`='' where `scope` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `scope` `scope` varchar(5) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_assessments` SET `name`='' where `name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `name` `name` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_assessments` SET `message`='' where `message` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `message` `message` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_assessments` SET `minimum`='' where `minimum` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `minimum` `minimum` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_assessments` SET `maximum`='' where `maximum` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `maximum` `maximum` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `id` `id` int(11) NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` DROP PRIMARY KEY;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` ADD PRIMARY KEY (`id`,`language`);"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_assessments` CHANGE `id` `id` int(11) NOT NULL auto_increment;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_conditions` CHANGE `cfieldname` `cfieldname` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_defaultvalues` CHANGE `specialtype` `specialtype` varchar(20) collate utf8_unicode_ci NOT NULL default '' AFTER `qid`;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_groups` SET `group_name`='' where `group_name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_groups` CHANGE `group_name` `group_name` varchar(100) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_labels` SET `code`='' where `code` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_labels` CHANGE `code` `code` varchar(5) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_labels` CHANGE `language` `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en' AFTER `assessment_value`;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_labelsets` SET `label_name`='' WHERE `label_name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_labelsets` CHANGE `label_name` `label_name` varchar(100) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_questions` CHANGE `parent_qid` `parent_qid` int(11) NOT NULL default '0' AFTER `qid`;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_questions` SET `type`='T' where `type` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_questions` CHANGE `type` `type` char(1) collate utf8_unicode_ci NOT NULL default 'T';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_questions` SET `title`='' where `type` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_questions` CHANGE `title` `title` varchar(20) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_questions` SET `question`='' where `question` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_questions` CHANGE `question` `question` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_questions` SET `other`='N' where `other` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_questions` CHANGE `other` `other` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_questions` CHANGE `mandatory` `mandatory` char(1) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_question_attributes` CHANGE `attribute` `attribute` varchar(50) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_quota` CHANGE `qlimit` `qlimit` int(8) default NULL AFTER `name`;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_saved_control` SET `identifier`='' where `identifier` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `identifier` `identifier` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_saved_control` SET `access_code`='' where `access_code` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `access_code` `access_code` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `email` `email` varchar(320) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_saved_control` SET `ip`='' where `ip` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `ip` `ip` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_saved_control` SET `saved_thisstep`='' where `access_code` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `saved_thisstep` `saved_thisstep` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_saved_control` SET `status`='' where `access_code` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `status` `status` char(1) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_saved_control` SET `saved_date`='0000-00-00 00:00:00' where `saved_date` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `saved_date` `saved_date` datetime NOT NULL;"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='' where `stg_value` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_settings_global` CHANGE `stg_value` `stg_value` varchar(255) collate utf8_unicode_ci NOT NULL default ''"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `admin` `admin` varchar(50) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_surveys` SET `active`='N' where `active` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `active` `active` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `startdate` `startdate` datetime default NULL AFTER `expires`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `adminemail` `adminemail` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `anonymized` `anonymized` char(1) collate utf8_unicode_ci NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `faxto` `faxto` varchar(20) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `format` `format` char(1) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `language` `language` varchar(50) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `additional_languages` `additional_languages` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `printanswers` `printanswers` char(1) collate utf8_unicode_ci default 'N' AFTER `allowprev`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `publicstatistics` `publicstatistics` char(1) collate utf8_unicode_ci default 'N' after `datecreated`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `publicgraphs` `publicgraphs` char(1) collate utf8_unicode_ci default 'N' AFTER `publicstatistics`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `assessments` `assessments` char(1) collate utf8_unicode_ci default 'N' AFTER `tokenanswerspersistence`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `usetokens` `usetokens` char(1) collate utf8_unicode_ci default 'N' AFTER `usecaptcha`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `bounce_email` `bounce_email` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys` CHANGE `tokenlength` `tokenlength` tinyint(2) default '15'"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_surveys_languagesettings` SET `surveyls_title`='' where `surveyls_title` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_title` `surveyls_title` varchar(200) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_endtext` `surveyls_endtext` text collate utf8_unicode_ci AFTER `surveyls_welcometext`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_url` `surveyls_url` varchar(255) collate utf8_unicode_ci default NULL AFTER `surveyls_endtext`"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_urldescription` `surveyls_urldescription` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_invite_subj` `surveyls_email_invite_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_remind_subj` `surveyls_email_remind_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_register_subj` `surveyls_email_register_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_confirm_subj` `surveyls_email_confirm_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_dateformat` `surveyls_dateformat` int(10) unsigned NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_users` SET `users_name`='' where `users_name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `users_name` `users_name` varchar(64) collate utf8_unicode_ci NOT NULL default ''"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE `prefix_users` SET `full_name`='' where `full_name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `full_name` `full_name` varchar(50) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `lang` `lang` varchar(20) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `email` `email` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `superadmin` `superadmin` tinyint(1) NOT NULL default '0' AFTER `delete_user`"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `htmleditormode` `htmleditormode` varchar(7) collate utf8_unicode_ci default 'default'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` CHANGE `dateformat` `dateformat` int(10) unsigned NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_users` DROP INDEX `email`;"); - - modify_database("","UPDATE `prefix_user_groups` SET `name`='' where `name` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_user_groups` CHANGE `name` `name` varchar(20) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE `prefix_user_groups` SET `description`='' where `description` is null;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE `prefix_user_groups` CHANGE `description` `description` text collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE `prefix_user_in_groups` DROP INDEX `user_in_groups_idx1`"); // Don't show output because this key might not exist - modify_database("","ALTER TABLE `prefix_user_in_groups` ADD PRIMARY KEY (`ugid`, `uid`)"); // Don't show output because this might already be set - modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_numberformat` int(11) NOT NULL DEFAULT 0 AFTER `surveyls_dateformat`"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE `prefix_failed_login_attempts` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `ip` varchar(37) NOT NULL, - `last_attempt` varchar(20) NOT NULL, - `number_attempts` int(11) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE=$databasetabletype CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables145(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 146) //Modify surveys table - { - upgrade_timing_tables146(); - modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - - echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; - return true; -} - - -function upgrade_survey_tables117() -{ - global $modifyoutput; - $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD `startdate` datetime AFTER `datestamp`"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_survey_tables118() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." CHANGE `token` `token` VARCHAR(15)"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_token_tables125() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD `emailstatus` varchar(300) NOT NULL DEFAULT 'OK'"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -// Add the reminders tracking fields -function upgrade_token_tables128() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD `remindersent` VARCHAR(17) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv[0]." ADD `remindercount` INT(11) DEFAULT 0"); echo $modifyoutput; flush();ob_flush(); - } - } -} - - - - -function upgrade_survey_tables133() -{ - $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); - $surveyidresult = db_execute_num($surveyidquery); - while ( $sv = $surveyidresult->FetchRow() ) - { - FixLanguageConsistency($sv[0],$sv[1]); - } -} - - -// Add the reminders tracking fields -function upgrade_token_tables134() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD `validfrom` Datetime"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv[0]." ADD `validuntil` Datetime"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -// Add the usesleft field to all existing token tables -function upgrade_token_tables145() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD `usesleft` int(11) NOT NULL default '1'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE ".$sv[0]." SET `usesleft`='0' WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); - } - } -} - - -function fix_mysql_collation() -{ - global $connect, $modifyoutput, $dbprefix; - $sql = 'SHOW TABLE STATUS'; - $result = db_execute_assoc($sql); - if (!$result) { - $modifyoutput .= 'SHOW TABLE - SQL Error'; - } - - while ( $tables = $result->FetchRow() ) { - // Loop through all tables in this database - $table = $tables['Name']; - $tablecollation=$tables['Collation']; - if (strpos($table,'old_')===false && ($dbprefix=='' || ($dbprefix!='' && strpos($table,$dbprefix)!==false))) - { - if ($tablecollation!='utf8_unicode_ci') - { - modify_database("","ALTER TABLE $table COLLATE utf8_unicode_ci"); - echo $modifyoutput; flush();ob_flush(); - } - - # Now loop through all the fields within this table - $result2 = db_execute_assoc("SHOW FULL COLUMNS FROM ".$table); - while ( $column = $result2->FetchRow()) - { - if ($column['Collation']!= 'utf8_unicode_ci' ) - { - $field_name = $column['Field']; - $field_type = $column['Type']; - $field_default = $column['Default']; - if ($field_default!='NULL') {$field_default="'".$field_default."'";} - # Change text based fields - $skipped_field_types = array('char', 'text', 'enum', 'set'); - - foreach ( $skipped_field_types as $type ) - { - if ( strpos($field_type, $type) !== false ) - { - $modstatement="ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_unicode_ci"; - if ($type!='text') {$modstatement.=" DEFAULT $field_default";} - modify_database("",$modstatement); - echo $modifyoutput; flush();ob_flush(); - } - } - } - } - } - } -} - - -function upgrade_survey_tables139() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - if (strpos($sv[0],$dbprefix."survey_")!==false) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD `lastpage` integer"); echo $modifyoutput; flush();ob_flush(); - } - } - } -} - -function upgrade_question_attributes142() -{ - global $modifyoutput,$dbprefix, $connect; - $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; - $questionids = db_select_column($attributequery); - foreach ($questionids as $questionid) - { - //Select all affected question attributes - $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); - modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); - $record['value']=implode(';',$attributevalues); - $record['attribute']='exclude_all_other'; - $record['qid']=$questionid; - $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); - } -} - -function upgrade_tables143() -{ - global $modifyoutput,$dbprefix, $connect; - - - $aQIDReplacements=array(); - $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); - } - } - - // Convert answers to subquestions - - $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['type']=$row['type']; - $insertarray['title']=$row['code']; - $insertarray['question']=$row['answer']; - $insertarray['question_order']=$row['sortorder']; - $insertarray['language']=$row['language']; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (!isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); - $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - else - { - $iSaveSQID=$insertarray['qid']; - } - if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); - } - } - } - // Sanitize data - modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();ob_flush(); - - // Convert labels to answers - $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - //$labelids[] - } - if ($row['type']=='1') - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - } - } - } - } - - // Convert labels to subquestions - $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['type']=$row['type']; - $insertarray['title']=$lrow['code']; - $insertarray['question']=$lrow['title']; - $insertarray['question_order']=$lrow['sortorder']; - $insertarray['language']=$lrow['language']; - $insertarray['scale_id']=1; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); - } - } - } - } - - - - $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - - // Now move all non-standard templates to the /upload dir - global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; - - if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} - if ($handle = opendir($standardtemplaterootdir)) - { - while (false !== ($file = readdir($handle))) - { - if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) - { - if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) - { - echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; - }; - } - } - closedir($handle); - } - -} - -function upgrade_timing_tables146() -{ - global $modifyoutput,$dbprefix, $connect; - $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); - foreach ($aTimingTables as $sTable) { - modify_database("","ALTER TABLE {$sTable} CHANGE `interviewTime` `interviewtime` DOUBLE NULL default 0;"); echo $modifyoutput; flush();ob_flush(); - } -} +'german-informal', + 'cns'=>'cn-Hans', + 'cnt'=>'cn-Hant', + 'pt_br'=>'pt-BR', + 'gr'=>'el', + 'jp'=>'ja', + 'si'=>'sl', + 'se'=>'sv', + 'vn'=>'vi'); + + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update `prefix_answers` set `language`='$newlang' where language='$oldlang'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_questions` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_groups` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_labels` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_surveys` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_surveys_languagesettings` set `surveyls_language`='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_users` set `lang`='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + } + + + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update `prefix_labelsets` set `languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();@ob_flush(); + } + + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace=str_replace('german_informal','german-informal',$toreplace); + $toreplace=str_replace('cns','cn-Hans',$toreplace); + $toreplace=str_replace('cnt','cn-Hant',$toreplace); + $toreplace=str_replace('pt_br','pt-BR',$toreplace); + $toreplace=str_replace('gr','el',$toreplace); + $toreplace=str_replace('jp','ja',$toreplace); + $toreplace=str_replace('si','sl',$toreplace); + $toreplace=str_replace('se','sv',$toreplace); + $toreplace=str_replace('vn','vi',$toreplace); + modify_database("","update `prefix_surveys` set `additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();@ob_flush(); + } + modify_database("","update `prefix_settings_global` set `stg_value`='111' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + } + + + if ($oldversion < 112) { + //The size of the users_name field is now 64 char (20 char before version 112) + modify_database("","ALTER TABLE `prefix_users` CHANGE `users_name` `users_name` VARCHAR( 64 ) NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='112' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 113) { + //Fixes the collation for the complete DB, tables and columns + echo "Attention:The following upgrades will update your MySQL Database collations. This may take some time.
                If for any reason you should get a timeout just re-run the upgrade procedure. The updating will continue where it left off.

                "; flush();@ob_flush(); + fix_mysql_collation(); + modify_database("","ALTER DATABASE `$databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;");echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='113' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 114) { + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `email` `email` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `adminemail` `adminemail` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `email` `email` VARCHAR(320) NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("",'INSERT INTO `prefix_settings_global` VALUES (\'SessionName\', \'$sessionname\');');echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='114' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 126) { + //Adds new "public" field + modify_database("","ALTER TABLE `prefix_surveys` ADD `printanswers` CHAR(1) default 'N' AFTER allowsave"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `listpublic` CHAR(1) default 'N' AFTER `datecreated`"); echo $modifyoutput; flush();@ob_flush(); + upgrade_survey_tables117(); + upgrade_survey_tables118(); + // 119 + modify_database("","CREATE TABLE `prefix_quota` ( + `id` int(11) NOT NULL auto_increment, + `sid` int(11) default NULL, + `qlimit` int(8) default NULL, + `name` varchar(255) collate utf8_unicode_ci default NULL, + `action` int(2) default NULL, + `active` int(1) NOT NULL default '1', + PRIMARY KEY (`id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE `prefix_quota_members` ( + `id` int(11) NOT NULL auto_increment, + `sid` int(11) default NULL, + `qid` int(11) default NULL, + `quota_id` int(11) default NULL, + `code` varchar(5) collate utf8_unicode_ci default NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `sid` (`sid`,`qid`,`quota_id`,`code`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + // Rename Norwegian language code from NO to NB + $oldnewlanguages=array('no'=>'nb'); + foreach ($oldnewlanguages as $oldlang=>$newlang) + { + modify_database("","update `prefix_answers` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_questions` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_groups` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_labels` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_surveys` set `language`='$newlang' where language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_surveys_languagesettings` set `surveyls_language`='$newlang' where surveyls_language='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + modify_database("","update `prefix_users` set `lang`='$newlang' where lang='$oldlang'");echo $modifyoutput;flush();@ob_flush(); + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("labelsets")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update `prefix_labelsets` set `languages`='$toreplace' where lid=".$datarow['lid']);echo $modifyoutput;flush();@ob_flush();} + } + + $resultdata=db_execute_assoc("select * from ".db_table_name("surveys")); + while ($datarow = $resultdata->FetchRow()){ + $toreplace=$datarow['additional_languages']; + $toreplace2=str_replace('no','nb',$toreplace); + if ($toreplace2!=$toreplace) {modify_database("","update `prefix_surveys` set `additional_languages`='$toreplace' where sid=".$datarow['sid']);echo $modifyoutput;flush();@ob_flush();} + } + + + modify_database("","ALTER TABLE `prefix_surveys` ADD `htmlemail` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `tokenanswerspersistence` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `usecaptcha` CHAR(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` ADD `htmleditormode` CHAR(7) default 'default'"); echo $modifyoutput; flush();@ob_flush(); + //122 + modify_database("","CREATE TABLE `prefix_templates_rights` ( + `uid` int(11) NOT NULL, + `folder` varchar(255) NOT NULL, + `use` int(1) NOT NULL, + PRIMARY KEY (`uid`,`folder`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE `prefix_templates` ( + `folder` varchar(255) NOT NULL, + `creator` int(11) NOT NULL, + PRIMARY KEY (`folder`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + //123 + modify_database("","ALTER TABLE `prefix_conditions` CHANGE `value` `value` VARCHAR(255) NOT NULL default ''"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_labels` CHANGE `title` `title` text"); echo $modifyoutput; flush();@ob_flush(); + //124 + modify_database("","ALTER TABLE `prefix_surveys` ADD `bounce_email` text"); echo $modifyoutput; flush();@ob_flush(); + //125 + upgrade_token_tables125(); + modify_database("","ALTER TABLE `prefix_users` ADD `superadmin` tinyint(1) NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_users` SET `superadmin`=1 where (create_survey=1 AND create_user=1 AND move_user=1 AND delete_user=1 AND configurator=1)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` DROP COLUMN `move_user`"); echo $modifyoutput; flush();@ob_flush(); + //126 + modify_database("","ALTER TABLE `prefix_questions` ADD `lid1` integer NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_conditions` SET `method`='==' where (`method` is null) or `method`='' or `method`='0'"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","update `prefix_settings_global` set `stg_value`='126' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 127) { + modify_database("","create index `assessments_idx2` on `prefix_assessments` (`sid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `assessments_idx3` on `prefix_assessments` (`gid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `conditions_idx2` on `prefix_conditions` (`qid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `groups_idx2` on `prefix_groups` (`sid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `questions_idx2` on `prefix_questions` (`sid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `questions_idx3` on `prefix_questions` (`gid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `question_attributes_idx2` on `prefix_question_attributes` (`qid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `quota_idx2` on `prefix_quota` (`sid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `saved_control_idx2` on `prefix_saved_control` (`sid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `user_in_groups_idx1` on `prefix_user_in_groups` (`ugid`, `uid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `answers_idx2` on `prefix_answers` (`sortorder`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `conditions_idx3` on `prefix_conditions` (`cqid`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","create index `questions_idx4` on `prefix_questions` (`type`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='127' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 128) { + //128 + upgrade_token_tables128(); + modify_database("","update `prefix_settings_global` set `stg_value`='128' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 129) { + //129 + modify_database("","ALTER TABLE `prefix_surveys` ADD `startdate` DATETIME"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `usestartdate` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='129' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 130) + { + modify_database("","ALTER TABLE `prefix_conditions` ADD `scenario` integer NOT NULL default '1' AFTER `qid`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_conditions` SET `scenario`=1 where (`scenario` is null) or `scenario`='' or `scenario`=0"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='130' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 131) + { + modify_database("","ALTER TABLE `prefix_surveys` ADD `publicstatistics` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='131' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 132) + { + modify_database("","ALTER TABLE `prefix_surveys` ADD `publicgraphs` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='132' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 133) + { + modify_database("","ALTER TABLE `prefix_users` ADD `one_time_pw` blob"); echo $modifyoutput; flush();@ob_flush(); + // Add new assessment setting + modify_database("","ALTER TABLE `prefix_surveys` ADD `assessments` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + // add new assessment value fields to answers & labels + modify_database("","ALTER TABLE `prefix_answers` ADD `assessment_value` int(11) NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_labels` ADD `assessment_value` int(11) NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + // copy any valid codes from code field to assessment field + modify_database("","update `prefix_answers` set `assessment_value`=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'");echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_labels` set `assessment_value`=CAST(`code` as SIGNED) where `code` REGEXP '^-?[0-9]+$'");echo $modifyoutput; flush();@ob_flush(); + // activate assessment where assessment rules exist + modify_database("","update `prefix_surveys` set `assessments`='Y' where `sid` in (SELECT `sid` FROM `prefix_assessments` group by `sid`)"); echo $modifyoutput; flush();@ob_flush(); + // add language field to assessment table + modify_database("","ALTER TABLE `prefix_assessments` ADD `language` varchar(20) NOT NULL default 'en'"); echo $modifyoutput; flush();@ob_flush(); + // update language field with default language of that particular survey + modify_database("","update `prefix_assessments` set `language`=(select `language` from `prefix_surveys` where `sid`=`prefix_assessments`.`sid`)"); echo $modifyoutput; flush();@ob_flush(); + // copy assessment link to message since from now on we will have HTML assignment messages + modify_database("","update `prefix_assessments` set `message`=concat(replace(`message`,'/''',''''),'
                ',`link`,'')"); echo $modifyoutput; flush();@ob_flush(); + // drop the old link field + modify_database("","ALTER TABLE `prefix_assessments` DROP COLUMN `link`"); echo $modifyoutput; flush();@ob_flush(); + // change the primary index to include language + modify_database("","ALTER TABLE `prefix_assessments` DROP PRIMARY KEY, ADD PRIMARY KEY USING BTREE(`id`, `language`)"); echo $modifyoutput; flush();@ob_flush(); + // Add new fields to survey language settings + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_url` varchar(255)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_endtext` text"); echo $modifyoutput; flush();@ob_flush(); + // copy old URL fields ot language specific entries + modify_database("","update `prefix_surveys_languagesettings` set `surveyls_url`=(select `url` from `prefix_surveys` where `sid`=`prefix_surveys_languagesettings`.`surveyls_survey_id`)"); echo $modifyoutput; flush();@ob_flush(); + // drop old URL field + modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `url`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 134) + { + // Add new tokens setting + modify_database("","ALTER TABLE `prefix_surveys` ADD `usetokens` varchar(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `attributedescriptions` TEXT;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `attribute1`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` DROP COLUMN `attribute2`"); echo $modifyoutput; flush();@ob_flush(); + upgrade_token_tables134(); + modify_database("","update `prefix_settings_global` set `stg_value`='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 135) + { + modify_database("","ALTER TABLE `prefix_question_attributes` MODIFY `value` text"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='135' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 136) //New Quota Functions + { + modify_database("","ALTER TABLE `prefix_quota` ADD `autoload_url` int(1) NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE `prefix_quota_languagesettings` ( + `quotals_id` int(11) NOT NULL auto_increment, + `quotals_quota_id` int(11) NOT NULL default '0', + `quotals_language` varchar(45) NOT NULL default 'en', + `quotals_name` varchar(255) collate utf8_unicode_ci default NULL, + `quotals_message` text NOT NULL, + `quotals_url` varchar(255), + `quotals_urldescrip` varchar(255), + PRIMARY KEY (`quotals_id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='136' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 137) //New Quota Functions + { + modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_dateformat` int(1) NOT NULL default '1'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_users` ADD `dateformat` int(1) NOT NULL default '1'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_surveys` set `startdate`=null where `usestartdate`='N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_surveys` set `expires`=null where `useexpiry`='N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `useexpiry`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `usestartdate`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='137' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 138) //Modify quota field + { + modify_database("", "ALTER TABLE `prefix_quota_members` CHANGE `code` `code` VARCHAR(11) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 139) //Modify quota field + { + upgrade_survey_tables139(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 140) //Modify surveys table + { + modify_database("", "ALTER TABLE `prefix_surveys` ADD `emailresponseto` text DEFAULT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 141) //Modify surveys table + { + modify_database("", "ALTER TABLE `prefix_surveys` ADD `tokenlength` tinyint(2) NOT NULL default '15'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 142) //Modify surveys table + { + upgrade_question_attributes142(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `expires` `expires` datetime"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `startdate` `startdate` datetime"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_question_attributes` SET `value`='0' WHERE `value`='false'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_question_attributes` SET `value`='1' WHERE `value`='true'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 143) //Modify surveys table + { + modify_database("", "ALTER TABLE `prefix_questions` ADD `parent_qid` integer NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_answers` ADD `scale_id` tinyint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_questions` ADD `scale_id` tinyint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_questions` ADD `same_default` tinyint NOT NULL default '0' COMMENT 'Saves if user set to use the same default value across languages in default options dialog'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_answers` DROP PRIMARY KEY, ADD PRIMARY KEY (`qid`,`code`,`language`,`scale_id`)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE `prefix_defaultvalues` ( + `qid` int(11) NOT NULL default '0', + `scale_id` int(11) NOT NULL default '0', + `sqid` int(11) NOT NULL default '0', + `language` varchar(20) NOT NULL, + `specialtype` varchar(20) NOT NULL default '', + `defaultvalue` text, + PRIMARY KEY (`qid` , `scale_id`, `language`, `specialtype`, `sqid` ) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + // -Move all 'answers' that are subquestions to the questions table + // -Move all 'labels' that are answers to the answers table + // -Transscribe the default values where applicable + // -Move default values from answers to questions + upgrade_tables143(); + + modify_database("", "ALTER TABLE `prefix_answers` DROP COLUMN `default_value`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_questions` DROP COLUMN `lid`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_questions` DROP COLUMN `lid1`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE prefix_sessions( + sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', + expiry DATETIME NOT NULL , + expireref VARCHAR( 250 ) DEFAULT '', + created DATETIME NOT NULL , + modified DATETIME NOT NULL , + sessdata LONGTEXT, + PRIMARY KEY ( sesskey ) , + INDEX sess2_expiry( expiry ), + INDEX sess2_expireref( expireref )) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + + + + + } + + if ($oldversion < 145) + { + modify_database("", "ALTER TABLE `prefix_surveys` ADD `savetimings` CHAR(1) NULL default 'N' AFTER `format`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `showxquestions` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `showgroupinfo` CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `shownoanswer` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `showqnumcode` CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bouncetime` BIGINT(20) NULL "); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceprocessing` VARCHAR(1) NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccounttype` VARCHAR(4) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccounthost` VARCHAR(200) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountpass` VARCHAR(100) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountencryption` VARCHAR(3) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `bounceaccountuser` VARCHAR(200) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `showwelcome` CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `showprogress` char(1) default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `allowjumps` char(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `navigationdelay` tinyint(2) default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `nokeyboard` char(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_surveys` ADD `alloweditaftercompletion` char(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE `prefix_survey_permissions` ( + `sid` int(10) unsigned NOT NULL, + `uid` int(10) unsigned NOT NULL, + `permission` varchar(20) NOT NULL, + `create_p` tinyint(1) NOT NULL default '0', + `read_p` tinyint(1) NOT NULL default '0', + `update_p` tinyint(1) NOT NULL default '0', + `delete_p` tinyint(1) NOT NULL default '0', + `import_p` tinyint(1) NOT NULL default '0', + `export_p` tinyint(1) NOT NULL default '0', + PRIMARY KEY (sid, uid, permission) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + upgrade_surveypermissions_table145(); + + // drop the old survey rights table + modify_database("", "DROP TABLE `prefix_surveys_rights`"); echo $modifyoutput; flush();@ob_flush(); + + // Add new fields for email templates + modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD + (`email_admin_notification_subj` VARCHAR(255) NULL, + `email_admin_notification` TEXT NULL, + `email_admin_responses_subj` VARCHAR(255) NULL, + `email_admin_responses` TEXT NULL)"); + + //Add index to questions table to speed up subquestions + modify_database("", "create INDEX parent_qid_idx on prefix_questions( parent_qid );"); echo $modifyoutput; flush();@ob_flush(); + + + modify_database("", "ALTER TABLE `prefix_surveys` ADD `emailnotificationto` text DEFAULT NULL AFTER `emailresponseto`"); echo $modifyoutput; flush();@ob_flush(); + upgrade_survey_table145(); + modify_database("", "ALTER TABLE `prefix_surveys` DROP COLUMN `notification`"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_conditions` CHANGE `method` `method` CHAR( 5 ) NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_surveys` set `private`='N' where `private` is NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `private` `anonymized` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();@ob_flush(); + + + //now we clean up things that were not properly set in previous DB upgrades + + modify_database("","UPDATE `prefix_answers` SET `answer`='' where `answer` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_answers` CHANGE `answer` `answer` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_answers` CHANGE `assessment_value` `assessment_value` int(11) NOT NULL default '0' AFTER `answer`;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_assessments` SET `scope`='' where `scope` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `scope` `scope` varchar(5) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_assessments` SET `name`='' where `name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `name` `name` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_assessments` SET `message`='' where `message` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `message` `message` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_assessments` SET `minimum`='' where `minimum` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `minimum` `minimum` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_assessments` SET `maximum`='' where `maximum` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `maximum` `maximum` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `id` `id` int(11) NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` DROP PRIMARY KEY;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` ADD PRIMARY KEY (`id`,`language`);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_assessments` CHANGE `id` `id` int(11) NOT NULL auto_increment;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_conditions` CHANGE `cfieldname` `cfieldname` varchar(50) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_defaultvalues` CHANGE `specialtype` `specialtype` varchar(20) collate utf8_unicode_ci NOT NULL default '' AFTER `qid`;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_groups` SET `group_name`='' where `group_name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_groups` CHANGE `group_name` `group_name` varchar(100) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_labels` SET `code`='' where `code` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_labels` CHANGE `code` `code` varchar(5) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_labels` CHANGE `language` `language` varchar(20) collate utf8_unicode_ci NOT NULL default 'en' AFTER `assessment_value`;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_labelsets` SET `label_name`='' WHERE `label_name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_labelsets` CHANGE `label_name` `label_name` varchar(100) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_questions` CHANGE `parent_qid` `parent_qid` int(11) NOT NULL default '0' AFTER `qid`;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_questions` SET `type`='T' where `type` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_questions` CHANGE `type` `type` char(1) collate utf8_unicode_ci NOT NULL default 'T';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_questions` SET `title`='' where `type` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_questions` CHANGE `title` `title` varchar(20) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_questions` SET `question`='' where `question` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_questions` CHANGE `question` `question` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_questions` SET `other`='N' where `other` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_questions` CHANGE `other` `other` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_questions` CHANGE `mandatory` `mandatory` char(1) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_question_attributes` CHANGE `attribute` `attribute` varchar(50) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_quota` CHANGE `qlimit` `qlimit` int(8) default NULL AFTER `name`;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_saved_control` SET `identifier`='' where `identifier` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `identifier` `identifier` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_saved_control` SET `access_code`='' where `access_code` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `access_code` `access_code` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `email` `email` varchar(320) collate utf8_unicode_ci default NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_saved_control` SET `ip`='' where `ip` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `ip` `ip` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_saved_control` SET `saved_thisstep`='' where `access_code` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `saved_thisstep` `saved_thisstep` text collate utf8_unicode_ci NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_saved_control` SET `status`='' where `access_code` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `status` `status` char(1) collate utf8_unicode_ci NOT NULL default '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_saved_control` SET `saved_date`='0000-00-00 00:00:00' where `saved_date` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_saved_control` CHANGE `saved_date` `saved_date` datetime NOT NULL;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_settings_global` SET `stg_value`='' where `stg_value` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_settings_global` CHANGE `stg_value` `stg_value` varchar(255) collate utf8_unicode_ci NOT NULL default ''"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `admin` `admin` varchar(50) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_surveys` SET `active`='N' where `active` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `active` `active` char(1) collate utf8_unicode_ci NOT NULL default 'N';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `startdate` `startdate` datetime default NULL AFTER `expires`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `adminemail` `adminemail` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `anonymized` `anonymized` char(1) collate utf8_unicode_ci NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `faxto` `faxto` varchar(20) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `format` `format` char(1) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `language` `language` varchar(50) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `additional_languages` `additional_languages` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `printanswers` `printanswers` char(1) collate utf8_unicode_ci default 'N' AFTER `allowprev`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `publicstatistics` `publicstatistics` char(1) collate utf8_unicode_ci default 'N' after `datecreated`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `publicgraphs` `publicgraphs` char(1) collate utf8_unicode_ci default 'N' AFTER `publicstatistics`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `assessments` `assessments` char(1) collate utf8_unicode_ci default 'N' AFTER `tokenanswerspersistence`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `usetokens` `usetokens` char(1) collate utf8_unicode_ci default 'N' AFTER `usecaptcha`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `bounce_email` `bounce_email` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `tokenlength` `tokenlength` tinyint(2) default '15'"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_surveys_languagesettings` SET `surveyls_title`='' where `surveyls_title` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_title` `surveyls_title` varchar(200) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_endtext` `surveyls_endtext` text collate utf8_unicode_ci AFTER `surveyls_welcometext`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_url` `surveyls_url` varchar(255) collate utf8_unicode_ci default NULL AFTER `surveyls_endtext`"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_urldescription` `surveyls_urldescription` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_invite_subj` `surveyls_email_invite_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_remind_subj` `surveyls_email_remind_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_register_subj` `surveyls_email_register_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_email_confirm_subj` `surveyls_email_confirm_subj` varchar(255) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys_languagesettings` CHANGE `surveyls_dateformat` `surveyls_dateformat` int(10) unsigned NOT NULL default '1'"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_users` SET `users_name`='' where `users_name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `users_name` `users_name` varchar(64) collate utf8_unicode_ci NOT NULL default ''"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE `prefix_users` SET `full_name`='' where `full_name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `full_name` `full_name` varchar(50) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `lang` `lang` varchar(20) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `email` `email` varchar(320) collate utf8_unicode_ci default NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `superadmin` `superadmin` tinyint(1) NOT NULL default '0' AFTER `delete_user`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `htmleditormode` `htmleditormode` varchar(7) collate utf8_unicode_ci default 'default'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` CHANGE `dateformat` `dateformat` int(10) unsigned NOT NULL default '1'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_users` DROP INDEX `email`;"); + + modify_database("","UPDATE `prefix_user_groups` SET `name`='' where `name` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_user_groups` CHANGE `name` `name` varchar(20) collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE `prefix_user_groups` SET `description`='' where `description` is null;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_user_groups` CHANGE `description` `description` text collate utf8_unicode_ci NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE `prefix_user_in_groups` DROP INDEX `user_in_groups_idx1`"); // Don't show output because this key might not exist + modify_database("","ALTER TABLE `prefix_user_in_groups` ADD PRIMARY KEY (`ugid`, `uid`)"); // Don't show output because this might already be set + modify_database("", "ALTER TABLE `prefix_surveys_languagesettings` ADD `surveyls_numberformat` int(11) NOT NULL DEFAULT 0 AFTER `surveyls_dateformat`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE `prefix_failed_login_attempts` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `ip` varchar(37) NOT NULL, + `last_attempt` varchar(20) NOT NULL, + `number_attempts` int(11) NOT NULL, + PRIMARY KEY (`id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + upgrade_token_tables145(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 146) //Modify surveys table + { + upgrade_timing_tables146(); + // Fix permissions for new feature quick-translation + modify_database("", "INSERT into prefix_survey_permissions (sid,`uid`,permission,`read_p`,`update_p`) SELECT sid,owner_id,'translations','1','1' from prefix_surveys"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 147) + { + modify_database("", "ALTER TABLE `prefix_users` ADD `templateeditormode` VARCHAR( 7 )NOT NULL DEFAULT 'default' AFTER `htmleditormode`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE `prefix_users` ADD `questionselectormode` VARCHAR( 7 )NOT NULL DEFAULT 'default' AFTER `templateeditormode`"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='147' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 148) + { + modify_database("","ALTER TABLE `prefix_users` ADD `participant_panel` tinyint(1) NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE `prefix_participants` (`participant_id` varchar(50) NOT NULL, + `firstname` varchar(40) default NULL, + `lastname` varchar(40) default NULL, + `email` varchar(80) collate utf8_unicode_ci default NULL, + `language` varchar(40) default NULL, + `blacklisted` varchar(1) NOT NULL, + `owner_uid` int(20) NOT NULL , + PRIMARY KEY (`participant_id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE `prefix_participant_attribute` ( + `participant_id` varchar(50) NOT NULL, + `attribute_id` int(11) NOT NULL, + `value` varchar(50) NOT NULL, + PRIMARY KEY (`participant_id`,`attribute_id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + + modify_database("","CREATE TABLE `prefix_participant_attribute_names` ( + `attribute_id` int(11) NOT NULL AUTO_INCREMENT, + `attribute_type` varchar(4) NOT NULL, + `visible` char(5) NOT NULL, + PRIMARY KEY (`attribute_id`,`attribute_type`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE `prefix_participant_attribute_names_lang` ( + `attribute_id` int(11) NOT NULL, + `attribute_name` varchar(30) NOT NULL, + `lang` varchar(20) NOT NULL, + PRIMARY KEY (`attribute_id`,`lang`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE `prefix_participant_attribute_values` ( + `attribute_id` int(11) NOT NULL, + `value_id` int(11) NOT NULL AUTO_INCREMENT, + `value` varchar(20) NOT NULL, + PRIMARY KEY (`value_id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE `prefix_participant_shares` ( + `participant_id` varchar(50) NOT NULL, + `share_uid` int(11) NOT NULL, + `date_added` datetime NOT NULL, + `can_edit` varchar(5) NOT NULL, + PRIMARY KEY (`participant_id`,`share_uid`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE `prefix_survey_links` ( + `participant_id` varchar(50) NOT NULL, + `token_id` int(11) NOT NULL, + `survey_id` int(11) NOT NULL, + `date_created` datetime NOT NULL, + PRIMARY KEY (`participant_id`,`token_id`,`survey_id`) + ) CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + + // add language field to question_attributes table + modify_database("","ALTER TABLE `prefix_question_attributes` ADD `language` varchar(20)"); echo $modifyoutput; flush();@ob_flush(); + upgrade_question_attributes148(); + fixSubquestions(); + modify_database("", "UPDATE `prefix_settings_global` SET `stg_value`='148' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 150) + { + modify_database("","ALTER TABLE `prefix_questions` ADD `relevance` TEXT;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='150' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 151) + { + modify_database("","ALTER TABLE `prefix_groups` ADD `randomization_group` VARCHAR(20) NOT NULL DEFAULT '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='151' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 152) + { + modify_database("","CREATE INDEX `question_attributes_idx3` ON `prefix_question_attributes` (`attribute`);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='152' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 153) + { + modify_database("","CREATE TABLE `prefix_expression_errors` ( + `id` int(9) NOT NULL AUTO_INCREMENT, + `errortime` varchar(50) DEFAULT NULL, + `sid` int(11) DEFAULT NULL, + `gid` int(11) DEFAULT NULL, + `qid` int(11) DEFAULT NULL, + `gseq` int(11) DEFAULT NULL, + `qseq` int(11) DEFAULT NULL, + `type` varchar(50) , + `eqn` text, + `prettyprint` text, + PRIMARY KEY (`id`) + ) ENGINE=MYISAM CHARACTER SET utf8 COLLATE utf8_unicode_ci;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='153' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 154) + { + modify_database("","ALTER TABLE `prefix_groups` ADD `grelevance` text DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update `prefix_settings_global` set `stg_value`='154' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 155) + { + modify_database("","ALTER TABLE `prefix_surveys` ADD `googleanalyticsstyle` char(1) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` ADD `googleanalyticsapikey` varchar(25) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE `prefix_surveys` CHANGE `showXquestions` `showxquestions` char(1) collate utf8_unicode_ci NOT NULL default 'Y';"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("", "UPDATE `prefix_settings_global` SET stg_value='155' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + if ($oldversion < 155.6) + { + LimeExpressionManager::UpgradeConditionsToRelevance(); + modify_database("", "UPDATE `prefix_settings_global` SET stg_value='155.6' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); + } + fixLanguageConsistencyAllSurveys(); + echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; + return true; +} + + +function upgrade_survey_tables117() +{ + global $modifyoutput; + $surveyidquery = "SELECT sid FROM ".db_table_name('surveys')." WHERE active='Y' and datestamp='Y'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".db_table_name('survey_'.$sv[0])." ADD `startdate` datetime AFTER `datestamp`"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +function upgrade_survey_tables118() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." CHANGE `token` `token` VARCHAR(15)"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +function upgrade_token_tables125() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD `emailstatus` varchar(300) NOT NULL DEFAULT 'OK'"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +// Add the reminders tracking fields +function upgrade_token_tables128() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD `remindersent` VARCHAR(17) DEFAULT 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ".$sv[0]." ADD `remindercount` INT(11) DEFAULT 0"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + + + + +function fixLanguageConsistencyAllSurveys() +{ + $surveyidquery = "SELECT sid,additional_languages FROM ".db_table_name('surveys'); + $surveyidresult = db_execute_num($surveyidquery); + while ( $sv = $surveyidresult->FetchRow() ) + { + FixLanguageConsistency($sv[0]); + } +} + + +// Add the reminders tracking fields +function upgrade_token_tables134() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD `validfrom` Datetime"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ".$sv[0]." ADD `validuntil` Datetime"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +// Add the usesleft field to all existing token tables +function upgrade_token_tables145() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = "SHOW TABLES LIKE '".$dbprefix."tokens%'"; + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ($sv = $surveyidresult->FetchRow()) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD `usesleft` int(11) NOT NULL default '1'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE ".$sv[0]." SET `usesleft`='0' WHERE completed<>'N'"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + + +function fix_mysql_collation() +{ + global $connect, $modifyoutput, $dbprefix; + $sql = 'SHOW TABLE STATUS'; + $result = db_execute_assoc($sql); + if (!$result) { + $modifyoutput .= 'SHOW TABLE - SQL Error'; + } + + while ( $tables = $result->FetchRow() ) { + // Loop through all tables in this database + $table = $tables['Name']; + $tablecollation=$tables['Collation']; + if (strpos($table,'old_')===false && ($dbprefix=='' || ($dbprefix!='' && strpos($table,$dbprefix)!==false))) + { + if ($tablecollation!='utf8_unicode_ci') + { + modify_database("","ALTER TABLE $table COLLATE utf8_unicode_ci"); + echo $modifyoutput; flush();@ob_flush(); + } + + # Now loop through all the fields within this table + $result2 = db_execute_assoc("SHOW FULL COLUMNS FROM ".$table); + while ( $column = $result2->FetchRow()) + { + if ($column['Collation']!= 'utf8_unicode_ci' ) + { + $field_name = $column['Field']; + $field_type = $column['Type']; + $field_default = $column['Default']; + if ($field_default!='NULL') {$field_default="'".$field_default."'";} + # Change text based fields + $skipped_field_types = array('char', 'text', 'enum', 'set'); + + foreach ( $skipped_field_types as $type ) + { + if ( strpos($field_type, $type) !== false ) + { + $modstatement="ALTER TABLE $table CHANGE `$field_name` `$field_name` $field_type CHARACTER SET utf8 COLLATE utf8_unicode_ci"; + if ($type!='text') {$modstatement.=" DEFAULT $field_default";} + modify_database("",$modstatement); + echo $modifyoutput; flush();@ob_flush(); + } + } + } + } + } + } +} + + +function upgrade_survey_tables139() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + if (strpos($sv[0],$dbprefix."survey_")!==false) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD `lastpage` integer"); echo $modifyoutput; flush();@ob_flush(); + } + } + } +} + +function upgrade_question_attributes142() +{ + global $modifyoutput,$dbprefix, $connect; + $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; + $questionids = db_select_column($attributequery); + foreach ($questionids as $questionid) + { + //Select all affected question attributes + $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); + modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();@ob_flush(); + $record['value']=implode(';',$attributevalues); + $record['attribute']='exclude_all_other'; + $record['qid']=$questionid; + $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); + } +} + +function upgrade_tables143() +{ + global $modifyoutput,$dbprefix, $connect; + + + $aQIDReplacements=array(); + $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();@ob_flush(); + } + } + + // Convert answers to subquestions + + $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$row['code']; + $insertarray['question']=$row['answer']; + $insertarray['question_order']=$row['sortorder']; + $insertarray['language']=$row['language']; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();@ob_flush(); + if (!isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + else + { + $iSaveSQID=$insertarray['qid']; + } + if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();@ob_flush(); + } + } + } + // Sanitize data + modify_database("","delete {$dbprefix}answers from {$dbprefix}answers LEFT join {$dbprefix}questions ON {$dbprefix}answers.qid={$dbprefix}questions.qid where {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();@ob_flush(); + + // Convert labels to answers + $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();@ob_flush(); + //$labelids[] + } + if ($row['type']=='1') + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();@ob_flush(); + } + } + } + } + + // Convert labels to subquestions + $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$lrow['code']; + $insertarray['question']=$lrow['title']; + $insertarray['question_order']=$lrow['sortorder']; + $insertarray['language']=$lrow['language']; + $insertarray['scale_id']=1; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();@ob_flush(); + if (isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); + } + } + } + } + + + + $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; + modify_database("",$updatequery); echo $modifyoutput; flush();@ob_flush(); + $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; + modify_database("",$updatequery); echo $modifyoutput; flush();@ob_flush(); + + // Now move all non-standard templates to the /upload dir + global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; + + if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} + if ($handle = opendir($standardtemplaterootdir)) + { + while (false !== ($file = readdir($handle))) + { + if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) + { + if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) + { + echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; + }; + } + } + closedir($handle); + } + +} + +function upgrade_timing_tables146() +{ + global $modifyoutput,$dbprefix, $connect; + $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); + foreach ($aTimingTables as $sTable) { + modify_database("","ALTER TABLE {$sTable} CHANGE `interviewTime` `interviewtime` DOUBLE NULL default 0;"); echo $modifyoutput; flush();@ob_flush(); + } +} diff --git a/include/limesurvey/admin/update/upgrade-postgres.php b/include/limesurvey/admin/update/upgrade-postgres.php index 1491bfe7..9befdaf6 100644 --- a/include/limesurvey/admin/update/upgrade-postgres.php +++ b/include/limesurvey/admin/update/upgrade-postgres.php @@ -1,571 +1,687 @@ -'||link||''"); echo $modifyoutput; flush();ob_flush(); - // drop the old link field - modify_database("","ALTER TABLE prefix_assessments DROP COLUMN link"); echo $modifyoutput; flush();ob_flush(); - // change the primary index to include language - modify_database("","ALTER TABLE prefix_assessments DROP CONSTRAINT prefix_assessments_pkey"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_assessments ADD CONSTRAINT prefix_assessments_pkey PRIMARY KEY (id,language)"); echo $modifyoutput; flush();ob_flush(); - // and fix missing translations for assessments - upgrade_survey_tables133(); - - // Add new fields to survey language settings - modify_database("","ALTER TABLE prefix_surveys_languagesettings ADD surveyls_url character varying(255)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys_languagesettings ADD surveyls_endtext text"); echo $modifyoutput; flush();ob_flush(); - - // copy old URL fields ot language specific entries - modify_database("","update prefix_surveys_languagesettings set surveyls_url=(select url from prefix_surveys where sid=prefix_surveys_languagesettings.surveyls_survey_id)"); echo $modifyoutput; flush();ob_flush(); - // drop old URL field - modify_database("","ALTER TABLE prefix_surveys DROP COLUMN url"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","update prefix_settings_global set stg_value='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 134) - { - modify_database("","ALTER TABLE prefix_surveys ADD usetokens char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys ADD attributedescriptions TEXT;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys DROP COLUMN attribute1"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys DROP COLUMN attribute2"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables134(); - modify_database("","update prefix_settings_global set stg_value='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - } - if ($oldversion < 135) - { - modify_database("","ALTER TABLE prefix_question_attributes ALTER COLUMN value TYPE text"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update prefix_settings_global set stg_value='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 136) - { - modify_database("","ALTER TABLE prefix_quota ADD autoload_url integer NOT NULL DEFAULT 0"); echo $modifyoutput; flush();ob_flush(); - modify_database("","CREATE TABLE prefix_quota_languagesettings ( - quotals_id serial NOT NULL, - quotals_quota_id integer NOT NULL DEFAULT 0, - quotals_language character varying(45) NOT NULL DEFAULT 'en'::character varying, - quotals_name character varying(200), - quotals_message text NOT NULL, - quotals_url character varying(255), - quotals_urldescrip character varying(255));"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ONLY prefix_quota_languagesettings - ADD CONSTRAINT prefix_quota_languagesettings_pkey PRIMARY KEY (quotals_id);"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ONLY prefix_users ADD CONSTRAINT prefix_users_pkey PRIMARY KEY (uid)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ONLY prefix_users ADD CONSTRAINT prefix_user_name_key UNIQUE (users_name)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","update prefix_settings_global set stg_value='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - } - - if ($oldversion < 137) //New date format specs - { - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD surveyls_dateformat integer NOT NULL default 1"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_users ADD \"dateformat\" integer NOT NULL default 1"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update prefix_surveys set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update prefix_surveys set expires=null where useexpiry='N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN usestartdate"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN useexpiry"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "update prefix_settings_global set stg_value='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 138) //Modify quota field - { - modify_database("", "ALTER TABLE prefix_quota_members ALTER COLUMN code TYPE character varying(11)"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 139) //Modify quota field - { - upgrade_survey_tables139(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 140) //Modify surveys table - { - modify_database("", "ALTER TABLE prefix_surveys ADD \"emailresponseto\" TEXT"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 141) //Modify surveys table - { - modify_database("", "ALTER TABLE prefix_surveys ADD \"tokenlength\" smallint NOT NULL DEFAULT '15'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 142) //Modify surveys table - { - upgrade_question_attributes142(); - modify_database("", "ALTER TABLE prefix_surveys ALTER COLUMN \"startdate\" TYPE timestamp"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ALTER COLUMN \"expires\" TYPE timestamp"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_question_attributes SET value='0' WHERE value='false'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_question_attributes SET value='1' WHERE value='true'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - if ($oldversion < 143) //Modify surveys table - { - modify_database("", "ALTER TABLE prefix_questions ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_answers ADD scale_id smallint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_questions ADD scale_id smallint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_questions ADD same_default smallint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_answers DROP CONSTRAINT prefix_answers_pkey"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_answers ADD CONSTRAINT prefix_answers_pkey PRIMARY KEY (qid,code,language,scale_id)"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "CREATE TABLE prefix_defaultvalues ( - qid integer NOT NULL default '0', - scale_id integer NOT NULL default '0', - sqid integer NOT NULL default '0', - language character varying(20) NOT NULL, - specialtype character varying(20) NOT NULL default '', - defaultvalue text)"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_defaultvalues ADD CONSTRAINT prefix_defaultvalues_pkey PRIMARY KEY (qid , scale_id, language, specialtype, sqid)"); echo $modifyoutput; flush();ob_flush(); - - // -Move all 'answers' that are subquestions to the questions table - // -Move all 'labels' that are answers to the answers table - // -Transscribe the default values where applicable - // -Move default values from answers to questions - upgrade_tables143(); - - modify_database("", "ALTER TABLE prefix_answers DROP COLUMN default_value"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_questions DROP COLUMN lid"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_questions DROP COLUMN lid1"); echo $modifyoutput; flush();ob_flush(); - // add field for timings and table for extended conditions - modify_database("", "ALTER TABLE prefix_surveys ADD savetimings char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_sessions( - sesskey VARCHAR( 64 ) NOT NULL DEFAULT '', - expiry TIMESTAMP NOT NULL , - expireref VARCHAR( 250 ) DEFAULT '', - created TIMESTAMP NOT NULL , - modified TIMESTAMP NOT NULL , - sessdata TEXT DEFAULT '', - PRIMARY KEY ( sesskey ) - );"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "create INDEX sess2_expiry on prefix_sessions( expiry );"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "create INDEX sess2_expireref on prefix_sessions ( expireref );"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "UPDATE prefix_settings_global SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - - - - } - if ($oldversion < 145) - { - modify_database("", "ALTER TABLE prefix_surveys ADD savetimings CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD showXquestions CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD showgroupinfo CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD shownoanswer CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bouncetime bigint NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceprocessing character varying(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccounttype character varying(4) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccounthost character varying(200) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountpass character varying(100) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountencryption character varying(3) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountuser character varying(200) NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD showwelcome CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD navigationdelay smallint NOT NULL default '0'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD nokeyboard char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys ADD alloweditaftercompletion char(1) default 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_survey_permissions ( - sid integer DEFAULT 0 NOT NULL, - uid integer DEFAULT 0 NOT NULL, - permission character varying(20) NOT NULL, - create_p integer DEFAULT 0 NOT NULL, - read_p integer DEFAULT 0 NOT NULL, - update_p integer DEFAULT 0 NOT NULL, - delete_p integer DEFAULT 0 NOT NULL, - import_p integer DEFAULT 0 NOT NULL, - export_p integer DEFAULT 0 NOT NULL - );"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE ONLY prefix_survey_permissions ADD CONSTRAINT prefix_survey_permissions_pkey PRIMARY KEY (sid,uid,permission);"); echo $modifyoutput; flush();ob_flush(); - upgrade_surveypermissions_table145(); - - // drop the old survey rights table - modify_database("", "DROP TABLE prefix_surveys_rights"); echo $modifyoutput; flush();ob_flush(); - - // Add new fields for email templates - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_notification_subj character varying(255)"); - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_responses_subj character varying(255)"); - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_notification text"); - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_responses text"); - - //Add index to questions table to speed up subquestions - modify_database("", "create INDEX parent_qid_idx on prefix_questions( parent_qid );"); echo $modifyoutput; flush();ob_flush(); - - modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto text DEFAULT NULL"); echo $modifyoutput; flush();ob_flush(); - upgrade_survey_table145(); - modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN notification"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","ALTER TABLE prefix_conditions ALTER COLUMN method TYPE CHAR(5)"); echo $modifyoutput; flush();ob_flush(); - - modify_database("","UPDATE prefix_surveys set private='N' where private is NULL;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys RENAME COLUMN private TO anonymized;"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized TYPE char(1);"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized SET DEFAULT 'N';"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized SET NOT NULL ;"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "CREATE TABLE prefix_failed_login_attempts ( - id serial PRIMARY KEY NOT NULL, - ip character varying(37) NOT NULL, - last_attempt character varying(20) NOT NULL, - number_attempts integer NOT NULL - );"); echo $modifyoutput; flush();ob_flush(); - modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD surveyls_numberformat integer default 0 NOT NULL"); echo $modifyoutput; flush();ob_flush(); - upgrade_token_tables145(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - if ($oldversion < 146) //Modify surveys table - { - upgrade_timing_tables146(); - modify_database("", "UPDATE prefix_settings_global SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();ob_flush(); - } - - - echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; - return true; -} - -function upgrade_token_tables128() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."tokens%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv['0']." ADD remindersent character varying(17) DEFAULT 'N'"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv['0']." ADD remindercount INTEGER DEFAULT 0"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_survey_tables133() -{ - global $modifyoutput; - - $surveyidquery = "SELECT sid, additional_languages FROM ".db_table_name('surveys'); - $surveyidresult = db_execute_num($surveyidquery); - while ( $sv = $surveyidresult->FetchRow() ) - { - FixLanguageConsistency($sv['0'],$sv['1']); - } -} - -function upgrade_token_tables134() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."tokens%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD validfrom timestamp"); echo $modifyoutput; flush();ob_flush(); - modify_database("","ALTER TABLE ".$sv[0]." ADD validuntil timestamp"); echo $modifyoutput; flush();ob_flush(); - } - } -} -// Add the usesleft field to all existing token tables -function upgrade_token_tables145() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."tokens%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD usesleft integer DEFAULT 1 NOT NULL"); echo $modifyoutput; flush();ob_flush(); - modify_database("","UPDATE ".$sv[0]." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_survey_tables139() -{ - global $modifyoutput,$dbprefix; - $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); - $surveyidresult = db_execute_num($surveyidquery); - if (!$surveyidresult) {return "Database Error";} - else - { - while ( $sv = $surveyidresult->FetchRow() ) - { - modify_database("","ALTER TABLE ".$sv[0]." ADD lastpage integer"); echo $modifyoutput; flush();ob_flush(); - } - } -} - -function upgrade_question_attributes142() -{ - global $modifyoutput,$dbprefix, $connect; - $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; - $questionids = db_select_column($attributequery); - foreach ($questionids as $questionid) - { - //Select all affected question attributes - $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); - modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();ob_flush(); - $record['value']=implode(';',$attributevalues); - $record['attribute']='exclude_all_other'; - $record['qid']=$questionid; - $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); - } -} - -function upgrade_tables143() -{ - global $modifyoutput,$dbprefix, $connect; - - - $aQIDReplacements=array(); - $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();ob_flush(); - } - } - - // Convert answers to subquestions - - $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) {return "Database Error";} - else - { - while ( $row = $answerresult->FetchRow() ) - { - - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - $insertarray['sid']=$row['sid']; - $insertarray['gid']=$row['gid']; - $insertarray['type']=$row['type']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['title']=$row['code']; - $insertarray['question']=$row['answer']; - $insertarray['question_order']=$row['sortorder']; - $insertarray['language']=$row['language']; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (!isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); - $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; - } - else - { - $iSaveSQID=$insertarray['qid']; - } - if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') - { - modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();ob_flush(); - } - } - } - modify_database("","delete from {$dbprefix}answers using {$dbprefix}questions where {$dbprefix}answers.qid={$dbprefix}questions.qid and {$dbprefix}questions.type in ('1','A','B','C','E','F','H',';',':')"); echo $modifyoutput; flush();ob_flush(); - - // Convert labels to answers - $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - //$labelids[] - } - if ($row['type']=='1') - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();ob_flush(); - } - } - } - } - - // Convert labels to subquestions - $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; - $answerresult = db_execute_assoc($answerquery); - if (!$answerresult) - { - return "Database Error"; - } - else - { - while ( $row = $answerresult->FetchRow() ) - { - $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); - $labelresult = db_execute_assoc($labelquery); - while ( $lrow = $labelresult->FetchRow() ) - { - $insertarray=array(); - if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) - { - $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; - } - $insertarray['sid']=$row['sid']; - $insertarray['type']=$row['type']; - $insertarray['gid']=$row['gid']; - $insertarray['parent_qid']=$row['qid']; - $insertarray['title']=$lrow['code']; - $insertarray['question']=$lrow['title']; - $insertarray['question_order']=$lrow['sortorder']; - $insertarray['language']=$lrow['language']; - $insertarray['scale_id']=1; - $tablename="{$dbprefix}questions"; - $query=$connect->GetInsertSQL($tablename,$insertarray); - modify_database("",$query); echo $modifyoutput; flush();ob_flush(); - if (isset($insertarray['qid'])) - { - $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); - } - } - } - } - - - - - $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; - modify_database("",$updatequery); echo $modifyoutput; flush();ob_flush(); - - // Now move all non-standard templates to the /upload dir - global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; - - if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} - if ($handle = opendir($standardtemplaterootdir)) - { - while (false !== ($file = readdir($handle))) - { - if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) - { - if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) - { - echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; - }; - } - } - closedir($handle); - } - -} - -function upgrade_timing_tables146() -{ - global $modifyoutput,$dbprefix, $connect; - $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); - foreach ($aTimingTables as $sTable) { - modify_database("","ALTER TABLE {$sTable} RENAME COLUMN \"interviewTime\" TO interviewtime;"); echo $modifyoutput; flush();ob_flush(); - } -} +'||link||''"); echo $modifyoutput; flush();@ob_flush(); + // drop the old link field + modify_database("","ALTER TABLE prefix_assessments DROP COLUMN link"); echo $modifyoutput; flush();@ob_flush(); + // change the primary index to include language + modify_database("","ALTER TABLE prefix_assessments DROP CONSTRAINT prefix_assessments_pkey"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_assessments ADD CONSTRAINT prefix_assessments_pkey PRIMARY KEY (id,language)"); echo $modifyoutput; flush();@ob_flush(); + + // Add new fields to survey language settings + modify_database("","ALTER TABLE prefix_surveys_languagesettings ADD surveyls_url character varying(255)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys_languagesettings ADD surveyls_endtext text"); echo $modifyoutput; flush();@ob_flush(); + + // copy old URL fields ot language specific entries + modify_database("","update prefix_surveys_languagesettings set surveyls_url=(select url from prefix_surveys where sid=prefix_surveys_languagesettings.surveyls_survey_id)"); echo $modifyoutput; flush();@ob_flush(); + // drop old URL field + modify_database("","ALTER TABLE prefix_surveys DROP COLUMN url"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","update prefix_settings_global set stg_value='133' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 134) + { + modify_database("","ALTER TABLE prefix_surveys ADD usetokens char(1) NOT NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys ADD attributedescriptions TEXT;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys DROP COLUMN attribute1"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys DROP COLUMN attribute2"); echo $modifyoutput; flush();@ob_flush(); + upgrade_token_tables134(); + modify_database("","update prefix_settings_global set stg_value='134' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + } + if ($oldversion < 135) + { + modify_database("","ALTER TABLE prefix_question_attributes ALTER COLUMN value TYPE text"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update prefix_settings_global set stg_value='135' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 136) + { + modify_database("","ALTER TABLE prefix_quota ADD autoload_url integer NOT NULL DEFAULT 0"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE prefix_quota_languagesettings ( + quotals_id serial NOT NULL, + quotals_quota_id integer NOT NULL DEFAULT 0, + quotals_language character varying(45) NOT NULL DEFAULT 'en'::character varying, + quotals_name character varying(200), + quotals_message text NOT NULL, + quotals_url character varying(255), + quotals_urldescrip character varying(255));"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ONLY prefix_quota_languagesettings + ADD CONSTRAINT prefix_quota_languagesettings_pkey PRIMARY KEY (quotals_id);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ONLY prefix_users ADD CONSTRAINT prefix_users_pkey PRIMARY KEY (uid)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ONLY prefix_users ADD CONSTRAINT prefix_user_name_key UNIQUE (users_name)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","update prefix_settings_global set stg_value='136' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + } + + if ($oldversion < 137) //New date format specs + { + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD surveyls_dateformat integer NOT NULL default 1"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_users ADD \"dateformat\" integer NOT NULL default 1"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "update prefix_surveys set startdate=null where usestartdate='N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "update prefix_surveys set expires=null where useexpiry='N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN usestartdate"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN useexpiry"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "update prefix_settings_global set stg_value='137' where stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 138) //Modify quota field + { + modify_database("", "ALTER TABLE prefix_quota_members ALTER COLUMN code TYPE character varying(11)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='138' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 139) //Modify quota field + { + upgrade_survey_tables139(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='139' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 140) //Modify surveys table + { + modify_database("", "ALTER TABLE prefix_surveys ADD \"emailresponseto\" TEXT"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='140' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 141) //Modify surveys table + { + modify_database("", "ALTER TABLE prefix_surveys ADD \"tokenlength\" smallint NOT NULL DEFAULT '15'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='141' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 142) //Modify surveys table + { + upgrade_question_attributes142(); + modify_database("", "ALTER TABLE prefix_surveys ALTER COLUMN \"startdate\" TYPE timestamp"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ALTER COLUMN \"expires\" TYPE timestamp"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_question_attributes SET value='0' WHERE value='false'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_question_attributes SET value='1' WHERE value='true'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='142' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 143) //Modify surveys table + { + modify_database("", "ALTER TABLE prefix_questions ADD parent_qid integer NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_answers ADD scale_id smallint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_questions ADD scale_id smallint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_questions ADD same_default smallint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_answers DROP CONSTRAINT prefix_answers_pkey"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_answers ADD CONSTRAINT prefix_answers_pkey PRIMARY KEY (qid,code,language,scale_id)"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("", "CREATE TABLE prefix_defaultvalues ( + qid integer NOT NULL default '0', + scale_id integer NOT NULL default '0', + sqid integer NOT NULL default '0', + language character varying(20) NOT NULL, + specialtype character varying(20) NOT NULL default '', + defaultvalue text)"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_defaultvalues ADD CONSTRAINT prefix_defaultvalues_pkey PRIMARY KEY (qid , scale_id, language, specialtype, sqid)"); echo $modifyoutput; flush();@ob_flush(); + + // -Move all 'answers' that are subquestions to the questions table + // -Move all 'labels' that are answers to the answers table + // -Transscribe the default values where applicable + // -Move default values from answers to questions + upgrade_tables143(); + + modify_database("", "ALTER TABLE prefix_answers DROP COLUMN default_value"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_questions DROP COLUMN lid"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_questions DROP COLUMN lid1"); echo $modifyoutput; flush();@ob_flush(); + // add field for timings and table for extended conditions + modify_database("", "CREATE TABLE prefix_sessions( + sesskey character varying( 64 ) NOT NULL DEFAULT '', + expiry TIMESTAMP NOT NULL , + expireref character varying( 250 ) DEFAULT '', + created TIMESTAMP NOT NULL , + modified TIMESTAMP NOT NULL , + sessdata TEXT DEFAULT '', + PRIMARY KEY ( sesskey ) + );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "create INDEX sess2_expiry on prefix_sessions( expiry );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "create INDEX sess2_expireref on prefix_sessions ( expireref );"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("", "UPDATE prefix_settings_global SET stg_value='143' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + + + } + if ($oldversion < 145) + { + modify_database("", "ALTER TABLE prefix_surveys ADD savetimings CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD \"showXquestions\" CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD showgroupinfo CHAR(1) NULL default 'B'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD shownoanswer CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD showqnumcode CHAR(1) NULL default 'X'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bouncetime bigint NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceprocessing character varying(1) NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccounttype character varying(4) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccounthost character varying(200) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountpass character varying(100) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountencryption character varying(3) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD bounceaccountuser character varying(200) NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD showwelcome CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD showprogress CHAR(1) NULL default 'Y'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD allowjumps CHAR(1) NULL default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD navigationdelay smallint NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD nokeyboard char(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys ADD alloweditaftercompletion char(1) default 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE prefix_survey_permissions ( + sid integer DEFAULT 0 NOT NULL, + uid integer DEFAULT 0 NOT NULL, + permission character varying(20) NOT NULL, + create_p integer DEFAULT 0 NOT NULL, + read_p integer DEFAULT 0 NOT NULL, + update_p integer DEFAULT 0 NOT NULL, + delete_p integer DEFAULT 0 NOT NULL, + import_p integer DEFAULT 0 NOT NULL, + export_p integer DEFAULT 0 NOT NULL + );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE ONLY prefix_survey_permissions ADD CONSTRAINT prefix_survey_permissions_pkey PRIMARY KEY (sid,uid,permission);"); echo $modifyoutput; flush();@ob_flush(); + upgrade_surveypermissions_table145(); + + // drop the old survey rights table + modify_database("", "DROP TABLE prefix_surveys_rights"); echo $modifyoutput; flush();@ob_flush(); + + // Add new fields for email templates + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_notification_subj character varying(255)"); + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_responses_subj character varying(255)"); + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_notification text"); + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD email_admin_responses text"); + + //Add index to questions table to speed up subquestions + modify_database("", "create INDEX parent_qid_idx on prefix_questions( parent_qid );"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("", "ALTER TABLE prefix_surveys ADD emailnotificationto text DEFAULT NULL"); echo $modifyoutput; flush();@ob_flush(); + upgrade_survey_table145(); + modify_database("", "ALTER TABLE prefix_surveys DROP COLUMN notification"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","ALTER TABLE prefix_conditions ALTER COLUMN method TYPE CHAR(5)"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","UPDATE prefix_surveys set private='N' where private is NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys RENAME COLUMN private TO anonymized;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized TYPE char(1);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized SET DEFAULT 'N';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys ALTER COLUMN anonymized SET NOT NULL ;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "CREATE TABLE prefix_failed_login_attempts ( + id serial PRIMARY KEY NOT NULL, + ip character varying(37) NOT NULL, + last_attempt character varying(20) NOT NULL, + number_attempts integer NOT NULL + );"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_surveys_languagesettings ADD surveyls_numberformat integer default 0 NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + upgrade_token_tables145(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='145' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 146) //Modify surveys table + { + upgrade_timing_tables146(); + modify_database("", "INSERT into prefix_survey_permissions (sid,uid,permission,read_p,update_p) SELECT sid,owner_id,'translations','1','1' from prefix_surveys"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='146' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + if ($oldversion < 147) + { + modify_database("", "ALTER TABLE prefix_users ADD templateeditormode character varying(7) NOT NULL DEFAULT 'default'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "ALTER TABLE prefix_users ADD questionselectormode character varying(7) NOT NULL DEFAULT 'default'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='147' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 148) + { + modify_database("","ALTER TABLE prefix_users ADD participant_panel integer NOT NULL default '0'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","CREATE TABLE prefix_participants ( + participant_id character varying( 50 ) NOT NULL, + firstname character varying( 40 ) NOT NULL, + lastname character varying( 40 ) NOT NULL, + email character varying( 80 ) NOT NULL, + language character varying( 2 ) NOT NULL, + blacklisted character varying( 1 ) NOT NULL, + owner_uid integer NOT NULL, + PRIMARY KEY (participant_id) + );"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE prefix_participant_attribute ( + participant_id character varying( 50 ) NOT NULL, + attribute_id integer NOT NULL, + value integer NOT NULL, + PRIMARY KEY (participant_id,attribute_id) + );"); echo $modifyoutput; flush();@ob_flush(); + + modify_database("",'CREATE TABLE prefix_participant_attribute_names ( + "attribute_id" serial NOT NULL, + "attribute_type" character varying( 30 ) NOT NULL, + "visible" character varying( 5 ) NOT NULL, + CONSTRAINT prefix_participant_attribute_names_pkey PRIMARY KEY (attribute_id, attribute_type) + );'); echo $modifyoutput; flush();@ob_flush(); + + modify_database("",'CREATE TABLE prefix_participant_attribute_names_lang ( + "id" serial PRIMARY KEY NOT NULL, + "attribute_id" integer NOT NULL, + "attribute_name" character varying( 30 ) NOT NULL, + "lang" character varying( 20 ) NOT NULL + );'); echo $modifyoutput; flush();@ob_flush(); + + modify_database("",'CREATE TABLE prefix_participant_attribute_values ( + "value_id" serial PRIMARY KEY NOT NULL, + "attribute_id" integer NOT NULL, + "value" character varying( 20 ) NOT NULL + );'); echo $modifyoutput; flush();@ob_flush(); + + modify_database("",'CREATE TABLE prefix_participant_shares ( + "participant_id" character varying( 50 ) NOT NULL, + "shared_uid" integer NOT NULL, + "date_added" date NOT NULL, + "can_edit" character varying( 5 ) NOT NULL, + CONSTRAINT prefix_participant_shares_pkey PRIMARY KEY (participant_id,shared_uid) + );'); echo $modifyoutput; flush();@ob_flush(); + + modify_database("","CREATE TABLE prefix_survey_links ( + participant_id character varying( 50 ) NOT NULL, + token_id integer NOT NULL, + survey_id integer NOT NULL, + date_created date NOT NULL, + PRIMARY KEY (participant_id,token_id,survey_id) + );"); echo $modifyoutput; flush();@ob_flush(); + + // add language field to question_attributes table + modify_database("","ALTER TABLE prefix_question_attributes ADD language character varying(20)"); echo $modifyoutput; flush();@ob_flush(); + upgrade_question_attributes148(); + fixSubquestions(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='148' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + + } + + if ($oldversion < 150) + { + modify_database("","ALTER TABLE prefix_questions ADD relevance TEXT;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='150' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 151) + { + modify_database("","ALTER TABLE prefix_groups ADD randomization_group character varying(20) NOT NULL DEFAULT '';"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='151' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 152) + { + modify_database("","CREATE INDEX question_attributes_idx3 ON prefix_question_attributes (attribute);"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='152' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 153) + { + modify_database("",'CREATE TABLE prefix_expression_errors ( + "id" serial PRIMARY KEY NOT NULL, + errortime character varying(50) DEFAULT NULL, + sid integer DEFAULT NULL, + gid integer DEFAULT NULL, + qid integer DEFAULT NULL, + gseq integer DEFAULT NULL, + qseq integer DEFAULT NULL, + "type" character varying(50) , + eqn text, + prettyprint text + );'); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='153' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 154) + { + modify_database("","ALTER TABLE prefix_groups ADD grelevance text DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("", "UPDATE prefix_settings_global SET stg_value='154' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 155) + { + modify_database("","ALTER TABLE prefix_surveys ADD googleanalyticsstyle char(1) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE prefix_surveys ADD googleanalyticsapikey character varying(25) DEFAULT NULL;"); echo $modifyoutput; flush();@ob_flush(); + modify_database("",'ALTER TABLE prefix_surveys RENAME COLUMN "showXquestions" TO "showxquestions";'); + modify_database("","UPDATE prefix_settings_global SET stg_value='155' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + if ($oldversion < 155.6) + { + LimeExpressionManager::UpgradeConditionsToRelevance(); + modify_database("","UPDATE prefix_settings_global SET stg_value='155.6' WHERE stg_name='DBVersion'"); echo $modifyoutput; flush();@ob_flush(); + } + + fixLanguageConsistencyAllSurveys(); + echo '

                '.sprintf($clang->gT('Database update finished (%s)'),date('Y-m-d H:i:s')).'
                '; + return true; +} + +function upgrade_token_tables128() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."tokens%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv['0']." ADD remindersent character varying(17) DEFAULT 'N'"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ".$sv['0']." ADD remindercount INTEGER DEFAULT 0"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +function fixLanguageConsistencyAllSurveys() +{ + + $surveyidquery = "SELECT sid, additional_languages FROM ".db_table_name('surveys'); + $surveyidresult = db_execute_num($surveyidquery); + while ( $sv = $surveyidresult->FetchRow() ) + { + FixLanguageConsistency($sv[0]); + } +} + +function upgrade_token_tables134() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."tokens%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD validfrom timestamp"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","ALTER TABLE ".$sv[0]." ADD validuntil timestamp"); echo $modifyoutput; flush();@ob_flush(); + } + } +} +// Add the usesleft field to all existing token tables +function upgrade_token_tables145() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."tokens%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD usesleft integer DEFAULT 1 NOT NULL"); echo $modifyoutput; flush();@ob_flush(); + modify_database("","UPDATE ".$sv[0]." SET usesleft=0 WHERE completed<>'N'"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +function upgrade_survey_tables139() +{ + global $modifyoutput,$dbprefix; + $surveyidquery = db_select_tables_like($dbprefix."survey\_%"); + $surveyidresult = db_execute_num($surveyidquery); + if (!$surveyidresult) {return "Database Error";} + else + { + while ( $sv = $surveyidresult->FetchRow() ) + { + modify_database("","ALTER TABLE ".$sv[0]." ADD lastpage integer"); echo $modifyoutput; flush();@ob_flush(); + } + } +} + +function upgrade_question_attributes142() +{ + global $modifyoutput,$dbprefix, $connect; + $attributequery="Select qid from {$dbprefix}question_attributes where attribute='exclude_all_other' group by qid having count(qid)>1 "; + $questionids = db_select_column($attributequery); + foreach ($questionids as $questionid) + { + //Select all affected question attributes + $attributevalues=db_select_column("SELECT value from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); + modify_database("","delete from {$dbprefix}question_attributes where attribute='exclude_all_other' and qid=".$questionid); echo $modifyoutput; flush();@ob_flush(); + $record['value']=implode(';',$attributevalues); + $record['attribute']='exclude_all_other'; + $record['qid']=$questionid; + $connect->AutoExecute("{$dbprefix}question_attributes", $record, 'INSERT'); + } +} + +function upgrade_tables143() +{ + global $modifyoutput,$dbprefix, $connect; + + + $aQIDReplacements=array(); + $answerquery = "select a.*, q.sid, q.gid from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and q.type in ('L','O','!') and a.default_value='Y'"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},0,".db_quoteall($row['language']).",'',".db_quoteall($row['code']).")"); echo $modifyoutput; flush();@ob_flush(); + } + } + + // Convert answers to subquestions + + $answerquery = "select a.*, q.sid, q.gid, q.type from {$dbprefix}answers a,{$dbprefix}questions q where a.qid=q.qid and a.language=q.language and q.type in ('1','A','B','C','E','F','H','K',';',':','M','P','Q')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) {return "Database Error";} + else + { + while ( $row = $answerresult->FetchRow() ) + { + + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$row['code']])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$row['code']; + $insertarray['question']=$row['answer']; + $insertarray['question_order']=$row['sortorder']; + $insertarray['language']=$row['language']; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();@ob_flush(); + if (!isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$row['code']]=$connect->Insert_ID("{$dbprefix}questions","qid"); + $iSaveSQID=$aQIDReplacements[$row['qid'].'_'.$row['code']]; + } + else + { + $iSaveSQID=$insertarray['qid']; + } + if (($row['type']=='M' || $row['type']=='P') && $row['default_value']=='Y') + { + modify_database("","INSERT INTO {$dbprefix}defaultvalues (qid, sqid, scale_id,language,specialtype,defaultvalue) VALUES ({$row['qid']},{$iSaveSQID},0,".db_quoteall($row['language']).",'','Y')"); echo $modifyoutput; flush();@ob_flush(); + } + } + } + modify_database("","delete from {$dbprefix}answers using {$dbprefix}questions where {$dbprefix}answers.qid={$dbprefix}questions.qid and {$dbprefix}questions.type in ('1','F','H','M','P','W','Z')"); echo $modifyoutput; flush();@ob_flush(); + + // Convert labels to answers + $answerquery = "select qid ,type ,lid ,lid1, language from {$dbprefix}questions where parent_qid=0 and type in ('1','F','H','M','P','W','Z')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",{$lrow['assessment_value']})"); echo $modifyoutput; flush();@ob_flush(); + //$labelids[] + } + if ($row['type']=='1') + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid1']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + modify_database("","INSERT INTO {$dbprefix}answers (qid, code, answer, sortorder, language, scale_id, assessment_value) VALUES ({$row['qid']},".db_quoteall($lrow['code']).",".db_quoteall($lrow['title']).",{$lrow['sortorder']},".db_quoteall($lrow['language']).",1,{$lrow['assessment_value']})"); echo $modifyoutput; flush();@ob_flush(); + } + } + } + } + + // Convert labels to subquestions + $answerquery = "select * from {$dbprefix}questions where parent_qid=0 and type in (';',':')"; + $answerresult = db_execute_assoc($answerquery); + if (!$answerresult) + { + return "Database Error"; + } + else + { + while ( $row = $answerresult->FetchRow() ) + { + $labelquery="Select * from {$dbprefix}labels where lid={$row['lid']} and language=".db_quoteall($row['language']); + $labelresult = db_execute_assoc($labelquery); + while ( $lrow = $labelresult->FetchRow() ) + { + $insertarray=array(); + if (isset($aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1'])) + { + $insertarray['qid']=$aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']; + } + $insertarray['sid']=$row['sid']; + $insertarray['gid']=$row['gid']; + $insertarray['parent_qid']=$row['qid']; + $insertarray['type']=$row['type']; + $insertarray['title']=$lrow['code']; + $insertarray['question']=$lrow['title']; + $insertarray['question_order']=$lrow['sortorder']; + $insertarray['language']=$lrow['language']; + $insertarray['scale_id']=1; + $tablename="{$dbprefix}questions"; + $query=$connect->GetInsertSQL($tablename,$insertarray); + modify_database("",$query); echo $modifyoutput; flush();@ob_flush(); + if (isset($insertarray['qid'])) + { + $aQIDReplacements[$row['qid'].'_'.$lrow['code'].'_1']=$connect->Insert_ID("{$dbprefix}questions","qid"); + } + } + } + } + + + + + $updatequery = "update {$dbprefix}questions set type='!' where type='W'"; + modify_database("",$updatequery); echo $modifyoutput; flush();@ob_flush(); + $updatequery = "update {$dbprefix}questions set type='L' where type='Z'"; + modify_database("",$updatequery); echo $modifyoutput; flush();@ob_flush(); + + // Now move all non-standard templates to the /upload dir + global $usertemplaterootdir, $standardtemplates,$standardtemplaterootdir; + + if (!$usertemplaterootdir) {die("gettemplatelist() no template directory");} + if ($handle = opendir($standardtemplaterootdir)) + { + while (false !== ($file = readdir($handle))) + { + if (!is_file("$standardtemplaterootdir/$file") && $file != "." && $file != ".." && $file!=".svn" && !isStandardTemplate($file)) + { + if (!rename($standardtemplaterootdir.DIRECTORY_SEPARATOR.$file,$usertemplaterootdir.DIRECTORY_SEPARATOR.$file)) + { + echo "There was a problem moving directory '".$standardtemplaterootdir.DIRECTORY_SEPARATOR.$file."' to '".$usertemplaterootdir.DIRECTORY_SEPARATOR.$file."' due to missing permissions. Please do this manually.
                "; + }; + } + } + closedir($handle); + } + +} + +function upgrade_timing_tables146() +{ + global $modifyoutput,$dbprefix, $connect; + $aTimingTables=$connect->MetaTables('TABLES',false, "%timings"); + foreach ($aTimingTables as $sTable) { + modify_database("","ALTER TABLE {$sTable} RENAME COLUMN \"interviewTime\" TO interviewtime;"); echo $modifyoutput; flush();@ob_flush(); + } +} diff --git a/include/limesurvey/admin/upgrade/cmd_install.php b/include/limesurvey/admin/upgrade/cmd_install.php deleted file mode 100644 index 2932d685..00000000 --- a/include/limesurvey/admin/upgrade/cmd_install.php +++ /dev/null @@ -1,187 +0,0 @@ - DEFAULT SET TO EN FOR NOW -require_once($rootdir.'/classes/core/language.php'); -$clang = new limesurvey_lang("en"); -ob_implicit_flush(true); - -if (isset($argv[1]) && $argv[1]=='install') -{ - print("trying to create and populate $databasename on $databaselocation:$databaseport ($databasetype) \n"); - - if (!$database_exists) //Database named in config.php does not exist - { - - if($connect->Execute("CREATE DATABASE $databasename;")) - { - print("\nDatabase $databasename on $databasetype CREATED \n"); - } - else - { - print("\nDatabase $databasename on $databasetype COULD NOT BE CREATED \n"); - print("\n".$connect->ErrorMsg()); - return 1; - } - - } - else - { - if ($databasetype=='mysql' || $databasetype=='mysqli') {$connect->Execute("ALTER DATABASE `$databasename` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;");} //Set the collation also for manually created DBs - - print("\nDatabase $databasename on $databasetype EXISTS, not created \n"); - - } - - // Connect to the database we created a sec ago or to the existing db. - if(!$connect->Connect($databaselocation,$databaseuser,$databasepass,$databasename)) - { - print("\n".$connect->ErrorMsg()); - return 1; - } - - require_once($homedir."/classes/core/sha256.php"); - - $success = 0; // Let's be optimistic - - $createdbtype=$databasetype; - if ($createdbtype=='mssql_n' || $createdbtype=='odbc_mssql' || $createdbtype=='odbtp') $createdbtype='mssql'; - if ($createdbtype=='mssqlnative') $createdbtype == 'mssqlnative'; - $sqlfile = dirname(__FILE__).'/create-'.$createdbtype.'.sql' ; - - if (!empty($sqlfile)) { - if (!is_readable($sqlfile)) { - $success = false; - print "\nTried to populate database, but '". $sqlfile ."' doesn't exist!\n"; - return $success; - } else { - $lines = file($sqlfile); - } - } else { - $sqlstring = trim($sqlstring); - if ($sqlstring{strlen($sqlstring)-1} != ";") { - $sqlstring .= ";"; // add it in if it's not there. - } - $lines[] = $sqlstring; - } - - $command = ''; - - $connect->SetFetchMode(ADODB_FETCH_NUM); - foreach ($lines as $line) { - $line = rtrim($line); - $length = strlen($line); - - if ($length and $line[0] <> '#' and substr($line,0,2) <> '--') { - if (substr($line, $length-1, 1) == ';') { - $line = substr($line, 0, $length-1); // strip ; - $command .= $line; - $command = str_replace('prefix_', $dbprefix, $command); // Table prefixes - $command = str_replace('$defaultuser', $defaultuser, $command); // variables By Moses - $command = str_replace('$defaultpass', SHA256::hashing($defaultpass), $command); // variables By Moses - $command = str_replace('$siteadminname', $siteadminname, $command); - $command = str_replace('$siteadminemail', $siteadminemail, $command); // variables By Moses - $command = str_replace('$defaultlang', $defaultlang, $command); // variables By Moses - $command = str_replace('$sessionname', 'ls'.sRandomChars(20,'123456789'), $command); - $command = str_replace('$databasetabletype', $databasetabletype, $command); - - - - - if(!$connect->Execute($command,false)) - { - print ("\n".$clang->gT("Executing").".....".$command."...".$clang->gT('Failed! Reason:')."\n".$connect->ErrorMsg()."\n\n"); - $success=1; - } - - - - $command = ''; - } else { - $command .= $line; - } - } - } - $connect->SetFetchMode(ADODB_FETCH_ASSOC); - if($success == 0) - { - print("Database $databasename on $databasetype POPULATED"); - print("\n\neverything went fine"); - return $success; - } - else - { - print("\n\nSomething is strange"); - print("\nplease check you Database and Settings"); - return $success; - } - - - // if (modify_database(dirname(__FILE__).'\create-'.$databasetype.'.sql')) - // { - - // print("\nDatabase $databasename on $databasetype POPULATED \n"); - // return 0; - // } else { - - // print("Could not populate $databasename on $databasetype\n"); - // return 1; - // } -} - -elseif (isset($argv[1]) && $argv[1]=='upgrade') - -{ - - $upgradedbtype=$databasetype; - if ($upgradedbtype=='mssql_n' || $upgradedbtype=='odbc_mssql' || $upgradedbtype=='odbtp') $upgradedbtype='mssql'; - if ($upgradedbtype=='mssqnlative') $upgradedbtype='mssqlnative'; - include ('upgrade-all.php'); - include ('upgrade-'.$upgradedbtype.'.php'); - - $usquery = "SELECT stg_value FROM ".db_table_name("settings_global")." where stg_name='DBVersion'"; - $usresult = db_execute_assoc($usquery); - $usrow = $usresult->FetchRow(); - if (intval($usrow['stg_value'])<$dbversionnumber) - { - print("Upgrading db to $dbversionnumber\n"); - db_upgrade_all(intval($usrow['stg_value'])); - db_upgrade(intval($usrow['stg_value'])); - } else { - print("Already at db version $dbversionnumber\n"); - } - return 0; -} -else -{ - print("LimeSurvey Commandline Install\n"); - print("Usage: cmd_install
                "; - exit; - } - else - { - echo $modifyoutput; - echo"Error"; - } - -} - -if (!$dbname) -{ - echo "
                $setfont".$clang->gT("Error")."
                \n"; - echo $clang->gT("Database Information not provided. This script must be run from admin.php only."); - - echo "

                \n"; - echo ""; - exit; -} - -if (!$database_exists) //Database named in config-defaults.php does not exist -{ - // TODO SQL: Portable to other databases?? - switch ($databasetype) - { - case 'mysqli': - case 'mysql': $createDb=$connect->Execute("CREATE DATABASE `$dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci"); - break; - case 'mssql_n': - case 'odbc_mssql': - case 'mssqlnative': - case 'odbtp': $createDb=$connect->Execute("CREATE DATABASE [$dbname];"); - break; - default: $createDb=$connect->Execute("CREATE DATABASE $dbname"); - } - if ($createDb) //Database has been successfully created - { - $connect->database = $dbname; - $connect->Execute("USE DATABASE `$dbname`"); - echo "
                $setfont\n"; - echo $clang->gT("Database has been created.")."

                \n"; - echo $clang->gT("Please click below to populate the database")."

                \n"; - echo "
                "; - echo "
                "; - } - else - { - echo "$setfont".$clang->gT("Error")."
                \n"; - echo $clang->gT("Could not create database")." ($dbname)
                \n"; - echo $connect->ErrorMsg(); - echo "

                \n"; - echo ""; - } -} -echo "\n"; - -?> diff --git a/include/limesurvey/admin/upgrade/index.php b/include/limesurvey/admin/upgrade/index.php deleted file mode 100644 index 6d16ef58..00000000 --- a/include/limesurvey/admin/upgrade/index.php +++ /dev/null @@ -1,76 +0,0 @@ - DEFAULT SET TO EN FOR NOW -require_once($rootdir.'/classes/core/language.php'); -$clang = new limesurvey_lang("en"); -$adminoutput=getAdminHeader(); // Alle future output is written into this and then outputted at the end of file -ob_implicit_flush(true); -sendcacheheaders(); - -if (!$database_exists) -{ - $adminoutput.= "
                \n" - ."\n" - ."\t\n" - ."\t
                " - .$clang->gT("LimeSurvey Setup")."
                \n" - ."".$clang->gT("Welcome to LimeSurvey Setup!")."

                \n" - .$clang->gT("The database defined in config.php does not exist.")."
                \n" - .$clang->gT("LimeSurvey can attempt to create this database for you.")."

                \n" - .$clang->gT("Your selected database name is:")." $databasename
                \n" - ."
                \n" - ."
                \n" - ."\n\n"; -} -elseif ($dbexistsbutempty && !(returnglobal('createdbstep2')==$clang->gT("Populate Database"))) -{ - $connect->database = $databasename; - $connect->Execute("USE DATABASE `$databasename`"); - $adminoutput.= "
                " - .$clang->gT("LimeSurvey Setup")."
                \n"; - $adminoutput.= "
                \n"; - $adminoutput.= sprintf($clang->gT('A database named "%s" already exists.'),$databasename)."

                \n"; - $adminoutput.= $clang->gT("Do you want to populate that database now by creating the necessary tables?")."

                \n"; - $adminoutput.= "

                "; - $adminoutput.= "
                "; -} -else -{ - //DB EXISTS, CHECK FOR APPROPRIATE UPGRADES - $connect->database = $databasename; - $connect->Execute("USE DATABASE `$databasename`"); - ob_start(); - CheckForDBUpgrades(); - $output=ob_get_clean(); - if ($output== '') {$adminoutput.='
                LimeSurvey Database is up to date. No action needed';} - else {$adminoutput.=$output;} - $adminoutput.="
                Please log in."; - -} -echo $adminoutput; - - - - -?> diff --git a/include/limesurvey/admin/upgrade/phpinfo.php b/include/limesurvey/admin/upgrade/phpinfo.php deleted file mode 100644 index 57078d56..00000000 --- a/include/limesurvey/admin/upgrade/phpinfo.php +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/include/limesurvey/admin/upgrade/resetadminpw.php b/include/limesurvey/admin/upgrade/resetadminpw.php deleted file mode 100644 index c0c9a7d2..00000000 --- a/include/limesurvey/admin/upgrade/resetadminpw.php +++ /dev/null @@ -1,39 +0,0 @@ - diff --git a/include/limesurvey/admin/usercontrol.php b/include/limesurvey/admin/usercontrol.php index fcb11f67..9c9c7f32 100644 --- a/include/limesurvey/admin/usercontrol.php +++ b/include/limesurvey/admin/usercontrol.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: usercontrol.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: usercontrol.php 12260 2012-01-31 00:32:32Z c_schmitz $ */ // Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB @@ -73,7 +73,7 @@ if (!isset($_SESSION['loginID'])) $subject = $clang->gT("User data","unescaped"); $to = $emailaddr; $from = $siteadminemail; - $sitename = $siteadminname; + if(SendEmailMessage(null, $body, $subject, $to, $from, $sitename, false,$siteadminbounce)) { @@ -100,7 +100,7 @@ if (!isset($_SESSION['loginID'])) { include("database.php"); - $sIp= $_SERVER['REMOTE_ADDR']; + $sIp = getIPAddress(); $query = "SELECT * FROM ".db_table_name('failed_login_attempts'). " WHERE ip='$sIp';"; $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; $result = $connect->query($query); @@ -176,6 +176,8 @@ if (!isset($_SESSION['loginID'])) $_SESSION['user'] = $fields['users_name']; $_SESSION['full_name'] = $fields['full_name']; $_SESSION['htmleditormode'] = $fields['htmleditormode']; + $_SESSION['questionselectormode'] = $fields['questionselectormode']; + $_SESSION['templateeditormode'] = $fields['templateeditormode']; $_SESSION['dateformat'] = $fields['dateformat']; // Compute a checksession random number to test POSTs $_SESSION['checksessionpost'] = sRandomChars(10); @@ -286,7 +288,7 @@ if (!isset($_SESSION['loginID'])) } include("database.php"); - $query = "SELECT uid, users_name, password, parent_id, email, lang, htmleditormode, dateformat FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($mappeduser); + $query = "SELECT uid, users_name, password, parent_id, email, lang, htmleditormode, questionselectormode, templateeditormode, dateformat FROM ".db_table_name('users')." WHERE users_name=".$connect->qstr($mappeduser); $ADODB_FETCH_MODE = ADODB_FETCH_ASSOC; //Checked $result = $connect->SelectLimit($query, 1) or safe_die ($query."
                ".$connect->ErrorMsg()); if ($result->RecordCount() < 1) @@ -381,6 +383,8 @@ if (!isset($_SESSION['loginID'])) $_SESSION['user'] = $fields['users_name']; $_SESSION['adminlang'] = $fields['lang']; $_SESSION['htmleditormode'] = $fields['htmleditormode']; + $_SESSION['questionselectormode'] = $fields['questionselectormode']; + $_SESSION['templateeditormode'] = $fields['templateeditormode']; $_SESSION['dateformat'] = $fields['dateformat']; $_SESSION['checksessionpost'] = sRandomChars(10); $_SESSION['pw_notify']=false; @@ -454,25 +458,25 @@ elseif ($action == "adduser" && $_SESSION['USER_RIGHT_CREATE_USER']) "manage_label"=>$srow['manage_label'])); // send Mail - $body = sprintf($clang->gT("Hello %s,"), $new_full_name)."

                \n"; - $body .= sprintf($clang->gT("this is an automated email to notify that a user has been created for you on the site '%s'."), $sitename)."

                \n"; - $body .= $clang->gT("You can use now the following credentials to log into the site:")."
                \n"; - $body .= $clang->gT("Username") . ": " . $new_user . "
                \n"; + $body = sprintf($clang->gT("Hello %s,",'unescaped'), $new_full_name)."

                \n"; + $body .= sprintf($clang->gT("this is an automated email to notify that a user has been created for you on the site '%s'.",'unescaped'), $sitename)."

                \n"; + $body .= $clang->gT("You can use now the following credentials to log into the site:",'unescaped')."
                \n"; + $body .= $clang->gT("Username",'unescaped') . ": " . $new_user . "
                \n"; if ($useWebserverAuth === false) { // authent is not delegated to web server // send password (if authorized by config) if ($display_user_password_in_email === true) { - $body .= $clang->gT("Password") . ": " . $new_pass . "
                \n"; + $body .= $clang->gT("Password",'unescaped') . ": " . $new_pass . "
                \n"; } else { - $body .= $clang->gT("Password") . ": " . $clang->gT("Please ask your LimeSurvey administrator for your password.") . "
                \n"; + $body .= $clang->gT("Password",'unescaped') . ": " . $clang->gT("Please ask your LimeSurvey administrator for your password.") . "
                \n"; } } - $body .= "".$clang->gT("Click here to log in.")."

                \n"; - $body .= sprintf($clang->gT('If you have any questions regarding this mail please do not hesitate to contact the site administrator at %s. Thank you!'),$siteadminemail)."
                \n"; + $body .= "".$clang->gT("Click here to log in.",'unescaped')."

                \n"; + $body .= sprintf($clang->gT('If you have any questions regarding this mail please do not hesitate to contact the site administrator at %s. Thank you!','unescaped'),$siteadminemail)."
                \n"; $subject = sprintf($clang->gT("User registration at '%s'","unescaped"),$sitename); $to = $new_user." <$new_email>"; @@ -583,7 +587,12 @@ elseif (($action == "deluser" || $action == "finaldeluser") && ($_SESSION['USER_ $dquery="DELETE FROM {$dbprefix}survey_permissions WHERE uid=".$postuserid; $dresult=$connect->Execute($dquery); //Checked - if($postuserid == $_SESSION['loginID']) killSession(); // user deleted himself + if($postuserid == $_SESSION['loginID']) + { + killSession(); // user deleted himself + header( "Location: " . $homeurl . "/admin.php"); + die(); + } $addsummary .= "
                ".$clang->gT("Username").": {$postuser}

                \n"; $addsummary .= "
                ".$clang->gT("Success!")."
                \n"; diff --git a/include/limesurvey/admin/userrighthandling.php b/include/limesurvey/admin/userrighthandling.php index 3420947f..9819cc23 100644 --- a/include/limesurvey/admin/userrighthandling.php +++ b/include/limesurvey/admin/userrighthandling.php @@ -10,13 +10,13 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: userrighthandling.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id$ */ //Security Checked: POST/GET/DB/SESSION //Ensure script is not run directly, avoid path disclosure if (!isset($dbprefix) || isset($_REQUEST['dbprefix'])) {die("Cannot run this script directly");} -if (isset($_POST['uid'])) {$postuserid=sanitize_int($_POST['uid']);} -if (isset($_POST['ugid'])) {$postusergroupid=sanitize_int($_POST['ugid']);} +if (isset($_POST['uid'])) {$postuserid=intval($_POST['uid']);} +if (isset($_POST['ugid'])) {$postusergroupid=intval($_POST['ugid']);} if (get_magic_quotes_gpc()) {$_POST = array_map('recursive_stripslashes', $_POST);} @@ -27,7 +27,6 @@ $js_admin_includes[]='scripts/users.js'; if (($ugid && !$surveyid) || $action == "editusergroups" || $action == "addusergroup" || $action=="usergroupindb" || $action == "editusergroup" || $action == "mailusergroup") { - if($ugid) { $grpquery = "SELECT gp.* FROM ".db_table_name('user_groups')." AS gp, ".db_table_name('user_in_groups')." AS gu WHERE gp.ugid=gu.ugid AND gp.ugid = $ugid AND gu.uid=".$_SESSION['loginID']; @@ -445,8 +444,10 @@ if ($action == "editusers") . "\n"; $userlist = getuserlist(); + $ui = count($userlist); $usrhimself = $userlist[0]; + $usrhimself =array_map('htmlspecialchars',$usrhimself); unset($userlist[0]); // output users @@ -511,6 +512,8 @@ if ($action == "editusers") { $usr = $usr_arr[$i]; + $usr =array_map('htmlspecialchars',$usr); + $usersummary .= "\n"; $usersummary .= "\n"; @@ -620,7 +623,7 @@ if ($action == "addusergroup") . "
                " . "
                  \n" . "
                • \n" - . " ".$clang->gT("Required")."
                • \n" + . " ".$clang->gT("Required")."\n" . "
                • \n" . "
                • \n" . "

                \n" @@ -633,7 +636,7 @@ if ($action == "editusergroup") { if ($_SESSION['USER_RIGHT_SUPERADMIN'] == 1) { - $query = "SELECT * FROM ".db_table_name('user_groups')." WHERE ugid = ".$_GET['ugid']." AND owner_id = ".$_SESSION['loginID']; + $query = "SELECT * FROM ".db_table_name('user_groups')." WHERE ugid = ".$ugid." AND owner_id = ".$_SESSION['loginID']; $result = db_select_limit_assoc($query, 1); $esrow = $result->FetchRow(); $usersummary = "

                ".sprintf($clang->gT("Editing user group (Owner: %s)"),$_SESSION['user'])."
                " diff --git a/include/limesurvey/admin/vvexport.php b/include/limesurvey/admin/vvexport.php index d24e3f51..44166ee5 100644 --- a/include/limesurvey/admin/vvexport.php +++ b/include/limesurvey/admin/vvexport.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: vvexport.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: vvexport.php 11664 2011-12-16 05:19:42Z tmswhite $ */ // Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB @@ -72,6 +72,7 @@ $quexsfilterstate = questionnaireSampleFilterstate(); ."\n"; $vvoutput .= + "
              • \n" ." \n" ." *\n" diff --git a/include/limesurvey/admin/vvimport.php b/include/limesurvey/admin/vvimport.php index 041d9bcf..801ca5ab 100644 --- a/include/limesurvey/admin/vvimport.php +++ b/include/limesurvey/admin/vvimport.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: vvimport.php 10925 2011-09-02 14:12:02Z c_schmitz $ + * $Id: vvimport.php 11664 2011-12-16 05:19:42Z tmswhite $ */ include_once("login_check.php"); diff --git a/include/limesurvey/classes/.htaccess b/include/limesurvey/classes/.htaccess new file mode 100644 index 00000000..45552cb6 --- /dev/null +++ b/include/limesurvey/classes/.htaccess @@ -0,0 +1 @@ +Options -Indexes \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/contrib/toxmlrpc.inc.php b/include/limesurvey/classes/adodb/contrib/toxmlrpc.inc.php index 125c276c..95557c19 100644 --- a/include/limesurvey/classes/adodb/contrib/toxmlrpc.inc.php +++ b/include/limesurvey/classes/adodb/contrib/toxmlrpc.inc.php @@ -1,183 +1,183 @@ -GetArray()) would work with: - * - ADODB_FETCH_BOTH - * - null values - */ - -/** - * Include the main libraries - */ -@require_once('xmlrpc.inc') OR die(); -if (!defined('ADODB_DIR')) require_once('adodb.inc.php'); - -/** - * Builds an xmlrpc struct value out of an AdoDB recordset - */ -function rs2xmlrpcval(&$adodbrs) { - - $header = rs2xmlrpcval_header($adodbrs); - $body = rs2xmlrpcval_body($adodbrs); - - // put it all together and build final xmlrpc struct - $xmlrpcrs = new xmlrpcval ( array( - "header" => $header, - "body" => $body, - ), "struct"); - - return $xmlrpcrs; - -} - -/** - * Builds an xmlrpc struct value describing an AdoDB recordset - */ -function rs2xmlrpcval_header($adodbrs) -{ - $numfields = $adodbrs->FieldCount(); - $numrecords = $adodbrs->RecordCount(); - - // build structure holding recordset information - $fieldstruct = array(); - for ($i = 0; $i < $numfields; $i++) { - $fld = $adodbrs->FetchField($i); - $fieldarray = array(); - if (isset($fld->name)) - $fieldarray["name"] = new xmlrpcval ($fld->name); - if (isset($fld->type)) - $fieldarray["type"] = new xmlrpcval ($fld->type); - if (isset($fld->max_length)) - $fieldarray["max_length"] = new xmlrpcval ($fld->max_length, "int"); - if (isset($fld->not_null)) - $fieldarray["not_null"] = new xmlrpcval ($fld->not_null, "boolean"); - if (isset($fld->has_default)) - $fieldarray["has_default"] = new xmlrpcval ($fld->has_default, "boolean"); - if (isset($fld->default_value)) - $fieldarray["default_value"] = new xmlrpcval ($fld->default_value); - $fieldstruct[$i] = new xmlrpcval ($fieldarray, "struct"); - } - $fieldcount = new xmlrpcval ($numfields, "int"); - $recordcount = new xmlrpcval ($numrecords, "int"); - $sql = new xmlrpcval ($adodbrs->sql); - $fieldinfo = new xmlrpcval ($fieldstruct, "array"); - - $header = new xmlrpcval ( array( - "fieldcount" => $fieldcount, - "recordcount" => $recordcount, - "sql" => $sql, - "fieldinfo" => $fieldinfo - ), "struct"); - - return $header; -} - -/** - * Builds an xmlrpc struct value out of an AdoDB recordset - * (data values only, no data definition) - */ -function rs2xmlrpcval_body($adodbrs) -{ - $numfields = $adodbrs->FieldCount(); - - // build structure containing recordset data - $adodbrs->MoveFirst(); - $rows = array(); - while (!$adodbrs->EOF) { - $columns = array(); - // This should work on all cases of fetch mode: assoc, num, both or default - if ($adodbrs->fetchMode == 'ADODB_FETCH_BOTH' || count($adodbrs->fields) == 2 * $adodbrs->FieldCount()) - for ($i = 0; $i < $numfields; $i++) - if ($adodbrs->fields[$i] === null) - $columns[$i] = new xmlrpcval (''); - else - $columns[$i] = xmlrpc_encode ($adodbrs->fields[$i]); - else - foreach ($adodbrs->fields as $val) - if ($val === null) - $columns[] = new xmlrpcval (''); - else - $columns[] = xmlrpc_encode ($val); - - $rows[] = new xmlrpcval ($columns, "array"); - - $adodbrs->MoveNext(); - } - $body = new xmlrpcval ($rows, "array"); - - return $body; -} - -/** - * Returns an xmlrpc struct value as string out of an AdoDB recordset - */ -function rs2xmlrpcstring (&$adodbrs) { - $xmlrpc = rs2xmlrpcval ($adodbrs); - if ($xmlrpc) - return $xmlrpc->serialize(); - else - return null; -} - -/** - * Given a well-formed xmlrpc struct object returns an AdoDB object - * - * @todo add some error checking on the input value - */ -function xmlrpcval2rs (&$xmlrpcval) { - - $fields_array = array(); - $data_array = array(); - - // rebuild column information - $header = $xmlrpcval->structmem('header'); - - $numfields = $header->structmem('fieldcount'); - $numfields = $numfields->scalarval(); - $numrecords = $header->structmem('recordcount'); - $numrecords = $numrecords->scalarval(); - $sqlstring = $header->structmem('sql'); - $sqlstring = $sqlstring->scalarval(); - - $fieldinfo = $header->structmem('fieldinfo'); - for ($i = 0; $i < $numfields; $i++) { - $temp = $fieldinfo->arraymem($i); - $fld = new ADOFieldObject(); - while (list($key,$value) = $temp->structeach()) { - if ($key == "name") $fld->name = $value->scalarval(); - if ($key == "type") $fld->type = $value->scalarval(); - if ($key == "max_length") $fld->max_length = $value->scalarval(); - if ($key == "not_null") $fld->not_null = $value->scalarval(); - if ($key == "has_default") $fld->has_default = $value->scalarval(); - if ($key == "default_value") $fld->default_value = $value->scalarval(); - } // while - $fields_array[] = $fld; - } // for - - // fetch recordset information into php array - $body = $xmlrpcval->structmem('body'); - for ($i = 0; $i < $numrecords; $i++) { - $data_array[$i]= array(); - $xmlrpcrs_row = $body->arraymem($i); - for ($j = 0; $j < $numfields; $j++) { - $temp = $xmlrpcrs_row->arraymem($j); - $data_array[$i][$j] = $temp->scalarval(); - } // for j - } // for i - - // finally build in-memory recordset object and return it - $rs = new ADORecordSet_array(); - $rs->InitArrayFields($data_array,$fields_array); - return $rs; - -} - +GetArray()) would work with: + * - ADODB_FETCH_BOTH + * - null values + */ + +/** + * Include the main libraries + */ +@require_once('xmlrpc.inc') OR die(); +if (!defined('ADODB_DIR')) require_once('adodb.inc.php'); + +/** + * Builds an xmlrpc struct value out of an AdoDB recordset + */ +function rs2xmlrpcval(&$adodbrs) { + + $header = rs2xmlrpcval_header($adodbrs); + $body = rs2xmlrpcval_body($adodbrs); + + // put it all together and build final xmlrpc struct + $xmlrpcrs = new xmlrpcval ( array( + "header" => $header, + "body" => $body, + ), "struct"); + + return $xmlrpcrs; + +} + +/** + * Builds an xmlrpc struct value describing an AdoDB recordset + */ +function rs2xmlrpcval_header($adodbrs) +{ + $numfields = $adodbrs->FieldCount(); + $numrecords = $adodbrs->RecordCount(); + + // build structure holding recordset information + $fieldstruct = array(); + for ($i = 0; $i < $numfields; $i++) { + $fld = $adodbrs->FetchField($i); + $fieldarray = array(); + if (isset($fld->name)) + $fieldarray["name"] = new xmlrpcval ($fld->name); + if (isset($fld->type)) + $fieldarray["type"] = new xmlrpcval ($fld->type); + if (isset($fld->max_length)) + $fieldarray["max_length"] = new xmlrpcval ($fld->max_length, "int"); + if (isset($fld->not_null)) + $fieldarray["not_null"] = new xmlrpcval ($fld->not_null, "boolean"); + if (isset($fld->has_default)) + $fieldarray["has_default"] = new xmlrpcval ($fld->has_default, "boolean"); + if (isset($fld->default_value)) + $fieldarray["default_value"] = new xmlrpcval ($fld->default_value); + $fieldstruct[$i] = new xmlrpcval ($fieldarray, "struct"); + } + $fieldcount = new xmlrpcval ($numfields, "int"); + $recordcount = new xmlrpcval ($numrecords, "int"); + $sql = new xmlrpcval ($adodbrs->sql); + $fieldinfo = new xmlrpcval ($fieldstruct, "array"); + + $header = new xmlrpcval ( array( + "fieldcount" => $fieldcount, + "recordcount" => $recordcount, + "sql" => $sql, + "fieldinfo" => $fieldinfo + ), "struct"); + + return $header; +} + +/** + * Builds an xmlrpc struct value out of an AdoDB recordset + * (data values only, no data definition) + */ +function rs2xmlrpcval_body($adodbrs) +{ + $numfields = $adodbrs->FieldCount(); + + // build structure containing recordset data + $adodbrs->MoveFirst(); + $rows = array(); + while (!$adodbrs->EOF) { + $columns = array(); + // This should work on all cases of fetch mode: assoc, num, both or default + if ($adodbrs->fetchMode == 'ADODB_FETCH_BOTH' || count($adodbrs->fields) == 2 * $adodbrs->FieldCount()) + for ($i = 0; $i < $numfields; $i++) + if ($adodbrs->fields[$i] === null) + $columns[$i] = new xmlrpcval (''); + else + $columns[$i] = xmlrpc_encode ($adodbrs->fields[$i]); + else + foreach ($adodbrs->fields as $val) + if ($val === null) + $columns[] = new xmlrpcval (''); + else + $columns[] = xmlrpc_encode ($val); + + $rows[] = new xmlrpcval ($columns, "array"); + + $adodbrs->MoveNext(); + } + $body = new xmlrpcval ($rows, "array"); + + return $body; +} + +/** + * Returns an xmlrpc struct value as string out of an AdoDB recordset + */ +function rs2xmlrpcstring (&$adodbrs) { + $xmlrpc = rs2xmlrpcval ($adodbrs); + if ($xmlrpc) + return $xmlrpc->serialize(); + else + return null; +} + +/** + * Given a well-formed xmlrpc struct object returns an AdoDB object + * + * @todo add some error checking on the input value + */ +function xmlrpcval2rs (&$xmlrpcval) { + + $fields_array = array(); + $data_array = array(); + + // rebuild column information + $header = $xmlrpcval->structmem('header'); + + $numfields = $header->structmem('fieldcount'); + $numfields = $numfields->scalarval(); + $numrecords = $header->structmem('recordcount'); + $numrecords = $numrecords->scalarval(); + $sqlstring = $header->structmem('sql'); + $sqlstring = $sqlstring->scalarval(); + + $fieldinfo = $header->structmem('fieldinfo'); + for ($i = 0; $i < $numfields; $i++) { + $temp = $fieldinfo->arraymem($i); + $fld = new ADOFieldObject(); + while (list($key,$value) = $temp->structeach()) { + if ($key == "name") $fld->name = $value->scalarval(); + if ($key == "type") $fld->type = $value->scalarval(); + if ($key == "max_length") $fld->max_length = $value->scalarval(); + if ($key == "not_null") $fld->not_null = $value->scalarval(); + if ($key == "has_default") $fld->has_default = $value->scalarval(); + if ($key == "default_value") $fld->default_value = $value->scalarval(); + } // while + $fields_array[] = $fld; + } // for + + // fetch recordset information into php array + $body = $xmlrpcval->structmem('body'); + for ($i = 0; $i < $numrecords; $i++) { + $data_array[$i]= array(); + $xmlrpcrs_row = $body->arraymem($i); + for ($j = 0; $j < $numfields; $j++) { + $temp = $xmlrpcrs_row->arraymem($j); + $data_array[$i][$j] = $temp->scalarval(); + } // for j + } // for i + + // finally build in-memory recordset object and return it + $rs = new ADORecordSet_array(); + $rs->InitArrayFields($data_array,$fields_array); + return $rs; + +} + ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/datadict/datadict-mssql.inc.php b/include/limesurvey/classes/adodb/datadict/datadict-mssql.inc.php index 55605481..81bbfcac 100644 --- a/include/limesurvey/classes/adodb/datadict/datadict-mssql.inc.php +++ b/include/limesurvey/classes/adodb/datadict/datadict-mssql.inc.php @@ -88,7 +88,7 @@ class ADODB2_mssql extends ADODB_DataDict { case 'B': return 'IMAGE'; - case 'D': return 'DATETIME'; + case 'D': return 'DATE'; case 'TS': case 'T': return 'DATETIME'; diff --git a/include/limesurvey/classes/adodb/datadict/datadict-mssqlnative.inc.php b/include/limesurvey/classes/adodb/datadict/datadict-mssqlnative.inc.php index 0a6175b9..c2504678 100644 --- a/include/limesurvey/classes/adodb/datadict/datadict-mssqlnative.inc.php +++ b/include/limesurvey/classes/adodb/datadict/datadict-mssqlnative.inc.php @@ -88,7 +88,7 @@ class ADODB2_mssqlnative extends ADODB_DataDict { case 'B': return 'IMAGE'; - case 'D': return 'DATETIME'; + case 'D': return 'DATE'; case 'T': return 'DATETIME'; case 'L': return 'BIT'; @@ -135,7 +135,7 @@ class ADODB2_mssqlnative extends ADODB_DataDict { } */ - function DropColumnSQL($tabname, $flds) + function DropColumnSQL($tabname, $flds, $tableflds='', $tableoptions='') { $tabname = $this->TableName ($tabname); if (!is_array($flds)) diff --git a/include/limesurvey/classes/adodb/drivers/adodb-mssqlnative.inc.php b/include/limesurvey/classes/adodb/drivers/adodb-mssqlnative.inc.php index e74eb110..7ed196a8 100644 --- a/include/limesurvey/classes/adodb/drivers/adodb-mssqlnative.inc.php +++ b/include/limesurvey/classes/adodb/drivers/adodb-mssqlnative.inc.php @@ -114,7 +114,7 @@ class ADODB_mssqlnative extends ADOConnection { var $metaColumnsSQL = # xtype==61 is datetime "select c.name,t.name,c.length, (case when c.xusertype=61 then 0 else c.xprec end), - (case when c.xusertype=61 then 0 else c.xscale end) + (case when c.xusertype=61 then 0 else c.xscale end) from syscolumns c join systypes t on t.xusertype=c.xusertype join sysobjects o on o.id=c.id where o.name='%s'"; var $hasTop = 'top'; // support mssql SELECT TOP 10 * FROM TABLE var $hasGenID = true; @@ -177,7 +177,7 @@ class ADODB_mssqlnative extends ADOConnection { } function _affectedrows() - { + { return @sqlsrv_rows_affected($this->_queryID); } @@ -330,7 +330,7 @@ class ADODB_mssqlnative extends ADOConnection { See http://www.swynk.com/friends/achigrik/SQL70Locks.asp */ - function RowLock($tables,$where,$col='1 as adodbignore') + function RowLock($tables,$where,$col='1 as adodbignore') { if ($col == '1 as adodbignore') $col = 'top 1 null as ignore'; if (!$this->transCnt) $this->BeginTrans(); @@ -501,8 +501,8 @@ class ADODB_mssqlnative extends ADOConnection { $sql = "SELECT i.name AS ind_name, C.name AS col_name, USER_NAME(O.uid) AS Owner, c.colid, k.Keyno, CASE WHEN I.indid BETWEEN 1 AND 254 AND (I.status & 2048 = 2048 OR I.Status = 16402 AND O.XType = 'V') THEN 1 ELSE 0 END AS IsPK, CASE WHEN I.status & 2 = 2 THEN 1 ELSE 0 END AS IsUnique - FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id - INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid + FROM dbo.sysobjects o INNER JOIN dbo.sysindexes I ON o.id = i.id + INNER JOIN dbo.sysindexkeys K ON I.id = K.id AND I.Indid = K.Indid INNER JOIN dbo.syscolumns c ON K.id = C.id AND K.colid = C.Colid WHERE LEFT(i.name, 8) <> '_WA_Sys_' AND o.status >= 0 AND O.Name LIKE $table ORDER BY O.name, I.Name, K.keyno"; @@ -602,7 +602,7 @@ class ADODB_mssqlnative extends ADOConnection { if ($schema) $schema = "and k.table_catalog like '$schema%'"; $sql = "select distinct k.column_name,ordinal_position from information_schema.key_column_usage k, - information_schema.table_constraints tc + information_schema.table_constraints tc where tc.constraint_name = k.constraint_name and tc.constraint_type = 'PRIMARY KEY' and k.table_name = '$table' $schema order by ordinal_position "; @@ -731,7 +731,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { 91 => 'date', 93 => 'datetime' ); - + $fa = @sqlsrv_field_metadata($this->_queryID); if ($fieldOffset != -1) { $fa = $fa[$fieldOffset]; @@ -771,7 +771,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { return $f; } - + function _seek($row) { return false;//There is no support for cursors in the driver at this time. All data is returned via forward-only streams. @@ -837,7 +837,7 @@ class ADORecordset_mssqlnative extends ADORecordSet { if(is_array($this->fields)) { foreach($this->fields as $key=>$value) { if (is_object($value) && method_exists($value, 'format')) {//is DateTime object - $this->fields[$key] = $value->format("Y-m-d\TH:i:s\Z"); + $this->fields[$key] = $value->format("Y-m-d H:i:s"); } } } diff --git a/include/limesurvey/classes/adodb/lang/adodb-cn.inc.php b/include/limesurvey/classes/adodb/lang/adodb-cn.inc.php index 29baef7a..7ba4f20a 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-cn.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-cn.inc.php @@ -1,35 +1,35 @@ - 'cn', -DB_ERROR => 'δ֪����', -DB_ERROR_ALREADY_EXISTS => '�Ѿ�����', -DB_ERROR_CANNOT_CREATE => '���ܴ���', -DB_ERROR_CANNOT_DELETE => '����ɾ��', -DB_ERROR_CANNOT_DROP => '���ܶ���', -DB_ERROR_CONSTRAINT => 'Լ������', -DB_ERROR_DIVZERO => '��0��', -DB_ERROR_INVALID => '��Ч', -DB_ERROR_INVALID_DATE => '��Ч�����ڻ���ʱ��', -DB_ERROR_INVALID_NUMBER => '��������', -DB_ERROR_MISMATCH => '��ƥ��', -DB_ERROR_NODBSELECTED => 'û����ݿⱻѡ��', -DB_ERROR_NOSUCHFIELD => 'û����Ӧ���ֶ�', -DB_ERROR_NOSUCHTABLE => 'û����Ӧ�ı�', -DB_ERROR_NOT_CAPABLE => '��ݿ��̨������', -DB_ERROR_NOT_FOUND => 'û�з���', -DB_ERROR_NOT_LOCKED => 'û�б���', -DB_ERROR_SYNTAX => '�﷨����', -DB_ERROR_UNSUPPORTED => '��֧��', -DB_ERROR_VALUE_COUNT_ON_ROW => '�������ۼ�ֵ', -DB_ERROR_INVALID_DSN => '��Ч�����Դ (DSN)', -DB_ERROR_CONNECT_FAILED => '����ʧ��', -0 => 'û�д���', // DB_OK -DB_ERROR_NEED_MORE_DATA => '�ṩ����ݲ��ܷ��Ҫ��', -DB_ERROR_EXTENSION_NOT_FOUND=> '��չû�б�����', -DB_ERROR_NOSUCHDB => 'û����Ӧ����ݿ�', -DB_ERROR_ACCESS_VIOLATION => 'û�к��ʵ�Ȩ��' -); + 'cn', +DB_ERROR => 'δ֪����', +DB_ERROR_ALREADY_EXISTS => '�Ѿ�����', +DB_ERROR_CANNOT_CREATE => '���ܴ���', +DB_ERROR_CANNOT_DELETE => '����ɾ��', +DB_ERROR_CANNOT_DROP => '���ܶ���', +DB_ERROR_CONSTRAINT => 'Լ������', +DB_ERROR_DIVZERO => '��0��', +DB_ERROR_INVALID => '��Ч', +DB_ERROR_INVALID_DATE => '��Ч�����ڻ���ʱ��', +DB_ERROR_INVALID_NUMBER => '��������', +DB_ERROR_MISMATCH => '��ƥ��', +DB_ERROR_NODBSELECTED => 'û����ݿⱻѡ��', +DB_ERROR_NOSUCHFIELD => 'û����Ӧ���ֶ�', +DB_ERROR_NOSUCHTABLE => 'û����Ӧ�ı�', +DB_ERROR_NOT_CAPABLE => '��ݿ��̨������', +DB_ERROR_NOT_FOUND => 'û�з���', +DB_ERROR_NOT_LOCKED => 'û�б���', +DB_ERROR_SYNTAX => '�﷨����', +DB_ERROR_UNSUPPORTED => '��֧��', +DB_ERROR_VALUE_COUNT_ON_ROW => '�������ۼ�ֵ', +DB_ERROR_INVALID_DSN => '��Ч�����Դ (DSN)', +DB_ERROR_CONNECT_FAILED => '����ʧ��', +0 => 'û�д���', // DB_OK +DB_ERROR_NEED_MORE_DATA => '�ṩ����ݲ��ܷ��Ҫ��', +DB_ERROR_EXTENSION_NOT_FOUND=> '��չû�б�����', +DB_ERROR_NOSUCHDB => 'û����Ӧ����ݿ�', +DB_ERROR_ACCESS_VIOLATION => 'û�к��ʵ�Ȩ��' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-cz.inc.php b/include/limesurvey/classes/adodb/lang/adodb-cz.inc.php index 3f10ab08..c388e9c0 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-cz.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-cz.inc.php @@ -1,40 +1,40 @@ - - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'cz', -DB_ERROR => 'nezn�m� chyba', -DB_ERROR_ALREADY_EXISTS => 'ji? existuje', -DB_ERROR_CANNOT_CREATE => 'nelze vytvo?it', -DB_ERROR_CANNOT_DELETE => 'nelze smazat', -DB_ERROR_CANNOT_DROP => 'nelze odstranit', -DB_ERROR_CONSTRAINT => 'poru?en� omezuj�c� podm�nky', -DB_ERROR_DIVZERO => 'd?len� nulou', -DB_ERROR_INVALID => 'neplatn�', -DB_ERROR_INVALID_DATE => 'neplatn� datum nebo ?as', -DB_ERROR_INVALID_NUMBER => 'neplatn� ?�slo', -DB_ERROR_MISMATCH => 'nesouhlas�', -DB_ERROR_NODBSELECTED => '?�dn� datab�ze nen� vybr�na', -DB_ERROR_NOSUCHFIELD => 'pole nenalezeno', -DB_ERROR_NOSUCHTABLE => 'tabulka nenalezena', -DB_ERROR_NOT_CAPABLE => 'nepodporov�no', -DB_ERROR_NOT_FOUND => 'nenalezeno', -DB_ERROR_NOT_LOCKED => 'nezam?eno', -DB_ERROR_SYNTAX => 'syntaktick� chyba', -DB_ERROR_UNSUPPORTED => 'nepodporov�no', -DB_ERROR_VALUE_COUNT_ON_ROW => '', -DB_ERROR_INVALID_DSN => 'neplatn� DSN', -DB_ERROR_CONNECT_FAILED => 'p?ipojen� selhalo', -0 => 'bez chyb', // DB_OK -DB_ERROR_NEED_MORE_DATA => 'm�lo zdrojov�ch dat', -DB_ERROR_EXTENSION_NOT_FOUND=> 'roz?�?en� nenalezeno', -DB_ERROR_NOSUCHDB => 'datab�ze neexistuje', -DB_ERROR_ACCESS_VIOLATION => 'nedostate?n� pr�va' -); + + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'cz', +DB_ERROR => 'nezn�m� chyba', +DB_ERROR_ALREADY_EXISTS => 'ji? existuje', +DB_ERROR_CANNOT_CREATE => 'nelze vytvo?it', +DB_ERROR_CANNOT_DELETE => 'nelze smazat', +DB_ERROR_CANNOT_DROP => 'nelze odstranit', +DB_ERROR_CONSTRAINT => 'poru?en� omezuj�c� podm�nky', +DB_ERROR_DIVZERO => 'd?len� nulou', +DB_ERROR_INVALID => 'neplatn�', +DB_ERROR_INVALID_DATE => 'neplatn� datum nebo ?as', +DB_ERROR_INVALID_NUMBER => 'neplatn� ?�slo', +DB_ERROR_MISMATCH => 'nesouhlas�', +DB_ERROR_NODBSELECTED => '?�dn� datab�ze nen� vybr�na', +DB_ERROR_NOSUCHFIELD => 'pole nenalezeno', +DB_ERROR_NOSUCHTABLE => 'tabulka nenalezena', +DB_ERROR_NOT_CAPABLE => 'nepodporov�no', +DB_ERROR_NOT_FOUND => 'nenalezeno', +DB_ERROR_NOT_LOCKED => 'nezam?eno', +DB_ERROR_SYNTAX => 'syntaktick� chyba', +DB_ERROR_UNSUPPORTED => 'nepodporov�no', +DB_ERROR_VALUE_COUNT_ON_ROW => '', +DB_ERROR_INVALID_DSN => 'neplatn� DSN', +DB_ERROR_CONNECT_FAILED => 'p?ipojen� selhalo', +0 => 'bez chyb', // DB_OK +DB_ERROR_NEED_MORE_DATA => 'm�lo zdrojov�ch dat', +DB_ERROR_EXTENSION_NOT_FOUND=> 'roz?�?en� nenalezeno', +DB_ERROR_NOSUCHDB => 'datab�ze neexistuje', +DB_ERROR_ACCESS_VIOLATION => 'nedostate?n� pr�va' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-de.inc.php b/include/limesurvey/classes/adodb/lang/adodb-de.inc.php index 09e987ec..81b45133 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-de.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-de.inc.php @@ -1,33 +1,33 @@ - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'de', -DB_ERROR => 'Unbekannter Fehler', -DB_ERROR_ALREADY_EXISTS => 'existiert bereits', -DB_ERROR_CANNOT_CREATE => 'kann nicht erstellen', -DB_ERROR_CANNOT_DELETE => 'kann nicht löschen', -DB_ERROR_CANNOT_DROP => 'Tabelle oder Index konnte nicht gelöscht werden', -DB_ERROR_CONSTRAINT => 'Constraint Verletzung', -DB_ERROR_DIVZERO => 'Division durch Null', -DB_ERROR_INVALID => 'ung¨ltig', -DB_ERROR_INVALID_DATE => 'ung¨ltiges Datum oder Zeit', -DB_ERROR_INVALID_NUMBER => 'ung¨ltige Zahl', -DB_ERROR_MISMATCH => 'Unverträglichkeit', -DB_ERROR_NODBSELECTED => 'keine Dantebank ausgewählt', -DB_ERROR_NOSUCHFIELD => 'Feld nicht vorhanden', -DB_ERROR_NOSUCHTABLE => 'Tabelle nicht vorhanden', -DB_ERROR_NOT_CAPABLE => 'Funktion nicht installiert', -DB_ERROR_NOT_FOUND => 'nicht gefunden', -DB_ERROR_NOT_LOCKED => 'nicht gesperrt', -DB_ERROR_SYNTAX => 'Syntaxfehler', -DB_ERROR_UNSUPPORTED => 'nicht Unterst¨tzt', -DB_ERROR_VALUE_COUNT_ON_ROW => 'Anzahl der zur¨ckgelieferten Felder entspricht nicht der Anzahl der Felder in der Abfrage', -DB_ERROR_INVALID_DSN => 'ung¨ltiger DSN', -DB_ERROR_CONNECT_FAILED => 'Verbindung konnte nicht hergestellt werden', -0 => 'kein Fehler', // DB_OK -DB_ERROR_NEED_MORE_DATA => 'Nicht gen¨gend Daten geliefert', -DB_ERROR_EXTENSION_NOT_FOUND=> 'erweiterung nicht gefunden', -DB_ERROR_NOSUCHDB => 'keine Datenbank', -DB_ERROR_ACCESS_VIOLATION => 'ungen¨gende Rechte' -); + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'de', +DB_ERROR => 'Unbekannter Fehler', +DB_ERROR_ALREADY_EXISTS => 'existiert bereits', +DB_ERROR_CANNOT_CREATE => 'kann nicht erstellen', +DB_ERROR_CANNOT_DELETE => 'kann nicht löschen', +DB_ERROR_CANNOT_DROP => 'Tabelle oder Index konnte nicht gelöscht werden', +DB_ERROR_CONSTRAINT => 'Constraint Verletzung', +DB_ERROR_DIVZERO => 'Division durch Null', +DB_ERROR_INVALID => 'ung¨ltig', +DB_ERROR_INVALID_DATE => 'ung¨ltiges Datum oder Zeit', +DB_ERROR_INVALID_NUMBER => 'ung¨ltige Zahl', +DB_ERROR_MISMATCH => 'Unverträglichkeit', +DB_ERROR_NODBSELECTED => 'keine Dantebank ausgewählt', +DB_ERROR_NOSUCHFIELD => 'Feld nicht vorhanden', +DB_ERROR_NOSUCHTABLE => 'Tabelle nicht vorhanden', +DB_ERROR_NOT_CAPABLE => 'Funktion nicht installiert', +DB_ERROR_NOT_FOUND => 'nicht gefunden', +DB_ERROR_NOT_LOCKED => 'nicht gesperrt', +DB_ERROR_SYNTAX => 'Syntaxfehler', +DB_ERROR_UNSUPPORTED => 'nicht Unterst¨tzt', +DB_ERROR_VALUE_COUNT_ON_ROW => 'Anzahl der zur¨ckgelieferten Felder entspricht nicht der Anzahl der Felder in der Abfrage', +DB_ERROR_INVALID_DSN => 'ung¨ltiger DSN', +DB_ERROR_CONNECT_FAILED => 'Verbindung konnte nicht hergestellt werden', +0 => 'kein Fehler', // DB_OK +DB_ERROR_NEED_MORE_DATA => 'Nicht gen¨gend Daten geliefert', +DB_ERROR_EXTENSION_NOT_FOUND=> 'erweiterung nicht gefunden', +DB_ERROR_NOSUCHDB => 'keine Datenbank', +DB_ERROR_ACCESS_VIOLATION => 'ungen¨gende Rechte' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-fa.inc.php b/include/limesurvey/classes/adodb/lang/adodb-fa.inc.php index a85816bc..3107c645 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-fa.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-fa.inc.php @@ -1,35 +1,35 @@ - */ - -$ADODB_LANG_ARRAY = array ( - 'LANG' => 'fa', -DB_ERROR => 'خطای ناشناخته', -DB_ERROR_ALREADY_EXISTS => 'وجود دارد', -DB_ERROR_CANNOT_CREATE => 'امکان create وجود ندارد', -DB_ERROR_CANNOT_DELETE => 'امکان حذ٠وجود ندارد', -DB_ERROR_CANNOT_DROP => 'امکان drop وجود ندارد', -DB_ERROR_CONSTRAINT => 'نقض شرط', -DB_ERROR_DIVZERO => 'تقسیم بر ØµÙØ±', -DB_ERROR_INVALID => 'نامعتبر', -DB_ERROR_INVALID_DATE => 'زمان یا تاریخ نامعتبر', -DB_ERROR_INVALID_NUMBER => 'عدد نامعتبر', -DB_ERROR_MISMATCH => 'عدم مطابقت', -DB_ERROR_NODBSELECTED => 'بانک اطلاعاتی انتخاب نشده است', -DB_ERROR_NOSUCHFIELD => 'چنین ستونی وجود ندارد', -DB_ERROR_NOSUCHTABLE => 'چنین جدولی وجود ندارد', -DB_ERROR_NOT_CAPABLE => 'backend بانک اطلاعاتی قادر نیست', -DB_ERROR_NOT_FOUND => 'پیدا نشد', -DB_ERROR_NOT_LOCKED => 'Ù‚ÙÙ„ نشده', -DB_ERROR_SYNTAX => 'خطای دستوری', -DB_ERROR_UNSUPPORTED => 'پشتیبانی نمی شود', -DB_ERROR_VALUE_COUNT_ON_ROW => 'شمارش مقادیر روی ردیÙ', -DB_ERROR_INVALID_DSN => 'DSN نامعتبر', -DB_ERROR_CONNECT_FAILED => 'ارتباط برقرار نشد', -0 => 'بدون خطا', // DB_OK -DB_ERROR_NEED_MORE_DATA => 'داده ناکاÙÛŒ است', -DB_ERROR_EXTENSION_NOT_FOUND=> 'extension پیدا نشد', -DB_ERROR_NOSUCHDB => 'چنین بانک اطلاعاتی وجود ندارد', -DB_ERROR_ACCESS_VIOLATION => 'حق دسترسی ناکاÙÛŒ' -); + */ + +$ADODB_LANG_ARRAY = array ( + 'LANG' => 'fa', +DB_ERROR => 'خطای ناشناخته', +DB_ERROR_ALREADY_EXISTS => 'وجود دارد', +DB_ERROR_CANNOT_CREATE => 'امکان create وجود ندارد', +DB_ERROR_CANNOT_DELETE => 'امکان حذ٠وجود ندارد', +DB_ERROR_CANNOT_DROP => 'امکان drop وجود ندارد', +DB_ERROR_CONSTRAINT => 'نقض شرط', +DB_ERROR_DIVZERO => 'تقسیم بر ØµÙØ±', +DB_ERROR_INVALID => 'نامعتبر', +DB_ERROR_INVALID_DATE => 'زمان یا تاریخ نامعتبر', +DB_ERROR_INVALID_NUMBER => 'عدد نامعتبر', +DB_ERROR_MISMATCH => 'عدم مطابقت', +DB_ERROR_NODBSELECTED => 'بانک اطلاعاتی انتخاب نشده است', +DB_ERROR_NOSUCHFIELD => 'چنین ستونی وجود ندارد', +DB_ERROR_NOSUCHTABLE => 'چنین جدولی وجود ندارد', +DB_ERROR_NOT_CAPABLE => 'backend بانک اطلاعاتی قادر نیست', +DB_ERROR_NOT_FOUND => 'پیدا نشد', +DB_ERROR_NOT_LOCKED => 'Ù‚ÙÙ„ نشده', +DB_ERROR_SYNTAX => 'خطای دستوری', +DB_ERROR_UNSUPPORTED => 'پشتیبانی نمی شود', +DB_ERROR_VALUE_COUNT_ON_ROW => 'شمارش مقادیر روی ردیÙ', +DB_ERROR_INVALID_DSN => 'DSN نامعتبر', +DB_ERROR_CONNECT_FAILED => 'ارتباط برقرار نشد', +0 => 'بدون خطا', // DB_OK +DB_ERROR_NEED_MORE_DATA => 'داده ناکاÙÛŒ است', +DB_ERROR_EXTENSION_NOT_FOUND=> 'extension پیدا نشد', +DB_ERROR_NOSUCHDB => 'چنین بانک اطلاعاتی وجود ندارد', +DB_ERROR_ACCESS_VIOLATION => 'حق دسترسی ناکاÙÛŒ' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-fr.inc.php b/include/limesurvey/classes/adodb/lang/adodb-fr.inc.php index 5a1aaf9a..119f0db7 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-fr.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-fr.inc.php @@ -1,33 +1,33 @@ - 'fr', -DB_ERROR => 'erreur inconnue', -DB_ERROR_ALREADY_EXISTS => 'existe déjà', -DB_ERROR_CANNOT_CREATE => 'crétion impossible', -DB_ERROR_CANNOT_DELETE => 'effacement impossible', -DB_ERROR_CANNOT_DROP => 'suppression impossible', -DB_ERROR_CONSTRAINT => 'violation de contrainte', -DB_ERROR_DIVZERO => 'division par zéro', -DB_ERROR_INVALID => 'invalide', -DB_ERROR_INVALID_DATE => 'date ou heure invalide', -DB_ERROR_INVALID_NUMBER => 'nombre invalide', -DB_ERROR_MISMATCH => 'erreur de concordance', -DB_ERROR_NODBSELECTED => 'pas de base de donnéessélectionnée', -DB_ERROR_NOSUCHFIELD => 'nom de colonne invalide', -DB_ERROR_NOSUCHTABLE => 'table ou vue inexistante', -DB_ERROR_NOT_CAPABLE => 'fonction optionnelle non installée', -DB_ERROR_NOT_FOUND => 'pas trouvé', -DB_ERROR_NOT_LOCKED => 'non verrouillé', -DB_ERROR_SYNTAX => 'erreur de syntaxe', -DB_ERROR_UNSUPPORTED => 'non supporté', -DB_ERROR_VALUE_COUNT_ON_ROW => 'valeur insérée trop grande pour colonne', -DB_ERROR_INVALID_DSN => 'DSN invalide', -DB_ERROR_CONNECT_FAILED => 'échec à la connexion', -0 => "pas d'erreur", // DB_OK -DB_ERROR_NEED_MORE_DATA => 'données fournies insuffisantes', -DB_ERROR_EXTENSION_NOT_FOUND=> 'extension non trouvée', -DB_ERROR_NOSUCHDB => 'base de données inconnue', -DB_ERROR_ACCESS_VIOLATION => 'droits insuffisants' -); + 'fr', +DB_ERROR => 'erreur inconnue', +DB_ERROR_ALREADY_EXISTS => 'existe déjà', +DB_ERROR_CANNOT_CREATE => 'crétion impossible', +DB_ERROR_CANNOT_DELETE => 'effacement impossible', +DB_ERROR_CANNOT_DROP => 'suppression impossible', +DB_ERROR_CONSTRAINT => 'violation de contrainte', +DB_ERROR_DIVZERO => 'division par zéro', +DB_ERROR_INVALID => 'invalide', +DB_ERROR_INVALID_DATE => 'date ou heure invalide', +DB_ERROR_INVALID_NUMBER => 'nombre invalide', +DB_ERROR_MISMATCH => 'erreur de concordance', +DB_ERROR_NODBSELECTED => 'pas de base de donnéessélectionnée', +DB_ERROR_NOSUCHFIELD => 'nom de colonne invalide', +DB_ERROR_NOSUCHTABLE => 'table ou vue inexistante', +DB_ERROR_NOT_CAPABLE => 'fonction optionnelle non installée', +DB_ERROR_NOT_FOUND => 'pas trouvé', +DB_ERROR_NOT_LOCKED => 'non verrouillé', +DB_ERROR_SYNTAX => 'erreur de syntaxe', +DB_ERROR_UNSUPPORTED => 'non supporté', +DB_ERROR_VALUE_COUNT_ON_ROW => 'valeur insérée trop grande pour colonne', +DB_ERROR_INVALID_DSN => 'DSN invalide', +DB_ERROR_CONNECT_FAILED => 'échec à la connexion', +0 => "pas d'erreur", // DB_OK +DB_ERROR_NEED_MORE_DATA => 'données fournies insuffisantes', +DB_ERROR_EXTENSION_NOT_FOUND=> 'extension non trouvée', +DB_ERROR_NOSUCHDB => 'base de données inconnue', +DB_ERROR_ACCESS_VIOLATION => 'droits insuffisants' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-it.inc.php b/include/limesurvey/classes/adodb/lang/adodb-it.inc.php index 3f3f2679..c403af7b 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-it.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-it.inc.php @@ -1,34 +1,34 @@ - 'it', -DB_ERROR => 'errore sconosciuto', -DB_ERROR_ALREADY_EXISTS => 'esiste già', -DB_ERROR_CANNOT_CREATE => 'non posso creare', -DB_ERROR_CANNOT_DELETE => 'non posso cancellare', -DB_ERROR_CANNOT_DROP => 'non posso eliminare', -DB_ERROR_CONSTRAINT => 'violazione constraint', -DB_ERROR_DIVZERO => 'divisione per zero', -DB_ERROR_INVALID => 'non valido', -DB_ERROR_INVALID_DATE => 'data od ora non valida', -DB_ERROR_INVALID_NUMBER => 'numero non valido', -DB_ERROR_MISMATCH => 'diversi', -DB_ERROR_NODBSELECTED => 'nessun database selezionato', -DB_ERROR_NOSUCHFIELD => 'nessun campo trovato', -DB_ERROR_NOSUCHTABLE => 'nessuna tabella trovata', -DB_ERROR_NOT_CAPABLE => 'DB backend non abilitato', -DB_ERROR_NOT_FOUND => 'non trovato', -DB_ERROR_NOT_LOCKED => 'non bloccato', -DB_ERROR_SYNTAX => 'errore di sintassi', -DB_ERROR_UNSUPPORTED => 'non supportato', -DB_ERROR_VALUE_COUNT_ON_ROW => 'valore inserito troppo grande per una colonna', -DB_ERROR_INVALID_DSN => 'DSN non valido', -DB_ERROR_CONNECT_FAILED => 'connessione fallita', -0 => 'nessun errore', // DB_OK -DB_ERROR_NEED_MORE_DATA => 'dati inseriti insufficienti', -DB_ERROR_EXTENSION_NOT_FOUND=> 'estensione non trovata', -DB_ERROR_NOSUCHDB => 'database non trovato', -DB_ERROR_ACCESS_VIOLATION => 'permessi insufficienti' -); + 'it', +DB_ERROR => 'errore sconosciuto', +DB_ERROR_ALREADY_EXISTS => 'esiste già', +DB_ERROR_CANNOT_CREATE => 'non posso creare', +DB_ERROR_CANNOT_DELETE => 'non posso cancellare', +DB_ERROR_CANNOT_DROP => 'non posso eliminare', +DB_ERROR_CONSTRAINT => 'violazione constraint', +DB_ERROR_DIVZERO => 'divisione per zero', +DB_ERROR_INVALID => 'non valido', +DB_ERROR_INVALID_DATE => 'data od ora non valida', +DB_ERROR_INVALID_NUMBER => 'numero non valido', +DB_ERROR_MISMATCH => 'diversi', +DB_ERROR_NODBSELECTED => 'nessun database selezionato', +DB_ERROR_NOSUCHFIELD => 'nessun campo trovato', +DB_ERROR_NOSUCHTABLE => 'nessuna tabella trovata', +DB_ERROR_NOT_CAPABLE => 'DB backend non abilitato', +DB_ERROR_NOT_FOUND => 'non trovato', +DB_ERROR_NOT_LOCKED => 'non bloccato', +DB_ERROR_SYNTAX => 'errore di sintassi', +DB_ERROR_UNSUPPORTED => 'non supportato', +DB_ERROR_VALUE_COUNT_ON_ROW => 'valore inserito troppo grande per una colonna', +DB_ERROR_INVALID_DSN => 'DSN non valido', +DB_ERROR_CONNECT_FAILED => 'connessione fallita', +0 => 'nessun errore', // DB_OK +DB_ERROR_NEED_MORE_DATA => 'dati inseriti insufficienti', +DB_ERROR_EXTENSION_NOT_FOUND=> 'estensione non trovata', +DB_ERROR_NOSUCHDB => 'database non trovato', +DB_ERROR_ACCESS_VIOLATION => 'permessi insufficienti' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-ru1251.inc.php b/include/limesurvey/classes/adodb/lang/adodb-ru1251.inc.php index eb409fe9..3173845f 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-ru1251.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-ru1251.inc.php @@ -1,35 +1,35 @@ - 'ru1251', -DB_ERROR => '����������� ������', -DB_ERROR_ALREADY_EXISTS => '��� ����������', -DB_ERROR_CANNOT_CREATE => '���������� �������', -DB_ERROR_CANNOT_DELETE => '���������� �������', -DB_ERROR_CANNOT_DROP => '���������� ������� (drop)', -DB_ERROR_CONSTRAINT => '��������� ������� ��������', -DB_ERROR_DIVZERO => '������� �� 0', -DB_ERROR_INVALID => '�����������', -DB_ERROR_INVALID_DATE => '������������ ���� ��� �����', -DB_ERROR_INVALID_NUMBER => '������������ �����', -DB_ERROR_MISMATCH => '������', -DB_ERROR_NODBSELECTED => '�� �� �������', -DB_ERROR_NOSUCHFIELD => '�� ���������� ����', -DB_ERROR_NOSUCHTABLE => '�� ���������� �������', -DB_ERROR_NOT_CAPABLE => '���� �� � ���������', -DB_ERROR_NOT_FOUND => '�� �������', -DB_ERROR_NOT_LOCKED => '�� �������������', -DB_ERROR_SYNTAX => '�������������� ������', -DB_ERROR_UNSUPPORTED => '�� ��������������', -DB_ERROR_VALUE_COUNT_ON_ROW => '������� �������� � ������', -DB_ERROR_INVALID_DSN => '������������ DSN', -DB_ERROR_CONNECT_FAILED => '���������� ���������', -0 => '��� ������', // DB_OK -DB_ERROR_NEED_MORE_DATA => '������������� ������������ ������', -DB_ERROR_EXTENSION_NOT_FOUND=> '���������� �� �������', -DB_ERROR_NOSUCHDB => '�� ���������� ��', -DB_ERROR_ACCESS_VIOLATION => '������������ ���� �������' -); + 'ru1251', +DB_ERROR => '����������� ������', +DB_ERROR_ALREADY_EXISTS => '��� ����������', +DB_ERROR_CANNOT_CREATE => '���������� �������', +DB_ERROR_CANNOT_DELETE => '���������� �������', +DB_ERROR_CANNOT_DROP => '���������� ������� (drop)', +DB_ERROR_CONSTRAINT => '��������� ������� ��������', +DB_ERROR_DIVZERO => '������� �� 0', +DB_ERROR_INVALID => '�����������', +DB_ERROR_INVALID_DATE => '������������ ���� ��� �����', +DB_ERROR_INVALID_NUMBER => '������������ �����', +DB_ERROR_MISMATCH => '������', +DB_ERROR_NODBSELECTED => '�� �� �������', +DB_ERROR_NOSUCHFIELD => '�� ���������� ����', +DB_ERROR_NOSUCHTABLE => '�� ���������� �������', +DB_ERROR_NOT_CAPABLE => '���� �� � ���������', +DB_ERROR_NOT_FOUND => '�� �������', +DB_ERROR_NOT_LOCKED => '�� �������������', +DB_ERROR_SYNTAX => '�������������� ������', +DB_ERROR_UNSUPPORTED => '�� ��������������', +DB_ERROR_VALUE_COUNT_ON_ROW => '������� �������� � ������', +DB_ERROR_INVALID_DSN => '������������ DSN', +DB_ERROR_CONNECT_FAILED => '���������� ���������', +0 => '��� ������', // DB_OK +DB_ERROR_NEED_MORE_DATA => '������������� ������������ ������', +DB_ERROR_EXTENSION_NOT_FOUND=> '���������� �� �������', +DB_ERROR_NOSUCHDB => '�� ���������� ��', +DB_ERROR_ACCESS_VIOLATION => '������������ ���� �������' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/lang/adodb-sv.inc.php b/include/limesurvey/classes/adodb/lang/adodb-sv.inc.php index 029f762b..937bd4c2 100644 --- a/include/limesurvey/classes/adodb/lang/adodb-sv.inc.php +++ b/include/limesurvey/classes/adodb/lang/adodb-sv.inc.php @@ -1,33 +1,33 @@ - 'en', -DB_ERROR => 'Ok�nt fel', -DB_ERROR_ALREADY_EXISTS => 'finns redan', -DB_ERROR_CANNOT_CREATE => 'kan inte skapa', -DB_ERROR_CANNOT_DELETE => 'kan inte ta bort', -DB_ERROR_CANNOT_DROP => 'kan inte sl�ppa', -DB_ERROR_CONSTRAINT => 'begr�nsning kr�nkt', -DB_ERROR_DIVZERO => 'division med noll', -DB_ERROR_INVALID => 'ogiltig', -DB_ERROR_INVALID_DATE => 'ogiltigt datum eller tid', -DB_ERROR_INVALID_NUMBER => 'ogiltigt tal', -DB_ERROR_MISMATCH => 'felaktig matchning', -DB_ERROR_NODBSELECTED => 'ingen databas vald', -DB_ERROR_NOSUCHFIELD => 'inget s�dant f�lt', -DB_ERROR_NOSUCHTABLE => 'ingen s�dan tabell', -DB_ERROR_NOT_CAPABLE => 'DB backend klarar det inte', -DB_ERROR_NOT_FOUND => 'finns inte', -DB_ERROR_NOT_LOCKED => 'inte l�st', -DB_ERROR_SYNTAX => 'syntaxfel', -DB_ERROR_UNSUPPORTED => 'st�ds ej', -DB_ERROR_VALUE_COUNT_ON_ROW => 'v�rde r�knat p� rad', -DB_ERROR_INVALID_DSN => 'ogiltig DSN', -DB_ERROR_CONNECT_FAILED => 'anslutning misslyckades', -0 => 'inget fel', // DB_OK -DB_ERROR_NEED_MORE_DATA => 'otillr�ckligt med data angivet', -DB_ERROR_EXTENSION_NOT_FOUND=> 'ut�kning hittades ej', -DB_ERROR_NOSUCHDB => 'ingen s�dan databas', -DB_ERROR_ACCESS_VIOLATION => 'otillr�ckliga r�ttigheter' -); + 'en', +DB_ERROR => 'Ok�nt fel', +DB_ERROR_ALREADY_EXISTS => 'finns redan', +DB_ERROR_CANNOT_CREATE => 'kan inte skapa', +DB_ERROR_CANNOT_DELETE => 'kan inte ta bort', +DB_ERROR_CANNOT_DROP => 'kan inte sl�ppa', +DB_ERROR_CONSTRAINT => 'begr�nsning kr�nkt', +DB_ERROR_DIVZERO => 'division med noll', +DB_ERROR_INVALID => 'ogiltig', +DB_ERROR_INVALID_DATE => 'ogiltigt datum eller tid', +DB_ERROR_INVALID_NUMBER => 'ogiltigt tal', +DB_ERROR_MISMATCH => 'felaktig matchning', +DB_ERROR_NODBSELECTED => 'ingen databas vald', +DB_ERROR_NOSUCHFIELD => 'inget s�dant f�lt', +DB_ERROR_NOSUCHTABLE => 'ingen s�dan tabell', +DB_ERROR_NOT_CAPABLE => 'DB backend klarar det inte', +DB_ERROR_NOT_FOUND => 'finns inte', +DB_ERROR_NOT_LOCKED => 'inte l�st', +DB_ERROR_SYNTAX => 'syntaxfel', +DB_ERROR_UNSUPPORTED => 'st�ds ej', +DB_ERROR_VALUE_COUNT_ON_ROW => 'v�rde r�knat p� rad', +DB_ERROR_INVALID_DSN => 'ogiltig DSN', +DB_ERROR_CONNECT_FAILED => 'anslutning misslyckades', +0 => 'inget fel', // DB_OK +DB_ERROR_NEED_MORE_DATA => 'otillr�ckligt med data angivet', +DB_ERROR_EXTENSION_NOT_FOUND=> 'ut�kning hittades ej', +DB_ERROR_NOSUCHDB => 'ingen s�dan databas', +DB_ERROR_ACCESS_VIOLATION => 'otillr�ckliga r�ttigheter' +); ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/license.txt b/include/limesurvey/classes/adodb/license.txt index 2353871c..9821fcb7 100644 --- a/include/limesurvey/classes/adodb/license.txt +++ b/include/limesurvey/classes/adodb/license.txt @@ -1,182 +1,182 @@ -ADOdb is dual licensed using BSD and LGPL. - -In plain English, you do not need to distribute your application in source code form, nor do you need to distribute ADOdb source code, provided you follow the rest of terms of the BSD license. - -For more info about ADOdb, visit http://adodb.sourceforge.net/ - -BSD Style-License -================= - -Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, -are permitted provided that the following conditions are met: - -Redistributions of source code must retain the above copyright notice, this list -of conditions and the following disclaimer. - -Redistributions in binary form must reproduce the above copyright notice, this list -of conditions and the following disclaimer in the documentation and/or other materials -provided with the distribution. - -Neither the name of the John Lim nor the names of its contributors may be used to -endorse or promote products derived from this software without specific prior written -permission. - -DISCLAIMER: -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY -EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL -JOHN LIM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -========================================================== -GNU LESSER GENERAL PUBLIC LICENSE -Version 2.1, February 1999 - -Copyright (C) 1991, 1999 Free Software Foundation, Inc. -59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -Everyone is permitted to copy and distribute verbatim copies -of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - -Preamble -The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. - -This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. - -When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. - -To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. - -For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. - -We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. - -To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - -Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. - -Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. - -When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. - -We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. - -For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. - -In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. - -Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. - -The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - - -TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION -0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". - -A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. - -The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) - -"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. - -Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. - -1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. - -You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - -2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - - -a) The modified work must itself be a software library. -b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. -c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. -d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. -(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - -3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - -Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. - -This option is useful when you wish to copy part of the code of the Library into a program that is not a library. - -4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. - -If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. - -5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. - -However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. - -When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. - -If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) - -Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - -6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. - -You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: - - -a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) -b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. -c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. -d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. -e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. -For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. - -It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - -7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: - - -a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. -b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. -8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. - -9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. - -10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - -11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. - -This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - -12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. - -13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - -14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - -NO WARRANTY - -15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - -16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - - +ADOdb is dual licensed using BSD and LGPL. + +In plain English, you do not need to distribute your application in source code form, nor do you need to distribute ADOdb source code, provided you follow the rest of terms of the BSD license. + +For more info about ADOdb, visit http://adodb.sourceforge.net/ + +BSD Style-License +================= + +Copyright (c) 2000, 2001, 2002, 2003, 2004 John Lim +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +Redistributions of source code must retain the above copyright notice, this list +of conditions and the following disclaimer. + +Redistributions in binary form must reproduce the above copyright notice, this list +of conditions and the following disclaimer in the documentation and/or other materials +provided with the distribution. + +Neither the name of the John Lim nor the names of its contributors may be used to +endorse or promote products derived from this software without specific prior written +permission. + +DISCLAIMER: +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +JOHN LIM OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +========================================================== +GNU LESSER GENERAL PUBLIC LICENSE +Version 2.1, February 1999 + +Copyright (C) 1991, 1999 Free Software Foundation, Inc. +59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +Everyone is permitted to copy and distribute verbatim copies +of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + +Preamble +The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. + +This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. + +When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. + +To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. + +For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. + +We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. + +To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. + +Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. + +Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. + +When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. + +We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. + +For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. + +In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. + +Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. + +The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. + + +TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION +0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". + +A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. + +The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) + +"Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. + +Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. + +1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. + +You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. + +2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: + + +a) The modified work must itself be a software library. +b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. +c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. +d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. +(For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. + +3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. + +Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. + +This option is useful when you wish to copy part of the code of the Library into a program that is not a library. + +4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. + +If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. + +5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. + +However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. + +When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. + +If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) + +Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. + +6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. + +You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: + + +a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) +b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. +c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. +d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. +e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. +For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. + +It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. + +7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: + + +a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. +b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. +8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. + +9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. + +10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. + +11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. + +This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. + +12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. + +13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. + +14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. + +NO WARRANTY + +15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/readme.txt b/include/limesurvey/classes/adodb/readme.txt index 97bdd9ea..009b94c5 100644 --- a/include/limesurvey/classes/adodb/readme.txt +++ b/include/limesurvey/classes/adodb/readme.txt @@ -1,62 +1,62 @@ ->> ADODB Library for PHP4 - -(c) 2000-2004 John Lim (jlim@natsoft.com.my) - -Released under both BSD and GNU Lesser GPL library license. -This means you can use it in proprietary products. - - ->> Introduction - -PHP's database access functions are not standardised. This creates a -need for a database class library to hide the differences between the -different databases (encapsulate the differences) so we can easily -switch databases. - -We currently support MySQL, Interbase, Sybase, PostgreSQL, Oracle, -Microsoft SQL server, Foxpro ODBC, Access ODBC, Informix, DB2, -Sybase SQL Anywhere, generic ODBC and Microsoft's ADO. - -We hope more people will contribute drivers to support other databases. - - ->> Documentation and Examples - -Refer to the adodb/docs directory for full documentation and examples. -There is also a tutorial tute.htm that contrasts ADODB code with -mysql code. - - ->>> Files -Adodb.inc.php is the main file. You need to include only this file. - -Adodb-*.inc.php are the database specific driver code. - -Test.php contains a list of test commands to exercise the class library. - -Adodb-session.php is the PHP4 session handling code. - -Testdatabases.inc.php contains the list of databases to apply the tests on. - -Benchmark.php is a simple benchmark to test the throughput of a simple SELECT -statement for databases described in testdatabases.inc.php. The benchmark -tables are created in test.php. - -readme.htm is the main documentation. - -tute.htm is the tutorial. - - ->> More Info - -For more information, including installation see readme.htm -or visit - http://adodb.sourceforge.net/ - - ->> Feature Requests and Bug Reports - -Email to jlim@natsoft.com.my - - +>> ADODB Library for PHP4 + +(c) 2000-2004 John Lim (jlim@natsoft.com.my) + +Released under both BSD and GNU Lesser GPL library license. +This means you can use it in proprietary products. + + +>> Introduction + +PHP's database access functions are not standardised. This creates a +need for a database class library to hide the differences between the +different databases (encapsulate the differences) so we can easily +switch databases. + +We currently support MySQL, Interbase, Sybase, PostgreSQL, Oracle, +Microsoft SQL server, Foxpro ODBC, Access ODBC, Informix, DB2, +Sybase SQL Anywhere, generic ODBC and Microsoft's ADO. + +We hope more people will contribute drivers to support other databases. + + +>> Documentation and Examples + +Refer to the adodb/docs directory for full documentation and examples. +There is also a tutorial tute.htm that contrasts ADODB code with +mysql code. + + +>>> Files +Adodb.inc.php is the main file. You need to include only this file. + +Adodb-*.inc.php are the database specific driver code. + +Test.php contains a list of test commands to exercise the class library. + +Adodb-session.php is the PHP4 session handling code. + +Testdatabases.inc.php contains the list of databases to apply the tests on. + +Benchmark.php is a simple benchmark to test the throughput of a simple SELECT +statement for databases described in testdatabases.inc.php. The benchmark +tables are created in test.php. + +readme.htm is the main documentation. + +tute.htm is the tutorial. + + +>> More Info + +For more information, including installation see readme.htm +or visit + http://adodb.sourceforge.net/ + + +>> Feature Requests and Bug Reports + +Email to jlim@natsoft.com.my + + \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/session/adodb-encrypt-sha1.php b/include/limesurvey/classes/adodb/session/adodb-encrypt-sha1.php index 1fa3c7b7..34e30a49 100644 --- a/include/limesurvey/classes/adodb/session/adodb-encrypt-sha1.php +++ b/include/limesurvey/classes/adodb/session/adodb-encrypt-sha1.php @@ -1,32 +1,32 @@ -encrypt($data, $key); - - } - - - function read($data, $key) - { - $sha1crypt = new SHA1Crypt(); - return $sha1crypt->decrypt($data, $key); - - } -} - - - -return 1; +encrypt($data, $key); + + } + + + function read($data, $key) + { + $sha1crypt = new SHA1Crypt(); + return $sha1crypt->decrypt($data, $key); + + } +} + + + +return 1; ?> \ No newline at end of file diff --git a/include/limesurvey/classes/adodb/session/adodb-sess.txt b/include/limesurvey/classes/adodb/session/adodb-sess.txt index d23dac42..c6c76858 100644 --- a/include/limesurvey/classes/adodb/session/adodb-sess.txt +++ b/include/limesurvey/classes/adodb/session/adodb-sess.txt @@ -1,131 +1,131 @@ -John, - -I have been an extremely satisfied ADODB user for several years now. - -To give you something back for all your hard work, I've spent the last 3 -days rewriting the adodb-session.php code. - ----------- -What's New ----------- - -Here's a list of the new code's benefits: - -* Combines the functionality of the three files: - -adodb-session.php -adodb-session-clob.php -adodb-cryptsession.php - -each with very similar functionality, into a single file adodb-session.php. -This will ease maintenance and support issues. - -* Supports multiple encryption and compression schemes. - Currently, we support: - - MD5Crypt (crypt.inc.php) - MCrypt - Secure (Horde's emulation of MCrypt, if MCrypt module is not available.) - GZip - BZip2 - -These can be stacked, so if you want to compress and then encrypt your -session data, it's easy. -Also, the built-in MCrypt functions will be *much* faster, and more secure, -than the MD5Crypt code. - -* adodb-session.php contains a single class ADODB_Session that encapsulates -all functionality. - This eliminates the use of global vars and defines (though they are -supported for backwards compatibility). - -* All user defined parameters are now static functions in the ADODB_Session -class. - -New parameters include: - -* encryptionKey(): Define the encryption key used to encrypt the session. -Originally, it was a hard coded string. - -* persist(): Define if the database will be opened in persistent mode. -Originally, the user had to call adodb_sess_open(). - -* dataFieldName(): Define the field name used to store the session data, as -'DATA' appears to be a reserved word in the following cases: - ANSI SQL - IBM DB2 - MS SQL Server - Postgres - SAP - -* filter(): Used to support multiple, simulataneous encryption/compression -schemes. - -* Debug support is improved thru _rsdump() function, which is called after -every database call. - ------------- -What's Fixed ------------- - -The new code includes several bug fixes and enhancements: - -* sesskey is compared in BINARY mode for MySQL, to avoid problems with -session keys that differ only by case. - Of course, the user should define the sesskey field as BINARY, to -correctly fix this problem, otherwise performance will suffer. - -* In ADODB_Session::gc(), if $expire_notify is true, the multiple DELETES in -the original code have been optimized to a single DELETE. - -* In ADODB_Session::destroy(), since "SELECT expireref, sesskey FROM $table -WHERE sesskey = $qkey" will only return a single value, we don't loop on the -result, we simply process the row, if any. - -* We close $rs after every use. - ---------------- -What's the Same ---------------- - -I know backwards compatibility is *very* important to you. Therefore, the -new code is 100% backwards compatible. - -If you like my code, but don't "trust" it's backwards compatible, maybe we -offer it as beta code, in a new directory for a release or two? - ------------- -What's To Do ------------- - -I've vascillated over whether to use a single function to get/set -parameters: - -$user = ADODB_Session::user(); // get -ADODB_Session::user($user); // set - -or to use separate functions (which is the PEAR/Java way): - -$user = ADODB_Session::getUser(); -ADODB_Session::setUser($user); - -I've chosen the former as it's makes for a simpler API, and reduces the -amount of code, but I'd be happy to change it to the latter. - -Also, do you think the class should be a singleton class, versus a static -class? - -Let me know if you find this code useful, and will be including it in the -next release of ADODB. - -If so, I will modify the current documentation to detail the new -functionality. To that end, what file(s) contain the documentation? Please -send them to me if they are not publically available. - -Also, if there is *anything* in the code that you like to see changed, let -me know. - -Thanks, - -Ross - +John, + +I have been an extremely satisfied ADODB user for several years now. + +To give you something back for all your hard work, I've spent the last 3 +days rewriting the adodb-session.php code. + +---------- +What's New +---------- + +Here's a list of the new code's benefits: + +* Combines the functionality of the three files: + +adodb-session.php +adodb-session-clob.php +adodb-cryptsession.php + +each with very similar functionality, into a single file adodb-session.php. +This will ease maintenance and support issues. + +* Supports multiple encryption and compression schemes. + Currently, we support: + + MD5Crypt (crypt.inc.php) + MCrypt + Secure (Horde's emulation of MCrypt, if MCrypt module is not available.) + GZip + BZip2 + +These can be stacked, so if you want to compress and then encrypt your +session data, it's easy. +Also, the built-in MCrypt functions will be *much* faster, and more secure, +than the MD5Crypt code. + +* adodb-session.php contains a single class ADODB_Session that encapsulates +all functionality. + This eliminates the use of global vars and defines (though they are +supported for backwards compatibility). + +* All user defined parameters are now static functions in the ADODB_Session +class. + +New parameters include: + +* encryptionKey(): Define the encryption key used to encrypt the session. +Originally, it was a hard coded string. + +* persist(): Define if the database will be opened in persistent mode. +Originally, the user had to call adodb_sess_open(). + +* dataFieldName(): Define the field name used to store the session data, as +'DATA' appears to be a reserved word in the following cases: + ANSI SQL + IBM DB2 + MS SQL Server + Postgres + SAP + +* filter(): Used to support multiple, simulataneous encryption/compression +schemes. + +* Debug support is improved thru _rsdump() function, which is called after +every database call. + +------------ +What's Fixed +------------ + +The new code includes several bug fixes and enhancements: + +* sesskey is compared in BINARY mode for MySQL, to avoid problems with +session keys that differ only by case. + Of course, the user should define the sesskey field as BINARY, to +correctly fix this problem, otherwise performance will suffer. + +* In ADODB_Session::gc(), if $expire_notify is true, the multiple DELETES in +the original code have been optimized to a single DELETE. + +* In ADODB_Session::destroy(), since "SELECT expireref, sesskey FROM $table +WHERE sesskey = $qkey" will only return a single value, we don't loop on the +result, we simply process the row, if any. + +* We close $rs after every use. + +--------------- +What's the Same +--------------- + +I know backwards compatibility is *very* important to you. Therefore, the +new code is 100% backwards compatible. + +If you like my code, but don't "trust" it's backwards compatible, maybe we +offer it as beta code, in a new directory for a release or two? + +------------ +What's To Do +------------ + +I've vascillated over whether to use a single function to get/set +parameters: + +$user = ADODB_Session::user(); // get +ADODB_Session::user($user); // set + +or to use separate functions (which is the PEAR/Java way): + +$user = ADODB_Session::getUser(); +ADODB_Session::setUser($user); + +I've chosen the former as it's makes for a simpler API, and reduces the +amount of code, but I'd be happy to change it to the latter. + +Also, do you think the class should be a singleton class, versus a static +class? + +Let me know if you find this code useful, and will be including it in the +next release of ADODB. + +If so, I will modify the current documentation to detail the new +functionality. To that end, what file(s) contain the documentation? Please +send them to me if they are not publically available. + +Also, if there is *anything* in the code that you like to see changed, let +me know. + +Thanks, + +Ross + diff --git a/include/limesurvey/classes/adodb/xmlschema03.dtd b/include/limesurvey/classes/adodb/xmlschema03.dtd index a7c8864f..97850bc7 100644 --- a/include/limesurvey/classes/adodb/xmlschema03.dtd +++ b/include/limesurvey/classes/adodb/xmlschema03.dtd @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ]> \ No newline at end of file diff --git a/include/limesurvey/classes/core/language.php b/include/limesurvey/classes/core/language.php index ab6dfb37..3078eab9 100644 --- a/include/limesurvey/classes/core/language.php +++ b/include/limesurvey/classes/core/language.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: language.php 9648 2011-01-07 13:06:39Z c_schmitz $ + * $Id: language.php 9247 2010-10-14 21:09:05Z c_schmitz $ * diff --git a/include/limesurvey/classes/core/sanitize.php b/include/limesurvey/classes/core/sanitize.php index fa89dfba..40be7f88 100644 --- a/include/limesurvey/classes/core/sanitize.php +++ b/include/limesurvey/classes/core/sanitize.php @@ -1,377 +1,377 @@ -", "/", "?"); - $lastdot=strrpos($string, "."); - $clean = trim(str_replace($strip, "_", strip_tags($string))); - $clean = preg_replace('/\s+/', "-", $clean); - $clean = ($alphanumeric) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; - if ($lastdot !== false) { - $clean= substr_replace ( $clean , '.' , $lastdot , 1 ); - } - return ($force_lowercase) ? - (function_exists('mb_strtolower')) ? - mb_strtolower($clean, 'UTF-8') : - strtolower($clean) : - $clean; -} - - -// paranoid sanitization -- only let the alphanumeric set through -function sanitize_paranoid_string($string, $min='', $max='') -{ - if (isset($string)) - { - $string = preg_replace("/[^_.a-zA-Z0-9]/", "", $string); - $len = strlen($string); - if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) - return FALSE; - return $string; - } -} - -function sanitize_cquestions($string, $min='', $max='') -{ - if (isset($string)) - { - $string = preg_replace("/[^_.a-zA-Z0-9+#]/", "", $string); - $len = strlen($string); - if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) - return FALSE; - return $string; - } -} - -function sanitize_email($email) { - // Handles now emails separated with a semikolon - $emailarray=explode(';',$email); - for ($i = 0; $i <= count($emailarray)-1; $i++) - { - $emailarray[$i]=preg_replace("/[^`'a-zA-Z0-9;+_=|.$%&#!{*~?}^@-]/i", "", $emailarray[$i]); - } - return implode(';',$emailarray); -} - -// sanitize a string in prep for passing a single argument to system() (or similar) -function sanitize_system_string($string, $min='', $max='') -{ - if (isset($string)) - { - $pattern = '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'; // no piping, passing possible environment variables ($), - // seperate commands, nested execution, file redirection, - // background processing, special commands (backspace, etc.), quotes - // newlines, or some other special characters - $string = preg_replace($pattern, '', $string); - $string = '"'.preg_replace('/\$/', '\\\$', $string).'"'; //make sure this is only interpretted as ONE argument - $len = strlen($string); - if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return FALSE; - return $string; - } -} - -function sanitize_xss_string($string) -{ - if (isset($string)) - { - $bad = array ('*','^','&','\'','-',';','\"','(',')','%','$','?'); - return str_replace($bad, '',$string); - } -} - - - -// sanitize a string for SQL input (simple slash out quotes and slashes) -function sanitize_sql_db_tablename($string) -{ - $bad = array ('*','^','&','\'','-',';','\"','(',')','%','$','?'); - return str_replace($bad, "",$string); -} - -// sanitize a string for SQL input (simple slash out quotes and slashes) -function sanitize_ldap_string($string, $min='', $max='') -{ - $pattern = '/(\)|\(|\||&)/'; - $len = strlen($string); - if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) - return FALSE; - return preg_replace($pattern, '', $string); -} - - -// sanitize a string for HTML (make sure nothing gets interpretted!) -function sanitize_html_string($string) -{ - $pattern[0] = '/\&/'; - $pattern[1] = '//"; - $pattern[3] = '/\n/'; - $pattern[4] = '/"/'; - $pattern[5] = "/'/"; - $pattern[6] = "/%/"; - $pattern[7] = '/\(/'; - $pattern[8] = '/\)/'; - $pattern[9] = '/\+/'; - $pattern[10] = '/-/'; - $replacement[0] = '&'; - $replacement[1] = '<'; - $replacement[2] = '>'; - $replacement[3] = '
                '; - $replacement[4] = '"'; - $replacement[5] = '''; - $replacement[6] = '%'; - $replacement[7] = '('; - $replacement[8] = ')'; - $replacement[9] = '+'; - $replacement[10] = '-'; - return preg_replace($pattern, $replacement, $string); -} - -// make int int! -function sanitize_int($integer, $min='', $max='') -{ - $int = preg_replace("#[^0-9]#", "", $integer); - if((($min != '') && ($int < $min)) || (($max != '') && ($int > $max))) - { - return FALSE; - } - if ($int=='') - { - return null; - } - return $int; -} - -// sanitize a username -// TODO: define the exact format of the username -// allow for instance 0-9a-zA-Z@_-. -function sanitize_user($string) -{ - $username_length=64; - $string=mb_substr($string,0,$username_length); - return $string; -} - -// sanitize a username -// TODO: define the exact format of the username -// allow for instance 0-9a-zA-Z@_-. -function sanitize_userfullname($string) -{ - $username_length=50; - $string=mb_substr($string,0,$username_length); - return $string; -} - -function sanitize_labelname($string) -{ - $labelname_length=100; - $string=mb_substr($string,0,$labelname_length); - return $string; -} - -// make float float! -function sanitize_float($float, $min='', $max='') -{ - $float = str_replace(',','.',$float); - $float = floatval($float); - if((($min != '') && ($float < $min)) || (($max != '') && ($float > $max))) - return FALSE; - return $float; -} - -// glue together all the other functions -function sanitize($input, $flags, $min='', $max='') -{ - if($flags & PARANOID) $input = sanitize_paranoid_string($input, $min, $max); - if($flags & INT) $input = sanitize_int($input, $min, $max); - if($flags & FLOAT) $input = sanitize_float($input, $min, $max); - if($flags & HTML) $input = sanitize_html_string($input, $min, $max); - if($flags & LDAP) $input = sanitize_ldap_string($input, $min, $max); - if($flags & SYSTEM) $input = sanitize_system_string($input, $min, $max); - return $input; -} - -function check_paranoid_string($input, $min='', $max='') -{ - if($input != sanitize_paranoid_string($input, $min, $max)) - return FALSE; - return TRUE; -} - -function check_int($input, $min='', $max='') -{ - if($input != sanitize_int($input, $min, $max)) - return FALSE; - return TRUE; -} - -function check_float($input, $min='', $max='') -{ - if($input != sanitize_float($input, $min, $max)) - return FALSE; - return TRUE; -} - -function check_html_string($input, $min='', $max='') -{ - if($input != sanitize_html_string($input, $min, $max)) - return FALSE; - return TRUE; -} - - -function check_ldap_string($input, $min='', $max='') -{ - if($input != sanitize_string($input, $min, $max)) - return FALSE; - return TRUE; -} - -function check_system_string($input, $min='', $max='') -{ - if($input != sanitize_system_string($input, $min, $max, TRUE)) - return FALSE; - return TRUE; -} - -// glue together all the other functions -function check($input, $flags, $min='', $max='') -{ - $oldput = $input; - if($flags & UTF8) $input = my_utf8_decode($input); - if($flags & PARANOID) $input = sanitize_paranoid_string($input, $min, $max); - if($flags & INT) $input = sanitize_int($input, $min, $max); - if($flags & FLOAT) $input = sanitize_float($input, $min, $max); - if($flags & HTML) $input = sanitize_html_string($input, $min, $max); - if($flags & LDAP) $input = sanitize_ldap_string($input, $min, $max); - if($flags & SYSTEM) $input = sanitize_system_string($input, $min, $max, TRUE); - if($input != $oldput) - return FALSE; - return TRUE; -} - -function sanitize_languagecode($codetosanitize) { - return preg_replace('/[^a-z0-9-]/i', '', $codetosanitize); -} - -function sanitize_languagecodeS($codestringtosanitize) { - $codearray=explode(" ",trim($codestringtosanitize)); - $codearray=array_map("sanitize_languagecode",$codearray); - return implode(" ",$codearray); -} - -function sanitize_token($codetosanitize) { - return preg_replace('/[^_a-z0-9]/i', '', $codetosanitize); -} - -function sanitize_signedint($integer, $min='', $max='') -{ - $int = (int) $integer; - - if((($min != '') && ($int < $min)) || (($max != '') && ($int > $max))) - { - return FALSE; // Oops! Outside limits. - } - - return $int; -}; +", "/", "?"); + $lastdot=strrpos($string, "."); + $clean = trim(str_replace($strip, "_", strip_tags($string))); + $clean = preg_replace('/\s+/', "-", $clean); + $clean = ($alphanumeric) ? preg_replace("/[^a-zA-Z0-9]/", "", $clean) : $clean ; + if ($lastdot !== false) { + $clean= substr_replace ( $clean , '.' , $lastdot , 1 ); + } + return ($force_lowercase) ? + (function_exists('mb_strtolower')) ? + mb_strtolower($clean, 'UTF-8') : + strtolower($clean) : + $clean; +} + + +// paranoid sanitization -- only let the alphanumeric set through +function sanitize_paranoid_string($string, $min='', $max='') +{ + if (isset($string)) + { + $string = preg_replace("/[^_.a-zA-Z0-9]/", "", $string); + $len = strlen($string); + if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) + return FALSE; + return $string; + } +} + +function sanitize_cquestions($string, $min='', $max='') +{ + if (isset($string)) + { + $string = preg_replace("/[^_.a-zA-Z0-9+#]/", "", $string); + $len = strlen($string); + if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) + return FALSE; + return $string; + } +} + +function sanitize_email($email) { + // Handles now emails separated with a semikolon + $emailarray=explode(';',$email); + for ($i = 0; $i <= count($emailarray)-1; $i++) + { + $emailarray[$i]=preg_replace("/[^`'a-zA-Z0-9;+_=|.$%&#!{*~?}^@-]/i", "", $emailarray[$i]); + } + return implode(';',$emailarray); +} + +// sanitize a string in prep for passing a single argument to system() (or similar) +function sanitize_system_string($string, $min='', $max='') +{ + if (isset($string)) + { + $pattern = '/(;|\||`|>|<|&|^|"|'."\n|\r|'".'|{|}|[|]|\)|\()/i'; // no piping, passing possible environment variables ($), + // seperate commands, nested execution, file redirection, + // background processing, special commands (backspace, etc.), quotes + // newlines, or some other special characters + $string = preg_replace($pattern, '', $string); + $string = '"'.preg_replace('/\$/', '\\\$', $string).'"'; //make sure this is only interpretted as ONE argument + $len = strlen($string); + if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) return FALSE; + return $string; + } +} + +function sanitize_xss_string($string) +{ + if (isset($string)) + { + $bad = array ('*','^','&','\'','-',';','\"','(',')','%','$','?'); + return str_replace($bad, '',$string); + } +} + + + +// sanitize a string for SQL input (simple slash out quotes and slashes) +function sanitize_sql_db_tablename($string) +{ + $bad = array ('*','^','&','\'','-',';','\"','(',')','%','$','?'); + return str_replace($bad, "",$string); +} + +// sanitize a string for SQL input (simple slash out quotes and slashes) +function sanitize_ldap_string($string, $min='', $max='') +{ + $pattern = '/(\)|\(|\||&)/'; + $len = strlen($string); + if((($min != '') && ($len < $min)) || (($max != '') && ($len > $max))) + return FALSE; + return preg_replace($pattern, '', $string); +} + + +// sanitize a string for HTML (make sure nothing gets interpretted!) +function sanitize_html_string($string) +{ + $pattern[0] = '/\&/'; + $pattern[1] = '//"; + $pattern[3] = '/\n/'; + $pattern[4] = '/"/'; + $pattern[5] = "/'/"; + $pattern[6] = "/%/"; + $pattern[7] = '/\(/'; + $pattern[8] = '/\)/'; + $pattern[9] = '/\+/'; + $pattern[10] = '/-/'; + $replacement[0] = '&'; + $replacement[1] = '<'; + $replacement[2] = '>'; + $replacement[3] = '
                '; + $replacement[4] = '"'; + $replacement[5] = '''; + $replacement[6] = '%'; + $replacement[7] = '('; + $replacement[8] = ')'; + $replacement[9] = '+'; + $replacement[10] = '-'; + return preg_replace($pattern, $replacement, $string); +} + +// make int int! +function sanitize_int($integer, $min='', $max='') +{ + $int = preg_replace("#[^0-9]#", "", $integer); + if((($min != '') && ($int < $min)) || (($max != '') && ($int > $max))) + { + return FALSE; + } + if ($int=='') + { + return null; + } + return $int; +} + +// sanitize a username +// TODO: define the exact format of the username +// allow for instance 0-9a-zA-Z@_-. +function sanitize_user($string) +{ + $username_length=64; + $string=mb_substr($string,0,$username_length); + return $string; +} + +// sanitize a username +// TODO: define the exact format of the username +// allow for instance 0-9a-zA-Z@_-. +function sanitize_userfullname($string) +{ + $username_length=50; + $string=mb_substr($string,0,$username_length); + return $string; +} + +function sanitize_labelname($string) +{ + $labelname_length=100; + $string=mb_substr($string,0,$labelname_length); + return $string; +} + +// make float float! +function sanitize_float($float, $min='', $max='') +{ + $float = str_replace(',','.',$float); + $float = floatval($float); + if((($min != '') && ($float < $min)) || (($max != '') && ($float > $max))) + return FALSE; + return $float; +} + +// glue together all the other functions +function sanitize($input, $flags, $min='', $max='') +{ + if($flags & PARANOID) $input = sanitize_paranoid_string($input, $min, $max); + if($flags & INT) $input = sanitize_int($input, $min, $max); + if($flags & FLOAT) $input = sanitize_float($input, $min, $max); + if($flags & HTML) $input = sanitize_html_string($input, $min, $max); + if($flags & LDAP) $input = sanitize_ldap_string($input, $min, $max); + if($flags & SYSTEM) $input = sanitize_system_string($input, $min, $max); + return $input; +} + +function check_paranoid_string($input, $min='', $max='') +{ + if($input != sanitize_paranoid_string($input, $min, $max)) + return FALSE; + return TRUE; +} + +function check_int($input, $min='', $max='') +{ + if($input != sanitize_int($input, $min, $max)) + return FALSE; + return TRUE; +} + +function check_float($input, $min='', $max='') +{ + if($input != sanitize_float($input, $min, $max)) + return FALSE; + return TRUE; +} + +function check_html_string($input, $min='', $max='') +{ + if($input != sanitize_html_string($input, $min, $max)) + return FALSE; + return TRUE; +} + + +function check_ldap_string($input, $min='', $max='') +{ + if($input != sanitize_string($input, $min, $max)) + return FALSE; + return TRUE; +} + +function check_system_string($input, $min='', $max='') +{ + if($input != sanitize_system_string($input, $min, $max, TRUE)) + return FALSE; + return TRUE; +} + +// glue together all the other functions +function check($input, $flags, $min='', $max='') +{ + $oldput = $input; + if($flags & UTF8) $input = my_utf8_decode($input); + if($flags & PARANOID) $input = sanitize_paranoid_string($input, $min, $max); + if($flags & INT) $input = sanitize_int($input, $min, $max); + if($flags & FLOAT) $input = sanitize_float($input, $min, $max); + if($flags & HTML) $input = sanitize_html_string($input, $min, $max); + if($flags & LDAP) $input = sanitize_ldap_string($input, $min, $max); + if($flags & SYSTEM) $input = sanitize_system_string($input, $min, $max, TRUE); + if($input != $oldput) + return FALSE; + return TRUE; +} + +function sanitize_languagecode($codetosanitize) { + return preg_replace('/[^a-z0-9-]/i', '', $codetosanitize); +} + +function sanitize_languagecodeS($codestringtosanitize) { + $codearray=explode(" ",trim($codestringtosanitize)); + $codearray=array_map("sanitize_languagecode",$codearray); + return implode(" ",$codearray); +} + +function sanitize_token($codetosanitize) { + return preg_replace('/[^_a-z0-9]/i', '', $codetosanitize); +} + +function sanitize_signedint($integer, $min='', $max='') +{ + $int = (int) $integer; + + if((($min != '') && ($int < $min)) || (($max != '') && ($int > $max))) + { + return FALSE; // Oops! Outside limits. + } + + return $int; +}; diff --git a/include/limesurvey/classes/core/startup.php b/include/limesurvey/classes/core/startup.php index fb8f68b5..f34e924b 100644 --- a/include/limesurvey/classes/core/startup.php +++ b/include/limesurvey/classes/core/startup.php @@ -1,97 +1,97 @@ - true, - '_GET' => true, - '_POST' => true, - '_COOKIE' => true, - '_REQUEST' => true, - '_SERVER' => true, - '_SESSION' => true, - '_ENV' => true, - '_FILES' => true - ); - - // Not only will array_merge and array_keys give a warning if - // a parameter is not an array, array_merge will actually fail. - // So we check if _SESSION has been initialised. - if (!isset($_SESSION) || !is_array($_SESSION)) - { - $_SESSION = array(); - } - - // Merge all into one extremely huge array; unset this later - $input = array_merge( - array_keys($_GET), - array_keys($_POST), - array_keys($_COOKIE), - array_keys($_SERVER), - array_keys($_SESSION), - array_keys($_ENV), - array_keys($_FILES) - ); - - foreach ($input as $varname) - { - if (isset($not_unset[$varname])) - { - // Hacking attempt. No point in continuing. - exit; - } - - unset($GLOBALS[$varname]); - } - - unset($input); -} - -/** - * This function converts a standard # array to a PHP array without having to resort to JSON_decode which is available from 5.2x and up only - * - * @param string $json String with JSON data - * @return array - */ -if ( !function_exists('json_decode') ){ - function json_decode($content, $assoc=false){ - global $homedir; - require_once($homedir."/classes/json/JSON.php"); - if ( $assoc ){ - $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); - } else { - $json = new Services_JSON; - } - return $json->decode($content); - } -} - -if ( !function_exists('json_encode') ){ - function json_encode($content){ - global $homedir; - require_once($homedir."/classes/json/JSON.php"); - $json = new Services_JSON; - return $json->encode($content); - } -} - - -?> + true, + '_GET' => true, + '_POST' => true, + '_COOKIE' => true, + '_REQUEST' => true, + '_SERVER' => true, + '_SESSION' => true, + '_ENV' => true, + '_FILES' => true + ); + + // Not only will array_merge and array_keys give a warning if + // a parameter is not an array, array_merge will actually fail. + // So we check if _SESSION has been initialised. + if (!isset($_SESSION) || !is_array($_SESSION)) + { + $_SESSION = array(); + } + + // Merge all into one extremely huge array; unset this later + $input = array_merge( + array_keys($_GET), + array_keys($_POST), + array_keys($_COOKIE), + array_keys($_SERVER), + array_keys($_SESSION), + array_keys($_ENV), + array_keys($_FILES) + ); + + foreach ($input as $varname) + { + if (isset($not_unset[$varname])) + { + // Hacking attempt. No point in continuing. + exit; + } + + unset($GLOBALS[$varname]); + } + + unset($input); +} + +/** + * This function converts a standard # array to a PHP array without having to resort to JSON_decode which is available from 5.2x and up only + * + * @param string $json String with JSON data + * @return array + */ +if ( !function_exists('json_decode') ){ + function json_decode($content, $assoc=false){ + global $homedir; + require_once($homedir."/classes/json/JSON.php"); + if ( $assoc ){ + $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE); + } else { + $json = new Services_JSON; + } + return $json->decode($content); + } +} + +if ( !function_exists('json_encode') ){ + function json_encode($content){ + global $homedir; + require_once($homedir."/classes/json/JSON.php"); + $json = new Services_JSON; + return $json->encode($content); + } +} + + +?> diff --git a/include/limesurvey/classes/core/surveytranslator.php b/include/limesurvey/classes/core/surveytranslator.php index 69637213..1b9d5970 100644 --- a/include/limesurvey/classes/core/surveytranslator.php +++ b/include/limesurvey/classes/core/surveytranslator.php @@ -1,650 +1,672 @@ - array ('phpdate' => 'd.m.Y', 'jsdate' => 'dd.mm.yy', 'dateformat' => 'dd.mm.yyyy'), - 2=> array ('phpdate' => 'd-m-Y', 'jsdate' => 'dd-mm-yy', 'dateformat' => 'dd-mm-yyyy'), - 5=> array ('phpdate' => 'd/m/Y', 'jsdate' => 'dd/mm/yy', 'dateformat' => 'dd/mm/yyyy'), - 3=> array ('phpdate' => 'Y.m.d', 'jsdate' => 'yy.mm.dd', 'dateformat' => 'yyyy.mm.dd'), - 6=> array ('phpdate' => 'Y-m-d', 'jsdate' => 'yy-mm-dd', 'dateformat' => 'yyyy-mm-dd'), - 7=> array ('phpdate' => 'Y/m/d', 'jsdate' => 'yy/mm/dd', 'dateformat' => 'yyyy/mm/dd'), - 4=> array ('phpdate' => 'j.n.Y', 'jsdate' => 'd.m.yy', 'dateformat' => 'd.m.yyyy'), - 12=>array ('phpdate' => 'j-n-Y', 'jsdate' => 'd-m-yy', 'dateformat' => 'd-m-yyyy'), - 8=> array ('phpdate' => 'j/n/Y', 'jsdate' => 'd/m/yy', 'dateformat' => 'd/m/yyyy'), - 9=> array ('phpdate' => 'm-d-Y', 'jsdate' => 'mm-dd-yy', 'dateformat' => 'mm-dd-yyyy'), - 10=>array ('phpdate' => 'm.d.Y', 'jsdate' => 'mm.dd.yy', 'dateformat' => 'mm.dd.yyyy'), - 11=>array ('phpdate' => 'm/d/Y', 'jsdate' => 'mm/dd/yy', 'dateformat' => 'mm/dd/yyyy') - ); - - if ($format >0) - { - return $dateformats[$format]; - } - else - return $dateformats; - -} - -/** - * Returns avaliable formats for Radix Points (Decimal Seperators) or returns - * radix point info about a specific format. - * - * @param int $format Format ID/Number [optional] - */ - -function getRadixPointData($format=-1) -{ - global $clang; - $aRadixFormats = array ( - 0=>array('seperator'=> '.', 'desc'=> $clang->gT('Dot (.)')), - 1=>array('seperator'=> ',', 'desc'=> $clang->gT('Comma (,)')) - ); - - if ($format >= 0) - return $aRadixFormats[$format]; - else - return $aRadixFormats; -} - - -function getLanguageCodefromLanguage($languagetosearch) -{ - $detaillanguages = getLanguageData(); - foreach ($detaillanguages as $key2=>$languagename) - { - if ($languagetosearch==$languagename['description']) - { - return $key2; - } - } - // else return default en code - return "en"; -} - - - - -function getLanguageNameFromCode($codetosearch, $withnative=true) -{ - $detaillanguages = getLanguageData(); - if (isset($detaillanguages[$codetosearch]['description'])) - { - if ($withnative) { - return $detaillanguages[$codetosearch]['description'].' - '.$detaillanguages[$codetosearch]['nativedescription']; - } - else { return $detaillanguages[$codetosearch]['description'];} - } - else - // else return default en code - return false; -} - - -function getLanguageRTL($codetosearch) -{ - $detaillanguages = getLanguageData(); - if (isset($detaillanguages[$codetosearch]['rtl'])) - { - return $detaillanguages[$codetosearch]['rtl']; - } - else - { - return false; - } -} - -/** - * Returns the locale settings for a certain language code - * - * @param string $codetosearch - * @return array Array with locale details - * - */ -function getLanguageDetails($codetosearch) -{ - $detaillanguages = getLanguageData(); - if (isset($detaillanguages[$codetosearch])) - { - return $detaillanguages[$codetosearch]; - } - else - { - return $detaillanguages['en']; - } -} - -function getLanguageData($orderbynative=false) { - global $clang; - static $supportedLanguages; - static $result = array(); - - if (isset($result[$orderbynative])) return $result[$orderbynative]; - - if (!isset($supportedLanguages)) { - // Albanian - $supportedLanguages['sq']['description'] = $clang->gT('Albanian'); - $supportedLanguages['sq']['nativedescription'] = 'Shqipe'; - $supportedLanguages['sq']['rtl'] = false; - $supportedLanguages['sq']['dateformat'] = 1; - $supportedLanguages['sq']['radixpoint'] = 1; - - // Arabic - $supportedLanguages['ar']['description'] = $clang->gT('Arabic'); - $supportedLanguages['ar']['nativedescription'] = 'عَرَبيْ'; - $supportedLanguages['ar']['rtl'] = true; - $supportedLanguages['ar']['dateformat'] = 2; - $supportedLanguages['ar']['radixpoint'] = 0; - - // Basque - $supportedLanguages['eu']['description'] = $clang->gT('Basque'); - $supportedLanguages['eu']['nativedescription'] = 'Euskara'; - $supportedLanguages['eu']['rtl'] = false; - $supportedLanguages['eu']['dateformat'] = 3; - $supportedLanguages['eu']['radixpoint'] = 1; - - // Belarusian - $supportedLanguages['be']['description'] = $clang->gT('Belarusian'); - $supportedLanguages['be']['nativedescription'] = 'Беларускі'; - $supportedLanguages['be']['rtl'] = false; - $supportedLanguages['be']['dateformat'] = 1; - $supportedLanguages['be']['radixpoint'] = 1; - - // Bosnian - $supportedLanguages['bs']['description'] = $clang->gT('Bosnian'); - $supportedLanguages['bs']['nativedescription'] = 'Bosanski'; - $supportedLanguages['bs']['rtl'] = false; - $supportedLanguages['bs']['dateformat'] = 4; - $supportedLanguages['bs']['radixpoint'] = 0; - - // Bulgarian - $supportedLanguages['bg']['description'] = $clang->gT('Bulgarian'); - $supportedLanguages['bg']['nativedescription'] = 'Български'; - $supportedLanguages['bg']['rtl'] = false; - $supportedLanguages['bg']['dateformat'] = 1; - $supportedLanguages['bg']['radixpoint'] = 0; - - // Catalan - $supportedLanguages['ca']['description'] = $clang->gT('Catalan'); - $supportedLanguages['ca']['nativedescription'] = 'Catalά'; - $supportedLanguages['ca']['rtl'] = false; - $supportedLanguages['ca']['dateformat'] = 1; - $supportedLanguages['ca']['radixpoint'] = 1; - - // Welsh - $supportedLanguages['cy']['description'] = $clang->gT('Welsh'); - $supportedLanguages['cy']['nativedescription'] = 'Cymraeg'; - $supportedLanguages['cy']['rtl'] = false; - $supportedLanguages['cy']['dateformat'] = 5; - $supportedLanguages['cy']['radixpoint'] = 0; - - // Chinese (Simplified) - $supportedLanguages['zh-Hans']['description'] = $clang->gT('Chinese (Simplified)'); - $supportedLanguages['zh-Hans']['nativedescription'] = '简体中文'; - $supportedLanguages['zh-Hans']['rtl'] = false; - $supportedLanguages['zh-Hans']['dateformat'] = 6; - $supportedLanguages['zh-Hans']['radixpoint'] = 0; - - // Chinese (Traditional - Hong Kong) - $supportedLanguages['zh-Hant-HK']['description'] = $clang->gT('Chinese (Traditional - Hong Kong)'); - $supportedLanguages['zh-Hant-HK']['nativedescription'] = '繁體中文語系'; - $supportedLanguages['zh-Hant-HK']['rtl'] = false; - $supportedLanguages['zh-Hant-HK']['dateformat'] = 6; - $supportedLanguages['zh-Hant-HK']['radixpoint'] = 0; - - // Chinese (Traditional - Taiwan) - $supportedLanguages['zh-Hant-TW']['description'] = $clang->gT('Chinese (Traditional - Taiwan)'); - $supportedLanguages['zh-Hant-TW']['nativedescription'] = 'Chinese (Traditional - Taiwan)'; - $supportedLanguages['zh-Hant-TW']['rtl'] = false; - $supportedLanguages['zh-Hant-TW']['dateformat'] = 6; - $supportedLanguages['zh-Hant-TW']['radixpoint'] = 0; - - // Croatian - $supportedLanguages['hr']['description'] = $clang->gT('Croatian'); - $supportedLanguages['hr']['nativedescription'] = 'Hrvatski'; - $supportedLanguages['hr']['rtl'] = false; - $supportedLanguages['hr']['dateformat'] = 4; - $supportedLanguages['hr']['radixpoint'] = 1; - - // Czech - $supportedLanguages['cs']['description'] = $clang->gT('Czech'); - $supportedLanguages['cs']['nativedescription'] = 'Česky'; - $supportedLanguages['cs']['rtl'] = false; - $supportedLanguages['cs']['dateformat'] = 4; - $supportedLanguages['cs']['radixpoint'] = 1; - - // Danish - $supportedLanguages['da']['description'] = $clang->gT('Danish'); - $supportedLanguages['da']['nativedescription'] = 'Dansk'; - $supportedLanguages['da']['rtl'] = false; - $supportedLanguages['da']['dateformat'] = 2; - $supportedLanguages['da']['radixpoint'] = 1; - - // Dutch - $supportedLanguages['nl']['description'] = $clang->gT('Dutch'); - $supportedLanguages['nl']['nativedescription'] = 'Nederlands'; - $supportedLanguages['nl']['rtl'] = false; - $supportedLanguages['nl']['dateformat'] = 2; - $supportedLanguages['nl']['radixpoint'] = 1; - - // Dutch - $supportedLanguages['nl-informal']['description'] = $clang->gT('Dutch Informal'); - $supportedLanguages['nl-informal']['nativedescription'] = 'Nederlands (informeel)'; - $supportedLanguages['nl-informal']['rtl'] = false; - $supportedLanguages['nl-informal']['dateformat'] = 2; - $supportedLanguages['nl-informal']['radixpoint'] = 1; - - // English - $supportedLanguages['en']['description'] = $clang->gT('English'); - $supportedLanguages['en']['nativedescription'] = 'English'; - $supportedLanguages['en']['rtl'] = false; - $supportedLanguages['en']['dateformat'] = 9; - $supportedLanguages['en']['radixpoint'] = 0; - - // Estonian - $supportedLanguages['et']['description'] = $clang->gT('Estonian'); - $supportedLanguages['et']['nativedescription'] = 'Eesti'; - $supportedLanguages['et']['rtl'] = false; - $supportedLanguages['et']['dateformat'] = 4; - $supportedLanguages['et']['radixpoint'] = 1; - - // Finnish - $supportedLanguages['fi']['description'] = $clang->gT('Finnish'); - $supportedLanguages['fi']['nativedescription'] = 'Suomi'; - $supportedLanguages['fi']['rtl'] = false; - $supportedLanguages['fi']['dateformat'] = 4; - $supportedLanguages['fi']['radixpoint'] = 1; - - // French - $supportedLanguages['fr']['description'] = $clang->gT('French'); - $supportedLanguages['fr']['nativedescription'] = 'Français'; - $supportedLanguages['fr']['rtl'] = false; - $supportedLanguages['fr']['dateformat'] = 2; - $supportedLanguages['fr']['radixpoint'] = 1; - - // Galician - $supportedLanguages['gl']['description'] = $clang->gT('Galician'); - $supportedLanguages['gl']['nativedescription'] = 'Galego'; - $supportedLanguages['gl']['rtl'] = false; - $supportedLanguages['gl']['dateformat'] = 5; - $supportedLanguages['gl']['radixpoint'] = 1; - - // German - $supportedLanguages['de']['description'] = $clang->gT('German'); - $supportedLanguages['de']['nativedescription'] = 'Deutsch'; - $supportedLanguages['de']['rtl'] = false; - $supportedLanguages['de']['dateformat'] = 1; - $supportedLanguages['de']['radixpoint'] = 1; - - // German informal - $supportedLanguages['de-informal']['description'] = $clang->gT('German informal'); - $supportedLanguages['de-informal']['nativedescription'] = 'Deutsch (Du)'; - $supportedLanguages['de-informal']['rtl'] = false; - $supportedLanguages['de-informal']['dateformat'] = 1; - $supportedLanguages['de-informal']['radixpoint'] = 1; - - // Greek - $supportedLanguages['el']['description'] = $clang->gT('Greek'); - $supportedLanguages['el']['nativedescription'] = 'ελληνικά'; - $supportedLanguages['el']['rtl'] = false; - $supportedLanguages['el']['dateformat'] = 8; - $supportedLanguages['el']['radixpoint'] = 1; - - // Hindi - $supportedLanguages['hi']['description'] = $clang->gT('Hindi'); - $supportedLanguages['hi']['nativedescription'] = 'हिन्दी'; - $supportedLanguages['hi']['rtl'] = false; - $supportedLanguages['hi']['dateformat'] = 2; - $supportedLanguages['hi']['radixpoint'] = 0; - - // Hebrew - $supportedLanguages['he']['description'] = $clang->gT('Hebrew'); - $supportedLanguages['he']['nativedescription'] = ' עברית'; - $supportedLanguages['he']['rtl'] = true; - $supportedLanguages['he']['dateformat'] = 5; - $supportedLanguages['he']['radixpoint'] = 0; - - // Hungarian - $supportedLanguages['hu']['description'] = $clang->gT('Hungarian'); - $supportedLanguages['hu']['nativedescription'] = 'Magyar'; - $supportedLanguages['hu']['rtl'] = false; - $supportedLanguages['hu']['dateformat'] = 6; - $supportedLanguages['hu']['radixpoint'] = 1; - - // Icelandic - $supportedLanguages['is']['description'] = $clang->gT('Icelandic'); - $supportedLanguages['is']['nativedescription'] = 'íslenska'; - $supportedLanguages['is']['rtl'] = false; - $supportedLanguages['is']['dateformat'] = 1; - $supportedLanguages['is']['radixpoint'] = 1; - - // Indonesian - $supportedLanguages['id']['description'] = $clang->gT('Indonesian'); - $supportedLanguages['id']['nativedescription'] = 'Bahasa Indonesia'; - $supportedLanguages['id']['rtl'] = false; - $supportedLanguages['id']['dateformat'] = 5; - $supportedLanguages['id']['radixpoint'] = 1; - - // Irish - $supportedLanguages['ie']['description'] = $clang->gT('Irish'); - $supportedLanguages['ie']['nativedescription'] = 'Gaeilge'; - $supportedLanguages['ie']['rtl'] = false; - $supportedLanguages['ie']['dateformat'] = 2; - $supportedLanguages['ie']['radixpoint'] = 0; - - // Italian - $supportedLanguages['it']['description'] = $clang->gT('Italian'); - $supportedLanguages['it']['nativedescription'] = 'Italiano'; - $supportedLanguages['it']['rtl'] = false; - $supportedLanguages['it']['dateformat'] = 5; - $supportedLanguages['it']['radixpoint'] = 1; - - // Italian-Formal - $supportedLanguages['it-formal']['description'] = $clang->gT('Italian (formal)'); - $supportedLanguages['it-formal']['nativedescription'] = 'Formale Italiano'; - $supportedLanguages['it-formal']['rtl'] = false; - $supportedLanguages['it-formal']['dateformat'] = 5; - $supportedLanguages['it-formal']['radixpoint'] = 1; - - // Japanese - $supportedLanguages['ja']['description'] = $clang->gT('Japanese'); - $supportedLanguages['ja']['nativedescription'] = '日本語'; - $supportedLanguages['ja']['rtl'] = false; - $supportedLanguages['ja']['dateformat'] = 6; - $supportedLanguages['ja']['radixpoint'] = 0; - - // Korean - $supportedLanguages['ko']['description'] = $clang->gT('Korean'); - $supportedLanguages['ko']['nativedescription'] = '한국어'; - $supportedLanguages['ko']['rtl'] = false; - $supportedLanguages['ko']['dateformat'] = 7; - $supportedLanguages['ko']['radixpoint'] = 0; - - // Lithuanian - $supportedLanguages['lt']['description'] = $clang->gT('Lithuanian'); - $supportedLanguages['lt']['nativedescription'] = 'Lietuvių'; - $supportedLanguages['lt']['rtl'] = false; - $supportedLanguages['lt']['dateformat'] = 6; - $supportedLanguages['lt']['radixpoint'] = 1; - - // Latvian - $supportedLanguages['lv']['description'] = $clang->gT('Latvian'); - $supportedLanguages['lv']['nativedescription'] = 'Latviešu'; - $supportedLanguages['lv']['rtl'] = false; - $supportedLanguages['lv']['dateformat'] = 6; - $supportedLanguages['lv']['radixpoint'] = 1; - - // Macedonian - $supportedLanguages['mk']['description'] = $clang->gT('Macedonian'); - $supportedLanguages['mk']['nativedescription'] = 'Македонски'; - $supportedLanguages['mk']['rtl'] = false; - $supportedLanguages['mk']['dateformat'] = 1; - $supportedLanguages['mk']['radixpoint'] = 1; - - // Malay - $supportedLanguages['ms']['description'] = $clang->gT('Malay'); - $supportedLanguages['ms']['nativedescription'] = 'Bahasa Melayu'; - $supportedLanguages['ms']['rtl'] = false; - $supportedLanguages['ms']['dateformat'] = 1; - $supportedLanguages['ms']['radixpoint'] = 0; - - // Maltese - $supportedLanguages['mt']['description'] = $clang->gT('Maltese'); - $supportedLanguages['mt']['nativedescription'] = 'Malti'; - $supportedLanguages['mt']['rtl'] = false; - $supportedLanguages['mt']['dateformat'] = 1; - $supportedLanguages['mt']['radixpoint'] = 0; - - // Norwegian Bokmal - $supportedLanguages['nb']['description'] = $clang->gT('Norwegian (Bokmal)'); - $supportedLanguages['nb']['nativedescription'] = 'Norsk Bokmål'; - $supportedLanguages['nb']['rtl'] = false; - $supportedLanguages['nb']['dateformat'] = 4; - $supportedLanguages['nb']['radixpoint'] = 1; - - // Norwegian Nynorsk - $supportedLanguages['nn']['description'] = $clang->gT('Norwegian (Nynorsk)'); - $supportedLanguages['nn']['nativedescription'] = 'Norsk Nynorsk'; - $supportedLanguages['nn']['rtl'] = false; - $supportedLanguages['nn']['dateformat'] = 4; - $supportedLanguages['nn']['radixpoint'] = 1; - - // Persian - $supportedLanguages['fa']['description'] = $clang->gT('Persian'); - $supportedLanguages['fa']['nativedescription'] = 'فارسی'; - $supportedLanguages['fa']['rtl'] = true; - $supportedLanguages['fa']['dateformat'] = 6; - $supportedLanguages['fa']['radixpoint'] = 0; - - // Polish - $supportedLanguages['pl']['description'] = $clang->gT('Polish'); - $supportedLanguages['pl']['nativedescription'] = 'Polski'; - $supportedLanguages['pl']['rtl'] = false; - $supportedLanguages['pl']['dateformat'] = 1; - $supportedLanguages['pl']['radixpoint'] = 1; - - // Portuguese - $supportedLanguages['pt']['description'] = $clang->gT('Portuguese'); - $supportedLanguages['pt']['nativedescription'] = 'Português'; - $supportedLanguages['pt']['rtl'] = false; - $supportedLanguages['pt']['dateformat'] = 5; - $supportedLanguages['pt']['radixpoint'] = 1; - - // Brazilian Portuguese - $supportedLanguages['pt-BR']['description'] = $clang->gT('Portuguese (Brazilian)'); - $supportedLanguages['pt-BR']['nativedescription'] = 'Português do Brasil'; - $supportedLanguages['pt-BR']['rtl'] = false; - $supportedLanguages['pt-BR']['dateformat'] = 5; - $supportedLanguages['pt-BR']['radixpoint'] = 1; - - // Punjabi - $supportedLanguages['pa']['description'] = $clang->gT('Punjabi'); - $supportedLanguages['pa']['nativedescription'] = 'ਪੰਜਾਬੀ'; - $supportedLanguages['pa']['rtl'] = false; - $supportedLanguages['pa']['dateformat'] = 2; - $supportedLanguages['pa']['radixpoint'] = 0; - - // Russian - $supportedLanguages['ru']['description'] = $clang->gT('Russian'); - $supportedLanguages['ru']['nativedescription'] = 'Русский'; - $supportedLanguages['ru']['rtl'] = false; - $supportedLanguages['ru']['dateformat'] = 1; - $supportedLanguages['ru']['radixpoint'] = 1; - - // Romanian - $supportedLanguages['ro']['description'] = $clang->gT('Romanian'); - $supportedLanguages['ro']['nativedescription'] = 'Românesc'; - $supportedLanguages['ro']['rtl'] = false; - $supportedLanguages['ro']['dateformat'] = 1; - $supportedLanguages['ro']['radixpoint'] = 1; - - // Slovak - $supportedLanguages['sk']['description'] = $clang->gT('Slovak'); - $supportedLanguages['sk']['nativedescription'] = 'Slovák'; - $supportedLanguages['sk']['rtl'] = false; - $supportedLanguages['sk']['dateformat'] = 4; - $supportedLanguages['sk']['radixpoint'] = 1; - - // Sinhala - $supportedLanguages['si']['description'] = $clang->gT('Sinhala'); - $supportedLanguages['si']['nativedescription'] = 'සිංහල'; - $supportedLanguages['si']['rtl'] = false; - $supportedLanguages['si']['dateformat'] = 5; - $supportedLanguages['si']['radixpoint'] = 0; - - // Slovenian - $supportedLanguages['sl']['description'] = $clang->gT('Slovenian'); - $supportedLanguages['sl']['nativedescription'] = 'Slovenščina'; - $supportedLanguages['sl']['rtl'] = false; - $supportedLanguages['sl']['dateformat'] = 4; - $supportedLanguages['sl']['radixpoint'] = 1; - - // Serbian - $supportedLanguages['sr']['description'] = $clang->gT('Serbian'); - $supportedLanguages['sr']['nativedescription'] = 'Srpski'; - $supportedLanguages['sr']['rtl'] = false; - $supportedLanguages['sr']['dateformat'] = 4; - $supportedLanguages['sr']['radixpoint'] = 1; - - // Spanish - $supportedLanguages['es']['description'] = $clang->gT('Spanish'); - $supportedLanguages['es']['nativedescription'] = 'Español'; - $supportedLanguages['es']['rtl'] = false; - $supportedLanguages['es']['dateformat'] = 5; - $supportedLanguages['es']['radixpoint'] = 1; - - // Spanish (Mexico) - $supportedLanguages['es-MX']['description'] = $clang->gT('Spanish (Mexico)'); - $supportedLanguages['es-MX']['nativedescription'] = 'Español Mejicano'; - $supportedLanguages['es-MX']['rtl'] = false; - $supportedLanguages['es-MX']['dateformat'] = 5; - $supportedLanguages['es-MX']['radixpoint'] = 0; - - // Swedish - $supportedLanguages['sv']['description'] = $clang->gT('Swedish'); - $supportedLanguages['sv']['nativedescription'] = 'Svenska'; - $supportedLanguages['sv']['rtl'] = false; - $supportedLanguages['sv']['dateformat'] = 6; - $supportedLanguages['sv']['radixpoint'] = 1; - - // Turkish - $supportedLanguages['tr']['description'] = $clang->gT('Turkish'); - $supportedLanguages['tr']['nativedescription'] = 'Türkçe'; - $supportedLanguages['tr']['rtl'] = false; - $supportedLanguages['tr']['dateformat'] = 5; - $supportedLanguages['tr']['radixpoint'] = 1; - - // Thai - $supportedLanguages['th']['description'] = $clang->gT('Thai'); - $supportedLanguages['th']['nativedescription'] = 'ภาษาไทย'; - $supportedLanguages['th']['rtl'] = false; - $supportedLanguages['th']['dateformat'] = 5; - $supportedLanguages['th']['radixpoint'] = 0; - - - //Urdu - $supportedLanguages['ur']['description'] = $clang->gT('Urdu'); - $supportedLanguages['ur']['nativedescription'] = 'اردو'; - $supportedLanguages['ur']['rtl'] = true; - $supportedLanguages['ur']['dateformat'] = 2; - $supportedLanguages['ur']['radixpoint'] = 0; - - // Vietnamese - $supportedLanguages['vi']['description'] = $clang->gT('Vietnamese'); - $supportedLanguages['vi']['nativedescription'] = 'Tiếng Việt'; - $supportedLanguages['vi']['rtl'] = false; - $supportedLanguages['vi']['dateformat'] = 5; - $supportedLanguages['vi']['radixpoint'] = 1; - } - - if ($orderbynative) - { - uasort($supportedLanguages,"user_sort_native"); - } - else - { - uasort($supportedLanguages,"user_sort"); - } - - $result[$orderbynative] = $supportedLanguages; - - Return $supportedLanguages; -} - -function user_sort($a, $b) { - - // smarts is all-important, so sort it first - if($a['description'] >$b['description']) { - return 1; - } - else { - return -1; - } -} - -function user_sort_native($a, $b) { - - // smarts is all-important, so sort it first - if($a['nativedescription'] >$b['nativedescription']) { - return 1; - } - else { - return -1; - } -} - - -/* // future languages - // Afrikaans - $supportedLanguages['za']['nativedescription'] = 'Afrikaans'; - // Irish - $supportedLanguages['ie']['nativedescription'] = 'Gaeilge'; - // Serbian - $supportedLanguages['yu']['nativedescription'] = 'Srpski'; - */ - - -/** - * This function support the ability NOT to reverse numbers (for example when you output - * a phrase as a parameter for a SWF file that can't handle RTL languages itself, but - * obviously any numbers should remain the same as in the original phrase). - * Note that it can be used just as well for UTF-8 usages if you want the numbers to remain intact - * - * @param string $str - * @param boolean $reverse_numbers - * @return string - */ -function utf8_strrev($str, $reverse_numbers=false) { - preg_match_all('/./us', $str, $ar); - if ($reverse_numbers) - return join('',array_reverse($ar[0])); - else { - $temp = array(); - foreach ($ar[0] as $value) { - if (is_numeric($value) && !empty($temp[0]) && is_numeric($temp[0])) { - foreach ($temp as $key => $value2) { - if (is_numeric($value2)) - $pos = ($key + 1); - else - break; - } - $temp2 = array_splice($temp, $pos); - $temp = array_merge($temp, array($value), $temp2); - } else - array_unshift($temp, $value); - } - return implode('', $temp); - } -} - -?> + array ('phpdate' => 'd.m.Y', 'jsdate' => 'dd.mm.yy', 'dateformat' => 'dd.mm.yyyy'), + 2=> array ('phpdate' => 'd-m-Y', 'jsdate' => 'dd-mm-yy', 'dateformat' => 'dd-mm-yyyy'), + 5=> array ('phpdate' => 'd/m/Y', 'jsdate' => 'dd/mm/yy', 'dateformat' => 'dd/mm/yyyy'), + 3=> array ('phpdate' => 'Y.m.d', 'jsdate' => 'yy.mm.dd', 'dateformat' => 'yyyy.mm.dd'), + 6=> array ('phpdate' => 'Y-m-d', 'jsdate' => 'yy-mm-dd', 'dateformat' => 'yyyy-mm-dd'), + 7=> array ('phpdate' => 'Y/m/d', 'jsdate' => 'yy/mm/dd', 'dateformat' => 'yyyy/mm/dd'), + 4=> array ('phpdate' => 'j.n.Y', 'jsdate' => 'd.m.yy', 'dateformat' => 'd.m.yyyy'), + 12=>array ('phpdate' => 'j-n-Y', 'jsdate' => 'd-m-yy', 'dateformat' => 'd-m-yyyy'), + 8=> array ('phpdate' => 'j/n/Y', 'jsdate' => 'd/m/yy', 'dateformat' => 'd/m/yyyy'), + 9=> array ('phpdate' => 'm-d-Y', 'jsdate' => 'mm-dd-yy', 'dateformat' => 'mm-dd-yyyy'), + 10=>array ('phpdate' => 'm.d.Y', 'jsdate' => 'mm.dd.yy', 'dateformat' => 'mm.dd.yyyy'), + 11=>array ('phpdate' => 'm/d/Y', 'jsdate' => 'mm/dd/yy', 'dateformat' => 'mm/dd/yyyy') + ); + + if ($format >0) + { + return $dateformats[$format]; + } + else + return $dateformats; + +} + +/** + * Returns avaliable formats for Radix Points (Decimal Seperators) or returns + * radix point info about a specific format. + * + * @param int $format Format ID/Number [optional] + */ + +function getRadixPointData($format=-1) +{ + global $clang; + $aRadixFormats = array ( + 0=>array('seperator'=> '.', 'desc'=> $clang->gT('Dot (.)')), + 1=>array('seperator'=> ',', 'desc'=> $clang->gT('Comma (,)')) + ); + + if ($format >= 0) + return $aRadixFormats[$format]; + else + return $aRadixFormats; +} + + +function getLanguageCodefromLanguage($languagetosearch) +{ + $detaillanguages = getLanguageData(); + foreach ($detaillanguages as $key2=>$languagename) + { + if ($languagetosearch==$languagename['description']) + { + return $key2; + } + } + // else return default en code + return "en"; +} + + + + +function getLanguageNameFromCode($codetosearch, $withnative=true) +{ + $detaillanguages = getLanguageData(); + if (isset($detaillanguages[$codetosearch]['description'])) + { + if ($withnative) { + return $detaillanguages[$codetosearch]['description'].' - '.$detaillanguages[$codetosearch]['nativedescription']; + } + else { return $detaillanguages[$codetosearch]['description'];} + } + else + // else return default en code + return false; +} + + +function getLanguageRTL($codetosearch) +{ + $detaillanguages = getLanguageData(); + if (isset($detaillanguages[$codetosearch]['rtl'])) + { + return $detaillanguages[$codetosearch]['rtl']; + } + else + { + return false; + } +} + +/** + * Returns the locale settings for a certain language code + * + * @param string $codetosearch + * @return array Array with locale details + * + */ +function getLanguageDetails($codetosearch) +{ + $detaillanguages = getLanguageData(); + if (isset($detaillanguages[$codetosearch])) + { + return $detaillanguages[$codetosearch]; + } + else + { + return $detaillanguages['en']; + } +} + +function getLanguageData($orderbynative=false) { + global $clang; + static $supportedLanguages; + static $result = array(); + + if (isset($result[$orderbynative])) return $result[$orderbynative]; + + if (!isset($supportedLanguages)) { + + // Afrikaans + $supportedLanguages['af']['description'] = $clang->gT('Afrikaans'); + $supportedLanguages['af']['nativedescription'] = 'Afrikaans'; + $supportedLanguages['af']['rtl'] = false; + $supportedLanguages['af']['dateformat'] = 2; + $supportedLanguages['af']['radixpoint'] = 1; + + // Amharic + $supportedLanguages['am']['description'] = $clang->gT('Amharic'); + $supportedLanguages['am']['nativedescription'] = 'አማርኛ'; + $supportedLanguages['am']['rtl'] = false; + $supportedLanguages['am']['dateformat'] = 2; + $supportedLanguages['am']['radixpoint'] = 1; + + // Albanian + $supportedLanguages['sq']['description'] = $clang->gT('Albanian'); + $supportedLanguages['sq']['nativedescription'] = 'Shqipe'; + $supportedLanguages['sq']['rtl'] = false; + $supportedLanguages['sq']['dateformat'] = 1; + $supportedLanguages['sq']['radixpoint'] = 1; + + // Arabic + $supportedLanguages['ar']['description'] = $clang->gT('Arabic'); + $supportedLanguages['ar']['nativedescription'] = 'عَرَبيْ'; + $supportedLanguages['ar']['rtl'] = true; + $supportedLanguages['ar']['dateformat'] = 2; + $supportedLanguages['ar']['radixpoint'] = 0; + + // Basque + $supportedLanguages['eu']['description'] = $clang->gT('Basque'); + $supportedLanguages['eu']['nativedescription'] = 'Euskara'; + $supportedLanguages['eu']['rtl'] = false; + $supportedLanguages['eu']['dateformat'] = 3; + $supportedLanguages['eu']['radixpoint'] = 1; + + // Belarusian + $supportedLanguages['be']['description'] = $clang->gT('Belarusian'); + $supportedLanguages['be']['nativedescription'] = 'Беларускі'; + $supportedLanguages['be']['rtl'] = false; + $supportedLanguages['be']['dateformat'] = 1; + $supportedLanguages['be']['radixpoint'] = 1; + + // Bosnian + $supportedLanguages['bs']['description'] = $clang->gT('Bosnian'); + $supportedLanguages['bs']['nativedescription'] = 'Bosanski'; + $supportedLanguages['bs']['rtl'] = false; + $supportedLanguages['bs']['dateformat'] = 4; + $supportedLanguages['bs']['radixpoint'] = 0; + + // Bulgarian + $supportedLanguages['bg']['description'] = $clang->gT('Bulgarian'); + $supportedLanguages['bg']['nativedescription'] = 'Български'; + $supportedLanguages['bg']['rtl'] = false; + $supportedLanguages['bg']['dateformat'] = 1; + $supportedLanguages['bg']['radixpoint'] = 0; + + // Catalan + $supportedLanguages['ca']['description'] = $clang->gT('Catalan'); + $supportedLanguages['ca']['nativedescription'] = 'Catalά'; + $supportedLanguages['ca']['rtl'] = false; + $supportedLanguages['ca']['dateformat'] = 1; + $supportedLanguages['ca']['radixpoint'] = 1; + + // Welsh + $supportedLanguages['cy']['description'] = $clang->gT('Welsh'); + $supportedLanguages['cy']['nativedescription'] = 'Cymraeg'; + $supportedLanguages['cy']['rtl'] = false; + $supportedLanguages['cy']['dateformat'] = 5; + $supportedLanguages['cy']['radixpoint'] = 0; + + // Chinese (Simplified) + $supportedLanguages['zh-Hans']['description'] = $clang->gT('Chinese (Simplified)'); + $supportedLanguages['zh-Hans']['nativedescription'] = '简体中文'; + $supportedLanguages['zh-Hans']['rtl'] = false; + $supportedLanguages['zh-Hans']['dateformat'] = 6; + $supportedLanguages['zh-Hans']['radixpoint'] = 0; + + // Chinese (Traditional - Hong Kong) + $supportedLanguages['zh-Hant-HK']['description'] = $clang->gT('Chinese (Traditional - Hong Kong)'); + $supportedLanguages['zh-Hant-HK']['nativedescription'] = '繁體中文語系'; + $supportedLanguages['zh-Hant-HK']['rtl'] = false; + $supportedLanguages['zh-Hant-HK']['dateformat'] = 6; + $supportedLanguages['zh-Hant-HK']['radixpoint'] = 0; + + // Chinese (Traditional - Taiwan) + $supportedLanguages['zh-Hant-TW']['description'] = $clang->gT('Chinese (Traditional - Taiwan)'); + $supportedLanguages['zh-Hant-TW']['nativedescription'] = 'Chinese (Traditional - Taiwan)'; + $supportedLanguages['zh-Hant-TW']['rtl'] = false; + $supportedLanguages['zh-Hant-TW']['dateformat'] = 6; + $supportedLanguages['zh-Hant-TW']['radixpoint'] = 0; + + // Croatian + $supportedLanguages['hr']['description'] = $clang->gT('Croatian'); + $supportedLanguages['hr']['nativedescription'] = 'Hrvatski'; + $supportedLanguages['hr']['rtl'] = false; + $supportedLanguages['hr']['dateformat'] = 4; + $supportedLanguages['hr']['radixpoint'] = 1; + + // Czech + $supportedLanguages['cs']['description'] = $clang->gT('Czech'); + $supportedLanguages['cs']['nativedescription'] = 'Česky'; + $supportedLanguages['cs']['rtl'] = false; + $supportedLanguages['cs']['dateformat'] = 4; + $supportedLanguages['cs']['radixpoint'] = 1; + + // Danish + $supportedLanguages['da']['description'] = $clang->gT('Danish'); + $supportedLanguages['da']['nativedescription'] = 'Dansk'; + $supportedLanguages['da']['rtl'] = false; + $supportedLanguages['da']['dateformat'] = 2; + $supportedLanguages['da']['radixpoint'] = 1; + + // Dutch + $supportedLanguages['nl']['description'] = $clang->gT('Dutch'); + $supportedLanguages['nl']['nativedescription'] = 'Nederlands'; + $supportedLanguages['nl']['rtl'] = false; + $supportedLanguages['nl']['dateformat'] = 2; + $supportedLanguages['nl']['radixpoint'] = 1; + + // Dutch + $supportedLanguages['nl-informal']['description'] = $clang->gT('Dutch Informal'); + $supportedLanguages['nl-informal']['nativedescription'] = 'Nederlands (informeel)'; + $supportedLanguages['nl-informal']['rtl'] = false; + $supportedLanguages['nl-informal']['dateformat'] = 2; + $supportedLanguages['nl-informal']['radixpoint'] = 1; + + // English + $supportedLanguages['en']['description'] = $clang->gT('English'); + $supportedLanguages['en']['nativedescription'] = 'English'; + $supportedLanguages['en']['rtl'] = false; + $supportedLanguages['en']['dateformat'] = 9; + $supportedLanguages['en']['radixpoint'] = 0; + + // Estonian + $supportedLanguages['et']['description'] = $clang->gT('Estonian'); + $supportedLanguages['et']['nativedescription'] = 'Eesti'; + $supportedLanguages['et']['rtl'] = false; + $supportedLanguages['et']['dateformat'] = 4; + $supportedLanguages['et']['radixpoint'] = 1; + + // Finnish + $supportedLanguages['fi']['description'] = $clang->gT('Finnish'); + $supportedLanguages['fi']['nativedescription'] = 'Suomi'; + $supportedLanguages['fi']['rtl'] = false; + $supportedLanguages['fi']['dateformat'] = 4; + $supportedLanguages['fi']['radixpoint'] = 1; + + // French + $supportedLanguages['fr']['description'] = $clang->gT('French'); + $supportedLanguages['fr']['nativedescription'] = 'Français'; + $supportedLanguages['fr']['rtl'] = false; + $supportedLanguages['fr']['dateformat'] = 2; + $supportedLanguages['fr']['radixpoint'] = 1; + + // Galician + $supportedLanguages['gl']['description'] = $clang->gT('Galician'); + $supportedLanguages['gl']['nativedescription'] = 'Galego'; + $supportedLanguages['gl']['rtl'] = false; + $supportedLanguages['gl']['dateformat'] = 5; + $supportedLanguages['gl']['radixpoint'] = 1; + + // German + $supportedLanguages['de']['description'] = $clang->gT('German'); + $supportedLanguages['de']['nativedescription'] = 'Deutsch'; + $supportedLanguages['de']['rtl'] = false; + $supportedLanguages['de']['dateformat'] = 1; + $supportedLanguages['de']['radixpoint'] = 1; + + // German informal + $supportedLanguages['de-informal']['description'] = $clang->gT('German informal'); + $supportedLanguages['de-informal']['nativedescription'] = 'Deutsch (Du)'; + $supportedLanguages['de-informal']['rtl'] = false; + $supportedLanguages['de-informal']['dateformat'] = 1; + $supportedLanguages['de-informal']['radixpoint'] = 1; + + // Greek + $supportedLanguages['el']['description'] = $clang->gT('Greek'); + $supportedLanguages['el']['nativedescription'] = 'ελληνικά'; + $supportedLanguages['el']['rtl'] = false; + $supportedLanguages['el']['dateformat'] = 8; + $supportedLanguages['el']['radixpoint'] = 1; + + // Hindi + $supportedLanguages['hi']['description'] = $clang->gT('Hindi'); + $supportedLanguages['hi']['nativedescription'] = 'हिन्दी'; + $supportedLanguages['hi']['rtl'] = false; + $supportedLanguages['hi']['dateformat'] = 2; + $supportedLanguages['hi']['radixpoint'] = 0; + + // Hebrew + $supportedLanguages['he']['description'] = $clang->gT('Hebrew'); + $supportedLanguages['he']['nativedescription'] = ' עברית'; + $supportedLanguages['he']['rtl'] = true; + $supportedLanguages['he']['dateformat'] = 5; + $supportedLanguages['he']['radixpoint'] = 0; + + // Hungarian + $supportedLanguages['hu']['description'] = $clang->gT('Hungarian'); + $supportedLanguages['hu']['nativedescription'] = 'Magyar'; + $supportedLanguages['hu']['rtl'] = false; + $supportedLanguages['hu']['dateformat'] = 6; + $supportedLanguages['hu']['radixpoint'] = 1; + + // Icelandic + $supportedLanguages['is']['description'] = $clang->gT('Icelandic'); + $supportedLanguages['is']['nativedescription'] = 'íslenska'; + $supportedLanguages['is']['rtl'] = false; + $supportedLanguages['is']['dateformat'] = 1; + $supportedLanguages['is']['radixpoint'] = 1; + + // Indonesian + $supportedLanguages['id']['description'] = $clang->gT('Indonesian'); + $supportedLanguages['id']['nativedescription'] = 'Bahasa Indonesia'; + $supportedLanguages['id']['rtl'] = false; + $supportedLanguages['id']['dateformat'] = 5; + $supportedLanguages['id']['radixpoint'] = 1; + + // Irish + $supportedLanguages['ie']['description'] = $clang->gT('Irish'); + $supportedLanguages['ie']['nativedescription'] = 'Gaeilge'; + $supportedLanguages['ie']['rtl'] = false; + $supportedLanguages['ie']['dateformat'] = 2; + $supportedLanguages['ie']['radixpoint'] = 0; + + // Italian + $supportedLanguages['it']['description'] = $clang->gT('Italian'); + $supportedLanguages['it']['nativedescription'] = 'Italiano'; + $supportedLanguages['it']['rtl'] = false; + $supportedLanguages['it']['dateformat'] = 5; + $supportedLanguages['it']['radixpoint'] = 1; + + // Italian-Formal + $supportedLanguages['it-formal']['description'] = $clang->gT('Italian (formal)'); + $supportedLanguages['it-formal']['nativedescription'] = 'Formale Italiano'; + $supportedLanguages['it-formal']['rtl'] = false; + $supportedLanguages['it-formal']['dateformat'] = 5; + $supportedLanguages['it-formal']['radixpoint'] = 1; + + // Japanese + $supportedLanguages['ja']['description'] = $clang->gT('Japanese'); + $supportedLanguages['ja']['nativedescription'] = '日本語'; + $supportedLanguages['ja']['rtl'] = false; + $supportedLanguages['ja']['dateformat'] = 6; + $supportedLanguages['ja']['radixpoint'] = 0; + + // Korean + $supportedLanguages['ko']['description'] = $clang->gT('Korean'); + $supportedLanguages['ko']['nativedescription'] = '한국어'; + $supportedLanguages['ko']['rtl'] = false; + $supportedLanguages['ko']['dateformat'] = 7; + $supportedLanguages['ko']['radixpoint'] = 0; + + // Lithuanian + $supportedLanguages['lt']['description'] = $clang->gT('Lithuanian'); + $supportedLanguages['lt']['nativedescription'] = 'Lietuvių'; + $supportedLanguages['lt']['rtl'] = false; + $supportedLanguages['lt']['dateformat'] = 6; + $supportedLanguages['lt']['radixpoint'] = 1; + + // Latvian + $supportedLanguages['lv']['description'] = $clang->gT('Latvian'); + $supportedLanguages['lv']['nativedescription'] = 'Latviešu'; + $supportedLanguages['lv']['rtl'] = false; + $supportedLanguages['lv']['dateformat'] = 6; + $supportedLanguages['lv']['radixpoint'] = 1; + + // Macedonian + $supportedLanguages['mk']['description'] = $clang->gT('Macedonian'); + $supportedLanguages['mk']['nativedescription'] = 'Македонски'; + $supportedLanguages['mk']['rtl'] = false; + $supportedLanguages['mk']['dateformat'] = 1; + $supportedLanguages['mk']['radixpoint'] = 1; + + // Malay + $supportedLanguages['ms']['description'] = $clang->gT('Malay'); + $supportedLanguages['ms']['nativedescription'] = 'Bahasa Melayu'; + $supportedLanguages['ms']['rtl'] = false; + $supportedLanguages['ms']['dateformat'] = 1; + $supportedLanguages['ms']['radixpoint'] = 0; + + // Maltese + $supportedLanguages['mt']['description'] = $clang->gT('Maltese'); + $supportedLanguages['mt']['nativedescription'] = 'Malti'; + $supportedLanguages['mt']['rtl'] = false; + $supportedLanguages['mt']['dateformat'] = 1; + $supportedLanguages['mt']['radixpoint'] = 0; + + // Norwegian Bokmal + $supportedLanguages['nb']['description'] = $clang->gT('Norwegian (Bokmal)'); + $supportedLanguages['nb']['nativedescription'] = 'Norsk Bokmål'; + $supportedLanguages['nb']['rtl'] = false; + $supportedLanguages['nb']['dateformat'] = 4; + $supportedLanguages['nb']['radixpoint'] = 1; + + // Norwegian Nynorsk + $supportedLanguages['nn']['description'] = $clang->gT('Norwegian (Nynorsk)'); + $supportedLanguages['nn']['nativedescription'] = 'Norsk Nynorsk'; + $supportedLanguages['nn']['rtl'] = false; + $supportedLanguages['nn']['dateformat'] = 4; + $supportedLanguages['nn']['radixpoint'] = 1; + + // Persian + $supportedLanguages['fa']['description'] = $clang->gT('Persian'); + $supportedLanguages['fa']['nativedescription'] = 'فارسی'; + $supportedLanguages['fa']['rtl'] = true; + $supportedLanguages['fa']['dateformat'] = 6; + $supportedLanguages['fa']['radixpoint'] = 0; + + // Polish + $supportedLanguages['pl']['description'] = $clang->gT('Polish'); + $supportedLanguages['pl']['nativedescription'] = 'Polski'; + $supportedLanguages['pl']['rtl'] = false; + $supportedLanguages['pl']['dateformat'] = 1; + $supportedLanguages['pl']['radixpoint'] = 1; + + // Portuguese + $supportedLanguages['pt']['description'] = $clang->gT('Portuguese'); + $supportedLanguages['pt']['nativedescription'] = 'Português'; + $supportedLanguages['pt']['rtl'] = false; + $supportedLanguages['pt']['dateformat'] = 5; + $supportedLanguages['pt']['radixpoint'] = 1; + + // Brazilian Portuguese + $supportedLanguages['pt-BR']['description'] = $clang->gT('Portuguese (Brazilian)'); + $supportedLanguages['pt-BR']['nativedescription'] = 'Português do Brasil'; + $supportedLanguages['pt-BR']['rtl'] = false; + $supportedLanguages['pt-BR']['dateformat'] = 5; + $supportedLanguages['pt-BR']['radixpoint'] = 1; + + // Punjabi + $supportedLanguages['pa']['description'] = $clang->gT('Punjabi'); + $supportedLanguages['pa']['nativedescription'] = 'ਪੰਜਾਬੀ'; + $supportedLanguages['pa']['rtl'] = false; + $supportedLanguages['pa']['dateformat'] = 2; + $supportedLanguages['pa']['radixpoint'] = 0; + + // Russian + $supportedLanguages['ru']['description'] = $clang->gT('Russian'); + $supportedLanguages['ru']['nativedescription'] = 'Русский'; + $supportedLanguages['ru']['rtl'] = false; + $supportedLanguages['ru']['dateformat'] = 1; + $supportedLanguages['ru']['radixpoint'] = 1; + + // Romanian + $supportedLanguages['ro']['description'] = $clang->gT('Romanian'); + $supportedLanguages['ro']['nativedescription'] = 'Românesc'; + $supportedLanguages['ro']['rtl'] = false; + $supportedLanguages['ro']['dateformat'] = 1; + $supportedLanguages['ro']['radixpoint'] = 1; + + // Slovak + $supportedLanguages['sk']['description'] = $clang->gT('Slovak'); + $supportedLanguages['sk']['nativedescription'] = 'Slovák'; + $supportedLanguages['sk']['rtl'] = false; + $supportedLanguages['sk']['dateformat'] = 4; + $supportedLanguages['sk']['radixpoint'] = 1; + + // Sinhala + $supportedLanguages['si']['description'] = $clang->gT('Sinhala'); + $supportedLanguages['si']['nativedescription'] = 'සිංහල'; + $supportedLanguages['si']['rtl'] = false; + $supportedLanguages['si']['dateformat'] = 5; + $supportedLanguages['si']['radixpoint'] = 0; + + // Slovenian + $supportedLanguages['sl']['description'] = $clang->gT('Slovenian'); + $supportedLanguages['sl']['nativedescription'] = 'Slovenščina'; + $supportedLanguages['sl']['rtl'] = false; + $supportedLanguages['sl']['dateformat'] = 4; + $supportedLanguages['sl']['radixpoint'] = 1; + + // Serbian + $supportedLanguages['sr']['description'] = $clang->gT('Serbian'); + $supportedLanguages['sr']['nativedescription'] = 'Srpski'; + $supportedLanguages['sr']['rtl'] = false; + $supportedLanguages['sr']['dateformat'] = 4; + $supportedLanguages['sr']['radixpoint'] = 1; + + // Spanish + $supportedLanguages['es']['description'] = $clang->gT('Spanish'); + $supportedLanguages['es']['nativedescription'] = 'Español'; + $supportedLanguages['es']['rtl'] = false; + $supportedLanguages['es']['dateformat'] = 5; + $supportedLanguages['es']['radixpoint'] = 1; + + // Spanish (Chile) + $supportedLanguages['es-CL']['description'] = $clang->gT('Spanish (Chile)'); + $supportedLanguages['es-CL']['nativedescription'] = 'Español chileno'; + $supportedLanguages['es-CL']['rtl'] = false; + $supportedLanguages['es-CL']['dateformat'] = 5; + $supportedLanguages['es-CL']['radixpoint'] = 0; + + // Spanish (Mexico) + $supportedLanguages['es-MX']['description'] = $clang->gT('Spanish (Mexico)'); + $supportedLanguages['es-MX']['nativedescription'] = 'Español mejicano'; + $supportedLanguages['es-MX']['rtl'] = false; + $supportedLanguages['es-MX']['dateformat'] = 5; + $supportedLanguages['es-MX']['radixpoint'] = 0; + + // Swedish + $supportedLanguages['sv']['description'] = $clang->gT('Swedish'); + $supportedLanguages['sv']['nativedescription'] = 'Svenska'; + $supportedLanguages['sv']['rtl'] = false; + $supportedLanguages['sv']['dateformat'] = 6; + $supportedLanguages['sv']['radixpoint'] = 1; + + // Turkish + $supportedLanguages['tr']['description'] = $clang->gT('Turkish'); + $supportedLanguages['tr']['nativedescription'] = 'Türkçe'; + $supportedLanguages['tr']['rtl'] = false; + $supportedLanguages['tr']['dateformat'] = 5; + $supportedLanguages['tr']['radixpoint'] = 1; + + // Thai + $supportedLanguages['th']['description'] = $clang->gT('Thai'); + $supportedLanguages['th']['nativedescription'] = 'ภาษาไทย'; + $supportedLanguages['th']['rtl'] = false; + $supportedLanguages['th']['dateformat'] = 5; + $supportedLanguages['th']['radixpoint'] = 0; + + + //Urdu + $supportedLanguages['ur']['description'] = $clang->gT('Urdu'); + $supportedLanguages['ur']['nativedescription'] = 'اردو'; + $supportedLanguages['ur']['rtl'] = true; + $supportedLanguages['ur']['dateformat'] = 2; + $supportedLanguages['ur']['radixpoint'] = 0; + + // Vietnamese + $supportedLanguages['vi']['description'] = $clang->gT('Vietnamese'); + $supportedLanguages['vi']['nativedescription'] = 'Tiếng Việt'; + $supportedLanguages['vi']['rtl'] = false; + $supportedLanguages['vi']['dateformat'] = 5; + $supportedLanguages['vi']['radixpoint'] = 1; + } + + if ($orderbynative) + { + uasort($supportedLanguages,"user_sort_native"); + } + else + { + uasort($supportedLanguages,"user_sort"); + } + + $result[$orderbynative] = $supportedLanguages; + + Return $supportedLanguages; +} + +function user_sort($a, $b) { + + // smarts is all-important, so sort it first + if($a['description'] >$b['description']) { + return 1; + } + else { + return -1; + } +} + +function user_sort_native($a, $b) { + + // smarts is all-important, so sort it first + if($a['nativedescription'] >$b['nativedescription']) { + return 1; + } + else { + return -1; + } +} + + +/* // future languages + // Afrikaans + $supportedLanguages['za']['nativedescription'] = 'Afrikaans'; + // Irish + $supportedLanguages['ie']['nativedescription'] = 'Gaeilge'; + // Serbian + $supportedLanguages['yu']['nativedescription'] = 'Srpski'; + */ + + +/** + * This function support the ability NOT to reverse numbers (for example when you output + * a phrase as a parameter for a SWF file that can't handle RTL languages itself, but + * obviously any numbers should remain the same as in the original phrase). + * Note that it can be used just as well for UTF-8 usages if you want the numbers to remain intact + * + * @param string $str + * @param boolean $reverse_numbers + * @return string + */ +function utf8_strrev($str, $reverse_numbers=false) { + preg_match_all('/./us', $str, $ar); + if ($reverse_numbers) + return join('',array_reverse($ar[0])); + else { + $temp = array(); + foreach ($ar[0] as $value) { + if (is_numeric($value) && !empty($temp[0]) && is_numeric($temp[0])) { + foreach ($temp as $key => $value2) { + if (is_numeric($value2)) + $pos = ($key + 1); + else + break; + } + $temp2 = array_splice($temp, $pos); + $temp = array_merge($temp, array($value), $temp2); + } else + array_unshift($temp, $value); + } + return implode('', $temp); + } +} + +?> diff --git a/include/limesurvey/classes/dTexts/dFunctions/dFunctionHide.php b/include/limesurvey/classes/dTexts/dFunctions/dFunctionHide.php deleted file mode 100644 index 1dbdabdb..00000000 --- a/include/limesurvey/classes/dTexts/dFunctions/dFunctionHide.php +++ /dev/null @@ -1,50 +0,0 @@ -run($args); - if(strtolower($newStr)=='true'){ - $id=time().rand(0,100); - $hideJS=<<
              • "; //updatecheck(); - echo getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual")); + echo getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual")); } else - { + { echo getAdminHeader(), - '
                ',CheckForDBUpgrades(),'
                ', + '
                ',CheckForDBUpgrades(),'
                ', getAdminFooter("http://docs.limesurvey.org", $clang->gT("LimeSurvey online manual")) ; - } + } die; } if (is_dir($homedir."/install") && $debug<2) { die ("

                Congratulations

                Your installation is now complete. The final step is to remove or rename the LimeSurvey installation directory (admin/install) on your server since it may be a security risk.

                Once this directory has been removed or renamed you will be able to log in to your new LimeSurvey Installation.

                Try again

                "); - } + } } //Admin menus and standards diff --git a/include/limesurvey/common_functions.php b/include/limesurvey/common_functions.php index 832b180b..2bf25636 100644 --- a/include/limesurvey/common_functions.php +++ b/include/limesurvey/common_functions.php @@ -1,19 +1,23 @@ array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Assessments"),'description'=>$clang->gT("Permission to create/view/update/delete assessments rules for a survey"),'img'=>'assessments'), // Checked - 'quotas'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Quotas"),'description'=>$clang->gT("Permission to create/view/update/delete quota rules for a survey"),'img'=>'quota'), // Checked - 'responses'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Responses"),'description'=>$clang->gT("Permission to create(data entry)/view/update/delete/import/export responses"),'img'=>'browse'), - 'statistics'=>array('create'=>false,'read'=>true,'update'=>false,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Statistics"),'description'=>$clang->gT("Permission to view statistics"),'img'=>'statistics'), //Checked - 'survey'=>array('create'=>false,'read'=>true,'update'=>false,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey deletion"),'description'=>$clang->gT("Permission to delete a survey"),'img'=>'delete'), //Checked - 'surveyactivation'=>array('create'=>false,'read'=>false,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey activation"),'description'=>$clang->gT("Permission to activate/deactivate a survey"),'img'=>'activate_deactivate'), //Checked - 'surveycontent'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Survey content"),'description'=>$clang->gT("Permission to create/view/update/delete/import/export the questions, groups, answers & conditions of a survey"),'img'=>'add'), - 'surveylocale'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey locale settings"),'description'=>$clang->gT("Permission to view/update the survey locale settings"),'img'=>'edit'), - 'surveysecurity'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey security"),'description'=>$clang->gT("Permission to modify survey security settings"),'img'=>'survey_security'), - 'surveysettings'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey settings"),'description'=>$clang->gT("Permission to view/update the survey settings including token table creation"),'img'=>'survey_settings'), - 'tokens'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Tokens"),'description'=>$clang->gT("Permission to create/update/delete/import/export token entries"),'img'=>'tokens'), - 'translations'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Quick translation"),'description'=>$clang->gT("Permission to view & update the translations using the quick-translation feature"),'img'=>'translate') - ); - uasort($aPermissions,"aComparePermission"); - return $aPermissions; + 'assessments'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Assessments"),'description'=>$clang->gT("Permission to create/view/update/delete assessments rules for a survey"),'img'=>'assessments'), // Checked + 'quotas'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Quotas"),'description'=>$clang->gT("Permission to create/view/update/delete quota rules for a survey"),'img'=>'quota'), // Checked + 'responses'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Responses"),'description'=>$clang->gT("Permission to create(data entry)/view/update/delete/import/export responses"),'img'=>'browse'), + 'statistics'=>array('create'=>false,'read'=>true,'update'=>false,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Statistics"),'description'=>$clang->gT("Permission to view statistics"),'img'=>'statistics'), //Checked + 'survey'=>array('create'=>false,'read'=>true,'update'=>false,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey deletion"),'description'=>$clang->gT("Permission to delete a survey"),'img'=>'delete'), //Checked + 'surveyactivation'=>array('create'=>false,'read'=>false,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey activation"),'description'=>$clang->gT("Permission to activate/deactivate a survey"),'img'=>'activate_deactivate'), //Checked + 'surveycontent'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Survey content"),'description'=>$clang->gT("Permission to create/view/update/delete/import/export the questions, groups, answers & conditions of a survey"),'img'=>'add'), + 'surveylocale'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey locale settings"),'description'=>$clang->gT("Permission to view/update the survey locale settings"),'img'=>'edit'), + 'surveysecurity'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey security"),'description'=>$clang->gT("Permission to modify survey security settings"),'img'=>'survey_security'), + 'surveysettings'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Survey settings"),'description'=>$clang->gT("Permission to view/update the survey settings including token table creation"),'img'=>'survey_settings'), + 'tokens'=>array('create'=>true,'read'=>true,'update'=>true,'delete'=>true,'import'=>true,'export'=>true,'title'=>$clang->gT("Tokens"),'description'=>$clang->gT("Permission to create/update/delete/import/export token entries"),'img'=>'tokens'), + 'translations'=>array('create'=>false,'read'=>true,'update'=>true,'delete'=>false,'import'=>false,'export'=>false,'title'=>$clang->gT("Quick translation"),'description'=>$clang->gT("Permission to view & update the translations using the quick-translation feature"),'img'=>'translate') + ); + uasort($aPermissions,"aComparePermission"); + return $aPermissions; } /** @@ -63,24 +66,24 @@ function aComparePermission($aPermissionA,$aPermissionB) } /** - * getqtypelist() Returns list of question types available in LimeSurvey. Edit this if you are adding a new - * question type - * - * @global string $publicurl - * @global string $sourcefrom - * - * @param string $SelectedCode Value of the Question Type (defaults to "T") - * @param string $ReturnType Type of output from this function (defaults to selector) - * - * @return depending on $ReturnType param, returns a straight "array" of question types, or an list - * - * Explanation of questiontype array: - * - * description : Question description - * subquestions : 0= Does not support subquestions x=Number of subquestion scales - * answerscales : 0= Does not need answers x=Number of answer scales (usually 1, but e.g. for dual scale question set to 2) - * assessable : 0=Does not support assessment values when editing answerd 1=Support assessment values - */ +* getqtypelist() Returns list of question types available in LimeSurvey. Edit this if you are adding a new +* question type +* +* @global string $publicurl +* @global string $sourcefrom +* +* @param string $SelectedCode Value of the Question Type (defaults to "T") +* @param string $ReturnType Type of output from this function (defaults to selector) +* +* @return depending on $ReturnType param, returns a straight "array" of question types, or an list +* +* Explanation of questiontype array: +* +* description : Question description +* subquestions : 0= Does not support subquestions x=Number of subquestion scales +* answerscales : 0= Does not need answers x=Number of answer scales (usually 1, but e.g. for dual scale question set to 2) +* assessable : 0=Does not support assessment values when editing answerd 1=Support assessment values +*/ function getqtypelist($SelectedCode = "T", $ReturnType = "selector") { global $publicurl; @@ -99,173 +102,179 @@ function getqtypelist($SelectedCode = "T", $ReturnType = "selector") $qtypes = array( "1"=>array('description'=>$clang->gT("Array dual scale"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'assessable'=>1, - 'hasdefaultvalues'=>0, - 'answerscales'=>2), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'assessable'=>1, + 'hasdefaultvalues'=>0, + 'answerscales'=>2), "5"=>array('description'=>$clang->gT("5 Point Choice"), - 'group'=>$group['SinChoiceQues'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['SinChoiceQues'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), "A"=>array('description'=>$clang->gT("Array (5 Point Choice)"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>0), "B"=>array('description'=>$clang->gT("Array (10 Point Choice)"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>0), "C"=>array('description'=>$clang->gT("Array (Yes/No/Uncertain)"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>0), "D"=>array('description'=>$clang->gT("Date"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "E"=>array('description'=>$clang->gT("Array (Increase/Same/Decrease)"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>0), "F"=>array('description'=>$clang->gT("Array"), - 'group'=>$group['Arrays'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['Arrays'], + 'subquestions'=>1, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>1), "G"=>array('description'=>$clang->gT("Gender"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), "H"=>array('description'=>$clang->gT("Array by column"), - 'group'=>$group['Arrays'], - 'hasdefaultvalues'=>0, - 'subquestions'=>1, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['Arrays'], + 'hasdefaultvalues'=>0, + 'subquestions'=>1, + 'assessable'=>1, + 'answerscales'=>1), "I"=>array('description'=>$clang->gT("Language Switch"), - 'group'=>$group['MaskQuestions'], - 'hasdefaultvalues'=>0, - 'subquestions'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'hasdefaultvalues'=>0, + 'subquestions'=>0, + 'assessable'=>0, + 'answerscales'=>0), "K"=>array('description'=>$clang->gT("Multiple Numerical Input"), - 'group'=>$group['MaskQuestions'], - 'hasdefaultvalues'=>0, - 'subquestions'=>1, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'hasdefaultvalues'=>1, + 'subquestions'=>1, + 'assessable'=>1, + 'answerscales'=>0), "L"=>array('description'=>$clang->gT("List (Radio)"), - 'group'=>$group['SinChoiceQues'], - 'subquestions'=>0, - 'hasdefaultvalues'=>1, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['SinChoiceQues'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>1, + 'answerscales'=>1), "M"=>array('description'=>$clang->gT("Multiple choice"), - 'group'=>$group['MulChoiceQues'], - 'subquestions'=>1, - 'hasdefaultvalues'=>1, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['MulChoiceQues'], + 'subquestions'=>1, + 'hasdefaultvalues'=>1, + 'assessable'=>1, + 'answerscales'=>0), "N"=>array('description'=>$clang->gT("Numerical Input"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "O"=>array('description'=>$clang->gT("List with comment"), - 'group'=>$group['SinChoiceQues'], - 'subquestions'=>0, - 'hasdefaultvalues'=>1, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['SinChoiceQues'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>1, + 'answerscales'=>1), "P"=>array('description'=>$clang->gT("Multiple choice with comments"), - 'group'=>$group['MulChoiceQues'], - 'subquestions'=>1, - 'hasdefaultvalues'=>1, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['MulChoiceQues'], + 'subquestions'=>1, + 'hasdefaultvalues'=>1, + 'assessable'=>1, + 'answerscales'=>0), "Q"=>array('description'=>$clang->gT("Multiple Short Text"), - 'group'=>$group['TextQuestions'], - 'subquestions'=>1, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['TextQuestions'], + 'subquestions'=>1, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "R"=>array('description'=>$clang->gT("Ranking"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>1), "S"=>array('description'=>$clang->gT("Short Free Text"), - 'group'=>$group['TextQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['TextQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "T"=>array('description'=>$clang->gT("Long Free Text"), - 'group'=>$group['TextQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['TextQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "U"=>array('description'=>$clang->gT("Huge Free Text"), - 'group'=>$group['TextQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['TextQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>0, + 'answerscales'=>0), "X"=>array('description'=>$clang->gT("Text display"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), "Y"=>array('description'=>$clang->gT("Yes/No"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), "!"=>array('description'=>$clang->gT("List (Dropdown)"), - 'group'=>$group['SinChoiceQues'], - 'subquestions'=>0, - 'hasdefaultvalues'=>1, - 'assessable'=>1, - 'answerscales'=>1), + 'group'=>$group['SinChoiceQues'], + 'subquestions'=>0, + 'hasdefaultvalues'=>1, + 'assessable'=>1, + 'answerscales'=>1), ":"=>array('description'=>$clang->gT("Array (Numbers)"), - 'group'=>$group['Arrays'], - 'subquestions'=>2, - 'hasdefaultvalues'=>0, - 'assessable'=>1, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>2, + 'hasdefaultvalues'=>0, + 'assessable'=>1, + 'answerscales'=>0), ";"=>array('description'=>$clang->gT("Array (Texts)"), - 'group'=>$group['Arrays'], - 'subquestions'=>2, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['Arrays'], + 'subquestions'=>2, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), "|"=>array('description'=>$clang->gT("File upload"), - 'group'=>$group['MaskQuestions'], - 'subquestions'=>0, - 'hasdefaultvalues'=>0, - 'assessable'=>0, - 'answerscales'=>0), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), + "*"=>array('description'=>$clang->gT("Equation"), + 'group'=>$group['MaskQuestions'], + 'subquestions'=>0, + 'hasdefaultvalues'=>0, + 'assessable'=>0, + 'answerscales'=>0), ); asort($qtypes); if ($ReturnType == "array") {return $qtypes;} @@ -275,7 +284,7 @@ function getqtypelist($SelectedCode = "T", $ReturnType = "selector") } - $qtypeselecter = ""; + $qtypeselecter = ""; foreach($newqType as $group=>$members) { $qtypeselecter .= ''; @@ -310,17 +319,17 @@ function getqtypelist($SelectedCode = "T", $ReturnType = "selector") function isStandardTemplate($sTemplateName) { return in_array($sTemplateName,array('quexs', - 'basic', - 'bluengrey', - 'business_grey', - 'citronade', - 'clear_logo', - 'default', - 'eirenicon', - 'limespired', - 'mint_idea', - 'sherpa', - 'vallendar')); + 'basic', + 'bluengrey', + 'business_grey', + 'citronade', + 'clear_logo', + 'default', + 'eirenicon', + 'limespired', + 'mint_idea', + 'sherpa', + 'vallendar')); } @@ -363,11 +372,11 @@ function &db_select_limit_assoc($sql,$numrows=-1,$offset=-1,$inputarr=false,$die } /** - * Returns the first row of values of the $sql query result - * as a 1-dimensional array - * - * @param mixed $sql - */ +* Returns the first row of values of the $sql query result +* as a 1-dimensional array +* +* @param mixed $sql +*/ function &db_select_column($sql) { global $connect; @@ -383,10 +392,10 @@ function &db_select_column($sql) /** - * This functions quotes fieldnames accordingly - * - * @param mixed $id Fieldname to be quoted - */ +* This functions quotes fieldnames accordingly +* +* @param mixed $id Fieldname to be quoted +*/ function db_quote_id($id) { global $databasetype; @@ -401,8 +410,8 @@ function db_quote_id($id) return "`".$id."`"; break; case "mssql_n" : - case "mssql" : - case "mssqlnative" : + case "odbtp" : + case "mssqlnative" : case "odbc_mssql" : return "[".$id."]"; break; @@ -448,10 +457,10 @@ function db_table_name($name) } /** - * returns the table name without quotes - * - * @param mixed $name - */ +* returns the table name without quotes +* +* @param mixed $name +*/ function db_table_name_nq($name) { global $dbprefix; @@ -459,12 +468,12 @@ function db_table_name_nq($name) } /** - * Return a sql statement for finding LIKE named tables - * Be aware that you have to escape underscor chars by using a backslash - * otherwise you might get table names returned you don't want - * - * @param mixed $table - */ +* Return a sql statement for finding LIKE named tables +* Be aware that you have to escape underscor chars by using a backslash +* otherwise you might get table names returned you don't want +* +* @param mixed $table +*/ function db_select_tables_like($table) { global $databasetype; @@ -476,7 +485,7 @@ function db_select_tables_like($table) case 'mssql_n' : case 'mssqlnative': case 'odbc_mssql' : - return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLE_NAME LIKE '$table'"; + return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES where TABLE_TYPE='BASE TABLE' and TABLE_NAME LIKE '$table' ESCAPE '\'"; case 'postgres' : $table=str_replace('\\','\\\\',$table); return "SELECT table_name FROM information_schema.tables WHERE table_schema = 'public' and table_name like '$table'"; @@ -485,11 +494,11 @@ function db_select_tables_like($table) } /** - * Return a boolean stating if the table(s) exist(s) - * Accepts '%' in names since it uses the 'like' statement - * - * @param mixed $table - */ +* Return a boolean stating if the table(s) exist(s) +* Accepts '%' in names since it uses the 'like' statement +* +* @param mixed $table +*/ function db_tables_exist($table) { global $connect; @@ -508,19 +517,19 @@ function db_tables_exist($table) } /** - * getsurveylist() Queries the database (survey table) for a list of existing surveys - * - * @param mixed $returnarray boolean - if set to true an array instead of an HTML option list is given back - * - * @global string $surveyid - * @global string $dbprefix - * @global string $scriptname - * @global string $connect - * @global string $clang - * - * @return string This string is returned containing formatted list of existing surveys - * - */ +* getsurveylist() Queries the database (survey table) for a list of existing surveys +* +* @param mixed $returnarray boolean - if set to true an array instead of an HTML option list is given back +* +* @global string $surveyid +* @global string $dbprefix +* @global string $scriptname +* @global string $connect +* @global string $clang +* +* @return string This string is returned containing formatted list of existing surveys +* +*/ function getsurveylist($returnarray=false,$returnwithouturl=false) { global $surveyid, $dbprefix, $scriptname, $connect, $clang, $timeadjust; @@ -554,11 +563,11 @@ function getsurveylist($returnarray=false,$returnwithouturl=false) foreach($surveynames as $sv) { - $surveylstitle=FlattenText($sv['surveyls_title']); - if (strlen($surveylstitle)>45) - { - $surveylstitle = htmlspecialchars(mb_strcut(html_entity_decode($surveylstitle,ENT_QUOTES,'UTF-8'), 0, 45, 'UTF-8'))."..."; - } + $surveylstitle=FlattenText($sv['surveyls_title']); + if (strlen($surveylstitle)>45) + { + $surveylstitle = htmlspecialchars(mb_strcut(html_entity_decode($surveylstitle,ENT_QUOTES,'UTF-8'), 0, 45, 'UTF-8'))."..."; + } if($sv['active']!='Y') { @@ -650,14 +659,14 @@ function getsurveylist($returnarray=false,$returnwithouturl=false) } /** - * getQuestions() queries the database for an list of all questions matching the current survey and group id - * - * @global string $surveyid - * @global string $gid - * @global string $selectedqid - * - * @return This string is returned containing formatted list of questions in the current survey and group - */ +* getQuestions() queries the database for an list of all questions matching the current survey and group id +* +* @global string $surveyid +* @global string $gid +* @global string $selectedqid +* +* @return This string is returned containing formatted list of questions in the current survey and group +*/ function getQuestions($surveyid,$gid,$selectedqid) { global $scriptname, $clang; @@ -695,13 +704,13 @@ function getQuestions($surveyid,$gid,$selectedqid) } /** - * getGidPrevious() returns the Gid of the group prior to the current active group - * - * @param string $surveyid - * @param string $gid - * - * @return The Gid of the previous group - */ +* getGidPrevious() returns the Gid of the group prior to the current active group +* +* @param string $surveyid +* @param string $gid +* +* @return The Gid of the previous group +*/ function getGidPrevious($surveyid, $gid) { global $scriptname, $clang; @@ -725,14 +734,14 @@ function getGidPrevious($surveyid, $gid) } /** - * getQidPrevious() returns the Qid of the question prior to the current active question - * - * @param string $surveyid - * @param string $gid - * @param string $qid - * - * @return This Qid of the previous question - */ +* getQidPrevious() returns the Qid of the question prior to the current active question +* +* @param string $surveyid +* @param string $gid +* @param string $qid +* +* @return This Qid of the previous question +*/ function getQidPrevious($surveyid, $gid, $qid) { global $scriptname, $clang; @@ -754,13 +763,13 @@ function getQidPrevious($surveyid, $gid, $qid) } /** - * getGidNext() returns the Gid of the group next to the current active group - * - * @param string $surveyid - * @param string $gid - * - * @return The Gid of the next group - */ +* getGidNext() returns the Gid of the group next to the current active group +* +* @param string $surveyid +* @param string $gid +* +* @return The Gid of the next group +*/ function getGidNext($surveyid, $gid) { global $scriptname, $clang; @@ -785,14 +794,14 @@ function getGidNext($surveyid, $gid) } /** - * getQidNext() returns the Qid of the question prior to the current active question - * - * @param string $surveyid - * @param string $gid - * @param string $qid - * - * @return This Qid of the previous question - */ +* getQidNext() returns the Qid of the question prior to the current active question +* +* @param string $surveyid +* @param string $gid +* @param string $qid +* +* @return This Qid of the previous question +*/ function getQidNext($surveyid, $gid, $qid) { global $scriptname, $clang; @@ -827,11 +836,11 @@ function fCalculateTotalFileUploadUsage(){ $iTotalSize=0.0; foreach ($aRows as $aRow) { - $sFilesPath=$uploaddir.'/surveys/'.$aRow['sid'].'/files'; - if (file_exists($sFilesPath)) - { - $iTotalSize+=(float)iGetDirectorySize($sFilesPath); - } + $sFilesPath=$uploaddir.'/surveys/'.$aRow['sid'].'/files'; + if (file_exists($sFilesPath)) + { + $iTotalSize+=(float)iGetDirectorySize($sFilesPath); + } } return (float)$iTotalSize/1024/1024; } @@ -845,11 +854,11 @@ function iGetDirectorySize($directory) { } /** - * Gets number of groups inside a particular survey - * - * @param string $surveyid - * @param mixed $lang - */ +* Gets number of groups inside a particular survey +* +* @param string $surveyid +* @param mixed $lang +*/ function getGroupSum($surveyid, $lang) { global $surveyid,$dbprefix ; @@ -863,11 +872,11 @@ function getGroupSum($surveyid, $lang) /** - * Gets number of questions inside a particular group - * - * @param string $surveyid - * @param mixed $groupid - */ +* Gets number of questions inside a particular group +* +* @param string $surveyid +* @param mixed $groupid +*/ function getQuestionSum($surveyid, $groupid) { global $surveyid,$dbprefix ; @@ -880,11 +889,11 @@ function getQuestionSum($surveyid, $groupid) /** - * getMaxgrouporder($surveyid) queries the database for the maximum sortorder of a group and returns the next higher one. - * - * @param mixed $surveyid - * @global string $surveyid - */ +* getMaxgrouporder($surveyid) queries the database for the maximum sortorder of a group and returns the next higher one. +* +* @param mixed $surveyid +* @global string $surveyid +*/ function getMaxgrouporder($surveyid) { global $surveyid, $connect ; @@ -900,12 +909,12 @@ function getMaxgrouporder($surveyid) /** - * getGroupOrder($surveyid,$gid) queries the database for the sortorder of a group. - * - * @param mixed $surveyid - * @param mixed $gid - * @return mixed - */ +* getGroupOrder($surveyid,$gid) queries the database for the sortorder of a group. +* +* @param mixed $surveyid +* @param mixed $gid +* @return mixed +*/ function getGroupOrder($surveyid,$gid) { $s_lang = GetBaseLanguageFromSurveyID($surveyid); @@ -921,10 +930,10 @@ function getGroupOrder($surveyid,$gid) } /** - * getMaxquestionorder($gid) queries the database for the maximum sortorder of a question. - * - * @global string $surveyid - */ +* getMaxquestionorder($gid) queries the database for the maximum sortorder of a question. +* +* @global string $surveyid +*/ function getMaxquestionorder($gid) { global $surveyid ; @@ -943,11 +952,11 @@ function getMaxquestionorder($gid) } /** - * question_class() returns a class name for a given question type to allow custom styling for each question type. - * - * @param string $input containing unique character representing each question type. - * @return string containing the class name for a given question type. - */ +* question_class() returns a class name for a given question type to allow custom styling for each question type. +* +* @param string $input containing unique character representing each question type. +* @return string containing the class name for a given question type. +*/ function question_class($input) { @@ -958,9 +967,9 @@ function question_class($input) case 'X': return 'boilerplate'; // BOILERPLATE QUESTION case '5': return 'choice-5-pt-radio'; // 5 POINT CHOICE radio-buttons case 'D': return 'date'; // DATE - case 'Z': return 'list-radio-flexible'; // LIST Flexible radio-button +// case 'Z': return 'list-radio-flexible'; // LIST Flexible radio-button case 'L': return 'list-radio'; // LIST radio-button - case 'W': return 'list-dropdown-flexible'; // LIST drop-down (flexible label) +// case 'W': return 'list-dropdown-flexible'; // LIST drop-down (flexible label) case '!': return 'list-dropdown'; // List - dropdown case 'O': return 'list-with-comment'; // LIST radio-button + textarea case 'R': return 'ranking'; // RANKING STYLE @@ -981,115 +990,98 @@ function question_class($input) case 'E': return 'array-increase-same-decrease'; // ARRAY (Increase/Same/Decrease) radio-buttons case 'F': return 'array-flexible-row'; // ARRAY (Flexible) - Row Format case 'H': return 'array-flexible-column'; // ARRAY (Flexible) - Column Format - // case '^': return 'slider'; // SLIDER CONTROL + // case '^': return 'slider'; // SLIDER CONTROL case ':': return 'array-multi-flexi'; // ARRAY (Multi Flexi) 1 to 10 case ";": return 'array-multi-flexi-text'; case "1": return 'array-flexible-duel-scale'; // Array dual scale + case "*": return 'equation'; // Equation default: return 'generic_question'; // Should have a default fallback }; }; -if(!defined('COLSTYLE')) -{ - /** - * The following prepares and defines the 'COLSTYLE' constant which - * dictates how columns are to be marked up for list type questions. - * - * $column_style is initialised at the end of config-defaults.php or from within config.php - */ - if( !isset($column_style) || - $column_style != 'css' || - $column_style != 'ul' || - $column_style != 'table' || - $column_style != null ) - { - $column_style = 'ul'; - }; - define('COLSTYLE' ,strtolower($column_style), true); -}; - - function setup_columns($columns, $answer_count) { /** - * setup_columns() defines all the html tags to be wrapped around - * various list type answers. - * - * @param integer $columns - the number of columns, usually supplied by $dcols - * @param integer $answer_count - the number of answers to a question, usually supplied by $anscount - * @return array with all the various opening and closing tags to generate a set of columns. - * - * It returns an array with the following items: - * $wrapper['whole-start'] = Opening wrapper for the whole list - * $wrapper['whole-end'] = closing wrapper for the whole list - * $wrapper['col-devide'] = normal column devider - * $wrapper['col-devide-last'] = the last column devider (to allow - * for different styling of the last - * column - * $wrapper['item-start'] = opening wrapper tag for individual - * option - * $wrapper['item-start-other'] = opening wrapper tag for other - * option - * $wrapper['item-end'] = closing wrapper tag for individual - * option - * $wrapper['maxrows'] = maximum number of rows in each - * column - * $wrapper['cols'] = Number of columns to be inserted - * (and checked against) - * - * It also expect the constant COLSTYLE which sets how columns should - * be rendered. - * - * COLSTYLE is defined 30 lines above. - * - * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Columns are a problem. - * Really there is no perfect solution to columns at the moment. - * - * - Using Tables is problematic semanticly. - * - Using inline or float to create columns, causes the answers - * flows horizontally, not vertically which is not ideal visually. - * - Using CSS3 columns is also a problem because of browser support - * and also because if you have answeres split across two or more - * lines, and those answeres happen to fall at the bottom of a - * column, the answer might be split across columns as well as - * lines. - * - Using nested unordered list with the first level of
              • s - * floated is the same as using tables and so is bad semantically - * for the same reason tables are bad. - * - Breaking the unordered lists into consecutive floated unordered - * lists is not great semantically but probably not as bad as - * using tables. - * - * Because I haven't been able to decide which option is the least - * bad, I have handed over that responsibility to the admin who sets - * LimeSurvey up on their server. - * - * There are four options: - * 'css' using one of the various CSS only methods for - * rendering columns. - * (Check the CSS file for your chosen template to see - * how columns are defined.) - * 'ul' using multiple floated unordered lists. (DEFAULT) - * 'table' using conventional tables based layout. - * NULL blocks the use of columns - * - * 'ul' is the default because it's the best possible compromise - * between semantic markup and visual layout. - */ + * setup_columns() defines all the html tags to be wrapped around + * various list type answers. + * + * @param integer $columns - the number of columns, usually supplied by $dcols + * @param integer $answer_count - the number of answers to a question, usually supplied by $anscount + * @return array with all the various opening and closing tags to generate a set of columns. + * + * It returns an array with the following items: + * $wrapper['whole-start'] = Opening wrapper for the whole list + * $wrapper['whole-end'] = closing wrapper for the whole list + * $wrapper['col-devide'] = normal column devider + * $wrapper['col-devide-last'] = the last column devider (to allow + * for different styling of the last + * column + * $wrapper['item-start'] = opening wrapper tag for individual + * option + * $wrapper['item-start-other'] = opening wrapper tag for other + * option + * $wrapper['item-end'] = closing wrapper tag for individual + * option + * $wrapper['maxrows'] = maximum number of rows in each + * column + * $wrapper['cols'] = Number of columns to be inserted + * (and checked against) + * + * It also expect the global parameter $column_style + * initialised at the end of config-defaults.php or from within config.php + * + * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + * Columns are a problem. + * Really there is no perfect solution to columns at the moment. + * + * - Using Tables is problematic semanticly. + * - Using inline or float to create columns, causes the answers + * flows horizontally, not vertically which is not ideal visually. + * - Using CSS3 columns is also a problem because of browser support + * and also because if you have answeres split across two or more + * lines, and those answeres happen to fall at the bottom of a + * column, the answer might be split across columns as well as + * lines. + * - Using nested unordered list with the first level of
              • s + * floated is the same as using tables and so is bad semantically + * for the same reason tables are bad. + * - Breaking the unordered lists into consecutive floated unordered + * lists is not great semantically but probably not as bad as + * using tables. + * + * Because I haven't been able to decide which option is the least + * bad, I have handed over that responsibility to the admin who sets + * LimeSurvey up on their server. + * + * There are four options: + * 'css' using one of the various CSS only methods for + * rendering columns. + * (Check the CSS file for your chosen template to see + * how columns are defined.) + * 'ul' using multiple floated unordered lists. (DEFAULT) + * 'table' using conventional tables based layout. + * NULL blocks the use of columns + * + * 'ul' is the default because it's the best possible compromise + * between semantic markup and visual layout. + */ - $colstyle = COLSTYLE; + global $column_style; + if ( !in_array($column_style,array('css','ul','table')) && !is_null($column_style) ) + { + $column_style = 'ul'; + }; /* - if(defined('PRINT_TEMPLATE')) // This forces tables based columns for printablesurvey - { - $colstyle = 'table'; - }; - */ + if(defined('PRINT_TEMPLATE')) // This forces tables based columns for printablesurvey + { + $colstyle = 'table'; + }; + */ if($columns < 2) { - $colstyle = null; + $column_style = null; $columns = 1; } @@ -1100,13 +1092,13 @@ function setup_columns($columns, $answer_count) if ($answer_count>0 && $columns>0) { - $columns = ceil($answer_count/ceil($answer_count/$columns)); // # of columns is # of answers divided by # of rows (all rounded up) + $columns = ceil($answer_count/ceil($answer_count/$columns)); // # of columns is # of answers divided by # of rows (all rounded up) } $class_first = ''; - if($columns > 1 && $colstyle != null) + if($columns > 1 && !is_null($column_style)) { - if($colstyle == 'ul') + if($column_style == 'ul') { $ul = '-ul'; } @@ -1127,7 +1119,7 @@ function setup_columns($columns, $answer_count) }; $wrapper = array( - 'whole-start' => "\n\n" + 'whole-start' => "\n\n" ,'whole-end' => "
              \n" ,'col-devide' => '' ,'col-devide-last' => '' @@ -1138,37 +1130,37 @@ function setup_columns($columns, $answer_count) ,'cols' => $columns ); - switch($colstyle) + switch($column_style) { case 'ul': if($columns > 1) - { - $wrapper['col-devide'] = "\n
            \n\n\n"; - $wrapper['col-devide-last'] = "\n
          \n\n\n"; - } - break; + { + $wrapper['col-devide'] = "\n
        \n\n\n"; + $wrapper['col-devide-last'] = "\n
      \n\n\n"; + } + break; case 'table': $table_cols = ''; - for($cols = $columns ; $cols > 0 ; --$cols) - { - switch($cols) + for($cols = $columns ; $cols > 0 ; --$cols) { - case $columns: $table_cols .= "\t\n"; - break; - case 1: $table_cols .= "\t\n"; - break; - default: $table_cols .= "\t\n"; + switch($cols) + { + case $columns: $table_cols .= "\t\n"; + break; + case 1: $table_cols .= "\t\n"; + break; + default: $table_cols .= "\t\n"; + }; }; - }; - if($columns > 1) - { - $wrapper['col-devide'] = "\t
    \n\n\n\n\t
      \n"; - $wrapper['col-devide-last'] = "\t
    \n\n\n\n\t
      \n"; - }; - $wrapper['whole-start'] = "\n\n$table_cols\n\t\n\n\n\t
        \n"; - $wrapper['whole-end'] = "\t
      \n\n\n\t\n\n"; - $wrapper['item-start'] = "
    • \n"; - $wrapper['item-end'] = "
    • \n"; + if($columns > 1) + { + $wrapper['col-devide'] = "\t
    \n\n\n\n\t
      \n"; + $wrapper['col-devide-last'] = "\t
    \n\n\n\n\t
      \n"; + }; + $wrapper['whole-start'] = "\n\n$table_cols\n\t\n\n\n\t
        \n"; + $wrapper['whole-end'] = "\t
      \n\n\n\t\n\n"; + $wrapper['item-start'] = "
    • \n"; + $wrapper['item-end'] = "
    • \n"; }; return $wrapper; @@ -1177,31 +1169,31 @@ function setup_columns($columns, $answer_count) function alternation($alternate = '' , $type = 'col') { /** - * alternation() Returns a class identifyer for alternating between - * two options. Used to style alternate elements differently. creates - * or alternates between the odd string and the even string used in - * as column and row classes for array type questions. - * - * @param string $alternate = '' (empty) (default) , 'array2' , 'array1' , 'odd' , 'even' - * @param string $type = 'col' (default) or 'row' - * - * @return string representing either the first alternation or the opposite alternation to the one supplied.. - */ + * alternation() Returns a class identifyer for alternating between + * two options. Used to style alternate elements differently. creates + * or alternates between the odd string and the even string used in + * as column and row classes for array type questions. + * + * @param string $alternate = '' (empty) (default) , 'array2' , 'array1' , 'odd' , 'even' + * @param string $type = 'col' (default) or 'row' + * + * @return string representing either the first alternation or the opposite alternation to the one supplied.. + */ /* - // The following allows type to be left blank for row in subsequent - // function calls. - // It has been left out because 'row' must be defined the first time - // alternation() is called. Since it is only ever written once for each - // while statement within a function, 'row' is always defined. - if(!empty($alternate) && $type != 'row') - { if($alternate == ('array2' || 'array1')) - { - $type = 'row'; - }; - }; - // It has been left in case it becomes useful but probably should be - // removed. - */ + // The following allows type to be left blank for row in subsequent + // function calls. + // It has been left out because 'row' must be defined the first time + // alternation() is called. Since it is only ever written once for each + // while statement within a function, 'row' is always defined. + if(!empty($alternate) && $type != 'row') + { if($alternate == ('array2' || 'array1')) + { + $type = 'row'; + }; + }; + // It has been left in case it becomes useful but probably should be + // removed. + */ if($type == 'row') { $odd = 'array2'; // should be row_odd @@ -1225,14 +1217,14 @@ function alternation($alternate = '' , $type = 'col') /** - * longest_string() returns the length of the longest string past to it. - * @peram string $new_string - * @peram integer $longest_length length of the (previously) longest string passed to it. - * @return integer representing the length of the longest string passed (updated if $new_string was longer than $longest_length) - * - * usage should look like this: $longest_length = longest_string( $new_string , $longest_length ); - * - */ +* longest_string() returns the length of the longest string past to it. +* @peram string $new_string +* @peram integer $longest_length length of the (previously) longest string passed to it. +* @return integer representing the length of the longest string passed (updated if $new_string was longer than $longest_length) +* +* usage should look like this: $longest_length = longest_string( $new_string , $longest_length ); +* +*/ function longest_string( $new_string , $longest_length ) { if($longest_length < strlen(trim(strip_tags($new_string)))) @@ -1245,12 +1237,12 @@ function longest_string( $new_string , $longest_length ) /** - * getNotificationlist() returns different options for notifications - * - * @param string $notificationcode - the currently selected one - * - * @return This string is returned containing formatted list of notification methods for current survey - */ +* getNotificationlist() returns different options for notifications +* +* @param string $notificationcode - the currently selected one +* +* @return This string is returned containing formatted list of notification methods for current survey +*/ function getNotificationlist($notificationcode) { global $clang; @@ -1271,16 +1263,16 @@ function getNotificationlist($notificationcode) /** - * getgrouplist() queries the database for a list of all groups matching the current survey sid - * - * @global string $surveyid - * @global string $dbprefix - * @global string $scriptname - * - * @param string $gid - the currently selected gid/group - * - * @return This string is returned containing formatted list of groups to current survey - */ +* getgrouplist() queries the database for a list of all groups matching the current survey sid +* +* @global string $surveyid +* @global string $dbprefix +* @global string $scriptname +* +* @param string $gid - the currently selected gid/group +* +* @return This string is returned containing formatted list of groups to current survey +*/ function getgrouplist($gid) { global $surveyid, $dbprefix, $scriptname, $connect, $clang; @@ -1351,10 +1343,10 @@ function getgrouplist3($gid) } /** - * Gives back the name of a group for a certaing group id - * - * @param integer $gid Group ID - */ +* Gives back the name of a group for a certaing group id +* +* @param integer $gid Group ID +*/ function getgroupname($gid) { global $surveyid; @@ -1371,11 +1363,11 @@ function getgroupname($gid) } /** - * put your comment there... - * - * @param mixed $gid - * @param mixed $language - */ +* put your comment there... +* +* @param mixed $gid +* @param mixed $language +*/ function getgrouplistlang($gid, $language) { global $surveyid, $scriptname, $connect, $clang; @@ -1425,11 +1417,11 @@ function getuserlist($outputformat='fullinfoarray') // a subselect is used here because MSSQL does not like to group by text // also Postgres does like this one better $uquery = " SELECT * FROM ".db_table_name('users')." where uid in - (SELECT u.uid FROM ".db_table_name('users')." AS u, - ".db_table_name('user_in_groups')." AS ga ,".db_table_name('user_in_groups')." AS gb - WHERE u.uid=$myuid - OR (ga.ugid=gb.ugid AND ( (gb.uid=$myuid AND u.uid=ga.uid) OR (u.parent_id=$myuid) ) ) - GROUP BY u.uid)"; + (SELECT u.uid FROM ".db_table_name('users')." AS u, + ".db_table_name('user_in_groups')." AS ga ,".db_table_name('user_in_groups')." AS gb + WHERE u.uid=$myuid + OR (ga.ugid=gb.ugid AND ( (gb.uid=$myuid AND u.uid=ga.uid) OR (u.parent_id=$myuid) ) ) + GROUP BY u.uid)"; } else { @@ -1484,12 +1476,12 @@ function getuserlist($outputformat='fullinfoarray') /** - * Gets all survey infos in one big array including the language specific settings - * - * @param string $surveyid The survey ID - * @param string $languagecode The language code - if not given the base language of the particular survey is used - * @return array Returns array with survey info or false, if survey does not exist - */ +* Gets all survey infos in one big array including the language specific settings +* +* @param string $surveyid The survey ID +* @param string $languagecode The language code - if not given the base language of the particular survey is used +* @return array Returns array with survey info or false, if survey does not exist +*/ function getSurveyInfo($surveyid, $languagecode='') { global $dbprefix, $siteadminname, $siteadminemail, $connect, $languagechanger; @@ -1533,8 +1525,9 @@ function getSurveyInfo($surveyid, $languagecode='') $thissurvey['passthruvalue']=isset($_SESSION['passthruvalue']) ? $_SESSION['passthruvalue'] : ""; } - //not sure this should be here... ToDo: Find a better place - if (function_exists('makelanguagechanger')) $languagechanger = makelanguagechanger(); + if (!(isset($languagechanger) && strlen($languagechanger) > 0) && function_exists('makelanguagechanger')) { + $languagechanger = makelanguagechanger(); + } return $thissurvey; } @@ -1568,14 +1561,14 @@ function getlabelsets($languages=null) } /** - * Compares two elements from an array (passed by the usort function) - * and returns -1, 0 or 1 depending on the result of the comparison of - * the sort order of the group_order and question_order field - * - * @param mixed $a - * @param mixed $b - * @return int - */ +* Compares two elements from an array (passed by the usort function) +* and returns -1, 0 or 1 depending on the result of the comparison of +* the sort order of the group_order and question_order field +* +* @param mixed $a +* @param mixed $b +* @return int +*/ function GroupOrderThenQuestionOrder($a, $b) { if (isset($a['group_order']) && isset($b['group_order'])) @@ -1618,11 +1611,11 @@ function fixsortorderAnswers($qid) //Function rewrites the sortorder for a group } /** - * This function rewrites the sortorder for questions inside the named group - * - * @param integer $groupid the group id - * @param integer $surveyid the survey id - */ +* This function rewrites the sortorder for questions inside the named group +* +* @param integer $groupid the group id +* @param integer $surveyid the survey id +*/ function fixsortorderQuestions($groupid, $surveyid) //Function rewrites the sortorder for questions { global $connect; @@ -1735,7 +1728,10 @@ function returnglobal($stringname) return sanitize_languagecode($urlParam); } elseif ($stringname =="htmleditormode" || - $stringname =="subaction") + $stringname =="subaction" || + $stringname =="questionselectormode" || + $stringname =="templateeditormode" + ) { return sanitize_paranoid_string($urlParam); } @@ -1821,14 +1817,14 @@ function getsidgidqidaidtype($fieldcode) } /** - * put your comment there... - * - * @param mixed $fieldcode - * @param mixed $value - * @param mixed $format - * @param mixed $dateformatid - * @return string - */ +* put your comment there... +* +* @param mixed $fieldcode +* @param mixed $value +* @param mixed $format +* @param mixed $dateformatid +* @return string +*/ function getextendedanswer($fieldcode, $value, $format='', $dateformatphp='d.m.Y') { @@ -1855,11 +1851,11 @@ function getextendedanswer($fieldcode, $value, $format='', $dateformatphp='d.m.Y switch($this_type) { case 'D': if (trim($value)!='') - { - $datetimeobj = new Date_Time_Converter($value , "Y-m-d H:i:s"); - $value=$datetimeobj->convert($dateformatphp); - } - break; + { + $datetimeobj = new Date_Time_Converter($value , "Y-m-d H:i:s"); + $value=$datetimeobj->convert($dateformatphp); + } + break; case "L": case "!": case "O": @@ -1880,47 +1876,51 @@ function getextendedanswer($fieldcode, $value, $format='', $dateformatphp='d.m.Y case "M": case "J": case "P": - switch($value) - { - case "Y": $this_answer=$clang->gT("Yes"); break; - } - break; + switch($value) + { + case "Y": $this_answer=$clang->gT("Yes"); break; + } + break; case "Y": - switch($value) - { - case "Y": $this_answer=$clang->gT("Yes"); break; - case "N": $this_answer=$clang->gT("No"); break; - default: $this_answer=$clang->gT("No answer"); - } - break; + switch($value) + { + case "Y": $this_answer=$clang->gT("Yes"); break; + case "N": $this_answer=$clang->gT("No"); break; + default: $this_answer=$clang->gT("No answer"); + } + break; case "G": - switch($value) - { - case "M": $this_answer=$clang->gT("Male"); break; - case "F": $this_answer=$clang->gT("Female"); break; - default: $this_answer=$clang->gT("No answer"); - } - break; + switch($value) + { + case "M": $this_answer=$clang->gT("Male"); break; + case "F": $this_answer=$clang->gT("Female"); break; + default: $this_answer=$clang->gT("No answer"); + } + break; case "C": - switch($value) - { - case "Y": $this_answer=$clang->gT("Yes"); break; - case "N": $this_answer=$clang->gT("No"); break; - case "U": $this_answer=$clang->gT("Uncertain"); break; - } - break; + switch($value) + { + case "Y": $this_answer=$clang->gT("Yes"); break; + case "N": $this_answer=$clang->gT("No"); break; + case "U": $this_answer=$clang->gT("Uncertain"); break; + } + break; case "E": - switch($value) - { - case "I": $this_answer=$clang->gT("Increase"); break; - case "D": $this_answer=$clang->gT("Decrease"); break; - case "S": $this_answer=$clang->gT("Same"); break; - } - break; + switch($value) + { + case "I": $this_answer=$clang->gT("Increase"); break; + case "D": $this_answer=$clang->gT("Decrease"); break; + case "S": $this_answer=$clang->gT("Same"); break; + } + break; case "F": case "H": case "1": $query = "SELECT answer FROM ".db_table_name('answers')." WHERE qid={$fields['qid']} AND code='".$connect->escape($value)."' AND language='".$s_lang."'"; + if (isset($fields['scale_id'])) + { + $query.=" AND scale_id={$fields['scale_id']}"; + } $result = db_execute_assoc($query) or safe_die ("Couldn't get answer type F/H - getextendedanswer() in common.php"); //Checked while($row=$result->FetchRow()) { @@ -1931,6 +1931,23 @@ function getextendedanswer($fieldcode, $value, $format='', $dateformatphp='d.m.Y $this_answer=$clang->gT("Other"); } break; + case "|": //File upload + if (substr($fieldcode, -9) == 'filecount') { + $this_answer = $clang->gT("File count"); + } else { + //Show the filename, size, title and comment -- no link! + $files = json_decode($value); + $value = ''; + if (is_array($files)) { + foreach ($files as $file) { + $value .= $file->name . + ' (' . $file->size . 'KB) ' . + strip_tags($file->title) . + ' - ' . strip_tags($file->comment) . "
      "; + } + } + } + break; default: ; } // switch @@ -1982,14 +1999,14 @@ function getextendedanswer($fieldcode, $value, $format='', $dateformatphp='d.m.Y } /*function validate_email($email) - { - // Create the syntactical validation regular expression - // Validate the syntax +{ +// Create the syntactical validation regular expression +// Validate the syntax - // see http://data.iana.org/TLD/tlds-alpha-by-domain.txt - $maxrootdomainlength = 6; - return ( ! preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $email)) ? FALSE : TRUE; - }*/ +// see http://data.iana.org/TLD/tlds-alpha-by-domain.txt +$maxrootdomainlength = 6; +return ( ! preg_match("/^[_a-zA-Z0-9-]+(\.[_a-zA-Z0-9-]+)*@[a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.(([0-9]{1,3})|([a-zA-Z]{2,".$maxrootdomainlength."}))$/ix", $email)) ? FALSE : TRUE; +}*/ function validate_email($email){ @@ -2079,14 +2096,14 @@ function validate_email($email){ } $bits = array( - 'local' => isset($m[1]) ? $m[1] : '', - 'local-atom' => isset($m[2]) ? $m[2] : '', - 'local-quoted' => isset($m[3]) ? $m[3] : '', - 'local-obs' => isset($m[4]) ? $m[4] : '', - 'domain' => isset($m[5]) ? $m[5] : '', - 'domain-atom' => isset($m[6]) ? $m[6] : '', - 'domain-literal' => isset($m[7]) ? $m[7] : '', - 'domain-obs' => isset($m[8]) ? $m[8] : '', + 'local' => isset($m[1]) ? $m[1] : '', + 'local-atom' => isset($m[2]) ? $m[2] : '', + 'local-quoted' => isset($m[3]) ? $m[3] : '', + 'local-obs' => isset($m[4]) ? $m[4] : '', + 'domain' => isset($m[5]) ? $m[5] : '', + 'domain-atom' => isset($m[6]) ? $m[6] : '', + 'domain-literal' => isset($m[7]) ? $m[7] : '', + 'domain-obs' => isset($m[8]) ? $m[8] : '', ); @@ -2205,14 +2222,18 @@ function strip_comments($comment, $email, $replace=''){ function validate_templatedir($templatename) { - global $usertemplaterootdir, $standardtemplaterootdir, $defaulttemplate; - if (is_dir("$usertemplaterootdir/{$templatename}/")) + global $usertemplaterootdir, $defaulttemplate; + if (isStandardTemplate($templatename)) { return $templatename; } - elseif (is_dir("$standardtemplaterootdir/{$templatename}/")) + elseif (is_dir("$usertemplaterootdir/{$templatename}/")) { - return $templatename; + return $templatename; + } + elseif (isStandardTemplate($defaulttemplate)) + { + return $defaulttemplate; } elseif (is_dir("$usertemplaterootdir/{$defaulttemplate}/")) { @@ -2226,21 +2247,41 @@ function validate_templatedir($templatename) /** - * This function generates an array containing the fieldcode, and matching data in the same order as the activate script - * - * @param string $surveyid The Survey ID - * @param mixed $style 'short' (default) or 'full' - full creates extra information like default values - * @param mixed $force_refresh - Forces to really refresh the array, not just take the session copy - * @param int $questionid Limit to a certain qid only (for question preview) - default is false - * @return array - */ -function createFieldMap($surveyid, $style='short', $force_refresh=false, $questionid=false, $sQuestionLanguage=null) { +* This function generates an array containing the fieldcode, and matching data in the same order as the activate script +* +* @param string $surveyid The Survey ID +* @param mixed $style 'short' (default) or 'full' - full creates extra information like default values +* @param mixed $force_refresh - Forces to really refresh the array, not just take the session copy +* @param int $questionid Limit to a certain qid only (for question preview) - default is false +* @return array +*/ +function createFieldMap($surveyid, $style='full', $force_refresh=false, $questionid=false, $sQuestionLanguage=null) { - global $dbprefix, $connect, $globalfieldmap, $clang, $aDuplicateQIDs; + global $dbprefix, $connect, $clang, $aDuplicateQIDs; $surveyid=sanitize_int($surveyid); + + //Get list of questions + if (is_null($sQuestionLanguage)) + { + if (isset($_SESSION['s_lang'])&& in_array($_SESSION['s_lang'],GetAdditionalLanguagesFromSurveyID($surveyid)) ) { + $sQuestionLanguage = $_SESSION['s_lang']; + } + else { + $sQuestionLanguage = GetBaseLanguageFromSurveyID($surveyid); + } + } + $sQuestionLanguage = sanitize_languagecode($sQuestionLanguage); + if ($clang->langcode != $sQuestionLanguage) { + SetSurveyLanguage($surveyid, $sQuestionLanguage); + } + $s_lang = $clang->langcode; + //checks to see if fieldmap has already been built for this page. - if (isset($globalfieldmap[$surveyid][$style][$clang->langcode]) && $force_refresh==false) { - return $globalfieldmap[$surveyid][$style][$clang->langcode]; + if (isset($_SESSION['fieldmap-' . $surveyid . $s_lang]) && !$force_refresh && $questionid == false) { + if (isset($_SESSION['adminlang']) && $clang->langcode != $_SESSION['adminlang']) { + $clang = new limesurvey_lang($_SESSION['adminlang']); + } + return $_SESSION['fieldmap-' . $surveyid . $s_lang]; } $fieldmap["id"]=array("fieldname"=>"id", 'sid'=>$surveyid, 'type'=>"id", "gid"=>"", "qid"=>"", "aid"=>""); @@ -2294,11 +2335,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi if ($prow['datestamp'] == "Y") { $fieldmap["datestamp"]=array("fieldname"=>"datestamp", - 'type'=>"datestamp", - 'sid'=>$surveyid, - "gid"=>"", - "qid"=>"", - "aid"=>""); + 'type'=>"datestamp", + 'sid'=>$surveyid, + "gid"=>"", + "qid"=>"", + "aid"=>""); if ($style == "full") { $fieldmap["datestamp"]['title']=""; @@ -2306,11 +2347,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap["datestamp"]['group_name']=""; } $fieldmap["startdate"]=array("fieldname"=>"startdate", - 'type'=>"startdate", - 'sid'=>$surveyid, - "gid"=>"", - "qid"=>"", - "aid"=>""); + 'type'=>"startdate", + 'sid'=>$surveyid, + "gid"=>"", + "qid"=>"", + "aid"=>""); if ($style == "full") { $fieldmap["startdate"]['title']=""; @@ -2322,11 +2363,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi if ($prow['ipaddr'] == "Y") { $fieldmap["ipaddr"]=array("fieldname"=>"ipaddr", - 'type'=>"ipaddress", - 'sid'=>$surveyid, - "gid"=>"", - "qid"=>"", - "aid"=>""); + 'type'=>"ipaddress", + 'sid'=>$surveyid, + "gid"=>"", + "qid"=>"", + "aid"=>""); if ($style == "full") { $fieldmap["ipaddr"]['title']=""; @@ -2347,27 +2388,59 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi } } - //Get list of questions - if (is_null($sQuestionLanguage)) + // Collect all default values once so don't need separate query for each question with defaults + // First collect language specific defaults + $defaultsQuery = "SELECT a.qid, a.sqid, a.scale_id, a.specialtype, a.defaultvalue" + . " FROM ".db_table_name('defaultvalues')." as a, ".db_table_name('questions')." as b" + . " WHERE a.qid = b.qid" + . " AND a.language = b.language" + . " AND a.language = '$s_lang'" + . " AND b.same_default=0" + . " AND b.sid = ".$surveyid; + $defaultResults = db_execute_assoc($defaultsQuery) or safe_die ("Couldn't get list of default values in createFieldMap.
      $defaultsQuery
      ".$conect->ErrorMsg()); + + $defaultValues = array(); // indexed by question then subquestion + foreach($defaultResults as $dv) { - $s_lang = GetBaseLanguageFromSurveyID($surveyid); + if ($dv['specialtype'] != '') { + $sq = $dv['specialtype']; + } + else { + $sq = $dv['sqid']; + } + $defaultValues[$dv['qid'].'~'.$sq] = $dv['defaultvalue']; } - else + + // Now overwrite language-specific defaults (if any) base language values for each question that uses same_defaults=1 + $baseLanguage = GetBaseLanguageFromSurveyID($surveyid); + $defaultsQuery = "SELECT a.qid, a.sqid, a.scale_id, a.specialtype, a.defaultvalue" + . " FROM ".db_table_name('defaultvalues')." as a, ".db_table_name('questions')." as b" + . " WHERE a.qid = b.qid" + . " AND a.language = b.language" + . " AND a.language = '$baseLanguage'" + . " AND b.same_default=1" + . " AND b.sid = ".$surveyid; + $defaultResults = db_execute_assoc($defaultsQuery) or safe_die ("Couldn't get list of default values in createFieldMap.
      $defaultsQuery
      ".$conect->ErrorMsg()); + + foreach($defaultResults as $dv) { - $s_lang = $sQuestionLanguage; + if ($dv['specialtype'] != '') { + $sq = $dv['specialtype']; + } + else { + $sq = $dv['sqid']; + } + $defaultValues[$dv['qid'].'~'.$sq] = $dv['defaultvalue']; } + $qtypes=getqtypelist('','array'); - $aquery = "SELECT *, " - ." (SELECT count(1) FROM ".db_table_name('conditions')." c\n" - ." WHERE questions.qid = c.qid) AS hasconditions,\n" - ." (SELECT count(1) FROM ".db_table_name('conditions')." c\n" - ." WHERE questions.qid = c.cqid) AS usedinconditions\n" - ." FROM ".db_table_name('questions')." as questions, ".db_table_name('groups')." as groups" - ." WHERE questions.gid=groups.gid AND " - ." questions.sid=$surveyid AND " - ." questions.language='{$s_lang}' AND " - ." questions.parent_qid=0 AND " - ." groups.language='{$s_lang}' "; + $aquery = "SELECT * " + ." FROM ".db_table_name('questions')." as questions, ".db_table_name('groups')." as groups" + ." WHERE questions.gid=groups.gid AND " + ." questions.sid=$surveyid AND " + ." questions.language='{$s_lang}' AND " + ." questions.parent_qid=0 AND " + ." groups.language='{$s_lang}' "; if ($questionid!==false) { $aquery.=" and questions.qid={$questionid} "; @@ -2375,53 +2448,35 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $aquery.=" ORDER BY group_order, question_order"; $aresult = db_execute_assoc($aquery) or safe_die ("Couldn't get list of questions in createFieldMap function.
      $query
      ".$connect->ErrorMsg()); //Checked + $questionSeq=-1; // this is incremental question sequence across all groups + $groupSeq=-1; + $_groupOrder=-1; + while ($arow=$aresult->FetchRow()) //With each question, create the appropriate field(s) { - if ($arow['hasconditions']>0) - { - $conditions = "Y"; - } - else - { - $conditions = "N"; - } - if ($arow['usedinconditions']>0) - { - $usedinconditions = "Y"; - } - else - { - // This question is not directly used in a condition, however we should - // check if its SGQA code is not used as a value in another condition - // as a @SGQA@ code - $atsgqaQuery = "SELECT count(1) as sgqausedincondition " - . "FROM ".db_table_name('questions')." as q, " - . db_table_name('conditions')." as c " - . "WHERE c.qid=q.qid AND q.sid=".$arow['sid']." AND " - . "c.value like '@".$arow['sid']."X".$arow['gid']."X".$arow['qid']."%'"; - $atsgqaResult = db_execute_assoc($atsgqaQuery) or safe_die ("Couldn't get list @sgqa@ conditions in createFieldMap function.
      $atsgqaQuery
      ".$connect->ErrorMsg()); //Checked - $atsgqaRow = $atsgqaResult->FetchRow(); - if ($atsgqaRow['sgqausedincondition'] == 0 ) - { - $usedinconditions = "N"; - } - else - { - $usedinconditions = "Y"; - } + ++$questionSeq; + + // fix fact taht group_order may have gaps + if ($_groupOrder != $arow['group_order']) { + $_groupOrder = $arow['group_order']; + ++$groupSeq; } + // Conditions indicators are obsolete with EM. However, they are so tightly coupled into LS code that easider to just set values to 'N' for now and refactor later. + $conditions = 'N'; + $usedinconditions = 'N'; + // Field identifier // GXQXSXA // G=Group Q=Question S=Subquestion A=Answer Option // If S or A don't exist then set it to 0 // Implicit (subqestion intermal to a question type ) or explicit qubquestions/answer count starts at 1 - // Types "L", "!" , "O", "D", "G", "N", "X", "Y", "5","S","T","U" + // Types "L", "!" , "O", "D", "G", "N", "X", "Y", "5","S","T","U","*" + $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}"; if ($qtypes[$arow['type']]['subquestions']==0 && $arow['type'] != "R" && $arow['type'] != "|") { - $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>"{$arow['type']}", 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>""); if ($style == "full") @@ -2432,33 +2487,28 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; - if ($qtypes[$arow['type']]['hasdefaultvalues']) - { - if ($arow['same_default']) - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='".GetBaseLanguageFromSurveyID($surveyid)."'"); - } - else - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='{$clang->langcode}'"); - } + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + if (isset($defaultValues[$arow['qid'].'~0'])) { + $fieldmap[$fieldname]['defaultvalue'] = $defaultValues[$arow['qid'].'~0']; } } switch($arow['type']) { case "L": //RADIO LIST case "!": //DROPDOWN LIST + $fieldmap[$fieldname]['other']=$arow['other']; // so that base variable knows whether has other value if ($arow['other'] == "Y") { $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}other"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); $fieldmap[$fieldname]=array("fieldname"=>$fieldname, - 'type'=>$arow['type'], - 'sid'=>$surveyid, - "gid"=>$arow['gid'], - "qid"=>$arow['qid'], - "aid"=>"other"); + 'type'=>$arow['type'], + 'sid'=>$surveyid, + "gid"=>$arow['gid'], + "qid"=>$arow['qid'], + "aid"=>"other"); // dgk bug fix line above. aid should be set to "other" for export to append to the field name in the header line. if ($style == "full") { @@ -2469,13 +2519,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; - if ($arow['same_default']) - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='".GetBaseLanguageFromSurveyID($surveyid)."' and specialtype='other'"); - } - else - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE qid={$arow['qid']} AND scale_id=0 AND language='{$clang->langcode}' and specialtype='other'"); + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['other']=$arow['other']; + if (isset($defaultValues[$arow['qid'].'~other'])) { + $fieldmap[$fieldname]['defaultvalue'] = $defaultValues[$arow['qid'].'~other']; } } } @@ -2485,11 +2533,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); $fieldmap[$fieldname]=array("fieldname"=>$fieldname, - 'type'=>$arow['type'], - 'sid'=>$surveyid, - "gid"=>$arow['gid'], - "qid"=>$arow['qid'], - "aid"=>"comment"); + 'type'=>$arow['type'], + 'sid'=>$surveyid, + "gid"=>$arow['gid'], + "qid"=>$arow['qid'], + "aid"=>"comment"); // dgk bug fix line below. aid should be set to "comment" for export to append to the field name in the header line. Also needed set the type element correctly. if ($style == "full") { @@ -2500,6 +2548,8 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } break; } @@ -2511,12 +2561,17 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $abrows = getSubQuestions($surveyid,$arow['qid'],$s_lang); //Now first process scale=1 $answerset=array(); + $answerList = array(); foreach ($abrows as $key=>$abrow) { if($abrow['scale_id']==1) { $answerset[]=$abrow; + $answerList[] = array( + 'code'=>$abrow['title'], + 'answer'=>$abrow['question'], + ); unset($abrows[$key]); - } + } } reset($abrows); foreach ($abrows as $abrow) @@ -2526,12 +2581,12 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}_{$answer['title']}"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); $fieldmap[$fieldname]=array("fieldname"=>$fieldname, - 'type'=>$arow['type'], - 'sid'=>$surveyid, - "gid"=>$arow['gid'], - "qid"=>$arow['qid'], - "aid"=>$abrow['title']."_".$answer['title'], - "sqid"=>$abrow['qid']); + 'type'=>$arow['type'], + 'sid'=>$surveyid, + "gid"=>$arow['gid'], + "qid"=>$arow['qid'], + "aid"=>$abrow['title']."_".$answer['title'], + "sqid"=>$abrow['qid']); if ($abrow['other']=="Y") {$alsoother="Y";} if ($style == "full") { @@ -2543,6 +2598,10 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['preg']=$arow['preg']; + $fieldmap[$fieldname]['answerList']=$answerList; } } } @@ -2553,37 +2612,41 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $abrows = getSubQuestions($surveyid,$arow['qid'],$s_lang); foreach ($abrows as $abrow) { - $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}#0"; + $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}#0"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); - $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title'], "scale_id"=>0); - if ($style == "full") - { - $fieldmap[$fieldname]['title']=$arow['title']; - $fieldmap[$fieldname]['question']=$arow['question']; - $fieldmap[$fieldname]['subquestion']=$abrow['question']; - $fieldmap[$fieldname]['group_name']=$arow['group_name']; - $fieldmap[$fieldname]['scale']=$clang->gT('Scale 1'); - $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; - $fieldmap[$fieldname]['hasconditions']=$conditions; - $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; - } + $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title'], "scale_id"=>0); + if ($style == "full") + { + $fieldmap[$fieldname]['title']=$arow['title']; + $fieldmap[$fieldname]['question']=$arow['question']; + $fieldmap[$fieldname]['subquestion']=$abrow['question']; + $fieldmap[$fieldname]['group_name']=$arow['group_name']; + $fieldmap[$fieldname]['scale']=$clang->gT('Scale 1'); + $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; + $fieldmap[$fieldname]['hasconditions']=$conditions; + $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + } - $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}#1"; + $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}#1"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); - $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title'], "scale_id"=>1); - if ($style == "full") - { - $fieldmap[$fieldname]['title']=$arow['title']; - $fieldmap[$fieldname]['question']=$arow['question']; - $fieldmap[$fieldname]['subquestion']=$abrow['question']; - $fieldmap[$fieldname]['group_name']=$arow['group_name']; - $fieldmap[$fieldname]['scale']=$clang->gT('Scale 2'); - $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; - $fieldmap[$fieldname]['hasconditions']=$conditions; - $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; - } + $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title'], "scale_id"=>1); + if ($style == "full") + { + $fieldmap[$fieldname]['title']=$arow['title']; + $fieldmap[$fieldname]['question']=$arow['question']; + $fieldmap[$fieldname]['subquestion']=$abrow['question']; + $fieldmap[$fieldname]['group_name']=$arow['group_name']; + $fieldmap[$fieldname]['scale']=$clang->gT('Scale 2'); + $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; + $fieldmap[$fieldname]['hasconditions']=$conditions; + $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } } + } elseif ($arow['type'] == "R") { @@ -2603,27 +2666,27 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } } } elseif ($arow['type'] == "|") { $abquery = "SELECT value FROM ".db_table_name('question_attributes') - ." WHERE attribute='max_num_of_files' AND qid=".$arow['qid']; + ." WHERE attribute='max_num_of_files' AND qid=".$arow['qid']; $abresult = db_execute_assoc($abquery) or safe_die ("Couldn't get maximum - number of files that can be uploaded
      $abquery
      ".$connect->ErrorMsg()); + number of files that can be uploaded
      $abquery
      ".$connect->ErrorMsg()); $abrow = $abresult->FetchRow(); - for ($i = 1; $i <= $abrow['value']; $i++) - { $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}"; $fieldmap[$fieldname]=array("fieldname"=>$fieldname, - 'type'=>$arow['type'], - 'sid'=>$surveyid, - "gid"=>$arow['gid'], - "qid"=>$arow['qid'], - "aid"=>'' - ); + 'type'=>$arow['type'], + 'sid'=>$surveyid, + "gid"=>$arow['gid'], + "qid"=>$arow['qid'], + "aid"=>'' + ); if ($style == "full") { $fieldmap[$fieldname]['title']=$arow['title']; @@ -2633,15 +2696,17 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}"."_filecount"; $fieldmap[$fieldname]=array("fieldname"=>$fieldname, - 'type'=>$arow['type'], - 'sid'=>$surveyid, - "gid"=>$arow['gid'], - "qid"=>$arow['qid'], - "aid"=>"filecount" - ); + 'type'=>$arow['type'], + 'sid'=>$surveyid, + "gid"=>$arow['gid'], + "qid"=>$arow['qid'], + "aid"=>"filecount" + ); if ($style == "full") { $fieldmap[$fieldname]['title']=$arow['title']; @@ -2651,8 +2716,9 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } - } } else // Question types with subquestions and one answer per subquestion (M/A/B/C/E/F/H/P) { @@ -2662,7 +2728,13 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi { $fieldname="{$arow['sid']}X{$arow['gid']}X{$arow['qid']}{$abrow['title']}"; if (isset($fieldmap[$fieldname])) $aDuplicateQIDs[$arow['qid']]=array('fieldname'=>$fieldname,'question'=>$arow['question'],'gid'=>$arow['gid']); - $fieldmap[$fieldname]=array("fieldname"=>$fieldname, 'type'=>$arow['type'], 'sid'=>$surveyid, "gid"=>$arow['gid'], "qid"=>$arow['qid'], "aid"=>$abrow['title']); + $fieldmap[$fieldname]=array("fieldname"=>$fieldname, + 'type'=>$arow['type'], + 'sid'=>$surveyid, + 'gid'=>$arow['gid'], + 'qid'=>$arow['qid'], + 'aid'=>$abrow['title'], + 'sqid'=>$abrow['qid']); if ($style == "full") { $fieldmap[$fieldname]['title']=$arow['title']; @@ -2672,13 +2744,11 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; - if ($arow['same_default']) - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE sqid={$abrow['qid']} and qid={$arow['qid']} AND scale_id=0 AND language='".GetBaseLanguageFromSurveyID($surveyid)."'"); - } - else - { - $fieldmap[$fieldname]['defaultvalue']=$connect->GetOne("SELECT defaultvalue FROM ".db_table_name('defaultvalues')." WHERE sqid={$abrow['qid']} and qid={$arow['qid']} AND scale_id=0 AND language='{$clang->langcode}'"); + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['preg']=$arow['preg']; + if (isset($defaultValues[$arow['qid'].'~'.$abrow['qid']])) { + $fieldmap[$fieldname]['defaultvalue'] = $defaultValues[$arow['qid'].'~'.$abrow['qid']]; } } if ($arow['type'] == "P") @@ -2695,6 +2765,8 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; } } } @@ -2712,6 +2784,9 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['other']=$arow['other']; } if ($arow['type']=="P") { @@ -2727,30 +2802,103 @@ function createFieldMap($surveyid, $style='short', $force_refresh=false, $questi $fieldmap[$fieldname]['mandatory']=$arow['mandatory']; $fieldmap[$fieldname]['hasconditions']=$conditions; $fieldmap[$fieldname]['usedinconditions']=$usedinconditions; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['other']=$arow['other']; } } } } + if (isset($fieldmap[$fieldname])) // only add these fields if there is actually a valid field + { + $fieldmap[$fieldname]['relevance']=$arow['relevance']; + $fieldmap[$fieldname]['grelevance']=$arow['grelevance']; + $fieldmap[$fieldname]['questionSeq']=$questionSeq; + $fieldmap[$fieldname]['groupSeq']=$groupSeq; + $fieldmap[$fieldname]['preg']=$arow['preg']; + $fieldmap[$fieldname]['other']=$arow['other']; + $fieldmap[$fieldname]['help']=$arow['help']; + } + else + { + --$questionSeq; // didn't generate a valid $fieldmap entry, so decrement the question counter to ensure they are sequential + } } if (isset($fieldmap)) { - $globalfieldmap[$surveyid][$style][$clang->langcode] = $fieldmap; + if ($questionid == false) + { + // If the fieldmap was randomized, the master will contain the proper order. Copy that fieldmap with the new language settings. + if (isset($_SESSION['fieldmap-' . $surveyid . '-randMaster'])) + { + $masterFieldmap = $_SESSION['fieldmap-' . $surveyid . '-randMaster']; + $mfieldmap = $_SESSION[$masterFieldmap]; + + foreach ($mfieldmap as $fieldname => $mf) + { + if (isset($fieldmap[$fieldname])) + { + $f = $fieldmap[$fieldname]; + if (isset($f['question'])) + { + $mf['question'] = $f['question']; + } + if (isset($f['subquestion'])) + { + $mf['subquestion'] = $f['subquestion']; + } + if (isset($f['subquestion1'])) + { + $mf['subquestion1'] = $f['subquestion1']; + } + if (isset($f['subquestion2'])) + { + $mf['subquestion2'] = $f['subquestion2']; + } + if (isset($f['group_name'])) + { + $mf['group_name'] = $f['group_name']; + } + if (isset($f['answerList'])) + { + $mf['answerList'] = $f['answerList']; + } + if (isset($f['defaultvalue'])) + { + $mf['defaultvalue'] = $f['defaultvalue']; + } + if (isset($f['help'])) + { + $mf['help'] = $f['help']; + } + } + $mfieldmap[$fieldname] = $mf; + } + $fieldmap = $mfieldmap; + } + + $_SESSION['fieldmap-' . $surveyid . $clang->langcode]=$fieldmap; + } + + if (isset($_SESSION['adminlang']) && $clang->langcode != $_SESSION['adminlang']) { + $clang = new limesurvey_lang($_SESSION['adminlang']); + } return $fieldmap; } } /** - * This function generates an array containing the fieldcode, and matching data in the same order as the activate script - * - * @param string $surveyid The Survey ID - * @param mixed $style 'short' (default) or 'full' - full creates extra information like default values - * @param mixed $force_refresh - Forces to really refresh the array, not just take the session copy - * @param int $questionid Limit to a certain qid only (for question preview) - default is false - * @return array - */ +* This function generates an array containing the fieldcode, and matching data in the same order as the activate script +* +* @param string $surveyid The Survey ID +* @param mixed $style 'short' (default) or 'full' - full creates extra information like default values +* @param mixed $force_refresh - Forces to really refresh the array, not just take the session copy +* @param int $questionid Limit to a certain qid only (for question preview) - default is false +* @return array +*/ function createTimingsFieldMap($surveyid, $style='full', $force_refresh=false, $questionid=false, $sQuestionLanguage=null) { - global $dbprefix, $connect, $globalfieldmap, $clang, $aDuplicateQIDs; + global $dbprefix, $connect, $clang, $aDuplicateQIDs; static $timingsFieldMap; $surveyid=sanitize_int($surveyid); @@ -2785,13 +2933,13 @@ function createTimingsFieldMap($surveyid, $style='full', $force_refresh=false, $ } /** - * put your comment there... - * - * @param mixed $needle - * @param mixed $haystack - * @param mixed $keyname - * @param mixed $maxanswers - */ +* put your comment there... +* +* @param mixed $needle +* @param mixed $haystack +* @param mixed $keyname +* @param mixed $maxanswers +*/ function arraySearchByKey($needle, $haystack, $keyname, $maxanswers="") { $output=array(); foreach($haystack as $hay) { @@ -2810,10 +2958,10 @@ function arraySearchByKey($needle, $haystack, $keyname, $maxanswers="") { /** - * This function returns a count of the number of saved responses to a survey - * - * @param mixed $surveyid Survey ID - */ +* This function returns a count of the number of saved responses to a survey +* +* @param mixed $surveyid Survey ID +*/ function getSavedCount($surveyid) { global $dbprefix, $connect; @@ -2827,16 +2975,16 @@ function getSavedCount($surveyid) function GetBaseLanguageFromSurveyID($surveyid) { static $cache = array(); - global $connect; + global $connect,$defaultlang; $surveyid=(int)($surveyid); if (!isset($cache[$surveyid])) { - $query = "SELECT language FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; - $surveylanguage = $connect->GetOne($query); //Checked - if (is_null($surveylanguage)) - { - $surveylanguage='en'; - } - $cache[$surveyid] = $surveylanguage; + $query = "SELECT language FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; + $surveylanguage = $connect->GetOne($query); //Checked + if (is_null($surveylanguage)) + { + $surveylanguage=$defaultlang; + } + $cache[$surveyid] = $surveylanguage; } else { $surveylanguage = $cache[$surveyid]; } @@ -2851,16 +2999,16 @@ function GetAdditionalLanguagesFromSurveyID($surveyid) $surveyid=sanitize_int($surveyid); if (!isset($cache[$surveyid])) { $query = "SELECT additional_languages FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; - $additional_languages = $connect->GetOne($query); + $additional_languages = $connect->GetOne($query); if (trim($additional_languages)=='') - { - $additional_languages = array(); - } - else - { - $additional_languages = explode(" ", trim($additional_languages)); - } - $cache[$surveyid] = $additional_languages; + { + $additional_languages = array(); + } + else + { + $additional_languages = explode(" ", trim($additional_languages)); + } + $cache[$surveyid] = $additional_languages; } else { $additional_languages = $cache[$surveyid]; } @@ -2879,22 +3027,24 @@ function SetSurveyLanguage($surveyid, $language) if (isset($surveyid) && $surveyid>0) { // see if language actually is present in survey - $query = "SELECT language, additional_languages FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; - $result = db_execute_assoc($query); //Checked - while ($result && ($row=$result->FetchRow())) { - $additional_languages = $row['additional_languages']; - $default_language = $row['language']; - } - - if (!isset($language) || ($language=='') || (isset($additional_languages) && strpos($additional_languages, $language) === false) - or (isset($default_language) && $default_language == $language) - ) { - // Language not supported, or default language for survey, fall back to survey's default language +# $query = "SELECT language, additional_languages FROM ".db_table_name('surveys')." WHERE sid=$surveyid"; +# $result = db_execute_assoc($query); //Checked +# while ($result && ($row=$result->FetchRow())) { +# $additional_languages = $row['additional_languages']; +# $default_language = $row['language']; +# } + $default_language=GetBaseLanguageFromSurveyID($surveyid); + $additional_languages=GetAdditionalLanguagesFromSurveyID($surveyid); + if ( !isset($language) || ($language=='') + || !( in_array($language,$additional_languages) || $language==$default_language) + ) + { + // Language not supported, fall back to survey's default language $_SESSION['s_lang'] = $default_language; - //echo "Language not supported, resorting to ".$_SESSION['s_lang']."
      "; - } else { + } + else + { $_SESSION['s_lang'] = $language; - //echo "Language will be set to ".$_SESSION['s_lang']."
      "; } $clang = new limesurvey_lang($_SESSION['s_lang']); } @@ -2904,6 +3054,8 @@ function SetSurveyLanguage($surveyid, $language) $thissurvey=getSurveyInfo($surveyid, $_SESSION['s_lang']); $_SESSION['dateformats'] = getDateFormatData($thissurvey['surveyls_dateformat']); + + LimeExpressionManager::SetEMLanguage($_SESSION['s_lang']); return $clang; } @@ -2913,17 +3065,17 @@ function buildLabelSetCheckSumArray() global $connect; // BUILD CHECKSUMS FOR ALL EXISTING LABEL SETS $query = "SELECT lid - FROM ".db_table_name('labelsets')." - ORDER BY lid"; + FROM ".db_table_name('labelsets')." + ORDER BY lid"; $result = db_execute_assoc($query) or safe_die("safe_died collecting labelset ids
      $query
      ".$connect->ErrorMsg()); //Checked $csarray=array(); while ($row=$result->FetchRow()) { $thisset=""; $query2 = "SELECT code, title, sortorder, language, assessment_value - FROM ".db_table_name('labels')." - WHERE lid={$row['lid']} - ORDER BY language, sortorder, code"; + FROM ".db_table_name('labels')." + WHERE lid={$row['lid']} + ORDER BY language, sortorder, code"; $result2 = db_execute_num($query2) or safe_die("safe_died querying labelset $lid
      $query2
      ".$connect->ErrorMsg()); //Checked while($row2=$result2->FetchRow()) { @@ -2936,13 +3088,13 @@ function buildLabelSetCheckSumArray() /** - * - * Returns a flat array with all question attributes for the question only (and the qid we gave it)! - * @author: c_schmitz - * @param $qid The question ID - * @param $type optional The question type - saves a DB query if you provide it - * @return array{attribute=>value , attribute=>value} or false if the question ID does not exist (anymore) - */ +* +* Returns a flat array with all question attributes for the question only (and the qid we gave it)! +* @author: c_schmitz +* @param $qid The question ID +* @param $type optional The question type - saves a DB query if you provide it +* @return array{attribute=>value , attribute=>value} or false if the question ID does not exist (anymore) +*/ function getQuestionAttributes($qid, $type='') { static $cache = array(); @@ -2983,12 +3135,12 @@ function getQuestionAttributes($qid, $type='') $setattributes=array(); $qid=sanitize_int($qid); $query = "SELECT attribute, value FROM ".db_table_name('question_attributes')." WHERE qid=$qid"; - $result = db_execute_assoc($query) or safe_die("Error finding question attributes"); //Checked + $result = db_execute_assoc($query) or safe_die("Error finding question attributes"); //Checked $setattributes=array(); - while ($row=$result->FetchRow()) - { + while ($row=$result->FetchRow()) + { $setattributes[$row['attribute']]=$row['value']; - } + } //echo "
      ";print_r($qid_attributes);echo "
      "; $qid_attributes=array_merge($defaultattributes,$setattributes); $cache[$qid]=$qid_attributes; @@ -2996,13 +3148,13 @@ function getQuestionAttributes($qid, $type='') } /** - * - * Returns the questionAttribtue value set or '' if not set - * @author: lemeur - * @param $questionAttributeArray - * @param $attributeName - * @return string - */ +* +* Returns the questionAttribtue value set or '' if not set +* @author: lemeur +* @param $questionAttributeArray +* @param $attributeName +* @return string +*/ function getQuestionAttributeValue($questionAttributeArray, $attributeName) { if (isset($questionAttributeArray[$attributeName])) @@ -3016,10 +3168,10 @@ function getQuestionAttributeValue($questionAttributeArray, $attributeName) } /** - * Returns array of question type chars with attributes - * - * @param mixed $returnByName If set to true the array will be by attribute name - */ +* Returns array of question type chars with attributes +* +* @param mixed $returnByName If set to true the array will be by attribute name +*/ function questionAttributes($returnByName=false) { global $clang; @@ -3031,7 +3183,7 @@ function questionAttributes($returnByName=false) // If you insert a new attribute please do it in correct alphabetical order! $qattributes["alphasort"]=array( - "types"=>"!LOWZ", + "types"=>"!LO", 'category'=>$clang->gT('Display'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3052,21 +3204,32 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Answer width')); $qattributes["array_filter"]=array( - "types"=>"1ABCEF:;MPL", + "types"=>"1ABCEF:;MPLKQ", 'category'=>$clang->gT('Logic'), 'sortorder'=>100, 'inputtype'=>'text', - "help"=>$clang->gT("Enter the code of a Multiple choice question to only show the matching answer options in this question."), + "help"=>$clang->gT("Enter the code(s) of Multiple choice question(s) (separated by semicolons) to only show the matching answer options in this question."), "caption"=>$clang->gT('Array filter')); $qattributes["array_filter_exclude"]=array( - "types"=>"1ABCEF:;MPL", + "types"=>"1ABCEF:;MPLKQ", 'category'=>$clang->gT('Logic'), 'sortorder'=>100, 'inputtype'=>'text', - "help"=>$clang->gT("Enter the code of a Multiple choice question to exclude the matching answer options in this question."), + "help"=>$clang->gT("Enter the code(s) of Multiple choice question(s) (separated by semicolons) to exclude the matching answer options in this question."), "caption"=>$clang->gT('Array filter exclusion')); + $qattributes["array_filter_style"]=array( + "types"=>"1ABCEF:;MPLKQ", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>100, + 'inputtype'=>'singleselect', + 'options'=>array(0=>$clang->gT('Hidden'), + 1=>$clang->gT('Disabled')), + 'default'=>0, + "help"=>$clang->gT("Specify how array-filtered sub-questions should be displayed"), + "caption"=>$clang->gT('Array filter style')); + $qattributes["assessment_value"]=array( "types"=>"MP", 'category'=>$clang->gT('Logic'), @@ -3084,16 +3247,8 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT('Category separator'), "caption"=>$clang->gT('Category separator')); - $qattributes["code_filter"]=array( - "types"=>"WZ", - 'category'=>$clang->gT('Logic'), - 'sortorder'=>100, - 'inputtype'=>'text', - "help"=>$clang->gT('Filter the available answers by this value'), - "caption"=>$clang->gT('Code filter')); - $qattributes["display_columns"]=array( - "types"=>"GLMZ", + "types"=>"LM", 'category'=>$clang->gT('Display'), 'sortorder'=>100, 'inputtype'=>'integer', @@ -3178,8 +3333,40 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT('Multiple numeric inputs sum must equal this value'), "caption"=>$clang->gT('Equals sum value')); + $qattributes["em_validation_q"]=array( + "types"=>":;ABCEFKMNPQRSTU", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>200, + 'inputtype'=>'textarea', + "help"=>$clang->gT('Boolean equation to validate the whole question.'), + "caption"=>$clang->gT('Question validation equation')); + + $qattributes["em_validation_q_tip"]=array( + "types"=>":;ABCEFKMNPQRSTU", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>210, + 'inputtype'=>'textarea', + "help"=>$clang->gT('Tip to show user describing the question validation equation.'), + "caption"=>$clang->gT('Question validation tip')); + + $qattributes["em_validation_sq"]=array( + "types"=>";:KQSTUN", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>220, + 'inputtype'=>'textarea', + "help"=>$clang->gT('Boolean equation to validate each sub-question.'), + "caption"=>$clang->gT('Sub-question validation equation')); + + $qattributes["em_validation_sq_tip"]=array( + "types"=>";:KQSTUN", + 'category'=>$clang->gT('Logic'), + 'sortorder'=>230, + 'inputtype'=>'textarea', + "help"=>$clang->gT('Tip to show user describing the sub-question validation equation.'), + "caption"=>$clang->gT('Sub-question validation tip')); + $qattributes["exclude_all_others"]=array( - "types"=>"M", + "types"=>":ABCEFMPKQ", 'category'=>$clang->gT('Logic'), 'sortorder'=>130, 'inputtype'=>'text', @@ -3187,7 +3374,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Exclusive option')); $qattributes["exclude_all_others_auto"]=array( - "types"=>"M", + "types"=>"MP", 'category'=>$clang->gT('Logic'), 'sortorder'=>131, 'inputtype'=>'singleselect', @@ -3301,7 +3488,7 @@ function questionAttributes($returnByName=false) // End Map Options $qattributes["hide_tip"]=array( - "types"=>"!KLMNOPRSWZ", + "types"=>"15ABCDEFGHIKLMNOPQRSTUXY!:;|", 'category'=>$clang->gT('Display'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3312,7 +3499,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Hide tip')); $qattributes['hidden']=array( - 'types'=>'15ABCDEFGHIKLMNOPQRSTUWXYZ!:;|', + 'types'=>'15ABCDEFGHIKLMNOPQRSTUXY!:;|*', 'category'=>$clang->gT('Display'), 'sortorder'=>101, 'inputtype'=>'singleselect', @@ -3323,7 +3510,7 @@ function questionAttributes($returnByName=false) 'caption'=>$clang->gT('Always hide this question')); $qattributes["max_answers"]=array( - "types"=>"MPR", + "types"=>"MPR1:;ABCEFKQ", 'category'=>$clang->gT('Logic'), 'sortorder'=>11, 'inputtype'=>'integer', @@ -3339,23 +3526,15 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Maximum sum value')); $qattributes["max_num_value_n"]=array( - "types"=>"N", + "types"=>"NK", 'category'=>$clang->gT('Input'), 'sortorder'=>110, 'inputtype'=>'integer', "help"=>$clang->gT('Maximum value of the numeric input'), "caption"=>$clang->gT('Maximum value')); - $qattributes["max_num_value_sgqa"]=array( - "types"=>"K", - 'category'=>$clang->gT('Logic'), - 'sortorder'=>100, - 'inputtype'=>'text', - "help"=>$clang->gT('Enter the SGQA identifier to use the total of a previous question as the maximum for this question'), - "caption"=>$clang->gT('Max value from SGQA')); - $qattributes["maximum_chars"]=array( - "types"=>"STUNQK:", + "types"=>"STUNQK:;", 'category'=>$clang->gT('Input'), 'sortorder'=>100, 'inputtype'=>'text', @@ -3363,7 +3542,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Maximum characters')); $qattributes["min_answers"]=array( - "types"=>"MPR", + "types"=>"MPR1:;ABCEFKQ", 'category'=>$clang->gT('Logic'), 'sortorder'=>10, 'inputtype'=>'integer', @@ -3379,26 +3558,18 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Minimum sum value')); $qattributes["min_num_value_n"]=array( - "types"=>"N", + "types"=>"NK", 'category'=>$clang->gT('Input'), 'sortorder'=>100, 'inputtype'=>'integer', "help"=>$clang->gT('Minimum value of the numeric input'), "caption"=>$clang->gT('Minimum value')); - $qattributes["min_num_value_sgqa"]=array( - "types"=>"K", - 'category'=>$clang->gT('Logic'), - 'sortorder'=>100, - 'inputtype'=>'text', - "help"=>$clang->gT('Enter the SGQA identifier to use the total of a previous question as the minimum for this question'), - "caption"=>$clang->gT('Minimum value from SGQA')); - $qattributes["multiflexible_max"]=array( "types"=>":", 'category'=>$clang->gT('Display'), - 'sortorder'=>112, - 'inputtype'=>'text', + 'sortorder'=>112, + 'inputtype'=>'text', "help"=>$clang->gT('Maximum value for array(mult-flexible) question type'), "caption"=>$clang->gT('Maximum value')); @@ -3440,83 +3611,75 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT('Present answer options in reverse order'), "caption"=>$clang->gT('Reverse answer order')); - $qattributes["num_value_equals_sgqa"]=array( - "types"=>"K", - 'category'=>$clang->gT('Logic'), - 'sortorder'=>100, - 'inputtype'=>'text', - "help"=>$clang->gT('SGQA identifier to use total of previous question as total for this question'), - "caption"=>$clang->gT('Value equals SGQA')); - $qattributes["num_value_int_only"]=array( "types"=>"N", 'category'=>$clang->gT('Input'), 'sortorder'=>100, 'inputtype'=>'singleselect', 'options'=>array( - 0=>$clang->gT('No'), - 1=>$clang->gT('Yes')), + 0=>$clang->gT('No'), + 1=>$clang->gT('Yes')), 'default'=>0, "help"=>$clang->gT('Restrict input to integer values'), "caption"=>$clang->gT('Integer only')); $qattributes["numbers_only"]=array( - "types"=>"Q;S", - 'category'=>$clang->gT('Other'), - 'sortorder'=>100, - 'inputtype'=>'singleselect', - 'options'=>array( - 0=>$clang->gT('No'), - 1=>$clang->gT('Yes') - ), - 'default'=>0, - "help"=>$clang->gT('Allow only numerical input'), - "caption"=>$clang->gT('Numbers only') + "types"=>"Q;S*", + 'category'=>$clang->gT('Other'), + 'sortorder'=>100, + 'inputtype'=>'singleselect', + 'options'=>array( + 0=>$clang->gT('No'), + 1=>$clang->gT('Yes') + ), + 'default'=>0, + "help"=>$clang->gT('Allow only numerical input'), + "caption"=>$clang->gT('Numbers only') ); $qattributes['show_totals'] = array( - 'types' => ';', - 'category' => $clang->gT('Other'), - 'sortorder' => 100, - 'inputtype' => 'singleselect', - 'options' => array( - 'X' => $clang->gT('Off'), - 'R' => $clang->gT('Rows'), - 'C' => $clang->gT('Columns'), - 'B' => $clang->gT('Both rows and columns') - ), - 'default' => 'X', - 'help' => $clang->gT('Show totals for either rows, columns or both rows and columns'), - 'caption' => $clang->gT('Show totals for') + 'types' => ';', + 'category' => $clang->gT('Other'), + 'sortorder' => 100, + 'inputtype' => 'singleselect', + 'options' => array( + 'X' => $clang->gT('Off'), + 'R' => $clang->gT('Rows'), + 'C' => $clang->gT('Columns'), + 'B' => $clang->gT('Both rows and columns') + ), + 'default' => 'X', + 'help' => $clang->gT('Show totals for either rows, columns or both rows and columns'), + 'caption' => $clang->gT('Show totals for') ); $qattributes['show_grand_total'] = array( - 'types' => ';', - 'category' => $clang->gT('Other'), - 'sortorder' => 100, - 'inputtype' => 'singleselect', - 'options' => array( - 0 => $clang->gT('No'), - 1 => $clang->gT('Yes') - ), - 'default' => 0, - 'help' => $clang->gT('Show grand total for either columns or rows'), - 'caption' => $clang->gT('Show grand total') + 'types' => ';', + 'category' => $clang->gT('Other'), + 'sortorder' => 100, + 'inputtype' => 'singleselect', + 'options' => array( + 0 => $clang->gT('No'), + 1 => $clang->gT('Yes') + ), + 'default' => 0, + 'help' => $clang->gT('Show grand total for either columns or rows'), + 'caption' => $clang->gT('Show grand total') ); $qattributes["input_boxes"]=array( - "types"=>":", - 'category'=>$clang->gT('Display'), - 'sortorder'=>100, - 'inputtype'=>'singleselect', - 'options'=>array(0=>$clang->gT('No'), + "types"=>":", + 'category'=>$clang->gT('Display'), + 'sortorder'=>100, + 'inputtype'=>'singleselect', + 'options'=>array(0=>$clang->gT('No'), 1=>$clang->gT('Yes')), - 'default'=>0, - "help"=>$clang->gT("Present as text input boxes instead of dropdown lists"), - "caption"=>$clang->gT("Text inputs")); + 'default'=>0, + "help"=>$clang->gT("Present as text input boxes instead of dropdown lists"), + "caption"=>$clang->gT("Text inputs")); $qattributes["other_comment_mandatory"]=array( - "types"=>"PLW!Z", + "types"=>"PL!", 'category'=>$clang->gT('Logic'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3529,8 +3692,8 @@ function questionAttributes($returnByName=false) $qattributes["other_numbers_only"]=array( "types"=>"LMP", 'category'=>$clang->gT('Logic'), - 'sortorder'=>100, - 'inputtype'=>'singleselect', + 'sortorder'=>100, + 'inputtype'=>'singleselect', 'options'=>array(0=>$clang->gT('No'), 1=>$clang->gT('Yes')), 'default'=>0, @@ -3538,7 +3701,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT("Numbers only for 'Other'")); $qattributes["other_replace_text"]=array( - "types"=>"LMPWZ!", + "types"=>"LMP!", 'category'=>$clang->gT('Display'), 'sortorder'=>100, 'inputtype'=>'text', @@ -3546,7 +3709,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT("Label for 'Other:' option")); $qattributes["page_break"]=array( - "types"=>"15ABCDEFGHKLMNOPQRSTUWXYZ!:;|", + "types"=>"15ABCDEFGHKLMNOPQRSTUXY!:;|*", 'category'=>$clang->gT('Other'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3565,7 +3728,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Answer prefix')); $qattributes["public_statistics"]=array( - "types"=>"15ABCEFGHKLMNOPRWYZ!:", + "types"=>"15ABCEFGHKLMNOPRY!:*", 'category'=>$clang->gT('Other'), 'sortorder'=>80, 'inputtype'=>'singleselect', @@ -3576,7 +3739,7 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT('Show in public statistics')); $qattributes["random_order"]=array( - "types"=>"!ABCEFHKLMOPQRWZ1:;", + "types"=>"!ABCEFHKLMOPQR1:;", 'category'=>$clang->gT('Display'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3646,10 +3809,10 @@ function questionAttributes($returnByName=false) 'sortorder'=>90, 'inputtype'=>'singleselect', 'options'=>array( - 0=>$clang->gT('No'), - 1=>$clang->gT('Yes - stars'), - 2=>$clang->gT('Yes - slider with emoticon'), - ), + 0=>$clang->gT('No'), + 1=>$clang->gT('Yes - stars'), + 2=>$clang->gT('Yes - slider with emoticon'), + ), 'default'=>0, "help"=>$clang->gT('Use slider layout'), "caption"=>$clang->gT('Use slider layout')); @@ -3701,8 +3864,29 @@ function questionAttributes($returnByName=false) "help"=>$clang->gT('Use dropdown boxes instead of list of radio buttons'), "caption"=>$clang->gT('Use dropdown boxes')); + $qattributes["dropdown_size"]=array( + "types"=>"!", // TODO add these later? "1F", + 'category'=>$clang->gT('Display'), + 'sortorder'=>200, + 'inputtype'=>'text', + 'default'=>0, + "help"=>$clang->gT('For list dropdown boxes, show up to this many rows'), + "caption"=>$clang->gT('Height of dropdown')); + + $qattributes["dropdown_prefix"]=array( + "types"=>"!", // TODO add these later? "1F", + 'category'=>$clang->gT('Display'), + 'sortorder'=>201, + 'inputtype'=>'singleselect', + 'options'=>array(0=>$clang->gT('None'), + 1=>$clang->gT('Order'), + ), + 'default'=>0, + "help"=>$clang->gT('Accelerator keys for list items'), + "caption"=>$clang->gT('Prefix for list items')); + $qattributes["scale_export"]=array( - "types"=>"CEFGHLMOPWYZ1!:", + "types"=>"CEFGHLMOPY1!:*", 'category'=>$clang->gT('Other'), 'sortorder'=>100, 'inputtype'=>'singleselect', @@ -3746,22 +3930,22 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT("Time limit disable next")); $qattributes["time_limit_disable_prev"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>96, "inputtype"=>"singleselect", 'options'=>array(0=>$clang->gT('No'), 1=>$clang->gT('Yes')), - "help"=>$clang->gT("Disable the prev button until the time limit expires"), - "caption"=>$clang->gT("Time limit disable prev")); + "help"=>$clang->gT("Disable the prev button until the time limit expires"), + "caption"=>$clang->gT("Time limit disable prev")); $qattributes["time_limit_countdown_message"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>98, "inputtype"=>"textarea", - "help"=>$clang->gT("The text message that displays in the countdown timer during the countdown"), - "caption"=>$clang->gT("Time limit countdown message")); + "help"=>$clang->gT("The text message that displays in the countdown timer during the countdown"), + "caption"=>$clang->gT("Time limit countdown message")); $qattributes["time_limit_timer_style"]=array( "types"=>"STUX", @@ -3828,104 +4012,118 @@ function questionAttributes($returnByName=false) "caption"=>$clang->gT("1st time limit warning CSS style")); $qattributes["time_limit_warning_2"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>116, "inputtype"=>"integer", - "help"=>$clang->gT("Display the 2nd 'time limit warning' when there are this many seconds remaining in the countdown (warning will not display if left blank)"), - "caption"=>$clang->gT("2nd time limit warning message timer")); + "help"=>$clang->gT("Display the 2nd 'time limit warning' when there are this many seconds remaining in the countdown (warning will not display if left blank)"), + "caption"=>$clang->gT("2nd time limit warning message timer")); $qattributes["time_limit_warning_2_display_time"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>118, "inputtype"=>"integer", - "help"=>$clang->gT("The 2nd 'time limit warning' will stay visible for this many seconds (will not turn off if this setting is left blank)"), - "caption"=>$clang->gT("2nd time limit warning message display time")); + "help"=>$clang->gT("The 2nd 'time limit warning' will stay visible for this many seconds (will not turn off if this setting is left blank)"), + "caption"=>$clang->gT("2nd time limit warning message display time")); $qattributes["time_limit_warning_2_message"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>120, "inputtype"=>"textarea", - "help"=>$clang->gT("The 2nd message to display as a 'time limit warning' (a default warning will display if this is left blank)"), - "caption"=>$clang->gT("2nd time limit warning message")); + "help"=>$clang->gT("The 2nd message to display as a 'time limit warning' (a default warning will display if this is left blank)"), + "caption"=>$clang->gT("2nd time limit warning message")); $qattributes["time_limit_warning_2_style"]=array( - "types"=>"STUX", + "types"=>"STUX", 'category'=>$clang->gT('Timer'), 'sortorder'=>122, "inputtype"=>"textarea", - "help"=>$clang->gT("CSS style used when the 2nd 'time limit warning' message is displayed"), - "caption"=>$clang->gT("2nd time limit warning CSS style")); + "help"=>$clang->gT("CSS style used when the 2nd 'time limit warning' message is displayed"), + "caption"=>$clang->gT("2nd time limit warning CSS style")); $qattributes["show_title"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('File metadata'), 'sortorder'=>124, "inputtype"=>"singleselect", 'options'=>array(0=>$clang->gT('No'), 1=>$clang->gT('Yes')), 'default'=>1, - "help"=>$clang->gT("Is the participant required to give a title to the uploaded file?"), - "caption"=>$clang->gT("Show title")); + "help"=>$clang->gT("Is the participant required to give a title to the uploaded file?"), + "caption"=>$clang->gT("Show title")); $qattributes["show_comment"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('File metadata'), 'sortorder'=>126, "inputtype"=>"singleselect", 'options'=>array(0=>$clang->gT('No'), 1=>$clang->gT('Yes')), 'default'=>1, - "help"=>$clang->gT("Is the participant required to give a comment to the uploaded file?"), - "caption"=>$clang->gT("Show comment")); + "help"=>$clang->gT("Is the participant required to give a comment to the uploaded file?"), + "caption"=>$clang->gT("Show comment")); $qattributes["max_filesize"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('Other'), 'sortorder'=>128, "inputtype"=>"integer", 'default'=>1024, - "help"=>$clang->gT("The participant cannot upload a single file larger than this size"), - "caption"=>$clang->gT("Maximum file size allowed (in KB)")); + "help"=>$clang->gT("The participant cannot upload a single file larger than this size"), + "caption"=>$clang->gT("Maximum file size allowed (in KB)")); $qattributes["max_num_of_files"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('Other'), 'sortorder'=>130, - "inputtype"=>"integer", + "inputtype"=>"text", 'default'=>1, - "help"=>$clang->gT("Maximum number of files that the participant can upload for this question"), - "caption"=>$clang->gT("Max number of files")); + "help"=>$clang->gT("Maximum number of files that the participant can upload for this question"), + "caption"=>$clang->gT("Max number of files")); $qattributes["min_num_of_files"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('Other'), 'sortorder'=>132, - "inputtype"=>"integer", + "inputtype"=>"text", 'default'=>0, - "help"=>$clang->gT("Minimum number of files that the participant must upload for this question"), - "caption"=>$clang->gT("Min number of files")); + "help"=>$clang->gT("Minimum number of files that the participant must upload for this question"), + "caption"=>$clang->gT("Min number of files")); $qattributes["allowed_filetypes"]=array( - "types"=>"|", + "types"=>"|", 'category'=>$clang->gT('Other'), 'sortorder'=>134, 'inputtype'=>'text', 'default'=>"png, gif, doc, odt", - "help"=>$clang->gT("Allowed file types in comma separated format. e.g. pdf,doc,odt"), - "caption"=>$clang->gT("Allowed file types")); + "help"=>$clang->gT("Allowed file types in comma separated format. e.g. pdf,doc,odt"), + "caption"=>$clang->gT("Allowed file types")); $qattributes["random_group"]=array( - "types"=>"15ABCDEFGHIKLMNOPQRSTUWXYZ!:;|", + "types"=>"15ABCDEFGHIKLMNOPQRSTUXY!:;|", 'category'=>$clang->gT('Logic'), 'sortorder'=>100, 'inputtype'=>'text', "help"=>$clang->gT("Place questions into a specified randomization group, all questions included in the specified group will appear in a random order"), "caption"=>$clang->gT("Randomization group name")); + // This is added to support historical behavior. Early versions of 1.92 used a value of "No", so if there was a min_sum_value or equals_sum_value, the question was not valid + // unless those criteria were met. In later releases of 1.92, the default was changed so that missing values were allowed even if those attributes were set + // This attribute lets authors control whether missing values should be allowed in those cases without needing to set min_answers + // Existing surveys will use the old behavior, but if the author edits the question, the default will be the new behavior. + $qattributes["value_range_allows_missing"]=array( + "types"=>"K", + 'category'=>$clang->gT('Input'), + 'sortorder'=>100, + "inputtype"=>"singleselect", + 'options'=>array(0=>$clang->gT('No'), + 1=>$clang->gT('Yes')), + 'default'=>1, + "help"=>$clang->gT("Is no answer (missing) allowed when either 'Equals sum value' or 'Minimum sum value' are set?"), + "caption"=>$clang->gT("Value range allows missing")); //This builds a more useful array (don't modify) if ($returnByName==false) @@ -3935,14 +4133,14 @@ function questionAttributes($returnByName=false) for ($i=0; $i<=strlen($qvalue['types'])-1; $i++) { $qat[substr($qvalue['types'], $i, 1)][]=array("name"=>$qname, - "inputtype"=>$qvalue['inputtype'], - "category"=>$qvalue['category'], - "sortorder"=>$qvalue['sortorder'], - "readonly"=>isset($qvalue['readonly_when_active'])?$qvalue['readonly_when_active']:false, - "options"=>isset($qvalue['options'])?$qvalue['options']:'', - "default"=>isset($qvalue['default'])?$qvalue['default']:'', - "help"=>$qvalue['help'], - "caption"=>$qvalue['caption']); + "inputtype"=>$qvalue['inputtype'], + "category"=>$qvalue['category'], + "sortorder"=>$qvalue['sortorder'], + "readonly"=>isset($qvalue['readonly_when_active'])?$qvalue['readonly_when_active']:false, + "options"=>isset($qvalue['options'])?$qvalue['options']:'', + "default"=>isset($qvalue['default'])?$qvalue['default']:'', + "help"=>$qvalue['help'], + "caption"=>$qvalue['caption']); } } return $qat; @@ -3965,12 +4163,12 @@ function CategorySort($a, $b) if (!function_exists('get_magic_quotes_gpc')) { /** - * Gets the current configuration setting of magic_quotes_gpc - * NOTE: Compat variant for PHP 6+ versions - * - * @link http://www.php.net/manual/en/function.get-magic-quotes-gpc.php - * @return int 0 if magic_quotes_gpc is off, 1 otherwise. - */ + * Gets the current configuration setting of magic_quotes_gpc + * NOTE: Compat variant for PHP 6+ versions + * + * @link http://www.php.net/manual/en/function.get-magic-quotes-gpc.php + * @return int 0 if magic_quotes_gpc is off, 1 otherwise. + */ function get_magic_quotes_gpc() { return 0; } @@ -4024,7 +4222,7 @@ function javascript_escape($str, $strip_tags=false, $htmldecode=false) { // If you want to echo the header use doHeader() ! function getHeader($meta = false) { - global $embedded, $surveyid, $rooturl,$defaultlang, $js_header_includes, $css_header_includes; + global $embedded, $surveyid, $rooturl, $defaultlang, $js_header_includes, $css_header_includes; $js_header_includes = array_unique($js_header_includes); $css_header_includes = array_unique($css_header_includes); @@ -4064,32 +4262,35 @@ function getHeader($meta = false) } + + $header= "\n" + . "\n" + . "\n" + . "\n" + . "" + . "" + . $js_header; + + if ($meta) + $header .= $meta; + if ( !$embedded ) { - $header= "\n" - . "\n" - . "\n" - . "" - . "" - . $js_header; - - if ($meta) - $header .= $meta; - return $header; } - - global $embedded_headerfunc; - - if ( function_exists( $embedded_headerfunc ) ) - return $embedded_headerfunc(); + else + { + global $embedded_headerfunc; + if ( function_exists( $embedded_headerfunc ) ) + return $embedded_headerfunc($header); + } } function doHeader() @@ -4148,24 +4349,17 @@ function getAdminFooter($url, $explanation) /** - * This function returns the header for the printable survey - * @return String - * - */ +* This function returns the header for the printable survey +* @return String +* +*/ function getPrintableHeader() { global $rooturl,$homeurl; $headelements = ' - - - - - + + + '; return $headelements; } @@ -4182,11 +4376,12 @@ function getFooter() { return "\n\n\t\n\n"; } - - global $embedded_footerfunc; - - if ( function_exists( $embedded_footerfunc ) ) - return $embedded_footerfunc(); + else + { + global $embedded_footerfunc; + if ( function_exists( $embedded_footerfunc ) ) + return $embedded_footerfunc(); + } } @@ -4199,39 +4394,46 @@ function doFooter() // This function replaces field names in a text with the related values // (e.g. for email and template functions) -function ReplaceFields ($text,$fieldsarray, $bReplaceInsertans=false) +function ReplaceFields ($text,$fieldsarray, $bReplaceInsertans=true, $staticReplace=true) { - foreach ( $fieldsarray as $key => $value ) - { - $text=str_replace($key, $value, $text); - } - if ($bReplaceInsertans) { - $text = insertansReplace($text); + $replacements = array(); + foreach ( $fieldsarray as $key => $value ) + { + $replacements[substr($key,1,-1)] = $value; + } + $text = LimeExpressionManager::ProcessString($text, NULL, $replacements, false, 2, 1, false, false, $staticReplace); + } + else + { + foreach ( $fieldsarray as $key => $value ) + { + $text=str_replace($key, $value, $text); + } } return $text; } /** - * This function mails a text $body to the recipient $to. - * You can use more than one recipient when using a semikolon separated string with recipients. - * If you send several emails at once please supply an email object so that it can be re-used over and over. Especially with SMTP connections this speeds up things by 200%. - * If you supply an email object Do not forget to close the mail connection by calling $mail->SMTPClose(); - * - * @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 +* This function mails a text $body to the recipient $to. +* You can use more than one recipient when using a semikolon separated string with recipients. +* If you send several emails at once please supply an email object so that it can be re-used over and over. Especially with SMTP connections this speeds up things by 200%. +* If you supply an email object Do not forget to close the mail connection by calling $mail->SMTPClose(); +* +* @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 Array with several email addresses or single string with one email address - * @param mixed $from - * @param mixed $sitename - * @param mixed $ishtml - * @param mixed $bouncemail - * @param mixed $attachment - * @return bool If successful returns true - */ +* @param mixed $from +* @param mixed $sitename +* @param mixed $ishtml +* @param mixed $bouncemail +* @param mixed $attachment +* @return bool If successful returns true +*/ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml=false, $bouncemail=null, $attachment=null, $customheaders="") { @@ -4251,14 +4453,14 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml return false; } - if (is_null($bouncemail) ) - { - $sender=$from; - } - else - { - $sender=$bouncemail; - } + if (is_null($bouncemail) ) + { + $sender=$from; + } + else + { + $sender=$bouncemail; + } $bUnsetEmail=false; if (is_null($mail)) { @@ -4274,61 +4476,61 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml { $mail->SetLanguage('en',$rootdir.'/classes/phpmailer/language/'); } - $mail->CharSet = $emailcharset; - if (isset($emailsmtpssl) && trim($emailsmtpssl)!=='' && $emailsmtpssl!==0) { + $mail->CharSet = $emailcharset; + if (isset($emailsmtpssl) && trim($emailsmtpssl)!=='' && $emailsmtpssl!==0) { if ($emailsmtpssl===1) {$mail->SMTPSecure = "ssl";} - else {$mail->SMTPSecure = $emailsmtpssl;} - } + else {$mail->SMTPSecure = $emailsmtpssl;} + } - $fromname=''; - $fromemail=$from; - if (strpos($from,'<')) - { - $fromemail=substr($from,strpos($from,'<')+1,strpos($from,'>')-1-strpos($from,'<')); - $fromname=trim(substr($from,0, strpos($from,'<')-1)); - } + $fromname=''; + $fromemail=$from; + if (strpos($from,'<')) + { + $fromemail=substr($from,strpos($from,'<')+1,strpos($from,'>')-1-strpos($from,'<')); + $fromname=trim(substr($from,0, strpos($from,'<')-1)); + } - $sendername=''; - $senderemail=$sender; - if (strpos($sender,'<')) - { - $senderemail=substr($sender,strpos($sender,'<')+1,strpos($sender,'>')-1-strpos($sender,'<')); - $sendername=trim(substr($sender,0, strpos($sender,'<')-1)); - } + $sendername=''; + $senderemail=$sender; + if (strpos($sender,'<')) + { + $senderemail=substr($sender,strpos($sender,'<')+1,strpos($sender,'>')-1-strpos($sender,'<')); + $sendername=trim(substr($sender,0, strpos($sender,'<')-1)); + } - switch ($emailmethod) { - case "qmail": - $mail->IsQmail(); - break; - case "smtp": - $mail->IsSMTP(); - if ($emailsmtpdebug>0) - { + switch ($emailmethod) { + case "qmail": + $mail->IsQmail(); + break; + case "smtp": + $mail->IsSMTP(); + if ($emailsmtpdebug>0) + { $mail->SMTPDebug = $emailsmtpdebug; - } - if (strpos($emailsmtphost,':')>0) - { - $mail->Host = substr($emailsmtphost,0,strpos($emailsmtphost,':')); - $mail->Port = substr($emailsmtphost,strpos($emailsmtphost,':')+1); - } - else { - $mail->Host = $emailsmtphost; - } - $mail->Username =$emailsmtpuser; - $mail->Password =$emailsmtppassword; + } + if (strpos($emailsmtphost,':')>0) + { + $mail->Host = substr($emailsmtphost,0,strpos($emailsmtphost,':')); + $mail->Port = substr($emailsmtphost,strpos($emailsmtphost,':')+1); + } + else { + $mail->Host = $emailsmtphost; + } + $mail->Username =$emailsmtpuser; + $mail->Password =$emailsmtppassword; if (trim($emailsmtpuser)!="") - { - $mail->SMTPAuth = true; - } - break; - case "sendmail": - $mail->IsSendmail(); - break; - default: - //Set to the default value to rule out incorrect settings. - $emailmethod="mail"; - $mail->IsMail(); - } + { + $mail->SMTPAuth = true; + } + break; + case "sendmail": + $mail->IsSendmail(); + break; + default: + //Set to the default value to rule out incorrect settings. + $emailmethod="mail"; + $mail->IsMail(); + } $mail->SetFrom($fromemail, $fromname); $mail->Sender = $senderemail; // Sets Return-Path for error notifications @@ -4336,9 +4538,9 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml { if (strpos($singletoemail, '<') ) { - $toemail=substr($singletoemail,strpos($singletoemail,'<')+1,strpos($singletoemail,'>')-1-strpos($singletoemail,'<')); - $toname=trim(substr($singletoemail,0, strpos($singletoemail,'<')-1)); - $mail->AddAddress($toemail,$toname); + $toemail=substr($singletoemail,strpos($singletoemail,'<')+1,strpos($singletoemail,'>')-1-strpos($singletoemail,'<')); + $toname=trim(substr($singletoemail,0, strpos($singletoemail,'<')-1)); + $mail->AddAddress($toemail,$toname); } else { @@ -4351,23 +4553,23 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml $mail->AddCustomHeader($val); } } - $mail->AddCustomHeader("X-Surveymailer: $sitename Emailer (LimeSurvey.sourceforge.net)"); - if (get_magic_quotes_gpc() != "0") {$body = stripcslashes($body);} + $mail->AddCustomHeader("X-Surveymailer: $sitename Emailer (LimeSurvey.sourceforge.net)"); + if (get_magic_quotes_gpc() != "0") {$body = stripcslashes($body);} if ($ishtml) { $mail->IsHTML(true); - $mail->Body = $body; + $mail->Body = $body; $mail->AltBody = trim(strip_tags(html_entity_decode($body,ENT_QUOTES,'UTF-8'))); } else - { + { $mail->IsHTML(false); $mail->Body = $body; - } + } // add the attachment if there is one if(!is_null($attachment)) - $mail->AddAttachment($attachment); + $mail->AddAttachment($attachment); - if (trim($subject)!='') {$mail->Subject = "=?$emailcharset?B?" . base64_encode($subject) . "?=";} + if (trim($subject)!='') {$mail->Subject = "=?$emailcharset?B?" . base64_encode($subject) . "?=";} if ($emailsmtpdebug>0) { ob_start(); } @@ -4384,310 +4586,53 @@ function SendEmailMessage($mail, $body, $subject, $to, $from, $sitename, $ishtml { unset($mail); } - return $sent; + return $sent; } /** - * This functions removes all HTML tags, Javascript, CRs, linefeeds and other strange chars from a given text. CRs, linefeeds are not removed for .csv files - * - * @param string $sTextToFlatten Text you want to clean - * @param boolan $bDecodeHTMLEntities If set to true then all HTML entities will be decoded to the specified charset. Default: false - * @param string $sCharset Charset to decode to if $decodeHTMLEntities is set to true - * - * @return string Cleaned text - */ -function FlattenText($sTextToFlatten, $bDecodeHTMLEntities=false, $sCharset='UTF-8', $bStripNewLines=true) +* This functions removes all HTML tags, Javascript, CRs, linefeeds and other strange chars from a given text +* +* @param string $sTextToFlatten Text you want to clean +* @param boolan $bDecodeHTMLEntities If set to true then all HTML entities will be decoded to the specified charset. Default: false +* @param string $sCharset Charset to decode to if $decodeHTMLEntities is set to true +* +* @return string Cleaned text +*/ +function FlattenText($sTextToFlatten, $bDecodeHTMLEntities=false, $sCharset='UTF-8', $bStripNewLines=true, $keepSpan=false) { $sNicetext = strip_javascript($sTextToFlatten); - $sNicetext = strip_tags($sNicetext); - - if ($bStripNewLines ){ - $sNicetext = preg_replace('~\Ru~', '', $sNicetext); + // When stripping tags, add a space before closing tags so that strings with embedded HTML tables don't get concatenated + $sNicetext = str_replace(' so can show EM syntax-highlighting; add space before tags so that word-wrapping not destroyed when remove tags. + $sNicetext = strip_tags($sNicetext,' + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      '); } - else // unify newlines + else { + $sNicetext = strip_tags($sNicetext); + } + if ($bStripNewLines ){ // strip new lines + $sNicetext = preg_replace(array('~\Ru~'),array(' '), $sNicetext); + } + else // unify newlines to \r\n { - $sNicetext = preg_replace('~\Ru~', "\r\n", $sNicetext); + $sNicetext = preg_replace(array('~\Ru~'), array("\r\n"), $sNicetext); } if ($bDecodeHTMLEntities==true) { $sNicetext = str_replace(' ',' ', $sNicetext); // html_entity_decode does not convert   to spaces $sNicetext = html_entity_decode($sNicetext, ENT_QUOTES, $sCharset); } - 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 - * @global string $gid - * @global string $dbprefix - * @return returns an nested array which contains arrays with the keys: question id (qid), question manditory, target type (type), and list_filter id (fid) - */ -function getArrayFiltersForGroup($surveyid,$gid) -{ - // TODO: Check list_filter values to make sure questions are previous? - global $dbprefix; - $surveyid=sanitize_int($surveyid); - $gid=sanitize_int($gid); - // Get All Questions in Current Group - $fieldmap = createFieldMap($surveyid,'full'); - if($gid != "") { - $qrows = arraySearchByKey($gid, $fieldmap, 'gid'); - } else { - $qrows = $fieldmap; - } - $grows = array(); //Create an empty array in case query not return any rows - // Store each result as an array with in the $grows array - foreach ($qrows as $qrow) { - if (isset($qrow['gid']) && !empty($qrow['gid'])) { - $grows[$qrow['qid']] = array('qid' => $qrow['qid'],'type' => $qrow['type'], 'mandatory' => $qrow['mandatory'], 'title' => $qrow['title'], 'gid' => $qrow['gid']); - } - } - $attrmach = array(); // Stores Matches of filters that have their values as questions with in current group - $grows2 = $grows; - foreach ($grows as $qrow) // Cycle through questions to see if any have list_filter attributes - { - $qresult = getQuestionAttributes($qrow['qid']); - if (isset($qresult['array_filter'])) // We Found a array_filter attribute - { - $val = $qresult['array_filter']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - foreach ($grows2 as $avalue) - { - if ($avalue['title'] == $val) - { - $filter = array('qid' => $qrow['qid'], 'mandatory' => $qrow['mandatory'], 'type' => $avalue['type'], 'fid' => $avalue['qid'], 'gid' => $qrow['gid'], 'gid2'=>$avalue['gid']); - array_push($attrmach,$filter); - } - } - reset($grows2); - } - } - return $attrmach; + $sNicetext = trim($sNicetext); + return $sNicetext; } /** - * getArrayFilterExcludesCascadesForGroup() queries the database and produces a list of array_filter_exclude questions and targets with in the same group - * @global string $surveyid - * @global string $gid - * @global string $output - expects 'qid' or 'title' - * @global string $dbprefix - * @return returns a keyed nested array, keyed by the qid of the question, containing cascade information - */ -function getArrayFilterExcludesCascadesForGroup($surveyid, $gid="", $output="qid") -{ - global $dbprefix; - $surveyid=sanitize_int($surveyid); - $gid=sanitize_int($gid); - - $cascaded=array(); - $sources=array(); - $qidtotitle=array(); - $fieldmap = createFieldMap($surveyid,'full'); - if($gid != "") { - $qrows = arraySearchByKey($gid, $fieldmap, 'gid'); - } else { - $qrows = $fieldmap; - } - $grows = array(); //Create an empty array in case query not return any rows - // Store each result as an array with in the $grows array - foreach ($qrows as $qrow) { - if (isset($qrow['gid']) && !empty($qrow['gid'])) { - $grows[$qrow['qid']] = array('qid' => $qrow['qid'],'type' => $qrow['type'], 'mandatory' => $qrow['mandatory'], 'title' => $qrow['title'], 'gid' => $qrow['gid']); - } - } - $attrmach = array(); // Stores Matches of filters that have their values as questions within current group - foreach ($grows as $qrow) // Cycle through questions to see if any have list_filter attributes - { - $qidtotitle[$qrow['qid']]=$qrow['title']; - $qresult = getQuestionAttributes($qrow['qid'],$qrow['type']); - if (isset($qresult['array_filter_exclude'])) // We Found a array_filter attribute - { - $val = $qresult['array_filter_exclude']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - foreach ($grows as $avalue) // Cycle through all the other questions in this group until we find the source question for this array_filter - { - if ($avalue['title'] == $val) - { - /* This question ($avalue) is the question that provides the source information we use - * to determine which answers show up in the question we're looking at, which is $qrow['qid'] - * So, in other words, we're currently working on question $qrow['qid'], trying to find out more - * information about question $avalue['qid'], because that's the source */ - $sources[$qrow['qid']]=$avalue['qid']; /* This question ($qrow['qid']) relies on answers in $avalue['qid'] */ - if(isset($cascades)) {unset($cascades);} - $cascades=array(); /* Create an empty array */ - - /* At this stage, we know for sure that this question relies on one other question for the filter */ - /* But this function wants to send back information about questions that rely on multiple other questions for the filter */ - /* So we don't want to do anything yet */ - - /* What we need to do now, is check whether the question this one relies on, also relies on another */ - - /* The question we are now checking is $avalue['qid'] */ - $keepgoing=1; - $questiontocheck=$avalue['qid']; - /* If there is a key in the $sources array that is equal to $avalue['qid'] then we want to add that - * to the $cascades array */ - while($keepgoing > 0) - { - if(!empty($sources[$questiontocheck])) - { - $cascades[] = $sources[$questiontocheck]; - /* Now we need to move down the chain */ - /* We want to check the $sources[$questiontocheck] question */ - $questiontocheck=$sources[$questiontocheck]; - } else { - /* Since it was empty, there must not be any more questions down the cascade */ - $keepgoing=0; - } - } - /* Now add all that info */ - if(count($cascades) > 0) { - $cascaded[$qrow['qid']]=$cascades; - } - } - } - } - } - $cascade2=array(); - if($output == "title") - { - foreach($cascaded as $key=>$cascade) { - foreach($cascade as $item) - { - $cascade2[$key][]=$qidtotitle[$item]; - } - } - $cascaded=$cascade2; - } - return $cascaded; -} - -/** - * getArrayFilterExcludesForGroup() queries the database and produces a list of array_filter_exclude questions and targets with in the same group - * @global string $surveyid - * @global string $gid - * @global string $dbprefix - * @return returns an nested array which contains arrays with the keys: question id (qid), question manditory, target type (type), and list_filter id (fid) - */ -function getArrayFilterExcludesForGroup($surveyid,$gid) -{ - // TODO: Check list_filter values to make sure questions are previous? - global $dbprefix; - $surveyid=sanitize_int($surveyid); - $gid=sanitize_int($gid); - // Get All Questions in Current Group - $fieldmap = createFieldMap($surveyid,'full'); - if($gid != "") { - $qrows = arraySearchByKey($gid, $fieldmap, 'gid'); - } else { - $qrows = $fieldmap; - } - $grows = array(); //Create an empty array in case query not return any rows - // Store each result as an array with in the $grows array - foreach ($qrows as $qrow) { - if (isset($qrow['gid']) && !empty($qrow['gid'])) { - $grows[$qrow['qid']] = array('qid' => $qrow['qid'],'type' => $qrow['type'], 'mandatory' => $qrow['mandatory'], 'title' => $qrow['title'], 'gid' => $qrow['gid']); - } - } - $attrmach = array(); // Stores Matches of filters that have their values as questions within current group - $grows2 = $grows; - foreach ($grows as $qrow) // Cycle through questions to see if any have list_filter attributes - { - $qresult = getQuestionAttributes($qrow['qid'],$qrow['type']); - if (isset($qresult['array_filter_exclude'])) // We Found a array_filter attribute - { - $val = $qresult['array_filter_exclude']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - foreach ($grows2 as $avalue) - { - if ($avalue['title'] == $val) - { - //Get the code for this question, so we can see if any later questions in this group us it for an array_filter_exclude - $cqquery = "SELECT {$dbprefix}questions.title FROM {$dbprefix}questions WHERE {$dbprefix}questions.qid='".$qrow['qid']."'"; - $cqresult=db_execute_assoc($cqquery); - $xqid=""; - while($ftitle=$cqresult->FetchRow()) - { - $xqid=$ftitle['title']; - } - - $filter = array('qid' => $qrow['qid'], - 'mandatory' => $qrow['mandatory'], - 'type' => $avalue['type'], - 'fid' => $avalue['qid'], - 'gid' => $qrow['gid'], - 'gid2' => $avalue['gid'], - 'source_title' => $avalue['title'], - 'source_qid' => $avalue['qid'], - 'this_title' => $xqid); - array_push($attrmach,$filter); - } - } - reset($grows2); - } - } - return $attrmach; -} - -/** - * getArrayFiltersForQuestion($qid) finds out if a question has an array_filter attribute and what codes where selected on target question - * @global string $surveyid - * @global string $gid - * @global string $dbprefix - * @return returns an array of codes that were selected else returns false - */ -function getArrayFiltersForQuestion($qid) -{ - static $cache = array(); - - // TODO: Check list_filter values to make sure questions are previous? - global $surveyid, $dbprefix; - $qid=sanitize_int($qid); - - if (isset($cache[$qid])) return $cache[$qid]; - - $attributes = getQuestionAttributes($qid); - if (isset($attributes['array_filter']) && isset($_SESSION['fieldarray'])) { - $val = $attributes['array_filter']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - foreach ($_SESSION['fieldarray'] as $fields) - { - if ($fields[2] == $val) - { - // we found the target question, now we need to know what the answers where, we know its a multi! - $fields[0]=sanitize_int($fields[0]); - $query = "SELECT title FROM ".db_table_name('questions')." where parent_qid='{$fields[0]}' AND language='".$_SESSION['s_lang']."' order by question_order"; - $qresult = db_execute_assoc($query); //Checked - $selected = array(); - while ($code = $qresult->fetchRow()) - { - if ((isset($_SESSION[$fields[1].$code['title']]) && $_SESSION[$fields[1].$code['title']] == "Y") - || $_SESSION[$fields[1]] == $code['title']) array_push($selected,$code['title']); - } - - //Now we also need to find out if (a) the question had "other" enabled, and (b) if that was selected - $query = "SELECT other FROM ".db_table_name('questions')." where qid='{$fields[0]}'"; - $qresult = db_execute_assoc($query); - while ($row=$qresult->fetchRow()) {$other=$row['other'];} - if($other == "Y") - { - if($_SESSION[$fields[1].'other'] != "") {array_push($selected, "other");} - } - $cache[$qid] = $selected; - return $cache[$qid]; - } - } - $cache[$qid] = false; - return $cache[$qid]; - } - $cache[$qid] = false; - return $cache[$qid]; -} -/** - * getGroupsByQuestion($surveyid) - * @global string $surveyid - * @return returns a keyed array of groups to questions ie: array([1]=>[2]) question qid 1, is in group gid 2. - */ +* getGroupsByQuestion($surveyid) +* @global string $surveyid +* @return returns a keyed array of groups to questions ie: array([1]=>[2]) question qid 1, is in group gid 2. +*/ function getGroupsByQuestion($surveyid) { global $surveyid, $dbprefix; @@ -4702,151 +4647,22 @@ function getGroupsByQuestion($surveyid) { } return $output; } -/** - * getArrayFilterExcludesForQuestion($qid) finds out if a question has an array_filter_exclude attribute and what codes where selected on target question - * @global string $surveyid - * @global string $gid - * @global string $dbprefix - * @return returns an array of codes that were selected else returns false - */ -function getArrayFilterExcludesForQuestion($qid) -{ - static $cascadesCache = array(); - static $cache = array(); - - // TODO: Check list_filter values to make sure questions are previous? - global $surveyid, $dbprefix; - $qid=sanitize_int($qid); - - if (isset($cache[$qid])) return $cache[$qid]; - - $attributes = getQuestionAttributes($qid); - $excludevals=array(); - if (isset($attributes['array_filter_exclude'])) // We Found a array_filter_exclude attribute - { - $selected=array(); - $excludevals[] = $attributes['array_filter_exclude']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - /* Find any cascades and place them in the $excludevals array*/ - if (!isset($cascadesCache[$surveyid])) { - $cascadesCache[$surveyid] = getArrayFilterExcludesCascadesForGroup($surveyid, "", "title"); - } - $array_filterXqs_cascades = $cascadesCache[$surveyid]; - - if(isset($array_filterXqs_cascades[$qid])) - { - foreach($array_filterXqs_cascades[$qid] as $afc) - { - $excludevals[]=array("value"=>$afc); - - } - } - /* For each $val (question title) that applies to this, check what values exist and add them to the $selected array */ - foreach ($excludevals as $val) - { - foreach ($_SESSION['fieldarray'] as $fields) //iterate through every question in the survey - { - if ($fields[2] == $val) - { - // we found the target question, now we need to know what the answers were! - $fields[0]=sanitize_int($fields[0]); - $query = "SELECT title FROM ".db_table_name('questions')." where parent_qid='{$fields[0]}' AND language='".$_SESSION['s_lang']."' order by question_order"; - $qresult = db_execute_assoc($query); //Checked - while ($code = $qresult->fetchRow()) - { - if (isset($_SESSION[$fields[1]])) - if ((isset($_SESSION[$fields[1].$code['title']]) && $_SESSION[$fields[1].$code['title']] == "Y") - || $_SESSION[$fields[1]] == $code['title']) - array_push($selected,$code['title']); - } - //Now we also need to find out if (a) the question had "other" enabled, and (b) if that was selected - $query = "SELECT other FROM ".db_table_name('questions')." where qid='{$fields[0]}'"; - $qresult = db_execute_assoc($query); - while ($row=$qresult->fetchRow()) {$other=$row['other'];} - if($other == "Y") - { - if($_SESSION[$fields[1].'other'] != "") {array_push($selected, "other");} - } - } - } - } - if(count($selected) > 0) - { - $cache[$qid] = $selected; - return $cache[$qid]; - } else { - $cache[$qid] = false; - return $cache[$qid]; - } - } - $cache[$qid] = false; - return $cache[$qid]; -} -/** - * getArrayFiltersForGroup($qid) finds out if a question is in the current group or not for array filter - * @global string $qid - * @return returns true if its not in currect group and false if it is.. - */ -function getArrayFiltersOutGroup($qid) -{ - // TODO: Check list_filter values to make sure questions are previous? - global $surveyid, $dbprefix, $gid; - $qid=sanitize_int($qid); - $attributes = getQuestionAttributes($qid); - if (isset($attributes['array_filter'])) // We Found a array_filter attribute - { - $val = $attributes['array_filter']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - - // we found the target question, now we need to know what the answers where, we know its a multi! - $surveyid=returnglobal('sid'); - $fieldmap = createFieldMap($surveyid, 'full'); - $val2 = arraySearchByKey($val, $fieldmap, 'title', 1); - if ($val2['gid'] != $gid) return true; - if ($val2['gid'] == $gid) return false; - return false; - } - return false; -} /** - * getArrayFiltersExcludesOutGroup($qid) finds out if a question is in the current group or not for array filter exclude - * @global string $qid - * @return returns true if its not in currect group and false if it is.. - */ -function getArrayFiltersExcludesOutGroup($qid) -{ - // TODO: Check list_filter values to make sure questions are previous? - global $surveyid, $dbprefix, $gid; - $qid=sanitize_int($qid); - $attributes = getQuestionAttributes($qid); - if (isset($attributes['array_filter_exclude'])) // We Found a array_filter attribute - { - $val = $attributes['array_filter_exclude']; // Get the Value of the Attribute ( should be a previous question's title in same group ) - - // we found the target question, now we need to know what the answers where, we know its a multi! - $surveyid=returnglobal('sid'); - $fieldmap = createFieldMap($surveyid, 'full'); - $val2 = arraySearchByKey($val, $fieldmap, 'title', 1); - if ($val2['gid'] != $gid) return true; - if ($val2['gid'] == $gid) return false; - } - return false; -} - -/** - * Run an arbitrary sequence of semicolon-delimited SQL commands - * - * Assumes that the input text (file or string) consists of - * a number of SQL statements ENDING WITH SEMICOLONS. The - * semicolons MUST be the last character in a line. - * Lines that are blank or that start with "#" or "--" (postgres) are ignored. - * Only tested with mysql dump files (mysqldump -p -d limesurvey) - * Function kindly borrowed by Moodle - * @uses $dbprefix - * @param string $sqlfile The path where a file with sql commands can be found on the server. - * @param string $sqlstring If no path is supplied then a string with semicolon delimited sql - * commands can be supplied in this argument. - * @return bool Returns true if database was modified successfully. - */ +* Run an arbitrary sequence of semicolon-delimited SQL commands +* +* Assumes that the input text (file or string) consists of +* a number of SQL statements ENDING WITH SEMICOLONS. The +* semicolons MUST be the last character in a line. +* Lines that are blank or that start with "#" or "--" (postgres) are ignored. +* Only tested with mysql dump files (mysqldump -p -d limesurvey) +* Function kindly borrowed by Moodle +* @uses $dbprefix +* @param string $sqlfile The path where a file with sql commands can be found on the server. +* @param string $sqlstring If no path is supplied then a string with semicolon delimited sql +* commands can be supplied in this argument. +* @return bool Returns true if database was modified successfully. +*/ function modify_database($sqlfile='', $sqlstring='') { global $dbprefix; @@ -4980,7 +4796,7 @@ function createPassword() for ($i=0; $i<$password_length; $i++) { - $passwd .= $pwchars[floor(rand(0,strlen($pwchars)-1))]; + $passwd .= $pwchars[(int)floor(rand(0,strlen($pwchars)-1))]; } return $passwd; } @@ -5021,8 +4837,8 @@ function sGetSurveyUserlist($bIncludeOwner=true, $bIncludeSuperAdmins=true) $surveyid=sanitize_int($surveyid); $sSurveyIDQuery = "SELECT a.uid, a.users_name, a.full_name FROM ".db_table_name('users')." AS a - LEFT OUTER JOIN (SELECT uid AS id FROM ".db_table_name('survey_permissions')." WHERE sid = {$surveyid}) AS b ON a.uid = b.id - WHERE id IS NULL "; + LEFT OUTER JOIN (SELECT uid AS id FROM ".db_table_name('survey_permissions')." WHERE sid = {$surveyid}) AS b ON a.uid = b.id + WHERE id IS NULL "; if (!$bIncludeSuperAdmins) { $sSurveyIDQuery.='and superadmin=0 '; @@ -5223,11 +5039,11 @@ function convertCSVRowToArray($string, $seperator, $quotechar) /** - * This function removes surrounding and masking quotes from the CSV field - * - * @param mixed $field - * @return mixed - */ +* This function removes surrounding and masking quotes from the CSV field +* +* @param mixed $field +* @return mixed +*/ function CSVUnquote($field) { //print $field.":"; @@ -5239,11 +5055,11 @@ function CSVUnquote($field) } /** - * CleanLanguagesFromSurvey() removes any languages from survey tables that are not in the passed list - * @param string $sid - the currently selected survey - * @param string $availlangs - space seperated list of additional languages in survey - * @return bool - always returns true - */ +* CleanLanguagesFromSurvey() removes any languages from survey tables that are not in the passed list +* @param string $sid - the currently selected survey +* @param string $availlangs - space seperated list of additional languages in survey +* @return bool - always returns true +*/ function CleanLanguagesFromSurvey($sid, $availlangs) { global $connect; @@ -5289,11 +5105,11 @@ function CleanLanguagesFromSurvey($sid, $availlangs) } /** - * FixLanguageConsistency() fixes missing groups,questions,answers & assessments for languages on a survey - * @param string $sid - the currently selected survey - * @param string $availlangs - space seperated list of additional languages in survey - if empty all additional languages of a survey are checked against the base language - * @return bool - always returns true - */ +* FixLanguageConsistency() fixes missing groups,questions,answers & assessments for languages on a survey +* @param string $sid - the currently selected survey +* @param string $availlangs - space seperated list of additional languages in survey - if empty all additional languages of a survey are checked against the base language +* @return bool - always returns true +*/ function FixLanguageConsistency($sid, $availlangs='') { global $connect, $databasetype; @@ -5304,11 +5120,41 @@ function FixLanguageConsistency($sid, $availlangs='') $langs = explode(" ",$availlangs); if($langs[count($langs)-1] == "") array_pop($langs); } else { - $langs=GetAdditionalLanguagesFromSurveyID($sid); + $langs=GetAdditionalLanguagesFromSurveyID($sid); } $baselang = GetBaseLanguageFromSurveyID($sid); $sid=sanitize_int($sid); + + $query = "SELECT * FROM ".db_table_name('quota_languagesettings')." join ".db_table_name('quota')." q on quotals_quota_id=q.id WHERE q.sid='{$sid}' AND quotals_language='{$baselang}'"; + $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); + if ($result->RecordCount() > 0) + { + while ($qls = $result->FetchRow()) + { + foreach ($langs as $lang) + { + $query = "SELECT quotals_id FROM ".db_table_name('quota_languagesettings')." WHERE quotals_quota_id='{$qls['quotals_quota_id']}' AND quotals_language='{$lang}'"; + $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked + if ($gresult->RecordCount() < 1) + { + $query = "INSERT INTO ".db_table_name('quota_languagesettings') + ." (quotals_quota_id,quotals_language,quotals_name,quotals_message,quotals_url,quotals_urldescrip) VALUES (" + . "'".$qls['quotals_quota_id']."'," + . "'".$lang."'," + . db_quoteall($qls['quotals_name'])."," + . db_quoteall($qls['quotals_message'])."," + . "'".$qls['quotals_url']."'," + . db_quoteall($qls['quotals_urldescrip'])."" + . ")"; + $connect->Execute($query) or safe_die($connect->ErrorMsg()); //Checked + db_switchIDInsert('quota_languagesettings',false); + } + } + reset($langs); + } + } + $query = "SELECT * FROM ".db_table_name('groups')." WHERE sid='{$sid}' AND language='{$baselang}' ORDER BY group_order"; $result = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked if ($result->RecordCount() > 0) @@ -5322,7 +5168,7 @@ function FixLanguageConsistency($sid, $availlangs='') if ($gresult->RecordCount() < 1) { db_switchIDInsert('groups',true); - $query = "INSERT INTO ".db_table_name('groups')." (gid,sid,group_name,group_order,description,language) VALUES('{$group['gid']}','{$group['sid']}',".db_quoteall($group['group_name']).",'{$group['group_order']}',".db_quoteall($group['description']).",'{$lang}')"; + $query = "INSERT INTO ".db_table_name('groups')." (gid,sid,group_name,group_order,description,grelevance,language) VALUES('{$group['gid']}','{$group['sid']}',".db_quoteall($group['group_name']).",'{$group['group_order']}',".db_quoteall($group['description']).",'".db_quote($group['grelevance'])."','{$lang}')"; $connect->Execute($query) or safe_die($connect->ErrorMsg()); //Checked db_switchIDInsert('groups',false); } @@ -5341,12 +5187,12 @@ function FixLanguageConsistency($sid, $availlangs='') array_push($quests,$question['qid']); foreach ($langs as $lang) { - $query = "SELECT qid FROM ".db_table_name('questions')." WHERE sid='{$sid}' AND qid='{$question['qid']}' AND language='{$lang}'"; + $query = "SELECT qid FROM ".db_table_name('questions')." WHERE sid='{$sid}' AND qid='{$question['qid']}' AND language='{$lang}' AND scale_id={$question['scale_id']}"; $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked if ($gresult->RecordCount() < 1) { db_switchIDInsert('questions',true); - $query = "INSERT INTO ".db_table_name('questions')." (qid,sid,gid,type,title,question,preg,help,other,mandatory,question_order,language, scale_id,parent_qid) VALUES('{$question['qid']}','{$question['sid']}','{$question['gid']}','{$question['type']}',".db_quoteall($question['title']).",".db_quoteall($question['question']).",".db_quoteall($question['preg']).",".db_quoteall($question['help']).",'{$question['other']}','{$question['mandatory']}','{$question['question_order']}','{$lang}',{$question['scale_id']},{$question['parent_qid']})"; + $query = "INSERT INTO ".db_table_name('questions')." (qid,sid,gid,type,title,question,preg,help,other,mandatory,question_order,language, scale_id,parent_qid, relevance) VALUES('{$question['qid']}','{$question['sid']}','{$question['gid']}','{$question['type']}',".db_quoteall($question['title']).",".db_quoteall($question['question']).",".db_quoteall($question['preg']).",".db_quoteall($question['help']).",'{$question['other']}','{$question['mandatory']}','{$question['question_order']}','{$lang}',{$question['scale_id']},{$question['parent_qid']}, '{$question['relevance']}')"; $connect->Execute($query) or safe_die($query."
      ".$connect->ErrorMsg()); //Checked db_switchIDInsert('questions',false); } @@ -5368,7 +5214,7 @@ function FixLanguageConsistency($sid, $availlangs='') { foreach ($langs as $lang) { - $query = "SELECT qid FROM ".db_table_name('answers')." WHERE code='{$answer['code']}' AND qid='{$answer['qid']}' AND language='{$lang}'"; + $query = "SELECT qid FROM ".db_table_name('answers')." WHERE code='{$answer['code']}' AND qid='{$answer['qid']}' AND language='{$lang}' AND scale_id={$answer['scale_id']}"; $gresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked if ($gresult->RecordCount() < 1) { @@ -5412,357 +5258,6 @@ function FixLanguageConsistency($sid, $availlangs='') return true; } -/** - * GetGroupDepsForConditions() get Dependencies between groups caused by conditions - * @param string $sid - the currently selected survey - * @param string $depgid - (optionnal) get only the dependencies applying to the group with gid depgid - * @param string $targgid - (optionnal) get only the dependencies for groups dependents on group targgid - * @param string $index-by - (optionnal) "by-depgid" for result indexed with $res[$depgid][$targgid] - * "by-targgid" for result indexed with $res[$targgid][$depgid] - * @return array - returns an array describing the conditions or NULL if no dependecy is found - * - * Example outupt assumin $index-by="by-depgid": - *Array - *( - * [125] => Array // Group Id 125 is dependent on - * ( - * [123] => Array // Group Id 123 - * ( - * [depgpname] => G3 // GID-125 has name G3 - * [targetgpname] => G1 // GID-123 has name G1 - * [conditions] => Array - * ( - * [189] => Array // Because Question Id 189 - * ( - * [0] => 9 // Have condition 9 set - * [1] => 10 // and condition 10 set - * [2] => 14 // and condition 14 set - * ) - * - * ) - * - * ) - * - * [124] => Array // GID 125 is also dependent on GID 124 - * ( - * [depgpname] => G3 - * [targetgpname] => G2 - * [conditions] => Array - * ( - * [189] => Array // Because Question Id 189 have conditions set - * ( - * [0] => 11 - * ) - * - * [215] => Array // And because Question Id 215 have conditions set - * ( - * [0] => 12 - * ) - * - * ) - * - * ) - * - * ) - * - *) - * - * Usage example: - * * Get all group dependencies for SID $sid indexed by depgid: - * $result=GetGroupDepsForConditions($sid); - * * Get all group dependencies for GID $gid in survey $sid indexed by depgid: - * $result=GetGroupDepsForConditions($sid,$gid); - * * Get all group dependents on group $gid in survey $sid indexed by targgid: - * $result=GetGroupDepsForConditions($sid,"all",$gid,"by-targgid"); - */ -function GetGroupDepsForConditions($sid,$depgid="all",$targgid="all",$indexby="by-depgid") -{ - global $connect, $clang; - $sid=sanitize_int($sid); - $condarray = Array(); - - $sqldepgid=""; - $sqltarggid=""; - if ($depgid != "all") { $depgid = sanitize_int($depgid); $sqldepgid="AND tq.gid=$depgid";} - if ($targgid != "all") {$targgid = sanitize_int($targgid); $sqltarggid="AND tq2.gid=$targgid";} - - $baselang = GetBaseLanguageFromSurveyID($sid); - $condquery = "SELECT tg.gid as depgid, tg.group_name as depgpname, " - . "tg2.gid as targgid, tg2.group_name as targgpname, tq.qid as depqid, tc.cid FROM " - . db_table_name('conditions')." AS tc, " - . db_table_name('questions')." AS tq, " - . db_table_name('questions')." AS tq2, " - . db_table_name('groups')." AS tg ," - . db_table_name('groups')." AS tg2 " - . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tg.language='{$baselang}' AND tg2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid=$sid " - . "AND tq.gid = tg.gid AND tg2.gid = tq2.gid " - . "AND tq2.qid=tc.cqid AND tq.gid != tg2.gid $sqldepgid $sqltarggid"; - $condresult=db_execute_assoc($condquery) or safe_die($connect->ErrorMsg()); //Checked - - if ($condresult->RecordCount() > 0) { - while ($condrow = $condresult->FetchRow()) - { - - switch ($indexby) - { - case "by-depgid": - $depgid=$condrow['depgid']; - $targetgid=$condrow['targgid']; - $depqid=$condrow['depqid']; - $cid=$condrow['cid']; - $condarray[$depgid][$targetgid]['depgpname'] = $condrow['depgpname']; - $condarray[$depgid][$targetgid]['targetgpname'] = $condrow['targgpname']; - $condarray[$depgid][$targetgid]['conditions'][$depqid][]=$cid; - break; - - case "by-targgid": - $depgid=$condrow['depgid']; - $targetgid=$condrow['targgid']; - $depqid=$condrow['depqid']; - $cid=$condrow['cid']; - $condarray[$targetgid][$depgid]['depgpname'] = $condrow['depgpname']; - $condarray[$targetgid][$depgid]['targetgpname'] = $condrow['targgpname']; - $condarray[$targetgid][$depgid]['conditions'][$depqid][] = $cid; - break; - } - } - return $condarray; - } - return null; -} - -/** - * GetQuestDepsForConditions() get Dependencies between groups caused by conditions - * @param string $sid - the currently selected survey - * @param string $gid - (optionnal) only search dependecies inside the Group Id $gid - * @param string $depqid - (optionnal) get only the dependencies applying to the question with qid depqid - * @param string $targqid - (optionnal) get only the dependencies for questions dependents on question Id targqid - * @param string $index-by - (optionnal) "by-depqid" for result indexed with $res[$depqid][$targqid] - * "by-targqid" for result indexed with $res[$targqid][$depqid] - * @return array - returns an array describing the conditions or NULL if no dependecy is found - * - * Example outupt assumin $index-by="by-depqid": - *Array - *( - * [184] => Array // Question Id 184 - * ( - * [183] => Array // Depends on Question Id 183 - * ( - * [0] => 5 // Because of condition Id 5 - * ) - * - * ) - * - *) - * - * Usage example: - * * Get all questions dependencies for Survey $sid and group $gid indexed by depqid: - * $result=GetQuestDepsForConditions($sid,$gid); - * * Get all questions dependencies for question $qid in survey/group $sid/$gid indexed by depqid: - * $result=GetGroupDepsForConditions($sid,$gid,$qid); - * * Get all questions dependents on question $qid in survey/group $sid/$gid indexed by targqid: - * $result=GetGroupDepsForConditions($sid,$gid,"all",$qid,"by-targgid"); - */ -function GetQuestDepsForConditions($sid,$gid="all",$depqid="all",$targqid="all",$indexby="by-depqid", $searchscope="samegroup") -{ - global $connect, $clang; - $condarray = Array(); - - $baselang = GetBaseLanguageFromSurveyID($sid); - $sqlgid=""; - $sqldepqid=""; - $sqltargqid=""; - $sqlsearchscope=""; - if ($gid != "all") {$gid = sanitize_int($gid); $sqlgid="AND tq.gid=$gid";} - if ($depqid != "all") {$depqid = sanitize_int($depqid); $sqldepqid="AND tq.qid=$depqid";} - if ($targqid != "all") {$targqid = sanitize_int($targqid); $sqltargqid="AND tq2.qid=$targqid";} - if ($searchscope == "samegroup") {$sqlsearchscope="AND tq2.gid=tq.gid";} - - $condquery = "SELECT tq.qid as depqid, tq2.qid as targqid, tc.cid FROM " - . db_table_name('conditions')." AS tc, " - . db_table_name('questions')." AS tq, " - . db_table_name('questions')." AS tq2 " - . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid=$sid " - . "AND tq2.qid=tc.cqid $sqlsearchscope $sqlgid $sqldepqid $sqltargqid"; - - $condresult=db_execute_assoc($condquery) or safe_die($connect->ErrorMsg()); //Checked - - if ($condresult->RecordCount() > 0) { - while ($condrow = $condresult->FetchRow()) - { - $depqid=$condrow['depqid']; - $targetqid=$condrow['targqid']; - $condid=$condrow['cid']; - switch ($indexby) - { - case "by-depqid": - $condarray[$depqid][$targetqid][] = $condid; - break; - - case "by-targqid": - $condarray[$targetqid][$depqid][] = $condid; - break; - } - } - return $condarray; - } - return null; -} - - -/** - * checkMovequestionConstraintsForConditions() - * @param string $sid - the currently selected survey - * @param string $qid - qid of the question you want to check possible moves - * @param string $newgid - (optionnal) get only constraints when trying to move to this particular GroupId - * otherwise, get all moves constraints for this question - * - * @return array - returns an array describing the conditions - * Array - * ( - * ['notAbove'] = null | Array - * ( - * Array ( gid1, group_order1, qid1, cid1 ) - * ) - * ['notBelow'] = null | Array - * ( - * Array ( gid2, group_order2, qid2, cid2 ) - * ) - * ) - * - * This should be read as: - * - this question can't be move above group gid1 in position group_order1 because of the condition cid1 on question qid1 - * - this question can't be move below group gid2 in position group_order2 because of the condition cid2 on question qid2 - * - */ -function checkMovequestionConstraintsForConditions($sid,$qid,$newgid="all") -{ - global $connect; - $resarray=Array(); - $resarray['notAbove']=null; // defaults to no constraint - $resarray['notBelow']=null; // defaults to no constraint - $sid=sanitize_int($sid); - $qid=sanitize_int($qid); - - if ($newgid != "all") - { - $newgid=sanitize_int($newgid); - $newgorder=getGroupOrder($sid,$newgid); - } - else - { - $neworder=""; // Not used in this case - } - - $baselang = GetBaseLanguageFromSurveyID($sid); - - // First look for 'my dependencies': questions on which I have set conditions - $condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " - . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " - . "tc.cid FROM " - . db_table_name('conditions')." AS tc, " - . db_table_name('questions')." AS tq, " - . db_table_name('questions')." AS tq2, " - . db_table_name('groups')." AS tg, " - . db_table_name('groups')." AS tg2 " - . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid=$sid " - . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq.qid=$qid ORDER BY tg2.group_order DESC"; - - $condresult=db_execute_assoc($condquery) or safe_die($connect->ErrorMsg()); //Checked - - if ($condresult->RecordCount() > 0) { - - while ($condrow = $condresult->FetchRow() ) - { - // This Question can go up to the minimum GID on the 1st row - $depqid=$condrow['depqid']; - $depgid=$condrow['depgid']; - $depgorder=$condrow['depgorder']; - $targetqid=$condrow['targqid']; - $targetgid=$condrow['targgid']; - $targetgorder=$condrow['targgorder']; - $condid=$condrow['cid']; - //echo "This question can't go above to GID=$targetgid/order=$targetgorder because of CID=$condid"; - if ($newgid != "all") - { // Get only constraints when trying to move to this group - if ($newgorder < $targetgorder) - { - $resarray['notAbove'][]=Array($targetgid,$targetgorder,$depqid,$condid); - } - } - else - { // get all moves constraints - $resarray['notAbove'][]=Array($targetgid,$targetgorder,$depqid,$condid); - } - } - } - - // Secondly look for 'questions dependent on me': questions that have conditions on my answers - $condquery = "SELECT tq.qid as depqid, tq.gid as depgid, tg.group_order as depgorder, " - . "tq2.qid as targqid, tq2.gid as targgid, tg2.group_order as targgorder, " - . "tc.cid FROM " - . db_table_name('conditions')." AS tc, " - . db_table_name('questions')." AS tq, " - . db_table_name('questions')." AS tq2, " - . db_table_name('groups')." AS tg, " - . db_table_name('groups')." AS tg2 " - . "WHERE tq.language='{$baselang}' AND tq2.language='{$baselang}' AND tc.qid = tq.qid AND tq.sid=$sid " - . "AND tq2.qid=tc.cqid AND tg.gid=tq.gid AND tg2.gid=tq2.gid AND tq2.qid=$qid ORDER BY tg.group_order"; - - $condresult=db_execute_assoc($condquery) or safe_die($connect->ErrorMsg()); //Checked - - if ($condresult->RecordCount() > 0) { - - while ($condrow = $condresult->FetchRow()) - { - // This Question can go down to the maximum GID on the 1st row - $depqid=$condrow['depqid']; - $depgid=$condrow['depgid']; - $depgorder=$condrow['depgorder']; - $targetqid=$condrow['targqid']; - $targetgid=$condrow['targgid']; - $targetgorder=$condrow['targgorder']; - $condid=$condrow['cid']; - //echo "This question can't go below to GID=$depgid/order=$depgorder because of CID=$condid"; - if ($newgid != "all") - { // Get only constraints when trying to move to this group - if ($newgorder > $depgorder) - { - $resarray['notBelow'][]=Array($depgid,$depgorder,$depqid,$condid); - } - } - else - { // get all moves constraints - $resarray['notBelow'][]=Array($depgid,$depgorder,$depqid,$condid); - } - } - } - return $resarray; -} - - -/** - * Return an array describing what queXS questionnaireId and sampleId to filter results on - * - * @return array The questionnaire Id and sample Id to filter to (sample id is null for entire questionnaire) - * @author Adam Zammit - * @since 2011-09-07 - */ -function questionnaireSampleFilterstate() -{ - $letsfilter = returnglobal('quexsfilterinc'); - - $_SESSION['quexsanswers']=$letsfilter; - - $qs = explode(":",$_SESSION['quexsanswers']); - - if (count($qs) == 2) - { - return $qs; - } - return false; -} - function incompleteAnsFilterstate() { global $filterout_incomplete_answers; @@ -5795,11 +5290,11 @@ function incompleteAnsFilterstate() } /** - * captcha_enabled($screen, $usecaptchamode) - * @param string $screen - the screen name for which to test captcha activation - * - * @return boolean - returns true if captcha must be enabled - **/ +* captcha_enabled($screen, $usecaptchamode) +* @param string $screen - the screen name for which to test captcha activation +* +* @return boolean - returns true if captcha must be enabled +**/ function captcha_enabled($screen, $captchamode='') { switch($screen) @@ -5852,11 +5347,11 @@ function captcha_enabled($screen, $captchamode='') /** - * used for import[survey|questions|groups] - * - * @param mixed $string - * @return mixed - */ +* used for import[survey|questions|groups] +* +* @param mixed $string +* @return mixed +*/ function convertCsvreturn2return($string) { $string= str_replace('\n', "\n", $string); @@ -5866,16 +5361,16 @@ function convertCsvreturn2return($string) /** - * Checks that each object from an array of CSV data [question-rows,answer-rows,labelsets-row] supports at least a given language - * - * @param mixed $csvarray array with a line of csv data per row - * @param mixed $idkeysarray array of integers giving the csv-row numbers of the object keys - * @param mixed $langfieldnum integer giving the csv-row number of the language(s) filed - * ==> the language field can be a single language code or a - * space separated language code list - * @param mixed $langcode the language code to be tested - * @param mixed $hasheader if we should strip off the first line (if it contains headers) - */ +* Checks that each object from an array of CSV data [question-rows,answer-rows,labelsets-row] supports at least a given language +* +* @param mixed $csvarray array with a line of csv data per row +* @param mixed $idkeysarray array of integers giving the csv-row numbers of the object keys +* @param mixed $langfieldnum integer giving the csv-row number of the language(s) filed +* ==> the language field can be a single language code or a +* space separated language code list +* @param mixed $langcode the language code to be tested +* @param mixed $hasheader if we should strip off the first line (if it contains headers) +*/ function bDoesImportarraySupportsLanguage($csvarray,$idkeysarray,$langfieldnum,$langcode, $hasheader = false) { // An array with one row per object id and langsupport status as value @@ -5927,17 +5422,17 @@ function bDoesImportarraySupportsLanguage($csvarray,$idkeysarray,$langfieldnum, } /** This function checks to see if there is an answer saved in the survey session - * data that matches the $code. If it does, it returns that data. - * It is used when building a questions text to allow incorporating the answer - * to an earlier question into the text of a later question. - * IE: Q1: What is your name? [Jason] - * Q2: Hi [Jason] how are you ? - * This function is called from the retriveAnswers function. - * - * @param mixed $code - * @param mixed $phpdateformat The date format in which any dates are shown - * @return mixed returns the answerText from session variable corresponding to a question code - */ +* data that matches the $code. If it does, it returns that data. +* It is used when building a questions text to allow incorporating the answer +* to an earlier question into the text of a later question. +* IE: Q1: What is your name? [Jason] +* Q2: Hi [Jason] how are you ? +* This function is called from the retriveAnswers function. +* +* @param mixed $code +* @param mixed $phpdateformat The date format in which any dates are shown +* @return mixed returns the answerText from session variable corresponding to a question code +*/ function retrieve_Answer($code, $phpdateformat=null) { //This function checks to see if there is an answer saved in the survey session @@ -5959,7 +5454,7 @@ function retrieve_Answer($code, $phpdateformat=null) if ($questiondetails['type'] == "M" || $questiondetails['type'] == "P") { - if (strpos($code,'comment')>0 && isset($_SESSION[$code])) + if ((strpos($code,'comment')>0 || strpos($code,'other')>0) && isset($_SESSION[$code])) { return $_SESSION[$code]; } @@ -5997,7 +5492,7 @@ function retrieve_Answer($code, $phpdateformat=null) elseif (!$_SESSION[$code] && $_SESSION[$code] !=0) { //$return=$clang->gT("No answer"); - $return = ""; //queXS Addition + $return = ""; //queXS Addition } else { @@ -6012,11 +5507,11 @@ function retrieve_Answer($code, $phpdateformat=null) } /** - * Check if a table does exist in the database - * - * @param mixed $sid Table name to check for (without dbprefix!)) - * @return boolean True or false if table exists or not - */ +* Check if a table does exist in the database +* +* @param mixed $sid Table name to check for (without dbprefix!)) +* @return boolean True or false if table exists or not +*/ function tableExists($tablename) { global $connect; @@ -6054,19 +5549,19 @@ function bIsTokenCompletedDatestamped($thesurvey) } /** - * example usage - * $date = "2006-12-31 21:00"; - * $shift "+6 hours"; // could be days, weeks... see function strtotime() for usage - * - * echo sql_date_shift($date, "Y-m-d H:i:s", $shift); - * - * will output: 2007-01-01 03:00:00 - * - * @param mixed $date - * @param mixed $dformat - * @param mixed $shift - * @return string - */ +* example usage +* $date = "2006-12-31 21:00"; +* $shift "+6 hours"; // could be days, weeks... see function strtotime() for usage +* +* echo sql_date_shift($date, "Y-m-d H:i:s", $shift); +* +* will output: 2007-01-01 03:00:00 +* +* @param mixed $date +* @param mixed $dformat +* @param mixed $shift +* @return string +*/ function date_shift($date, $dformat, $shift) { return date($dformat, strtotime($shift, strtotime($date))); @@ -6083,12 +5578,12 @@ function getBounceEmail($surveyid) return getGlobalSetting('siteadminbounce'); } else if ($surveyInfo['bounce_email'] == '') - { - return null; // will be converted to from in MailText - } - else - { - return $surveyInfo['bounce_email']; + { + return null; // will be converted to from in MailText + } + else + { + return $surveyInfo['bounce_email']; } } @@ -6127,10 +5622,10 @@ function hasTemplateManageRights($userid, $templatefolder) { } /** - * This function creates an incrementing answer code based on the previous source-code - * - * @param mixed $sourcecode The previous answer code - */ +* This function creates an incrementing answer code based on the previous source-code +* +* @param mixed $sourcecode The previous answer code +*/ function getNextCode($sourcecode) { $i=1; @@ -6159,14 +5654,14 @@ function getNextCode($sourcecode) } /** - * Translink - * - * @param mixed $type - * @param mixed $oldid - * @param mixed $newid - * @param mixed $text - * @return mixed - */ +* Translink +* +* @param mixed $type +* @param mixed $oldid +* @param mixed $newid +* @param mixed $text +* @return mixed +*/ function translink($type, $oldid, $newid, $text) { global $relativeurl; @@ -6205,28 +5700,56 @@ function aReverseTranslateFieldnames($iOldSID,$iNewSID,$aGIDReplacements,$aQIDRe { $aGIDReplacements=array_flip($aGIDReplacements); $aQIDReplacements=array_flip($aQIDReplacements); - $aFieldMap=createFieldMap($iNewSID); + if ($iOldSID==$iNewSID) { + $forceRefresh=true; // otherwise grabs the cached copy and throws undefined index exceptions + } + else { + $forceRefresh=false; + } + $aFieldMap=createFieldMap($iNewSID,'full',$forceRefresh); $aFieldMappings=array(); foreach ($aFieldMap as $sFieldname=>$aFieldinfo) { - if ($aFieldinfo['qid']!=null) - { - $aFieldMappings[$sFieldname]=$iOldSID.'X'.$aGIDReplacements[$aFieldinfo['gid']].'X'.$aQIDReplacements[$aFieldinfo['qid']].$aFieldinfo['aid']; - // now also add a shortened field mapping which is needed for certain kind of condition mappings - $aFieldMappings[$iNewSID.'X'.$aFieldinfo['gid'].'X'.$aFieldinfo['qid']]=$iOldSID.'X'.$aGIDReplacements[$aFieldinfo['gid']].'X'.$aQIDReplacements[$aFieldinfo['qid']]; - } + if ($aFieldinfo['qid']!=null) + { + $aFieldMappings[$sFieldname]=$iOldSID.'X'.$aGIDReplacements[$aFieldinfo['gid']].'X'.$aQIDReplacements[$aFieldinfo['qid']].$aFieldinfo['aid']; + // now also add a shortened field mapping which is needed for certain kind of condition mappings + $aFieldMappings[$iNewSID.'X'.$aFieldinfo['gid'].'X'.$aFieldinfo['qid']]=$iOldSID.'X'.$aGIDReplacements[$aFieldinfo['gid']].'X'.$aQIDReplacements[$aFieldinfo['qid']]; + } } return array_flip($aFieldMappings); } /** - * This function replaces the old insertans tags with new ones across a survey - * - * @param string $newsid Old SID - * @param string $oldsid New SID - * @param mixed $fieldnames Array array('oldfieldname'=>'newfieldname') + * Return an array describing what queXS questionnaireId and sampleId to filter results on + * + * @return array The questionnaire Id and sample Id to filter to (sample id is null for entire questionnaire) + * @author Adam Zammit + * @since 2011-09-07 */ +function questionnaireSampleFilterstate() +{ + $letsfilter = returnglobal('quexsfilterinc'); + + $_SESSION['quexsanswers']=$letsfilter; + + $qs = explode(":",$_SESSION['quexsanswers']); + + if (count($qs) == 2) + { + return $qs; + } + return false; +} + +/** +* This function replaces the old insertans tags with new ones across a survey +* +* @param string $newsid Old SID +* @param string $oldsid New SID +* @param mixed $fieldnames Array array('oldfieldname'=>'newfieldname') +*/ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) { global $connect, $dbprefix; @@ -6247,8 +5770,8 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) foreach ($fieldnames as $sOldFieldname=>$sNewFieldname) { - $pattern = "{INSERTANS:".$sOldFieldname."}"; - $replacement = "{INSERTANS:".$sNewFieldname."}"; + $pattern = $sOldFieldname; + $replacement = $sNewFieldname; $urldescription=preg_replace('/'.$pattern.'/', $replacement, $urldescription); $endurl=preg_replace('/'.$pattern.'/', $replacement, $endurl); } @@ -6273,8 +5796,8 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) foreach ($fieldnames as $sOldFieldname=>$sNewFieldname) { - $pattern = "{INSERTANS:".$sOldFieldname."}"; - $replacement = "{INSERTANS:".$sNewFieldname."}"; + $pattern = $sOldFieldname; + $replacement = $sNewFieldname; $urldescription=preg_replace('/'.$pattern.'/', $replacement, $urldescription); $endurl=preg_replace('/'.$pattern.'/', $replacement, $endurl); } @@ -6302,14 +5825,14 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) foreach ($fieldnames as $sOldFieldname=>$sNewFieldname) { - $pattern = "{INSERTANS:".$sOldFieldname."}"; - $replacement = "{INSERTANS:".$sNewFieldname."}"; + $pattern = $sOldFieldname; + $replacement = $sNewFieldname; $gpname = preg_replace('/'.$pattern.'/', $replacement, $gpname); $description=preg_replace('/'.$pattern.'/', $replacement, $description); } if (strcmp($description,$qentry['description']) !=0 || - strcmp($gpname,$qentry['group_name']) !=0) + strcmp($gpname,$qentry['group_name']) !=0) { // Update Fields $sqlupdate = "UPDATE {$dbprefix}groups SET description='".db_quote($description)."', group_name='".db_quote($gpname)."' WHERE gid=$gid AND language='$language'"; @@ -6330,8 +5853,8 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) foreach ($fieldnames as $sOldFieldname=>$sNewFieldname) { - $pattern = "{INSERTANS:".$sOldFieldname."}"; - $replacement = "{INSERTANS:".$sNewFieldname."}"; + $pattern = $sOldFieldname; + $replacement = $sNewFieldname; $question=preg_replace('/'.$pattern.'/', $replacement, $question); $help=preg_replace('/'.$pattern.'/', $replacement, $help); } @@ -6359,8 +5882,8 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) foreach ($fieldnames as $sOldFieldname=>$sNewFieldname) { - $pattern = "{INSERTANS:".$sOldFieldname."}"; - $replacement = "{INSERTANS:".$sNewFieldname."}"; + $pattern = $sOldFieldname; + $replacement = $sNewFieldname; $answer=preg_replace('/'.$pattern.'/', $replacement, $answer); } @@ -6375,11 +5898,11 @@ function TranslateInsertansTags($newsid,$oldsid,$fieldnames) /** - * put your comment there... - * - * @param mixed $id - * @param mixed $type - */ +* put your comment there... +* +* @param mixed $id +* @param mixed $type +*/ function hasResources($id,$type='survey') { global $publicdir,$uploaddir; @@ -6419,20 +5942,20 @@ function hasResources($id,$type='survey') } /** - * Creates a random sequence of characters - * - * @param mixed $length Length of resulting string - * @param string $pattern To define which characters should be in the resulting string - */ +* Creates a random sequence of characters +* +* @param mixed $length Length of resulting string +* @param string $pattern To define which characters should be in the resulting string +*/ function sRandomChars($length,$pattern="23456789abcdefghijkmnpqrstuvwxyz") { $patternlength = strlen($pattern)-1; for($i=0;$i<$length;$i++) { if(isset($key)) - $key .= $pattern{rand(0,$patternlength)}; + $key .= $pattern{rand(0,$patternlength)}; else - $key = $pattern{rand(0,$patternlength)}; + $key = $pattern{rand(0,$patternlength)}; } return $key; } @@ -6440,12 +5963,12 @@ function sRandomChars($length,$pattern="23456789abcdefghijkmnpqrstuvwxyz") /** - * used to translate simple text to html (replacing \n with
      - * - * @param mixed $mytext - * @param mixed $ishtml - * @return mixed - */ +* used to translate simple text to html (replacing \n with
      +* +* @param mixed $mytext +* @param mixed $ishtml +* @return mixed +*/ function conditional_nl2br($mytext,$ishtml,$encoded='') { if ($ishtml === true) @@ -6490,20 +6013,20 @@ function safe_die($text) } /** - * getQuotaInformation() returns quota information for the current survey - * @param string $surveyid - Survey identification number - * @param string $quotaid - Optional quotaid that restricts the result to a given quota - * @return array - nested array, Quotas->Members->Fields - */ +* getQuotaInformation() returns quota information for the current survey +* @param string $surveyid - Survey identification number +* @param string $quotaid - Optional quotaid that restricts the result to a given quota +* @return array - nested array, Quotas->Members->Fields +*/ function getQuotaInformation($surveyid,$language,$quotaid='all') { global $clang, $clienttoken; $baselang = GetBaseLanguageFromSurveyID($surveyid); $query = "SELECT * FROM ".db_table_name('quota').", ".db_table_name('quota_languagesettings')." - WHERE ".db_table_name('quota').".id = ".db_table_name('quota_languagesettings').".quotals_quota_id - AND sid='{$surveyid}' - AND quotals_language='".$language."'"; + WHERE ".db_table_name('quota').".id = ".db_table_name('quota_languagesettings').".quotals_quota_id + AND sid='{$surveyid}' + AND quotals_language='".$language."'"; if ($quotaid != 'all') { $query .= " AND id=$quotaid"; @@ -6527,12 +6050,12 @@ function getQuotaInformation($surveyid,$language,$quotaid='all') $survey_quotas['quotals_url']=str_replace("{TOKEN}",$clienttoken, $survey_quotas['quotals_url']); array_push($quota_info,array('Name' => $survey_quotas['name'], - 'Limit' => $survey_quotas['qlimit'], - 'Action' => $survey_quotas['action'], - 'Message' => $survey_quotas['quotals_message'], - 'Url' => passthruReplace(insertansReplace($survey_quotas['quotals_url']), $surveyinfo), - 'UrlDescrip' => $survey_quotas['quotals_urldescrip'], - 'AutoloadUrl' => $survey_quotas['autoload_url'])); + 'Limit' => $survey_quotas['qlimit'], + 'Action' => $survey_quotas['action'], + 'Message' => $survey_quotas['quotals_message'], + 'Url' => templatereplace(passthruReplace($survey_quotas['quotals_url'], $surveyinfo)), + 'UrlDescrip' => $survey_quotas['quotals_urldescrip'], + 'AutoloadUrl' => $survey_quotas['autoload_url'])); $query = "SELECT * FROM ".db_table_name('quota_members')." WHERE quota_id='{$survey_quotas['id']}'"; $result_qe = db_execute_assoc($query) or safe_die($connect->ErrorMsg()); //Checked $quota_info[$x]['members'] = array(); @@ -6572,11 +6095,11 @@ function getQuotaInformation($surveyid,$language,$quotaid='all') } array_push($quota_info[$x]['members'],array('Title' => $qtype['title'], - 'type' => $qtype['type'], - 'code' => $quota_entry['code'], - 'value' => $value, - 'qid' => $quota_entry['qid'], - 'fieldnames' => $fieldnames)); + 'type' => $qtype['type'], + 'code' => $quota_entry['code'], + 'value' => $value, + 'qid' => $quota_entry['qid'], + 'fieldnames' => $fieldnames)); } } $x++; @@ -6586,11 +6109,11 @@ function getQuotaInformation($surveyid,$language,$quotaid='all') } /** - * get_quotaCompletedCount() returns the number of answers matching the quota - * @param string $surveyid - Survey identification number - * @param string $quotaid - quota id for which you want to compute the completed field - * @return string - number of mathing entries in the result DB or 'N/A' - */ +* get_quotaCompletedCount() returns the number of answers matching the quota +* @param string $surveyid - Survey identification number +* @param string $quotaid - quota id for which you want to compute the completed field +* @return string - number of mathing entries in the result DB or 'N/A' +*/ function get_quotaCompletedCount($surveyid, $quotaid) { $result ="N/A"; @@ -6671,378 +6194,10 @@ function recursive_stripslashes($array_or_string) /** - * This function checks if a given question should be displayed or not - * If the optionnal gid parameter is set, then we are in a group/group survey - * and thus we can't evaluate conditions using answers on the same page - * (this will be done by javascript): in this case we disregard conditions on - * answers from same page - * - * @param mixed $qid - * @param mixed $gid - */ -function checkquestionfordisplay($qid, $gid=null) -{ - global $dbprefix, $connect,$surveyid,$thissurvey; - - if (!is_array($thissurvey)) - { - $local_thissurvey=getSurveyInfo($surveyid); - } - else - { - $local_thissurvey=$thissurvey; - } - - $scenarioquery = "SELECT DISTINCT scenario FROM ".db_table_name("conditions") - ." WHERE ".db_table_name("conditions").".qid=$qid ORDER BY scenario"; - $scenarioresult=db_execute_assoc($scenarioquery); - - if ($scenarioresult->RecordCount() == 0) - { - return true; - } - - while ($scenariorow=$scenarioresult->FetchRow()) - { - $scenario = $scenariorow['scenario']; - $totalands=0; - $query = "SELECT * FROM ".db_table_name('conditions')."\n" - ."WHERE qid=$qid AND scenario=$scenario ORDER BY cqid,cfieldname"; - $result = db_execute_assoc($query) or safe_die("Couldn't check conditions
      $query
      ".$connect->ErrorMsg()); //Checked - - $conditionsfoundforthisscenario=0; - while($row=$result->FetchRow()) - { - // Conditions on different cfieldnames from the same question are ANDed together - // (for instance conditions on several multiple-numerical lines) - // - // However, if they are related to the same cfieldname - // they are ORed. Conditions on the same cfieldname can be either: - // * conditions on the same 'simple question': - // - for instance several possible answers on the same radio-button question - // * conditions on the same 'multiple choice question': - // - this case is very specific. In fact each checkbox corresponds to a different - // cfieldname (1X1X1a, 1X1X1b, ...), but the condition uses only the base - // 'SGQ' cfieldname and the expected answers codes as values - // - then, in the following lines for questions M or P, we transform the - // condition SGQ='a' to SGQa='Y'. We need also to keep the artificial distinctcfieldname - // value to SGQ so that we can implement ORed conditions between the cbx - // ==> This explains why conditions on multiple choice answers are ORed even if - // in reality they use a different cfieldname for each checkbox - // - // In order to implement this we build an array storing the result - // of condition evaluations for this group and scenario - // This array is processed as follow: - // * it is indexed by cfieldname, - // * each 'cfieldname' row is added at the first condition eval on this fieldname - // * each row is updated only if the condition evaluation is successful - // ==> this way if only 1 condition for a cfieldname is successful, the set of - // conditions for this cfieldname is assumed to be met (Ored conditions) - - $conditionsfoundforthisscenario++; - $conditionCanBeEvaluated=true; - //Iterate through each condition for this question and check if it is met. - - if (preg_match("/^\+(.*)$/",$row['cfieldname'],$cfieldnamematch)) - { // this condition uses a single checkbox as source - $conditionSourceType='question'; - $query2= "SELECT type, gid FROM ".db_table_name('questions')."\n" - ." WHERE qid={$row['cqid']} AND language='".$_SESSION['s_lang']."'"; - $result2=db_execute_assoc($query2) or safe_die ("Coudn't get type from questions
      $ccquery
      ".$connect->ErrorMsg()); //Checked - while($row2=$result2->FetchRow()) - { - $cq_gid=$row2['gid']; - // set type to +M or +P in order to skip - $thistype='+'.$row2['type']; - } - - $row['cfieldname']=$cfieldnamematch[1]; // remover the leading '+' - } - elseif (preg_match("/^{/",$row['cfieldname'])) - { // this condition uses a token attr as source - $conditionSourceType='tokenattr'; - $thistype=""; - $cq_gid=0; - } - else - { // this is a simple condition using a question as source - $conditionSourceType='question'; - $query2= "SELECT type, gid FROM ".db_table_name('questions')."\n" - ." WHERE qid={$row['cqid']} AND language='".$_SESSION['s_lang']."'"; - $result2=db_execute_assoc($query2) or safe_die ("Coudn't get type from questions
      $ccquery
      ".$connect->ErrorMsg()); //Checked - while($row2=$result2->FetchRow()) - { - $cq_gid=$row2['gid']; - //Find out the 'type' of the question this condition uses - $thistype=$row2['type']; - } - } - - - - // Fix the cfieldname and cvalue in case of type M or P questions - if ($thistype == "M" || $thistype == "P") - { - // The distinctcfieldname simply is the virtual cfieldname - $row['distinctcfieldname']=$row['cfieldname']; - - // For multiple choice type questions, the "answer" value will be "Y" - // if selected, the fieldname will have the answer code appended. - $row['cfieldname']=$row['cfieldname'].$row['value']; - $row['value']="Y"; - } - else - { - // the distinctcfieldname simply is the real cfieldname - $row['distinctcfieldname']=$row['cfieldname']; - } - - if ( !is_null($gid) && $gid == $cq_gid && $conditionSourceType == 'question') - { - //Don't do anything - this cq is in the current group - } - elseif (preg_match('/^@([0-9]+X[0-9]+X[^@]+)@'.'/',$row['value'],$targetconditionfieldname)) - { - if (isset($_SESSION[$targetconditionfieldname[1]]) ) - { - // If value uses @SIDXGIDXQID@ codes i - // then try to replace them with a - // value recorded in SESSION if any - $cvalue=$_SESSION[$targetconditionfieldname[1]]; - if ($conditionSourceType == 'question') - { - if (isset($_SESSION[$row['cfieldname']])) - { - $cfieldname=$_SESSION[$row['cfieldname']]; - } - else - { - $conditionCanBeEvaluated=false; - //$cfieldname=' '; - } - } - elseif ($local_thissurvey['anonymized'] == "N" && preg_match('/^{TOKEN:([^}]*)}$/',$row['cfieldname'],$sourceconditiontokenattr)) - { - if ( isset($_SESSION['token']) && - in_array(strtolower($sourceconditiontokenattr[1]),GetTokenConditionsFieldNames($surveyid))) - { - $cfieldname=GetAttributeValue($surveyid,strtolower($sourceconditiontokenattr[1]),$_SESSION['token']); - } - else - { - $conditionCanBeEvaluated=false; - } - - } - else - { - $conditionCanBeEvaluated=false; - } - } - else - { // if _SESSION[$targetconditionfieldname[1]] is not set then evaluate condition as FALSE - $conditionCanBeEvaluated=false; - //$cfieldname=' '; - } - } - elseif ($local_thissurvey['anonymized'] == "N" && preg_match('/^{TOKEN:([^}]*)}$/',$row['value'],$targetconditiontokenattr)) - { - if ( isset($_SESSION['token']) && - in_array(strtolower($targetconditiontokenattr[1]),GetTokenConditionsFieldNames($surveyid))) - { - // If value uses {TOKEN:XXX} placeholders - // then try to replace them with a - // the value recorded in DB - $cvalue=GetAttributeValue($surveyid,strtolower($targetconditiontokenattr[1]),$_SESSION['token']); - - //quexs Addition - include_once("quexs.php"); - $cvalue = quexs_template_replace($cvalue); - - if ($conditionSourceType == 'question') - { - if (isset($_SESSION[$row['cfieldname']])) - { - $cfieldname=$_SESSION[$row['cfieldname']]; - } - else - { - $conditionCanBeEvaluated=false; - } - } - elseif ($local_thissurvey['anonymized'] == "N" && preg_match('/^{TOKEN:([^}]*)}$/',$row['cfieldname'],$sourceconditiontokenattr)) - { - if ( isset($_SESSION['token']) && - in_array(strtolower($sourceconditiontokenattr[1]),GetTokenConditionsFieldNames($surveyid))) - { - $cfieldname=GetAttributeValue($surveyid,strtolower($sourceconditiontokenattr[1]),$_SESSION['token']); - } - else - { - $conditionCanBeEvaluated=false; - } - - } - elseif ($local_thissurvey['anonymized'] == "N" && preg_match('/^{/',$row['cfieldname'],$sourceconditiontokenattr)) - { - //queXS Addition - include_once("quexs.php"); - $cfieldname=quexs_template_replace($row['cfieldname']); - } - else - { - $conditionCanBeEvaluated=false; - } - } - else - { // if _SESSION[$targetconditionfieldname[1]] is not set then evaluate condition as FALSE - $conditionCanBeEvaluated=false; - } - } - else - { - $cvalue=$row['value']; - if ($conditionSourceType == 'question') - { - if (isset($_SESSION[$row['cfieldname']])) - { - $cfieldname=$_SESSION[$row['cfieldname']]; - } - elseif ($thistype == "M" || $thistype == "P" || $thistype == "+M" || $thistype == "+P") - { - $cfieldname=""; - } - else - { - $conditionCanBeEvaluated=false; - } - } - elseif ($local_thissurvey['anonymized'] == "N" && preg_match('/^{TOKEN:([^}]*)}$/',$row['cfieldname'],$sourceconditiontokenattr)) - { - if ( isset($_SESSION['token']) && - in_array(strtolower($sourceconditiontokenattr[1]),GetTokenConditionsFieldNames($surveyid))) - { - $cfieldname=GetAttributeValue($surveyid,strtolower($sourceconditiontokenattr[1]),$_SESSION['token']); - } - else - { - $conditionCanBeEvaluated=false; - } - - } - else - { - $conditionCanBeEvaluated=false; - } - } - - if ( !is_null($gid) && $gid == $cq_gid && $conditionSourceType == 'question') - { - //Don't do anything - this cq is in the current group - $conditionMatches=true; - } - elseif ($conditionCanBeEvaluated === false) - { - // condition can't be evaluated, so let's assume FALSE - $conditionMatches=false; - } - else - { - if (trim($row['method'])=='') - { - $row['method']='=='; - } - if ($row['method'] != 'RX') - { - if (preg_match("/^a(.*)b$/",$row['method'],$matchmethods)) - { - // strings comparizon operator in PHP are the same as numerical operators - $matchOperator = $matchmethods[1]; - } - else - { - $matchOperator = $row['method']; - } - if (eval('if (trim($cfieldname)'. $matchOperator.' trim($cvalue)) return true; else return false;')) - { - //error_log("TIBO1 oper=$matchOperator"); - $conditionMatches=true; - //This condition is met - } - else - { - //error_log("TIBO2 oper=$matchOperator"); - $conditionMatches=false; - } - } - else - { - if (preg_match('/'.trim($cvalue).'/',trim($cfieldname))) - { - $conditionMatches=true; - - } - else - { - $conditionMatches=false; - } - } - } - - if ($conditionMatches === true) - { - // Let's store this positive result in the distinctcqids array - // indexed by cfieldname so that conditions on theb same cfieldname ar Ored - // while conditions on different cfieldnames (either different conditions - // or conditions on different cfieldnames inside the same question) - if (!isset($distinctcqids[$row['distinctcfieldname']]) || $distinctcqids[$row['distinctcfieldname']] == 0) - { - $distinctcqids[$row['distinctcfieldname']] = 1; - } - } - else - { - // Let's store this negative result in the distinctcqids array - // indexed by cfieldname so that conditions on theb same cfieldname ar Ored - // while conditions on different cfieldnames (either different conditions - // or conditions on different cfieldnames inside the same question) - if (!isset($distinctcqids[$row['distinctcfieldname']])) - { - $distinctcqids[$row['distinctcfieldname']] = 0; - } - } - } // while - if ($conditionsfoundforthisscenario > 0) { - foreach($distinctcqids as $key=>$val) - { - // Let's count the number of conditions that are met, and then compare - // it to the total number of stored results - $totalands=$totalands+$val; - } - if ($totalands >= count($distinctcqids)) - { - // if all stored results are positive then we MUST show the group - // because at least this question is displayed - return true; - } - } - else - { - //Curious there is no condition for this question in this scenario - // this is not a normal behaviour, but I propose to defaults to a - // condition-matched state in this case - return true; - } - unset($distinctcqids); - } // end while scenario - return false; -} - -/** - * This is a helper function for GetAttributeFieldNames - * - * @param mixed $fieldname - */ +* This is a helper function for GetAttributeFieldNames +* +* @param mixed $fieldname +*/ function filterforattributes ($fieldname) { if (strpos($fieldname,'attribute_')===false) return false; else return true; @@ -7050,12 +6205,12 @@ function filterforattributes ($fieldname) /** - * Retrieves the attribute field names from the related token table - * - * @param mixed $surveyid The survey ID - * @return array The fieldnames - */ -function GetAttributeFieldNames($surveyid) +* Retrieves the attribute field names from the related token table +* +* @param mixed $surveyid The survey ID +* @return array The fieldnames +*/ +function GetAttributeFieldNames($surveyid,$filter=true) { global $dbprefix, $connect; if (tableExists('tokens_'.$surveyid) === false) @@ -7063,15 +6218,19 @@ function GetAttributeFieldNames($surveyid) return Array(); } $tokenfieldnames = array_values($connect->MetaColumnNames("{$dbprefix}tokens_$surveyid", true)); - return array_filter($tokenfieldnames,'filterforattributes'); + if ($filter) + { + return array_filter($tokenfieldnames,'filterforattributes'); + } + return $tokenfieldnames; } /** - * Retrieves the token field names usable for conditions from the related token table - * - * @param mixed $surveyid The survey ID - * @return array The fieldnames - */ +* Retrieves the token field names usable for conditions from the related token table +* +* @param mixed $surveyid The survey ID +* @return array The fieldnames +*/ function GetTokenConditionsFieldNames($surveyid) { $extra_attrs=GetAttributeFieldNames($surveyid); @@ -7084,13 +6243,13 @@ function GetTokenConditionsFieldNames($surveyid) } /** - * Retrieves the attribute names from the related token table - * - * @param mixed $surveyid The survey ID - * @param boolean $onlyAttributes Set this to true if you only want the fieldnames of the additional attribue fields - defaults to false - * @param boolean $quexs True to include queXS fieldnames - * @return array The fieldnames as key and names as value in an Array - */ +* Retrieves the attribute names from the related token table +* +* @param mixed $surveyid The survey ID +* @param boolean $onlyAttributes Set this to true if you only want the fieldnames of the additional attribue fields - defaults to false +* @param boolean $quexs True to include queXS fieldnames +* @return array The fieldnames as key and names as value in an Array +*/ function GetTokenFieldsAndNames($surveyid, $onlyAttributes=false, $quexs=true) { global $dbprefix, $connect, $clang; @@ -7160,18 +6319,17 @@ function GetTokenFieldsAndNames($surveyid, $onlyAttributes=false, $quexs=true) } /** - * Retrieves the token attribute value from the related token table - * - * @param mixed $surveyid The survey ID - * @param mixed $attrName The token-attribute field name - * @param mixed $token The token code - * @return string The token attribute value (or null on error) - */ +* Retrieves the token attribute value from the related token table +* +* @param mixed $surveyid The survey ID +* @param mixed $attrName The token-attribute field name +* @param mixed $token The token code +* @return string The token attribute value (or null on error) +*/ function GetAttributeValue($surveyid,$attrName,$token) { global $dbprefix, $connect; $attrName=strtolower($attrName); - if ($attrName == 'callattempts' || $attrName == 'onappointment' || $attrName == 'perccomplete' || $attrName == 'messagesleft') //queXS addition { include_once("quexs.php"); @@ -7213,14 +6371,14 @@ function GetAttributeValue($surveyid,$attrName,$token) } /** - * This function strips any content between and including @siU' // Strip style tags properly + '@]*?>.*?@siU' // Strip style tags properly /* ,'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags '@@' // Strip multi-line comments including CDATA */ @@ -7231,23 +6389,23 @@ function strip_javascript($content){ /** - * This function cleans files from the temporary directory being older than 1 day - * @todo Make the days configurable - */ +* This function cleans files from the temporary directory being older than 1 day +* @todo Make the days configurable +*/ function cleanTempDirectory() { global $tempdir; $dir= $tempdir.'/'; $dp = opendir($dir) or die ('Could not open temporary directory'); while ($file = readdir($dp)) { - if (is_file($dir.$file) && (filemtime($dir.$file)) < (strtotime('-1 days')) && $file!='index.html' && $file!='readme.txt' && $file!='..' && $file!='.' && $file!='.svn') { + if (is_file($dir.$file) && (filemtime($dir.$file)) < (strtotime('-1 days')) && $file!='.gitignore' && $file!='index.html' && $file!='readme.txt' && $file!='..' && $file!='.' && $file!='.svn') { @unlink($dir.$file); } } $dir= $tempdir.'/upload/'; $dp = opendir($dir) or die ('Could not open temporary directory'); while ($file = readdir($dp)) { - if (is_file($dir.$file) && (filemtime($dir.$file)) < (strtotime('-1 days')) && $file!='index.html' && $file!='readme.txt' && $file!='..' && $file!='.' && $file!='.svn') { + if (is_file($dir.$file) && (filemtime($dir.$file)) < (strtotime('-1 days')) && $file!='.gitignore' && $file!='index.html' && $file!='readme.txt' && $file!='..' && $file!='.' && $file!='.svn') { @unlink($dir.$file); } } @@ -7264,13 +6422,13 @@ function use_firebug() }; /** - * This is a convenience function for the coversion of datetime values - * - * @param mixed $value - * @param mixed $fromdateformat - * @param mixed $todateformat - * @return string - */ +* This is a convenience function for the coversion of datetime values +* +* @param mixed $value +* @param mixed $fromdateformat +* @param mixed $todateformat +* @return string +*/ function convertDateTimeFormat($value, $fromdateformat, $todateformat) { $datetimeobj = new Date_Time_Converter($value , $fromdateformat); @@ -7279,11 +6437,11 @@ function convertDateTimeFormat($value, $fromdateformat, $todateformat) /** - * This function removes the UTF-8 Byte Order Mark from a string - * - * @param string $str - * @return string - */ +* This function removes the UTF-8 Byte Order Mark from a string +* +* @param string $str +* @return string +*/ function removeBOM($str=""){ if(substr($str, 0,3) == pack("CCC",0xef,0xbb,0xbf)) { $str=substr($str, 3); @@ -7292,13 +6450,13 @@ function removeBOM($str=""){ } /** - * This function requests the latest update information from the LimeSurvey.org website - * - * @returns array Contains update information or false if the request failed for some reason - */ +* This function requests the latest update information from the LimeSurvey.org website +* +* @returns array Contains update information or false if the request failed for some reason +*/ function GetUpdateInfo() { - return false; + return false; //queXS Addition global $homedir, $debug, $buildnumber, $versionnumber; require_once($homedir."/classes/http/http.php"); @@ -7344,12 +6502,12 @@ function GetUpdateInfo() /** - * This function updates the actual global variables if an update is available after using GetUpdateInfo - * @return Array with update or error information - */ +* This function updates the actual global variables if an update is available after using GetUpdateInfo +* @return Array with update or error information +*/ function updatecheck() { - return false; + return false; global $buildnumber; $updateinfo=GetUpdateInfo(); if (isset($updateinfo['Targetversion']['build']) && (int)$updateinfo['Targetversion']['build']>(int)$buildnumber && trim($buildnumber)!='') @@ -7367,11 +6525,11 @@ function updatecheck() } /** - * This function removes a directory recursively - * - * @param mixed $dirname - * @return bool - */ +* This function removes a directory recursively +* +* @param mixed $dirname +* @return bool +*/ function rmdirr($dirname) { // Sanity check @@ -7406,6 +6564,7 @@ function getTokenData($surveyid, $token) global $dbprefix, $connect; $query = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."'"; $result = db_execute_assoc($query) or safe_die("Couldn't get token info in getTokenData()
      ".$query."
      ".$connect->ErrorMsg()); //Checked + $thistoken=array(); // so has default value while($row=$result->FetchRow()) { $thistoken=array("firstname"=>$row['firstname'], @@ -7438,15 +6597,15 @@ function sGetTemplatePath($sTemplateName) } else { - if (file_exists($usertemplaterootdir.'/'.$sTemplateName)) + if (is_dir($usertemplaterootdir.'/'.$sTemplateName)) { return $usertemplaterootdir.'/'.$sTemplateName; } - elseif (file_exists($usertemplaterootdir.'/'.$defaulttemplate)) + elseif (is_dir($usertemplaterootdir.'/'.$defaulttemplate)) { return $usertemplaterootdir.'/'.$defaulttemplate; } - elseif (file_exists($standardtemplaterootdir.'/'.$defaulttemplate)) + elseif (isStandardTemplate($defaulttemplate)) { return $standardtemplaterootdir.'/'.$defaulttemplate; } @@ -7479,7 +6638,7 @@ function sGetTemplateURL($sTemplateName) { return $usertemplaterooturl.'/'.$defaulttemplate; } - elseif (file_exists($standardtemplaterootdir.'/'.$defaulttemplate)) + elseif (isStandardTemplate($defaulttemplate)) { return $standardtemplaterooturl.'/'.$defaulttemplate; } @@ -7491,12 +6650,12 @@ function sGetTemplateURL($sTemplateName) } /** - * Return the goodchars to be used when filtering input for numbers. - * - * @param $lang string language used, for localisation - * @param $integer bool use only integer - * @param $negative bool allow negative values - */ +* Return the goodchars to be used when filtering input for numbers. +* +* @param $lang string language used, for localisation +* @param $integer bool use only integer +* @param $negative bool allow negative values +*/ function getNumericalFormat($lang = 'en', $integer = false, $negative = true) { $goodchars = "0123456789"; if ($integer === false) $goodchars .= "."; //Todo, add localisation @@ -7505,39 +6664,43 @@ function getNumericalFormat($lang = 'en', $integer = false, $negative = true) { } /** - * Return an array of subquestions for a given sid/qid - * - * @param int $sid - * @param int $qid - * @param $sLanguage Language of the subquestion text - */ +* Return an array of subquestions for a given sid/qid +* +* @param int $sid +* @param int $qid +* @param $sLanguage Language of the subquestion text +*/ function getSubQuestions($sid, $qid, $sLanguage) { global $dbprefix, $connect, $clang; static $subquestions; - if (!isset($subquestions[$sid])) { - $sid = sanitize_int($sid); - $query = "SELECT sq.*, q.other FROM {$dbprefix}questions as sq, {$dbprefix}questions as q" - ." WHERE sq.parent_qid=q.qid AND q.sid=$sid" - ." AND sq.language='".$sLanguage. "' " - ." AND q.language='".$sLanguage. "' " - ." ORDER BY sq.parent_qid, q.question_order,sq.scale_id , sq.question_order"; - $result=db_execute_assoc($query) or safe_die ("Couldn't get perform answers query
      $query
      ".$connect->ErrorMsg()); //Checked - $resultset=array(); - while ($row=$result->FetchRow()) - { - $resultset[$row['parent_qid']][] = $row; - } - $subquestions[$sid] = $resultset; + if (!isset($subquestions[$sid])) + { + $subquestions[$sid]=array(); } - if (isset($subquestions[$sid][$qid])) return $subquestions[$sid][$qid]; + if (!isset($subquestions[$sid][$sLanguage])) { + $sid = sanitize_int($sid); + $query = "SELECT sq.*, q.other FROM {$dbprefix}questions as sq, {$dbprefix}questions as q" + ." WHERE sq.parent_qid=q.qid AND q.sid=$sid" + ." AND sq.language='".$sLanguage. "' " + ." AND q.language='".$sLanguage. "' " + ." ORDER BY sq.parent_qid, q.question_order,sq.scale_id , sq.question_order"; + $result=db_execute_assoc($query) or safe_die ("Couldn't get perform answers query
      $query
      ".$connect->ErrorMsg()); //Checked + $resultset=array(); + while ($row=$result->FetchRow()) + { + $resultset[$row['parent_qid']][] = $row; + } + $subquestions[$sid][$sLanguage] = $resultset; + } + if (isset($subquestions[$sid][$sLanguage][$qid])) return $subquestions[$sid][$sLanguage][$qid]; return array(); } /** - * Wrapper function to retrieve an xmlwriter object and do error handling if it is not compiled - * into PHP - */ +* Wrapper function to retrieve an xmlwriter object and do error handling if it is not compiled +* into PHP +*/ function getXMLWriter() { if (!extension_loaded('xmlwriter')) { safe_die('XMLWriter class not compiled into PHP, please contact your system administrator'); @@ -7550,8 +6713,8 @@ function getXMLWriter() { /* - * Return a sql statement for renaming a table - */ +* Return a sql statement for renaming a table +*/ function db_rename_table($oldtable, $newtable) { global $connect; @@ -7581,32 +6744,55 @@ function usedTokens($token) return $utresult; } - +/** +* Return true if the actual survey answer is completed +* +* @param int $surveyid The survey id +* @param int $srid The survey answer id +*/ +function isCompleted($surveyid,$srid) +{ + global $connect; + $completed = false; + if($surveyid && $srid) + { + $sRow=$connect->GetRow("SELECT active FROM ".db_table_name('surveys')." WHERE sid=$surveyid"); + if($sRow['active']=='Y') + { + $sridRow=$connect->GetRow("SELECT submitdate FROM ".db_table_name('survey_'.$surveyid)." WHERE id=$srid"); + if($sridRow && $sridRow['submitdate']) + { + $completed=true; + } + } + } + return $completed; +}; /** - * redirect() generates a redirect URL for the apporpriate SSL mode then applies it. - * - * @param $ssl_mode string 's' or '' (empty). - */ +* redirect() generates a redirect URL for the apporpriate SSL mode then applies it. +* +* @param $ssl_mode string 's' or '' (empty). +*/ function redirect($ssl_mode) { $url = 'http'.$ssl_mode.'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; if (!headers_sent()) { // If headers not sent yet... then do php redirect ob_clean(); - header('Location: '.$url); - ob_flush(); - exit; + header('Location: '.$url); + ob_flush(); + exit; }; }; /** - * SSL_mode() $force_ssl is on or off, it checks if the current - * request is to HTTPS (or not). If $force_ssl is on, and the - * request is not to HTTPS, it redirects the request to the HTTPS - * version of the URL, if the request is to HTTPS, it rewrites all - * the URL variables so they also point to HTTPS. - */ +* SSL_mode() $force_ssl is on or off, it checks if the current +* request is to HTTPS (or not). If $force_ssl is on, and the +* request is not to HTTPS, it redirects the request to the HTTPS +* version of the URL, if the request is to HTTPS, it rewrites all +* the URL variables so they also point to HTTPS. +*/ function SSL_mode() { global $rooturl , $homeurl , $publicurl , $tempurl , $imageurl , $uploadurl; @@ -7624,11 +6810,11 @@ function SSL_mode() }; if( $force_ssl == 'on' && $https == '' ) { - redirect('s'); + redirect('s'); } if( $force_ssl == 'off' && $https != '') { - redirect(''); + redirect(''); }; }; @@ -7650,11 +6836,22 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor $idquery = "SELECT * FROM ".db_table_name('survey_'.$iSurveyID)." WHERE id=".$iResponseID; $idrow=$connect->GetRow($idquery) or safe_die ("Couldn't get entry
      \n$idquery
      \n".$connect->ErrorMsg()); //Checked + // Create array of non-null values - those are the relevant ones + $aRelevantFields = array(); + + foreach ($aFieldMap as $sKey=>$fname) + { + if (!is_null($idrow[$fname['fieldname']])) + { + $aRelevantFields[$sKey]=$fname; + } + } + $aResultTable=array(); $oldgid = 0; $oldqid = 0; - foreach ($aFieldMap as $sKey=>$fname) + foreach ($aRelevantFields as $sKey=>$fname) { if (!empty($fname['qid'])) { @@ -7671,27 +6868,14 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor 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'],'',''); @@ -7702,13 +6886,6 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor $aResultTable[$fname['fieldname']]=array($question,'',$answer); continue; } - - } - else - { - continue; - } - } } else @@ -7718,30 +6895,27 @@ function aGetFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonor continue; } if (isset($fname['subquestion'])) - $subquestion = "{$fname['subquestion']}"; + $subquestion = "{$fname['subquestion']}"; if (isset($fname['subquestion1'])) - $subquestion = "{$fname['subquestion1']}"; + $subquestion = "{$fname['subquestion1']}"; if (isset($fname['subquestion2'])) - $subquestion .= "[{$fname['subquestion2']}]"; - if ($isQuestionVisible) - { + $subquestion .= "[{$fname['subquestion2']}]"; + $answer=getextendedanswer($fname['fieldname'], $idrow[$fname['fieldname']]); $aResultTable[$fname['fieldname']]=array('',$subquestion,$answer); } - - } return $aResultTable; } /** - * Check if $str is an integer, or string representation of an integer - * - * @param mixed $mStr - */ +* Check if $str is an integer, or string representation of an integer +* +* @param mixed $mStr +*/ function bIsNumericInt($mStr) { if(is_int($mStr)) @@ -7752,15 +6926,15 @@ function bIsNumericInt($mStr) } /** - * Invert key/values of an associative array, preserving multiple values in - * the source array as a single key with multiple values in the resulting - * array. - * - * This is not the same as array_flip(), which flattens the structure of the - * source array. - * - * @param array $aArr - */ +* Invert key/values of an associative array, preserving multiple values in +* the source array as a single key with multiple values in the resulting +* array. +* +* This is not the same as array_flip(), which flattens the structure of the +* source array. +* +* @param array $aArr +*/ function aArrayInvert($aArr) { $aRet = array(); @@ -7770,89 +6944,8 @@ function aArrayInvert($aArr) } /** - * Check if a question was (at least partially) answered in the current session. - * - * @param integer $q - Question id - * @param array $aFieldnamesInfoInv - Inverted fieldnamesInfo - */ -function bCheckQuestionForAnswer($q, $aFieldnamesInfoInv) -{ - $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 - */ +* Include Keypad headers +*/ function vIncludeKeypad() { global $js_header_includes, $css_header_includes, $clang; @@ -7878,11 +6971,11 @@ function sStripDBPrefix($sTableName) } /* - * Emit the standard (last) onsubmit handler for the survey. - * - * This code in injected in the three questionnaire modes right after the
      element, - * before the individual questions emit their own onsubmit replacement code. - */ +* Emit the standard (last) onsubmit handler for the survey. +* +* This code in injected in the three questionnaire modes right after the element, +* before the individual questions emit their own onsubmit replacement code. +*/ function sDefaultSubmitHandler() { return <<0 and (sq.gid!=q.gid or sq.type!=q.type)"); - foreach($surveyidresult->GetRows() as $sv) + $surveyidresult=db_select_limit_assoc("select sq.qid, sq.parent_qid, sq.gid as sqgid, q.gid, sq.type as sqtype, q.type + from ".db_table_name('questions')." sq JOIN ".db_table_name('questions')." q on sq.parent_qid=q.qid + where sq.parent_qid>0 and (sq.gid!=q.gid or sq.type!=q.type)",1000); + while ($sv = $surveyidresult->FetchRow()) { - db_execute_assoc('update '.db_table_name('questions')." set type='{$sv['type']}', gid={$sv['gid']} where qid={$sv['qid']}"); + db_execute_assoc('update '.db_table_name('questions')." set type='{$sv['type']}', gid={$sv['gid']} where qid={$sv['qid']}"); } } - -function checkgroupfordisplay($gid) +/** +* Need custom version of JSON encode to avoid having Expression Manager mangle it +* @param type $val +* @return type +*/ +function ls_json_encode($val) { - //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 + $ans = json_encode($val); + $ans = str_replace(array('{','}'),array('{ ',' }'), $ans); + return $ans; +} +/** +* This function returns the real IP address under all configurations +* +*/ +function getIPAddress() +{ + global $bServerBehindProxy; + if ($bServerBehindProxy) { - if ($ia[5] == $gid) //If the question is in the group we are checking: - + if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet { - // 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 - } - } + return $_SERVER['HTTP_CLIENT_IP']; + } + elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy + { + return $_SERVER['HTTP_X_FORWARDED_FOR']; } } - if ($countQuestionsInThisGroup===0) + if (!empty($_SERVER['REMOTE_ADDR'])) { - 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; + return $_SERVER['REMOTE_ADDR']; } 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; + return '127.0.0.1'; } } diff --git a/include/limesurvey/config-defaults.php b/include/limesurvey/config-defaults.php index 127e6c07..6aa223a3 100644 --- a/include/limesurvey/config-defaults.php +++ b/include/limesurvey/config-defaults.php @@ -10,7 +10,7 @@ * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. * - * $Id: config-defaults.php 10474 2011-07-11 15:51:19Z c_schmitz $ + * $Id: config-defaults.php 12242 2012-01-27 23:41:13Z c_schmitz $ */ // CAUTION @@ -154,6 +154,13 @@ $emailcharset = "utf-8"; // You can change this to change the cha // If you don't know what this is better leave this setting alone. $modrewrite = 0; +// CMS Integration Settings +// Set $embedded to true and specify the header and footer functions - for example if the survey is to be displayed embedded in a CMS +$embedded = false; +$embedded_inc = ''; // path to a php file to include +$embedded_headerfunc = ''; // e.g. COM_siteHeader for geeklog +$embedded_footerfunc = ''; // e.g. COM_siteFooter for geeklog + // Enable or Disable LDAP feature $enableLdap = false; @@ -183,6 +190,20 @@ $filterout_incomplete_answers = 'show'; // * none: no html editor $defaulthtmleditormode = 'inline'; +// $defaultquestionselectormode +// * sets the default for the question-type selector : full or none +// users without specific preference inherit this setup +// * full : javascript selector with picture of the question type +// * none : basic html selector +$defaultquestionselectormode = 'full'; + +// $defaulttemplateeditormode +// * sets the default for the template editor : full or none +// users without specific preference inherit this setup +// * full : javascript editor mode, with Editarea (text formatting, search and replace and real-time syntax highlight) +// * none : basic textarea +$defaulttemplateeditormode = 'full'; + // $surveyPreview_require_Auth // Enforce Authentication to the LS system // before beeing able to preview a survey (testing a non active survey) @@ -451,13 +472,13 @@ $chartfontsize =10; $updatecheckperiod=0; /** - * @var $showXquestions string allows you to control whether or not + * @var $showxquestions string allows you to control whether or not * {THEREAREXQUESTIONS} is displayed (if it is included in a template) * hide = always hide {THEREAREXQUESTIONS} * show = always show {THEREAREXQUESTIONS} * choose = allow survey admins to choose */ -$showXquestions = 'choose'; +$showxquestions = 'choose'; /** @@ -532,6 +553,18 @@ $ipInfoDbAPIKey = ''; $googleMapsAPIKey = ''; +// Google Analytics API key: http://www.google.com/analytics/ +$googleAnalyticsAPIKey = ''; + +// Style for using Google Analytics +// 0 = Don't use Analytics +// 1 = Default +// 2 = SurveyName-[SID]/GroupName +$googleAnalyticsStyle = '0'; + +// Google Translate API key: https://code.google.com/apis/language/translate/v2/getting_started.html +$googletranslateapikey = ''; + /** * This variable defines the total space available to the file upload question across all surveys. If set to 0 then no limit applies. * @@ -540,6 +573,15 @@ $googleMapsAPIKey = ''; */ $iFileUploadTotalSpaceMB=0; +/** +* Set this variable to true to indicate that your server is behind a proxy. +* This will ensure the correct captioning of IP addresses instead of just the proxy address +* +* @var $bServerBehindProxy Default: false +* +*/ +$bServerBehindProxy=false; + //DO NOT EVER CHANGE THE FOLLOWING 5 LINES --------------- require_once(dirname(__FILE__).'/config.php'); if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']!='' && $_SERVER['HTTPS']!='off') diff --git a/include/limesurvey/config.php b/include/limesurvey/config.php index 68b1ac83..f98ed831 100644 --- a/include/limesurvey/config.php +++ b/include/limesurvey/config.php @@ -1,86 +1,88 @@ - 'autouser', - 'email' => $siteadminemail, - 'htmledtirmode' => $defaulthtmleditormode, - 'templatelist' => 'default,basic', - 'create_survey' => 1, - 'lang' => DEFAULT_LOCALE, - 'create_user' => 1, - 'delete_user' => 1, - 'superadmin' => 1, - 'configurator' => 1, - 'manage_template' => 1, - 'manage_label' => 1); - - + 'autouser', + 'email' => $siteadminemail, + 'htmledtirmode' => $defaulthtmleditormode, + 'templatelist' => 'default,basic', + 'create_survey' => 1, + 'lang' => DEFAULT_LOCALE, + 'create_user' => 1, + 'delete_user' => 1, + 'superadmin' => 1, + 'configurator' => 1, + 'manage_template' => 1, + 'manage_label' => 1); + + diff --git a/include/limesurvey/delete.php b/include/limesurvey/delete.php index 66869e27..46208ef0 100644 --- a/include/limesurvey/delete.php +++ b/include/limesurvey/delete.php @@ -62,7 +62,7 @@ if (empty($_SESSION) || !isset($_SESSION['fieldname'])) } else die('Invalid filename'); - $sJSON = $_SESSION[$fieldname]; + $sJSON = $_SESSION[$sFieldname]; $aFiles = json_decode(stripslashes($sJSON),true); if(substr($sFilename,0,3)=='fu_'){ @@ -78,7 +78,7 @@ if (empty($_SESSION) || !isset($_SESSION['fieldname'])) $iFileIndex++; } if ($found==true) unset($aFiles[$iFileIndex]); - $_SESSION[$fieldname] = json_encode($aFiles); + $_SESSION[$sFieldname] = ls_json_encode($aFiles); } if (@unlink($sFileDir.$sFilename)) @@ -88,4 +88,4 @@ if (empty($_SESSION) || !isset($_SESSION['fieldname'])) else echo $clang->gT('Oops, There was an error deleting the file'); -?> \ No newline at end of file +?> diff --git a/include/limesurvey/docs/.htaccess b/include/limesurvey/docs/.htaccess index efd3ea78..b1afaaa5 100644 --- a/include/limesurvey/docs/.htaccess +++ b/include/limesurvey/docs/.htaccess @@ -1,4 +1,4 @@ -# Do not remove this file. With a correct apache configuration -# this file should prevent snooping on your LimeSurvey version by -# reading the release_notes.txt +# Do not remove this file. With a correct apache configuration +# this file should prevent snooping on your LimeSurvey version by +# reading the release_notes.txt deny from all \ No newline at end of file diff --git a/include/limesurvey/docs/demosurveys/Randomization_Group_Test.lss b/include/limesurvey/docs/demosurveys/Randomization_Group_Test.lss index 1e2b7407..8980406b 100644 --- a/include/limesurvey/docs/demosurveys/Randomization_Group_Test.lss +++ b/include/limesurvey/docs/demosurveys/Randomization_Group_Test.lss @@ -1,8 +1,9 @@ Survey - 145 + 155 + fr en @@ -17,7 +18,7 @@ - + @@ -26,7 +27,7 @@ - + @@ -35,7 +36,7 @@ - + @@ -44,7 +45,7 @@ - + @@ -53,7 +54,7 @@ - + @@ -62,7 +63,7 @@ - + @@ -70,6 +71,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -80,31 +135,69 @@ group_order description language + randomization_group + grelevance - + + + - + - + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + @@ -125,13 +218,14 @@ language scale_id same_default + relevance - + - + <![CDATA[Q1]]> ]]> @@ -139,16 +233,36 @@ - + + - + - + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + <![CDATA[Q2]]> ]]> @@ -156,16 +270,36 @@ - + + - + - + + + <![CDATA[Q2]]> + + + + + + + + + + + + + + + + <![CDATA[Q3]]> ]]> @@ -173,36 +307,39 @@ - + + - + - - - <![CDATA[Q4]]> - ]]> + + + <![CDATA[Q3]]> + - - + + + - + - - - <![CDATA[Q5]]> - ]]> + + + <![CDATA[Q4]]> + ]]> @@ -211,12 +348,69 @@ + - + - + + + <![CDATA[Q4]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q5]]> + ]]> + + + + + + + + + + + + + + + + + <![CDATA[Q5]]> + + + + + + + + + + + + + + + + <![CDATA[Q6]]> ]]> @@ -224,16 +418,36 @@ - + + - + - + + + <![CDATA[Q6]]> + + + + + + + + + + + + + + + + <![CDATA[Q7]]> ]]> @@ -245,12 +459,32 @@ + - + - + + + <![CDATA[Q7]]> + + + + + + + + + + + + + + + + <![CDATA[Q8]]> ]]> @@ -262,12 +496,32 @@ + - + - + + + <![CDATA[Q8]]> + + + + + + + + + + + + + + + + <![CDATA[Q9]]> ]]> @@ -279,6 +533,242 @@ + + + + + + + + + <![CDATA[Q9]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[g1q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[g2q3]]> + + + + + + + + + + @@ -299,13 +789,14 @@ language scale_id same_default + relevance - - + + - + <![CDATA[SQ001]]> @@ -317,12 +808,31 @@ + - - + + - + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> @@ -334,12 +844,31 @@ + - - + + - + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> @@ -351,12 +880,31 @@ + - - + + - + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> @@ -368,12 +916,31 @@ + - - + + - + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> @@ -385,12 +952,31 @@ + - - + + - + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> @@ -402,12 +988,31 @@ + - - + + - + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> @@ -419,851 +1024,1360 @@ + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + - qaid qid attribute value - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + + + + + + + + + + + + + + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + + + + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - + + - - - - - - - - - - - - - - + - - + - - - + + - - - + + - - - - - - - - - - - - - - + - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + - - - + + - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - + + + - - - - + + + - - - - + + + - - + - - - - - - - - + - - - + + - - - - - - - - - - - - - - - + + - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1273,7 +2387,7 @@ expires startdate adminemail - private + anonymized faxto format savetimings @@ -1286,22 +2400,10 @@ allowsave autonumber_start autoredirect - showXquestions - showgroupinfo - shownoanswer - showqnumcode - showwelcome allowprev printanswers ipaddr refurl - bouncetime - bounceprocessing - bounceaccounttype - bounceaccounthost - bounceaccountuser - bounceaccountpass - bounceaccountencryption publicstatistics publicgraphs listpublic @@ -1315,8 +2417,25 @@ emailresponseto emailnotificationto tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome showprogress - anonymized + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey @@ -1325,35 +2444,23 @@ - + - + - - - - - - - + + - - - - - - - @@ -1367,8 +2474,25 @@ + + + + + + + + + + + + - + + + + + + @@ -1390,30 +2514,31 @@ surveyls_email_register surveyls_email_confirm_subj surveyls_email_confirm + surveyls_dateformat email_admin_notification_subj email_admin_notification email_admin_responses_subj email_admin_responses - surveyls_dateformat + surveyls_numberformat - -
      -To Illustrate this:
      -
      -                    A      B       C
      ----------------------------------------
      -Rand Group1  Q1 |  Q4  | Q7
      -                          --------------------
      -Rand Group2  Q2 |  Q5  | Q8
      -                          --------------------
      -Rand Group3  Q3 |  Q6  | Q9
      -
      -
      + +
      +To Illustrate this:
      +
      +                    A      B       C
      +---------------------------------------
      +Rand Group1  Q1 |  Q4  | Q7
      +                          --------------------
      +Rand Group2  Q2 |  Q5  | Q8
      +                          --------------------
      +Rand Group3  Q3 |  Q6  | Q9
      +
      +

      ]]>
      @@ -1427,6 +2552,7 @@ Rand Group3  Q3 |  Q6  | Q9

      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}.]]>

      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}]]>
      +
      A new response was submitted for your survey '{SURVEYNAME}'.

      Click the following link to reload the survey:
      {RELOADURL}

      Click the following link to see the individual response:
      {VIEWRESPONSEURL}

      Click the following link to edit the individual response:
      {EDITRESPONSEURL}

      View statistics by clicking here:
      {STATISTICSURL}]]>
      @@ -1466,7 +2592,170 @@ Rand Group3  Q3 |  Q6  | Q9
      padding-top:1em; } Hello,

      A new response was submitted for your survey '{SURVEYNAME}'.

      Click the following link to reload the survey:
      {RELOADURL}

      Click the following link to see the individual response:
      {VIEWRESPONSEURL}

      Click the following link to edit the individual response:
      {EDITRESPONSEURL}

      View statistics by clicking here:
      {STATISTICSURL}


      The following answers were given by the participant:
      {ANSWERTABLE}]]> - + +
      + + + + + + Cette enquête permettra de tester la fonctionnalité de la randomisation de groupe, il contient 3 groupes avec 3 questions à un groupe. La première question de chaque groupe est en rand groupe1, la deuxième question dans chaque groupe est en rand groupe2, et la dernière question de chaque groupe est en rand groupe3. Les groupes de l'enquête sont du groupe A, B, C. Pour illustrer ceci:

      +

      +
      +                     A      B       C
      + ---------------------------------------
      + Rand Group1  Q1 |  Q4  | Q7
      +                           --------------------
      + Rand Group2  Q2 |  Q5  | Q8
      +                           --------------------
      + Rand Group3  Q3 |  Q6  | Q9

      +]]>
      + + + + + + + + + + + + + + + + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Bonjour, + +Une nouvelle réponse a été soumise pour votre questionnaire '{SURVEYNAME}'. + +Cliquer sur le lien suivant pour recharger votre questionnaire : +{RELOADURL} + +Cliquer sur le lien suivant pour voir la réponse : +{VIEWRESPONSEURL} + +Cliquez sur le lien suivant pour éditer la réponse individuelle : +{EDITRESPONSEURL} + +Visualiser les statistiques en cliquant ici : +{STATISTICSURL} + + +les réponses suivantes ont été données par le participant : +{ANSWERTABLE}]]> +
      diff --git a/include/limesurvey/docs/demosurveys/SAMPLE_SURVEY_191_EN_DE_FR.lss b/include/limesurvey/docs/demosurveys/SAMPLE_SURVEY_191_EN_DE_FR.lss new file mode 100644 index 00000000..23775760 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/SAMPLE_SURVEY_191_EN_DE_FR.lss @@ -0,0 +1,14844 @@ + + + Survey + 146 + + fr + de-informal + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cid + qid + scenario + cqid + cfieldname + method + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + specialtype + scale_id + sqid + language + defaultvalue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + LimeSurvey can use a lot of condition and filter to show or hide question. You an use AND or OR condition. You can use previous question answers and tokens.

      +

      + More information on condition on the LimeSurvey documentation

      +]]>
      + +
      + + + + + + + LimeSurvey peut utiliser de nombreuses conditions et filtres pour masquer certaines questions. Il est possible d'utiliser des conditions de type OR ou AND. Vous pouvez utiliser les réponses précédentes mais aussi les attributs des invitations.

      +

      + Plus d'informations sur les conditions sur La documentation de LimeSurvey

      +]]>
      + +
      + + + + + + + Limesurvey unterstützt eine Vielzahl von Bedingungen und Filtern zum Anzeigen und Vestecken von Fragen. Dies umfasst Bedingungen mit UND- sowie ODER-Verknüpfungen. Weitere Informationen finden sich in der LimeSurvey Dokumentation.

      +]]>
      + +
      + + + + + + Array Filter and Array Filter Exclusion]]> + + + + + + + + Fitre de tableau]]> + + + + + + + + Array Filter und Array Filter Exclusion gefiltert werden.]]> + + +
      +
      + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + + + + + + + + + <![CDATA[S]]> + + + + + + + + + + + + + + + + + <![CDATA[S]]> + + + + + + + + + + + + + + + + + <![CDATA[S]]> + + + + + + + + + + + + + + + + + <![CDATA[T]]> + + + + + + + + + + + + + + + + + <![CDATA[T]]> + + + + + + + + + + + + + + + + + <![CDATA[T]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[S1]]> + + + + + + + + + + + + + + + + + <![CDATA[S1]]> + + + + + + + + + + + + + + + + + <![CDATA[S1]]> + + + + + + + + + + + + + + + + + <![CDATA[T1]]> + + + + + + + + + + + + + + + + + <![CDATA[T1]]> + + + + + + + + + + + + + + + + + <![CDATA[T1]]> + + Langer freier Text, Eingabefeld mit Größenangaben:

      +

      + Breite: 3
      + Anzahl Zeilen: 2
      + Maximale Zeichenanzahl: 6

      +]]>
      + + + + + + + + +
      + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + + + + + + + + + + + + + + + + <![CDATA[N]]> + + + + + + + + + + + + + + + + + <![CDATA[N]]> + + + + + + + + + + + + + + + + + <![CDATA[N]]> + + + + + + + + + + + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + <![CDATA[Q2]]> + + + + + + + + + + + + + + + + + <![CDATA[Q2]]> + + + + + + + + + + + + + + + + + <![CDATA[Q2]]> + +Genauigkeit = 0,1
      +Minimumwert
      +Maximumwert
      +Nutzung des Text-Separators]]>
      + + + + + + + + +
      + + + + + + + <![CDATA[Y]]> + + + + + + + + + + + + + + + + + <![CDATA[Y]]> + + + + + + + + + + + + + + + + + <![CDATA[Y]]> + + + + + + + + + + + + + + + + + <![CDATA[G]]> + + + + + + + + + + + + + + + + + <![CDATA[G]]> + + + + + + + + + + + + + + + + + <![CDATA[G]]> + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + <![CDATA[I]]> + + + + Cette question change la langue du questionnaire en cours, mieux vaut ne l'utiliser qu'a cela.

      +

      + Cela peut être intéressant de poser cette question au démarrage du questionnaire.

      +]]>
      + + + + + + +
      + + + + + + + <![CDATA[I]]> + + + + This question change the language of the actual survey : don't use for other thing.

      +

      + It can be interesting to use it at survey start

      +]]>
      + + + + + + +
      + + + + + + + <![CDATA[I]]> + + + + + + + + + + + + + + + + + <![CDATA[!2]]> + + + + + + + + + + + + + + + + + <![CDATA[!2]]> + + + + + + + + + + + + + + + + + <![CDATA[!2]]> + + + + + + + + + + + + + + + + + <![CDATA[L]]> + + + + + + + + + + + + + + + + + <![CDATA[L]]> + + + + + + + + + + + + + + + + + <![CDATA[L]]> + + + + + + + + + + + + + + + + + <![CDATA[O]]> + + + + + + + + + + + + + + + + + <![CDATA[O]]> + + + + + + + + + + + + + + + + + <![CDATA[O]]> + + + + + + + + + + + + + + + + + <![CDATA[M]]> + + + + + + + + + + + + + + + + + <![CDATA[M]]> + + + + + + + + + + + + + + + + + <![CDATA[M]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + + + + + + + + + + + + + + + + <![CDATA[M2]]> + + Mehrfachauswahl (mit Exklusivauswahl)

      +]]>
      + + + + + + + + +
      + + + + + + + <![CDATA[K]]> + + + + + + + + + + + + + + + + + <![CDATA[K]]> + +$(document).ready(function() { + $('#answer87262X32X427SQ002comment').hide(); +}); +Multiple option with comments (default answers and 1 Minimum Answer)]]> + + + + + + + + + + + + + + + + <![CDATA[K]]> + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + <![CDATA[D1]]> + + + + + + + + + + + + + + + + + <![CDATA[D1]]> + + + + + + + + + + + + + + + + + <![CDATA[D1]]> + + + + + + + + + + + + + + + + + <![CDATA[R]]> + + + + + + + + + + + + + + + + + <![CDATA[R]]> + +jQuery(document).ready(function () { +$("#CHOICES_25 option[value='A1'").remove(); +}); +]]> + + + + + + + + + + + + + + + + <![CDATA[R]]> + +jQuery(document).ready(function () { +$("#CHOICES_25 option[value='A1'").remove(); +}); +]]> + + + + + + + + + + + + + + + + <![CDATA[F]]> + + + + + + + + + + + + + + + + + <![CDATA[F]]> + + + + + + + + + + + + + + + + + <![CDATA[F]]> + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + <![CDATA[X]]> + + + + + + + + + + + + + + + + + <![CDATA[X]]> + + + + + + + + + + + + + + + + + <![CDATA[X]]> + + + + + + + + + + + + + + + + + <![CDATA[;]]> + + + + + + + + + + + + + + + + + <![CDATA[;]]> + + + + + + + + + + + + + + + + + <![CDATA[;]]> + + + + + + + + + + + + + + + + + <![CDATA[:]]> + + + + + + + + + + + + + + + + + <![CDATA[:]]> + + + + + + + + + + + + + + + + + <![CDATA[:]]> + + + + + + + + + + + + + + + + + <![CDATA[:2]]> + + + + + + + + + + + + + + + + + <![CDATA[:2]]> + + + + + + + + + + + + + + + + + <![CDATA[:2]]> + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + <![CDATA[12]]> + + + + + + + + + + + + + + + + + <![CDATA[12]]> + + + + + + + + + + + + + + + + + <![CDATA[12]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + <![CDATA[AN]]> + + + + + + + + + + + + + + + + + <![CDATA[AN]]> + + + + + + + + + + + + + + + + + <![CDATA[AN]]> + + + + + + + + + + + + + + + + + <![CDATA[!1]]> + + + + + + + + + + + + + + + + + <![CDATA[!1]]> + + + + + + + + + + + + + + + + + <![CDATA[!1]]> + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + <![CDATA[R1]]> + + + + + + + + + + + + + + + + + <![CDATA[R1]]> + + + + + + + + + + + + + + + + + <![CDATA[R1]]> + + + + + + + + + + + + + + + + + <![CDATA[XB]]> + + + + + + + + + + + + + + + + + <![CDATA[XB]]> + + + + + + + + + + + + + + + + + <![CDATA[XB]]> + + + + + + + + + + + + + + + + + <![CDATA[XC]]> + + + + + + + + + + + + + + + + + <![CDATA[XC]]> + + + + + + + + + + + + + + + + + <![CDATA[XC]]> + + + + + + + + + + + + + + + + + <![CDATA[QC]]> + + + + + + + + + + + + + + + + + <![CDATA[QC]]> + + + + + + + + + + + + + + + + + <![CDATA[QC]]> + + + + + + + + + + + + + + + + + <![CDATA[QCYes]]> + + + + + + + + + + + + + + + + + <![CDATA[QCYes]]> + + + + + + + + + + + + + + + + + <![CDATA[QCYes]]> + + + + + + + + + + + + + + + + + <![CDATA[QCNo]]> + + + + + + + + + + + + + + + + + <![CDATA[QCNo]]> + + + + + + + + + + + + + + + + + <![CDATA[QCNo]]> + + + + + + + + + + + + + + + + + <![CDATA[QCDefault]]> + + + + + + + + + + + + + + + + + <![CDATA[QCDefault]]> + + + + + + + + + + + + + + + + + <![CDATA[QCDefault]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS1]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS1]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS1]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS2]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS2]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS2]]> + + + + + + + + + + + + + + + + + <![CDATA[CC01]]> + Afficher la question 1 sur l'une des questions précédentes.]]> + + + + + + + + + + + + + + + + <![CDATA[CC01]]> + Show question 1 at one of previous question]]> + + + + + + + + + + + + + + + + <![CDATA[CC01]]> + + + + + + + + + + + + + + + + + <![CDATA[QC02]]> + Afficher la question 1 sur l'une des questions précédentes.]]> + + + + + + + + + + + + + + + + <![CDATA[QC02]]> + Show question 2 at one of previous question.]]> + + + + + + + + + + + + + + + + <![CDATA[QC02]]> + + + + + + + + + + + + + + + + + <![CDATA[QCS3]]> + Afficher sur l'une des questions précédentes.]]> + + + + + + + + + + + + + + + + <![CDATA[QCS3]]> + display an previous question.]]> + + + + + + + + + + + + + + + + <![CDATA[QCS3]]> + + + + + + + + + + + + + + + + + <![CDATA[AF]]> + + + + + + + + + + + + + + + + + <![CDATA[AF]]> + + + + + + + + + + + + + + + + + <![CDATA[AF]]> + + + + + + + + + + + + + + + + + <![CDATA[FAF]]> + + + + + + + + + + + + + + + + + <![CDATA[FAF]]> + + + + + + + + + + + + + + + + + <![CDATA[FAF]]> + + + + + + + + + + + + + + + + + <![CDATA[FAFE]]> + + + + + + + + + + + + + + + + + <![CDATA[FAFE]]> + + + + + + + + + + + + + + + + + <![CDATA[FAFE]]> + + + + + + + + + + +
      +
      + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ001]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ002]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ003]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ004]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ004]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ004]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SH101]]> + + + + + + + + + + + + + + + + + <![CDATA[SH101]]> + + + + + + + + + + + + + + + + + <![CDATA[SH101]]> + + + + + + + + + + + + + + + + + <![CDATA[SH102]]> + + + + + + + + + + + + + + + + + <![CDATA[SH102]]> + + + + + + + + + + + + + + + + + <![CDATA[SH102]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ201]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ201]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ201]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ202]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ202]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ202]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQX04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ05]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ05]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ05]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQ04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY01]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY02]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY03]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + + + <![CDATA[SQY04]]> + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + alert(bravo);]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + Dies ist die Willkommensnachricht des Fragebogens. Sie kann unter Fragebogeneinstellungen -> Texte angepasst werden.

      +]]>
      + + + + + + + + + + + + + + + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hallo, + +Eine neue Antwort wurde für die Umfrage '{SURVEYNAME}' abgegeben. + +Klicke auf den folgenden Link um die Umfrage neu zu laden: +{RELOADURL} + +Klicke auf den folgenden Link um den Antwortdatensatz anzusehen: +{VIEWRESPONSEURL} + +Klicke auf den folgenden Link um den Antwortdatensatz zu bearbeiten: +{EDITRESPONSEURL} + +Um die Statistik zu sehen, klicke hier: +{STATISTICSURL} + + +Die folgenden Antworten wurden vom Teilnehmer gegeben: +{ANSWERTABLE}]]> + +
      + + + + + + + This is the welcome text for the survey! You can can edit it in the survey properties.

      +]]>
      + + This is the end message for the survey! A good place to thank you to answer to this survey.

      +

      + LimeSurvey : THE survey software is a free software, help LimeSurvey project : donate

      +]]>
      + + + +
      You have been invited to participate in a survey.

      The survey is titled:
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      To participate, please click on the link below.

      Sincerely,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Click here to do the survey:
      {SURVEYURL}

      If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
      {OPTOUTURL}]]>
      + +
      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:
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      To participate, please click on the link below.

      Sincerely,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Click here to do the survey:
      {SURVEYURL}

      If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
      {OPTOUTURL}]]>
      + +
      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}.]]>
      + +
      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} at {ADMINEMAIL}.

      Sincerely,

      {ADMINNAME}]]>
      + + + + + + +
      + + + + + + + Ceci est le message d'accueil de votre sondage !! Vous pouvez l'éditer dans les paramètres du questionnaire.

      +]]>
      + + Ceci est le message de fin de votre questionnaire ! Un bon endroit pour vous remercier d'avoir répondu à ce questionnaire.

      +

      + LimeSurvey : THE survey software est un logiciel libre, pour soutenir le projet : donation

      +]]>
      + + + +
      Vous avez été invité à participer à un questionnaire.

      Celui-ci est intitulé :
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      Pour participer, veuillez cliquer sur le lien ci-dessous.

      Cordialement,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Cliquez ici pour remplir ce questionnaire :
      {SURVEYURL}

      Si vous ne souhaitez pas participer à ce questionnaire et ne souhaitez plus recevoir aucune invitation, veuillez cliquer sur le lien suivant :
      {OPTOUTURL}]]>
      + +
      Vous avez été invité à participer à un questionnaire récemment.

      Nous avons pris en compte que vous n'avez pas encore complété le questionnaire, et nous vous rappelons que celui-ci est toujours disponible si vous souhaitez participer.

      Le questionnaire est intitulé :
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      Pour participer, veuillez cliquer sur le lien ci-dessous.

      Cordialement,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Cliquez ici pour faire le questionnaire:
      {SURVEYURL}

      Si vous ne souhaitez pas participer à ce questionnaire et ne souhaitez plus recevoir aucune invitation, veuillez cliquer sur le lien suivant :
      {OPTOUTURL}]]>
      + +
      Vous (ou quelqu'un utilisant votre adresse électronique) vous êtes enregistré pour participer à un questionnaire en ligne intitulé {SURVEYNAME}.

      Pour compléter ce questionnaire, cliquez sur le lien suivant :

      {SURVEYURL}

      Si vous avez des questions à propos de ce questionnaire, ou si vous ne vous êtes pas enregistré pour participer à celui-ci et croyez que ce courriel est une erreur, veuillez contacter {ADMINNAME} sur {ADMINEMAIL}]]>
      + +
      Ce courriel vous confirme que vous avez complété le questionnaire intitulé {SURVEYNAME} et que votre réponse a été enregistrée. Merci pour votre participation.

      Si vous avez des questions à propos de ce courriel, veuillez contacter {ADMINNAME} sur {ADMINEMAIL}.

      Cordialement,

      {ADMINNAME}]]>
      + + + + + + +
      +
      +
      +
      diff --git a/include/limesurvey/docs/demosurveys/limesurvey2_sample_survey_english.lss b/include/limesurvey/docs/demosurveys/limesurvey2_sample_survey_english.lss new file mode 100644 index 00000000..7530b2d2 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/limesurvey2_sample_survey_english.lss @@ -0,0 +1,35724 @@ + + + Survey + 154 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + specialtype + scale_id + sqid + language + defaultvalue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + +Please make sure that num is less than num2, otherwise you won't be able to answer some of the validation tests.
      +Also, in order to see the Dynamic Relevance page, the value for num must be greater than 10.]]>
      + + + +
      + + + + + + +This page is only shown when num from the previous page is greater than 10. It's current value is {num}.
      +You must enter values for age and yearsMarried in order to complete some of the Validation Tests later in this survey; and age must be greater than yearsMarried.]]>
      + + + 10]]> +
      + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      +
      + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[math]]> + +
      FunctionSyntaxResult
      Absolute valueabs({num}){if(is_numeric(num),abs(num),'')}
      Arc cosineacos({num}){if(is_numeric(num),acos(num),'')}
      Arc sineasin({num}){if(is_numeric(num),asin(num),'')}
      Arc tangent of two variablesatan2({num},{num2}){if(is_numeric(num) && is_numeric(num2),atan2(num,num2),'')}
      Arc tangentatan({num}){if(is_numeric(num),atan(num),'')}
      Round fractions upceil({num}){if(is_numeric(num),ceil(num),'')}
      Cosinecos({num}){if(is_numeric(num),cos(num),'')}
      Calculates the exponent of eexp({num}){if(is_numeric(num),exp(num),'')}
      Round fractions downfloor({num}){if(is_numeric(num),floor(num),'')}
      Finds whether a value is not a numberis_nan({num}){if(is_numeric(num),is_nan(num),'')}
      Natural logarithmlog({num}){if(is_numeric(num),log(num),'')}
      Get value of pipi(){pi()}
      Exponential expressionpow({num},{num2}){if(is_numeric(num) && is_numeric(num2),pow(num,num2),'')}
      Generate a random integerrand(){rand()}
      Rounds a floatround({num}){if(is_numeric(num),round(num),'')}
      Sinesin({num}){if(is_numeric(num),sin(num),'')}
      Square rootsqrt({num}){if(is_numeric(num),sqrt(num),'')}
      Calculate the sum of values in an arraysum({num}){if(is_numeric(num),sum(num),'')}
      Tangenttan({num}){if(is_numeric(num),tan(num),'')}
      Find lowest valuemin({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),min(num2,num,num+num2,num-num2,num*num2,num/2),'')}
      Find highest valuemax({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),max(num2,num,num+num2,num-num2,num*num2,num/2),'')}
      Sumsum({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),sum(num2,num,num+num2,num-num2,num*num2,num/2),'')}
      Join array elements with a stringimplode('~',{num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){implode('~',num2,num,num+num2,num-num2,num*num2,num/2)}
      Get the integer value of a variableintval({num}){if(is_numeric(num),intval(num),'')}
      Finds whether the type of a variable is floatis_float({num}){if(is_numeric(num),is_float(num),'')}
      Finds whether the type of a variable is integeris_int({num}){if(is_numeric(num),is_int(num),'')}
      Finds whether the type of a variable is NULLis_null({num}){is_null(num)}
      Finds whether a variable is a number or a numeric stringis_numeric({num}){is_numeric(num)}
      Finds whether the type of a variable is stringis_string({num}){is_string(num)}
      Determine whether a variable is considered to be emptyis_empty({num}){is_empty(num)}
      ]]> + + + + + + + + + + + + + + + + + <![CDATA[num]]> + + + + + + + + + + + + + + + + + + <![CDATA[num]]> + + + + + + + + + + + + + + + + + + <![CDATA[num]]> + + + + + + + + + + + + + + + + + + <![CDATA[num2]]> + + + + + + + + + + + + + + + + + + <![CDATA[num2]]> + + + + + + + + + + + + + + + + + + <![CDATA[num2]]> + + + + + + + + + + + + + + + + + + <![CDATA[name]]> + + + + + + + + + + + + + + + + + + <![CDATA[name]]> + + + + + + + + + + + + + + + + + + <![CDATA[name]]> + + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[married]]> + + + 5 (and one hopes much older)]]> + + + + + + + 5]]> + + + + + + + + <![CDATA[married]]> + + + 5 (and one hopes much older)]]> + + + + + + + 5]]> + + + + + + + + <![CDATA[married]]> + + + 5 (and one hopes much older)]]> + + + + + + + 5]]> + + + + + + + + <![CDATA[numKids]]> + + + 11 (and one hopes much older)]]> + + + + + + + 11]]> + + + + + + + + <![CDATA[numKids]]> + + + 11 (and one hopes much older)]]> + + + + + + + 11]]> + + + + + + + + <![CDATA[numKids]]> + + + 11 (and one hopes much older)]]> + + + + + + + 11]]> + + + + + + + + <![CDATA[message2]]> + +{if(is_empty(name),'',if(is_empty(age),'How old are you?',implode(' ','So, you are',age,'years old. Funny, you don\'t look it.')))}
      +{if(numKids>0,implode(' ','I hope you enjoy playing with your',if(numKids==1,'child!',implode(' ',numKids,'children!')),' I love my two girls!'),'')}
      +{if(numKids>1,implode('','The sum of the ages of your first ',min(5,numKids),' children is ',sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK),''),'')}
      +{if(sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)>age,'Wow, that means that the combined age of your children exceeds your own!','')}
      +{if((married=='Y' and max(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)>yearsMarried),'Hmmm, your oldest child is older than your marriage. Interesting.','')}]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[yearsMarried]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsMarried]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsMarried]]> + + + + + + + + + + + + + + + + + + <![CDATA[kid1]]> + + + + + + + + + + = 1]]> + + + + + + + + <![CDATA[kid1]]> + + + + + + + + + + = 1]]> + + + + + + + + <![CDATA[kid1]]> + + + + + + + + + + = 1]]> + + + + + + + + <![CDATA[kid2]]> + + + + + + + + + + = 2]]> + + + + + + + + <![CDATA[kid2]]> + + + + + + + + + + = 2]]> + + + + + + + + <![CDATA[kid2]]> + + + + + + + + + + = 2]]> + + + + + + + + <![CDATA[kid3]]> + + + + + + + + + + = 3]]> + + + + + + + + <![CDATA[kid3]]> + + + + + + + + + + = 3]]> + + + + + + + + <![CDATA[kid3]]> + + + + + + + + + + = 3]]> + + + + + + + + <![CDATA[kid4]]> + + + + + + + + + + = 4]]> + + + + + + + + <![CDATA[kid4]]> + + + + + + + + + + = 4]]> + + + + + + + + <![CDATA[kid4]]> + + + + + + + + + + = 4]]> + + + + + + + + <![CDATA[kid5]]> + + + + + + + + + + = 5]]> + + + + + + + + <![CDATA[kid5]]> + + + + + + + + + + = 5]]> + + + + + + + + <![CDATA[kid5]]> + + + + + + + + + + = 5]]> + + + + + + + + <![CDATA[q5pointChoice]]> + How much do you like LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[q5pointChoice]]> + How much do you like LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[q5pointChoice]]> + How much do you like LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListDropdown]]> + + What is your favorite pastime?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListDropdown]]> + + What is your favorite pastime?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListDropdown]]> + + What is your favorite pastime?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListRadio]]> + + What is your favorite color?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListRadio]]> + + What is your favorite color?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListRadio]]> + + What is your favorite color?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListWithComment]]> + Who is your favorite relative?  Why?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListWithComment]]> + Who is your favorite relative?  Why?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListWithComment]]> + Who is your favorite relative?  Why?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray]]> + How much do you like these foods?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray]]> + How much do you like these foods?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray]]> + How much do you like these foods?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray10Point]]> + How much pain to you currently feel in the following locations?  1 = none, 10 = extreme

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray10Point]]> + How much pain to you currently feel in the following locations?  1 = none, 10 = extreme

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray10Point]]> + How much pain to you currently feel in the following locations?  1 = none, 10 = extreme

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray5Point]]> + How much do you like the following?  (1 = not at all, 5 = extremely)

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray5Point]]> + How much do you like the following?  (1 = not at all, 5 = extremely)

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray5Point]]> + How much do you like the following?  (1 = not at all, 5 = extremely)

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayISD]]> + How should the following change?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayISD]]> + How should the following change?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayISD]]> + How should the following change?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayNumbers]]> + How long should it take to fix the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayNumbers]]> + How long should it take to fix the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayNumbers]]> + How long should it take to fix the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayTexts]]> + Who are your favorite characters in the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayTexts]]> + Who are your favorite characters in the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayTexts]]> + Who are your favorite characters in the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayYNU]]> + Which of the following conditions have you had?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayYNU]]> + Which of the following conditions have you had?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayYNU]]> + Which of the following conditions have you had?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayByColumn]]> + How tall are the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayByColumn]]> + How tall are the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayByColumn]]> + How tall are the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayDualScale]]> + For each of these issues, how severe and bothersome are they?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayDualScale]]> + For each of these issues, how severe and bothersome are they?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayDualScale]]> + For each of these issues, how severe and bothersome are they?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qDate]]> + When was your most recent birthday?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qDate]]> + When was your most recent birthday?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qDate]]> + When was your most recent birthday?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qFileUpload]]> + Please upload a picture

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qFileUpload]]> + Please upload a picture

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qFileUpload]]> + Please upload a picture

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qGender]]> + What gender are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qGender]]> + What gender are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qGender]]> + What gender are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLanguage]]> + Pick a new language

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLanguage]]> + Pick a new language

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLanguage]]> + Pick a new language

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleNumerical]]> + How old are the following people (or how old were  they when they died)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleNumerical]]> + How old are the following people (or how old were  they when they died)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleNumerical]]> + How old are the following people (or how old were  they when they died)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qNumerical]]> + How old are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qNumerical]]> + How old are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qNumerical]]> + How old are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qRanking]]> + Please rate your  favorite activities:

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qRanking]]> + Please rate your  favorite activities:

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qRanking]]> + Please rate your  favorite activities:

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qTextDisplay]]> + This is just a text display.  Is the rendered value saved anywhere?  Is there a database field for it (e.g. to emulate the Equation question type)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qTextDisplay]]> + This is just a text display.  Is the rendered value saved anywhere?  Is there a database field for it (e.g. to emulate the Equation question type)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qTextDisplay]]> + This is just a text display.  Is the rendered value saved anywhere?  Is there a database field for it (e.g. to emulate the Equation question type)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qYesNo]]> + Do you love LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qYesNo]]> + Do you love LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qYesNo]]> + Do you love LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qHugeText]]> + + Please paste your resume

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qHugeText]]> + + Please paste your resume

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qHugeText]]> + + Please paste your resume

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLongText]]> + Please write an essay saying  how much you love LimeSurvey.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLongText]]> + Please write an essay saying  how much you love LimeSurvey.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLongText]]> + Please write an essay saying  how much you love LimeSurvey.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleShort]]> + What are the names of your best friends?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleShort]]> + What are the names of your best friends?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleShort]]> + What are the names of your best friends?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qShort]]> + What is your favorite food?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qShort]]> + What is your favorite food?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qShort]]> + What is your favorite food?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleChoice]]> + Where would you like to vacation this year?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleChoice]]> + Where would you like to vacation this year?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleChoice]]> + Where would you like to vacation this year?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultChoiceComment]]> + Which of the following  do you like?   Please comment why or why not for each.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultChoiceComment]]> + Which of the following  do you like?   Please comment why or why not for each.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultChoiceComment]]> + Which of the following  do you like?   Please comment why or why not for each.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[OnPageRelevance]]> + + + + + + + + + + + + + + + + + + <![CDATA[OnPageRelevance]]> + + + + + + + + + + + + + + + + + + <![CDATA[OnPageRelevance]]> + + + + + + + + + + + + + + + + + + <![CDATA[showAny]]> + + + + + + + + + + + + + + + + + + <![CDATA[tThanks]]> + + You're all done, thanks!

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[tThanks]]> + + You're all done, thanks!

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[tThanks]]> + + You're all done, thanks!

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[tSummary1]]> + +Question#QuestionResponseCodeResponse +num{num.question}{num}{num.shown} +num2{num2.question}{num2}{num2.shown} +showAny{showAny.question}{showAny}{showAny.shown} +name{name.question}{name}{name.shown} +age{age.question}{age}{age.shown} +married{married.question}{married}{married.shown} +yearsMarried{yearsMarried.question}{yearsMarried}{yearsMarried.shown} +numKids{numKids.question}{numKids}{numKids.shown} +kid1{kid1.question}{kid1}{kid1.shown} +kid2{kid2.question}{kid2}{kid2.shown} +kid3{kid3.question}{kid3}{kid3.shown} +kid4{kid4.question}{kid4}{kid4.shown} +kid5{kid5.question}{kid5}{kid5.shown} +q5pointChoice{q5pointChoice.question}{q5pointChoice}{q5pointChoice.shown} +qListDropdown{qListDropdown.question}{qListDropdown}{qListDropdown.shown} +qListRadio{qListRadio.question}{qListRadio}{qListRadio.shown} +qListWithComment{qListWithComment.question}{qListWithComment}{qListWithComment.shown} +qListWithComment_comment{qListWithComment_comment.question}{qListWithComment_comment}{qListWithComment_comment.shown} +qArray_F1{qArray_F1.question}{qArray_F1}{qArray_F1.shown} +qArray_F2{qArray_F2.question}{qArray_F2}{qArray_F2.shown} +qArray_F3{qArray_F3.question}{qArray_F3}{qArray_F3.shown} +qArray_F4{qArray_F4.question}{qArray_F4}{qArray_F4.shown} +qArray_F5{qArray_F5.question}{qArray_F5}{qArray_F5.shown} +qArray10Point_L1{qArray10Point_L1.question}{qArray10Point_L1}{qArray10Point_L1.shown} +qArray10Point_L2{qArray10Point_L2.question}{qArray10Point_L2}{qArray10Point_L2.shown} +qArray10Point_L3{qArray10Point_L3.question}{qArray10Point_L3}{qArray10Point_L3.shown} +qArray10Point_L4{qArray10Point_L4.question}{qArray10Point_L4}{qArray10Point_L4.shown} +qArray10Point_L5{qArray10Point_L5.question}{qArray10Point_L5}{qArray10Point_L5.shown} +qArray10Point_L6{qArray10Point_L6.question}{qArray10Point_L6}{qArray10Point_L6.shown} +qArray5Point_1{qArray5Point_1.question}{qArray5Point_1}{qArray5Point_1.shown} +qArray5Point_2{qArray5Point_2.question}{qArray5Point_2}{qArray5Point_2.shown} +qArray5Point_3{qArray5Point_3.question}{qArray5Point_3}{qArray5Point_3.shown} +qArray5Point_4{qArray5Point_4.question}{qArray5Point_4}{qArray5Point_4.shown} +qArray5Point_5{qArray5Point_5.question}{qArray5Point_5}{qArray5Point_5.shown} +qArray5Point_6{qArray5Point_6.question}{qArray5Point_6}{qArray5Point_6.shown} +qArrayISD_1{qArrayISD_1.question}{qArrayISD_1}{qArrayISD_1.shown} +qArrayISD_2{qArrayISD_2.question}{qArrayISD_2}{qArrayISD_2.shown} +qArrayISD_3{qArrayISD_3.question}{qArrayISD_3}{qArrayISD_3.shown} +qArrayISD_4{qArrayISD_4.question}{qArrayISD_4}{qArrayISD_4.shown} +qArrayISD_5{qArrayISD_5.question}{qArrayISD_5}{qArrayISD_5.shown} +qArrayISD_6{qArrayISD_6.question}{qArrayISD_6}{qArrayISD_6.shown} +qArrayISD_7{qArrayISD_7.question}{qArrayISD_7}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.question}{qArrayNumbers_ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.question}{qArrayNumbers_ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.question}{qArrayNumbers_ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.question}{qArrayNumbers_todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.question}{qArrayNumbers_todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.question}{qArrayNumbers_todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.question}{qArrayNumbers_honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.question}{qArrayNumbers_honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.question}{qArrayNumbers_honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.question}{qArrayNumbers_econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.question}{qArrayNumbers_econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.question}{qArrayNumbers_econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.question}{qArrayTexts_hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.question}{qArrayTexts_hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.question}{qArrayTexts_hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{qArrayTexts_st_1st.question}{qArrayTexts_st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.question}{qArrayTexts_st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.question}{qArrayTexts_st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.question}{qArrayTexts_sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.question}{qArrayTexts_sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.question}{qArrayTexts_sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{qArrayYNU_1.question}{qArrayYNU_1}{qArrayYNU_1.shown} +qArrayYNU_2{qArrayYNU_2.question}{qArrayYNU_2}{qArrayYNU_2.shown} +qArrayYNU_3{qArrayYNU_3.question}{qArrayYNU_3}{qArrayYNU_3.shown} +qArrayYNU_4{qArrayYNU_4.question}{qArrayYNU_4}{qArrayYNU_4.shown} +qArrayYNU_5{qArrayYNU_5.question}{qArrayYNU_5}{qArrayYNU_5.shown} +qArrayByColumn_1{qArrayByColumn_1.question}{qArrayByColumn_1}{qArrayByColumn_1.shown} +qArrayByColumn_2{qArrayByColumn_2.question}{qArrayByColumn_2}{qArrayByColumn_2.shown} +qArrayByColumn_3{qArrayByColumn_3.question}{qArrayByColumn_3}{qArrayByColumn_3.shown} +qArrayByColumn_4{qArrayByColumn_4.question}{qArrayByColumn_4}{qArrayByColumn_4.shown} +qArrayByColumn_5{qArrayByColumn_5.question}{qArrayByColumn_5}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{qArrayDualScale_money_0.question}{qArrayDualScale_money_0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{qArrayDualScale_money_1.question}{qArrayDualScale_money_1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{qArrayDualScale_health_0.question}{qArrayDualScale_health_0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{qArrayDualScale_health_1.question}{qArrayDualScale_health_1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{qArrayDualScale_md_0.question}{qArrayDualScale_md_0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{qArrayDualScale_md_1.question}{qArrayDualScale_md_1}{qArrayDualScale_md_1.shown} +qDate{qDate.question}{qDate}{qDate.shown} +qFileUpload{qFileUpload.question}{qFileUpload}{qFileUpload.shown} +qGender{qGender.question}{qGender}{qGender.shown} +qLanguage{qLanguage.question}{qLanguage}{qLanguage.shown} +qMultipleNumerical_self{qMultipleNumerical_self.question}{qMultipleNumerical_self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{qMultipleNumerical_mom.question}{qMultipleNumerical_mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{qMultipleNumerical_dad.question}{qMultipleNumerical_dad}{qMultipleNumerical_dad.shown} +qNumerical{qNumerical.question}{qNumerical}{qNumerical.shown} +qRanking_1{qRanking_1.question}{qRanking_1}{qRanking_1.shown} +qRanking_2{qRanking_2.question}{qRanking_2}{qRanking_2.shown} +qRanking_3{qRanking_3.question}{qRanking_3}{qRanking_3.shown} +qRanking_4{qRanking_4.question}{qRanking_4}{qRanking_4.shown} +qTextDisplay{qTextDisplay.question}{qTextDisplay}{qTextDisplay.shown} +qYesNo{qYesNo.question}{qYesNo}{qYesNo.shown} +qHugeText{qHugeText.question}{qHugeText}{qHugeText.shown} +qLongText{qLongText.question}{qLongText}{qLongText.shown} +qMultipleShort_friend{qMultipleShort_friend.question}{qMultipleShort_friend}{qMultipleShort_friend.shown} +qMultipleShort_family{qMultipleShort_family.question}{qMultipleShort_family}{qMultipleShort_family.shown} +qMultipleShort_work{qMultipleShort_work.question}{qMultipleShort_work}{qMultipleShort_work.shown} +qShort{qShort.question}{qShort}{qShort.shown} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.question}{qMultipleChoice_Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.question}{qMultipleChoice_Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.question}{qMultipleChoice_NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{qMultChoiceComment_junk.question}{qMultChoiceComment_junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.question}{qMultChoiceComment_junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.question}{qMultChoiceComment_rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.question}{qMultChoiceComment_rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{qMultChoiceComment_ex.question}{qMultChoiceComment_ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.question}{qMultChoiceComment_excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + + + + + + + + <![CDATA[tSummary1]]> + +Question#QuestionResponseCodeResponse +num{num.question}{num}{num.shown} +num2{num2.question}{num2}{num2.shown} +showAny{showAny.question}{showAny}{showAny.shown} +name{name.question}{name}{name.shown} +age{age.question}{age}{age.shown} +married{married.question}{married}{married.shown} +yearsMarried{yearsMarried.question}{yearsMarried}{yearsMarried.shown} +numKids{numKids.question}{numKids}{numKids.shown} +kid1{kid1.question}{kid1}{kid1.shown} +kid2{kid2.question}{kid2}{kid2.shown} +kid3{kid3.question}{kid3}{kid3.shown} +kid4{kid4.question}{kid4}{kid4.shown} +kid5{kid5.question}{kid5}{kid5.shown} +q5pointChoice{q5pointChoice.question}{q5pointChoice}{q5pointChoice.shown} +qListDropdown{qListDropdown.question}{qListDropdown}{qListDropdown.shown} +qListRadio{qListRadio.question}{qListRadio}{qListRadio.shown} +qListWithComment{qListWithComment.question}{qListWithComment}{qListWithComment.shown} +qListWithComment_comment{qListWithComment_comment.question}{qListWithComment_comment}{qListWithComment_comment.shown} +qArray_F1{qArray_F1.question}{qArray_F1}{qArray_F1.shown} +qArray_F2{qArray_F2.question}{qArray_F2}{qArray_F2.shown} +qArray_F3{qArray_F3.question}{qArray_F3}{qArray_F3.shown} +qArray_F4{qArray_F4.question}{qArray_F4}{qArray_F4.shown} +qArray_F5{qArray_F5.question}{qArray_F5}{qArray_F5.shown} +qArray10Point_L1{qArray10Point_L1.question}{qArray10Point_L1}{qArray10Point_L1.shown} +qArray10Point_L2{qArray10Point_L2.question}{qArray10Point_L2}{qArray10Point_L2.shown} +qArray10Point_L3{qArray10Point_L3.question}{qArray10Point_L3}{qArray10Point_L3.shown} +qArray10Point_L4{qArray10Point_L4.question}{qArray10Point_L4}{qArray10Point_L4.shown} +qArray10Point_L5{qArray10Point_L5.question}{qArray10Point_L5}{qArray10Point_L5.shown} +qArray10Point_L6{qArray10Point_L6.question}{qArray10Point_L6}{qArray10Point_L6.shown} +qArray5Point_1{qArray5Point_1.question}{qArray5Point_1}{qArray5Point_1.shown} +qArray5Point_2{qArray5Point_2.question}{qArray5Point_2}{qArray5Point_2.shown} +qArray5Point_3{qArray5Point_3.question}{qArray5Point_3}{qArray5Point_3.shown} +qArray5Point_4{qArray5Point_4.question}{qArray5Point_4}{qArray5Point_4.shown} +qArray5Point_5{qArray5Point_5.question}{qArray5Point_5}{qArray5Point_5.shown} +qArray5Point_6{qArray5Point_6.question}{qArray5Point_6}{qArray5Point_6.shown} +qArrayISD_1{qArrayISD_1.question}{qArrayISD_1}{qArrayISD_1.shown} +qArrayISD_2{qArrayISD_2.question}{qArrayISD_2}{qArrayISD_2.shown} +qArrayISD_3{qArrayISD_3.question}{qArrayISD_3}{qArrayISD_3.shown} +qArrayISD_4{qArrayISD_4.question}{qArrayISD_4}{qArrayISD_4.shown} +qArrayISD_5{qArrayISD_5.question}{qArrayISD_5}{qArrayISD_5.shown} +qArrayISD_6{qArrayISD_6.question}{qArrayISD_6}{qArrayISD_6.shown} +qArrayISD_7{qArrayISD_7.question}{qArrayISD_7}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.question}{qArrayNumbers_ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.question}{qArrayNumbers_ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.question}{qArrayNumbers_ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.question}{qArrayNumbers_todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.question}{qArrayNumbers_todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.question}{qArrayNumbers_todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.question}{qArrayNumbers_honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.question}{qArrayNumbers_honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.question}{qArrayNumbers_honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.question}{qArrayNumbers_econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.question}{qArrayNumbers_econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.question}{qArrayNumbers_econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.question}{qArrayTexts_hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.question}{qArrayTexts_hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.question}{qArrayTexts_hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{qArrayTexts_st_1st.question}{qArrayTexts_st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.question}{qArrayTexts_st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.question}{qArrayTexts_st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.question}{qArrayTexts_sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.question}{qArrayTexts_sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.question}{qArrayTexts_sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{qArrayYNU_1.question}{qArrayYNU_1}{qArrayYNU_1.shown} +qArrayYNU_2{qArrayYNU_2.question}{qArrayYNU_2}{qArrayYNU_2.shown} +qArrayYNU_3{qArrayYNU_3.question}{qArrayYNU_3}{qArrayYNU_3.shown} +qArrayYNU_4{qArrayYNU_4.question}{qArrayYNU_4}{qArrayYNU_4.shown} +qArrayYNU_5{qArrayYNU_5.question}{qArrayYNU_5}{qArrayYNU_5.shown} +qArrayByColumn_1{qArrayByColumn_1.question}{qArrayByColumn_1}{qArrayByColumn_1.shown} +qArrayByColumn_2{qArrayByColumn_2.question}{qArrayByColumn_2}{qArrayByColumn_2.shown} +qArrayByColumn_3{qArrayByColumn_3.question}{qArrayByColumn_3}{qArrayByColumn_3.shown} +qArrayByColumn_4{qArrayByColumn_4.question}{qArrayByColumn_4}{qArrayByColumn_4.shown} +qArrayByColumn_5{qArrayByColumn_5.question}{qArrayByColumn_5}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{qArrayDualScale_money_0.question}{qArrayDualScale_money_0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{qArrayDualScale_money_1.question}{qArrayDualScale_money_1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{qArrayDualScale_health_0.question}{qArrayDualScale_health_0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{qArrayDualScale_health_1.question}{qArrayDualScale_health_1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{qArrayDualScale_md_0.question}{qArrayDualScale_md_0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{qArrayDualScale_md_1.question}{qArrayDualScale_md_1}{qArrayDualScale_md_1.shown} +qDate{qDate.question}{qDate}{qDate.shown} +qFileUpload{qFileUpload.question}{qFileUpload}{qFileUpload.shown} +qGender{qGender.question}{qGender}{qGender.shown} +qLanguage{qLanguage.question}{qLanguage}{qLanguage.shown} +qMultipleNumerical_self{qMultipleNumerical_self.question}{qMultipleNumerical_self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{qMultipleNumerical_mom.question}{qMultipleNumerical_mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{qMultipleNumerical_dad.question}{qMultipleNumerical_dad}{qMultipleNumerical_dad.shown} +qNumerical{qNumerical.question}{qNumerical}{qNumerical.shown} +qRanking_1{qRanking_1.question}{qRanking_1}{qRanking_1.shown} +qRanking_2{qRanking_2.question}{qRanking_2}{qRanking_2.shown} +qRanking_3{qRanking_3.question}{qRanking_3}{qRanking_3.shown} +qRanking_4{qRanking_4.question}{qRanking_4}{qRanking_4.shown} +qTextDisplay{qTextDisplay.question}{qTextDisplay}{qTextDisplay.shown} +qYesNo{qYesNo.question}{qYesNo}{qYesNo.shown} +qHugeText{qHugeText.question}{qHugeText}{qHugeText.shown} +qLongText{qLongText.question}{qLongText}{qLongText.shown} +qMultipleShort_friend{qMultipleShort_friend.question}{qMultipleShort_friend}{qMultipleShort_friend.shown} +qMultipleShort_family{qMultipleShort_family.question}{qMultipleShort_family}{qMultipleShort_family.shown} +qMultipleShort_work{qMultipleShort_work.question}{qMultipleShort_work}{qMultipleShort_work.shown} +qShort{qShort.question}{qShort}{qShort.shown} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.question}{qMultipleChoice_Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.question}{qMultipleChoice_Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.question}{qMultipleChoice_NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{qMultChoiceComment_junk.question}{qMultChoiceComment_junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.question}{qMultChoiceComment_junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.question}{qMultChoiceComment_rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.question}{qMultChoiceComment_rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{qMultChoiceComment_ex.question}{qMultChoiceComment_ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.question}{qMultChoiceComment_excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + + + + + + + + <![CDATA[tSummary1]]> + +Question#QuestionResponseCodeResponse +num{num.question}{num}{num.shown} +num2{num2.question}{num2}{num2.shown} +showAny{showAny.question}{showAny}{showAny.shown} +name{name.question}{name}{name.shown} +age{age.question}{age}{age.shown} +married{married.question}{married}{married.shown} +yearsMarried{yearsMarried.question}{yearsMarried}{yearsMarried.shown} +numKids{numKids.question}{numKids}{numKids.shown} +kid1{kid1.question}{kid1}{kid1.shown} +kid2{kid2.question}{kid2}{kid2.shown} +kid3{kid3.question}{kid3}{kid3.shown} +kid4{kid4.question}{kid4}{kid4.shown} +kid5{kid5.question}{kid5}{kid5.shown} +q5pointChoice{q5pointChoice.question}{q5pointChoice}{q5pointChoice.shown} +qListDropdown{qListDropdown.question}{qListDropdown}{qListDropdown.shown} +qListRadio{qListRadio.question}{qListRadio}{qListRadio.shown} +qListWithComment{qListWithComment.question}{qListWithComment}{qListWithComment.shown} +qListWithComment_comment{qListWithComment_comment.question}{qListWithComment_comment}{qListWithComment_comment.shown} +qArray_F1{qArray_F1.question}{qArray_F1}{qArray_F1.shown} +qArray_F2{qArray_F2.question}{qArray_F2}{qArray_F2.shown} +qArray_F3{qArray_F3.question}{qArray_F3}{qArray_F3.shown} +qArray_F4{qArray_F4.question}{qArray_F4}{qArray_F4.shown} +qArray_F5{qArray_F5.question}{qArray_F5}{qArray_F5.shown} +qArray10Point_L1{qArray10Point_L1.question}{qArray10Point_L1}{qArray10Point_L1.shown} +qArray10Point_L2{qArray10Point_L2.question}{qArray10Point_L2}{qArray10Point_L2.shown} +qArray10Point_L3{qArray10Point_L3.question}{qArray10Point_L3}{qArray10Point_L3.shown} +qArray10Point_L4{qArray10Point_L4.question}{qArray10Point_L4}{qArray10Point_L4.shown} +qArray10Point_L5{qArray10Point_L5.question}{qArray10Point_L5}{qArray10Point_L5.shown} +qArray10Point_L6{qArray10Point_L6.question}{qArray10Point_L6}{qArray10Point_L6.shown} +qArray5Point_1{qArray5Point_1.question}{qArray5Point_1}{qArray5Point_1.shown} +qArray5Point_2{qArray5Point_2.question}{qArray5Point_2}{qArray5Point_2.shown} +qArray5Point_3{qArray5Point_3.question}{qArray5Point_3}{qArray5Point_3.shown} +qArray5Point_4{qArray5Point_4.question}{qArray5Point_4}{qArray5Point_4.shown} +qArray5Point_5{qArray5Point_5.question}{qArray5Point_5}{qArray5Point_5.shown} +qArray5Point_6{qArray5Point_6.question}{qArray5Point_6}{qArray5Point_6.shown} +qArrayISD_1{qArrayISD_1.question}{qArrayISD_1}{qArrayISD_1.shown} +qArrayISD_2{qArrayISD_2.question}{qArrayISD_2}{qArrayISD_2.shown} +qArrayISD_3{qArrayISD_3.question}{qArrayISD_3}{qArrayISD_3.shown} +qArrayISD_4{qArrayISD_4.question}{qArrayISD_4}{qArrayISD_4.shown} +qArrayISD_5{qArrayISD_5.question}{qArrayISD_5}{qArrayISD_5.shown} +qArrayISD_6{qArrayISD_6.question}{qArrayISD_6}{qArrayISD_6.shown} +qArrayISD_7{qArrayISD_7.question}{qArrayISD_7}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.question}{qArrayNumbers_ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.question}{qArrayNumbers_ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.question}{qArrayNumbers_ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.question}{qArrayNumbers_todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.question}{qArrayNumbers_todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.question}{qArrayNumbers_todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.question}{qArrayNumbers_honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.question}{qArrayNumbers_honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.question}{qArrayNumbers_honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.question}{qArrayNumbers_econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.question}{qArrayNumbers_econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.question}{qArrayNumbers_econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.question}{qArrayTexts_hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.question}{qArrayTexts_hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.question}{qArrayTexts_hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{qArrayTexts_st_1st.question}{qArrayTexts_st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.question}{qArrayTexts_st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.question}{qArrayTexts_st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.question}{qArrayTexts_sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.question}{qArrayTexts_sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.question}{qArrayTexts_sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{qArrayYNU_1.question}{qArrayYNU_1}{qArrayYNU_1.shown} +qArrayYNU_2{qArrayYNU_2.question}{qArrayYNU_2}{qArrayYNU_2.shown} +qArrayYNU_3{qArrayYNU_3.question}{qArrayYNU_3}{qArrayYNU_3.shown} +qArrayYNU_4{qArrayYNU_4.question}{qArrayYNU_4}{qArrayYNU_4.shown} +qArrayYNU_5{qArrayYNU_5.question}{qArrayYNU_5}{qArrayYNU_5.shown} +qArrayByColumn_1{qArrayByColumn_1.question}{qArrayByColumn_1}{qArrayByColumn_1.shown} +qArrayByColumn_2{qArrayByColumn_2.question}{qArrayByColumn_2}{qArrayByColumn_2.shown} +qArrayByColumn_3{qArrayByColumn_3.question}{qArrayByColumn_3}{qArrayByColumn_3.shown} +qArrayByColumn_4{qArrayByColumn_4.question}{qArrayByColumn_4}{qArrayByColumn_4.shown} +qArrayByColumn_5{qArrayByColumn_5.question}{qArrayByColumn_5}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{qArrayDualScale_money_0.question}{qArrayDualScale_money_0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{qArrayDualScale_money_1.question}{qArrayDualScale_money_1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{qArrayDualScale_health_0.question}{qArrayDualScale_health_0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{qArrayDualScale_health_1.question}{qArrayDualScale_health_1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{qArrayDualScale_md_0.question}{qArrayDualScale_md_0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{qArrayDualScale_md_1.question}{qArrayDualScale_md_1}{qArrayDualScale_md_1.shown} +qDate{qDate.question}{qDate}{qDate.shown} +qFileUpload{qFileUpload.question}{qFileUpload}{qFileUpload.shown} +qGender{qGender.question}{qGender}{qGender.shown} +qLanguage{qLanguage.question}{qLanguage}{qLanguage.shown} +qMultipleNumerical_self{qMultipleNumerical_self.question}{qMultipleNumerical_self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{qMultipleNumerical_mom.question}{qMultipleNumerical_mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{qMultipleNumerical_dad.question}{qMultipleNumerical_dad}{qMultipleNumerical_dad.shown} +qNumerical{qNumerical.question}{qNumerical}{qNumerical.shown} +qRanking_1{qRanking_1.question}{qRanking_1}{qRanking_1.shown} +qRanking_2{qRanking_2.question}{qRanking_2}{qRanking_2.shown} +qRanking_3{qRanking_3.question}{qRanking_3}{qRanking_3.shown} +qRanking_4{qRanking_4.question}{qRanking_4}{qRanking_4.shown} +qTextDisplay{qTextDisplay.question}{qTextDisplay}{qTextDisplay.shown} +qYesNo{qYesNo.question}{qYesNo}{qYesNo.shown} +qHugeText{qHugeText.question}{qHugeText}{qHugeText.shown} +qLongText{qLongText.question}{qLongText}{qLongText.shown} +qMultipleShort_friend{qMultipleShort_friend.question}{qMultipleShort_friend}{qMultipleShort_friend.shown} +qMultipleShort_family{qMultipleShort_family.question}{qMultipleShort_family}{qMultipleShort_family.shown} +qMultipleShort_work{qMultipleShort_work.question}{qMultipleShort_work}{qMultipleShort_work.shown} +qShort{qShort.question}{qShort}{qShort.shown} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.question}{qMultipleChoice_Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.question}{qMultipleChoice_Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.question}{qMultipleChoice_NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{qMultChoiceComment_junk.question}{qMultChoiceComment_junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.question}{qMultChoiceComment_junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.question}{qMultChoiceComment_rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.question}{qMultChoiceComment_rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{qMultChoiceComment_ex.question}{qMultChoiceComment_ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.question}{qMultChoiceComment_excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + + + + + + + + <![CDATA[af5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[af5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[af5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[afDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[afe5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[afe5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[afe5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeL]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v2K]]> + + + num and num2 from the Dynamic Math display page, so based on current values, between {num} and {num2}.]]> + + + + + + + + + + + + + + + <![CDATA[v1AMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v4K]]> + + + num from the Dynamic Math Display page.)]]> + + + + + + + + + + + + + + + <![CDATA[oL]]> + + + + + + + + + + + + + + + + + + <![CDATA[oL]]> + + + + + + + + + + + + + + + + + + <![CDATA[oL]]> + + + + + + + + + + + + + + + + + + <![CDATA[oDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oN]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[oSFT]]> + + + + + + + + + + + + + + + + + + <![CDATA[oSFT]]> + + + + + + + + + + + + + + + + + + <![CDATA[oSFT]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[oMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden1]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden1]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden1]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden2]]> + 3}]]> + + + + + + + + + + + + + + + + + <![CDATA[hidden2]]> + 3}]]> + + + + + + + + + + + + + + + + + <![CDATA[hidden2]]> + 3}]]> + + + + + + + + + + + + + + + + + <![CDATA[hidden3]]> + + + + + + + + + + 50]]> + + + + + + + + <![CDATA[hidden3]]> + + + + + + + + + + 50]]> + + + + + + + + <![CDATA[hidden3]]> + + + + + + + + + + 50]]> + + + + + + + + <![CDATA[hidden4]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden4]]> + + + + + + + + + + + + + + + + + + <![CDATA[hidden4]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v2K_mnr]]> + + + num and num2 from the Dynamic Math Display page. So, base on current values, the sum must be between {num} and {num2}]]> + + + + + + + + + + + + + + + <![CDATA[v1AMF_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1AMF_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1AMF_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K_mnr]]> + + + + + + + + + + + + + + + + + + <![CDATA[v4K_mnr]]> + + + num from the Dynamic Math Display page, so based on current values, the sum must equal {num}]]> + + + + + + + + + + + + + + + <![CDATA[v5N]]> + + + yearsMarried and age (both from the Dynamic Relevance page), so based on current values, between {yearsMarried} and {age})]]> + + + + + + + + + + + + + + + <![CDATA[vQ]]> + + + + + + + + + + + + + + + + + + <![CDATA[vS]]> + + + + + + + + + + + + + + + + + + <![CDATA[vS]]> + + + + + + + + + + + + + + + + + + <![CDATA[vS]]> + + + + + + + + + + + + + + + + + + <![CDATA[vT]]> + + + + + + + + + + + + + + + + + + <![CDATA[vT]]> + + + + + + + + + + + + + + + + + + <![CDATA[vT]]> + + + + + + + + + + + + + + + + + + <![CDATA[vU]]> + + + + + + + + + + + + + + + + + + <![CDATA[vU]]> + + + + + + + + + + + + + + + + + + <![CDATA[vU]]> + + + + + + + + + + + + + + + + + + <![CDATA[vfMFtext]]> + + + afSrcFilter in the Array Filter Tests page.
      Please enter a valid US phone number. The Validation Equation is /^(?:\(\d{ 3 }\))\s*\d{ 3 }-\d{ 4 }$/]]>
      + + + + + + + +
      + + + + + + + <![CDATA[city]]> + + + + + + + + + + + + + + + + + + <![CDATA[city]]> + + + + + + + + + + + + + + + + + + <![CDATA[city]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsThere]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsThere]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsThere]]> + + + + + + + + + + + + + + + + + + <![CDATA[ranking]]> + + + + + + + + + + + + + + + + + + <![CDATA[ranking]]> + + + + + + + + + + + + + + + + + + <![CDATA[ranking]]> + + + + + + + + + + + + + + + + + + <![CDATA[opinions]]> + + + + + + + + + + + + + + + + + + <![CDATA[opinions]]> + + + + + + + + + + + + + + + + + + <![CDATA[opinions]]> + + + + + + + + + + + + + + + + + + <![CDATA[worries]]> + + + + + + + + + + + + + + + + + + <![CDATA[worries]]> + + + + + + + + + + + + + + + + + + <![CDATA[worries]]> + + + + + + + + + + + + + + + + + + <![CDATA[report]]> + + + + + + + + + + + + + + + + + + + +
      #QuestionCodeValueShown
      {city.qid}{city.question}{city}{city.value}{city.shown}
      {yearsThere.qid}{yearsThere.question}{yearsThere}{yearsThere.value}{yearsThere.shown}
      {ranking_1.qid}{ranking_1.question}{ranking_1}{ranking_1.value}{ranking_1.shown}
      {ranking_2.qid}{ranking_2.question}{ranking_2}{ranking_2.value}{ranking_2.shown}
      {ranking_3.qid}{ranking_3.question}{ranking_3}{ranking_3.value}{ranking_3.shown}
      {ranking_4.qid}{ranking_4.question}{ranking_4}{ranking_4.value}{ranking_4.shown}
      {opinions_tax.qid}{opinions_tax.question}{opinions_tax}{opinions_tax.value}{opinions_tax.shown}
      {opinions_srv.qid}{opinions_srv.question}{opinions_srv}{opinions_srv.value}{opinions_srv.shown}
      {opinions_evt.qid}{opinions_evt.question}{opinions_evt}{opinions_evt.value}{opinions_evt.shown}
      {worries_taxes_0.qid}{worries_taxes_0.question}{worries_taxes_0}{worries_taxes_0.value}{worries_taxes_0.shown}
      {worries_taxes_1.qid}{worries_taxes_1.question}{worries_taxes_1}{worries_taxes_1.value}{worries_taxes_1.shown}
      {worries_smog_0.qid}{worries_smog_0.question}{worries_smog_0}{worries_smog_0.value}{worries_smog_0.shown}
      {worries_smog_1.qid}{worries_smog_1.question}{worries_smog_1}{worries_smog_1.value}{worries_smog_1.shown}
      {worries_trans_0.qid}{worries_trans_0.question}{worries_trans_0}{worries_trans_0.value}{worries_trans_0.shown}
      {worries_trans_1.qid}{worries_trans_1.question}{worries_trans_1}{worries_trans_1.value}{worries_trans_1.shown}
      +Is this correct? +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[report]]> + + + + + + + + + + + + + + + + + + + +
      #QuestionCodeValueShown
      {city.qid}{city.question}{city}{city.value}{city.shown}
      {yearsThere.qid}{yearsThere.question}{yearsThere}{yearsThere.value}{yearsThere.shown}
      {ranking_1.qid}{ranking_1.question}{ranking_1}{ranking_1.value}{ranking_1.shown}
      {ranking_2.qid}{ranking_2.question}{ranking_2}{ranking_2.value}{ranking_2.shown}
      {ranking_3.qid}{ranking_3.question}{ranking_3}{ranking_3.value}{ranking_3.shown}
      {ranking_4.qid}{ranking_4.question}{ranking_4}{ranking_4.value}{ranking_4.shown}
      {opinions_tax.qid}{opinions_tax.question}{opinions_tax}{opinions_tax.value}{opinions_tax.shown}
      {opinions_srv.qid}{opinions_srv.question}{opinions_srv}{opinions_srv.value}{opinions_srv.shown}
      {opinions_evt.qid}{opinions_evt.question}{opinions_evt}{opinions_evt.value}{opinions_evt.shown}
      {worries_taxes_0.qid}{worries_taxes_0.question}{worries_taxes_0}{worries_taxes_0.value}{worries_taxes_0.shown}
      {worries_taxes_1.qid}{worries_taxes_1.question}{worries_taxes_1}{worries_taxes_1.value}{worries_taxes_1.shown}
      {worries_smog_0.qid}{worries_smog_0.question}{worries_smog_0}{worries_smog_0.value}{worries_smog_0.shown}
      {worries_smog_1.qid}{worries_smog_1.question}{worries_smog_1}{worries_smog_1.value}{worries_smog_1.shown}
      {worries_trans_0.qid}{worries_trans_0.question}{worries_trans_0}{worries_trans_0.value}{worries_trans_0.shown}
      {worries_trans_1.qid}{worries_trans_1.question}{worries_trans_1}{worries_trans_1.value}{worries_trans_1.shown}
      +Is this correct? +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[report]]> + + + + + + + + + + + + + + + + + + + +
      #QuestionCodeValueShown
      {city.qid}{city.question}{city}{city.value}{city.shown}
      {yearsThere.qid}{yearsThere.question}{yearsThere}{yearsThere.value}{yearsThere.shown}
      {ranking_1.qid}{ranking_1.question}{ranking_1}{ranking_1.value}{ranking_1.shown}
      {ranking_2.qid}{ranking_2.question}{ranking_2}{ranking_2.value}{ranking_2.shown}
      {ranking_3.qid}{ranking_3.question}{ranking_3}{ranking_3.value}{ranking_3.shown}
      {ranking_4.qid}{ranking_4.question}{ranking_4}{ranking_4.value}{ranking_4.shown}
      {opinions_tax.qid}{opinions_tax.question}{opinions_tax}{opinions_tax.value}{opinions_tax.shown}
      {opinions_srv.qid}{opinions_srv.question}{opinions_srv}{opinions_srv.value}{opinions_srv.shown}
      {opinions_evt.qid}{opinions_evt.question}{opinions_evt}{opinions_evt.value}{opinions_evt.shown}
      {worries_taxes_0.qid}{worries_taxes_0.question}{worries_taxes_0}{worries_taxes_0.value}{worries_taxes_0.shown}
      {worries_taxes_1.qid}{worries_taxes_1.question}{worries_taxes_1}{worries_taxes_1.value}{worries_taxes_1.shown}
      {worries_smog_0.qid}{worries_smog_0.question}{worries_smog_0}{worries_smog_0.value}{worries_smog_0.shown}
      {worries_smog_1.qid}{worries_smog_1.question}{worries_smog_1}{worries_smog_1.value}{worries_smog_1.shown}
      {worries_trans_0.qid}{worries_trans_0.question}{worries_trans_0}{worries_trans_0.value}{worries_trans_0.shown}
      {worries_trans_1.qid}{worries_trans_1.question}{worries_trans_1}{worries_trans_1.value}{worries_trans_1.shown}
      +Is this correct? +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[report2]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      + Var + SGQA + INSERTANS:SGQA
      + city + 82556X129X3206 + {82556X129X3206}, {INSERTANS:82556X129X3206}
      + yearsThere + 82556X129X3207 + {82556X129X3207}, {INSERTANS:82556X129X3207}
      + ranking_2 + 82556X129X32082 + {82556X129X32082}, {INSERTANS:82556X129X32082}
      + opinions_srv + 82556X129X3209srv + {82556X129X3209srv}, {INSERTANS:82556X129X3209srv}
      + worries_smog_0 + 82556X129X3210smog#0 + {82556X129X3210smog#0}, {INSERTANS:82556X129X3210smog#0}
      + worries_trans_1 + 82556X129X3210trans#1 + {82556X129X3210trans#1}, {INSERTANS:82556X129X3210trans#1}
      +

      +  

      ]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[num_gt_num2]]> + num) is less than the second number (num2), otherwise you will not be able to answer some of the validation tests.]]> + + + + + + + + + = num2]]> + + + + + + + + <![CDATA[num_lt_10]]> + num is less than 10, you will not be able to see the Dynamic Relevance page; and since that page asks your age, you will not be able to complete the validation questions later in the survey, that depend upon your age.]]> + + + + + + + + + + + + + + + + + <![CDATA[no_age_ymarried]]> + age and yearsMarried in order to complete some of the Validation Tests later in the survey.
      +In order to enter age, you must enter your name. In order to enter yearsMarried, you must say you are more than 5 years old.]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[age_lt_ym]]> + +Please correct this or you won't be able to pass some of the Validation Tests later in this survey.]]> + + + + + + + + + = age]]> + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[junk]]> + + + + + + + + + + + + + + + + + + <![CDATA[junk]]> + + + + + + + + + + + + + + + + + + <![CDATA[junk]]> + + + + + + + + + + + + + + + + + + <![CDATA[Hawaii]]> + + + + + + + + + + + + + + + + + + <![CDATA[Hawaii]]> + + + + + + + + + + + + + + + + + + <![CDATA[Hawaii]]> + + + + + + + + + + + + + + + + + + <![CDATA[rtv]]> + + + + + + + + + + + + + + + + + + <![CDATA[rtv]]> + + + + + + + + + + + + + + + + + + <![CDATA[rtv]]> + + + + + + + + + + + + + + + + + + <![CDATA[Bahamas]]> + + + + + + + + + + + + + + + + + + <![CDATA[Bahamas]]> + + + + + + + + + + + + + + + + + + <![CDATA[Bahamas]]> + + + + + + + + + + + + + + + + + + <![CDATA[ex]]> + + + + + + + + + + + + + + + + + + <![CDATA[ex]]> + + + + + + + + + + + + + + + + + + <![CDATA[ex]]> + + + + + + + + + + + + + + + + + + <![CDATA[friend]]> + + + + + + + + + + + + + + + + + + <![CDATA[friend]]> + + + + + + + + + + + + + + + + + + <![CDATA[friend]]> + + + + + + + + + + + + + + + + + + <![CDATA[Europe]]> + + + + + + + + + + + + + + + + + + <![CDATA[Europe]]> + + + + + + + + + + + + + + + + + + <![CDATA[Europe]]> + + + + + + + + + + + + + + + + + + <![CDATA[family]]> + + + + + + + + + + + + + + + + + + <![CDATA[family]]> + + + + + + + + + + + + + + + + + + <![CDATA[family]]> + + + + + + + + + + + + + + + + + + <![CDATA[NewZealand]]> + + + + + + + + + + + + + + + + + + <![CDATA[NewZealand]]> + + + + + + + + + + + + + + + + + + <![CDATA[NewZealand]]> + + + + + + + + + + + + + + + + + + <![CDATA[self]]> + + + + + + + + + + + + + + + + + + <![CDATA[self]]> + + + + + + + + + + + + + + + + + + <![CDATA[self]]> + + + + + + + + + + + + + + + + + + <![CDATA[mom]]> + + + + + + + + + + + + + + + + + + <![CDATA[mom]]> + + + + + + + + + + + + + + + + + + <![CDATA[mom]]> + + + + + + + + + + + + + + + + + + <![CDATA[work]]> + + + + + + + + + + + + + + + + + + <![CDATA[work]]> + + + + + + + + + + + + + + + + + + <![CDATA[work]]> + + + + + + + + + + + + + + + + + + <![CDATA[money]]> + + + + + + + + + + + + + + + + + + <![CDATA[money]]> + + + + + + + + + + + + + + + + + + <![CDATA[money]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[dad]]> + + + + + + + + + + + + + + + + + + <![CDATA[dad]]> + + + + + + + + + + + + + + + + + + <![CDATA[dad]]> + + + + + + + + + + + + + + + + + + <![CDATA[health]]> + + + + + + + + + + + + + + + + + + <![CDATA[health]]> + + + + + + + + + + + + + + + + + + <![CDATA[health]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[md]]> + + + + + + + + + + + + + + + + + + <![CDATA[md]]> + + + + + + + + + + + + + + + + + + <![CDATA[md]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[1st]]> + + + + + + + + + + + + + + + + + + <![CDATA[1st]]> + + + + + + + + + + + + + + + + + + <![CDATA[1st]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[hp]]> + + + + + + + + + + + + + + + + + + <![CDATA[hp]]> + + + + + + + + + + + + + + + + + + <![CDATA[hp]]> + + + + + + + + + + + + + + + + + + <![CDATA[2nd]]> + + + + + + + + + + + + + + + + + + <![CDATA[2nd]]> + + + + + + + + + + + + + + + + + + <![CDATA[2nd]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[ls1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ls1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ls1]]> + + + + + + + + + + + + + + + + + + <![CDATA[st]]> + + + + + + + + + + + + + + + + + + <![CDATA[st]]> + + + + + + + + + + + + + + + + + + <![CDATA[st]]> + + + + + + + + + + + + + + + + + + <![CDATA[3rd]]> + + + + + + + + + + + + + + + + + + <![CDATA[3rd]]> + + + + + + + + + + + + + + + + + + <![CDATA[3rd]]> + + + + + + + + + + + + + + + + + + <![CDATA[min]]> + + + + + + + + + + + + + + + + + + <![CDATA[min]]> + + + + + + + + + + + + + + + + + + <![CDATA[min]]> + + + + + + + + + + + + + + + + + + <![CDATA[sw]]> + + + + + + + + + + + + + + + + + + <![CDATA[sw]]> + + + + + + + + + + + + + + + + + + <![CDATA[sw]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[max]]> + + + + + + + + + + + + + + + + + + <![CDATA[max]]> + + + + + + + + + + + + + + + + + + <![CDATA[max]]> + + + + + + + + + + + + + + + + + + <![CDATA[todo]]> + + + + + + + + + + + + + + + + + + <![CDATA[todo]]> + + + + + + + + + + + + + + + + + + <![CDATA[todo]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[avg]]> + + + + + + + + + + + + + + + + + + <![CDATA[avg]]> + + + + + + + + + + + + + + + + + + <![CDATA[avg]]> + + + + + + + + + + + + + + + + + + <![CDATA[honey]]> + + + + + + + + + + + + + + + + + + <![CDATA[honey]]> + + + + + + + + + + + + + + + + + + <![CDATA[honey]]> + + + + + + + + + + + + + + + + + + <![CDATA[econ]]> + + + + + + + + + + + + + + + + + + <![CDATA[econ]]> + + + + + + + + + + + + + + + + + + <![CDATA[econ]]> + + + + + + + + + + + + + + + + + + <![CDATA[F1]]> + + + + + + + + + + + + + + + + + + <![CDATA[F1]]> + + + + + + + + + + + + + + + + + + <![CDATA[F1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[L1]]> + + + + + + + + + + + + + + + + + + <![CDATA[L1]]> + + + + + + + + + + + + + + + + + + <![CDATA[L1]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L2]]> + + + + + + + + + + + + + + + + + + <![CDATA[L2]]> + + + + + + + + + + + + + + + + + + <![CDATA[L2]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[7]]> + + + + + + + + + + + + + + + + + + <![CDATA[7]]> + + + + + + + + + + + + + + + + + + <![CDATA[7]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[F2]]> + + + + + + + + + + + + + + + + + + <![CDATA[F2]]> + + + + + + + + + + + + + + + + + + <![CDATA[F2]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L4]]> + + + + + + + + + + + + + + + + + + <![CDATA[L4]]> + + + + + + + + + + + + + + + + + + <![CDATA[L4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F3]]> + + + + + + + + + + + + + + + + + + <![CDATA[F3]]> + + + + + + + + + + + + + + + + + + <![CDATA[F3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L5]]> + + + + + + + + + + + + + + + + + + <![CDATA[L5]]> + + + + + + + + + + + + + + + + + + <![CDATA[L5]]> + + + + + + + + + + + + + + + + + + <![CDATA[L6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L6]]> + + + + + + + + + + + + + + + + + + <![CDATA[F4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F5]]> + + + + + + + + + + + + + + + + + + <![CDATA[F5]]> + + + + + + + + + + + + + + + + + + <![CDATA[F5]]> + + + + + + + + + + + + + + + + + + <![CDATA[q5C]]> + + + + + + + + + + + + + + + + + + <![CDATA[q5C]]> + + + + + + + + + + + + + + + + + + <![CDATA[q5C]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLWC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLWC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLWC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA10P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA10P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA10P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA5P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA5P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA5P]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qABC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qABC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qABC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qADS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qADS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qADS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qFU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qFU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qFU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qG]]> + + + + + + + + + + + + + + + + + + <![CDATA[qG]]> + + + + + + + + + + + + + + + + + + <![CDATA[qG]]> + + + + + + + + + + + + + + + + + + <![CDATA[qL]]> + + + + + + + + + + + + + + + + + + <![CDATA[qL]]> + + + + + + + + + + + + + + + + + + <![CDATA[qL]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qR]]> + + + + + + + + + + + + + + + + + + <![CDATA[qTD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qTD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qTD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qYN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qYN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qYN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qHT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qHT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qHT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[w]]> + + + + + + + + + + + + + + + + + + <![CDATA[w]]> + + + + + + + + + + + + + + + + + + <![CDATA[w]]> + + + + + + + + + + + + + + + + + + <![CDATA[p]]> + + + + + + + + + + + + + + + + + + <![CDATA[p]]> + + + + + + + + + + + + + + + + + + <![CDATA[p]]> + + + + + + + + + + + + + + + + + + <![CDATA[s]]> + + + + + + + + + + + + + + + + + + <![CDATA[s]]> + + + + + + + + + + + + + + + + + + <![CDATA[s]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[taxes]]> + + + + + + + + + + + + + + + + + + <![CDATA[taxes]]> + + + + + + + + + + + + + + + + + + <![CDATA[taxes]]> + + + + + + + + + + + + + + + + + + <![CDATA[smog]]> + + + + + + + + + + + + + + + + + + <![CDATA[smog]]> + + + + + + + + + + + + + + + + + + <![CDATA[smog]]> + + + + + + + + + + + + + + + + + + <![CDATA[tax]]> + + + + + + + + + + + + + + + + + + <![CDATA[tax]]> + + + + + + + + + + + + + + + + + + <![CDATA[tax]]> + + + + + + + + + + + + + + + + + + <![CDATA[trans]]> + + + + + + + + + + + + + + + + + + <![CDATA[trans]]> + + + + + + + + + + + + + + + + + + <![CDATA[trans]]> + + + + + + + + + + + + + + + + + + <![CDATA[srv]]> + + + + + + + + + + + + + + + + + + <![CDATA[srv]]> + + + + + + + + + + + + + + + + + + <![CDATA[srv]]> + + + + + + + + + + + + + + + + + + <![CDATA[evt]]> + + + + + + + + + + + + + + + + + + <![CDATA[evt]]> + + + + + + + + + + + + + + + + + + <![CDATA[evt]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 11]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + + + + + + + + + + + + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hallo, + +Eine neue Antwort wurde für die Umfrage '{SURVEYNAME}' abgegeben. + +Klicken Sie auf den folgenden Link um die Umfrage neu zu laden: +{RELOADURL} + +Klicken Sie auf den folgenden Link um den Antwortdatensatz anzusehen: +{VIEWRESPONSEURL} + +Klicken Sie auf den folgenden Link um den Antwortdatensatz zu bearbeiten: +{EDITRESPONSEURL} + +Um die Statistik zu sehen, klicken Sie hier: +{STATISTICSURL} + + +Die folgenden Antworten wurden vom Teilnehmer gegeben: +{ANSWERTABLE}]]> + + + + + + + + +
    • Dynamic tailoring of question text, including real-time Assessments. This includes access to a dozen question attributes so that you can show print-answer-like reports mid-survey
    • +
    • Dynamic control of question visibility via Relevance - like dynamic, complex Conditions
    • +
    • Flagging irrelevant questions as Not Applicable (they get NULLed in the database)
    • +
    • Cascading relevance - since irrelevant questions have their responses blanked out, relevance conditions can be cascaded by checking whether any single predecessor has a valid response.
    • +
    • Refer to questions by the SPSS/R variable_label (title/code) or via SGQA code
    • +
    • Navigation Index that lets you jump backwards, change answers, then safely jump forwards again (it will re-compute and validate everything in between)
    • +
    • Default Values (group All Question Types) - Note that if questions with default values become irrelevant, are saved, then become relevant again, the default values are restored
    • +
    • Enhanced development and debugging tools - e.g. from admin mode, select 'Survey Logic File' to see one-page view of all question/sub-question/answer text, conditions, attributes, relevance, validation, and tailoring; and click on any variable name to open a new window to edit that question or group.
    • + +

      +Please be sure to change your answers on the page, and navigate back and forth to see how it changes which questions you see and what they say.]]> + + + + +
      you have been invited to participate in a survey.

      The survey is titled:
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      To participate, please click on the link below.

      Sincerely,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Click here to do the survey:
      {SURVEYURL}

      If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
      {OPTOUTURL}]]>
      + +
      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:
      "{SURVEYNAME}"

      "{SURVEYDESCRIPTION}"

      To participate, please click on the link below.

      Sincerely,

      {ADMINNAME} ({ADMINEMAIL})

      ----------------------------------------------
      Click here to do the survey:
      {SURVEYURL}

      If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
      {OPTOUTURL}]]>
      + +
      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}.]]>
      + +
      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}]]>
      + + +
      A new response was submitted for your survey '{SURVEYNAME}'.

      Click the following link to reload the survey:
      {RELOADURL}

      Click the following link to see the individual response:
      {VIEWRESPONSEURL}

      Click the following link to edit the individual response:
      {EDITRESPONSEURL}

      View statistics by clicking here:
      {STATISTICSURL}]]>
      + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

      A new response was submitted for your survey '{SURVEYNAME}'.

      Click the following link to reload the survey:
      {RELOADURL}

      Click the following link to see the individual response:
      {VIEWRESPONSEURL}

      Click the following link to edit the individual response:
      {EDITRESPONSEURL}

      View statistics by clicking here:
      {STATISTICSURL}


      The following answers were given by the participant:
      {ANSWERTABLE}]]>
      + + + + + + + +

      +
      + Cette démo vous montre tous les types de questions et les options disponiblesdans les versions de LimeSurvey 1.92 + Beaucoup de nouvelles capacitésd'utiliser les haut-ExpressionManager (EM), y compris dynamique, basée sur la pertinence, en cascade, des branchements conditionnels et les micro-adaptation des questions.
      +
      +
      +
      +
      +
      +
      +
      +
      +  
      +
      +
      +
      +
      +
      +
      + +
      +]]> + + + + + + + + + + + + + + + + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Bonjour, + +Une nouvelle réponse a été soumise pour votre questionnaire '{SURVEYNAME}'. + +Cliquer sur le lien suivant pour recharger votre questionnaire : +{RELOADURL} + +Cliquer sur le lien suivant pour voir la réponse : +{VIEWRESPONSEURL} + +Cliquez sur le lien suivant pour éditer la réponse individuelle : +{EDITRESPONSEURL} + +Visualiser les statistiques en cliquant ici : +{STATISTICSURL} + + +les réponses suivantes ont été données par le participant : +{ANSWERTABLE}]]> + +
      +
      +
      + diff --git a/include/limesurvey/docs/demosurveys/limesurvey_sample_survey_english.lss b/include/limesurvey/docs/demosurveys/limesurvey_sample_survey_english.lss index 21ab5fdc..8fd56b60 100644 --- a/include/limesurvey/docs/demosurveys/limesurvey_sample_survey_english.lss +++ b/include/limesurvey/docs/demosurveys/limesurvey_sample_survey_english.lss @@ -7060,7 +7060,7 @@ This is the welcome text for the survey! You can can edit it in the survey properties.

      ]]>
      - This is the end message for the survey! A good place to thank you to answer to this survey.

      + This is the end message for the survey! A good place to thank you to answer to this survey.

      LimeSurvey : THE survey software is a free software, help LimeSurvey project : donate

      ]]>
      diff --git a/include/limesurvey/docs/demosurveys/ls2_EM_question_attributes.lss b/include/limesurvey/docs/demosurveys/ls2_EM_question_attributes.lss new file mode 100644 index 00000000..8cdecd78 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_EM_question_attributes.lss @@ -0,0 +1,6661 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + specialtype + scale_id + sqid + language + defaultvalue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[OnPageRelevance]]> + + + + + + + + + + + + + + + + + + <![CDATA[q5pointChoice]]> + How much do you like LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListDropdown]]> + + What is your favorite pastime?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListRadio]]> + + What is your favorite color?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qListWithComment]]> + Who is your favorite relative?  Why?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray]]> + How much do you like these foods?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray10Point]]> + How much pain to you currently feel in the following locations?  1 = none, 10 = extreme

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArray5Point]]> + How much do you like the following?  (1 = not at all, 5 = extremely)

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayISD]]> + How should the following change?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayNumbers]]> + How long should it take to fix the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayTexts]]> + Who are your favorite characters in the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayYNU]]> + Which of the following conditions have you had?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayByColumn]]> + How tall are the following?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qArrayDualScale]]> + For each of these issues, how severe and bothersome are they?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qDate]]> + When was your most recent birthday?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qFileUpload]]> + Please upload a picture

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qGender]]> + What gender are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLanguage]]> + Pick a new language

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleNumerical]]> + How old are the following people (or how old were  they when they died)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qNumerical]]> + How old are you?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qRanking]]> + Please rate your  favorite activities:

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qTextDisplay]]> + This is just a text display.  Is the rendered value saved anywhere?  Is there a database field for it (e.g. to emulate the Equation question type)?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qYesNo]]> + Do you love LimeSurvey?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qHugeText]]> + + Please paste your resume

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qLongText]]> + Please write an essay saying  how much you love LimeSurvey.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleShort]]> + What are the names of your best friends?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qShort]]> + What is your favorite food?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultipleChoice]]> + Where would you like to vacation this year?

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[qMultChoiceComment]]> + Which of the following  do you like?   Please comment why or why not for each.

      +]]>
      + + + + + + + + + +
      + + + + + + + <![CDATA[note]]> + + + + + + + + + + + + + + + + + + <![CDATA[report1]]> + +QcodeQuestionResponse CodeResponse +q5pointChoice{q5pointChoice.question}{q5pointChoice}{q5pointChoice.shown} +qListDropdown{qListDropdown.question}{qListDropdown}{qListDropdown.shown} +qListDropdown_other{qListDropdown_other.question}{qListDropdown_other}{qListDropdown_other.shown} +qListRadio{qListRadio.question}{qListRadio}{qListRadio.shown} +qListRadio_other{qListRadio_other.question}{qListRadio_other}{qListRadio_other.shown} +qListWithComment{qListWithComment.question}{qListWithComment}{qListWithComment.shown} +qListWithComment_comment{qListWithComment_comment.question}{qListWithComment_comment}{qListWithComment_comment.shown} +qArray_F1{qArray_F1.question}{qArray_F1}{qArray_F1.shown} +qArray_F2{qArray_F2.question}{qArray_F2}{qArray_F2.shown} +qArray_F3{qArray_F3.question}{qArray_F3}{qArray_F3.shown} +qArray_F4{qArray_F4.question}{qArray_F4}{qArray_F4.shown} +qArray_F5{qArray_F5.question}{qArray_F5}{qArray_F5.shown} +qArray10Point_L1{qArray10Point_L1.question}{qArray10Point_L1}{qArray10Point_L1.shown} +qArray10Point_L2{qArray10Point_L2.question}{qArray10Point_L2}{qArray10Point_L2.shown} +qArray10Point_L3{qArray10Point_L3.question}{qArray10Point_L3}{qArray10Point_L3.shown} +qArray10Point_L4{qArray10Point_L4.question}{qArray10Point_L4}{qArray10Point_L4.shown} +qArray10Point_L5{qArray10Point_L5.question}{qArray10Point_L5}{qArray10Point_L5.shown} +qArray10Point_L6{qArray10Point_L6.question}{qArray10Point_L6}{qArray10Point_L6.shown} +qArray5Point_1{qArray5Point_1.question}{qArray5Point_1}{qArray5Point_1.shown} +qArray5Point_2{qArray5Point_2.question}{qArray5Point_2}{qArray5Point_2.shown} +qArray5Point_3{qArray5Point_3.question}{qArray5Point_3}{qArray5Point_3.shown} +qArray5Point_4{qArray5Point_4.question}{qArray5Point_4}{qArray5Point_4.shown} +qArray5Point_5{qArray5Point_5.question}{qArray5Point_5}{qArray5Point_5.shown} +qArray5Point_6{qArray5Point_6.question}{qArray5Point_6}{qArray5Point_6.shown} +qArrayISD_1{qArrayISD_1.question}{qArrayISD_1}{qArrayISD_1.shown} +qArrayISD_2{qArrayISD_2.question}{qArrayISD_2}{qArrayISD_2.shown} +qArrayISD_3{qArrayISD_3.question}{qArrayISD_3}{qArrayISD_3.shown} +qArrayISD_4{qArrayISD_4.question}{qArrayISD_4}{qArrayISD_4.shown} +qArrayISD_5{qArrayISD_5.question}{qArrayISD_5}{qArrayISD_5.shown} +qArrayISD_6{qArrayISD_6.question}{qArrayISD_6}{qArrayISD_6.shown} +qArrayISD_7{qArrayISD_7.question}{qArrayISD_7}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.question}{qArrayNumbers_ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.question}{qArrayNumbers_ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.question}{qArrayNumbers_ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.question}{qArrayNumbers_todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.question}{qArrayNumbers_todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.question}{qArrayNumbers_todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.question}{qArrayNumbers_honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.question}{qArrayNumbers_honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.question}{qArrayNumbers_honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.question}{qArrayNumbers_econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.question}{qArrayNumbers_econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.question}{qArrayNumbers_econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.question}{qArrayTexts_hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.question}{qArrayTexts_hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.question}{qArrayTexts_hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{qArrayTexts_st_1st.question}{qArrayTexts_st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.question}{qArrayTexts_st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.question}{qArrayTexts_st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.question}{qArrayTexts_sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.question}{qArrayTexts_sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.question}{qArrayTexts_sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{qArrayYNU_1.question}{qArrayYNU_1}{qArrayYNU_1.shown} +qArrayYNU_2{qArrayYNU_2.question}{qArrayYNU_2}{qArrayYNU_2.shown} +qArrayYNU_3{qArrayYNU_3.question}{qArrayYNU_3}{qArrayYNU_3.shown} +qArrayYNU_4{qArrayYNU_4.question}{qArrayYNU_4}{qArrayYNU_4.shown} +qArrayYNU_5{qArrayYNU_5.question}{qArrayYNU_5}{qArrayYNU_5.shown} +qArrayByColumn_1{qArrayByColumn_1.question}{qArrayByColumn_1}{qArrayByColumn_1.shown} +qArrayByColumn_2{qArrayByColumn_2.question}{qArrayByColumn_2}{qArrayByColumn_2.shown} +qArrayByColumn_3{qArrayByColumn_3.question}{qArrayByColumn_3}{qArrayByColumn_3.shown} +qArrayByColumn_4{qArrayByColumn_4.question}{qArrayByColumn_4}{qArrayByColumn_4.shown} +qArrayByColumn_5{qArrayByColumn_5.question}{qArrayByColumn_5}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{qArrayDualScale_money_0.question}{qArrayDualScale_money_0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{qArrayDualScale_money_1.question}{qArrayDualScale_money_1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{qArrayDualScale_health_0.question}{qArrayDualScale_health_0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{qArrayDualScale_health_1.question}{qArrayDualScale_health_1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{qArrayDualScale_md_0.question}{qArrayDualScale_md_0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{qArrayDualScale_md_1.question}{qArrayDualScale_md_1}{qArrayDualScale_md_1.shown} +qDate{qDate.question}{qDate}{qDate.shown} +qFileUpload{qFileUpload.question}{qFileUpload}{qFileUpload.shown} +qFileUpload_filecount{qFileUpload_filecount.question}{qFileUpload_filecount}{qFileUpload_filecount.shown} +qGender{qGender.question}{qGender}{qGender.shown} +qLanguage{qLanguage.question}{qLanguage}{qLanguage.shown} +qMultipleNumerical_self{qMultipleNumerical_self.question}{qMultipleNumerical_self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{qMultipleNumerical_mom.question}{qMultipleNumerical_mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{qMultipleNumerical_dad.question}{qMultipleNumerical_dad}{qMultipleNumerical_dad.shown} +qNumerical{qNumerical.question}{qNumerical}{qNumerical.shown} +qRanking_1{qRanking_1.question}{qRanking_1}{qRanking_1.shown} +qRanking_2{qRanking_2.question}{qRanking_2}{qRanking_2.shown} +qRanking_3{qRanking_3.question}{qRanking_3}{qRanking_3.shown} +qRanking_4{qRanking_4.question}{qRanking_4}{qRanking_4.shown} +qTextDisplay{qTextDisplay.question}{qTextDisplay}{qTextDisplay.shown} +qYesNo{qYesNo.question}{qYesNo}{qYesNo.shown} +qHugeText{qHugeText.question}{qHugeText}{qHugeText.shown} +qLongText{qLongText.question}{qLongText}{qLongText.shown} +qMultipleShort_friend{qMultipleShort_friend.question}{qMultipleShort_friend}{qMultipleShort_friend.shown} +qMultipleShort_family{qMultipleShort_family.question}{qMultipleShort_family}{qMultipleShort_family.shown} +qMultipleShort_work{qMultipleShort_work.question}{qMultipleShort_work}{qMultipleShort_work.shown} +qShort{qShort.question}{qShort}{qShort.shown} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.question}{qMultipleChoice_Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.question}{qMultipleChoice_Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_Europe{qMultipleChoice_Europe.question}{qMultipleChoice_Europe}{qMultipleChoice_Europe.shown} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.question}{qMultipleChoice_NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{qMultChoiceComment_junk.question}{qMultChoiceComment_junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.question}{qMultChoiceComment_junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.question}{qMultChoiceComment_rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.question}{qMultChoiceComment_rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{qMultChoiceComment_ex.question}{qMultChoiceComment_ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.question}{qMultChoiceComment_excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + + + + + + + + <![CDATA[report2]]> + +QcodeTypeSQGQGIDQIDgseqqseq +q5pointChoice{q5pointChoice.type}{q5pointChoice.sgqa}{q5pointChoice.gid}{q5pointChoice.qid}{q5pointChoice.gseq}{q5pointChoice.qseq} +qListDropdown{qListDropdown.type}{qListDropdown.sgqa}{qListDropdown.gid}{qListDropdown.qid}{qListDropdown.gseq}{qListDropdown.qseq} +qListDropdown_other{qListDropdown_other.type}{qListDropdown_other.sgqa}{qListDropdown_other.gid}{qListDropdown_other.qid}{qListDropdown_other.gseq}{qListDropdown_other.qseq} +qListRadio{qListRadio.type}{qListRadio.sgqa}{qListRadio.gid}{qListRadio.qid}{qListRadio.gseq}{qListRadio.qseq} +qListRadio_other{qListRadio_other.type}{qListRadio_other.sgqa}{qListRadio_other.gid}{qListRadio_other.qid}{qListRadio_other.gseq}{qListRadio_other.qseq} +qListWithComment{qListWithComment.type}{qListWithComment.sgqa}{qListWithComment.gid}{qListWithComment.qid}{qListWithComment.gseq}{qListWithComment.qseq} +qListWithComment_comment{qListWithComment_comment.type}{qListWithComment_comment.sgqa}{qListWithComment_comment.gid}{qListWithComment_comment.qid}{qListWithComment_comment.gseq}{qListWithComment_comment.qseq} +qArray_F1{qArray_F1.type}{qArray_F1.sgqa}{qArray_F1.gid}{qArray_F1.qid}{qArray_F1.gseq}{qArray_F1.qseq} +qArray_F2{qArray_F2.type}{qArray_F2.sgqa}{qArray_F2.gid}{qArray_F2.qid}{qArray_F2.gseq}{qArray_F2.qseq} +qArray_F3{qArray_F3.type}{qArray_F3.sgqa}{qArray_F3.gid}{qArray_F3.qid}{qArray_F3.gseq}{qArray_F3.qseq} +qArray_F4{qArray_F4.type}{qArray_F4.sgqa}{qArray_F4.gid}{qArray_F4.qid}{qArray_F4.gseq}{qArray_F4.qseq} +qArray_F5{qArray_F5.type}{qArray_F5.sgqa}{qArray_F5.gid}{qArray_F5.qid}{qArray_F5.gseq}{qArray_F5.qseq} +qArray10Point_L1{qArray10Point_L1.type}{qArray10Point_L1.sgqa}{qArray10Point_L1.gid}{qArray10Point_L1.qid}{qArray10Point_L1.gseq}{qArray10Point_L1.qseq} +qArray10Point_L2{qArray10Point_L2.type}{qArray10Point_L2.sgqa}{qArray10Point_L2.gid}{qArray10Point_L2.qid}{qArray10Point_L2.gseq}{qArray10Point_L2.qseq} +qArray10Point_L3{qArray10Point_L3.type}{qArray10Point_L3.sgqa}{qArray10Point_L3.gid}{qArray10Point_L3.qid}{qArray10Point_L3.gseq}{qArray10Point_L3.qseq} +qArray10Point_L4{qArray10Point_L4.type}{qArray10Point_L4.sgqa}{qArray10Point_L4.gid}{qArray10Point_L4.qid}{qArray10Point_L4.gseq}{qArray10Point_L4.qseq} +qArray10Point_L5{qArray10Point_L5.type}{qArray10Point_L5.sgqa}{qArray10Point_L5.gid}{qArray10Point_L5.qid}{qArray10Point_L5.gseq}{qArray10Point_L5.qseq} +qArray10Point_L6{qArray10Point_L6.type}{qArray10Point_L6.sgqa}{qArray10Point_L6.gid}{qArray10Point_L6.qid}{qArray10Point_L6.gseq}{qArray10Point_L6.qseq} +qArray5Point_1{qArray5Point_1.type}{qArray5Point_1.sgqa}{qArray5Point_1.gid}{qArray5Point_1.qid}{qArray5Point_1.gseq}{qArray5Point_1.qseq} +qArray5Point_2{qArray5Point_2.type}{qArray5Point_2.sgqa}{qArray5Point_2.gid}{qArray5Point_2.qid}{qArray5Point_2.gseq}{qArray5Point_2.qseq} +qArray5Point_3{qArray5Point_3.type}{qArray5Point_3.sgqa}{qArray5Point_3.gid}{qArray5Point_3.qid}{qArray5Point_3.gseq}{qArray5Point_3.qseq} +qArray5Point_4{qArray5Point_4.type}{qArray5Point_4.sgqa}{qArray5Point_4.gid}{qArray5Point_4.qid}{qArray5Point_4.gseq}{qArray5Point_4.qseq} +qArray5Point_5{qArray5Point_5.type}{qArray5Point_5.sgqa}{qArray5Point_5.gid}{qArray5Point_5.qid}{qArray5Point_5.gseq}{qArray5Point_5.qseq} +qArray5Point_6{qArray5Point_6.type}{qArray5Point_6.sgqa}{qArray5Point_6.gid}{qArray5Point_6.qid}{qArray5Point_6.gseq}{qArray5Point_6.qseq} +qArrayISD_1{qArrayISD_1.type}{qArrayISD_1.sgqa}{qArrayISD_1.gid}{qArrayISD_1.qid}{qArrayISD_1.gseq}{qArrayISD_1.qseq} +qArrayISD_2{qArrayISD_2.type}{qArrayISD_2.sgqa}{qArrayISD_2.gid}{qArrayISD_2.qid}{qArrayISD_2.gseq}{qArrayISD_2.qseq} +qArrayISD_3{qArrayISD_3.type}{qArrayISD_3.sgqa}{qArrayISD_3.gid}{qArrayISD_3.qid}{qArrayISD_3.gseq}{qArrayISD_3.qseq} +qArrayISD_4{qArrayISD_4.type}{qArrayISD_4.sgqa}{qArrayISD_4.gid}{qArrayISD_4.qid}{qArrayISD_4.gseq}{qArrayISD_4.qseq} +qArrayISD_5{qArrayISD_5.type}{qArrayISD_5.sgqa}{qArrayISD_5.gid}{qArrayISD_5.qid}{qArrayISD_5.gseq}{qArrayISD_5.qseq} +qArrayISD_6{qArrayISD_6.type}{qArrayISD_6.sgqa}{qArrayISD_6.gid}{qArrayISD_6.qid}{qArrayISD_6.gseq}{qArrayISD_6.qseq} +qArrayISD_7{qArrayISD_7.type}{qArrayISD_7.sgqa}{qArrayISD_7.gid}{qArrayISD_7.qid}{qArrayISD_7.gseq}{qArrayISD_7.qseq} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.type}{qArrayNumbers_ls1_min.sgqa}{qArrayNumbers_ls1_min.gid}{qArrayNumbers_ls1_min.qid}{qArrayNumbers_ls1_min.gseq}{qArrayNumbers_ls1_min.qseq} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.type}{qArrayNumbers_ls1_max.sgqa}{qArrayNumbers_ls1_max.gid}{qArrayNumbers_ls1_max.qid}{qArrayNumbers_ls1_max.gseq}{qArrayNumbers_ls1_max.qseq} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.type}{qArrayNumbers_ls1_avg.sgqa}{qArrayNumbers_ls1_avg.gid}{qArrayNumbers_ls1_avg.qid}{qArrayNumbers_ls1_avg.gseq}{qArrayNumbers_ls1_avg.qseq} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.type}{qArrayNumbers_todo_min.sgqa}{qArrayNumbers_todo_min.gid}{qArrayNumbers_todo_min.qid}{qArrayNumbers_todo_min.gseq}{qArrayNumbers_todo_min.qseq} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.type}{qArrayNumbers_todo_max.sgqa}{qArrayNumbers_todo_max.gid}{qArrayNumbers_todo_max.qid}{qArrayNumbers_todo_max.gseq}{qArrayNumbers_todo_max.qseq} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.type}{qArrayNumbers_todo_avg.sgqa}{qArrayNumbers_todo_avg.gid}{qArrayNumbers_todo_avg.qid}{qArrayNumbers_todo_avg.gseq}{qArrayNumbers_todo_avg.qseq} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.type}{qArrayNumbers_honey_min.sgqa}{qArrayNumbers_honey_min.gid}{qArrayNumbers_honey_min.qid}{qArrayNumbers_honey_min.gseq}{qArrayNumbers_honey_min.qseq} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.type}{qArrayNumbers_honey_max.sgqa}{qArrayNumbers_honey_max.gid}{qArrayNumbers_honey_max.qid}{qArrayNumbers_honey_max.gseq}{qArrayNumbers_honey_max.qseq} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.type}{qArrayNumbers_honey_avg.sgqa}{qArrayNumbers_honey_avg.gid}{qArrayNumbers_honey_avg.qid}{qArrayNumbers_honey_avg.gseq}{qArrayNumbers_honey_avg.qseq} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.type}{qArrayNumbers_econ_min.sgqa}{qArrayNumbers_econ_min.gid}{qArrayNumbers_econ_min.qid}{qArrayNumbers_econ_min.gseq}{qArrayNumbers_econ_min.qseq} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.type}{qArrayNumbers_econ_max.sgqa}{qArrayNumbers_econ_max.gid}{qArrayNumbers_econ_max.qid}{qArrayNumbers_econ_max.gseq}{qArrayNumbers_econ_max.qseq} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.type}{qArrayNumbers_econ_avg.sgqa}{qArrayNumbers_econ_avg.gid}{qArrayNumbers_econ_avg.qid}{qArrayNumbers_econ_avg.gseq}{qArrayNumbers_econ_avg.qseq} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.type}{qArrayTexts_hp_1st.sgqa}{qArrayTexts_hp_1st.gid}{qArrayTexts_hp_1st.qid}{qArrayTexts_hp_1st.gseq}{qArrayTexts_hp_1st.qseq} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.type}{qArrayTexts_hp_2nd.sgqa}{qArrayTexts_hp_2nd.gid}{qArrayTexts_hp_2nd.qid}{qArrayTexts_hp_2nd.gseq}{qArrayTexts_hp_2nd.qseq} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.type}{qArrayTexts_hp_3rd.sgqa}{qArrayTexts_hp_3rd.gid}{qArrayTexts_hp_3rd.qid}{qArrayTexts_hp_3rd.gseq}{qArrayTexts_hp_3rd.qseq} +qArrayTexts_st_1st{qArrayTexts_st_1st.type}{qArrayTexts_st_1st.sgqa}{qArrayTexts_st_1st.gid}{qArrayTexts_st_1st.qid}{qArrayTexts_st_1st.gseq}{qArrayTexts_st_1st.qseq} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.type}{qArrayTexts_st_2nd.sgqa}{qArrayTexts_st_2nd.gid}{qArrayTexts_st_2nd.qid}{qArrayTexts_st_2nd.gseq}{qArrayTexts_st_2nd.qseq} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.type}{qArrayTexts_st_3rd.sgqa}{qArrayTexts_st_3rd.gid}{qArrayTexts_st_3rd.qid}{qArrayTexts_st_3rd.gseq}{qArrayTexts_st_3rd.qseq} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.type}{qArrayTexts_sw_1st.sgqa}{qArrayTexts_sw_1st.gid}{qArrayTexts_sw_1st.qid}{qArrayTexts_sw_1st.gseq}{qArrayTexts_sw_1st.qseq} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.type}{qArrayTexts_sw_2nd.sgqa}{qArrayTexts_sw_2nd.gid}{qArrayTexts_sw_2nd.qid}{qArrayTexts_sw_2nd.gseq}{qArrayTexts_sw_2nd.qseq} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.type}{qArrayTexts_sw_3rd.sgqa}{qArrayTexts_sw_3rd.gid}{qArrayTexts_sw_3rd.qid}{qArrayTexts_sw_3rd.gseq}{qArrayTexts_sw_3rd.qseq} +qArrayYNU_1{qArrayYNU_1.type}{qArrayYNU_1.sgqa}{qArrayYNU_1.gid}{qArrayYNU_1.qid}{qArrayYNU_1.gseq}{qArrayYNU_1.qseq} +qArrayYNU_2{qArrayYNU_2.type}{qArrayYNU_2.sgqa}{qArrayYNU_2.gid}{qArrayYNU_2.qid}{qArrayYNU_2.gseq}{qArrayYNU_2.qseq} +qArrayYNU_3{qArrayYNU_3.type}{qArrayYNU_3.sgqa}{qArrayYNU_3.gid}{qArrayYNU_3.qid}{qArrayYNU_3.gseq}{qArrayYNU_3.qseq} +qArrayYNU_4{qArrayYNU_4.type}{qArrayYNU_4.sgqa}{qArrayYNU_4.gid}{qArrayYNU_4.qid}{qArrayYNU_4.gseq}{qArrayYNU_4.qseq} +qArrayYNU_5{qArrayYNU_5.type}{qArrayYNU_5.sgqa}{qArrayYNU_5.gid}{qArrayYNU_5.qid}{qArrayYNU_5.gseq}{qArrayYNU_5.qseq} +qArrayByColumn_1{qArrayByColumn_1.type}{qArrayByColumn_1.sgqa}{qArrayByColumn_1.gid}{qArrayByColumn_1.qid}{qArrayByColumn_1.gseq}{qArrayByColumn_1.qseq} +qArrayByColumn_2{qArrayByColumn_2.type}{qArrayByColumn_2.sgqa}{qArrayByColumn_2.gid}{qArrayByColumn_2.qid}{qArrayByColumn_2.gseq}{qArrayByColumn_2.qseq} +qArrayByColumn_3{qArrayByColumn_3.type}{qArrayByColumn_3.sgqa}{qArrayByColumn_3.gid}{qArrayByColumn_3.qid}{qArrayByColumn_3.gseq}{qArrayByColumn_3.qseq} +qArrayByColumn_4{qArrayByColumn_4.type}{qArrayByColumn_4.sgqa}{qArrayByColumn_4.gid}{qArrayByColumn_4.qid}{qArrayByColumn_4.gseq}{qArrayByColumn_4.qseq} +qArrayByColumn_5{qArrayByColumn_5.type}{qArrayByColumn_5.sgqa}{qArrayByColumn_5.gid}{qArrayByColumn_5.qid}{qArrayByColumn_5.gseq}{qArrayByColumn_5.qseq} +qArrayDualScale_money_0{qArrayDualScale_money_0.type}{qArrayDualScale_money_0.sgqa}{qArrayDualScale_money_0.gid}{qArrayDualScale_money_0.qid}{qArrayDualScale_money_0.gseq}{qArrayDualScale_money_0.qseq} +qArrayDualScale_money_1{qArrayDualScale_money_1.type}{qArrayDualScale_money_1.sgqa}{qArrayDualScale_money_1.gid}{qArrayDualScale_money_1.qid}{qArrayDualScale_money_1.gseq}{qArrayDualScale_money_1.qseq} +qArrayDualScale_health_0{qArrayDualScale_health_0.type}{qArrayDualScale_health_0.sgqa}{qArrayDualScale_health_0.gid}{qArrayDualScale_health_0.qid}{qArrayDualScale_health_0.gseq}{qArrayDualScale_health_0.qseq} +qArrayDualScale_health_1{qArrayDualScale_health_1.type}{qArrayDualScale_health_1.sgqa}{qArrayDualScale_health_1.gid}{qArrayDualScale_health_1.qid}{qArrayDualScale_health_1.gseq}{qArrayDualScale_health_1.qseq} +qArrayDualScale_md_0{qArrayDualScale_md_0.type}{qArrayDualScale_md_0.sgqa}{qArrayDualScale_md_0.gid}{qArrayDualScale_md_0.qid}{qArrayDualScale_md_0.gseq}{qArrayDualScale_md_0.qseq} +qArrayDualScale_md_1{qArrayDualScale_md_1.type}{qArrayDualScale_md_1.sgqa}{qArrayDualScale_md_1.gid}{qArrayDualScale_md_1.qid}{qArrayDualScale_md_1.gseq}{qArrayDualScale_md_1.qseq} +qDate{qDate.type}{qDate.sgqa}{qDate.gid}{qDate.qid}{qDate.gseq}{qDate.qseq} +qFileUpload{qFileUpload.type}{qFileUpload.sgqa}{qFileUpload.gid}{qFileUpload.qid}{qFileUpload.gseq}{qFileUpload.qseq} +qFileUpload_filecount{qFileUpload_filecount.type}{qFileUpload_filecount.sgqa}{qFileUpload_filecount.gid}{qFileUpload_filecount.qid}{qFileUpload_filecount.gseq}{qFileUpload_filecount.qseq} +qGender{qGender.type}{qGender.sgqa}{qGender.gid}{qGender.qid}{qGender.gseq}{qGender.qseq} +qLanguage{qLanguage.type}{qLanguage.sgqa}{qLanguage.gid}{qLanguage.qid}{qLanguage.gseq}{qLanguage.qseq} +qMultipleNumerical_self{qMultipleNumerical_self.type}{qMultipleNumerical_self.sgqa}{qMultipleNumerical_self.gid}{qMultipleNumerical_self.qid}{qMultipleNumerical_self.gseq}{qMultipleNumerical_self.qseq} +qMultipleNumerical_mom{qMultipleNumerical_mom.type}{qMultipleNumerical_mom.sgqa}{qMultipleNumerical_mom.gid}{qMultipleNumerical_mom.qid}{qMultipleNumerical_mom.gseq}{qMultipleNumerical_mom.qseq} +qMultipleNumerical_dad{qMultipleNumerical_dad.type}{qMultipleNumerical_dad.sgqa}{qMultipleNumerical_dad.gid}{qMultipleNumerical_dad.qid}{qMultipleNumerical_dad.gseq}{qMultipleNumerical_dad.qseq} +qNumerical{qNumerical.type}{qNumerical.sgqa}{qNumerical.gid}{qNumerical.qid}{qNumerical.gseq}{qNumerical.qseq} +qRanking_1{qRanking_1.type}{qRanking_1.sgqa}{qRanking_1.gid}{qRanking_1.qid}{qRanking_1.gseq}{qRanking_1.qseq} +qRanking_2{qRanking_2.type}{qRanking_2.sgqa}{qRanking_2.gid}{qRanking_2.qid}{qRanking_2.gseq}{qRanking_2.qseq} +qRanking_3{qRanking_3.type}{qRanking_3.sgqa}{qRanking_3.gid}{qRanking_3.qid}{qRanking_3.gseq}{qRanking_3.qseq} +qRanking_4{qRanking_4.type}{qRanking_4.sgqa}{qRanking_4.gid}{qRanking_4.qid}{qRanking_4.gseq}{qRanking_4.qseq} +qTextDisplay{qTextDisplay.type}{qTextDisplay.sgqa}{qTextDisplay.gid}{qTextDisplay.qid}{qTextDisplay.gseq}{qTextDisplay.qseq} +qYesNo{qYesNo.type}{qYesNo.sgqa}{qYesNo.gid}{qYesNo.qid}{qYesNo.gseq}{qYesNo.qseq} +qHugeText{qHugeText.type}{qHugeText.sgqa}{qHugeText.gid}{qHugeText.qid}{qHugeText.gseq}{qHugeText.qseq} +qLongText{qLongText.type}{qLongText.sgqa}{qLongText.gid}{qLongText.qid}{qLongText.gseq}{qLongText.qseq} +qMultipleShort_friend{qMultipleShort_friend.type}{qMultipleShort_friend.sgqa}{qMultipleShort_friend.gid}{qMultipleShort_friend.qid}{qMultipleShort_friend.gseq}{qMultipleShort_friend.qseq} +qMultipleShort_family{qMultipleShort_family.type}{qMultipleShort_family.sgqa}{qMultipleShort_family.gid}{qMultipleShort_family.qid}{qMultipleShort_family.gseq}{qMultipleShort_family.qseq} +qMultipleShort_work{qMultipleShort_work.type}{qMultipleShort_work.sgqa}{qMultipleShort_work.gid}{qMultipleShort_work.qid}{qMultipleShort_work.gseq}{qMultipleShort_work.qseq} +qShort{qShort.type}{qShort.sgqa}{qShort.gid}{qShort.qid}{qShort.gseq}{qShort.qseq} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.type}{qMultipleChoice_Hawaii.sgqa}{qMultipleChoice_Hawaii.gid}{qMultipleChoice_Hawaii.qid}{qMultipleChoice_Hawaii.gseq}{qMultipleChoice_Hawaii.qseq} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.type}{qMultipleChoice_Bahamas.sgqa}{qMultipleChoice_Bahamas.gid}{qMultipleChoice_Bahamas.qid}{qMultipleChoice_Bahamas.gseq}{qMultipleChoice_Bahamas.qseq} +qMultipleChoice_Europe{qMultipleChoice_Europe.type}{qMultipleChoice_Europe.sgqa}{qMultipleChoice_Europe.gid}{qMultipleChoice_Europe.qid}{qMultipleChoice_Europe.gseq}{qMultipleChoice_Europe.qseq} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.type}{qMultipleChoice_NewZealand.sgqa}{qMultipleChoice_NewZealand.gid}{qMultipleChoice_NewZealand.qid}{qMultipleChoice_NewZealand.gseq}{qMultipleChoice_NewZealand.qseq} +qMultChoiceComment_junk{qMultChoiceComment_junk.type}{qMultChoiceComment_junk.sgqa}{qMultChoiceComment_junk.gid}{qMultChoiceComment_junk.qid}{qMultChoiceComment_junk.gseq}{qMultChoiceComment_junk.qseq} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.type}{qMultChoiceComment_junkcomment.sgqa}{qMultChoiceComment_junkcomment.gid}{qMultChoiceComment_junkcomment.qid}{qMultChoiceComment_junkcomment.gseq}{qMultChoiceComment_junkcomment.qseq} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.type}{qMultChoiceComment_rtv.sgqa}{qMultChoiceComment_rtv.gid}{qMultChoiceComment_rtv.qid}{qMultChoiceComment_rtv.gseq}{qMultChoiceComment_rtv.qseq} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.type}{qMultChoiceComment_rtvcomment.sgqa}{qMultChoiceComment_rtvcomment.gid}{qMultChoiceComment_rtvcomment.qid}{qMultChoiceComment_rtvcomment.gseq}{qMultChoiceComment_rtvcomment.qseq} +qMultChoiceComment_ex{qMultChoiceComment_ex.type}{qMultChoiceComment_ex.sgqa}{qMultChoiceComment_ex.gid}{qMultChoiceComment_ex.qid}{qMultChoiceComment_ex.gseq}{qMultChoiceComment_ex.qseq} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.type}{qMultChoiceComment_excomment.sgqa}{qMultChoiceComment_excomment.gid}{qMultChoiceComment_excomment.qid}{qMultChoiceComment_excomment.gseq}{qMultChoiceComment_excomment.qseq} +]]> + + + + + + + + + + + + + + + + + <![CDATA[report3]]> + +QcodeMandatoryGroup relevance eqnRelevance eqnRelevance Status +q5pointChoice{q5pointChoice.mandatory}{q5pointChoice.grelevance}{q5pointChoice.relevance}{q5pointChoice.relevanceStatus} +qListDropdown{qListDropdown.mandatory}{qListDropdown.grelevance}{qListDropdown.relevance}{qListDropdown.relevanceStatus} +qListDropdown_other{qListDropdown_other.mandatory}{qListDropdown_other.grelevance}{qListDropdown_other.relevance}{qListDropdown_other.relevanceStatus} +qListRadio{qListRadio.mandatory}{qListRadio.grelevance}{qListRadio.relevance}{qListRadio.relevanceStatus} +qListRadio_other{qListRadio_other.mandatory}{qListRadio_other.grelevance}{qListRadio_other.relevance}{qListRadio_other.relevanceStatus} +qListWithComment{qListWithComment.mandatory}{qListWithComment.grelevance}{qListWithComment.relevance}{qListWithComment.relevanceStatus} +qListWithComment_comment{qListWithComment_comment.mandatory}{qListWithComment_comment.grelevance}{qListWithComment_comment.relevance}{qListWithComment_comment.relevanceStatus} +qArray_F1{qArray_F1.mandatory}{qArray_F1.grelevance}{qArray_F1.relevance}{qArray_F1.relevanceStatus} +qArray_F2{qArray_F2.mandatory}{qArray_F2.grelevance}{qArray_F2.relevance}{qArray_F2.relevanceStatus} +qArray_F3{qArray_F3.mandatory}{qArray_F3.grelevance}{qArray_F3.relevance}{qArray_F3.relevanceStatus} +qArray_F4{qArray_F4.mandatory}{qArray_F4.grelevance}{qArray_F4.relevance}{qArray_F4.relevanceStatus} +qArray_F5{qArray_F5.mandatory}{qArray_F5.grelevance}{qArray_F5.relevance}{qArray_F5.relevanceStatus} +qArray10Point_L1{qArray10Point_L1.mandatory}{qArray10Point_L1.grelevance}{qArray10Point_L1.relevance}{qArray10Point_L1.relevanceStatus} +qArray10Point_L2{qArray10Point_L2.mandatory}{qArray10Point_L2.grelevance}{qArray10Point_L2.relevance}{qArray10Point_L2.relevanceStatus} +qArray10Point_L3{qArray10Point_L3.mandatory}{qArray10Point_L3.grelevance}{qArray10Point_L3.relevance}{qArray10Point_L3.relevanceStatus} +qArray10Point_L4{qArray10Point_L4.mandatory}{qArray10Point_L4.grelevance}{qArray10Point_L4.relevance}{qArray10Point_L4.relevanceStatus} +qArray10Point_L5{qArray10Point_L5.mandatory}{qArray10Point_L5.grelevance}{qArray10Point_L5.relevance}{qArray10Point_L5.relevanceStatus} +qArray10Point_L6{qArray10Point_L6.mandatory}{qArray10Point_L6.grelevance}{qArray10Point_L6.relevance}{qArray10Point_L6.relevanceStatus} +qArray5Point_1{qArray5Point_1.mandatory}{qArray5Point_1.grelevance}{qArray5Point_1.relevance}{qArray5Point_1.relevanceStatus} +qArray5Point_2{qArray5Point_2.mandatory}{qArray5Point_2.grelevance}{qArray5Point_2.relevance}{qArray5Point_2.relevanceStatus} +qArray5Point_3{qArray5Point_3.mandatory}{qArray5Point_3.grelevance}{qArray5Point_3.relevance}{qArray5Point_3.relevanceStatus} +qArray5Point_4{qArray5Point_4.mandatory}{qArray5Point_4.grelevance}{qArray5Point_4.relevance}{qArray5Point_4.relevanceStatus} +qArray5Point_5{qArray5Point_5.mandatory}{qArray5Point_5.grelevance}{qArray5Point_5.relevance}{qArray5Point_5.relevanceStatus} +qArray5Point_6{qArray5Point_6.mandatory}{qArray5Point_6.grelevance}{qArray5Point_6.relevance}{qArray5Point_6.relevanceStatus} +qArrayISD_1{qArrayISD_1.mandatory}{qArrayISD_1.grelevance}{qArrayISD_1.relevance}{qArrayISD_1.relevanceStatus} +qArrayISD_2{qArrayISD_2.mandatory}{qArrayISD_2.grelevance}{qArrayISD_2.relevance}{qArrayISD_2.relevanceStatus} +qArrayISD_3{qArrayISD_3.mandatory}{qArrayISD_3.grelevance}{qArrayISD_3.relevance}{qArrayISD_3.relevanceStatus} +qArrayISD_4{qArrayISD_4.mandatory}{qArrayISD_4.grelevance}{qArrayISD_4.relevance}{qArrayISD_4.relevanceStatus} +qArrayISD_5{qArrayISD_5.mandatory}{qArrayISD_5.grelevance}{qArrayISD_5.relevance}{qArrayISD_5.relevanceStatus} +qArrayISD_6{qArrayISD_6.mandatory}{qArrayISD_6.grelevance}{qArrayISD_6.relevance}{qArrayISD_6.relevanceStatus} +qArrayISD_7{qArrayISD_7.mandatory}{qArrayISD_7.grelevance}{qArrayISD_7.relevance}{qArrayISD_7.relevanceStatus} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.mandatory}{qArrayNumbers_ls1_min.grelevance}{qArrayNumbers_ls1_min.relevance}{qArrayNumbers_ls1_min.relevanceStatus} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.mandatory}{qArrayNumbers_ls1_max.grelevance}{qArrayNumbers_ls1_max.relevance}{qArrayNumbers_ls1_max.relevanceStatus} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.mandatory}{qArrayNumbers_ls1_avg.grelevance}{qArrayNumbers_ls1_avg.relevance}{qArrayNumbers_ls1_avg.relevanceStatus} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.mandatory}{qArrayNumbers_todo_min.grelevance}{qArrayNumbers_todo_min.relevance}{qArrayNumbers_todo_min.relevanceStatus} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.mandatory}{qArrayNumbers_todo_max.grelevance}{qArrayNumbers_todo_max.relevance}{qArrayNumbers_todo_max.relevanceStatus} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.mandatory}{qArrayNumbers_todo_avg.grelevance}{qArrayNumbers_todo_avg.relevance}{qArrayNumbers_todo_avg.relevanceStatus} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.mandatory}{qArrayNumbers_honey_min.grelevance}{qArrayNumbers_honey_min.relevance}{qArrayNumbers_honey_min.relevanceStatus} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.mandatory}{qArrayNumbers_honey_max.grelevance}{qArrayNumbers_honey_max.relevance}{qArrayNumbers_honey_max.relevanceStatus} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.mandatory}{qArrayNumbers_honey_avg.grelevance}{qArrayNumbers_honey_avg.relevance}{qArrayNumbers_honey_avg.relevanceStatus} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.mandatory}{qArrayNumbers_econ_min.grelevance}{qArrayNumbers_econ_min.relevance}{qArrayNumbers_econ_min.relevanceStatus} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.mandatory}{qArrayNumbers_econ_max.grelevance}{qArrayNumbers_econ_max.relevance}{qArrayNumbers_econ_max.relevanceStatus} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.mandatory}{qArrayNumbers_econ_avg.grelevance}{qArrayNumbers_econ_avg.relevance}{qArrayNumbers_econ_avg.relevanceStatus} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.mandatory}{qArrayTexts_hp_1st.grelevance}{qArrayTexts_hp_1st.relevance}{qArrayTexts_hp_1st.relevanceStatus} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.mandatory}{qArrayTexts_hp_2nd.grelevance}{qArrayTexts_hp_2nd.relevance}{qArrayTexts_hp_2nd.relevanceStatus} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.mandatory}{qArrayTexts_hp_3rd.grelevance}{qArrayTexts_hp_3rd.relevance}{qArrayTexts_hp_3rd.relevanceStatus} +qArrayTexts_st_1st{qArrayTexts_st_1st.mandatory}{qArrayTexts_st_1st.grelevance}{qArrayTexts_st_1st.relevance}{qArrayTexts_st_1st.relevanceStatus} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.mandatory}{qArrayTexts_st_2nd.grelevance}{qArrayTexts_st_2nd.relevance}{qArrayTexts_st_2nd.relevanceStatus} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.mandatory}{qArrayTexts_st_3rd.grelevance}{qArrayTexts_st_3rd.relevance}{qArrayTexts_st_3rd.relevanceStatus} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.mandatory}{qArrayTexts_sw_1st.grelevance}{qArrayTexts_sw_1st.relevance}{qArrayTexts_sw_1st.relevanceStatus} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.mandatory}{qArrayTexts_sw_2nd.grelevance}{qArrayTexts_sw_2nd.relevance}{qArrayTexts_sw_2nd.relevanceStatus} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.mandatory}{qArrayTexts_sw_3rd.grelevance}{qArrayTexts_sw_3rd.relevance}{qArrayTexts_sw_3rd.relevanceStatus} +qArrayYNU_1{qArrayYNU_1.mandatory}{qArrayYNU_1.grelevance}{qArrayYNU_1.relevance}{qArrayYNU_1.relevanceStatus} +qArrayYNU_2{qArrayYNU_2.mandatory}{qArrayYNU_2.grelevance}{qArrayYNU_2.relevance}{qArrayYNU_2.relevanceStatus} +qArrayYNU_3{qArrayYNU_3.mandatory}{qArrayYNU_3.grelevance}{qArrayYNU_3.relevance}{qArrayYNU_3.relevanceStatus} +qArrayYNU_4{qArrayYNU_4.mandatory}{qArrayYNU_4.grelevance}{qArrayYNU_4.relevance}{qArrayYNU_4.relevanceStatus} +qArrayYNU_5{qArrayYNU_5.mandatory}{qArrayYNU_5.grelevance}{qArrayYNU_5.relevance}{qArrayYNU_5.relevanceStatus} +qArrayByColumn_1{qArrayByColumn_1.mandatory}{qArrayByColumn_1.grelevance}{qArrayByColumn_1.relevance}{qArrayByColumn_1.relevanceStatus} +qArrayByColumn_2{qArrayByColumn_2.mandatory}{qArrayByColumn_2.grelevance}{qArrayByColumn_2.relevance}{qArrayByColumn_2.relevanceStatus} +qArrayByColumn_3{qArrayByColumn_3.mandatory}{qArrayByColumn_3.grelevance}{qArrayByColumn_3.relevance}{qArrayByColumn_3.relevanceStatus} +qArrayByColumn_4{qArrayByColumn_4.mandatory}{qArrayByColumn_4.grelevance}{qArrayByColumn_4.relevance}{qArrayByColumn_4.relevanceStatus} +qArrayByColumn_5{qArrayByColumn_5.mandatory}{qArrayByColumn_5.grelevance}{qArrayByColumn_5.relevance}{qArrayByColumn_5.relevanceStatus} +qArrayDualScale_money_0{qArrayDualScale_money_0.mandatory}{qArrayDualScale_money_0.grelevance}{qArrayDualScale_money_0.relevance}{qArrayDualScale_money_0.relevanceStatus} +qArrayDualScale_money_1{qArrayDualScale_money_1.mandatory}{qArrayDualScale_money_1.grelevance}{qArrayDualScale_money_1.relevance}{qArrayDualScale_money_1.relevanceStatus} +qArrayDualScale_health_0{qArrayDualScale_health_0.mandatory}{qArrayDualScale_health_0.grelevance}{qArrayDualScale_health_0.relevance}{qArrayDualScale_health_0.relevanceStatus} +qArrayDualScale_health_1{qArrayDualScale_health_1.mandatory}{qArrayDualScale_health_1.grelevance}{qArrayDualScale_health_1.relevance}{qArrayDualScale_health_1.relevanceStatus} +qArrayDualScale_md_0{qArrayDualScale_md_0.mandatory}{qArrayDualScale_md_0.grelevance}{qArrayDualScale_md_0.relevance}{qArrayDualScale_md_0.relevanceStatus} +qArrayDualScale_md_1{qArrayDualScale_md_1.mandatory}{qArrayDualScale_md_1.grelevance}{qArrayDualScale_md_1.relevance}{qArrayDualScale_md_1.relevanceStatus} +qDate{qDate.mandatory}{qDate.grelevance}{qDate.relevance}{qDate.relevanceStatus} +qFileUpload{qFileUpload.mandatory}{qFileUpload.grelevance}{qFileUpload.relevance}{qFileUpload.relevanceStatus} +qFileUpload_filecount{qFileUpload_filecount.mandatory}{qFileUpload_filecount.grelevance}{qFileUpload_filecount.relevance}{qFileUpload_filecount.relevanceStatus} +qGender{qGender.mandatory}{qGender.grelevance}{qGender.relevance}{qGender.relevanceStatus} +qLanguage{qLanguage.mandatory}{qLanguage.grelevance}{qLanguage.relevance}{qLanguage.relevanceStatus} +qMultipleNumerical_self{qMultipleNumerical_self.mandatory}{qMultipleNumerical_self.grelevance}{qMultipleNumerical_self.relevance}{qMultipleNumerical_self.relevanceStatus} +qMultipleNumerical_mom{qMultipleNumerical_mom.mandatory}{qMultipleNumerical_mom.grelevance}{qMultipleNumerical_mom.relevance}{qMultipleNumerical_mom.relevanceStatus} +qMultipleNumerical_dad{qMultipleNumerical_dad.mandatory}{qMultipleNumerical_dad.grelevance}{qMultipleNumerical_dad.relevance}{qMultipleNumerical_dad.relevanceStatus} +qNumerical{qNumerical.mandatory}{qNumerical.grelevance}{qNumerical.relevance}{qNumerical.relevanceStatus} +qRanking_1{qRanking_1.mandatory}{qRanking_1.grelevance}{qRanking_1.relevance}{qRanking_1.relevanceStatus} +qRanking_2{qRanking_2.mandatory}{qRanking_2.grelevance}{qRanking_2.relevance}{qRanking_2.relevanceStatus} +qRanking_3{qRanking_3.mandatory}{qRanking_3.grelevance}{qRanking_3.relevance}{qRanking_3.relevanceStatus} +qRanking_4{qRanking_4.mandatory}{qRanking_4.grelevance}{qRanking_4.relevance}{qRanking_4.relevanceStatus} +qTextDisplay{qTextDisplay.mandatory}{qTextDisplay.grelevance}{qTextDisplay.relevance}{qTextDisplay.relevanceStatus} +qYesNo{qYesNo.mandatory}{qYesNo.grelevance}{qYesNo.relevance}{qYesNo.relevanceStatus} +qHugeText{qHugeText.mandatory}{qHugeText.grelevance}{qHugeText.relevance}{qHugeText.relevanceStatus} +qLongText{qLongText.mandatory}{qLongText.grelevance}{qLongText.relevance}{qLongText.relevanceStatus} +qMultipleShort_friend{qMultipleShort_friend.mandatory}{qMultipleShort_friend.grelevance}{qMultipleShort_friend.relevance}{qMultipleShort_friend.relevanceStatus} +qMultipleShort_family{qMultipleShort_family.mandatory}{qMultipleShort_family.grelevance}{qMultipleShort_family.relevance}{qMultipleShort_family.relevanceStatus} +qMultipleShort_work{qMultipleShort_work.mandatory}{qMultipleShort_work.grelevance}{qMultipleShort_work.relevance}{qMultipleShort_work.relevanceStatus} +qShort{qShort.mandatory}{qShort.grelevance}{qShort.relevance}{qShort.relevanceStatus} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.mandatory}{qMultipleChoice_Hawaii.grelevance}{qMultipleChoice_Hawaii.relevance}{qMultipleChoice_Hawaii.relevanceStatus} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.mandatory}{qMultipleChoice_Bahamas.grelevance}{qMultipleChoice_Bahamas.relevance}{qMultipleChoice_Bahamas.relevanceStatus} +qMultipleChoice_Europe{qMultipleChoice_Europe.mandatory}{qMultipleChoice_Europe.grelevance}{qMultipleChoice_Europe.relevance}{qMultipleChoice_Europe.relevanceStatus} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.mandatory}{qMultipleChoice_NewZealand.grelevance}{qMultipleChoice_NewZealand.relevance}{qMultipleChoice_NewZealand.relevanceStatus} +qMultChoiceComment_junk{qMultChoiceComment_junk.mandatory}{qMultChoiceComment_junk.grelevance}{qMultChoiceComment_junk.relevance}{qMultChoiceComment_junk.relevanceStatus} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.mandatory}{qMultChoiceComment_junkcomment.grelevance}{qMultChoiceComment_junkcomment.relevance}{qMultChoiceComment_junkcomment.relevanceStatus} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.mandatory}{qMultChoiceComment_rtv.grelevance}{qMultChoiceComment_rtv.relevance}{qMultChoiceComment_rtv.relevanceStatus} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.mandatory}{qMultChoiceComment_rtvcomment.grelevance}{qMultChoiceComment_rtvcomment.relevance}{qMultChoiceComment_rtvcomment.relevanceStatus} +qMultChoiceComment_ex{qMultChoiceComment_ex.mandatory}{qMultChoiceComment_ex.grelevance}{qMultChoiceComment_ex.relevance}{qMultChoiceComment_ex.relevanceStatus} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.mandatory}{qMultChoiceComment_excomment.grelevance}{qMultChoiceComment_excomment.relevance}{qMultChoiceComment_excomment.relevanceStatus} +]]> + + + + + + + + + + + + + + + + + <![CDATA[report4]]> + +QcodeJavaScript varnameJavaScript rownameCoded valueAssessment Value +q5pointChoice{q5pointChoice.jsName}{q5pointChoice.rowdivid}{q5pointChoice.code}{q5pointChoice.value} +qListDropdown{qListDropdown.jsName}{qListDropdown.rowdivid}{qListDropdown.code}{qListDropdown.value} +qListDropdown_other{qListDropdown_other.jsName}{qListDropdown_other.rowdivid}{qListDropdown_other.code}{qListDropdown_other.value} +qListRadio{qListRadio.jsName}{qListRadio.rowdivid}{qListRadio.code}{qListRadio.value} +qListRadio_other{qListRadio_other.jsName}{qListRadio_other.rowdivid}{qListRadio_other.code}{qListRadio_other.value} +qListWithComment{qListWithComment.jsName}{qListWithComment.rowdivid}{qListWithComment.code}{qListWithComment.value} +qListWithComment_comment{qListWithComment_comment.jsName}{qListWithComment_comment.rowdivid}{qListWithComment_comment.code}{qListWithComment_comment.value} +qArray_F1{qArray_F1.jsName}{qArray_F1.rowdivid}{qArray_F1.code}{qArray_F1.value} +qArray_F2{qArray_F2.jsName}{qArray_F2.rowdivid}{qArray_F2.code}{qArray_F2.value} +qArray_F3{qArray_F3.jsName}{qArray_F3.rowdivid}{qArray_F3.code}{qArray_F3.value} +qArray_F4{qArray_F4.jsName}{qArray_F4.rowdivid}{qArray_F4.code}{qArray_F4.value} +qArray_F5{qArray_F5.jsName}{qArray_F5.rowdivid}{qArray_F5.code}{qArray_F5.value} +qArray10Point_L1{qArray10Point_L1.jsName}{qArray10Point_L1.rowdivid}{qArray10Point_L1.code}{qArray10Point_L1.value} +qArray10Point_L2{qArray10Point_L2.jsName}{qArray10Point_L2.rowdivid}{qArray10Point_L2.code}{qArray10Point_L2.value} +qArray10Point_L3{qArray10Point_L3.jsName}{qArray10Point_L3.rowdivid}{qArray10Point_L3.code}{qArray10Point_L3.value} +qArray10Point_L4{qArray10Point_L4.jsName}{qArray10Point_L4.rowdivid}{qArray10Point_L4.code}{qArray10Point_L4.value} +qArray10Point_L5{qArray10Point_L5.jsName}{qArray10Point_L5.rowdivid}{qArray10Point_L5.code}{qArray10Point_L5.value} +qArray10Point_L6{qArray10Point_L6.jsName}{qArray10Point_L6.rowdivid}{qArray10Point_L6.code}{qArray10Point_L6.value} +qArray5Point_1{qArray5Point_1.jsName}{qArray5Point_1.rowdivid}{qArray5Point_1.code}{qArray5Point_1.value} +qArray5Point_2{qArray5Point_2.jsName}{qArray5Point_2.rowdivid}{qArray5Point_2.code}{qArray5Point_2.value} +qArray5Point_3{qArray5Point_3.jsName}{qArray5Point_3.rowdivid}{qArray5Point_3.code}{qArray5Point_3.value} +qArray5Point_4{qArray5Point_4.jsName}{qArray5Point_4.rowdivid}{qArray5Point_4.code}{qArray5Point_4.value} +qArray5Point_5{qArray5Point_5.jsName}{qArray5Point_5.rowdivid}{qArray5Point_5.code}{qArray5Point_5.value} +qArray5Point_6{qArray5Point_6.jsName}{qArray5Point_6.rowdivid}{qArray5Point_6.code}{qArray5Point_6.value} +qArrayISD_1{qArrayISD_1.jsName}{qArrayISD_1.rowdivid}{qArrayISD_1.code}{qArrayISD_1.value} +qArrayISD_2{qArrayISD_2.jsName}{qArrayISD_2.rowdivid}{qArrayISD_2.code}{qArrayISD_2.value} +qArrayISD_3{qArrayISD_3.jsName}{qArrayISD_3.rowdivid}{qArrayISD_3.code}{qArrayISD_3.value} +qArrayISD_4{qArrayISD_4.jsName}{qArrayISD_4.rowdivid}{qArrayISD_4.code}{qArrayISD_4.value} +qArrayISD_5{qArrayISD_5.jsName}{qArrayISD_5.rowdivid}{qArrayISD_5.code}{qArrayISD_5.value} +qArrayISD_6{qArrayISD_6.jsName}{qArrayISD_6.rowdivid}{qArrayISD_6.code}{qArrayISD_6.value} +qArrayISD_7{qArrayISD_7.jsName}{qArrayISD_7.rowdivid}{qArrayISD_7.code}{qArrayISD_7.value} +qArrayNumbers_ls1_min{qArrayNumbers_ls1_min.jsName}{qArrayNumbers_ls1_min.rowdivid}{qArrayNumbers_ls1_min.code}{qArrayNumbers_ls1_min.value} +qArrayNumbers_ls1_max{qArrayNumbers_ls1_max.jsName}{qArrayNumbers_ls1_max.rowdivid}{qArrayNumbers_ls1_max.code}{qArrayNumbers_ls1_max.value} +qArrayNumbers_ls1_avg{qArrayNumbers_ls1_avg.jsName}{qArrayNumbers_ls1_avg.rowdivid}{qArrayNumbers_ls1_avg.code}{qArrayNumbers_ls1_avg.value} +qArrayNumbers_todo_min{qArrayNumbers_todo_min.jsName}{qArrayNumbers_todo_min.rowdivid}{qArrayNumbers_todo_min.code}{qArrayNumbers_todo_min.value} +qArrayNumbers_todo_max{qArrayNumbers_todo_max.jsName}{qArrayNumbers_todo_max.rowdivid}{qArrayNumbers_todo_max.code}{qArrayNumbers_todo_max.value} +qArrayNumbers_todo_avg{qArrayNumbers_todo_avg.jsName}{qArrayNumbers_todo_avg.rowdivid}{qArrayNumbers_todo_avg.code}{qArrayNumbers_todo_avg.value} +qArrayNumbers_honey_min{qArrayNumbers_honey_min.jsName}{qArrayNumbers_honey_min.rowdivid}{qArrayNumbers_honey_min.code}{qArrayNumbers_honey_min.value} +qArrayNumbers_honey_max{qArrayNumbers_honey_max.jsName}{qArrayNumbers_honey_max.rowdivid}{qArrayNumbers_honey_max.code}{qArrayNumbers_honey_max.value} +qArrayNumbers_honey_avg{qArrayNumbers_honey_avg.jsName}{qArrayNumbers_honey_avg.rowdivid}{qArrayNumbers_honey_avg.code}{qArrayNumbers_honey_avg.value} +qArrayNumbers_econ_min{qArrayNumbers_econ_min.jsName}{qArrayNumbers_econ_min.rowdivid}{qArrayNumbers_econ_min.code}{qArrayNumbers_econ_min.value} +qArrayNumbers_econ_max{qArrayNumbers_econ_max.jsName}{qArrayNumbers_econ_max.rowdivid}{qArrayNumbers_econ_max.code}{qArrayNumbers_econ_max.value} +qArrayNumbers_econ_avg{qArrayNumbers_econ_avg.jsName}{qArrayNumbers_econ_avg.rowdivid}{qArrayNumbers_econ_avg.code}{qArrayNumbers_econ_avg.value} +qArrayTexts_hp_1st{qArrayTexts_hp_1st.jsName}{qArrayTexts_hp_1st.rowdivid}{qArrayTexts_hp_1st.code}{qArrayTexts_hp_1st.value} +qArrayTexts_hp_2nd{qArrayTexts_hp_2nd.jsName}{qArrayTexts_hp_2nd.rowdivid}{qArrayTexts_hp_2nd.code}{qArrayTexts_hp_2nd.value} +qArrayTexts_hp_3rd{qArrayTexts_hp_3rd.jsName}{qArrayTexts_hp_3rd.rowdivid}{qArrayTexts_hp_3rd.code}{qArrayTexts_hp_3rd.value} +qArrayTexts_st_1st{qArrayTexts_st_1st.jsName}{qArrayTexts_st_1st.rowdivid}{qArrayTexts_st_1st.code}{qArrayTexts_st_1st.value} +qArrayTexts_st_2nd{qArrayTexts_st_2nd.jsName}{qArrayTexts_st_2nd.rowdivid}{qArrayTexts_st_2nd.code}{qArrayTexts_st_2nd.value} +qArrayTexts_st_3rd{qArrayTexts_st_3rd.jsName}{qArrayTexts_st_3rd.rowdivid}{qArrayTexts_st_3rd.code}{qArrayTexts_st_3rd.value} +qArrayTexts_sw_1st{qArrayTexts_sw_1st.jsName}{qArrayTexts_sw_1st.rowdivid}{qArrayTexts_sw_1st.code}{qArrayTexts_sw_1st.value} +qArrayTexts_sw_2nd{qArrayTexts_sw_2nd.jsName}{qArrayTexts_sw_2nd.rowdivid}{qArrayTexts_sw_2nd.code}{qArrayTexts_sw_2nd.value} +qArrayTexts_sw_3rd{qArrayTexts_sw_3rd.jsName}{qArrayTexts_sw_3rd.rowdivid}{qArrayTexts_sw_3rd.code}{qArrayTexts_sw_3rd.value} +qArrayYNU_1{qArrayYNU_1.jsName}{qArrayYNU_1.rowdivid}{qArrayYNU_1.code}{qArrayYNU_1.value} +qArrayYNU_2{qArrayYNU_2.jsName}{qArrayYNU_2.rowdivid}{qArrayYNU_2.code}{qArrayYNU_2.value} +qArrayYNU_3{qArrayYNU_3.jsName}{qArrayYNU_3.rowdivid}{qArrayYNU_3.code}{qArrayYNU_3.value} +qArrayYNU_4{qArrayYNU_4.jsName}{qArrayYNU_4.rowdivid}{qArrayYNU_4.code}{qArrayYNU_4.value} +qArrayYNU_5{qArrayYNU_5.jsName}{qArrayYNU_5.rowdivid}{qArrayYNU_5.code}{qArrayYNU_5.value} +qArrayByColumn_1{qArrayByColumn_1.jsName}{qArrayByColumn_1.rowdivid}{qArrayByColumn_1.code}{qArrayByColumn_1.value} +qArrayByColumn_2{qArrayByColumn_2.jsName}{qArrayByColumn_2.rowdivid}{qArrayByColumn_2.code}{qArrayByColumn_2.value} +qArrayByColumn_3{qArrayByColumn_3.jsName}{qArrayByColumn_3.rowdivid}{qArrayByColumn_3.code}{qArrayByColumn_3.value} +qArrayByColumn_4{qArrayByColumn_4.jsName}{qArrayByColumn_4.rowdivid}{qArrayByColumn_4.code}{qArrayByColumn_4.value} +qArrayByColumn_5{qArrayByColumn_5.jsName}{qArrayByColumn_5.rowdivid}{qArrayByColumn_5.code}{qArrayByColumn_5.value} +qArrayDualScale_money_0{qArrayDualScale_money_0.jsName}{qArrayDualScale_money_0.rowdivid}{qArrayDualScale_money_0.code}{qArrayDualScale_money_0.value} +qArrayDualScale_money_1{qArrayDualScale_money_1.jsName}{qArrayDualScale_money_1.rowdivid}{qArrayDualScale_money_1.code}{qArrayDualScale_money_1.value} +qArrayDualScale_health_0{qArrayDualScale_health_0.jsName}{qArrayDualScale_health_0.rowdivid}{qArrayDualScale_health_0.code}{qArrayDualScale_health_0.value} +qArrayDualScale_health_1{qArrayDualScale_health_1.jsName}{qArrayDualScale_health_1.rowdivid}{qArrayDualScale_health_1.code}{qArrayDualScale_health_1.value} +qArrayDualScale_md_0{qArrayDualScale_md_0.jsName}{qArrayDualScale_md_0.rowdivid}{qArrayDualScale_md_0.code}{qArrayDualScale_md_0.value} +qArrayDualScale_md_1{qArrayDualScale_md_1.jsName}{qArrayDualScale_md_1.rowdivid}{qArrayDualScale_md_1.code}{qArrayDualScale_md_1.value} +qDate{qDate.jsName}{qDate.rowdivid}{qDate.code}{qDate.value} +qFileUpload{qFileUpload.jsName}{qFileUpload.rowdivid}{qFileUpload.code}{qFileUpload.value} +qFileUpload_filecount{qFileUpload_filecount.jsName}{qFileUpload_filecount.rowdivid}{qFileUpload_filecount.code}{qFileUpload_filecount.value} +qGender{qGender.jsName}{qGender.rowdivid}{qGender.code}{qGender.value} +qLanguage{qLanguage.jsName}{qLanguage.rowdivid}{qLanguage.code}{qLanguage.value} +qMultipleNumerical_self{qMultipleNumerical_self.jsName}{qMultipleNumerical_self.rowdivid}{qMultipleNumerical_self.code}{qMultipleNumerical_self.value} +qMultipleNumerical_mom{qMultipleNumerical_mom.jsName}{qMultipleNumerical_mom.rowdivid}{qMultipleNumerical_mom.code}{qMultipleNumerical_mom.value} +qMultipleNumerical_dad{qMultipleNumerical_dad.jsName}{qMultipleNumerical_dad.rowdivid}{qMultipleNumerical_dad.code}{qMultipleNumerical_dad.value} +qNumerical{qNumerical.jsName}{qNumerical.rowdivid}{qNumerical.code}{qNumerical.value} +qRanking_1{qRanking_1.jsName}{qRanking_1.rowdivid}{qRanking_1.code}{qRanking_1.value} +qRanking_2{qRanking_2.jsName}{qRanking_2.rowdivid}{qRanking_2.code}{qRanking_2.value} +qRanking_3{qRanking_3.jsName}{qRanking_3.rowdivid}{qRanking_3.code}{qRanking_3.value} +qRanking_4{qRanking_4.jsName}{qRanking_4.rowdivid}{qRanking_4.code}{qRanking_4.value} +qTextDisplay{qTextDisplay.jsName}{qTextDisplay.rowdivid}{qTextDisplay.code}{qTextDisplay.value} +qYesNo{qYesNo.jsName}{qYesNo.rowdivid}{qYesNo.code}{qYesNo.value} +qHugeText{qHugeText.jsName}{qHugeText.rowdivid}{qHugeText.code}{qHugeText.value} +qLongText{qLongText.jsName}{qLongText.rowdivid}{qLongText.code}{qLongText.value} +qMultipleShort_friend{qMultipleShort_friend.jsName}{qMultipleShort_friend.rowdivid}{qMultipleShort_friend.code}{qMultipleShort_friend.value} +qMultipleShort_family{qMultipleShort_family.jsName}{qMultipleShort_family.rowdivid}{qMultipleShort_family.code}{qMultipleShort_family.value} +qMultipleShort_work{qMultipleShort_work.jsName}{qMultipleShort_work.rowdivid}{qMultipleShort_work.code}{qMultipleShort_work.value} +qShort{qShort.jsName}{qShort.rowdivid}{qShort.code}{qShort.value} +qMultipleChoice_Hawaii{qMultipleChoice_Hawaii.jsName}{qMultipleChoice_Hawaii.rowdivid}{qMultipleChoice_Hawaii.code}{qMultipleChoice_Hawaii.value} +qMultipleChoice_Bahamas{qMultipleChoice_Bahamas.jsName}{qMultipleChoice_Bahamas.rowdivid}{qMultipleChoice_Bahamas.code}{qMultipleChoice_Bahamas.value} +qMultipleChoice_Europe{qMultipleChoice_Europe.jsName}{qMultipleChoice_Europe.rowdivid}{qMultipleChoice_Europe.code}{qMultipleChoice_Europe.value} +qMultipleChoice_NewZealand{qMultipleChoice_NewZealand.jsName}{qMultipleChoice_NewZealand.rowdivid}{qMultipleChoice_NewZealand.code}{qMultipleChoice_NewZealand.value} +qMultChoiceComment_junk{qMultChoiceComment_junk.jsName}{qMultChoiceComment_junk.rowdivid}{qMultChoiceComment_junk.code}{qMultChoiceComment_junk.value} +qMultChoiceComment_junkcomment{qMultChoiceComment_junkcomment.jsName}{qMultChoiceComment_junkcomment.rowdivid}{qMultChoiceComment_junkcomment.code}{qMultChoiceComment_junkcomment.value} +qMultChoiceComment_rtv{qMultChoiceComment_rtv.jsName}{qMultChoiceComment_rtv.rowdivid}{qMultChoiceComment_rtv.code}{qMultChoiceComment_rtv.value} +qMultChoiceComment_rtvcomment{qMultChoiceComment_rtvcomment.jsName}{qMultChoiceComment_rtvcomment.rowdivid}{qMultChoiceComment_rtvcomment.code}{qMultChoiceComment_rtvcomment.value} +qMultChoiceComment_ex{qMultChoiceComment_ex.jsName}{qMultChoiceComment_ex.rowdivid}{qMultChoiceComment_ex.code}{qMultChoiceComment_ex.value} +qMultChoiceComment_excomment{qMultChoiceComment_excomment.jsName}{qMultChoiceComment_excomment.rowdivid}{qMultChoiceComment_excomment.code}{qMultChoiceComment_excomment.value} +]]> + + + + + + + + + + + + + + + + + <![CDATA[report0]]> + +QcodeINSERTANSQcode.shown +q5pointChoice{INSERTANS:14272X54X930}{q5pointChoice.shown} +qListDropdown{INSERTANS:14272X54X931}{qListDropdown.shown} +qListDropdown_other{INSERTANS:14272X54X931other}{qListDropdown_other.shown} +qListRadio{INSERTANS:14272X54X932}{qListRadio.shown} +qListRadio_other{INSERTANS:14272X54X932other}{qListRadio_other.shown} +qListWithComment{INSERTANS:14272X54X933}{qListWithComment.shown} +qListWithComment_comment{INSERTANS:14272X54X933comment}{qListWithComment_comment.shown} +qArray_F1{INSERTANS:14272X54X934F1}{qArray_F1.shown} +qArray_F2{INSERTANS:14272X54X934F2}{qArray_F2.shown} +qArray_F3{INSERTANS:14272X54X934F3}{qArray_F3.shown} +qArray_F4{INSERTANS:14272X54X934F4}{qArray_F4.shown} +qArray_F5{INSERTANS:14272X54X934F5}{qArray_F5.shown} +qArray10Point_L1{INSERTANS:14272X54X935L1}{qArray10Point_L1.shown} +qArray10Point_L2{INSERTANS:14272X54X935L2}{qArray10Point_L2.shown} +qArray10Point_L3{INSERTANS:14272X54X935L3}{qArray10Point_L3.shown} +qArray10Point_L4{INSERTANS:14272X54X935L4}{qArray10Point_L4.shown} +qArray10Point_L5{INSERTANS:14272X54X935L5}{qArray10Point_L5.shown} +qArray10Point_L6{INSERTANS:14272X54X935L6}{qArray10Point_L6.shown} +qArray5Point_1{INSERTANS:14272X54X9361}{qArray5Point_1.shown} +qArray5Point_2{INSERTANS:14272X54X9362}{qArray5Point_2.shown} +qArray5Point_3{INSERTANS:14272X54X9363}{qArray5Point_3.shown} +qArray5Point_4{INSERTANS:14272X54X9364}{qArray5Point_4.shown} +qArray5Point_5{INSERTANS:14272X54X9365}{qArray5Point_5.shown} +qArray5Point_6{INSERTANS:14272X54X9366}{qArray5Point_6.shown} +qArrayISD_1{INSERTANS:14272X54X9371}{qArrayISD_1.shown} +qArrayISD_2{INSERTANS:14272X54X9372}{qArrayISD_2.shown} +qArrayISD_3{INSERTANS:14272X54X9373}{qArrayISD_3.shown} +qArrayISD_4{INSERTANS:14272X54X9374}{qArrayISD_4.shown} +qArrayISD_5{INSERTANS:14272X54X9375}{qArrayISD_5.shown} +qArrayISD_6{INSERTANS:14272X54X9376}{qArrayISD_6.shown} +qArrayISD_7{INSERTANS:14272X54X9377}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{INSERTANS:14272X54X938ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{INSERTANS:14272X54X938ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{INSERTANS:14272X54X938ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{INSERTANS:14272X54X938todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{INSERTANS:14272X54X938todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{INSERTANS:14272X54X938todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{INSERTANS:14272X54X938honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{INSERTANS:14272X54X938honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{INSERTANS:14272X54X938honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{INSERTANS:14272X54X938econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{INSERTANS:14272X54X938econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{INSERTANS:14272X54X938econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{INSERTANS:14272X54X939hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{INSERTANS:14272X54X939hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{INSERTANS:14272X54X939hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{INSERTANS:14272X54X939st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{INSERTANS:14272X54X939st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{INSERTANS:14272X54X939st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{INSERTANS:14272X54X939sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{INSERTANS:14272X54X939sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{INSERTANS:14272X54X939sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{INSERTANS:14272X54X9401}{qArrayYNU_1.shown} +qArrayYNU_2{INSERTANS:14272X54X9402}{qArrayYNU_2.shown} +qArrayYNU_3{INSERTANS:14272X54X9403}{qArrayYNU_3.shown} +qArrayYNU_4{INSERTANS:14272X54X9404}{qArrayYNU_4.shown} +qArrayYNU_5{INSERTANS:14272X54X9405}{qArrayYNU_5.shown} +qArrayByColumn_1{INSERTANS:14272X54X9411}{qArrayByColumn_1.shown} +qArrayByColumn_2{INSERTANS:14272X54X9412}{qArrayByColumn_2.shown} +qArrayByColumn_3{INSERTANS:14272X54X9413}{qArrayByColumn_3.shown} +qArrayByColumn_4{INSERTANS:14272X54X9414}{qArrayByColumn_4.shown} +qArrayByColumn_5{INSERTANS:14272X54X9415}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{INSERTANS:14272X54X942money#0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{INSERTANS:14272X54X942money#1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{INSERTANS:14272X54X942health#0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{INSERTANS:14272X54X942health#1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{INSERTANS:14272X54X942md#0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{INSERTANS:14272X54X942md#1}{qArrayDualScale_md_1.shown} +qDate{INSERTANS:14272X54X943}{qDate.shown} +qFileUpload{INSERTANS:14272X54X944}{qFileUpload.shown} +qFileUpload_filecount{INSERTANS:14272X54X944_filecount}{qFileUpload_filecount.shown} +qGender{INSERTANS:14272X54X945}{qGender.shown} +qLanguage{INSERTANS:14272X54X946}{qLanguage.shown} +qMultipleNumerical_self{INSERTANS:14272X54X947self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{INSERTANS:14272X54X947mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{INSERTANS:14272X54X947dad}{qMultipleNumerical_dad.shown} +qNumerical{INSERTANS:14272X54X948}{qNumerical.shown} +qRanking_1{INSERTANS:14272X54X9491}{qRanking_1.shown} +qRanking_2{INSERTANS:14272X54X9492}{qRanking_2.shown} +qRanking_3{INSERTANS:14272X54X9493}{qRanking_3.shown} +qRanking_4{INSERTANS:14272X54X9494}{qRanking_4.shown} +qTextDisplay{INSERTANS:14272X54X950}{qTextDisplay.shown} +qYesNo{INSERTANS:14272X54X951}{qYesNo.shown} +qHugeText{INSERTANS:14272X54X952}{qHugeText.shown} +qLongText{INSERTANS:14272X54X953}{qLongText.shown} +qMultipleShort_friend{INSERTANS:14272X54X954friend}{qMultipleShort_friend.shown} +qMultipleShort_family{INSERTANS:14272X54X954family}{qMultipleShort_family.shown} +qMultipleShort_work{INSERTANS:14272X54X954work}{qMultipleShort_work.shown} +qShort{INSERTANS:14272X54X955}{qShort.shown} +qMultipleChoice_Hawaii{INSERTANS:14272X54X956Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{INSERTANS:14272X54X956Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_Europe{INSERTANS:14272X54X956Europe}{qMultipleChoice_Europe.shown} +qMultipleChoice_NewZealand{INSERTANS:14272X54X956NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{INSERTANS:14272X54X957junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{INSERTANS:14272X54X957junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{INSERTANS:14272X54X957rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{INSERTANS:14272X54X957rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{INSERTANS:14272X54X957ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{INSERTANS:14272X54X957excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + + + + + + + + <![CDATA[report00]]> + +QcodeINSERTANSQcode.shown +q5pointChoice{INSERTANS:14272X54X930}{q5pointChoice.shown} +qListDropdown{INSERTANS:14272X54X931}{qListDropdown.shown} +qListDropdown_other{INSERTANS:14272X54X931other}{qListDropdown_other.shown} +qListRadio{INSERTANS:14272X54X932}{qListRadio.shown} +qListRadio_other{INSERTANS:14272X54X932other}{qListRadio_other.shown} +qListWithComment{INSERTANS:14272X54X933}{qListWithComment.shown} +qListWithComment_comment{INSERTANS:14272X54X933comment}{qListWithComment_comment.shown} +qArray_F1{INSERTANS:14272X54X934F1}{qArray_F1.shown} +qArray_F2{INSERTANS:14272X54X934F2}{qArray_F2.shown} +qArray_F3{INSERTANS:14272X54X934F3}{qArray_F3.shown} +qArray_F4{INSERTANS:14272X54X934F4}{qArray_F4.shown} +qArray_F5{INSERTANS:14272X54X934F5}{qArray_F5.shown} +qArray10Point_L1{INSERTANS:14272X54X935L1}{qArray10Point_L1.shown} +qArray10Point_L2{INSERTANS:14272X54X935L2}{qArray10Point_L2.shown} +qArray10Point_L3{INSERTANS:14272X54X935L3}{qArray10Point_L3.shown} +qArray10Point_L4{INSERTANS:14272X54X935L4}{qArray10Point_L4.shown} +qArray10Point_L5{INSERTANS:14272X54X935L5}{qArray10Point_L5.shown} +qArray10Point_L6{INSERTANS:14272X54X935L6}{qArray10Point_L6.shown} +qArray5Point_1{INSERTANS:14272X54X9361}{qArray5Point_1.shown} +qArray5Point_2{INSERTANS:14272X54X9362}{qArray5Point_2.shown} +qArray5Point_3{INSERTANS:14272X54X9363}{qArray5Point_3.shown} +qArray5Point_4{INSERTANS:14272X54X9364}{qArray5Point_4.shown} +qArray5Point_5{INSERTANS:14272X54X9365}{qArray5Point_5.shown} +qArray5Point_6{INSERTANS:14272X54X9366}{qArray5Point_6.shown} +qArrayISD_1{INSERTANS:14272X54X9371}{qArrayISD_1.shown} +qArrayISD_2{INSERTANS:14272X54X9372}{qArrayISD_2.shown} +qArrayISD_3{INSERTANS:14272X54X9373}{qArrayISD_3.shown} +qArrayISD_4{INSERTANS:14272X54X9374}{qArrayISD_4.shown} +qArrayISD_5{INSERTANS:14272X54X9375}{qArrayISD_5.shown} +qArrayISD_6{INSERTANS:14272X54X9376}{qArrayISD_6.shown} +qArrayISD_7{INSERTANS:14272X54X9377}{qArrayISD_7.shown} +qArrayNumbers_ls1_min{INSERTANS:14272X54X938ls1_min}{qArrayNumbers_ls1_min.shown} +qArrayNumbers_ls1_max{INSERTANS:14272X54X938ls1_max}{qArrayNumbers_ls1_max.shown} +qArrayNumbers_ls1_avg{INSERTANS:14272X54X938ls1_avg}{qArrayNumbers_ls1_avg.shown} +qArrayNumbers_todo_min{INSERTANS:14272X54X938todo_min}{qArrayNumbers_todo_min.shown} +qArrayNumbers_todo_max{INSERTANS:14272X54X938todo_max}{qArrayNumbers_todo_max.shown} +qArrayNumbers_todo_avg{INSERTANS:14272X54X938todo_avg}{qArrayNumbers_todo_avg.shown} +qArrayNumbers_honey_min{INSERTANS:14272X54X938honey_min}{qArrayNumbers_honey_min.shown} +qArrayNumbers_honey_max{INSERTANS:14272X54X938honey_max}{qArrayNumbers_honey_max.shown} +qArrayNumbers_honey_avg{INSERTANS:14272X54X938honey_avg}{qArrayNumbers_honey_avg.shown} +qArrayNumbers_econ_min{INSERTANS:14272X54X938econ_min}{qArrayNumbers_econ_min.shown} +qArrayNumbers_econ_max{INSERTANS:14272X54X938econ_max}{qArrayNumbers_econ_max.shown} +qArrayNumbers_econ_avg{INSERTANS:14272X54X938econ_avg}{qArrayNumbers_econ_avg.shown} +qArrayTexts_hp_1st{INSERTANS:14272X54X939hp_1st}{qArrayTexts_hp_1st.shown} +qArrayTexts_hp_2nd{INSERTANS:14272X54X939hp_2nd}{qArrayTexts_hp_2nd.shown} +qArrayTexts_hp_3rd{INSERTANS:14272X54X939hp_3rd}{qArrayTexts_hp_3rd.shown} +qArrayTexts_st_1st{INSERTANS:14272X54X939st_1st}{qArrayTexts_st_1st.shown} +qArrayTexts_st_2nd{INSERTANS:14272X54X939st_2nd}{qArrayTexts_st_2nd.shown} +qArrayTexts_st_3rd{INSERTANS:14272X54X939st_3rd}{qArrayTexts_st_3rd.shown} +qArrayTexts_sw_1st{INSERTANS:14272X54X939sw_1st}{qArrayTexts_sw_1st.shown} +qArrayTexts_sw_2nd{INSERTANS:14272X54X939sw_2nd}{qArrayTexts_sw_2nd.shown} +qArrayTexts_sw_3rd{INSERTANS:14272X54X939sw_3rd}{qArrayTexts_sw_3rd.shown} +qArrayYNU_1{INSERTANS:14272X54X9401}{qArrayYNU_1.shown} +qArrayYNU_2{INSERTANS:14272X54X9402}{qArrayYNU_2.shown} +qArrayYNU_3{INSERTANS:14272X54X9403}{qArrayYNU_3.shown} +qArrayYNU_4{INSERTANS:14272X54X9404}{qArrayYNU_4.shown} +qArrayYNU_5{INSERTANS:14272X54X9405}{qArrayYNU_5.shown} +qArrayByColumn_1{INSERTANS:14272X54X9411}{qArrayByColumn_1.shown} +qArrayByColumn_2{INSERTANS:14272X54X9412}{qArrayByColumn_2.shown} +qArrayByColumn_3{INSERTANS:14272X54X9413}{qArrayByColumn_3.shown} +qArrayByColumn_4{INSERTANS:14272X54X9414}{qArrayByColumn_4.shown} +qArrayByColumn_5{INSERTANS:14272X54X9415}{qArrayByColumn_5.shown} +qArrayDualScale_money_0{INSERTANS:14272X54X942money#0}{qArrayDualScale_money_0.shown} +qArrayDualScale_money_1{INSERTANS:14272X54X942money#1}{qArrayDualScale_money_1.shown} +qArrayDualScale_health_0{INSERTANS:14272X54X942health#0}{qArrayDualScale_health_0.shown} +qArrayDualScale_health_1{INSERTANS:14272X54X942health#1}{qArrayDualScale_health_1.shown} +qArrayDualScale_md_0{INSERTANS:14272X54X942md#0}{qArrayDualScale_md_0.shown} +qArrayDualScale_md_1{INSERTANS:14272X54X942md#1}{qArrayDualScale_md_1.shown} +qDate{INSERTANS:14272X54X943}{qDate.shown} +qFileUpload{INSERTANS:14272X54X944}{qFileUpload.shown} +qFileUpload_filecount{INSERTANS:14272X54X944_filecount}{qFileUpload_filecount.shown} +qGender{INSERTANS:14272X54X945}{qGender.shown} +qLanguage{INSERTANS:14272X54X946}{qLanguage.shown} +qMultipleNumerical_self{INSERTANS:14272X54X947self}{qMultipleNumerical_self.shown} +qMultipleNumerical_mom{INSERTANS:14272X54X947mom}{qMultipleNumerical_mom.shown} +qMultipleNumerical_dad{INSERTANS:14272X54X947dad}{qMultipleNumerical_dad.shown} +qNumerical{INSERTANS:14272X54X948}{qNumerical.shown} +qRanking_1{INSERTANS:14272X54X9491}{qRanking_1.shown} +qRanking_2{INSERTANS:14272X54X9492}{qRanking_2.shown} +qRanking_3{INSERTANS:14272X54X9493}{qRanking_3.shown} +qRanking_4{INSERTANS:14272X54X9494}{qRanking_4.shown} +qTextDisplay{INSERTANS:14272X54X950}{qTextDisplay.shown} +qYesNo{INSERTANS:14272X54X951}{qYesNo.shown} +qHugeText{INSERTANS:14272X54X952}{qHugeText.shown} +qLongText{INSERTANS:14272X54X953}{qLongText.shown} +qMultipleShort_friend{INSERTANS:14272X54X954friend}{qMultipleShort_friend.shown} +qMultipleShort_family{INSERTANS:14272X54X954family}{qMultipleShort_family.shown} +qMultipleShort_work{INSERTANS:14272X54X954work}{qMultipleShort_work.shown} +qShort{INSERTANS:14272X54X955}{qShort.shown} +qMultipleChoice_Hawaii{INSERTANS:14272X54X956Hawaii}{qMultipleChoice_Hawaii.shown} +qMultipleChoice_Bahamas{INSERTANS:14272X54X956Bahamas}{qMultipleChoice_Bahamas.shown} +qMultipleChoice_Europe{INSERTANS:14272X54X956Europe}{qMultipleChoice_Europe.shown} +qMultipleChoice_NewZealand{INSERTANS:14272X54X956NewZealand}{qMultipleChoice_NewZealand.shown} +qMultChoiceComment_junk{INSERTANS:14272X54X957junk}{qMultChoiceComment_junk.shown} +qMultChoiceComment_junkcomment{INSERTANS:14272X54X957junkcomment}{qMultChoiceComment_junkcomment.shown} +qMultChoiceComment_rtv{INSERTANS:14272X54X957rtv}{qMultChoiceComment_rtv.shown} +qMultChoiceComment_rtvcomment{INSERTANS:14272X54X957rtvcomment}{qMultChoiceComment_rtvcomment.shown} +qMultChoiceComment_ex{INSERTANS:14272X54X957ex}{qMultChoiceComment_ex.shown} +qMultChoiceComment_excomment{INSERTANS:14272X54X957excomment}{qMultChoiceComment_excomment.shown} +]]> + + + + + + + + + + +
      +
      + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[q5C]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLD]]> + + + + + + + + + + + + + + + + + + <![CDATA[junk]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLR]]> + + + + + + + + + + + + + + + + + + <![CDATA[Hawaii]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLWC]]> + + + + + + + + + + + + + + + + + + <![CDATA[rtv]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA]]> + + + + + + + + + + + + + + + + + + <![CDATA[Bahamas]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA10P]]> + + + + + + + + + + + + + + + + + + <![CDATA[ex]]> + + + + + + + + + + + + + + + + + + <![CDATA[qA5P]]> + + + + + + + + + + + + + + + + + + <![CDATA[friend]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[Europe]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAN]]> + + + + + + + + + + + + + + + + + + <![CDATA[family]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAT]]> + + + + + + + + + + + + + + + + + + <![CDATA[NewZealand]]> + + + + + + + + + + + + + + + + + + <![CDATA[qAYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[self]]> + + + + + + + + + + + + + + + + + + <![CDATA[qABC]]> + + + + + + + + + + + + + + + + + + <![CDATA[mom]]> + + + + + + + + + + + + + + + + + + <![CDATA[qADS]]> + + + + + + + + + + + + + + + + + + <![CDATA[work]]> + + + + + + + + + + + + + + + + + + <![CDATA[qD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qFU]]> + + + + + + + + + + + + + + + + + + <![CDATA[money]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[qG]]> + + + + + + + + + + + + + + + + + + <![CDATA[dad]]> + + + + + + + + + + + + + + + + + + <![CDATA[qL]]> + + + + + + + + + + + + + + + + + + <![CDATA[health]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMN]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[qN]]> + + + + + + + + + + + + + + + + + + <![CDATA[md]]> + + + + + + + + + + + + + + + + + + <![CDATA[qR]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[qTD]]> + + + + + + + + + + + + + + + + + + <![CDATA[qYN]]> + + + + + + + + + + + + + + + + + + <![CDATA[1st]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[qHT]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[qLT]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMS]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[qS]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[hp]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[2nd]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[ls1]]> + + + + + + + + + + + + + + + + + + <![CDATA[st]]> + + + + + + + + + + + + + + + + + + <![CDATA[3rd]]> + + + + + + + + + + + + + + + + + + <![CDATA[min]]> + + + + + + + + + + + + + + + + + + <![CDATA[sw]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[max]]> + + + + + + + + + + + + + + + + + + <![CDATA[todo]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[avg]]> + + + + + + + + + + + + + + + + + + <![CDATA[honey]]> + + + + + + + + + + + + + + + + + + <![CDATA[econ]]> + + + + + + + + + + + + + + + + + + <![CDATA[F1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[L1]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L2]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[7]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[F2]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + + + <![CDATA[L3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F3]]> + + + + + + + + + + + + + + + + + + <![CDATA[L5]]> + + + + + + + + + + + + + + + + + + <![CDATA[L6]]> + + + + + + + + + + + + + + + + + + <![CDATA[F4]]> + + + + + + + + + + + + + + + + + + <![CDATA[F5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + +
    • Samples of every question type
    • +
    • Default values for any question type that accepts defaults
    • +
    • Reports showing all 16 available EM dot notation suffixes
    • +
    • Proper Qcode and SGQA naming of all variables
    • +
    ]]> + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + + + + + diff --git a/include/limesurvey/docs/demosurveys/ls2_array_filter_tests.lss b/include/limesurvey/docs/demosurveys/ls2_array_filter_tests.lss new file mode 100644 index 00000000..5bdb4189 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_array_filter_tests.lss @@ -0,0 +1,15022 @@ + + + Survey + 155.5 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[f_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ads_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_t1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ads_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_et1]]> + + + + + + + + + + + + + + + + + + <![CDATA[f_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_t2]]> + + + + + + + + + + + + + + + + + + <![CDATA[ads_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_et2]]> + + + + + + + + + + + + + + + + + + <![CDATA[f_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_t3]]> + + + + + + + + + + + + + + + + + + <![CDATA[ads_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_et3]]> + + + + + + + + + + + + + + + + + + <![CDATA[f_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_t4]]> + + + + + + + + + + + + + + + + + + <![CDATA[ads_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[an_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[at_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[afive_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aten_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aynu_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[aisd_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[af_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[list_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mc_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mcc_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[mn_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[ms_et4]]> + + + + + + + + + + + + + + + + + + <![CDATA[ar_et4]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[m]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + Change the type of first question (f1) to demonstrate that each of the following types of questions can trigger filtering of the other questions:

    Multiple choice
    Multiple choice with comments
    Multiple short text
    Multiple numeric
    Array (5 point, 10 point, Yes/No/Unknown, Increase/Same/Decrease, Column)
    Array (Dual Scale, Text, Numbers)
    Ranking]]>
    + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + .printouttable { margin:1em auto; } .printouttable th { text-align: center; } .printouttable td { border-color: #ddf #ddf #ddf #ddf; border-style: solid; border-width: 1px; padding:0.1em 1em 0.1em 0.5em; } .printouttable td:first-child { font-weight: 700; text-align: right; padding-right: 5px; padding-left: 5px; } .printouttable .printanswersquestion td{ background-color:#F7F8FF; } .printouttable .printanswersquestionhead td{ text-align: left; background-color:#ddf; } .printouttable .printanswersgroup td{ text-align: center; font-weight:bold; padding-top:1em; } Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter.lss b/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter.lss new file mode 100644 index 00000000..ac9db83b --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter.lss @@ -0,0 +1,2230 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + cid + qid + scenario + cqid + cfieldname + method + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[Q01]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q03]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q04]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q04A]]> + {Q04.shown}
    your favorite brand of  made-at-home electronics?]]> + + + + + + + + + + + + + + + + + <![CDATA[Q06]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q06A]]> + +]]> + + + + + + + + + + + + + + + + + <![CDATA[Q02]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q05]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q05A]]> + {Q05.shown} your favorite not-made-at-home brand of electronics?]]> + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + + <![CDATA[F]]> + + + + + + + + + + + + + + + + + + <![CDATA[G]]> + + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + + <![CDATA[I]]> + + + + + + + + + + + + + + + + + + <![CDATA[J]]> + + + + + + + + + + + + + + + + + + <![CDATA[NA]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + + <![CDATA[F]]> + + + + + + + + + + + + + + + + + + <![CDATA[G]]> + + + + + + + + + + + + + + + + + + <![CDATA[H]]> + + + + + + + + + + + + + + + + + + <![CDATA[I]]> + + + + + + + + + + + + + + + + + + <![CDATA[J]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[6]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleAnalyticsStyle + googleAnalyticsAPIKey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + This survey is based off the design of a survey courtesy of Joy Lane Research, LLC.

    +

    + They identified a bug in 1.91+ which prevented proper use of cascading array filters.  In 1.91+, say you first pick several options from Q01 and Q02, then pick a favorite from Q04.  If you uncheck the favorite option in Q01, that option does not disappear from Q04.  We also discovered the 'other' option were not being handled correctly.

    +

    + This survey shows that LimeSurvey 1.92 with Expression Manager makes the cascading work correctly.  It also lets us pick an 'other' option and have its label carry through to subsequent questions.  This survey also shows that you can simultaneously use array_filter and array_filter_exclude (see question Q05).

    +]]>
    + + This survey is based off the design of a survey courtesy of Joy Lane Research, LLC.

    +

    + They identified a bug in 1.91+ which prevented proper use of cascading array filters.  In 1.91+, say you first pick several options from Q01 and Q02, then pick a favorite from Q04.  If you uncheck the favorite option in Q01, that option does not disappear from Q04.  We also discovered the 'other' option were not being handled correctly.

    +

    + This survey shows that LimeSurvey 1.92 with Expression Manager makes the cascading work correctly.  It also lets us pick an 'other' option and have its label carry through to subsequent questions.  This survey also shows that you can simultaneously use array_filter and array_filter_exclude (see question Q05).

    +]]>
    + + + + +
    You have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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} at {ADMINEMAIL}.

    Sincerely,

    {ADMINNAME}]]>
    + + + + + + +
    +
    +
    + diff --git a/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter_exclude.lss b/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter_exclude.lss new file mode 100644 index 00000000..cd4e3054 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_cascading_array_filter_exclude.lss @@ -0,0 +1,928 @@ + + + Survey + 155 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[l1]]> + + + + + + + + + + + + + + + + + + <![CDATA[l2]]> + + + + + + + + + + + + + + + + + + <![CDATA[l3]]> + + + + + + + + + + + + + + + + + + <![CDATA[l4]]> + + + + + + + + + + + + + + + + + + <![CDATA[l5]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[cross]]> + + + + + + + + + + + + + + + + + + <![CDATA[circl]]> + + + + + + + + + + + + + + + + + + <![CDATA[trian]]> + + + + + + + + + + + + + + + + + + <![CDATA[spira]]> + + + + + + + + + + + + + + + + + + <![CDATA[squar]]> + + + + + + + + + + + + + + + + + + <![CDATA[cross]]> + + + + + + + + + + + + + + + + + + <![CDATA[circl]]> + + + + + + + + + + + + + + + + + + <![CDATA[spira]]> + + + + + + + + + + + + + + + + + + <![CDATA[trian]]> + + + + + + + + + + + + + + + + + + <![CDATA[squar]]> + + + + + + + + + + + + + + + + + + <![CDATA[cross]]> + + + + + + + + + + + + + + + + + + <![CDATA[circl]]> + + + + + + + + + + + + + + + + + + <![CDATA[spira]]> + + + + + + + + + + + + + + + + + + <![CDATA[trian]]> + + + + + + + + + + + + + + + + + + <![CDATA[squar]]> + + + + + + + + + + + + + + + + + + <![CDATA[cross]]> + + + + + + + + + + + + + + + + + + <![CDATA[circl]]> + + + + + + + + + + + + + + + + + + <![CDATA[spira]]> + + + + + + + + + + + + + + + + + + <![CDATA[trian]]> + + + + + + + + + + + + + + + + + + <![CDATA[squar]]> + + + + + + + + + + + + + + + + + + <![CDATA[cross]]> + + + + + + + + + + + + + + + + + + <![CDATA[circl]]> + + + + + + + + + + + + + + + + + + <![CDATA[spira]]> + + + + + + + + + + + + + + + + + + <![CDATA[trian]]> + + + + + + + + + + + + + + + + + + <![CDATA[squar]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}

    If you have blacklisted before but want to participate in this survey and want to receive invitations please click the following link:
    {OPTINURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + .printouttable { margin:1em auto; } .printouttable th { text-align: center; } .printouttable td { border-color: #ddf #ddf #ddf #ddf; border-style: solid; border-width: 1px; padding:0.1em 1em 0.1em 0.5em; } .printouttable td:first-child { font-weight: 700; text-align: right; padding-right: 5px; padding-left: 5px; } .printouttable .printanswersquestion td{ background-color:#F7F8FF; } .printouttable .printanswersquestionhead td{ text-align: left; background-color:#ddf; } .printouttable .printanswersgroup td{ text-align: center; font-weight:bold; padding-top:1em; } Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_comma_as_radix_separator.lss b/include/limesurvey/docs/demosurveys/ls2_comma_as_radix_separator.lss new file mode 100644 index 00000000..e1bad4dd --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_comma_as_radix_separator.lss @@ -0,0 +1,2008 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[Q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q4]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q5]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q6]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q7]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q8]]> + + + + + + + + + + + + + + + + + + <![CDATA[Q9]]> + + + + + + + + + + + + + + + + + + <![CDATA[thanks]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[X]]> + + + + + + + + + + + + + + + + + + <![CDATA[Y]]> + + + + + + + + + + + + + + + + + + <![CDATA[Z]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[X]]> + + + + + + + + + + + + + + + + + + <![CDATA[Y]]> + + + + + + + + + + + + + + + + + + <![CDATA[Z]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_countifop_sumifop.lss b/include/limesurvey/docs/demosurveys/ls2_countifop_sumifop.lss new file mode 100644 index 00000000..bf60d7be --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_countifop_sumifop.lss @@ -0,0 +1,920 @@ + + + Survey + 155.5 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[an]]> + + + + + + + Purpose + + Equation + + Result + + + + + + # answered + + count(self) + + {count(self)} + + + + grand total + + sum(self) + + {sum(self)} + + + + # answered in column C + + count(self.sq_C) + + {count(self.sq_C)} + + + + sum of column C + + sum(self.sq_C) + + {sum(self.sq_C)} + + + + sum of columns B-D + + sum(self.sq_B.sq_C.sq_D) + + {sum(self.sq_B.sq_C.sq_D)} + + + + # of negative values + + countifop("lt",0,self) + + {countifop("lt",0,self)} + + + + sum of positive values + + sumifop("gt",0,self) + + {sumifop("gt",0,self)} + + + + count of even numbers + + countifop("RX","/[02468]$/",self) + + {countifop("RX","/[02468]$/",self)} + + + + sum of odd numbers + + sumifop("RX","/[13579]$/",self) + + {sumifop("RX","/[13579]$/",self)} + + + +

    +  

    +]]>
    + + + + + + + +
    + + + + + + + <![CDATA[result]]> + + + + + Purpose + + Equation + + Result + + + + + + # answered + + count(that.an) + + {count(that.an)} + + + + grand total + + sum(that.an) + + {sum(that.an)} + + + + # answered in column C + + count(that.an.sq_C) + + {count(that.an.sq_C)} + + + + sum of column C + + sum(that.an.sq_C) + + {sum(that.an.sq_C)} + + + + sum of columns B-D + + sum(that.an.sq_B.sq_C.sq_D) + + {sum(that.an.sq_B.sq_C.sq_D)} + + + + # of negative values + + countifop("lt",0,that.an) + + {countifop("lt",0,that.an)} + + + + sum of positive values + + sumifop("gt",0,that.an) + + {sumifop("gt",0,that.an)} + + + + count of even numbers + + countifop("RX","/[02468]$/",that.an) + + {countifop("RX","/[02468]$/",that.an)} + + + + sum of odd numbers + + sumifop("RX","/[13579]$/",that.an) + + {sumifop("RX","/[13579]$/",that.an)} + + + +

    +  

    +]]>
    + + + + + + + + + +
    +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_em_tailoring.lss b/include/limesurvey/docs/demosurveys/ls2_em_tailoring.lss new file mode 100644 index 00000000..59c600be --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_em_tailoring.lss @@ -0,0 +1,3746 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +It demonstrates the use of hidden Equation-type questions, whose values are stored in the database even though hidden on the screen.]]> + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[math]]> + +FunctionSyntaxResult +Absolute valueabs({num}){if(is_numeric(num),abs(num),'')} +Arc cosineacos({num}){if(is_numeric(num),acos(num),'')} +Arc sineasin({num}){if(is_numeric(num),asin(num),'')} +Arc tangent of two variablesatan2({num},{num2}){if(is_numeric(num) && is_numeric(num2),atan2(num,num2),'')} +Arc tangentatan({num}){if(is_numeric(num),atan(num),'')} +Round fractions upceil({num}){if(is_numeric(num),ceil(num),'')} +Cosinecos({num}){if(is_numeric(num),cos(num),'')} +Calculates the exponent of eexp({num}){if(is_numeric(num),exp(num),'')} +Round fractions downfloor({num}){if(is_numeric(num),floor(num),'')} +Finds whether a value is not a numberis_nan({num}){if(is_numeric(num),is_nan(num),'')} +Natural logarithmlog({num}){if(is_numeric(num),log(num),'')} +Get value of pipi(){pi()} +Exponential expressionpow({num},{num2}){if(is_numeric(num) && is_numeric(num2),pow(num,num2),'')} +Generate a random integerrand(){rand()} +Rounds a floatround({num}){if(is_numeric(num),round(num),'')} +Sinesin({num}){if(is_numeric(num),sin(num),'')} +Square rootsqrt({num}){if(is_numeric(num),sqrt(num),'')} +Calculate the sum of values in an arraysum({num}){if(is_numeric(num),sum(num),'')} +Tangenttan({num}){if(is_numeric(num),tan(num),'')} +Find lowest valuemin({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),min(num2,num,num+num2,num-num2,num*num2,num/2),'')} +Find highest valuemax({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),max(num2,num,num+num2,num-num2,num*num2,num/2),'')} +Sumsum({num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){if(is_numeric(num),sum(num2,num,num+num2,num-num2,num*num2,num/2),'')} +Join array elements with a stringimplode('~',{num2},{num},{num}+{num2},{num}-{num2},{num}*{num2},{num}/2){implode('~',num2,num,num+num2,num-num2,num*num2,num/2)} +Get the integer value of a variableintval({num}){if(is_numeric(num),intval(num),'')} +Finds whether the type of a variable is floatis_float({num}){if(is_numeric(num),is_float(num),'')} +Finds whether the type of a variable is integeris_int({num}){if(is_numeric(num),is_int(num),'')} +Finds whether the type of a variable is NULLis_null({num}){is_null(num)} +Finds whether a variable is a number or a numeric stringis_numeric({num}){is_numeric(num)} +Finds whether the type of a variable is stringis_string({num}){is_string(num)} +Determine whether a variable is considered to be emptyis_empty({num}){is_empty(num)} +]]> + + + + + + + + + + + + + + + + + <![CDATA[num]]> + + + + + + + + + + + + + + + + + + <![CDATA[num2]]> + + + + + + + + + + + + + + + + + + <![CDATA[name]]> + + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[married]]> + + + 5 (and one hopes much older)]]> + + + + + + + 5]]> + + + + + + + + <![CDATA[numKids]]> + + + 11 (and one hopes much older)]]> + + + + + + + 11]]> + + + + + + + + <![CDATA[message2]]> + +{if(is_empty(name),'',if(is_empty(age),'How old are you?',implode(' ','So, you are',age,'years old. Funny, you don\'t look it.')))}
    +{if(numKids>0,implode(' ','I hope you enjoy playing with your',if(numKids==1,'child!',implode(' ',numKids,'children!')),' I love my two girls!'),'')}
    +{if(numKids>1,implode('','The sum of the ages of your first ',min(5,numKids),' children is ',sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK),''),'')}
    +{if(sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)>age,'Wow, that means that the combined age of your children exceeds your own!','')}
    +{if((married=='Y' and max(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)>yearsMarried),'Hmmm, your oldest child is older than your marriage. Interesting.','')}]]>
    + + + + + + + + + +
    + + + + + + + <![CDATA[yearsMarried]]> + + + + + + + + + + + + + + + + + + <![CDATA[kid1]]> + + + + + + + + + + = 1]]> + + + + + + + + <![CDATA[kid2]]> + + + + + + + + + + = 2]]> + + + + + + + + <![CDATA[kid3]]> + + + + + + + + + + = 3]]> + + + + + + + + <![CDATA[kid4]]> + + + + + + + + + + = 4]]> + + + + + + + + <![CDATA[kid5]]> + + + + + + + + + + = 5]]> + + + + + + + + <![CDATA[tThanks]]> + + You're all done, thanks!

    +]]>
    + + + + + + + + + +
    + + + + + + + <![CDATA[city]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsThere]]> + + + + + + + + + + + + + + + + + + <![CDATA[ranking]]> + + + + + + + + + + + + + + + + + + <![CDATA[opinions]]> + + + + + + + + + + + + + + + + + + <![CDATA[worries]]> + + + + + + + + + + + + + + + + + + <![CDATA[report]]> + + + + + + + + + + + + + + + + + + + +
    #QuestionCodeValueShown
    {city.qid}{city.question}{city}{city.value}{city.shown}
    {yearsThere.qid}{yearsThere.question}{yearsThere}{yearsThere.value}{yearsThere.shown}
    {ranking_1.qid}{ranking_1.question}{ranking_1}{ranking_1.value}{ranking_1.shown}
    {ranking_2.qid}{ranking_2.question}{ranking_2}{ranking_2.value}{ranking_2.shown}
    {ranking_3.qid}{ranking_3.question}{ranking_3}{ranking_3.value}{ranking_3.shown}
    {ranking_4.qid}{ranking_4.question}{ranking_4}{ranking_4.value}{ranking_4.shown}
    {opinions_tax.qid}{opinions_tax.question}{opinions_tax}{opinions_tax.value}{opinions_tax.shown}
    {opinions_srv.qid}{opinions_srv.question}{opinions_srv}{opinions_srv.value}{opinions_srv.shown}
    {opinions_evt.qid}{opinions_evt.question}{opinions_evt}{opinions_evt.value}{opinions_evt.shown}
    {worries_taxes_0.qid}{worries_taxes_0.question}{worries_taxes_0}{worries_taxes_0.value}{worries_taxes_0.shown}
    {worries_taxes_1.qid}{worries_taxes_1.question}{worries_taxes_1}{worries_taxes_1.value}{worries_taxes_1.shown}
    {worries_smog_0.qid}{worries_smog_0.question}{worries_smog_0}{worries_smog_0.value}{worries_smog_0.shown}
    {worries_smog_1.qid}{worries_smog_1.question}{worries_smog_1}{worries_smog_1.value}{worries_smog_1.shown}
    {worries_trans_0.qid}{worries_trans_0.question}{worries_trans_0}{worries_trans_0.value}{worries_trans_0.shown}
    {worries_trans_1.qid}{worries_trans_1.question}{worries_trans_1}{worries_trans_1.value}{worries_trans_1.shown}
    +Is this correct? +]]>
    + + + + + + + + + +
    + + + + + + + <![CDATA[report2]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Var + SGQA + INSERTANS:SGQA
    + city + 36849X70X1445 + {36849X70X1445}, {INSERTANS:36849X70X1445}
    + yearsThere + 36849X70X1446 + {36849X70X1446}, {INSERTANS:36849X70X1446}
    + ranking_2 + 36849X70X14472 + {36849X70X14472}, {INSERTANS:36849X70X14472}
    + opinions_srv + 36849X70X1448srv + {36849X70X1448srv}, {INSERTANS:36849X70X1448srv}
    + worries_smog_0 + 36849X70X1449smog#0 + {36849X70X1449smog#0}, {INSERTANS:36849X70X1449smog#0}
    + worries_trans_1 + 36849X70X1449trans#1 + {36849X70X1449trans#1}, {INSERTANS:36849X70X1449trans#1}
    +

    +  

    ]]>
    + + + + + + + + + +
    + + + + + + + <![CDATA[weight]]> + + + + + + + + + + + + + + + + + + <![CDATA[height]]> + + + + + + + + + + + + + + + + + + <![CDATA[BMI]]> + + + + + + + + + + + + + + + + + + <![CDATA[weight_status]]> + + + + + + + + + + + + + + + + + + <![CDATA[Report]]> + +Your Body Mass Index (BMI) is {round(BMI,2)}.
    +Assuming you are an adult, you are {weight_status}.]]>
    + + + + + + + + + +
    + + + + + + + <![CDATA[weight_units]]> + + + + + + + + + + + + + + + + + + <![CDATA[height_units]]> + + + + + + + + + + + + + + + + + + <![CDATA[weight_kg]]> + + + + + + + + + + + + + + + + + + <![CDATA[height_m]]> + + + + + + + + + + + +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[taxes]]> + + + + + + + + + + + + + + + + + + <![CDATA[smog]]> + + + + + + + + + + + + + + + + + + <![CDATA[tax]]> + + + + + + + + + + + + + + + + + + <![CDATA[trans]]> + + + + + + + + + + + + + + + + + + <![CDATA[srv]]> + + + + + + + + + + + + + + + + + + <![CDATA[evt]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 11]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_em_validation_q.lss b/include/limesurvey/docs/demosurveys/ls2_em_validation_q.lss new file mode 100644 index 00000000..a7983823 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_em_validation_q.lss @@ -0,0 +1,1823 @@ + + + Survey + 155.5 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[mc]]> + + + + + + + + + + + + + + + + + + <![CDATA[a]]> + + + + + + + + + + + + + + + + + + <![CDATA[b]]> + + + + + + + + + + + + + + + + + + <![CDATA[c]]> + + + + + + + + + + + + + + + + + + <![CDATA[e]]> + + + + + + + + + + + + + + + + + + <![CDATA[f]]> + + + + + + + + + + + + + + + + + + <![CDATA[p]]> + + + + + + + + + + + + + + + + + + <![CDATA[r]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[D]]> + + + + + + + + + + + + + + + + + + <![CDATA[E]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (countif("D",self) + countif("S",self))]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + =3]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + This survey demonstrates the use of:

    +
      +
    • + Whole question validation (which now works for more question types)
    • +
    • + Using the 'self' variable within those validation equations
    • +
    • + Creating a multiple forced choice array (must pick one from each column)
    • +
    +]]>
    + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_group_relevance.lss b/include/limesurvey/docs/demosurveys/ls2_group_relevance.lss new file mode 100644 index 00000000..f9bb9391 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_group_relevance.lss @@ -0,0 +1,4249 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + 0]]> + + + + + + + + + + 1 && p1_rel != ""]]> + + + + + + + + + + 2 && p2_rel != ""]]> + + + + + + + + + + 3 && p3_rel != ""]]> + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[name]]> + + + + + + + + + + + + + + + + + + <![CDATA[gender]]> + + + + + + + + + + + + + + + + + + <![CDATA[cohabs]]> + + + + + + + + + + + + + + + + + + <![CDATA[p1_sex]]> + + + + + + + + + + + + + + + + + + <![CDATA[p1_name]]> + + + + + + + + + + + + + + + + + + <![CDATA[p1_age]]> + + + + + + + + + + + + + + + + + + <![CDATA[p1_rel]]> + + + + + + + + + + + + + + + + + + <![CDATA[p1_sum]]> + =1,p1_rel_other,p1_rel.shown)}.]]> + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[p2_sex]]> + + + + + + + + + + + + + + + + + + <![CDATA[p2_name]]> + + + + + + + + + + + + + + + + + + <![CDATA[p2_age]]> + + + + + + + + + + + + + + + + + + <![CDATA[p2_rel]]> + + + + + + + + + + + + + + + + + + <![CDATA[p2_sum]]> + =1,p2_rel_other,p2_rel.shown)}.]]> + + + + + + + + + + + + + + + + + <![CDATA[p3_sex]]> + + + + + + + + + + + + + + + + + + <![CDATA[p3_name]]> + + + + + + + + + + + + + + + + + + <![CDATA[p3_age]]> + + + + + + + + + + + + + + + + + + <![CDATA[p3_rel]]> + + + + + + + + + + + + + + + + + + <![CDATA[p3_sum]]> + =1,p3_rel_other,p3_rel.shown)}.]]> + + + + + + + + + + + + + + + + + <![CDATA[p4_sex]]> + + + + + + + + + + + + + + + + + + <![CDATA[p4_name]]> + + + + + + + + + + + + + + + + + + <![CDATA[p4_age]]> + + + + + + + + + + + + + + + + + + <![CDATA[p4_rel]]> + + + + + + + + + + + + + + + + + + <![CDATA[p4_sum]]> + =1,p4_rel_other,p4_rel.shown)}.]]> + + + + + + + + + + + + + + + + + <![CDATA[s_you]]> + + + + + + + + + + + + + + + + + + <![CDATA[sp1]]> + =1,p1_rel_other,p1_rel.shown)}.]]> + + + + + + + + + 0 && p1_rel !=""]]> + + + + + + + + <![CDATA[sp2]]> + =1,p2_rel_other,p2_rel.shown)}.]]> + + + + + + + + + 1 && p2_rel!=""]]> + + + + + + + + <![CDATA[sp3]]> + =1,p3_rel_other,p3_rel.shown)}.]]> + + + + + + + + + 2 && p3_rel!=""]]> + + + + + + + + <![CDATA[sp4]]> + =1,p4_rel_other,p4_rel.shown)}.]]> + + + + + + + + + 3 && p4_rel != ""]]> + + + + + + + + <![CDATA[comment]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + It demonstrates how group-level relevance can make it easier to implement a "loop" of questions. After creating the group for Person 1, I exported the group. Since I used qcode variable names like p1_name instead of the SGQA code, I could use a text editor to quickly edit and re-import the group several times (e.g. it took about 10 seconds to edit and re-import each repeating group, ensuring that all variables had unique variables names and that the group-level logic was correct).

    + +

    This also shows how you can prevent the Finished message from appearing until the survey is truly finished (e.g. all needed groups are completed).

    ]]>
    + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_maximum_chars_feature.lss b/include/limesurvey/docs/demosurveys/ls2_maximum_chars_feature.lss new file mode 100644 index 00000000..0bc12bd0 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_maximum_chars_feature.lss @@ -0,0 +1,1716 @@ + + + Survey + 155 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[S]]> + + + + + + + + + + + + + + + + + + <![CDATA[t]]> + + + + + + + + + + + + + + + + + + <![CDATA[u]]> + + + + + + + + + + + + + + + + + + <![CDATA[n]]> + + + + + + + + + + + + + + + + + + <![CDATA[k]]> + + + + + + + + + + + + + + + + + + <![CDATA[q]]> + + + + + + + + + + + + + + + + + + <![CDATA[colon]]> + + + + + + + + + + + + + + + + + + <![CDATA[semicolon]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[a]]> + + + + + + + + + + + + + + + + + + <![CDATA[b]]> + + + + + + + + + + + + + + + + + + <![CDATA[c]]> + + + + + + + + + + + + + + + + + + <![CDATA[a]]> + + + + + + + + + + + + + + + + + + <![CDATA[b]]> + + + + + + + + + + + + + + + + + + <![CDATA[c]]> + + + + + + + + + + + + + + + + + + <![CDATA[a]]> + + + + + + + + + + + + + + + + + + <![CDATA[b]]> + + + + + + + + + + + + + + + + + + <![CDATA[c]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[a]]> + + + + + + + + + + + + + + + + + + <![CDATA[b]]> + + + + + + + + + + + + + + + + + + <![CDATA[c]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_plurals_test.lss b/include/limesurvey/docs/demosurveys/ls2_plurals_test.lss new file mode 100644 index 00000000..3008f4f6 --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_plurals_test.lss @@ -0,0 +1,2248 @@ + + + Survey + 155 + + en + + + + qid + specialtype + scale_id + sqid + language + defaultvalue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[minSelect]]> + fewest options you want to be able to select?]]> + + + + + + + + + + + + + + + + + <![CDATA[maxSelect]]> + maximum number of options you want to be able to select?]]> + + + + + + + + + + + + + + + + + <![CDATA[minVal]]> + minimum allowable value?]]> + + + + + + + + + + + + + + + + + <![CDATA[maxVal]]> + maximum allowable value?]]> + + + + + + + + + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[array1]]> + + + + + + + + + + + + + + + + + + <![CDATA[array2]]> + + + + + + + + + + + + + + + + + + <![CDATA[array3]]> + + + + + + + + + + + + + + + + + + <![CDATA[array4]]> + + + + + + + + + + + + + + + + + + <![CDATA[marray1]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_self_and_that.lss b/include/limesurvey/docs/demosurveys/ls2_self_and_that.lss new file mode 100644 index 00000000..b73a37bc --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_self_and_that.lss @@ -0,0 +1,1029 @@ + + + Survey + 155.5 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + self.suffix is internally expanded to a comma-separated list of all variable names for the current question. Thus, it is useful for functions that take a variable number of arguments, like sum(), count(), min(), max(), and implode().
    +that.suffix is also expanded.]]>
    + + + +
    +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[q1]]> + + + +sum = {sum(self.NAOK)}
    +min = {min(self.NAOK)}
    +max = {max(self.NAOK)}
    +list = {list(self.NAOK)}
    +stddev = {stddev(self.NAOK)}
    +mean = {if(count(self.NAOK)>0,sum(self.NAOK) / count(self.NAOK),'')}]]>
    + + + + + + + +
    + + + + + + + <![CDATA[q2]]> + + Here is what you entered for question 1, along with the row, column and grand totals.

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +   + A + B + C + Total
    + 1 + {q1_1_A} + {q1_1_B} + {q1_1_C} + {sum(that.q1.sq_1)}
    + 2 + {q1_2_A} + {q1_2_B} + {q1_2_C} + {sum(that.q1.sq_2)}
    + 3 + {q1_3_A} + {q1_3_B} + {q1_3_C} + {sum(that.q1.sq_3)}
    + Total + {sum(that.q1.sq_A)} + {sum(that.q1.sq_B)} + {sum(that.q1.sq_C)} + {sum(that.q1)}
    +

    +  

    +]]>
    + + + This is only shown if you answered q1 (e.g. relevance = { count(that.q1)>0 })

    +

    + Note that you can use multiple sub-selectors on self and that.  You can also use the nosq selector to select all columns or rows that do not match the desired pattern.

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    + Goal + Syntax + Result
    + Sum of odd columns + { sum(that.q1.sq_1.sq_3) } + {sum(that.q1.sq_1.sq_3)}
    + # answered in odd rows + { count(that.q1.nosq_B) } + {count(that.q1.nosq_B)}
    + Max of values in row 2 and column B + { max(that.q1.sq_2.sq_B) } + {max(that.q1.sq_2.sq_B)}
    +

    +  

    +]]>
    + + + + + + + 0]]> +
    + + + + + + + <![CDATA[q3]]> + +how many checked = {count(self.nocomments)}
    +comments = {list(self.comments)}
    ]]>
    + + + + + + + + + +
    +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + =3]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + +
      +
    • +     self
    • +
    • +     self.suffix
    • +
    • +     self.sub-selector
    • +
    • +     self.sub-selector.suffix
    • +
    +
    +suffix is any of the normal qcode suffixes (e.g. NAOK, value, shown)
    +sub-selector is one of:
    +
    +    comments - only subquestions that are comments (e.g. from multiple choice with comment and list with comment)
    +    nocomments - only subquestions that are not comments
    +    sq_X - where X is a row or column identifier. Only sub-questions matching pattern X are selected.
    +
    +The 'that' variable is like the 'self' variable, but lets you refer to other questions. Its syntax is:
    +
      +
    • +     that.qname
    • +
    • +     that.qname.suffix
    • +
    • +     that.qname.sub-selector
    • +
    • +     that.qname.sub-selector.suffix
    • +
    +
    +qname is the question name without any sub-question extensions. So, say you create a question 'q1', that is its qname
    +
    +Examples:
    +
      +
    • +     Has any part of question q1 been answered? { count(that.q1.NAOK)>0 }
    • +
    • +     What is the assessment score for q2? { sum(that.q2.valueNAOK) }
    • +
    • +     What is the grand total of q3? { sum(that.q3.NAOK) }
    • +
    • +     What is the total of row C in q4? { sum(that.q4.sq_C.NAOK) }
    • +
    • +     What is the total of column 2 in q4? { sum(that.q4.sq_2.NAOK) }
    • +
    +]]>
    + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_subquestion_relevance.lss b/include/limesurvey/docs/demosurveys/ls2_subquestion_relevance.lss new file mode 100644 index 00000000..82360e2d --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_subquestion_relevance.lss @@ -0,0 +1,1319 @@ + + + Survey + 155 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[min]]> + + + + + + + + + + + + + + + + + + <![CDATA[max]]> + + + + + + + + + + + + + + + + + + <![CDATA[afK]]> + + + + + + + + + + + + + + + + + + <![CDATA[afeK]]> + + + + + + + + + + + + + + + + + + <![CDATA[Notes]]> +
    +You answered {count(afK_sq1.NAOK,afK_sq2.NAOK,afK_sq3.NAOK,afK_sq4.NAOK,afK_sq5.NAOK,afK_other.NAOK)} questions in afK (sum = {sum(afK_sq1.NAOK,afK_sq2.NAOK,afK_sq3.NAOK,afK_sq4.NAOK,afK_sq5.NAOK,afK_other.NAOK)}).
    +and {count(afeK_sq1.NAOK,afeK_sq2.NAOK,afeK_sq3.NAOK,afeK_sq4.NAOK,afeK_sq5.NAOK,afeK_other.NAOK)} questions in afeK (sum = {sum(afeK_sq1.NAOK,afeK_sq2.NAOK,afeK_sq3.NAOK,afeK_sq4.NAOK,afeK_sq5.NAOK,afeK_other.NAOK)}).]]>
    + + + + + + + + + +
    +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[other]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_test_em_sq_validation.lss b/include/limesurvey/docs/demosurveys/ls2_test_em_sq_validation.lss new file mode 100644 index 00000000..eaf8c08f --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_test_em_sq_validation.lss @@ -0,0 +1,3756 @@ + + + Survey + 155 + + en + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[sqK]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqQ]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqMFT]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqMFN]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqS]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqT]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqU]]> + + + + + + + + + + + + + + + + + + <![CDATA[sqN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qK]]> + + + + + + + + + + + + + + + + + + <![CDATA[qQ]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMFT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qMFN]]> + + + + + + + + + + + + + + + + + + <![CDATA[qS]]> + + + + + + + + + + + + + + + + + + <![CDATA[qT]]> + + + + + + + + + + + + + + + + + + <![CDATA[qU]]> + + + + + + + + + + + + + + + + + + <![CDATA[qN]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[Test]]> + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[l]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[h]]> + + + + + + + + + + + + + + + + + + <![CDATA[q1]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[q2]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[q3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[A]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[B]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[C]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[4]]> + + + + + + + + + + + + + + + + + + <![CDATA[5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + = q1_sq2 && q1_sq2 >= q1_sq3 && q1_sq3 >= q1_sq4]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleanalyticsstyle + googleanalyticsapikey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/demosurveys/ls2_validation_tests.lss b/include/limesurvey/docs/demosurveys/ls2_validation_tests.lss new file mode 100644 index 00000000..17013bbf --- /dev/null +++ b/include/limesurvey/docs/demosurveys/ls2_validation_tests.lss @@ -0,0 +1,6362 @@ + + + Survey + 155 + + en + + + + qid + code + answer + assessment_value + sortorder + language + scale_id + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + specialtype + scale_id + sqid + language + defaultvalue + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + gid + sid + group_name + group_order + description + language + randomization_group + grelevance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[v1MC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1MCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1R]]> + + + + + + + + + + + + + + + + + + <![CDATA[v1K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v2K]]> + + + num and num2 from the first page, so based on current values, between {num} and {num2}.]]> + + + + + + + + + + + + + + + <![CDATA[v1AMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[v3K]]> + + + + + + + + + + + + + + + + + + <![CDATA[v4K]]> + + + num from the first page.)]]> + + + + + + + + + + + + + + + <![CDATA[v5N]]> + + + yearsMarried and age (both from the first page), so based on current values, between {yearsMarried} and {age})]]> + + + + + + + + + + + + + + + <![CDATA[vQ]]> + + + + + + + + + + + + + + + + + + <![CDATA[vS]]> + + + + + + + + + + + + + + + + + + <![CDATA[vT]]> + + + + + + + + + + + + + + + + + + <![CDATA[vU]]> + + + + + + + + + + + + + + + + + + <![CDATA[vfMFtext]]> + + + afSrcFilter from the first page.
    +Please enter a valid US phone number. The Validation Equation is /^(?:\(\d{ 3 }\))\s*\d{ 3 }-\d{ 4 }$/]]>
    + + + + + + + +
    + + + + + + + <![CDATA[Finished]]> + + + + + + + + + + + + + + + + + + <![CDATA[num]]> + + + + + + + + + + + + + + + + + + <![CDATA[num2]]> + + + + + + + + + + + + + + + + + + <![CDATA[age]]> + + + + + + + + + + + + + + + + + + <![CDATA[yearsMarried]]> + + + + + + + + + + + + + + + + + + <![CDATA[afSrcFilter]]> + + + + + + + + + + + + + + + + + + <![CDATA[minSelect]]> + fewest options you want to be able to select?]]> + + + + + + + + + + + + + + + + + <![CDATA[maxSelect]]> + maximum number of options you want to be able to select?]]> + + + + + + + + + + + + + + + + + <![CDATA[afDS]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAMF]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMFtext]]> + + + + + + + + + + + + + + + + + + <![CDATA[af5pc]]> + + + + + + + + + + + + + + + + + + <![CDATA[afA10p]]> + + + + + + + + + + + + + + + + + + <![CDATA[afYNU]]> + + + + + + + + + + + + + + + + + + <![CDATA[afISD]]> + + + + + + + + + + + + + + + + + + <![CDATA[afAFR]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMCC]]> + + + + + + + + + + + + + + + + + + <![CDATA[afL]]> + + + + + + + + + + + + + + + + + + <![CDATA[afMN]]> + + + +Enter at least {minSelect} and at most {maxSelect} values.]]> + + + + + + + + + + + + + + + <![CDATA[afMS]]> + + + + + + + + + + + +
    +
    + + + qid + parent_qid + sid + gid + type + title + question + preg + help + other + mandatory + question_order + language + scale_id + same_default + relevance + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq1]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq2]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq3]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq4]]> + + + + + + + + + + + + + + + + + + <![CDATA[sq5]]> + + + + + + + + + + + + + + + + qid + attribute + value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sid + admin + expires + startdate + adminemail + anonymized + faxto + format + savetimings + template + language + additional_languages + datestamp + usecookie + allowregister + allowsave + autonumber_start + autoredirect + allowprev + printanswers + ipaddr + refurl + publicstatistics + publicgraphs + listpublic + htmlemail + tokenanswerspersistence + assessments + usecaptcha + usetokens + bounce_email + attributedescriptions + emailresponseto + emailnotificationto + tokenlength + showxquestions + showgroupinfo + shownoanswer + showqnumcode + bouncetime + bounceprocessing + bounceaccounttype + bounceaccounthost + bounceaccountpass + bounceaccountencryption + bounceaccountuser + showwelcome + showprogress + allowjumps + navigationdelay + nokeyboard + alloweditaftercompletion + googleAnalyticsStyle + googleAnalyticsAPIKey + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + surveyls_survey_id + surveyls_language + surveyls_title + surveyls_description + surveyls_welcometext + surveyls_endtext + surveyls_url + 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 + surveyls_dateformat + email_admin_notification_subj + email_admin_notification + email_admin_responses_subj + email_admin_responses + surveyls_numberformat + + + + + + + pression-based validation.
    +It also shows how color coding is used to show whether each question and sub-question is valid.]]>
    + + + + + +
    you have been invited to participate in a survey.

    The survey is titled:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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:
    "{SURVEYNAME}"

    "{SURVEYDESCRIPTION}"

    To participate, please click on the link below.

    Sincerely,

    {ADMINNAME} ({ADMINEMAIL})

    ----------------------------------------------
    Click here to do the survey:
    {SURVEYURL}

    If you do not want to participate in this survey and don't want to receive any more invitations please click the following link:
    {OPTOUTURL}]]>
    + +
    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}.]]>
    + +
    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}]]>
    + + +
    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}]]>
    + + + .printouttable { + margin:1em auto; + } + .printouttable th { + text-align: center; + } + .printouttable td { + border-color: #ddf #ddf #ddf #ddf; + border-style: solid; + border-width: 1px; + padding:0.1em 1em 0.1em 0.5em; + } + + .printouttable td:first-child { + font-weight: 700; + text-align: right; + padding-right: 5px; + padding-left: 5px; + + } + .printouttable .printanswersquestion td{ + background-color:#F7F8FF; + } + + .printouttable .printanswersquestionhead td{ + text-align: left; + background-color:#ddf; + } + + .printouttable .printanswersgroup td{ + text-align: center; + font-weight:bold; + padding-top:1em; + } + Hello,

    A new response was submitted for your survey '{SURVEYNAME}'.

    Click the following link to reload the survey:
    {RELOADURL}

    Click the following link to see the individual response:
    {VIEWRESPONSEURL}

    Click the following link to edit the individual response:
    {EDITRESPONSEURL}

    View statistics by clicking here:
    {STATISTICSURL}


    The following answers were given by the participant:
    {ANSWERTABLE}]]>
    + +
    +
    +
    +
    diff --git a/include/limesurvey/docs/release_notes.txt b/include/limesurvey/docs/release_notes.txt index e51f01f9..979292be 100644 --- a/include/limesurvey/docs/release_notes.txt +++ b/include/limesurvey/docs/release_notes.txt @@ -1,4 +1,4 @@ -Welcome to LimeSurvey v1.91+! +Welcome to LimeSurvey v1.92+! Warranty: This program is provided "as is" without warranties of any kind, either expressed or implied, including, but not limited to, the implied warranties of merchantability and fitness for a particular @@ -77,6 +77,633 @@ 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.92+ (build 120909) to 1.92+ (build 120919) September 19, 2012 +-Fixed issue #6528: Save changes on label set results in a php warning when text contains a tab character (Carsten Schmitz) +-Fixed issue #6536: HTML editor converts special characters to html entities within equations (Carsten Schmitz) +-Fixed issue #6547: Arbitrary URL redirect - parameter "redirect" (Carsten Schmitz) +-Fixed issue #6553: $column_style global parameter aren't used (Denis Chenu) + +Changes from 1.92+ (build 120822) to 1.92+ (build 120909) September 9, 2012 +-Fixed issue #6530: Since latest update unable to upload documents in survey (Denis Chenu) +-Fixed issue #6543: SQL injection in activate_functions.php - parameter "sid" (jcleeland) +-Fixed issue #6544: SQL injection in activate_functions.php - parameter "fixnumbering" (jcleeland) +-Fixed issue #6545: SQL injection in preview.php - parameter "lang". Sanitized language string. (jcleeland) +-Fixed issue #6546: SQL injection in userrighthandling.php - parameter "ugid" (jcleeland) + + +Changes from 1.92+ (build 120815) to 1.92+ (build 120822) August 22, 2012 +-Fixed issue #6423: Potential XSS in 'Resume survey' load form (Carsten Schmitz) +#Updated translation: Chinese (Simplified) by jun9 +#Updated translation: French (France) by BenoitBouvarel +#Updated translation: Italian by lfanfoni +#Updated translation: Korean by gregshin +#Updated translation: Spanish (Chile) by jergas +#Updated translation: Thai + + +Changes from 1.92+ (build 120808) to 1.92+ (build 120815) August 15, 2012 +-Fixed issue #6319: Preview group can throw error (Denis Chenu) +-Fixed issue #6442 : Adding labels fails without numbers in last Code field in Label Set editor (Denis Chenu) +-Fixed issue #6452: File Upload not working with embedded_layout use (Carsten Schmitz) +-Fixed issue #6465: Assessment typo (Carsten Schmitz) +-Fixed issue #6467 : checkbox for 'other' missing for multiple choice (Denis Chenu) +-Fixed issue #6470 : Bad emplacement of Other text input box for large screen in Multiple option (Denis Chenu) +-Fixed issue #6476: Error in data entry when using multiple choice with comment questions and MSSQL (Carsten Schmitz) +-Fixed issue: Multiple option with checkbox : Other can be checked at submit with empty value (Denis Chenu) +-Fixed issue: Remove escape character (\) from any field evaluated by EM. (Thomas White) +#Updated translation: French (France) by BenoitBouvarel, DenisChenu +#Updated translation: German by debianese +#Updated translation: Greek by kiolalis +#Updated translation: Italian by lfanfoni +#Updated translation: Japanese by nomoto +#Updated translation: Malay by ayahanda +#Updated translation: Polish by elisa + + +Changes from 1.92+ (build 120801) to 1.92+ (build 120808) August 8, 2012 +-Fixed issue #6424: Lastpage field not being added in MSSQL when upgrading from 1.85 or older (Carsten Schmitz) +-Fixed issue #6439: Question type Array (numbers) does not work with numbers >10 as labels (Thomas White) +#Updated translation: Czech by slansky +#Updated translation: German by c_schmitz +#Updated translation: German (Informal) by c_schmitz +#Updated translation: Malay by ayahanda +#Updated translation: Polish by elisa +#Updated translation: Turkish by kayazeren + +Changes from 1.92+ (build 120725) to 1.92+ (build 120801) August 1, 2012 +-Fixed issue #6066: File upload fails if single oder double quotes are used (Carsten Schmitz) +-Fixed issue #6287: Unable to export QueXML with Postgresql 9.1 (Adam Zammit) +-Fixed issue #6297: QueXML Export broken Dev Removed condition checking for queXML export (Adam Zammit) +-Fixed issue #6334: Don't have a valid session in file upload question (Carsten Schmitz) +-Fixed issue #6387: Broken Add vs Replace Buttons on Quick Add for Labels (tpartner) +-Fixed issue #6395: QuickAdd permits longer codes than 5 characters (Carsten Schmitz) +#Updated translation: Albanian by emiljan, c_schmitz +#Updated translation: Czech by slansky +#Updated translation: German by c_schmitz +#Updated translation: German (Informal) by c_schmitz +#Updated translation: Italian by lfanfoni +#Updated translation: Italian (Formal) by gifino +#Updated translation: Norwegian (Bokmal) by reidarborgersen, dittaeva +#Updated translation: Polish by elisa +#Updated translation: Turkish by kayazeren + + +Changes from 1.92+ (build 120718) to 1.92+ (build 120725) July 25, 2012 +-Fixed issue #6312: Editing Survey Security Permissions as non-super-admin and non-survey owner throws PHP Fatal Error (Stephanie King) +-Fixed Issue #6312 - Editing Survey Security Permissions as non-super-admin and non-survey owner throws PHP Fatal Error (Stephanie King) +-Fixed issue #6335 : Group preview add answer (Denis Chenu) +-Fixed issue #6336 : Bad template URL if templatedir is not exist (Denis Chenu) +-Fixed issue #6337 : $defaulttemplate aren't allways used (Denis Chenu) +-Fixed issue #6340: Error "String offset cast occured" when adding user and using PHP 5.4 or later (Carsten Schmitz) +-Fixed issue #6346: Statistic page filter not remembering statistics language (Carsten Schmitz) +-Fixed issue #6348: Bar chart not translated in statistics when changing statistics language (Carsten Schmitz) +-Fixed issue #6349: condition does not work while using slider with stars (Thomas White) +-Fixed issue: Bad CSS for empty other comment in mandatory question for citronade (Denis Chenu) +-New feature: Ability to reset Expression Manager for admin with showlogicfile (Denis Chenu) + + +Changes from 1.92+ (build 120711) to 1.92+ (build 120718) July 18, 2012 +-Fixed issue #6328: pre-filling of hidden questions does not work (Thomas White) +-Fixed issue #6304: Reloading unfinished survey can submit it without user interaction / reloading survey don't goe to actual step (Denis Chenu) +-Fixed issue #6318: Attributes/validation cut off when checking with EM (Carsten Schmitz) +-Fixed issue #6329: Language titles in language switcher are displayed in the currently used language instead of the native name (Carsten Schmitz) +-Fixed issue #6330: Regex engine does not accept a leading zero even if explicitly specified as acceptable (Thomas White) +-Fixed issue: Other comment mandatory requires 2 or more characters in comment field instead of 1 or more characters (Thomas White) +-Fixed issue: Whole Question Validation (em_validation_q) missing from several question types (Thomas White) +#Updated translation: Chinese (Simplified) by yooyooh +#Updated translation: Czech by slansky +#Updated translation: French (France) by DenisChenu +#Updated translation: German by Mazi +#Updated translation: German (Informal) by c_schmitz +#Updated translation: Italian by lfanfoni +#Updated translation: Polish by elisa +#Updated translation: Spanish (Spain) by danielgeisler + + +Changes from 1.92+ (build 120704) to 1.92+ (build 120711) July 11, 2012 +-Fixed issue #6207: Error "Ambiguous column name 'qid'" when using MSSQL server and editing answer options (Carsten Schmitz) +-Fixed issue #6252: English warning message though German language set (Carsten Schmitz) +-Fixed issue #6282: Error accessing a survey from a language that it hasn't (Carsten Schmitz) +-Fixed issue #6284: In some cases statistics' layout is broken (Carsten Schmitz) +-Fixed issue #6290: Array (texts) responses with single quotes are truncated on data entry screen (Carsten Schmitz) +-Fixed issue #6300: Token can be duplicated under some condition (Denis Chenu) +-Fixed issue #6305: Assessment values are not shown in logic file; nor in question, and group previews (Thomas White) +-Fixed issue #6309 : Bad javascript for Multiple choice with "Other option" (Denis Chenu) +-Fixed issue: Several remote file inclusion vulnerabilities (only when register_globals is activated) (Carsten Schmitz) +-Fixed issue: When magic quotes enabled on the server then quoting was not correct on the response data (Carsten Schmitz) +#Updated translation: Czech by slansky +#Updated translation: French (France) by DenisChenu +#Updated translation: German by c_schmitz +#Updated translation: Italian by lfanfoni +#Updated translation: Polish by elisa +#Updated translation: Russian by gdemin +#Updated translation: Spanish (Spain) by gap1981 +#Updated translation: Turkish by kayazeren + + +Changes from 1.92+ (build 120623) to 1.92+ (build 120704) July 4, 2012 +#Updated translation: Czech by slansky +#Updated translation: Italian by lfanfoni +#Updated translation: Spanish (Chile) by SirCrovax +-Fixed issue #5849: Unable to paste into numeric question types (Thomas White) +-Fixed issue #6188: Display error in conditions editor when selecting several options per sub-question (Carsten Schmitz) +-Fixed issue #6210 Inconsistent database after deleting a file by "clear & exit" button (Denis Chenu) +-Fixed issue #6250 : Public statistics always use default template (Denis Chenu) +-Fixed issue #6256: Touch event support (tpartner) +-Fixed issue #6271: text entry fields use onchange instead of onkeyup events to propagate changes (Thomas White) +-Fixed issue #6281: hidden variables used in equations have wrong name so don't POST properly (Thomas White) +-Fixed issue #6296: Question type file upload dose not work (tpartner) +-Fixed issue #6298: File upload button too narrow in Safari + Chrome (tpartner) +-Fixed issue: Array filter of ranking does not work reliably across browsers (Thomas White) +-Fixed issue: Changes to comments in multiple choice checkbox could not trigger changes in tailoring (Thomas White) +-Fixed issue: Clearing "other" value in multiple choice checkbox did not clear associated comment (Thomas White) +-Fixed issue: EM unit tests broken due to missing LEMradix variable. (Thomas White) +-Fixed issue: Revert to using onchange instead of onkeyup for Array Numbers when using dropdown lists of numbers (Thomas White) +-Fixed issue: Show Survey Logic File does not show survey title, description, welcome, endmsg, endurl, nor any errors within them (Thomas White) +-Fixed issue: Unchecking entries in multiple choice checkbox did not clear associated comment (Thomas White) +-Fixed issue: Wrong flag image for ZH-Hant-TW (Carsten Schmitz) +-Fixed issue: Removed dot in front of languageswitch drop down. (Marcel Minke) + + + +Changes from 1.92+ (build 120620) to 1.92+ (build 120623) June 22, 2012 +-Fixed issue #6240: conversion of conditions to relevance can fail for multiple choice tests during some upgrades (Thomas White) +#Updated translation: Chinese (Simplified) by yooyooh +#Updated translation: French (France) by DenisChenu +#Updated translation: Italian by gifino, lfanfoni +#Updated translation: Polish by elisa + + +Changes from 1.92+ (build 120613) to 1.92+ (build 120620) June 20, 2012 +-Fixed issue #5766: exclude_all_others_auto does not work (Thomas White) +-Fixed issue #6205: Add http:// by default to endurl for indication (Denis Chenu) +-Fixed issue #6207: [Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name 'qid' (Carsten Schmitz) +-Fixed issue #6207: [Microsoft][ODBC SQL Server Driver][SQL Server]Ambiguous column name 'qid' (Thomas White) +-Fixed issue #6208 : Adding user to user group leads to error message (Denis Chenu) +-Fixed issue #6211: Problems with two "file upload" question types in the same question group (Thomas White) +-Fixed issue #6213: File upload questions tips have an error in italian (Thomas White) +-Fixed issue #6214: relevance equations that only contain static replacement values cause JS crash (Thomas White) +-Fixed issue #6221: Array filtering does not work when trigger question has multiple inputs per row (Thomas White) +-Fixed issue #6222: Conditions not working when it relies on value from a hidden question (Thomas White) +-Fixed issue #6223: Admin login does not work with postgres right after install (Carsten Schmitz) +-Fixed issue #6224: resetadminpw.php: SQL-string for postgres incorrect (Carsten Schmitz) +-Fixed issue #6225: unable to pass qcode-named variables via URL (Thomas White) +-Fixed issue #6226 & #6229: Only end message with Cannot edit answer (token and edit answers after submitting activated) (Denis Chenu) +-Fixed issue #6231: EM doesn't convert condition correctly, OR becomes AND (Thomas White) +-Fixed issue #6235: Javascript errors when use equations for min/max num values in Ranking questions (Thomas White) +-Fixed issue #6238: array filtering does not work for Ranking questions (Thomas White) +-Fixed issue #6239: Ranking style questions can't be used to filter other questions (Thomas White) +-Fixed issue: Array-filter algorithms for Ranking questions do not appear in Show Logic File (Thomas White) +-Fixed issue: PHP errors thrown if use invalid array filter question (Thomas White) +-Fixed issue: QID links in Show Survey Logic File should open new edit-question window, not just view question (Thomas White) +-Fixed issue: ShowLogicFile did not show array filters for List(Radio) questions when "other" advanced question option selected (Thomas White) +#Updated translation: Chinese (Simplified) by yooyooh +#Updated translation: Italian by lfanfoni, gifino +#Updated translation: Polish by elisa +#Updated translation: Swedish +#Updated translation: Turkish by kayazeren + + +Changes from 1.92+ (build 120608) to 1.92+ (build 120613) June 13, 2012 +-Fixed issue #6100: English in other language (Thomas White) +-Fixed issue #6130: Response emails sent as "text/plain" but with HTML embedded (Carsten Schmitz) +-Fixed issue #6147: "Please rank at least x items" not being translated (Carsten Schmitz) +-Fixed issue #6151: CSS errors on public statistics page (Carsten Schmitz) +-Fixed issue #6153: "Cannot find data type DATE" when activating a survey with MSSQL 2005 (Carsten Schmitz) +-Fixed issue #6168: Question preview ignores "no answer" setting (Thomas White) +-Fixed issue #6177: uppercase logical operators (e.g. 'OR') in EM yield JavaScript errors (Thomas White) +-Fixed issue #6178: es-CL is listed as Spanish (Mexico) instead of Spanish (Chile) (Carsten Schmitz) +-Fixed issue #6186: Array Question Type: EM doesn't convert condition correctly, AND becomes OR (Thomas White) +-Fixed issue #6187: Javascript Error on em_javascript.js : attr is undefined (Thomas White) +-Fixed issue #6196: Misplaced PopUpEditor icon (tpartner) +-Fixed issue #6200: if enter text into other box, then click the other checkbox, the entered text disappears (Thomas White) +-Fixed issue #6201: Fatal error: Cannot redeclare replacenewline() (Thomas White) +-Fixed issue: "Please check at least one item" not appropriate for single select list questions (Thomas White) +#Updated translation: Arabic by maan +#Updated translation: Croatian by rovinj +#Updated translation: Czech by slansky +#Updated translation: German by c_schmitz +#Updated translation: German (Informal) by c_schmitz +#Updated translation: Italian by lfanfoni +#Updated translation: Korean by heasunchun +#Updated translation: Norwegian (BokmÃ¥l) by c_schmitz +#Updated translation: Polish by elisa +#Updated translation: Portuguese (Brazil) by mauriciofurtado +#Updated translation: Spanish (Mexican) by scoutino + +Changes from 1.92+ (build 120607) to 1.92+ (build 120608) June 7, 2012 +Fixed issue HTML error in hidden field for equation question type + +Changes from 1.92+ (build 120530) to 1.92+ (build 120607) June 7, 2012 +-Fixed issue #6122: EM seems to be holding a cache in admin dev: now only setting language in EM (mennodekker) +-Fixed issue #6155: Error on MSSQL: Ambiguous column name qid (Menno Dekker) +-Fixed issue #5943: exclusive option in multiple choice hide all other answer options (Thomas White) +-Fixed issue #6057: Hitting RETURN while typing in M.C. 'Other' of non-tracked survey looses all survey input (tpartner) +-Fixed issue #6140: Survey doesn't start from where it was left on Token Persistence (Thomas White) +-Fixed issue #6149: EM shows wrong result for number generated by rand() function (Thomas White) +-Fixed issue #6154: File upload questions not mandatory anymore (Thomas White) +-Fixed issue #6158: In question-by-question mode, EM replacements in same group but on different page use (Thomas White) +-Fixed issue #6163: error in mandatory array_filter-ed multi-numeric and multiple-short questions +-Fixed issue #6165: unable to implement affirmative exclusive non-answer in array_filter_exclude +-Fixed issue #06079: sub-question filtering broken if "other" or "no answer" option is given (Thomas White) +-Fixed issue #6171: variable < X is true even if variable isn't answered (Thomas White) +-Fixed issue #6172: Update to Version 1.92+ from 1.91+ Cannot Complete - Reason: Duplicate column name 'grelevance' (Thomas White) +-Fixed issue #6173: users can skip min_sum_value and equals_sum_value questions (Thomas White) +-Fixed issue #6176: replacements of other value for multiple-choice don't appear when click previous (Thomas White) +-Fixed issue: Assesments for multi choice question (Denis Chenu) +-Fixed issue: Error in PostgreSQL DB create script. (Jonathan Harker) +-Fixed issue: Error in upgrade from old DB versions (Carsten Schmitz) +-Fixed issue: Errors in Postgres DB creation script (Carsten Schmitz) +-Fixed issue: Google Analytics Style #2 breaks if group names contain special characters (Thomas White) +-Fixed issue: mktime() function needs to be passed integer values (Thomas White) +-Fixed issue: 'other' status flag missing from Show Logic File (Thomas White) +-Fixed issue: Errors in Postgres upgrade and DB creation (Carsten Schmitz) +#Updated translation: Amharic by mezwor +#Updated translation: Czech by slansky +#Updated translation: Dutch +#Updated translation: Dutch (Informal) +#Updated translation: Estonian by LimAlf +#Updated translation: Italian by lfanfoni +#Updated translation: Polish by elisa +#Updated translation: Portuguese (Portugal) by algarvio +#Updated translation: Slovenian +#Updated translation: Spanish (Chile) by SirCrovax +#Updated translation: Turkish by kayazeren + + +Changes from 1.92+ (build 120529) to 1.92+ (build 120530) May 28, 2012 +-Fixed issue #6133: Race condition with concurrent upload of similar "survey structure" (Carsten Schmitz) + +Changes from 1.92+ (build 120526) to 1.92+ (build 120529) May 28, 2012 +-Fixed issue #6106: Mandatory error shown when testing a question (Carsten Schmitz) +-Fixed issue #6133: Race condition with concurrent upload of similar "survey structure" (Carsten Schmitz) +-Fixed issue #6136: Relevance evaluation with Postgres fails when using regular expressions (Carsten Schmitz) +-Fixed issue: Admin language switching to survey language (Carsten Schmitz) + +Changes from 1.92+ (build 120517) to 1.92+ (build 120526) May 26, 2012 +#Updated translation: Dutch by Nickko +#Updated translation: Dutch (Informal) by Nickko (root) +#Updated translation: French by Denis Chenu, Nickko +#Updated translation: German (Informal) by c_schmitz (root) +#Updated translation: German by c_schmitz +#Updated translation: Polish (elisa-ls) +#Updated translation: Dutch +#Updated translation: Portuguese +#Updated translation: Slovenian +-Fixed issue #6122: EM seems to be holding a cache in admin dev: only set language when a surveyid is set (mennodekker) +-Fixed issue #5766: exclude_all_others_auto does not work (Thomas White) +-Fixed issue #6114: Mail encryption really off for bounce managment (Denis Chenu) +-Fixed issue #6119: Apostrophe bug in statistics PDF and Excel output (Carsten Schmitz) +-Fixed issue #6124: User with limited rights is allowed to export complete MySQL DB +-Fixed issue: User with configurator access doesn't have acces to global settings (Denis Chenu) +-Fixed issue: Survey list does not show surveys having deleted owners (Carsten Schmitz) + + +Changes from 1.92+ (build 120516) to 1.92+ (build 120517) May 17, 2012 +-Fixed issue: Missing translations / texts + +Changes from 1.92+ (build 120509) to 1.92+ (build 120516) May 16, 2012 ++New translation: Spanish (Chile) kindly provided by Victor Pinto (Carsten Schmitz) +#Updated translation: Polish (elisa-ls) +#Updated translation: Amharic kindly provided by Mezene Worku +#Updated translation: Czech (lukas-slansky) +#Updated translation: German by c_schmitz +#Updated translation: Persian - kindly provided by Morteza Farahbod +#Updated translation: Turkish - 100% - kindly provided by Kaya Zeren +-Fixed issue #5766: exclude_all_others_auto does not work (Thomas White) +-Fixed issue #5943: Exclusive option in multiple choice hides all other answer options (Thomas White) +-Fixed issue #6003: Text truncated after single quote when browsing responses to Multiple short text question. (Thomas White) +-Fixed issue #6046: Resume later deletes answers from db when all questions are on one page (Thomas White) +-Fixed issue #6078: Invalid LimeExpressionManager->ngT() calls (TMSWhite) +-Fixed issue #6086: 1.92+ Build 120509 Conditions do not work with probably good logic (Thomas White) +-Fixed issue #6087: cascading array filter fails for depth>=3 in group and question modes (Thomas White) +-Fixed issue #6093: Wrong result when comparing decimal values from equation question types in surveys using comma as decimal point (Thomas White) +-Fixed issue #6102: "Print your answers" shows EM syntax errors (Thomas White) +-Fixed issue #6048: Conditions editor produces fatal error: maximum allocated memory (Carsten Schmitz) +-Fixed issue #6080: Wrong validation for multiple numeric questions +-Fixed issue #6085: By pasting a subquestion code can contain a space (Carsten Schmitz) +-Fixed issue: Misaligned input with multi column on citronade (Denis Chenu) +-Fixed issue: Array-filter equations not visible for List-type questions in Show Survey Logic file (Thomas White) +-Fixed issue: Datestamp on not date stamped survey. Dev: use 1980-01-01 for 'All database same value' (Denis Chenu) +-Fixed issue: Endless javascript loop in answer edit or subquestion edit (Denis Chenu) +-Fixed issue: Missing translations for jQuery popup calendar (Carsten Schmitz) +-Fixed issue: Nice exit if surveyid is invalid (Denis Chenu) +-Fixed issue: Unable to add label in label set administration (Carsten Schmitz) + + +Changes from 1.92+ (build 120501) to 1.92+ (build 120509) May 9, 2012 ++New translation: Afrikaans ++New translation: Amharic - kindly provided by Mezene Worku +#Updated translation: Polish (elisa-ls) +#Updated translation: German (Carsten Schmitz) +#Updated translation: German (informal) (Carsten Schmitz) +#Updated translation: Persian by M. Farahbod (Carsten Schmitz) +#Updated translation: Portuguese (Brazil) by Flávio Rodrigues (Carsten Schmitz) +-Fixed issue #5975: Confirmation screen broken for iterate survey feature (tpartner) +-Fixed issue #5987: prefix and suffix are misaligned for "total" field at miltiple numeric question (tpartner) +-Fixed issue #6030: answeroption not left-aligned (tpartner) +-Fixed issue #6030: answeroption not left-aligned Dev Fixed up CSS for list-radio questions (tpartner) +-Fixed issue #6044: Use advanced question settings such as numbers_only, display_rows, max_characters, prefix, suffix, ... at data entry screen. (Marcel Minke) +-Fixed issue #6062: Language selector is missing on survey without description nor welcome message (tpartner) +-Fixed issue #6075: Content of previous answer is not replaced, instead placeholder of selected answer is shown: eg. {TOKEN:ATTRIBUTE_2} (Thomas White) +-Fixed issue #6030: answeroption not left-aligned with multiple-opt-comments Dev : move input outside label (Denis Chenu) +-Fixed issue #6030: Misalign input in multi-line answers / citronade part Dev : fixed some issue with little screen too (Denis Chenu) +-Fixed issue #6048: Conditions editor produces fatal error: maximum allocated memory (Carsten Schmitz) +-Fixed issue #6059: EM puts spaces between variables (Carsten Schmitz) +-Fixed issue #6061: Duplicate codes when adding new answer options/subquestions/labels (Carsten Schmitz) +-Fixed issue #6065: Error when creating a new survey by copying an existing one (Carsten Schmitz) +-Fixed issue #6071: Notices if using mssql and changing/importing survey (Carsten Schmitz) +-Fixed issue: Added quota_languagesettings table to the fixlanguageconsistency() array - when languages are added, matching quota entries are created for each language (jcleeland) +-Fixed issue: Behaviour change on 'resume later' (Carsten Schmitz) +-Fixed issue: db_quoteall added to fixlanguageconsistency() function when copying quota translations. (jcleeland) +-Fixed issue: Submit date set even though participant was screened out by a quota (Carsten Schmitz) +-Fixed issue: Several HTML fixes for data entry screen (data entry & data edit) (Marcel Minke) + + +Changes from 1.92+ (build 120425) to 1.92+ (build 120501) May 1, 2012 +-Fixed issue #6008: File upload doesn't work from date entry, not available in response edit (mennodekker) +-Fixed issue #6045: Firefox 12 vertical scrolling problem in admin view (and other pages) (Carsten Schmitz) +-Fixed issue #6056 - Quota languages don't update (jcleeland) +-Fixed issue: Images inserted into HTML emails were not properly linked to the server (Carsten Schmitz) +-Fixed issue: Fixed several HTML issues for data entry mode +-Fixed issue: Partial fix (just data entry - editing data missing) for bug #6044: Use advanced question settings such as numbers_only, display_rows, max_characters, prefix, suffix, ... at data entry screen. (Marcel Minke) + + +Changes from 1.92+ (build 120418) to 1.92+ (build 120425) April 25, 2012 +-Fixed issue #5988: Problem displaying words with French accent within Expression Manager (Carsten Schmitz) +-Fixed issue #6027: Users who have token creation permission can't create token table (Carsten Schmitz) +-Fixed issue #6035: Insertans not working in multiple options with comments (Carsten Schmitz) +-Fixed issue #6036: Reminder sent to people which opted out (Carsten Schmitz) +-Fixed issue #6037: Zero uses left by default when importing tokens from CSV (Carsten Schmitz) +-Fixed issue #6042: Check for existing token taables after activation -> switch to closed access (Carsten Schmitz) +-Fixed issue #6043: Errors creating surveys in MSSQL (Carsten Schmitz) +#Updated translation: Czech (lukas-slansky) +#Updated translation: Danish - kindly provided by Søren O'Neill (Carsten Schmitz) +#Updated translation: Finnish kindly provided by Flo Apps Oy (Carsten Schmitz) +#Updated translation: German (Carsten Schmitz) +#Updated translation: Italian - kindly provided by Alberto Danese (Carsten Schmitz) +#Updated translation: Spanish (Mexico) (Carsten Schmitz) + + +Changes from 1.92+ (build 120412) to 1.92+ (build 120418) April 18, 2012 +-Fixed issue #5896: Miscellaneous, rarely used, qcode.* attributes showing blank values (Thomas White) +-Fixed issue #6006: Error in LImeExpressionManage.php anytime using an array (numbers) with checkboxes and Mandatory (Thomas White) +-Fixed issue #6007: Token variables resolving as 'undefined variable' after Version 1.91+ Build 11026 (Thomas White) +-Fixed issue #6013: passthru stopped working (Thomas White) +-Fixed issue #6015: INSERTANS does not work in end message (Thomas White) +-Fixed issue #6024: $deletenonvalues option no longer working in 1.92+ (Thomas White) +-Fixed issue #5986: Import label set does not properly show an error for invalid files (Carsten Schmitz) +-Fixed issue #6016: Load Unfinished Survey button does not display for existing survey (Carsten Schmitz) +-Fixed issue #6018: Using mssqlnative the "date" question type uses DATETIME type and not DATE (Carsten Schmitz) +-Fixed issue: Notice when using mssqlnative driver (Carsten Schmitz) +-Fixed issue: Only set EM variables for {TOKEN:xxxx} when token table exists; and only for declared attributes (Thomas White) +-Fixed issue: Participant IP address not correctly captured if server is behind proxy (Carsten Schmitz) +-Fixed issue: Warning if upload file and there is no minimum number of files specified (Thomas White) +#Updated translation: Czech kindly provided by Slansky Lukas +#Updated translation: French kindly provided by Guillaume Jaouen +#Updated translation: German +#Updated translation: German (informal) (Carsten Schmitz) + + +Changes from 1.92+ (build 120405) to 1.92+ (build 120412) April 12, 2012 +-Fixed issue #5962: View Response Details does not work correctly if responses are filtered (Statistics) (Thomas White) +-Fixed issue #5985: Notifications using INSERTANS and/or QCODE don't work with all-in-one presentation of survey (Thomas White) +-Fixed issue #5992: After upgrade to Version 1.92+ Build 120405 the uploaded file information gets corrupted. (Thomas White) +-Fixed issue #6002: @@SURVEYURL@@ placeholder fails to translate (Thomas White) +-Fixed issue #5976: Iterate survey sets all "uses_left" to "1" even if there has been set a larger number previously (Carsten Schmitz) +-Fixed issue #5997 : upload windows are on default survey langage (Denis Chenu) +-Fixed issue: Bad HTML in editgroup(Denis Chenu) +-Fixed issue: Mssqlnative driver gives back weird date format in export (Carsten Schmitz) +-Fixed issue: With certain Apache configurations then em_javascript.js file was not readable (Carsten Schmitz) +#Updated translation: Danish - kindly provided by Søren O'Neill (Carsten Schmitz) +#Updated translation: Galician - kindly provided by Carlos Neira Cortizas (Carsten Schmitz) +#Updated translation: German Updated translation: German (informal) (Carsten Schmitz) +#Updated translation: Greek by Yannis Kaskamanidis (Carsten Schmitz) +#Updated translation: Spanish (Mexico) (Carsten Schmitz) + + +Changes from 1.92+ (build 120330) to 1.92+ (build 120405) April 5, 2012 +-Fixed issue #5877: Resume later doesn't work with a survey allowing public registration (Carsten Schmitz) +-Fixed issue #5971: Strange behavior of expression manager - static equation results not visible (Thomas White) +-Fixed issue #5979: values prefilled via URL are not passed through to end URL Dev also syntax highlighted end URL so can see if it contains typos (Thomas White) +-Fixed issue #5981: EM attributes that should be static generate elements (Thomas White) +-Fixed issue #5982: Wrong replacement field properties (Thomas White) +-Fixed issue #5984: Javascript error with upload question type for italian language Dev: add js option on clang (Denis Chenu) +-Fixed issue #5960: Start language always saved as English (Carsten Schmitz) +-Fixed issue #5969: Trying to import a question group without a matching language gives no proper error (Carsten Schmitz) +-Fixed issue: When there are multiple languages, getSubQuestions() returns wrong values (often a mix of language-specific values) (Thomas White) + + +Changes from 1.92+ (build 120325) to 1.92+ (build 120330) Mar 30, 2012 +-Fixed issue #5948: Mandatory directive for question is ignored for array (numbers) using checkbox layout (Thomas White) +-Fixed issue #5952: Error in statistics (Carsten Schmitz) +-Fixed issue #5957: Cannot check integrity database (Carsten Schmitz) +-Fixed issue #5962: View Response details does not work correctly if responses are filtered (Carsten Schmitz) +-Fixed issue: Certain French characters garbled in statistics display and other areas (Carsten Schmitz) +-Fixed issue: Error if s_lang are not in survey langage (Denis Chenu) +-Fixed issue: When trying to export to application then not all fields are shown (Carsten Schmitz) + +Changes from 1.92+ (build 120324) to 1.92+ (build 120325) Mar 23, 2012 +-Fixed issue #5877: Resume later doesn't work with a survey allowing public registration (magiclko) +-Fixed issue: MSSQL error on importing survey (Carsten Schmitz) + +Changes from 1.92+ (build 120323) to 1.92+ (build 120324) Mar 23, 2012 +-Fixed issue #5877: Resume later doesn't work with a survey allowing public registration (magiclko) +-Fixed issue #5934: Generating new Lablesets won't work (magiclko) +-Fixed issue #5946: SQL error while creating new survey (Carsten Schmitz) + +Changes from 1.92+ (build 120319) to 1.92+ (build 120323) Mar 23, 2012 +-Fixed issue #5731: Randomization group name seems to block "Test this survey" (Thomas White) +-Fixed issue #5909: Re-uploading files after deletions and other problems with File Upload question type and Expression Manager (Carsten Schmitz) +-Fixed issue #5932: Default answers to hidden questions are not saved to database (Thomas White) +-Fixed issue #5933: Uploaded files with uppercase extensions show placeholder instead of image (Carsten Schmitz) +-Fixed issue #5936: INSERTANS or TOKEN cannot be used in mail adress notification (Denis Chenu) +-Fixed issue #5941: Quotas fail to terminate survey (Carsten Schmitz) +-Fixed issue #5942: unable to activate survey after some modification (Denis Chenu) +-Fixed issue #5944: Cannot grant "Survey security" permission to another user (Carsten Schmitz) +-Fixed issue: Conditions were not properly converted to EM expressions when magicquotes are enabled (Carsten Schmitz) + +Changes from 1.92+ (build 120314) to 1.92+ (build 120319) Mar 19, 2012 +#Updated translation: Hungarian by Pongrácz István (Carsten Schmitz) +-Fixed issue #5904: Database upgrade fails with errors on Postgres (Carsten Schmitz) +-Fixed issue #5913: Bad SQL syntax in file create-mssql.sql (Carsten Schmitz) +-Fixed issue #5917: Bold text not showing when using default template (Carsten Schmitz) +-Fixed issue #5921: Duplicate header field names for Dual scale question type when exporting to application (Carsten Schmitz) +-Fixed issue #5924: Wrong alignment of subquestion text and radiobuttons in Array questions with RTL languages (Carsten Schmitz) +-Fixed issue #5926: With multilingual surveys the sheetname on Excel export was not always in the base language (Carsten Schmitz) +-Fixed issue #5927: Default template Yes/No questions & Male/Female alignment (Carsten Schmitz) +-Fixed issue: Error in update scripts for MSSQL server (Carsten Schmitz) +-Fixed issue: PHP warning when importing label set without labels (Carsten Schmitz) + +Changes from 1.92+ (build 120311) to 1.92+ (build 120314) Mar 14, 2012 ++New feature #5492: Changing global settings takes you away from survey design Now it "remembers" the referee url and redirect to that url after saving global settings! (magiclko) +-Fixed issue #5898: {GOOGLE_ANALYTICS_JAVASCRIPT} integration errors (Thomas White) +-Fixed issue #5835: Standard survey header is not used in public statistics (Carsten Schmitz) +-Fixed issue: Notice if Referer is not set (Shnoulle) +-Fixed issue: Textareas in survey taking were not properly quoted when displayed again (Carsten Schmitz) +-Fixed issue: Invalid email in 'resume later' save form did not show an error message (Carsten Schmitz) +-Fixed issue: HTMLeditor popup not properly filtering some input variables (Carsten Schmitz) + + +Changes from 1.92 (build 120302) to 1.92+ (build 120311) Mar 11, 2012 +-Fixed issue #5859: Question group import does not update references properly (Thomas White) +-Fixed issue #5875: Flexible Labels do not register in french when apostrophes are in label text. (magiclko) +-Fixed issue #5879: em_validation_q generates duplicative JavaScript (Thomas White) +-Fixed issue #5880: Make em_q_fn_validation and em_sq_fn_validation more easily visible (Thomas White) +-Fixed issue #5887: Minimum answers in Ranking question type are deactivated (Thomas White) +-Fixed issue #5892: With question type "Short free text" and "display row" set, the text field is shown with some code (Thomas White) +-Fixed issue #5894: INSERTANS (and qcode.shown) returning wrong values for some question types +-Fixed issue #5895: On-page substitution of comment for List with Comment type not being displayed (Thomas White) +-Fixed issue #5897: Survey ID not set correctly after row insert in servey_NNN table (Thomas White) +-Fixed issue #5778: Multiple choice answer for rtl in basic,bluenegrey,citronade,clear_logo,eireicon (Shnoulle) +-Fixed issue #5778: Template for RTL : limespired, mint_idea,sherpa,vallendar (Shnoulle) +-Fixed issue #5870: Progress indicator in quick-translate hiding to early. Some language (like Irish or Chinese) did not translate. (Carsten Schmitz) +-Fixed issue #5876: Cryptic error message when trying to run LimeSurvey using an outdated PHP version (Carsten Schmitz) +-Fixed issue #5878: Progress-bar not showing because of JS /eval folder being blocked (Carsten Schmitz) +-Fixed issue: Uploaded files fail if target directory does not exist. (Thomas White) +-Fixed issue: Data not saved and validations don't work when use multiflexible_checkbox option in Array (numbers) question type (Thomas White) +-Fixed issue: Differencation for good/empty and good/not-empty (Shnoulle) +-Fixed issue: Equation question types were only capturing the contents of the first replacement element (Thomas White) +-Fixed issue: Error on upgrade from 1.90 or earlier (Carsten Schmitz) +-Fixed issue: Group preview sometimes does not work (Thomas White) +-Fixed issue: hide_type advanced question option not available for all question types (Thomas White) +-Fixed issue: JavaScript IDs for validation messages start with a number, which does not pass strict HTML validation criteria (Thomas White) +-Fixed issue: When using question type Array (Numbers) with multiflexible_checkbox input and radix separator = comma, JavaScript throws error when trying to fix radix separator (Thomas White) +#Updated translation: Greek by Γιάννης Κασκαμανίδης (Carsten Schmitz) + +Changes from 1.91+ (build 120302) to 1.92 (build 120303) Mar 3, 2012 ++New feature #5780: Information when there is no matching label set (shnoulle) ++New feature #5103: Support conditional piping/tailoring and complex calculations via embedded equation parser (tmswhite) ++New feature #5104: Create new question type for stored calculation results, called Equation (tmswhite) ++New feature #5268: Do all LimeReplacementField and Token replacements in a single function (tmswhite) ++New feature #5269: Use ExpressionManager for Branching logic as optional alternative to Conditions (tmswhite) ++New feature #5279: Add a GUI for ExpressionManager (tmswhite) ++New feature #5288: Optionally replace Assessments with ExpressionManager features (tmswhite) ++New feature: Each type of validation tip can be styled separately (so if a question fails validation checks, you can see whether it is because of wrong number of answers, wrong value range, wrong sum range, or wrong regex criteria). (tmswhite) ++New feature: JavaScript question type selector and Editarea template can be desactivated by user (shnoulle) ++New feature: EM reserved word "this" which refers the the current sgqa code (tmswhite) ++New feature: Question_attribute 'em_validation_q': "Boolean equation to validate the whole question" (tmswhite) ++New feature: Question_attribute 'em_validation_q_tip': "Tip to show user describing the Question Validation Equation" (tmswhite) ++New feature: Question_attribute 'em_validation_sq': "Boolean equation to validate each sub-question." (tmswhite) ++New feature: Question_attribute 'em_validation_sq_tip': "Tip to show user describing the Sub-Question Validation Equation." (tmswhite) ++New feature: Added Tools button to access Expression Manager Test Suite (tmswhite) ++New feature: Allow Regular-Expression validation of question type ';' (ARRAY (Multi Flexi) Text) (tmswhite) ++New feature: Allow Regular-Expression validation of question type 'Q' (Multiple Short Text) (tmswhite) ++New feature: Google Analytics Support (tmswhite) ++New feature: Support dynamic validation range for multiflexible_min and multiflexible_max when in text input mode (tmswhite) ++New feature: dropdown_prefix attribute for List (dropdown) - lets you prefix each entry with its visible order in the list (tmswhite) ++New feature: dropdown_size attribute for List (dropdown) - lets you specify number of visible rows in the dropdown box (tmswhite) ++New feature: Code/QID visible in quick-translation answers/subquestions/questions for easier orientation (c_schmitz) ++New feature: Show Logic File for Entire Survey, with all conditions, validation, and tailoring (tmswhite) ++New feature: Sets "equals" as the default comparison operator for conditions (jcleeland) ++New feature: Quick-add feature for label sets which (was in _dev branch but was accidentally removed with merge in from _dev_tms branch) (tmswhite) +#Updated feature: Added German translations to 1.91 sample survey. (maziminke) +#Updated feature: Browse of submitted responses now only shows relevant questions and answers. (tmswhite) +#Updated feature: Default values now available for the following question types: Date, Short/Long/Huge Text, Multiple ShortText, Multiple Numerical (tmswhite) +#Updated feature: Deprecated min_num_value_sgqa, max_num_value_sgqa, and num_value_equals_sgqa (tmswhite) +#Updated feature: array_filter - now also available for multiple_numeric and multiple_short_text (tmswhite) +#Updated feature: exclude_all_others - now also available for multiple_choice_with_comments (tmswhite) +#Updated feature: max_answers - now also available for all array types, multiple_numeric and multiple_short_text (tmswhite) +#Updated feature: max_num_value_n - now also available for multiple_numeric (tmswhite) +#Updated feature: min_answers - now also available for all array types, multiple_numeric and multiple_short_text (tmswhite) +#Updated feature: Add many more unit tests to EM and group/sort them. Contributed by GCi participant Aaron Schmitz (tmswhite) +#Updated feature: min_num_value_n - now also available for multiple_numeric (tmswhite) + + +Changes from 1.91+ (build 120224) to 1.91+ (build 120302) Mar 2, 2012 +-Fixed issue #5721: Login with admin and default password doesn't work on Postgres with certain server versions (Carsten Schmitz) +-Fixed issue #5783: Surveys created in versions pre QuickTranslate do not set permission rights correctly (Carsten Schmitz) +-Fixed issue: Updater bugging out if no files exist for backup (Carsten Schmitz) +#Updated translation: German (Informal) by Gregor Herrmann (Carsten Schmitz) +#Updated translation: German Updated translation: German (informal) (Carsten Schmitz) +#Updated translation: Indonesian (Carsten Schmitz) +#Updated translation: Portuguese (Brazil) (Carsten Schmitz) +#Updated translation: Turkish (Carsten Schmitz) +#Update translation: Greek by Yannis Kaskamanidis (Carsten Schmitz) + + +Changes from 1.91+ (build 12416) to 1.91+ (build 120224) Feb 24, 2012 +-Fixed issue #05752: statistics_user.php - always shown in baselang (magiclko) +-Fixed issue #05764: If enter Y-scale and X-scale at same time, and click save, only Y-scale is saved (magiclko) +-Fixed issue #5824: QueXML export FAIL (Adam Zammit) +-Fixed issue #5831: User name not properly quoted on display (Carsten Schmitz) +-Fixed issue #5832: Unsanitized variable id when viewing a single response (Carsten Schmitz) +-Fixed issue: Fieldnames are not being properly sanitized (Carsten Schmitz) +-Fixed issue: Quote dbname correctly and use utf-8 for postgres installation (Stephan Beyer) + +Changes from 1.91+ (build 12358) to 1.91+ (build 12416) Feb 7, 2012 +#Updated translation: Greek by Yannis Kaskamanidis (c_schmitz) +-Fixed issue #5734: Problem upgrading from 1.72 to 1.91+ (c_schmitz) +-Fixed issue #5739: Wrong percentage in graphs with List with Comments question types (c_schmitz) +-Fixed issue #5749: Wrong date conversion when using certain date formats (c_schmitz) +-Fixed issue #5775: SQL error on translation (shnoulle) + +Changes from 1.91+ (build 12170) to 1.91+ (build 12358) Feb 5, 2012 +#Updated translation: German (maziminke) +-Fixed issue: Added missing information about a token being required for sending invitations. (maziminke) +-Fixed issue #5589: Error messages when user deletes himself (c_schmitz) +-Fixed issue #5592: Wrong answer mapping for dual scale matrix in detailed admin notification email (c_schmitz) +-Fixed issue #5648: Quota list of questions is not sorted (c_schmitz) +-Fixed issue #5688: Quota answers not in base language (c_schmitz) +-Fixed issue #5695: When creating a survey 'List survey publicly' defaults to Yes instead of Np (c_schmitz) +-Fixed issue #5751: Quick translation - assignment problem with dual matrix (c_schmitz) +-Fixed issue #5590: 1980-01-01 in printview (tpartner) +-Fixed issue #5692: Google Maps do not reappear where field is has conditions (tpartner) +-Fixed issue: Fixing notice introduced with commit 12113 (mennodekker) +-Fixed issue: uploader on preview (mennodekker) + +Changes from 1.91+ (build 11804) to 1.91+ (build 12170) Jan 23, 2012 +#Updated translation: French (b00z00) +#Updated translation: German (c_schmitz) +#Updated translation: German Informal (c_schmitz) +#Updated translation: Polish (elisa-ls) +#Updated translation: Portuguese (Brazil) (c_schmitz) +#Updated translation: Russian (c_schmitz) +#Updated translation: Turkish by Kaya Zeren (c_schmitz) +#Updated feature: Added German translations to 1.91 sample survey. (maziminke) ++New feature: Code/QID visible in quick-translation answers/subquestions/questions for easier orientation (c_schmitz) +-Fixed issue #5645 : Upload file question for all in one survey and Fancy URLs (shnoulle) +-Fixed issue #5628: SQL error after setting a filter in statistics and removing it again (c_schmitz) +-Fixed issue #5649: Error message on numerical input type question not working for more than one question of this type (c_schmitz) +-Fixed issue #5662: Clicking the 'Browse' button in statistics to browser filtered data shows all reponses (c_schmitz) +-Fixed issue #5678: usesleft field is not created by RemoteControl in tokens table (c_schmitz) +-Fixed issue #5643: CMS integration hack. Note: this option was removed for 2.00 (shnoulle) +-Fixed issue: Display columns layout for citronade (shnoulle) +-Fixed issue: php alert and bad deletion of file in upload file question (shnoulle) +-Fixed issue: Answers not properly added for dual scale questions when adding a new language to the survey (c_schmitz) +-Fixed issue: Missing sorting for groups/question in quick translate (c_schmitz) +-Fixed issue: Broken pdf export of printable survey due to incorrect filename (mennodekker) +-Fixed issue: printanswers shows json string for file upload fields (mennodekker) + +Changes from 1.91+ (build 11379) to 1.91+ (build 11804) Dec 30, 2011 +#Updated translation: Hungarian by GCI participant Andor Uhlár (c_schmitz) +#Updated translation: French (b00z00) +#Updated translation: Czech by GCI participant Martin JaneÄÂek (c_schmitz) +#Updated translation: Indonesian 100% by Ivan Lanin (c_schmitz) +#Updated translation: Indonesian by Jeremy Malcolm (c_schmitz) +#Updated translation: Lithuanian by Roland As (c_schmitz) +#Updated translation: Portuguese by João Santa Comba (c_schmitz) +#Updated translation: Slovak (c_schmitz) +#Updated translation: Spanish (es) (kadejo) +#Updated translation: Turkish by GCI participant Mtmecax (c_schmitz) +#Updated translations: Backported relevant translations from the Yii version (c_schmitz) +-Fixed issue #5587: Unable to take ranking questions on Android phone browsers (tpartner) +-Fixed issue: If SMTP sending fails due to invalid domain all following invitations in the same batch fail too if using SMTP (c_schmitz) + +Changes from 1.91+ (build 11343) to 1.91+ (build 11379) Nov 16, 2011 +-Fixed issue #5580: conditions don't work when using slider with emoticons and evaluation is done on the same page (lemeur) +-Fixed issue #5570: INSERTANS does not return other comment in multiple questions with Other activated (c_schmitz) +-Fixed issue #5574: Error in printable survey with Postgres/MSSQL (c_schmitz) +-Fixed issue #5576: Quick-translation adds backslashes before quotes and double-quotes when magic_quotes are activated (c_schmitz) +-Fixed issue #5578: $sitename not loaded (c_schmitz) +-Fixed issue: Printable survey was not displaying 'Other' when other was selected as a condition (jcleeland) +-Fixed issue: Languages in language changer select box were not sorted by the current language (c_schmitz) +-Fixed issue: Memory issue in integrity check (c_schmitz) +-Fixed issue: XSS injection due to improper quoting in tool tips - thanks for reporting to Joshua Tiago via Secunia Vulnerability Coordination Reward Program (SVCRP) (c_schmitz) + + 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) @@ -380,11 +1007,11 @@ Changes from 1.91+ (build 10168) to 1.91+ (build 10202) Changes from 1.91+ (build 10120) to 1.91+ (build 10168) #Updated translation: French (b00z00) -#Updated translation: Czech by Vladimír Braun (c_schmitz) +#Updated translation: Czech by Vladimír Braun (c_schmitz) #Updated translation: French by Frederic Villerot (c_schmitz) #Updated translation: German (c_schmitz) #Updated translation: German Informal (c_schmitz) -#Updated translation: Icelandic by Jóhann Friðriksson (c_schmitz) +#Updated translation: Icelandic by Jóhann Friðriksson (c_schmitz) #Updated translation: Polish (elisa-ls) +New feature: Updated FCKeditor to CKEditor (c_schmitz) +New feature: Updated phpExcel to 1.7.6 (c_schmitz) @@ -419,13 +1046,13 @@ Changes from 1.91+ (build 10089) to 1.91+ (build 10120) -Fixed issue: No "Source" button in basic editor (tpartner) Changes from 1.91+ (build 10062) to 1.91+ (build 10089) -#Updated translation: Norwegian Nynorsk - kindly provided by Guttorm Flatabø (c_schmitz) +#Updated translation: Norwegian Nynorsk - kindly provided by Guttorm Flatabø (c_schmitz) #Updated translation : French (b00z00) #Updated translation: Czech - kindly provided by Vladimir Braun (c_schmitz) #Updated translation: German (c_schmitz) #Updated translation: German Informal (c_schmitz) -#Updated translation: Hungarian - kindly provided by Balázs Zoltán (c_schmitz) -#Updated translation: Norwegian Bokmal - kindly provided by Pål Monstad (c_schmitz) +#Updated translation: Hungarian - kindly provided by Balázs Zoltán (c_schmitz) +#Updated translation: Norwegian Bokmal - kindly provided by PÃ¥l Monstad (c_schmitz) -Fixed issue #4851: Translate button doesn't work in IE (tpartner) -Fixed issue #5150: Preview question; default answer not shown (c_schmitz) -Fixed issue #5157: Limit on 5 character in multiple answers with comments (c_schmitz) @@ -608,7 +1235,7 @@ Changes from 1.87+ (build 8472) to 1.87+ (build 8498)- Legend: # updated featur -Fixed issue #4192: Problem saving partially finished survey for the second time in MSSQL server (c_schmitz) -Fixed issue #4195: RTL language aligment problem in bluengrey template (c_schmitz) -Fixed issue #4199: Cookie path not set (c_schmitz) --Fixed issue 04188: Edit Response - Data Entry - Not working Dev corrected filling values automatically for Array (MultiFlexible)(Numbers) type questions (harsha_mora) +-Fixed issue 04188: Edit Response - Data Entry - Not working (harsha_mora) -Fixed the issue for Date type questions 04188 (harsha_mora) Changes from 1.87+ (build 8453) to 1.87+ (build 8472)- Legend: # updated feature, - bug fix @@ -643,7 +1270,7 @@ Changes from 1.87+ (build 6406) to 1.87+ (build 8429) - Legend: # updated featu #Updated language: Croatian (idobraca) #Updated language: French (b00z00) #Updated language: Italian (thanks to Cristina Fiorentini ) (gandalfar) -#Updated language: Portuguese, thanks to Rui Gouveia and Marco Mendonça (gandalfar) +#Updated language: Portuguese, thanks to Rui Gouveia and Marco Mendonça (gandalfar) #Updated language: Spanish (es) (kadejo) #Updated translation: German (c_schmitz) #Updated translation: German Informal (c_schmitz) @@ -832,8 +1459,8 @@ Changes from 1.87RC4 (build 8002) [29-11-2009] to 1.87RC5 (build 8151) - Legend: +New feature: Start/Expiry is now date and time (previously only date) (c_schmitz) #Updated feature: SPSS export now configurable for SPSS version - patch by Menno Dekker (c_schmitz) #Updated translation: Croatian (idobraca) -#Updated translation: Norwegian BokmÃ¥l (reidarok) -#Updated translation: Czech by Vladimír Braun (c_schmitz) +#Updated translation: Norwegian BokmÃ¥l (reidarok) +#Updated translation: Czech by Vladimír Braun (c_schmitz) #Updated translation: Dutch by Fred Dekkers & Han Velthuis (c_schmitz) #Updated translation: Dutch by Fred Dekkers (c_schmitz) #Updated translation: Dutch Informal by Han Velthuis (c_schmitz) @@ -912,7 +1539,7 @@ Changes from 1.87RC2 (build 7886) to 1.87RC3 (build 7996) [27-11-2009] - Legend: #Updated translation: Finnish by Tapio Nurminen #Updated translation: German (c_schmitz) #Updated translation: German Informal (c_schmitz) -#Updated translation: Norwegian BokmÃ¥l. By Reidar Øksnevad +#Updated translation: Norwegian BokmÃ¥l. By Reidar Øksnevad #Updated translation: Portuguese Brazilian by Yoshitake #Updated translation: Slovakian by Pavel Cerny #Updated translation: Spanish (kadejo) @@ -1193,7 +1820,7 @@ Changes from 1.85+ (build 7337) to 1.85+ (build 7393) [03-08-2009] - Legend: + n #Updated translation: Italian. (idobraca) #Updated translation: French. (b00z00) #Updated translation: Polish(elisa-ls) -#Updated translation: Slovak by Marek Hallér. (jaycburton) +#Updated translation: Slovak by Marek Hallér. (jaycburton) #Updated translation: Spanish (es) (kadejo) +New feature: CSS class for cells within array (flexible label) question type. This way cells within the table can have a background color assigned using CSS. (maziminke) -Fixed bug #03459: Using a "lower than" > character as code within label set leads to a save error in the end user survey form (jcleeland) @@ -1390,7 +2017,7 @@ Changes from 1.81 to 1.82 (build 6757) [2009/04/29] - Legend: + new feature, # u +New feature in group order - detects faulty group_order numbering and fixes before displaying groups (jcleeland) +New language translation: Sinhalese translation by Janaka Padukka (c_schmitz) #Updated Language: Czech (macduy) -#Updated Language: Hungarian - kindly provided by Miklós Kriván (c_schmitz) +#Updated Language: Hungarian - kindly provided by Miklós Kriván (c_schmitz) #Updated Language: Polish - kindly provided by Ela Lesinska (elisa) (c_schmitz) #Updated language: German & German (informal) (c_schmitz) #Updated language: German translation (c_schmitz) @@ -1588,10 +2215,10 @@ Updated translations: Updated Language: Galician language updated. By Carlos Neira Cortizas. (kadejo) Updated Language: Greek language updated. By Yiannos Katsirintakis. (kadejo) Updated Language: Italian. By Giovanni Chiozza. (kadejo) - Updated Language: Norwegian BokmÃ¥l. By Reidar Øksnevad. (kadejo) + Updated Language: Norwegian BokmÃ¥l. By Reidar Øksnevad. (kadejo) Updated Language: Polish (xqleg) - Updated Language: Portuguese Brazilian by Andréa Simões (c_schmitz) - Updated Language: Portuguese Brazilian by Flávio Veras (c_schmitz) + Updated Language: Portuguese Brazilian by Andréa Simões (c_schmitz) + Updated Language: Portuguese Brazilian by Flávio Veras (c_schmitz) Updated Language: Russian. By Pavel Tokarev. (kadejo) Updated Language: Serbian language updated. By Miroslav Jovanovic. (first in Cyrillic alphabet). (kadejo) Updated Language: Slovenian language update (gasper_koren) @@ -1812,7 +2439,7 @@ Feature Changes: -Applied changes to originals texts for better i18n compatibility by Hooman Mesgary (c_schmitz) Languages: --Added Icelandic translation kindly provided by Jóhann Friðriksson ( johannfr -i-t- arskoli -d-i-t- is ) +-Added Icelandic translation kindly provided by Jóhann Friðriksson ( johannfr -i-t- arskoli -d-i-t- is ) -Updated Albanian Language file by Eniel Ninka (e -d-o-t- ninka -a-t- univpm -d-o-t- it ) -Updated Basque Translation by inforbek13 --i-t-- eps -d-a-t- mondragon -d-a-t- edu -Updated Bulgarian translation by Alexander Simidchiev ($thissurvey['active']=='Y'), +'allowsave'=>($thissurvey['allowsave']=='Y'), +'anonymized'=>($thissurvey['anonymized']!='N'), +'assessments'=>($thissurvey['assessments']=='Y'), +'datestamp'=>($thissurvey['datestamp']=='Y'), +'deletenonvalues'=>(isset($deletenonvalues)? $deletenonvalues: 1), +'hyperlinkSyntaxHighlighting'=>(($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY), // TODO set this to true if in admin mode but not if running a survey +'ipaddr'=>($thissurvey['ipaddr']=='Y'), +'radix'=>$radix, +'refurl'=>(($thissurvey['refurl'] == "Y") ? $_SESSION['refurl'] : NULL), +'rooturl'=>(isset($rooturl) ? $rooturl : ''), +'savetimings'=>($thissurvey['savetimings'] == "Y"), +'surveyls_dateformat'=>(isset($thissurvey['surveyls_dateformat']) ? $thissurvey['surveyls_dateformat'] : 1), +'startlanguage'=>(isset($clang->langcode) ? $clang->langcode : $thissurvey['language']), +'target'=>(isset($uploaddir) ? "{$uploaddir}/surveys/{$thissurvey['sid']}/files/" : "/temp/{$thissurvey['sid']}/files"), +'tempdir'=>(isset($tempdir) ? $tempdir : '/temp/'), +'timeadjust'=>(isset($timeadjust) ? $timeadjust : 0), +'token'=>(isset($clienttoken) ? $clienttoken : NULL), +); //Security Checked: POST, GET, SESSION, REQUEST, returnglobal, DB $previewgrp = false; -if (isset($_REQUEST['action']) && ($_REQUEST['action']=='previewgroup')){ +if ( $surveyMode=='group' && isset($_REQUEST['action']) && ($_REQUEST['action']=='previewgroup')){ $previewgrp = true; } if (isset($_REQUEST['newtest'])) - if ($_REQUEST['newtest']=="Y") - setcookie("limesurvey_timers", "0"); -$show_empty_group = false; -if (!isset($homedir) || isset($_REQUEST['$homedir'])) {die("Cannot run this script directly");} + if ($_REQUEST['newtest']=="Y") + setcookie("limesurvey_timers", "0"); + $show_empty_group = false; if ($previewgrp) { - $_SESSION['prevstep'] = 1; - $_SESSION['maxstep'] = 0; + $_SESSION['prevstep'] = 1; + $_SESSION['maxstep'] = 0; } else { //RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ######################################## - if (!isset($_SESSION['step']) || !$_SESSION['step']) + if (!isset($_SESSION['step'])) // || !$_SESSION['step']) - don't do this for step 0, else rebuild the session { $totalquestions = buildsurveysession(); - $_SESSION['step'] = 0; - if(isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { - //If explicitply set, hide the welcome screen - $_SESSION['step'] = 1; - } + LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); +// $_SESSION['step'] = 0; + //if ($surveyMode == 'survey') { + // $move = "movenext"; // to force a call to NavigateForwards() + // } + // else if (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { + //If explicitply set, hide the welcome screen + // $_SESSION['step'] = 0; + $_SESSION['step'] = 1; + $move = "movenext"; + // } } if (!isset($_SESSION['totalsteps'])) {$_SESSION['totalsteps']=0;} if (!isset($_SESSION['maxstep'])) {$_SESSION['maxstep']=0;} - if (!isset($gl)) {$gl=array('null');} - $_SESSION['prevstep']=$_SESSION['step']; - //Move current step ########################################################################### - if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev']=='Y' || $thissurvey['allowjumps']=='Y')) + if (isset($_SESSION['LEMpostKey']) && isset($_POST['LEMpostKey']) && $_POST['LEMpostKey'] != $_SESSION['LEMpostKey']) { - $_SESSION['step'] = $thisstep-1; + // then trying to resubmit (e.g. Next, Previous, Submit) from a cached copy of the page + // Does not try to save anything from the page to the database + $moveResult = LimeExpressionManager::GetLastMoveResult(true); + if (isset($_POST['thisstep']) && isset($moveResult['seq']) && $_POST['thisstep'] == $moveResult['seq']) + { + // then pressing F5 or otherwise refreshing the current page, which is OK + $LEMskipReprocessing=true; + $move = "movenext"; // so will re-display the survey + } + else + { + // trying to use browser back buttons, which may be disallowed if no 'previous' button is present + $LEMskipReprocessing=true; + $move = "movenext"; // so will re-display the survey + $invalidLastPage=true; + $vpopup="\n"; + } } - if (isset($move) && $move == "movenext") + + if (!(isset($_POST['saveall']) || isset($_POST['saveprompt']) || isset($_POST['loadall']) || isset($_GET['sid']) || $LEMskipReprocessing || (isset($move) && (preg_match('/^changelang_/',$move))))) { - if ($_SESSION['step']==$thisstep) - $_SESSION['step'] = $thisstep+1; + $_SESSION['prevstep']=$_SESSION['step']; } - if (isset($move) && bIsNumericInt($move) && $thissurvey['allowjumps']=='Y') + if (!isset($_SESSION['prevstep'])) { - $move = (int)$move; - if ($move > 0 && (($move <= $_SESSION['step']) || (isset($_SESSION['maxstep']) && $move <= $_SESSION['maxstep']))) - $_SESSION['step'] = $move; + $_SESSION['prevstep']=-1; // this only happens on re-load + } + + if (isset($_SESSION['LEMtokenResume'])) + { + LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); + $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,false); // if late in the survey, will re-validate contents, which may be overkill + unset($_SESSION['LEMtokenResume']); + unset($_SESSION['LEMreload']); + } + else if (!$LEMskipReprocessing) + { + //Move current step ########################################################################### + if (isset($move) && $move == 'moveprev' && ($thissurvey['allowprev']=='Y' || $thissurvey['allowjumps']=='Y')) + { + $moveResult = LimeExpressionManager::NavigateBackwards(); + if ($moveResult['at_start']) { + $_SESSION['step']=0; + unset($moveResult); // so display welcome page again + } + } + if (isset($move) && $move == "movenext") + { + if (isset($_SESSION['LEMreload'])) + { + LimeExpressionManager::StartSurvey($thissurvey['sid'], $surveyMode, $surveyOptions, false,$LEMdebugLevel); + $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,false); // if late in the survey, will re-validate contents, which may be overkill + unset($_SESSION['LEMreload']); + } + else { + $moveResult = LimeExpressionManager::NavigateForwards(); + } + } + if (isset($move) && ($move == 'movesubmit')) + { + if ($surveyMode == 'survey') + { + $moveResult = LimeExpressionManager::NavigateForwards(); + } + else + { + // may be submitting from the navigation bar, in which case need to process all intervening questions + // in order to update equations and ensure there are no intervening relevant mandatory or relevant invalid questions + $moveResult = LimeExpressionManager::JumpTo($_SESSION['totalsteps']+1,false); + } + } + if (isset($move) && (preg_match('/^changelang_/',$move))) { + // jump to current step using new language, processing POST values + $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,true); // do process the POST data + } + if (isset($move) && bIsNumericInt($move) && $thissurvey['allowjumps']=='Y') + { + $move = (int)$move; + if ($move > 0 && (($move <= $_SESSION['step']) || (isset($_SESSION['maxstep']) && $move <= $_SESSION['maxstep']))) { + $moveResult = LimeExpressionManager::JumpTo($move,false); + } + } + if (!isset($moveResult) && !($surveyMode != 'survey' && $_SESSION['step'] == 0)) { + // Just in case not set via any other means, but don't do this if it is the welcome page + $moveResult = LimeExpressionManager::GetLastMoveResult(true); + $LEMskipReprocessing=true; + } + } + + if (isset($moveResult)) { + if ($moveResult['finished']==true) { + $move = 'movesubmit'; + } + else + { + $_SESSION['step']= $moveResult['seq']+1; // step is index base 1 + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); + } + if ($move == "movesubmit" && $moveResult['finished'] == false) { + // then there are errors, so don't finalize the survey + $move = "movenext"; // so will re-display the survey + $invalidLastPage=true; + } } // We do not keep the participant session anymore when the same browser is used to answer a second time a survey (let's think of a library PC for instance). // Previously we used to keep the session and redirect the user to the // submit page. - //if (isset($_SESSION['finished'])) {$move='movesubmit'; } - if ($_SESSION['step'] == 0) { + if ($surveyMode != 'survey' && $_SESSION['step'] == 0) { display_first_page(); exit; } @@ -77,67 +217,95 @@ else //CHECK IF ALL MANDATORY QUESTIONS HAVE BEEN ANSWERED ############################################ //First, see if we are moving backwards or doing a Save so far, and its OK not to check: - if ($allowmandbackwards==1 && ( - (isset($move) && ($move == "moveprev" || (is_int($move) && $_SESSION['prevstep'] == $_SESSION['maxstep']))) || - (isset($_POST['saveall']) && $_POST['saveall'] == $clang->gT("Save your responses so far")))) + if ( + (isset($move) && ($move == "moveprev" || (is_int($move) && $_SESSION['prevstep'] == $_SESSION['maxstep']) || $_SESSION['prevstep'] == $_SESSION['step'])) || + (isset($_POST['saveall']) && $_POST['saveall'] == $clang->gT("Save your responses so far"))) { - $backok="Y"; + if ($allowmandbackwards==1) { + $backok="Y"; + } + else + { + $backok="N"; + } } else { - $backok="N"; + $backok="N"; // NA, since not moving backwards + } + + if ($thissurvey['active'] == "Y" && isset($_POST['saveall'])) + { + // must do this here to process the POSTed values + //$moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false); // by jumping to current step, saves data so far + + //showsaveform(); // generates a form and exits, awaiting input + if(!tableExists('tokens_'.$surveyid) || $thissurvey['anonymized']=='Y' || (tableExists('tokens_'.$surveyid) && $thissurvey['tokenanswerspersistence'] == 'N' )) + { + $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,false,true); // by jumping to current step, saves data so far + //queXS Removal + //showsaveform(); + } + else + { + $moveResult = LimeExpressionManager::JumpTo($_SESSION['step'],false,true,false,false,true); // by jumping to current step, saves data so far + } + } + + if ($thissurvey['active'] == "Y" && isset($_POST['saveprompt'])) + { + // The response from the save form + // CREATE SAVED CONTROL RECORD USING SAVE FORM INFORMATION + $flashmessage = savedcontrol(); + + if (isset($errormsg) && $errormsg != "") + { + showsaveform(); // reshow the form if there is an error + } + + $moveResult = LimeExpressionManager::GetLastMoveResult(true); + $LEMskipReprocessing=true; + + // TODO - does this work automatically for token answer persistence? Used to be savedsilent() + } //Now, we check mandatory questions if necessary //CHECK IF ALL CONDITIONAL MANDATORY QUESTIONS THAT APPLY HAVE BEEN ANSWERED - $notanswered=addtoarray_single(checkmandatorys($move,$backok),checkconditionalmandatorys($move,$backok)); + global $notanswered; - //CHECK INPUT - $notvalidated=checkpregs($move,$backok); + if (isset($moveResult) && !$moveResult['finished']) + { + $unansweredSQList = $moveResult['unansweredSQs']; + if (strlen($unansweredSQList) > 0 && $backok != "N") { + $notanswered = explode('|',$unansweredSQList); + } + else { + $notanswered = array(); + } + + //CHECK INPUT + $invalidSQList = $moveResult['invalidSQs']; + if (strlen($invalidSQList) > 0 && $backok != "N") { + $notvalidated = explode('|',$invalidSQList); + } + else { + $notvalidated = array(); + } + } // CHECK UPLOADED FILES + // TMSW - Move this into LEM::NavigateForwards? $filenotvalidated = checkUploadedFileValidity($move, $backok); //SEE IF THIS GROUP SHOULD DISPLAY $show_empty_group = false; if ($_SESSION['step']==0) - $show_empty_group = true; - - if (isset($move) && $_SESSION['step'] != 0 && $move != "movesubmit") - { - while(isset($_SESSION['grouplist'][$_SESSION['step']-1]) && checkgroupfordisplay($_SESSION['grouplist'][$_SESSION['step']-1][0]) === false) - { - if ($_SESSION['prevstep'] > $_SESSION['step']) - { - $_SESSION['step']=$_SESSION['step']-1; - } - else - { - $_SESSION['step']=$_SESSION['step']+1; - } - if ($_SESSION['step']>$_SESSION['totalsteps']) - { - // We are skipping groups, but we moved 'off' the last group. - // Now choose to implement an implicit submit (old behaviour), - // or create an empty page giving the user the explicit option to submit. - if (isset($show_empty_group_if_the_last_group_is_hidden) && $show_empty_group_if_the_last_group_is_hidden == true) - { - - $show_empty_group = true; - break; - } else - { - $move = "movesubmit"; - submitanswer(); // complete this answer (submitdate) - break; - } - } - } - } + $show_empty_group = true; //SUBMIT ############################################################################### - if ((isset($move) && $move == "movesubmit") && (!isset($notanswered) || !$notanswered) && (!isset($notvalidated) || !$notvalidated ) && (!isset($filenotvalidated) || !$filenotvalidated)) + if ((isset($move) && $move == "movesubmit")) { setcookie ("limesurvey_timers", "", time() - 3600);// remove the timers cookies if ($thissurvey['refurl'] == "Y") @@ -155,11 +323,6 @@ else { $assessments = doAssessment($surveyid); } - $thissurvey['surveyls_url']=dTexts::run($thissurvey['surveyls_url']); - if($thissurvey['printanswers'] != 'Y') - { - killSession(); - } sendcacheheaders(); doHeader(); @@ -177,10 +340,11 @@ else /*echo "
    ";print_r($_SESSION);echo "
    "; for($i = 1; isset($_SESSION['files'][$i]); $i++) { - unlink('upload/tmp/'.$_SESSION['files'][$i]['filename']); + unlink('upload/tmp/'.$_SESSION['files'][$i]['filename']); } */ - $completed = $thissurvey['surveyls_endtext']; + // can't kill session before end message, otherwise INSERTANS doesn't work. + $completed = templatereplace($thissurvey['surveyls_endtext']); $completed .= "
    ".$clang->gT("Did Not Save")."

    \n\n"; $completed .= $clang->gT("Your survey responses have not been recorded. This survey is not yet active.")."

    \n"; if ($thissurvey['printanswers'] == 'Y') @@ -189,6 +353,10 @@ else // in other cases the session is cleared at submit time $completed .= "".$clang->gT("Clear Responses")."

    \n"; } + if($thissurvey['printanswers'] != 'Y') + { + killSession(); + } } else //THE FOLLOWING DEALS WITH SUBMITTING ANSWERS AND COMPLETING AN ACTIVE SURVEY { @@ -200,8 +368,8 @@ else //Before doing the "templatereplace()" function, check the $thissurvey['url'] //field for limereplace stuff, and do transformations! - $thissurvey['surveyls_url']=dTexts::run($thissurvey['surveyls_url']); $thissurvey['surveyls_url']=passthruReplace($thissurvey['surveyls_url'], $thissurvey); + $thissurvey['surveyls_url']=templatereplace($thissurvey['surveyls_url']); // to do INSERTANS substitutions $content=''; $content .= templatereplace(file_get_contents("$thistpl/startpage.pstpl")); @@ -231,7 +399,6 @@ else $content .= templatereplace(file_get_contents("$thistpl/startpage.pstpl")); - //echo $thissurvey['url']; //Check for assessments if ($thissurvey['assessments']== "Y") { @@ -250,7 +417,7 @@ else } else { - $completed = $thissurvey['surveyls_endtext']; + $completed = templatereplace($thissurvey['surveyls_endtext']); } // Link to Print Answer Preview ********** @@ -269,7 +436,7 @@ else if ($thissurvey['publicstatistics']=='Y') { $completed .= "

    " - ."" + ."" .$clang->gT("View the statistics for this survey.") ."
    \n"; } @@ -283,27 +450,25 @@ else { //Automatically redirect the page to the "url" setting for the survey - $url = $thissurvey['surveyls_url']; - $url = dTexts::run($thissurvey['surveyls_url']); + $url = templatereplace($thissurvey['surveyls_url']); // TODO - check safety of this - provides access to any replacement value $url = passthruReplace($url, $thissurvey); $url = str_replace("{SAVEDID}",$saved_id, $url); // to activate the SAVEDID in the END URL $url = str_replace("{TOKEN}",$clienttoken, $url); // to activate the TOKEN in the END URL $url = str_replace("{SID}", $surveyid, $url); // to activate the SID in the END URL $url = str_replace("{LANG}", $clang->getlangcode(), $url); // to activate the LANG in the END URL - //queXS Addition - include_once("quexs.php"); - $quexs_url = get_start_interview_url(); - $url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url); - - $end_url = get_end_interview_url(); - $url = str_replace("{ENDINTERVIEWURL}", $end_url, $url); + //queXS Addition + include_once("quexs.php"); + $quexs_url = get_start_interview_url(); + $url = str_replace("{STARTINTERVIEWURL}", $quexs_url, $url); + + $end_url = get_end_interview_url(); + $url = str_replace("{ENDINTERVIEWURL}", $end_url, $url); header("Location: {$url}"); } - //if($thissurvey['printanswers'] != 'Y' && $thissurvey['usecookie'] != 'Y' && $tokensexist !=1) if($thissurvey['printanswers'] != 'Y') { killSession(); @@ -316,12 +481,20 @@ else echo templatereplace(file_get_contents("$thistpl/completed.pstpl")); echo "\n
    \n"; + if ((($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING)) { + echo LimeExpressionManager::GetDebugTimingMessage(); + } + if ((($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY)) { + echo "
    Group/Question Validation Results:".$moveResult['message']."
    \n"; + } echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); exit; } } +// IF GOT THIS FAR, THEN DISPLAY THE ACTIVE GROUP OF QUESTIONSs + //SEE IF $surveyid EXISTS #################################################################### if ($surveyexists <1) { @@ -336,22 +509,30 @@ if ($surveyexists <1) //GET GROUP DETAILS -if ($previewgrp) +if ($surveyMode == 'group' && $previewgrp) { - setcookie("limesurvey_timers", "0"); - $_SESSION['step'] = $_REQUEST['gid']+1; + setcookie("limesurvey_timers", "0"); + $_gid = sanitize_int($_REQUEST['gid']); - foreach($_SESSION['grouplist'] as $index=>$group) - { - if ($group[0]==$_REQUEST['gid']){ - $grouparrayno = $index; - break; - } + LimeExpressionManager::StartSurvey($thissurvey['sid'], 'group', $surveyOptions, false,$LEMdebugLevel); + $gseq = LimeExpressionManager::GetGroupSeq($_gid); + if ($gseq == -1) { + echo $clang->gT('Invalid group number for this survey: ') . $_gid; + exit; + } + $moveResult = LimeExpressionManager::JumpTo($gseq+1,true); + if (is_null($moveResult)) { + echo $clang->gT('This group contains no questions. You must add questions to this group before you can preview it'); + exit; + } + if (isset($moveResult)) { + $_SESSION['step']= $moveResult['seq']+1; // step is index base 1? } - $gid=$_SESSION['grouplist'][$grouparrayno][0]; - $groupname=$_SESSION['grouplist'][$grouparrayno][1]; - $groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); + $gid = $stepInfo['gid']; + $groupname = $stepInfo['gname']; + $groupdescription = $stepInfo['gtext']; } else { @@ -361,17 +542,15 @@ else $groupname=$clang->gT("Submit your answers"); $groupdescription=$clang->gT("There are no more questions. Please press the button to finish this survey."); } - else - { - $grouparrayno=$_SESSION['step']-1; - $gid=$_SESSION['grouplist'][$grouparrayno][0]; - $groupname=$_SESSION['grouplist'][$grouparrayno][1]; - $groupdescription=$_SESSION['grouplist'][$grouparrayno][2]; - } + else if ($surveyMode != 'survey') + { + $stepInfo = LimeExpressionManager::GetStepIndexInfo($moveResult['seq']); + $gid = $stepInfo['gid']; + $groupname = $stepInfo['gname']; + $groupdescription = $stepInfo['gtext']; + } } -//Setup an inverted fieldnamesInfo for quick lookup of field answers. -$aFieldnamesInfoInv = aArrayInvert($_SESSION['fieldnamesInfo']); if ($_SESSION['step'] > $_SESSION['maxstep']) { $_SESSION['maxstep'] = $_SESSION['step']; @@ -381,103 +560,93 @@ if ($_SESSION['step'] > $_SESSION['maxstep']) //PRESENT SURVEY //****************************************************************************************************** +$okToShowErrors = (!$previewgrp && (isset($invalidLastPage) || $_SESSION['prevstep'] == $_SESSION['step'])); -require_once("qanda.php"); //This should be qanda.php when finished +require_once("qanda.php"); +//store id's of all the question in $idlist array. +$idlist = array(); //Iterate through the questions about to be displayed: -$mandatorys=array(); -$mandatoryfns=array(); -$conmandatorys=array(); -$conmandatoryfns=array(); -$conditions=array(); $inputnames=array(); - -$qtypesarray = array(); - -$qnumber = 0; - -foreach ($_SESSION['fieldarray'] as $key=>$ia) -{ - $qtypesarray[$ia[1]] = $ia[4]; - ++$qnumber; - $ia[9] = $qnumber; // incremental question count; - - if ((isset($ia[10]) && $ia[10] == $gid) || (!isset($ia[10]) && $ia[5] == $gid)) +if (isset($_SESSION['grouplist'])) + foreach ($_SESSION['grouplist'] as $gl) { - if(IsSet($hideQuestion[$ia[0]]) && $hideQuestion[$ia[0]]==true){ - continue; + $gid = $gl[0]; + $qnumber = 0; + + if ($surveyMode != 'survey') + { + $onlyThisGID = $stepInfo['gid']; + if ($onlyThisGID != $gid) + { + continue; + } } - $qidattributes=getQuestionAttributes($ia[0]); - if ($qidattributes===false || $qidattributes['hidden']==1) { - // Should we really skip the question here, maybe the result won't be stored if we do that - continue; - } - // Following line DISABLED BY lemeur - // It prevents further calls to checkquestionfordisplay if using PREVIOUS button - // from the LimeSurvey Navigator Toolbar - // $_SESSION['fieldarray'][$key][7]='N'; + // TMSW - could iterate through LEM::currentQset instead + foreach ($_SESSION['fieldarray'] as $key => $ia) + { + ++$qnumber; + $ia[9] = $qnumber; // incremental question count; - //Get the answers/inputnames - list($plus_qanda, $plus_inputnames)=retrieveAnswers($ia); - if ($plus_qanda) - { - $plus_qanda[] = $ia[4]; - $plus_qanda[] = $ia[6]; // adds madatory identifyer for adding mandatory class to question wrapping div - $qanda[]=$plus_qanda; - } - if ($plus_inputnames) - { - $inputnames = addtoarray_single($inputnames, $plus_inputnames); - } + if ((isset($ia[10]) && $ia[10] == $gid) || (!isset($ia[10]) && $ia[5] == $gid)) + { + if ($surveyMode == 'question' && $ia[0] != $stepInfo['qid']) + { + continue; + } + $qidattributes = getQuestionAttributes($ia[0], $ia[4]); + if ($ia[4] != '*' && ($qidattributes === false || $qidattributes['hidden'] == 1)) + { + continue; + } - //Display the "mandatory" popup if necessary - if (isset($notanswered)) - { - list($mandatorypopup, $popup)=mandatory_popup($ia, $notanswered); - } + //Get the answers/inputnames + // TMSW - can content of retrieveAnswers() be provided by LEM? Review scope of what it provides. + // TODO - retrieveAnswers is slow - queries database separately for each question. May be fixed in _CI or _YII ports, so ignore for now + list($plus_qanda, $plus_inputnames) = retrieveAnswers($ia); - //Display the "validation" popup if necessary - if (isset($notvalidated)) - { - list($validationpopup, $vpopup)=validation_popup($ia, $notvalidated); - } + //can eliminate extra space for these 2 arrays if $_SESSION['fieldmap'] is used directly! - // Display the "file validation" popup if necessary - if (isset($filenotvalidated)) - { - list($filevalidationpopup, $fpopup) = file_validation_popup($ia, $filenotvalidated); - } + $idlist[] = $ia[1]; + if ($plus_qanda) + { + $plus_qanda[] = $ia[4]; + $plus_qanda[] = $ia[6]; // adds madatory identifyer for adding mandatory class to question wrapping div + $qanda[] = $plus_qanda; + } + if ($plus_inputnames) + { + $inputnames = addtoarray_single($inputnames, $plus_inputnames); + } - //Get list of mandatory questions - list($plusman, $pluscon)=create_mandatorylist($ia); - if ($plusman !== null) - { - list($plus_man, $plus_manfns)=$plusman; - $mandatorys=addtoarray_single($mandatorys, $plus_man); - $mandatoryfns=addtoarray_single($mandatoryfns, $plus_manfns); - } - if ($pluscon !== null) - { - list($plus_conman, $plus_conmanfns)=$pluscon; - $conmandatorys=addtoarray_single($conmandatorys, $plus_conman); - $conmandatoryfns=addtoarray_single($conmandatoryfns, $plus_conmanfns); - } + //Display the "mandatory" popup if necessary + // TMSW - get question-level error messages - don't call **_popup() directly + if ($okToShowErrors && $stepInfo['mandViolation']) + { + list($mandatorypopup, $popup) = mandatory_popup($ia, $notanswered); + } - //Build an array containing the conditions that apply for this page - $plus_conditions=retrieveConditionInfo($ia); //Returns false if no conditions - if ($plus_conditions) - { - $conditions = addtoarray_single($conditions, $plus_conditions); - } - } - if ($ia[4] == "|") - $upload_file = TRUE; -} //end iteration + //Display the "validation" popup if necessary + if ($okToShowErrors && !$stepInfo['valid']) + { + list($validationpopup, $vpopup) = validation_popup($ia, $notvalidated); + } -if (isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == 'Y') + // Display the "file validation" popup if necessary + if ($okToShowErrors && isset($filenotvalidated)) + { + list($filevalidationpopup, $fpopup) = file_validation_popup($ia, $filenotvalidated); + } + } + if ($ia[4] == "|") + $upload_file = TRUE; + } //end iteration +} + +if ($surveyMode != 'survey' && isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == 'Y') { if ($show_empty_group) { @@ -488,7 +657,9 @@ if (isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == 'Y') $percentcomplete = makegraph($_SESSION['step'], $_SESSION['totalsteps']); } } -$languagechanger = makelanguagechanger(); +if (!(isset($languagechanger) && strlen($languagechanger) > 0) && function_exists('makelanguagechanger')) { + $languagechanger = makelanguagechanger(); +} //READ TEMPLATES, INSERT DATA AND PRESENT PAGE sendcacheheaders(); @@ -498,15 +669,11 @@ if (isset($popup)) {echo $popup;} if (isset($vpopup)) {echo $vpopup;} if (isset($fpopup)) {echo $fpopup;} -//foreach(file("$thistpl/startpage.pstpl") as $op) -//{ -// echo templatereplace($op); -//} echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); //ALTER PAGE CLASS TO PROVIDE WHOLE-PAGE ALTERNATION -if ($_SESSION['step'] != $_SESSION['prevstep'] || - (isset($_SESSION['stepno']) && $_SESSION['stepno'] % 2)) +if ($surveyMode != 'survey' && $_SESSION['step'] != $_SESSION['prevstep'] || +(isset($_SESSION['stepno']) && $_SESSION['stepno'] % 2)) { if (!isset($_SESSION['stepno'])) $_SESSION['stepno'] = 0; if ($_SESSION['step'] != $_SESSION['prevstep']) ++$_SESSION['stepno']; @@ -522,745 +689,218 @@ $hiddenfieldnames=implode("|", $inputnames); if (isset($upload_file) && $upload_file) echo " - - \n"; + + \n"; else echo " - - \n"; + + \n"; echo sDefaultSubmitHandler(); -// <-- END FEATURE - SAVE +if ($surveyMode == 'survey') +{ +// if(isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') { + //Hide the welcome screen if explicitly set + // } else { + // echo templatereplace(file_get_contents("$thistpl/welcome.pstpl"))."\n"; + // } + + if ($thissurvey['anonymized'] == "Y") + { + echo templatereplace(file_get_contents("$thistpl/privacy.pstpl"))."\n"; + } +} // <-- START THE SURVEY --> - -echo templatereplace(file_get_contents("{$thistpl}/survey.pstpl")); +if ($surveyMode != 'survey') { + echo templatereplace(file_get_contents("{$thistpl}/survey.pstpl")); +} // the runonce element has been changed from a hidden to a text/display:none one // in order to workaround an not-reproduced issue #4453 (lemeur) echo " - - \n\n"; // End checkconditions javascript function - -echo "\n\n\n"; -echo templatereplace(file_get_contents("$thistpl/startgroup.pstpl")); -echo "\n"; - -if ($groupdescription) -{ - echo templatereplace(file_get_contents("$thistpl/groupdescription.pstpl")); -} -echo "\n"; +print << + +END; //Display the "mandatory" message on page if necessary -if (isset($showpopups) && $showpopups == 0 && isset($notanswered) && $notanswered == true) +if (isset($showpopups) && $showpopups == 0 && $stepInfo['mandViolation'] && $okToShowErrors) { echo "

    " . $clang->gT("One or more mandatory questions have not been answered. You cannot proceed until these have been completed.") . "

    "; } //Display the "validation" message on page if necessary -if (isset($showpopups) && $showpopups == 0 && isset($notvalidated) && $notvalidated == true) +if (isset($showpopups) && $showpopups == 0 && !$stepInfo['valid'] && $okToShowErrors) { echo "

    " . $clang->gT("One or more questions have not been answered in a valid manner. You cannot proceed until these answers are valid.") . "

    "; } //Display the "file validation" message on page if necessary -if (isset($showpopups) && $showpopups == 0 && isset($filenotvalidated) && $filenotvalidated == true) +if (isset($showpopups) && $showpopups == 0 && isset($filenotvalidated) && $filenotvalidated == true && $okToShowErrors) { echo "

    " . $clang->gT("One or more uploaded files are not in proper format/size. You cannot proceed until these files are valid.") . "

    "; } -echo "\n\n\n"; -if (isset($qanda) && is_array($qanda)) + +if (isset($_SESSION['grouplist'])) + $_gseq = -1; +foreach ($_SESSION['grouplist'] as $gl) { - foreach ($qanda as $qa) + $gid=$gl[0]; + ++$_gseq; + $groupname=$gl[1]; + $groupdescription=$gl[2]; + + if ($surveyMode != 'survey' && $gid != $onlyThisGID) { + continue; + } + + echo "\n\n\n"; + echo "\n\n\n"; } -echo "\n\n\n"; -echo templatereplace(file_get_contents("$thistpl/endgroup.pstpl")); -echo "\n"; + +LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing); +echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript(); +LimeExpressionManager::FinishProcessingPage(); if (!$previewgrp){ $navigator = surveymover(); //This gets globalised in the templatereplace function @@ -1315,35 +971,60 @@ if (!$previewgrp){ } - if($thissurvey['allowjumps']=='Y') + if($surveyMode != 'survey' && $thissurvey['allowjumps']=='Y') { echo "\n\n\n"; echo '

    ' . $clang->gT("Question index") . '

    '; + + $stepIndex = LimeExpressionManager::GetStepIndexInfo(); + $lastGseq=-1; + $gseq = -1; + $grel=true; for($v = 0, $n = 0; $n != $_SESSION['maxstep']; ++$n) { - $g = $_SESSION['grouplist'][$n]; - if(!checkgroupfordisplay($g[0])) - continue; - - $sText = FlattenText($g[1]); - - $bGAnsw = true; - foreach($_SESSION['fieldarray'] as $ia) - { - if($ia[5] != $g[0]) - continue; - - $qidattributes=getQuestionAttributes($ia[0], $ia[4]); - if($qidattributes['hidden']==1 || !checkquestionfordisplay($ia[0])) - continue; - - if (!bCheckQuestionForAnswer($ia[1], $aFieldnamesInfoInv)) - { - $bGAnsw = false; - break; - } + if (!isset($stepIndex[$n])) { + continue; // this is an invalid group - skip it } + $stepInfo = $stepIndex[$n]; + + if ($surveyMode == 'question') + { + if ($lastGseq != $stepInfo['gseq']) { + // show the group label + ++$gseq; + $g = $_SESSION['grouplist'][$gseq]; + $grel = !LimeExpressionManager::GroupIsIrrelevantOrHidden($gseq); + if ($grel) + { + $gtitle = LimeExpressionManager::ProcessString($g[1]); + echo '

    ' . FlattenText($gtitle) . "

    "; + } + $lastGseq = $stepInfo['gseq']; + } + if (!$grel || !$stepInfo['show']) + continue; + $q = $_SESSION['fieldarray'][$n]; + } + else + { + ++$gseq; + if (!$stepInfo['show']) + continue; + $g = $_SESSION['grouplist'][$gseq]; + } + + if ($surveyMode == 'group') + { + $indexlabel = LimeExpressionManager::ProcessString($g[1]); + } + else + { + $indexlabel = LimeExpressionManager::ProcessString($q[3]); + } + + $sText = (($surveyMode == 'group') ? FlattenText($indexlabel) : FlattenText($indexlabel)); + $bGAnsw = !$stepInfo['anyUnanswered']; ++$v; @@ -1357,64 +1038,37 @@ if (!$previewgrp){ if($_SESSION['maxstep'] == $_SESSION['totalsteps']) { echo "\n"; + . $clang->gT("Submit")." ' name='move2' />\n"; } echo '
    '; /* Can be replaced by php or in global js */ - echo "\n"; - echo "\n"; - } - - echo "\n"; //This can go eventually - it's redundent for debugging - - if (isset($conditions) && is_array($conditions) && count($conditions) != 0) - { - //if conditions exist, create hidden inputs for 'previously' answered questions - // Note that due to move 'back' possibility, there may be answers from next pages - // However we make sure that no answer from this page are inserted here - foreach (array_keys($_SESSION) as $SESak) - { - if (in_array($SESak, $_SESSION['insertarray']) && !in_array($SESak, $inputnames)) - { - echo "\n"; - } - } - } - //SOME STUFF FOR MANDATORY QUESTIONS - if (remove_nulls_from_array($mandatorys)) - { - $mandatory=implode("|", remove_nulls_from_array($mandatorys)); - echo "\n"; - } - if (remove_nulls_from_array($conmandatorys)) - { - $conmandatory=implode("|", remove_nulls_from_array($conmandatorys)); - echo "\n"; - } - if (remove_nulls_from_array($mandatoryfns)) - { - $mandatoryfn=implode("|", remove_nulls_from_array($mandatoryfns)); - echo "\n"; - } - if (remove_nulls_from_array($conmandatoryfns)) - { - $conmandatoryfn=implode("|", remove_nulls_from_array($conmandatoryfns)); - echo "\n"; + echo "\n"; + echo "\n"; } echo "\n"; echo "\n"; echo "\n"; + $_SESSION['LEMpostKey'] = mt_rand(); + echo "\n"; + if (isset($token) && !empty($token)) { echo "\n\n"; } } + +if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) { + echo LimeExpressionManager::GetDebugTimingMessage(); +} +if (($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) { + echo "
    Group/Question Validation Results:".$moveResult['message']."
    \n"; +} echo "\n"; echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); diff --git a/include/limesurvey/htaccess.txt b/include/limesurvey/htaccess.txt index 8971d27a..1e98e0c8 100644 --- a/include/limesurvey/htaccess.txt +++ b/include/limesurvey/htaccess.txt @@ -1,18 +1,18 @@ -## MOD_REWRITE for LimeSurvey ## - - RewriteEngine On - - ## DONT TOUCH ANYTHING ## - # Only with survey code - # http://server.fr/123456 - RewriteRule ^([0-9]+)/*$ index.php?sid=$1 [L,QSA] - - # Survey code + Lang : http://server.fr/123456/lang-fr - RewriteRule ^([0-9]+)/lang-([^/]*)/*$ index.php?sid=$1&lang=$2 [L,QSA] - - # Survey code + Lang + Token : http://server.fr/123456/lang-fr/tk-sdlfkjozeiru - RewriteRule ^([0-9]+)/lang-([^/]*)/tk-([^/]*)/*$ index.php?sid=$1&lang=$2&token=$3 [L,QSA] - - # Survey code + Token : http://server.fr/123456/tk-sdlfkjozeiru - RewriteRule ^([0-9]+)/tk-([^/]*)/*$ index.php?sid=$1&token=$2 [L,QSA] - +## MOD_REWRITE for LimeSurvey ## + + RewriteEngine On + + ## DONT TOUCH ANYTHING ## + # Only with survey code + # http://server.fr/123456 + RewriteRule ^([0-9]+)/*$ index.php?sid=$1 [L,QSA] + + # Survey code + Lang : http://server.fr/123456/lang-fr + RewriteRule ^([0-9]+)/lang-([^/]*)/*$ index.php?sid=$1&lang=$2 [L,QSA] + + # Survey code + Lang + Token : http://server.fr/123456/lang-fr/tk-sdlfkjozeiru + RewriteRule ^([0-9]+)/lang-([^/]*)/tk-([^/]*)/*$ index.php?sid=$1&lang=$2&token=$3 [L,QSA] + + # Survey code + Token : http://server.fr/123456/tk-sdlfkjozeiru + RewriteRule ^([0-9]+)/tk-([^/]*)/*$ index.php?sid=$1&token=$2 [L,QSA] + diff --git a/include/limesurvey/images/expressionManager_30.png b/include/limesurvey/images/expressionManager_30.png new file mode 100644 index 00000000..64e7028d Binary files /dev/null and b/include/limesurvey/images/expressionManager_30.png differ diff --git a/include/limesurvey/images/flags/zh-Hant-TW.png b/include/limesurvey/images/flags/zh-Hant-TW.png index 01ca7909..f4678877 100644 Binary files a/include/limesurvey/images/flags/zh-Hant-TW.png and b/include/limesurvey/images/flags/zh-Hant-TW.png differ diff --git a/include/limesurvey/images/quality_assurance.png b/include/limesurvey/images/quality_assurance.png new file mode 100644 index 00000000..129fbb1c Binary files /dev/null and b/include/limesurvey/images/quality_assurance.png differ diff --git a/include/limesurvey/images/screenshots/EQUATION.png b/include/limesurvey/images/screenshots/EQUATION.png new file mode 100644 index 00000000..a1090a93 Binary files /dev/null and b/include/limesurvey/images/screenshots/EQUATION.png differ diff --git a/include/limesurvey/index.php b/include/limesurvey/index.php index 8f2b5cf7..ebb255ce 100644 --- a/include/limesurvey/index.php +++ b/include/limesurvey/index.php @@ -1,17 +1,17 @@ FetchRow(); - $stg_SessionName=$usrow['stg_value']; - if ($surveyid) - { - @session_name($stg_SessionName.'-runtime-'.$surveyid); - } - else - { - @session_name($stg_SessionName.'-runtime-publicportal'); - } -} -else -{ - session_name("LimeSurveyRuntime-$surveyid"); -} -session_set_cookie_params(0,$relativeurl.'/'); -if (!isset($_SESSION) || empty($_SESSION)) // the $_SESSION variable can be empty if register_globals is on - @session_start(); - - - // First check if survey is active // if not: copy some vars from the admin session // to a new user session @@ -107,15 +79,133 @@ if ($surveyid) $surveyexists=true; if($aRow['active']=='Y') { - $issurveyactive=true; + $issurveyactive=true; + } } -} else { $surveyexists=false; } } +// Compute the Session name +// Session name is based: +// * on this specific limesurvey installation (Value SessionName in DB) +// * on the surveyid (from Get or Post param). If no surveyid is given we are on the public surveys portal +$usquery = "SELECT stg_value FROM ".db_table_name("settings_global")." where stg_name='SessionName'"; +$usresult = db_execute_assoc($usquery,'',true); //Checked +if ($usresult) +{ + $usrow = $usresult->FetchRow(); + $stg_SessionName=$usrow['stg_value']; + if ($surveyid && $surveyexists) + { + @session_name($stg_SessionName.'-runtime-'.$surveyid); + } + else + { + @session_name($stg_SessionName.'-runtime-publicportal'); + } +} +else +{ + session_name("LimeSurveyRuntime-$surveyid"); +} +session_set_cookie_params(0,$relativeurl.'/'); +if (!isset($_SESSION) || empty($_SESSION)) // the $_SESSION variable can be empty if register_globals is on + @session_start(); + +if ( $embedded && $embedded_inc != '' ) +{ + require_once( $embedded_inc ); +} + +//CHECK FOR REQUIRED INFORMATION (sid) +if (!$surveyid || !$surveyexists) +{ + if(isset($_GET['lang'])) + { + $baselang = sanitize_languagecode($_GET['lang']); + } + elseif (!isset($baselang)) + { + $baselang=$defaultlang; + } + $clang = new limesurvey_lang($baselang); + $languagechanger = makelanguagechanger(); + //Find out if there are any publicly available surveys + $query = "SELECT a.sid, b.surveyls_title, a.publicstatistics,a.language + FROM ".db_table_name('surveys')." AS a + INNER JOIN ".db_table_name('surveys_languagesettings')." AS b + ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language ) + WHERE surveyls_survey_id=a.sid + AND surveyls_language=a.language + AND a.active='Y' + AND a.listpublic='Y' + AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null)) + AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) + ORDER BY surveyls_title"; + $result = db_execute_assoc($query,false,true) or die("Could not connect to database. If you try to install LimeSurvey please refer to the installation docs and/or contact the system administrator of this webpage."); //Checked + $list=array(); + if($result->RecordCount() > 0) + { + while($rows = $result->FetchRow()) + { + $sLinkLanguage=$rows['language']; + $result2 = db_execute_assoc("Select surveyls_title from ".db_table_name('surveys_languagesettings')." where surveyls_survey_id={$rows['sid']} and surveyls_language='$baselang'"); + if ($result2->RecordCount()) + { + $languagedetails=$result2->FetchRow(); + $rows['surveyls_title']=$languagedetails['surveyls_title']; + $sLinkLanguage=$baselang; + } + $link = "
  • \n"; + if ($rows['publicstatistics'] == 'Y') $link .= "(".$clang->gT('View statistics').")"; + $link .= "
  • \n"; + $list[]=$link; + } + } + if(count($list) < 1) + { + $list[]="
  • ".$clang->gT("No available surveys")."
  • "; + } + + if(!$surveyid) + { + $thissurvey['name']=$sitename; + $nosid=$clang->gT("You have not provided a survey identification number"); + } + else + { + $thissurvey['name']=$clang->gT("The survey identification number is invalid"); + $nosid=$clang->gT("The survey identification number is invalid"); + } + $surveylist=array( + "nosid"=>$clang->gT("You have not provided a survey identification number"), + "contact"=>sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$siteadminname,encodeEmail($siteadminemail)), + "listheading"=>$clang->gT("The following surveys are available:"), + "list"=>implode("\n",$list), + ); + + $thissurvey['templatedir']=$defaulttemplate; + + //A nice exit + sendcacheheaders(); + doHeader(); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); + + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/surveylist.pstpl")); + + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); + doFooter(); + exit; +} + if ($clienttoken != '' && isset($_SESSION['token']) && $clienttoken != $_SESSION['token']) { @@ -129,7 +219,7 @@ $clienttoken != $_SESSION['token']) sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/startpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("Token mismatch")."

    \n" @@ -138,7 +228,7 @@ $clienttoken != $_SESSION['token']) ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/endpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); doFooter(); exit; } @@ -155,7 +245,7 @@ if (isset($_SESSION['finished']) && $_SESSION['finished'] === true) sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/startpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("Previous session is set to be finished.")."

    \n" @@ -164,18 +254,18 @@ if (isset($_SESSION['finished']) && $_SESSION['finished'] === true) ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/endpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); doFooter(); exit; } $previewgrp = false; if (isset($_REQUEST['action']) && ($_REQUEST['action'] == 'previewgroup')){ - $rightquery="SELECT uid FROM {$dbprefix}survey_permissions WHERE sid=".db_quote($surveyid)." AND uid = ".db_quote($_SESSION['loginID'].' group by uid'); - $rightresult = db_execute_assoc($rightquery); - if ($rightresult->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) - { - $previewgrp = true; - } + $rightquery="SELECT uid FROM {$dbprefix}survey_permissions WHERE sid=".db_quote($surveyid)." AND uid = ".db_quote($_SESSION['loginID'].' group by uid'); + $rightresult = db_execute_assoc($rightquery); + if ($rightresult->RecordCount() > 0 || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) + { + $previewgrp = true; + } } if (($surveyid && @@ -300,7 +390,7 @@ $surveyPreview_require_Auth == true) && $previewgrp == false) sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/startpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("ERROR")."

    \n" @@ -309,7 +399,7 @@ $surveyPreview_require_Auth == true) && $previewgrp == false) ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/endpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); doFooter(); exit; } @@ -333,7 +423,7 @@ if (!isset($_SESSION['s_lang']) && (isset($move)) ) sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/startpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("ERROR")."

    \n" @@ -343,11 +433,17 @@ if (!isset($_SESSION['s_lang']) && (isset($move)) ) ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$standardtemplaterootdir/default/endpage.pstpl")); + echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); doFooter(); exit; }; +if (isset($move) && (preg_match('/^changelang_/',$move))) +{ + // Then changing language from the language changer + $_POST['lang'] = substr($_POST['move'],11); // since sanitizing $move removes hyphen in languages like de-informal +} + // Set the language of the survey, either from POST, GET parameter of session var if (isset($_POST['lang']) && $_POST['lang']!='') // this one comes from the language question { @@ -358,116 +454,30 @@ if (isset($_POST['lang']) && $_POST['lang']!='') // this one comes from the lan UpdateFieldArray(); // to refresh question titles and question text } else -if (isset($_GET['lang']) && $surveyid) -{ - $templang = sanitize_languagecode($_GET['lang']); - $clang = SetSurveyLanguage( $surveyid, $templang); - UpdateSessionGroupList($templang); // to refresh the language strings in the group list session variable - UpdateFieldArray(); // to refresh question titles and question text -} + if (isset($_GET['lang']) && $surveyid) + { + $templang = sanitize_languagecode($_GET['lang']); + $clang = SetSurveyLanguage( $surveyid, $templang); + UpdateSessionGroupList($templang); // to refresh the language strings in the group list session variable + UpdateFieldArray(); // to refresh question titles and question text + } + else + if (isset($_SESSION['s_lang'])) + { + $clang = SetSurveyLanguage( $surveyid, $_SESSION['s_lang']); + } + elseif (isset($surveyid) && $surveyid) + { + $baselang = GetBaseLanguageFromSurveyID($surveyid); + $clang = SetSurveyLanguage( $surveyid, $baselang); + } -if (isset($_SESSION['s_lang'])) -{ - $clang = SetSurveyLanguage( $surveyid, $_SESSION['s_lang']); -} -elseif (isset($surveyid) && $surveyid) -{ - $baselang = GetBaseLanguageFromSurveyID($surveyid); - $clang = SetSurveyLanguage( $surveyid, $baselang); -} -else -{ - $baselang=$defaultlang; -} - -if (isset($_REQUEST['embedded_inc'])) + if (isset($_REQUEST['embedded_inc'])) { safe_die('You cannot start this script directly'); } -//CHECK FOR REQUIRED INFORMATION (sid) -if (!$surveyid) -{ - if(isset($_GET['lang'])) - { - $baselang = sanitize_languagecode($_GET['lang']); - } - elseif (!isset($baselang)) - { - $baselang=$defaultlang; - } - $clang = new limesurvey_lang($baselang); - if(!isset($defaulttemplate)) - { - $defaulttemplate="default"; - } - $languagechanger = makelanguagechanger(); - //Find out if there are any publicly available surveys - $query = "SELECT a.sid, b.surveyls_title, a.publicstatistics - FROM ".db_table_name('surveys')." AS a - INNER JOIN ".db_table_name('surveys_languagesettings')." AS b - ON ( surveyls_survey_id = a.sid AND surveyls_language = a.language ) - WHERE surveyls_survey_id=a.sid - AND surveyls_language=a.language - AND a.active='Y' - AND a.listpublic='Y' - AND ((a.expires >= '".date("Y-m-d H:i")."') OR (a.expires is null)) - AND ((a.startdate <= '".date("Y-m-d H:i")."') OR (a.startdate is null)) - ORDER BY surveyls_title"; - $result = db_execute_assoc($query,false,true) or die("Could not connect to database. If you try to install LimeSurvey please refer to the installation docs and/or contact the system administrator of this webpage."); //Checked - $list=array(); - if($result->RecordCount() > 0) - { - while($rows = $result->FetchRow()) - { - $result2 = db_execute_assoc("Select surveyls_title from ".db_table_name('surveys_languagesettings')." where surveyls_survey_id={$rows['sid']} and surveyls_language='$baselang'"); - if ($result2->RecordCount()) - { - $languagedetails=$result2->FetchRow(); - $rows['surveyls_title']=$languagedetails['surveyls_title']; - } - $link = "
  • \n"; - if ($rows['publicstatistics'] == 'Y') $link .= "(".$clang->gT('View statistics').")"; - $link .= "
  • \n"; - $list[]=$link; - } - } - if(count($list) < 1) - { - $list[]="
  • ".$clang->gT("No available surveys")."
  • "; - } - $surveylist=array( - "nosid"=>$clang->gT("You have not provided a survey identification number"), - "contact"=>sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$siteadminname,encodeEmail($siteadminemail)), - "listheading"=>$clang->gT("The following surveys are available:"), - "list"=>implode("\n",$list), - ); - - $thissurvey['name']=$sitename; - $thissurvey['templatedir']=$defaulttemplate; - - //A nice exit - sendcacheheaders(); - doHeader(); - echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/startpage.pstpl")); - - echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/surveylist.pstpl")); - - echo templatereplace(file_get_contents(sGetTemplatePath($defaulttemplate)."/endpage.pstpl")); - doFooter(); - exit; -} - // Get token if (!isset($token)) { @@ -480,12 +490,10 @@ $thissurvey=getSurveyInfo($surveyid, $_SESSION['s_lang']); if (isset($_GET['newtest']) && $_GET['newtest'] == "Y") { - //Removes any existing timer cookies so timers will start again + //Removes any existing timer cookies so timers will start again setcookie ("limesurvey_timers", "", time() - 3600); } - - //SEE IF SURVEY USES TOKENS AND GROUP TOKENS $i = 0; //$tokensexist = 0; if ($surveyexists == 1 && tableExists('tokens_'.$thissurvey['sid'])) @@ -524,15 +532,15 @@ if ($thissurvey['expiry']!='' and date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); + echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("This survey is no longer available.")."

    \n" ."\t".sprintf($clang->gT("Please contact %s ( %s ) for further assistance."),$thissurvey['adminname'],$thissurvey['adminemail']).".

    \n" - ."\t

    \n" + ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); + echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); exit; } @@ -564,7 +572,7 @@ if (isset($_COOKIE[$cookiename]) && $_COOKIE[$cookiename] == "COMPLETE" && $this sendcacheheaders(); doHeader(); - echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); + echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); echo "\t
    \n" ."\t

    \n" ."\t".$clang->gT("Error")."

    \n" @@ -573,7 +581,7 @@ if (isset($_COOKIE[$cookiename]) && $_COOKIE[$cookiename] == "COMPLETE" && $this ."\t

    \n" ."\t
    \n"; - echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); + echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); exit; } @@ -610,22 +618,23 @@ if (isset($oldsid) && $oldsid && $oldsid != $surveyid) } -//queXS Removal -//if (isset($_GET['loadall']) && $_GET['loadall'] == "reload") -//{ -// if (returnglobal('loadname') && returnglobal('loadpass')) -// { -// $_POST['loadall']="reload"; -// } -//} +/* queXS Removal +if (isset($_GET['loadall']) && $_GET['loadall'] == "reload") +{ + if (returnglobal('loadname') && returnglobal('loadpass')) + { + $_POST['loadall']="reload"; + } +} +end queXS Removal */ //LOAD SAVED SURVEY if (isset($_POST['loadall']) && $_POST['loadall'] == "reload") { $errormsg=""; // if (loadname is not set) or if ((loadname is set) and (loadname is NULL)) - -/* queXS Removal + + /* queXS Removal if (!isset($loadname) || (isset($loadname) && ($loadname == null))) { @@ -650,19 +659,20 @@ if (isset($_POST['loadall']) && $_POST['loadall'] == "reload") } } -queXS Removal */ + end queXS Removal */ // Load session before loading the values from the saved data if (isset($_GET['loadall'])) { - buildsurveysession(); + $totalquestions = buildsurveysession(); } - $_SESSION['holdname']=$_POST['token']; //Session variable used to load answers every page. //queXS update - $_SESSION['holdpass']=$_POST['token']; //Session variable used to load answers every page. //queXS update + $_SESSION['holdname']=$_POST['token']; //Session variable used to load answers every page. + $_SESSION['holdpass']=$_POST['token']; //Session variable used to load answers every page. if ($errormsg == "") loadanswers(); - $move = "movecurrent"; //queXS Change + $move = "movecurrent"; + $_SESSION['LEMreload']=true; if ($errormsg) { @@ -670,13 +680,15 @@ queXS Removal */ } } -/* queXS Removal +/* queXS Removal + //Allow loading of saved survey if (isset($_POST['loadall']) && $_POST['loadall'] == $clang->gT("Load Unfinished Survey")) { require_once("load.php"); } -*/ + +end queXS Removal */ //Check if TOKEN is used for EVERY PAGE //This function fixes a bug where users able to submit two surveys/votes @@ -685,16 +697,16 @@ if (isset($_POST['loadall']) && $_POST['loadall'] == $clang->gT("Load Unfinished // this check is done in buildsurveysession and error message // could be more interresting there (takes into accound captcha if used) if ($tokensexist == 1 && isset($token) && $token && - isset($_SESSION['step']) && $_SESSION['step']>0 && db_tables_exist($dbprefix.'tokens_'.$surveyid)) +isset($_SESSION['step']) && $_SESSION['step']>0 && db_tables_exist($dbprefix.'tokens_'.$surveyid)) { - //check if tokens actually haven't been already used - $areTokensUsed = usedTokens(db_quote(trim(strip_tags(returnglobal('token'))))); - // check if token actually does exist - // check also if it is allowed to change survey after completion - if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { - $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' "; - } else { - $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' AND (completed = 'N' or completed='')"; + //check if tokens actually haven't been already used + $areTokensUsed = usedTokens(db_quote(trim(strip_tags(returnglobal('token'))))); + // check if token actually does exist + // check also if it is allowed to change survey after completion + if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { + $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' "; + } else { + $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' AND (completed = 'N' or completed='')"; } $tkresult = db_execute_num($tkquery); //Checked $tokendata = $tkresult->FetchRow(); @@ -717,16 +729,16 @@ if ($tokensexist == 1 && isset($token) && $token && ."\t\n"; echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); - killSession(); + killSession(); doFooter(); exit; -} + } } if ($tokensexist == 1 && isset($token) && $token && db_tables_exist($dbprefix.'tokens_'.$surveyid)) //check if token is in a valid time frame { - // check also if it is allowed to change survey after completion - if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { + // check also if it is allowed to change survey after completion + if ($thissurvey['alloweditaftercompletion'] == 'Y' ) { $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' "; } else { $tkquery = "SELECT * FROM ".db_table_name('tokens_'.$surveyid)." WHERE token='".db_quote($token)."' AND (completed = 'N' or completed='')"; @@ -754,7 +766,7 @@ if ($tokensexist == 1 && isset($token) && $token && db_tables_exist($dbprefix.'t echo templatereplace(file_get_contents("$thistpl/endpage.pstpl")); doFooter(); - killSession(); + killSession(); exit; } } @@ -765,68 +777,64 @@ if ($tokensexist == 1 && isset($token) && $token && db_tables_exist($dbprefix.'t if (isset($_GET['move']) && $_GET['move'] == "clearall") { $s_lang = $_SESSION['s_lang']; - if (isset($_SESSION['srid'])) + if (isset($_SESSION['srid']) && !isCompleted($surveyid,$_SESSION['srid'])) { - // find out if there are any fuqt questions - checked - $fieldmap = createFieldMap($surveyid); - foreach ($fieldmap as $field) + // delete the response but only if not already completed + $result = $connect->query('SELECT id FROM '.db_table_name('survey_'.$surveyid).' WHERE id='.$_SESSION['srid']." AND submitdate IS NULL"); + if($result->RecordCount()>0) { - if ($field['type'] == "|" && !strpos($field['fieldname'], "_filecount")) + $connect->query('DELETE FROM '.db_table_name('survey_'.$surveyid).' WHERE id='.$_SESSION['srid']." AND submitdate IS NULL"); + // find out if there are any fuqt questions - checked + $fieldmap = createFieldMap($surveyid); + foreach ($fieldmap as $field) { - if (!isset($qid)) { $qid = array(); } - $qid[] = $field['fieldname']; - } - } - - // if yes, extract the response json to those questions - if (isset($qid)) - { - $query = "SELECT * FROM ".db_table_name("survey_".$surveyid)." WHERE id=".$_SESSION['srid']; - $result = db_execute_assoc($query); - while ($row = $result->FetchRow()) - { - foreach ($qid as $question) + if ($field['type'] == "|" && !strpos($field['fieldname'], "_filecount")) { - $json = $row[$question]; - if ($json == "" || $json == NULL) - continue; - - // decode them - $phparray = json_decode($json); - - foreach ($phparray as $metadata) + if (!isset($qid)) { $qid = array(); } + $qid[] = $field['fieldname']; + } + } + // if yes, extract the response json to those questions + if (isset($qid)) + { + $query = "SELECT * FROM ".db_table_name("survey_".$surveyid)." WHERE id=".$_SESSION['srid']; + $result = db_execute_assoc($query); + while ($row = $result->FetchRow()) + { + foreach ($qid as $question) { - $target = "{$uploaddir}/surveys/{$surveyid}/files/"; - // delete those files - unlink($target.$metadata->filename); + $json = $row[$question]; + if ($json == "" || $json == NULL) + continue; + + // decode them + $phparray = json_decode($json); + + foreach ($phparray as $metadata) + { + $target = "{$uploaddir}/surveys/{$surveyid}/files/"; + // delete those files + unlink($target.$metadata->filename); + } } } } + // done deleting uploaded files } - // done deleting uploaded files - - // delete the response but only if not already completed - $connect->query('DELETE FROM '.db_table_name('survey_'.$surveyid).' WHERE id='.$_SESSION['srid']." AND submitdate IS NULL"); - - // also delete a record from saved_control when there is one + // also delete a record from saved_control when there is one, we can allway do it. $connect->query('DELETE FROM '.db_table_name('saved_control'). ' WHERE srid='.$_SESSION['srid'].' AND sid='.$surveyid); } session_unset(); session_destroy(); setcookie(session_name(),"EXPIRED",time()-120); sendcacheheaders(); - if (isset($_GET['redirect'])) - { - session_write_close(); - header("Location: {$_GET['redirect']}"); - } doHeader(); echo templatereplace(file_get_contents("$thistpl/startpage.pstpl")); echo "\n\n\n" ."\t"; //queXS Removal + echo ""; } +end queXS Removal */ function loadanswers() { @@ -937,8 +929,8 @@ function loadanswers() if (isset($_POST['loadall']) && $_POST['loadall'] == "reload") { $query = "SELECT * FROM ".db_table_name('saved_control')." INNER JOIN {$thissurvey['tablename']} - ON ".db_table_name('saved_control').".srid = {$thissurvey['tablename']}.id - WHERE ".db_table_name('saved_control').".sid=$surveyid\n"; + ON ".db_table_name('saved_control').".srid = {$thissurvey['tablename']}.id + WHERE ".db_table_name('saved_control').".sid=$surveyid\n"; if (isset($scid)) //Would only come from email { @@ -958,7 +950,7 @@ function loadanswers() elseif (isset($_SESSION['srid'])) { $query = "SELECT * FROM {$thissurvey['tablename']} - WHERE {$thissurvey['tablename']}.id=".$_SESSION['srid']."\n"; + WHERE {$thissurvey['tablename']}.id=".$_SESSION['srid']."\n"; } else { @@ -973,6 +965,8 @@ function loadanswers() { //A match has been found. Let's load the values! //If this is from an email, build surveysession first + $_SESSION['LEMtokenResume']=true; + $row=$result->FetchRow(); foreach ($row as $column => $value) { @@ -993,14 +987,14 @@ function loadanswers() $thisstep=$value-1; } /* - Commented this part out because otherwise startlanguage would overwrite any other language during a running survey. - We will need a new field named 'endlanguage' to save the current language (for example for returning participants) - /the language the survey was completed in. + Commented this part out because otherwise startlanguage would overwrite any other language during a running survey. + We will need a new field named 'endlanguage' to save the current language (for example for returning participants) + /the language the survey was completed in. elseif ($column =='startlanguage') { - $clang = SetSurveyLanguage( $surveyid, $value); - UpdateSessionGroupList($value); // to refresh the language strings in the group list session variable - UpdateFieldArray(); // to refresh question titles and question text + $clang = SetSurveyLanguage( $surveyid, $value); + UpdateSessionGroupList($value); // to refresh the language strings in the group list session variable + UpdateFieldArray(); // to refresh question titles and question text }*/ elseif ($column == "scid") { @@ -1023,20 +1017,20 @@ function loadanswers() //Only make session variables for those in insertarray[] if (in_array($column, $_SESSION['insertarray'])) { - if (($_SESSION['fieldmap'][$column]['type'] == 'N' || - $_SESSION['fieldmap'][$column]['type'] == 'K' || - $_SESSION['fieldmap'][$column]['type'] == 'D') && $value == null) - { // For type N,K,D NULL in DB is to be considered as NoAnswer in any case. - // We need to set the _SESSION[field] value to '' in order to evaluate conditions. - // This is especially important for the deletenonvalue feature, - // otherwise we would erase any answer with condition such as EQUALS-NO-ANSWER on such - // question types (NKD) - $_SESSION[$column]=''; - } - else - { + // if (($_SESSION['fieldmap'][$column]['type'] == 'N' || + // $_SESSION['fieldmap'][$column]['type'] == 'K' || + // $_SESSION['fieldmap'][$column]['type'] == 'D') && $value == null) + // { // For type N,K,D NULL in DB is to be considered as NoAnswer in any case. + // // We need to set the _SESSION[field] value to '' in order to evaluate conditions. + // // This is especially important for the deletenonvalue feature, + // // otherwise we would erase any answer with condition such as EQUALS-NO-ANSWER on such + // // question types (NKD) + // $_SESSION[$column]=''; + // } + // else + // { $_SESSION[$column]=$value; - } + // } } // if (in_array( } // else } // foreach @@ -1049,12 +1043,9 @@ function makegraph($currentstep, $total) global $thissurvey; global $publicurl, $clang; - $size = round(($currentstep-1)/$total*100,1); + $size = intval(($currentstep-1)/$total*100); - $graph=' -
    '.sprintf($clang->gT('%s%% complete'),$size).'
    '; - - return $graph; + return '
    '.sprintf($clang->gT('%s%% complete'),$size).'
    '; } @@ -1068,8 +1059,11 @@ function makelanguagechanger() if (isset($surveyid)) { $slangs = GetAdditionalLanguagesFromSurveyID($surveyid); + $sBaseLanguage = GetBaseLanguageFromSurveyID($surveyid); + } + // TODO - When is this needed? $token = sanitize_token(returnglobal('token')); if ($token != '') { @@ -1084,25 +1078,33 @@ function makelanguagechanger() if ($_REQUEST['action']=='previewgroup') $previewgrp = true; - if (!empty($slangs)) + if (!empty($slangs)) { if (isset($_SESSION['s_lang']) && $_SESSION['s_lang'] != '') { $lang = sanitize_languagecode($_SESSION['s_lang']); } else if(isset($_POST['lang']) && $_POST['lang']!='') - { - $lang = sanitize_languagecode($_POST['lang']); + { + $lang = sanitize_languagecode($_POST['lang']); + } + else if (isset($_GET['lang']) && $_GET['lang'] != '') + { + $lang = sanitize_languagecode($_GET['lang']); + } + else + { + $lang = $sBaseLanguage; } - else if (isset($_GET['lang']) && $_GET['lang'] != '') - { - $lang = sanitize_languagecode($_GET['lang']); - } - else - $lang = GetBaseLanguageFromSurveyID($surveyid); + $slangs[]=$sBaseLanguage; + $aAllLanguages=getLanguageData(); + $slangs=array_keys(array_intersect_key($aAllLanguages,array_flip($slangs))); // Sort languages by their locale name + + // Changed how language changer works so that posts any currently set values. This also ensures that token (and other) parmeters are also posted. + // $htmlcode ="\n"; - $htmlcode ="\n"; @@ -1131,10 +1135,6 @@ function makelanguagechanger() foreach(getlanguagedata() as $key=>$val) { $htmlcode .= "\t