define('CP_REDIRECT', 'blog_admin.php?do=tags&pagenumber=' . $vbulletin->GPC['pagenumber'] . '&pp=' . $vbulletin->GPC['perpage'] . '&sort=' . $vbulletin->GPC['sort']); print_stop_message('tags_edited_successfully'); } */ // ######################################################################## if ($_REQUEST['do'] == 'usercss' or $_POST['do'] == 'updateusercss') { $vbulletin->input->clean_array_gpc('r', array('userid' => TYPE_UINT)); $userinfo = fetch_userinfo($vbulletin->GPC['userid']); if (!$userinfo) { print_stop_message('invalid_user_specified'); } cache_permissions($userinfo, false); $usercsspermissions = array('caneditfontfamily' => $userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditfontfamily'] ? true : false, 'caneditfontsize' => $userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditfontsize'] ? true : false, 'caneditcolors' => $userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditcolors'] ? true : false, 'caneditbgimage' => $userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditbgimage'] ? true : false, 'caneditborders' => $userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditborders'] ? true : false); require_once DIR . '/includes/class_usercss.php'; require_once DIR . '/includes/class_usercss_blog.php'; $usercss = new vB_UserCSS_Blog($vbulletin, $userinfo['userid']); } // ######################################################################## if ($_POST['do'] == 'updateusercss') { $vbulletin->input->clean_array_gpc('p', array('usercss' => TYPE_ARRAY)); $allowedfonts = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_fonts']); $allowedfontsizes = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_font_sizes']); $allowedborderwidths = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_border_widths']); $allowedpaddings = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_padding']); foreach ($vbulletin->GPC['usercss'] as $selectorname => $selector) { if (!isset($usercss->cssedit["{$selectorname}"]) or !empty($usercss->cssedit["{$selectorname}"]['noinputset'])) { $usercss->error[] = fetch_error('invalid_selector_name_x', $selectorname); continue; } if (!is_array($selector)) { continue;
'border_width' => '', 'linkcolor' => '', 'shadecolor' => '', 'padding' => '', 'background_repeat' => '', ); $usercsspermissions = array( 'caneditfontfamily' => $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditfontfamily'] ? true : false, 'caneditfontsize' => $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditfontsize'] ? true : false, 'caneditcolors' => $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditcolors'] ? true : false, 'caneditbgimage' => ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_albums'] AND $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditbgimage']) ? true : false, 'caneditborders' => $vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_caneditborders'] ? true : false ); $usercss = new vB_UserCSS_Blog($vbulletin, $vbulletin->userinfo['userid']); $allowedfonts = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_fonts']); $allowedfontsizes = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_font_sizes']); $allowedborderwidths = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_border_widths']); $allowedpaddings = $usercss->build_select_option($vbulletin->options['vbblog_usercss_allowed_padding']); $vbulletin->input->clean_array_gpc('p', array( 'copyprofilecss' => TYPE_STR )); if ($vbulletin->GPC['copyprofilecss']) { $_REQUEST['do'] = 'customize'; $_POST['do'] = ''; }
/** * Constructs the User's Custom CSS * * @param array An array of userinfo * @param bool (Return) Whether to show the user css on/off switch to the user * * @return string HTML for the User's CSS */ function construct_usercss_blog(&$userinfo, &$show_usercss_switch) { global $vbulletin; if (defined('VBBLOG_NOUSERCSS') OR !($userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_cancustomizeblog'])) { $show_usercss_switch = false; return ''; } // check if permissions have changed and we need to rebuild this user's css if ($userinfo['blog_hascachedcss'] AND $userinfo['blog_cssbuildpermissions'] != $userinfo['permissions']['vbblog_general_permissions']) { require_once(DIR . '/includes/class_usercss.php'); require_once(DIR . '/includes/class_usercss_blog.php'); $usercss = new vB_UserCSS_Blog($vbulletin, $userinfo['userid'], false); $userinfo['blog_cachedcss'] = $usercss->update_css_cache(); } if (!$vbulletin->userinfo['userid']) { $vbulletin->userinfo['showblogcss'] = 1; } if (!$vbulletin->userinfo['showblogcss'] AND $vbulletin->userinfo['userid'] != $userinfo['userid']) { // user has disabled viewing css; they can reenable $show_usercss_switch = (trim($userinfo['blog_cachedcss']) != ''); $usercss = ''; } else if (trim($userinfo['blog_cachedcss'])) { if ($csscolors = @unserialize($userinfo['blog_csscolors'])) { // todo - this is broken, $stylevar doesn't exist... //$stylevar = array_merge($stylevar, $csscolors); } $show_usercss_switch = ($vbulletin->userinfo['userid'] != $userinfo['userid']); $userinfo['blog_cachedcss'] = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $userinfo['blog_cachedcss']); $templater = vB_Template::create('blog_usercss'); $templater->register('userinfo', $userinfo); $usercss = $templater->render(); } else { $show_usercss_switch = false; $usercss = ''; } return $usercss; }