mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 22:38:52 +00:00
Merge remote-tracking branch 'nickvergessen/ticket/10531' into prep-release-3.0.10
* nickvergessen/ticket/10531: [ticket/10531] Disallow deleting of the last style
This commit is contained in:
commit
56c3a66c28
1 changed files with 16 additions and 2 deletions
|
@ -1634,6 +1634,13 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING);
|
trigger_error($user->lang['NO_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$s_only_component = $this->display_component_options($mode, $style_row[$mode . '_id'], $style_row);
|
||||||
|
|
||||||
|
if ($s_only_component)
|
||||||
|
{
|
||||||
|
trigger_error($user->lang['ONLY_' . $l_prefix] . adm_back_link($this->u_action), E_USER_WARNING);
|
||||||
|
}
|
||||||
|
|
||||||
if ($update)
|
if ($update)
|
||||||
{
|
{
|
||||||
if ($mode == 'style')
|
if ($mode == 'style')
|
||||||
|
@ -1678,8 +1685,6 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
|
trigger_error($user->lang[$message] . adm_back_link($this->u_action));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->display_component_options($mode, $style_row[$mode . '_id'], $style_row);
|
|
||||||
|
|
||||||
$this->page_title = 'DELETE_' . $l_prefix;
|
$this->page_title = 'DELETE_' . $l_prefix;
|
||||||
|
|
||||||
$template->assign_vars(array(
|
$template->assign_vars(array(
|
||||||
|
@ -1765,11 +1770,14 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the options which can be used to replace a style/template/theme/imageset
|
* Display the options which can be used to replace a style/template/theme/imageset
|
||||||
|
*
|
||||||
|
* @return boolean Returns true if the component is the only component and can not be deleted.
|
||||||
*/
|
*/
|
||||||
function display_component_options($component, $component_id, $style_row = false, $style_id = false)
|
function display_component_options($component, $component_id, $style_row = false, $style_id = false)
|
||||||
{
|
{
|
||||||
global $db, $template, $user;
|
global $db, $template, $user;
|
||||||
|
|
||||||
|
$is_only_component = true;
|
||||||
$component_in_use = array();
|
$component_in_use = array();
|
||||||
if ($component != 'style')
|
if ($component != 'style')
|
||||||
{
|
{
|
||||||
|
@ -1801,6 +1809,9 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
$s_options = '';
|
$s_options = '';
|
||||||
if (($component != 'style') && empty($component_in_use))
|
if (($component != 'style') && empty($component_in_use))
|
||||||
{
|
{
|
||||||
|
// If it is not in use, there must be another component
|
||||||
|
$is_only_component = false;
|
||||||
|
|
||||||
$sql = "SELECT {$component}_id, {$component}_name
|
$sql = "SELECT {$component}_id, {$component}_name
|
||||||
FROM $sql_from
|
FROM $sql_from
|
||||||
WHERE {$component}_id = {$component_id}";
|
WHERE {$component}_id = {$component_id}";
|
||||||
|
@ -1824,6 +1835,7 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
{
|
{
|
||||||
if ($row[$component . '_id'] != $component_id)
|
if ($row[$component . '_id'] != $component_id)
|
||||||
{
|
{
|
||||||
|
$is_only_component = false;
|
||||||
$s_options .= '<option value="' . $row[$component . '_id'] . '">' . sprintf($user->lang['REPLACE_WITH_OPTION'], $row[$component . '_name']) . '</option>';
|
$s_options .= '<option value="' . $row[$component . '_id'] . '">' . sprintf($user->lang['REPLACE_WITH_OPTION'], $row[$component . '_name']) . '</option>';
|
||||||
}
|
}
|
||||||
else if ($component != 'style')
|
else if ($component != 'style')
|
||||||
|
@ -1851,6 +1863,8 @@ parse_css_file = {PARSE_CSS_FILE}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $is_only_component;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue