function smart_ip_admin_settings_submit in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/smart_ip.admin.inc \smart_ip_admin_settings_submit()
- 6 includes/smart_ip.admin.inc \smart_ip_admin_settings_submit()
- 7 includes/smart_ip.admin.inc \smart_ip_admin_settings_submit()
Process Forms submitted by IP to Country administration page
1 string reference to 'smart_ip_admin_settings_submit'
- smart_ip_admin_settings in includes/
smart_ip.admin.inc - Smart IP administration settings.
File
- includes/
smart_ip.admin.inc, line 949 - Admin interface callbacks/handlers to configure Smart IP.
Code
function smart_ip_admin_settings_submit($form, &$form_state) {
global $user;
// Save the roles to geolocate
$roles_to_geolocate = array();
foreach ($form_state['values']['smart_ip_roles_to_geolocate'] as $rid => $value) {
if ($rid == $value) {
$roles_to_geolocate[] = $rid;
}
}
variable_set('smart_ip_roles_to_geolocate', $roles_to_geolocate);
// Exclude unnecessary elements from being saved in variable table
unset($form_state['values']['smart_ip_lookup'], $form_state['values']['smart_ip_csv_source'], $form_state['values']['smart_ip_roles_to_geolocate']);
// Download the MaxMind GeoIP Legacy binary database if necessary before proceeding
if ($form_state['values']['smart_ip_source'] == 'maxmind_bin') {
module_load_include('inc', 'smart_ip', 'includes/smart_ip.utility');
smart_ip_maxmind_bin_db_update($form_state['values']['smart_ip_maxmind_license']);
}
// Download the MaxMind GeoIP2 binary database if necessary before proceeding
if ($form_state['values']['smart_ip_source'] == 'maxmindgeoip2_bin') {
module_load_include('inc', 'smart_ip', 'includes/smart_ip.utility');
smart_ip_maxmind_bin_db_update($form_state['values']['smart_ip_maxmind_geoip2_license']);
}
// Save the role based debug mode
$roles = user_roles();
$roles_debug = variable_get('smart_ip_roles_in_debug_mode', array());
$roles_debug_ip = variable_get('smart_ip_roles_in_debug_mode_ip', array());
foreach ($roles as $role_id => $role) {
$roles_debug[$role_id] = $form_state['values']["smart_ip_debug_{$role_id}"];
$roles_debug_ip[$role_id] = $form_state['values']["smart_ip_test_ip_address_{$role_id}"];
unset($form_state['values']["smart_ip_debug_{$role_id}"], $form_state['values']["smart_ip_test_ip_address_{$role_id}"]);
}
variable_set('smart_ip_roles_in_debug_mode', $roles_debug);
variable_set('smart_ip_roles_in_debug_mode_ip', $roles_debug_ip);
}