added dd/mm/yyyy as an acceptable date format

This commit is contained in:
SJ 2013-07-28 20:56:59 +02:00
parent bd484784f9
commit 9a23429cf6
8 changed files with 23 additions and 52 deletions

View File

@ -173,10 +173,10 @@ $config['PILER_LOGIN_HELPER_PLACEHOLDER'] = 'PILER_COMMENT_FOR_PROPER_LOGIN_SO_T
$config['SIZE_X'] = 430;
$config['SIZE_Y'] = 250;
$config['AUDIT_DATE_FORMAT'] = 'Y.m.d H:i';
$config['SEARCH_HIT_DATE_FORMAT'] = 'Y.m.d';
$config['DATE_TEMPLATE'] = 'Y.m.d';
$config['DATE_FORMAT'] = 'YYYY-MM-DD';
$config['JQUERY_DATE_FORMAT'] = 'yy-mm-dd';
$config['DATE_FORMAT'] = '(Y.m.d.)';
$config['FROM_LENGTH_TO_SHOW'] = 28;
@ -184,8 +184,6 @@ $config['HISTORY_REFRESH'] = 60;
$config['HEALTH_REFRESH'] = 60;
$config['HEALTH_RATIO'] = 80;
$config['LOG_DATE_FORMAT'] = 'd-M-Y H:i:s';
$config['MAX_AUDIT_HITS'] = 1000;
$config['MIN_PASSWORD_LENGTH'] = 6;
@ -365,4 +363,5 @@ if(!isset($health_smtp_servers)) {
$health_smtp_servers = array( array(PILER_HOST, PILER_PORT, "piler"), array(SMARTHOST, SMARTHOST_PORT, "smarthost") );
}
?>

View File

@ -120,7 +120,7 @@ class ControllerSearchHelper extends Controller {
while(list($k, $v) = each($b)) {
if($v == '') { continue; }
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v)) {
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v) || preg_match("/\d{1,2}\/\d{1,2}\/\d{4}/", $v)) {
$ndate++;
$this->a["date$ndate"] = $v;
}
@ -164,7 +164,7 @@ class ControllerSearchHelper extends Controller {
else if($v == 'note:') { $token = 'note'; continue; }
else if($v == 'ref:') { $token = 'ref'; continue; }
else {
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v)) {
if(preg_match("/\d{4}\-\d{1,2}\-\d{1,2}/", $v) || preg_match("/\d{1,2}\/\d{1,2}\/\d{4}/", $v)) {
$ndate++;
$this->a["date$ndate"] = $v;
}

View File

@ -91,7 +91,7 @@ class ModelAuditAudit extends Model {
'piler_id' => isset($m[$a['meta_id']]) ? $m[$a['meta_id']] : '',
'action' => $a['action'],
'email' => $a['email'],
'date' => date(AUDIT_DATE_FORMAT, $a['ts']),
'date' => date(DATE_TEMPLATE . " H:i", $a['ts']),
'ipaddr' => DEMO_MODE == 1 ? anonimize_ip_addr($a['ipaddr']) : $a['ipaddr'],
'description' => $a['description'],
'shortdescription' => make_short_string($a['description'], MAX_CGI_FROM_SUBJ_LEN)

View File

@ -510,7 +510,7 @@ class ModelSearchSearch extends Model {
$m['subject'] = escape_gt_lt_quote_symbols($m['subject']);
$m['shortsubject'] = make_short_string($m['subject'], MAX_CGI_FROM_SUBJ_LEN);
$m['date'] = date(SEARCH_HIT_DATE_FORMAT, $m['sent']);
$m['date'] = date(DATE_TEMPLATE, $m['sent']);
$m['size'] = nice_size($m['size']);
in_array($m['from'], $_SESSION['emails']) ? $m['yousent'] = 1 : $m['yousent'] = 0;

View File

@ -8,14 +8,7 @@ function LOGGER($event = '', $username = '') {
else { $username = 'unknown'; }
}
$log_entry = sprintf("[%s]: %s, %s, '%s'\n", date(LOG_DATE_FORMAT), $username, $_SERVER['REMOTE_ADDR'], $event);
if($fp = @fopen(LOG_FILE, 'a')) {
fwrite($fp, $log_entry);
fflush($fp);
fclose($fp);
}
syslog(LOG_INFO, "username=$username, event='$event'");
}
@ -267,33 +260,6 @@ function my_qp_encode($s){
}
function format_qshape($desc = '', $filename = '') {
$leadingspaces = 999;
if($filename == '' || !file_exists($filename) ) { return array(); }
$stat = stat($filename);
$s = file_get_contents($filename);
$a = explode("\n", $s);
while(list($k, $v) = each($a)){
$len1 = strlen($v);
$v = preg_replace("/^\ {0,}/", "", $v);
$delta = $len1 - strlen($v);
if($len1 > 5 && $delta < $leadingspaces) { $leadingspaces = $delta; }
}
reset($a); $s="";
while(list($k, $v) = each($a)){
$s .= substr($v, $leadingspaces, strlen($v)) . "\n";
}
return array('desc' => $desc, 'date' => date(LOG_DATE_FORMAT, $stat['ctime']), 'lines' => $s);
}
function nice_size($size = 0, $space = '') {
if($size < 1000) return "1k";
if($size < 100000) return round($size/1000) . $space . "k";
@ -436,14 +402,20 @@ function fixup_date_condition($field = '', $date1 = 0, $date2 = 0) {
$date = "";
if($date1) {
list($y,$m,$d) = preg_split("/(\.|\-)/", $date1);
list($y,$m,$d) = preg_split("/(\.|\-|\/)/", $date1);
if(DATE_TEMPLATE == 'd/m/Y') { $a = $y; $y = $d; $d = $a; }
$date1 = mktime(0, 0, 0, $m, $d, $y);
if($date1 > 0) { $date .= "$field >= $date1 "; }
}
if($date2) {
list($y,$m,$d) = preg_split("/(\.|\-)/", $date2);
list($y,$m,$d) = preg_split("/(\.|\-|\/)/", $date2);
if(DATE_TEMPLATE == 'd/m/Y') { $a = $y; $y = $d; $d = $a; }
$date2 = mktime(23, 59, 59, $m, $d, $y);
if($date2 > 0) {

View File

@ -1037,8 +1037,8 @@ $.datepicker.setDefaults($.datepicker.regional[Piler.piler_ui_lang]);
});
$("#date1").datepicker( {dateFormat: 'yy-mm-dd' });
$("#date2").datepicker( {dateFormat: 'yy-mm-dd' });
$("#date1").datepicker( {dateFormat: '<?php print JQUERY_DATE_FORMAT; ?>' });
$("#date2").datepicker( {dateFormat: '<?php print JQUERY_DATE_FORMAT; ?>' });
});

View File

@ -62,14 +62,14 @@
<div class="control-group">
<label class="control-label" for="date1"><?php print $text_from; ?> <?php print $text_date; ?>:</label>
<div class="controls">
<input type="text" name="date1" id="date1" size="11" value="<?php if(isset($date1)) { print $date1; } ?>" />
<input type="text" name="date1" id="date1" size="11" value="<?php if(isset($date1)) { print $date1; } ?>" placeholder="<?php print DATE_FORMAT; ?>" />
</div>
</div>
<div class="control-group">
<label class="control-label" for="date2"><?php print $text_to; ?> <?php print $text_date; ?>:</label>
<div class="controls">
<input type="text" name="date2" id="date2" size="11" value="<?php if(isset($date2)) { print $date2; } ?>" />
<input type="text" name="date2" id="date2" size="11" value="<?php if(isset($date2)) { print $date2; } ?>" placeholder="<?php print DATE_FORMAT; ?>" />
</div>
</div>

View File

@ -52,12 +52,12 @@
<div class="row">
<div class="cell1"><?php print $text_date; ?>: </div>
<div class="cell2"><input type="text" name="date1" id="date1" size="11" value="<?php if(isset($date1)) { print $date1; } ?>" placeholder="YYYY-MM-DD" /></div>
<div class="cell2"><input type="text" name="date1" id="date1" size="11" value="<?php if(isset($date1)) { print $date1; } ?>" placeholder="<?php print DATE_FORMAT; ?>" /></div>
</div>
<div class="row">
<div class="cell1">&nbsp;</div>
<div class="cell2"><input type="text" name="date2" id="date2" size="11" value="<?php if(isset($date2)) { print $date2; } ?>" placeholder="YYYY-MM-DD" /></div>
<div class="cell2"><input type="text" name="date2" id="date2" size="11" value="<?php if(isset($date2)) { print $date2; } ?>" placeholder="<?php print DATE_FORMAT; ?>" /></div>
</div>
<div class="row">