Zeile 19 | Zeile 19 |
---|
{ global $mybb, $db;
|
{ global $mybb, $db;
|
require_once MYBB_ROOT."inc/class_xml.php";
$parser = new XMLParser($xml);
| $parser = create_xml_parser($xml);
|
$tree = $parser->get_tree();
if(!is_array($tree) || !is_array($tree['theme']))
| $tree = $parser->get_tree();
if(!is_array($tree) || !is_array($tree['theme']))
|
Zeile 29 | Zeile 27 |
---|
return -1; }
|
return -1; }
|
$theme = $tree['theme'];
| $theme = $tree['theme'];
|
// Do we have MyBB 1.2 template's we're importing? $css_120 = "";
if(isset($theme['cssbits']) && is_array($theme['cssbits'])) { $cssbits = kill_tags($theme['cssbits']);
|
// Do we have MyBB 1.2 template's we're importing? $css_120 = "";
if(isset($theme['cssbits']) && is_array($theme['cssbits'])) { $cssbits = kill_tags($theme['cssbits']);
|
|
|
foreach($cssbits as $name => $values) { $css_120 .= "{$name} {\n";
| foreach($cssbits as $name => $values) { $css_120 .= "{$name} {\n";
|
Zeile 52 | Zeile 50 |
---|
{ $css_120 .= "\t{$property2}: {$value2}\n"; }
|
{ $css_120 .= "\t{$property2}: {$value2}\n"; }
|
}
| }
|
else { $css_120 .= "\t{$property}: {$value}\n";
| else { $css_120 .= "\t{$property}: {$value}\n";
|
Zeile 61 | Zeile 59 |
---|
$css_120 .= "}\n"; } }
|
$css_120 .= "}\n"; } }
|
|
|
if(isset($theme['themebits']) && is_array($theme['themebits'])) { $themebits = kill_tags($theme['themebits']);
|
if(isset($theme['themebits']) && is_array($theme['themebits'])) { $themebits = kill_tags($theme['themebits']);
|
$theme['properties']['tag'] = 'properties';
| $theme['properties']['tag'] = 'properties';
|
foreach($themebits as $name => $value) { if($name == "extracss")
| foreach($themebits as $name => $value) { if($name == "extracss")
|
Zeile 113 | Zeile 111 |
---|
$value['value'] = $data; }
|
$value['value'] = $data; }
|
|
|
$properties[$property] = $value['value']; } }
| $properties[$property] = $value['value']; } }
|
Zeile 130 | Zeile 128 |
---|
$query = $db->simple_select("themes", "tid", "name='".$db->escape_string($name)."'", array("limit" => 1)); $existingtheme = $db->fetch_array($query);
|
$query = $db->simple_select("themes", "tid", "name='".$db->escape_string($name)."'", array("limit" => 1)); $existingtheme = $db->fetch_array($query);
|
if(!empty($options['force_name_check']) && $existingtheme['tid'])
| if(!empty($options['force_name_check']) && !empty($existingtheme['tid']))
|
{ return -3; }
|
{ return -3; }
|
else if($existingtheme['tid'])
| else if(!empty($existingtheme['tid']))
|
{ $options['tid'] = $existingtheme['tid']; }
| { $options['tid'] = $existingtheme['tid']; }
|
Zeile 146 | Zeile 144 |
---|
// Do we have any templates to insert? if(!empty($theme['templates']['template']) && empty($options['no_templates']))
|
// Do we have any templates to insert? if(!empty($theme['templates']['template']) && empty($options['no_templates']))
|
{ if($options['templateset']) { $sid = $options['templateset']; } else { $sid = $db->insert_query("templatesets", array('title' => $db->escape_string($name)." Templates")); }
| {
|
$templates = $theme['templates']['template']; if(is_array($templates)) {
| $templates = $theme['templates']['template']; if(is_array($templates)) {
|
Zeile 166 | Zeile 155 |
---|
} }
|
} }
|
| // Security check
|
$security_check = false;
|
$security_check = false;
|
$templatecache = array(); foreach($templates as $template) {
| foreach($templates as $template) {
|
if(check_template($template['value'])) { $security_check = true; break; }
|
if(check_template($template['value'])) { $security_check = true; break; }
|
| }
if($security_check == true) { return -4; }
if(!empty($options['templateset'])) { $sid = (int)$options['templateset']; } else { $sid = $db->insert_query("templatesets", array('title' => $db->escape_string($name)." Templates")); }
|
|
|
| $templatecache = array(); foreach($templates as $template) {
|
$templatecache[] = array( "title" => $db->escape_string($template['attributes']['name']), "template" => $db->escape_string($template['value']),
| $templatecache[] = array( "title" => $db->escape_string($template['attributes']['name']), "template" => $db->escape_string($template['value']),
|
Zeile 183 | Zeile 190 |
---|
"version" => $db->escape_string($template['attributes']['version']), "dateline" => TIME_NOW );
|
"version" => $db->escape_string($template['attributes']['version']), "dateline" => TIME_NOW );
|
}
if($security_check == true) { return -4;
| |
}
foreach($templatecache as $template)
| }
foreach($templatecache as $template)
|
Zeile 240 | Zeile 242 |
---|
{ $inherited_stylesheets = my_unserialize($db->fetch_field($query, "stylesheets"));
|
{ $inherited_stylesheets = my_unserialize($db->fetch_field($query, "stylesheets"));
|
if(is_array($inherited_stylesheets['inherited']))
| if(isset($inherited_stylesheets['inherited']) && is_array($inherited_stylesheets['inherited']))
|
{ $loop = 1; foreach($inherited_stylesheets['inherited'] as $action => $stylesheets)
| { $loop = 1; foreach($inherited_stylesheets['inherited'] as $action => $stylesheets)
|
Zeile 630 | Zeile 632 |
---|
); $properties['logo'] = parse_theme_variables($properties['logo'], $theme_vars); }
|
); $properties['logo'] = parse_theme_variables($properties['logo'], $theme_vars); }
|
|
|
$updated_theme = array(); if(!empty($stylesheets)) { $updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets)); } $updated_theme['properties'] = $db->escape_string(my_serialize($properties));
|
$updated_theme = array(); if(!empty($stylesheets)) { $updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets)); } $updated_theme['properties'] = $db->escape_string(my_serialize($properties));
|
|
|
if(count($updated_theme) > 0) { $db->update_query("themes", $updated_theme, "tid='{$tid}'");
| if(count($updated_theme) > 0) { $db->update_query("themes", $updated_theme, "tid='{$tid}'");
|
Zeile 679 | Zeile 681 |
---|
$comments = $matches[1][$i]; preg_match_all("#Name:(.*)#i", $comments, $name_match); if(isset($name_match[count($name_match)-1][0]))
|
$comments = $matches[1][$i]; preg_match_all("#Name:(.*)#i", $comments, $name_match); if(isset($name_match[count($name_match)-1][0]))
|
{
| {
|
$name = trim($name_match[count($name_match)-1][0]); } preg_match_all("#Description:(.*)#i", $comments, $description_match); if(isset($description_match[count($description_match)-1][0])) { $description = trim($description_match[count($description_match)-1][0]);
|
$name = trim($name_match[count($name_match)-1][0]); } preg_match_all("#Description:(.*)#i", $comments, $description_match); if(isset($description_match[count($description_match)-1][0])) { $description = trim($description_match[count($description_match)-1][0]);
|
}
| }
|
$class_id = md5($class_name); if(isset($already_parsed[$class_id])) { $already_parsed[$class_id]++; $class_id .= "_".$already_parsed[$class_id];
|
$class_id = md5($class_name); if(isset($already_parsed[$class_id])) { $already_parsed[$class_id]++; $class_id .= "_".$already_parsed[$class_id];
|
}
| }
|
else { $already_parsed[$class_id] = 1;
| else { $already_parsed[$class_id] = 1;
|
Zeile 700 | Zeile 702 |
---|
$values = trim($matches[5][$i]); $values = preg_replace("#/\*(.*?)\*/#s", "", $values); $parsed_css[$class_id] = array("class_name" => $class_name, "name" => $name, "description" => $description, "values" => $values);
|
$values = trim($matches[5][$i]); $values = preg_replace("#/\*(.*?)\*/#s", "", $values); $parsed_css[$class_id] = array("class_name" => $class_name, "name" => $name, "description" => $description, "values" => $values);
|
}
| }
|
return $parsed_css; }
| return $parsed_css; }
|
Zeile 754 | Zeile 756 |
---|
* @return int */ function css_selectors_sort_cmp($a, $b)
|
* @return int */ function css_selectors_sort_cmp($a, $b)
|
{
| {
|
if(!$a['name'])
|
if(!$a['name'])
|
{
| {
|
$a['name'] = $a['class_name'];
|
$a['name'] = $a['class_name'];
|
}
| }
|
if(!$b['name']) { $b['name'] = $b['class_name']; } return strcmp($a['name'], $b['name']);
|
if(!$b['name']) { $b['name'] = $b['class_name']; } return strcmp($a['name'], $b['name']);
|
}
/**
| }
/**
|
* @param array|string $css * @param string $id *
| * @param array|string $css * @param string $id *
|
Zeile 795 | Zeile 797 |
---|
*/ function parse_css_properties($values) {
|
*/ function parse_css_properties($values) {
|
$css_bits = array();
| $css_bits = array( 'extra' => null, );
|
if(!$values) {
| if(!$values) {
|
Zeile 991 | Zeile 995 |
---|
foreach($parent_list as $theme_id) {
|
foreach($parent_list as $theme_id) {
|
if($mybb->settings['usecdn'] && !empty($mybb->settings['cdnpath']))
| if(!empty($mybb->settings['usecdn']) && !empty($mybb->settings['cdnpath']))
|
{ $cdnpath = rtrim($mybb->settings['cdnpath'], '/\\').'/'; if(file_exists($cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(
| { $cdnpath = rtrim($mybb->settings['cdnpath'], '/\\').'/'; if(file_exists($cdnpath."cache/themes/theme{$theme_id}/{$stylesheet['name']}") && filemtime(
|
Zeile 1015 | Zeile 1019 |
---|
} } }
|
} } }
|
|
|
if(is_object($plugins)) { $plugins->run_hooks('update_theme_stylesheet_list_set_css_url', $css_url);
| if(is_object($plugins)) { $plugins->run_hooks('update_theme_stylesheet_list_set_css_url', $css_url);
|
Zeile 1041 | Zeile 1045 |
---|
if(count($attached_actions) == 0) { $attached_actions = array("global");
|
if(count($attached_actions) == 0) { $attached_actions = array("global");
|
}
| }
|
foreach($attached_actions as $action) {
| foreach($attached_actions as $action) {
|
Zeile 1059 | Zeile 1063 |
---|
$updated_theme = array( "stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)) );
|
$updated_theme = array( "stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)) );
|
|
|
// Do we have a theme present? If so, update the stylesheet display orders if($update_disporders) {
| // Do we have a theme present? If so, update the stylesheet display orders if($update_disporders) {
|
Zeile 1067 | Zeile 1071 |
---|
{ $theme_cache = cache_themes(); $theme = $theme_cache[$tid];
|
{ $theme_cache = cache_themes(); $theme = $theme_cache[$tid];
|
}
| }
|
$orders = $orphaned_stylesheets = array(); $properties = $theme['properties'];
|
$orders = $orphaned_stylesheets = array(); $properties = $theme['properties'];
|
|
|
if(!is_array($properties)) { $properties = my_unserialize($theme['properties']); }
|
if(!is_array($properties)) { $properties = my_unserialize($theme['properties']); }
|
|
|
$max_disporder = 0;
foreach($stylesheets as $stylesheet)
| $max_disporder = 0;
foreach($stylesheets as $stylesheet)
|
Zeile 1086 | Zeile 1090 |
---|
$orphaned_stylesheets[] = $stylesheet['name']; continue; }
|
$orphaned_stylesheets[] = $stylesheet['name']; continue; }
|
|
|
if($properties['disporder'][$stylesheet['name']] > $max_disporder) { $max_disporder = $properties['disporder'][$stylesheet['name']];
| if($properties['disporder'][$stylesheet['name']] > $max_disporder) { $max_disporder = $properties['disporder'][$stylesheet['name']];
|
Zeile 1232 | Zeile 1236 |
---|
$query = $db->simple_select("themes", "*", "", array('order_by' => "pid, name")); while($theme = $db->fetch_array($query)) {
|
$query = $db->simple_select("themes", "*", "", array('order_by' => "pid, name")); while($theme = $db->fetch_array($query)) {
|
| $theme['users'] = 0;
|
$theme['properties'] = my_unserialize($theme['properties']); $theme['stylesheets'] = my_unserialize($theme['stylesheets']); $theme_cache[$theme['tid']] = $theme;
| $theme['properties'] = my_unserialize($theme['properties']); $theme['stylesheets'] = my_unserialize($theme['stylesheets']); $theme_cache[$theme['tid']] = $theme;
|
Zeile 1274 | Zeile 1279 |
---|
$user_themes['style'] = $themes['default']; }
|
$user_themes['style'] = $themes['default']; }
|
if($themes[$user_themes['style']]['users'] > 0)
| if(isset($themes[$user_themes['style']]['users']) && $themes[$user_themes['style']]['users'] > 0)
|
{ $themes[$user_themes['style']]['users'] += (int)$user_themes['users']; }
| { $themes[$user_themes['style']]['users'] += (int)$user_themes['users']; }
|
Zeile 1298 | Zeile 1303 |
---|
unset($themes); }
|
unset($themes); }
|
if(!is_array($theme_cache[$parent]))
| if(!isset($theme_cache[$parent]) || !is_array($theme_cache[$parent]))
|
{ return; }
| { return; }
|
Zeile 1306 | Zeile 1311 |
---|
foreach($theme_cache[$parent] as $theme) { $popup = new PopupMenu("theme_{$theme['tid']}", $lang->options);
|
foreach($theme_cache[$parent] as $theme) { $popup = new PopupMenu("theme_{$theme['tid']}", $lang->options);
|
| $set_default = '';
|
if($theme['tid'] > 1) { $popup->add_item($lang->edit_theme, "index.php?module=style-themes&action=edit&tid={$theme['tid']}");
| if($theme['tid'] > 1) { $popup->add_item($lang->edit_theme, "index.php?module=style-themes&action=edit&tid={$theme['tid']}");
|
Zeile 1327 | Zeile 1333 |
---|
$set_default = "<img src=\"styles/{$page->style}/images/icons/default.png\" alt=\"{$lang->default_theme}\" style=\"vertical-align: middle;\" title=\"{$lang->default_theme}\" />"; } $popup->add_item($lang->force_on_users, "index.php?module=style-themes&action=force&tid={$theme['tid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_theme_forced}')");
|
$set_default = "<img src=\"styles/{$page->style}/images/icons/default.png\" alt=\"{$lang->default_theme}\" style=\"vertical-align: middle;\" title=\"{$lang->default_theme}\" />"; } $popup->add_item($lang->force_on_users, "index.php?module=style-themes&action=force&tid={$theme['tid']}&my_post_key={$mybb->post_code}", "return AdminCP.deleteConfirmation(this, '{$lang->confirm_theme_forced}')");
|
| $set_default = "<div class=\"float_right\">{$set_default}</div>";
|
} $popup->add_item($lang->export_theme, "index.php?module=style-themes&action=export&tid={$theme['tid']}"); $popup->add_item($lang->duplicate_theme, "index.php?module=style-themes&action=duplicate&tid={$theme['tid']}");
|
} $popup->add_item($lang->export_theme, "index.php?module=style-themes&action=export&tid={$theme['tid']}"); $popup->add_item($lang->duplicate_theme, "index.php?module=style-themes&action=duplicate&tid={$theme['tid']}");
|
$table->construct_cell("<div class=\"float_right\">{$set_default}</div><div style=\"margin-left: {$padding}px;\"><strong>{$theme['name']}</strong></div>");
| $table->construct_cell("{$set_default}<div style=\"margin-left: {$padding}px;\"><strong>{$theme['name']}</strong></div>");
|
$table->construct_cell(my_number_format($theme['users']), array("class" => "align_center")); $table->construct_cell($popup->fetch(), array("class" => "align_center")); $table->construct_row();
| $table->construct_cell(my_number_format($theme['users']), array("class" => "align_center")); $table->construct_cell($popup->fetch(), array("class" => "align_center")); $table->construct_row();
|
Zeile 1370 | Zeile 1377 |
---|
unset($theme); }
|
unset($theme); }
|
if(!is_array($theme_cache[$parent]) || $ignoretid === $parent)
| if(!isset($theme_cache[$parent]) || !is_array($theme_cache[$parent]) || $ignoretid === $parent)
|
{ return null; }
| { return null; }
|
Zeile 1424 | Zeile 1431 |
---|
foreach($style as $stylesheet2) { $stylesheets[$stylesheet2]['applied_to'][$file][] = $action;
|
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])))
| if(isset($file_stylesheets['inherited'][$file."_".$action]) && 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)
| { $stylesheets[$stylesheet2]['inherited'] = $file_stylesheets['inherited'][$file."_".$action]; foreach($file_stylesheets['inherited'][$file."_".$action] as $value)
|
Zeile 1438 | Zeile 1445 |
---|
foreach($stylesheets as $file => $stylesheet2) {
|
foreach($stylesheets as $file => $stylesheet2) {
|
if(is_array($stylesheet2['inherited']))
| if(isset($stylesheet2['inherited']) && is_array($stylesheet2['inherited']))
|
{ foreach($stylesheet2['inherited'] as $inherited_file => $tid) {
| { foreach($stylesheet2['inherited'] as $inherited_file => $tid) {
|