diff options
author | Marc Alexander <admin@m-a-styles.de> | 2019-08-17 11:02:08 +0200 |
---|---|---|
committer | Marc Alexander <admin@m-a-styles.de> | 2019-08-17 11:02:08 +0200 |
commit | 9a992a48666b1769522002d84f5d6e995dca80fb (patch) | |
tree | 37840c99a0ed7a4bc7d0275439508ce1ceb00423 | |
parent | 2d8c5efbd26cecf00188c2e3d6d6235b820575a0 (diff) | |
parent | 6de0c7bc666ec934cc801cdf7cf94290a3d013f9 (diff) | |
download | forums-9a992a48666b1769522002d84f5d6e995dca80fb.tar forums-9a992a48666b1769522002d84f5d6e995dca80fb.tar.gz forums-9a992a48666b1769522002d84f5d6e995dca80fb.tar.bz2 forums-9a992a48666b1769522002d84f5d6e995dca80fb.tar.xz forums-9a992a48666b1769522002d84f5d6e995dca80fb.zip |
Merge pull request #5656 from 3D-I/ticket/16019
[ticket/16019] Deny prosilver's uninstallation
-rw-r--r-- | phpBB/adm/style/acp_styles.html | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_styles.php | 26 | ||||
-rw-r--r-- | phpBB/language/en/acp/styles.php | 85 |
3 files changed, 67 insertions, 48 deletions
diff --git a/phpBB/adm/style/acp_styles.html b/phpBB/adm/style/acp_styles.html index 38bec5a1e4..cfa804090f 100644 --- a/phpBB/adm/style/acp_styles.html +++ b/phpBB/adm/style/acp_styles.html @@ -146,7 +146,9 @@ {styles_list.EXTRA} <td class="{$ROW_CLASS} mark" width="20"> <!-- IF styles_list.STYLE_ID --> - <input class="checkbox" type="checkbox" name="ids[]" value="{styles_list.STYLE_ID}" /> + {% if styles_list.STYLE_NAME !== 'prosilver' %} + <input class="checkbox" type="checkbox" name="ids[]" value="{styles_list.STYLE_ID}" /> + {% endif %} <!-- ELSE --> <!-- IF styles_list.COMMENT != '' --> diff --git a/phpBB/includes/acp/acp_styles.php b/phpBB/includes/acp/acp_styles.php index 5029510839..87c8d88f52 100644 --- a/phpBB/includes/acp/acp_styles.php +++ b/phpBB/includes/acp/acp_styles.php @@ -259,6 +259,19 @@ class acp_styles // Get list of styles to uninstall $ids = $this->request_vars('id', 0, true); + // Don't remove prosilver, you can still deactivate it. + $sql = 'SELECT style_id + FROM ' . STYLES_TABLE . " + WHERE style_name = '" . $this->db->sql_escape('prosilver') . "'"; + $result = $this->db->sql_query($sql); + $prosilver_id = (int) $this->db->sql_fetchfield('style_id'); + $this->db->sql_freeresult($result); + + if ($prosilver_id && in_array($prosilver_id, $ids)) + { + trigger_error($this->user->lang('UNINSTALL_PROSILVER') . adm_back_link($this->u_action), E_USER_WARNING); + } + // Check if confirmation box was submitted if (confirm_box(true)) { @@ -998,11 +1011,14 @@ class acp_styles 'L_ACTION' => $this->user->lang['EXPORT'] ); */ - // Uninstall - $actions[] = array( - 'U_ACTION' => $this->u_action . '&action=uninstall&hash=' . generate_link_hash('uninstall') . '&id=' . $style['style_id'], - 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'] - ); + if ($style['style_name'] !== 'prosilver') + { + // Uninstall + $actions[] = array( + 'U_ACTION' => $this->u_action . '&action=uninstall&hash=' . generate_link_hash('uninstall') . '&id=' . $style['style_id'], + 'L_ACTION' => $this->user->lang['STYLE_UNINSTALL'] + ); + } // Preview $actions[] = array( diff --git a/phpBB/language/en/acp/styles.php b/phpBB/language/en/acp/styles.php index ab85d9d2f5..44be3c11cd 100644 --- a/phpBB/language/en/acp/styles.php +++ b/phpBB/language/en/acp/styles.php @@ -21,7 +21,7 @@ if (!defined('IN_PHPBB')) if (empty($lang) || !is_array($lang)) { - $lang = array(); + $lang = []; } // DEVELOPERS PLEASE NOTE @@ -36,55 +36,56 @@ if (empty($lang) || !is_array($lang)) // equally where a string contains only two placeholders which are used to wrap text // in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine -$lang = array_merge($lang, array( - 'ACP_STYLES_EXPLAIN' => 'Here you can manage the available styles on your board. You may alter existing styles, delete, deactivate, reactivate, install new ones. You can also see what a style will look like using the preview function. Also listed is the total user count for each style, note that overriding user styles will not be reflected here.', +$lang = array_merge($lang, [ + 'ACP_STYLES_EXPLAIN' => 'Here you can manage the styles available on your board.<br>Please note you cannot uninstall the “<strong>prosilver</strong>” style as it is phpBB’s default and primary parent style.', - 'CANNOT_BE_INSTALLED' => 'Cannot be installed', - 'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?', - 'COPYRIGHT' => 'Copyright', + 'CANNOT_BE_INSTALLED' => 'Cannot be installed', + 'CONFIRM_UNINSTALL_STYLES' => 'Are you sure you wish to uninstall selected styles?', + 'COPYRIGHT' => 'Copyright', - 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', - 'DELETE_FROM_FS' => 'Delete from filesystem', - 'DELETE_STYLE_FILES_FAILED' => 'Error deleting files for style "%s".', - 'DELETE_STYLE_FILES_SUCCESS' => 'Files for style "%s" have been deleted.', - 'DETAILS' => 'Details', + 'DEACTIVATE_DEFAULT' => 'You cannot deactivate the default style.', + 'DELETE_FROM_FS' => 'Delete from filesystem', + 'DELETE_STYLE_FILES_FAILED' => 'Error deleting files for style "%s".', + 'DELETE_STYLE_FILES_SUCCESS' => 'Files for style "%s" have been deleted.', + 'DETAILS' => 'Details', - 'INHERITING_FROM' => 'Inherits from', - 'INSTALL_STYLE' => 'Install style', - 'INSTALL_STYLES' => 'Install styles', - 'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.<br />If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.', - 'INVALID_STYLE_ID' => 'Invalid style ID.', + 'INHERITING_FROM' => 'Inherits from', + 'INSTALL_STYLE' => 'Install style', + 'INSTALL_STYLES' => 'Install styles', + 'INSTALL_STYLES_EXPLAIN' => 'Here you can install new styles.<br>If you cannot find a specific style in list below, check to make sure style is already installed. If it is not installed, check if it was uploaded correctly.', + 'INVALID_STYLE_ID' => 'Invalid style ID.', - 'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.', - 'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.', + 'NO_MATCHING_STYLES_FOUND' => 'No styles match your query.', + 'NO_UNINSTALLED_STYLE' => 'No uninstalled styles detected.', - 'PURGED_CACHE' => 'Cache was purged.', + 'PURGED_CACHE' => 'Cache was purged.', - 'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.', + 'REQUIRES_STYLE' => 'This style requires the style "%s" to be installed.', - 'STYLE_ACTIVATE' => 'Activate', - 'STYLE_ACTIVE' => 'Active', - 'STYLE_DEACTIVATE' => 'Deactivate', - 'STYLE_DEFAULT' => 'Make default style', - 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', - 'STYLE_ERR_INVALID_PARENT' => 'Invalid parent style.', - 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', - 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', - 'STYLE_INSTALLED' => 'Style "%s" has been installed.', + 'STYLE_ACTIVATE' => 'Activate', + 'STYLE_ACTIVE' => 'Active', + 'STYLE_DEACTIVATE' => 'Deactivate', + 'STYLE_DEFAULT' => 'Make default style', + 'STYLE_DEFAULT_CHANGE_INACTIVE' => 'You must activate style before making it default style.', + 'STYLE_ERR_INVALID_PARENT' => 'Invalid parent style.', + 'STYLE_ERR_NAME_EXIST' => 'A style with that name already exists.', + 'STYLE_ERR_STYLE_NAME' => 'You must supply a name for this style.', + 'STYLE_INSTALLED' => 'Style "%s" has been installed.', 'STYLE_INSTALLED_RETURN_INSTALLED_STYLES' => 'Return to installed styles list', 'STYLE_INSTALLED_RETURN_UNINSTALLED_STYLES' => 'Install more styles', - 'STYLE_NAME' => 'Style name', - 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', - 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', - 'STYLE_PATH' => 'Style path', - 'STYLE_UNINSTALL' => 'Uninstall', - 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', - 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', - 'STYLE_PHPBB_VERSION' => 'phpBB Version', - 'STYLE_USED_BY' => 'Used by (including robots)', - 'STYLE_VERSION' => 'Style version', + 'STYLE_NAME' => 'Style name', + 'STYLE_NAME_RESERVED' => 'Style "%s" can not be installed, because the name is reserved.', + 'STYLE_NOT_INSTALLED' => 'Style "%s" was not installed.', + 'STYLE_PATH' => 'Style path', + 'STYLE_UNINSTALL' => 'Uninstall', + 'STYLE_UNINSTALL_DEPENDENT' => 'Style "%s" cannot be uninstalled because it has one or more child styles.', + 'STYLE_UNINSTALLED' => 'Style "%s" uninstalled successfully.', + 'STYLE_PHPBB_VERSION' => 'phpBB Version', + 'STYLE_USED_BY' => 'Used by (including robots)', + 'STYLE_VERSION' => 'Style version', - 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', + 'UNINSTALL_PROSILVER' => 'You cannot uninstall the style “prosilver”.', + 'UNINSTALL_DEFAULT' => 'You cannot uninstall the default style.', - 'BROWSE_STYLES_DATABASE' => 'Browse styles database', -)); + 'BROWSE_STYLES_DATABASE' => 'Browse styles database', +]); |