Zeile 262 | Zeile 262 |
---|
$loop = 1; foreach($theme['stylesheets']['stylesheet'] as $stylesheet) {
|
$loop = 1; foreach($theme['stylesheets']['stylesheet'] as $stylesheet) {
|
| $stylesheet['attributes']['name'] = my_substr($stylesheet['attributes']['name'], 0, 30);
|
if(substr($stylesheet['attributes']['name'], -4) != ".css") { continue;
| if(substr($stylesheet['attributes']['name'], -4) != ".css") { continue;
|
Zeile 324 | Zeile 326 |
---|
}
++$loop;
|
}
++$loop;
|
}
| }
|
// Now we have our list of built stylesheets, save them $updated_theme = array( "stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)) );
|
// Now we have our list of built stylesheets, save them $updated_theme = array( "stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)) );
|
if(is_array($properties['disporder'])) { asort($properties['disporder'], SORT_NUMERIC);
// Because inherited stylesheets can mess this up $loop = 1; $orders = array(); foreach($properties['disporder'] as $filename => $order) { $orders[$filename] = $loop; ++$loop; }
$properties['disporder'] = $orders; $updated_theme['properties'] = $db->escape_string(my_serialize($properties)); }
| |
$db->update_query("themes", $updated_theme, "tid='{$theme_id}'"); }
| $db->update_query("themes", $updated_theme, "tid='{$theme_id}'"); }
|
Zeile 388 | Zeile 373 |
---|
{ global $mybb;
|
{ global $mybb;
|
$filename = str_replace('/', '', $filename);
| $filename = basename($filename);
|
$tid = (int) $tid; $theme_directory = "cache/themes/theme{$tid}";
|
$tid = (int) $tid; $theme_directory = "cache/themes/theme{$tid}";
|
| if(substr($filename, -4) != ".css") { return false; }
|
// If we're in safe mode save to the main theme folder by default if($mybb->safemode) { $theme_directory = "cache/themes"; $filename = $tid."_".$filename;
|
// If we're in safe mode save to the main theme folder by default if($mybb->safemode) { $theme_directory = "cache/themes"; $filename = $tid."_".$filename;
|
}
| }
|
// Does our theme directory exist? Try and create it. elseif(!is_dir(MYBB_ROOT . $theme_directory))
|
// Does our theme directory exist? Try and create it. elseif(!is_dir(MYBB_ROOT . $theme_directory))
|
{
| {
|
if(!@mkdir(MYBB_ROOT . $theme_directory)) { $theme_directory = "cache/themes";
| if(!@mkdir(MYBB_ROOT . $theme_directory)) { $theme_directory = "cache/themes";
|
Zeile 412 | Zeile 402 |
---|
$fp = @fopen(MYBB_ROOT . $theme_directory."/index.html", "w"); @fwrite($fp, ""); @fclose($fp);
|
$fp = @fopen(MYBB_ROOT . $theme_directory."/index.html", "w"); @fwrite($fp, ""); @fclose($fp);
|
|
|
} }
| } }
|
Zeile 420 | Zeile 410 |
---|
"theme" => $theme_directory ); $stylesheet = parse_theme_variables($stylesheet, $theme_vars);
|
"theme" => $theme_directory ); $stylesheet = parse_theme_variables($stylesheet, $theme_vars);
|
$stylesheet = preg_replace_callback("#url\((\"|'|)(.*)\\1\)#", create_function('$matches', 'return fix_css_urls($matches[2]);'), $stylesheet);
| $stylesheet = preg_replace_callback("#url\((\"|'|)([^\"'\s]*?)\\1\)#", 'fix_css_urls_callback', $stylesheet);
|
$fp = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename}", "wb"); if(!$fp) {
| $fp = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename}", "wb"); if(!$fp) {
|
Zeile 429 | Zeile 419 |
---|
}
@fwrite($fp, $stylesheet);
|
}
@fwrite($fp, $stylesheet);
|
@fclose($fp);
| @fclose($fp);
|
$stylesheet_min = minify_stylesheet($stylesheet); $filename_min = str_replace('.css', '.min.css', $filename); $fp_min = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename_min}", "wb");
| $stylesheet_min = minify_stylesheet($stylesheet); $filename_min = str_replace('.css', '.min.css', $filename); $fp_min = @fopen(MYBB_ROOT . "{$theme_directory}/{$filename_min}", "wb");
|
Zeile 511 | Zeile 501 |
---|
}
/**
|
}
/**
|
| * @deprecated
|
* @param string $url * * @return string
| * @param string $url * * @return string
|
Zeile 528 | Zeile 519 |
---|
}
/**
|
}
/**
|
| * @param array $matches Matches. * * @return string */ function fix_css_urls_callback($matches) { return fix_css_urls($matches[2]); }
/** * @deprecated
|
* @param string $url * * @return string
| * @param string $url * * @return string
|
Zeile 565 | Zeile 567 |
---|
{ $query = $db->simple_select("themes", "*", "tid='".(int)$parent."'"); $parent_theme = $db->fetch_array($query);
|
{ $query = $db->simple_select("themes", "*", "tid='".(int)$parent."'"); $parent_theme = $db->fetch_array($query);
|
if(count($properties) == 0 || !is_array($properties))
| if(!is_array($properties) || count($properties) == 0)
|
{ $parent_properties = my_unserialize($parent_theme['properties']); if(!empty($parent_properties))
| { $parent_properties = my_unserialize($parent_theme['properties']); if(!empty($parent_properties))
|
Zeile 628 | Zeile 630 |
---|
); $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));
| if(!empty($stylesheets)) { $updated_theme['stylesheets'] = $db->escape_string(my_serialize($stylesheets));
|
Zeile 1110 | Zeile 1114 |
---|
$db->update_query("themes", $updated_theme, "tid = '{$tid}'");
// Do we have any children themes that need updating too?
|
$db->update_query("themes", $updated_theme, "tid = '{$tid}'");
// Do we have any children themes that need updating too?
|
if(count($child_list) > 0)
| if(is_array($child_list) && count($child_list) > 0)
|
{ foreach($child_list as $id) {
| { foreach($child_list as $id) {
|