Beispiel #1
0
function CondDate($condparm)
{
    global $Now;
    if (!preg_match('/^(\\S*?)(\\.\\.(\\S*))?(\\s+\\S.*)?$/', trim($condparm), $match)) {
        return false;
    }
    if ($match[4] == '') {
        $x0 = $Now;
        NoCache();
    } else {
        list($x0, $x1) = DRange($match[4]);
    }
    if ($match[1] > '') {
        list($t0, $t1) = DRange($match[1]);
        if ($x0 < $t0) {
            return false;
        }
        if ($match[2] == '' && $x0 >= $t1) {
            return false;
        }
    }
    if ($match[3]) {
        list($t0, $t1) = Drange($match[3]);
        if ($x0 >= $t1) {
            return false;
        }
    }
    return true;
}
Beispiel #2
0
function ME_ftime($arg0 = '', $arg1 = '', $argp = NULL) {
  global $TimeFmt, $Now, $FTimeFmt;
  if (@$argp['fmt']) $fmt = $argp['fmt']; 
  else if (strpos($arg0, '%') !== false) { $fmt = $arg0; $arg0 = $arg1; }
  else if (strpos($arg1, '%') !== false) $fmt = $arg1;
  ## determine the timestamp
  if (isset($argp['when'])) list($time, $x) = DRange($argp['when']);
  else if ($arg0 > '') list($time, $x) = DRange($arg0);
  else $time = $Now;
  if (@$fmt == '') { SDV($FTimeFmt, $TimeFmt); $fmt = $FTimeFmt; }
  ##  make sure we have %F available for ISO dates
  $fmt = str_replace(array('%F', '%s'), array('%Y-%m-%d', $time), $fmt);
  return strftime($fmt, $time);
}