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 Mar 29, 2021
2 parents bbc2849 + 2909921 commit 9c6411c
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 167 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -12,7 +12,7 @@
*/

$config['versionnumber'] = '4.4.14';
$config['dbversionnumber'] = 442;
$config['dbversionnumber'] = 443;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
Expand Down
13 changes: 2 additions & 11 deletions application/controllers/admin/participantsaction.php
Expand Up @@ -2486,29 +2486,20 @@ public function addToTokenattmap()
* mapped[attribute_38] = 39
* meaning that an attribute is mapped onto another.
*/
$mappedAttributes = Yii::app()->request->getPost('mapped');
$mappedAttributes = Yii::app()->request->getPost('mapped', []);

/**
* newarr takes values like
* newarr[] = 39
*/
$newAttributes = Yii::app()->request->getPost('newarr');
$newAttributes = Yii::app()->request->getPost('newarr', []);

$options = array();
$options['overwriteauto'] = Yii::app()->request->getPost('overwrite') === 'true';
$options['overwriteman'] = Yii::app()->request->getPost('overwriteman') === 'true';
$options['overwritest'] = Yii::app()->request->getPost('overwritest') === 'true';
$options['createautomap'] = Yii::app()->request->getPost('createautomap') === 'true';

// TODO: Why?
if (empty($newAttributes[0])) {
$newAttributes = array();
}

if (empty($mappedAttributes)) {
$mappedAttributes = array();
}

try {
$response = Participant::model()->copyCPDBAttributesToTokens($surveyId, $participantIds, $mappedAttributes, $newAttributes, $options);
}
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSUserIdentity.php
Expand Up @@ -179,7 +179,7 @@ protected function postLogin()
}

//At last store the login time in the user table
$user->lastLogin = date('Y-m-d H:i:s');
$user->last_login = date('Y-m-d H:i:s');
$user->save();
}

Expand Down
35 changes: 11 additions & 24 deletions application/helpers/admin/statistics_helper.php
Expand Up @@ -3524,15 +3524,11 @@ public function generate_simple_statistics($surveyid, $allfields, $q2show = 'all
$sOutputHTML .= '</div>';

$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey != '') {
$sGoogleMapsAPIKey = '&key=' . $sGoogleMapsAPIKey;
if (!empty($sGoogleMapsAPIKey)) {
$sOutputHTML .= "<script type=\"text/javascript\" src=\"//maps.googleapis.com/maps/api/js?sensor=false&key={$sGoogleMapsAPIKey}\"></script>\n";
}
$sSSL = '';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
$sSSL = 's';
}
$sOutputHTML .= "<script type=\"text/javascript\" src=\"http{$sSSL}://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey\"></script>\n"
. "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";

$sOutputHTML .= "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";


return $sOutputHTML;
Expand Down Expand Up @@ -3745,15 +3741,10 @@ public function generate_html_chartjs_statistics($surveyid, $allfields, $q2show
} //end if -> show summary results

$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey != '') {
$sGoogleMapsAPIKey = '&key=' . $sGoogleMapsAPIKey;
}
$sSSL = '';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
$sSSL = 's';
if (!empty($sGoogleMapsAPIKey)) {
$sOutputHTML .= "<script type=\"text/javascript\" src=\"//maps.googleapis.com/maps/api/js?sensor=false&key={$sGoogleMapsAPIKey}\"></script>\n";
}
$sOutputHTML .= "<script type=\"text/javascript\" src=\"http{$sSSL}://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey\"></script>\n"
. "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";
$sOutputHTML .= "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";


return $sOutputHTML;
Expand Down Expand Up @@ -4087,15 +4078,11 @@ public function generate_statistics($surveyid, $allfields, $q2show = 'all', $use
break;
case 'html':
$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey != '') {
$sGoogleMapsAPIKey = '&key=' . $sGoogleMapsAPIKey;
if (!empty($sGoogleMapsAPIKey)) {
$sOutputHTML .= "<script type=\"text/javascript\" src=\"//maps.googleapis.com/maps/api/js?sensor=false&key={$sGoogleMapsAPIKey}\"></script>\n";
}
$sSSL = '';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
$sSSL = 's';
}
$sOutputHTML .= "<script type=\"text/javascript\" src=\"http{$sSSL}://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey\"></script>\n"
. "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";

$sOutputHTML .= "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";
return $sOutputHTML;

break;
Expand Down
3 changes: 2 additions & 1 deletion application/helpers/frontend_helper.php
Expand Up @@ -422,7 +422,8 @@ function submittokens($quotaexit = false)
}
$token->usesleft--;
}
$token->save();
$token->decrypt();
$token->encryptSave();

if ($quotaexit == false) {
if ($token && trim(strip_tags($thissurvey['email_confirm'])) != "" && $thissurvey['sendconfirmation'] == "Y") {
Expand Down
12 changes: 3 additions & 9 deletions application/helpers/qanda_helper.php
Expand Up @@ -2381,12 +2381,7 @@ function do_shortfreetext($ia)
{
global $thissurvey;

$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
$coreClass = "ls-answers answer-item text-item";
if ($sGoogleMapsAPIKey != '') {
$sGoogleMapsAPIKey = '&key=' . $sGoogleMapsAPIKey;
}

$extraclass = "";
$aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);

Expand Down Expand Up @@ -2525,10 +2520,9 @@ function do_shortfreetext($ia)
$currentLocation = $currentLatLong[0] . " " . $currentLatLong[1];

Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "map.js", LSYii_ClientScript::POS_END);
if ($aQuestionAttributes['location_mapservice'] == 1 && !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
Yii::app()->getClientScript()->registerScriptFile("https://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
} elseif ($aQuestionAttributes['location_mapservice'] == 1) {
Yii::app()->getClientScript()->registerScriptFile("http://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey", LSYii_ClientScript::POS_BEGIN);
$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($aQuestionAttributes['location_mapservice'] == 1 && !empty($sGoogleMapsAPIKey)) {
Yii::app()->getClientScript()->registerScriptFile("//maps.googleapis.com/maps/api/js?sensor=false&key={$sGoogleMapsAPIKey}", LSYii_ClientScript::POS_BEGIN);
} elseif ($aQuestionAttributes['location_mapservice'] == 2) {
/* 2019-04-01 : openlayers auto redirect to https (on firefox) , but always good to use automatic protocol */
Yii::app()->getClientScript()->registerScriptFile("//www.openlayers.org/api/OpenLayers.js", LSYii_ClientScript::POS_BEGIN);
Expand Down
6 changes: 6 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -3783,6 +3783,12 @@ function ($v) {
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 442), "stg_name='DBVersion'");
$oTransaction->commit();
}
if ($iOldDBVersion < 443) {
$oTransaction = $oDB->beginTransaction();
$oDB->createCommand()->renameColumn('{{users}}', 'lastLogin', 'last_login');
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 443), "stg_name='DBVersion'");
$oTransaction->commit();
}
} catch (Exception $e) {
Yii::app()->setConfig('Updating', false);
$oTransaction->rollback();
Expand Down
11 changes: 3 additions & 8 deletions application/helpers/userstatistics_helper.php
Expand Up @@ -2804,15 +2804,10 @@ public function generate_statistics($surveyid, $allfields, $q2show = 'all', $use
break;
case 'html':
$sGoogleMapsAPIKey = trim(Yii::app()->getConfig("googleMapsAPIKey"));
if ($sGoogleMapsAPIKey != '') {
$sGoogleMapsAPIKey = '&key=' . $sGoogleMapsAPIKey;
if (!empty($sGoogleMapsAPIKey)) {
$sOutputHTML .= "<script type=\"text/javascript\" src=\"//maps.googleapis.com/maps/api/js?sensor=false&key={$sGoogleMapsAPIKey}\"></script>\n";
}
$sSSL = '';
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != "off") {
$sSSL = 's';
}
$sOutputHTML .= "<script type=\"text/javascript\" src=\"http{$sSSL}://maps.googleapis.com/maps/api/js?sensor=false$sGoogleMapsAPIKey\"></script>\n"
. "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";
$sOutputHTML .= "<script type=\"text/javascript\">var site_url='" . Yii::app()->baseUrl . "';var temppath='" . Yii::app()->getConfig("tempurl") . "';var imgpath='" . Yii::app()->getConfig('adminimageurl') . "';var aStatData=" . ls_json_encode($aStatisticsData) . "</script>";
return $sOutputHTML;

break;
Expand Down
3 changes: 2 additions & 1 deletion application/models/LSActiveRecord.php
Expand Up @@ -244,6 +244,7 @@ public function findAllByAttributes($attributes, $condition = '', $params = arra
* @param int $iSurveyId
* @param string $sClassName
* @return array
* TODO: Should be split into seperate functions in the appropiate model or helper class
*/
public function getAllEncryptedAttributes($iSurveyId = 0, $sClassName)
{
Expand Down Expand Up @@ -357,7 +358,7 @@ public static function decryptSingle($value = '')

/**
* Enrypt single value
* @param string $value String value which needs to be decrypted
* @param string $value String value which needs to be encrypted
*/
public static function encryptSingle($value = '')
{
Expand Down

0 comments on commit 9c6411c

Please sign in to comment.