Skip to content

Commit

Permalink
Merge branch 'master' into bug/17221-check-data-integrity-crash
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Apr 6, 2021
2 parents 6a82960 + 2cf312e commit a338732
Show file tree
Hide file tree
Showing 76 changed files with 1,078 additions and 3,596 deletions.
3 changes: 3 additions & 0 deletions application/config/config-defaults.php
Expand Up @@ -678,6 +678,9 @@
//The following url and dir locations do not need to be modified unless you have a non-standard
//LimeSurvey installation. Do not change unless you know what you are doing.

// The public URL is the URL that is used for anything that is facing a survey participant.
// It can be used to have a separation / distinction between a public URL for surveys and a private one for
// the administration - for example for certain proxy configurations or internal/external domain separation
if (!isset($argv[0]) && Yii::app() != null) {
$config['publicurl'] = Yii::app()->baseUrl.'/'; // The public website location (url) of the public survey script
} else {
Expand Down
4 changes: 2 additions & 2 deletions application/config/version.php
Expand Up @@ -11,10 +11,10 @@
* See COPYRIGHT.php for copyright notices and details.
*/

$config['versionnumber'] = '4.4.15';
$config['versionnumber'] = '4.4.16';
$config['dbversionnumber'] = 443;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
$config['assetsversionnumber'] = '30198';
$config['assetsversionnumber'] = '30199';
return $config;
4 changes: 2 additions & 2 deletions application/controllers/QuestionAdministrationController.php
Expand Up @@ -2541,14 +2541,14 @@ private function unparseAndSetGeneralOptions($oQuestion, $dataSet)
$attributeValue
)
) {
throw new CHttpException(500, gT("Could not store general options"));
throw new CHttpException(500, gT("Could not save question attributes"));
}
}

if (!$oQuestion->save()) {
throw new CHttpException(
500,
gT("Could not store question after general options") . PHP_EOL
gT("Could not save question") . PHP_EOL
. print_r($oQuestion->getErrors(), true)
);
}
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/RegisterController.php
Expand Up @@ -413,8 +413,8 @@ public function getStartDate($iSurveyId)
}
Yii::app()->loadHelper("surveytranslator");
$aDateFormat = getDateFormatData(getDateFormatForSID($iSurveyId, Yii::app()->language), Yii::app()->language);
$datetimeobj = new Date_Time_Converter($aSurveyInfo['startdate'], 'Y-m-d H:i:s');
return $datetimeobj->convert($aDateFormat['phpdate']);
$datetimeobj = DateTime::createFromFormat('Y-m-d H:i:s', $aSurveyInfo['startdate']);
return $datetimeobj->format($aDateFormat['phpdate']);
}
/**
* Display needed public page
Expand Down
28 changes: 11 additions & 17 deletions application/controllers/SurveyAdministrationController.php
Expand Up @@ -289,7 +289,7 @@ public function actionRegenerateQuestionCodes()

//check subaction
if (!($sSubAction === 'straight' || $sSubAction === 'bygroup')) {
Yii::app()->setFlashMessage(gT("Wrong parameter for subaction (straight or bygroup.)"), 'error');
Yii::app()->setFlashMessage(gT("Invalid parameters."), 'error');
$this->redirect(array('surveyAdministration/view', 'surveyid' => $iSurveyID));
}

Expand Down Expand Up @@ -417,7 +417,7 @@ public function actionInsert($iSurveyID = null)
{
if (Permission::model()->hasGlobalPermission('surveys', 'create')) {
$user = Yii::app()->user;

// CHECK IF USER OWNS PREVIOUS SURVEYS BEGIN
if ($user !== null) {
$userid = (int) $user->getId();
Expand Down Expand Up @@ -506,10 +506,10 @@ public function actionInsert($iSurveyID = null)
} elseif (!$ownsPreviousSurveys) {
// SET create question and create question group as default view.
$redirecturl = $this->createUrl(
'questionGroupsAdministration/add/',
['surveyid' => $iNewSurveyid]
'questionGroupsAdministration/add/',
['surveyid' => $iNewSurveyid]
);
} else {
} else {
$redirecturl = $this->createUrl(
'surveyAdministration/view/',
['iSurveyID' => $iNewSurveyid]
Expand Down Expand Up @@ -2281,13 +2281,11 @@ public function actionExpireMultipleSurveys()
$aResults = array();
$expires = App()->request->getPost('expires');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
Yii::import('application.libraries.Date_Time_Converter', true);
if (trim($expires) == "") {
$expires = null;
} else {
//new Date_Time_Converter($expires, $formatdata['phpdate'].' H:i');
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
$datetimeobj = DateTime::createFromFormat($formatdata['phpdate'] . ' H:i', $expires);
$expires = $datetimeobj->format("Y-m-d H:i:s");
}

foreach ($aSIDs as $sid) {
Expand Down Expand Up @@ -2730,19 +2728,15 @@ private function surveysummary(&$aData)

$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
if (trim($oSurvey->startdate) != '') {
Yii::import('application.libraries.Date_Time_Converter');
$datetimeobj = new Date_Time_Converter($oSurvey->startdate, 'Y-m-d H:i:s');
$aData['startdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
$datetimeobj = DateTime::createFromFormat('Y-m-d H:i:s', $oSurvey->startdate);
$aData['startdate'] = $datetimeobj->format($dateformatdetails['phpdate'] . ' H:i');
} else {
$aData['startdate'] = "-";
}

if (trim($oSurvey->expires) != '') {
//$constructoritems = array($surveyinfo['expires'] , "Y-m-d H:i:s");
Yii::import('application.libraries.Date_Time_Converter');
$datetimeobj = new Date_Time_Converter($oSurvey->expires, 'Y-m-d H:i:s');
//$datetimeobj = new Date_Time_Converter($surveyinfo['expires'] , "Y-m-d H:i:s");
$aData['expdate'] = $datetimeobj->convert($dateformatdetails['phpdate'] . ' H:i');
$datetimeobj = DateTime::createFromFormat('Y-m-d H:i:s', $oSurvey->expires);
$aData['expdate'] = $datetimeobj->format($dateformatdetails['phpdate'] . ' H:i');
} else {
$aData['expdate'] = "-";
}
Expand Down
8 changes: 4 additions & 4 deletions application/controllers/ThemeOptionsController.php
Expand Up @@ -142,7 +142,7 @@ public function actionResetMultiple()
}

//set Modal table labels
$tableLabels = array(gT('Template id'),gT('Template name') ,gT('Status'));
$tableLabels = array(gT('Theme ID'),gT('Theme name') ,gT('Status'));

$this->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down Expand Up @@ -201,7 +201,7 @@ public function actionUninstallMultiple()
}
}
//set Modal table labels
$tableLabels = array(gT('Template id'),gT('Template name') ,gT('Status'));
$tableLabels = array(gT('Theme ID'),gT('Theme name') ,gT('Status'));

$this->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down Expand Up @@ -243,7 +243,7 @@ public function actionSelectedItems()
$aResults[$template]['result'] = gT('Selected');
}
//set Modal table labels
$tableLabels = array(gT('Template id'),gT('Template name') ,gT('Status'));
$tableLabels = array(gT('Theme ID'),gT('Theme name') ,gT('Status'));

$this->renderPartial(
'ext.admin.grid.MassiveActionsWidget.views._selected_items',
Expand Down Expand Up @@ -610,7 +610,7 @@ public function actionReset(int $gsid)
array(":gsid" => $gsid, ":templatename" => $templatename)
);
if (empty($oTemplateConfiguration)) {
throw new CHttpException(401, gT("Invalid template configuration for this group."));
throw new CHttpException(401, gT("Invalid theme configuration for this group."));
}
$oTemplateConfiguration->setToInherit();
if ($oTemplateConfiguration->save()) {
Expand Down
14 changes: 7 additions & 7 deletions application/controllers/UserManagementController.php
Expand Up @@ -244,7 +244,7 @@ public function actionDeleteUser()
return App()->getController()->renderPartial('/admin/super/_renderJson', [
'data' => [
'success' => false,
'message' => gT("you cannot delete yourself.")
'message' => gT("You cannot delete yourself.")
]
]);
}
Expand Down Expand Up @@ -785,7 +785,7 @@ public function actionDeleteMultiple()
}
}

$tableLabels = array(gT('User id'), gT('Username'), gT('Status'));
$tableLabels = array(gT('User ID'), gT('Username'), gT('Status'));

Yii::app()->getController()->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down Expand Up @@ -821,13 +821,13 @@ public function actionRenderSelectedItems()
$aResults[$user]['result'] = gT('Selected');
}
//set Modal table labels
$tableLabels = array(gT('User id'), gT('Username'), gT('Status'));
$tableLabels = array(gT('User ID'), gT('Username'), gT('Status'));

App()->getController()->renderPartial(
'ext.admin.grid.MassiveActionsWidget.views._selected_items',
array(
'aResults' => $aResults,
'successLabel' => gT('Seleted'),
'successLabel' => gT('Selected'),
'tableLabels' => $tableLabels,
)
);
Expand Down Expand Up @@ -920,7 +920,7 @@ public function actionBatchPermissions()
}
}

$tableLabels = array(gT('User id'), gT('Username'), gT('Status'));
$tableLabels = array(gT('User ID'), gT('Username'), gT('Status'));

Yii::app()->getController()->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down Expand Up @@ -975,7 +975,7 @@ public function actionBatchAddGroup()
}
}

$tableLabels = array(gT('User id'), gT('Username'), gT('Status'));
$tableLabels = array(gT('User ID'), gT('Username'), gT('Status'));

Yii::app()->getController()->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down Expand Up @@ -1021,7 +1021,7 @@ public function actionBatchApplyRoles()
}
}

$tableLabels = array(gT('User id'), gT('Username'), gT('Status'));
$tableLabels = array(gT('User ID'), gT('Username'), gT('Status'));

Yii::app()->getController()->renderPartial(
'ext.admin.survey.ListSurveysWidget.views.massive_actions._action_results',
Expand Down
40 changes: 20 additions & 20 deletions application/controllers/admin/ExpressionValidate.php
Expand Up @@ -171,16 +171,16 @@ public function email($iSurveyId, $lang)
'ADMINEMAIL' => $aSurveyInfo['adminemail'],
);
// Not needed : templatereplace do the job : but this can/must be fixed for invitaton/reminder/registration (#9424)
$aReplacement["SURVEYNAME"] = gT("Name of the survey");
$aReplacement["SURVEYDESCRIPTION"] = gT("Description of the survey");
$aReplacement["SURVEYNAME"] = gT("Survey title");
$aReplacement["SURVEYDESCRIPTION"] = gT("Survey description");
// Replaced when sending email with Survey
$aAttributes = getTokenFieldsAndNames($iSurveyId, true);
$aReplacement["TOKEN"] = gT("Access code for this participant");
$aReplacement["TOKEN:EMAIL"] = gT("Email address of the participant");
$aReplacement["TOKEN:FIRSTNAME"] = gT("First name of the participant");
$aReplacement["TOKEN:LASTNAME"] = gT("Last name of the participant");
$aReplacement["TOKEN:TOKEN"] = gT("Access code for this participant");
$aReplacement["TOKEN:LANGUAGE"] = gT("language of participant");
$aReplacement["TOKEN"] = gT("Participant - Access code");
$aReplacement["TOKEN:EMAIL"] = gT("Participant - Email address");
$aReplacement["TOKEN:FIRSTNAME"] = gT("Participant - First name");
$aReplacement["TOKEN:LASTNAME"] = gT("Participant - Last name");
$aReplacement["TOKEN:TOKEN"] = gT("Participant - Access code");
$aReplacement["TOKEN:LANGUAGE"] = gT("Participant - Language");
foreach ($aAttributes as $sAttribute => $aAttribute) {
$aReplacement['TOKEN:' . strtoupper($sAttribute) . ''] = sprintf(gT("Participant attribute: %s"), $aAttribute['description']);
}
Expand All @@ -190,24 +190,24 @@ public function email($iSurveyId, $lang)
case 'reminder':
case 'registration':
// Replaced when sending email (registration too ?)
$aReplacement["EMAIL"] = gT("Email address of the participant");
$aReplacement["FIRSTNAME"] = gT("First name of the participant");
$aReplacement["LASTNAME"] = gT("Last name of the participant");
$aReplacement["LANGUAGE"] = gT("language of participant");
$aReplacement["EMAIL"] = gT("Participant - Email address");
$aReplacement["FIRSTNAME"] = gT("Participant - First name");
$aReplacement["LASTNAME"] = gT("Participant - Last name");
$aReplacement["LANGUAGE"] = gT("Participant - Language");
$aReplacement["OPTOUTURL"] = gT("URL for a respondent to opt-out of this survey");
$aReplacement["OPTINURL"] = gT("URL for a respondent to opt-in to this survey");
$aReplacement["SURVEYURL"] = gT("URL of the survey");
$aReplacement["SURVEYURL"] = gT("Survey URL");
foreach ($aAttributes as $sAttribute => $aAttribute) {
$aReplacement['' . strtoupper($sAttribute) . ''] = sprintf(gT("Participant attribute: %s"), $aAttribute['description']);
$aReplacement['' . strtoupper($sAttribute) . ''] = sprintf(gT("Participant - Attribute: %s"), $aAttribute['description']);
}
break;
case 'confirmation':
$aReplacement["EMAIL"] = gT("Email address of the participant");
$aReplacement["FIRSTNAME"] = gT("First name of the participant");
$aReplacement["LASTNAME"] = gT("Last name of the participant");
$aReplacement["SURVEYURL"] = gT("URL of the survey");
$aReplacement["EMAIL"] = gT("Participant - Email address");
$aReplacement["FIRSTNAME"] = gT("Participant - Last name");
$aReplacement["LASTNAME"] = gT("Participant - First name");
$aReplacement["SURVEYURL"] = gT("Survey URL");
foreach ($aAttributes as $sAttribute => $aAttribute) {
$aReplacement['' . strtoupper($sAttribute) . ''] = sprintf(gT("Participant attribute: %s"), $aAttribute['description']);
$aReplacement['' . strtoupper($sAttribute) . ''] = sprintf(gT("Participant - Attribute: %s"), $aAttribute['description']);
}
// $moveResult = LimeExpressionManager::NavigateForwards(); // Seems OK without, nut need $LEM::StartSurvey
break;
Expand Down Expand Up @@ -239,7 +239,7 @@ public function email($iSurveyId, $lang)
}
$aData['aExpressions'] = $aExpressions;
$this->getController()->layout = $this->layout;
$this->getController()->pageTitle = sprintf(gT("Validate expression in email : %s"), $sType);
$this->getController()->pageTitle = sprintf(gT("Validate expressions in email: %s"), $sType);

$this->getController()->renderPartial("/admin/expressions/validationList", $aData);
}
Expand Down
5 changes: 2 additions & 3 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -995,9 +995,8 @@ protected function _checkintegrity()
$sDate = (string) date('Y-m-d H:i:s', (int) mktime($iHour, $iMinute, 0, $iMonth, $iDay, $iYear));

$dateformatdetails = getDateFormatData(Yii::app()->session['dateformat']);
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter(dateShift($sDate, 'Y-m-d H:i:s', getGlobalSetting('timeadjust')), 'Y-m-d H:i:s');
$sDate = $datetimeobj->convert($dateformatdetails['phpdate'] . " H:i");
$datetimeobj = DateTime::createFromFormat('Y-m-d H:i:s', dateShift($sDate, 'Y-m-d H:i:s', getGlobalSetting('timeadjust')));
$sDate = $datetimeobj->format($dateformatdetails['phpdate'] . " H:i");

$sQuery = 'SELECT count(*) as recordcount FROM ' . $sTableName;
$aFirstRow = Yii::app()->db->createCommand($sQuery)->queryRow();
Expand Down
4 changes: 3 additions & 1 deletion application/controllers/admin/conditionsaction.php
Expand Up @@ -697,7 +697,9 @@ protected function insertCondition(array $args)
/** @var string $editSourceTab */
extract($args);

if (isset($p_cquestions) && $p_cquestions != '') {
$editSourceTab = $request->getPost('editSourceTab');

if (isset($p_cquestions) && $p_cquestions != '' && $editSourceTab == '#SRCPREVQUEST') {
$conditionCfieldname = $p_cquestions;
} elseif (isset($p_csrctoken) && $p_csrctoken != '') {
$conditionCfieldname = $p_csrctoken;
Expand Down
10 changes: 4 additions & 6 deletions application/controllers/admin/database.php
Expand Up @@ -667,7 +667,6 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
/* Date management */
Yii::app()->loadHelper('surveytranslator');
$formatdata = getDateFormatData(Yii::app()->session['dateformat']);
Yii::app()->loadLibrary('Date_Time_Converter');

$unfilteredStartdate = App()->request->getPost('startdate', null);
$startdate = $this->_filterEmptyFields($oSurvey, 'startdate');
Expand All @@ -676,9 +675,8 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
} elseif (trim($unfilteredStartdate) == "") {
$oSurvey->startdate = "";
} else {
Yii::app()->loadLibrary('Date_Time_Converter');
$datetimeobj = new date_time_converter($startdate, $formatdata['phpdate'] . ' H:i');
$startdate = $datetimeobj->convert("Y-m-d H:i:s");
$datetimeobj = DateTime::createFromFormat($formatdata['phpdate'] . ' H:i', $startdate);
$startdate = $datetimeobj->format("Y-m-d H:i:s");
$oSurvey->startdate = $startdate;
}

Expand All @@ -690,8 +688,8 @@ private function actionUpdateSurveyLocaleSettings($iSurveyID)
// Must not convert if empty.
$oSurvey->expires = "";
} else {
$datetimeobj = new date_time_converter($expires, $formatdata['phpdate'] . ' H:i');
$expires = $datetimeobj->convert("Y-m-d H:i:s");
$datetimeobj = DateTime::createFromFormat($formatdata['phpdate'] . ' H:i', $expires);
$expires = $datetimeobj->format("Y-m-d H:i:s");
$oSurvey->expires = $expires;
}

Expand Down

0 comments on commit a338732

Please sign in to comment.