[ticket/16019] Deny prosilver's uninstallation

PHPBB3-16019
This commit is contained in:
3D-I 2019-08-13 04:30:48 +02:00
parent 0a5d167441
commit 3fbdb2f345
2 changed files with 14 additions and 1 deletions

View file

@ -289,6 +289,14 @@ class acp_styles
{ {
global $user, $phpbb_log; global $user, $phpbb_log;
// 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_fetchrow($result);
$this->db->sql_freeresult($result);
$default = $this->default_style; $default = $this->default_style;
$uninstalled = array(); $uninstalled = array();
$messages = array(); $messages = array();
@ -296,6 +304,10 @@ class acp_styles
// Check styles list // Check styles list
foreach ($ids as $id) foreach ($ids as $id)
{ {
if ($id == $prosilver_id)
{
trigger_error($this->user->lang['UNINSTALL_PROSILVER'] . adm_back_link($this->u_action), E_USER_WARNING);
}
if (!$id) if (!$id)
{ {
trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING); trigger_error($this->user->lang['INVALID_STYLE_ID'] . adm_back_link($this->u_action), E_USER_WARNING);

View file

@ -84,7 +84,8 @@ $lang = array_merge($lang, array(
'STYLE_USED_BY' => 'Used by (including robots)', 'STYLE_USED_BY' => 'Used by (including robots)',
'STYLE_VERSION' => 'Style version', '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',
)); ));