if ($vbulletin->userinfo['cssprefs'] != '') { $vbulletin->options['cpstylefolder'] = $vbulletin->userinfo['cssprefs']; } // ###################### Get date / time info ####################### // override date/time settings if specified fetch_options_overrides($vbulletin->userinfo); fetch_time_data(); // ############################################ LANGUAGE STUFF #################################### // initialize $vbphrase and set language constants $vbphrase = init_language(); $_tmp = NULL; fetch_stylevars($_tmp, $vbulletin->userinfo); $permissions = cache_permissions($vbulletin->userinfo, true); $vbulletin->userinfo['permissions'] =& $permissions; $cpsession = array(); $vbulletin->input->clean_array_gpc('c', array( COOKIE_PREFIX . 'cpsession' => TYPE_STR, )); if (!empty($vbulletin->GPC[COOKIE_PREFIX . 'cpsession'])) { $cpsession = $db->query_first(" SELECT * FROM " . TABLE_PREFIX . "cpsession WHERE userid = " . $vbulletin->userinfo['userid'] . " AND hash = '" . $db->escape_string($vbulletin->GPC[COOKIE_PREFIX . 'cpsession']) . "'
/** * Switch the style for rendering * This really should be part of the bootstrap code except: * 1) We don't actually load the bootstrap in the admincp * 2) There is a lot to the style load that isn't easy to redo (header/footer templates for example) * * This handles the stylevars and template lists -- including reloading the template cache. * This is enough to handle the css template rendering, but probably won't work for anything * more complicated. */ function switch_css_style($styleid, $templates) { global $vbulletin; $styletemp = $vbulletin->db->query_first (" SELECT * FROM " . TABLE_PREFIX . "style WHERE styleid = " . intval($styleid) ); if (!$styletemp) { return false; } global $style; $style = $styletemp; $vbulletin->stylevars = unserialize($style['newstylevars']); fetch_stylevars($style, $vbulletin->userinfo); global $templateassoc; //clear the template cache, otherwise we might get old templates $vbulletin->templatecache = array(); $templateassoc = null; cache_templates($templates, $style['templatelist']); }
// ############################################ LANGUAGE STUFF #################################### // initialize $vbphrase and set language constants $vbphrase = init_language(); // ###################### Start templates & styles ####################### // allow archive to use a non-english language $styleid = intval($vbulletin->options['styleid']); ($hook = vBulletinHook::fetch_hook('style_fetch')) ? eval($hook) : false; $style = $db->query_first_slave(" SELECT * FROM " . TABLE_PREFIX . "style WHERE styleid = $styleid "); fetch_stylevars($style, $vbulletin->userinfo); if ((strtoupper(substr(PHP_OS, 0, 3)) == 'WIN' AND stristr($_SERVER['SERVER_SOFTWARE'], 'apache') === false) OR (strpos(SAPI_NAME, 'cgi') !== false AND @!ini_get('cgi.fix_pathinfo'))) { define('SLASH_METHOD', false); } else { define('SLASH_METHOD', true); } if (SLASH_METHOD) { $archive_info = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : $_SERVER['PHP_SELF']; } else
if ($styleid == 0) { continue; } $count++; if ($count > 1) { echo ','; } echo " $count"; $vbulletin->templatecache =& $stylelist["$styleid"]['templatelist']; // The fact that we use $userinfo here means that if you were to use any language specific stylevars in these templates (which we don't do by default), they would be of this user's language // The only remedy for this is to create even more scenarios in the post parsed table with left -> right, right -> left and the imageoverride folder :eek: $vbulletin->stylevars = $stylelist["$styleid"]['newstylevars']; fetch_stylevars($stylelist["$styleid"], $vbulletin->userinfo); $parsedtext = $bbcode_parser->parse($post['pagetext'], $post['forumid'], $post['allowsmilie'], false, '', false, true); $saveparsed .= ", ($post[postid], " . intval($post['lastpost']) . ", " . intval($bbcode_parser->cached['has_images']) . ", '" . $db->escape_string($bbcode_parser->cached['text']) . "', " . intval($styleid) . ", " . intval(LANGUAGEID) . " )"; } echo "<br />\n"; } if (strlen($saveparsed) > 500000) {
if ($_REQUEST['do'] == 'buildpostcache') { $bbcodelist = array(); $bbcodes = $db->query_read("\n\t\tSELECT templateid, template\n\t\tFROM " . TABLE_PREFIX . "template\n\t\tWHERE title IN ('bbcode_quote', 'bbcode_php', 'bbcode_code', 'bbcode_html')\n\t"); while ($bbcode = $db->fetch_array($bbcodes)) { $bbcodelist["{$bbcode['templateid']}"] = $bbcode['template']; } $stylelist = array(); //$uniquelist = array(); $styles = $db->query_read("\n\t\tSELECT * FROM " . TABLE_PREFIX . "style\n\t"); while ($style = $db->fetch_array($styles)) { $tlist = unserialize($style['templatelist']); $stylelist["{$style['styleid']}"]['templatelist'] = array('bbcode_code' => &$bbcodelist["{$tlist['bbcode_code']}"], 'bbcode_quote' => &$bbcodelist["{$tlist['bbcode_quote']}"], 'bbcode_php' => &$bbcodelist["{$tlist['bbcode_php']}"], 'bbcode_html' => &$bbcodelist["{$tlist['bbcode_html']}"]); $stylelist["{$style['styleid']}"]['idlist'] = array('bbcode_code' => intval($tlist['bbcode_code_styleid']), 'bbcode_quote' => intval($tlist['bbcode_quote_styleid']), 'bbcode_php' => intval($tlist['bbcode_php_styleid']), 'bbcode_html' => intval($tlist['bbcode_html_styleid'])); // The fact that we use $userinfo here means that if you were to use any language specific stylevars in these templates (which we don't do by default), they would be of this user's language // The only remedy for this is to create even more scenarios in the post parsed table with left -> right, right -> left and the imageoverride folder :eek: $stylelist["{$style['styleid']}"]['stylevar'] = fetch_stylevars($style, $vbulletin->userinfo); /*$unique = "{$tlist['bbcode_code_styleid']}|{$tlist['bbcode_quote_styleid']}|{$tlist['bbcode_php_styleid']}|{$tlist['bbcode_html_styleid']}"; if (empty($uniquelist["$unique"])) { $uniquelist["$unique"] = $style['styleid']; }*/ } $stylelist["0"] =& $stylelist["{$vbulletin->options['styleid']}"]; require_once DIR . '/includes/class_bbcode.php'; $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); if (empty($vbulletin->GPC['perpage'])) { $vbulletin->GPC['perpage'] = 1000; } if ($vbulletin->GPC['startat'] == 0) { $db->query_write("TRUNCATE TABLE " . TABLE_PREFIX . "postparsed"); $firstpost = $db->query_first("SELECT MIN(postid) AS min FROM " . TABLE_PREFIX . "post");
/** * Switch the style for rendering * This really should be part of the bootstrap code except: * 1) We don't actually load the bootstrap in the admincp * 2) There is a lot to the style load that isn't easy to redo (header/footer templates for example) * * This handles the stylevars and template lists -- including reloading the template cache. * This is enough to handle the css template rendering, but probably won't work for anything * more complicated. */ function switchCssStyle($styleid, $templates) { global $vbulletin; $style = $this->fetchStyleByID($styleid); if (empty($style)) { return false; } $this->cacheStyles(); $vbulletin->stylevars = unserialize($style['newstylevars']); fetch_stylevars($style, vB::getCurrentSession()->fetch_userinfo()); //clear the template cache, otherwise we might get old templates vB_Library::instance('template')->cacheTemplates($templates, $style['templatelist'], false, true); }
/** * Loads style information (selected style and style vars) */ public function load_style() { if ($this->called('style') and !(defined('UNIT_TESTING') and UNIT_TESTING === true)) { return; } $this->called['style'] = true; global $style; $style = $this->fetch_style_record($this->force_styleid); define('STYLEID', $style['styleid']); global $vbulletin; $vbulletin->stylevars = unserialize($style['newstylevars']); fetch_stylevars($style, $vbulletin->userinfo); }
/** * Loads style information (selected style and style vars) */ public function load_style() { if ($this->called('style') and !(defined('UNIT_TESTING') and UNIT_TESTING === true)) { return; } $this->called['style'] = true; global $style, $vbulletin; $style = $this->fetch_style_record($this->force_styleid); define('STYLEID', $style['styleid']); define('STYLE_TYPE', $style['type']); define('IS_MOBILE_STYLE', isset($vbulletin->stylecache['mobile'][$style['styleid']]) ? 1 : 0); $vbulletin->stylevars = unserialize($style['newstylevars']); fetch_stylevars($style, $vbulletin->userinfo); }