Vergleich admin/modules/style/themes.php - 1.8.6 - 1.8.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 614Zeile 614
		{
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 756Zeile 756
		{
$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 783Zeile 783
						"version" => $db->escape_string($template['version']),
"dateline" => TIME_NOW
);

						"version" => $db->escape_string($template['version']),
"dateline" => TIME_NOW
);





					if($db->engine == "pgsql")
{
echo " ";

					if($db->engine == "pgsql")
{
echo " ";

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

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

	);

	);


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


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

	);


	);


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

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

	);


	);


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

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

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

if($errors)

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

if($errors)

	{

	{

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

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

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

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

	}

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

	}

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

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

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

	}

	}


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



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


Zeile 969Zeile 969
	if($mybb->request_method == "post")
{
$inherited_theme_cache = array();

	if($mybb->request_method == "post")
{
$inherited_theme_cache = array();





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

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

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

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

			{

			{

				continue;
}


				continue;
}


Zeile 996Zeile 996
					{
$inherited_stylesheets = true;
}

					{
$inherited_stylesheets = true;
}

				}

				}

			}

			}

		}

		}


if($inherited_stylesheets == true)


if($inherited_stylesheets == true)

		{

		{

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

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





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

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

 

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

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


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


Zeile 1075Zeile 1078
		}

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

		}

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

		{

		{

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

foreach($colors as $color)

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

foreach($colors as $color)

Zeile 1084Zeile 1087

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


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

		}

		}


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


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

		{

		{

			$errors[] = $lang->error_invalid_templateset;

			$errors[] = $lang->error_invalid_templateset;

		}

		}


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


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

		if($theme_properties['disporder'])

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

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

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

 
		}
else
{
$errors[] = $lang->error_no_display_order;

		}

$allowedgroups = array();

		}

$allowedgroups = array();

Zeile 1129Zeile 1136
			$errors[] = $lang->error_missing_name;
}
else

			$errors[] = $lang->error_missing_name;
}
else

		{

		{

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

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





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

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

Zeile 1155Zeile 1162
			if(!$ts_check)
{
unset($properties['templateset']);

			if(!$ts_check)
{
unset($properties['templateset']);

			}
}

			}
}

		if(!$properties['templateset'])
{
$errors[] = $lang->error_invalid_templateset;

		if(!$properties['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']))
{
$errors[] = $lang->error_invalid_editortheme;

		if(!$properties['editortheme'] || !file_exists(MYBB_ROOT."jscripts/sceditor/editor_themes/".$properties['editortheme']) || is_dir(MYBB_ROOT."jscripts/sceditor/editor_themes/".$properties['editortheme']))
{
$errors[] = $lang->error_invalid_editortheme;

Zeile 1169Zeile 1176
		if(empty($errors))
{
$plugins->run_hooks("admin_style_themes_edit_commit");

		if(empty($errors))
{
$plugins->run_hooks("admin_style_themes_edit_commit");





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


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


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

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

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

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

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

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

		}
}


		}
}


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

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

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

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

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


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


Zeile 1356Zeile 1363
	{
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 1604Zeile 1611

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


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

	$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}


	$form->output_submit_wrapper($buttons);
$form->end();

$page->output_footer();
}


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

Zeile 1643Zeile 1650

// Fetch list of all of the stylesheets for this theme
$stylesheets = fetch_theme_stylesheets($theme);


// Fetch list of all of the stylesheets for this theme
$stylesheets = fetch_theme_stylesheets($theme);





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

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

Zeile 1710Zeile 1717
				if(!is_array($mybb->input['color']))
{
$errors[] = $lang->error_no_color_picked;

				if(!is_array($mybb->input['color']))
{
$errors[] = $lang->error_no_color_picked;

				}

				}

				else
{
$attached = $mybb->input['color'];
}

				else
{
$attached = $mybb->input['color'];
}

			}

			}


// Update Stylesheet
$update_array = array(


// Update Stylesheet
$update_array = array(

Zeile 1728Zeile 1735
				$update_array['cachefile'] = $db->escape_string(str_replace('/', '', $mybb->input['name']));
}


				$update_array['cachefile'] = $db->escape_string(str_replace('/', '', $mybb->input['name']));
}


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


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


			// If the name changed, re-cache our stylesheet
$theme_c = $update_d = false;
if($stylesheet['name'] != $mybb->input['name'])

			// If the name changed, re-cache our stylesheet
$theme_c = $update_d = false;
if($stylesheet['name'] != $mybb->input['name'])

Zeile 1737Zeile 1744
				// Update the theme stylesheet list if the name is changed
$theme_c = $theme;
$update_d = true;

				// Update the theme stylesheet list if the name is changed
$theme_c = $theme;
$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']))
{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$stylesheet['sid']}"), "sid='{$stylesheet['sid']}'", 1);
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

				$db->update_query("themestylesheets", array('lastmodified' => TIME_NOW), "sid='{$stylesheet['sid']}'", 1);
if(!cache_stylesheet($theme['tid'], str_replace('/', '', $mybb->input['name']), $theme['stylesheet']))
{
$db->update_query("themestylesheets", array('cachefile' => "css.php?stylesheet={$stylesheet['sid']}"), "sid='{$stylesheet['sid']}'", 1);
}
@unlink(MYBB_ROOT."cache/themes/theme{$theme['tid']}/{$stylesheet['cachefile']}");

 

$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 2034Zeile 2044
		}

$css_to_insert = '';

		}

$css_to_insert = '';

		foreach($mybb->input['css_bits'] as $field => $value)

		foreach($mybb->input['css_bits'] as $field => $value)

		{
if(!trim($value) || !trim($field))
{

		{
if(!trim($value) || !trim($field))
{

Zeile 2243Zeile 2253
//]]>
</script>';


//]]>
</script>';


	$form->end();

$page->output_footer();
}


	$form->end();

$page->output_footer();
}


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

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

Zeile 2258Zeile 2268
	{
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_stylesheet_advanced");


	}

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

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

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

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

Zeile 2327Zeile 2337
	$stylesheets = fetch_theme_stylesheets($theme);
$this_stylesheet = $stylesheets[$stylesheet['name']];
unset($stylesheets);

	$stylesheets = fetch_theme_stylesheets($theme);
$this_stylesheet = $stylesheets[$stylesheet['name']];
unset($stylesheets);





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

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

Zeile 2379Zeile 2389

// Has the file on the file system been modified?
if(resync_stylesheet($stylesheet))


// Has the file on the file system been modified?
if(resync_stylesheet($stylesheet))

	{

	{

		// Need to refetch new stylesheet as it was modified
$query = $db->simple_select("themestylesheets", "stylesheet", "sid='{$stylesheet['sid']}'");
$stylesheet['stylesheet'] = $db->fetch_field($query, 'stylesheet');

		// Need to refetch new stylesheet as it was modified
$query = $db->simple_select("themestylesheets", "stylesheet", "sid='{$stylesheet['sid']}'");
$stylesheet['stylesheet'] = $db->fetch_field($query, 'stylesheet');

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

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

 

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


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


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