build_all_styles(); if ($vbulletin->GPC['redirect']) { define('CP_REDIRECT', $vbulletin->GPC['redirect']); } print_stop_message('templates_merged'); } else { // more templates to merge print_cp_redirect( 'template.php?do=massmerge&product=' . urlencode($vbulletin->GPC['product']) . '&hash=' . CP_SESSIONHASH . '&redirect=' . urlencode($vbulletin->GPC['redirect']) . '&startat=' . ($merge_data->start_offset + $merge->fetch_processed_count()) ); } } // ############################################################################# // view the history of a template, including old versions and diffs between versions if ($_REQUEST['do'] == 'history') { $vbulletin->input->clean_array_gpc('r', array( 'title' => TYPE_STR, )); $revisions = array(); $have_cur_def = false; $cur_temp_time = 0;
require_once DIR . '/includes/class_template_merge.php'; $merge_data = new vB_Template_Merge_Data($vbulletin); $merge_data->start_offset = $vbulletin->GPC['startat']; $merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')"); $merge = new vB_Template_Merge($vbulletin); $merge->time_limit = 5; $completed = $merge->merge_templates($merge_data); if ($completed) { // completed $vbphrase['style'] = 'Style'; $vbphrase['please_wait'] = 'Please Wait'; build_all_styles(); define('SCRIPT_REDIRECT', true); } else { // more templates to merge print_cp_redirect('tools.php?do=templatemerge&startat=' . ($merge_data->start_offset + $merge->fetch_processed_count())); } } else { if ($_REQUEST['do'] == 'cache') { switch ($vbulletin->GPC['type']) { case 'forum': build_forum_permissions(); define('SCRIPT_REDIRECT', true); break; case 'options': build_options(); define('SCRIPT_REDIRECT', true); break; } } else { if ($_REQUEST['do'] == 'cookie') {
$merge_data->start_offset = $vbulletin->GPC['startat']; $merge_data->add_condition($c = "tnewmaster.product IN (" . implode(', ', $products) . ")"); $merge = new vB_Template_Merge($vbulletin); $merge->time_limit = 4; $completed = $merge->merge_templates($merge_data); if ($completed) { // completed build_all_styles(); } else { // more templates to merge print_next_page(0, $merge_data->start_offset + $merge->fetch_processed_count()); } } // ############################################################################# if ($vbulletin->GPC['step'] == (should_install_suite() ? 8 : 6)) { $gotopage = '../' . $vbulletin->config['Misc']['admincpdir'] . '/index.php'; echo '<p align="center" class="smallfont"><a href="' . $gotopage . '">' . $vbphrase['proceed'] . '</a></p>'; echo "\n<script type=\"text/javascript\">\n"; echo "window.location=\"$gotopage\";"; echo "\n</script>\n"; print_upgrade_footer(); exit;
/** * Massive merge templates * * @param string $product Product string ID. * @param integer $startat Start offset of the merge. * * @return integer New startat value. -1 if no more to do. */ public function massMerge($product = 'vbulletin', $startat = 0) { $this->checkHasAdminPermission('canadmintemplates'); require_once DIR . '/includes/adminfunctions.php'; // TODO: Product API $full_product_info = fetch_product_list(true); $vbulletin =& vB::get_registry(); require_once DIR . '/includes/class_template_merge.php'; require_once DIR . '/includes/adminfunctions_template.php'; $merge = new vB_Template_Merge($vbulletin); $merge->time_limit = 5; $merge_data = new vB_Template_Merge_Data($vbulletin); $merge_data->start_offset = $startat; if ($product == 'vbulletin' or !$product) { $merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')"); } else { $merge_data->add_condition("tnewmaster.product = '" . mysql_escape_string($product) . "'"); $merge->merge_version = $full_product_info[$product]['version']; } $completed = $merge->merge_templates($merge_data, $output); if ($completed) { // completed build_all_styles(); vB_Library::instance('Style')->setCssDate(); return -1; } else { return $merge_data->start_offset + $merge->fetch_processed_count(); } }
$merge_data->add_condition("tnewmaster.product IN ('', 'vbulletin')"); } else { $merge_data->add_condition("tnewmaster.product = '" . $db->escape_string($vbulletin->GPC['product']) . "'"); $merge->merge_version = $full_product_info[$vbulletin->GPC['product']]['version']; } $completed = $merge->merge_templates($merge_data); if ($completed) { // completed build_all_styles(); if ($vbulletin->GPC['redirect']) { define('CP_REDIRECT', $vbulletin->GPC['redirect']); } print_stop_message('templates_merged'); } else { // more templates to merge print_cp_redirect('template.php?do=massmerge&product=' . urlencode($vbulletin->GPC['product']) . '&hash=' . CP_SESSIONHASH . '&redirect=' . urlencode($vbulletin->GPC['redirect']) . '&startat=' . ($merge_data->start_offset + $merge->fetch_processed_count())); } } // ############################################################################# // view the history of a template, including old versions and diffs between versions if ($_REQUEST['do'] == 'history') { $vbulletin->input->clean_array_gpc('r', array('title' => TYPE_STR)); $revisions = array(); $have_cur_def = false; $cur_temp_time = 0; $current_temps = $db->query_read("\r\n\t\tSELECT templateid, title, styleid, dateline, username, version\r\n\t\tFROM " . TABLE_PREFIX . "template\r\n\t\tWHERE title = '" . $db->escape_string($vbulletin->GPC['title']) . "'\r\n\t\t\tAND styleid IN (-1, " . $vbulletin->GPC['dostyleid'] . ")\r\n\t"); while ($template = $db->fetch_array($current_temps)) { $template['type'] = 'current'; // the point of the second part of this key is to prevent dateline // collisions, as rare as that may be $revisions["{$template['dateline']}|b{$template['templateid']}"] = $template;
/** * Template Merge * * @param array contains start info * @param int Master styleid * */ function merge_templates($data, $mastertype) { if ($data['options']['skiptemplatemerge']) { $this->skip_message(); return; } if ($data['response'] == 'timeout') { $this->show_message($this->phrase['final']['step_timed_out']); return; } $this->show_message($this->phrase['final']['merge_template_changes']); $startat = intval($data['startat']); require_once DIR . '/includes/class_template_merge.php'; $products = array("''", "'vbulletin'", "'skimlinks'", "'forumrunner'", "'postrelease'"); if (should_install_suite()) { $products = array_merge($products, array("'vbblog'", "'vbcms'")); } $merge_data = new vB_Template_Merge_Data($this->registry); $merge_data->start_offset = $startat; $merge_data->add_condition($c = "tnewmaster.product IN (" . implode(', ', $products) . ")"); $merge = new vB_Template_Merge($this->registry); $merge->time_limit = 4; $output = array(); $completed = $merge->merge_templates($merge_data, $output, $mastertype == 'standard' ? -1 : -2); if ($output) { foreach ($output as $message) { $this->show_message($message); } } if ($completed) { $this->set_option('upgrade_from', 'version', '', 'string', ''); if ($error = build_all_styles(0, 0, '', true, $mastertype)) { $this->add_error($error, self::PHP_TRIGGER_ERROR, true); return false; } } else { return array('startat' => $startat + $merge->fetch_processed_count()); } }