$data['screen'] = get_slideshow_by_slideshowid($data['elementId'], PERM_READ); if (!$data['screen']) { // Redirect to slide show list. ob_end_clean(); redirect('slideconf.php'); } } $data['fullscreen'] = getRequest('fullscreen'); if ($data['screen']) { // get groups and hosts if (check_dynamic_items($data['elementId'], 1)) { $data['isDynamicItems'] = true; $data['pageFilter'] = new CPageFilter(['groups' => ['monitored_hosts' => true, 'with_items' => true], 'hosts' => ['monitored_hosts' => true, 'with_items' => true, 'DDFirstLabel' => _('not selected')], 'hostid' => getRequest('hostid'), 'groupid' => getRequest('groupid')]); $data['groupid'] = $data['pageFilter']->groupid; $data['hostid'] = $data['pageFilter']->hostid; } // get element $data['element'] = get_slideshow_by_slideshowid($data['elementId'], PERM_READ); $data['screen']['editable'] = (bool) get_slideshow_by_slideshowid($data['elementId'], PERM_READ_WRITE); if ($data['screen']['delay'] > 0) { $data['element']['delay'] = $data['screen']['delay']; } show_messages(); } // refresh $data['refreshMultiplier'] = CProfile::get('web.slides.rf_rate.' . WIDGET_SLIDESHOW, 1, $data['elementId']); // render view $slidesView = new CView('monitoring.slides', $data); $slidesView->render(); $slidesView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
require_once dirname(__FILE__) . '/include/page_footer.php'; exit; } /* * Display */ $data = array('hostid' => getRequest('hostid', 0), 'fullscreen' => $_REQUEST['fullscreen'], 'screenid' => getRequest('screenid', CProfile::get('web.hostscreen.screenid', null)), 'period' => getRequest('period'), 'stime' => getRequest('stime')); CProfile::update('web.hostscreen.screenid', $data['screenid'], PROFILE_TYPE_ID); // get screen list $data['screens'] = API::TemplateScreen()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND)); $data['screens'] = zbx_toHash($data['screens'], 'screenid'); order_result($data['screens'], 'name'); // get screen $screenid = null; if (!empty($data['screens'])) { $screen = !isset($data['screens'][$data['screenid']]) ? reset($data['screens']) : $data['screens'][$data['screenid']]; if (!empty($screen['screenid'])) { $screenid = $screen['screenid']; } } $data['screen'] = API::TemplateScreen()->get(array('screenids' => $screenid, 'hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'selectScreenItems' => API_OUTPUT_EXTEND)); $data['screen'] = reset($data['screen']); // get host if (!empty($data['screen']['hostid'])) { $data['host'] = get_host_by_hostid($data['screen']['hostid']); } // render view $screenView = new CView('monitoring.hostscreen', $data); $screenView->render(); $screenView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
case AUDIT_ACTION_ENABLE: $action = _('Enabled'); break; case AUDIT_ACTION_DISABLE: $action = _('Disabled'); break; default: $action = _('Unknown action'); } $audit['action'] = $action; $audit['resourcetype'] = audit_resource2str($audit['resourcetype']); if (empty($audit['details'])) { $audit['details'] = DBfetchArray(DBselect('SELECT ad.table_name,ad.field_name,ad.oldvalue,ad.newvalue' . ' FROM auditlog_details ad' . ' WHERE ad.auditid=' . zbx_dbstr($audit['auditid']))); } $data['actions'][$audit['auditid']] = $audit; } if (!empty($data['actions'])) { order_result($data['actions'], 'clock', ZBX_SORT_DOWN); } // get paging $data['paging'] = getPagingLine($data['actions'], ZBX_SORT_DOWN, new CUrl('auditlogs.php')); // get timeline unset($sqlWhere['from'], $sqlWhere['till']); $sql = 'SELECT MIN(a.clock) AS clock' . ' FROM auditlog a,users u' . ' WHERE a.userid=u.userid' . implode('', $sqlWhere); $firstAudit = DBfetch(DBselect($sql, $config['search_limit'] + 1)); $data['timeline'] = ['period' => $effectivePeriod, 'starttime' => date(TIMESTAMP_FORMAT, $firstAudit ? $firstAudit['clock'] : null), 'usertime' => isset($_REQUEST['stime']) ? date(TIMESTAMP_FORMAT, zbxDateToTime($data['stime']) + $effectivePeriod) : null]; // render view $auditView = new CView('administration.auditlogs.list', $data); $auditView->render(); $auditView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
show_error_message(_('Cannot update macros')); } } /* * Display */ $form = new CForm(); $form->cleanItems(); $cmbConf = new CComboBox('configDropDown', 'adm.macros.php', 'redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other'))); $form->addItem($cmbConf); $cnf_wdgt = new CWidget(); $cnf_wdgt->addPageHeader(_('CONFIGURATION OF MACROS'), $form); $data = array(); $data['form_refresh'] = get_request('form_refresh', 0); $data['macros'] = array(); if ($data['form_refresh']) { $data['macros'] = get_request('macros', array()); } else { $data['macros'] = API::UserMacro()->get(array('output' => API_OUTPUT_EXTEND, 'globalmacro' => 1)); } if (empty($data['macros'])) { $data['macros'] = array(0 => array('macro' => '', 'value' => '')); } if ($result) { $data['macros'] = order_macros($data['macros'], 'macro'); } $macrosForm = new CView('administration.general.macros.edit', $data); $cnf_wdgt->addItem($macrosForm->render()); $cnf_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$isValid = $triggerFunctionValidator->validate(['function' => $expressionData['function'], 'functionName' => $expressionData['functionName'], 'functionParamList' => $expressionData['functionParamList'], 'valueType' => $data['itemValueType']]); if (!$isValid) { unset($data['insert']); throw new Exception($triggerFunctionValidator->getError()); } } else { unset($data['insert']); throw new Exception($triggerExpression->error); } // quote function param if (isset($data['insert'])) { foreach ($data['params'] as $pnum => $param) { $data['params'][$pnum] = quoteFunctionParam($param); } } } else { unset($data['insert']); throw new Exception(_('Item not selected')); } } catch (Exception $e) { error($e->getMessage()); show_error_message(_('Cannot insert trigger expression')); } } elseif (hasErrorMesssages()) { show_messages(); } // render view $expressionView = new CView('configuration.triggers.expression', $data); $expressionView->render(); $expressionView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$messageFailed = _('Cannot change authentication method to HTTP'); DBstart(); $result = update_config($config); if ($result) { // reset all sessions if ($isAuthenticationTypeChanged) { $result &= DBexecute('UPDATE sessions SET status=' . ZBX_SESSION_PASSIVE . ' WHERE sessionid<>' . zbx_dbstr(CWebUser::$data['sessionid'])); } $isAuthenticationTypeChanged = false; add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ZABBIX_CONFIG, $messageSuccess); } $result = DBend($result); show_messages($result, $messageSuccess, $messageFailed); } } show_messages(); /* * Display */ $data = array('form_refresh' => getRequest('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => getRequest('user', CWebUser::$data['alias']), 'user_password' => getRequest('user_password', ''), 'user_list' => null, 'change_bind_password' => getRequest('change_bind_password')); // get tab title $data['title'] = authentication2str($config['authentication_type']); // get user list if (getUserGuiAccess(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) { $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid FROM users u ORDER BY u.alias')); } // render view $authenticationView = new CView('administration.authentication.edit', $data); $authenticationView->render(); $authenticationView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
<?php /* ** Zabbix ** Copyright (C) 2001-2013 Zabbix SIA ** ** This program is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program; if not, write to the Free Software ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/include/gettextwrapper.inc.php'; require_once dirname(__FILE__) . '/include/func.inc.php'; require_once dirname(__FILE__) . '/include/defines.inc.php'; require_once dirname(__FILE__) . '/include/classes/class.cview.php'; $browserWarningForm = new CView('general.browserwarning'); $browserWarningForm->render();
* Display */ $form = new CForm(); $form->cleanItems(); $cmbConf = new CComboBox('configDropDown', 'adm.triggerseverities.php', 'redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other'))); $form->addItem($cmbConf); $cnf_wdgt = new CWidget(); $cnf_wdgt->addPageHeader(_('CONFIGURATION OF TRIGGER SEVERITIES'), $form); $data = array(); $data['form_refresh'] = getRequest('form_refresh', 0); if ($data['form_refresh']) { $data['config']['severity_name_0'] = getRequest('severity_name_0'); $data['config']['severity_color_0'] = getRequest('severity_color_0', ''); $data['config']['severity_name_1'] = getRequest('severity_name_1'); $data['config']['severity_color_1'] = getRequest('severity_color_1', ''); $data['config']['severity_name_2'] = getRequest('severity_name_2'); $data['config']['severity_color_2'] = getRequest('severity_color_2', ''); $data['config']['severity_name_3'] = getRequest('severity_name_3'); $data['config']['severity_color_3'] = getRequest('severity_color_3', ''); $data['config']['severity_name_4'] = getRequest('severity_name_4'); $data['config']['severity_color_4'] = getRequest('severity_color_4', ''); $data['config']['severity_name_5'] = getRequest('severity_name_5'); $data['config']['severity_color_5'] = getRequest('severity_color_5', ''); } else { $data['config'] = select_config(false); } $triggerSeverityForm = new CView('administration.general.triggerSeverity.edit', $data); $cnf_wdgt->addItem($triggerSeverityForm->render()); $cnf_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$menu_selected = true; $sub_menu_div->setAttribute('style', 'display: block;'); insert_js('MMenu.def_label = ' . zbx_jsvalue($label)); } else { $sub_menu_div->setAttribute('style', 'display: none;'); } $menu_divs[] = $sub_menu_div; } $sub_menu_div = new CDiv(SPACE); $sub_menu_div->setAttribute('id', 'sub_empty'); $sub_menu_div->setAttribute('style', 'display: ' . ($menu_selected ? 'none;' : 'block;')); $menu_divs[] = $sub_menu_div; $search_div = null; if ($page['file'] != 'index.php' && CWebUser::$data['userid'] > 0) { $searchForm = new CView('general.search'); $search_div = $searchForm->render(); } $sub_menu_table->addRow(array($menu_divs, $search_div)); $page_menu->addItem($sub_menu_table); $page_menu->show(); } // create history if (isset($page['hist_arg']) && CWebUser::$data['alias'] != ZBX_GUEST_USER && $page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) { $table = new CTable(null, 'history left'); $table->addRow(new CRow(array(new CCol(_('History') . ':', 'caption'), get_user_history()))); $table->show(); } elseif ($page['type'] == PAGE_TYPE_HTML && !defined('ZBX_PAGE_NO_MENU')) { echo SBR; } // unset multiple variables unset($ZBX_MENU, $table, $top_page_row, $menu_table, $node_form, $main_menu_row, $db_nodes, $node_data, $sub_menu_table, $sub_menu_rows);
} // new operation if (!empty($data['new_operation'])) { if (!is_array($data['new_operation'])) { $data['new_operation'] = array('action' => 'create', 'operationtype' => 0, 'esc_period' => 0, 'esc_step_from' => 1, 'esc_step_to' => 1, 'evaltype' => 0); } } // render view $actionView = new CView('configuration.action.edit', $data); $actionView->render(); $actionView->show(); } else { $data = array('eventsource' => getRequest('eventsource', CProfile::get('web.actionconf.eventsource', EVENT_SOURCE_TRIGGERS)), 'displayNodes' => is_array(get_current_nodeid())); $sortfield = getPageSortField('name'); $data['actions'] = API::Action()->get(array('output' => API_OUTPUT_EXTEND, 'filter' => array('eventsource' => array($data['eventsource'])), 'selectConditions' => API_OUTPUT_EXTEND, 'selectOperations' => API_OUTPUT_EXTEND, 'editable' => true, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1)); // sorting && paging order_result($data['actions'], $sortfield, getPageSortOrder()); $data['paging'] = getPagingLine($data['actions'], array('actionid')); // nodes if ($data['displayNodes']) { foreach ($data['actions'] as &$action) { $action['nodename'] = get_node_name_by_elid($action['actionid'], true); } unset($action); } // render view $actionView = new CView('configuration.action.list', $data); $actionView->render(); $actionView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
$cmbIPMIAuthtype = new CTextBox('ipmi_authtype_name', ipmiAuthTypes($dbHost['ipmi_authtype']), ZBX_TEXTBOX_SMALL_SIZE, true); $ipmiList->addRow(_('Authentication algorithm'), $cmbIPMIAuthtype); $cmbIPMIPrivilege = new CTextBox('ipmi_privilege_name', ipmiPrivileges($dbHost['ipmi_privilege']), ZBX_TEXTBOX_SMALL_SIZE, true); $ipmiList->addRow(_('Privilege level'), $cmbIPMIPrivilege); } $ipmiList->addRow(_('Username'), new CTextBox('ipmi_username', $ipmi_username, ZBX_TEXTBOX_SMALL_SIZE, $isDiscovered)); $ipmiList->addRow(_('Password'), new CTextBox('ipmi_password', $ipmi_password, ZBX_TEXTBOX_SMALL_SIZE, $isDiscovered)); $divTabs->addTab('ipmiTab', _('IPMI'), $ipmiList); /* * Macros */ if (empty($macros)) { $macros = array(array('macro' => '', 'value' => '')); } $macrosView = new CView('common.macros', array('macros' => $macros, 'readonly' => $isDiscovered)); $divTabs->addTab('macroTab', _('Macros'), $macrosView->render()); $inventoryFormList = new CFormList('inventorylist'); // radio buttons for inventory type choice $inventoryMode = isset($dbHost['inventory']['inventory_mode']) ? $dbHost['inventory']['inventory_mode'] : HOST_INVENTORY_DISABLED; $inventoryDisabledBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_DISABLED, null, 'host_inventory_radio_' . HOST_INVENTORY_DISABLED, $inventoryMode == HOST_INVENTORY_DISABLED); $inventoryDisabledBtn->setEnabled(!$isDiscovered); $inventoryManualBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_MANUAL, null, 'host_inventory_radio_' . HOST_INVENTORY_MANUAL, $inventoryMode == HOST_INVENTORY_MANUAL); $inventoryManualBtn->setEnabled(!$isDiscovered); $inventoryAutomaticBtn = new CRadioButton('inventory_mode', HOST_INVENTORY_AUTOMATIC, null, 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC, $inventoryMode == HOST_INVENTORY_AUTOMATIC); $inventoryAutomaticBtn->setEnabled(!$isDiscovered); $inventoryTypeRadioButton = array($inventoryDisabledBtn, new CLabel(_('Disabled'), 'host_inventory_radio_' . HOST_INVENTORY_DISABLED), $inventoryManualBtn, new CLabel(_('Manual'), 'host_inventory_radio_' . HOST_INVENTORY_MANUAL), $inventoryAutomaticBtn, new CLabel(_('Automatic'), 'host_inventory_radio_' . HOST_INVENTORY_AUTOMATIC)); $inventoryFormList->addRow(SPACE, new CDiv($inventoryTypeRadioButton, 'jqueryinputset')); $hostInventoryTable = DB::getSchema('host_inventory'); $hostInventoryFields = getHostInventories(); foreach ($hostInventoryFields as $inventoryNo => $inventoryInfo) { if (!isset($host_inventory[$inventoryInfo['db_field']])) {
$data['applications'] = API::Application()->get(array('applicationids' => $applicationIds, 'output' => API_OUTPUT_EXTEND, 'selectItems' => array('itemid'), 'selectHost' => array('hostid', 'name'))); order_result($data['applications'], $sortField, $sortOrder); // fetch template application source parents $applicationSourceParentIds = getApplicationSourceParentIds($applicationIds); $parentAppIds = array(); foreach ($applicationSourceParentIds as $applicationParentIds) { foreach ($applicationParentIds as $parentId) { $parentAppIds[$parentId] = $parentId; } } if ($parentAppIds) { $parentTemplates = DBfetchArrayAssoc(DBselect('SELECT a.applicationid,h.hostid,h.name' . ' FROM applications a,hosts h' . ' WHERE a.hostid=h.hostid' . ' AND ' . dbConditionInt('a.applicationid', $parentAppIds)), 'applicationid'); foreach ($data['applications'] as &$application) { if ($application['templateids'] && isset($applicationSourceParentIds[$application['applicationid']])) { foreach ($applicationSourceParentIds[$application['applicationid']] as $parentAppId) { $application['sourceTemplates'][] = $parentTemplates[$parentAppId]; } } } } } else { $data['applications'] = array(); } // get paging $data['paging'] = getPagingLine($data['applications'], $sortOrder); // render view $applicationView = new CView('configuration.application.list', $data); $applicationView->render(); $applicationView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
$help_hint = (new CList())->addClass(ZBX_STYLE_NOTIF_BODY)->addStyle('min-width: ' . ZBX_OVERVIEW_HELP_MIN_WIDTH . 'px')->addItem([(new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle(null, false)), new CTag('h4', true, _('OK')), (new CTag('p', true, ''))->addClass(ZBX_STYLE_GREY)]); for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $help_hint->addItem([(new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle($severity)), new CTag('h4', true, getSeverityName($severity, $data['config'])), (new CTag('p', true, _('PROBLEM')))->addClass(ZBX_STYLE_GREY)]); } // blinking preview in help popup (only if blinking is enabled) if ($data['config']['blink_period'] > 0) { $indic_container = (new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC_CONTAINER)->addItem((new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle(null, false))->addClass('blink')); for ($severity = TRIGGER_SEVERITY_NOT_CLASSIFIED; $severity < TRIGGER_SEVERITY_COUNT; $severity++) { $indic_container->addItem((new CDiv())->addClass(ZBX_STYLE_NOTIF_INDIC)->addClass(getSeverityStyle($severity))->addClass('blink')); } $indic_container->addItem((new CTag('p', true, _s('Age less than %s', convertUnitsS($data['config']['blink_period']))))->addClass(ZBX_STYLE_GREY)); $help_hint->addItem($indic_container); } // header right $help = get_icon('overviewhelp'); $help->setHint($help_hint); $widget = (new CWidget())->setTitle(_('Overview'))->setControls((new CForm('get'))->cleanItems()->addItem((new CList())->addItem([_('Group'), SPACE, $this->data['pageFilter']->getGroupsCB()])->addItem([_('Type'), SPACE, new CComboBox('type', $this->data['type'], 'submit()', [SHOW_TRIGGERS => _('Triggers'), SHOW_DATA => _('Data')])])->addItem([_('Hosts location'), SPACE, new CComboBox('view_style', $this->data['view_style'], 'submit()', [STYLE_TOP => _('Top'), STYLE_LEFT => _('Left')])])->addItem(get_icon('fullscreen', ['fullscreen' => $this->data['fullscreen']]))->addItem($help))); // filter $filter = $this->data['filter']; $filterFormView = new CView('common.filter.trigger', ['overview' => true, 'filter' => ['filterid' => 'web.overview.filter.state', 'showTriggers' => $filter['showTriggers'], 'ackStatus' => $filter['ackStatus'], 'showSeverity' => $filter['showSeverity'], 'statusChange' => $filter['statusChange'], 'statusChangeDays' => $filter['statusChangeDays'], 'txtSelect' => $filter['txtSelect'], 'application' => $filter['application'], 'inventory' => $filter['inventory'], 'showMaintenance' => $filter['showMaintenance'], 'hostId' => $this->data['hostid'], 'groupId' => $this->data['groupid'], 'fullScreen' => $this->data['fullscreen']], 'config' => $data['config']]); $filterForm = $filterFormView->render(); $widget->addItem($filterForm); // data table if ($data['pageFilter']->groupsSelected) { global $page; $dataTable = getTriggersOverview($this->data['hosts'], $this->data['triggers'], $page['file'], $this->data['view_style']); } else { $dataTable = new CTableInfo(); } $widget->addItem($dataTable); return $widget;
} $result = DBend($result); show_messages($result, _('Configuration updated'), _('Cannot update configuration')); } /* * Display */ $form = new CForm(); $form->cleanItems(); $cmbConf = new CComboBox('configDropDown', 'adm.other.php', 'redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other'))); $form->addItem($cmbConf); $cnf_wdgt = new CWidget(); $cnf_wdgt->addPageHeader(_('OTHER CONFIGURATION PARAMETERS'), $form); $data = array(); if (hasRequest('form_refresh')) { $data['config']['discovery_groupid'] = getRequest('discovery_groupid'); $data['config']['alert_usrgrpid'] = getRequest('alert_usrgrpid'); $data['config']['refresh_unsupported'] = getRequest('refresh_unsupported'); $data['config']['snmptrap_logging'] = getRequest('snmptrap_logging'); } else { $data['config'] = select_config(false); } $data['discovery_groups'] = API::HostGroup()->get(array('output' => array('usrgrpid', 'name'), 'filter' => array('flags' => ZBX_FLAG_DISCOVERY_NORMAL), 'editable' => true)); order_result($data['discovery_groups'], 'name'); $data['alert_usrgrps'] = DBfetchArray(DBselect('SELECT u.usrgrpid,u.name FROM usrgrp u')); order_result($data['alert_usrgrps'], 'name'); $otherForm = new CView('administration.general.other.edit', $data); $cnf_wdgt->addItem($otherForm->render()); $cnf_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$haystack = mb_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]); if ($haystack !== $needle) { unset($data['hosts'][$num]); } } } $sort_fields = ['pr_name' => 'name', 'pr_type' => 'type', 'pr_os' => 'os', 'pr_serialno_a' => 'serialno_a', 'pr_tag' => 'tag', 'pr_macaddress_a' => 'macaddress_a']; if (array_key_exists($sortField, $sort_fields)) { // copying an inventory field into the upper array level for sorting foreach ($data['hosts'] as &$host) { $host[$sortField] = $host['inventory'][$sort_fields[$sortField]]; } unset($host); } $limit = $data['config']['search_limit'] + 1; order_result($data['hosts'], $sortField, $sortOrder); if ($sortOrder == ZBX_SORT_UP) { $data['hosts'] = array_slice($data['hosts'], 0, $limit); } else { $data['hosts'] = array_slice($data['hosts'], -$limit, $limit); } order_result($data['hosts'], $sortField, $sortOrder); } } $url = (new CUrl('hostinventories.php'))->setArgument('groupid', $data['pageFilter']->groupid); $data['paging'] = getPagingLine($data['hosts'], $sortOrder, $url); $hostinventoriesView = new CView('inventory.host.list', $data); $hostinventoriesView->render(); $hostinventoriesView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
/** * Renders an "access denied" message and stops the execution of the script. * * The $mode parameters controls the layout of the message: * - ACCESS_DENY_OBJECT - render the message when denying access to a specific object * - ACCESS_DENY_PAGE - render a complete access denied page * * @param int $mode */ function access_deny($mode = ACCESS_DENY_OBJECT) { // deny access to an object if ($mode == ACCESS_DENY_OBJECT) { require_once dirname(__FILE__) . '/page_header.php'; show_error_message(_('No permissions to referred object or it does not exist!')); require_once dirname(__FILE__) . '/page_footer.php'; } else { // url to redirect the user to after he loggs in $url = new CUrl(!empty($_REQUEST['request']) ? $_REQUEST['request'] : ''); $url->setArgument('sid', null); $url = urlencode($url->toString()); // if the user is logged in - render the access denied message if (CWebUser::isLoggedIn()) { $header = _('Access denied.'); $message = array(_('Your are logged in as'), ' ', bold(CWebUser::$data['alias']), '. ', _('You have no permissions to access this page.'), BR(), _('If you think this message is wrong, please consult your administrators about getting the necessary permissions.')); $buttons = array(); // display the login button only for guest users if (CWebUser::isGuest()) { $buttons[] = new CButton('login', _('Login'), 'javascript: document.location = "index.php?request=' . $url . '";', 'formlist'); } $buttons[] = new CButton('back', _('Go to dashboard'), 'javascript: document.location = "dashboard.php"', 'formlist'); } else { $header = _('You are not logged in.'); $message = array(_('You must login to view this page.'), BR(), _('If you think this message is wrong, please consult your administrators about getting the necessary permissions.')); $buttons = array(new CButton('login', _('Login'), 'javascript: document.location = "index.php?request=' . $url . '";', 'formlist')); } $warning = new CWarning($header, $message); $warning->setButtons($buttons); $warningView = new CView('general.warning', array('warning' => $warning)); $warningView->render(); exit; } }
// render view $itemView = new CView('configuration.item.prototype.edit', $data); $itemView->render(); $itemView->show(); } else { $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name')); $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP)); CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR); CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR); $config = select_config(); $data = ['form' => getRequest('form'), 'parent_discoveryid' => getRequest('parent_discoveryid'), 'hostid' => $discoveryRule['hostid'], 'sort' => $sortField, 'sortorder' => $sortOrder]; $data['items'] = API::ItemPrototype()->get(['discoveryids' => $data['parent_discoveryid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectApplications' => API_OUTPUT_EXTEND, 'sortfield' => $sortField, 'limit' => $config['search_limit'] + 1]); foreach ($data['items'] as &$item) { if ($item['value_type'] == ITEM_VALUE_TYPE_STR || $item['value_type'] == ITEM_VALUE_TYPE_LOG || $item['value_type'] == ITEM_VALUE_TYPE_TEXT) { $item['trends'] = ''; } if ($item['type'] == ITEM_TYPE_TRAPPER || $item['type'] == ITEM_TYPE_SNMPTRAP) { $item['delay'] = ''; } } unset($item); $data['items'] = CMacrosResolverHelper::resolveItemNames($data['items']); order_result($data['items'], $sortField, $sortOrder); $url = (new CUrl('disc_prototypes.php'))->setArgument('parent_discoveryid', $data['parent_discoveryid']); $data['paging'] = getPagingLine($data['items'], $sortOrder, $url); // render view $itemView = new CView('configuration.item.prototype.list', $data); $itemView->render(); $itemView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
$cmbConf = new CComboBox('configDropDown', 'adm.housekeeper.php', 'redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other'))); $form->addItem($cmbConf); $cnf_wdgt = new CWidget(null, 'hk'); $cnf_wdgt->addPageHeader(_('CONFIGURATION OF HOUSEKEEPING'), $form); $data['form_refresh'] = getRequest('form_refresh', 0); if ($data['form_refresh']) { $data['config']['hk_events_mode'] = getRequest('hk_events_mode'); $data['config']['hk_events_trigger'] = isset($_REQUEST['hk_events_trigger']) ? getRequest('hk_events_trigger') : $data['config']['hk_events_trigger']; $data['config']['hk_events_internal'] = isset($_REQUEST['hk_events_internal']) ? getRequest('hk_events_internal') : $data['config']['hk_events_internal']; $data['config']['hk_events_discovery'] = isset($_REQUEST['hk_events_discovery']) ? getRequest('hk_events_discovery') : $data['config']['hk_events_discovery']; $data['config']['hk_events_autoreg'] = isset($_REQUEST['hk_events_autoreg']) ? getRequest('hk_events_autoreg') : $data['config']['hk_events_autoreg']; $data['config']['hk_services_mode'] = getRequest('hk_services_mode'); $data['config']['hk_services'] = isset($_REQUEST['hk_services']) ? getRequest('hk_services') : $data['config']['hk_services']; $data['config']['hk_audit_mode'] = getRequest('hk_audit_mode'); $data['config']['hk_audit'] = isset($_REQUEST['hk_audit']) ? getRequest('hk_audit') : $data['config']['hk_audit']; $data['config']['hk_sessions_mode'] = getRequest('hk_sessions_mode'); $data['config']['hk_sessions'] = isset($_REQUEST['hk_sessions']) ? getRequest('hk_sessions') : $data['config']['hk_sessions']; $data['config']['hk_history_mode'] = getRequest('hk_history_mode'); $data['config']['hk_history_global'] = getRequest('hk_history_global'); $data['config']['hk_history'] = isset($_REQUEST['hk_history']) ? getRequest('hk_history') : $data['config']['hk_history']; $data['config']['hk_trends_mode'] = getRequest('hk_trends_mode'); $data['config']['hk_trends_global'] = getRequest('hk_trends_global'); $data['config']['hk_trends'] = isset($_REQUEST['hk_trends']) ? getRequest('hk_trends') : $data['config']['hk_trends']; } else { $data['config'] = select_config(false); } $houseKeeperForm = new CView('administration.general.housekeeper.edit', $data); $cnf_wdgt->addItem($houseKeeperForm->render()); $cnf_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. **/ require_once dirname(__FILE__) . '/include/config.inc.php'; $page['title'] = _('Configuration of trigger displaying options'); $page['file'] = 'adm.triggerdisplayoptions.php'; require_once dirname(__FILE__) . '/include/page_header.php'; $fields = ['problem_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged PROBLEM events')], 'problem_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged PROBLEM events')], 'ok_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged OK events')], 'ok_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged OK events')], 'problem_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'problem_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('Display OK triggers for')], 'blink_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('On status change triggers blink for')], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null]]; check_fields($fields); /* * Actions */ if (hasRequest('update')) { DBstart(); $result = update_config(['problem_unack_color' => getRequest('problem_unack_color'), 'problem_ack_color' => getRequest('problem_ack_color'), 'ok_unack_color' => getRequest('ok_unack_color'), 'ok_ack_color' => getRequest('ok_ack_color'), 'problem_unack_style' => getRequest('problem_unack_style', 0), 'problem_ack_style' => getRequest('problem_ack_style', 0), 'ok_unack_style' => getRequest('ok_unack_style', 0), 'ok_ack_style' => getRequest('ok_ack_style', 0), 'ok_period' => getRequest('ok_period'), 'blink_period' => getRequest('blink_period')]); $result = DBend($result); show_messages($result, _('Configuration updated'), _('Cannot update configuration')); } /* * Display */ $config = select_config(); // form has been submitted if (hasRequest('form_refresh')) { $data = ['problem_unack_color' => getRequest('problem_unack_color', $config['problem_unack_color']), 'problem_ack_color' => getRequest('problem_ack_color', $config['problem_ack_color']), 'ok_unack_color' => getRequest('ok_unack_color', $config['ok_unack_color']), 'ok_ack_color' => getRequest('ok_ack_color', $config['ok_ack_color']), 'problem_unack_style' => getRequest('problem_unack_style', 0), 'problem_ack_style' => getRequest('problem_ack_style', 0), 'ok_unack_style' => getRequest('ok_unack_style', 0), 'ok_ack_style' => getRequest('ok_ack_style', 0), 'ok_period' => getRequest('ok_period', $config['ok_period']), 'blink_period' => getRequest('blink_period', $config['blink_period'])]; } else { $data = ['problem_unack_color' => $config['problem_unack_color'], 'problem_ack_color' => $config['problem_ack_color'], 'ok_unack_color' => $config['ok_unack_color'], 'ok_ack_color' => $config['ok_ack_color'], 'problem_unack_style' => $config['problem_unack_style'], 'problem_ack_style' => $config['problem_ack_style'], 'ok_unack_style' => $config['ok_unack_style'], 'ok_ack_style' => $config['ok_ack_style'], 'ok_period' => $config['ok_period'], 'blink_period' => $config['blink_period']]; } $view = new CView('administration.general.trigger.options.edit', $data); $view->render(); $view->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$options['groupids'] = $config['dropdown_first_entry'] ? null : array(); } $data['maintenances'] = API::Maintenance()->get($options); order_result($data['maintenances'], $sortfield, $sortorder); $data['paging'] = getPagingLine($data['maintenances'], array('maintenanceid')); // get list of maintenances $data['maintenances'] = API::Maintenance()->get(array('maintenanceids' => zbx_objectValues($data['maintenances'], 'maintenanceid'), 'output' => API_OUTPUT_EXTEND)); foreach ($data['maintenances'] as $number => $maintenance) { if ($maintenance['active_till'] < time()) { $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_EXPIRED; } elseif ($maintenance['active_since'] > time()) { $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_APPROACH; } else { $data['maintenances'][$number]['status'] = MAINTENANCE_STATUS_ACTIVE; } } order_result($data['maintenances'], $sortfield, $sortorder); $data['pageFilter'] = $pageFilter; // nodes if ($data['displayNodes']) { foreach ($data['maintenances'] as &$maintenance) { $maintenance['nodename'] = get_node_name_by_elid($maintenance['maintenanceid'], true); } unset($maintenance); } // render view $maintenanceView = new CView('configuration.maintenance.list', $data); $maintenanceView->render(); $maintenanceView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
require_once dirname(__FILE__) . '/include/forms.inc.php'; $page['title'] = _('Scripts'); $page['file'] = 'scripts_exec.php'; define('ZBX_PAGE_NO_MENU', 1); require_once dirname(__FILE__) . '/include/page_header.php'; // VAR TYPE OPTIONAL FLAGS VALIDATION EXCEPTION $fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'scriptid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'execute' => array(T_ZBX_INT, O_OPT, P_ACT, IN('0,1'), null)); check_fields($fields); if (isset($_REQUEST['execute'])) { $scriptid = get_request('scriptid'); $hostid = get_request('hostid'); $data = array('message' => '', 'info' => DBfetch(DBselect('SELECT s.name FROM scripts s WHERE s.scriptid=' . zbx_dbstr($scriptid)))); $result = API::Script()->execute(array('hostid' => $hostid, 'scriptid' => $scriptid)); $isErrorExist = false; if (empty($result)) { $isErrorExist = true; } elseif ($result['response'] == 'failed') { error($result['value']); $isErrorExist = true; } else { $data['message'] = $result['value']; } if ($isErrorExist) { show_error_message(_('Cannot connect to the trapper port of zabbix server daemon, but it should be available to run the script.')); } // render view $scriptView = new CView('general.script.execute', $data); $scriptView->render(); $scriptView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
/** * Process screen with particular screen objects. * * @return CTable */ public function show() { if (empty($this->screen)) { return new CTableInfo(_('No screens defined.')); } $skipedFields = array(); $screenitems = array(); $emptyScreenColumns = array(); // calculate table columns and rows foreach ($this->screen['screenitems'] as $screenitem) { $screenitems[] = $screenitem; for ($i = 0; $i < $screenitem['rowspan'] || $i == 0; $i++) { for ($j = 0; $j < $screenitem['colspan'] || $j == 0; $j++) { if ($i != 0 || $j != 0) { if (!isset($skipedFields[$screenitem['y'] + $i])) { $skipedFields[$screenitem['y'] + $i] = array(); } $skipedFields[$screenitem['y'] + $i][$screenitem['x'] + $j] = 1; } } } } // create screen table $screenTable = new CTable(); $screenTable->setAttribute('class', in_array($this->mode, array(SCREEN_MODE_PREVIEW, SCREEN_MODE_SLIDESHOW)) ? 'screen_view' : 'screen_edit'); $screenTable->setAttribute('id', 'iframe'); // action top row if ($this->mode == SCREEN_MODE_EDIT) { $newColumns = array(new CCol(new CImg('images/general/zero.png', 'zero', 1, 1))); for ($i = 0, $size = $this->screen['hsize'] + 1; $i < $size; $i++) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_col=' . $i . '";'); array_push($newColumns, new CCol($icon)); } $screenTable->addRow($newColumns); } for ($r = 0; $r < $this->screen['vsize']; $r++) { $newColumns = array(); $emptyScreenRow = true; // action left cell if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&add_row=' . $r . '";'); array_push($newColumns, new CCol($icon)); } for ($c = 0; $c < $this->screen['hsize']; $c++) { if (isset($skipedFields[$r][$c])) { continue; } // screen item $isEditForm = false; $screenitem = array(); foreach ($screenitems as $tmprow) { if ($tmprow['x'] == $c && $tmprow['y'] == $r) { $screenitem = $tmprow; break; } } if (empty($screenitem)) { $screenitem = array('screenitemid' => 0, 'resourcetype' => 0, 'resourceid' => 0, 'width' => 0, 'height' => 0, 'colspan' => 1, 'rowspan' => 1, 'elements' => 0, 'valign' => VALIGN_DEFAULT, 'halign' => HALIGN_DEFAULT, 'style' => 0, 'url' => '', 'dynamic' => 0, 'sort_triggers' => SCREEN_SORT_TRIGGERS_DATE_DESC); } if (!empty($screenitem['screenitemid'])) { $emptyScreenRow = false; $emptyScreenColumns[$c] = 1; } // action if ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] != 0) { $action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid']; } elseif ($this->mode == SCREEN_MODE_EDIT && $screenitem['screenitemid'] == 0) { $action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r; } else { $action = null; } // edit form cell if ($this->mode == SCREEN_MODE_EDIT && (isset($_REQUEST['form']) && $_REQUEST['form'] == 'update') && (isset($_REQUEST['x']) && $_REQUEST['x'] == $c && isset($_REQUEST['y']) && $_REQUEST['y'] == $r || isset($_REQUEST['screenitemid']) && bccomp($_REQUEST['screenitemid'], $screenitem['screenitemid']) == 0)) { $screenView = new CView('configuration.screen.constructor.edit', array('screen' => $this->screen)); $item = $screenView->render(); $isEditForm = true; } elseif (!empty($screenitem['screenitemid']) && isset($screenitem['resourcetype'])) { $screenBase = CScreenBuilder::getScreen(array('isFlickerfree' => $this->isFlickerfree, 'pageFile' => $this->pageFile, 'mode' => $this->mode, 'timestamp' => $this->timestamp, 'hostid' => $this->hostid, 'profileIdx' => $this->profileIdx, 'profileIdx2' => $this->profileIdx2, 'updateProfile' => $this->updateProfile, 'timeline' => $this->timeline, 'resourcetype' => $screenitem['resourcetype'], 'screenitem' => $screenitem)); if (!empty($screenBase)) { if ($this->mode == SCREEN_MODE_EDIT && !empty($screenitem['screenitemid'])) { $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&screenitemid=' . $screenitem['screenitemid']; } elseif ($this->mode == SCREEN_MODE_EDIT && empty($screenitem['screenitemid'])) { $screenBase->action = 'screenedit.php?form=update' . url_param('screenid') . '&x=' . $c . '&y=' . $r; } $item = $screenBase->get(); } else { $item = null; } } else { $item = array(SPACE); if ($this->mode == SCREEN_MODE_EDIT) { array_push($item, BR(), new CLink(_('Change'), $action, 'empty_change_link')); } } // align $halign = 'def'; if ($screenitem['halign'] == HALIGN_CENTER) { $halign = 'cntr'; } if ($screenitem['halign'] == HALIGN_LEFT) { $halign = 'left'; } if ($screenitem['halign'] == HALIGN_RIGHT) { $halign = 'right'; } $valign = 'def'; if ($screenitem['valign'] == VALIGN_MIDDLE) { $valign = 'mdl'; } if ($screenitem['valign'] == VALIGN_TOP) { $valign = 'top'; } if ($screenitem['valign'] == VALIGN_BOTTOM) { $valign = 'bttm'; } if ($this->mode == SCREEN_MODE_EDIT && !$isEditForm) { $item = new CDiv($item, 'draggable'); $item->setAttribute('id', 'position_' . $r . '_' . $c); $item->setAttribute('data-xcoord', $c); $item->setAttribute('data-ycoord', $r); } // colspan/rowspan $newColumn = new CCol($item, $halign . '_' . $valign . ' screenitem'); if (!empty($screenitem['colspan'])) { $newColumn->setColSpan($screenitem['colspan']); } if (!empty($screenitem['rowspan'])) { $newColumn->setRowSpan($screenitem['rowspan']); } array_push($newColumns, $newColumn); } // action right cell if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/minus.png', null, null, null, 'pointer'); if ($emptyScreenRow) { $removeRowLink = 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '";'; } else { $removeRowLink = 'javascript: if (Confirm("' . _('This screen-row is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_row=' . $r . '"; }'; } $icon->addAction('onclick', $removeRowLink); array_push($newColumns, new CCol($icon)); } $screenTable->addRow(new CRow($newColumns)); } // action bottom row if ($this->mode == SCREEN_MODE_EDIT) { $icon = new CImg('images/general/plus.png', null, null, null, 'pointer'); $icon->addAction('onclick', 'javascript: location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&add_row=' . $this->screen['vsize'] . '";'); $newColumns = array(new CCol($icon)); for ($i = 0; $i < $this->screen['hsize']; $i++) { $icon = new CImg('images/general/minus.png', null, null, null, 'pointer'); if (isset($emptyScreenColumns[$i])) { $removeColumnLink = 'javascript: if (Confirm("' . _('This screen-column is not empty. Delete it?') . '")) {' . ' location.href = "screenedit.php?screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '"; }'; } else { $removeColumnLink = 'javascript: location.href = "screenedit.php?config=1&screenid=' . $this->screen['screenid'] . '&rmv_col=' . $i . '";'; } $icon->addAction('onclick', $removeColumnLink); array_push($newColumns, new CCol($icon)); } array_push($newColumns, new CCol(new CImg('images/general/zero.png', 'zero', 1, 1))); $screenTable->addRow($newColumns); } return $screenTable; }
$data = array(); $data['form_refresh'] = get_request('form_refresh', 0); // form has been submitted if ($data['form_refresh']) { $data['ok_period'] = get_request('ok_period'); $data['blink_period'] = get_request('blink_period'); $data['problem_unack_color'] = get_request('problem_unack_color'); $data['problem_ack_color'] = get_request('problem_ack_color'); $data['ok_unack_color'] = get_request('ok_unack_color'); $data['ok_ack_color'] = get_request('ok_ack_color'); $data['problem_unack_style'] = get_request('problem_unack_style'); $data['problem_ack_style'] = get_request('problem_ack_style'); $data['ok_unack_style'] = get_request('ok_unack_style'); $data['ok_ack_style'] = get_request('ok_ack_style'); } else { $config = select_config(false); $data['ok_period'] = $config['ok_period']; $data['blink_period'] = $config['blink_period']; $data['problem_unack_color'] = $config['problem_unack_color']; $data['problem_ack_color'] = $config['problem_ack_color']; $data['ok_unack_color'] = $config['ok_unack_color']; $data['ok_ack_color'] = $config['ok_ack_color']; $data['problem_unack_style'] = $config['problem_unack_style']; $data['problem_ack_style'] = $config['problem_ack_style']; $data['ok_unack_style'] = $config['ok_unack_style']; $data['ok_ack_style'] = $config['ok_ack_style']; } $triggerDisplayingForm = new CView('administration.general.triggerDisplayOptions.edit', $data); $cnf_wdgt->addItem($triggerDisplayingForm->render()); $cnf_wdgt->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
* Display */ if (isset($_REQUEST['form'])) { $data = array('nodeid' => get_request('nodeid'), 'masterNode' => DBfetch(DBselect('SELECT n.name FROM nodes n WHERE n.masterid IS NULL AND n.nodetype=' . ZBX_NODE_MASTER))); if (get_request('nodeid') && !isset($_REQUEST['form_refresh'])) { $data['new_nodeid'] = $node['nodeid']; $data['name'] = $node['name']; $data['ip'] = $node['ip']; $data['port'] = $node['port']; $data['masterid'] = $node['masterid']; $data['nodetype'] = $node['nodetype']; } else { $data['new_nodeid'] = get_request('new_nodeid'); $data['name'] = get_request('name', ''); $data['ip'] = get_request('ip', '127.0.0.1'); $data['port'] = get_request('port', 10051); $data['nodetype'] = get_request('nodetype', ZBX_NODE_CHILD); $data['masterid'] = get_request('masterid', get_current_nodeid(false)); } $nodeView = new CView('administration.node.edit', $data); } else { validate_sort_and_sortorder(); $data = array(); if (ZBX_DISTRIBUTED) { $data['nodes'] = DBselect('SELECT n.* FROM nodes n ' . order_by('n.nodeid,n.name,n.ip', 'n.masterid')); } $nodeView = new CView('administration.node.list', $data); } $nodeView->render(); $nodeView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
clearCookies($goResult, $_REQUEST['hostid']); } /* * Display */ if (isset($_REQUEST['form'])) { $data = getItemFormData(array('is_discovery_rule' => true)); $data['page_header'] = _('CONFIGURATION OF DISCOVERY RULES'); // render view $itemView = new CView('configuration.item.edit', $data); $itemView->render(); $itemView->show(); } else { $data = array('hostid' => get_request('hostid', 0), 'host' => $host, 'showErrorColumn' => $host['status'] != HOST_STATUS_TEMPLATE); $sortfield = getPageSortField('name'); // discoveries $data['discoveries'] = API::DiscoveryRule()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND, 'editable' => true, 'selectItems' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT, 'selectTriggers' => API_OUTPUT_COUNT, 'selectHostPrototypes' => API_OUTPUT_COUNT, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1)); $data['discoveries'] = CMacrosResolverHelper::resolveItemNames($data['discoveries']); if ($sortfield === 'status') { orderItemsByStatus($data['discoveries'], getPageSortOrder()); } else { order_result($data['discoveries'], $sortfield, getPageSortOrder()); } // paging $data['paging'] = getPagingLine($data['discoveries'], array('itemid'), array('hostid' => get_request('hostid'))); // render view $discoveryView = new CView('configuration.host.discovery.list', $data); $discoveryView->render(); $discoveryView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
} else { $data['pageFilter'] = $pageFilter; $data['showDisabled'] = $showDisabled; $data['showAllApps'] = $showAllApps; $data['db_apps'] = array(); $db_app_result = DBselect('SELECT DISTINCT h.name AS hostname,a.*' . ' FROM applications a,hosts h' . ' WHERE a.hostid=h.hostid' . ($data['hostid'] > 0 ? ' AND h.hostid=' . $data['hostid'] : '') . ' AND ' . dbConditionInt('h.hostid', $pageFilter->hostsSelected ? array_keys($pageFilter->hosts) : array())); while ($db_app = DBfetch($db_app_result)) { $db_app['scenarios_cnt'] = 0; $data['db_apps'][$db_app['applicationid']] = $db_app; } // get http tests $data['db_httptests'] = array(); $dbHttpTests_result = DBselect('SELECT wt.*,a.name AS application,h.name AS hostname,h.hostid' . ' FROM httptest wt,applications a,hosts h' . ' WHERE wt.applicationid=a.applicationid' . ' AND a.hostid=h.hostid' . ' AND ' . dbConditionInt('a.applicationid', array_keys($data['db_apps'])) . ($showDisabled == 0 ? ' AND wt.status=' . HTTPTEST_STATUS_ACTIVE : '')); while ($httptest_data = DBfetch($dbHttpTests_result)) { $data['db_apps'][$httptest_data['applicationid']]['scenarios_cnt']++; $httptest_data['step_count'] = null; $data['db_httptests'][$httptest_data['httptestid']] = $httptest_data; } // get http steps $httpstep_res = DBselect('SELECT hs.httptestid,COUNT(hs.httpstepid) AS cnt' . ' FROM httpstep hs' . ' WHERE ' . dbConditionInt('hs.httptestid', array_keys($data['db_httptests'])) . ' GROUP BY hs.httptestid'); while ($step_count = DBfetch($httpstep_res)) { $data['db_httptests'][$step_count['httptestid']]['step_count'] = $step_count['cnt']; } order_result($data['db_httptests'], getPageSortField('host'), getPageSortOrder()); $data['paging'] = getPagingLine($data['db_httptests']); // render view $httpView = new CView('configuration.httpconf.list', $data); $httpView->render(); $httpView->show(); } require_once dirname(__FILE__) . '/include/page_footer.php';
$trigger = API::Trigger()->get(['triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'expandDescription' => true]); if (!$trigger) { access_deny(); } $trigger = reset($trigger); /* * Actions */ if (hasRequest('update')) { DBstart(); $result = DBexecute('UPDATE triggers' . ' SET comments=' . zbx_dbstr(getRequest('comments')) . ' WHERE triggerid=' . zbx_dbstr(getRequest('triggerid'))); $trigger['comments'] = $_REQUEST['comments']; if ($result) { add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_TRIGGER, _('Trigger') . ' [' . $_REQUEST['triggerid'] . '] [' . $trigger['description'] . '] ' . _('Comments') . ' [' . $_REQUEST['comments'] . ']'); } $result = DBend($result); show_messages($result, _('Description updated'), _('Cannot update description')); } elseif (isset($_REQUEST['cancel'])) { jsRedirect('tr_status.php'); exit; } /* * Display */ $triggerEditable = API::Trigger()->get(['triggerids' => $_REQUEST['triggerid'], 'output' => ['triggerid'], 'editable' => true]); $data = ['triggerid' => getRequest('triggerid'), 'trigger' => $trigger, 'isTriggerEditable' => !empty($triggerEditable), 'isCommentExist' => !empty($trigger['comments'])]; // render view $triggerCommentView = new CView('monitoring.triggerComment', $data); $triggerCommentView->render(); $triggerCommentView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$result = API::User()->updateMedia(array('users' => $user, 'medias' => $user['user_medias'])); } $result = DBend($result); if (!$result) { error(API::User()->resetErrors()); } if ($result) { DBstart(); add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_USER, 'User alias [' . CWebUser::$data['alias'] . '] Name [' . CWebUser::$data['name'] . ']' . ' Surname [' . CWebUser::$data['surname'] . '] profile id [' . CWebUser::$data['userid'] . ']'); DBend(true); ob_end_clean(); redirect(CWebUser::$data['last_page']['url']); } else { show_messages($result, _('User updated'), _('Cannot update user')); } } } ob_end_flush(); /* * Display */ $data = getUserFormData(CWebUser::$data['userid'], true); $data['userid'] = CWebUser::$data['userid']; $data['form'] = getRequest('form'); $data['form_refresh'] = getRequest('form_refresh', 0); $data['autologout'] = getRequest('autologout'); // render view $usersView = new CView('administration.users.edit', $data); $usersView->render(); $usersView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
$result = DBend($result); if ($page['type'] == PAGE_TYPE_JS && $result) { echo 'switchElementClass("addrm_fav", "iconminus", "iconplus");'; } } } if (!empty($_REQUEST['period']) || !empty($_REQUEST['stime'])) { CScreenBase::calculateTime(array('profileIdx' => 'web.screens', 'profileIdx2' => $pageFilter->graphid, 'updateProfile' => true, 'period' => getRequest('period'), 'stime' => getRequest('stime'))); $curl = new CUrl(); $curl->removeArgument('period'); $curl->removeArgument('stime'); ob_end_clean(); DBstart(); CProfile::flush(); DBend(); redirect($curl->getUrl()); } ob_end_flush(); if ($page['type'] == PAGE_TYPE_JS || $page['type'] == PAGE_TYPE_HTML_BLOCK) { require_once dirname(__FILE__) . '/include/page_footer.php'; exit; } /* * Display */ $data = array('pageFilter' => $pageFilter, 'graphid' => $pageFilter->graphid, 'fullscreen' => $_REQUEST['fullscreen']); // render view $chartsView = new CView('monitoring.charts', $data); $chartsView->render(); $chartsView->show(); require_once dirname(__FILE__) . '/include/page_footer.php';
} } $hostForm = new CView('configuration.host.massupdate', $data); $hostsWidget->addItem($hostForm->render()); } elseif (isset($_REQUEST['form'])) { $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS')); $data = array(); if ($hostId = get_request('hostid', 0)) { $hostsWidget->addItem(get_header_host_table('', $_REQUEST['hostid'])); $dbHosts = API::Host()->get(array('hostids' => $hostId, 'selectGroups' => API_OUTPUT_EXTEND, 'selectParentTemplates' => array('templateid', 'name'), 'selectMacros' => API_OUTPUT_EXTEND, 'selectInventory' => true, 'selectDiscoveryRule' => array('name', 'itemid'), 'output' => API_OUTPUT_EXTEND)); $dbHost = reset($dbHosts); $dbHost['interfaces'] = API::HostInterface()->get(array('hostids' => $hostId, 'output' => API_OUTPUT_EXTEND, 'selectItems' => array('type'), 'sortfield' => 'interfaceid', 'preservekeys' => true)); $data['dbHost'] = $dbHost; } $hostForm = new CView('configuration.host.edit', $data); $hostsWidget->addItem($hostForm->render()); $rootClass = 'host-edit'; if (get_request('hostid') && $dbHost['flags'] == ZBX_FLAG_DISCOVERY_CREATED) { $rootClass .= ' host-edit-discovered'; } $hostsWidget->setRootClass($rootClass); } else { $displayNodes = is_array(get_current_nodeid()) && $pageFilter->groupid == 0; $frmForm = new CForm(); $frmForm->cleanItems(); $frmForm->addItem(new CDiv(array(new CSubmit('form', _('Create host')), new CButton('form', _('Import'), 'redirect("conf.import.php?rules_preset=host")')))); $frmForm->addItem(new CVar('groupid', $_REQUEST['groupid'], 'filter_groupid_id')); $hostsWidget->addPageHeader(_('CONFIGURATION OF HOSTS'), $frmForm); $frmGroup = new CForm('get'); $frmGroup->addItem(array(_('Group') . SPACE, $pageFilter->getGroupsCB(true))); $hostsWidget->addHeader(_('Hosts'), $frmGroup);