Index: branches/RC/core/units/custom_fields/custom_fields_tag_processor.php =================================================================== diff -u -N -r8929 -r10796 --- branches/RC/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 8929) +++ branches/RC/core/units/custom_fields/custom_fields_tag_processor.php (.../custom_fields_tag_processor.php) (revision 10796) @@ -1,7 +1,7 @@ GetDBField('FieldName').$append; } - + function CustomField($params) { $params['name'] = $this->GetMainField($params); $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); return $this->Application->ProcessParsedTag($source_prefix, 'Field', $params); } - + function CustomFormat($params) { $params['name'] = $this->GetMainField($params); $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); return $this->Application->ProcessParsedTag($source_prefix, 'Format', $params); } - + function CustomInputName($params) { $params['name'] = $this->GetMainField($params); $source_prefix = $this->Application->Parser->GetParam('SourcePrefix'); return $this->Application->ProcessParsedTag($source_prefix, 'InputName', $params); } - + function setParamValue(&$params, $param_name) { // $deep_level if GetParam = 1 used in case if PrintList is called during parsing "grid" block (=> +1 to deep_level) if (!isset($params[$param_name])) { $params[$param_name] = $this->Application->Parser->GetParam($param_name, 1); } - + return $params[$param_name]; } - + /** * Prints list content using block specified * @@ -57,59 +57,59 @@ { $this->setParamValue($params, 'SourcePrefix'); $this->setParamValue($params, 'value_field'); - + $list =& $this->GetList($params); $id_field = $this->Application->getUnitOption($this->Prefix,'IDField'); - + $list->Query(); $o = ''; $list->GoFirst(); $block_params = $this->prepareTagParams($params); $block_params['name'] = $this->SelectParam($params, 'render_as,block'); $block_params['pass_params'] = 'true'; - + $prev_heading = ''; $display_original = false; $source_prefix = getArrayValue($params, 'SourcePrefix'); if ($source_prefix) { - $source_object =& $this->Application->recallObject($source_prefix); + $source_object =& $this->Application->recallObject($source_prefix, null, Array ('raise_warnings' => 0)); // it's possible, that in some cases object will not be loaded /* @var $source_object kCatDBItem */ - + $display_original = $this->Application->ProcessParsedTag($source_prefix, 'DisplayOriginal', Array('display_original' => $this->setParamValue($params, 'display_original'))); } - + if ($display_original) { $block_params['display_original'] = $display_original; $block_params['original_title'] = $this->setParamValue($params, 'original_title'); - $original_object =& $this->Application->recallObject($source_prefix.'.original'); + $original_object =& $this->Application->recallObject($source_prefix.'.original', null, Array ('raise_warnings' => 0)); // it's possible, that in some cases object will not be loaded } - + if ($this->Special == 'general') { $this->groupRecords($list->Records, 'Heading'); } - + while (!$list->EOL()) { $this->Application->SetVar( $this->getPrefixSpecial().'_id', $list->GetDBField($id_field) ); // for edit/delete links using GET - - if ($source_prefix) { + + if ($source_prefix) { $list->SetDBField($params['value_field'], $source_object->GetDBField('cust_'.$list->GetDBField('FieldName'))); if ($display_original) { $list->SetDBField('OriginalValue', $original_object->GetField('cust_'.$list->GetDBField('FieldName'))); } $block_params['field'] = $block_params['virtual_field'] = 'cust_'.$list->GetDBField('FieldName'); $block_params['show_heading'] = ($prev_heading != $list->GetDBField('Heading') ) ? 1 : 0; - + $options = $source_object->GetFieldOptions('cust_'.$list->GetDBField('FieldName')); $list->SetDBField('DirectOptions', isset($options['options']) ? $options['options'] : false); } - + $o.= $this->Application->ParseBlock($block_params, 1); $prev_heading = $list->GetDBField('Heading'); $list->GoNext(); } - + $this->Application->SetVar( $this->getPrefixSpecial().'_id', ''); return $o; } Index: branches/RC/core/kernel/db/db_event_handler.php =================================================================== diff -u -N -r10780 -r10796 --- branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 10780) +++ branches/RC/core/kernel/db/db_event_handler.php (.../db_event_handler.php) (revision 10796) @@ -411,6 +411,32 @@ } /** + * Shows not found template content + * + * @param kEvent $event + * + */ + function _errorNotFound(&$event) + { + if ($event->getEventParam('raise_warnings') === 0) { + // when it's possible, that autoload fails do nothing + return ; + } + + header('HTTP/1.0 404 Not Found'); + + while (ob_get_level()) { + ob_end_clean(); + } + + // object is used inside template parsing, so break out any parsing and return error document + $error_template = $this->Application->ConfigValue('ErrorTemplate'); + $this->Application->HTML = $this->Application->ParseBlock( Array ('name' => $error_template) ); + $this->Application->Done(); + exit; + } + + /** * Builds item (loads if needed) * * @param kEvent $event Index: branches/RC/core/units/general/cat_event_handler.php =================================================================== diff -u -N -r10786 -r10796 --- branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10786) +++ branches/RC/core/units/general/cat_event_handler.php (.../cat_event_handler.php) (revision 10796) @@ -2331,19 +2331,8 @@ { $object =& $event->getObject(); if (!$object->isLoaded()) { - if (!$this->Application->IsAdmin() && ($object->Prefix != 'cms')) { - // category item not loaded on Front-End -> it's not found in database - header('HTTP/1.0 404 Not Found'); - - while (ob_get_level()) { - ob_end_clean(); - } - - // object is used inside template parsing, so break out any parsing and return error document - $error_template = $this->Application->ConfigValue('ErrorTemplate'); - $this->Application->HTML = $this->Application->ParseBlock( Array ('name' => $error_template) ); - $this->Application->Done(); - exit; + if ($object->Prefix != 'cms') { + $this->_errorNotFound($event); } return true;