et['enable_groups']) ), ); // Get custom fields $custom_blocks = $vbulletin->db->query_read_slave(" SELECT pfc.profilefieldcategoryid AS id FROM " . TABLE_PREFIX . "profilefieldcategory AS pfc INNER JOIN " . TABLE_PREFIX . "profilefield pf ON pf.profilefieldcategoryid = pfc.profilefieldcategoryid WHERE pfc.allowprivacy = 1 GROUP BY pfc.profilefieldcategoryid ORDER BY pfc.location, pfc.displayorder "); while($block = $vbulletin->db->fetch_array($custom_blocks)) { $blocks["profile_cat$block[id]"] = array ( 'name' => $vbphrase["category$block[id]_title"], 'requirement' => 0, 'enabled' => true ); } $vbulletin->db->free_result($custom_blocks); } // ####################################################################### if ($_POST['do'] == 'doprivacy') { $vbulletin->input->clean_gpc('r', 'blockprivacy', TYPE_ARRAY_UINT ); $values = array(); foreach($vbulletin->GPC['blockprivacy'] AS $blockid => $requirement) { if (isset($blocks[$blockid])) { $blocks[$blockid]['requirement'] = $requirement; $values[] = "({$vbulletin->userinfo['userid']}, '$blockid', $requirement)"; } } if (sizeof($values)) { $vbulletin->db->query_write($sql = " REPLACE INTO " . TABLE_PREFIX . "profileblockprivacy (userid, blockid, requirement) VALUES " . implode(',', $values) . " "); } $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'] . "do=privacy"; print_standard_redirect('profile_privacy_saved'); } // ####################################################################### if ($_REQUEST['do'] == 'privacy') { // Get current privacy settings if (!isset($_POST['do'])) { $results = $vbulletin->db->query_read_slave(" SELECT blockid, requirement FROM " . TABLE_PREFIX . "profileblockprivacy WHERE userid = " . intval($vbulletin->userinfo['userid']) . " "); while ($result = $vbulletin->db->fetch_array($results)) { if (isset($blocks[$result['blockid']])) { $blocks[$result['blockid']]['requirement'] = $result['requirement']; } } $vbulletin->db->free_result($results); } foreach($blocks as $blockid => $block) { if ($block['enabled']) { $selected = array($block['requirement'] => 'selected="selected"'); $templater = vB_Template::create('modifyprivacy_bit'); $templater->register('block', $block); $templater->register('blockid', $blockid); $templater->register('selected', $selected); $profileprivacybits .= $templater->render(); } } $navbits[''] = $vbphrase['profile_privacy']; construct_usercp_nav('privacy'); $page_templater = vB_Template::create('modifyprofileprivacy'); $page_templater->register('errors', $errors); $page_templater->register('profileprivacybits', $profileprivacybits); } // ############################################################################# // dismiss notice (non-ajax / no js user) if ($_POST['do'] == 'dismissnotice') { $vbulletin->input->clean_array_gpc('p', array( 'dismiss_noticeid' => TYPE_UINT )); $dismiss_noticeid = $vbulletin->GPC['dismiss_noticeid']; // in IE, clicking the image won't send a value, so pull it out of the element's name foreach (array_keys($_POST) AS $input_name) { if (preg_match('#^dismiss_noticeid_(\d+)_x$#', $input_name, $match)) { $dismiss_noticeid = intval($match[1]); break; } } if ($dismiss_noticeid) { $db->query_write(" REPLACE INTO " . TABLE_PREFIX . "noticedismissed (noticeid, userid) VALUES (" . intval($dismiss_noticeid) . ", " . $vbulletin->userinfo['userid'] .") "); } print_standard_redirect('redirect_notice_dismissed'); } // ############################################################################# // spit out final HTML if we have got this far if (!empty($page_templater)) { // make navbar $navbits = construct_navbits($navbits); $navbar = render_navbar_template($navbits); ($hook = vBulletinHook::fetch_hook('profile_complete')) ? eval($hook) : false; // add any extra clientscripts $clientscripts = (isset($clientscripts_template) ? $clientscripts_template->render() : ''); if (!$vbulletin->options['storecssasfile']) { $includecss = implode(',', $includecss); } // shell template $templater = vB_Template::create($shelltemplatename); $templater->register_page_templates(); $templater->register('includecss', $includecss); $templater->register('cpnav', $cpnav); $templater->register('HTML', $page_templater->render()); $templater->register