/** * Quick Method of building the CPNav Template * * @param string The selected item in the CPNav */ function construct_usercp_nav($selectedcell = 'usercp') { global $navclass, $cpnav, $gobutton, $stylevar, $vbphrase; global $messagecounters, $subscribecounters, $vbulletin; global $show, $subscriptioncache, $template_hook; $cells = array('usercp', 'signature', 'profile', 'options', 'password', 'avatar', 'profilepic', 'album', 'pm_messagelist', 'pm_newpm', 'pm_trackpm', 'pm_editfolders', 'substhreads_listthreads', 'substhreads_editfolders', 'deletedthreads', 'deletedposts', 'moderatedthreads', 'moderatedposts', 'moderatedvms', 'deletedvms', 'moderatedgms', 'deletedgms', 'moderatedpcs', 'deletedpcs', 'moderatedpics', 'event_reminders', 'paid_subscriptions', 'usergroups', 'buddylist', 'ignorelist', 'attachments', 'customize'); ($hook = vBulletinHook::fetch_hook('usercp_nav_start')) ? eval($hook) : false; // Get forums that allow canview access $canget = $canpost = ''; foreach ($vbulletin->userinfo['forumpermissions'] as $forumid => $perm) { if ($perm & $vbulletin->bf_ugp_forumpermissions['canview'] and $perm & $vbulletin->bf_ugp_forumpermissions['canviewthreads'] and $perm & $vbulletin->bf_ugp_forumpermissions['cangetattachment']) { $canget .= ",{$forumid}"; } if ($perm & $vbulletin->bf_ugp_forumpermissions['canpostattachment'] and !empty($vbulletin->userinfo['attachmentextensions'])) { $canpost .= ",{$forumid}"; } } if (!$canpost) { $attachments = $vbulletin->db->query_first_slave("\n\t\t\tSELECT COUNT(*) AS total\n\t\t\tFROM " . TABLE_PREFIX . "attachment AS attachment\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = attachment.postid)\n\t\t\tLEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (post.threadid = thread.threadid)\n\t\t\tWHERE attachment.userid = " . $vbulletin->userinfo['userid'] . "\n\t\t\t\tAND\t((forumid IN(0{$canget}) AND thread.visible = 1 AND post.visible = 1) OR attachment.postid = 0)\n\t\t"); $totalattachments = intval($attachments['total']); } if (!($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_profile_styling'])) { $show['customizelink'] = false; } else { if ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontfamily'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontsize'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditcolors'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditbgimage'] or $vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditborders']) { $show['customizelink'] = true; } else { $show['customizelink'] = false; } } if ($show['avatarlink'] and !($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) { $membergroups = fetch_membergroupids_array($vbulletin->userinfo); // We don't have any predefined avatars or user's groups are all denied permission if (!empty($vbulletin->noavatarperms) and ($vbulletin->noavatarperms['all'] == true or !count(array_diff($membergroups, $vbulletin->noavatarperms)))) { $show['avatarlink'] = false; } else { if (!empty($vbulletin->userinfo['infractiongroupids'])) { $show['avatarlink'] = $categorycache =& fetch_avatar_categories($vbulletin->userinfo); } } } if ($totalattachments or $canpost) { $show['attachments'] = true; } if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) { $show['socialgroupslink'] = true; } if (!$vbulletin->options['subscriptionmethods']) { $show['paidsubscriptions'] = false; } else { // cache all the subscriptions - should move this to a datastore object at some point require_once DIR . '/includes/class_paid_subscription.php'; $subobj = new vB_PaidSubscription($vbulletin); $subobj->cache_user_subscriptions(); $show['paidsubscriptions'] = false; foreach ($subobj->subscriptioncache as $subscription) { $subscriptionid =& $subscription['subscriptionid']; if ($subscription['active'] and (empty($subscription['deniedgroups']) or count(array_diff(fetch_membergroupids_array($vbulletin->userinfo), $subscription['deniedgroups'])))) { $show['paidsubscriptions'] = true; break; } } } // check to see if there are usergroups available $show['publicgroups'] = false; foreach ($vbulletin->usergroupcache as $usergroup) { if ($usergroup['ispublicgroup'] or $usergroup['canoverride'] and is_member_of($vbulletin->userinfo, $usergroup['usergroupid'])) { $show['publicgroups'] = true; break; } } // Setup Moderation Links if (can_moderate()) { $show['deleteditems'] = true; $show['deletedmessages'] = true; } if (can_moderate(0, 'canmoderateposts')) { $show['moderatedposts'] = true; } if (can_moderate(0, 'canmoderatevisitormessages') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']) { $show['moderatedvms'] = true; $show['deletedvms'] = true; } if (can_moderate(0, 'canmoderategroupmessages') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] and $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderatedgms'] = true; $show['deletedgms'] = true; } if (can_moderate(0, 'canmoderatepicturecomments') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->options['pc_enabled']) { $show['moderatedpcs'] = true; $show['deletedpcs'] = true; } if (can_moderate(0, 'canmoderatepictures') and $vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']) { $show['moderatedpics'] = true; } $show['moderateditems'] = ($show['moderatedposts'] or $show['moderatedvms'] or $show['moderatedgms'] or $show['moderatedpcs'] or $show['moderatedpics']); $show['moderation'] = ($show['deleteditems'] or $show['moderateditems']); // album setup $show['albumlink'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] and $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] and $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum']); // set the class for each cell/group $navclass = array(); foreach ($cells as $cellname) { $navclass["{$cellname}"] = 'alt2'; } $navclass["{$selectedcell}"] = 'alt1'; // variable to hold templates for pm / subs folders $cpnav = array(); // get PM folders $cpnav['pmfolders'] = ''; $pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']); if (!empty($vbulletin->userinfo['pmfolders'])) { $pmfolders = $pmfolders + unserialize($vbulletin->userinfo['pmfolders']); } foreach ($pmfolders as $folderid => $foldername) { $linkurl = 'private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$folderid}"; eval('$cpnav[\'pmfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } // get subscriptions folders $cpnav['subsfolders'] = ''; $subsfolders = unserialize($vbulletin->userinfo['subfolders']); if (!empty($subsfolders)) { foreach ($subsfolders as $folderid => $foldername) { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . "folderid={$folderid}"; eval('$cpnav[\'subsfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } } if ($cpnav['subsfolders'] == '') { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=0'; $foldername = $vbphrase['subscriptions']; eval('$cpnav[\'subsfolders\'] .= "' . fetch_template('usercp_nav_folderbit') . '";'); } ($hook = vBulletinHook::fetch_hook('usercp_nav_complete')) ? eval($hook) : false; }
$vbulletin->userinfo['avatarurl'] = 'image.php?' . $vbulletin->session->vars['sessionurl'] . 'u=' . $vbulletin->userinfo['userid'] . "&dateline={$avatar['dateline']}"; } if ($avatar['width'] and $avatar['height']) { $vbulletin->userinfo['avatarurl'] .= "\" width=\"{$avatar['width']}\" height=\"{$avatar['height']}"; } eval('$currentavatar = "' . fetch_template('modifyavatarbit_custom') . '";'); } else { // no avatar specified $nouseavatarchecked = 'checked="checked"'; $avatarchecked[0] = ''; eval('$currentavatar = "' . fetch_template('modifyavatarbit_noavatar') . '";'); } } // get rid of any lingering $avatar variables unset($avatar); $categorycache =& fetch_avatar_categories($vbulletin->userinfo); foreach ($categorycache as $category) { if (!$donefirstcategory or $category['imagecategoryid'] == $vbulletin->GPC['categoryid']) { $displaycategory = $category; $donefirstcategory = 1; } } // get the id of the avatar category we want to display if ($vbulletin->GPC['categoryid'] == 0) { if ($vbulletin->userinfo['avatarid'] != 0 and !empty($categorycache["{$bbavatar['imagecategoryid']}"])) { $displaycategory = $bbavatar; } $vbulletin->GPC['categoryid'] = $displaycategory['imagecategoryid']; } // make the category <select> list $optionselected["{$vbulletin->GPC['categoryid']}"] = 'selected="selected"';
/** * Quick Method of building the CPNav Template * * @param string The selected item in the CPNav */ function construct_usercp_nav($selectedcell = 'usercp') { global $navclass, $cpnav, $gobutton, $vbphrase; global $messagecounters, $subscribecounters, $vbulletin; global $show, $subscriptioncache, $template_hook; $cells = array( 'usercp', 'signature', 'profile', 'options', 'connections', 'password', 'avatar', 'profilepic', 'album', 'pm_messagelist', 'pm_newpm', 'pm_trackpm', 'pm_editfolders', 'substhreads_listthreads', 'substhreads_editfolders', 'deletedthreads', 'deletedposts', 'moderatedthreads', 'moderatedposts', 'moderatedvms', 'deletedvms', 'moderatedgms', 'deletedgms', 'moderateddiscussions', 'deleteddiscussions', 'moderatedpcs', 'deletedpcs', 'moderatedpics', 'event_reminders', 'paid_subscriptions', 'socialgroups', 'usergroups', 'buddylist', 'ignorelist', 'attachments', 'customize', 'privacy', 'deleteditems', 'moderateditems', 'newitems', 'newvms', 'newgms', 'newdiscussions', 'newpcs', 'newpics' ); ($hook = vBulletinHook::fetch_hook('usercp_nav_start')) ? eval($hook) : false; // TODO: Issue #29084 - Reenable Profile Styling /* if (!($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_profile_styling'])) { $show['customizelink'] = false; } else if ( ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontfamily']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditfontsize']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditcolors']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditbgimage']) OR ($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditborders']) ) { $show['customizelink'] = true; } else { $show['customizelink'] = false; } */ $show['customizelink'] = false; $show['privacylink'] = (($vbulletin->userinfo['permissions']['usercsspermissions'] & $vbulletin->bf_ugp_usercsspermissions['caneditprivacy']) AND $vbulletin->options['profileprivacy']); if ($show['avatarlink'] AND !($vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canuseavatar'])) { $membergroups = fetch_membergroupids_array($vbulletin->userinfo); // We don't have any predefined avatars or user's groups are all denied permission if (!empty($vbulletin->noavatarperms) AND ($vbulletin->noavatarperms['all'] == true OR !count(array_diff($membergroups, $vbulletin->noavatarperms)))) { $show['avatarlink'] = false; } else if (!empty($vbulletin->userinfo['infractiongroupids'])) { $show['avatarlink'] = ($categorycache =& fetch_avatar_categories($vbulletin->userinfo)); } } // currently, we only have faceboook as external login, // but as we add more, we need to add them to this assignment $show['externalconnections'] = $vbulletin->options['enablefacebookconnect']; if ($selectedcell == 'attachments') { $show['attachments'] = true; } else { require_once(DIR . '/packages/vbattach/attach.php'); $attachmultiple = new vB_Attachment_Display_Multiple($vbulletin); if ($results = $attachmultiple->fetch_results('a.userid = ' . $vbulletin->userinfo['userid'], true)) { $show['attachments'] = true; } } if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->userinfo['permissions']['socialgrouppermissions'] & $vbulletin->bf_ugp_socialgrouppermissions['canviewgroups']) { $show['socialgroupslink'] = true; } if (!$vbulletin->options['subscriptionmethods']) { $show['paidsubscriptions'] = false; } else { // cache all the subscriptions - should move this to a datastore object at some point require_once(DIR . '/includes/class_paid_subscription.php'); $subobj = new vB_PaidSubscription($vbulletin); $subobj->cache_user_subscriptions(); $show['paidsubscriptions'] = false; foreach ($subobj->subscriptioncache AS $subscription) { $subscriptionid =& $subscription['subscriptionid']; if ($subscription['active'] AND (empty($subscription['deniedgroups']) OR count(array_diff(fetch_membergroupids_array($vbulletin->userinfo), $subscription['deniedgroups'])))) { $show['paidsubscriptions'] = true; break; } } } // check to see if there are usergroups available $show['publicgroups'] = false; foreach ($vbulletin->usergroupcache AS $usergroup) { if ($usergroup['ispublicgroup'] OR ($usergroup['canoverride'] AND is_member_of($vbulletin->userinfo, $usergroup['usergroupid']))) { $show['publicgroups'] = true; break; } } // Setup Moderation Links if (can_moderate()) { $show['deleteditems'] = true; $show['deletedmessages'] = true; } $show['moderatedposts'] = can_moderate(0, 'canmoderateposts'); $show['deletedposts'] = ($show['moderatedposts'] OR can_moderate(0, 'candeleteposts') OR can_moderate(0, 'canremoveposts')); // visitor messages if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_visitor_messaging']) { $show['moderatedvms'] = can_moderate(0, 'canmoderatevisitormessages'); $show['deletedvms'] = ($show['moderatedvms'] OR can_moderate(0, 'candeletevisitormessages') OR can_moderate(0, 'canremovevisitormessages')); $show['newvms'] = ($show['moderatedvms'] OR $show['deletedvms'] OR can_moderate(0, 'caneditvisitormessages')); } // group messages if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderatedgms'] = can_moderate(0, 'canmoderategroupmessages'); $show['deletedgms'] = ($show['moderatedgms'] OR can_moderate(0, 'candeletegroupmessages') OR can_moderate(0, 'canremovegroupmessages')); $show['newgms'] = ($show['moderatedgms'] OR $show['deletedgms'] OR can_moderate(0, 'caneditgroupmessages')); } // group discussions if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_groups'] AND $vbulletin->options['socnet_groups_msg_enabled']) { $show['moderateddiscussions'] = can_moderate(0, 'canmoderatediscussions'); $show['deleteddiscussions'] = ($show['moderateddiscussions'] OR (can_moderate(0, 'candeletediscussions') OR can_moderate(0, 'canremovediscussions'))); $show['newdiscussions'] = ($show['moderateddiscussions'] OR $show['deleteddiscussions'] OR can_moderate(0, 'caneditdiscussions')); } // picture comments if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->options['pc_enabled']) { $show['moderatedpcs'] = can_moderate(0, 'canmoderatepicturecomments'); $show['deletedpcs'] = ($show['moderatedpcs'] OR can_moderate(0, 'candeletepicturecomments') OR can_moderate(0, 'canremovepicturecomments')); $show['newpcs'] = ($show['moderatedpcs'] OR $show['deletedpcs'] OR can_moderate(0, 'caneditpicturecomments')); } // pictures if ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums']) { $show['moderatedpics'] = can_moderate(0, 'canmoderatepictures'); $show['newpics'] = ($show['moderatedpics'] OR can_moderate(0, 'caneditalbumpicture')); } $show['moderateditems'] = ($show['moderatedposts'] OR $show['moderatedvms'] OR $show['moderatedgms'] OR $show['moderateddiscussions'] OR $show['moderatedpcs'] OR $show['moderatedpics']); $show['deleteditems'] = ($show['deletedposts'] OR $show['deletedvms'] OR $show['deletedgms'] OR $show['deleteddiscussions'] OR $show['deletedpcs']); $show['newitems'] = ($show['newposts'] OR $show['newvms'] OR $show['newgms'] OR $show['newdiscussions'] OR $show['newpcs'] OR $show['newpics']); $show['moderation'] = ($show['moderateditems'] OR $show['deleteditems'] OR $show['newitems']); // album setup $show['albumlink'] = ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->userinfo['permissions']['genericpermissions'] & $vbulletin->bf_ugp_genericpermissions['canviewmembers'] AND $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canviewalbum'] AND $vbulletin->userinfo['permissions']['albumpermissions'] & $vbulletin->bf_ugp_albumpermissions['canalbum'] ); // set the class for each cell/group $navclass = array(); foreach ($cells AS $cellname) { $navclass["$cellname"] = 'inactive'; } $navclass["$selectedcell"] = 'active'; // variable to hold templates for pm / subs folders $cpnav = array(); // get PM folders $cpnav['pmfolders'] = ''; $pmfolders = array('0' => $vbphrase['inbox'], '-1' => $vbphrase['sent_items']); if (!empty($vbulletin->userinfo['pmfolders'])) { $pmfolders = $pmfolders + unserialize($vbulletin->userinfo['pmfolders']); } foreach ($pmfolders AS $folderid => $foldername) { $linkurl = 'private.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$folderid"; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['pmfolders'] .= $templater->render(); } // get subscriptions folders $cpnav['subsfolders'] = ''; $subsfolders = unserialize($vbulletin->userinfo['subfolders']); if (!empty($subsfolders)) { foreach ($subsfolders AS $folderid => $foldername) { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . "folderid=$folderid"; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['subsfolders'] .= $templater->render(); } } if ($cpnav['subsfolders'] == '') { $linkurl = 'subscription.php?' . $vbulletin->session->vars['sessionurl'] . 'folderid=0'; $foldername = $vbphrase['subscriptions']; $templater = vB_Template::create('usercp_nav_folderbit'); $templater->register('foldername', $foldername); $templater->register('linkurl', $linkurl); $cpnav['subsfolders'] .= $templater->render(); } ($hook = vBulletinHook::fetch_hook('usercp_nav_complete')) ? eval($hook) : false; }