Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 15, 2020
2 parents 00926bd + a85b0a7 commit 7fac976
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 195 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
@@ -1,7 +1,7 @@
<?php
/*
* LimeSurvey
* Copyright (C) 2007-2019 The LimeSurvey Project Team / Carsten Schmitz
* Copyright (C) 2007-2020 The LimeSurvey Project Team / Carsten Schmitz
* All rights reserved.
* License: GNU/GPL License v3 or later, see LICENSE.php
* LimeSurvey is free software. This version may have been modified pursuant
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/themes.php
Expand Up @@ -809,15 +809,15 @@ public function templatesavechanges()
if (returnGlobal('changes')) {
$changedtext = returnGlobal('changes');
$changedtext = str_replace('<?', '', $changedtext);
if (get_magic_quotes_gpc()) {
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$changedtext = stripslashes($changedtext);
}
}

if (returnGlobal('changes_cp')) {
$changedtext = returnGlobal('changes_cp');
$changedtext = str_replace('<?', '', $changedtext);
if (get_magic_quotes_gpc()) {
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$changedtext = stripslashes($changedtext);
}
}
Expand Down
122 changes: 0 additions & 122 deletions application/core/LSYii_XssValidator.php

This file was deleted.

4 changes: 2 additions & 2 deletions application/helpers/admin/label_helper.php
Expand Up @@ -124,8 +124,8 @@ function modlabelsetanswers($lid)

$sPostData = Yii::app()->getRequest()->getPost('dataToSend');
$sPostData = str_replace("\t", '', $sPostData);
if (get_magic_quotes_gpc()) {
$data = json_decode(stripslashes($sPostData), true);
if(function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
$data = json_decode(stripslashes($sPostData));
} else {
$data = json_decode($sPostData, true);
}
Expand Down
5 changes: 3 additions & 2 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -8568,7 +8568,7 @@ public static function UnitTestRelevance()
foreach(explode("\n",$tests) as $test)
{
$args = explode("~",$test);
$type = (($args[1]=='expr') ? Question::QT_ASTERISK_EQUATION : ($args[1]=='message') ? Question::QT_X_BOILERPLATE_QUESTION : Question::QT_S_SHORT_FREE_TEXT);
$type = $args[1]=='expr' ? Question::QT_ASTERISK_EQUATION : ($args[1]=='message' ? Question::QT_X_BOILERPLATE_QUESTION : Question::QT_S_SHORT_FREE_TEXT);
$vars[$args[0]] = array('sgqa'=>$args[0], 'code'=>'', 'jsName'=>'java' . $args[0], 'jsName_on'=>'java' . $args[0], 'readWrite'=>'Y', 'type'=>$type, 'relevanceStatus'=>'1', 'gid'=>1, 'gseq'=>1, 'qseq'=>$i, 'qid'=>$i);
$varSeq[] = $args[0];
$testArgs[] = $args;
Expand Down Expand Up @@ -9385,7 +9385,8 @@ private function _GetVarAttribute($name,$attr,$default,$gseq,$qseq)
|| ($this->surveyMode=='group' && $gseq != -1 && isset($var['gseq']) && $gseq == $var['gseq'])
|| ($this->surveyMode=='question' && $qseq != -1 && isset($var['qseq']) && $qseq == $var['qseq']))
{
return (isset($var['jsName_on']) ? $var['jsName_on'] : (isset($var['jsName'])) ? $var['jsName'] : $default);
// TODO: jsName_on will never be returned?
return (isset($var['jsName_on']) ? $var['jsName_on'] : isset($var['jsName'])) ? $var['jsName'] : $default;
}
else {
return (isset($var['jsName']) ? $var['jsName'] : $default);
Expand Down
19 changes: 14 additions & 5 deletions application/models/TokenDynamic.php
Expand Up @@ -96,20 +96,29 @@ public function primaryKey()
return 'tid';
}

/** @inheritdoc */
/**
* @inheritdoc
* @see \Token::model()->rules
**/
public function rules()
{
return array(
array('firstname, lastname', 'LSYii_XssValidator', 'allowHTML' => false),
array('token', 'unique', 'allowEmpty'=>true),
$aRules = array(
array('token', 'unique', 'allowEmpty' => true),
array('firstname', 'LSYii_Validators'),
array('lastname', 'LSYii_Validators'),
array(implode(',', $this->tableSchema->columnNames), 'safe'),
array('remindercount', 'numerical', 'integerOnly'=>true, 'allowEmpty'=>true),
array('email', 'filter', 'filter'=>'trim'),
array('email', 'LSYii_EmailIDNAValidator', 'allowEmpty'=>true, 'allowMultiple'=>true, 'except'=>'allowinvalidemail'),
array('usesleft', 'numerical', 'integerOnly'=>true, 'allowEmpty'=>true),
array('mpid', 'numerical', 'integerOnly'=>true, 'allowEmpty'=>true),
array('blacklisted', 'in', 'range'=>array('Y', 'N'), 'allowEmpty'=>true),
array('emailstatus', 'default', 'value' => $this->emailstatus),
array('emailstatus', 'default', 'value' => 'OK'),
);
foreach (decodeTokenAttributes($this->survey->attributedescriptions) as $key => $info) {
$aRules[] = array($key, 'LSYii_Validators', 'except'=>'FinalSubmit');
}
return $aRules;
}

/** @inheritdoc */
Expand Down
79 changes: 19 additions & 60 deletions application/views/admin/token/tokenform.php
Expand Up @@ -172,7 +172,11 @@
<?php eT("Access code:"); ?>
</label>
<div class="">
<input class='form-control' type='text' maxlength="<?php echo $iTokenLength; ?>" size='20' name='token' id='token' value="<?php if (isset($token)) {echo $token; } ?>" />
<?=TbHtml::textField('token',(isset($token) ? $token : ""), [
'class' => 'form-control',
'size' => '20',
'maxlength' => $iTokenLength
]);?>
<?php if ($token_subaction == "addnew"): ?>
<span id="helpBlock" class="help-block"><?php eT("You can leave this blank, and automatically generate access codes using 'Generate access codes'"); ?></span>
<?php endif; ?>
Expand All @@ -194,47 +198,32 @@
<label class=" control-label" for='email'>
<?php eT("Email:"); ?>
</label>
<div class="input-group">
<?php
// Official IETF email pattern
$emailPattern = "[a-zA-Z0-9!#\\&$%'*+=?^`{}|~_-](\.?[a-zA-Z0-9\\!#$&%'*+=?^`{}|~_-]){0,}@[a-zA-Z0-9]+\.(?!-)([a-zA-Z0-9]?((-?[a-zA-Z0-9]+)+\.(?!-))){0,}[a-zA-Z0-9]{2,8}";
echo TbHtml::textField('email', $email, [
<div class="">
<?=TbHtml::textField('email', $email, [
'class' => 'form-control',
'size' => '50',
'maxlength' => '320',
'pattern' => "^".$emailPattern."(;".$emailPattern.")*$"
]);?>
<span class="input-group-addon" id="selector--emailValidationIcon">
<i class="fa fa-check hidden"></i>
</span>
</div>
</div>
</div>

<!-- Email Status -->
<div class="form-group">
<!-- Email Status -->
<div class="form-group">
<label class=" control-label" for='emailstatus'>
<?php eT("Email status:"); ?>
</label>
<div class="input-group">
<div class="">
<?=TbHtml::textField('emailstatus', $emailstatus, [
'class' => 'form-control',
'size' => '50',
'maxlength' => '320',
'placeholder' => 'OK',
'readonly' => true,
'data-toggle' => "tooltip",
"title" => gT("This field is to record the delivery state. Normally the system will handle this automatically")
'placeholder' => 'OK'
]);?>
<span class="input-group-addon">
<button id="selector--emailStatusIconButton" class="btn btn-xs">
<i class="fa fa-lock"></i>
</button>
</span>
</div>
</div>
</div>

<!-- Invitation sent, Reminder sent -->
<div class="form-group">
<!-- Invitation sent, Reminder sent -->
<div class="form-group">
<!-- Invitation sent -->
<label class=" control-label" for='sent'>
<?php eT("Invitation sent?"); ?>
Expand Down Expand Up @@ -303,11 +292,11 @@
</div>
</div>
</div>
</div>
<input class='form-control hidden YesNoDateHidden' type='text' size='20' id='sent' name='sent' value="<?php if (isset($sent)) {echo $sent; } else {echo " N "; }?>" />
</div>
<input class='form-control hidden YesNoDateHidden' type='text' size='20' id='sent' name='sent' value="<?php if (isset($sent)) {echo $sent; } else {echo " N "; }?>" />
</div>
</div>
<div class="form-group">
</div>
<div class="form-group">
<!-- Reminder sent -->
<label class=" control-label" for='remindersent'>
<?php eT("Reminder sent?"); ?>
Expand Down Expand Up @@ -472,34 +461,4 @@
App()->getClientScript()->registerScript('TokenformViewBSSwitcher', "
LS.renderBootstrapSwitch();
", LSYii_ClientScript::POS_POSTSCRIPT);

App()->getClientScript()->registerScript('TokenformViewEmailValidate', "
var validateEmailField = function(){
if($('#email').val().length > 0) {
$('#selector--emailValidationIcon').find('i.fa').removeClass('hidden');
if(/^(".$emailPattern.")(;".$emailPattern.")*$/.test($('#email').val())) {
$('#email').parent('div').removeClass('has-error');
$('#selector--emailValidationIcon').find('i.fa').removeClass('fa-times').addClass('fa-check');
} else {
$('#email').parent('div').addClass('has-error');
$('#selector--emailValidationIcon').find('i.fa').removeClass('fa-check').addClass('fa-times');
}
} else {
$('#selector--emailValidationIcon').find('i.fa').addClass('hidden');
}
};
validateEmailField();
$('#email').on('keyup', validateEmailField);
$('#email').on('blur', validateEmailField);
$('#selector--emailStatusIconButton').on('click', function(e){
e.preventDefault();
if($(this).find('i.fa').hasClass('fa-lock')) {
$(this).find('i.fa').removeClass('fa-lock').addClass('fa-unlock');
$('#emailstatus').prop('readonly', false);
} else {
$(this).find('i.fa').removeClass('fa-unlock').addClass('fa-lock');
$('#emailstatus').prop('readonly', true);
}
});
", LSYii_ClientScript::POS_POSTSCRIPT);
?>
15 changes: 15 additions & 0 deletions docs/release_notes.txt
Expand Up @@ -1212,6 +1212,21 @@ Changes from 4.0.0-alpha (build 190408) to 4.0.0-beta (build 190509) May 09, 201
-Fixed issue #14698: Expression manager must not treat user entered value in expression (Denis Chenu)
-New feature: add dbengine to InstallerConfigurationForm (Tõnis Ormisson)

Changes from 3.21.4 (build 200108) to 3.21.5 (build 200115) January 15, 2020
-Fixed issue #15696: Multiple email addresses in token are not working (#1368) (Denis Chenu)
-Fixed issue #15692: where-clause in reorderMenu (Marko Bischof)
-Fixed issue #15685: Issue when exporting decimal value in MSSQL (Denis Chenu)
-Fixed issue #15684: When reloading decimal value with 0 with MSSQL : 0 disappear (#1360) (Denis Chenu)
-Fixed issue #15684: MSSQL issue reloading decimal value (Denis Chenu)
-Fixed issue #15570: Column filter gets stuck after selecting once and does not filter certain columns (Patrick Teichmann)


Changes from 3.21.3 (build 191219) to 3.21.4 (build 200108) January 8, 2020
-Fixed issue: Tooltips are not showing in hosting top bar (Eddy Lackmann)
-Fixed issue: Potential lost responses on first page (Denis Chenu)
-Fixed issue #15651: delete_participant fails to delete and gives no error back (Adam Zammit)


Changes from 3.21.2 (build 191216) to 3.21.3 (build 191219) December 19, 2019
+New translation: Kurdish (Kurmanji) (Carsten Schmitz)
-Fixed issue [security] #15681: LimeSurvey 3.21.1 Cross Site Scripting Stored (lacrioque)
Expand Down
2 changes: 1 addition & 1 deletion framework/utils/CFormatter.php
Expand Up @@ -229,7 +229,7 @@ protected function normalizeDateValue($time)
{
if(is_string($time))
{
if(ctype_digit($time) || ($time{0}=='-' && ctype_digit(substr($time, 1))))
if(ctype_digit($time) || ($time[0]=='-' && ctype_digit(substr($time, 1))))
return (int)$time;
else
return strtotime($time);
Expand Down

0 comments on commit 7fac976

Please sign in to comment.