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


PHP CArrayHelper::unsetEqualValues方法代码示例

本文整理汇总了PHP中CArrayHelper::unsetEqualValues方法的典型用法代码示例。如果您正苦于以下问题:PHP CArrayHelper::unsetEqualValues方法的具体用法?PHP CArrayHelper::unsetEqualValues怎么用?PHP CArrayHelper::unsetEqualValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CArrayHelper的用法示例。


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

示例1: get_request

    $ifm = get_request('filter_macro');
    $ifv = get_request('filter_value');
    $filter = isset($ifm, $ifv) ? $ifm . ':' . $ifv : '';
    $item = array('interfaceid' => get_request('interfaceid'), 'name' => get_request('name'), 'description' => get_request('description'), 'key_' => get_request('key'), 'hostid' => get_request('hostid'), 'delay' => get_request('delay'), 'status' => get_request('status', ITEM_STATUS_DISABLED), 'type' => get_request('type'), 'snmp_community' => get_request('snmp_community'), 'snmp_oid' => get_request('snmp_oid'), 'trapper_hosts' => get_request('trapper_hosts'), 'port' => get_request('port'), 'snmpv3_contextname' => get_request('snmpv3_contextname'), 'snmpv3_securityname' => get_request('snmpv3_securityname'), 'snmpv3_securitylevel' => get_request('snmpv3_securitylevel'), 'snmpv3_authprotocol' => get_request('snmpv3_authprotocol'), 'snmpv3_authpassphrase' => get_request('snmpv3_authpassphrase'), 'snmpv3_privprotocol' => get_request('snmpv3_privprotocol'), 'snmpv3_privpassphrase' => get_request('snmpv3_privpassphrase'), 'delay_flex' => $db_delay_flex, 'authtype' => get_request('authtype'), 'username' => get_request('username'), 'password' => get_request('password'), 'publickey' => get_request('publickey'), 'privatekey' => get_request('privatekey'), 'params' => get_request('params'), 'ipmi_sensor' => get_request('ipmi_sensor'), 'lifetime' => get_request('lifetime'), 'filter' => $filter);
    if (hasRequest('itemid')) {
        $itemId = getRequest('itemid');
        DBstart();
        $dbItem = get_item_by_itemid_limited($itemId);
        // unset snmpv3 fields
        if ($item['snmpv3_securitylevel'] == ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV) {
            $item['snmpv3_authprotocol'] = ITEM_AUTHPROTOCOL_MD5;
            $item['snmpv3_privprotocol'] = ITEM_PRIVPROTOCOL_DES;
        } elseif ($item['snmpv3_securitylevel'] == ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV) {
            $item['snmpv3_privprotocol'] = ITEM_PRIVPROTOCOL_DES;
        }
        $item = CArrayHelper::unsetEqualValues($item, $dbItem);
        $item['itemid'] = $itemId;
        $result = API::DiscoveryRule()->update($item);
        $result = DBend($result);
        show_messages($result, _('Discovery rule updated'), _('Cannot update discovery rule'));
    } else {
        $result = API::DiscoveryRule()->create(array($item));
        show_messages($result, _('Discovery rule created'), _('Cannot add discovery rule'));
    }
    if ($result) {
        unset($_REQUEST['itemid'], $_REQUEST['form']);
        clearCookies($result, $_REQUEST['hostid']);
    }
} elseif (str_in_array(getRequest('go'), array('activate', 'disable')) && hasRequest('g_hostdruleid')) {
    $groupHostDiscoveryRuleId = getRequest('g_hostdruleid');
    $enable = getRequest('go') == 'activate';
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:host_discovery.php

示例2: foreach

         // unset unchanged values
         $newItem = CArrayHelper::unsetEqualValues($newItem, $item, ['itemid']);
         // don't update the filter if it hasn't changed
         $conditionsChanged = false;
         if (count($newItem['filter']['conditions']) != count($item['filter']['conditions'])) {
             $conditionsChanged = true;
         } else {
             $conditions = $item['filter']['conditions'];
             foreach ($newItem['filter']['conditions'] as $i => $condition) {
                 if (CArrayHelper::unsetEqualValues($condition, $conditions[$i])) {
                     $conditionsChanged = true;
                     break;
                 }
             }
         }
         $filter = CArrayHelper::unsetEqualValues($newItem['filter'], $item['filter']);
         if (!isset($filter['evaltype']) && !isset($filter['formula']) && !$conditionsChanged) {
             unset($newItem['filter']);
         }
         $result = API::DiscoveryRule()->update($newItem);
         $result = DBend($result);
     } else {
         $result = API::DiscoveryRule()->create([$newItem]);
     }
 }
 if (hasRequest('add')) {
     show_messages($result, _('Discovery rule created'), _('Cannot add discovery rule'));
 } else {
     show_messages($result, _('Discovery rule updated'), _('Cannot update discovery rule'));
 }
 if ($result) {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:host_discovery.php

示例3: getRequest

     $newHostPrototype['hostid'] = getRequest('hostid');
     if (!$hostPrototype['templateid']) {
         // add group prototypes based on existing host groups
         $groupPrototypesByGroupId = zbx_toHash($hostPrototype['groupLinks'], 'groupid');
         unset($groupPrototypesByGroupId[0]);
         foreach (getRequest('group_links', array()) as $groupId) {
             if (isset($groupPrototypesByGroupId[$groupId])) {
                 $newHostPrototype['groupLinks'][] = array('groupid' => $groupPrototypesByGroupId[$groupId]['groupid'], 'group_prototypeid' => $groupPrototypesByGroupId[$groupId]['group_prototypeid']);
             } else {
                 $newHostPrototype['groupLinks'][] = array('groupid' => $groupId);
             }
         }
     } else {
         unset($newHostPrototype['groupPrototypes'], $newHostPrototype['groupLinks']);
     }
     $newHostPrototype = CArrayHelper::unsetEqualValues($newHostPrototype, $hostPrototype, array('hostid'));
     $result = API::HostPrototype()->update($newHostPrototype);
     show_messages($result, _('Host prototype updated'), _('Cannot update host prototype'));
 } else {
     $newHostPrototype['ruleid'] = getRequest('parent_discoveryid');
     // add group prototypes based on existing host groups
     foreach (getRequest('group_links', array()) as $groupId) {
         $newHostPrototype['groupLinks'][] = array('groupid' => $groupId);
     }
     $result = API::HostPrototype()->create($newHostPrototype);
     show_messages($result, _('Host prototype added'), _('Cannot add host prototype'));
 }
 $result = DBend($result);
 if ($result) {
     uncheckTableRows($discoveryRule['itemid']);
     unset($_REQUEST['itemid'], $_REQUEST['form']);
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:host_prototypes.php

示例4: reset

 if ($_REQUEST['authentication'] != HTTPTEST_AUTH_NONE) {
     $httpTest['http_user'] = $_REQUEST['http_user'];
     $httpTest['http_password'] = $_REQUEST['http_password'];
 } else {
     $httpTest['http_user'] = '';
     $httpTest['http_password'] = '';
 }
 if (isset($_REQUEST['httptestid'])) {
     // unset fields that did not change
     $dbHttpTest = API::HttpTest()->get(array('httptestids' => $_REQUEST['httptestid'], 'output' => API_OUTPUT_EXTEND, 'selectSteps' => API_OUTPUT_EXTEND));
     $dbHttpTest = reset($dbHttpTest);
     $dbHttpSteps = zbx_toHash($dbHttpTest['steps'], 'httpstepid');
     $httpTest = CArrayHelper::unsetEqualValues($httpTest, $dbHttpTest, array('applicationid'));
     foreach ($httpTest['steps'] as $snum => $step) {
         if (isset($step['httpstepid']) && isset($dbHttpSteps[$step['httpstepid']])) {
             $newStep = CArrayHelper::unsetEqualValues($step, $dbHttpSteps[$step['httpstepid']], array('httpstepid'));
             $httpTest['steps'][$snum] = $newStep;
         }
     }
     $httpTest['httptestid'] = $httpTestId = $_REQUEST['httptestid'];
     $result = API::HttpTest()->update($httpTest);
     if (!$result) {
         throw new Exception();
     } else {
         uncheckTableRows(getRequest('hostid'));
     }
 } else {
     $result = API::HttpTest()->create($httpTest);
     if (!$result) {
         throw new Exception();
     } else {
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:httpconf.php

示例5: getRequest

     $newHostPrototype['hostid'] = getRequest('hostid');
     if (!$hostPrototype['templateid']) {
         // add group prototypes based on existing host groups
         $groupPrototypesByGroupId = zbx_toHash($hostPrototype['groupLinks'], 'groupid');
         unset($groupPrototypesByGroupId[0]);
         foreach (getRequest('group_links', []) as $groupId) {
             if (isset($groupPrototypesByGroupId[$groupId])) {
                 $newHostPrototype['groupLinks'][] = ['groupid' => $groupPrototypesByGroupId[$groupId]['groupid'], 'group_prototypeid' => $groupPrototypesByGroupId[$groupId]['group_prototypeid']];
             } else {
                 $newHostPrototype['groupLinks'][] = ['groupid' => $groupId];
             }
         }
     } else {
         unset($newHostPrototype['groupPrototypes'], $newHostPrototype['groupLinks']);
     }
     $newHostPrototype = CArrayHelper::unsetEqualValues($newHostPrototype, $hostPrototype, ['hostid']);
     $result = API::HostPrototype()->update($newHostPrototype);
     show_messages($result, _('Host prototype updated'), _('Cannot update host prototype'));
 } else {
     $newHostPrototype['ruleid'] = getRequest('parent_discoveryid');
     // add group prototypes based on existing host groups
     foreach (getRequest('group_links', []) as $groupId) {
         $newHostPrototype['groupLinks'][] = ['groupid' => $groupId];
     }
     $result = API::HostPrototype()->create($newHostPrototype);
     show_messages($result, _('Host prototype added'), _('Cannot add host prototype'));
 }
 $result = DBend($result);
 if ($result) {
     uncheckTableRows($discoveryRule['itemid']);
     unset($_REQUEST['itemid'], $_REQUEST['form']);
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:host_prototypes.php


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