• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP zbx_value2array函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getImageByIdent

function getImageByIdent($ident)
{
    zbx_value2array($ident);
    if (!isset($ident['name'])) {
        return 0;
    }
    static $images;
    if (is_null($images)) {
        $images = array();
        $dbImages = API::Image()->get(array('output' => array('imageid', 'name'), 'nodeids' => get_current_nodeid(true)));
        foreach ($dbImages as $image) {
            if (!isset($images[$image['name']])) {
                $images[$image['name']] = array();
            }
            $nodeName = get_node_name_by_elid($image['imageid'], true);
            if (!is_null($nodeName)) {
                $images[$image['name']][$nodeName] = $image;
            } else {
                $images[$image['name']][] = $image;
            }
        }
    }
    $ident['name'] = trim($ident['name'], ' ');
    if (!isset($images[$ident['name']])) {
        return 0;
    }
    $searchedImages = $images[$ident['name']];
    if (!isset($ident['node'])) {
        return reset($searchedImages);
    } elseif (isset($searchedImages[$ident['node']])) {
        return $searchedImages[$ident['node']];
    } else {
        return 0;
    }
}
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:35,代码来源:ident.inc.php


示例2: delete_script

function delete_script($scriptids)
{
    zbx_value2array($scriptids);
    $sql = 'DELETE FROM scripts WHERE ' . DBcondition('scriptid', $scriptids);
    $result = DBexecute($sql);
    return $result;
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:7,代码来源:scripts.inc.php


示例3: addHeader

 public function addHeader($header = null, $headerright = SPACE)
 {
     zbx_value2array($headerright);
     if (is_null($header) && !is_null($headerright)) {
         $header = SPACE;
     }
     $this->headers[] = array('left' => $header, 'right' => $headerright);
 }
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:8,代码来源:class.cwidget.php


示例4: setHeader

 /**
  * Sets the header and adds a default expand-collapse icon.
  *
  * @param string|array|CTag $caption
  * @param string|array|CTag $icons
  */
 public function setHeader($caption = null, $icons = SPACE)
 {
     zbx_value2array($icons);
     $icon = new CIcon(_('Show') . '/' . _('Hide'), $this->open ? 'arrowup' : 'arrowdown', 'changeWidgetState(this, "' . $this->id . '");');
     $icon->setAttribute('id', $this->id . '_icon');
     array_unshift($icons, $icon);
     parent::setHeader($caption, $icons);
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:14,代码来源:CCollapsibleUiWidget.php


示例5: get

 /**
  * Get GraphItems data
  *
  * @param array $options
  * @return array|boolean
  */
 public function get($options = array())
 {
     $result = array();
     $userType = self::$userData['type'];
     $userid = self::$userData['userid'];
     $sqlParts = array('select' => array('gitems' => 'gi.gitemid'), 'from' => array('graphs_items' => 'graphs_items gi'), 'where' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('graphids' => null, 'itemids' => null, 'type' => null, 'editable' => null, 'nopermissions' => null, 'selectGraphs' => null, 'output' => API_OUTPUT_EXTEND, 'expandData' => null, 'countOutput' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null);
     $options = zbx_array_merge($defOptions, $options);
     $this->checkDeprecatedParam($options, 'expandData');
     // editable + PERMISSION CHECK
     if ($userType != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) {
         $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ;
         $userGroups = getUserGroupsByUserId($userid);
         $sqlParts['where'][] = 'EXISTS (' . 'SELECT NULL' . ' FROM items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE gi.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY i.itemid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ' AND MAX(r.permission)>=' . zbx_dbstr($permission) . ')';
     }
     // graphids
     if (!is_null($options['graphids'])) {
         zbx_value2array($options['graphids']);
         $sqlParts['from']['graphs'] = 'graphs g';
         $sqlParts['where']['gig'] = 'gi.graphid=g.graphid';
         $sqlParts['where'][] = dbConditionInt('g.graphid', $options['graphids']);
     }
     // itemids
     if (!is_null($options['itemids'])) {
         zbx_value2array($options['itemids']);
         $sqlParts['where'][] = dbConditionInt('gi.itemid', $options['itemids']);
     }
     // type
     if (!is_null($options['type'])) {
         $sqlParts['where'][] = 'gi.type=' . zbx_dbstr($options['type']);
     }
     // limit
     if (zbx_ctype_digit($options['limit']) && $options['limit']) {
         $sqlParts['limit'] = $options['limit'];
     }
     $sqlParts = $this->applyQueryOutputOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts);
     $sqlParts = $this->applyQuerySortOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts);
     $dbRes = DBselect($this->createSelectQueryFromParts($sqlParts), $sqlParts['limit']);
     while ($gitem = DBfetch($dbRes)) {
         if (!is_null($options['countOutput'])) {
             $result = $gitem['rowscount'];
         } else {
             $result[$gitem['gitemid']] = $gitem;
         }
     }
     if (!is_null($options['countOutput'])) {
         return $result;
     }
     if ($result) {
         $result = $this->addRelatedObjects($options, $result);
         $result = $this->unsetExtraFields($result, array('graphid'), $options['output']);
     }
     // removing keys (hash -> array)
     if (is_null($options['preservekeys'])) {
         $result = zbx_cleanHashes($result);
     }
     return $result;
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:64,代码来源:CGraphItem.php


示例6: setHeader

 /**
  * Set widget header.
  *
  * @param string|array|CTag $caption
  * @param string|array|CTag $icons
  */
 public function setHeader($caption = null, $icons = SPACE)
 {
     zbx_value2array($icons);
     if ($caption === null && $icons !== null) {
         $caption = SPACE;
     }
     $this->header = new CDiv(null, 'nowrap ui-corner-all ui-widget-header header');
     $this->header->addItem(array($icons, $caption));
 }
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:15,代码来源:CUiWidget.php


示例7: get

 /**
  * Get IconMap data.
  * @param array $options
  * @param array $options['iconmapids']
  * @param array $options['sysmapids']
  * @param array $options['editable']
  * @param array $options['count']
  * @param array $options['limit']
  * @param array $options['order']
  * @return array
  */
 public function get(array $options = [])
 {
     $result = [];
     $sqlParts = ['select' => ['icon_map' => 'im.iconmapid'], 'from' => ['icon_map' => 'icon_map im'], 'where' => [], 'order' => [], 'limit' => null];
     $defOptions = ['iconmapids' => null, 'sysmapids' => null, 'nopermissions' => null, 'editable' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_EXTEND, 'selectMappings' => null, 'countOutput' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null];
     $options = zbx_array_merge($defOptions, $options);
     // editable + PERMISSION CHECK
     if ($options['editable'] && self::$userData['type'] != USER_TYPE_SUPER_ADMIN) {
         return [];
     }
     // iconmapids
     if (!is_null($options['iconmapids'])) {
         zbx_value2array($options['iconmapids']);
         $sqlParts['where'][] = dbConditionInt('im.iconmapid', $options['iconmapids']);
     }
     // sysmapids
     if (!is_null($options['sysmapids'])) {
         zbx_value2array($options['sysmapids']);
         $sqlParts['from']['sysmaps'] = 'sysmaps s';
         $sqlParts['where'][] = dbConditionInt('s.sysmapid', $options['sysmapids']);
         $sqlParts['where']['ims'] = 'im.iconmapid=s.iconmapid';
     }
     // filter
     if (is_array($options['filter'])) {
         $this->dbFilter('icon_map im', $options, $sqlParts);
     }
     // search
     if (is_array($options['search'])) {
         zbx_db_search('icon_map im', $options, $sqlParts);
     }
     // limit
     if (zbx_ctype_digit($options['limit']) && $options['limit']) {
         $sqlParts['limit'] = $options['limit'];
     }
     $sqlParts = $this->applyQueryOutputOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts);
     $sqlParts = $this->applyQuerySortOptions($this->tableName(), $this->tableAlias(), $options, $sqlParts);
     $dbRes = DBselect($this->createSelectQueryFromParts($sqlParts), $sqlParts['limit']);
     while ($iconMap = DBfetch($dbRes)) {
         if ($options['countOutput']) {
             $result = $iconMap['rowscount'];
         } else {
             $result[$iconMap['iconmapid']] = $iconMap;
         }
     }
     if (!is_null($options['countOutput'])) {
         return $result;
     }
     if ($result) {
         $result = $this->addRelatedObjects($options, $result);
     }
     // removing keys (hash -> array)
     if (is_null($options['preservekeys'])) {
         $result = zbx_cleanHashes($result);
     }
     return $result;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:67,代码来源:CIconMap.php


示例8: zbx_addJSLocale

function zbx_addJSLocale($to_translate)
{
    global $JS_TRANSLATE;
    zbx_value2array($to_translate);
    if (empty($JS_TRANSLATE)) {
        $JS_TRANSLATE = array();
    }
    foreach ($to_translate as $tnum => $string) {
        if (defined($string)) {
            $JS_TRANSLATE[$string] = constant($string);
        } else {
            $JS_TRANSLATE[$string] = 'UNTRANSLATED[' . $string . ']';
        }
    }
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:15,代码来源:js.inc.php


示例9: setHeader

 public function setHeader($caption = null, $icons = SPACE)
 {
     zbx_value2array($icons);
     if (is_null($caption) && !is_null($icons)) {
         $caption = SPACE;
     }
     $this->_header = new CDiv(null, 'nowrap ui-corner-all ui-widget-header ' . $this->css_class);
     if (!is_null($this->state)) {
         $icon = new CIcon(_('Show') . '/' . _('Hide'), $this->state ? 'arrowup' : 'arrowdown', "changeHatStateUI(this,'" . $this->domid . "');");
         $icon->setAttribute('id', $this->domid . '_icon');
         $this->_header->addItem($icon);
     }
     $this->_header->addItem($icons);
     $this->_header->addItem($caption);
     return $this->_header;
 }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:16,代码来源:class.cuiwidget.php


示例10: getImageByIdent

function getImageByIdent($ident)
{
    zbx_value2array($ident);
    if (!isset($ident['name'])) {
        return 0;
    }
    static $images;
    if ($images === null) {
        $images = array();
        $dbImages = API::Image()->get(array('output' => array('imageid', 'name')));
        foreach ($dbImages as $image) {
            if (!isset($images[$image['name']])) {
                $images[$image['name']] = array();
            }
            $images[$image['name']][] = $image;
        }
    }
    $ident['name'] = trim($ident['name'], ' ');
    return isset($images[$ident['name']]) ? reset($images[$ident['name']]) : 0;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:20,代码来源:ident.inc.php


示例11: get

 /**
  * Get GraphPrototype data
  *
  * @param array $options
  * @return array
  */
 public function get($options = array())
 {
     $result = array();
     $userType = self::$userData['type'];
     $userid = self::$userData['userid'];
     // allowed columns for sorting
     $sortColumns = array('graphid', 'name', 'graphtype');
     // allowed output options for [ select_* ] params
     $subselectsAllowedOutputs = array(API_OUTPUT_REFER, API_OUTPUT_EXTEND, API_OUTPUT_CUSTOM);
     $sqlParts = array('select' => array('graphs' => 'g.graphid'), 'from' => array('graphs' => 'graphs g'), 'where' => array('g.flags=' . ZBX_FLAG_DISCOVERY_CHILD), 'group' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('nodeids' => null, 'groupids' => null, 'templateids' => null, 'hostids' => null, 'graphids' => null, 'itemids' => null, 'discoveryids' => null, 'type' => null, 'templated' => null, 'inherited' => null, 'editable' => null, 'nopermissions' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_REFER, 'selectGroups' => null, 'selectTemplates' => null, 'selectHosts' => null, 'selectItems' => null, 'selectGraphItems' => null, 'selectDiscoveryRule' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null);
     $options = zbx_array_merge($defOptions, $options);
     if (is_array($options['output'])) {
         unset($sqlParts['select']['graphs']);
         $dbTable = DB::getSchema('graphs');
         foreach ($options['output'] as $field) {
             if (isset($dbTable['fields'][$field])) {
                 $sqlParts['select'][$field] = 'g.' . $field;
             }
         }
         $options['output'] = API_OUTPUT_CUSTOM;
     }
     // editable + PERMISSION CHECK
     if ($userType != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) {
         $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ_ONLY;
         $userGroups = getUserGroupsByUserId($userid);
         $sqlParts['where'][] = 'EXISTS (' . 'SELECT NULL' . ' FROM graphs_items gi,items i,hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE g.graphid=gi.graphid' . ' AND gi.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY gi.graphid' . ' HAVING MIN(r.permission)>=' . $permission . ')';
     }
     // nodeids
     $nodeids = !is_null($options['nodeids']) ? $options['nodeids'] : get_current_nodeid();
     // groupids
     if (!is_null($options['groupids'])) {
         zbx_value2array($options['groupids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['groupid'] = 'hg.groupid';
         }
         $sqlParts['from']['graphs_items'] = 'graphs_items gi';
         $sqlParts['from']['items'] = 'items i';
         $sqlParts['from']['hosts_groups'] = 'hosts_groups hg';
         $sqlParts['where'][] = dbConditionInt('hg.groupid', $options['groupids']);
         $sqlParts['where'][] = 'hg.hostid=i.hostid';
         $sqlParts['where']['gig'] = 'gi.graphid=g.graphid';
         $sqlParts['where']['igi'] = 'i.itemid=gi.itemid';
         $sqlParts['where']['hgi'] = 'hg.hostid=i.hostid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['hg'] = 'hg.groupid';
         }
     }
     // templateids
     if (!is_null($options['templateids'])) {
         zbx_value2array($options['templateids']);
         if (!is_null($options['hostids'])) {
             zbx_value2array($options['hostids']);
             $options['hostids'] = array_merge($options['hostids'], $options['templateids']);
         } else {
             $options['hostids'] = $options['templateids'];
         }
     }
     // hostids
     if (!is_null($options['hostids'])) {
         zbx_value2array($options['hostids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['hostid'] = 'i.hostid';
         }
         $sqlParts['from']['graphs_items'] = 'graphs_items gi';
         $sqlParts['from']['items'] = 'items i';
         $sqlParts['where'][] = dbConditionInt('i.hostid', $options['hostids']);
         $sqlParts['where']['gig'] = 'gi.graphid=g.graphid';
         $sqlParts['where']['igi'] = 'i.itemid=gi.itemid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['i'] = 'i.hostid';
         }
     }
     // graphids
     if (!is_null($options['graphids'])) {
         zbx_value2array($options['graphids']);
         $sqlParts['where'][] = dbConditionInt('g.graphid', $options['graphids']);
     }
     // itemids
     if (!is_null($options['itemids'])) {
         zbx_value2array($options['itemids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['itemid'] = 'gi.itemid';
         }
         $sqlParts['from']['graphs_items'] = 'graphs_items gi';
         $sqlParts['where']['gig'] = 'gi.graphid=g.graphid';
         $sqlParts['where'][] = dbConditionInt('gi.itemid', $options['itemids']);
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['gi'] = 'gi.itemid';
         }
     }
     // discoveryids
     if (!is_null($options['discoveryids'])) {
         zbx_value2array($options['discoveryids']);
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:CGraphPrototype.php


示例12: get

 /**
  * Get items data.
  *
  * @param array  $options
  * @param array  $options['itemids']
  * @param array  $options['hostids']
  * @param array  $options['groupids']
  * @param array  $options['triggerids']
  * @param array  $options['applicationids']
  * @param bool   $options['status']
  * @param bool   $options['templated_items']
  * @param bool   $options['editable']
  * @param bool   $options['count']
  * @param string $options['pattern']
  * @param int    $options['limit']
  * @param string $options['order']
  *
  * @return array|int item data as array or false if error
  */
 public function get($options = array())
 {
     $result = array();
     $userType = self::$userData['type'];
     $userid = self::$userData['userid'];
     $sqlParts = array('select' => array('items' => 'i.itemid'), 'from' => array('items' => 'items i'), 'where' => array('webtype' => 'i.type<>' . ITEM_TYPE_HTTPTEST, 'flags' => 'i.flags IN (' . ZBX_FLAG_DISCOVERY_NORMAL . ',' . ZBX_FLAG_DISCOVERY_CREATED . ')'), 'group' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('groupids' => null, 'templateids' => null, 'hostids' => null, 'proxyids' => null, 'itemids' => null, 'interfaceids' => null, 'graphids' => null, 'triggerids' => null, 'applicationids' => null, 'webitems' => null, 'inherited' => null, 'templated' => null, 'monitored' => null, 'editable' => null, 'nopermissions' => null, 'group' => null, 'host' => null, 'application' => null, 'with_triggers' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_EXTEND, 'selectHosts' => null, 'selectInterfaces' => null, 'selectTriggers' => null, 'selectGraphs' => null, 'selectApplications' => null, 'selectDiscoveryRule' => null, 'selectItemDiscovery' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null, 'limitSelects' => null);
     $options = zbx_array_merge($defOptions, $options);
     // editable + permission check
     if ($userType != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) {
         $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ;
         $userGroups = getUserGroupsByUserId($userid);
         $sqlParts['where'][] = 'EXISTS (' . 'SELECT NULL' . ' FROM hosts_groups hgg' . ' JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE i.hostid=hgg.hostid' . ' GROUP BY hgg.hostid' . ' HAVING MIN(r.permission)>' . PERM_DENY . ' AND MAX(r.permission)>=' . zbx_dbstr($permission) . ')';
     }
     // itemids
     if (!is_null($options['itemids'])) {
         zbx_value2array($options['itemids']);
         $sqlParts['where']['itemid'] = dbConditionInt('i.itemid', $options['itemids']);
     }
     // templateids
     if (!is_null($options['templateids'])) {
         zbx_value2array($options['templateids']);
         if (!is_null($options['hostids'])) {
             zbx_value2array($options['hostids']);
             $options['hostids'] = array_merge($options['hostids'], $options['templateids']);
         } else {
             $options['hostids'] = $options['templateids'];
         }
     }
     // hostids
     if (!is_null($options['hostids'])) {
         zbx_value2array($options['hostids']);
         $sqlParts['where']['hostid'] = dbConditionInt('i.hostid', $options['hostids']);
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['i'] = 'i.hostid';
         }
     }
     // interfaceids
     if (!is_null($options['interfaceids'])) {
         zbx_value2array($options['interfaceids']);
         $sqlParts['where']['interfaceid'] = dbConditionInt('i.interfaceid', $options['interfaceids']);
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['i'] = 'i.interfaceid';
         }
     }
     // groupids
     if (!is_null($options['groupids'])) {
         zbx_value2array($options['groupids']);
         $sqlParts['from']['hosts_groups'] = 'hosts_groups hg';
         $sqlParts['where'][] = dbConditionInt('hg.groupid', $options['groupids']);
         $sqlParts['where'][] = 'hg.hostid=i.hostid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['hg'] = 'hg.groupid';
         }
     }
     // proxyids
     if (!is_null($options['proxyids'])) {
         zbx_value2array($options['proxyids']);
         $sqlParts['from']['hosts'] = 'hosts h';
         $sqlParts['where'][] = dbConditionInt('h.proxy_hostid', $options['proxyids']);
         $sqlParts['where'][] = 'h.hostid=i.hostid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['h'] = 'h.proxy_hostid';
         }
     }
     // triggerids
     if (!is_null($options['triggerids'])) {
         zbx_value2array($options['triggerids']);
         $sqlParts['from']['functions'] = 'functions f';
         $sqlParts['where'][] = dbConditionInt('f.triggerid', $options['triggerids']);
         $sqlParts['where']['if'] = 'i.itemid=f.itemid';
     }
     // applicationids
     if (!is_null($options['applicationids'])) {
         zbx_value2array($options['applicationids']);
         $sqlParts['from']['items_applications'] = 'items_applications ia';
         $sqlParts['where'][] = dbConditionInt('ia.applicationid', $options['applicationids']);
         $sqlParts['where']['ia'] = 'ia.itemid=i.itemid';
     }
     // graphids
     if (!is_null($options['graphids'])) {
//.........这里部分代码省略.........
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:101,代码来源:CItem.php


示例13: delete_expression

function delete_expression($expressionids)
{
    zbx_value2array($expressionids);
    $sql = 'DELETE FROM expressions WHERE ' . DBcondition('expressionid', $expressionids);
    return DBexecute($sql);
}
开发者ID:rennhak,项目名称:zabbix,代码行数:6,代码来源:regexp.inc.php


示例14: getScriptsByHosts

 /**
  * Returns all the scripts that are available on each given host.
  *
  * @param $hostIds
  *
  * @return array (an array of scripts in the form of array($hostId => array($script1, $script2, ...), ...) )
  */
 public function getScriptsByHosts($hostIds)
 {
     zbx_value2array($hostIds);
     $scriptsByHost = array();
     if (!$hostIds) {
         return $scriptsByHost;
     }
     foreach ($hostIds as $hostId) {
         $scriptsByHost[$hostId] = array();
     }
     $scripts = $this->get(array('output' => API_OUTPUT_EXTEND, 'selectHosts' => array('hostid'), 'hostids' => $hostIds, 'sortfield' => 'name', 'preservekeys' => true));
     if ($scripts) {
         // resolve macros
         $macrosData = array();
         foreach ($scripts as $scriptId => $script) {
             if (!empty($script['confirmation'])) {
                 foreach ($script['hosts'] as $host) {
                     if (isset($scriptsByHost[$host['hostid']])) {
                         $macrosData[$host['hostid']][$scriptId] = $script['confirmation'];
                     }
                 }
             }
         }
         if ($macrosData) {
             $macrosData = CMacrosResolverHelper::resolve(array('config' => 'scriptConfirmation', 'data' => $macrosData));
         }
         foreach ($scripts as $scriptId => $script) {
             $hosts = $script['hosts'];
             unset($script['hosts']);
             // set script to host
             foreach ($hosts as $host) {
                 $hostId = $host['hostid'];
                 if (isset($scriptsByHost[$hostId])) {
                     $size = count($scriptsByHost[$hostId]);
                     $scriptsByHost[$hostId][$size] = $script;
                     // set confirmation text with resolved macros
                     if (isset($macrosData[$hostId][$scriptId]) && $script['confirmation']) {
                         $scriptsByHost[$hostId][$size]['confirmation'] = $macrosData[$hostId][$scriptId];
                     }
                 }
             }
         }
     }
     return $scriptsByHost;
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:52,代码来源:CScript.php


示例15: get

 /**
  * Get Service data
  *
  * @param _array $options
  * @param array $options['nodeids'] Node IDs
  * @param array $options['groupids'] ServiceGroup IDs
  * @param array $options['hostids'] Service IDs
  * @param boolean $options['monitored_hosts'] only monitored Services
  * @param boolean $options['templated_hosts'] include templates in result
  * @param boolean $options['with_items'] only with items
  * @param boolean $options['with_historical_items'] only with historical items
  * @param boolean $options['with_triggers'] only with triggers
  * @param boolean $options['with_httptests'] only with http tests
  * @param boolean $options['with_graphs'] only with graphs
  * @param boolean $options['editable'] only with read-write permission. Ignored for SuperAdmins
  * @param boolean $options['selectGroups'] select ServiceGroups
  * @param boolean $options['selectTemplates'] select Templates
  * @param boolean $options['selectItems'] select Items
  * @param boolean $options['selectTriggers'] select Triggers
  * @param boolean $options['selectGraphs'] select Graphs
  * @param boolean $options['selectApplications'] select Applications
  * @param boolean $options['selectMacros'] select Macros
  * @param int $options['count'] count Services, returned column name is rowscount
  * @param string $options['pattern'] search hosts by pattern in Service name
  * @param string $options['extendPattern'] search hosts by pattern in Service name, ip and DNS
  * @param int $options['limit'] limit selection
  * @param string $options['sortfield'] field to sort by
  * @param string $options['sortorder'] sort order
  * @return array|boolean Service data as array or false if error
  */
 public function get($options = array())
 {
     $result = array();
     $nodeCheck = false;
     $userType = self::$userData['type'];
     // allowed columns for sorting
     $sortColumns = array('dserviceid', 'dhostid', 'ip');
     // allowed output options for [ select_* ] params
     $subselectsAllowedOutputs = array(API_OUTPUT_REFER, API_OUTPUT_EXTEND, API_OUTPUT_CUSTOM);
     $sqlParts = array('select' => array('dservices' => 'ds.dserviceid'), 'from' => array('dservices' => 'dservices ds'), 'where' => array(), 'group' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('nodeids' => null, 'dserviceids' => null, 'dhostids' => null, 'dcheckids' => null, 'druleids' => null, 'editable' => null, 'nopermissions' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_REFER, 'selectDRules' => null, 'selectDHosts' => null, 'selectDChecks' => null, 'selectHosts' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null, 'limitSelects' => null);
     $options = zbx_array_merge($defOptions, $options);
     if (is_array($options['output'])) {
         unset($sqlParts['select']['dservices']);
         $dbTable = DB::getSchema('dservices');
         foreach ($options['output'] as $field) {
             if (isset($dbTable['fields'][$field])) {
                 $sqlParts['select'][$field] = 's.' . $field;
             }
         }
         $options['output'] = API_OUTPUT_CUSTOM;
     }
     // editable + PERMISSION CHECK
     if (USER_TYPE_SUPER_ADMIN == $userType) {
     } elseif (is_null($options['editable']) && self::$userData['type'] == USER_TYPE_ZABBIX_ADMIN) {
     } elseif (!is_null($options['editable']) && self::$userData['type'] != USER_TYPE_SUPER_ADMIN) {
         return array();
     }
     // nodeids
     $nodeids = !is_null($options['nodeids']) ? $options['nodeids'] : get_current_nodeid();
     // dserviceids
     if (!is_null($options['dserviceids'])) {
         zbx_value2array($options['dserviceids']);
         $sqlParts['where']['dserviceid'] = dbConditionInt('ds.dserviceid', $options['dserviceids']);
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sqlParts['where'][] = DBin_node('ds.dserviceid', $nodeids);
         }
     }
     // dhostids
     if (!is_null($options['dhostids'])) {
         zbx_value2array($options['dhostids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['dhostid'] = 'ds.dhostid';
         }
         $sqlParts['where'][] = dbConditionInt('ds.dhostid', $options['dhostids']);
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['dhostid'] = 'ds.dhostid';
         }
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sqlParts['where'][] = DBin_node('ds.dhostid', $nodeids);
         }
     }
     // dcheckids
     if (!is_null($options['dcheckids'])) {
         zbx_value2array($options['dcheckids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sqlParts['select']['dcheckid'] = 'dc.dcheckid';
         }
         $sqlParts['from']['dhosts'] = 'dhosts dh';
         $sqlParts['from']['dchecks'] = 'dchecks dc';
         $sqlParts['where'][] = dbConditionInt('dc.dcheckid', $options['dcheckids']);
         $sqlParts['where']['dhds'] = 'dh.hostid=ds.hostid';
         $sqlParts['where']['dcdh'] = 'dc.druleid=dh.druleid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['dcheckid'] = 'dc.dcheckid';
         }
     }
     // druleids
//.........这里部分代码省略.........
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:101,代码来源:CDService.php


示例16: get

 /**
  * Get history data
  *
  * {@source}
  * @access public
  * @static
  * @since 1.8.3
  * @version 1.3
  *
  * @param array $options
  * @param array $options['itemids']
  * @param boolean $options['editable']
  * @param string $options['pattern']
  * @param int $options['limit']
  * @param string $options['order']
  * @return array|int item data as array or false if error
  */
 public static function get($options = array())
 {
     global $USER_DETAILS;
     $nodeCheck = false;
     $result = array();
     $sort_columns = array('itemid', 'clock');
     // allowed columns for sorting
     $subselects_allowed_outputs = array(API_OUTPUT_REFER, API_OUTPUT_EXTEND);
     // allowed output options for [ select_* ] params
     $sql_parts = array('select' => array('history' => 'h.itemid'), 'from' => array(), 'where' => array(), 'group' => array(), 'order' => array(), 'limit' => null);
     $def_options = array('history' => ITEM_VALUE_TYPE_UINT64, 'nodeids' => null, 'hostids' => null, 'itemids' => null, 'triggerids' => null, 'editable' => null, 'nopermissions' => null, 'filter' => null, 'search' => null, 'startSearch' => null, 'excludeSearch' => null, 'time_from' => null, 'time_till' => null, 'output' => API_OUTPUT_REFER, 'countOutput' => null, 'groupCount' => null, 'groupOutput' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null);
     $options = zbx_array_merge($def_options, $options);
     switch ($options['history']) {
         case ITEM_VALUE_TYPE_LOG:
             $sql_parts['from']['history'] = 'history_log h';
             $sort_columns[] = 'id';
             break;
         case ITEM_VALUE_TYPE_TEXT:
             $sql_parts['from']['history'] = 'history_text h';
             $sort_columns[] = 'id';
             break;
         case ITEM_VALUE_TYPE_STR:
             $sql_parts['from']['history'] = 'history_str h';
             break;
         case ITEM_VALUE_TYPE_UINT64:
             $sql_parts['from']['history'] = 'history_uint h';
             break;
         case ITEM_VALUE_TYPE_FLOAT:
         default:
             $sql_parts['from']['history'] = 'history h';
     }
     // editable + PERMISSION CHECK
     if (USER_TYPE_SUPER_ADMIN == $USER_DETAILS['type'] || $options['nopermissions']) {
     } else {
         $itemOptions = array('editable' => $options['editable'], 'preservekeys' => 1);
         if (!is_null($options['itemids'])) {
             $itemOptions['itemids'] = $options['itemids'];
         }
         $items = CItem::get($itemOptions);
         $options['itemids'] = array_keys($items);
     }
     // nodeids
     $nodeids = !is_null($options['nodeids']) ? $options['nodeids'] : get_current_nodeid();
     // itemids
     if (!is_null($options['itemids'])) {
         zbx_value2array($options['itemids']);
         $sql_parts['where']['itemid'] = DBcondition('h.itemid', $options['itemids']);
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sql_parts['where'][] = DBin_node('h.itemid', $nodeids);
         }
     }
     // hostids
     if (!is_null($options['hostids'])) {
         zbx_value2array($options['hostids']);
         if ($options['output'] != API_OUTPUT_SHORTEN) {
             $sql_parts['select']['hostid'] = 'i.hostid';
         }
         $sql_parts['from']['items'] = 'items i';
         $sql_parts['where']['i'] = DBcondition('i.hostid', $options['hostids']);
         $sql_parts['where']['hi'] = 'h.itemid=i.itemid';
         if (!$nodeCheck) {
             $nodeCheck = true;
             $sql_parts['where'][] = DBin_node('i.hostid', $nodeids);
         }
     }
     // node check !!!!!
     // should be last, after all ****IDS checks
     if (!$nodeCheck) {
         $nodeCheck = true;
         $sql_parts['where'][] = DBin_node('h.itemid', $nodeids);
     }
     // time_from
     if (!is_null($options['time_from'])) {
         $sql_parts['select']['clock'] = 'h.clock';
         $sql_parts['where']['clock_from'] = 'h.clock>=' . $options['time_from'];
     }
     // time_till
     if (!is_null($options['time_till'])) {
         $sql_parts['select']['clock'] = 'h.clock';
         $sql_parts['where']['clock_till'] = 'h.clock<=' . $options['time_till'];
     }
     // filter
//.........这里部分代码省略.........
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:101,代码来源:class.chistory.php


示例17: dbFilter

 /**
  * Apply filter conditions to sql built query.
  *
  * @param string $table
  * @param array  $options
  * @param array  $sqlParts
  *
  * @return bool
  */
 protected function dbFilter($table, $options, &$sqlParts)
 {
     list($table, $tableShort) = explode(' ', $table);
     $tableSchema = DB::getSchema($table);
     $filter = [];
     foreach ($options['filter'] as $field => $value) {
         // skip missing fields and text fields (not supported by Oracle)
         // skip empty values
         if (!isset($tableSchema['fields'][$field]) || $tableSchema['fields'][$field]['type'] == DB::FIELD_TYPE_TEXT || zbx_empty($value)) {
             continue;
         }
         zbx_value2array($value);
         $fieldName = $this->fieldId($field, $tableShort);
         $filter[$field] = DB::isNumericFieldType($tableSchema['fields'][$field]['type']) ? dbConditionInt($fieldName, $value) : dbConditionString($fieldName, $value);
     }
     if ($filter) {
         if (isset($sqlParts['where']['filter'])) {
             $filter[] = $sqlParts['where']['filter'];
         }
         if (is_null($options['searchByAny']) || $options['searchByAny'] === false || count($filter) == 1) {
             $sqlParts['where']['filter'] = implode(' AND ', $filter);
         } else {
             $sqlParts['where']['filter'] = '(' . implode(' OR ', $filter) . ')';
         }
         return true;
     }
     return false;
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:37,代码来源:CApiService.php


示例18: get

 /**
  * Get GraphPrototype data
  *
  * @param array $options
  * @return array
  */
 public function get($options = array())
 {
     $result = array();
     $userType = self::$userData['type'];
     $userid = self::$userData['userid'];
     $sqlParts = array('select' => array('graphs' => 'g.graphid'), 'from' => array('graphs' => 'graphs g'), 'where' => array('g.flags=' . ZBX_FLAG_DISCOVERY_PROTOTYPE), 'group' => array(), 'order' => array(), 'limit' => null);
     $defOptions = array('groupids' => null, 'templateids' => null, 'hostids' => null, 'graphids' => null, 'itemids' => null, 'discoveryids' => null, 'templated' => null, 'inherited' => null, 'editable' => null, 'nopermissions' => null, 'filter' => null, 'search' => null, 'searchByAny' => null, 'startSearch' => null, 'excludeSearch' => null, 'searchWildcardsEnabled' => null, 'output' => API_OUTPUT_EXTEND, 'selectGroups' => null, 'selectTemplates' => null, 'selectHosts' => null, 'selectItems' => null, 'selectGraphItems' => null, 'selectDiscoveryRule' => null, 'countOutput' => null, 'groupCount' => null, 'preservekeys' => null, 'sortfield' => '', 'sortorder' => '', 'limit' => null);
     $options = zbx_array_merge($defOptions, $options);
     // editable + PERMISSION CHECK
     if ($userType != USER_TYPE_SUPER_ADMIN && !$options['nopermissions']) {
         $permission = $options['editable'] ? PERM_READ_WRITE : PERM_READ;
         $userGroups = getUserGroupsByUserId($userid);
         // check permissions by graph items
         $sqlParts['where'][] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM graphs_items gi,items i,hosts_groups hgg' . ' LEFT JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE g.graphid=gi.graphid' . ' AND gi.itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY i.hostid' . ' HAVING MAX(permission)<' . zbx_dbstr($permission) . ' OR MIN(permission) IS NULL' . ' OR MIN(permission)=' . PERM_DENY . ')';
         // check permissions by Y min item
         $sqlParts['where'][] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM items i,hosts_groups hgg' . ' LEFT JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE g.ymin_type=' . GRAPH_YAXIS_TYPE_ITEM_VALUE . ' AND g.ymin_itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY i.hostid' . ' HAVING MAX(permission)<' . $permission . ' OR MIN(permission) IS NULL' . ' OR MIN(permission)=' . PERM_DENY . ')';
         // check permissions by Y max item
         $sqlParts['where'][] = 'NOT EXISTS (' . 'SELECT NULL' . ' FROM items i,hosts_groups hgg' . ' LEFT JOIN rights r' . ' ON r.id=hgg.groupid' . ' AND ' . dbConditionInt('r.groupid', $userGroups) . ' WHERE g.ymax_type=' . GRAPH_YAXIS_TYPE_ITEM_VALUE . ' AND g.ymax_itemid=i.itemid' . ' AND i.hostid=hgg.hostid' . ' GROUP BY i.hostid' . ' HAVING MAX(permission)<' . $permission . ' OR MIN(permission) IS NULL' . ' OR MIN(permission)=' . PERM_DENY . ')';
     }
     // groupids
     if (!is_null($options['groupids'])) {
         zbx_value2array($options['groupids']);
         $sqlParts['from']['graphs_items'] = 'graphs_items gi';
         $sqlParts['from']['items'] = 'items i';
         $sqlParts['from']['hosts_groups'] = 'hosts_groups hg';
         $sqlParts['where'][] = dbConditionInt('hg.groupid', $options['groupids']);
         $sqlParts['where'][] = 'hg.hostid=i.hostid';
         $sqlParts['where']['gig'] = 'gi.graphid=g.graphid';
         $sqlParts['where']['igi'] = 'i.itemid=gi.itemid';
         $sqlParts['where']['hgi'] = 'hg.hostid=i.hostid';
         if (!is_null($options['groupCount'])) {
             $sqlParts['group']['hg'] = 'hg.groupid';
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP zcInstallAddSID函数代码示例发布时间:2022-05-23
下一篇:
PHP zbx_toObject函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap