Vergleich admin/modules/style/themes.php - 1.8.3 - 1.8.27

  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 65Zeile 65
	$selector_list = get_selectors_as_options($css_array, $mybb->input['selector']);
$editable_selector = $css_array[$mybb->input['selector']];
$properties = parse_css_properties($editable_selector['values']);

	$selector_list = get_selectors_as_options($css_array, $mybb->input['selector']);
$editable_selector = $css_array[$mybb->input['selector']];
$properties = parse_css_properties($editable_selector['values']);

 

foreach(array('background', 'color', 'width', 'font-family', 'font-size', 'font-style', 'font-weight', 'text-decoration') as $_p)
{
if(!isset($properties[$_p]))
{
$properties[$_p] = '';
}
}


$form = new Form("index.php?module=style-themes&action=stylesheet_properties", "post", "selector_form", 0, "", true);
echo $form->generate_hidden_field("tid", $mybb->input['tid'], array('id' => "tid"))."\n";


$form = new Form("index.php?module=style-themes&action=stylesheet_properties", "post", "selector_form", 0, "", true);
echo $form->generate_hidden_field("tid", $mybb->input['tid'], array('id' => "tid"))."\n";

Zeile 145Zeile 153
	$page->output_nav_tabs($sub_tabs, 'browse_themes');

// Process search requests

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

// Process search requests

	require_once MYBB_ROOT."inc/class_xml.php";


 
	$keywords = "";

	$keywords = "";

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

	if(!empty($mybb->input['keywords']))
{

		$keywords = "&keywords=".urlencode($mybb->input['keywords']);
}

		$keywords = "&keywords=".urlencode($mybb->input['keywords']);
}


if($mybb->input['page'])
{
$url_page = "&page=".$mybb->get_input('page', 1);
}


if(!empty($mybb->input['page']))
{
$url_page = "&page=".$mybb->get_input('page', MyBB::INPUT_INT);
}

	else
{
$mybb->input['page'] = 1;
$url_page = "";

	else
{
$mybb->input['page'] = 1;
$url_page = "";

	}


	}


	// Gets the major version code. i.e. 1410 -> 1400 or 121 -> 1200
$major_version_code = round($mybb->version_code/100, 0)*100;
// Convert to mods site version codes
$search_version = ($major_version_code/100).'x';


	// Gets the major version code. i.e. 1410 -> 1400 or 121 -> 1200
$major_version_code = round($mybb->version_code/100, 0)*100;
// 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?api=2&type=themes&version={$search_version}{$keywords}{$url_page}");


	if(!$contents)

	if(!$contents)

	{
$page->output_inline_error($lang->error_communication_problem);
$page->output_footer();

	{
$page->output_inline_error($lang->error_communication_problem);
$page->output_footer();

		exit;
}


		exit;
}


Zeile 181Zeile 187
	$table->construct_header($lang->themes, array('colspan' => 2));
$table->construct_header($lang->controls, array("class" => "align_center", 'width' => 125));


	$table->construct_header($lang->themes, array('colspan' => 2));
$table->construct_header($lang->controls, array("class" => "align_center", 'width' => 125));


	$parser = new XMLParser($contents);

	$parser = create_xml_parser($contents);

	$tree = $parser->get_tree();

if(!is_array($tree) || !isset($tree['results']))

	$tree = $parser->get_tree();

if(!is_array($tree) || !isset($tree['results']))

Zeile 198Zeile 204
			$only_theme = $tree['results']['result'];
unset($tree['results']['result']);
$tree['results']['result'][0] = $only_theme;

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

		}


		}


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


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


Zeile 208Zeile 214
			$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['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['author']['url']['value'] = htmlspecialchars_uni($result['author']['url']['value']);
$result['author']['name']['value'] = htmlspecialchars_uni($result['author']['name']['value']);



			$result['download_url']['value'] = htmlspecialchars_uni(html_entity_decode($result['download_url']['value']));


			$result['download_url']['value'] = htmlspecialchars_uni(html_entity_decode($result['download_url']['value']));


			$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));
$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("<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} <a href=\"{$result['author']['url']['value']}\" target=\"_blank\" rel=\"noopener\">{$result['author']['name']['value']}</a></small></i>");
$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();
}

	}


	}


	if($table->num_rows() == 0)
{
$table->construct_cell($lang->error_no_results_found, array("colspan" => 3));
$table->construct_row();

	if($table->num_rows() == 0)
{
$table->construct_cell($lang->error_no_results_found, array("colspan" => 3));
$table->construct_row();

	}

	}


$search = new Form("index.php?module=style-themes&amp;action=browse", 'post', 'search_form');
echo "<div style=\"padding-bottom: 3px; margin-top: -9px; text-align: right;\">";


$search = new Form("index.php?module=style-themes&amp;action=browse", 'post', 'search_form');
echo "<div style=\"padding-bottom: 3px; margin-top: -9px; text-align: right;\">";

	if($mybb->input['keywords'])

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

	{
$default_class = '';
$value = htmlspecialchars_uni($mybb->input['keywords']);

	{
$default_class = '';
$value = htmlspecialchars_uni($mybb->input['keywords']);

Zeile 243Zeile 247
	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;

				return false;

			}
});

			}
});


var search = $('#search_keywords');


var search = $('#search_keywords');

		search.focus(function()

		search.on('focus', function()

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

		{
var search_focus = $(this);
if(search_focus.val() == '{$lang->search_for_themes}')
{
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 285Zeile 287

// 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://community.mybb.com/mods.php?action=browse&category=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://community.mybb.com/mods.php?action=browse&category=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));
}

if(!empty($tree['results']['attributes']['total']))
{
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}");

 

$page->output_footer();
}


$page->output_footer();
}

Zeile 379Zeile 384
				$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);

if($theme_id > -1)

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

if($theme_id > -1)

				{

				{

					$plugins->run_hooks("admin_style_themes_import_commit");

// Log admin action

					$plugins->run_hooks("admin_style_themes_import_commit");

// Log admin action

Zeile 414Zeile 419
				}
}
}

				}
}
}

	}


	}


	$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 425Zeile 430
	$page->add_breadcrumb_item($lang->import_a_theme, "index.php?module=style-themes&amp;action=import");

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

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

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


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

if($errors)


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

if($errors)

	{
$page->output_inline_error($errors);


	{
$page->output_inline_error($errors);


Zeile 489Zeile 494
		<dd style="margin-top: 0; margin-bottom: 0; width: 100%;" id="import_1" class="imports">
<table cellpadding="4">
<tr>

		<dd style="margin-top: 0; margin-bottom: 0; width: 100%;" id="import_1" class="imports">
<table cellpadding="4">
<tr>

					<td>'.$form->generate_text_box("url", $mybb->input['file']).'</td>

					<td>'.$form->generate_text_box("url", $mybb->get_input('file')).'</td>

				</tr>
</table></dd>
</dl>

				</tr>
</table></dd>
</dl>

Zeile 499Zeile 504

$form_container = new FormContainer($lang->import_a_theme);
$form_container->output_row($lang->import_from, $lang->import_from_desc, $actions, 'file');


$form_container = new FormContainer($lang->import_a_theme);
$form_container->output_row($lang->import_from, $lang->import_from_desc, $actions, 'file');

	$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->output_row($lang->new_name, $lang->new_name_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->advanced_options, "", $form->generate_check_box('version_compat', '1', $lang->ignore_version_compatibility, array('checked' => $mybb->input['version_compat'], 'id' => 'version_compat'))."<br /><small>{$lang->ignore_version_compat_desc}</small><br />".$form->generate_check_box('import_stylesheets', '1', $lang->import_stylesheets, array('checked' => $mybb->input['import_stylesheets'], 'id' => 'import_stylesheets'))."<br /><small>{$lang->import_stylesheets_desc}</small><br />".$form->generate_check_box('import_templates', '1', $lang->import_templates, array('checked' => $mybb->input['import_templates'], 'id' => 'import_templates'))."<br /><small>{$lang->import_templates_desc}</small>");

$form_container->end();

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

$form->output_submit_wrapper($buttons);


	$form_container->output_row($lang->parent_theme, $lang->parent_theme_desc, $form->generate_select_box('tid', $themes, $mybb->get_input('tid'), array('id' => 'tid')), 'tid');
$form_container->output_row($lang->new_name, $lang->new_name_desc, $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
$form_container->output_row($lang->advanced_options, "", $form->generate_check_box('version_compat', '1', $lang->ignore_version_compatibility, array('checked' => $mybb->get_input('version_compat'), 'id' => 'version_compat'))."<br /><small>{$lang->ignore_version_compat_desc}</small><br />".$form->generate_check_box('import_stylesheets', '1', $lang->import_stylesheets, array('checked' => $mybb->get_input('import_stylesheets'), 'id' => 'import_stylesheets'))."<br /><small>{$lang->import_stylesheets_desc}</small><br />".$form->generate_check_box('import_templates', '1', $lang->import_templates, array('checked' => $mybb->get_input('import_templates'), 'id' => 'import_templates'))."<br /><small>{$lang->import_templates_desc}</small>");

$form_container->end();

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

$form->output_submit_wrapper($buttons);


	$form->end();

$page->output_footer();
}

	$form->end();

$page->output_footer();
}





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?

	if(!$theme['tid'])

	if(empty($theme['tid']))

	{
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 541Zeile 546

if(is_array($value))
{


if(is_array($value))
{

				$value = serialize($value);

				$value = my_serialize($value);

			}

			}





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

$xml .= "\t\t<{$property}><![CDATA[{$value}]]></{$property}>\r\n";

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

$xml .= "\t\t<{$property}><![CDATA[{$value}]]></{$property}>\r\n";

		}

		}

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

// Fetch list of all of the stylesheets for this theme

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

// Fetch list of all of the stylesheets for this theme

Zeile 555Zeile 560

$stylesheets = array();
$inherited_load = array();


$stylesheets = array();
$inherited_load = array();





		// Now we loop through the list of stylesheets for each file
foreach($file_stylesheets as $file => $action_stylesheet)
{

		// Now we loop through the list of stylesheets for each file
foreach($file_stylesheets as $file => $action_stylesheet)
{

Zeile 563Zeile 568
			{
continue;
}

			{
continue;
}





			foreach($action_stylesheet as $action => $style)
{
foreach($style as $stylesheet)
{
$stylesheets[$stylesheet]['applied_to'][$file][] = $action;

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





$array = &$file_stylesheets['inherited'][$file."_".$action];

if(is_array($array) && array_key_exists($stylesheet, $array))

					{
$stylesheets[$stylesheet]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)

					{
$stylesheets[$stylesheet]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)

Zeile 584Zeile 592
		$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 592Zeile 600
			{
$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']])
{

			{
if(empty($theme_stylesheets[$theme_stylesheet['cachefile']]))
{

					$theme_stylesheets[$theme_stylesheet['cachefile']] = $theme_stylesheet;
$theme_stylesheets[$theme_stylesheet['sid']] = $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 614Zeile 617
		{
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']];

			}

			}

			else
{
$filename = basename($filename);

			else
{
$filename = basename($filename);

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

 




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


















				if(isset($theme_stylesheets[$filename]['sid']))
{
$style['sid'] = $theme_stylesheets[$filename]['sid'];
}
else
{
$style['sid'] = null;
}
}

if(isset($theme_stylesheets[$filename]['tid']))
{
$style['tid'] = $theme_stylesheets[$filename]['tid'];
}
else
{
$style['tid'] = null;
}


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


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

			}

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

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

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

}




			}

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

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

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

if($mybb->input['include_templates'] != 0)
{
$xml .= "\t<templates>\r\n";

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

if($mybb->input['include_templates'] != 0)
{
$xml .= "\t<templates>\r\n";

			$query = $db->simple_select("templates", "*", "sid='".$properties['templateset']."'");

			$query = $db->simple_select("templates", "*", "sid='".(int)$properties['templateset']."'");

			while($template = $db->fetch_array($query))
{
$template['template'] = str_replace(']]>', ']]]]><![CDATA[>', $template['template']);

			while($template = $db->fetch_array($query))
{
$template['template'] = str_replace(']]>', ']]]]><![CDATA[>', $template['template']);

Zeile 663Zeile 684
			$xml .= "\t</templates>\r\n";
}
$xml .= "</theme>";

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





		$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 677Zeile 698
		header("Expires: 0");
echo $xml;
exit;

		header("Expires: 0");
echo $xml;
exit;

	}

	}


$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");



$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");


Zeile 718Zeile 739
	echo $form->generate_hidden_field("tid", $theme['tid']);

$form_container = new FormContainer($lang->export_theme.": ".htmlspecialchars_uni($theme['name']));

	echo $form->generate_hidden_field("tid", $theme['tid']);

$form_container = new FormContainer($lang->export_theme.": ".htmlspecialchars_uni($theme['name']));

	$form_container->output_row($lang->include_custom_only, $lang->include_custom_only_desc, $form->generate_yes_no_radio('custom_theme', $mybb->input['custom_theme']), 'custom_theme');
$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->output_row($lang->include_custom_only, $lang->include_custom_only_desc, $form->generate_yes_no_radio('custom_theme', $mybb->get_input('custom_theme')), 'custom_theme');
$form_container->output_row($lang->include_templates, $lang->include_templates_desc, $form->generate_yes_no_radio('include_templates', $mybb->get_input('include_templates')), 'include_templates');


$form_container->end();



$form_container->end();


Zeile 734Zeile 755

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 756Zeile 777
		{
$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 766Zeile 787
		if(!$errors)
{
$properties = my_unserialize($theme['properties']);

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

			$sid = $properties['sid'];

			$sid = (int)$properties['templateset'];

			$nprops = null;

			$nprops = null;

			if($mybb->input['duplicate_templates'])

			if($mybb->get_input('duplicate_templates'))

			{

			{

				$nsid = $db->insert_query("templatesets", array('title' => $db->escape_string($mybb->input['name'])." Templates"));

				$nsid = $db->insert_query("templatesets", array('title' => $db->escape_string($mybb->get_input('name'))." Templates"));


// Copy all old Templates to our new templateset
$query = $db->simple_select("templates", "*", "sid='{$sid}'");


// Copy all old Templates to our new templateset
$query = $db->simple_select("templates", "*", "sid='{$sid}'");

Zeile 802Zeile 823
					}

$nprops[$property] = $value;

					}

$nprops[$property] = $value;

					if($properties['inherited'][$property])

					if(!empty($properties['inherited'][$property]))

					{
$nprops['inherited'][$property] = $properties['inherited'][$property];
}

					{
$nprops['inherited'][$property] = $properties['inherited'][$property];
}

Zeile 813Zeile 834
				}
$nprops['templateset'] = $nsid;
}

				}
$nprops['templateset'] = $nsid;
}

			$tid = build_new_theme($mybb->input['name'], $nprops, $theme['tid']);

			$tid = build_new_theme($mybb->get_input('name'), $nprops, $theme['tid']);


update_theme_stylesheet_list($tid);



update_theme_stylesheet_list($tid);


Zeile 827Zeile 848
		}
}


		}
}


	$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");


	$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->get_input('tid')}");


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

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





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

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

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

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

		'link' => "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}",
);


		'link' => "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->get_input('tid')}",
);


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

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

		'link' => "index.php?module=style-themes&amp;action=add_stylesheet&amp;tid={$mybb->input['tid']}",
);

		'link' => "index.php?module=style-themes&amp;action=add_stylesheet&amp;tid={$mybb->get_input('tid')}",
);


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


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

		'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->input['tid']}",

		'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->get_input('tid')}",

		'description' => $lang->export_theme_desc

		'description' => $lang->export_theme_desc

	);


	);


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

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

		'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->input['tid']}",

		'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->get_input('tid')}",

		'description' => $lang->duplicate_theme_desc
);

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

		'description' => $lang->duplicate_theme_desc
);

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


if($errors)


if($errors)

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

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

Zeile 865Zeile 886
	{
$mybb->input['duplicate_templates'] = true;
}

	{
$mybb->input['duplicate_templates'] = true;
}





	$form = new Form("index.php?module=style-themes&amp;action=duplicate&amp;tid={$theme['tid']}", "post");

$form_container = new FormContainer($lang->duplicate_theme);

	$form = new Form("index.php?module=style-themes&amp;action=duplicate&amp;tid={$theme['tid']}", "post");

$form_container = new FormContainer($lang->duplicate_theme);

	$form_container->output_row($lang->new_name, $lang->new_name_duplicate_desc, $form->generate_text_box('name', $mybb->input['name'], array('id' => 'name')), 'name');
$form_container->output_row($lang->advanced_options, "", $form->generate_check_box('duplicate_templates', '1', $lang->duplicate_templates, array('checked' => $mybb->input['duplicate_templates'], 'id' => 'duplicate_templates'))."<br /><small>{$lang->duplicate_templates_desc}</small>");


	$form_container->output_row($lang->new_name, $lang->new_name_duplicate_desc, $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
$form_container->output_row($lang->advanced_options, "", $form->generate_check_box('duplicate_templates', '1', $lang->duplicate_templates, array('checked' => $mybb->get_input('duplicate_templates'), 'id' => 'duplicate_templates'))."<br /><small>{$lang->duplicate_templates_desc}</small>");


	$form_container->end();

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

	$form_container->end();

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

Zeile 882Zeile 903

$page->output_footer();
}


$page->output_footer();
}





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

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

	{

	{

		$themes[$theme['tid']] = $theme['name'];
}


		$themes[$theme['tid']] = $theme['name'];
}


Zeile 909Zeile 930
			$tid = build_new_theme($mybb->input['name'], null, $mybb->input['tid']);

$plugins->run_hooks("admin_style_themes_add_commit");

			$tid = build_new_theme($mybb->input['name'], null, $mybb->input['tid']);

$plugins->run_hooks("admin_style_themes_add_commit");





			// Log admin action

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

Zeile 921Zeile 942
	$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->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_nav_tabs($sub_tabs, 'create_theme');

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

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

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





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

$form_container = new FormContainer($lang->create_a_theme);

	$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->output_row($lang->name, $lang->name_desc, $form->generate_text_box('name', $mybb->get_input('name'), array('id' => 'name')), 'name');
$form_container->output_row($lang->parent_theme, $lang->parent_theme_desc, $form->generate_select_box('tid', $themes, $mybb->get_input('tid'), array('id' => 'tid')), 'tid');


$form_container->end();



$form_container->end();


Zeile 948Zeile 969

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

	{
flash_message($lang->error_invalid_theme, 'error');

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

// User clicked no

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

// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

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

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

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


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


			if(!$theme2['stylesheets']['inherited'])

			if(empty($theme2['stylesheets']['inherited']))

			{
continue;
}

			{
continue;
}

Zeile 1010Zeile 1031
		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}");
}

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

		}

		}

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

 

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



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


Zeile 1020Zeile 1049

$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']}/");

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

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

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
















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

$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


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


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

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

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

	}
else
{

	}
else
{

Zeile 1045Zeile 1089

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


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?

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

	if(empty($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");
}





	$plugins->run_hooks("admin_style_themes_edit");

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

	$plugins->run_hooks("admin_style_themes_edit");

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

			'templateset' => (int)$mybb->input['templateset'],
'editortheme' => $mybb->input['editortheme'],
'imgdir' => $mybb->input['imgdir'],
'logo' => $mybb->input['logo'],
'tablespace' => (int)$mybb->input['tablespace'],
'borderwidth' => (int)$mybb->input['borderwidth'],
'color' => $mybb->input['color']

			'templateset' => $mybb->get_input('templateset', MyBB::INPUT_INT),
'editortheme' => $mybb->get_input('editortheme'),
'imgdir' => $mybb->get_input('imgdir'),
'logo' => $mybb->get_input('logo'),
'tablespace' => $mybb->get_input('tablespace', MyBB::INPUT_INT),
'borderwidth' => $mybb->get_input('borderwidth', MyBB::INPUT_INT),
'color' => $mybb->get_input('color')

		);

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

		);

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

		}


		}


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

foreach($colors as $color)
{

		if($mybb->input['colors'])
{
$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('(^((\p{L}|\p{Nd}|_)+)={1}((\p{L}|\p{Nd}|_)+)$)u', $color))
{
$color = explode("=", $color);
$properties['colors'][$color[0]] = $color[1];
}
else
{
$errors[] = $lang->sprintf($lang->error_invalid_color, $color);
}

			}
}


			}
}


Zeile 1092Zeile 1143
		}

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

		}

$allowedgroups = array();

Zeile 1118Zeile 1173

$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

		// Perform validation

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

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

Zeile 1150Zeile 1205
		}
if($properties['templateset'])
{

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

			$query = $db->simple_select("templatesets", "sid", "sid='".$properties['templateset']."'");

			$query = $db->simple_select("templatesets", "sid", "sid='".(int)$properties['templateset']."'");

			$ts_check = $db->fetch_field($query, "sid");
if(!$ts_check)
{

			$ts_check = $db->fetch_field($query, "sid");
if(!$ts_check)
{

Zeile 1161Zeile 1216
		{
$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;
}

Zeile 1171Zeile 1226
			$plugins->run_hooks("admin_style_themes_edit_commit");

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

			$plugins->run_hooks("admin_style_themes_edit_commit");

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

 
			update_theme_stylesheet_list($theme['tid']);


if($theme['def'] == 1)
{


if($theme['def'] == 1)
{

Zeile 1178Zeile 1234
			}

// 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 1204Zeile 1260
			foreach($style as $stylesheet)
{
$stylesheets[$stylesheet]['applied_to'][$file][] = $action;

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

				if(isset($file_stylesheets['inherited'][$file."_".$action]) && is_array($file_stylesheets['inherited'][$file."_".$action]) && in_array($stylesheet, array_keys($file_stylesheets['inherited'][$file."_".$action])))

				{
$stylesheets[$stylesheet]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)

				{
$stylesheets[$stylesheet]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)

Zeile 1219Zeile 1275
	$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 1227Zeile 1283
		{
$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", "*", "", 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 1249Zeile 1300
	if($mybb->request_method == "post" && $mybb->input['do'] == "save_orders")
{
if(!is_array($mybb->input['disporder']))

	if($mybb->request_method == "post" && $mybb->input['do'] == "save_orders")
{
if(!is_array($mybb->input['disporder']))

		{

		{

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

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

		}


		}


		$orders = array();
foreach($theme_stylesheets as $stylesheet => $properties)
{

		$orders = array();
foreach($theme_stylesheets as $stylesheet => $properties)
{

Zeile 1263Zeile 1314
				$order = (int)$mybb->input['disporder'][$properties['sid']];

$orders[$properties['name']] = $order;

				$order = (int)$mybb->input['disporder'][$properties['sid']];

$orders[$properties['name']] = $order;

			}
}

asort($orders, SORT_NUMERIC);


			}
}

asort($orders, SORT_NUMERIC);


		// Save the orders in the theme properties
$properties = my_unserialize($theme['properties']);
$properties['disporder'] = $orders;

$update_array = array(

		// Save the orders in the theme properties
$properties = my_unserialize($theme['properties']);
$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']}'");





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

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


// normalize for consistency


// Normalize for consistency

		update_theme_stylesheet_list($theme['tid'], false, true);

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

		update_theme_stylesheet_list($theme['tid'], false, true);

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

Zeile 1291Zeile 1342
	}

$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");

	}

$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");





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

$sub_tabs['edit_stylesheets'] = array(

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

$sub_tabs['edit_stylesheets'] = array(

Zeile 1303Zeile 1354
	$sub_tabs['add_stylesheet'] = array(
'title' => $lang->add_stylesheet,
'link' => "index.php?module=style-themes&amp;action=add_stylesheet&amp;tid={$mybb->input['tid']}",

	$sub_tabs['add_stylesheet'] = array(
'title' => $lang->add_stylesheet,
'link' => "index.php?module=style-themes&amp;action=add_stylesheet&amp;tid={$mybb->input['tid']}",

	);


	);


	$sub_tabs['export_theme'] = array(
'title' => $lang->export_theme,
'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->input['tid']}"

	$sub_tabs['export_theme'] = array(
'title' => $lang->export_theme,
'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->input['tid']}"

	);


	);


	$sub_tabs['duplicate_theme'] = array(
'title' => $lang->duplicate_theme,
'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->input['tid']}",

	$sub_tabs['duplicate_theme'] = array(
'title' => $lang->duplicate_theme,
'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->input['tid']}",

Zeile 1318Zeile 1369

$properties = my_unserialize($theme['properties']);
$page->output_nav_tabs($sub_tabs, 'edit_stylesheets');


$properties = my_unserialize($theme['properties']);
$page->output_nav_tabs($sub_tabs, 'edit_stylesheets');





	$table = new Table;
$table->construct_header($lang->stylesheets);
$table->construct_header($lang->display_order, array("class" => "align_center", "width" => 50));

	$table = new Table;
$table->construct_header($lang->stylesheets);
$table->construct_header($lang->display_order, array("class" => "align_center", "width" => 50));

Zeile 1338Zeile 1389
		{
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']];

			}

			}


if(basename($filename) != $style_name)
{


if(basename($filename) != $style_name)
{

Zeile 1355Zeile 1406
	{
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 1371Zeile 1422

$inherited = "";
$inherited_ary = array();


$inherited = "";
$inherited_ary = array();

		if(is_array($style['inherited']))

		if(isset($style['inherited']) && is_array($style['inherited']))

		{
foreach($style['inherited'] as $tid)
{

		{
foreach($style['inherited'] as $tid)
{

Zeile 1412Zeile 1463
			$count = 0;
$sep = " ";
$name = "";

			$count = 0;
$sep = " ";
$name = "";





			$colors = array();

			$colors = array();


if(!is_array($properties['colors']))
{


if(!isset($properties['colors']) || !is_array($properties['colors']))
{

				$properties['colors'] = array();
}

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

				$properties['colors'] = array();
}

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

				{
continue;

				{
continue;

				}

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

				}

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

				}


				}


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

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

Zeile 1440Zeile 1491

// It's a file:
++$count;


// It's a file:
++$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 1480Zeile 1535
				}

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

				}

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

			}


			}


			if($attached_to == '')
{
// Orphaned! :(

			if($attached_to == '')
{
// Orphaned! :(

Zeile 1504Zeile 1559
		}

$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_numeric_field("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 1518Zeile 1573
	echo '<br />';

// Theme Properties table

	echo '<br />';

// Theme Properties table

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

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


$form = new Form("index.php?module=style-themes&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field("tid", $theme['tid']);


$form = new Form("index.php?module=style-themes&amp;action=edit", "post", "edit");
echo $form->generate_hidden_field("tid", $theme['tid']);

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

	$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 1566Zeile 1621

$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->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_numeric_field('tablespace', $properties['tablespace'], array('id' => 'tablespace')), 'tablespace');
$form_container->output_row($lang->inner_border, $lang->inner_border_desc, $form->generate_numeric_field('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 1582Zeile 1637
		$colors = array('none' => $lang->colors_please_select);
$colors = array_merge($colors, $properties['colors']);


		$colors = array('none' => $lang->colors_please_select);
$colors = array_merge($colors, $properties['colors']);


 
		if(!isset($properties['color']))
{
$properties['color'] = 'none';
}

		$color_setting = $form->generate_select_box('color', $colors, $properties['color'], array('class' => "select\" style=\"width: 200px;"));

$mybb->input['colors'] = '';

		$color_setting = $form->generate_select_box('color', $colors, $properties['color'], array('class' => "select\" style=\"width: 200px;"));

$mybb->input['colors'] = '';

Zeile 1597Zeile 1656
	}

$form_container->output_row($lang->colors_setting, $lang->colors_setting_desc, $color_setting, 'color');

	}

$form_container->output_row($lang->colors_setting, $lang->colors_setting_desc, $color_setting, 'color');

	$form_container->output_row($lang->colors_add, $lang->colors_add_desc, $form->generate_text_area('colors', $mybb->input['colors'], array('style' => 'width: 200px;', 'rows' => '5')));

	$form_container->output_row($lang->colors_add, $lang->colors_add_desc, $form->generate_text_area('colors', $mybb->get_input('colors'), array('style' => 'width: 200px;', 'rows' => '5')));


$form_container->end();



$form_container->end();


Zeile 1612Zeile 1671
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 1664Zeile 1723
		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 1738Zeile 1800
				$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);

				{
$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']}");

				@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 1751Zeile 1816
			$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']}");

Zeile 1817Zeile 1882

$specific_files = "<div id=\"attach_1\" class=\"attachs\">";
$count = 0;


$specific_files = "<div id=\"attach_1\" class=\"attachs\">";
$count = 0;

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

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

	{
$check_actions = "";
$stylesheet['colors'] = array();

	{
$check_actions = "";
$stylesheet['colors'] = array();

Zeile 1867Zeile 1932
			<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>";

				</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 = 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}");

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

++$count;

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

++$count;

		}


		}


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

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

Zeile 1903Zeile 1968

// Colors
$specific_colors = $specific_colors_option = '';


// Colors
$specific_colors = $specific_colors_option = '';





	if(is_array($properties['colors']))
{
$specific_colors = "<div id=\"attach_2\" class=\"attachs\">";

	if(is_array($properties['colors']))
{
$specific_colors = "<div id=\"attach_2\" class=\"attachs\">";

Zeile 1969Zeile 2034

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 1986Zeile 2051
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);


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


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

	if(empty($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 2056Zeile 2121
		// 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 2065Zeile 2130
		if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $new_stylesheet))
{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);

		if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $new_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']);


Zeile 2104Zeile 2169
	}

$css_array = css_to_array($stylesheet['stylesheet']);

	}

$css_array = css_to_array($stylesheet['stylesheet']);

	$selector_list = get_selectors_as_options($css_array, $mybb->input['selector']);

	$selector_list = get_selectors_as_options($css_array, $mybb->get_input('selector'));


// Do we not have any selectors? Send em to the full edit page
if(!$selector_list)


// Do we not have any selectors? Send em to the full edit page
if(!$selector_list)

Zeile 2123Zeile 2188
	<script type=\"text/javascript\">
var my_post_key = '".$mybb->post_code."';
</script>";

	<script type=\"text/javascript\">
var my_post_key = '".$mybb->post_code."';
</script>";





	$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");
$page->add_breadcrumb_item("{$lang->editing} ".htmlspecialchars_uni($stylesheet['name']), "index.php?module=style-themes&amp;action=edit_stylesheet&amp;tid={$mybb->input['tid']}&amp;file=".htmlspecialchars_uni($mybb->input['file'])."&amp;mode=simple");

	$page->add_breadcrumb_item(htmlspecialchars_uni($theme['name']), "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}");
$page->add_breadcrumb_item("{$lang->editing} ".htmlspecialchars_uni($stylesheet['name']), "index.php?module=style-themes&amp;action=edit_stylesheet&amp;tid={$mybb->input['tid']}&amp;file=".htmlspecialchars_uni($mybb->input['file'])."&amp;mode=simple");





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

// If the stylesheet and theme do not match, we must be editing something that is inherited

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

// If the stylesheet and theme do not match, we must be editing something that is inherited

	if($this_stylesheet['inherited'][$stylesheet['name']])

	if(!empty($this_stylesheet['inherited'][$stylesheet['name']]))

	{
$query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
$stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));

	{
$query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
$stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));

Zeile 2171Zeile 2236
	$form->end();

// Haven't chosen a selector to edit, show the first one from the stylesheet

	$form->end();

// Haven't chosen a selector to edit, show the first one from the stylesheet

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

	if(!$mybb->get_input('selector'))

	{
reset($css_array);
uasort($css_array, "css_selectors_sort_cmp");

	{
reset($css_array);
uasort($css_array, "css_selectors_sort_cmp");

Zeile 2231Zeile 2296

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

// Does the theme not exist?
if(!$stylesheet['sid'])
{
flash_message($lang->error_invalid_stylesheet, 'error');
admin_redirect("index.php?module=style-themes");
}


{
// 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(empty($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;
}

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

// Does the theme not exist?
if($db->num_rows($query) == 0)
{
flash_message($lang->error_invalid_stylesheet, 'error');
admin_redirect("index.php?module=style-themes");
}


	if($mybb->request_method == "post")
{
$sid = $stylesheet['sid'];

	if($mybb->request_method == "post")
{
$sid = $stylesheet['sid'];

Zeile 2286Zeile 2351
		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}'");

// Cache the stylesheet to the file
if(!cache_stylesheet($theme['tid'], $stylesheet['name'], $mybb->input['stylesheet']))

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


			$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}


Zeile 2312Zeile 2377

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



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


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

		if(!$mybb->get_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&tid={$theme['tid']}");

		{
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&tid={$theme['tid']}");

		}

		}

	}

// Fetch list of all of the stylesheets for this theme

	}

// Fetch list of all of the stylesheets for this theme

Zeile 2330Zeile 2395
	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 2347Zeile 2412
	$page->output_header("{$lang->themes} - {$lang->edit_stylesheet_advanced_mode}");

// If the stylesheet and theme do not match, we must be editing something that is inherited

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

// If the stylesheet and theme do not match, we must be editing something that is inherited

	if($this_stylesheet['inherited'][$stylesheet['name']])

	if(!empty($this_stylesheet['inherited']) && $this_stylesheet['inherited'][$stylesheet['name']])

	{
$query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
$stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));

	{
$query = $db->simple_select("themes", "name", "tid='{$stylesheet['tid']}'");
$stylesheet_parent = htmlspecialchars_uni($db->fetch_field($query, 'name'));

Zeile 2391Zeile 2456
	$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'));


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

Zeile 2402Zeile 2467

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

	}

$page->output_footer();
}

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

	}

$page->output_footer();
}

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

{

{

	// Fetch the theme we want to edit this stylesheet in

	// 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)
{
flash_message($lang->error_invalid_theme, 'error');

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


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


	$plugins->run_hooks("admin_style_themes_delete_stylesheet");

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

	$plugins->run_hooks("admin_style_themes_delete_stylesheet");

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

Zeile 2433Zeile 2501
	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 2442Zeile 2510
	if(!$stylesheet['sid'] || $stylesheet['tid'] == 1)
{
flash_message($lang->error_invalid_stylesheet, 'error');

	if(!$stylesheet['sid'] || $stylesheet['tid'] == 1)
{
flash_message($lang->error_invalid_stylesheet, 'error');

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


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


	// User clicked no

	// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

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

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





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

	if($mybb->request_method == "post")
{
$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 2462Zeile 2533
		$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 2476Zeile 2547
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);


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


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

	if(empty($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 2539Zeile 2610
						// We have a custom attached file
$attached_id = (int)str_replace('attached_', '', $id);
$attached_to = $value;

						// We have a custom attached file
$attached_id = (int)str_replace('attached_', '', $id);
$attached_to = $value;





						if($mybb->input['action_'.$attached_id] == 1)
{
// We have custom actions for attached files
$actions_list = $mybb->input['action_list_'.$attached_id];

						if($mybb->input['action_'.$attached_id] == 1)
{
// We have custom actions for attached files
$actions_list = $mybb->input['action_list_'.$attached_id];

						}

						}


if($actions_list)
{


if($actions_list)
{

Zeile 2553Zeile 2624

$attached[] = $attached_to;
}


$attached[] = $attached_to;
}

				}
}

				}
}

			else if($mybb->input['attach'] == 2)
{
if(!is_array($mybb->input['color']))

			else if($mybb->input['attach'] == 2)
{
if(!is_array($mybb->input['color']))

Zeile 2570Zeile 2641
			// 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 2580Zeile 2651
			$sid = $db->insert_query("themestylesheets", $insert_array);

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

			$sid = $db->insert_query("themestylesheets", $insert_array);

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

			{

			{

				$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}


				$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$sid}"), "sid='{$sid}'", 1);
}


Zeile 2590Zeile 2661
			$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']));
}

	}


	}


	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 2620Zeile 2691
	$sub_tabs['edit_stylesheets'] = array(
'title' => $lang->edit_stylesheets,
'link' => "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}"

	$sub_tabs['edit_stylesheets'] = array(
'title' => $lang->edit_stylesheets,
'link' => "index.php?module=style-themes&amp;action=edit&amp;tid={$mybb->input['tid']}"

	);

	);


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


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

Zeile 2631Zeile 2702
	$sub_tabs['export_theme'] = array(
'title' => $lang->export_theme,
'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->input['tid']}"

	$sub_tabs['export_theme'] = array(
'title' => $lang->export_theme,
'link' => "index.php?module=style-themes&amp;action=export&amp;tid={$mybb->input['tid']}"

	);


	);


	$sub_tabs['duplicate_theme'] = array(
'title' => $lang->duplicate_theme,
'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->input['tid']}",
'description' => $lang->duplicate_theme_desc
);

	$sub_tabs['duplicate_theme'] = array(
'title' => $lang->duplicate_theme,
'link' => "index.php?module=style-themes&amp;action=duplicate&amp;tid={$mybb->input['tid']}",
'description' => $lang->duplicate_theme_desc
);





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

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

 

$add_checked = array();


if($errors)
{


if($errors)
{

Zeile 2653Zeile 2726
				$id = (int)$id;

$mybb->input['applied_to'][$value] = array(0 => 'global');

				$id = (int)$id;

$mybb->input['applied_to'][$value] = array(0 => 'global');





				if($mybb->input['action_'.$id] == 1)
{
$mybb->input['applied_to'][$value] = explode(',', $mybb->input['action_list_'.$id]);
}
}

				if($mybb->input['action_'.$id] == 1)
{
$mybb->input['applied_to'][$value] = explode(',', $mybb->input['action_list_'.$id]);
}
}

		}

		}


if($mybb->input['add_type'] == 1)
{


if($mybb->input['add_type'] == 1)
{

Zeile 2673Zeile 2746
		}
}
else

		}
}
else

	{
$mybb->input['name'] = $stylesheet['name'];












	{
$stylesheet = $mybb->get_input('stylesheet', MyBB::INPUT_ARRAY);
if(!isset($stylesheet['sid']))
{
$stylesheet['sid'] = '';
}
if(isset($stylesheet['name']))
{
$mybb->input['name'] = $stylesheet['name'];
}

$add_checked[1] = "";
$add_checked[2] = "";

	}

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

	}

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

Zeile 2687Zeile 2771

$specific_files = "<div id=\"attach_1\" class=\"attachs\">";
$count = 0;


$specific_files = "<div id=\"attach_1\" class=\"attachs\">";
$count = 0;

 
	$check_actions = "";
$mybb->input['attach'] = $mybb->get_input('attach', MyBB::INPUT_INT);
$stylesheet['colors'] = array();
$stylesheet['sid'] = null;


if($mybb->input['attach'] == 1 && is_array($mybb->input['applied_to']) && (!isset($mybb->input['applied_to']['global']) || $mybb->input['applied_to']['global'][0] != "global"))
{


if($mybb->input['attach'] == 1 && is_array($mybb->input['applied_to']) && (!isset($mybb->input['applied_to']['global']) || $mybb->input['applied_to']['global'][0] != "global"))
{

		$check_actions = "";


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

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

Zeile 2746Zeile 2832
	else if($mybb->input['attach'] == 2)
{
// Colors

	else if($mybb->input['attach'] == 2)
{
// Colors

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

 
		if(is_array($properties['colors']))
{
// We might have colors here...

		if(is_array($properties['colors']))
{
// We might have colors here...

Zeile 2773Zeile 2858
	// Colors
$specific_colors = $specific_colors_option = '';


	// Colors
$specific_colors = $specific_colors_option = '';


	if(is_array($properties['colors']))

	if(isset($properties['colors']) && is_array($properties['colors']))

	{
$specific_colors = "<br /><div id=\"attach_2\" class=\"attachs\">";
$specific_colors_option = '<dt><label style="display: block;"><input type="radio" name="attach" value="2" '.$global_checked[3].' class="attachs_check" onclick="checkAction(\'attach\');" style="vertical-align: middle;" /> '.$lang->colors_specific_color.'</label></dt>';

	{
$specific_colors = "<br /><div id=\"attach_2\" class=\"attachs\">";
$specific_colors_option = '<dt><label style="display: block;"><input type="radio" name="attach" value="2" '.$global_checked[3].' class="attachs_check" onclick="checkAction(\'attach\');" style="vertical-align: middle;" /> '.$lang->colors_specific_color.'</label></dt>';





		$specific_color = "
<small>{$lang->colors_add_edit_desc}</small>
<br /><br />

		$specific_color = "
<small>{$lang->colors_add_edit_desc}</small>
<br /><br />

Zeile 2802Zeile 2887
			}
});
$(\'.\'+id+\'s\').each(function(e)

			}
});
$(\'.\'+id+\'s\').each(function(e)

		{

		{

			$(this).hide();
});
if($(\'#\'+id+\'_\'+checked))

			$(this).hide();
});
if($(\'#\'+id+\'_\'+checked))

Zeile 2824Zeile 2909

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->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 = 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->get_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->attached_to, $lang->attached_to_desc, $actions);


Zeile 2834Zeile 2919
	{
$sheetnames[basename($filename)] = basename($filename);
}

	{
$sheetnames[basename($filename)] = basename($filename);
}





	$actions = "<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"add_type\" value=\"1\" {$add_checked[1]} class=\"adds_check\" onclick=\"checkAction('add');\" style=\"vertical-align: middle;\" /> <strong>{$lang->import_stylesheet_from}</strong></label></dt>
<dd style=\"margin-top: 4px;\" id=\"add_1\" class=\"adds\">
<table cellpadding=\"4\">
<tr>

	$actions = "<dl style=\"margin-top: 0; margin-bottom: 0; width: 100%;\">
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"add_type\" value=\"1\" {$add_checked[1]} class=\"adds_check\" onclick=\"checkAction('add');\" style=\"vertical-align: middle;\" /> <strong>{$lang->import_stylesheet_from}</strong></label></dt>
<dd style=\"margin-top: 4px;\" id=\"add_1\" class=\"adds\">
<table cellpadding=\"4\">
<tr>

					<td>".$form->generate_select_box('import', $sheetnames, $mybb->input['import'], array('id' => 'import'))."</td>

					<td>".$form->generate_select_box('import', $sheetnames, $mybb->get_input('import'), array('id' => 'import'))."</td>

				</tr>
</table>
</dd>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"add_type\" value=\"2\" {$add_checked[2]} class=\"adds_check\" onclick=\"checkAction('add');\" style=\"vertical-align: middle;\" /> <strong>{$lang->write_own}</strong></label></dt>

				</tr>
</table>
</dd>
<dt><label style=\"display: block;\"><input type=\"radio\" name=\"add_type\" value=\"2\" {$add_checked[2]} class=\"adds_check\" onclick=\"checkAction('add');\" style=\"vertical-align: middle;\" /> <strong>{$lang->write_own}</strong></label></dt>

		<span id=\"add_2\" class=\"adds\"><br />".$form->generate_text_area('stylesheet', $mybb->input['stylesheet'], array('id' => 'stylesheet', 'style' => 'width: 99%;', 'class' => '', 'rows' => '30'))."</span>

		<span id=\"add_2\" class=\"adds\"><br />".$form->generate_text_area('stylesheet', $mybb->get_input('stylesheet'), array('id' => 'stylesheet', 'style' => 'width: 99%;', 'class' => '', 'rows' => '30'))."</span>

	</dl>";

	</dl>";





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

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





	$form_container->end();

	$form_container->end();





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

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





	$form->output_submit_wrapper($buttons);

	$form->output_submit_wrapper($buttons);





	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 2879Zeile 2967
</script>';

$form->end();

</script>';

$form->end();





	$page->output_footer();
}


	$page->output_footer();
}


Zeile 2888Zeile 2976
	if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');

	if(!verify_post_check($mybb->input['my_post_key']))
{
flash_message($lang->invalid_post_verify_key2, 'error');

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

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

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

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

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

// Does the theme not exist?
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_set_default");

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

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


$plugins->run_hooks("admin_style_themes_set_default");

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

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

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

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?
if(!$theme['tid'] || $theme['tid'] == 1)
{
flash_message($lang->error_invalid_theme, 'error');

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

// Does the theme not exist?
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_force");

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

$plugins->run_hooks("admin_style_themes_force");


// User clicked no


// User clicked no

	if($mybb->input['no'])

	if($mybb->get_input('no'))

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

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

Zeile 2946Zeile 3034
		$plugins->run_hooks("admin_style_themes_force_commit");

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

		$plugins->run_hooks("admin_style_themes_force_commit");

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

 

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