/** * Converts all data from the template table for a style into the style table * * @param integer Style ID * @param string Title of style * @param array Array of actions set to true/false: docss/dostylevars/doreplacements/doposteditor * @param string List of parent styles * @param string Indent for HTML printing */ function build_style($styleid, $title = '', $actions = array(), $parentlist = '', $indent = '') { global $vbulletin, $_queries, $vbphrase, $_query_special_templates; static $phrase, $csscache; if (($actions['doreplacements'] OR $actions['docss'] OR $actions['dostylevars']) AND $vbulletin->options['storecssasfile']) { $actions['docss'] = true; $actions['doreplacements'] = true; } if ($styleid != -1) { $QUERY = array( '' => "dateline = " . TIMENOW ); // echo the title and start the listings echo "$indent<li><b>$title</b> ... <span class=\"smallfont\">"; vbflush(); // build the templateid cache if (!$parentlist) { $parentlist = fetch_parentids($styleid); } $templatelist = build_template_id_cache($styleid, 1, $parentlist); $QUERY[] = "templatelist = '" . $vbulletin->db->escape_string($templatelist) . "'"; echo "($vbphrase[templates]) "; vbflush(); // cache special templates if ($actions['docss'] OR $actions['dostylevars'] OR $actions['doreplacements'] OR $actions['doposteditor']) { // get special templates for this style $template_cache = array(); $templateids = implode(',' , unserialize($templatelist)); $templates = $vbulletin->db->query_read(" SELECT title, template, templatetype FROM " . TABLE_PREFIX . "template WHERE templateid IN ($templateids) AND (templatetype <> 'template' OR title IN('" . implode("', '", $_query_special_templates) . "')) "); while ($template = $vbulletin->db->fetch_array($templates)) { $template_cache["$template[templatetype]"]["$template[title]"] = $template; } $vbulletin->db->free_result($templates); } // style vars if ($actions['dostylevars']) { // rebuild the stylevars field for this style $stylevars = array(); foreach($template_cache['stylevar'] AS $template) { // set absolute paths for image directories /*if (substr($template['title'], 0, 7) == 'imgdir_') { if (!preg_match('#^https?://#i', $template['template'])) { $template['template'] = "$template[template]"; } }*/ $stylevars["$template[title]"] = $template['template']; } $QUERY[] = "stylevars = '" . $vbulletin->db->escape_string(serialize($stylevars)) . '\''; echo "($vbphrase[stylevars]) "; vbflush(); static $master_stylevar_cache = null; if ($master_stylevar_cache === null) { $master_stylevar_cache = array(); $master_stylevars = $vbulletin->db->query_read(" SELECT stylevardfn.stylevarid, stylevardfn.datatype, stylevar.value FROM " . TABLE_PREFIX . "stylevardfn AS stylevardfn LEFT JOIN " . TABLE_PREFIX . "stylevar AS stylevar ON (stylevardfn.stylevarid = stylevar.stylevarid AND stylevar.styleid = -1) "); while ($master_stylevar = $vbulletin->db->fetch_array($master_stylevars)) { $tmp = unserialize($master_stylevar['value']); if (!is_array($tmp)) { $tmp = array('value' => $tmp); } $master_stylevar_cache[$master_stylevar['stylevarid']] = $tmp; $master_stylevar_cache[$master_stylevar['stylevarid']]['datatype'] = $master_stylevar['datatype']; } } $newstylevars = $master_stylevar_cache; if (substr(trim($parentlist), 0, -3) != '') { $new_stylevars = $vbulletin->db->query_read($sql = " SELECT stylevarid, styleid, value, INSTR(',$parentlist,', CONCAT(',', styleid, ',') ) AS ordercontrol FROM " . TABLE_PREFIX . "stylevar WHERE styleid IN (" . substr(trim($parentlist), 0, -3) . ") ORDER BY ordercontrol DESC "); while ($new_stylevar = $vbulletin->db->fetch_array($new_stylevars)) { $newstylevars[$new_stylevar['stylevarid']] = unserialize($new_stylevar['value']); $newstylevars[$new_stylevar['stylevarid']]['datatype'] = $master_stylevar_cache[$new_stylevar['stylevarid']]['datatype']; } } $QUERY[] = "newstylevars = '" . $vbulletin->db->escape_string(serialize($newstylevars)) . '\''; } // replacements if ($actions['doreplacements']) { // rebuild the replacements field for this style $replacements = array(); if (is_array($template_cache['replacement'])) { foreach($template_cache['replacement'] AS $template) { // set the key to be a case-insentitive preg find string $replacementkey = '#' . preg_quote($template['title'], '#') . '#si'; $replacements["$replacementkey"] = $template['template']; } $QUERY[] = 'replacements = \'' . $vbulletin->db->escape_string(serialize($replacements)) . '\''; } else { $QUERY[] = 'replacements = \'\''; } echo "($vbphrase[replacement_variables]) "; vbflush(); } // css -- old style css if ($actions['docss']) { // build a quick cache with the ~old~ contents of the css fields from the style table if (!is_array($csscache)) { $csscache = array(); $fetchstyles = $vbulletin->db->query_read("SELECT styleid, css FROM " . TABLE_PREFIX . "style"); while ($fetchstyle = $vbulletin->db->fetch_array($fetchstyles)) { $fetchstyle['css'] .= "\n"; $csscache["$fetchstyle[styleid]"] = $fetchstyle['css']; } } // rebuild the css field for this style $css = array(); foreach($template_cache['css'] AS $template) { $css["$template[title]"] = unserialize($template['template']); } // build the CSS contents $csscolors = array(); $css = construct_css($css, $styleid, $title, $csscolors); // attempt to delete the old css file if it exists delete_css_file($styleid, $csscache["$styleid"]); $adblock_is_evil = str_replace('ad', 'be', substr(md5(microtime()), 8, 8)); $cssfilename = 'clientscript/vbulletin_css/style-' . $adblock_is_evil . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css'; // if we are going to store CSS as files, run replacement variable substitution on the file to be saved if ($vbulletin->options['storecssasfile']) { $css = process_replacement_vars($css, array('styleid' => $styleid, 'replacements' => serialize($replacements))); $css = preg_replace('#(?<=[^a-z0-9-]|^)url\((\'|"|)(.*)\\1\)#iUe', "rewrite_css_file_url('\\2', '\\1')", $css); if (write_css_file($cssfilename, $css)) { $css = "@import url(\"$cssfilename\");"; } } $fullcsstext = "<style type=\"text/css\" id=\"vbulletin_css\">\r\n" . "/**\r\n* vBulletin " . $vbulletin->options['templateversion'] . " CSS\r\n* Style: '$title'; Style ID: $styleid\r\n*/\r\n" . "$css\r\n</style>\r\n" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"clientscript/vbulletin_important.css?v=" . $vbulletin->options['simpleversion'] . "\" />" ; $QUERY[] = "css = '" . $vbulletin->db->escape_string($fullcsstext) . "'"; $QUERY[] = "csscolors = '" . $vbulletin->db->escape_string(serialize($csscolors)) . "'"; echo "($vbphrase[css]) "; vbflush(); } // post editor styles if ($actions['doposteditor']) { $editorstyles = array(); foreach ($template_cache['template'] AS $template) { if (substr($template['title'], 0, 13) == 'editor_styles') { $title = 'pi' . substr($template['title'], 13); $item = fetch_posteditor_styles($template['template']); $editorstyles["$title"] = array($item['background'], $item['color'], $item['padding'], $item['border']); } } $QUERY[] = 'editorstyles = \'' . $vbulletin->db->escape_string(serialize($editorstyles)) . '\''; echo "($vbphrase[controls]) "; vbflush(); } // do the style update query if (sizeof($QUERY)) { $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "style SET\n" . implode(",\n", $QUERY) . "\nWHERE styleid = $styleid"); } //write out the new css -- do this *after* we update the style record if ($vbulletin->options['storecssasfile']) { if (!write_style_css_directory($styleid, $parentlist, 'ltr')) { echo fetch_error("rebuild_failed_to_write_css"); } else if (!write_style_css_directory($styleid, $parentlist, 'rtl')) { echo fetch_error("rebuild_failed_to_write_css"); } } else { // race condition here //delete_style_css_directory($styleid, 'ltr'); //delete_style_css_directory($styleid, 'rtl'); } // finish off the listings echo "</span><b>" . $vbphrase['done'] . "</b>.<br /> </li>\n"; vbflush(); } $childsets = $vbulletin->db->query_read(" SELECT styleid, title, parentlist FROM " . TABLE_PREFIX . "style WHERE parentid = $styleid "); if ($vbulletin->db->num_rows($childsets)) { echo "$indent<ul class=\"ldi\">\n"; while ($childset = $vbulletin->db->fetch_array($childsets)) { build_style($childset['styleid'], $childset['title'], $actions, $childset['parentlist'], $indent . "\t"); } echo "$indent</ul>\n"; } }
if ($vbulletin->GPC['reason'] == '') { eval(standard_error(fetch_error('noreason'))); } if ($perform_floodcheck) { $reportobj->perform_floodcheck_commit(); } $reportobj->do_report($vbulletin->GPC['reason'], $messageinfo); $url =& $vbulletin->url; eval(print_standard_redirect('redirect_reportthanks')); } } if ($_REQUEST['do'] == 'quickedit') { $vbulletin->input->clean_array_gpc('p', array('editorid' => TYPE_NOHTML)); require_once DIR . '/includes/class_xml.php'; require_once DIR . '/includes/functions_editor.php'; $vminfo = verify_visitormessage($vbulletin->GPC['vmid']); $editorid = construct_edit_toolbar(htmlspecialchars_uni($vminfo['pagetext']), false, 'visitormessage', true, true, false, 'qenr', $vbulletin->GPC['editorid']); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('quickedit'); $xml->add_tag('editor', process_replacement_vars($messagearea), array('reason' => '', 'parsetype' => 'visitormessage', 'parsesmilies' => true, 'mode' => $show['is_wysiwyg_editor'])); $xml->close_group(); $xml->print_xml(); } ($hook = vBulletinHook::fetch_hook('visitor_message_complete')) ? eval($hook) : false; eval('print_output("' . fetch_template($templatename) . '");'); /*======================================================================*\ || #################################################################### || # Downloaded: 12:39, Wed May 30th 2012 || # CVS: $RCSfile$ - $Revision: 39862 $ || #################################################################### \*======================================================================*/
$postbit_factory->registry =& $vbulletin; $postbit_factory->forum =& $foruminfo; $postbit_factory->thread =& $threadinfo; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('post'); $postbit_obj->highlight =& $replacewords; $postbit_obj->cachable = (!$post['pagetext_html'] and $vbulletin->options['cachemaxage'] > 0 and TIMENOW - $vbulletin->options['cachemaxage'] * 60 * 60 * 24 <= $threadinfo['lastpost']); ($hook = vBulletinHook::fetch_hook('showpost_post')) ? eval($hook) : false; $postbits = $postbit_obj->construct_postbit($post); // save post to cache if relevant if ($postbit_obj->cachable) { /*insert query*/ $db->shutdown_query("\n\t\tREPLACE INTO " . TABLE_PREFIX . "postparsed (postid, dateline, hasimages, pagetext_html, styleid, languageid)\n\t\tVALUES (\n\t\t\t{$post['postid']}, " . intval($threadinfo['lastpost']) . ", " . intval($postbit_obj->post_cache['has_images']) . ", '" . $db->escape_string($postbit_obj->post_cache['text']) . "', " . intval(STYLEID) . ", " . intval(LANGUAGEID) . "\n\t\t\t)\n\t"); } ($hook = vBulletinHook::fetch_hook('showpost_complete')) ? eval($hook) : false; //if ($_SERVER['REQUEST_METHOD'] == 'POST' AND if ($vbulletin->GPC['ajax']) { require_once DIR . '/includes/class_xml.php'; $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('postbit', process_replacement_vars($postbits)); $xml->print_xml(); } else { eval('print_output("' . fetch_template('SHOWTHREAD_SHOWPOST') . '");'); } /*======================================================================*\ || #################################################################### || # Downloaded: 08:19, Wed Nov 5th 2008 || # CVS: $RCSfile$ - $Revision: 26399 $ || #################################################################### \*======================================================================*/
/** * Finishes off the current page (using templates), prints it out to the browser and halts execution * * @param string The HTML of the page to be printed * @param boolean Send the content length header? */ function print_output($vartext, $sendheader = true) { global $querytime, $vbulletin, $show, $vbphrase; if ($vbulletin->options['addtemplatename']) { if ($doctypepos = @strpos($vartext, vB_Template_Runtime::fetchStyleVar('htmldoctype'))) { $comment = substr($vartext, 0, $doctypepos); $vartext = substr($vartext, $doctypepos + strlen(vB_Template_Runtime::fetchStyleVar('htmldoctype'))); $vartext = vB_Template_Runtime::fetchStyleVar('htmldoctype') . "\n" . $comment . $vartext; } } if (!empty($vbulletin->db->explain) OR $vbulletin->debug) { $totaltime = microtime(true) - TIMESTART; $vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->"; } // set cookies for displayed notices if ($show['notices'] AND !defined('NOPMPOPUP') AND !empty($vbulletin->np_notices_displayed) AND is_array($vbulletin->np_notices_displayed)) { $np_notices_cookie = $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']; vbsetcookie('np_notices_displayed', ($np_notices_cookie ? "$np_notices_cookie," : '') . implode(',', $vbulletin->np_notices_displayed), false ); } // debug code global $DEVDEBUG, $vbcollapse; if ($vbulletin->debug) { devdebug('php_sapi_name(): ' . SAPI_NAME); $messages = ''; if (is_array($DEVDEBUG)) { foreach($DEVDEBUG AS $debugmessage) { $messages .= "\t<option>" . htmlspecialchars_uni($debugmessage) . "</option>\n"; } } if (!empty(vB_Template::$template_usage)) { $tempusagecache = vB_Template::$template_usage; $_TEMPLATEQUERIES = vB_Template::$template_queries; unset($tempusagecache['board_inactive_warning'], $_TEMPLATEQUERIES['board_inactive_warning']); ksort($tempusagecache); foreach ($tempusagecache AS $template_name => $times) { $tempusagecache["$template_name"] = "<span class=\"shade\" style=\"float:right\">($times)</span>" . ((isset($_TEMPLATEQUERIES["$template_name"]) AND $_TEMPLATEQUERIES["$template_name"]) ? "<span style=\"color:red; font-weight:bold\">$template_name</span>" : $template_name); } } else { $tempusagecache = array(); } $hook_usage = ''; $hook_total = 0; foreach (vBulletinHook::fetch_hookusage() AS $hook_name => $has_code) { $hook_usage .= '<li class="smallfont' . (!$has_code ? ' shade' : '') . '">' . $hook_name . '</li>'; $hook_total++; } if (!$hook_usage) { $hook_usage = '<li class="smallfont"> </li>'; } $phrase_groups = ''; sort($GLOBALS['phrasegroups']); foreach ($GLOBALS['phrasegroups'] AS $phrase_group) { $phrase_groups .= '<li class="smallfont">' . $phrase_group . '</li>'; } if (!$phrase_groups) { $phrase_groups = '<li class="smallfont"> </li>'; } $vbcollapse['collapseimg_debuginfo'] = (!empty($vbcollapse['collapseimg_debuginfo']) ? $vbcollapse['collapseimg_debuginfo'] : ''); $vbcollapse['collapseobj_debuginfo'] = (!empty($vbcollapse['collapseobj_debuginfo']) ? $vbcollapse['collapseobj_debuginfo'] : ''); $debughtml = " <div class=\"block\" id=\"debuginfo\" style=\"width:800px; margin:4px auto;\"> <h2 class=\"blockhead collapse\"> <a style=\"float:" . vB_Template_Runtime::fetchStyleVar('right') . ";\" href=\"" . htmlspecialchars_uni($vbulletin->input->fetch_relpath()) . "#\" title=\"Close Debug Information\" onclick=\"document.getElementById('debuginfo').parentNode.removeChild(document.getElementById('debuginfo')); return false;\">X</a> vBulletin {$vbulletin->options['templateversion']} Debug Information </h2> <div style=\"border:" . vB_Template_Runtime::fetchStyleVar('blockhead_border') . "; border-top:0;\"> <div class=\"blockbody\"> <div class=\"blockrow\"> <ul style=\"list-style:none; margin:0px; padding:0px\"> <li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Page Generation</span> " . vb_number_format($totaltime, 5) . " seconds</li> " . (function_exists('memory_get_usage') ? "<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Memory Usage</span> " . number_format(memory_get_usage() / 1024) . 'KB</li>' : '') . " <li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Queries Executed</span> " . (empty($_TEMPLATEQUERIES) ? $vbulletin->db->querycount : "<span title=\"Uncached Templates!\" style=\"color:red; font-weight:bold\">{$vbulletin->db->querycount}</span>") . " <a href=\"" . (htmlspecialchars($vbulletin->scriptpath)) . (strpos($vbulletin->scriptpath, '?') === false ? '?' : '&') . "explain=1\" target=\"_blank\" title=\"Explain Queries\">(?)</a></li> </ul> </div> </div> <div class=\"blocksubhead collapse\"> <a style=\"top:5px;\" class=\"collapse\" id=\"collapse_debuginfo_body\" href=\"#top\"><img src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_button') . "/collapse_40b.png\" alt=\"\" title=\"Collapse Debug Information\" /></a> More Information </div> <div class=\"blockbody\" id=\"debuginfo_body\"> <div class=\"blockrow\"> <div style=\"width:48%; float:left;\"> <div style=\"margin-bottom:6px; font-weight:bold;\">Template Usage (" . sizeof($tempusagecache) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', $tempusagecache) . " </li></ul> <hr style=\"margin:10px 0px 10px 0px\" /> <div style=\"margin-bottom:6px; font-weight:bold;\">Phrase Groups Available (" . sizeof($GLOBALS['phrasegroups']) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\">$phrase_groups</ul> </div> <div style=\"width:48%; float:right;\"> <div style=\"margin-bottom:6px; font-weight:bold;\">Included Files (" . sizeof($included_files = get_included_files()) . "):</div> <ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', str_replace(str_replace('\\', '/', DIR) . '/', '', preg_replace('#^(.*/)#si', '<span class="shade">./\1</span>', str_replace('\\', '/', $included_files)))) . " </li></ul> <hr style=\"margin:10px 0px 10px 0px\" /> <div style=\"margin-bottom:6px; font-weight:bold;\">Hooks Called ($hook_total):</div> <ul style=\"list-style:none; margin:0px; padding:0px\">$hook_usage</ul> </div> <br style=\"clear:both;\" /> </div> </div> <div class=\"blockbody\"> <div class=\"blockrow\"> <label>Messages:<select style=\"display:block; width:100%\">$messages</select></label> </div> </div> </div> </div> "; $vartext = str_replace('</body>', "<!--start debug html-->$debughtml<!--end debug html-->\n</body>", $vartext); } // end debug code $output = process_replacement_vars($vartext); if ($vbulletin->debug AND function_exists('memory_get_usage')) { $output = preg_replace('#(<!--querycount-->Executed <b>\d+</b> queries<!--/querycount-->)#siU', 'Memory Usage: <strong>' . number_format((memory_get_usage() / 1024)) . 'KB</strong>, \1', $output); } // parse PHP include ################## ($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false; // make sure headers sent returns correctly if (ob_get_level() AND ob_get_length()) { ob_end_flush(); } if (!headers_sent()) { if ($vbulletin->options['gzipoutput']) { $output = fetch_gzipped_text($output, $vbulletin->options['gziplevel']); } if ($sendheader) { @header('Content-Length: ' . strlen($output)); } } // Trigger shutdown event $vbulletin->shutdown->shutdown(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // show regular page if (empty($vbulletin->db->explain)) { echo $output; } // show explain else { $querytime = $vbulletin->db->time_total; echo "\n<b>Page generated in $totaltime seconds with " . $vbulletin->db->querycount . " queries,\nspending $querytime doing MySQL queries and " . ($totaltime - $querytime) . " doing PHP things.\n\n<hr />Shutdown Queries:</b>" . (defined('NOSHUTDOWNFUNC') ? " <b>DISABLED</b>" : '') . "<hr />\n\n"; } // broken if zlib.output_compression is on with Apache 2 if (SAPI_NAME != 'apache2handler' AND SAPI_NAME != 'apache2filter') { flush(); } exit; }
case 'signature': $dohtml = $vbulletin->userinfo['permissions']['signaturepermissions'] & $vbulletin->bf_ugp_signaturepermissions['allowhtml']; break; default: if (intval($vbulletin->GPC['parsetype'])) { $parsetype = intval($vbulletin->GPC['parsetype']); $foruminfo = fetch_foruminfo($parsetype); $dohtml = $foruminfo['allowhtml']; break; } else { $dohtml = false; } //($hook = vBulletinHook::fetch_hook('editor_switch_wysiwyg_to_standard')) ? eval($hook) : false; } $html_parser = new vB_WysiwygHtmlParser($vbulletin); $vbulletin->GPC['pagetext'] = process_replacement_vars($html_parser->parse_wysiwyg_html_to_bbcode($vbulletin->GPC['pagetext'], $dohtml)); } // If we have a posthash then only save it if it is valid // this can be used to grab attachments that are attached to this draft if ($vbulletin->GPC['posthash'] and $vbulletin->GPC['posthash'] != md5($vbulletin->GPC['poststarttime'] . $vbulletin->userinfo['userid'] . $vbulletin->userinfo['salt'])) { $vbulletin->GPC['posthash'] = ''; } $db->query_write("\n\t\tREPLACE INTO " . TABLE_PREFIX . "autosave\n\t\t\t(contenttypeid, contentid, parentcontentid, userid, pagetext, title, posthash, dateline)\n\t\tVALUES\n\t\t(\n\t\t\t'" . $db->escape_string($vbulletin->GPC['contenttypeid']) . "',\n\t\t\t{$vbulletin->GPC['contentid']},\n\t\t\t{$vbulletin->GPC['parentcontentid']},\n\t\t\t{$vbulletin->userinfo['userid']},\n\t\t\t'" . $db->escape_string($vbulletin->GPC['pagetext']) . "',\n\t\t\t'" . $db->escape_string($vbulletin->GPC['title']) . "',\n\t\t\t'" . $db->escape_string($vbulletin->GPC['posthash']) . "',\n\t\t\t" . TIMENOW . "\n\t\t)\n\t"); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('ok', 1); $xml->print_xml(); } ($hook = vBulletinHook::fetch_hook('ajax_complete')) ? eval($hook) : false; /*======================================================================*\ || #################################################################### || # Downloaded: 03:13, Sat Sep 7th 2013
$editorid = construct_edit_toolbar( htmlspecialchars_uni($vminfo['pagetext']), false, 'visitormessage', true, true, false, 'qenr', $vbulletin->GPC['editorid'] ); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('quickedit'); $xml->add_tag('editor', process_replacement_vars($messagearea), array( 'reason' => '', 'parsetype' => 'visitormessage', 'parsesmilies' => true, 'mode' => $show['is_wysiwyg_editor'] )); $xml->close_group(); $xml->print_xml(); } ($hook = vBulletinHook::fetch_hook('visitor_message_complete')) ? eval($hook) : false; /*======================================================================*\ || #################################################################### || #
/** * Converts all data from the template table for a style into the style table * * @param integer Style ID * @param string Title of style * @param array Array of actions set to true/false: docss/dostylevars/doreplacements/doposteditor * @param string List of parent styles * @param string Indent for HTML printing */ function build_style($styleid, $title = '', $actions, $parentlist = '', $indent = '') { global $vbulletin, $_queries, $vbphrase, $_query_special_templates; static $phrase, $csscache; if (($actions['doreplacements'] or $actions['docss']) and $vbulletin->options['storecssasfile']) { $actions['docss'] = true; $actions['doreplacements'] = true; } if ($styleid != -1) { $QUERY = array(); // echo the title and start the listings echo "{$indent}<li><b>{$title}</b> ... <span class=\"smallfont\">"; vbflush(); // build the templateid cache $templatelist = build_template_id_cache($styleid, 1, $parentlist); $QUERY[] = "templatelist = '" . $vbulletin->db->escape_string($templatelist) . "'"; echo "({$vbphrase['templates']}) "; vbflush(); // cache special templates if ($actions['docss'] or $actions['dostylevars'] or $actions['doreplacements'] or $actions['doposteditor']) { // get special templates for this style $template_cache = array(); $templateids = implode(',', unserialize($templatelist)); $templates = $vbulletin->db->query_read("\n\t\t\t\tSELECT title, template, templatetype\n\t\t\t\tFROM " . TABLE_PREFIX . "template\n\t\t\t\tWHERE templateid IN ({$templateids})\n\t\t\t\t\tAND (templatetype <> 'template' OR title IN('" . implode("', '", $_query_special_templates) . "'))\n\t\t\t"); while ($template = $vbulletin->db->fetch_array($templates)) { $template_cache["{$template['templatetype']}"]["{$template['title']}"] = $template; } $vbulletin->db->free_result($templates); } // style vars if ($actions['dostylevars']) { // rebuild the stylevars field for this style $stylevars = array(); foreach ($template_cache['stylevar'] as $template) { // set absolute paths for image directories /*if (substr($template['title'], 0, 7) == 'imgdir_') { if (!preg_match('#^https?://#i', $template['template'])) { $template['template'] = "$template[template]"; } }*/ $stylevars["{$template['title']}"] = $template['template']; } $QUERY[] = "stylevars = '" . $vbulletin->db->escape_string(serialize($stylevars)) . '\''; echo "({$vbphrase['stylevars']}) "; vbflush(); } // replacements if ($actions['doreplacements']) { // rebuild the replacements field for this style $replacements = array(); if (is_array($template_cache['replacement'])) { foreach ($template_cache['replacement'] as $template) { // set the key to be a case-insentitive preg find string $replacementkey = '#' . preg_quote($template['title'], '#') . '#si'; $replacements["{$replacementkey}"] = $template['template']; } $QUERY[] = 'replacements = \'' . $vbulletin->db->escape_string(serialize($replacements)) . '\''; } else { $QUERY[] = 'replacements = \'\''; } echo "({$vbphrase['replacement_variables']}) "; vbflush(); } // css if ($actions['docss']) { // build a quick cache with the ~old~ contents of the css fields from the style table if (!is_array($csscache)) { $csscache = array(); $fetchstyles = $vbulletin->db->query_read("SELECT styleid, css FROM " . TABLE_PREFIX . "style"); while ($fetchstyle = $vbulletin->db->fetch_array($fetchstyles)) { $fetchstyle['css'] .= "\n"; $csscache["{$fetchstyle['styleid']}"] = $fetchstyle['css']; } } // rebuild the css field for this style $css = array(); foreach ($template_cache['css'] as $template) { $css["{$template['title']}"] = unserialize($template['template']); } // build the CSS contents $csscolors = array(); $css = construct_css($css, $styleid, $title, $csscolors); // attempt to delete the old css file if it exists delete_css_file($styleid, $csscache["{$styleid}"]); $adblock_is_evil = str_replace('ad', 'be', substr(md5(microtime()), 8, 8)); $cssfilename = 'clientscript/vbulletin_css/style-' . $adblock_is_evil . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css'; // if we are going to store CSS as files, run replacement variable substitution on the file to be saved if ($vbulletin->options['storecssasfile'] and write_css_file($cssfilename, process_replacement_vars($css, array('styleid' => $styleid, 'replacements' => serialize($replacements))))) { $css = "@import url(\"{$cssfilename}\");"; } $fullcsstext = "<style type=\"text/css\" id=\"vbulletin_css\">\r\n" . "/**\r\n* vBulletin " . $vbulletin->options['templateversion'] . " CSS\r\n* Style: '{$title}'; Style ID: {$styleid}\r\n*/\r\n" . "{$css}\r\n</style>\r\n" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"clientscript/vbulletin_important.css?v=" . $vbulletin->options['simpleversion'] . "\" />"; $QUERY[] = "css = '" . $vbulletin->db->escape_string($fullcsstext) . "'"; $QUERY[] = "csscolors = '" . $vbulletin->db->escape_string(serialize($csscolors)) . "'"; echo "({$vbphrase['css']}) "; vbflush(); } // post editor styles if ($actions['doposteditor']) { $editorstyles = array(); foreach ($template_cache['template'] as $template) { if (substr($template['title'], 0, 13) == 'editor_styles') { $title = 'pi' . substr($template['title'], 13); $item = fetch_posteditor_styles($template['template']); $editorstyles["{$title}"] = array($item['background'], $item['color'], $item['padding'], $item['border']); } } $QUERY[] = 'editorstyles = \'' . $vbulletin->db->escape_string(serialize($editorstyles)) . '\''; echo "({$vbphrase['controls']}) "; vbflush(); } // do the style update query if (sizeof($QUERY)) { $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "style SET\n" . implode(",\n", $QUERY) . "\nWHERE styleid = {$styleid}"); } // finish off the listings echo "</span><b>" . $vbphrase['done'] . "</b>.<br /> </li>\n"; vbflush(); } $childsets = $vbulletin->db->query_read("\n\t\tSELECT styleid, title, parentlist\n\t\tFROM " . TABLE_PREFIX . "style\n\t\tWHERE parentid = {$styleid}\n\t"); if ($vbulletin->db->num_rows($childsets)) { echo "{$indent}<ul class=\"ldi\">\n"; while ($childset = $vbulletin->db->fetch_array($childsets)) { build_style($childset['styleid'], $childset['title'], $actions, $childset['parentlist'], $indent . "\t"); } echo "{$indent}</ul>\n"; } }
} else { $threadresult = $vbulletin->db->query_read_slave("\n\t\t\tSELECT pm.*, pmtext.*\n\t\t\tFROM " . TABLE_PREFIX . "pm AS pm\n\t\t\tINNER JOIN " . TABLE_PREFIX . "pmtext AS pmtext ON(pmtext.pmtextid = pm.pmtextid)\n\t\t\tWHERE (pm.parentpmid=" . $pm['parentpmid'] . "\n\t\t\t\t\tOR pm.pmid = " . $pm['parentpmid'] . ")\n\t\t\tAND pm.pmid != " . $vbulletin->GPC['pmid'] . "\n\t\t\tAND pm.userid=" . $vbulletin->userinfo['userid'] . "\n\t\t\tAND pmtext.dateline < " . intval($pm['dateline']) . "\n\t\t\tORDER BY pmtext.dateline DESC\n\t\t"); if ($vbulletin->db->num_rows($threadresult)) { $threadpms = ''; while ($threadpm = $vbulletin->db->fetch_array($threadresult)) { $postbit_factory = new vB_Postbit_Factory(); $postbit_factory->registry =& $vbulletin; $postbit_factory->cache = array(); $postbit_factory->bbcode_parser = new vB_BbCodeParser($vbulletin, fetch_tag_list()); $postbit_obj =& $postbit_factory->fetch_postbit('pm'); $threadpms .= $postbit_obj->construct_postbit($threadpm); } } else { $threadpms = vB_Template::create('pm_nomessagehistory')->render(); } $xml->add_tag('html', process_replacement_vars($threadpms)); } $xml->close_group(); $xml->print_xml(true); } // ############################### start pm folder view ############################### if ($_REQUEST['do'] == 'messagelist') { $vbulletin->input->clean_array_gpc('r', array('folderid' => TYPE_INT, 'perpage' => TYPE_UINT, 'pagenumber' => TYPE_UINT)); ($hook = vBulletinHook::fetch_hook('private_messagelist_start')) ? eval($hook) : false; $folderid = $vbulletin->GPC['folderid']; $folderjump = construct_folder_jump(0, $vbulletin->GPC['folderid'], false, '', true); $foldername = $foldernames["{$vbulletin->GPC['folderid']}"]['name']; // count receipts $receipts = $db->query_first_slave("\n\t\tSELECT\n\t\t\tSUM(IF(readtime <> 0, 1, 0)) AS confirmed,\n\t\t\tSUM(IF(readtime = 0, 1, 0)) AS unconfirmed\n\t\tFROM " . TABLE_PREFIX . "pmreceipt\n\t\tWHERE userid = " . $vbulletin->userinfo['userid']); // get ignored users $ignoreusers = preg_split('#\\s+#s', $vbulletin->userinfo['ignorelist'], -1, PREG_SPLIT_NO_EMPTY);
$vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "t={$threadinfo['threadid']}&page=" . $vbulletin->GPC['pagenumber'] . "&pp=" . $vbulletin->GPC['perpage']; eval(print_standard_redirect('redirect_threadrate_add')); } } } } require_once DIR . '/includes/class_xml.php'; $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('threadrating'); if ($update) { $thread = $db->query_first_slave("\n\t\tSELECT votetotal, votenum\n\t\tFROM " . TABLE_PREFIX . "thread\n\t\tWHERE threadid = {$threadinfo['threadid']}\n\t"); if ($thread['votenum'] >= $vbulletin->options['showvotes']) { // Show Voteavg $thread['voteavg'] = vb_number_format($thread['votetotal'] / $thread['votenum'], 2); $thread['rating'] = round($thread['votetotal'] / $thread['votenum']); $xml->add_tag('voteavg', process_replacement_vars("{$vbphrase['rating']}: <img class=\"inlineimg\" src=\"{$stylevar['imgdir_rating']}/rating_{$thread['rating']}.gif\" alt=\"" . construct_phrase($vbphrase['thread_rating_x_votes_y_average'], $thread['votenum'], $thread['voteavg']) . "\" border=\"0\" />")); } else { $xml->add_tag('voteavg', ''); } if (!function_exists('fetch_phrase')) { require_once DIR . '/includes/functions_misc.php'; } $xml->add_tag('message', fetch_phrase('redirect_threadrate_add', 'frontredirect', 'redirect_')); } else { $xml->add_tag('error', fetch_error('threadratevoted')); } $xml->close_group(); $xml->print_xml(); /*======================================================================*\ || #################################################################### || # Downloaded: 08:19, Wed Nov 5th 2008
$attach = new vB_Attach_Display_Content($vbulletin, 'vBBlog_BlogEntry'); $postattach = $attach->fetch_postattach(0, $bloginfo['blogid']); } require_once DIR . '/includes/class_blog_entry.php'; require_once DIR . '/includes/class_bbcode_blog.php'; require_once DIR . '/includes/class_xml.php'; $bbcode = new vB_BbCodeParser_Blog_Snippet($vbulletin, fetch_tag_list()); $factory = new vB_Blog_EntryFactory($vbulletin, $bbcode, $categories); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $bloginfo['state'] = 'visible'; $entry_handler =& $factory->create($bloginfo); if ($vbulletin->userinfo['userid'] == $bloginfo['userid']) { $entry_handler->userinfo = $vbulletin->userinfo; } $entry_handler->attachments = $postattach; $xml->add_tag('entrybit', process_replacement_vars($entry_handler->construct())); $xml->print_xml(); } // ############################################################################# // return a comment in an editor if ($_POST['do'] == 'quickeditcomment') { $vbulletin->input->clean_array_gpc('p', array('blogtextid' => TYPE_UINT, 'editorid' => TYPE_STR)); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); if (!$vbulletin->options['quickedit']) { // if quick edit has been disabled after showthread is loaded, return a string to indicate such $xml->add_tag('disabled', 'true'); $xml->print_xml(); } else { $vbulletin->GPC['editorid'] = preg_replace('/\\W/s', '', $vbulletin->GPC['editorid']); /* Check they can view a blog, any blog */ if (!($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewown']) and !($vbulletin->userinfo['permissions']['vbblog_general_permissions'] & $vbulletin->bf_ugp_vbblog_general_permissions['blog_canviewothers'])) {
if ($_REQUEST['do'] == 'customize') { $cssdisplayinfo = $usercss->build_display_array(); $errors = ''; // if we don't have errors, the displayed values are the existing ones // otherwise, use the form submission if (!defined('HAVE_ERRORS')) { if ($vbulletin->GPC['copyprofilecss'] AND ($vbulletin->options['socnet'] & $vbulletin->bf_misc_socnet['enable_profile_styling'])) { $profileusercss = new vB_UserCSS($vbulletin, $vbulletin->userinfo['userid']); $selectors_saved = $profileusercss->existing; $usercss_profile_preview = $profileusercss->build_css($profileusercss->fetch_effective()); $usercss_profile_preview = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $usercss_profile_preview); $usercss_profile_preview = process_replacement_vars($usercss_profile_preview); unset($profileusercss); define('VBBLOG_NOUSERCSS', true); } else { $selectors_saved = $usercss->existing; } } ($hook = vBulletinHook::fetch_hook('blog_customize_start')) ? eval($hook) : false; $usercssbits = ''; foreach ($cssdisplayinfo AS $selectorname => $selectorinfo) { $selector = $selector_base;
$popup = $vbulletin->input->clean_gpc('r', 'popup', TYPE_BOOL); if ($popup) { $templater = vB_Template::create('tag_edit_ajax_popup'); } else { $templater = vB_Template::create('tag_edit_ajax'); } $templater->register('contentid', $contentid); $templater->register('contenttype', $contenttypeid); $templater->register('tags_remain', $tags_remain); $templater->register('tag_manage_options', $tag_manage_options); $templater->register('url', $url); $html = $templater->render(); require_once DIR . '/includes/class_xml.php'; $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('tag'); $xml->add_tag($popup ? 'tagpopup' : 'html', process_replacement_vars($html)); $xml->add_tag('delimiters', $vbulletin->options['tagdelimiter']); $xml->close_group(); $xml->print_xml(); } else { $returnurl = $content->fetch_return_url(); $title = $content->get_title(); if (!$title) { $title = $content->fetch_content_type_diplay(); } $content_type_label = $content->fetch_content_type_diplay(); // navbar and output $navbits = $content->fetch_page_nav(); $navbar = render_navbar_template($navbits); $templater = vB_Template::create('tag_edit'); $templater->register_page_templates();
$templater = vB_Template::create('reputationbit'); $templater->register('postid', $postid); $templater->register('url', $url); $templater->register('userinfo', $userinfo); $reputationbit = $templater->render(); } if ($vbulletin->GPC['ajax']) { $templater = vB_Template::create('reputation_ajax'); $templater->register('reputationbit', $reputationbit); $reputation = $templater->render(); require_once(DIR . '/includes/class_xml.php'); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('reputationbit', process_replacement_vars($reputation)); $xml->print_xml(); } // draw nav bar $navbits = array(); $parentlist = array_reverse(explode(',', $foruminfo['parentlist'])); foreach ($parentlist AS $forumID) { $forumTitle = $vbulletin->forumcache["$forumID"]['title']; $navbits[fetch_seo_url('forum', array('forumid' => $forumID, 'title' => $forumTitle))] = $forumTitle; } $navbits[fetch_seo_url('thread', $threadinfo, array('p' => $postid)) . "#post$postid"] = $threadinfo['prefix_plain_html'] . ' ' . $threadinfo['title']; $navbits[''] = $vbphrase['reputation']; $navbits = construct_navbits($navbits);
{ $post['postcount'] = ++$postcount; } if ($post['attach']) { require_once(DIR . '/packages/vbattach/attach.php'); $attach = new vB_Attach_Display_Content($vbulletin, 'vBForum_Post'); $post['attachments'] = $attach->fetch_postattach(0, $post['postid']); } ($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false; $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype); $xml->add_tag('postbit', process_replacement_vars($postbit_obj->construct_postbit($post)), array('postid' => $post['postid'])); } // ajax posts always mark the thread as read because any missed posts are retrieved as well mark_thread_read($threadinfo, $foruminfo, $vbulletin->userinfo['userid'], TIMENOW); // if post is not moderated, attempt to publish this new reply to user's Facebook feed if ($newpost['visible'] AND is_facebookenabled()) { // check if this is a cms comment post, and make the appropriate FB post if so if (isset($vbulletin->options['vbcmsforumid']) AND $foruminfo['forumid'] == $vbulletin->options['vbcmsforumid']) { // only post fo facebook if we have a return node if ($vbulletin->GPC_exists['return_node'] AND intval($vbulletin->GPC['return_node'])) {
/** * Converts all data from the template table for a style into the style table * * @param integer Style ID * @param string Title of style * @param array Array of actions set to true/false: docss/dostylevars/doreplacements * @param string List of parent styles * @param string Indent for HTML printing * @param boolean Reset the master cache */ function build_style($styleid, $title = '', $actions = array(), $parentlist = '', $indent = '', $resetcache = false) { global $vbulletin, $_queries, $vbphrase, $_query_special_templates; static $phrase, $csscache; if (($actions['doreplacements'] or $actions['docss'] or $actions['dostylevars']) and $vbulletin->options['storecssasfile']) { $actions['docss'] = true; $actions['doreplacements'] = true; } if ($styleid != -1 and $styleid != -2) { $style = $vbulletin->db->query_first("\n\t\t\tSELECT *\n\t\t\tFROM " . TABLE_PREFIX . "style\n\t\t\tWHERE styleid = {$styleid}\n\t\t"); $masterstyleid = $style['type'] == 'standard' ? -1 : -2; $QUERY = array('' => "dateline = " . TIMENOW); if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { // echo the title and start the listings echo "{$indent}<li><b>{$title}</b> ... <span class=\"smallfont\">"; vbflush(); } // build the templateid cache if (!$parentlist) { $parentlist = fetch_parentids($styleid); } $templatelist = build_template_id_cache($styleid, 1, $parentlist); $QUERY[] = "templatelist = '" . $vbulletin->db->escape_string($templatelist) . "'"; if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "({$vbphrase['templates']}) "; vbflush(); } // cache special templates if ($actions['docss'] or $actions['dostylevars'] or $actions['doreplacements']) { // get special templates for this style $template_cache = array(); if ($templateids = implode(',', unserialize($templatelist))) { $templates = $vbulletin->db->query_read("\n\t\t\t\t\tSELECT title, template, templatetype\n\t\t\t\t\tFROM " . TABLE_PREFIX . "template\n\t\t\t\t\tWHERE templateid IN ({$templateids})\n\t\t\t\t\t\tAND (templatetype <> 'template' OR title IN('" . implode("', '", $_query_special_templates) . "'))\n\t\t\t\t"); while ($template = $vbulletin->db->fetch_array($templates)) { $template_cache["{$template['templatetype']}"]["{$template['title']}"] = $template; } $vbulletin->db->free_result($templates); } } // style vars if ($actions['dostylevars']) { // rebuild the stylevars field for this style $stylevars = array(); if ($template_cache['stylevar']) { foreach ($template_cache['stylevar'] as $template) { $stylevars["{$template['title']}"] = $template['template']; } $QUERY[] = "stylevars = '" . $vbulletin->db->escape_string(serialize($stylevars)) . '\''; } if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "({$vbphrase['stylevars']}) "; vbflush(); } static $master_stylevar_cache = array(-1 => null, -2 => null); static $resetcachedone = array(-1 => false, -2 => false); if ($resetcache and !$resetcachedone[$masterstyleid]) { $resetcachedone[$masterstyleid] = true; $master_stylevar_cache[$masterstyleid] = null; } if ($master_stylevar_cache[$masterstyleid] === null) { $master_stylevar_cache[$masterstyleid] = array(); $master_stylevars = $vbulletin->db->query_read("\n\t\t\t\tSELECT stylevardfn.stylevarid, stylevardfn.datatype, stylevar.value\n\t\t\t\tFROM " . TABLE_PREFIX . "stylevardfn AS stylevardfn\n\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "stylevar AS stylevar ON (stylevardfn.stylevarid = stylevar.stylevarid AND stylevar.styleid = {$masterstyleid})\n\t\t\t\t"); while ($master_stylevar = $vbulletin->db->fetch_array($master_stylevars)) { $tmp = unserialize($master_stylevar['value']); if (!is_array($tmp)) { $tmp = array('value' => $tmp); } $master_stylevar_cache[$masterstyleid][$master_stylevar['stylevarid']] = $tmp; $master_stylevar_cache[$masterstyleid][$master_stylevar['stylevarid']]['datatype'] = $master_stylevar['datatype']; } } $newstylevars = $master_stylevar_cache[$masterstyleid]; if (substr(trim($parentlist), 0, -3) != '') { $new_stylevars = $vbulletin->db->query_read($sql = "\n\t\t\t\tSELECT\n\t\t\t\t\tstylevarid, styleid, value, INSTR(',{$parentlist},', CONCAT(',', styleid, ',') ) AS ordercontrol\n\t\t\t\tFROM " . TABLE_PREFIX . "stylevar\n\t\t\t\tWHERE\n\t\t\t\t\tstyleid IN (" . substr(trim($parentlist), 0, -3) . ")\n\t\t\t\tORDER BY\n\t\t\t\t\tordercontrol DESC\n\t\t\t\t"); while ($new_stylevar = $vbulletin->db->fetch_array($new_stylevars)) { $newstylevars[$new_stylevar['stylevarid']] = unserialize($new_stylevar['value']); $newstylevars[$new_stylevar['stylevarid']]['datatype'] = $master_stylevar_cache[$masterstyleid][$new_stylevar['stylevarid']]['datatype']; } } if ($newstylevars) { $QUERY[] = "newstylevars = '" . $vbulletin->db->escape_string(serialize($newstylevars)) . '\''; } } // replacements if ($actions['doreplacements']) { // rebuild the replacements field for this style $replacements = array(); if (is_array($template_cache['replacement'])) { foreach ($template_cache['replacement'] as $template) { // set the key to be a case-insentitive preg find string $replacementkey = '#' . preg_quote($template['title'], '#') . '#si'; $replacements["{$replacementkey}"] = $template['template']; } $QUERY[] = 'replacements = \'' . $vbulletin->db->escape_string(serialize($replacements)) . '\''; } else { $QUERY[] = 'replacements = \'\''; } if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "({$vbphrase['replacement_variables']}) "; vbflush(); } } // css -- old style css if ($actions['docss'] and $template_cache['css']) { // build a quick cache with the ~old~ contents of the css fields from the style table if (!is_array($csscache)) { $csscache = array(); $fetchstyles = $vbulletin->db->query_read("SELECT styleid, css FROM " . TABLE_PREFIX . "style"); while ($fetchstyle = $vbulletin->db->fetch_array($fetchstyles)) { $fetchstyle['css'] .= "\n"; $csscache["{$fetchstyle['styleid']}"] = $fetchstyle['css']; } } // rebuild the css field for this style $css = array(); foreach ($template_cache['css'] as $template) { $css["{$template['title']}"] = unserialize($template['template']); } // build the CSS contents $csscolors = array(); $css = construct_css($css, $styleid, $title, $csscolors); // attempt to delete the old css file if it exists delete_css_file($styleid, $csscache["{$styleid}"]); $adblock_is_evil = str_replace('ad', 'be', substr(md5(microtime()), 8, 8)); $cssfilename = 'clientscript/vbulletin_css/style-' . $adblock_is_evil . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css'; // if we are going to store CSS as files, run replacement variable substitution on the file to be saved if ($vbulletin->options['storecssasfile']) { $css = process_replacement_vars($css, array('styleid' => $styleid, 'replacements' => serialize($replacements))); $css = preg_replace('#(?<=[^a-z0-9-]|^)url\\((\'|"|)(.*)\\1\\)#iUe', "rewrite_css_file_url('\\2', '\\1')", $css); if (write_css_file($cssfilename, $css)) { $css = "@import url(\"{$cssfilename}\");"; } } $fullcsstext = "<style type=\"text/css\" id=\"vbulletin_css\">\r\n" . "/**\r\n* vBulletin " . $vbulletin->options['templateversion'] . " CSS\r\n* Style: '{$title}'; Style ID: {$styleid}\r\n*/\r\n" . "{$css}\r\n</style>\r\n" . "<link rel=\"stylesheet\" type=\"text/css\" href=\"clientscript/vbulletin_important.css?v=" . $vbulletin->options['simpleversion'] . "\" />"; $QUERY[] = "css = '" . $vbulletin->db->escape_string($fullcsstext) . "'"; $QUERY[] = "csscolors = '" . $vbulletin->db->escape_string(serialize($csscolors)) . "'"; if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "({$vbphrase['css']}) "; vbflush(); } } // do the style update query if (sizeof($QUERY)) { $vbulletin->db->query_write("UPDATE " . TABLE_PREFIX . "style SET\n" . implode(",\n", $QUERY) . "\nWHERE styleid = {$styleid}"); } //write out the new css -- do this *after* we update the style record if ($vbulletin->options['storecssasfile']) { if (!write_style_css_directory($styleid, $parentlist, 'ltr')) { if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo fetch_error("rebuild_failed_to_write_css"); } else { return fetch_error("rebuild_failed_to_write_css"); } } else { if (!write_style_css_directory($styleid, $parentlist, 'rtl')) { if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo fetch_error("rebuild_failed_to_write_css"); } else { return fetch_error("rebuild_failed_to_write_css"); } } } } else { // race condition here //delete_style_css_directory($styleid, 'ltr'); //delete_style_css_directory($styleid, 'rtl'); } // finish off the listings if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "</span><b>" . $vbphrase['done'] . "</b>.<br /> </li>\n"; vbflush(); } } $childsets = $vbulletin->db->query_read("\n\t\tSELECT\n\t\t\tstyleid, title, parentlist\n\t\tFROM " . TABLE_PREFIX . "style\n\t\tWHERE\n\t\t\tparentid = {$styleid}\n\t"); if ($vbulletin->db->num_rows($childsets)) { if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "{$indent}<ul class=\"ldi\">\n"; } while ($childset = $vbulletin->db->fetch_array($childsets)) { if ($error = build_style($childset['styleid'], $childset['title'], $actions, $childset['parentlist'], $indent . "\t", $resetcache)) { return $error; } } if (VB_AREA != 'Upgrade' and VB_AREA != 'Install') { echo "{$indent}</ul>\n"; } } }
// Get the viewing user's moderated posts if ($vbulletin->userinfo['userid'] and !fetch_socialgroup_modperm('canmoderategroupmessages', $group)) { $state_or[] = "(gm.postuserid = " . $vbulletin->userinfo['userid'] . " AND state = 'moderation')"; } require_once DIR . '/includes/class_bbcode.php'; require_once DIR . '/includes/class_groupmessage.php'; $bbcode =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $factory =& new vB_Group_MessageFactory($vbulletin, $bbcode, $group); $hook_query_fields = $hook_query_joins = $hook_query_where = ''; ($hook = vBulletinHook::fetch_hook('group_message_post_ajax')) ? eval($hook) : false; $messages = $db->query_read_slave("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tgm.*, user.*, gm.ipaddress AS messageipaddress\n\t\t\t\t\t\t" . ($deljoinsql ? ",deletionlog.userid AS del_userid, deletionlog.username AS del_username, deletionlog.reason AS del_reason" : "") . "\n\t\t\t\t\t\t" . ($vbulletin->options['avatarenabled'] ? ",avatar.avatarpath, NOT ISNULL(customavatar.userid) AS hascustomavatar, customavatar.dateline AS avatardateline,customavatar.width AS avwidth,customavatar.height AS avheight, customavatar.width_thumb AS avwidth_thumb, customavatar.height_thumb AS avheight_thumb, customavatar.filedata_thumb" : "") . "\n\t\t\t\t\t\t{$hook_query_fields}\n\t\t\t\t\tFROM " . TABLE_PREFIX . "groupmessage AS gm\n\t\t\t\t\tLEFT JOIN " . TABLE_PREFIX . "user AS user ON (gm.postuserid = user.userid)\n\t\t\t\t\t" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . "\n\t\t\t\t\t{$deljoinsql}\n\t\t\t\t\t{$hook_query_joins}\n\t\t\t\t\tWHERE gm.groupid = {$group['groupid']}\n\t\t\t\t\t\tAND (" . implode(" OR ", $state_or) . ")\n\t\t\t\t\t\tAND " . (($lastviewed = $vbulletin->GPC['lastcomment']) ? "(gm.dateline > {$lastviewed} OR gm.gmid = {$gmid})" : "gm.gmid = {$gmid}") . "\n\t\t\t\t\t\t{$hook_query_where}\n\t\t\t\t\tORDER BY gm.dateline ASC\n\t\t\t\t"); while ($message = $db->fetch_array($messages)) { $response_handler =& $factory->create($message); // Shall we pre parse these? $response_handler->cachable = false; $xml->add_tag('message', process_replacement_vars($response_handler->construct()), array('gmid' => $message['gmid'], 'visible' => $message['state'] == 'visible' ? 1 : 0, 'bgclass' => $bgclass)); } $xml->add_tag('time', TIMENOW); $xml->close_group(); $xml->print_xml(true); } else { ($hook = vBulletinHook::fetch_hook('group_message_post_complete')) ? eval($hook) : false; $vbulletin->url = 'group.php?' . $vbulletin->session->vars['sessionurl'] . "groupid={$group['groupid']}&gmid={$gmid}#gmessage{$gmid}"; eval(print_standard_redirect('visitormessagethanks', true, true)); } } } } if ($_GET['do'] == 'message') { require_once DIR . '/includes/functions_editor.php'; ($hook = vBulletinHook::fetch_hook('group_message_form_start')) ? eval($hook) : false;
/** * Gets editor in the selected mode. * * @return string */ public function actionSwitchMode() { // Set up the style info - we need charset to be set for convert_urlencoded_unicode $this->bootstrap->force_styleid(0); $this->bootstrap->load_style(); require_once DIR . '/includes/class_xml.php'; vB::$vbulletin->input->clean_array_gpc('r', array( 'towysiwyg' => vB_Input::TYPE_BOOL, 'allowsmilie' => vB_Input::TYPE_BOOL, 'message' => vB_Input::TYPE_STR, )); vB::$vbulletin->GPC['message'] = convert_urlencoded_unicode(vB::$vbulletin->GPC['message']); $xml = new vB_AJAX_XML_Builder(vB::$vbulletin, 'text/xml'); if (vB::$vbulletin->GPC['towysiwyg']) { $wysiwyg_parser = new vBCms_BBCode_Wysiwyg(vB::$vbulletin, vBCms_BBCode_Wysiwyg::fetchCmsTags()); // todo: options $wysiwyg_html = $wysiwyg_parser->do_parse(vB::$vbulletin->GPC['message'], false, vB::$vbulletin->GPC['allowsmilie'], true, true, true); $xml->add_tag('message', process_replacement_vars($wysiwyg_html)); } else { $html_parser = new vBCms_WysiwygHtmlParser(vB::$vbulletin); $do_html = false; // todo: option $message = $html_parser->parse(vB::$vbulletin->GPC['message'], $do_html); $xml->add_tag('message', process_replacement_vars($message)); } if (!vB::contentHeadersSent()) { $xml->send_content_type_header(); $xml->send_content_length_header(); vB::contentHeadersSent(true); } return $xml->fetch_xml(); }
/** * Internal function to handle the recursion for buildStyle. * */ private function buildStyleInternal($styleid, $title = '', $actions = array(), $parentlist = '', $resetcache = false) { $assertor = vB::getDbAssertor(); require_once DIR . '/includes/adminfunctions.php'; require_once DIR . '/includes/adminfunctions_template.php'; static $csscache = array(); if (($actions['doreplacements'] or $actions['docss'] or $actions['dostylevars']) and vB::getDatastore()->getOption('storecssasfile')) { $actions['docss'] = true; $actions['doreplacements'] = true; } if ($styleid != -1) { unset($this->stylesById[$styleid]); // build the templateid cache if (!$parentlist) { $parentlist = $this->fetchTemplateParentlist($styleid); } $templatelist = $this->buildTemplateIdCache($styleid, 1, $parentlist); $styleupdate = array(); $styleupdate['templatelist'] = $templatelist; // cache special templates if ($actions['docss'] or $actions['dostylevars'] or $actions['doreplacements'] or $actions['doposteditor']) { // get special templates for this style $template_cache = array(); $templateids = unserialize($templatelist); $specials = vB_Api::instanceInternal('template')->fetchSpecialTemplates(); if ($templateids) { $templates = vB::getDbAssertor()->assertQuery('vBForum:fetchtemplatewithspecial', array('templateids' => $templateids, 'specialtemplates' => $specials)); foreach ($templates as $template) { $template_cache["{$template['templatetype']}"]["{$template['title']}"] = $template; } } } // style vars if ($actions['dostylevars']) { if ($template_cache['stylevar']) { // rebuild the stylevars field for this style $stylevars = array(); foreach ($template_cache['stylevar'] as $template) { $stylevars["{$template['title']}"] = $template['template']; } } // new stylevars static $master_stylevar_cache = null; if ($resetcache) { $resetcachedone = true; $master_stylevar_cache = null; } if ($master_stylevar_cache === null) { $master_stylevar_cache = array(); $master_stylevars = vB::getDbAssertor()->assertQuery('vBForum:getDefaultStyleVars', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_STORED)); foreach ($master_stylevars as $master_stylevar) { $tmp = unserialize($master_stylevar['value']); if (!is_array($tmp)) { $tmp = array('value' => $tmp); } $master_stylevar_cache[$master_stylevar['stylevarid']] = $tmp; $master_stylevar_cache[$master_stylevar['stylevarid']]['datatype'] = $master_stylevar['datatype']; } } $newstylevars = $master_stylevar_cache; if (substr(trim($parentlist), 0, -3) != '') { $data = array('stylelist' => explode(',', substr(trim($parentlist), 0, -3)), 'parentlist' => $parentlist); $new_stylevars = vB::getDbAssertor()->getRows('vBForum:getStylesFromList', $data); foreach ($new_stylevars as $new_stylevar) { ob_start(); $newstylevars[$new_stylevar['stylevarid']] = unserialize($new_stylevar['value']); if (ob_get_clean() or !is_array($newstylevars[$new_stylevar['stylevarid']])) { continue; } $newstylevars[$new_stylevar['stylevarid']]['datatype'] = $master_stylevar_cache[$new_stylevar['stylevarid']]['datatype']; } } $styleupdate['newstylevars'] = serialize($newstylevars); } // replacements if ($actions['doreplacements']) { // rebuild the replacements field for this style $replacements = array(); if (is_array($template_cache['replacement'])) { foreach ($template_cache['replacement'] as $template) { // set the key to be a case-insentitive preg find string $replacementkey = '#' . preg_quote($template['title'], '#') . '#si'; $replacements["{$replacementkey}"] = $template['template']; } $styleupdate['replacements'] = serialize($replacements); } else { $styleupdate['replacements'] = "''"; } } // css -- old style css if ($actions['docss'] and $template_cache['css']) { // build a quick cache with the ~old~ contents of the css fields from the style table if (empty($csscache)) { $fetchstyles = vB::getDbAssertor()->assertQuery('vBForum:style', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT)); foreach ($fetchstyles as $fetchstyle) { $fetchstyle['css'] .= "\n"; $csscache["{$fetchstyle['styleid']}"] = $fetchstyle['css']; } } // rebuild the css field for this style $css = array(); foreach ($template_cache['css'] as $template) { $css["{$template['title']}"] = unserialize($template['template']); } // build the CSS contents $csscolors = array(); $css = construct_css($css, $styleid, $title, $csscolors); // attempt to delete the old css file if it exists delete_css_file($styleid, $csscache["{$styleid}"]); $adblock_is_evil = str_replace('ad', 'be', substr(md5(microtime()), 8, 8)); $cssfilename = DIR . vB_Api::instanceInternal('style')->fetchCssLocation() . '/style-' . $adblock_is_evil . '-' . str_pad($styleid, 5, '0', STR_PAD_LEFT) . '.css'; // if we are going to store CSS as files, run replacement variable substitution on the file to be saved if (vB::getDatastore()->getOption('storecssasfile')) { $css = process_replacement_vars($css, array('styleid' => $styleid, 'replacements' => serialize($replacements))); $css = preg_replace_callback('#(?<=[^a-z0-9-]|^)url\\((\'|"|)(.*)\\1\\)#iU', function ($matches) { return rewrite_css_file_url($matches[2], $matches[1]); }, $css); if (write_css_file($cssfilename, $css)) { $css = "@import url(\"{$cssfilename}\");"; } } } // post editor styles if ($actions['doposteditor'] and $template_cache['template']) { $editorstyles = array(); if (!empty($template_cache['template'])) { foreach ($template_cache['template'] as $template) { if (substr($template['title'], 0, 13) == 'editor_styles') { $title = 'pi' . substr($template['title'], 13); $item = fetch_posteditor_styles($template['template']); $editorstyles["{$title}"] = array($item['background'], $item['color'], $item['padding'], $item['border']); } } } } // do the style update query if (!empty($styleupdate)) { $styleupdate['styleid'] = $styleid; $styleupdate[vB_dB_Query::TYPE_KEY] = vB_dB_Query::QUERY_UPDATE; vB::getDbAssertor()->assertQuery('vBForum:style', $styleupdate); } //write out the new css -- do this *after* we update the style record if (vB::getDatastore()->getOption('storecssasfile')) { if (!write_style_css_directory($styleid, $parentlist, 'ltr')) { return fetch_error("rebuild_failed_to_write_css"); } else { if (!write_style_css_directory($styleid, $parentlist, 'rtl')) { return fetch_error("rebuild_failed_to_write_css"); } } } } $childsets = vB::getDbAssertor()->getRows('style', array(vB_dB_Query::TYPE_KEY => vB_dB_Query::QUERY_SELECT, vB_dB_Query::CONDITIONS_KEY => array('parentid' => $styleid))); if (count($childsets)) { foreach ($childsets as $childset) { if ($error = $this->buildStyleInternal($childset['styleid'], $childset['title'], $actions, $childset['parentlist'], false)) { return $error; } } } //We want to force a fastDS rebuild, but we can't just call rebuild. There may be dual web servers, // and calling rebuild only rebuilds one of them. $options = vB::getDatastore()->getValue('miscoptions'); $options['tmtdate'] = vB::getRequest()->getTimeNow(); vB::getDatastore()->build('miscoptions', serialize($options), 1); }
WHERE profilefieldid = " . $vbulletin->GPC['fieldid'] ); // get displayable profilefield value $new_value = (isset($userdata->userfield['field' . $vbulletin->GPC['fieldid']]) ? $userdata->userfield['field' . $vbulletin->GPC['fieldid']] : $vbulletin->userinfo['field' . $vbulletin->GPC['fieldid']] ); fetch_profilefield_display($profilefield, $new_value); // output XML $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('response'); $returnvalue = $profilefield['value'] == '' ? $vbphrase['n_a'] : $profilefield['value']; $xml->add_tag('value', process_replacement_vars($returnvalue)); if ($profilefield['editable'] == 2 AND !empty($new_value)) { // this field is no longer editable $xml->add_tag('uneditable', '1'); } $xml->close_group(); $xml->print_xml(); } // ############################################################################# // verify username during registration if ($_POST['do'] == 'verifyusername') {
} if ($ignore["{$post['userid']}"]) { $fetchtype = 'post_ignore'; } else { if ($post['visible'] == 2) { $fetchtype = 'post_deleted'; } else { $fetchtype = 'post'; } } ($hook = vBulletinHook::fetch_hook('showthread_postbit_create')) ? eval($hook) : false; $show['spacer'] = false; $post['postcount'] = $vbulletin->GPC['postcount']; $postbit_obj =& $postbit_factory->fetch_postbit($fetchtype); $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_tag('postbit', process_replacement_vars($postbit_obj->construct_postbit($post))); $xml->print_xml(true); // ############################################################################# // ############################################################################# // ############################################################################# } else { $vbulletin->url = 'showthread.php?' . $vbulletin->session->vars['sessionurl'] . "p={$postinfo['postid']}#post{$postinfo['postid']}"; eval(print_standard_redirect('redirect_editthanks')); } } } } } // ############################### start edit post ############################### if ($_REQUEST['do'] == 'editpost') { ($hook = vBulletinHook::fetch_hook('editpost_edit_start')) ? eval($hook) : false;
($hook = vBulletinHook::fetch_hook('attachment_lightbox')) ? eval($hook) : false; $templater = vB_Template::create('lightbox'); $templater->register('attachmentinfo', $attachmentinfo); $templater->register('current', $current); $templater->register('first', $first); $templater->register('height', $height); $templater->register('imagelink', $imagelink); $templater->register('last', $last); $templater->register('total', $total); $templater->register('uniqueid', $uniqueid); $templater->register('width', $width); $html = $templater->render(true); $xml->add_group('img'); $xml->add_tag('html', process_replacement_vars($html)); $xml->add_tag('link', $imagelink); $xml->add_tag('name', $attachmentinfo['filename']); $xml->add_tag('date', $attachmentinfo['date_string']); $xml->add_tag('time', $attachmentinfo['time_string']); $xml->close_group(); } else { $xml->add_group('errormessage'); $xml->add_tag('error', 'notimage'); $xml->add_tag('extension', $attachmentinfo['extension']); $xml->close_group(); } $xml->print_xml(); }
/** * Finishes off the current page (using templates), prints it out to the browser and halts execution * * @param string The HTML of the page to be printed * @param boolean Send the content length header? */ function print_output($vartext, $sendheader = true) { global $querytime, $vbulletin, $show, $vbphrase; if ($vbulletin->options['addtemplatename']) { if ($doctypepos = @strpos($vartext, vB_Template_Runtime::fetchStyleVar('htmldoctype'))) { $comment = substr($vartext, 0, $doctypepos); $vartext = substr($vartext, $doctypepos + strlen(vB_Template_Runtime::fetchStyleVar('htmldoctype'))); $vartext = vB_Template_Runtime::fetchStyleVar('htmldoctype') . "\n" . $comment . $vartext; } } if (!empty($vbulletin->db->explain) or $vbulletin->debug) { $totaltime = microtime(true) - TIMESTART; $vartext .= "<!-- Page generated in " . vb_number_format($totaltime, 5) . " seconds with " . $vbulletin->db->querycount . " queries -->"; } // set cookies for displayed notices if ($show['notices'] and !defined('NOPMPOPUP') and !empty($vbulletin->np_notices_displayed) and is_array($vbulletin->np_notices_displayed)) { $np_notices_cookie = $_COOKIE[COOKIE_PREFIX . 'np_notices_displayed']; vbsetcookie('np_notices_displayed', ($np_notices_cookie ? "{$np_notices_cookie}," : '') . implode(',', $vbulletin->np_notices_displayed), false); } // --- / TODO remove this code for vB4 gold------------------------------ // debug code global $DEVDEBUG, $vbcollapse; if ($vbulletin->debug) { devdebug('php_sapi_name(): ' . SAPI_NAME); $messages = ''; if (is_array($DEVDEBUG)) { foreach ($DEVDEBUG as $debugmessage) { $messages .= "\t<option>" . htmlspecialchars_uni($debugmessage) . "</option>\n"; } } if (!empty(vB_Template::$template_usage)) { $tempusagecache = vB_Template::$template_usage; $_TEMPLATEQUERIES = vB_Template::$template_queries; unset($tempusagecache['board_inactive_warning'], $_TEMPLATEQUERIES['board_inactive_warning']); ksort($tempusagecache); foreach ($tempusagecache as $template_name => $times) { $tempusagecache["{$template_name}"] = "<span class=\"shade\" style=\"float:right\">({$times})</span>" . ((isset($_TEMPLATEQUERIES["{$template_name}"]) and $_TEMPLATEQUERIES["{$template_name}"]) ? "<span style=\"color:red; font-weight:bold\">{$template_name}</span>" : $template_name); } } else { $tempusagecache = array(); } $hook_usage = ''; $hook_total = 0; foreach (vBulletinHook::fetch_hookusage() as $hook_name => $has_code) { $hook_usage .= '<li class="smallfont' . (!$has_code ? ' shade' : '') . '">' . $hook_name . '</li>'; $hook_total++; } if (!$hook_usage) { $hook_usage = '<li class="smallfont"> </li>'; } $phrase_groups = ''; sort($GLOBALS['phrasegroups']); foreach ($GLOBALS['phrasegroups'] as $phrase_group) { $phrase_groups .= '<li class="smallfont">' . $phrase_group . '</li>'; } if (!$phrase_groups) { $phrase_groups = '<li class="smallfont"> </li>'; } $vbcollapse['collapseimg_debuginfo'] = !empty($vbcollapse['collapseimg_debuginfo']) ? $vbcollapse['collapseimg_debuginfo'] : ''; $vbcollapse['collapseobj_debuginfo'] = !empty($vbcollapse['collapseobj_debuginfo']) ? $vbcollapse['collapseobj_debuginfo'] : ''; // TODO: This needs to be converted to vb4 style - $stylevar doesn't exist, use vB_Template_Runtime::fetchStyleVar('textdirection') $debughtml = "\r\n\t\t\t<table class=\"tborder\" cellpadding=\"6\" cellspacing=\"1\" border=\"0\" align=\"center\" style=\"margin-top:20px\" id=\"debuginfo\" dir=\"ltr\">\r\n\t\t\t<thead>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<th class=\"tcat\" colspan=\"2\" align=\"left\">\r\n\t\t\t\t\t\t<a style=\"float:right\" href=\"#\" title=\"Close Debug Info\" onclick=\"document.getElementById('debuginfo').parentNode.removeChild(document.getElementById('debuginfo')); return false;\">X</a>\r\n\t\t\t\t\t\tvBulletin {$vbulletin->options['templateversion']} Debug Information\r\n\t\t\t\t\t</th>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"alt1 smallfont\" colspan=\"2\">\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">\r\n\t\t\t\t\t\t\t<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Page Generation</span> " . vb_number_format($totaltime, 5) . " seconds</li>\r\n\t\t\t\t\t\t\t" . (function_exists('memory_get_usage') ? "<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Memory Usage</span> " . number_format(memory_get_usage() / 1024) . 'KB</li>' : '') . "\r\n\t\t\t\t\t\t\t<li class=\"smallfont\" style=\"display:inline; margin-right:8px\"><span class=\"shade\">Queries Executed</span> " . (empty($_TEMPLATEQUERIES) ? $vbulletin->db->querycount : "<span title=\"Uncached Templates!\" style=\"color:red; font-weight:bold\">{$vbulletin->db->querycount}</span>") . " <a href=\"" . htmlspecialchars($vbulletin->scriptpath) . (strpos($vbulletin->scriptpath, '?') === false ? '?' : '&') . "explain=1\" target=\"_blank\" title=\"Explain Queries\">(?)</a></li>\r\n\t\t\t\t\t\t</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr align=\"left\">\r\n\t\t\t\t\t<th class=\"thead\" colspan=\"2\"><a style=\"float:right\" href=\"#\" onclick=\"return toggle_collapse('debuginfo')\"><img id=\"collapseimg_debuginfo\" src=\"" . vB_Template_Runtime::fetchStyleVar('imgdir_button') . "/collapse_thead{$vbcollapse['collapseimg_debuginfo']}.gif\" alt=\"\" border=\"0\" /></a> More Information</th>\r\n\t\t\t\t</tr>\r\n\t\t\t</thead>\r\n\t\t\t<tbody id=\"collapseobj_debuginfo\" style=\"{$vbcollapse['collapseobj_debuginfo']}\">\r\n\t\t\t\t<tr valign=\"top\">\r\n\t\t\t\t\t<td class=\"alt1 smallfont\">\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Template Usage (</strong>" . sizeof($tempusagecache) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', $tempusagecache) . " </li></ul>\r\n\t\t\t\t\t\t<hr style=\"margin:10px 0px 10px 0px\" />\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Phrase Groups Available (</strong>" . sizeof($GLOBALS['phrasegroups']) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">{$phrase_groups}</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t\t<td class=\"alt1 smallfont\">\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Included Files (</strong>" . sizeof($included_files = get_included_files()) . "<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\"><li class=\"smallfont\">" . implode('</li><li class="smallfont">', str_replace(str_replace('\\', '/', DIR) . '/', '', preg_replace('#^(.*/)#si', '<span class="shade">./\\1</span>', str_replace('\\', '/', $included_files)))) . " </li></ul>\r\n\t\t\t\t\t\t<hr style=\"margin:10px 0px 10px 0px\" />\r\n\t\t\t\t\t\t<div style=\"margin-bottom:6px\"><strong>Hooks Called (</strong>{$hook_total}<strong>):</strong></div>\r\n\t\t\t\t\t\t<ul style=\"list-style:none; margin:0px; padding:0px\">{$hook_usage}</ul>\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t</tbody>\r\n\t\t\t\t<tbody>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class=\"alt2 smallfont\" colspan=\"2\"><label>Messages:<select style=\"display:block; width:100%\">{$messages}</select></label></td>\r\n\t\t\t\t</tr>\r\n\t\t\t</tbody>\r\n\t\t\t</table>\r\n\t\t"; $vartext = str_replace('</body>', "<!--start debug html-->{$debughtml}<!--end debug html-->\n</body>", $vartext); } // end debug code // --- / TODO remove this code for vB4 gold------------------------------ $output = process_replacement_vars($vartext); if ($vbulletin->debug and function_exists('memory_get_usage')) { $output = preg_replace('#(<!--querycount-->Executed <b>\\d+</b> queries<!--/querycount-->)#siU', 'Memory Usage: <strong>' . number_format(memory_get_usage() / 1024) . 'KB</strong>, \\1', $output); } // parse PHP include ################## ($hook = vBulletinHook::fetch_hook('global_complete')) ? eval($hook) : false; // make sure headers sent returns correctly if (ob_get_level() and ob_get_length()) { ob_end_flush(); } if ($vbulletin->options['gzipoutput'] and !headers_sent()) { $output = fetch_gzipped_text($output, $vbulletin->options['gziplevel']); if ($sendheader and $vbulletin->donegzip) { @header('Content-Length: ' . strlen($output)); } } // Trigger shutdown event $vbulletin->shutdown->shutdown(); if (defined('NOSHUTDOWNFUNC')) { exec_shut_down(); } // show regular page if (empty($vbulletin->db->explain)) { echo $output; } else { $querytime = $vbulletin->db->time_total; echo "\n<b>Page generated in {$totaltime} seconds with " . $vbulletin->db->querycount . " queries,\nspending {$querytime} doing MySQL queries and " . ($totaltime - $querytime) . " doing PHP things.\n\n<hr />Shutdown Queries:</b>" . (defined('NOSHUTDOWNFUNC') ? " <b>DISABLED</b>" : '') . "<hr />\n\n"; } // broken if zlib.output_compression is on with Apache 2 if (SAPI_NAME != 'apache2handler' and SAPI_NAME != 'apache2filter') { flush(); } exit; }
$usercss->invalid["{$selectorname}"]["{$property}"] = ' usercsserror '; continue; } } $usercss->parse($selectorname, $property, $value); } } ($hook = vBulletinHook::fetch_hook('profile_docustomize_process')) ? eval($hook) : false; if ($vbulletin->GPC['ajax']) { // AJAX means get the preview $effective_css = $usercss->build_css($usercss->fetch_effective()); $effective_css = str_replace('/*sessionurl*/', $vbulletin->session->vars['sessionurl_js'], $effective_css); require_once DIR . '/includes/class_xml.php'; $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml'); $xml->add_group('preview'); $xml->add_tag('css', process_replacement_vars($effective_css)); $xml->close_group(); $xml->print_xml(); } if (empty($usercss->error) and empty($usercss->invalid)) { $usercss->save(); $vbulletin->url = "profile.php?" . $vbulletin->session->vars['sessionurl'] . "do=customize"; eval(print_standard_redirect('usercss_saved')); } else { if (!empty($usercss->error)) { standard_error(implode("<br />", $usercss->error)); } else { // have invalid, no errors $_REQUEST['do'] = 'customize'; define('HAVE_ERRORS', true); }
" . ($vbulletin->options['avatarenabled'] ? "LEFT JOIN " . TABLE_PREFIX . "avatar AS avatar ON(avatar.avatarid = user.avatarid) LEFT JOIN " . TABLE_PREFIX . "customavatar AS customavatar ON(customavatar.userid = user.userid)" : "") . " $deljoinsql WHERE $wheresql ORDER BY blog_text.dateline ASC "); while ($comment = $db->fetch_array($comments)) { $response_handler =& $factory->create($comment); $response_handler->userinfo = $bloginfo; if ($vbulletin->GPC['linkblog']) { $response_handler->linkblog = true; } $xml->add_tag('message', process_replacement_vars($response_handler->construct()), array( 'blogtextid' => $comment['blogtextid'], 'visible' => ($comment['state'] == 'visible') ? 1 : 0, 'bgclass' => $bgclass, )); } $xml->add_tag('time', TIMENOW); $xml->close_group(); $xml->print_xml(); } else { ($hook = vBulletinHook::fetch_hook('blog_post_updatecomment_complete')) ? eval($hook) : false; $vbulletin->url = 'blog.php?' . $vbulletin->session->vars['sessionurl'] . "bt=$blogcommentid"; if ($blogman->fetch_field('state') == 'moderation')