本文整理汇总了PHP中uint_in_array函数的典型用法代码示例。如果您正苦于以下问题:PHP uint_in_array函数的具体用法?PHP uint_in_array怎么用?PHP uint_in_array使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uint_in_array函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: array
}
} else {
if (isset($_REQUEST['add_dependence']) && isset($_REQUEST['new_dependence'])) {
if (!isset($_REQUEST['dependencies'])) {
$_REQUEST['dependencies'] = array();
}
foreach ($_REQUEST['new_dependence'] as $triggerid) {
if (!uint_in_array($triggerid, $_REQUEST['dependencies'])) {
array_push($_REQUEST['dependencies'], $triggerid);
}
}
} else {
if (isset($_REQUEST['del_dependence']) && isset($_REQUEST['rem_dependence'])) {
if (isset($_REQUEST['dependencies'])) {
foreach ($_REQUEST['dependencies'] as $key => $val) {
if (!uint_in_array($val, $_REQUEST['rem_dependence'])) {
continue;
}
unset($_REQUEST['dependencies'][$key]);
}
}
} else {
if ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['mass_save']) && isset($_REQUEST['g_triggerid'])) {
show_messages();
$result = false;
$visible = get_request('visible', array());
$_REQUEST['dependencies'] = get_request('dependencies', array());
$options = array('triggerids' => $_REQUEST['g_triggerid'], 'select_dependencies' => 1, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
$triggers = CTrigger::get($options);
DBstart();
foreach ($triggers as $tnum => $db_trig) {
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:31,代码来源:triggers.php
示例2: profile_type
function profile_type($type, $profile_type)
{
$profile_type = strtolower($profile_type);
switch ($profile_type) {
case 'array':
$result = uint_in_array($type, array(PROFILE_TYPE_ARRAY_ID, PROFILE_TYPE_ARRAY_INT, PROFILE_TYPE_ARRAY_STR));
break;
case 'id':
$result = uint_in_array($type, array(PROFILE_TYPE_ID, PROFILE_TYPE_ARRAY_ID));
break;
case 'int':
$result = uint_in_array($type, array(PROFILE_TYPE_INT, PROFILE_TYPE_ARRAY_INT));
break;
case 'str':
$result = uint_in_array($type, array(PROFILE_TYPE_STR, PROFILE_TYPE_ARRAY_STR));
break;
case 'unknown':
$result = $type == PROFILE_TYPE_UNKNOWN;
break;
default:
$result = false;
}
return $result;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:24,代码来源:profiles.inc.php
示例3: update_user_group
function update_user_group($usrgrpid, $name, $users_status, $gui_access, $api_access, $debug_mode, $users = array(), $rights = array())
{
global $USER_DETAILS;
$sql = 'SELECT * ' . ' FROM usrgrp ' . ' WHERE name=' . zbx_dbstr($name) . ' AND usrgrpid<>' . $usrgrpid . ' AND ' . DBin_node('usrgrpid', get_current_nodeid(false));
if (DBfetch(DBselect($sql))) {
error("Group '{$name}' already exists");
return 0;
}
$result = DBexecute('UPDATE usrgrp SET name=' . zbx_dbstr($name) . ' WHERE usrgrpid=' . $usrgrpid);
if (!$result) {
return $result;
}
// must come before adding user to group
$result &= change_group_status($usrgrpid, $users_status);
$result &= change_group_gui_access($usrgrpid, $gui_access);
$result &= change_group_api_access($usrgrpid, $api_access);
$result &= change_group_debug_mode($usrgrpid, $debug_mode);
if (!$result) {
return $result;
}
//-------
$grant = true;
if ($gui_access == GROUP_GUI_ACCESS_DISABLED || $users_status == GROUP_STATUS_DISABLED) {
$grant = !uint_in_array($USER_DETAILS['userid'], $users);
}
if ($grant) {
$result = DBexecute('DELETE FROM users_groups WHERE usrgrpid=' . $usrgrpid);
foreach ($users as $userid => $name) {
$result = add_user_to_group($userid, $usrgrpid);
if (!$result) {
return $result;
}
}
} else {
error(S_USER_CANNOT_DISABLE_ITSELF);
return false;
}
$result = DBexecute('DELETE FROM rights WHERE groupid=' . $usrgrpid);
foreach ($rights as $right) {
$id = get_dbid('rights', 'rightid');
$result = DBexecute('INSERT INTO rights (rightid,groupid,permission,id)' . ' VALUES (' . $id . ',' . $usrgrpid . ',' . $right['permission'] . ',' . $right['id'] . ')');
if (!$result) {
return $result;
}
}
return $result;
}
开发者ID:phedders,项目名称:zabbix,代码行数:47,代码来源:users.inc.php
示例4: delete_template_triggers
function delete_template_triggers($hostid, $templateids = null, $unlink_mode = false)
{
zbx_value2array($templateids);
$triggers = get_triggers_by_hostid($hostid);
while ($trigger = DBfetch($triggers)) {
if ($trigger['templateid'] == 0) {
continue;
}
if ($templateids != null) {
$db_tmp_hosts = get_hosts_by_triggerid($trigger["templateid"]);
$tmp_host = DBfetch($db_tmp_hosts);
if (!uint_in_array($tmp_host["hostid"], $templateids)) {
continue;
}
}
if ($unlink_mode) {
if (DBexecute('UPDATE triggers SET templateid=0 WHERE triggerid=' . $trigger['triggerid'])) {
info('Trigger "' . $trigger["description"] . '" unlinked');
}
} else {
delete_trigger($trigger["triggerid"]);
}
}
return TRUE;
}
开发者ID:rennhak,项目名称:zabbix,代码行数:25,代码来源:triggers.inc.php
示例5: CFormList
$itemFormList = new CFormList('itemFormList');
// append type to form list
$copyTypeComboBox = new CComboBox('copy_type', $this->data['copy_type'], 'submit()');
$copyTypeComboBox->addItem(0, _('Hosts'));
$copyTypeComboBox->addItem(1, _('Host groups'));
$itemFormList->addRow(_('Target type'), $copyTypeComboBox);
// append targets to form list
$targetList = array();
if ($this->data['copy_type'] == 0) {
$groupComboBox = new CComboBox('copy_groupid', $this->data['copy_groupid'], 'submit()');
foreach ($this->data['groups'] as $group) {
$groupComboBox->addItem($group['groupid'], $group['name']);
}
$itemFormList->addRow(_('Group'), $groupComboBox);
foreach ($this->data['hosts'] as $host) {
array_push($targetList, array(new CCheckBox('copy_targetid[' . $host['hostid'] . ']', uint_in_array($host['hostid'], $this->data['copy_targetid']), null, $host['hostid']), SPACE, $host['name'], BR()));
}
} else {
foreach ($this->data['groups'] as $group) {
array_push($targetList, array(new CCheckBox('copy_targetid[' . $group['groupid'] . ']', uint_in_array($group['groupid'], $this->data['copy_targetid']), null, $group['groupid']), SPACE, $group['name'], BR()));
}
}
$itemFormList->addRow(_('Target'), !empty($targetList) ? $targetList : SPACE);
// append tabs to form
$itemTab = new CTabView();
$itemTab->addTab('itemTab', count($this->data['group_itemid']) . ' ' . _('elements copy to ...'), $itemFormList);
$itemForm->addItem($itemTab);
// append buttons to form
$itemForm->addItem(makeFormFooter(new CSubmit('copy', _('Copy')), new CButtonCancel(url_param('groupid') . url_param('hostid') . url_param('config'))));
$itemWidget->addItem($itemForm);
return $itemWidget;
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:configuration.item.copy.php
示例6: CLink
}
if ($db_item['value_type'] == ITEM_VALUE_TYPE_FLOAT || $db_item['value_type'] == ITEM_VALUE_TYPE_UINT64) {
$actions = new CLink(S_GRAPH, 'history.php?action=showgraph&itemid=' . $db_item['itemid'], 'action');
} else {
$actions = new CLink(S_HISTORY, 'history.php?action=showvalues&period=3600&itemid=' . $db_item['itemid'], 'action');
}
array_push($app_rows, new CRow(array(is_show_subnodes() ? $db_host['item_cnt'] ? SPACE : get_node_name_by_elid($db_item['itemid']) : null, $_REQUEST['hostid'] ? NULL : ($db_host['item_cnt'] ? SPACE : $db_item['host']), str_repeat(SPACE, 6) . $description, $lastclock, new CCol($lastvalue), $change, $actions)));
}
unset($app_rows);
unset($db_host);
foreach ($db_hosts as $hostid => $db_host) {
if (!isset($tab_rows[$hostid])) {
continue;
}
$app_rows = $tab_rows[$hostid];
if (uint_in_array(0, $_REQUEST['applications']) || isset($show_all_apps)) {
$url = '?close=1&applicationid=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
$link = new CLink(new CImg('images/general/opened.gif'), $url);
// $link = new CLink(new CImg('images/general/opened.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
} else {
$url = '?open=1&applicationid=0' . url_param('groupid') . url_param('hostid') . url_param('applications') . url_param('select');
$link = new CLink(new CImg('images/general/closed.gif'), $url);
// $link = new CLink(new CImg('images/general/closed.gif'),$url,null,"javascript: return updater.onetime_update('".ZBX_PAGE_MAIN_HAT."','".$url."');");
}
$col = new CCol(array($link, SPACE, bold(S_MINUS_OTHER_MINUS), SPACE . '(' . $db_host['item_cnt'] . SPACE . S_ITEMS . ')'));
$col->SetColSpan(5);
$table->AddRow(array(get_node_name_by_elid($db_host['hostid']), $_REQUEST['hostid'] > 0 ? NULL : $db_host['host'], $col));
foreach ($app_rows as $row) {
$table->AddRow($row);
}
}
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:latest.php
示例7: DBend
/* if($result){
add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_HOST_GROUP,
S_HOST_GROUP.' ['.$group['name'].' ] ['.$group['groupid'].']');
}*/
}
$result = DBend($result);
show_messages(true, S_GROUP_DELETED, S_CANNOT_DELETE_GROUP);
} else {
if (str_in_array($_REQUEST['go'], array('activate', 'disable'))) {
$result = true;
$status = $_REQUEST['go'] == 'activate' ? HOST_STATUS_MONITORED : HOST_STATUS_NOT_MONITORED;
$groups = get_request('groups', array());
$db_hosts = DBselect('select h.hostid, hg.groupid ' . ' from hosts_groups hg, hosts h' . ' where h.hostid=hg.hostid ' . ' and h.status in (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ')' . ' and ' . DBin_node('h.hostid'));
DBstart();
while ($db_host = DBfetch($db_hosts)) {
if (!uint_in_array($db_host['groupid'], $groups)) {
continue;
}
$host = get_host_by_hostid($db_host['hostid']);
$result &= update_host_status($db_host['hostid'], $status);
/* add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_HOST,
'Old status ['.$host['status'].'] '.'New status ['.$status.']');*/
}
$result = DBend($result);
show_messages($result, S_HOST_STATUS_UPDATED, S_CANNOT_UPDATE_HOST);
unset($_REQUEST['activate']);
}
}
}
}
}
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:hostgroups.php
示例8: delete_template_graphs
function delete_template_graphs($hostid, $templateids = null, $unlink_mode = false)
{
zbx_value2array($templateids);
$db_graphs = get_graphs_by_hostid($hostid);
while ($db_graph = DBfetch($db_graphs)) {
if ($db_graph['templateid'] == 0) {
continue;
}
if (!is_null($templateids)) {
$tmp_hhosts = get_hosts_by_graphid($db_graph['templateid']);
$tmp_host = DBfetch($tmp_hhosts);
if (!uint_in_array($tmp_host['hostid'], $templateids)) {
continue;
}
}
if ($unlink_mode) {
if (DBexecute('UPDATE graphs SET templateid=0 WHERE graphid=' . $db_graph['graphid'])) {
info('Graph "' . $db_graph['name'] . '" unlinked');
}
} else {
delete_graph($db_graph['graphid']);
}
}
}
开发者ID:phedders,项目名称:zabbix,代码行数:24,代码来源:graphs.inc.php
示例9: draw
public function draw()
{
$start_time = microtime(true);
set_image_header();
$this->column = uint_in_array($this->type, array(GRAPH_TYPE_COLUMN, GRAPH_TYPE_COLUMN_STACKED));
$this->fullSizeX = $this->sizeX;
$this->fullSizeY = $this->sizeY;
if ($this->sizeX < 300 || $this->sizeY < 200) {
$this->showLegend(0);
}
$this->calcShifts();
$this->sizeX -= $this->shiftXleft + $this->shiftXright + $this->shiftlegendright + $this->shiftXCaptionLeft + $this->shiftXCaptionRight;
$this->sizeY -= $this->shiftY + $this->shiftYLegend + $this->shiftYCaptionBottom + $this->shiftYCaptionTop;
$this->calcSeriesWidth();
$this->calcMiniMax();
$this->correctMiniMax();
if (function_exists('imagecolorexactalpha') && function_exists('imagecreatetruecolor') && @imagecreatetruecolor(1, 1)) {
$this->im = imagecreatetruecolor($this->fullSizeX, $this->fullSizeY);
} else {
$this->im = imagecreate($this->fullSizeX, $this->fullSizeY);
}
$this->initColors();
$this->drawRectangle();
$this->drawHeader();
$this->drawGrid();
$this->drawSideValues();
$this->drawLogo();
$this->drawLegend();
$count = 0;
if ($this->column) {
$start = $this->shiftXleft + $this->shiftXCaptionLeft + floor($this->seriesDistance / 2);
} else {
$start = $this->sizeY + $this->shiftY + $this->shiftYCaptionTop - floor($this->seriesDistance / 2);
}
foreach ($this->series as $key => $series) {
foreach ($series as $num => $serie) {
$axis = $serie['axis'];
$value = $serie['value'];
$color = $this->getColor($this->seriesColor[$num], $this->opacity);
if ($this->column) {
imagefilledrectangle($this->im, $start, $this->sizeY + $this->shiftY + $this->shiftYCaptionTop - round($this->sizeY / $this->maxValue[$axis] * $value), $start + $this->columnWidth, $this->sizeY + $this->shiftY + $this->shiftYCaptionTop, $color);
imagerectangle($this->im, $start, $this->sizeY + $this->shiftY + $this->shiftYCaptionTop - round($this->sizeY / $this->maxValue[$axis] * $value), $start + $this->columnWidth, $this->sizeY + $this->shiftY + $this->shiftYCaptionTop, $this->getColor('Black No Alpha'));
} else {
imagefilledrectangle($this->im, $this->shiftXleft + $this->shiftXCaptionLeft, $start - $this->columnWidth, $this->shiftXleft + $this->shiftXCaptionLeft + round($this->sizeX / $this->maxValue[$axis] * $value), $start, $color);
imagerectangle($this->im, $this->shiftXleft + $this->shiftXCaptionLeft, $start - $this->columnWidth, $this->shiftXleft + $this->shiftXCaptionLeft + round($this->sizeX / $this->maxValue[$axis] * $value), $start, $this->getColor('Black No Alpha'));
}
$start = $this->column ? $start + $this->columnWidth : $start - $this->columnWidth;
}
$count++;
if ($this->column) {
$start = $count * ($this->seriesWidth + $this->seriesDistance) + $this->shiftXleft + $this->shiftXCaptionLeft + floor($this->seriesDistance / 2);
} else {
$start = $this->sizeY + $this->shiftY + $this->shiftYCaptionTop - $count * ($this->seriesWidth + $this->seriesDistance) - floor($this->seriesDistance / 2);
}
}
$str = sprintf('%0.2f', microtime(true) - $start_time);
$str = _s('Generated in %s sec', $str);
$strSize = imageTextSize(6, 0, $str);
imageText($this->im, 6, 0, $this->fullSizeX - $strSize['width'] - 5, $this->fullSizeY - 5, $this->getColor('Gray'), $str);
unset($this->items, $this->data);
imageOut($this->im);
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:62,代码来源:CBarGraphDraw.php
示例10: get_regexp_form
function get_regexp_form()
{
$frm_title = S_REGULAR_EXPRESSION;
if (isset($_REQUEST['regexpid']) && !isset($_REQUEST["form_refresh"])) {
$sql = 'SELECT re.* ' . ' FROM regexps re ' . ' WHERE ' . DBin_node('re.regexpid') . ' AND re.regexpid=' . $_REQUEST['regexpid'];
$regexp = DBfetch(DBSelect($sql));
$frm_title .= ' [' . $regexp['name'] . ']';
$rename = $regexp['name'];
$test_string = $regexp['test_string'];
$expressions = array();
$sql = 'SELECT e.* ' . ' FROM expressions e ' . ' WHERE ' . DBin_node('e.expressionid') . ' AND e.regexpid=' . $regexp['regexpid'] . ' ORDER BY e.expression_type';
$db_exps = DBselect($sql);
while ($exp = DBfetch($db_exps)) {
$expressions[] = $exp;
}
} else {
$rename = get_request('rename', '');
$test_string = get_request('test_string', '');
$expressions = get_request('expressions', array());
}
$tblRE = new CTable('', 'nowrap');
$tblRE->addStyle('border-left: 1px #AAA solid; border-right: 1px #AAA solid; background-color: #EEE; padding: 2px; padding-left: 6px; padding-right: 6px;');
$tblRE->addRow(array(S_NAME, new CTextBox('rename', $rename, 60)));
$tblRE->addRow(array(S_TEST_STRING, new CTextArea('test_string', $test_string, 66, 5)));
$tabExp = new CTableInfo();
$td1 = new CCol(S_EXPRESSION);
$td1->addStyle('background-color: #CCC;');
$td2 = new CCol(S_EXPECTED_RESULT);
$td2->addStyle('background-color: #CCC;');
$td3 = new CCol(S_RESULT);
$td3->addStyle('background-color: #CCC;');
$tabExp->setHeader(array($td1, $td2, $td3));
$final_result = !empty($test_string);
foreach ($expressions as $id => $expression) {
$results = array();
$paterns = array($expression['expression']);
if (!empty($test_string)) {
if ($expression['expression_type'] == EXPRESSION_TYPE_ANY_INCLUDED) {
$paterns = explode($expression['exp_delimiter'], $expression['expression']);
}
if (uint_in_array($expression['expression_type'], array(EXPRESSION_TYPE_TRUE, EXPRESSION_TYPE_FALSE))) {
if ($expression['case_sensitive']) {
$results[$id] = ereg($paterns[0], $test_string);
} else {
$results[$id] = eregi($paterns[0], $test_string);
}
if ($expression['expression_type'] == EXPRESSION_TYPE_TRUE) {
$final_result &= $results[$id];
} else {
$final_result &= !$results[$id];
}
} else {
$results[$id] = true;
$tmp_result = false;
if ($expression['case_sensitive']) {
foreach ($paterns as $pid => $patern) {
$tmp_result |= zbx_stristr($test_string, $patern) !== false;
}
} else {
foreach ($paterns as $pid => $patern) {
$tmp_result |= zbx_strstr($test_string, $patern) !== false;
}
}
$results[$id] &= $tmp_result;
$final_result &= $results[$id];
}
}
if (isset($results[$id]) && $results[$id]) {
$exp_res = new CSpan(S_TRUE_BIG, 'green bold');
} else {
$exp_res = new CSpan(S_FALSE_BIG, 'red bold');
}
$expec_result = expression_type2str($expression['expression_type']);
if (EXPRESSION_TYPE_ANY_INCLUDED == $expression['expression_type']) {
$expec_result .= ' (' . S_DELIMITER . "='" . $expression['exp_delimiter'] . "')";
}
$tabExp->addRow(array($expression['expression'], $expec_result, $exp_res));
}
$td = new CCol(S_COMBINED_RESULT, 'bold');
$td->setColSpan(2);
if ($final_result) {
$final_result = new CSpan(S_TRUE_BIG, 'green bold');
} else {
$final_result = new CSpan(S_FALSE_BIG, 'red bold');
}
$tabExp->addRow(array($td, $final_result));
$tblRE->addRow(array(S_RESULT, $tabExp));
$tblFoot = new CTableInfo(null);
$td = new CCol(array(new CButton('save', S_SAVE)));
$td->setColSpan(2);
$td->addStyle('text-align: right;');
$td->addItem(SPACE);
$td->addItem(new CButton('test', S_TEST));
if (isset($_REQUEST['regexpid'])) {
$td->addItem(SPACE);
$td->addItem(new CButton('clone', S_CLONE));
$td->addItem(SPACE);
$td->addItem(new CButtonDelete(S_DELETE_REGULAR_EXPRESSION_Q, url_param('form') . url_param('config') . url_param('regexpid')));
}
$td->addItem(SPACE);
//.........这里部分代码省略.........
开发者ID:rennhak,项目名称:zabbix,代码行数:101,代码来源:forms.inc.php
示例11: elseif
}
} elseif (isset($_REQUEST['delete']) && isset($_REQUEST['triggerid'])) {
DBstart();
$result = API::Trigger()->delete($_REQUEST['triggerid']);
$result = DBend($result);
show_messages($result, _('Trigger deleted'), _('Cannot delete trigger'));
clearCookies($result, $_REQUEST['hostid']);
if ($result) {
unset($_REQUEST['form'], $_REQUEST['triggerid']);
}
} elseif (isset($_REQUEST['add_dependency']) && isset($_REQUEST['new_dependency'])) {
if (!isset($_REQUEST['dependencies'])) {
$_REQUEST['dependencies'] = array();
}
foreach ($_REQUEST['new_dependency'] as $triggerid) {
if (!uint_in_array($triggerid, $_REQUEST['dependencies'])) {
array_push($_REQUEST['dependencies'], $triggerid);
}
}
} elseif ($_REQUEST['go'] == 'massupdate' && isset($_REQUEST['mass_save']) && isset($_REQUEST['g_triggerid'])) {
$visible = get_request('visible', array());
// update triggers
$triggersToUpdate = array();
foreach ($_REQUEST['g_triggerid'] as $triggerid) {
$trigger = array('triggerid' => $triggerid);
if (isset($visible['priority'])) {
$trigger['priority'] = get_request('priority');
}
if (isset($visible['dependencies'])) {
$trigger['dependencies'] = zbx_toObject(get_request('dependencies', array()), 'triggerid');
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:triggers.php
示例12: StartElement
function StartElement($parser, $name, $attrs)
{
$this->element_data = '';
if (!isset($this->root)) {
if ($name == XML_TAG_ZABBIX_EXPORT) {
if (isset($attrs['version'])) {
if ($attrs['version'] == '1.0') {
$this->root = true;
return;
} else {
error(S_UNSUPPORTED_VERSION_OF_IMPORTED_DATA);
}
}
}
error(S_UNSUPPORTED_FILE_FORMAT);
$this->root = false;
} else {
if (!$this->root) {
return false;
}
}
$data =& $this->data[$name];
foreach ($attrs as $id => $val) {
$attrs[$id] = html_entity_decode($val);
}
switch ($name) {
case XML_TAG_HOST:
$this->main_node = array($name);
$this->sub_node = null;
$data = $attrs;
$data['groups'] = array();
$data['skip'] = false;
$sql = 'SELECT hostid ' . ' FROM hosts' . ' WHERE host=' . zbx_dbstr($data['name']) . ' AND status IN (' . HOST_STATUS_MONITORED . ',' . HOST_STATUS_NOT_MONITORED . ',' . HOST_STATUS_TEMPLATE . ')' . ' AND ' . DBin_node('hostid', get_current_nodeid(false));
if ($host_data = DBfetch(DBselect($sql))) {
/* exist */
if ($this->host['exist'] == 1) {
$data['skip'] = true;
info('Host [' . $data['name'] . '] skipped - user rule');
break;
// case
}
if (!isset($this->available_hosts[$host_data['hostid']])) {
error('Host [' . $data['name'] . '] skipped - Access deny.');
break;
// case
}
$data['hostid'] = $host_data['hostid'];
$data['templates'] = get_templates_by_hostid($host_data['hostid']);
$data['groups'] = get_groupids_by_host($host_data['hostid']);
} else {
/* missed */
if ($this->host['missed'] == 1) {
/* skip */
$data['skip'] = true;
info('Host [' . $data['name'] . '] skipped - user rule');
break;
// case
}
if (!uint_in_array(get_current_nodeid(), $this->available_nodes)) {
error('Host [' . $data['name'] . '] skipped - access denied.');
break;
// case
}
$data['templates'] = array();
$data['hostid'] = add_host($data['name'], 10050, HOST_STATUS_TEMPLATE, 0, '', '', 0, array(), 'no', '', 623, -1, 2, '', '', null, array());
}
break;
// case
// case
case XML_TAG_GRAPH:
$data = $attrs;
$data['items'] = array();
$this->sub_node = null;
array_push($this->main_node, $name);
break;
// case
// case
case XML_TAG_DEPENDENCY:
// checks if trigger has been skipped
if (str_in_array($attrs['description'], $this->data[XML_TAG_DEPENDENCIES]['skip'])) {
info('Trigger [' . $attrs['description'] . '] dependency update skipped - user rule');
break;
}
// searches trigger by host name & trigger description
if (!($trigger_down = get_trigger_by_description($attrs['description']))) {
error('Trigger [' . $attrs['description'] . '] dependency update skipped - trigger not found');
break;
}
$data['triggerid_down'] = $trigger_down['triggerid'];
$data['triggerid_up'] = array();
$this->sub_node = null;
array_push($this->main_node, $name);
break;
case XML_TAG_HOSTPROFILE:
case XML_TAG_HOSTPROFILE_EXT:
case XML_TAG_TEMPLATE:
case XML_TAG_ITEM:
case XML_TAG_TRIGGER:
case XML_TAG_DEPENDS:
case XML_TAG_GRAPH_ELEMENT:
//.........这里部分代码省略.........
开发者ID:phedders,项目名称:zabbix,代码行数:101,代码来源:import.inc.php
示例13: get_viewed_nodes
function get_viewed_nodes($options = array())
{
global $USER_DETAILS;
global $ZBX_LOCALNODEID, $ZBX_AVAILABLE_NODES;
$config = select_config();
$def_options = array('allow_all' => 0);
$options = zbx_array_merge($def_options, $options);
$result = array('selected' => 0, 'nodes' => array(), 'nodeids' => array());
if (!defined('ZBX_NOT_ALLOW_ALL_NODES')) {
$result['nodes'][0] = array('nodeid' => 0, 'name' => S_ALL_S);
}
$available_nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_LIST, PERM_RES_DATA_ARRAY);
$available_nodes = get_tree_by_parentid($ZBX_LOCALNODEID, $available_nodes, 'masterid');
//remove parent nodes
// $selected_nodeids = get_request('selected_nodes', CProfile::get('web.nodes.selected', array($USER_DETAILS['node']['nodeid'])));
$selected_nodeids = get_request('selected_nodes', get_node_profile(array($USER_DETAILS['node']['nodeid'])));
// +++ Fill $result['NODEIDS'], $result['NODES'] +++
$nodes = array();
$nodeids = array();
foreach ($selected_nodeids as $num => $nodeid) {
if (isset($available_nodes[$nodeid])) {
$result['nodes'][$nodeid] = array('nodeid' => $available_nodes[$nodeid]['nodeid'], 'name' => $available_nodes[$nodeid]['name'], 'masterid' => $available_nodes[$nodeid]['masterid']);
$nodeids[$nodeid] = $nodeid;
}
}
// --- ---
$switch_node = get_request('switch_node', CProfile::get('web.nodes.switch_node', -1));
if (!isset($available_nodes[$switch_node]) || !uint_in_array($switch_node, $selected_nodeids)) {
//check switch_node
$switch_node = 0;
}
$result['nodeids'] = $nodeids;
if (!defined('ZBX_NOT_ALLOW_ALL_NODES')) {
$result['selected'] = $switch_node;
} else {
if (!empty($nodeids)) {
$result['selected'] = $switch_node > 0 ? $switch_node : array_shift($nodeids);
}
}
return $result;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:41,代码来源:nodes.inc.php
示例14: get_screen_item_form
//.........这里部分代码省略.........
$caption = '(' . $nodeName . ') ' . $caption;
}
}
$form->addVar('resourceid', $id);
$textfield = new Ctextbox('caption', $caption, 60, 'yes');
$selectbtn = new Cbutton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=sysmaps&srcfld1=sysmapid&srcfld2=name',400,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
} else {
if ($resourcetype == SCREEN_RESOURCE_PLAIN_TEXT) {
// Plain text
$options = array('itemids' => $resourceid, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND);
$items = CItem::get($options);
$caption = '';
$id = 0;
if (!empty($items)) {
$id = $resourceid;
$item = reset($items);
$item['host'] = reset($item['hosts']);
$caption = item_description($item);
$nodeName = get_node_name_by_elid($item['itemid']);
if (!zbx_empty($nodeName)) {
$caption = '(' . $nodeName . ') ' . $caption;
}
}
$form->addVar('resourceid', $id);
$textfield = new CTextbox('caption', $caption, 75, 'yes');
$selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=plain_text&srcfld1=itemid&srcfld2=description',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->addRow(S_PARAMETER, array($textfield, SPACE, $selectbtn));
$form->addRow(S_SHOW_LINES, new CNumericBox('elements', $elements, 2));
$form->addRow(S_SHOW_TEXT_AS_HTML, new CCheckBox('style', $style, null, 1));
} else {
if (uint_in_array($resourcetype, array(SCREEN_RESOURCE_HOSTGROUP_TRIGGERS, SCREEN_RESOURCE_HOST_TRIGGERS))) {
// Status of triggers
$caption = '';
$id = 0;
if (SCREEN_RESOURCE_HOSTGROUP_TRIGGERS == $resourcetype) {
if ($resourceid > 0) {
$options = array('groupids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
$groups = CHostgroup::get($options);
foreach ($groups as $gnum => $group) {
$caption = get_node_name_by_elid($group['groupid'], true, ':') . $group['name'];
$id = $resourceid;
}
}
$form->addVar('resourceid', $id);
$textfield = new CTextbox('caption', $caption, 60, 'yes');
$selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=host_group&srcfld1=groupid&srcfld2=name',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->addRow(S_GROUP, array($textfield, SPACE, $selectbtn));
} else {
if ($resourceid > 0) {
$options = array('hostids' => $resourceid, 'output' => API_OUTPUT_EXTEND, 'editable' => 1);
$hosts = CHost::get($options);
foreach ($hosts as $hnum => $host) {
$caption = get_node_name_by_elid($host['hostid'], true, ':') . $host['host'];
$id = $resourceid;
}
}
$form->addVar('resourceid', $id);
$textfield = new CTextbox('caption', $caption, 60, 'yes');
$selectbtn = new CButton('select', S_SELECT, "javascript: return PopUp('popup.php?writeonly=1&dstfrm=" . $form->getName() . "&dstfld1=resourceid&dstfld2=caption&srctbl=hosts&srcfld1=hostid&srcfld2=host',800,450);");
$selectbtn->setAttribute('onmouseover', "javascript: this.style.cursor = 'pointer';");
$form->addRow(S_HOST, array($textfield, SPACE, $selectbtn));
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:67,代码来源:screens.inc.php
示例15: zbx_uint_array_intersect
function zbx_uint_array_intersect(&$array1, &$array2)
{
$result = array();
foreach ($array1 as $key => $value) {
if (uint_in_array($value, $array2)) {
$result[$key] = $value;
}
}
return $result;
}
开发者ID:itnihao,项目名称:Zabbix_,代码行数:10,代码来源:func.inc.php
示例16: CNumericBox
$autologoutTextBox = new CNumericBox('autologout', $this->data['autologout'], 4);
} else {
$autologoutTextBox = new CNumericBox('autologout', 900, 4);
$autologoutTextBox->setAttribute('disabled', 'disabled');
}
if ($this->data['alias'] != ZBX_GUEST_USER) {
$userFormList->addRow(_('Auto-login'), new CCheckBox('autologin', $this->data['autologin'], null, 1));
$userFormList->addRow(_('Auto-logout (min 90 seconds)'), array($autologoutCheckBox, $autologoutTextBox));
}
$userFormList->addRow(_('Refresh (in seconds)'), new CNumericBox('refresh', $this->data['refresh'], 4));
$userFormList->addRow(_('Rows per page'), new CNumericBox('rows_per_page', $this->data['rows_per_page'], 6));
$userFormList->addRow(_('URL (after login)'), new CTextBox('url', $this->data['url'], ZBX_TEXTBOX_STANDARD_SIZE));
/*
* Media tab
*/
if (uint_in_array(CWebUser::$data['type'], array(USER_TYPE_ZABBIX_ADMIN, USER_TYPE_SUPER_ADMIN))) {
$userMediaFormList = new CFormList('userMediaFormList');
$userForm->addVar('user_medias', $this->data['user_medias']);
$mediaTableInfo = new CTableInfo(_('No media found.'));
foreach ($this->data['user_medias'] as $id => $media) {
if (!isset($media['active']) || !$media['active']) {
$status = new CLink(_('Enabled'), '#', 'enabled');
$status->onClick('return create_var("' . $userForm->getName() . '","disable_media",' . $id . ', true);');
} else {
$status = new CLink(_('Disabled'), '#', 'disabled');
$status->onClick('return create_var("' . $userForm->getName() . '","enable_media",' . $id . ', true);');
}
$mediaUrl = '?dstfrm=' . $userForm->getName() . '&media=' . $id . '&mediatypeid=' . $media['mediatypeid'] . '&sendto=' . urlencode($media['sendto']) . '&period=' . $media['period'] . '&severity=' . $media['severity'] . '&active=' . $media['active'];
foreach (getSeverityCaption() as $key => $caption) {
$mediaActive = $media['severity'] & 1 << $key;
$mediaSeverity[$key] = new CSpan(mb_substr($caption, 0, 1), $mediaActive ? 'enabled' : null);
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:administration.users.edit.php
示例17: getTriggerFormData
/**
* Generate data for the trigger configuration form.
*
* @param string $exprAction expression constructor action, see remakeExpression() for a list of supported values
*
* @return array
*/
function getTriggerFormData($exprAction)
{
$data = array('form' => getRequest('form'), 'form_refresh' => getRequest('form_refresh'), 'parent_discoveryid' => getRequest('parent_discoveryid'), 'dependencies' => getRequest('dependencies', array()), 'db_dependencies' => array(), 'triggerid' => getRequest('triggerid'), 'expression' => getRequest('expression', ''), 'expr_temp' => getRequest('expr_temp', ''), 'description' => getRequest('description', ''), 'type' => getRequest('type', 0), 'priority' => getRequest('priority', 0), 'status' => getRequest('status', 0), 'comments' => getRequest('comments', ''), 'url' => getRequest('url', ''), 'input_method' => getRequest('input_method', IM_ESTABLISHED), 'limited' => false, 'templates' => array(), 'hostid' => getRequest('hostid', 0));
if (!empty($data['triggerid'])) {
// get trigger
$options = array('output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid'), 'triggerids' => $data['triggerid']);
$trigger = $data['parent_discoveryid'] ? API::TriggerPrototype()->get($options) : API::Trigger()->get($options);
$data['trigger'] = reset($trigger);
// get templates
$tmp_triggerid = $data['triggerid'];
do {
$db_triggers = DBfetch(DBselect('SELECT t.triggerid,t.templateid,id.parent_itemid,h.name,h.hostid' . ' FROM triggers t' . ' LEFT JOIN functions f ON t.triggerid=f.triggerid' . ' LEFT JOIN items i ON f.itemid=i.itemid' . ' LEFT JOIN hosts h ON i.hostid=h.hostid' . ' LEFT JOIN item_discovery id ON i.itemid=id.itemid' . ' WHERE t.triggerid=' . zbx_dbstr($tmp_triggerid)));
if (bccomp($data['triggerid'], $tmp_triggerid) != 0) {
// parent trigger prototype link
if ($data['parent_discoveryid']) {
$link = 'trigger_prototypes.php?form=update&triggerid=' . $db_triggers['triggerid'] . '&parent_discoveryid=' . $db_triggers['parent_itemid'] . '&hostid=' . $db_triggers['hostid'];
} else {
$link = 'triggers.php?form=update&triggerid=' . $db_triggers['triggerid'] . '&hostid=' . $db_triggers['hostid'];
}
$data['templates'][] = new CLink(CHtml::encode($db_triggers['name']), $link, 'highlight underline weight_normal');
$data['templates'][] = SPACE . '⇒' . SPACE;
}
$tmp_triggerid = $db_triggers['templateid'];
} while ($tmp_triggerid != 0);
$data['templates'] = array_reverse($data['templates']);
array_shift($data['templates']);
$data['limited'] = $data['trigger']['templateid'] != 0;
// select first host from triggers if gived not match
$hosts = $data['trigger']['hosts'];
if (count($hosts) > 0 && !in_array(array('hostid' => $data['hostid']), $hosts)) {
$host = reset($hosts);
$data['hostid'] = $host['hostid'];
}
}
if (!empty($data['triggerid']) && !isset($_REQUEST['form_refresh']) || $data['limited']) {
$data['expression'] = explode_exp($data['trigger']['expression']);
if (!$data['limited'] || !isset($_REQUEST['form_refresh'])) {
$data['description'] = $data['trigger']['description'];
$data['type'] = $data['trigger']['type'];
$data['priority'] = $data['trigger']['priority'];
$data['status'] = $data['trigger']['status'];
$data['comments'] = $data['trigger']['comments'];
$data['url'] = $data['trigger']['url'];
$db_triggers = DBselect('SELECT t.triggerid,t.description' . ' FROM triggers t,trigger_depends d' . ' WHERE t.triggerid=d.triggerid_up' . ' AND d.triggerid_down=' . zbx_dbstr($data['triggerid']));
while ($trigger = DBfetch($db_triggers)) {
if (uint_in_array($trigger['triggerid'], $data['dependencies'])) {
continue;
}
array_push($data['dependencies'], $trigger
|
请发表评论