Permalink
Browse files

Time tweaks

  • Loading branch information...
bloatware committed Nov 8, 2018
1 parent ffa53ab commit bf13550eb947c4ea9166fb0ac9b1b97cf6d224e9
Showing with 6 additions and 3 deletions.
  1. +5 −2 textpattern/lib/txplib_misc.php
  2. +1 −1 textpattern/lib/txplib_publish.php
@@ -5210,7 +5210,7 @@ function buildTimeSql($month, $time, $field = 'Posted')
$start = $month ? strtotime($month) : time() or $start = time();
$timeq = "$safe_field LIKE '".doSlash(strftime($time, $start))."%'";
} else {
$start = $month ? strtotime($month) : false;
$start = $month ? safe_strtotime($month) : false;
if ($start === false) {
$from = $month ? "'".doSlash($month)."'" : now($field);
@@ -5230,7 +5230,10 @@ function buildTimeSql($month, $time, $field = 'Posted')
list($start, $stop) = array($stop, $start);
}
$timeq = ($start == $stop ? "0" : "$safe_field BETWEEN FROM_UNIXTIME($start) AND FROM_UNIXTIME($stop)");
$timeq = ($start == $stop ?
"$safe_field = FROM_UNIXTIME($start)" :
"$safe_field BETWEEN FROM_UNIXTIME($start) AND FROM_UNIXTIME($stop)"
);
}
}
@@ -956,7 +956,7 @@ function filterAtts($atts = null, $iscustom = null)
if ($expired && $expired != '1') {
$timeq .= ' AND '.buildTimeSql($expired, $time === null && !strtotime($expired) ? 'any' : $time, 'Expires');
} elseif (!$expired) {
$timeq .= ' AND ('.now('expires').' <= Expires OR Expires IS NULL)';
$timeq .= ' AND (Expires IS NULL OR '.now('expires').' <= Expires)';
}
if ($q && $searchsticky) {

0 comments on commit bf13550

Please sign in to comment.