function spa_save_login_data() { check_admin_referer('forum-adminform_login', 'forum-adminform_login'); # login $sflogin = sp_get_option('sflogin'); $sflogin['sfregmath'] = isset($_POST['sfregmath']); if (!empty($_POST['sfloginurl'])) { $sflogin['sfloginurl'] = sp_filter_save_cleanurl($_POST['sfloginurl']); } else { $sflogin['sfloginurl'] = ''; } if (!empty($_POST['sflogouturl'])) { $sflogin['sflogouturl'] = sp_filter_save_cleanurl($_POST['sflogouturl']); } else { $sflogin['sflogouturl'] = ''; } if (!empty($_POST['sfregisterurl'])) { $sflogin['sfregisterurl'] = sp_filter_save_cleanurl($_POST['sfregisterurl']); } else { $sflogin['sfregisterurl'] = ''; } if (!empty($_POST['sfloginemailurl'])) { $sflogin['sfloginemailurl'] = sp_filter_save_cleanurl($_POST['sfloginemailurl']); } else { $sflogin['sfloginemailurl'] = esc_url(wp_login_url(sp_url())); } if (!empty($_POST['sptimeout'])) { $timeout = sp_esc_int($_POST['sptimeout']); } if (!$timeout) { $timeout = 20; } $sflogin['sptimeout'] = $timeout; sp_update_option('sflogin', $sflogin); # RPX support $sfrpx = sp_get_option('sfrpx'); $oldrpx = $sfrpx['sfrpxenable']; $sfrpx['sfrpxenable'] = isset($_POST['sfrpxenable']); $sfrpx['sfrpxkey'] = sp_esc_str($_POST['sfrpxkey']); $sfrpx['sfrpxredirect'] = sp_filter_save_cleanurl($_POST['sfrpxredirect']); # change in RPX support? if (!$oldrpx && $sfrpx['sfrpxenable']) { include_once SPBOOT . 'site/credentials/sp-rpx.php'; $post_data = array('apiKey' => $_POST['sfrpxkey'], 'format' => 'json'); $raw = sp_rpx_http_post('https://rpxnow.com/plugin/lookup_rp', $post_data); $r = sp_rpx_parse_lookup_rp($raw); if ($r) { $sfrpx['sfrpxrealm'] = $r['realm']; } else { $mess = spa_text('Error in RPX API data!'); return $mess; } } sp_update_option('sfrpx', $sfrpx); do_action('sph_component_login_save'); $mess = spa_text('Login and registration component updated'); return $mess; }
function sp_rpx_process_token() { $sfrpx = sp_get_option('sfrpx'); if (empty($_REQUEST['rpx_response']) || empty($_REQUEST['token'])) { return; } $post_data = array('token' => $_REQUEST['token'], 'apiKey' => $sfrpx['sfrpxkey'], 'format' => 'json'); $raw_response = sp_rpx_http_post('https://rpxnow.com/api/v2/auth_info', $post_data); # parse the json or xml response into an associative array $auth_info = sp_rpx_parse_auth_info($raw_response); # process the auth_info response if ($auth_info['stat'] == 'ok') { sp_rpx_process_auth_info($auth_info); } else { sp_etext('An error occured'); } }