break; case ZBX_AUTH_LDAP: $auth = S_LDAP_AUTH; break; case ZBX_AUTH_HTTP: $auth = S_HTTP_AUTH; break; default: $auth = ''; } show_table_header(S_AUTHENTICATION_TO_ZABBIX, $auth); if (ZBX_AUTH_INTERNAL == $_REQUEST['config']) { $form_refresh_internal = get_request('form_refresh_internal', 0); $form_refresh_internal++; $frmAuth = new CFormTable(S_ZABBIX_INTERNAL_AUTH, 'authentication.php'); $frmAuth->setHelp('web.authentication.php'); $frmAuth->addVar('form_refresh_internal', $form_refresh_internal); $cmbConfig = new CCombobox('config', ZBX_AUTH_INTERNAL, 'submit()'); $cmbConfig->addItem(ZBX_AUTH_INTERNAL, S_INTERNAL_S); $cmbConfig->addItem(ZBX_AUTH_LDAP, S_LDAP); $cmbConfig->addItem(ZBX_AUTH_HTTP, S_HTTP); $frmAuth->addRow(S_DEFAULT_AUTHENTICATION, $cmbConfig); $action = "javascript: if(confirm('" . S_SWITCHING_HTTP . "')) return true; else return false;"; $frmAuth->addRow(S_ZABBIX_INTERNAL_AUTH . SPACE . S_ENABLED, new CCheckBox('authentication_type', ZBX_AUTH_INTERNAL == $config['authentication_type'], $action, ZBX_AUTH_INTERNAL)); $frmAuth->addItemToBottomRow(new CButton('save', S_SAVE)); $frmAuth->Show(); } else { if (ZBX_AUTH_LDAP == $_REQUEST['config']) { if (isset($_REQUEST['form_refresh_ldap'])) { foreach ($config as $id => $value) { if (isset($_REQUEST[$id])) {
$_REQUEST['axisside'] = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT); if (zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && $_REQUEST['itemid'] > 0) { $_REQUEST['caption'] = item_description(get_item_by_itemid($_REQUEST['itemid'])); } insert_js_function('add_bitem'); insert_js_function('update_bitem'); if (isset($_REQUEST['save']) && !isset($_REQUEST['gid'])) { insert_js("add_bitem('" . $_REQUEST['dstfrm'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n"); } if (isset($_REQUEST['save']) && isset($_REQUEST['gid'])) { insert_js("update_bitem('" . $_REQUEST['dstfrm'] . "','" . $_REQUEST['list_name'] . "','" . $_REQUEST['gid'] . "'," . zbx_jsvalue($_REQUEST['caption']) . ",'" . $_REQUEST['itemid'] . "','" . $_REQUEST['color'] . "'," . $_REQUEST['calc_fnc'] . "," . $_REQUEST['axisside'] . ");\n"); } else { echo SBR; $frmGItem = new CFormTable(S_NEW_ITEM_FOR_THE_GRAPH); $frmGItem->setName('graph_item'); $frmGItem->setHelp('web.graph.item.php'); $frmGItem->addVar('dstfrm', $_REQUEST['dstfrm']); $config = get_request('config', 1); $gid = get_request('gid', null); $list_name = get_request('list_name', null); $caption = get_request('caption', ''); $itemid = get_request('itemid', 0); $color = get_request('color', '009900'); $calc_fnc = get_request('calc_fnc', 2); $axisside = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT); $description = ''; if ($itemid > 0) { $description = get_item_by_itemid($itemid); $description = item_description($description); } $frmGItem->addVar('gid', $gid);
$help_table->setAttribute('style', 'width: 600px;'); if ($_REQUEST['extlang'] == 'new') { $help_table->addRow(array(S_STEP . SPACE . '1:', S_NEW_LOCALE_STEP_1)); $help_table->addRow(array(S_STEP . SPACE . '2:', S_NEW_LOCALE_STEP_2)); $help_table->addRow(array(S_STEP . SPACE . '3:', array(S_NEW_LOCALE_STEP_3_1, BR(), S_NEW_LOCALE_STEP_3_2))); $help_table->addRow(array(S_STEP . SPACE . '4:', array(S_NEW_LOCALE_STEP_4_1, BR(), S_NEW_LOCALE_STEP_4_2, BR(), S_NEW_LOCALE_STEP_4_3, BR(), S_NEW_LOCALE_STEP_4_4, BR(), S_NEW_LOCALE_STEP_4_5))); } else { $help_table->addRow(array(S_STEP . SPACE . '1:', S_UPDATE_LOCALE_1)); $help_table->addRow(array(S_STEP . SPACE . '2:', S_UPDATE_LOCALE_2)); $help_table->addRow(array(S_STEP . SPACE . '3:', S_UPDATE_LOCALE_3)); } $help->setHint($help_table); show_table_header(S_LOCALES); $frmLcls = new CFormTable(SPACE . S_CREATE . SPACE . S_LOCALE_SMALL . SPACE . S_FROM_SMALL . SPACE . $ZBX_LOCALES[$_REQUEST['srclang']], 'locales.php?action=1', 'post', null, 'form'); $frmLcls->setAttribute('id', 'locales'); $frmLcls->setHelp($help); $fileFrom = 'include/locales/' . $_REQUEST['srclang'] . '.inc.php'; if (preg_match('/^[a-z0-9_]+$/i', $_REQUEST['srclang']) && file_exists($fileFrom)) { include $fileFrom; if (!isset($TRANSLATION) || !is_array($TRANSLATION)) { error('Passed SOURCE is NOT valid PHP file.'); } $transFrom = $TRANSLATION; } unset($TRANSLATION); $frmLcls->addVar('extlang', $_REQUEST['extlang']); if (preg_match('/^[a-z0-9_]+$/i', $_REQUEST['extlang']) && $_REQUEST['extlang'] != 'new') { $fileTo = 'include/locales/' . $_REQUEST['extlang'] . '.inc.php'; if (file_exists($fileTo)) { include $fileTo; if (!isset($TRANSLATION) || !is_array($TRANSLATION)) {
$url = is_null($request) ? $USER_DETAILS['url'] : $request; redirect($url); exit; } } include_once 'include/page_header.php'; if (isset($_REQUEST['message'])) { show_error_message($_REQUEST['message']); } if (!isset($sessionid) || $USER_DETAILS['alias'] == ZBX_GUEST_USER) { switch ($authentication_type) { case ZBX_AUTH_HTTP: break; case ZBX_AUTH_LDAP: case ZBX_AUTH_INTERNAL: default: // konqueror bug #138024; adding useless param(login=1) to the form's action path to avoid bug!! $frmLogin = new CFormTable('Login', 'index.php?login=1', 'post', 'multipart/form-data'); $frmLogin->setHelp('web.index.login'); $frmLogin->addVar('request', $request); $frmLogin->addRow('Login name', new CTextBox('name')); $frmLogin->addRow('Password', new CPassBox('password')); $frmLogin->addItemToBottomRow(new CButton('enter', 'Enter')); $frmLogin->show(false); setFocus($frmLogin->getName(), 'name'); $frmLogin->destroy(); } } else { echo '<div align="center" class="textcolorstyles">Welcome to ZABBIX! You are connected as <b>' . $USER_DETAILS['alias'] . '</b>.</div>'; } include_once 'include/page_footer.php';
} $proxies_wdgt = new CWidget(); $frmForm = new CForm(); $cmbConf = new CComboBox('config', 'proxies.php', 'javascript: redirect(this.options[this.selectedIndex].value);'); $cmbConf->addItem('nodes.php', S_NODES); $cmbConf->addItem('proxies.php', S_PROXIES); $frmForm->addItem($cmbConf); if (!isset($_REQUEST['form'])) { $frmForm->addItem(new CButton('form', S_CREATE_PROXY)); } $proxies_wdgt->addPageHeader(S_CONFIGURATION_OF_PROXIES, $frmForm); if (isset($_REQUEST['form'])) { $_REQUEST['hostid'] = get_request('hostid', 0); $frm_title = S_PROXY; $frmHostG = new CFormTable($frm_title, 'proxies.php'); $frmHostG->setHelp('web.proxy.php'); if ($_REQUEST['hostid'] > 0) { $proxy = get_host_by_hostid($_REQUEST['hostid']); $frm_title = S_PROXY . ' [' . $proxy['host'] . ']'; $frmHostG->addVar('hostid', $_REQUEST['hostid']); } if ($_REQUEST['hostid'] > 0 && !isset($_REQUEST['form_refresh'])) { $name = $proxy['host']; $status = $proxy['status']; if ($status == HOST_STATUS_PROXY_PASSIVE) { $useip = $proxy['useip']; $dns = $proxy['dns']; $ip = $proxy['ip']; $port = $proxy['port']; } else { $useip = get_request('useip', 1);
function insert_template_form($available_hosts) { $frm_title = S_TEMPLATE_LINKAGE; if ($_REQUEST['hostid'] > 0) { $template = get_host_by_hostid($_REQUEST['hostid']); $frm_title .= ' [' . $template['host'] . ']'; } if ($_REQUEST['hostid'] > 0 && !isset($_REQUEST['form_refresh'])) { $name = $template['host']; } else { $name = get_request("tname", ''); } $frmHostT = new CFormTable($frm_title, 'hosts.php'); $frmHostT->setHelp('web.hosts.group.php'); $frmHostT->addVar('config', get_request('config', 2)); if ($_REQUEST['hostid'] > 0) { $frmHostT->addVar('hostid', $_REQUEST['hostid']); } $frmHostT->addRow(S_TEMPLATE, new CTextBox('tname', $name, 60, 'yes')); $hosts_in_tpl = array(); $sql = 'SELECT DISTINCT h.hostid,h.host ' . ' FROM hosts h,hosts_templates ht' . ' WHERE ht.templateid=' . $_REQUEST['hostid'] . ' AND h.hostid=ht.hostid' . ' AND h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ') ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host'; $db_hosts = DBselect($sql); while ($db_host = DBfetch($db_hosts)) { $hosts_in_tpl[$db_host['hostid']] = $db_host['hostid']; } $cmbHosts = new CTweenBox($frmHostT, 'hosts', $hosts_in_tpl, 6); $sql = 'SELECT DISTINCT h.hostid,h.host ' . ' FROM hosts h' . ' WHERE h.status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ') ' . ' AND ' . DBcondition('h.hostid', $available_hosts) . ' ORDER BY h.host'; $db_hosts = DBselect($sql); while ($db_host = DBfetch($db_hosts)) { $cmbHosts->addItem($db_host['hostid'], get_node_name_by_elid($db_host['hostid']) . $db_host['host']); } $frmHostT->addRow(S_HOSTS, $cmbHosts->Get(S_HOSTS . SPACE . S_IN, S_OTHER . SPACE . S_HOSTS)); $frmHostT->addItemToBottomRow(new CButton('save', S_SAVE)); $frmHostT->addItemToBottomRow(SPACE); $frmHostT->addItemToBottomRow(new CButtonCancel(url_param('config'))); $frmHostT->Show(); }
$audit_action = AUDIT_ACTION_ADD; show_messages($result, _('Trigger added'), _('Cannot add trigger')); } if ($result) { add_audit($audit_action, AUDIT_RESOURCE_TRIGGER, _('Trigger') . ' [' . $triggerid . '] [' . $trigger['description'] . ']'); unset($_REQUEST['sform']); zbx_add_post_js('closeForm("items.php");'); require_once dirname(__FILE__) . '/include/page_footer.php'; } } } //------------------------ </ACTIONS> -------------------------- //------------------------ <FORM> --------------------------- if (isset($_REQUEST['sform'])) { $frmTRLog = new CFormTable(_('Trigger'), 'tr_logform.php', 'POST', null, 'sform'); $frmTRLog->setHelp('web.triggerlog.service.php'); $frmTRLog->setTableClass('formlongtable formtable'); $frmTRLog->addVar('form_refresh', get_request('form_refresh', 1)); if (isset($_REQUEST['triggerid'])) { $frmTRLog->addVar('triggerid', $_REQUEST['triggerid']); } if (isset($_REQUEST['triggerid']) && !isset($_REQUEST['form_refresh'])) { $frmTRLog->addVar('form_refresh', get_request('form_refresh', 1)); $sql = 'SELECT DISTINCT f.functionid, f.function, f.parameter, t.expression, ' . ' t.description, t.priority, t.comments, t.url, t.status, t.type' . ' FROM functions f, triggers t, items i ' . ' WHERE t.triggerid=' . zbx_dbstr($_REQUEST['triggerid']) . ' AND i.itemid=f.itemid ' . ' AND f.triggerid = t.triggerid ' . ' AND i.value_type IN (' . ITEM_VALUE_TYPE_LOG . ' , ' . ITEM_VALUE_TYPE_TEXT . ', ' . ITEM_VALUE_TYPE_STR . ')'; $res = DBselect($sql); while ($rows = DBfetch($res)) { $description = $rows['description']; $expression = $rows['expression']; $type = $rows['type']; $priority = $rows['priority']; $comments = $rows['comments'];
$frm_title = S_PROXY; if ($_REQUEST['hostid'] > 0) { $proxy = get_host_by_hostid($_REQUEST['hostid']); $frm_title = S_PROXY . ' [' . $proxy["host"] . ']'; } if ($_REQUEST['hostid'] > 0 && !isset($_REQUEST["form_refresh"])) { $name = $proxy["host"]; $db_hosts = DBselect('SELECT hostid ' . ' FROM hosts ' . ' WHERE status NOT IN (' . HOST_STATUS_DELETED . ') ' . ' AND proxy_hostid=' . $_REQUEST['hostid']); while ($db_host = DBfetch($db_hosts)) { array_push($hosts, $db_host['hostid']); } } else { $name = get_request("host", ""); } $frmHostG = new CFormTable($frm_title, "proxies.php"); $frmHostG->setHelp("web.proxy.php"); $frmHostG->addVar("config", get_request("config", 5)); if ($_REQUEST['hostid'] > 0) { $frmHostG->addVar("hostid", $_REQUEST['hostid']); } $frmHostG->addRow(S_PROXY_NAME, new CTextBox("host", $name, 30)); $cmbHosts = new CTweenBox($frmHostG, 'hosts', $hosts); $sql = 'SELECT hostid,proxy_hostid,host ' . ' FROM hosts ' . ' WHERE status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ') ' . ' AND ' . DBcondition('hostid', $available_hosts) . ' ORDER BY host'; $db_hosts = DBselect($sql); while ($db_host = DBfetch($db_hosts)) { $cmbHosts->addItem($db_host['hostid'], get_node_name_by_elid($db_host['hostid']) . $db_host["host"], NULL, $db_host["proxy_hostid"] == 0 || $_REQUEST['hostid'] > 0 && $db_host["proxy_hostid"] == $_REQUEST['hostid']); } $frmHostG->addRow(S_HOSTS, $cmbHosts->Get(S_PROXY . SPACE . S_HOSTS, S_OTHER . SPACE . S_HOSTS)); $frmHostG->addItemToBottomRow(new CButton("save", S_SAVE)); if ($_REQUEST['hostid'] > 0) { $frmHostG->addItemToBottomRow(SPACE);
function insert_map_link_form() { $frmCnct = new CFormTable('New connector', 'sysmap.php'); $frmCnct->setHelp('web.sysmap.connector.php'); $frmCnct->addVar('sysmapid', $_REQUEST['sysmapid']); if (isset($_REQUEST['linkid']) && !isset($_REQUEST['form_refresh'])) { $frmCnct->addVar('linkid', $_REQUEST['linkid']); $db_links = DBselect('SELECT * FROM sysmaps_links WHERE linkid=' . $_REQUEST['linkid']); $db_link = DBfetch($db_links); $selementid1 = $db_link['selementid1']; $selementid2 = $db_link['selementid2']; $triggers = array(); $drawtype = $db_link['drawtype']; $color = $db_link['color']; $res = DBselect('SELECT * FROM sysmaps_link_triggers WHERE linkid=' . $_REQUEST['linkid']); while ($rows = DBfetch($res)) { $triggers[] = $rows; } } else { if (isset($_REQUEST['linkid'])) { $frmCnct->addVar('linkid', $_REQUEST['linkid']); } $selementid1 = get_request('selementid1', 0); $selementid2 = get_request('selementid2', 0); $triggers = get_request('triggers', array()); $drawtype = get_request('drawtype', 0); $color = get_request('color', 0); } /* START comboboxes preparations */ $cmbElements1 = new CComboBox('selementid1', $selementid1); $cmbElements2 = new CComboBox('selementid2', $selementid2); $map_elements = array(); $sql = 'SELECT selementid,label,elementid,elementtype ' . ' FROM sysmaps_elements ' . ' WHERE sysmapid=' . $_REQUEST['sysmapid']; $db_elements = DBselect($sql); while ($db_element = DBfetch($db_elements)) { $map_elements[$db_element['selementid']] = $db_element; } order_result($map_elements, 'label'); foreach ($map_elements as $selementid => $db_selement) { $label = $db_selement['label']; if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) { $db_host = get_host_by_hostid($db_selement['elementid']); $label .= ':' . $db_host['host']; } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_MAP) { $db_map = get_sysmap_by_sysmapid($db_selement['elementid']); $label .= ':' . $db_map['name']; } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) { if ($db_selement['elementid'] > 0) { $label .= ':' . expand_trigger_description($db_selement['elementid']); } } else { if ($db_selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST_GROUP) { if ($db_selement['elementid'] > 0) { $db_group = DBfetch(DBselect('SELECT name FROM groups WHERE groupid=' . $db_selement['elementid'])); $label .= ':' . $db_group['name']; } } } } } $cmbElements1->addItem($db_selement['selementid'], $label); $cmbElements2->addItem($db_selement['selementid'], $label); } $cmbType = new CComboBox('drawtype', $drawtype); foreach (map_link_drawtypes() as $i) { $value = map_link_drawtype2str($i); $cmbType->addItem($i, $value); } /* END preparation */ $frmCnct->addRow(S_ELEMENT_1, $cmbElements1); $frmCnct->addRow(S_ELEMENT_2, $cmbElements2); //trigger links foreach ($triggers as $id => $trigger) { if (isset($trigger['triggerid'])) { $triggers[$id]['description'] = expand_trigger_description($trigger['triggerid']); } } $table = new CTable(); $table->SetClass('tableinfo'); $table->setOddRowClass('even_row'); $table->setEvenRowClass('even_row'); $table->attributes['cellpadding'] = 3; $table->attributes['cellspacing'] = 1; $table->headerClass = 'header'; $table->footerClass = 'footer'; $table->setHeader(array(new CCheckBox('all_triggers', null, "checkAll('" . $frmCnct->getName() . "','all_triggers','triggers');"), S_TRIGGERS, S_TYPE, S_COLOR)); $table->setAttribute('id', 'link_triggers'); foreach ($triggers as $id => $trigger) { if (!isset($trigger['triggerid'])) { continue; } $colorbox = new CSpan(SPACE . SPACE . SPACE); $colorbox->setAttribute('style', 'text-decoration: none; outline-color: black; outline-style: solid; outline-width: 1px; background-color: #' . $trigger['color'] . ';'); $link_desc = new CSpan($trigger['description'], 'link'); $link_desc->setAttribute('onclick', "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . "&triggerid=" . $trigger['triggerid'] . url_param('linkid') . "','ZBX_Link_Indicator',560,260,'scrollbars=1, toolbar=0, menubar=0, resizable=0');"); $table->addRow(array(array(new CCheckBox('triggers[' . $trigger['triggerid'] . '][triggerid]', null, null, $trigger['triggerid']), new CVar('triggers[' . $trigger['triggerid'] . '][triggerid]', $trigger['triggerid'])), array($link_desc, new CVar('triggers[' . $trigger['triggerid'] . '][description]', $trigger['description'])), array(map_link_drawtype2str($trigger['drawtype']), new CVar('triggers[' . $trigger['triggerid'] . '][drawtype]', $trigger['drawtype'])), array($colorbox, new CVar('triggers[' . $trigger['triggerid'] . '][color]', $trigger['color'])))); } $btnadd = new CButton('btn1', S_ADD, "javascript: openWinCentered('popup_link_tr.php?form=1&dstfrm=" . $frmCnct->GetName() . url_param('linkid') . "','ZBX_Link_Indicator',560,180,'scrollbars=1, toolbar=0, menubar=0, resizable=0');", 'T'); $btnRemove = new CButton('btn1', S_REMOVE, "javascript: remove_childs('" . $frmCnct->GetName() . "','triggers','tr');", 'T'); $btnadd->SetType('button'); $frmCnct->addRow(S_LINK_STATUS_INDICATORS, array($table, BR(), $btnadd, $btnRemove)); //---------- $frmCnct->addRow(S_TYPE . ' (' . S_OK_BIG . ')', $cmbType); $frmCnct->addRow(S_COLOR . ' (' . S_OK_BIG . ')', new CColor('color', $color)); $frmCnct->addItemToBottomRow(new CButton("save_link", S_SAVE)); if (isset($_REQUEST["linkid"])) { $frmCnct->addItemToBottomRow(SPACE); $frmCnct->addItemToBottomRow(new CButtonDelete("Delete link?", url_param("linkid") . url_param("sysmapid"))); } $frmCnct->addItemToBottomRow(SPACE); $frmCnct->addItemToBottomRow(new CButtonCancel(url_param("sysmapid"))); $frmCnct->show(); }
** ** 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., 675 Mass Ave, Cambridge, MA 02139, USA. **/ require_once 'include/config.inc.php'; require_once 'include/forms.inc.php'; $page["title"] = "S_INSTALLATION"; $page["file"] = 'instal.php'; include_once 'include/page_header.php'; include_once 'setup.php'; include_once 'include/page_footer.php'; /*******************************/ /* THIS POINT NEVER BE REACHED */ /*******************************/ $fields = array("install" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "update" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL)); check_fields($fields); if (isset($_REQUEST['install'])) { jsRedirect('setup.php'); exit; } else { if (isset($_REQUEST['update'])) { error('*UNDER CONSTRUCTION*'); } } $form = new CFormTable(S_INSTALLATION_UPDATE); $form->setHelp('install_source_web.php'); $form->addRow(array(bold(S_NEW_INSTALLATION_BIG), BR(), BR(), bold(S_DESCRIPTION), BR(), 'Not implemented yet!', BR(), BR(), BR()), new CButton('install', S_NEW_INSTALLATION)); $form->addRow(array(bold(S_UPDATE_BIG), BR(), BR(), bold(S_DESCRIPTION), BR(), 'Not implemented yet!', BR(), BR(), BR()), new CButton('update', S_UPDATE)); $form->show(); include_once 'include/page_footer.php';
} // checks $fields['test_expression'] = array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null); if (!check_fields($fields)) { $test = false; } // actions if (isset($_REQUEST['test_expression'])) { show_messages(); $test = true; } else { $test = false; } // form $testForm = new CFormTable(_('Test'), 'tr_testexpr.php'); $testForm->setHelp('web.testexpr.service.php'); $testForm->setTableClass('formlongtable formtable'); $testForm->addVar('form_refresh', get_request('form_refresh', 1)); $testForm->addVar('expression', $expression); $testForm->addRow(_('Test data'), $dataTable); $resultTable = new CTable(null, 'tableinfo'); $resultTable->setAttribute('id', 'result_list'); $resultTable->setOddRowClass('even_row'); $resultTable->setEvenRowClass('even_row'); $resultTable->setHeader(array(_('Expression'), _('Result'))); ksort($rplcts, SORT_NUMERIC); foreach ($eHTMLTree as $e) { $result = array('result' => '-', 'error' => ''); if ($allowedTesting && $test && isset($e['expression'])) { $result = evalExpressionData($e['expression']['value'], $macrosData); }
if (!isset($_REQUEST['form']) && ZBX_DISTRIBUTED) { $frmForm->addItem(new CButton('form', S_NEW_NODE)); } $nodes_wdgt->addPageHeader(S_CONFIGURATION_OF_NODES, $frmForm); if (ZBX_DISTRIBUTED) { global $ZBX_NODES, $ZBX_LOCMASTERID; if (isset($_REQUEST['form'])) { $frm_title = S_NODE; if (isset($_REQUEST['nodeid'])) { $node_data = get_node_by_nodeid($_REQUEST['nodeid']); $frm_title .= ' "' . $node_data['name'] . '"'; } $master_node = DBfetch(DBselect('SELECT name FROM nodes WHERE masterid=0 AND nodetype=' . ZBX_NODE_LOCAL)); $has_master = !$master_node ? true : false; $frmNode = new CFormTable($frm_title); $frmNode->setHelp('node.php'); if (isset($_REQUEST['nodeid'])) { $frmNode->addVar('nodeid', $_REQUEST['nodeid']); } if (isset($_REQUEST['nodeid']) && !isset($_REQUEST['form_refresh'])) { $new_nodeid = $node_data['nodeid']; $name = $node_data['name']; $timezone = $node_data['timezone']; $ip = $node_data['ip']; $port = $node_data['port']; $slave_history = $node_data['slave_history']; $slave_trends = $node_data['slave_trends']; $masterid = $node_data['masterid']; $node_type = detect_node_type($node_data); } else { $new_nodeid = get_request('new_nodeid', 0);
function insert_map_form() { $frm_title = 'New system map'; if (isset($_REQUEST['sysmapid'])) { $options = array('sysmapids' => $_REQUEST['sysmapid'], 'output' => API_OUTPUT_EXTEND); $sysmaps = CMap::get($options); $row = reset($sysmaps); $frm_title = 'System map: "' . $row['name'] . '"'; } if (isset($_REQUEST['sysmapid']) && !isset($_REQUEST['form_refresh'])) { $name = $row['name']; $width = $row['width']; $height = $row['height']; $backgroundid = $row['backgroundid']; $label_type = $row['label_type']; $label_location = $row['label_location']; $highlight = $row['highlight']; $markelements = $row['markelements']; $expandproblem = $row['expandproblem']; $show_unack = $row['show_unack']; } else { $name = get_request('name', ''); $width = get_request('width', 800); $height = get_request('height', 600); $backgroundid = get_request('backgroundid', 0); $label_type = get_request('label_type', 0); $label_location = get_request('label_location', 0); $highlight = get_request('highlight', 0); $markelements = get_request('markelements', 0); $expandproblem = get_request('expandproblem', 0); $show_unack = get_request('show_unack', 0); } $frmMap = new CFormTable($frm_title, 'sysmaps.php'); $frmMap->setHelp('web.sysmaps.map.php'); if (isset($_REQUEST['sysmapid'])) { $frmMap->addVar('sysmapid', $_REQUEST['sysmapid']); } $frmMap->addRow(S_NAME, new CTextBox('name', $name, 32)); $frmMap->addRow(S_WIDTH, new CNumericBox('width', $width, 5)); $frmMap->addRow(S_HEIGHT, new CNumericBox('height', $height, 5)); $cmbImg = new CComboBox('backgroundid', $backgroundid); $cmbImg->addItem(0, S_NO_IMAGE . '...'); $result = DBselect('SELECT * FROM images WHERE imagetype=2 AND ' . DBin_node('imageid') . ' order by name'); while ($row = DBfetch($result)) { $cmbImg->addItem($row['imageid'], get_node_name_by_elid($row['imageid'], null, ': ') . $row['name']); } $frmMap->addRow(S_BACKGROUND_IMAGE, $cmbImg); $frmMap->addRow(S_ICON_HIGHLIGHTING, new CCheckBox('highlight', $highlight, null, 1)); $frmMap->addRow(S_MARK_ELEMENTS_ON_TRIGGER_STATUS_CHANGE, new CCheckBox('markelements', $markelements, null, 1)); $frmMap->addRow(S_EXPAND_SINGLE_PROBLEM, new CCheckBox('expandproblem', $expandproblem, null, 1)); $cmbLabel = new CComboBox('label_type', $label_type); $cmbLabel->addItem(0, S_LABEL); $cmbLabel->addItem(1, S_IP_ADDRESS); $cmbLabel->addItem(2, S_ELEMENT_NAME); $cmbLabel->addItem(3, S_STATUS_ONLY); $cmbLabel->addItem(4, S_NOTHING); $frmMap->addRow(S_ICON_LABEL_TYPE, $cmbLabel); $cmbLocation = new CComboBox('label_location', $label_location); $cmbLocation->addItem(0, S_BOTTOM); $cmbLocation->addItem(1, S_LEFT); $cmbLocation->addItem(2, S_RIGHT); $cmbLocation->addItem(3, S_TOP); $frmMap->addRow(S_ICON_LABEL_LOCATION, $cmbLocation); $config = select_config(); $cb = new CComboBox('show_unack', $show_unack); $cb->addItems(array(EXTACK_OPTION_ALL => S_O_ALL, EXTACK_OPTION_BOTH => S_O_SEPARATED, EXTACK_OPTION_UNACK => S_O_UNACKNOWLEDGED_ONLY)); $cb->setEnabled($config['event_ack_enable']); if (!$config['event_ack_enable']) { $cb->setAttribute('title', S_EVENT_ACKNOWLEDGING_DISABLED); } $frmMap->addRow(S_PROBLEM_DISPLAY, $cb); $frmMap->addItemToBottomRow(new CButton('save', S_SAVE)); if (isset($_REQUEST['sysmapid'])) { $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonDelete(S_DELETE_SYSTEM_MAP_Q, url_param('form') . url_param('sysmapid'))); } $frmMap->addItemToBottomRow(SPACE); $frmMap->addItemToBottomRow(new CButtonCancel()); return $frmMap; }
//---------------------------------- CHECKS ------------------------------------ $fields['test_expression'] = array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null); if (!check_fields($fields)) { $test = false; } //------------------------ <ACTIONS> --------------------------- if (isset($_REQUEST['test_expression'])) { show_messages(); $test = true; } else { $test = false; } //------------------------ </ACTIONS> -------------------------- //------------------------ <FORM> --------------------------- $frm_test = new CFormTable(_('Test'), 'tr_testexpr.php'); $frm_test->setHelp('web.testexpr.service.php'); $frm_test->setTableClass('formlongtable formtable'); $frm_test->addVar('form_refresh', get_request('form_refresh', 1)); $frm_test->addVar('expression', $expression); /* test data */ $frm_test->addRow(_('Test data'), $data_table); /* result */ $res_table = new CTable(null, 'tableinfo'); $res_table->setAttribute('id', 'result_list'); $res_table->setOddRowClass('even_row'); $res_table->setEvenRowClass('even_row'); $res_table->setHeader(array(_('Expression'), _('Result'))); ksort($rplcts, SORT_NUMERIC); foreach ($eHTMLTree as $e) { $result = '-'; if ($allowedTesting && $test && isset($e['expression'])) {
if (isset($_REQUEST["applicationid"]) && !isset($_REQUEST["form_refresh"])) { $appname = $row["name"]; $apphostid = $row['hostid']; } else { $appname = get_request("appname", ""); $apphostid = get_request("apphostid", get_request("hostid", 0)); } $db_host = get_host_by_hostid($apphostid, 1); if ($db_host) { $apphost = $db_host["host"]; } else { $apphost = ''; $apphostid = 0; } $frmApp = new CFormTable($frm_title); $frmApp->setHelp("web.applications.php"); if (isset($_REQUEST["applicationid"])) { $frmApp->addVar("applicationid", $_REQUEST["applicationid"]); } $frmApp->addRow(S_NAME, new CTextBox("appname", $appname, 32)); $frmApp->addVar("apphostid", $apphostid); if (!isset($_REQUEST["applicationid"])) { // any new application can SELECT host $frmApp->addRow(S_HOST, array(new CTextBox("apphost", $apphost, 32, 'yes'), new CButton("btn1", S_SELECT, "return PopUp('popup.php?dstfrm=" . $frmApp->getName() . "&dstfld1=apphostid&dstfld2=apphost&srctbl=hosts_and_templates&srcfld1=hostid&srcfld2=host',450,450);", 'T'))); } $frmApp->addItemToBottomRow(new CButton('save', S_SAVE)); if (isset($_REQUEST['applicationid'])) { $frmApp->addItemToBottomRow(SPACE); $frmApp->addItemToBottomRow(new CButtonDelete(S_DELETE_APPLICATION, url_param('config') . url_param('hostid') . url_param('groupid') . url_param('form') . url_param('applicationid'))); } $frmApp->addItemToBottomRow(SPACE);
$gid = get_request("gid", null); $list_name = get_request("list_name", null); $itemid = get_request("itemid", 0); $color = get_request("color", '009900'); $drawtype = get_request("drawtype", 0); $sortorder = get_request("sortorder", 0); $yaxisside = get_request("yaxisside", 1); $calc_fnc = get_request("calc_fnc", 2); $type = get_request("type", 0); $periods_cnt = get_request("periods_cnt", 5); $only_hostid = get_request("only_hostid", null); $monitored_hosts = get_request('monitored_hosts', null); $caption = $itemid ? S_UPD_ITEM_FOR_THE_GRAPH : S_NEW_ITEM_FOR_THE_GRAPH; $frmGItem = new CFormTable($caption); $frmGItem->setName('graph_item'); $frmGItem->setHelp("web.graph.item.php"); $frmGItem->addVar('dstfrm', $_REQUEST['dstfrm']); $description = ''; if ($itemid > 0) { $description = get_item_by_itemid($itemid); $description = item_description($description); } $frmGItem->addVar('graphid', $graphid); $frmGItem->addVar('gid', $gid); $frmGItem->addVar('list_name', $list_name); $frmGItem->addVar('itemid', $itemid); $frmGItem->addVar('graphtype', $graphtype); $frmGItem->addVar('only_hostid', $only_hostid); $txtCondVal = new CTextBox('description', $description, 50, 'yes'); $host_condition = ''; if (isset($only_hostid)) {
foreach ($valueamaps as $valuemap) { $mappings_row = array(); $maps = $valuemap['maps']; order_result($maps, 'value'); foreach ($maps as $map) { array_push($mappings_row, $map['value'], SPACE . RARR . SPACE, $map['newvalue'], BR()); } $table->addRow(array(new CLink($valuemap['name'], 'config.php?form=update&valuemapid=' . $valuemap['valuemapid'] . url_param('config')), empty($mappings_row) ? SPACE : $mappings_row)); } $cnf_wdgt->addItem($table); } } else { if ($_REQUEST['config'] == 7) { //work period $frmHouseKeep = new CFormTable(S_WORKING_TIME, "config.php"); $frmHouseKeep->setHelp("web.config.workperiod.php"); $frmHouseKeep->addVar("config", get_request("config", 7)); $frmHouseKeep->addRow(S_WORKING_TIME, new CTextBox("work_period", $config["work_period"], 35)); $frmHouseKeep->addItemToBottomRow(new CButton("save", S_SAVE)); $cnf_wdgt->addItem($frmHouseKeep); } else { if ($_REQUEST['config'] == 8) { // GUI $frmGUI = new CFormTable(S_GUI, "config.php"); $frmGUI->addVar("config", get_request("config", 8)); $combo_theme = new CComboBox('default_theme', $config['default_theme']); $combo_theme->addItem('css_ob.css', S_ORIGINAL_BLUE); $combo_theme->addItem('css_bb.css', S_BLACK_AND_BLUE); $combo_theme->addItem('css_od.css', S_DARK_ORANGE); $exp_select = new CComboBox('event_ack_enable'); $exp_select->addItem(EVENT_ACK_ENABLED, S_ENABLED, $config['event_ack_enable'] ? 'yes' : 'no');