} } } $show['referrer'] = true; } else { $show['referrer'] = false; } // get extra profile fields if ($show['coppa']) { $bgclass1 = 'alt1'; } // get facebook profile data to pre-populate custom profile fields $fb_importform_skip_fields = array(); $fb_profilefield_info = array(); if (is_facebookenabled() and vB_Facebook::instance()->userIsLoggedIn()) { $fb_profilefield_info = get_vbprofileinfo(); } if ($vbulletin->options['reqbirthday'] and !$vbulletin->options['usecoppa']) { $fb_importform_skip_fields[] = 'birthday'; if ($vbulletin->options['fb_userfield_birthday'] and !empty($fb_profilefield_info['birthday']) and !$vbulletin->GPC['day'] and !$vbulletin->GPC['month'] and !$vbulletin->GPC['year']) { list($bd_month, $bd_day, $bd_year) = explode('/', $fb_profilefield_info['birthday']); $vbulletin->GPC['day'] = intval($bd_day); $vbulletin->GPC['month'] = intval($bd_month); $vbulletin->GPC['year'] = intval($bd_year); } $show['birthday'] = true; $monthselected[str_pad($vbulletin->GPC['month'], 2, '0', STR_PAD_LEFT)] = 'selected="selected"'; $dayselected[str_pad($vbulletin->GPC['day'], 2, '0', STR_PAD_LEFT)] = 'selected="selected"'; $year = !$vbulletin->GPC['year'] ? '' : $vbulletin->GPC['year']; // Default Birthday Privacy option to show all if (empty($errorlist)) {
/** * Saves the facebook avatar specified from facebook url * * @param vB_DataManager_User, the datamanager to put any upload errors into * @param string, the url to retrieve the avatar from * @param bool, flag denoting if we want to try a different URL if this one fails * @param string, the url to retrieve the avatar from if the first one fails * * @return bool true if saved worked, false otherwise */ function save_fbavatar($userdata, $avatarurl = '', $do_fallback = true, $fallback_avatarurl = '') { global $vbulletin; // if we are not passed an avatar url, grab it from fb api if (empty($avatarurl)) { $pf = get_vbprofileinfo(); $avatarurl = $pf['avatarurl']; } // begin custom avatar code require_once DIR . '/includes/class_upload.php'; require_once DIR . '/includes/class_image.php'; // grab permissions info from logged in user, if user not logged in, use permissions from registered usergroup $usergroup_info = !empty($vbulletin->userinfo['userid']) ? $vbulletin->userinfo['permissions'] : $vbulletin->usergroupcache[2]; // if user does not have permission to user custom avatar, skip this step if (!($usergroup_info['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) { return; } // initialize the uploader and populate with the avatar permissions $upload = new vB_Upload_Userpic($vbulletin); $upload->data =& datamanager_init('Userpic_Avatar', $vbulletin, ERRTYPE_STANDARD, 'userpic'); $upload->image =& vB_Image::fetch_library($vbulletin); $upload->maxwidth = $usergroup_info['avatarmaxwidth']; $upload->maxheight = $usergroup_info['avatarmaxheight']; $upload->maxuploadsize = $usergroup_info['avatarmaxsize']; $upload->allowanimation = $usergroup_info['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['cananimateavatar'] ? true : false; // upload and validate if (!$upload->process_upload($avatarurl)) { // check if we want to try a fallback url if ($do_fallback) { // if we are not passed a fallback url, grab smaller pic from FB api if (empty($fallback_avatarurl)) { $pf = get_vbprofileinfo(); $fallback_avatarurl = $pf['fallback_avatarurl']; } // do this again, but don't use a fallback if that one fails return save_fbavatar($userdata, $fallback_avatarurl, false); } else { $userdata->error($upload->fetch_error()); return false; } } // if we get here, there were no errors, so return true return true; }