当前位置: 首页>>代码示例>>PHP>>正文


PHP zbx_strpos函数代码示例

本文整理汇总了PHP中zbx_strpos函数的典型用法代码示例。如果您正苦于以下问题:PHP zbx_strpos函数的具体用法?PHP zbx_strpos怎么用?PHP zbx_strpos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了zbx_strpos函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 public function __construct($url = null)
 {
     if (empty($url)) {
         $this->formatGetArguments();
         $this->url = basename($_SERVER['SCRIPT_NAME']);
     } else {
         $this->url = $url;
         // parse reference
         $tmp_pos = zbx_strpos($this->url, '#');
         if ($tmp_pos !== false) {
             $this->reference = zbx_substring($this->url, $tmp_pos + 1);
             $this->url = zbx_substring($this->url, 0, $tmp_pos);
         }
         $tmp_pos = zbx_strpos($url, '?');
         // parse query
         if ($tmp_pos !== false) {
             $this->query = zbx_substring($url, $tmp_pos + 1);
             $this->url = $url = zbx_substring($url, 0, $tmp_pos);
         }
         $this->formatArguments();
     }
     if (isset($_COOKIE['zbx_sessionid'])) {
         $this->setArgument('sid', substr($_COOKIE['zbx_sessionid'], 16, 16));
     }
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:25,代码来源:class.curl.php

示例2: retrieve_headers

 /**
  * Retrieve the HTTP request headers from the $_SERVER superglobal
  * @param Array Additional Headers to retrieve
  */
 public function retrieve_headers($add_headers = false)
 {
     if ($add_headers) {
         $this->add_headers = array_merge($this->add_headers, $add_headers);
     }
     if (isset($_SERVER['HTTP_METHOD'])) {
         $this->method = $_SERVER['HTTP_METHOD'];
         unset($_SERVER['HTTP_METHOD']);
     } else {
         $this->method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : false;
     }
     $this->protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : false;
     $this->request_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : false;
     $this->headers = array();
     foreach ($_SERVER as $i => $val) {
         if (zbx_strpos($i, 'HTTP_') === 0 || in_array($i, $this->add_headers)) {
             $name = str_replace(array('HTTP_', '_'), array('', '-'), $i);
             $this->headers[$name] = $val;
         }
     }
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:25,代码来源:class.chttp_request.php

示例3: resolveItemKeyMacros

/**
 * Resolve macros in item key.
 * Resolve {HOSTNAME}, {IPADDRESS}, {HOST.IP}, {HOST.DNS}, {HOST.CONN}, {HOST.HOST}, {HOST.NAME} and user macros.
 * Macros related to interface resolved only for host items.
 *
 * @param array $item
 * @param string $item['key_']
 * @param string $item['itemid']
 *
 * @return string
 */
function resolveItemKeyMacros(array $item)
{
    $key =& $item['key_'];
    $macStack = array();
    $macros = array('{HOSTNAME}', '{IPADDRESS}', '{HOST.IP}', '{HOST.DNS}', '{HOST.CONN}', '{HOST.HOST}', '{HOST.NAME}');
    foreach ($macros as $macro) {
        if (zbx_strpos($key, $macro) !== false) {
            $macStack[] = $macro;
        }
    }
    if (!empty($macStack)) {
        $dbItem = API::Item()->get(array('itemids' => $item['itemid'], 'selectInterfaces' => array('ip', 'dns', 'useip'), 'selectHosts' => array('host', 'name'), 'output' => API_OUTPUT_REFER, 'filter' => array('flags' => null)));
        if (!empty($dbItem)) {
            $dbItem = reset($dbItem);
            $host = reset($dbItem['hosts']);
            $interface = reset($dbItem['interfaces']);
            // if item without interface or template item, resolve interface related macros to *UNKNOWN*
            if (!$interface) {
                $interface = array('ip' => UNRESOLVED_MACRO_STRING, 'dns' => UNRESOLVED_MACRO_STRING, 'useip' => false);
            }
            foreach ($macStack as $macro) {
                switch ($macro) {
                    case '{HOST.NAME}':
                        $key = str_replace('{HOST.NAME}', $host['name'], $key);
                        break;
                    case '{HOSTNAME}':
                        // deprecated
                        $key = str_replace('{HOSTNAME}', $host['host'], $key);
                        break;
                    case '{HOST.HOST}':
                        $key = str_replace('{HOST.HOST}', $host['host'], $key);
                        break;
                    case '{HOST.IP}':
                        $key = str_replace('{HOST.IP}', $interface['ip'], $key);
                        break;
                    case '{IPADDRESS}':
                        // deprecated
                        $key = str_replace('{IPADDRESS}', $interface['ip'], $key);
                        break;
                    case '{HOST.DNS}':
                        $key = str_replace('{HOST.DNS}', $interface['dns'], $key);
                        break;
                    case '{HOST.CONN}':
                        $key = str_replace('{HOST.CONN}', $interface['useip'] ? $interface['ip'] : $interface['dns'], $key);
                        break;
                }
            }
        }
    }
    if (preg_match('/' . ZBX_PREG_EXPRESSION_USER_MACROS . '/', $key)) {
        $item = API::UserMacro()->resolveItem($item);
    }
    return $item['key_'];
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:65,代码来源:items.inc.php

示例4: ldapLogin

 public static function ldapLogin($user)
 {
     $name = $user['user'];
     $passwd = $user['password'];
     $cnf = isset($user['cnf']) ? $user['cnf'] : null;
     if (is_null($cnf)) {
         $config = select_config();
         foreach ($config as $id => $value) {
             if (zbx_strpos($id, 'ldap_') !== false) {
                 $cnf[str_replace('ldap_', '', $id)] = $config[$id];
             }
         }
     }
     if (!function_exists('ldap_connect')) {
         info(S_CUSER_ERROR_LDAP_MODULE_MISSING);
         return false;
     }
     $ldap = new CLdap($cnf);
     $ldap->connect();
     $result = $ldap->checkPass($name, $passwd);
     return $result;
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:22,代码来源:class.cuser.php

示例5: resolveMapLabelMacrosAll

/**
 * Resolve all kinds of macros in map labels
 *
 * @param array $selement
 * @param string $selement['label'] label to expand
 * @param int $selement['elementtype'] type of element: trigger, host, ...
 * @param int $selement['elementid'] element id in DB
 * @param string $selement['elementExpressionTrigger'] if type is trigger, then trigger expression
 *
 * @return string expanded label
 */
function resolveMapLabelMacrosAll(array $selement)
{
    $label = $selement['label'];
    // for host and trigger items expand macros if they exists
    if (($selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST || $selement['elementtype'] == SYSMAP_ELEMENT_TYPE_TRIGGER) && (zbx_strpos($label, 'HOST.NAME') !== false || zbx_strpos($label, 'HOSTNAME') !== false || zbx_strpos($label, 'HOST.HOST') !== false || zbx_strpos($label, 'HOST.DNS') !== false || zbx_strpos($label, 'HOST.IP') !== false || zbx_strpos($label, 'IPADDRESS') !== false || zbx_strpos($label, 'HOST.CONN') !== false)) {
        // priorities of interface types doesn't match interface type ids in DB
        $priorities = array(INTERFACE_TYPE_AGENT => 4, INTERFACE_TYPE_SNMP => 3, INTERFACE_TYPE_JMX => 2, INTERFACE_TYPE_IPMI => 1);
        // get host data if element is host
        if ($selement['elementtype'] == SYSMAP_ELEMENT_TYPE_HOST) {
            $res = DBselect('SELECT hi.ip,hi.dns,hi.useip,h.host,h.name,hi.type AS interfacetype' . ' FROM interface hi,hosts h' . ' WHERE hi.hostid=h.hostid' . ' AND hi.main=1 AND hi.hostid=' . zbx_dbstr($selement['elementid']));
            // process interface priorities
            $tmpPriority = 0;
            while ($dbHost = DBfetch($res)) {
                if ($priorities[$dbHost['interfacetype']] > $tmpPriority) {
                    $resHost = $dbHost;
                    $tmpPriority = $priorities[$dbHost['interfacetype']];
                }
            }
            $hostsByNr[''] = $resHost;
        } else {
            $res = DBselect('SELECT hi.ip,hi.dns,hi.useip,h.host,h.name,f.functionid,hi.type AS interfacetype' . ' FROM interface hi,items i,functions f,hosts h' . ' WHERE h.hostid=hi.hostid' . ' AND hi.hostid=i.hostid' . ' AND i.itemid=f.itemid' . ' AND hi.main=1 AND f.triggerid=' . zbx_dbstr($selement['elementid']) . ' ORDER BY f.functionid');
            // process interface priorities, build $hostsByFunctionId array
            $tmpFunctionId = -1;
            while ($dbHost = DBfetch($res)) {
                if ($dbHost['functionid'] != $tmpFunctionId) {
                    $tmpPriority = 0;
                    $tmpFunctionId = $dbHost['functionid'];
                }
                if ($priorities[$dbHost['interfacetype']] > $tmpPriority) {
                    $hostsByFunctionId[$dbHost['functionid']] = $dbHost;
                    $tmpPriority = $priorities[$dbHost['interfacetype']];
                }
            }
            // get all function ids from expression and link host data against position in expression
            preg_match_all('/\\{([0-9]+)\\}/', $selement['elementExpressionTrigger'], $matches);
            $hostsByNr = array();
            foreach ($matches[1] as $i => $functionid) {
                if (isset($hostsByFunctionId[$functionid])) {
                    $hostsByNr[$i + 1] = $hostsByFunctionId[$functionid];
                }
            }
            // for macro without numeric index
            if (isset($hostsByNr[1])) {
                $hostsByNr[''] = $hostsByNr[1];
            }
        }
        // resolve functional macros like: {{HOST.HOST}:log[{HOST.HOST}.log].last(0)}
        $label = resolveMapLabelMacros($label, $hostsByNr);
        // resolves basic macros
        // $hostsByNr possible keys: '' and 1-9
        foreach ($hostsByNr as $i => $host) {
            $replace = array('{HOST.NAME' . $i . '}' => $host['name'], '{HOSTNAME' . $i . '}' => $host['name'], '{HOST.HOST' . $i . '}' => $host['host'], '{HOST.DNS' . $i . '}' => $host['dns'], '{HOST.IP' . $i . '}' => $host['ip'], '{IPADDRESS' . $i . '}' => $host['ip'], '{HOST.CONN' . $i . '}' => $host['useip'] ? $host['ip'] : $host['dns']);
            $label = str_replace(array_keys($replace), $replace, $label);
        }
    } else {
        // resolve functional macros like: {sampleHostName:log[{HOST.HOST}.log].last(0)}, if no host provided
        $label = resolveMapLabelMacros($label);
    }
    // resolve map specific processing consuming macros
    switch ($selement['elementtype']) {
        case SYSMAP_ELEMENT_TYPE_HOST:
        case SYSMAP_ELEMENT_TYPE_MAP:
        case SYSMAP_ELEMENT_TYPE_TRIGGER:
        case SYSMAP_ELEMENT_TYPE_HOST_GROUP:
            if (zbx_strpos($label, '{TRIGGERS.UNACK}') !== false) {
                $label = str_replace('{TRIGGERS.UNACK}', get_triggers_unacknowledged($selement), $label);
            }
            if (zbx_strpos($label, '{TRIGGERS.PROBLEM.UNACK}') !== false) {
                $label = str_replace('{TRIGGERS.PROBLEM.UNACK}', get_triggers_unacknowledged($selement, true), $label);
            }
            if (zbx_strpos($label, '{TRIGGER.EVENTS.UNACK}') !== false) {
                $label = str_replace('{TRIGGER.EVENTS.UNACK}', get_events_unacknowledged($selement), $label);
            }
            if (zbx_strpos($label, '{TRIGGER.EVENTS.PROBLEM.UNACK}') !== false) {
                $label = str_replace('{TRIGGER.EVENTS.PROBLEM.UNACK}', get_events_unacknowledged($selement, null, TRIGGER_VALUE_TRUE), $label);
            }
            if (zbx_strpos($label, '{TRIGGER.PROBLEM.EVENTS.PROBLEM.UNACK}') !== false) {
                $label = str_replace('{TRIGGER.PROBLEM.EVENTS.PROBLEM.UNACK}', get_events_unacknowledged($selement, TRIGGER_VALUE_TRUE, TRIGGER_VALUE_TRUE), $label);
            }
            if (zbx_strpos($label, '{TRIGGERS.ACK}') !== false) {
                $label = str_replace('{TRIGGERS.ACK}', get_triggers_unacknowledged($selement, null, true), $label);
            }
            if (zbx_strpos($label, '{TRIGGERS.PROBLEM.ACK}') !== false) {
                $label = str_replace('{TRIGGERS.PROBLEM.ACK}', get_triggers_unacknowledged($selement, true, true), $label);
            }
            if (zbx_strpos($label, '{TRIGGER.EVENTS.ACK}') !== false) {
                $label = str_replace('{TRIGGER.EVENTS.ACK}', get_events_unacknowledged($selement, null, null, true), $label);
            }
            if (zbx_strpos($label, '{TRIGGER.EVENTS.PROBLEM.ACK}') !== false) {
//.........这里部分代码省略.........
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:101,代码来源:maps.inc.php

示例6: checkPass

 public function checkPass($user, $pass)
 {
     // reject empty password
     if (empty($pass)) {
         return false;
     }
     if (!$this->connect()) {
         return false;
     }
     // indirect user bind
     if (!empty($this->cnf['bind_dn']) && !empty($this->cnf['bind_password'])) {
         // use superuser credentials
         if (!ldap_bind($this->ds, $this->cnf['bind_dn'], $this->cnf['bind_password'])) {
             error('LDAP: cannot bind by given Bind DN.');
             return false;
         }
         $this->bound = 2;
     } elseif (!empty($this->cnf['bind_dn']) && !empty($this->cnf['base_dn']) && !empty($this->cnf['userfilter'])) {
         // special bind string
         $dn = $this->makeFilter($this->cnf['bind_dn'], array('user' => $user, 'host' => $this->cnf['host']));
     } elseif (zbx_strpos($this->cnf['base_dn'], '%{user}')) {
         // direct user bind
         $dn = $this->makeFilter($this->cnf['base_dn'], array('user' => $user, 'host' => $this->cnf['host']));
     } else {
         // anonymous bind
         if (!ldap_bind($this->ds)) {
             error('LDAP: can not bind anonymously.');
             return false;
         }
     }
     // try to bind to with the dn if we have one.
     if (!empty($dn)) {
         // user/password bind
         if (!ldap_bind($this->ds, $dn, $pass)) {
             return false;
         }
         $this->bound = 1;
         return true;
     } else {
         // see if we can find the user
         $this->info = $this->getUserData($user);
         if (empty($this->info['dn'])) {
             return false;
         } else {
             $dn = $this->info['dn'];
         }
         // try to bind with the dn provided
         if (!ldap_bind($this->ds, $dn, $pass)) {
             return false;
         }
         $this->bound = 1;
         return true;
     }
     return false;
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:55,代码来源:class.cldap.php

示例7: expand_item_key_by_data

function expand_item_key_by_data($item)
{
    $key =& $item['key_'];
    $macStack = array();
    $macroses = array('{HOSTNAME}', '{IPADDRESS}', '{HOST.DNS}', '{HOST.CONN}');
    foreach ($macroses as $macro) {
        $pos = 0;
        while ($pos = zbx_strpos($key, $macro, $pos)) {
            $pos++;
            $macStack[] = $macro;
        }
    }
    if (!empty($macStack)) {
        $host = get_host_by_itemid($item['itemid']);
        foreach ($macStack as $macro) {
            switch ($macro) {
                case '{HOSTNAME}':
                    $key = str_replace('{HOSTNAME}', $host['host'], $key);
                    break;
                case '{IPADDRESS}':
                    $key = str_replace('{IPADDRESS}', $host['ip'], $key);
                    break;
                case '{HOST.DNS}':
                    $key = str_replace('{HOST.DNS}', $host['dns'], $key);
                    break;
                case '{HOST.CONN}':
                    $key = str_replace('{HOST.CONN}', $host['useip'] ? $host['ip'] : $host['dns'], $key);
                    break;
            }
        }
    }
    CUserMacro::resolveItem($item);
    return $item['key_'];
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:34,代码来源:items.inc.php

示例8: CDiv

    }
}
$itemFormList->addRow(_('Flexible intervals'), new CDiv($delayFlexTable, 'objectgroup inlineblock border_dotted ui-corner-all'), false, 'row_flex_intervals');
// append new flexible interval to form list
$newFlexInt = new CSpan(array(_('Interval (in sec)'), SPACE, new CNumericBox('new_delay_flex[delay]', $this->data['new_delay_flex']['delay'], 5, 'no', false, false), SPACE, _('Period'), SPACE, new CTextBox('new_delay_flex[period]', $this->data['new_delay_flex']['period'], 20), SPACE, new CButton('add_delay_flex', _('Add'), null, 'formlist')));
$newFlexInt->setAttribute('id', 'row-new-delay-flex-fields');
$maxFlexMsg = new CSpan(_('Maximum number of flexible intervals added'), 'red');
$maxFlexMsg->setAttribute('id', 'row-new-delay-flex-max-reached');
$maxFlexMsg->setAttribute('style', 'display: none;');
$itemFormList->addRow(_('New flexible interval'), array($newFlexInt, $maxFlexMsg), false, 'row_new_delay_flex', 'new');
if ($this->data['is_discovery_rule']) {
    $itemFormList->addRow(_('Keep lost resources period (in days)'), new CTextBox('lifetime', $this->data['lifetime'], ZBX_TEXTBOX_SMALL_SIZE, false, 64));
    // append filter to formlist
    if (!empty($this->data['filter'])) {
        // exploding filter to two parts: before first ':' and after
        $pos = zbx_strpos($this->data['filter'], ':');
        $filter_macro = zbx_substr($this->data['filter'], 0, $pos);
        $filter_value = zbx_substr($this->data['filter'], $pos + 1);
    } else {
        $filter_macro = '';
        $filter_value = '';
    }
    $itemFormList->addRow(_('Filter'), array(_('Macro'), SPACE, new CTextBox('filter_macro', $filter_macro, 13), SPACE, _('Regexp'), SPACE, new CTextBox('filter_value', $filter_value, 20)));
    $itemFormList->addRow(_('Allowed hosts'), new CTextBox('trapper_hosts', $this->data['trapper_hosts'], ZBX_TEXTBOX_STANDARD_SIZE), false, 'row_trapper_hosts');
} else {
    $dataConfig = select_config();
    $keepHistory = array();
    $keepHistory[] = new CNumericBox('history', $this->data['history'], 8);
    if ($dataConfig['hk_history_global'] && !$data['parent_discoveryid'] && !$data['is_template']) {
        $keepHistory[] = SPACE;
        if (CWebUser::getType() == USER_TYPE_SUPER_ADMIN) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:configuration.item.edit.php

示例9: validate_ip_range

function validate_ip_range($str)
{
    foreach (explode(',', $str) as $ip_range) {
        if (zbx_strpos($ip_range, '/') !== false) {
            if (!validate_ip_range_mask($ip_range)) {
                return false;
            }
        } else {
            if (!validate_ip_range_range($ip_range)) {
                return false;
            }
        }
    }
    return true;
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:15,代码来源:validate.inc.php

示例10: preg_replace

     $expr_v = preg_replace('/\\(\\(\\((.+?)\\)\\)$/i', '(($1)', $expr_v);
     $expression = splitByFirstLevel($expression);
     $expr_v = splitByFirstLevel($expr_v);
     foreach ($expression as $id => $expr) {
         $expr = preg_replace('/^\\((.*)\\)$/u', '$1', $expr);
         $value = preg_replace('/([=|#]0)/', '', $expr);
         $value = preg_replace('/^\\((.*)\\)$/u', '$1', $value);
         // removing wrapping parentheses
         $expressions[$id]['value'] = trim($value);
         $expressions[$id]['type'] = zbx_strpos($expr, '#0', zbx_strlen($expr) - 3) === false ? REGEXP_EXCLUDE : REGEXP_INCLUDE;
     }
     foreach ($expr_v as $id => $expr) {
         $expr = preg_replace('/^\\((.*)\\)$/u', '$1', $expr);
         $value = preg_replace('/\\((.*)\\)[=|#]0/U', '$1', $expr);
         $value = preg_replace('/^\\((.*)\\)$/u', '$1', $value);
         if (zbx_strpos($expr, '#0', zbx_strlen($expr) - 3) === false) {
             //REGEXP_EXCLUDE
             $value = str_replace('&', ' OR ', $value);
             $value = str_replace('|', ' AND ', $value);
         } else {
             //EGEXP_INCLUDE
             $value = str_replace('&', ' AND ', $value);
             $value = str_replace('|', ' OR ', $value);
         }
         $value = preg_replace($functionid, $functions, $value);
         $value = preg_replace('/([=|#]0)/', '', $value);
         $expressions[$id]['view'] = trim($value);
     }
 } else {
     $description = get_request('description', '');
     $expressions = get_request('expressions', array());
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:tr_logform.php

示例11: ldapLogin

 /**
  * Authenticate a user using LDAP.
  *
  * The $user array must have the following attributes:
  * - user       - user name
  * - password   - user password
  *
  * @param array $user
  *
  * @return bool
  */
 protected function ldapLogin(array $user)
 {
     $config = select_config();
     $cnf = array();
     foreach ($config as $id => $value) {
         if (zbx_strpos($id, 'ldap_') !== false) {
             $cnf[str_replace('ldap_', '', $id)] = $config[$id];
         }
     }
     if (!function_exists('ldap_connect')) {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Probably php-ldap module is missing.'));
     }
     $ldapValidator = new CLdapAuthValidator(array('conf' => $cnf));
     if ($ldapValidator->validate($user)) {
         return true;
     } else {
         self::exception(ZBX_API_ERROR_PARAMETERS, _('Login name or password is incorrect.'));
     }
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:30,代码来源:CUser.php

示例12: resolveMapLabelMacros

function resolveMapLabelMacros($label, $replaceHost = null)
{
    if (null === $replaceHost) {
        $pattern = "/{" . ZBX_PREG_HOST_FORMAT . ":.+\\.(last|max|min|avg)\\([0-9]+\\)}/Uu";
    } else {
        $pattern = "/{(" . ZBX_PREG_HOST_FORMAT . "|{HOSTNAME}):.+\\.(last|max|min|avg)\\([0-9]+\\)}/Uu";
    }
    preg_match_all($pattern, $label, $matches);
    foreach ($matches[0] as $expr) {
        $macro = $expr;
        if ($replaceHost !== null && zbx_strpos($macro, '{HOSTNAME}') == 1) {
            $macro = substr_replace($macro, $replaceHost, 1, 10);
        }
        $trigExpr = new CTriggerExpression(array('expression' => $macro));
        if (!empty($trigExpr->errors)) {
            continue;
        }
        $itemHost = reset($trigExpr->data['hosts']);
        $key = reset($trigExpr->data['items']);
        $function = reset($trigExpr->data['functions']);
        $parameter = reset($trigExpr->data['functionParams']);
        $item = CItem::get(array('filter' => array('host' => $itemHost, 'key_' => $key), 'output' => API_OUTPUT_EXTEND));
        $item = reset($item);
        if (!$item) {
            $label = str_replace($expr, '???', $label);
            continue;
        }
        switch ($item['value_type']) {
            case ITEM_VALUE_TYPE_FLOAT:
                $history_table = 'history';
                break;
            case ITEM_VALUE_TYPE_UINT64:
                $history_table = 'history_uint';
                break;
            case ITEM_VALUE_TYPE_TEXT:
                $history_table = 'history_text';
                break;
            case ITEM_VALUE_TYPE_LOG:
                $history_table = 'history_log';
                break;
            case ITEM_VALUE_TYPE_STR:
                $history_table = 'history_str';
                break;
            default:
                $history_table = 'history_str';
        }
        if (0 == strcmp($function, 'last')) {
            if (null === $item['lastvalue']) {
                $label = str_replace($expr, '(' . S_NO_DATA_SMALL . ')', $label);
            } else {
                switch ($item['value_type']) {
                    case ITEM_VALUE_TYPE_FLOAT:
                    case ITEM_VALUE_TYPE_UINT64:
                        $value = convert_units($item['lastvalue'], $item['units']);
                        break;
                    default:
                        $value = $item['lastvalue'];
                }
                $label = str_replace($expr, $value, $label);
            }
        } else {
            if (0 == strcmp($function, 'min') || 0 == strcmp($function, 'max') || 0 == strcmp($function, 'avg')) {
                if ($item['value_type'] != ITEM_VALUE_TYPE_FLOAT && $item['value_type'] != ITEM_VALUE_TYPE_UINT64) {
                    $label = str_replace($expr, '???', $label);
                    continue;
                }
                $sql = 'SELECT ' . $function . '(value) as value ' . ' FROM ' . $history_table . ' WHERE clock>' . (time() - $parameter) . ' AND itemid=' . $item['itemid'];
                $result = DBselect($sql);
                if (null === ($row = DBfetch($result)) || null === $row['value']) {
                    $label = str_replace($expr, '(' . S_NO_DATA_SMALL . ')', $label);
                } else {
                    $label = str_replace($expr, convert_units($row['value'], $item['units']), $label);
                }
            }
        }
    }
    return $label;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:78,代码来源:maps.inc.php

示例13: foreach

            if ($data['pageFilter']->groupid > 0) {
                $options['groupids'] = $data['pageFilter']->groupid;
            }
            $data['hosts'] = API::Host()->get($options);
            // copy some inventory fields to the uppers array level for sorting
            // and filter out hosts if we are using filter
            foreach ($data['hosts'] as $num => $host) {
                $data['hosts'][$num]['pr_name'] = $host['inventory']['name'];
                $data['hosts'][$num]['pr_type'] = $host['inventory']['type'];
                $data['hosts'][$num]['pr_os'] = $host['inventory']['os'];
                $data['hosts'][$num]['pr_serialno_a'] = $host['inventory']['serialno_a'];
                $data['hosts'][$num]['pr_tag'] = $host['inventory']['tag'];
                $data['hosts'][$num]['pr_macaddress_a'] = $host['inventory']['macaddress_a'];
                // if we are filtering by inventory field
                if (!empty($data['filterField']) && !empty($data['filterFieldValue'])) {
                    // must we filter exactly or using a substring (both are case insensitive)
                    $match = $data['filterExact'] ? zbx_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]) === zbx_strtolower($data['filterFieldValue']) : zbx_strpos(zbx_strtolower($data['hosts'][$num]['inventory'][$data['filterField']]), zbx_strtolower($data['filterFieldValue'])) !== false;
                    if (!$match) {
                        unset($data['hosts'][$num]);
                    }
                }
            }
            order_result($data['hosts'], getPageSortField('name'), getPageSortOrder());
        }
    }
    $data['paging'] = getPagingLine($data['hosts']);
    $hostinventoriesView = new CView('inventory.host.list', $data);
    $hostinventoriesView->render();
    $hostinventoriesView->show();
}
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:hostinventories.php

示例14: hide_form_items

function hide_form_items(&$obj)
{
    if (is_array($obj)) {
        foreach ($obj as $id => $item) {
            hide_form_items($obj[$id]);
            // attention recursion
        }
    } elseif (is_object($obj)) {
        $formObjects = array('cform', 'ccheckbox', 'cselect', 'cbutton', 'csubmit', 'cbuttonqmessage', 'cbuttondelete', 'cbuttoncancel');
        if (is_object($obj) && str_in_array(zbx_strtolower(get_class($obj)), $formObjects)) {
            $obj = SPACE;
        }
        if (isset($obj->items) && !empty($obj->items)) {
            foreach ($obj->items as $id => $item) {
                hide_form_items($obj->items[$id]);
                // attention recursion
            }
        }
    } else {
        foreach (array('<form', '<input', '<select') as $item) {
            if (zbx_strpos($obj, $item) !== false) {
                $obj = SPACE;
            }
        }
    }
}
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:26,代码来源:html.inc.php

示例15: get_request

        $itemtype = get_request('itemtype', 0);
        $cmbTypes = new CComboBox('itemtype', $itemtype, 'javascript: submit();');
        foreach ($allowed_item_types as $type) {
            $cmbTypes->addItem($type, item_type2str($type));
        }
        $frmTitle->addItem(array(_('Type'), SPACE, $cmbTypes));
    }
    if (str_in_array($srctbl, array('triggers', 'items', 'applications', 'graphs'))) {
        $frmTitle->addItem(array(SPACE, _('Host'), SPACE, $pageFilter->getHostsCB()));
    }
}
if (str_in_array($srctbl, array('applications', 'triggers'))) {
    if (zbx_empty($noempty)) {
        $value1 = isset($_REQUEST['dstfld1']) && zbx_strpos($_REQUEST['dstfld1'], 'id') !== false ? 0 : '';
        $value2 = isset($_REQUEST['dstfld2']) && zbx_strpos($_REQUEST['dstfld2'], 'id') !== false ? 0 : '';
        $value3 = isset($_REQUEST['dstfld3']) && zbx_strpos($_REQUEST['dstfld3'], 'id') !== false ? 0 : '';
        $epmtyScript = get_window_opener($dstfrm, $dstfld1, $value1);
        $epmtyScript .= get_window_opener($dstfrm, $dstfld2, $value2);
        $epmtyScript .= get_window_opener($dstfrm, $dstfld3, $value3);
        $epmtyScript .= ' close_window(); return false;';
        $frmTitle->addItem(array(SPACE, new CButton('empty', _('Empty'), $epmtyScript)));
    }
}
show_table_header($page['title'], $frmTitle);
insert_js_function('addSelectedValues');
insert_js_function('addValues');
insert_js_function('addValue');
/*
 * User group
 */
if ($srctbl == 'usrgrp') {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:popup.php


注:本文中的zbx_strpos函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。