Index: branches/5.2.x/units/listings/listings_tag_processor.php =================================================================== diff -u -N -r14254 -r14873 --- branches/5.2.x/units/listings/listings_tag_processor.php (.../listings_tag_processor.php) (revision 14254) +++ branches/5.2.x/units/listings/listings_tag_processor.php (.../listings_tag_processor.php) (revision 14873) @@ -1,6 +1,6 @@ Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); - $listing_type =& $this->Application->recallObject( 'lst', 'lst', $params ); + return $this->_expirationField($params, 'DateFormat'); + } - $dur_type_mapping = Array( 1 => 1, - 2 => 60, - 3 => 3600, - 4 => 3600*24, - 5 => 3600*24*7, - 6 => 3600*24*365/12, - 7 => 3600*24*365 - ); - $duration = $listing_type->GetDBField('Duration'); - $duration_type = $listing_type->GetDBField('DurationType'); - $expiration_interval = $duration * $dur_type_mapping[$duration_type]; - $expiration_date = adodb_mktime() + $expiration_interval; - - $lang =& $this->Application->recallObject('lang.current'); - $format = $lang->GetDBField('DateFormat'); - $expiration_date = adodb_date($format, $expiration_date); - - return $expiration_date; + protected function ExpirationTime($params) + { + return $this->_expirationField($params, 'TimeFormat'); } - function ExpirationTime($params) + protected function _expirationField($params, $format_field) { - $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params ); + $object =& $this->getObject($params); + /* @var $object kDBItem */ + $listing_type =& $this->Application->recallObject( 'lst', 'lst', $params ); + /* @var $listing_type kDBItem */ - $dur_type_mapping = Array( 1 => 1, - 2 => 60, - 3 => 3600, - 4 => 3600*24, - 5 => 3600*24*7, - 6 => 3600*24*365/12, - 7 => 3600*24*365 - ); + $dur_type_mapping = Array ( + 1 => 1, 2 => 60, 3 => 3600, 4 => 3600 * 24, + 5 => 3600 * 24 * 7, 6 => 3600 * 24 * 365 / 12, 7 => 3600 * 24 * 365 + ); + $duration = $listing_type->GetDBField('Duration'); $duration_type = $listing_type->GetDBField('DurationType'); $expiration_interval = $duration * $dur_type_mapping[$duration_type]; $expiration_date = adodb_mktime() + $expiration_interval; $lang =& $this->Application->recallObject('lang.current'); - $format = $lang->GetDBField('TimeFormat'); - $expiration_date = adodb_date($format, $expiration_date); + /* @var $lang LanguagesItem */ - return $expiration_date; + return adodb_date($lang->GetDBField($format_field), $expiration_date); } } \ No newline at end of file