Index: branches/unlabeled/unlabeled-1.103.2/kernel/action.php =================================================================== diff -u -r3937 -r3962 --- branches/unlabeled/unlabeled-1.103.2/kernel/action.php (.../action.php) (revision 3937) +++ branches/unlabeled/unlabeled-1.103.2/kernel/action.php (.../action.php) (revision 3962) @@ -78,10 +78,10 @@ $dupe_user = ''; //$user_pending = (int)$_POST["user_pending"]; //$user_enabled = (int)$_POST["user_enabled"]; - $CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat()); + $CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat(0, true)); $CreatedOn += SecondsSinceMidnight($_POST["user_time"]); - $dob = DateTimestamp($_POST["user_dob"],GetDateFormat()); + $dob = DateTimestamp($_POST["user_dob"],GetDateFormat(0, true)); $objEditItems = new clsUserManager(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalUser"); @@ -153,9 +153,9 @@ break; case "m_edit_user": - //$CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat()); + //$CreatedOn = DateTimestamp($_POST["user_date"],GetDateFormat(0, true)); //$CreatedOn += SecondsSinceMidnight($_POST["user_time"]); - $dob = DateTimestamp($_POST["user_dob"],GetDateFormat()); + $dob = DateTimestamp($_POST["user_dob"],GetDateFormat(0, true)); $objEditItems = new clsUserManager(); $objEditItems->SourceTable = $objSession->GetEditTable("PortalUser"); //$user_pending = (int)$_POST["user_pending"]; @@ -236,7 +236,7 @@ case 'm_group_edit': // when editing user membership in group - $membership_expires = DateTimestamp( $_POST['membership_expires_date'], GetDateFormat() ); + $membership_expires = DateTimestamp( $_POST['membership_expires_date'], GetDateFormat(0, true) ); $membership_expires += SecondsSinceMidnight( $_POST['membership_expires_time'] ); $objEditItems = new clsUserGroupList(); @@ -780,12 +780,12 @@ case "m_add_category": - if(ValidDate($_POST["cat_date"],GetDateFormat())) - { - $CreatedOn = DateTimestamp($_POST["cat_date"],GetDateFormat()); + if (ValidDate($_POST['cat_date'], GetDateFormat(0, true))) { + $CreatedOn = DateTimestamp($_POST['cat_date'],GetDateFormat(0, true)); } - else - $CreatedOn = adodb_mktime(); + else { + $CreatedOn = adodb_mktime(); + } $html = (int)$_POST["html_enable"]; $cat_pick = GetVar('cat_pick'); @@ -823,7 +823,7 @@ break; case "m_edit_category": - $CreatedOn = DateTimestamp($_POST["cat_date"],GetDateFormat()); + $CreatedOn = DateTimestamp($_POST["cat_date"],GetDateFormat(0, true)); $cat_pick = GetVar('cat_pick'); $Status = (int)$_POST["status"]; $Hot = false; //(int)$_POST["itemhot"]; @@ -1062,7 +1062,7 @@ $Pending = (int)$_POST["review_pending"]; $Enabled = (int)$_POST["review_enabled"]; $Status = (int)$_POST["status"]; - $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat()); + $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat(0, true)); $CreatedOn += SecondsSinceMidnight($_POST["review_time"]); $html = (int)$_POST["html_enable"]; $ReviewText = inp_escape($_POST["review_body"],1); @@ -1112,7 +1112,7 @@ $objReviews = new clsItemReviewList(); $objReviews->SourceTable = $objSession->GetEditTable("ItemReview"); $Status = (int)$_POST["status"]; - $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat()); + $CreatedOn = DateTimestamp($_POST["review_date"],GetDateFormat(0, true)); $CreatedOn += SecondsSinceMidnight($_POST["review_time"]); $html = (int)$_POST["html_enable"]; $ReviewText = inp_escape($_POST["review_body"],1); Index: branches/unlabeled/unlabeled-1.23.10/kernel/admin_templates/incs/form_blocks.tpl =================================================================== diff -u -r3581 -r3962 --- branches/unlabeled/unlabeled-1.23.10/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 3581) +++ branches/unlabeled/unlabeled-1.23.10/kernel/admin_templates/incs/form_blocks.tpl (.../form_blocks.tpl) (revision 3962) @@ -105,11 +105,11 @@ "> - " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> () + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> () - " id="" value=""> + " id="" value="">   @@ -125,12 +125,12 @@ - " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> - () + " id="" value="" tabindex="" size="" class="" datepickerIcon="admin/images/ddarrow.gif"> + () -  " id="" value="" tabindex="" size="" class=""> () +  " id="" value="" tabindex="" size="" class=""> ()   Index: branches/unlabeled/unlabeled-1.17.44/kernel/include/portalgroup.php =================================================================== diff -u -r3937 -r3962 --- branches/unlabeled/unlabeled-1.17.44/kernel/include/portalgroup.php (.../portalgroup.php) (revision 3937) +++ branches/unlabeled/unlabeled-1.17.44/kernel/include/portalgroup.php (.../portalgroup.php) (revision 3962) @@ -224,11 +224,11 @@ break; case 'membership_expires_date': - return $this->Get('MembershipExpires') <= 0 ? '' : LangDate( $this->Get('MembershipExpires') ); + return $this->Get('MembershipExpires') <= 0 ? '' : LangDate( $this->Get('MembershipExpires'), 0, true ); break; case 'membership_expires_time': - return $this->Get('MembershipExpires') <= 0 ? '' : LangTime( $this->Get('MembershipExpires') ); + return $this->Get('MembershipExpires') <= 0 ? '' : LangTime( $this->Get('MembershipExpires'), 0, true ); break; case "group_id": Index: branches/unlabeled/unlabeled-1.95.2/kernel/parser.php =================================================================== diff -u -r3886 -r3962 --- branches/unlabeled/unlabeled-1.95.2/kernel/parser.php (.../parser.php) (revision 3886) +++ branches/unlabeled/unlabeled-1.95.2/kernel/parser.php (.../parser.php) (revision 3962) @@ -793,7 +793,7 @@ $FormValues[$FormName]["zip"] = $u->Get("Zip"); $FormValues[$FormName]["country"] = $u->Get("Country"); -// $FormValues[$FormName]["dob"] = LangDate($u->Get("dob")); +// $FormValues[$FormName]["dob"] = LangDate($u->Get("dob"), 0, true); $FormValues[$FormName]["dob_day"] = adodb_date("d", $u->Get("dob")); $FormValues[$FormName]["dob_year"] = adodb_date("Y", $u->Get("dob")); $FormValues[$FormName]["dob_month"] = adodb_date("m", $u->Get("dob")); @@ -1396,7 +1396,7 @@ { $l = $objLanguages->GetItemByField("PackName",$lang); } - $fmt = GetDateFormat($LangId); + $fmt = GetDateFormat($LangId, true); $fmt = GetStdFormat($fmt); return $fmt; Index: branches/unlabeled/unlabeled-1.96.2/globals.php =================================================================== diff -u -r3867 -r3962 --- branches/unlabeled/unlabeled-1.96.2/globals.php (.../globals.php) (revision 3867) +++ branches/unlabeled/unlabeled-1.96.2/globals.php (.../globals.php) (revision 3962) @@ -1161,41 +1161,36 @@ unset($objTagList); } -function GetDateFormat($LangId=0) -{ - global $objLanguages; + function GetDateFormat($LangId = 0, $is_input = false) + { + global $objLanguages; + + if (!$LangId) { + $LangId = $objLanguages->GetPrimary(); + } + + $l = $objLanguages->GetItem($LangId); + $fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'DateFormat') : 'm-d-Y'; + + if (getArrayValue($GLOBALS, 'FrontEnd')) { + return $fmt; + } + return preg_replace('/y+/i','Y', $fmt); + } - if(!$LangId) - $LangId= $objLanguages->GetPrimary(); - $l = $objLanguages->GetItem($LangId); - if(is_object($l)) - { - $fmt = $l->Get("DateFormat"); - } - else - $fmt = "m-d-Y"; + function GetTimeFormat($LangId = 0, $is_input = false) + { + global $objLanguages; - if(isset($GLOBALS['FrontEnd'])&&$GLOBALS['FrontEnd']) + if (!$LangId) { + $LangId = $objLanguages->GetPrimary(); + } + $l = $objLanguages->GetItem($LangId); + + $fmt = is_object($l) ? $l->Get(($is_input ? 'Input' : '').'TimeFormat') : 'H:i:s'; return $fmt; - return preg_replace('/y+/i','Y',$fmt); -} + } -function GetTimeFormat($LangId=0) -{ - global $objLanguages; - - if(!$LangId) - $LangId= $objLanguages->GetPrimary(); - $l = $objLanguages->GetItem($LangId); - if(is_object($l)) - { - $fmt = $l->Get("TimeFormat"); - } - else - $fmt = "H:i:s"; - return $fmt; -} - /** * Gets one of currently selected language options * @@ -1214,18 +1209,32 @@ return is_object($l)?$l->Get($optionName):false; } -function LangDate($TimeStamp=NULL,$LangId=0) +/** + * Returns formatted timestamp + * + * @param int $TimeStamp + * @param int $LangId + * @param bool $is_input use input date format instead of display date format + * @return string + */ +function LangDate($TimeStamp = null, $LangId = 0, $is_input = false) { - $fmt = GetDateFormat($LangId); - $ret = adodb_date($fmt,$TimeStamp); - return $ret; + $fmt = GetDateFormat($LangId, $is_input); + return adodb_date($fmt, $TimeStamp); } -function LangTime($TimeStamp=NULL,$LangId=0) +/** + * Returns formatted timestamp + * + * @param int $TimeStamp + * @param int $LangId + * @param bool $is_input use input time format instead of display time format + * @return string + */ +function LangTime($TimeStamp = null, $LangId = 0, $is_input = false) { - $fmt = GetTimeFormat($LangId); - $ret = adodb_date($fmt,$TimeStamp); - return $ret; + $fmt = GetTimeFormat($LangId, $is_input); + return adodb_date($fmt, $TimeStamp); } function LangNumber($Num,$DecPlaces=NULL,$LangId=0) Index: branches/unlabeled/unlabeled-1.65.2/kernel/frontaction.php =================================================================== diff -u -r3874 -r3962 --- branches/unlabeled/unlabeled-1.65.2/kernel/frontaction.php (.../frontaction.php) (revision 3874) +++ branches/unlabeled/unlabeled-1.65.2/kernel/frontaction.php (.../frontaction.php) (revision 3962) @@ -451,16 +451,15 @@ if($Status>0) { - if($objConfig->Get("User_Password_Auto")) - { + if ($objConfig->Get("User_Password_Auto")) { $password = makepassword(); $objSession->Set("password", $password); } - else + else { $password = $_POST["password"]; - - $_POST["dob"] = $_POST["dob_month"]."/".$_POST["dob_day"]."/".$_POST["dob_year"]; - $dob = DateTimestamp($_POST["dob"],GetDateFormat()); + } + + $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); $ip = $_SERVER['REMOTE_ADDR']; $u = &$objUsers->Add_User($_POST["username"], md5($password), $_POST["email"], $CreatedOn, $_POST["firstname"], $_POST["lastname"], $Status, $_POST["phone"], $_POST["street"], $_POST["city"], $_POST["state"], $_POST["zip"], $_POST["country"], $dob, $ip, TRUE); @@ -602,8 +601,7 @@ /* save profile */ $u =& $objUsers->GetItem($UserId); $status = $u->Get("Status"); - $_POST["dob"] = $_POST["dob_month"]."/".$_POST["dob_day"]."/".$_POST["dob_year"]; - $dob = DateTimestamp($_POST["dob"], GetDateFormat()); + $dob = adodb_mktime(0, 0, 0, $_POST['dob_month'], $_POST['dob_day'], $_POST['dob_year']); if(strlen($_POST["password"])>0) { $password = md5($_POST["password"]); Index: branches/unlabeled/unlabeled-1.33.2/kernel/include/portaluser.php =================================================================== diff -u -r3910 -r3962 --- branches/unlabeled/unlabeled-1.33.2/kernel/include/portaluser.php (.../portaluser.php) (revision 3910) +++ branches/unlabeled/unlabeled-1.33.2/kernel/include/portaluser.php (.../portaluser.php) (revision 3962) @@ -701,13 +701,13 @@ return $this->Get("Email"); break; case "user_date": - return LangDate($this->Get("CreatedOn")); + return LangDate($this->Get('CreatedOn'), 0, true); break; case "user_time": - return LangTime($this->Get("CreatedOn")); + return LangTime($this->Get('CreatedOn'), 0, true); break; case "user_dob": - return LangDate($this->Get("dob")); + return LangDate($this->Get('dob'), 0, true); break; case "user_password": Index: branches/unlabeled/unlabeled-1.42.10/core/kernel/db/db_tag_processor.php =================================================================== diff -u -r3688 -r3962 --- branches/unlabeled/unlabeled-1.42.10/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3688) +++ branches/unlabeled/unlabeled-1.42.10/core/kernel/db/db_tag_processor.php (.../db_tag_processor.php) (revision 3962) @@ -704,6 +704,8 @@ $options = $object->GetFieldOptions($field); + $format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ]; + $formatter_class = getArrayValue($options,'formatter'); if($formatter_class) { @@ -717,12 +719,12 @@ } elseif($human_format || $edit_size) { - $format = $formatter->HumanFormat($options['format']); + $format = $formatter->HumanFormat($format); return $edit_size ? strlen($format) : $format; } } - return $options['format']; + return $format; } /** @@ -1387,6 +1389,8 @@ $options = $object->GetFieldOptions($field); + $format = $options[ $this->SelectParam($params, 'input_format') ? 'input_format' : 'format' ]; + $formatter_class = getArrayValue($options,'formatter'); if($formatter_class) { @@ -1400,12 +1404,12 @@ } elseif($human_format || $edit_size) { - $format = $formatter->HumanFormat($options['format']); + $format = $formatter->HumanFormat($format); return $edit_size ? strlen($format) : $format; } } - return $options['format']; + return $format; } /** @@ -1418,13 +1422,17 @@ { $field = $this->SelectParam($params, 'field,name'); + + $error_var_name = $this->getPrefixSpecial().'_'.$field.'_'.$params['type'].'_error'; $error_msg = $this->Application->RecallVar($error_var_name); if($error_msg) { $this->Application->StoreVar($error_var_name, ''); } - return $error_msg; + + $object =& $this->Application->recallObject($this->Prefix.'.'.$this->Special.'-item', null, Array('skip_autoload' => true)); + return $object->ErrorMsgs[$error_msg]; } /** Index: branches/unlabeled/unlabeled-1.10.10/kernel/admin_templates/visits/visits_list.tpl =================================================================== diff -u -r3665 -r3962 --- branches/unlabeled/unlabeled-1.10.10/kernel/admin_templates/visits/visits_list.tpl (.../visits_list.tpl) (revision 3665) +++ branches/unlabeled/unlabeled-1.10.10/kernel/admin_templates/visits/visits_list.tpl (.../visits_list.tpl) (revision 3962) @@ -64,10 +64,10 @@ : - " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> - () + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> + () @@ -76,10 +76,10 @@ : - " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> - () + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> + () Index: branches/unlabeled/unlabeled-1.30.10/core/kernel/utility/formatters.php =================================================================== diff -u -r3699 -r3962 --- branches/unlabeled/unlabeled-1.30.10/core/kernel/utility/formatters.php (.../formatters.php) (revision 3699) +++ branches/unlabeled/unlabeled-1.30.10/core/kernel/utility/formatters.php (.../formatters.php) (revision 3962) @@ -256,18 +256,24 @@ if ($date_format === false) $date_format = $language->GetDBField('DateFormat'); if ($time_format === false) $time_format = $language->GetDBField('TimeFormat'); + $input_format['date'] = $language->GetDBField('InputDateFormat'); + $input_format['time'] = $language->GetDBField('InputTimeFormat'); + if (!isset($field_options['date_time_separator'])) $field_options['date_time_separator'] = ' '; $field_options['format'] = $date_format.$field_options['date_time_separator'].$time_format; + $field_options['input_format'] = $input_format['date'].$field_options['date_time_separator'].$input_format['time']; + $field_options['sub_fields'] = Array('date' => $field_name.'_date', 'time' => $field_name.'_time'); $add_fields = Array(); - $opts = Array('master_field' => $field_name, 'formatter'=>'kDateFormatter', 'format'=>$date_format); + $opts = Array('master_field' => $field_name, 'formatter'=>'kDateFormatter', 'format' => $date_format, 'input_format' => $input_format['date']); if ( isset($field_options['default']) ) $opts['default'] = $field_options['default']; if ( isset($field_options['required']) ) $opts['required'] = $field_options['required']; $add_fields[$field_name.'_date'] = $opts; $opts['format'] = $time_format; + $opts['input_format'] = $input_format['time']; $add_fields[$field_name.'_time'] = $opts; $filter_type = getArrayValue($field_options, 'filter_type'); @@ -316,7 +322,11 @@ if($empty_time === false) $empty_time = adodb_mktime(0,0,0); $object->SetDBField($sub_fields['time'], $empty_time); } - $object->SetField($field, $object->GetField($sub_fields['date']).$options['date_time_separator'].$object->GetField($sub_fields['time'])); + + $input_format['date'] = $object->Fields[ $sub_fields['date'] ]['input_format']; + $input_format['time'] = $object->Fields[ $sub_fields['time'] ]['input_format']; + + $object->SetField($field, $object->GetField($sub_fields['date'], $input_format['date']).$options['date_time_separator'].$object->GetField($sub_fields['time'], $input_format['time'])); } // when in one of sub_fields - call update for master_field to update its value from sub_fields [are you following ? :) ] elseif ($master_field = getArrayValue($options, 'master_field') ) { @@ -423,7 +433,7 @@ if($value == '') return NULL; //return strtotime($value); - $format = $options['format']; + $format = $options['input_format']; if($dt_separator) $format = trim($format, $dt_separator); $object->FieldErrors[$field_name]['params'] = Array( $this->HumanFormat($format), adodb_date($format) ); @@ -555,7 +565,7 @@ function GetSample($field, &$options, &$object) { - return $this->Format( adodb_mktime(), $field, $object); + return $this->Format( adodb_mktime(), $field, $object, $options['input_format']); } } Index: branches/unlabeled/unlabeled-1.11.50/admin/include/tabs.js =================================================================== diff -u -r1567 -r3962 --- branches/unlabeled/unlabeled-1.11.50/admin/include/tabs.js (.../tabs.js) (revision 1567) +++ branches/unlabeled/unlabeled-1.11.50/admin/include/tabs.js (.../tabs.js) (revision 3962) @@ -7,7 +7,7 @@ var form_result = true; var field_result = true; var j = 0; - + for (var i = 0; i < f.elements.length; i++) { ValType = ''; Index: branches/unlabeled/unlabeled-1.48.2/kernel/include/category.php =================================================================== diff -u -r3885 -r3962 --- branches/unlabeled/unlabeled-1.48.2/kernel/include/category.php (.../category.php) (revision 3885) +++ branches/unlabeled/unlabeled-1.48.2/kernel/include/category.php (.../category.php) (revision 3962) @@ -1430,7 +1430,7 @@ break; case "cat_date": - return LangDate($this->Get("CreatedOn")); + return LangDate($this->Get("CreatedOn"), 0, true); break; case "cat_num_cats": return $this->Get("CachedDescendantCatsQty"); Index: branches/unlabeled/unlabeled-1.10.10/core/admin_templates/logs/visits/visits_list.tpl =================================================================== diff -u -r3665 -r3962 --- branches/unlabeled/unlabeled-1.10.10/core/admin_templates/logs/visits/visits_list.tpl (.../visits_list.tpl) (revision 3665) +++ branches/unlabeled/unlabeled-1.10.10/core/admin_templates/logs/visits/visits_list.tpl (.../visits_list.tpl) (revision 3962) @@ -64,10 +64,10 @@ : - " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> - () + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> + () @@ -76,10 +76,10 @@ : - " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> - () + " id="" value="" size="" datepickerIcon="admin/images/ddarrow.gif"> + () Index: branches/unlabeled/unlabeled-1.21.16/kernel/include/itemreview.php =================================================================== diff -u -r3496 -r3962 --- branches/unlabeled/unlabeled-1.21.16/kernel/include/itemreview.php (.../itemreview.php) (revision 3496) +++ branches/unlabeled/unlabeled-1.21.16/kernel/include/itemreview.php (.../itemreview.php) (revision 3962) @@ -331,12 +331,14 @@ return $res; break; case "review_created_date": - return LangDate($this->Get("CreatedOn")); - break; + return LangDate($this->Get('CreatedOn'), 0, true); + break; + case "review_created_time": - if($this->Get("CreatedOn")<=0) - return ""; - return adodb_date($objConfig->TimeFormat(), $this->Get("CreatedOn")); + if ($this->Get('CreatedOn') <= 0) { + return ''; + } + return LangTime($this->Get('CreatedOn'), 0, true); break; case "review_created_date_month": Index: branches/unlabeled/unlabeled-1.10.2/admin/head.php =================================================================== diff -u -r3946 -r3962 --- branches/unlabeled/unlabeled-1.10.2/admin/head.php (.../head.php) (revision 3946) +++ branches/unlabeled/unlabeled-1.10.2/admin/head.php (.../head.php) (revision 3962) @@ -40,7 +40,7 @@ if ($use_xml) { ?>