diff options
author | Andreas Fischer <bantu@phpbb.com> | 2011-12-16 16:19:22 +0100 |
---|---|---|
committer | Andreas Fischer <bantu@phpbb.com> | 2011-12-16 16:19:22 +0100 |
commit | 124ff6c50a3805aec4410942d2b5aa428bee3ddf (patch) | |
tree | ac79feb6d8050b4f37029a421c84f05aa0a57602 /phpBB | |
parent | 93701adf02c6198bc8bdb3afe1066f65e8449f5e (diff) | |
parent | 8f690d34751a1da68cb71d068ea75121a9386724 (diff) | |
download | forums-124ff6c50a3805aec4410942d2b5aa428bee3ddf.tar forums-124ff6c50a3805aec4410942d2b5aa428bee3ddf.tar.gz forums-124ff6c50a3805aec4410942d2b5aa428bee3ddf.tar.bz2 forums-124ff6c50a3805aec4410942d2b5aa428bee3ddf.tar.xz forums-124ff6c50a3805aec4410942d2b5aa428bee3ddf.zip |
Merge branch 'develop-olympus' into develop
* develop-olympus:
[ticket/10531] Disallow deleting of the last style
Conflicts:
phpBB/includes/acp/acp_styles.php
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index c480021507..b31d7763aa 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -962,6 +962,13 @@ version = {VERSION} 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 ($mode == 'style') @@ -1006,8 +1013,6 @@ version = {VERSION} 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; $template->assign_vars(array( @@ -1082,11 +1087,14 @@ version = {VERSION} /** * Display the options which can be used to replace a style/template/theme + * + * @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) { global $db, $template, $user; + $is_only_component = true; $component_in_use = array(); if ($component != 'style') { @@ -1114,6 +1122,9 @@ version = {VERSION} $s_options = ''; 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 FROM $sql_from WHERE {$component}_id = {$component_id}"; @@ -1137,6 +1148,7 @@ version = {VERSION} { 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>'; } else if ($component != 'style') @@ -1164,6 +1176,8 @@ version = {VERSION} } } } + + return $is_only_component; } /** |