Vergleich admin/modules/style/themes.php - 1.6.0 - 1.6.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: themes.php 5117 2010-07-26 04:09:21Z RyanGordon $

 * $Id: themes.php 5390 2011-03-17 15:23:41Z Tomm $

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 385Zeile 385
						case -3:
$errors[] = $lang->error_theme_already_exists;
break;

						case -3:
$errors[] = $lang->error_theme_already_exists;
break;

 
						case -4:
$errors[] = $lang->error_theme_security_problem;

					}
}
}

					}
}
}

Zeile 1294Zeile 1296
	
if($mybb->request_method == "post")
{

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

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


		// Do we not have a name, or is it just an extension?
if(!$mybb->input['name'] || $mybb->input['name'] == ".css")

		{
$errors[] = $lang->error_missing_stylesheet_name;
}

		{
$errors[] = $lang->error_missing_stylesheet_name;
}

Zeile 1349Zeile 1352
				'name' => $db->escape_string($mybb->input['name']),
'attachedto' => $db->escape_string(implode('|', $attached))
);

				'name' => $db->escape_string($mybb->input['name']),
'attachedto' => $db->escape_string(implode('|', $attached))
);

			

			

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

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

Zeile 1405Zeile 1408
	}

$applied_to = $this_stylesheet['applied_to'];

	}

$applied_to = $this_stylesheet['applied_to'];

	unset($this_stylesheet);


	unset($this_stylesheet);


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

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

Zeile 1624Zeile 1627
			{
$field = str_replace("_", "-", $field);
$css_to_insert .= "{$field}: {$value};\n";

			{
$field = str_replace("_", "-", $field);
$css_to_insert .= "{$field}: {$value};\n";

			}
}

$new_stylesheet = insert_into_css($css_to_insert, $mybb->input['selector'], $new_stylesheet);

// Now we have the new stylesheet, save it
$updated_stylesheet = array(

			}
}

$new_stylesheet = insert_into_css($css_to_insert, $mybb->input['selector'], $new_stylesheet);

// 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)),
"lastmodified" => TIME_NOW

			"cachefile" => $db->escape_string($stylesheet['name']),
"stylesheet" => $db->escape_string(unfix_css_urls($new_stylesheet)),
"lastmodified" => TIME_NOW

Zeile 1852Zeile 1855
});
//]]>
</script>';

});
//]]>
</script>';


$form->end();



$form->end();


	$page->output_footer();
}

if($mybb->input['action'] == "edit_stylesheet" && $mybb->input['mode'] == "advanced")
{
$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced");

	$page->output_footer();
}

if($mybb->input['action'] == "edit_stylesheet" && $mybb->input['mode'] == "advanced")
{
$plugins->run_hooks("admin_style_themes_edit_stylesheet_advanced");

	

	

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

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

	

	

	if(!$theme['tid'])
{
flash_message($lang->error_invalid_theme, 'error');

	if(!$theme['tid'])
{
flash_message($lang->error_invalid_theme, 'error');

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


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


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

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

Zeile 1881Zeile 1884
	
$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);

	

	

	// Does the theme not exist?
if(!$stylesheet['sid'])
{

	// Does the theme not exist?
if(!$stylesheet['sid'])
{

Zeile 1890Zeile 1893
	}

if($mybb->request_method == "post")

	}

if($mybb->request_method == "post")

	{

	{

		$sid = $stylesheet['sid'];

// Theme & stylesheet theme ID do not match, editing inherited - we copy to local theme

		$sid = $stylesheet['sid'];

// Theme & stylesheet theme ID do not match, editing inherited - we copy to local theme

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

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

		}
}

// Fetch list of all of the stylesheets for this theme
$file_stylesheets = unserialize($theme['stylesheets']);

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

// Now we loop through the list of stylesheets for each file
foreach($file_stylesheets as $file => $action_stylesheet)
{
if($file == 'inherited')
{
continue;
}

foreach($action_stylesheet as $action => $style)
{
foreach($style as $stylesheet2)
{
$stylesheets[$stylesheet2]['applied_to'][$file][] = $action;
if(is_array($file_stylesheets['inherited'][$file."_".$action]) && in_array($stylesheet2, array_keys($file_stylesheets['inherited'][$file."_".$action])))
{
$stylesheets[$stylesheet2]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)
{
$inherited_load[] = $value;
}
}
}
}
}

foreach($stylesheets as $file => $stylesheet2)
{
if(is_array($stylesheet2['inherited']))

		}
}

// Fetch list of all of the stylesheets for this theme
$file_stylesheets = unserialize($theme['stylesheets']);

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

// Now we loop through the list of stylesheets for each file
foreach($file_stylesheets as $file => $action_stylesheet)
{
if($file == 'inherited')
{
continue;
}

foreach($action_stylesheet as $action => $style)
{
foreach($style as $stylesheet2)
{
$stylesheets[$stylesheet2]['applied_to'][$file][] = $action;
if(is_array($file_stylesheets['inherited'][$file."_".$action]) && in_array($stylesheet2, array_keys($file_stylesheets['inherited'][$file."_".$action])))
{
$stylesheets[$stylesheet2]['inherited'] = $file_stylesheets['inherited'][$file."_".$action];
foreach($file_stylesheets['inherited'][$file."_".$action] as $value)
{
$inherited_load[] = $value;
}
}
}
}
}

foreach($stylesheets as $file => $stylesheet2)
{
if(is_array($stylesheet2['inherited']))

		{
foreach($stylesheet2['inherited'] as $inherited_file => $tid)
{

		{
foreach($stylesheet2['inherited'] as $inherited_file => $tid)
{

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

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

	<link type="text/css" href="./jscripts/codepress/languages/codepress-css.css" rel="stylesheet" id="cp-lang-style" />

	<link type="text/css" href="./jscripts/codepress/languages/css.css" rel="stylesheet" id="cp-lang-style" />

	<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'css\';

	<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'css\';

Zeile 2051Zeile 2054
	$form->output_submit_wrapper($buttons);

$form->end();

	$form->output_submit_wrapper($buttons);

$form->end();

	

	

	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

	if($admin_options['codepress'] != 0)
{
echo "<script type=\"text/javascript\">

Zeile 2073Zeile 2076
if($mybb->input['action'] == "delete_stylesheet")
{
$plugins->run_hooks("admin_style_themes_delete_stylesheet");

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

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

if(!$theme['tid'])
{

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

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

	}


	}


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

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

Zeile 2093Zeile 2096
	
$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);

	

	

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

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

	{

	{

		flash_message($lang->error_invalid_stylesheet, 'error');

		flash_message($lang->error_invalid_stylesheet, 'error');

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

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

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

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

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

if($mybb->request_method == "post")

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

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

Zeile 2191Zeile 2194
	
if($mybb->request_method == "post")
{

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

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

		if(!$mybb->input['name'] || $mybb->input['name'] == ".css")

		{
$errors[] = $lang->error_missing_stylesheet_name;
}

		{
$errors[] = $lang->error_missing_stylesheet_name;
}

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

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

	<link type="text/css" href="./jscripts/codepress/languages/codepress-css.css" rel="stylesheet" id="cp-lang-style" />

	<link type="text/css" href="./jscripts/codepress/languages/css.css" rel="stylesheet" id="cp-lang-style" />

	<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'css\';

	<script type="text/javascript" src="./jscripts/codepress/codepress.js"></script>
<script type="text/javascript">
CodePress.language = \'css\';