Vergleich admin/modules/style/themes.php - 1.8.0 - 1.8.21

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 35Zeile 35
if($mybb->input['action'] == "xmlhttp_stylesheet" && $mybb->request_method == "post")
{
// Fetch the theme we want to edit this stylesheet in

if($mybb->input['action'] == "xmlhttp_stylesheet" && $mybb->request_method == "post")
{
// Fetch the theme we want to edit this stylesheet in

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

Zeile 72Zeile 72
	echo $form->generate_hidden_field("selector", htmlspecialchars_uni($mybb->input['selector']), array('id' => 'hidden_selector'))."\n";

$table = new Table;

	echo $form->generate_hidden_field("selector", htmlspecialchars_uni($mybb->input['selector']), array('id' => 'hidden_selector'))."\n";

$table = new Table;

	$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[background]', $properties['background'], array('id' => 'css_bits[background]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->background}</strong></div>", array('style' => 'width: 20%;'));










	if($lang->settings['rtl'] === true)
{
$div_align = "left";
}
else
{
$div_align = "right";
}

$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[background]', $properties['background'], array('id' => 'css_bits[background]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->background}</strong></div>", array('style' => 'width: 20%;'));

	$table->construct_cell("<strong>{$lang->extra_css_atribs}</strong><br /><div style=\"align: center;\">".$form->generate_text_area('css_bits[extra]', $properties['extra'], array('id' => 'css_bits[extra]', 'style' => 'width: 98%;', 'rows' => '19'))."</div>", array('rowspan' => 8));
$table->construct_row();

	$table->construct_cell("<strong>{$lang->extra_css_atribs}</strong><br /><div style=\"align: center;\">".$form->generate_text_area('css_bits[extra]', $properties['extra'], array('id' => 'css_bits[extra]', 'style' => 'width: 98%;', 'rows' => '19'))."</div>", array('rowspan' => 8));
$table->construct_row();

	$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[color]', $properties['color'], array('id' => 'css_bits[color]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->color}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[width]', $properties['width'], array('id' => 'css_bits[width]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->width}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[font_family]', $properties['font-family'], array('id' => 'css_bits[font_family]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_family}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[font_size]', $properties['font-size'], array('id' => 'css_bits[font_size]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_size}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[font_style]', $properties['font-style'], array('id' => 'css_bits[font_style]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_style}</strong></div>", array('style' => 'width: 40%;'));





	$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[color]', $properties['color'], array('id' => 'css_bits[color]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->color}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[width]', $properties['width'], array('id' => 'css_bits[width]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->width}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[font_family]', $properties['font-family'], array('id' => 'css_bits[font_family]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_family}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[font_size]', $properties['font-size'], array('id' => 'css_bits[font_size]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_size}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[font_style]', $properties['font-style'], array('id' => 'css_bits[font_style]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_style}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[font_weight]', $properties['font-weight'], array('id' => 'css_bits[font_weight]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_weight}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: {$div_align};\">".$form->generate_text_box('css_bits[text_decoration]', $properties['text-decoration'], array('id' => 'css_bits[text_decoration]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->text_decoration}</strong></div>", array('style' => 'width: 40%;'));

	$table->construct_row();

	$table->construct_row();

	$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[font_weight]', $properties['font-weight'], array('id' => 'css_bits[font_weight]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->font_weight}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();
$table->construct_cell("<div style=\"float: right;\">".$form->generate_text_box('css_bits[text_decoration]', $properties['text-decoration'], array('id' => 'css_bits[text_decoration]', 'style' => 'width: 260px;'))."</div><div><strong>{$lang->text_decoration}</strong></div>", array('style' => 'width: 40%;'));
$table->construct_row();








	$table->output(htmlspecialchars_uni($editable_selector['class_name'])."<span id=\"saved\" style=\"color: #FEE0C6;\"></span>");
exit;

	$table->output(htmlspecialchars_uni($editable_selector['class_name'])."<span id=\"saved\" style=\"color: #FEE0C6;\"></span>");
exit;

}

$page->add_breadcrumb_item($lang->themes, "index.php?module=style-themes");

}

$page->add_breadcrumb_item($lang->themes, "index.php?module=style-themes");


if($mybb->input['action'] == "add" || $mybb->input['action'] == "import" || $mybb->input['action'] == "browse" || !$mybb->input['action'])
{


if($mybb->input['action'] == "add" || $mybb->input['action'] == "import" || $mybb->input['action'] == "browse" || !$mybb->input['action'])
{

Zeile 102Zeile 111
		'title' => $lang->themes,
'link' => "index.php?module=style-themes",
'description' => $lang->themes_desc

		'title' => $lang->themes,
'link' => "index.php?module=style-themes",
'description' => $lang->themes_desc

	);

	);


$sub_tabs['create_theme'] = array(
'title' => $lang->create_new_theme,


$sub_tabs['create_theme'] = array(
'title' => $lang->create_new_theme,

Zeile 114Zeile 123
		'title' => $lang->import_a_theme,
'link' => "index.php?module=style-themes&amp;action=import",
'description' => $lang->import_a_theme_desc

		'title' => $lang->import_a_theme,
'link' => "index.php?module=style-themes&amp;action=import",
'description' => $lang->import_a_theme_desc

	);

	);


$sub_tabs['browse_themes'] = array(
'title' => $lang->browse_themes,


$sub_tabs['browse_themes'] = array(
'title' => $lang->browse_themes,

Zeile 146Zeile 155

if($mybb->input['page'])
{


if($mybb->input['page'])
{

		$url_page = "&page=".$mybb->get_input('page', 1);

		$url_page = "&page=".$mybb->get_input('page', MyBB::INPUT_INT);

	}
else
{

	}
else
{

Zeile 159Zeile 168
	// Convert to mods site version codes
$search_version = ($major_version_code/100).'x';


	// Convert to mods site version codes
$search_version = ($major_version_code/100).'x';


	$contents = fetch_remote_file("http://community.mybb.com/xmlbrowse.php?type=themes&version={$search_version}{$keywords}{$url_page}", $post_data);

	$contents = fetch_remote_file("https://community.mybb.com/xmlbrowse.php?type=themes&version={$search_version}{$keywords}{$url_page}", $post_data);


if(!$contents)
{


if(!$contents)
{

Zeile 190Zeile 199
			unset($tree['results']['result']);
$tree['results']['result'][0] = $only_theme;
}

			unset($tree['results']['result']);
$tree['results']['result'][0] = $only_theme;
}

 

require_once MYBB_ROOT . '/inc/class_parser.php';
$post_parser = new postParser();


foreach($tree['results']['result'] as $result)
{


foreach($tree['results']['result'] as $result)
{

			$table->construct_cell("<img src=\"http://community.mybb.com/{$result['thumbnail']['value']}\" alt=\"{$lang->theme_thumbnail}\" title=\"{$lang->theme_thumbnail}\"/>", array("class" => "align_center", "width" => 100));










			$result['thumbnail']['value'] = htmlspecialchars_uni($result['thumbnail']['value']);
$result['name']['value'] = htmlspecialchars_uni($result['name']['value']);
$result['description']['value'] = htmlspecialchars_uni($result['description']['value']);
$result['author']['value'] = $post_parser->parse_message($result['author']['value'], array(
'allow_html' => true
)
);
$result['download_url']['value'] = htmlspecialchars_uni(html_entity_decode($result['download_url']['value']));

$table->construct_cell("<img src=\"https://community.mybb.com/{$result['thumbnail']['value']}\" alt=\"{$lang->theme_thumbnail}\" title=\"{$lang->theme_thumbnail}\"/>", array("class" => "align_center", "width" => 100));

			$table->construct_cell("<strong>{$result['name']['value']}</strong><br /><small>{$result['description']['value']}</small><br /><i><small>{$lang->created_by} {$result['author']['value']}</small></i>");

			$table->construct_cell("<strong>{$result['name']['value']}</strong><br /><small>{$result['description']['value']}</small><br /><i><small>{$lang->created_by} {$result['author']['value']}</small></i>");

			$table->construct_cell("<strong><a href=\"http://community.mybb.com/{$result['download_url']['value']}\" target=\"_blank\">{$lang->download}</a></strong>", array("class" => "align_center"));

			$table->construct_cell("<strong><a href=\"https://community.mybb.com/{$result['download_url']['value']}\" target=\"_blank\" rel=\"noopener\">{$lang->download}</a></strong>", array("class" => "align_center"));

			$table->construct_row();
}
}

			$table->construct_row();
}
}

Zeile 222Zeile 243
	echo "<input type=\"submit\" class=\"search_button\" value=\"{$lang->search}\" />\n";
echo "<script type=\"text/javascript\">
var form = $(\"#search_form\");

	echo "<input type=\"submit\" class=\"search_button\" value=\"{$lang->search}\" />\n";
echo "<script type=\"text/javascript\">
var form = $(\"#search_form\");

		form.submit(function()

		form.on('submit', function()

		{
var search = $('#search_keywords');
if(search.val() == '' || search.val() == '{$lang->search_for_themes}')
{

		{
var search = $('#search_keywords');
if(search.val() == '' || search.val() == '{$lang->search_for_themes}')
{

				search.focus();

				search.trigger('focus');

				return false;
}
});

var search = $('#search_keywords');

				return false;
}
});

var search = $('#search_keywords');

		search.focus(function()

		search.on('focus', function()

		{
var search_focus = $(this);
if(search_focus.val() == '{$lang->search_for_themes}')

		{
var search_focus = $(this);
if(search_focus.val() == '{$lang->search_for_themes}')

Zeile 241Zeile 262
				search_focus.removeClass('search_default');
search_focus.val('');
}

				search_focus.removeClass('search_default');
search_focus.val('');
}

		});

search.blur(function()

		}).on('blur', function()



		{
var search_blur = $(this);
if(search_blur.val() == '')

		{
var search_blur = $(this);
if(search_blur.val() == '')

Zeile 265Zeile 284
	// Recommended themes = Default; Otherwise search results & pagination
if($mybb->request_method == "post")
{

	// Recommended themes = Default; Otherwise search results & pagination
if($mybb->request_method == "post")
{

		$table->output("<span style=\"float: right;\"><small><a href=\"http://mods.mybb.com/themes\" target=\"_blank\">{$lang->browse_all_themes}</a></small></span>".$lang->sprintf($lang->browse_results_for_mybb, $mybb->version));

		$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=themes\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_themes}</a></small></span>".$lang->sprintf($lang->browse_results_for_mybb, $mybb->version));

	}
else
{

	}
else
{

		$table->output("<span style=\"float: right;\"><small><a href=\"http://mods.mybb.com/themes\" target=\"_blank\">{$lang->browse_all_themes}</a></small></span>".$lang->sprintf($lang->recommended_themes_for_mybb, $mybb->version));

		$table->output("<span style=\"float: right;\"><small><a href=\"https://community.mybb.com/mods.php?action=browse&category=themes\" target=\"_blank\" rel=\"noopener\">{$lang->browse_all_themes}</a></small></span>".$lang->sprintf($lang->recommended_themes_for_mybb, $mybb->version));

	}

echo "<br />".draw_admin_pagination($mybb->input['page'], 15, $tree['results']['attributes']['total'], "index.php?module=style-themes&amp;action=browse{$keywords}&amp;page={page}");

	}

echo "<br />".draw_admin_pagination($mybb->input['page'], 15, $tree['results']['attributes']['total'], "index.php?module=style-themes&amp;action=browse{$keywords}&amp;page={page}");

Zeile 358Zeile 377
				$options = array(
'no_stylesheets' => ($mybb->input['import_stylesheets'] ? 0 : 1),
'no_templates' => ($mybb->input['import_templates'] ? 0 : 1),

				$options = array(
'no_stylesheets' => ($mybb->input['import_stylesheets'] ? 0 : 1),
'no_templates' => ($mybb->input['import_templates'] ? 0 : 1),

					'version_compat' => (int)$mybb->input['version_compat'],
'parent' => $mybb->get_input('tid', 1),

					'version_compat' => $mybb->get_input('version_compat', MyBB::INPUT_INT),
'parent' => $mybb->get_input('tid', MyBB::INPUT_INT),

					'force_name_check' => true,
);
$theme_id = import_theme_xml($contents, $options);

					'force_name_check' => true,
);
$theme_id = import_theme_xml($contents, $options);

Zeile 495Zeile 514

if($mybb->input['action'] == "export")
{


if($mybb->input['action'] == "export")
{

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist?

	$theme = $db->fetch_array($query);

// Does the theme not exist?

Zeile 520Zeile 539

if(is_array($value))
{


if(is_array($value))
{

				$value = serialize($value);

				$value = my_serialize($value);

			}

$value = str_replace(']]>', ']]]]><![CDATA[>', $value);

			}

$value = str_replace(']]>', ']]]]><![CDATA[>', $value);

Zeile 563Zeile 582
		$inherited_load[] = $mybb->input['tid'];
$inherited_load = array_unique($inherited_load);


		$inherited_load[] = $mybb->input['tid'];
$inherited_load = array_unique($inherited_load);


		$inherited_themes = array();

		$inherited_themes = $theme_stylesheets = array();

		if(count($inherited_load) > 0)
{
$query = $db->simple_select("themes", "tid, name", "tid IN (".implode(",", $inherited_load).")");

		if(count($inherited_load) > 0)
{
$query = $db->simple_select("themes", "tid, name", "tid IN (".implode(",", $inherited_load).")");

Zeile 571Zeile 590
			{
$inherited_themes[$inherited_theme['tid']] = $inherited_theme['name'];
}

			{
$inherited_themes[$inherited_theme['tid']] = $inherited_theme['name'];
}

		}

$theme_stylesheets = array();

 




		if(count($inherited_load) > 0)
{

 
			$query = $db->simple_select("themestylesheets", "*", "tid IN (".implode(",", $inherited_load).")", array('order_by' => 'tid', 'order_dir' => 'desc'));
while($theme_stylesheet = $db->fetch_array($query))

			$query = $db->simple_select("themestylesheets", "*", "tid IN (".implode(",", $inherited_load).")", array('order_by' => 'tid', 'order_dir' => 'desc'));
while($theme_stylesheet = $db->fetch_array($query))

			{

			{

				if(!$theme_stylesheets[$theme_stylesheet['cachefile']])
{
$theme_stylesheets[$theme_stylesheet['cachefile']] = $theme_stylesheet;
$theme_stylesheets[$theme_stylesheet['sid']] = $theme_stylesheet['cachefile'];
}

				if(!$theme_stylesheets[$theme_stylesheet['cachefile']])
{
$theme_stylesheets[$theme_stylesheet['cachefile']] = $theme_stylesheet;
$theme_stylesheets[$theme_stylesheet['sid']] = $theme_stylesheet['cachefile'];
}

			}

			}

		}

$xml .= "\t<stylesheets>\r\n";

		}

$xml .= "\t<stylesheets>\r\n";

Zeile 593Zeile 607
		{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

		{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

				$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);

				$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);

				$filename = $theme_stylesheets[$style['sid']];
}
else
{
$filename = basename($filename);
$style['sid'] = $theme_stylesheets[$filename]['sid'];

				$filename = $theme_stylesheets[$style['sid']];
}
else
{
$filename = basename($filename);
$style['sid'] = $theme_stylesheets[$filename]['sid'];

			}


			}


			$style['tid'] = $theme_stylesheets[$filename]['tid'];

if($mybb->input['custom_theme'] == 1 && $style['tid'] != $mybb->input['tid'])

			$style['tid'] = $theme_stylesheets[$filename]['tid'];

if($mybb->input['custom_theme'] == 1 && $style['tid'] != $mybb->input['tid'])

			{

			{

				continue;

				continue;

			}


			}


			// Has the file on the file system been modified?
resync_stylesheet($theme_stylesheets[$filename]);

			// Has the file on the file system been modified?
resync_stylesheet($theme_stylesheets[$filename]);





			$style['sid'] = $theme_stylesheets[$filename]['sid'];

$attachedto = $theme_stylesheets[$filename]['attachedto'];
$stylesheet = $theme_stylesheets[$filename]['stylesheet'];
$stylesheet = str_replace(']]>', ']]]]><![CDATA[>', $stylesheet);

			$style['sid'] = $theme_stylesheets[$filename]['sid'];

$attachedto = $theme_stylesheets[$filename]['attachedto'];
$stylesheet = $theme_stylesheets[$filename]['stylesheet'];
$stylesheet = str_replace(']]>', ']]]]><![CDATA[>', $stylesheet);





			if($attachedto)
{
$attachedto = "attachedto=\"{$attachedto}\" ";

			if($attachedto)
{
$attachedto = "attachedto=\"{$attachedto}\" ";

Zeile 626Zeile 640
			$filename = $theme_stylesheets[$filename]['name'];

$xml .= "\t\t<stylesheet name=\"{$filename}\" {$attachedto}version=\"{$mybb->version_code}\"><![CDATA[{$stylesheet}]]>\r\n\t\t</stylesheet>\r\n";

			$filename = $theme_stylesheets[$filename]['name'];

$xml .= "\t\t<stylesheet name=\"{$filename}\" {$attachedto}version=\"{$mybb->version_code}\"><![CDATA[{$stylesheet}]]>\r\n\t\t</stylesheet>\r\n";





		}
$xml .= "\t</stylesheets>\r\n";


		}
$xml .= "\t</stylesheets>\r\n";


Zeile 646Zeile 660
		$plugins->run_hooks("admin_style_themes_export_commit");

// Log admin action

		$plugins->run_hooks("admin_style_themes_export_commit");

// Log admin action

		log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));

		log_admin_action($theme['tid'], $theme['name']);


$theme['name'] = rawurlencode($theme['name']);
header("Content-disposition: attachment; filename=".$theme['name']."-theme.xml");


$theme['name'] = rawurlencode($theme['name']);
header("Content-disposition: attachment; filename=".$theme['name']."-theme.xml");

Zeile 701Zeile 715
	$form_container->output_row($lang->include_templates, $lang->include_templates_desc, $form->generate_yes_no_radio('include_templates', $mybb->input['include_templates']), 'include_templates');

$form_container->end();

	$form_container->output_row($lang->include_templates, $lang->include_templates_desc, $form->generate_yes_no_radio('include_templates', $mybb->input['include_templates']), 'include_templates');

$form_container->end();





	$buttons[] = $form->generate_submit_button($lang->export_theme);

$form->output_submit_wrapper($buttons);

	$buttons[] = $form->generate_submit_button($lang->export_theme);

$form->output_submit_wrapper($buttons);

Zeile 713Zeile 727

if($mybb->input['action'] == "duplicate")
{


if($mybb->input['action'] == "duplicate")
{

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist?

	$theme = $db->fetch_array($query);

// Does the theme not exist?

Zeile 735Zeile 749
		{
$query = $db->simple_select("themes", "COUNT(tid) as numthemes", "name = '".$db->escape_string($mybb->get_input('name'))."'");
$numthemes = $db->fetch_field($query, 'numthemes');

		{
$query = $db->simple_select("themes", "COUNT(tid) as numthemes", "name = '".$db->escape_string($mybb->get_input('name'))."'");
$numthemes = $db->fetch_field($query, 'numthemes');

			



			if($numthemes)
{
$errors[] = $lang->error_theme_already_exists;

			if($numthemes)
{
$errors[] = $lang->error_theme_already_exists;

Zeile 745Zeile 759
		if(!$errors)
{
$properties = my_unserialize($theme['properties']);

		if(!$errors)
{
$properties = my_unserialize($theme['properties']);

			$sid = $properties['sid'];

			$sid = $properties['templateset'];

			$nprops = null;
if($mybb->input['duplicate_templates'])
{

			$nprops = null;
if($mybb->input['duplicate_templates'])
{

Zeile 778Zeile 792
					if($property == "inherited")
{
continue;

					if($property == "inherited")
{
continue;

					}


					}


					$nprops[$property] = $value;
if($properties['inherited'][$property])
{

					$nprops[$property] = $value;
if($properties['inherited'][$property])
{

Zeile 865Zeile 879
if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_style_themes_add");

if($mybb->input['action'] == "add")
{
$plugins->run_hooks("admin_style_themes_add");





	$query = $db->simple_select("themes", "tid, name");
while($theme = $db->fetch_array($query))
{

	$query = $db->simple_select("themes", "tid, name");
while($theme = $db->fetch_array($query))
{

Zeile 879Zeile 893
			$errors[] = $lang->error_missing_name;
}
else if(in_array($mybb->input['name'], $themes))

			$errors[] = $lang->error_missing_name;
}
else if(in_array($mybb->input['name'], $themes))

		{

		{

			$errors[] = $lang->error_theme_already_exists;
}


			$errors[] = $lang->error_theme_already_exists;
}


Zeile 890Zeile 904
			$plugins->run_hooks("admin_style_themes_add_commit");

// Log admin action

			$plugins->run_hooks("admin_style_themes_add_commit");

// Log admin action

			log_admin_action(htmlspecialchars_uni($mybb->input['name']), $tid);

			log_admin_action($mybb->input['name'], $tid);


flash_message($lang->success_theme_created, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid=".$tid);
}


flash_message($lang->success_theme_created, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid=".$tid);
}

	}


	}


	$page->add_breadcrumb_item($lang->create_new_theme, "index.php?module=style-themes&amp;action=add");

	$page->add_breadcrumb_item($lang->create_new_theme, "index.php?module=style-themes&amp;action=add");





	$page->output_header("{$lang->themes} - {$lang->create_new_theme}");

	$page->output_header("{$lang->themes} - {$lang->create_new_theme}");





	$page->output_nav_tabs($sub_tabs, 'create_theme');

	$page->output_nav_tabs($sub_tabs, 'create_theme');





	if($errors)
{
$page->output_inline_error($errors);

	if($errors)
{
$page->output_inline_error($errors);

	}

$form = new Form("index.php?module=style-themes&amp;action=add", "post");


	}

$form = new Form("index.php?module=style-themes&amp;action=add", "post");


	$form_container = new FormContainer($lang->create_a_theme);
$form_container->output_row($lang->name, $lang->name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->parent_theme, $lang->parent_theme_desc, $form->generate_select_box('tid', $themes, $mybb->input['tid'], array('id' => 'tid')), 'tid');

$form_container->end();

	$form_container = new FormContainer($lang->create_a_theme);
$form_container->output_row($lang->name, $lang->name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->parent_theme, $lang->parent_theme_desc, $form->generate_select_box('tid', $themes, $mybb->input['tid'], array('id' => 'tid')), 'tid');

$form_container->end();





	$buttons[] = $form->generate_submit_button($lang->create_new_theme);

$form->output_submit_wrapper($buttons);

	$buttons[] = $form->generate_submit_button($lang->create_new_theme);

$form->output_submit_wrapper($buttons);

Zeile 927Zeile 941

if($mybb->input['action'] == "delete")
{


if($mybb->input['action'] == "delete")
{

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist? or are we trying to delete the master?
if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

// Does the theme not exist? or are we trying to delete the master?
if(!$theme['tid'] || $theme['tid'] == 1)

	{

	{

		flash_message($lang->error_invalid_theme, 'error');
admin_redirect("index.php?module=style-themes");
}

		flash_message($lang->error_invalid_theme, 'error');
admin_redirect("index.php?module=style-themes");
}

Zeile 951Zeile 965

$query = $db->simple_select("themes", "tid,stylesheets", "tid != '{$theme['tid']}'", array('order_by' => "pid, name"));
while($theme2 = $db->fetch_array($query))


$query = $db->simple_select("themes", "tid,stylesheets", "tid != '{$theme['tid']}'", array('order_by' => "pid, name"));
while($theme2 = $db->fetch_array($query))

		{
$theme2['stylesheets'] = my_unserialize($theme2['stylesheets']);


		{
$theme2['stylesheets'] = my_unserialize($theme2['stylesheets']);


			if(!$theme2['stylesheets']['inherited'])
{
continue;

			if(!$theme2['stylesheets']['inherited'])
{
continue;

Zeile 980Zeile 994
		}

if($inherited_stylesheets == true)

		}

if($inherited_stylesheets == true)

		{

		{

			flash_message($lang->error_inheriting_stylesheets, 'error');
admin_redirect("index.php?module=style-themes");
}

			flash_message($lang->error_inheriting_stylesheets, 'error');
admin_redirect("index.php?module=style-themes");
}

Zeile 989Zeile 1003
		while($cachefile = $db->fetch_array($query))
{
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$cachefile['cachefile']}");

		while($cachefile = $db->fetch_array($query))
{
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$cachefile['cachefile']}");

 

$filename_min = str_replace('.css', '.min.css', $cachefile['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");

		}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/index.html");

		}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/index.html");





		$db->delete_query("themestylesheets", "tid='{$theme['tid']}'");

// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid'], $theme, true);

		$db->delete_query("themestylesheets", "tid='{$theme['tid']}'");

// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid'], $theme, true);





		$db->update_query("users", array('style' => 0), "style='{$theme['tid']}'");

		$db->update_query("users", array('style' => 0), "style='{$theme['tid']}'");





		@rmdir(MYBB_ROOT."cache/themes/theme{$theme['tid']}/");

		@rmdir(MYBB_ROOT."cache/themes/theme{$theme['tid']}/");


$children = make_child_theme_list($theme['tid']);
$child_tid = $children[0];

$db->update_query("themes", array('pid' => $theme['pid']), "tid='{$child_tid}'");














$children = (array)make_child_theme_list($theme['tid']);
$child_tids = array();

foreach($children as $child_tid)
{
if($child_tid != 0)
{
$child_tids[] = $child_tid;
}
}

if(!empty($child_tids))
{
$db->update_query("themes", array('pid' => $theme['pid']), "tid IN (".implode(',', $child_tids).")");
}


		$db->delete_query("themes", "tid='{$theme['tid']}'", 1);

$plugins->run_hooks("admin_style_themes_delete_commit");

// Log admin action

		$db->delete_query("themes", "tid='{$theme['tid']}'", 1);

$plugins->run_hooks("admin_style_themes_delete_commit");

// Log admin action

		log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));

		log_admin_action($theme['tid'], $theme['name']);


flash_message($lang->success_theme_deleted, 'success');
admin_redirect("index.php?module=style-themes");
}
else


flash_message($lang->success_theme_deleted, 'success');
admin_redirect("index.php?module=style-themes");
}
else

	{

	{

		$page->output_confirm_action("index.php?module=style-themes&amp;action=delete&amp;tid={$theme['tid']}", $lang->confirm_theme_deletion);
}
}

if($mybb->input['action'] == "edit")
{

		$page->output_confirm_action("index.php?module=style-themes&amp;action=delete&amp;tid={$theme['tid']}", $lang->confirm_theme_deletion);
}
}

if($mybb->input['action'] == "edit")
{

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist?

	$theme = $db->fetch_array($query);

// Does the theme not exist?

Zeile 1039Zeile 1067
	if($mybb->request_method == "post" && !$mybb->input['do'])
{
$properties = array(

	if($mybb->request_method == "post" && !$mybb->input['do'])
{
$properties = array(

			'templateset' => (int)$mybb->input['templateset'],

			'templateset' => $mybb->get_input('templateset', MyBB::INPUT_INT),

			'editortheme' => $mybb->input['editortheme'],
'imgdir' => $mybb->input['imgdir'],
'logo' => $mybb->input['logo'],

			'editortheme' => $mybb->input['editortheme'],
'imgdir' => $mybb->input['imgdir'],
'logo' => $mybb->input['logo'],

			'tablespace' => (int)$mybb->input['tablespace'],
'borderwidth' => (int)$mybb->input['borderwidth'],

			'tablespace' => $mybb->get_input('tablespace', MyBB::INPUT_INT),
'borderwidth' => $mybb->get_input('borderwidth', MyBB::INPUT_INT),

			'color' => $mybb->input['color']

			'color' => $mybb->input['color']

		);


		);


		if($properties['color'] == 'none')
{
unset($properties['color']);

		if($properties['color'] == 'none')
{
unset($properties['color']);

Zeile 1058Zeile 1086
			$colors = explode("\n", $mybb->input['colors']);

foreach($colors as $color)

			$colors = explode("\n", $mybb->input['colors']);

foreach($colors as $color)

			{
$color = explode("=", $color);

$properties['colors'][$color[0]] = $color[1];








			{
$color = trim($color);
if(preg_match('/^[a-z0-9]+={1}[a-z0-9]+$/i', $color))
{
$color = explode("=", $color);
$properties['colors'][$color[0]] = $color[1];
}
else
{
$errors[] = $lang->sprintf($lang->error_invalid_color, $color);
}

			}
}

if($properties['templateset'] <= 0)

			}
}

if($properties['templateset'] <= 0)

		{

		{

			$errors[] = $lang->error_invalid_templateset;

			$errors[] = $lang->error_invalid_templateset;

		}


		}


		$theme_properties = my_unserialize($theme['properties']);

		$theme_properties = my_unserialize($theme['properties']);

		if($theme_properties['disporder'])

		if(is_array($theme_properties['disporder']))

		{

		{

			$properties['disporder'] = $theme_properties['disporder'];
}






			$properties['disporder'] = $theme_properties['disporder'];
}
else
{
$errors[] = $lang->error_no_display_order;
}


		$allowedgroups = array();
if(is_array($mybb->input['allowedgroups']))
{

		$allowedgroups = array();
if(is_array($mybb->input['allowedgroups']))
{

Zeile 1093Zeile 1132
		if(is_array($allowedgroups))
{
$allowedgroups = implode(",", $allowedgroups);

		if(is_array($allowedgroups))
{
$allowedgroups = implode(",", $allowedgroups);

		}

		}


$update_array = array(
'name' => $db->escape_string($mybb->input['name']),


$update_array = array(
'name' => $db->escape_string($mybb->input['name']),

			'pid' => $mybb->get_input('pid', 1),

			'pid' => $mybb->get_input('pid', MyBB::INPUT_INT),

			'allowedgroups' => $allowedgroups,

			'allowedgroups' => $allowedgroups,

			'properties' => $db->escape_string(serialize($properties))

			'properties' => $db->escape_string(my_serialize($properties))

		);

		);





		// perform validation
if(!$update_array['name'])
{
$errors[] = $lang->error_missing_name;

		// perform validation
if(!$update_array['name'])
{
$errors[] = $lang->error_missing_name;

		}

		}

		else
{
$query = $db->simple_select("themes", "COUNT(tid) as numthemes", "name = '".$db->escape_string($update_array['name'])."' AND tid != '{$theme['tid']}'");
$numthemes = $db->fetch_field($query, 'numthemes');

		else
{
$query = $db->simple_select("themes", "COUNT(tid) as numthemes", "name = '".$db->escape_string($update_array['name'])."' AND tid != '{$theme['tid']}'");
$numthemes = $db->fetch_field($query, 'numthemes');





			if($numthemes)
{
$errors[] = $lang->error_theme_already_exists;

			if($numthemes)
{
$errors[] = $lang->error_theme_already_exists;

			}
}

			}
}


if($update_array['pid'])
{


if($update_array['pid'])
{

Zeile 1137Zeile 1176
			}
}
if(!$properties['templateset'])

			}
}
if(!$properties['templateset'])

		{

		{

			$errors[] = $lang->error_invalid_templateset;

			$errors[] = $lang->error_invalid_templateset;

		}
if(!$properties['editortheme'] || !file_exists(MYBB_ROOT."jscripts/sceditor/editor_themes/".$properties['editortheme']) || is_dir(MYBB_ROOT."jscripts/sceditor/editor_themes/".$properties['editortheme']))

		}
if(!$properties['editortheme'] || !file_exists(MYBB_ROOT."jscripts/sceditor/themes/".$properties['editortheme']) || is_dir(MYBB_ROOT."jscripts/sceditor/themes/".$properties['editortheme']))

		{
$errors[] = $lang->error_invalid_editortheme;

		{
$errors[] = $lang->error_invalid_editortheme;

		}


		}


		if(empty($errors))
{

		if(empty($errors))
{

 
			$plugins->run_hooks("admin_style_themes_edit_commit");


			$db->update_query("themes", $update_array, "tid='{$theme['tid']}'");

			$db->update_query("themes", $update_array, "tid='{$theme['tid']}'");

 
			update_theme_stylesheet_list($theme['tid']);


if($theme['def'] == 1)
{
$cache->update_default_theme();
}


if($theme['def'] == 1)
{
$cache->update_default_theme();
}


$plugins->run_hooks("admin_style_themes_edit_commit");

 

// Log admin action


// Log admin action

			log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));

			log_admin_action($theme['tid'], $theme['name']);


flash_message($lang->success_theme_properties_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");


flash_message($lang->success_theme_properties_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");

Zeile 1181Zeile 1221
		foreach($action_stylesheet as $action => $style)
{
foreach($style as $stylesheet)

		foreach($action_stylesheet as $action => $style)
{
foreach($style as $stylesheet)

			{

			{

				$stylesheets[$stylesheet]['applied_to'][$file][] = $action;
if(is_array($file_stylesheets['inherited'][$file."_".$action]) && in_array($stylesheet, array_keys($file_stylesheets['inherited'][$file."_".$action])))
{

				$stylesheets[$stylesheet]['applied_to'][$file][] = $action;
if(is_array($file_stylesheets['inherited'][$file."_".$action]) && in_array($stylesheet, array_keys($file_stylesheets['inherited'][$file."_".$action])))
{

Zeile 1192Zeile 1232
					}
}
}

					}
}
}

		}
}

		}
}


$inherited_load[] = $mybb->input['tid'];


$inherited_load[] = $mybb->input['tid'];

	$inherited_load = array_unique($inherited_load);

$inherited_themes = array();
if(count($inherited_load) > 0)
{

	$inherited_load = array_unique($inherited_load);

$inherited_themes = $theme_stylesheets = array();
if(count($inherited_load) > 0)
{

		$query = $db->simple_select("themes", "tid, name", "tid IN (".implode(",", $inherited_load).")");
while($inherited_theme = $db->fetch_array($query))
{
$inherited_themes[$inherited_theme['tid']] = $inherited_theme['name'];
}

		$query = $db->simple_select("themes", "tid, name", "tid IN (".implode(",", $inherited_load).")");
while($inherited_theme = $db->fetch_array($query))
{
$inherited_themes[$inherited_theme['tid']] = $inherited_theme['name'];
}

	}

$theme_stylesheets = array();

 




	if(count($inherited_load) > 0)
{

 
		$query = $db->simple_select("themestylesheets", "*", "", array('order_by' => 'sid DESC, tid', 'order_dir' => 'desc'));
while($theme_stylesheet = $db->fetch_array($query))
{

		$query = $db->simple_select("themestylesheets", "*", "", array('order_by' => 'sid DESC, tid', 'order_dir' => 'desc'));
while($theme_stylesheet = $db->fetch_array($query))
{

Zeile 1252Zeile 1287
		$properties['disporder'] = $orders;

$update_array = array(

		$properties['disporder'] = $orders;

$update_array = array(

			"properties" => $db->escape_string(serialize($properties))

			"properties" => $db->escape_string(my_serialize($properties))

		);

$db->update_query("themes", $update_array, "tid = '{$theme['tid']}'");

		);

$db->update_query("themes", $update_array, "tid = '{$theme['tid']}'");

Zeile 1261Zeile 1296
		{
$cache->update_default_theme();
}

		{
$cache->update_default_theme();
}

 

// normalize for consistency
update_theme_stylesheet_list($theme['tid'], false, true);


		flash_message($lang->success_stylesheet_order_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");
}

		flash_message($lang->success_stylesheet_order_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");
}

Zeile 1313Zeile 1352
		{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

		{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

				$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);

				$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);

				$filename = $theme_stylesheets[$style['sid']];
}


				$filename = $theme_stylesheets[$style['sid']];
}


Zeile 1330Zeile 1369
	{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

	{
if(strpos($filename, 'css.php?stylesheet=') !== false)
{

			$style['sid'] = (integer)str_replace('css.php?stylesheet=', '', $filename);

			$style['sid'] = (int)str_replace('css.php?stylesheet=', '', $filename);

			$filename = $theme_stylesheets[$style['sid']];
}
else

			$filename = $theme_stylesheets[$style['sid']];
}
else

Zeile 1382Zeile 1421
		if(is_array($style['applied_to']) && (!isset($style['applied_to']['global']) || $style['applied_to']['global'][0] != "global"))
{
$attached_to = '';

		if(is_array($style['applied_to']) && (!isset($style['applied_to']['global']) || $style['applied_to']['global'][0] != "global"))
{
$attached_to = '';

			$got_color = false;

 

$applied_to_count = count($style['applied_to']);
$count = 0;
$sep = " ";
$name = "";


$applied_to_count = count($style['applied_to']);
$count = 0;
$sep = " ";
$name = "";

 

$colors = array();

if(!is_array($properties['colors']))
{
$properties['colors'] = array();
}


foreach($style['applied_to'] as $name => $actions)
{


foreach($style['applied_to'] as $name => $actions)
{

				if(strpos($name, ".php") === false)

				if(!$name)

				{

				{

					$got_color = true; // Maybe...

 
					continue;
}


					continue;
}


				if(!$name)
{
continue;







				if(array_key_exists($name, $properties['colors']))
{
$colors[] = $properties['colors'][$name];
}

if(count($colors))
{
// Colors override files and are handled below.
continue;

				}


				}


 
				// It's a file:

				++$count;

				++$count;

 

$name = htmlspecialchars_uni($name);


if($actions[0] != "global")


if($actions[0] != "global")

				{



				{
$actions = array_map('htmlspecialchars_uni', $actions);


					$name = "{$name} ({$lang->actions}: ".implode(',', $actions).")";
}


					$name = "{$name} ({$lang->actions}: ".implode(',', $actions).")";
}


Zeile 1416Zeile 1471
				$attached_to .= $sep.$name;

$sep = $lang->comma;

				$attached_to .= $sep.$name;

$sep = $lang->comma;

			}


			}


			if($attached_to)
{
$attached_to = "<small>{$lang->attached_to} {$attached_to}</small>";
}


			if($attached_to)
{
$attached_to = "<small>{$lang->attached_to} {$attached_to}</small>";
}


			$colors = array();
if($got_color == true && is_array($properties['colors']))

			if(count($colors))


			{

			{

				// We might have colors here...
foreach($style['applied_to'] as $name => $actions)
{
if(strpos($name, ".php") !== false)
{
continue;
}

// Verify this is a color for this theme
if(array_key_exists($name, $properties['colors']))
{
$colors[] = $properties['colors'][$name];
}
}


				// Attached to color instead of files.















				$count = 1;

				$count = 1;

				$plural = 's';

 
				$color_list = $sep = '';

				$color_list = $sep = '';

				if(count($colors == 1))
{
$plural = '';
}

 

foreach($colors as $color)
{


foreach($colors as $color)
{

Zeile 1462Zeile 1497
					$sep = ', ';
}


					$sep = ', ';
}


				$attached_to = "<small>{$lang->attached_to} ".$lang->sprintf($lang->colors_attached_to, $plural)." {$color_list}</small>";

				$attached_to = "<small>{$lang->attached_to} ".$lang->sprintf($lang->colors_attached_to)." {$color_list}</small>";

			}

if($attached_to == '')

			}

if($attached_to == '')

Zeile 1487Zeile 1522
		}

$table->construct_cell("<strong><a href=\"index.php?module=style-themes&amp;action=edit_stylesheet&amp;file=".htmlspecialchars_uni($filename)."&amp;tid={$theme['tid']}\">{$filename}</a></strong>{$inherited}<br />{$attached_to}");

		}

$table->construct_cell("<strong><a href=\"index.php?module=style-themes&amp;action=edit_stylesheet&amp;file=".htmlspecialchars_uni($filename)."&amp;tid={$theme['tid']}\">{$filename}</a></strong>{$inherited}<br />{$attached_to}");

		$table->construct_cell($form->generate_text_box("disporder[{$theme_stylesheets[$filename]['sid']}]", $properties['disporder'][$filename], array('style' => 'width: 80%; text-align: center;')), array("class" => "align_center"));

		$table->construct_cell($form->generate_numeric_field("disporder[{$theme_stylesheets[$filename]['sid']}]", $properties['disporder'][$filename], array('style' => 'width: 80%; text-align: center;', 'min' => 0)), array("class" => "align_center"));

		$table->construct_cell($popup->fetch(), array("class" => "align_center"));
$table->construct_row();
}

		$table->construct_cell($popup->fetch(), array("class" => "align_center"));
$table->construct_row();
}

Zeile 1501Zeile 1536
	echo '<br />';

// Theme Properties table

	echo '<br />';

// Theme Properties table

	if($errors)
{

	if($errors)
{

		$page->output_inline_error($errors);
}


		$page->output_inline_error($errors);
}


Zeile 1526Zeile 1561
	$options = array();
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title'));
while($templateset = $db->fetch_array($query))

	$options = array();
$query = $db->simple_select("templatesets", "*", "", array('order_by' => 'title'));
while($templateset = $db->fetch_array($query))

	{

	{

		$options[(int)$templateset['sid']] = $templateset['title'];
}
$form_container->output_row($lang->template_set." <em>*</em>", $lang->template_set_desc, $form->generate_select_box('templateset', $options, $properties['templateset'], array('id' => 'templateset')), 'templateset');

$options = array();

		$options[(int)$templateset['sid']] = $templateset['title'];
}
$form_container->output_row($lang->template_set." <em>*</em>", $lang->template_set_desc, $form->generate_select_box('templateset', $options, $properties['templateset'], array('id' => 'templateset')), 'templateset');

$options = array();

	$editor_theme_root = MYBB_ROOT."jscripts/sceditor/editor_themes/";

	$editor_theme_root = MYBB_ROOT."jscripts/sceditor/themes/";

	if($dh = @opendir($editor_theme_root))
{
while($dir = readdir($dh))

	if($dh = @opendir($editor_theme_root))
{
while($dir = readdir($dh))

Zeile 1542Zeile 1577
				continue;
}
$options[$dir] = ucfirst(str_replace(array('_', '.css'), array(' ', ''), $dir));

				continue;
}
$options[$dir] = ucfirst(str_replace(array('_', '.css'), array(' ', ''), $dir));

		}
}

		}
}


$form_container->output_row($lang->editor_theme." <em>*</em>", $lang->editor_theme_desc, $form->generate_select_box('editortheme', $options, $properties['editortheme'], array('id' => 'editortheme')), 'editortheme');

$form_container->output_row($lang->img_directory, $lang->img_directory_desc, $form->generate_text_box('imgdir', $properties['imgdir'], array('id' => 'imgdir')), 'imgdir');
$form_container->output_row($lang->logo, $lang->logo_desc, $form->generate_text_box('logo', $properties['logo'], array('id' => 'boardlogo')), 'logo');


$form_container->output_row($lang->editor_theme." <em>*</em>", $lang->editor_theme_desc, $form->generate_select_box('editortheme', $options, $properties['editortheme'], array('id' => 'editortheme')), 'editortheme');

$form_container->output_row($lang->img_directory, $lang->img_directory_desc, $form->generate_text_box('imgdir', $properties['imgdir'], array('id' => 'imgdir')), 'imgdir');
$form_container->output_row($lang->logo, $lang->logo_desc, $form->generate_text_box('logo', $properties['logo'], array('id' => 'boardlogo')), 'logo');

	$form_container->output_row($lang->table_spacing, $lang->table_spacing_desc, $form->generate_text_box('tablespace', $properties['tablespace'], array('id' => 'tablespace')), 'tablespace');
$form_container->output_row($lang->inner_border, $lang->inner_border_desc, $form->generate_text_box('borderwidth', $properties['borderwidth'], array('id' => 'borderwidth')), 'borderwidth');

	$form_container->output_row($lang->table_spacing, $lang->table_spacing_desc, $form->generate_numeric_field('tablespace', $properties['tablespace'], array('id' => 'tablespace', 'min' => 0)), 'tablespace');
$form_container->output_row($lang->inner_border, $lang->inner_border_desc, $form->generate_numeric_field('borderwidth', $properties['borderwidth'], array('id' => 'borderwidth', 'min' => 0)), 'borderwidth');


$form_container->end();



$form_container->end();


Zeile 1595Zeile 1630
if($mybb->input['action'] == "stylesheet_properties")
{
// Fetch the theme we want to edit this stylesheet in

if($mybb->input['action'] == "stylesheet_properties")
{
// Fetch the theme we want to edit this stylesheet in

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

Zeile 1629Zeile 1664
	if(!array_key_exists($stylesheet['cachefile'], $stylesheets) && array_key_exists("css.php?stylesheet=".$stylesheet['tid'], $stylesheets))
{
$stylesheet['cachefile'] = "css.php?stylesheet=".$stylesheet['tid'];

	if(!array_key_exists($stylesheet['cachefile'], $stylesheets) && array_key_exists("css.php?stylesheet=".$stylesheet['tid'], $stylesheets))
{
$stylesheet['cachefile'] = "css.php?stylesheet=".$stylesheet['tid'];

	}


	}


	$this_stylesheet = $stylesheets[$stylesheet['cachefile']];
unset($stylesheets);

	$this_stylesheet = $stylesheets[$stylesheet['cachefile']];
unset($stylesheets);





	if($mybb->request_method == "post")
{
// Do we not have a name, or is it just an extension?

	if($mybb->request_method == "post")
{
// Do we not have a name, or is it just an extension?

Zeile 1647Zeile 1682
		if(get_extension($mybb->input['name']) != "css")
{
// Does not end with '.css'

		if(get_extension($mybb->input['name']) != "css")
{
// Does not end with '.css'

			$errors[] = $lang->sprintf($lang->error_missing_stylesheet_extension, $mybb->input['name']);




			$errors[] = $lang->sprintf(
$lang->error_missing_stylesheet_extension,
htmlspecialchars_uni($mybb->input['name'])
);

		}

if(!$errors)

		}

if(!$errors)

Zeile 1721Zeile 1759
				$update_d = true;

$db->update_query("themestylesheets", array('lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'", 1);

				$update_d = true;

$db->update_query("themestylesheets", array('lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'", 1);

				if(!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $theme['stylesheet']))

				if(!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $stylesheet['stylesheet']))

				{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$stylesheet['sid']}"), "sid='{$stylesheet['sid']}'", 1);
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

				{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$stylesheet['sid']}"), "sid='{$stylesheet['sid']}'", 1);
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

 

$filename_min = str_replace('.css', '.min.css', $stylesheet['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");

			}

// Update the CSS file list for this theme

			}

// Update the CSS file list for this theme

Zeile 1734Zeile 1775
			$plugins->run_hooks("admin_style_themes_stylesheet_properties_commit");

// Log admin action

			$plugins->run_hooks("admin_style_themes_stylesheet_properties_commit");

// Log admin action

			log_admin_action($stylesheet['sid'], $mybb->input['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));

			log_admin_action($stylesheet['sid'], $mybb->input['name'], $theme['tid'], $theme['name']);


flash_message($lang->success_stylesheet_properties_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");


flash_message($lang->success_stylesheet_properties_updated, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");

		}

		}

	}

$properties = my_unserialize($theme['properties']);

	}

$properties = my_unserialize($theme['properties']);

Zeile 1757Zeile 1798
		if($stylesheet['tid'] == 1)
{
$page->output_alert($lang->sprintf($lang->stylesheet_inherited_default, $stylesheet_parent));

		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));

		else
{
$page->output_alert($lang->sprintf($lang->stylesheet_inherited, $stylesheet_parent));

Zeile 1802Zeile 1843
	$count = 0;
if(is_array($applied_to) && $applied_to['global'][0] != "global")
{

	$count = 0;
if(is_array($applied_to) && $applied_to['global'][0] != "global")
{

		$got_color = false;

 
		$check_actions = "";

		$check_actions = "";









		$stylesheet['colors'] = array();

if(!is_array($properties['colors']))
{
$properties['colors'] = array();
}


		foreach($applied_to as $name => $actions)
{

		foreach($applied_to as $name => $actions)
{

			if(strpos($name, ".php") === false)







			// Verify this is a color for this theme
if(array_key_exists($name, $properties['colors']))
{
$stylesheet['colors'][] = $name;
}

if(count($stylesheet['colors']))

			{

			{

				$got_color = true; // Maybe...

				// Colors override files and are handled below.

				continue;
}


				continue;
}


			$short_name = substr($name, 0, -4);


			// It's a file:


			$action_list = "";
if($actions[0] != "global")
{
$action_list = implode(',', $actions);

			$action_list = "";
if($actions[0] != "global")
{
$action_list = implode(',', $actions);

			}


			}


			if($actions[0] == "global")
{
$global_action_checked[1] = "checked=\"checked\"";
$global_action_checked[2] = "";

			if($actions[0] == "global")
{
$global_action_checked[1] = "checked=\"checked\"";
$global_action_checked[2] = "";

			}

			}

			else
{
$global_action_checked[2] = "checked=\"checked\"";

			else
{
$global_action_checked[2] = "checked=\"checked\"";

Zeile 1840Zeile 1891
			<table cellpadding=\"4\">
<tr>
<td>".$form->generate_text_box('action_list_'.$count, $action_list, array('id' => 'action_list_'.$count, 'style' => 'width: 190px;'))."</td>

			<table cellpadding=\"4\">
<tr>
<td>".$form->generate_text_box('action_list_'.$count, $action_list, array('id' => 'action_list_'.$count, 'style' => 'width: 190px;'))."</td>

				</tr>
</table>
</dd>
</dl>";

$form_container = new FormContainer();
$form_container->output_row("", "", "<span style=\"float: right;\"><a href=\"\" id=\"delete_img_{$count}\"><img src=\"styles/{$page->style}/images/icons/cross.png\" alt=\"{$lang->delete}\" title=\"{$lang->delete}\" /></a></span>{$lang->file} &nbsp;".$form->generate_text_box("attached_{$count}", $name, array('id' => "attached_{$count}", 'style' => 'width: 200px;')), "attached_{$count}");

$form_container->output_row("", "", $specific_file);

$specific_files .= "<div id=\"attached_form_{$count}\">".$form_container->end(true)."</div><div id=\"attach_box_".($count+1)."\"></div>";

$check_actions .= "\n\tcheckAction('action_{$count}');";

++$count;
}


				</tr>
</table>
</dd>
</dl>";

$form_container = new FormContainer();
$form_container->output_row("", "", "<span style=\"float: right;\"><a href=\"\" id=\"delete_img_{$count}\"><img src=\"styles/{$page->style}/images/icons/cross.png\" alt=\"{$lang->delete}\" title=\"{$lang->delete}\" /></a></span>{$lang->file} &nbsp;".$form->generate_text_box("attached_{$count}", $name, array('id' => "attached_{$count}", 'style' => 'width: 200px;')), "attached_{$count}");

$form_container->output_row("", "", $specific_file);

$specific_files .= "<div id=\"attached_form_{$count}\">".$form_container->end(true)."</div><div id=\"attach_box_".($count+1)."\"></div>";

$check_actions .= "\n\tcheckAction('action_{$count}');";

++$count;
}


		if($check_actions)
{
$global_checked[3] = "";

		if($check_actions)
{
$global_checked[3] = "";

Zeile 1864Zeile 1915
			$global_checked[1] = "";
}


			$global_checked[1] = "";
}


		$stylesheet['colors'] = array();
if($got_color == true && is_array($properties['colors']))

		if(!empty($stylesheet['colors']))


		{

		{

			// We might have colors here...
foreach($applied_to as $name => $actions)
{
if(strpos($name, ".php") !== false)
{
continue;
}

// Verify this is a color for this theme
if(array_key_exists($name, $properties['colors']))
{
$stylesheet['colors'][] = $name;
}
}

if(!empty($stylesheet['colors']))
{
$global_checked[3] = "checked=\"checked\"";
$global_checked[2] = "";
$global_checked[1] = "";
}

			$global_checked[3] = "checked=\"checked\"";
$global_checked[2] = "";
$global_checked[1] = "";



















		}
}


		}
}


Zeile 1961Zeile 1993

echo <<<EOF



echo <<<EOF


	<script type="text/javascript" src="./jscripts/theme_properties.js"></script>

	<script type="text/javascript" src="./jscripts/theme_properties.js?ver=1821"></script>

	<script type="text/javascript">
<!---
themeProperties.setup('{$count}');

	<script type="text/javascript">
<!---
themeProperties.setup('{$count}');

Zeile 1978Zeile 2010
if($mybb->input['action'] == "edit_stylesheet" && (!isset($mybb->input['mode']) || $mybb->input['mode'] == "simple"))
{
// Fetch the theme we want to edit this stylesheet in

if($mybb->input['action'] == "edit_stylesheet" && (!isset($mybb->input['mode']) || $mybb->input['mode'] == "simple"))
{
// Fetch the theme we want to edit this stylesheet in

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

Zeile 2048Zeile 2080
		// Now we have the new stylesheet, save it
$updated_stylesheet = array(
"cachefile" => $db->escape_string($stylesheet['name']),

		// Now we have the new stylesheet, save it
$updated_stylesheet = array(
"cachefile" => $db->escape_string($stylesheet['name']),

			"stylesheet" => $db->escape_string(unfix_css_urls($new_stylesheet)),

			"stylesheet" => $db->escape_string($new_stylesheet),

			"lastmodified" => TIME_NOW
);
$db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");

			"lastmodified" => TIME_NOW
);
$db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");

Zeile 2223Zeile 2255

$form->output_submit_wrapper($buttons);



$form->output_submit_wrapper($buttons);


	echo '<script type="text/javascript" src="./jscripts/themes.js"></script>';

	echo '<script type="text/javascript" src="./jscripts/themes.js?ver=1808"></script>';

	echo '<script type="text/javascript">


	echo '<script type="text/javascript">


$(document).ready(function() {

$(function() {

//<![CDATA[

//<![CDATA[

	new ThemeSelector("./index.php?module=style-themes&action=xmlhttp_stylesheet", "./index.php?module=style-themes&action=edit_stylesheet", $("#selector"), $("#stylesheet"), "'.htmlspecialchars_uni($mybb->input['file']).'", $("#selector_form"), "'.$mybb->input['tid'].'");

	ThemeSelector.init("./index.php?module=style-themes&action=xmlhttp_stylesheet", "./index.php?module=style-themes&action=edit_stylesheet", $("#selector"), $("#stylesheet"), "'.htmlspecialchars_uni($mybb->input['file']).'", $("#selector_form"), "'.$mybb->input['tid'].'");

	lang.saving = "'.$lang->saving.'";
});
//]]>
</script>';

	lang.saving = "'.$lang->saving.'";
});
//]]>
</script>';





	$form->end();

	$form->end();





	$page->output_footer();
}

	$page->output_footer();
}





if($mybb->input['action'] == "edit_stylesheet" && $mybb->input['mode'] == "advanced")

if($mybb->input['action'] == "edit_stylesheet" && $mybb->input['mode'] == "advanced")

{
// Fetch the theme we want to edit this stylesheet in
$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");
$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)
{
flash_message($lang->error_invalid_theme, 'error');
admin_redirect("index.php?module=style-themes");
}

$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced");

$parent_list = make_parent_theme_list($theme['tid']);
$parent_list = implode(',', $parent_list);

{
// Fetch the theme we want to edit this stylesheet in
$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");
$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)
{
flash_message($lang->error_invalid_theme, 'error');
admin_redirect("index.php?module=style-themes");
}

$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced");

$parent_list = make_parent_theme_list($theme['tid']);
$parent_list = implode(',', $parent_list);

	if(!$parent_list)
{
$parent_list = 1;

	if(!$parent_list)
{
$parent_list = 1;

	}

	}


$query = $db->simple_select("themestylesheets", "*", "name='".$db->escape_string($mybb->input['file'])."' AND tid IN ({$parent_list})", array('order_by' => 'tid', 'order_dir' => 'desc', 'limit' => 1));
$stylesheet = $db->fetch_array($query);


$query = $db->simple_select("themestylesheets", "*", "name='".$db->escape_string($mybb->input['file'])."' AND tid IN ({$parent_list})", array('order_by' => 'tid', 'order_dir' => 'desc', 'limit' => 1));
$stylesheet = $db->fetch_array($query);

Zeile 2278Zeile 2310
		if($theme['tid'] != $stylesheet['tid'])
{
$sid = copy_stylesheet_to_theme($stylesheet, $theme['tid']);

		if($theme['tid'] != $stylesheet['tid'])
{
$sid = copy_stylesheet_to_theme($stylesheet, $theme['tid']);

		}


		}


		// Now we have the new stylesheet, save it
$updated_stylesheet = array(
"cachefile" => $db->escape_string($stylesheet['name']),

		// Now we have the new stylesheet, save it
$updated_stylesheet = array(
"cachefile" => $db->escape_string($stylesheet['name']),

			"stylesheet" => $db->escape_string(unfix_css_urls($mybb->input['stylesheet'])),

			"stylesheet" => $db->escape_string($mybb->input['stylesheet']),

			"lastmodified" => TIME_NOW
);
$db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");

			"lastmodified" => TIME_NOW
);
$db->update_query("themestylesheets", $updated_stylesheet, "sid='{$sid}'");





		// Cache the stylesheet to the file
if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $mybb->input['stylesheet']))
{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}

		// Cache the stylesheet to the file
if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $mybb->input['stylesheet']))
{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}





		// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid']);

		// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid']);





		$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced_commit");

// Log admin action

		$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced_commit");

// Log admin action

Zeile 2305Zeile 2337
		flash_message($lang->success_stylesheet_updated, 'success');

if(!$mybb->input['save_close'])

		flash_message($lang->success_stylesheet_updated, 'success');

if(!$mybb->input['save_close'])

		{

		{

			admin_redirect("index.php?module=style-themes&action=edit_stylesheet&file=".htmlspecialchars_uni($stylesheet['name'])."&tid={$theme['tid']}&mode=advanced");
}
else

			admin_redirect("index.php?module=style-themes&action=edit_stylesheet&file=".htmlspecialchars_uni($stylesheet['name'])."&tid={$theme['tid']}&mode=advanced");
}
else

Zeile 2322Zeile 2354
	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css" rel="stylesheet">
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/lib/codemirror.js"></script>
<script src="./jscripts/codemirror/mode/css/css.js"></script>
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>
<script src="./jscripts/codemirror/addon/search/search.js"></script>

<link href="./jscripts/codemirror/lib/codemirror.css?ver=1813" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css?ver=1813" rel="stylesheet">
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css?ver=1813" rel="stylesheet">
<script src="./jscripts/codemirror/lib/codemirror.js?ver=1813"></script>
<script src="./jscripts/codemirror/mode/css/css.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/dialog/dialog.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/search/search.js?ver=1821"></script>

';
}


';
}


Zeile 2383Zeile 2415
	$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 = 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']));

	$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);


$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();

if($admin_options['codepress'] != 0)
{

	$form->end();

if($admin_options['codepress'] != 0)
{

		echo "<script type=\"text/javascript\">
var editor = CodeMirror.fromTextArea(document.getElementById(\"stylesheet\"), {

		echo '<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("stylesheet"), {

				lineNumbers: true,

				lineNumbers: true,

				tabMode: \"indent\",
theme: \"mybb\",
lineWrapping: true
});</script>";




				lineWrapping: true,
viewportMargin: Infinity,
indentWithTabs: true,
indentUnit: 4,
mode: "text/css",
theme: "mybb"
});</script>';

	}

$page->output_footer();

	}

$page->output_footer();

Zeile 2409Zeile 2444
if($mybb->input['action'] == "delete_stylesheet")
{
// Fetch the theme we want to edit this stylesheet in

if($mybb->input['action'] == "delete_stylesheet")
{
// Fetch the theme we want to edit this stylesheet in

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

Zeile 2447Zeile 2482
	{
$db->delete_query("themestylesheets", "sid='{$stylesheet['sid']}'", 1);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

	{
$db->delete_query("themestylesheets", "sid='{$stylesheet['sid']}'", 1);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

 

$filename_min = str_replace('.css', '.min.css', $stylesheet['cachefile']);
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$filename_min}");


// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid'], $theme, true);


// Update the CSS file list for this theme
update_theme_stylesheet_list($theme['tid'], $theme, true);

Zeile 2454Zeile 2492
		$plugins->run_hooks("admin_style_themes_delete_stylesheet_commit");

// Log admin action

		$plugins->run_hooks("admin_style_themes_delete_stylesheet_commit");

// Log admin action

		log_admin_action($stylesheet['sid'], $stylesheet['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));

		log_admin_action($stylesheet['sid'], $stylesheet['name'], $theme['tid'], $theme['name']);


flash_message($lang->success_stylesheet_deleted, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");


flash_message($lang->success_stylesheet_deleted, 'success');
admin_redirect("index.php?module=style-themes&action=edit&tid={$theme['tid']}");

Zeile 2468Zeile 2506
if($mybb->input['action'] == "add_stylesheet")
{
// Fetch the theme we want to edit this stylesheet in

if($mybb->input['action'] == "add_stylesheet")
{
// Fetch the theme we want to edit this stylesheet in

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

	$theme = $db->fetch_array($query);

if(!$theme['tid'] || $theme['tid'] == 1)

Zeile 2562Zeile 2600
			// Add Stylesheet
$insert_array = array(
'name' => $db->escape_string($mybb->input['name']),

			// Add Stylesheet
$insert_array = array(
'name' => $db->escape_string($mybb->input['name']),

				'tid' => $mybb->get_input('tid', 1),

				'tid' => $mybb->get_input('tid', MyBB::INPUT_INT),

				'attachedto' => implode('|', array_map(array($db, "escape_string"), $attached)),
'stylesheet' => $db->escape_string($stylesheet),
'cachefile' => $db->escape_string(str_replace('/', '', $mybb->input['name'])),

				'attachedto' => implode('|', array_map(array($db, "escape_string"), $attached)),
'stylesheet' => $db->escape_string($stylesheet),
'cachefile' => $db->escape_string(str_replace('/', '', $mybb->input['name'])),

Zeile 2582Zeile 2620
			$plugins->run_hooks("admin_style_themes_add_stylesheet_commit");

// Log admin action

			$plugins->run_hooks("admin_style_themes_add_stylesheet_commit");

// Log admin action

			log_admin_action($sid, $mybb->input['name'], $theme['tid'], htmlspecialchars_uni($theme['name']));

			log_admin_action($sid, $mybb->input['name'], $theme['tid'], $theme['name']);


flash_message($lang->success_stylesheet_added, 'success');
admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&sid={$sid}&file=".urlencode($mybb->input['name']));


flash_message($lang->success_stylesheet_added, 'success');
admin_redirect("index.php?module=style-themes&action=edit_stylesheet&tid={$mybb->input['tid']}&sid={$sid}&file=".urlencode($mybb->input['name']));

Zeile 2592Zeile 2630
	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

	if($admin_options['codepress'] != 0)
{
$page->extra_header .= '

<link href="./jscripts/codemirror/lib/codemirror.css" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css" rel="stylesheet">
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css" rel="stylesheet">
<script src="./jscripts/codemirror/lib/codemirror.js"></script>
<script src="./jscripts/codemirror/mode/css/css.js"></script>
<script src="./jscripts/codemirror/addon/dialog/dialog.js"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js"></script>
<script src="./jscripts/codemirror/addon/search/search.js"></script>

<link href="./jscripts/codemirror/lib/codemirror.css?ver=1813" rel="stylesheet">
<link href="./jscripts/codemirror/theme/mybb.css?ver=1813" rel="stylesheet">
<link href="./jscripts/codemirror/addon/dialog/dialog-mybb.css?ver=1813" rel="stylesheet">
<script src="./jscripts/codemirror/lib/codemirror.js?ver=1813"></script>
<script src="./jscripts/codemirror/mode/css/css.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/dialog/dialog.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/search/searchcursor.js?ver=1813"></script>
<script src="./jscripts/codemirror/addon/search/search.js?ver=1821"></script>

';
}


';
}


Zeile 2686Zeile 2724

foreach($mybb->input['applied_to'] as $name => $actions)
{


foreach($mybb->input['applied_to'] as $name => $actions)
{

			$short_name = substr($name, 0, -4);


 
			$action_list = "";
if($actions[0] != "global")
{

			$action_list = "";
if($actions[0] != "global")
{

Zeile 2818Zeile 2854

echo $form->generate_hidden_field("sid", $stylesheet['sid'])."<br />\n";



echo $form->generate_hidden_field("sid", $stylesheet['sid'])."<br />\n";


	$form_container = new FormContainer("{$lang->add_stylesheet_to} ".htmlspecialchars_uni($theme['name']));

	$form_container = new FormContainer($lang->add_stylesheet_to.' '.htmlspecialchars_uni($theme['name']), 'tfixed');

	$form_container->output_row($lang->file_name, $lang->file_name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name', 'style' => 'width: 200px;')), 'name');

$form_container->output_row($lang->attached_to, $lang->attached_to_desc, $actions);

	$form_container->output_row($lang->file_name, $lang->file_name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name', 'style' => 'width: 200px;')), 'name');

$form_container->output_row($lang->attached_to, $lang->attached_to_desc, $actions);

Zeile 2852Zeile 2888

if($admin_options['codepress'] != 0)
{


if($admin_options['codepress'] != 0)
{

		echo "<script type=\"text/javascript\">
var editor = CodeMirror.fromTextArea(document.getElementById(\"stylesheet\"), {

		echo '<script type="text/javascript">
var editor = CodeMirror.fromTextArea(document.getElementById("stylesheet"), {

				lineNumbers: true,

				lineNumbers: true,

				tabMode: \"indent\",
theme: \"mybb\",
lineWrapping: true
});</script>";




				lineWrapping: true,
viewportMargin: Infinity,
indentWithTabs: true,
indentUnit: 4,
mode: "text/css",
theme: "mybb"
});</script>';

	}


	}


	echo '<script type="text/javascript" src="./jscripts/themes.js"></script>';
echo '<script type="text/javascript" src="./jscripts/theme_properties.js"></script>';

	echo '<script type="text/javascript" src="./jscripts/themes.js?ver=1808"></script>';
echo '<script type="text/javascript" src="./jscripts/theme_properties.js?ver=1821"></script>';

	echo '<script type="text/javascript">
$(function() {
//<![CDATA[

	echo '<script type="text/javascript">
$(function() {
//<![CDATA[

Zeile 2875Zeile 2914
	$form->end();

$page->output_footer();

	$form->end();

$page->output_footer();

}

}


if($mybb->input['action'] == "set_default")
{


if($mybb->input['action'] == "set_default")
{

Zeile 2885Zeile 2924
		admin_redirect("index.php?module=style-themes");
}


		admin_redirect("index.php?module=style-themes");
}


	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist?

	$theme = $db->fetch_array($query);

// Does the theme not exist?

Zeile 2900Zeile 2939
	$cache->update('default_theme', $theme);

$db->update_query("themes", array('def' => 0));

	$cache->update('default_theme', $theme);

$db->update_query("themes", array('def' => 0));

	$db->update_query("themes", array('def' => 1), "tid='".$mybb->get_input('tid', 1)."'");

	$db->update_query("themes", array('def' => 1), "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");


$plugins->run_hooks("admin_style_themes_set_default_commit");

// Log admin action


$plugins->run_hooks("admin_style_themes_set_default_commit");

// Log admin action

	log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));

	log_admin_action($theme['tid'], $theme['name']);


flash_message($lang->success_theme_set_default, 'success');
admin_redirect("index.php?module=style-themes");


flash_message($lang->success_theme_set_default, 'success');
admin_redirect("index.php?module=style-themes");

Zeile 2913Zeile 2952

if($mybb->input['action'] == "force")
{


if($mybb->input['action'] == "force")
{

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', 1)."'");

	$query = $db->simple_select("themes", "*", "tid='".$mybb->get_input('tid', MyBB::INPUT_INT)."'");

	$theme = $db->fetch_array($query);

// Does the theme not exist?

	$theme = $db->fetch_array($query);

// Does the theme not exist?

Zeile 2936Zeile 2975
		$updated_users = array(
"style" => $theme['tid']
);

		$updated_users = array(
"style" => $theme['tid']
);

 

$plugins->run_hooks("admin_style_themes_force_commit");


$db->update_query("users", $updated_users);



$db->update_query("users", $updated_users);


		$plugins->run_hooks("admin_style_themes_force_commit");





		// The theme has to be accessible to all usergroups in order to force on all users
if($theme['allowedgroups'] !== "all")
{
$db->update_query("themes", array("allowedgroups" => "all"), "tid='{$theme['tid']}'");
}


// Log admin action


// Log admin action

		log_admin_action($theme['tid'], htmlspecialchars_uni($theme['name']));

		log_admin_action($theme['tid'], $theme['name']);


flash_message($lang->success_theme_forced, 'success');
admin_redirect("index.php?module=style-themes");


flash_message($lang->success_theme_forced, 'success');
admin_redirect("index.php?module=style-themes");