本文整理汇总了PHP中explode_exp函数的典型用法代码示例。如果您正苦于以下问题:PHP explode_exp函数的具体用法?PHP explode_exp怎么用?PHP explode_exp使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了explode_exp函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: triggerIdents
function triggerIdents($triggerids)
{
$idents = array();
$options = array('triggerids' => $triggerids, 'select_hosts' => array('hostid', 'host'), 'output' => API_OUTPUT_EXTEND, 'nodeids' => get_current_nodeid(true));
$triggers = CTrigger::get($options);
foreach ($triggers as $tnum => $trigger) {
$host = reset($trigger['hosts']);
$idents[$trigger['triggerid']] = array('node' => get_node_name_by_elid($host['hostid'], true), 'host' => $host['host'], 'description' => $trigger['description'], 'expression' => explode_exp($trigger['expression'], false));
}
return $idents;
}
示例2: CFormTable
}
}
//------------------------ <FORM> ---------------------------
if (hasRequest('sform')) {
$frmTRLog = new CFormTable(_('Trigger'), null, null, null, 'sform');
$frmTRLog->setName('sform');
$frmTRLog->addHelpIcon();
$frmTRLog->setTableClass('formlongtable formtable');
if (hasRequest('triggerid')) {
$frmTRLog->addVar('triggerid', getRequest('triggerid'));
}
if (hasRequest('triggerid') && !hasRequest('form_refresh')) {
$result = DBselect('SELECT t.expression,t.description,t.priority,t.comments,t.url,t.status,t.type' . ' FROM triggers t' . ' WHERE t.triggerid=' . zbx_dbstr(getRequest('triggerid')) . ' AND EXISTS (' . 'SELECT NULL' . ' FROM functions f,items i' . ' WHERE t.triggerid=f.triggerid' . ' AND f.itemid=i.itemid ' . ' AND i.value_type IN (' . ITEM_VALUE_TYPE_LOG . ',' . ITEM_VALUE_TYPE_TEXT . ',' . ITEM_VALUE_TYPE_STR . ')' . ')');
if ($row = DBfetch($result)) {
$description = $row['description'];
$expression = explode_exp($row['expression']);
$type = $row['type'];
$priority = $row['priority'];
$comments = $row['comments'];
$url = $row['url'];
$status = $row['status'];
}
// break expression into parts
$expressions = $constructor->getPartsFromExpression($expression);
} else {
$description = getRequest('description', '');
$expressions = getRequest('expressions', array());
$type = getRequest('type', 0);
$priority = getRequest('priority', 0);
$comments = getRequest('comments', '');
$url = getRequest('url', '');
示例3: make_trigger_details
function make_trigger_details($trigger)
{
$hosts = reset($trigger['hosts']);
$hostId = $hosts['hostid'];
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostId, 'selectScreens' => API_OUTPUT_COUNT, 'preservekeys' => true));
$host = reset($hosts);
$scripts = API::Script()->getScriptsByHosts($hostId);
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(getMenuPopupHost($host, $scripts ? reset($scripts) : null));
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$table->addRow(array(_('Host'), $hostName));
$table->addRow(array(_('Trigger'), CMacrosResolverHelper::resolveTriggerName($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), explode_exp($trigger['expression'], true, true)));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
示例4: update_profile
if (isset($_REQUEST['favobj'])) {
if ('hat' == $_REQUEST['favobj']) {
update_profile('web.tr_events.hats.' . $_REQUEST['favid'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
}
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
exit;
}
//--------
if (!check_right_on_trigger_by_triggerid(PERM_READ_ONLY, $_REQUEST["triggerid"])) {
access_deny();
}
$trigger_data = DBfetch(DBselect('SELECT h.host, t.* ' . ' FROM hosts h, items i, functions f, triggers t ' . ' WHERE i.itemid=f.itemid ' . ' AND f.triggerid=t.triggerid ' . ' AND t.triggerid=' . $_REQUEST["triggerid"] . ' AND h.hostid=i.hostid ' . ' AND ' . DBin_node('t.triggerid')));
$p_elements = array();
//Header
$trigger_data['exp_expr'] = explode_exp($trigger_data["expression"], 1);
$trigger_data['exp_desc'] = expand_trigger_description_by_data($trigger_data);
$text = array(S_EVENTS_BIG . ': "' . $trigger_data['exp_desc'] . '"');
$url = '?fullscreen=' . ($_REQUEST['fullscreen'] ? '0' : '1') . url_param('triggerid') . url_param('eventid');
$fs_icon = new CDiv(SPACE, 'fullscreen');
$fs_icon->addOption('title', $_REQUEST['fullscreen'] ? S_NORMAL . ' ' . S_VIEW : S_FULLSCREEN);
$fs_icon->addAction('onclick', new CScript("javascript: document.location = '" . $url . "';"));
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->addOption('border', 0);
$left_tab->addRow(create_hat(S_EVENT . SPACE . S_SOURCE . SPACE . S_DETAILS, make_trigger_details($_REQUEST['triggerid'], $trigger_data), null, 'hat_triggerdetails'));
$left_tab->addRow(create_hat(S_EVENT_DETAILS, make_event_details($_REQUEST['eventid']), null, 'hat_eventdetails'));
$right_tab = new CTable();
$right_tab->setCellPadding(3);
示例5: checkIfExistsOnHost
/**
* Checks that no trigger with the same description and expression as $trigger exist on the given host.
* Assumes the given trigger is valid.
*
* @throws APIException if at least one trigger exists
*
* @param array $trigger a trigger with an exploded expression
* @param null $hostid
*
* @return void
*/
protected function checkIfExistsOnHost(array $trigger, $hostId = null)
{
// skip the check if the description and expression haven't been changed
if (!isset($trigger['description']) && !isset($trigger['expression'])) {
return;
}
// make sure we have all the required data
if (!isset($trigger['description']) || !isset($trigger['expression'])) {
$explodeExpression = !isset($trigger['expression']);
$trigger = $this->extendObject($this->tableName(), $trigger, array('description', 'expression'));
if ($explodeExpression) {
$trigger['expression'] = explode_exp($trigger['expression']);
}
}
$filter = array('description' => $trigger['description']);
if ($hostId) {
$filter['hostid'] = $hostId;
} else {
$expressionData = new CTriggerExpression($trigger['expression']);
$expressionData->parse($trigger['expression']);
$expressionHosts = $expressionData->getHosts();
$filter['host'] = reset($expressionHosts);
}
$triggers = $this->get(array('filter' => $filter, 'output' => array('expression', 'triggerid'), 'nopermissions' => true));
foreach ($triggers as $dbTrigger) {
$tmpExp = explode_exp($dbTrigger['expression']);
// check if the expressions are also equal and that this is a different trigger
$differentTrigger = !isset($trigger['triggerid']) || !idcmp($trigger['triggerid'], $dbTrigger['triggerid']);
if (strcmp($tmpExp, $trigger['expression']) == 0 && $differentTrigger) {
$options = array('output' => array('name'), 'templated_hosts' => true, 'nopermissions' => true, 'limit' => 1);
if (isset($filter['host'])) {
$options['filter'] = array('host' => $filter['host']);
} else {
$options['hostids'] = $hostId;
}
$host = API::Host()->get($options);
$host = reset($host);
self::exception(ZBX_API_ERROR_PARAMETERS, _s('Trigger "%1$s" already exists on "%2$s".', $trigger['description'], $host['name']));
}
}
}
示例6: syncTemplates
public function syncTemplates(array $data)
{
$data['templateids'] = zbx_toArray($data['templateids']);
$data['hostids'] = zbx_toArray($data['hostids']);
$triggers = $this->get(array('hostids' => $data['templateids'], 'preservekeys' => true, 'output' => array('triggerid', 'expression', 'description', 'url', 'status', 'priority', 'comments', 'type')));
foreach ($triggers as $trigger) {
$trigger['expression'] = explode_exp($trigger['expression']);
$this->inherit($trigger, $data['hostids']);
}
return true;
}
示例7: array
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
include_once 'include/page_footer.php';
exit;
}
//--------
$options = array('triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'select_hosts' => API_OUTPUT_EXTEND);
$trigger = CTrigger::get($options);
if (!$trigger) {
access_deny();
} else {
$trigger = reset($trigger);
$trigger['host'] = reset($trigger['hosts']);
$trigger['host'] = $trigger['host']['host'];
}
$trigger['exp_expr'] = explode_exp($trigger['expression'], 1, false, true);
$trigger['exp_desc'] = expand_trigger_description_by_data($trigger);
$tr_event_wdgt = new CWidget();
$tr_event_wdgt->setClass('header');
// Main widget header
$text = array(S_EVENTS_BIG . ': "' . $trigger['exp_desc'] . '"');
$fs_icon = get_icon('fullscreen', array('fullscreen' => $_REQUEST['fullscreen']));
$tr_event_wdgt->addHeader($text, $fs_icon);
//-------
$left_tab = new CTable();
$left_tab->setCellPadding(3);
$left_tab->setCellSpacing(3);
$left_tab->setAttribute('border', 0);
// tr details
$tr_dtl = new CWidget('hat_triggerdetails', make_trigger_details($_REQUEST['triggerid'], $trigger));
$tr_dtl->setClass('header');
示例8: selectTriggers
/**
* Select trigger ids for previously added trigger names/expressions.
*/
protected function selectTriggers()
{
if (!empty($this->triggers)) {
$this->triggersRefs = array();
$dbTriggers = API::Trigger()->get(array('output' => array('triggerid', 'expression', 'description'), 'filter' => array('description' => array_keys($this->triggers), 'flags' => array(ZBX_FLAG_DISCOVERY_NORMAL, ZBX_FLAG_DISCOVERY_PROTOTYPE, ZBX_FLAG_DISCOVERY_CREATED)), 'editable' => true));
foreach ($dbTriggers as $dbTrigger) {
$dbTriggerExpression = explode_exp($dbTrigger['expression']);
if (isset($this->triggers[$dbTrigger['description']][$dbTriggerExpression])) {
$this->triggersRefs[$dbTrigger['description']][$dbTriggerExpression] = $dbTrigger['triggerid'];
}
}
}
}
示例9: syncTemplates
public function syncTemplates($data)
{
$data['templateids'] = zbx_toArray($data['templateids']);
$data['hostids'] = zbx_toArray($data['hostids']);
$triggers = $this->get(array('hostids' => $data['templateids'], 'preservekeys' => true, 'output' => API_OUTPUT_EXTEND, 'selectDependencies' => true));
foreach ($triggers as $trigger) {
$trigger['expression'] = explode_exp($trigger['expression']);
$this->inherit($trigger, $data['hostids']);
}
return true;
}
示例10: EndElement
//.........这里部分代码省略.........
$data['type'] = 0;
}
if (!isset($data['priority'])) {
$data['priority'] = 0;
}
if (!isset($data['status'])) {
$data['status'] = 0;
}
if (!isset($data['comments'])) {
$data['comments'] = '';
}
if (!isset($data['url'])) {
$data['url'] = '';
}
if (!isset($this->data[XML_TAG_HOST]['hostid']) || !$this->data[XML_TAG_HOST]['hostid']) {
if (isset($this->data[XML_TAG_HOST]['skip']) && $this->data[XML_TAG_HOST]['skip']) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule for host');
break;
// case
}
if (zbx_strstr($data['expression'], '{HOSTNAME}')) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
error('Trigger [' . $data['description'] . '] skipped - missing host');
break;
// case
}
} else {
$data['expression'] = str_replace('{{HOSTNAME}:', '{' . $this->data[XML_TAG_HOST]['name'] . ':', $data['expression']);
$result = DBselect('SELECT DISTINCT t.triggerid,t.templateid,t.expression ' . ' FROM triggers t,functions f,items i ' . ' WHERE t.triggerid=f.triggerid ' . ' AND f.itemid=i.itemid' . ' AND i.hostid=' . $this->data[XML_TAG_HOST]['hostid'] . ' AND t.description=' . zbx_dbstr($data['description']));
while ($trigger = DBfetch($result)) {
if (explode_exp($trigger['expression'], 0) == $data['expression']) {
break;
// while
}
}
if (!empty($trigger)) {
/* exist */
if ($this->trigger['exist'] == 1) {
/* skip */
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule');
break;
// case
}
update_trigger($trigger['triggerid'], $data['expression'], $data['description'], $data['type'], $data['priority'], $data['status'], $data['comments'], $data['url'], get_trigger_dependencies_by_triggerid($trigger['triggerid']), $trigger['templateid']);
break;
// case
} else {
/* missed */
// continue [add_trigger]
}
}
if ($this->trigger['missed'] == 1) {
// remember skipped triggers for dependencies
$this->data[XML_TAG_DEPENDENCIES]['skip'][] = $this->data[XML_TAG_HOST]['name'] . ':' . $data['description'];
info('Trigger [' . $data['description'] . '] skipped - user rule');
break;
// case
}
add_trigger($data['expression'], $data['description'], $data['type'], $data['priority'], $data['status'], $data['comments'], $data['url']);
break;
// case
示例11: time
$now = time();
if (isset($_REQUEST['status'])) {
$status = TRIGGER_STATUS_DISABLED;
} else {
$status = TRIGGER_STATUS_ENABLED;
}
//if(isset($_REQUEST['type'])) { $type=TRIGGER_MULT_EVENT_ENABLED; }
//else{ $type=TRIGGER_MULT_EVENT_DISABLED; }
$type = TRIGGER_MULT_EVENT_ENABLED;
if (isset($_REQUEST['triggerid'])) {
$options = array('triggerids' => $_REQUEST['triggerid'], 'output' => API_OUTPUT_EXTEND, 'selectDependencies' => API_OUTPUT_REFER);
$triggersData = API::Trigger()->get($options);
$triggerData = reset($triggersData);
if ($triggerData['templateid']) {
$_REQUEST['description'] = $triggerData['description'];
$expression = explode_exp($triggerData['expression']);
}
$trigger = array();
$trigger['triggerid'] = $_REQUEST['triggerid'];
$trigger['expression'] = $expression;
$trigger['description'] = $_REQUEST['description'];
$trigger['type'] = $type;
$trigger['priority'] = $_REQUEST['priority'];
$trigger['status'] = $status;
$trigger['comments'] = $_REQUEST['comments'];
$trigger['url'] = $_REQUEST['url'];
DBstart();
$result = API::Trigger()->update($trigger);
//REVERT
$result = DBend($result);
$triggerid = $_REQUEST['triggerid'];
示例12: show_messages
if (isset($_REQUEST['save'])) {
show_messages();
if (!check_right_on_trigger_by_expression(PERM_READ_WRITE, $_REQUEST['expression'])) {
if (isset($_REQUEST['triggerid'])) {
show_messages(false, null, S_CANNOT_UPDATE_TRIGGER);
} else {
show_messages(false, null, S_CANNOT_ADD_TRIGGER);
}
} else {
$status = isset($_REQUEST['status']) ? TRIGGER_STATUS_DISABLED : TRIGGER_STATUS_ENABLED;
$deps = get_request('dependencies', array());
if (isset($_REQUEST['triggerid'])) {
$triggerData = get_trigger_by_triggerid($_REQUEST['triggerid']);
if ($triggerData['templateid']) {
$_REQUEST['description'] = $triggerData['description'];
$_REQUEST['expression'] = explode_exp($triggerData['expression'], 0);
}
$current_deps = get_trigger_dependencies_by_triggerid($_REQUEST['triggerid']);
sort($deps);
sort($current_deps);
if ($deps == $current_deps) {
$deps = null;
}
$type = get_request('type');
$priority = get_request('priority');
$comments = get_request('comments');
$url = get_request('url');
if ($triggerData['type'] == $_REQUEST['type']) {
$type = null;
}
if ($triggerData['priority'] == $_REQUEST['priority']) {
示例13: CLink
if ($trigger['status'] == TRIGGER_STATUS_DISABLED) {
$status = new CLink(S_DISABLED, $status_link, 'disabled');
} else {
if ($trigger['status'] == TRIGGER_STATUS_UNKNOWN) {
$status = new CLink(S_UNKNOWN, $status_link, 'unknown');
} else {
if ($trigger['status'] == TRIGGER_STATUS_ENABLED) {
$status = new CLink(S_ENABLED, $status_link, 'enabled');
}
}
}
if ($_REQUEST['hostid'] > 0) {
$table->addRow(array(new CCheckBox('g_triggerid[' . $triggerid . ']', NULL, NULL, $triggerid), $priority, $status, $description, explode_exp($trigger['expression'], 1), $error));
} else {
foreach ($trigger['hosts'] as $host) {
$table->addRow(array(new CCheckBox('g_triggerid[' . $triggerid . ']', NULL, NULL, $triggerid), $priority, $status, $host['host'], $description, explode_exp($trigger['expression'], 1), $error));
}
}
}
//----- GO ------
$goBox = new CComboBox('go');
$goBox->addItem('activate', S_ACTIVATE_SELECTED);
$goBox->addItem('disable', S_DISABLE_SELECTED);
$goBox->addItem('massupdate', S_MASS_UPDATE);
$goBox->addItem('copy_to', S_COPY_SELECTED_TO);
$goBox->addItem('delete', S_DELETE_SELECTED);
// goButton name is necessary!!!
$goButton = new CButton('goButton', S_GO . ' (0)');
$goButton->setAttribute('id', 'goButton');
zbx_add_post_js('chkbxRange.pageGoName = "g_triggerid";');
$table->setFooter(new CCol(array($goBox, $goButton)));
示例14: make_trigger_details
function make_trigger_details($trigger)
{
$hostNames = array();
$hostIds = zbx_objectValues($trigger['hosts'], 'hostid');
$hosts = API::Host()->get(array('output' => array('name', 'hostid', 'status'), 'hostids' => $hostIds, 'selectScreens' => API_OUTPUT_COUNT, 'selectGraphs' => API_OUTPUT_COUNT));
if (count($hosts) > 1) {
order_result($hosts, 'name', ZBX_SORT_UP);
}
$scripts = API::Script()->getScriptsByHosts($hostIds);
foreach ($hosts as $host) {
$hostName = new CSpan($host['name'], 'link_menu');
$hostName->setMenuPopup(CMenuPopupHelper::getHost($host, $scripts[$host['hostid']]));
$hostNames[] = $hostName;
$hostNames[] = ', ';
}
array_pop($hostNames);
$table = new CTableInfo();
$table->addRow(array(new CCol(_n('Host', 'Hosts', count($hosts))), new CCol($hostNames, 'wraptext')));
$table->addRow(array(new CCol(_('Trigger')), new CCol(CMacrosResolverHelper::resolveTriggerName($trigger), 'wraptext')));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(new CCol(_('Expression')), new CCol(explode_exp($trigger['expression'], true, true), 'trigger-expression')));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}
示例15: make_trigger_details
function make_trigger_details($trigger)
{
$table = new CTableInfo();
if (is_show_all_nodes()) {
$table->addRow(array(_('Node'), get_node_name_by_elid($trigger['triggerid'])));
}
$expression = explode_exp($trigger['expression'], true, true);
$host = API::Host()->get(array('output' => array('name', 'hostid'), 'hostids' => $trigger['hosts'][0]['hostid'], 'selectScreens' => API_OUTPUT_COUNT, 'selectInventory' => array('hostid'), 'preservekeys' => true));
$host = reset($host);
$hostScripts = API::Script()->getScriptsByHosts($host['hostid']);
// host js link
$hostSpan = new CSpan($host['name'], 'link_menu menu-host');
$scripts = $hostScripts[$host['hostid']];
$hostSpan->attr('data-menu', hostMenuData($host, $scripts));
// get visible name of the first host
$table->addRow(array(_('Host'), $hostSpan));
$table->addRow(array(_('Trigger'), CTriggerHelper::expandDescription($trigger)));
$table->addRow(array(_('Severity'), getSeverityCell($trigger['priority'])));
$table->addRow(array(_('Expression'), $expression));
$table->addRow(array(_('Event generation'), _('Normal') . (TRIGGER_MULT_EVENT_ENABLED == $trigger['type'] ? SPACE . '+' . SPACE . _('Multiple PROBLEM events') : '')));
$table->addRow(array(_('Disabled'), TRIGGER_STATUS_ENABLED == $trigger['status'] ? new CCol(_('No'), 'off') : new CCol(_('Yes'), 'on')));
return $table;
}