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 Oct 1, 2021
2 parents 4ceb310 + 720c3da commit 6e5ab7e
Show file tree
Hide file tree
Showing 10 changed files with 2,371 additions and 2,342 deletions.
10 changes: 7 additions & 3 deletions application/controllers/admin/labels.php
Expand Up @@ -362,7 +362,7 @@ public function process()
$lid = $oLabelSet->lid;
}
if (($action == "modlabelsetanswers" || ($action == "ajaxmodlabelsetanswers")) && Permission::model()->hasGlobalPermission('labelsets', 'update')) {
modlabelsetanswers($lid);
modlabelsetanswers($lid);
}
if ($action == "deletelabelset" && Permission::model()->hasGlobalPermission('labelsets', 'delete')) {
if (LabelSet::model()->deleteLabelSet($lid)) {
Expand All @@ -371,10 +371,14 @@ public function process()
}
}

if (Yii::app()->request->getPost("saveandclose")) {
$this->getController()->redirect(array("admin/labels/sa/view"));
}

if ($lid) {
$this->getController()->redirect(array("admin/labels/sa/view/lid/" . $lid));
$this->getController()->redirect(array("admin/labels/sa/view/lid/" . $lid));
} else {
$this->getController()->redirect(array("admin/labels/sa/view"));
$this->getController()->redirect(array("admin/labels/sa/view"));
}
}

Expand Down
33 changes: 23 additions & 10 deletions application/helpers/remotecontrol/remotecontrol_handle.php
Expand Up @@ -2653,24 +2653,31 @@ public function mail_registered_participants($sSessionKey, $iSurveyID, $override
//pattern taken from php_filter_validate_email PHP_5_4/ext/filter/logical_filters.c
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';

//if(!filter_var($emailaddress, FILTER_VALIDATE_EMAIL))
if (preg_match($pattern, $oToken['email']) !== 1) {
unset($aResultTokens[$key]);
//subtract from 'left to send'
$iAllTokensCount--;
//pattern to split in case of multiple emails for a participant
$emailsToCheck = preg_split("/(,|;)/", $oToken['email']);

//Loop through each email and validate it
foreach($emailsToCheck as $emailToCheck) {
if (preg_match($pattern, $emailToCheck) !== 1) {
unset($aResultTokens[$key]);
//subtract from 'left to send'
$iAllTokensCount--;
break;
}
}
}

if (empty($aResultTokens)) {
return array('status' => 'Error: No candidate tokens');
return array('status' => 'Error: No candidate tokens');
}

$aResult = emailTokens($iSurveyID, $aResultTokens, 'register');
$iLeft = $iAllTokensCount - count($aResultTokens);
$aResult['status'] = $iLeft . " left to send";

return $aResult;
} else {
return array('status' => 'No permission');
return array('status' => 'No permission');
}
}

Expand Down Expand Up @@ -2719,9 +2726,15 @@ public function invite_participants($sSessionKey, $iSurveyID, $aTokenIds = null,
//pattern taken from php_filter_validate_email PHP_5_4/ext/filter/logical_filters.c
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';

//if(!filter_var($emailaddress, FILTER_VALIDATE_EMAIL))
if (preg_match($pattern, $oToken['email']) !== 1) {
unset($aResultTokens[$key]);
//pattern to split in case of multiple emails for a participant
$emailsToCheck = preg_split("/(,|;)/", $oToken['email']);

//Loop through each email and validate it
foreach($emailsToCheck as $emailToCheck) {
if (preg_match($pattern, $emailToCheck) !== 1) {
unset($aResultTokens[$key]);
break;
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions application/models/QuestionGroup.php
Expand Up @@ -338,8 +338,8 @@ public function search()
$sort->defaultOrder = array('group_order' => false);
$sort->attributes = array(
'group_id' => array(
'asc' => 'gid',
'desc' => 'gid desc',
'asc' => 't.gid',
'desc' => 't.gid desc',
),
'group_order' => array(
'asc' => 'group_order',
Expand Down

0 comments on commit 6e5ab7e

Please sign in to comment.