protected function build_new_config() { $config = $this->get_old_config(); $forum_config = ForumConfig::load(); $forum_config->set_forum_name($config['forum_name']); $forum_config->set_number_topics_per_page($config['pagination_topic']); $forum_config->set_number_messages_per_page($config['pagination_msg']); $forum_config->set_read_messages_storage_duration($config['view_time']); $forum_config->set_max_topic_number_in_favorite($config['topic_track']); if (!empty($config['topic_track'])) { $forum_config->enable_edit_mark(); } else { $forum_config->disable_edit_mark(); } if (!empty($config['no_left_column'])) { $forum_config->enable_left_column(); } else { $forum_config->disable_left_column(); } if (!empty($config['no_right_column'])) { $forum_config->enable_right_column(); } else { $forum_config->disable_right_column(); } if (!empty($config['activ_display_msg'])) { $forum_config->display_message_before_topic_title(); } else { $forum_config->hide_message_before_topic_title(); } $forum_config->set_message_before_topic_title($config['display_msg']); $forum_config->set_message_when_topic_is_unsolved($config['explain_display_msg']); $forum_config->set_message_when_topic_is_solved($config['explain_display_msg_bis']); if (!empty($config['icon_activ_display_msg'])) { $forum_config->display_message_before_topic_title_icon(); } else { $forum_config->hide_message_before_topic_title_icon(); } if (!empty($config['display_connexion'])) { $forum_config->display_connexion_form(); } else { $forum_config->hide_connexion_form(); } $forum_config->set_authorizations($this->build_authorizations(unserialize($config['auth']))); ForumConfig::save(); return true; }
private function save() { $this->config->set_forum_name($this->form->get_value('forum_name')); $this->config->set_number_topics_per_page($this->form->get_value('number_topics_per_page')); $this->config->set_number_messages_per_page($this->form->get_value('number_messages_per_page')); $this->config->set_read_messages_storage_duration($this->form->get_value('read_messages_storage_duration')); $this->config->set_max_topic_number_in_favorite($this->form->get_value('max_topic_number_in_favorite')); if ($this->form->get_value('edit_mark_enabled')) { $this->config->enable_edit_mark(); } else { $this->config->disable_edit_mark(); } if ($this->form->get_value('multiple_posts_allowed')) { $this->config->allow_multiple_posts(); } else { $this->config->forbid_multiple_posts(); } if ($this->form->get_value('connexion_form_displayed')) { $this->config->display_connexion_form(); } else { $this->config->hide_connexion_form(); } if ($this->form->get_value('left_column_disabled')) { $this->config->disable_left_column(); } else { $this->config->enable_left_column(); } if ($this->form->get_value('right_column_disabled')) { $this->config->disable_right_column(); } else { $this->config->enable_right_column(); } if ($this->form->get_value('message_before_topic_title_displayed')) { $this->config->display_message_before_topic_title(); $this->config->set_message_before_topic_title($this->form->get_value('message_before_topic_title')); $this->config->set_message_when_topic_is_unsolved($this->form->get_value('message_when_topic_is_unsolved')); $this->config->set_message_when_topic_is_solved($this->form->get_value('message_when_topic_is_solved')); if ($this->form->get_value('message_before_topic_title_icon_displayed')) { $this->config->display_message_before_topic_title_icon(); } else { $this->config->hide_message_before_topic_title_icon(); } } else { $this->config->hide_message_before_topic_title(); } $this->config->set_authorizations($this->form->get_value('authorizations')->build_auth_array()); ForumConfig::save(); ForumService::get_categories_manager()->regenerate_cache(); }