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")
|
if(substr($stylesheet['attributes']['name'], -4) != ".css")
|
{
| {
|
continue;
|
continue;
|
}
| }
|
if(empty($stylesheet['attributes']['lastmodified']))
|
if(empty($stylesheet['attributes']['lastmodified']))
|
{
| {
|
$stylesheet['attributes']['lastmodified'] = TIME_NOW;
|
$stylesheet['attributes']['lastmodified'] = TIME_NOW;
|
}
| }
|
if(empty($stylesheet['attributes']['disporder'])) { $stylesheet['attributes']['disporder'] = $loop;
|
if(empty($stylesheet['attributes']['disporder'])) { $stylesheet['attributes']['disporder'] = $loop;
|
}
| }
|
if(empty($stylesheet['attributes']['attachedto'])) {
| if(empty($stylesheet['attributes']['attachedto'])) {
|
Zeile 304 | Zeile 306 |
---|
if(!$attachedto) { $attachedto = "global";
|
if(!$attachedto) { $attachedto = "global";
|
}
| }
|
// private.php?compose,folders|usercp.php,global|global $attachedto = explode("|", $attachedto);
| // private.php?compose,folders|usercp.php,global|global $attachedto = explode("|", $attachedto);
|
Zeile 330 | Zeile 332 |
---|
"stylesheets" => $db->escape_string(my_serialize($theme_stylesheets)) );
|
"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}'"); }
update_theme_stylesheet_list($theme_id);
| $db->update_query("themes", $updated_theme, "tid='{$theme_id}'"); }
update_theme_stylesheet_list($theme_id);
|
// And done? return $theme_id;
| // And done? return $theme_id;
|
Zeile 391 | Zeile 376 |
---|
$filename = basename($filename); $tid = (int) $tid; $theme_directory = "cache/themes/theme{$tid}";
|
$filename = basename($filename); $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)
| // If we're in safe mode save to the main theme folder by default if($mybb->safemode)
|
Zeile 511 | Zeile 501 |
---|
}
/**
|
}
/**
|
| * @deprecated
|
* @param string $url * * @return string
| * @param string $url * * @return string
|
Zeile 538 | Zeile 529 |
---|
}
/**
|
}
/**
|
| * @deprecated
|
* @param string $url * * @return string
| * @param string $url * * @return string
|
Zeile 572 | Zeile 564 |
---|
$inherited_properties = false; $stylesheets = array(); if($parent > 0)
|
$inherited_properties = false; $stylesheets = array(); if($parent > 0)
|
{
| {
|
$query = $db->simple_select("themes", "*", "tid='".(int)$parent."'"); $parent_theme = $db->fetch_array($query); if(!is_array($properties) || count($properties) == 0)
| $query = $db->simple_select("themes", "*", "tid='".(int)$parent."'"); $parent_theme = $db->fetch_array($query); if(!is_array($properties) || count($properties) == 0)
|
Zeile 638 | 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 645 | Zeile 639 |
---|
$updated_theme['properties'] = $db->escape_string(my_serialize($properties));
if(count($updated_theme) > 0)
|
$updated_theme['properties'] = $db->escape_string(my_serialize($properties));
if(count($updated_theme) > 0)
|
{
| {
|
$db->update_query("themes", $updated_theme, "tid='{$tid}'"); }
| $db->update_query("themes", $updated_theme, "tid='{$tid}'"); }
|
Zeile 720 | Zeile 714 |
---|
function get_selectors_as_options($css, $selected_item=null) { $select = "";
|
function get_selectors_as_options($css, $selected_item=null) { $select = "";
|
if(!is_array($css))
| if(!is_array($css))
|
{ $css = css_to_array($css); }
|
{ $css = css_to_array($css); }
|
|
|
$selected = false;
|
$selected = false;
|
|
|
if(is_array($css)) { uasort($css, "css_selectors_sort_cmp");
|
if(is_array($css)) { uasort($css, "css_selectors_sort_cmp");
|
|
|
foreach($css as $id => $css_array) { if(!$css_array['name']) { $css_array['name'] = $css_array['class_name'];
|
foreach($css as $id => $css_array) { if(!$css_array['name']) { $css_array['name'] = $css_array['class_name'];
|
}
| }
|
if($selected_item == $id || (!$selected_item && !$selected)) { $select .= "<option value=\"{$id}\" selected=\"selected\">{$css_array['name']}</option>\n";
| if($selected_item == $id || (!$selected_item && !$selected)) { $select .= "<option value=\"{$id}\" selected=\"selected\">{$css_array['name']}</option>\n";
|
Zeile 831 | Zeile 825 |
---|
$css_bits['extra'] .= "{$property}: ".trim($css_value).";\n";
}
|
$css_bits['extra'] .= "{$property}: ".trim($css_value).";\n";
}
|
}
| }
|
return $css_bits; }
|
return $css_bits; }
|
|
|
/** * Inserts an incoming string of CSS in to an already defined document. If the class ID is not found, the CSS is appended to the file. *
| /** * Inserts an incoming string of CSS in to an already defined document. If the class ID is not found, the CSS is appended to the file. *
|
Zeile 850 | Zeile 844 |
---|
$new_css = str_replace(array("\r\n", "\n", "\r"), "\n", $new_css);
$generated_css = '';
|
$new_css = str_replace(array("\r\n", "\n", "\r"), "\n", $new_css);
$generated_css = '';
|
|
|
// Build the new CSS properties list $new_css = explode("\n", $new_css); foreach($new_css as $css_line) { $generated_css .= "\t".trim($css_line)."\n";
|
// Build the new CSS properties list $new_css = explode("\n", $new_css); foreach($new_css as $css_line) { $generated_css .= "\t".trim($css_line)."\n";
|
}
$parsed_css = array();
| }
$parsed_css = array();
|
// Parse out the CSS if($css)
|
// Parse out the CSS if($css)
|
{
| {
|
$parsed_css = css_to_array($css);
|
$parsed_css = css_to_array($css);
|
}
| }
|
if(!$class_id) { $class_id = $parsed_css[$selector]['class_name'];
|
if(!$class_id) { $class_id = $parsed_css[$selector]['class_name'];
|
}
| }
|
// The specified class ID cannot be found, add CSS to end of file if(!$css || !$parsed_css[$selector]) {
| // The specified class ID cannot be found, add CSS to end of file if(!$css || !$parsed_css[$selector]) {
|
Zeile 942 | Zeile 936 |
---|
if(!is_numeric($key)) { $new_stylesheet[$db->escape_string($key)] = $db->escape_string($value);
|
if(!is_numeric($key)) { $new_stylesheet[$db->escape_string($key)] = $db->escape_string($value);
|
} }
| } }
|
$sid = $db->insert_query("themestylesheets", $new_stylesheet);
|
$sid = $db->insert_query("themestylesheets", $new_stylesheet);
|
|
|
return $sid; }
| return $sid; }
|
Zeile 962 | Zeile 956 |
---|
global $mybb, $db, $cache, $plugins;
$stylesheets = array();
|
global $mybb, $db, $cache, $plugins;
$stylesheets = array();
|
|
|
$child_list = make_child_theme_list($tid); $parent_list = make_parent_theme_list($tid);
|
$child_list = make_child_theme_list($tid); $parent_list = make_parent_theme_list($tid);
|
|
|
if(!is_array($parent_list))
|
if(!is_array($parent_list))
|
{
| {
|
return false; }
| return false; }
|
Zeile 980 | Zeile 974 |
---|
if(empty($stylesheets[$stylesheet['name']])) { if($stylesheet['tid'] != $tid)
|
if(empty($stylesheets[$stylesheet['name']])) { if($stylesheet['tid'] != $tid)
|
{
| {
|
$stylesheet['inherited'] = $stylesheet['tid']; }
| $stylesheet['inherited'] = $stylesheet['tid']; }
|
Zeile 1018 | Zeile 1012 |
---|
{ $css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}"; break;
|
{ $css_url = "cache/themes/theme{$theme_id}/{$stylesheet['name']}"; break;
|
} } }
| } } }
|
if(is_object($plugins)) {
| if(is_object($plugins)) {
|
Zeile 1057 | Zeile 1051 |
---|
{ $theme_stylesheets['inherited']["{$attached_file}_{$action}"][$css_url] = $stylesheet['inherited']; }
|
{ $theme_stylesheets['inherited']["{$attached_file}_{$action}"][$css_url] = $stylesheet['inherited']; }
|
} }
| } }
|
}
// Now we have our list of built stylesheets, save them
| }
// Now we have our list of built stylesheets, save them
|
Zeile 1132 | Zeile 1126 |
---|
return true; }
|
return true; }
|
|
|
/** * @param int $tid *
| /** * @param int $tid *
|
Zeile 1168 | Zeile 1162 |
---|
$themes = array();
foreach($themes_by_parent[$tid] as $key => $theme)
|
$themes = array();
foreach($themes_by_parent[$tid] as $key => $theme)
|
{ $themes[] = $theme['tid'];
| { $themes[] = $theme['tid'];
|
$parents = make_parent_theme_list($theme['pid']);
if(is_array($parents))
| $parents = make_parent_theme_list($theme['pid']);
if(is_array($parents))
|
Zeile 1467 | Zeile 1461 |
---|
*/ function upgrade_css_120_to_140($css) {
|
*/ function upgrade_css_120_to_140($css) {
|
| global $mybb;
|
// Update our CSS to the new stuff in 1.4 $parsed_css = css_to_array($css);
| // Update our CSS to the new stuff in 1.4 $parsed_css = css_to_array($css);
|