diff --git a/extend/fast/Date.php b/extend/fast/Date.php
index 7a7e1f89..f68696ab 100644
--- a/extend/fast/Date.php
+++ b/extend/fast/Date.php
@@ -124,7 +124,7 @@ class Date
*/
public static function human($remote, $local = null)
{
- $time_diff = (is_null($local) ? time() : $local) - $remote;
+ $time_diff = (is_null($local) ? time() : $local) - (int)$remote;
$tense = $time_diff < 0 ? 'after' : 'ago';
$time_diff = abs($time_diff);
$chunks = [
@@ -196,11 +196,11 @@ class Date
case 'quarter':
$quarter = ceil(date('n', $baseTime) / 3) + $offset;
$month = $quarter * 3;
- $offset_year = ceil($month/12) - 1;
+ $offset_year = ceil($month / 12) - 1;
$year = $year + $offset_year;
$month = $month - ($offset_year * 12);
$time = $position ?
- mktime(0, 0, 0, $month-2, 1, $year) :
+ mktime(0, 0, 0, $month - 2, 1, $year) :
mktime(23, 59, 59, $month, self::days_in_month($month, $year), $year);
break;
case 'year':
diff --git a/extend/fast/Form.php b/extend/fast/Form.php
index 3260c4df..8c601aed 100644
--- a/extend/fast/Form.php
+++ b/extend/fast/Form.php
@@ -205,6 +205,7 @@ class FormBuilder
$value = $this->getValueAttribute($name, $value);
$options['class'] = isset($options['class']) ? $options['class'] . (stripos($options['class'], 'form-control') !== false ? '' : ' form-control') : 'form-control';
}
+ $value = $this->escape($value);
$merge = compact('type', 'value', 'id');
$options = array_merge($options, $merge);
@@ -586,9 +587,9 @@ EOD;
public function datetimepicker($name, $value, $options = [])
{
$defaults = [
- 'data-date-format' => "YYYY-MM-DD HH:mm:ss",
+ 'data-date-format' => "YYYY-MM-DD HH:mm:ss",
// 兼容旧的用法
- 'data-use-current' => "true",
+ 'data-use-current' => "true",
'data-date-use-current' => "true",
];
$value = is_numeric($value) ? date("Y-m-d H:i:s", $value) : $value;
@@ -680,6 +681,7 @@ EOD;
return "{$value}";
}, $title));
$value = is_array($value) ? json_encode($value) : $value;
+ $value = $this->escape($value);
$html = <<
@@ -710,7 +712,8 @@ EOD;
$level = $index + 1;
$class = "cxselect-{$level}";
$classes[] = $class;
- $selectValue = isset($values[$value]) ? $values[$value] : (isset($values[$index]) ? $values[$index] : '');
+ $selectValue = $values[$value] ?? ($values[$index] ?? '');
+ $selectValue = $this->escape($selectValue);
$cxselect[] = <<