function FillParams($params, $editing = false)
 {
     # Why is FillParams is called twice?!?
     static $func_called = false;
     if ($func_called) {
         return;
     }
     #---
     if (isset($params['content_type'])) {
         $AdvancedContent =& cms_utils::get_module('AdvancedContent');
         $parameters = array_merge(array('pagedata', 'searchable', 'disable_wysiwyg'), $this->_advancedAttribs);
         $this->_contentBlocksLoaded = false;
         $this->mTemplateId = isset($params['template_id']) ? $params['template_id'] : $this->mTemplateId;
         $this->mType = $params['content_type'];
         if ($this->mType == 'content2' || $this->mType == 'content') {
             # add content blocks
             $this->_parse_template();
             $this->mParentId = isset($params['parent_id']) ? $params['parent_id'] : $this->mParentId;
             if (check_permission(get_userid(), 'Manage AdvancedContent Options') && $AdvancedContent->GetPreference('use_advanced_pageoptions', 0)) {
                 $params['feu_access'] = isset($params['feu_access']) && is_array($params['feu_access']) ? $params['feu_access'] : ($editing ? $this->CleanArray(explode(',', $this->GetPropertyValue('feu_access'))) : $this->CleanArray(explode(',', $AdvancedContent->GetPreference('feu_access'))));
                 # if page has no parents but wants to inherit -> remove inheritance
                 if ($this->mParentId <= 0 && in_array(-1, $params['feu_access'])) {
                     foreach ($params['feu_access'] as $k => $v) {
                         if ($v == -1) {
                             unset($params['feu_access'][$k]);
                         }
                     }
                 }
                 # if there is still inheritance -> check if there actually is any feu group selected by parents
                 $_feuAccess = array();
                 if (in_array(-1, $params['feu_access'])) {
                     # $_feuAccess contains all feu groups (of current page as well as of all parent pages)
                     $_feuAccess = $this->InheritParentProp('feu_access', $params['feu_access']);
                 }
                 # if we have selected any feu group -> disable caching and search
                 if (count($_feuAccess) || count($params['feu_access']) && !in_array(-1, $params['feu_access'])) {
                     $params['cachable'] = false;
                     $this->mCachable = false;
                     $params['searchable'] = false;
                 }
                 $params['feu_access'] = implode(',', $params['feu_access']);
                 $params['redirect_page'] = isset($params['redirect_page']) ? $params['redirect_page'] : ($editing ? $this->GetPropertyValue('redirect_page') : $AdvancedContent->GetPreference('redirect_page'));
                 if ($this->mParentId <= 0 && $params['redirect_page'] == -1) {
                     $params['redirect_page'] = '';
                 }
                 $params['feu_action'] = isset($params['feu_action']) ? $params['feu_action'] : ($editing ? $this->GetPropertyValue('feu_action') : $AdvancedContent->GetPreference('feu_action', 1));
                 if ($this->mParentId <= 0 && $params['feu_action'] == -1) {
                     $params['feu_action'] = 1;
                 }
                 $params['hide_menu_item'] = isset($params['hide_menu_item']) ? $params['hide_menu_item'] : ($editing ? $this->GetPropertyValue('hide_menu_item') : $AdvancedContent->GetPreference('hide_menu_item', 0));
                 if ($this->mParentId <= 0 && $params['hide_menu_item'] == -1) {
                     $params['hide_menu_item'] = 0;
                 }
                 /* do this on validation
                 			if($params['feu_access'] && $params['hide_menu_item'] == 2)
                 			{
                 				$params['hide_menu_item'] = $AdvancedContent->GetPreference('hide_menu_item',0);
                 			}
                 			*/
                 $params['inherit_feu_params'] = isset($params['inherit_feu_params']) ? true : ($editing ? $this->GetPropertyValue('inherit_feu_params') : $AdvancedContent->GetPreference('inherit_feu_params'));
                 if ($this->ParentId() <= 0 && $params['inherit_feu_params']) {
                     $params['inherit_feu_params'] = false;
                 }
                 if ($params['inherit_feu_params']) {
                     $params['feu_params'] = -1;
                     $params['feu_params_smarty'] = -1;
                 }
                 $params['inherit_custom_params'] = isset($params['inherit_custom_params']) ? true : ($editing ? $this->GetPropertyValue('inherit_custom_params') : $AdvancedContent->GetPreference('inherit_custom_params'));
                 if ($this->ParentId() <= 0 && $params['inherit_custom_params']) {
                     $params['inherit_custom_params'] = false;
                 }
                 if ($params['inherit_custom_params']) {
                     $params['custom_params'] = -1;
                     $params['custom_params_smarty'] = -1;
                 }
                 $params['use_expire_date'] = isset($params['use_expire_date']) ? $params['use_expire_date'] : ($editing ? $this->GetPropertyValue('use_expire_date') : $AdvancedContent->GetPreference('use_expire_date'));
                 if ($this->mParentId <= 0 && $params['use_expire_date'] == -1) {
                     $params['use_expire_date'] = 0;
                 }
                 if ($params['use_expire_date'] == -1) {
                     $params['start_date'] = -1;
                     $params['end_date'] = -1;
                 } else {
                     if ($params['use_expire_date'] == 0) {
                         $params['start_date'] = '';
                         $params['end_date'] = '';
                     } else {
                         if (isset($params['start_date'])) {
                             $params['start_date'] = $params['start_date']['time'] + $params['start_date']['date'] / 1000;
                         } else {
                             $params['start_date'] = $editing && $this->GetPropertyValue('start_date') ? $this->GetPropertyValue('start_date') : strtotime('+' . $AdvancedContent->GetPreference("start_date", '1 week'));
                         }
                         if (isset($params['end_date'])) {
                             $params['end_date'] = $params['end_date']['time'] + $params['end_date']['date'] / 1000;
                         } else {
                             $params['end_date'] = $editing && $this->GetPropertyValue('end_date') ? $this->GetPropertyValue('end_date') : strtotime('+' . $AdvancedContent->GetPreference("end_date", '1 week'), $params['start_date']);
                         }
                     }
                 }
             }
             # do the content property parameters
             foreach ($parameters as $oneparam) {
                 if (isset($params[$oneparam])) {
                     $this->SetPropertyValueNoLoad($oneparam, $params[$oneparam]);
                 }
             }
             if (check_permission(get_userid(), 'Manage AdvancedContent Options') && $AdvancedContent->GetPreference('use_advanced_pageoptions', 0) && $this->GetPropertyValue('use_expire_date') && ($this->GetProperty('start_date') > time() || $this->GetProperty('end_date') < time())) {
                 $params['active'] = false;
                 $this->mActive = false;
             }
             # metadata
             $this->mMetadata = isset($params['metadata']) ? $params['metadata'] : $this->mMetadata;
             # contentblocks
             foreach ($this->_contentBlocks as $blockId => $contentBlock) {
                 $value = $contentBlock->FillBlockParams($params, $editing);
                 if ($value == '' && !$contentBlock->GetBlockProperty('allow_none')) {
                     $value = $contentBlock->GetBlockProperty('default');
                     if ($contentBlock->GetBlockProperty('smarty')) {
                         $value = $this->DoSmarty($value);
                     }
                 }
                 #$this->AddExtraProperty($blockId); # is done by _register_content_block()
                 $this->SetPropertyValueNoLoad($blockId, $value);
             }
         }
     }
     parent::FillParams($params, $editing);
     # Why is FillParams called twice?!?
     $func_called = true;
     #---
 }
 function FillParams($params, $editing = false)
 {
     $AC =& ac_utils::get_module('AdvancedContent');
     $this->_loaded = false;
     if (isset($params['parent_id']) && $params['parent_id'] != $this->ParentId()) {
         $this->SetItemOrder(-1);
     }
     $this->SetTemplateId(isset($params['template_id']) ? $params['template_id'] : $this->TemplateId());
     $this->SetParentId(isset($params['parent_id']) ? $params['parent_id'] : $this->ParentId());
     $this->GetContentBlocks();
     ac_admin_ops::FillParams($this, $params, $editing);
     # <- ToDo: this causes issues on import in TMS (contentblocks are empty or do not exist anymore)
     parent::FillParams($params, $editing);
 }