function upgrade17_updatecss() { global $db, $output, $orig_config, $mybb; if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) { require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php"; } else { if (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) { require_once MYBB_ROOT . "admin/inc/functions_themes.php"; } else { $output->print_error("Please make sure your admin directory is uploaded correctly."); } } $output->print_header("Updating CSS"); $query = $db->simple_select("themestylesheets", "*", "name='global.css' OR name='usercp.css'"); while ($theme = $db->fetch_array($query)) { resync_stylesheet($theme); } $query = $db->simple_select("themestylesheets", "*", "name='global.css' OR name='usercp.css'"); while ($theme = $db->fetch_array($query)) { $theme['stylesheet'] = upgrade_css_140_to_160($theme['name'], $theme['stylesheet']); // Create stylesheets cache_stylesheet($theme['tid'], $theme['cachefile'], $theme['stylesheet']); $update_stylesheet = array("stylesheet" => $db->escape_string($theme['stylesheet']), "lastmodified" => TIME_NOW); $db->update_query("themestylesheets", $update_stylesheet, "sid='{$theme['sid']}'"); } echo "<p>The CSS has been successfully updated.</p>"; echo "<p>Click next to continue with the upgrade process.</p>"; global $footer_extra; //$footer_extra = "<script type=\"text/javascript\">$(document).ready(function() { var button = $('.submit_button'); if(button) { button.val('Automatically Redirecting...'); button.prop('disabled', true); button.css('color', '#aaa'); button.css('border-color', '#aaa'); document.forms[0].submit(); } });</script>"; $output->print_footer("17_done"); }
// If the stylesheet and theme do not match, we must be editing something that is inherited if ($this_stylesheet['inherited'][$stylesheet['name']]) { $query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'"); $stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name')); // Show inherited warning if ($stylesheet['tid'] == 1) { $page->output_alert($lang->sprintf($lang->stylesheet_inherited_default, $stylesheet_parent)); } else { $page->output_alert($lang->sprintf($lang->stylesheet_inherited, $stylesheet_parent)); } } $sub_tabs['edit_stylesheet'] = array('title' => $lang->edit_stylesheet_simple_mode, 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=" . htmlspecialchars_uni($mybb->input['file']) . "&mode=simple"); $sub_tabs['edit_stylesheet_advanced'] = array('title' => $lang->edit_stylesheet_advanced_mode, 'link' => "index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&file=" . htmlspecialchars_uni($mybb->input['file']) . "&mode=advanced", 'description' => $lang->edit_stylesheet_advanced_mode_desc); $page->output_nav_tabs($sub_tabs, 'edit_stylesheet_advanced'); // Has the file on the file system been modified? if (resync_stylesheet($stylesheet)) { // Need to refetch new stylesheet as it was modified $query = $db->simple_select("themestylesheets", "stylesheet", "sid='{$stylesheet['sid']}'"); $stylesheet['stylesheet'] = $db->fetch_field($query, 'stylesheet'); } $form = new Form("index.php?module=style-themes&action=edit_stylesheet&mode=advanced", "post", "edit_stylesheet"); echo $form->generate_hidden_field("tid", $mybb->input['tid']) . "\n"; echo $form->generate_hidden_field("file", htmlspecialchars_uni($mybb->input['file'])) . "\n"; $table = new Table(); $table->construct_cell($form->generate_text_area('stylesheet', $stylesheet['stylesheet'], array('id' => 'stylesheet', 'style' => 'width: 99%;', 'class' => '', 'rows' => '30'))); $table->construct_row(); $table->output($lang->full_stylesheet_for . ' ' . htmlspecialchars_uni($stylesheet['name']), 1, 'tfixed'); $buttons[] = $form->generate_submit_button($lang->save_changes, array('id' => 'save', 'name' => 'save')); $buttons[] = $form->generate_submit_button($lang->save_changes_and_close, array('id' => 'save_close', 'name' => 'save_close')); $form->output_submit_wrapper($buttons); $form->end();
function upgrade17_updatecss() { global $db, $output, $orig_config, $mybb; if (file_exists(MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php")) { require_once MYBB_ROOT . $mybb->config['admin_dir'] . "/inc/functions_themes.php"; } else { if (file_exists(MYBB_ROOT . "admin/inc/functions_themes.php")) { require_once MYBB_ROOT . "admin/inc/functions_themes.php"; } else { $output->print_error("Upewnij się, że katalog /admin został poprawnie załadowany na serwer."); } } $output->print_header("Aktualizowanie arkuszy stylów CSS"); $query = $db->simple_select("themestylesheets", "*", "name='global.css' OR name='usercp.css'"); while ($theme = $db->fetch_array($query)) { resync_stylesheet($theme); } $query = $db->simple_select("themestylesheets", "*", "name='global.css' OR name='usercp.css'"); while ($theme = $db->fetch_array($query)) { $theme['stylesheet'] = upgrade_css_140_to_160($theme['name'], $theme['stylesheet']); // Create stylesheets cache_stylesheet($theme['tid'], $theme['cachefile'], $theme['stylesheet']); $update_stylesheet = array("stylesheet" => $db->escape_string($theme['stylesheet']), "lastmodified" => TIME_NOW); $db->update_query("themestylesheets", $update_stylesheet, "sid='{$theme['sid']}'"); } echo "<p>Arkusze stylów CSS zostały zaktualizowane.</p>"; echo "<p>Naciśnij przycisk Dalej, aby kontynuować proces aktualizacji.</p>"; global $footer_extra; //$footer_extra = "<script type=\"text/javascript\">window.onload = function() { var button = $$('.submit_button'); if(button[0]) { button[0].value = 'Automatyczne przekierowanie...'; button[0].disabled = true; button[0].style.color = '#aaa'; button[0].style.borderColor = '#aaa'; document.forms[0].submit(); }}</script>"; $output->print_footer("17_done"); }