diff options
author | Ivo Kurzemnieks <ivo.kurzemnieks@zabbix.com> | 2021-05-28 10:33:58 +0300 |
---|---|---|
committer | Ivo Kurzemnieks <ivo.kurzemnieks@zabbix.com> | 2021-05-28 10:33:58 +0300 |
commit | a71344e8727afcb6e96c6130ba9b0d6dfeb866f4 (patch) | |
tree | 719c0b260579dcf514df88caa7b891baa7f6f549 /ui/app | |
parent | 9730e3ea47ae394159b07b57a17b763f50aac5bd (diff) | |
parent | 2f4cef24f8a8410cec2934568f42763cc0d8cd7f (diff) |
.......... [ZBX-19446] updated to latest from release/5.4
Diffstat (limited to 'ui/app')
-rw-r--r-- | ui/app/controllers/CControllerMenuPopup.php | 5 | ||||
-rw-r--r-- | ui/app/controllers/CControllerPopupMassupdateHost.php | 22 | ||||
-rw-r--r-- | ui/app/controllers/CControllerProxyHostDisable.php | 2 | ||||
-rw-r--r-- | ui/app/controllers/CControllerProxyHostEnable.php | 2 | ||||
-rw-r--r-- | ui/app/partials/configuration.tags.tab.php | 2 | ||||
-rw-r--r-- | ui/app/partials/hostmacros.inherited.list.html.php | 4 | ||||
-rw-r--r-- | ui/app/views/js/popup.massupdate.tmpl.js.php | 2 |
7 files changed, 28 insertions, 11 deletions
diff --git a/ui/app/controllers/CControllerMenuPopup.php b/ui/app/controllers/CControllerMenuPopup.php index e7bb29ea293..71fc3d898c8 100644 --- a/ui/app/controllers/CControllerMenuPopup.php +++ b/ui/app/controllers/CControllerMenuPopup.php @@ -620,7 +620,8 @@ class CControllerMenuPopup extends CController { $menu_data['urls'][] = [ 'label' => $url['name'], 'url' => $url['url'], - 'target' => '_blank' + 'target' => '_blank', + 'rel' => 'noopener'.(ZBX_NOREFERER ? ' noreferrer' : '') ]; } } @@ -632,7 +633,7 @@ class CControllerMenuPopup extends CController { $url['url'] = 'javascript: alert(\''. _s('Provided URL "%1$s" is invalid.', zbx_jsvalue($url['url'], false, false)). '\');'; - unset($url['target']); + unset($url['target'], $url['rel']); } } unset($url); diff --git a/ui/app/controllers/CControllerPopupMassupdateHost.php b/ui/app/controllers/CControllerPopupMassupdateHost.php index 45463f60662..4c39dc6b0c1 100644 --- a/ui/app/controllers/CControllerPopupMassupdateHost.php +++ b/ui/app/controllers/CControllerPopupMassupdateHost.php @@ -118,7 +118,7 @@ class CControllerPopupMassupdateHost extends CControllerPopupMassupdateAbstract // filter only normal and discovery created hosts $options = [ - 'output' => ['hostid', 'inventory_mode'], + 'output' => ['hostid', 'inventory_mode', 'flags'], 'hostids' => $hostids, 'filter' => ['flags' => [ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_CREATED]] ]; @@ -289,7 +289,12 @@ class CControllerPopupMassupdateHost extends CControllerPopupMassupdateAbstract } } - if (array_key_exists('inventory_mode', $new_values)) { + /* + * Inventory mode cannot be changed for discovered hosts. If discovered host has disabled inventory + * mode, inventory values also cannot be changed. + */ + if (array_key_exists('inventory_mode', $new_values) + && $host['flags'] != ZBX_FLAG_DISCOVERY_CREATED) { $host['inventory'] = $host_inventory; } elseif ($host['inventory_mode'] != HOST_INVENTORY_DISABLED) { @@ -407,10 +412,21 @@ class CControllerPopupMassupdateHost extends CControllerPopupMassupdateAbstract unset($host['parentTemplates']); $host = $new_values + $host; + + /* + * API prevents changing host inventory_mode for discovered hosts. However, inventory values can + * still be updated if inventory mode allows it. + */ + if ($host['flags'] == ZBX_FLAG_DISCOVERY_CREATED) { + unset($host['inventory_mode']); + } + unset($host['flags']); } unset($host); - if (!API::Host()->update($hosts)) { + $result = $hosts ? (bool) API::Host()->update($hosts) : true; + + if ($result === false) { throw new Exception(); } diff --git a/ui/app/controllers/CControllerProxyHostDisable.php b/ui/app/controllers/CControllerProxyHostDisable.php index 0048a636d75..990da67cb7b 100644 --- a/ui/app/controllers/CControllerProxyHostDisable.php +++ b/ui/app/controllers/CControllerProxyHostDisable.php @@ -63,7 +63,7 @@ class CControllerProxyHostDisable extends CController { } unset($host); - $result = API::Host()->update($hosts); + $result = $hosts ? (bool) API::Host()->update($hosts) : true; $updated = count($hosts); diff --git a/ui/app/controllers/CControllerProxyHostEnable.php b/ui/app/controllers/CControllerProxyHostEnable.php index ef255370d24..6a21002ed39 100644 --- a/ui/app/controllers/CControllerProxyHostEnable.php +++ b/ui/app/controllers/CControllerProxyHostEnable.php @@ -63,7 +63,7 @@ class CControllerProxyHostEnable extends CController { } unset($host); - $result = API::Host()->update($hosts); + $result = $hosts ? (bool) API::Host()->update($hosts) : true; $updated = count($hosts); diff --git a/ui/app/partials/configuration.tags.tab.php b/ui/app/partials/configuration.tags.tab.php index 2c4fafed6e6..10a8d0ea202 100644 --- a/ui/app/partials/configuration.tags.tab.php +++ b/ui/app/partials/configuration.tags.tab.php @@ -95,7 +95,7 @@ foreach ($data['tags'] as $i => $tag) { (new CUrl('templates.php')) ->setArgument('form', 'update') ->setArgument('templateid', $templateid) - ))->setAttribute('target', '_blank'); + ))->setTarget('_blank'); } else { $template_list[] = (new CSpan($template['name']))->addClass(ZBX_STYLE_GREY); diff --git a/ui/app/partials/hostmacros.inherited.list.html.php b/ui/app/partials/hostmacros.inherited.list.html.php index 36862d58ae3..18d2dddcac8 100644 --- a/ui/app/partials/hostmacros.inherited.list.html.php +++ b/ui/app/partials/hostmacros.inherited.list.html.php @@ -40,7 +40,7 @@ else { ->setArgument('action', 'macros.edit') ->getUrl() )) - ->setAttribute('target', '_blank'); + ->setTarget('_blank'); $link = [' (', $link, ')']; } @@ -139,7 +139,7 @@ else { 'templates.php?form=update&templateid='.$macro['template']['templateid']) ) ->addClass('unknown') - ->setAttribute('target', '_blank'); + ->setTarget('_blank'); } else { $link = new CSpan(CHtml::encode($macro['template']['name'])); diff --git a/ui/app/views/js/popup.massupdate.tmpl.js.php b/ui/app/views/js/popup.massupdate.tmpl.js.php index 8cfc95681de..0f94b347051 100644 --- a/ui/app/views/js/popup.massupdate.tmpl.js.php +++ b/ui/app/views/js/popup.massupdate.tmpl.js.php @@ -102,7 +102,7 @@ <tr id="dependency_#{triggerid}" data-triggerid="#{triggerid}"> <td> <input type="hidden" name="dependencies[]" id="dependencies_#{triggerid}" value="#{triggerid}"> - <a href="#{url}" target="_blank">#{name}</a> + <a href="#{url}" target="_blank" rel="noopener<?= ZBX_NOREFERER ? ' noreferrer' : '' ?>">#{name}</a> </td> <td class="<?= ZBX_STYLE_NOWRAP ?>"> <?= (new CButton('remove', _('Remove'))) |