/** * Reads some context based on general input information */ public function read_input_context() { global $vbulletin; parent::read_input_context(); global $postinfo, $threadinfo, $foruminfo, $pollinfo; global $postid, $threadid, $forumid, $pollid; $vbulletin->input->clean_array_gpc('r', array('postid' => vB_Cleaner::TYPE_UINT, 'threadid' => vB_Cleaner::TYPE_UINT, 'forumid' => vB_Cleaner::TYPE_INT, 'pollid' => vB_Cleaner::TYPE_UINT)); $codestyleid = 0; // Init post/thread/forum values $postinfo = array(); $threadinfo = array(); $foruminfo = array(); // automatically query $postinfo, $threadinfo & $foruminfo if $threadid exists if ($vbulletin->GPC['postid'] and $postinfo = verify_id('post', $vbulletin->GPC['postid'], 0, 1)) { $postid = $postinfo['postid']; $vbulletin->GPC['threadid'] = $postinfo['threadid']; } // automatically query $threadinfo & $foruminfo if $threadid exists if ($vbulletin->GPC['threadid'] and $threadinfo = verify_id('thread', $vbulletin->GPC['threadid'], 0, 1)) { $threadid = $threadinfo['threadid']; $vbulletin->GPC['forumid'] = $forumid = $threadinfo['forumid']; if ($forumid) { $foruminfo = fetch_foruminfo($threadinfo['forumid']); if (($foruminfo['styleoverride'] == 1 or $vbulletin->userinfo['styleid'] == 0) and !defined('BYPASS_STYLE_OVERRIDE')) { $codestyleid = $foruminfo['styleid']; } } if ($vbulletin->GPC['pollid']) { $pollinfo = verify_id('poll', $vbulletin->GPC['pollid'], 0, 1); $pollid = $pollinfo['pollid']; } } else { if ($vbulletin->GPC['forumid']) { $foruminfo = verify_id('forum', $vbulletin->GPC['forumid'], 0, 1); $forumid = $foruminfo['forumid']; if (($foruminfo['styleoverride'] == 1 or $vbulletin->userinfo['styleid'] == 0) and !defined('BYPASS_STYLE_OVERRIDE')) { $codestyleid = $foruminfo['styleid']; } } else { if ($vbulletin->GPC['pollid'] and THIS_SCRIPT == 'poll') { $pollinfo = verify_id('poll', $vbulletin->GPC['pollid'], 0, 1); $pollid = $pollinfo['pollid']; $threadinfo = fetch_threadinfo($pollinfo['threadid']); $threadid = $threadinfo['threadid']; $foruminfo = fetch_foruminfo($threadinfo['forumid']); $forumid = $foruminfo['forumid']; if (($foruminfo['styleoverride'] == 1 or $vbulletin->userinfo['styleid'] == 0) and !defined('BYPASS_STYLE_OVERRIDE')) { $codestyleid = $foruminfo['styleid']; } } } } // ############################################################################# // Redirect if this forum has a link // check if this forum is a link to an outside site if (!empty($foruminfo['link']) and trim($foruminfo['link']) != '' and (THIS_SCRIPT != 'subscription' or $_REQUEST['do'] != 'removesubscription')) { // get permission to view forum $_permsgetter_ = 'forumdisplay'; $forumperms = fetch_permissions($foruminfo['forumid']); if (!($forumperms & $vbulletin->bf_ugp_forumpermissions['canview'])) { print_no_permission(); } // add session hash to local links if necessary if (preg_match('#^([a-z0-9_]+\\.php)(\\?.*$)?#i', $foruminfo['link'], $match)) { if ($match[2]) { // we have a ?xyz part, put session url at beginning if necessary $query_string = preg_replace('/([^a-z0-9])(s|sessionhash)=[a-z0-9]{32}(&|&)?/', '\\1', $match[2]); $foruminfo['link'] = $match[1] . '?' . vB::getCurrentSession()->get('sessionurl_js') . substr($query_string, 1); } else { $foruminfo['link'] .= vB::getCurrentSession()->get('sessionurl_q'); } } exec_header_redirect($foruminfo['link'], 301); } $this->force_styleid = $codestyleid; }