Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:LimeSurvey/LimeSurvey.git int…
Browse files Browse the repository at this point in the history
…o answers_html

# Conflicts:
#	scripts/expressions/em_javascript.js
  • Loading branch information
Shnoulle committed Oct 15, 2016
2 parents 5b45926 + 8341e9f commit 84c13e7
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 7 deletions.
31 changes: 29 additions & 2 deletions application/controllers/InstallerController.php
Expand Up @@ -790,8 +790,8 @@ function is_writable_recursive($sDirectory)
/**
* check for a specific PHPFunction, return HTML image
*
* @param string $function
* @param string $image return
* @param string $sFunctionName
* @param string $sImage return
* @return bool result
*/
function check_PHPFunction($sFunctionName, &$sImage)
Expand Down Expand Up @@ -933,6 +933,9 @@ function check_DirectoryWriteable($directory, &$data, $base, $keyError, $bRecurs
// imap php library check
check_PHPFunction('imap_open', $aData['bIMAPPresent']);

// Silently check some default PHP extensions
$this->checkDefaultExtensions();

return $bProceed;
}

Expand Down Expand Up @@ -1365,4 +1368,28 @@ private function dbTest($aDbConfig = array(), $aData = array())

return true;
}

/**
* Contains a number of extensions that can be expected
* to be installed by default, but maybe not on BSD systems etc.
* Check them silently and die if they are missing.
* @return void
*/
private function checkDefaultExtensions()
{
$extensions = array(
'simplexml',
'filter',
'ctype',
'session',
'hash'
);

foreach ($extensions as $extension) {
if (!extension_loaded($extension)) {
die('You\'re missing default PHP extension ' . $extension);
}
}

}
}
2 changes: 1 addition & 1 deletion application/models/Token.php
Expand Up @@ -108,7 +108,7 @@ public static function createTable($surveyId, array $extraFields = array())
foreach($tokenattributefieldnames as $attrname=>$attrdetails)
{
if (!isset($fields[$attrname])) {
$fields[$attrname] = 'string(255)';
$fields[$attrname] = 'text';
}
}

Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/tokenwarning.php
Expand Up @@ -61,7 +61,7 @@
</p>
<p>
<?php echo CHtml::form(array("admin/tokens/sa/index/surveyid/{$surveyid}"), 'post'); ?>
<select size='4' name='oldtable' style='width:250px;'>
<select size='4' name='oldtable'>
<?php
foreach ($oldlist as $ol)
{
Expand Down
12 changes: 9 additions & 3 deletions scripts/expressions/em_javascript.js
Expand Up @@ -737,7 +737,7 @@ function LEMval(alias)
var sdatetimePattern=$(jsName.replace(/java/g, '#dateformat')).attr('value');

// if undefined (eg., variable on a previous page), set default format yy-mm-dd HH:MM
sdatetimePattern=typeof sdatetimePattern=='undefined'? 'yy-mm-dd HH:MM': sdatetimePattern;
sdatetimePattern =typeof sdatetimePattern == 'undefined'? 'YYYY-MM-DD HH:mm': sdatetimePattern;

if (sdatetimePattern==null) {
sdatetimePattern="";
Expand All @@ -757,8 +757,14 @@ function LEMval(alias)
return value;
}
else {
var decimal_safe = new Decimal(value);
return parseFloat(decimal_safe.valueOf());
// If it's not a decimal number, just return value
try {
var decimal_safe = new Decimal(value);
return parseFloat(decimal_safe.valueOf());
}
catch (ex) {
return value;
}
}
}
case 'rowdivid':
Expand Down

0 comments on commit 84c13e7

Please sign in to comment.