require_api('html_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('project_api.php'); require_api('string_api.php'); form_security_validate('manage_config_revert'); auth_reauthenticate(); $f_project_id = gpc_get_int('project', 0); $f_revert = gpc_get_string('revert', ''); $f_return = gpc_get_string('return'); $t_access = true; $t_revert_vars = explode(',', $f_revert); array_walk($t_revert_vars, 'trim'); foreach ($t_revert_vars as $t_revert) { $t_access &= access_has_project_level(config_get_access($t_revert), $f_project_id); } if (!$t_access) { access_denied(); } if ('' != $f_revert) { # Confirm with the user helper_ensure_confirmed(lang_get('config_delete_sure') . lang_get('word_separator') . string_html_specialchars(implode(', ', $t_revert_vars)) . lang_get('word_separator') . lang_get('in_project') . lang_get('word_separator') . project_get_name($f_project_id), lang_get('delete_config_button')); foreach ($t_revert_vars as $t_revert) { config_delete($t_revert, null, $f_project_id); } } form_security_purge('manage_config_revert'); $t_redirect_url = $f_return; html_page_top(null, $t_redirect_url); html_operation_successful($t_redirect_url); html_page_bottom();
* @uses config_api.php * @uses constant_inc.php * @uses form_api.php * @uses gpc_api.php * @uses helper_api.php * @uses lang_api.php * @uses print_api.php * @uses project_api.php */ require_once 'core.php'; require_api('access_api.php'); require_api('config_api.php'); require_api('constant_inc.php'); require_api('form_api.php'); require_api('gpc_api.php'); require_api('helper_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('project_api.php'); form_security_validate('adm_config_delete'); $f_user_id = gpc_get_int('user_id'); $f_project_id = gpc_get_int('project_id'); $f_config_option = gpc_get_string('config_option'); access_ensure_global_level(config_get('set_configuration_threshold')); if ($f_project_id != ALL_PROJECTS) { project_ensure_exists($f_project_id); } helper_ensure_confirmed(lang_get('delete_config_sure_msg'), lang_get('delete_link')); config_delete($f_config_option, $f_user_id, $f_project_id); form_security_purge('adm_config_delete'); print_successful_redirect('adm_config_report.php');
/** * Delete a plugin configuration option from the database. * @param string Configuration option name * @param int User ID * @param int Project ID */ function plugin_config_delete($p_option, $p_user = ALL_USERS, $p_project = ALL_PROJECTS) { $t_basename = plugin_get_current(); $t_full_option = 'plugin_' . $t_basename . '_' . $p_option; config_delete($t_full_option, $p_user, $p_project); }
require_api('html_api.php'); require_api('lang_api.php'); require_api('print_api.php'); require_api('project_api.php'); require_api('string_api.php'); form_security_validate('manage_config_revert'); auth_reauthenticate(); $f_project_id = gpc_get_int('project', 0); $f_revert = gpc_get_string('revert', ''); $f_return = gpc_get_string('return'); $t_access = true; $t_revert_vars = explode(',', $f_revert); array_walk($t_revert_vars, 'trim'); foreach ($t_revert_vars as $t_revert) { $t_access &= access_has_project_level(config_get_access($t_revert), $f_project_id); } if (!$t_access) { access_denied(); } if ('' != $f_revert) { # Confirm with the user helper_ensure_confirmed(lang_get('config_delete_sure') . lang_get('word_separator') . string_html_specialchars(implode(', ', $t_revert_vars)) . lang_get('word_separator') . lang_get('in_project') . lang_get('word_separator') . project_get_name($f_project_id), lang_get('delete_config_button')); foreach ($t_revert_vars as $t_revert) { config_delete($t_revert, ALL_USERS, $f_project_id); } } form_security_purge('manage_config_revert'); $t_redirect_url = $f_return; html_page_top(null, $t_redirect_url); html_operation_successful($t_redirect_url); html_page_bottom();
# - Strings are returned as-is # - Empty values are typecast as appropriate $t_value = $f_value; if ($t_type != CONFIG_TYPE_STRING) { try { if (!empty($f_value)) { $t_parser = new ConfigParser($f_value); $t_value = $t_parser->parse(ConfigParser::EXTRA_TOKENS_IGNORE); } switch ($t_type) { case CONFIG_TYPE_INT: $t_value = (int) $t_value; break; case CONFIG_TYPE_FLOAT: $t_value = (double) $t_value; break; } } catch (Exception $e) { error_parameters($f_config_option, $e->getMessage()); trigger_error(ERROR_CONFIG_OPT_BAD_SYNTAX, ERROR); } } if ('action_edit' === $f_edit_action) { # EDIT action doesn't keep original if key values are different. if ($f_original_config_option !== $f_config_option || $f_original_user_id !== $f_user_id || $f_original_project_id !== $f_project_id) { config_delete($f_original_config_option, $f_original_user_id, $f_original_project_id); } } config_set($f_config_option, $t_value, $f_user_id, $f_project_id); form_security_purge('adm_config_set'); print_successful_redirect('adm_config_report.php');
} } # walk through the status labels to set the status threshold $t_set_new = array(); foreach ($t_enum_status as $t_status_id => $t_status_label) { $f_level = gpc_get_int('access_change_' . $t_status_id); if (config_get('bug_submit_status') == $t_status_id) { if ($f_level != config_get('report_bug_threshold')) { config_set('report_bug_threshold', (int) $f_level, ALL_USERS, $t_project, $f_access); } else { config_delete('report_bug_threshold', ALL_USERS, $t_project); } unset($t_set_parent[$t_status_id]); unset($t_set_current[$t_status_id]); } else { $t_set_new[$t_status_id] = $f_level; } } if ($t_set_new == $t_set_parent && $f_access == $t_access_current) { # If new value is equal to parent and access has not changed config_delete('set_status_threshold', ALL_USERS, $t_project); } else { if ($t_set_new != $t_set_current || $f_access != $t_access_current) { # Set config if value or access have changed config_set('set_status_threshold', $t_set_new, ALL_USERS, $t_project, $f_access); } } } form_security_purge('manage_config_workflow_set'); html_operation_successful($t_redirect_url); html_page_bottom();
public function update_config() { # Prevent more than one SVN class from handling form elements. if (!SourceSVNPlugin::$config_form_handled) { SourceSVNPlugin::$config_form_handled = true; $f_svnpath = gpc_get_string('plugin_SourceSVN_svnpath', ''); $t_svnpath = config_get('plugin_SourceSVN_svnpath', ''); $f_svnpath = rtrim($f_svnpath, DIRECTORY_SEPARATOR); if ($f_svnpath != $t_svnpath) { if (is_blank($f_svnpath)) { config_delete('plugin_SourceSVN_svnpath'); } else { # be sure that the path is valid if (($t_binary = SourceSVNPlugin::svn_binary($f_svnpath, true)) != 'svn') { config_set('plugin_SourceSVN_svnpath', $f_svnpath); } else { plugin_error('SVNPathInvalid', ERROR); } } } $f_svnargs = gpc_get_string('plugin_SourceSVN_svnargs', ''); if ($f_svnargs != config_get('plugin_SourceSVN_svnargs', '')) { config_set('plugin_SourceSVN_svnargs', $f_svnargs); } $f_svnssl = gpc_get_bool('plugin_SourceSVN_svnssl', false); if ($f_svnssl != config_get('plugin_SourceSVN_svnssl', false)) { config_set('plugin_SourceSVN_svnssl', $f_svnssl); } $f_winstart = gpc_get_bool('plugin_SourceSVN_winstart', false); if ($f_winstart != config_get('plugin_SourceSVN_winstart', false)) { config_set('plugin_SourceSVN_winstart', $f_winstart); } } }