public static function getUserPerms($userid = false) { bootstrap_framework(); // TODO: If we fetch another user's permissions they're going to overwrite the current user... vB::$vbulletin->userinfo['permissions']['cms'] = self::getPerms($userid, $usergroups); }
'checkurl', 'del_perms', 'find_categories', 'find_leaves', 'get_comment_reply', 'get_comments', 'list', 'list_allcategory', 'list_allsection', 'list_categories', 'list_nodes', 'list_sections', 'perms_section' ))) { bootstrap_framework(); } // ####################################################################### // ######################## START MAIN SCRIPT ############################ // ####################################################################### // ############################################################################# // user name search if ($_POST['do'] == 'usersearch') { $vbulletin->input->clean_array_gpc('p', array('fragment' => TYPE_STR)); $vbulletin->GPC['fragment'] = convert_urlencoded_unicode($vbulletin->GPC['fragment']);
/** * Template method. Calls all the appropriate methods to build a post and then evaluates the template. * * @param array Post information * * @return string HTML for the post */ function construct_postbit(&$post) { global $ad_location; $this->post =& $post; $thread =& $this->thread; $forum =& $this->forum; // make sure we can display this post if ($this->is_displayable() == false) { return ''; } global $show, $vbphrase; global $spacer_open, $spacer_close; global $bgclass, $altbgclass; exec_switch_bg(); $template_hook = array(); ($hook = vBulletinHook::fetch_hook('postbit_display_start')) ? eval($hook) : false; // put together each part of the post $this->prep_post_start(); $this->process_date_status(); $this->process_edit_info(); $this->process_icon(); $this->process_ip(); if (!empty($this->post['userid'])) { $this->process_registered_user(); $this->process_im_icons(); } else { $this->process_unregistered_user(); } $this->bbcode_parser->containerid = $this->post['postid']; $this->parse_bbcode(); $this->process_attachments(); // finish prepping the post $this->prep_post_end(); $pageinfo_post = array( 'p' => $post['postid'] ); if ($this->templatename != 'postbit') { $pageinfo_post['viewfull'] = 1; } // execute hook ($hook = vBulletinHook::fetch_hook('postbit_display_complete')) ? eval($hook) : false; $show['last_ad'] = $show['first_ad'] = $show['first_adsense'] = false; if ($post['isfirstshown']) { //this does not appear to be an ad slot, rather it appears to be some shim html //that needs to be rendered if the firstpost google ad is included. $template = vB_Template::create('ad_showthread_firstpost_sig'); $template->register('adsense_pub_id', $this->registry->adsense_pub_id); $template->register('adsense_host_id', $this->registry->adsense_host_id); $ad_location['ad_showthread_firstpost_sig'] = $template->render(); $template = vB_Template::create('ad_showthread_firstpost_start'); $template->register('adsense_pub_id', $this->registry->adsense_pub_id); $template->register('adsense_host_id', $this->registry->adsense_host_id); $ad_location['ad_showthread_firstpost_start'] = trim($template->render(true)); $ad_location['ad_showthread_firstpost_sig'] = vB_Template::create('ad_showthread_firstpost_sig')->render(); if ($ad_location['ad_showthread_firstpost_start']) { $show['first_ad'] = true; } if ($ad_location['thread_first_post_content'] = trim(vB_Template::create('ad_thread_first_post_content')->render(true))) { if (preg_match('#^<div id="ad_thread_first_post_content">.+</div>$#si', $ad_location['thread_first_post_content'])) { $show['first_ad'] = true; } else { $ad_location['thread_first_post_content'] = ''; } } } else if ( $post['islastshown'] AND $ad_location['thread_last_post_content'] = trim(vB_Template::create('ad_thread_last_post_content')->render(true)) ) { if (preg_match('#^<div id="ad_thread_last_post_content">.+</div>$#si', $ad_location['thread_last_post_content'])) { $show['last_ad'] = true; } else { $ad_location['thread_last_post_content'] = ''; } } // prepare the member action drop-down menu // pass the local template hook so that each drop-down gets its own hook (per-postbit) $memberaction_dropdown = construct_memberaction_dropdown($post, $template_hook); // evaluate template $postid =& $post['postid']; $templater = vB_Template::create($this->template_prefix . $this->templatename); if ($this->add_promote_links AND $this->registry->products['vbcms']) { if (!isset($this->registry->userinfo['permissions']['cms'])) { bootstrap_framework(); vBCMS_Permissions::getUserPerms(); } if ($this->registry->userinfo['permissions']['cms']['canpublish'][0] != -1) { $templater->register('promote_sectionid', $this->registry->userinfo['permissions']['cms']['canpublish'][0]); $templater->register('articletypeid', vB_Types::instance()->getContentTypeID('vBCms_Article')); $promote_url = vB_Route::create('vBCms_Route_Content', '1/addcontent/')->getCurrentURL(); $promote_url .= (strrpos($promote_url, '?') ? '&' : '?') . 'contenttypeid=' . vB_Types::instance()->getContentTypeID('vBCms_Article') . "&postid=" . $post['postid'] . '&parentid=1'; $templater->register('promote_url', $promote_url); } } $templater->register('ad_location', $ad_location); $templater->register('memberaction_dropdown', $memberaction_dropdown); $templater->register('pageinfo_post', $pageinfo_post); $templater->register('post', $post); $templater->register('postid', $postid); $templater->register('template_hook', $template_hook); $templater->register('thread', $thread); $postbit = $templater->render(); $templater = vB_Template::create('postbit_wrapper'); $templater->register('post', $post); $templater->register('postbit', $postbit); $templater->register('spacer_close', $spacer_close); $templater->register('spacer_open', $spacer_open); $retval = $templater->render(); return $retval; }