Skip to content
Snippets Groups Projects
Commit 57540eeb authored by tbrehm's avatar tbrehm
Browse files

Added new "DATE" datatype which uses the native mysql date format instead of...

Added new "DATE" datatype which uses the native mysql date format instead of tstamps in tform library. The old tstamp datatype as been renamed to "DATETSTAMP".
parent 6f4add6f
No related branches found
No related tags found
No related merge requests found
......@@ -281,7 +281,17 @@ class listform {
$record[$key] = htmlentities(stripslashes($record[$key]),ENT_QUOTES,$conf["html_content_encoding"]);
break;
case 'DATE':
case 'DATETSTAMP':
if ($record[$key] > 0) {
// is value int?
if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
$record[$key] = date($this->lng('conf_format_dateshort'), $record[$key]);
} else {
$record[$key] = date($this->lng('conf_format_dateshort'), strtotime($record[$key]));
}
}
break;
case 'DATE':
if ($record[$key] > 0) {
// is value int?
if (ereg("^[0-9]+[.]?[0-9]*$", $record[$key], $p)) {
......@@ -340,11 +350,17 @@ class listform {
}
break;
case 'DATE':
case 'DATETSTAMP':
if($record[$key] > 0) {
$record[$key] = date('Y-m-d',strtotime($record[$key]));
}
break;
case 'DATE':
if($record[$key] != '' && $record[$key] != '0000-00-00') {
$record[$key] = $record[$key];
}
break;
case 'DATETIME':
if($record[$key] > 0) {
......
......@@ -176,11 +176,18 @@ class tform {
$new_record[$key] = $record[$key];
break;
case 'DATE':
case 'DATETSTAMP':
if($record[$key] > 0) {
$new_record[$key] = date($this->dateformat,$record[$key]);
}
break;
case 'DATE':
if($record[$key] != '' && $record[$key] != '0000-00-00') {
$tmp = explode('-',$record[$key]);
$new_record[$key] = date($this->dateformat,mktime(0, 0, 0, $tmp[1] , $tmp[2], $tmp[0]));
}
break;
case 'INTEGER':
$new_record[$key] = intval($record[$key]);
......@@ -596,13 +603,23 @@ class tform {
$new_record[$key] = implode($field['separator'],$record[$key]);
}
break;
case 'DATE':
case 'DATETSTAMP':
if($record[$key] > 0) {
list($tag,$monat,$jahr) = explode('.',$record[$key]);
$new_record[$key] = mktime(0,0,0,$monat,$tag,$jahr);
} else {
$new_record[$key] = 0;
}
break;
case 'DATE':
if($record[$key] != '' && $record[$key] != '0000-00-00') {
list($tag,$monat,$jahr) = explode('.',$record[$key]);
$new_record[$key] = $jahr.'-'.$monat.'-'.$tag;
//$tmp = strptime($record[$key],$this->dateformat);
//$new_record[$key] = ($tmp['tm_year']+1900).'-'.($tmp['tm_mon']+1).'-'.$tmp['tm_mday'];
} else {
$new_record[$key] = '0000-00-00';
}
break;
case 'INTEGER':
$new_record[$key] = (isset($record[$key]))?$record[$key]:0;
......
......@@ -31,4 +31,5 @@ $wb['top_menu_sites'] = 'Sites';
$wb['top_menu_dns'] = 'DNS';
$wb['top_menu_tools'] = 'Tools';
$wb['top_menu_help'] = 'Support';
$wb['top_menu_billing'] = 'Billing';
?>
......@@ -31,5 +31,6 @@ $wb['top_menu_sites'] = 'Sites';
$wb['top_menu_dns'] = 'DNS';
$wb['top_menu_tools'] = 'Tools';
$wb['top_menu_help'] = 'Help';
$wb['top_menu_billing'] = 'Billing';
$wb['toolsarea_head_txt'] = 'Tools';
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment