/** * Fix the extension groups */ function extension_groups(&$error, $selected) { global $db; $extension_groups_rows = $existing_extension_groups = array(); get_extension_groups_rows($this->db_cleaner->data->extension_groups, $extension_groups_rows, $existing_extension_groups); foreach ($extension_groups_rows as $name) { if (isset($this->db_cleaner->data->extension_groups[$name]) && in_array($name, $existing_extension_groups)) { continue; } if (isset($selected[$name])) { if (isset($this->db_cleaner->data->extension_groups[$name]) && !in_array($name, $existing_extension_groups)) { $insert = array('group_name' => $name, 'cat_id' => $this->db_cleaner->data->extension_groups[$name][0], 'allow_group' => $this->db_cleaner->data->extension_groups[$name][1], 'download_mode' => $this->db_cleaner->data->extension_groups[$name][2], 'upload_icon' => $this->db_cleaner->data->extension_groups[$name][3], 'max_filesize' => $this->db_cleaner->data->extension_groups[$name][4], 'allowed_forums' => $this->db_cleaner->data->extension_groups[$name][5]); // Add it $db->sql_query('INSERT INTO ' . EXTENSION_GROUPS_TABLE . ' ' . $db->sql_build_array('INSERT', $insert)); } else { if (!isset($this->db_cleaner->data->extension_groups[$name]) && in_array($name, $existing_extension_groups)) { // Remove it $db->sql_query('DELETE FROM ' . EXTENSION_GROUPS_TABLE . " WHERE group_name = '" . $db->sql_escape($name) . "'"); } } } } }
/** * Validate the extension groups */ function extension_groups() { global $user, $template; // display extra config variables and let them check/uncheck the ones they want to add/remove $this->_section_data['extension_groups'] = array('NAME' => 'EXTENSION_GROUPS_SETTINGS', 'TITLE' => 'ROWS'); $extension_groups_rows = $existing_extension_groups = array(); get_extension_groups_rows($this->db_cleaner->data->extension_groups, $extension_groups_rows, $existing_extension_groups); foreach ($extension_groups_rows as $name) { // Skip ones that are in the default install and are in the existing config if (isset($this->db_cleaner->data->extension_groups[$name]) && in_array($name, $existing_extension_groups)) { continue; } $this->_section_data['extension_groups']['ITEMS'][] = array('NAME' => $name, 'FIELD_NAME' => $name, 'MISSING' => !in_array($name, $existing_extension_groups) ? true : false); if ($this->_has_changes === false) { $this->_has_changes = true; } } $template->assign_vars(array('NO_CHANGES_TEXT' => $user->lang['SECTION_NOT_CHANGED_EXPLAIN'][$this->db_cleaner->step_to_action[$this->db_cleaner->step]], 'NO_CHANGES_TITLE' => $user->lang['SECTION_NOT_CHANGED_TITLE'][$this->db_cleaner->step_to_action[$this->db_cleaner->step]])); $this->success_message = 'CONFIG_UPDATE_SUCCESS'; }