} // ############################### start facebook associate ############################### // process facebook association if ($_POST['do'] == 'fbconnect') { $vbulletin->input->clean_array_gpc('p', array('link' => TYPE_NOHTML, 'nolink' => TYPE_NOHTML)); // if facebook is not enabled, we we somehow lost either the fb or vb session, // display regular registration form if (!is_facebookenabled() or empty($vbulletin->userinfo['userid']) or !vB_Facebook::instance()->userIsLoggedIn()) { $_REQUEST['do'] = 'register'; } else { if ($vbulletin->GPC['link']) { // instantiate the data manager class $userdata =& datamanager_init('user', $vbulletin, ERRTYPE_ARRAY); $userdata->set_existing($vbulletin->userinfo); // save the fb data save_fbdata($userdata); // if there were errors in the association code // go back to the association form and display errors $userdata->pre_save(); if (!empty($userdata->errors)) { $_REQUEST['do'] = 'register'; $errorlist = ''; foreach ($userdata->errors as $index => $error) { $errorlist .= "<li>{$error}</li>"; } $show['errors'] = true; } else { $userdata->save(); $vbulletin->url = 'forum.php' . $vbulletin->session->vars['sessionurl_q']; eval(print_standard_redirect('redirect_updatethanks')); }
if (empty($vbulletin->userinfo['userid'])) { eval(standard_error(fetch_error('usernotloggedin'))); } else { eval(standard_error(fetch_error('facebook_usernotloggedin'))); } } } else { $_REQUEST['do'] = 'register'; } } else { if ($vbulletin->GPC['link']) { // instantiate the data manager class $userdata =& datamanager_init('user', $vbulletin, ERRTYPE_ARRAY); $userdata->set_existing($vbulletin->userinfo); // save the fb data save_fbdata($userdata, false); // if there were errors in the association code // go back to the association form and display errors $userdata->pre_save(); if (!empty($userdata->errors)) { $_REQUEST['do'] = 'register'; $errorlist = ''; if (!VB_API) { foreach ($userdata->errors as $index => $error) { $errorlist .= "<li>{$error}</li>"; } } else { $error = array_pop($userdata->errors); $output = is_array($error) ? $error[0] : $error; eval(standard_error(fetch_error($output))); }